mirror of
https://github.com/theniceboy/.config.git
synced 2026-05-11 00:55:56 +08:00
updated yazi plugins
This commit is contained in:
parent
6227a7d090
commit
f4d802a03d
8 changed files with 82 additions and 14 deletions
|
|
@ -1,5 +1,5 @@
|
|||
[plugin]
|
||||
deps = [{ use = "llanosrocas/yaziline", rev = "5886330" }, { use = "Rolv-Apneseth/starship", rev = "247f49d" }, { use = "yazi-rs/plugins:git", rev = "ec97f88" }]
|
||||
deps = [{ use = "llanosrocas/yaziline", rev = "5886330" }, { use = "Rolv-Apneseth/starship", rev = "247f49d" }, { use = "yazi-rs/plugins:git", rev = "ec97f88" }, { use = "yazi-rs/plugins:smart-enter", rev = "7afba3a" }, { use = "h-hg/yamb", rev = "108347b" }]
|
||||
|
||||
[flavor]
|
||||
deps = []
|
||||
|
|
|
|||
21
yazi/plugins/smart-enter.yazi/LICENSE
Normal file
21
yazi/plugins/smart-enter.yazi/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 yazi-rs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
40
yazi/plugins/smart-enter.yazi/README.md
Normal file
40
yazi/plugins/smart-enter.yazi/README.md
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# smart-enter.yazi
|
||||
|
||||
[`Open`][open] files or [`enter`][enter] directories all in one key!
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:smart-enter
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Bind your <kbd>l</kbd> key to the plugin, in your `~/.config/yazi/keymap.toml`:
|
||||
|
||||
```toml
|
||||
[[manager.prepend_keymap]]
|
||||
on = "l"
|
||||
run = "plugin smart-enter"
|
||||
desc = "Enter the child directory, or open the file"
|
||||
```
|
||||
|
||||
## Advanced
|
||||
|
||||
By default, `--hovered` is passed to the [`open`][open] command, make the behavior consistent with [`enter`][enter] avoiding accidental triggers,
|
||||
which means both will only target the currently hovered file.
|
||||
|
||||
If you still want `open` to target multiple selected files, add this to your `~/.config/yazi/init.lua`:
|
||||
|
||||
```lua
|
||||
require("smart-enter"):setup {
|
||||
open_multi = true,
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||
|
||||
[open]: https://yazi-rs.github.io/docs/configuration/keymap/#manager.open
|
||||
[enter]: https://yazi-rs.github.io/docs/configuration/keymap/#manager.enter
|
||||
1
yazi/plugins/yamb.yazi/.gitattributes
vendored
1
yazi/plugins/yamb.yazi/.gitattributes
vendored
|
|
@ -1 +0,0 @@
|
|||
* text=auto eol=lf
|
||||
|
|
@ -18,6 +18,9 @@ git clone https://github.com/h-hg/yamb.yazi.git ~/.config/yazi/plugins/yamb.yazi
|
|||
|
||||
# Windows
|
||||
git clone https://github.com/h-hg/yamb.yazi.git $env:APPDATA\yazi\config\plugins\yamb.yazi
|
||||
|
||||
# if you are using Yazi version >= 3.0
|
||||
ya pack -a h-hg/yamb
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
@ -52,6 +55,8 @@ table.insert(bookmarks, {
|
|||
require("yamb"):setup {
|
||||
-- Optional, the path ending with path seperator represents folder.
|
||||
bookmarks = bookmarks,
|
||||
-- Optional, recieve notification everytime you jump.
|
||||
jump_notify = true,
|
||||
-- Optional, the cli of fzf.
|
||||
cli = "fzf",
|
||||
-- Optional, a string used for randomly generating keys, where the preceding characters have higher priority.
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ local which_find = function(bookmarks)
|
|||
return cands[idx].path
|
||||
end
|
||||
|
||||
local action_jump = function(bookmarks, path)
|
||||
local action_jump = function(bookmarks, path, jump_notify)
|
||||
if path == nil then
|
||||
return
|
||||
end
|
||||
|
|
@ -112,12 +112,14 @@ local action_jump = function(bookmarks, path)
|
|||
else
|
||||
ya.manager_emit("reveal", { path })
|
||||
end
|
||||
ya.notify {
|
||||
title = "Bookmarks",
|
||||
content = 'Jump to "' .. tag .. '"',
|
||||
timeout = 2,
|
||||
level = "info",
|
||||
}
|
||||
if jump_notify then
|
||||
ya.notify {
|
||||
title = "Bookmarks",
|
||||
content = 'Jump to "' .. tag .. '"',
|
||||
timeout = 2,
|
||||
level = "info",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local generate_key = function(bookmarks)
|
||||
|
|
@ -294,6 +296,7 @@ return {
|
|||
(ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark") or
|
||||
(os.getenv("HOME") .. "/.config/yazi/bookmark")
|
||||
state.cli = options.cli or "fzf"
|
||||
state.jump_notify = options.jump_notify and true
|
||||
-- init the keys
|
||||
local keys = options.keys or "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
state.keys = {}
|
||||
|
|
@ -325,12 +328,12 @@ return {
|
|||
save_to_file(state.path, bookmarks)
|
||||
state.bookmarks = bookmarks
|
||||
end,
|
||||
entry = function(self, args)
|
||||
local action = args[1]
|
||||
entry = function(self, jobs)
|
||||
local action = jobs.args[1]
|
||||
if not action then
|
||||
return
|
||||
end
|
||||
local mb_path, cli, bookmarks = get_state_attr("path"), get_state_attr("cli"), get_state_attr("bookmarks")
|
||||
local mb_path, cli, bookmarks, jump_notify = get_state_attr("path"), get_state_attr("cli"), get_state_attr("bookmarks"), get_state_attr("jump_notify")
|
||||
if action == "save" then
|
||||
action_save(mb_path, bookmarks, get_hovered_path())
|
||||
elseif action == "delete_by_key" then
|
||||
|
|
@ -340,9 +343,9 @@ return {
|
|||
elseif action == "delete_all" then
|
||||
action_delete_all(mb_path)
|
||||
elseif action == "jump_by_key" then
|
||||
action_jump(bookmarks, which_find(bookmarks))
|
||||
action_jump(bookmarks, which_find(bookmarks), jump_notify)
|
||||
elseif action == "jump_by_fzf" then
|
||||
action_jump(bookmarks, fzf_find(cli, mb_path))
|
||||
action_jump(bookmarks, fzf_find(cli, mb_path), jump_notify)
|
||||
elseif action == "rename_by_key" then
|
||||
action_save(mb_path, bookmarks, which_find(bookmarks))
|
||||
elseif action == "rename_by_fzf" then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue