Skip to content

Commit

Permalink
features
Browse files Browse the repository at this point in the history
  • Loading branch information
HE7086 committed Aug 10, 2024
1 parent a9bab4d commit 246e4bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion yazi/.config/yazi/keymap.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[manager]
prepend_keymap = [
{ on = [ "l" ], run = "plugin --sync smart-enter", desc = "Enter the child directory, or open the file" },
{ on = [ "L" ], run = "plugin --sync sudoedit", desc = "Enter the child directory, or open the file" },
{ on = [ "L" ], run = "plugin --sync sudoedit", desc = "Edit the file with sudoedit" },
{ on = [ "q" ], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
{ on = [ "Q" ], run = "quit", desc = "Exit the process" },

Expand Down
15 changes: 10 additions & 5 deletions yazi/.config/yazi/plugins/sudoedit.yazi/init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
return {
entry = function(_, _)
ya.manager_emit("shell", {
'sudoedit "$@"',
block = true,
confirm = true,
})
local h = cx.active.current.hovered
if h and h.cha.is_dir then
ya.manager_emit("enter", {})
else
ya.manager_emit("shell", {
'sudoedit "$@"',
block = true,
confirm = true,
})
end
end
}

0 comments on commit 246e4bd

Please sign in to comment.