mirror of
https://github.com/Ascyii/projects.yazi.git
synced 2026-01-01 03:24:24 -05:00
refactor: migrate to yazi v25.2.7
This commit is contained in:
16
README.md
16
README.md
@@ -38,37 +38,37 @@ Add this to your `keymap.toml`:
|
|||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "s" ]
|
on = [ "P", "s" ]
|
||||||
run = "plugin projects --args=save"
|
run = "plugin projects save"
|
||||||
desc = "Save current project"
|
desc = "Save current project"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "l" ]
|
on = [ "P", "l" ]
|
||||||
run = "plugin projects --args=load"
|
run = "plugin projects load"
|
||||||
desc = "Load project"
|
desc = "Load project"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "P" ]
|
on = [ "P", "P" ]
|
||||||
run = "plugin projects --args=load_last"
|
run = "plugin projects load_last"
|
||||||
desc = "Load last project"
|
desc = "Load last project"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "d" ]
|
on = [ "P", "d" ]
|
||||||
run = "plugin projects --args=delete"
|
run = "plugin projects delete"
|
||||||
desc = "Delete project"
|
desc = "Delete project"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "D" ]
|
on = [ "P", "D" ]
|
||||||
run = "plugin projects --args=delete_all"
|
run = "plugin projects delete_all"
|
||||||
desc = "Delete all projects"
|
desc = "Delete all projects"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "m" ]
|
on = [ "P", "m" ]
|
||||||
run = "plugin projects --args='merge current'"
|
run = "plugin projects 'merge current'"
|
||||||
desc = "Merge current tab to other projects"
|
desc = "Merge current tab to other projects"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "P", "M" ]
|
on = [ "P", "M" ]
|
||||||
run = "plugin projects --args='merge all'"
|
run = "plugin projects 'merge all'"
|
||||||
desc = "Merge current project to other projects"
|
desc = "Merge current project to other projects"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ If you want to save the last project when exiting, map the default `quit` key to
|
|||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "q" ]
|
on = [ "q" ]
|
||||||
run = "plugin projects --args=quit"
|
run = "plugin projects quit"
|
||||||
desc = "Save last project and exit the process"
|
desc = "Save last project and exit the process"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -514,17 +514,17 @@ local SUPPORTED_KEYS = {
|
|||||||
{ on = "z" },
|
{ on = "z" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local _load_config = ya.sync(function(state, args)
|
local _load_config = ya.sync(function(state, opts)
|
||||||
state.save = {
|
state.save = {
|
||||||
method = "yazi",
|
method = "yazi",
|
||||||
lua_save_path = "",
|
lua_save_path = "",
|
||||||
}
|
}
|
||||||
if type(args.save) == "table" then
|
if type(opts.save) == "table" then
|
||||||
if type(args.save.method) == "string" then
|
if type(opts.save.method) == "string" then
|
||||||
state.save.method = args.save.method
|
state.save.method = opts.save.method
|
||||||
end
|
end
|
||||||
if type(args.save.lua_save_path) == "string" then
|
if type(opts.save.lua_save_path) == "string" then
|
||||||
state.save.lua_save_path = args.save.lua_save_path
|
state.save.lua_save_path = opts.save.lua_save_path
|
||||||
else
|
else
|
||||||
local lua_save_path
|
local lua_save_path
|
||||||
local appdata = os.getenv("APPDATA")
|
local appdata = os.getenv("APPDATA")
|
||||||
@@ -543,24 +543,24 @@ local _load_config = ya.sync(function(state, args)
|
|||||||
update_after_load = true,
|
update_after_load = true,
|
||||||
load_after_start = false,
|
load_after_start = false,
|
||||||
}
|
}
|
||||||
if type(args.last) == "table" then
|
if type(opts.last) == "table" then
|
||||||
if type(args.last.update_after_save) == "boolean" then
|
if type(opts.last.update_after_save) == "boolean" then
|
||||||
state.last.update_after_save = args.last.update_after_save
|
state.last.update_after_save = opts.last.update_after_save
|
||||||
end
|
end
|
||||||
if type(args.last.update_after_load) == "boolean" then
|
if type(opts.last.update_after_load) == "boolean" then
|
||||||
state.last.update_after_load = args.last.update_after_load
|
state.last.update_after_load = opts.last.update_after_load
|
||||||
end
|
end
|
||||||
if type(args.last.load_after_start) == "boolean" then
|
if type(opts.last.load_after_start) == "boolean" then
|
||||||
state.last.load_after_start = args.last.load_after_start
|
state.last.load_after_start = opts.last.load_after_start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
state.merge = {
|
state.merge = {
|
||||||
quit_after_merge = false,
|
quit_after_merge = false,
|
||||||
}
|
}
|
||||||
if type(args.merge) == "table" then
|
if type(opts.merge) == "table" then
|
||||||
if type(args.merge.quit_after_merge) == "boolean" then
|
if type(opts.merge.quit_after_merge) == "boolean" then
|
||||||
state.merge.quit_after_merge = args.merge.quit_after_merge
|
state.merge.quit_after_merge = opts.merge.quit_after_merge
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -570,18 +570,18 @@ local _load_config = ya.sync(function(state, args)
|
|||||||
timeout = 3,
|
timeout = 3,
|
||||||
level = "info",
|
level = "info",
|
||||||
}
|
}
|
||||||
if type(args.notify) == "table" then
|
if type(opts.notify) == "table" then
|
||||||
if type(args.notify.enable) == "boolean" then
|
if type(opts.notify.enable) == "boolean" then
|
||||||
state.notify.enable = args.notify.enable
|
state.notify.enable = opts.notify.enable
|
||||||
end
|
end
|
||||||
if type(args.notify.title) == "string" then
|
if type(opts.notify.title) == "string" then
|
||||||
state.notify.title = args.notify.title
|
state.notify.title = opts.notify.title
|
||||||
end
|
end
|
||||||
if type(args.notify.timeout) == "number" then
|
if type(opts.notify.timeout) == "number" then
|
||||||
state.notify.timeout = args.notify.timeout
|
state.notify.timeout = opts.notify.timeout
|
||||||
end
|
end
|
||||||
if type(args.notify.level) == "string" then
|
if type(opts.notify.level) == "string" then
|
||||||
state.notify.level = args.notify.level
|
state.notify.level = opts.notify.level
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -821,6 +821,11 @@ local _merge_event = ya.sync(function(state)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
setup = function(_, opts)
|
||||||
|
_load_config(opts)
|
||||||
|
_load_projects()
|
||||||
|
_merge_event()
|
||||||
|
end,
|
||||||
entry = function(_, job)
|
entry = function(_, job)
|
||||||
local action = job.args[1]
|
local action = job.args[1]
|
||||||
if not action then
|
if not action then
|
||||||
@@ -909,9 +914,4 @@ return {
|
|||||||
delete_project(selected_idx)
|
delete_project(selected_idx)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
setup = function(_, args)
|
|
||||||
_load_config(args)
|
|
||||||
_load_projects()
|
|
||||||
_merge_event()
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user