Is it possible to have "sticky" modes #9607
-
I am trying to implement a keybinding in my config to open a list of files/directories, and allow you to select them. Here is what I have so far: [keys.normal]
C-f = [":new", ":insert-output ls -F1d \"$PWD/\"*", ":goto 1"]
# Mode for the file picker, TODO opened when the user presses control-f by the keybinding in normal mode
# 4 roadblocks:
# - activate modes from keymaps
# - if statements
# - using the registers inside a command
# - using the escape key
[keys.normal."_"]
esc = [":buffer-close!"]
f = ["extend_to_line_bounds", "goto_file", ":buffer-previous", ":buffer-close!"]
d = ["extend_to_line_bounds", "yank", "select_all", ":insert-output ls -F1d \"$PWD/\"*", ":goto 1"] # Need to be able to change the working directory to the value of the main register
j = "move_line_down"
k = "move_line_up" I am wondering if it is possible to stop the picker mode from deactivating ounce the keybindings is pressed. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Proposal for:
I'm not sure if this is out of scope, and would rathor be implemented in a plugin system #3806 [keys.normal]
C-f = [":new", ":insert-output pwd; ls -F1 --indicator-style=none", ":goto 2", "handle_key_press _"] # Enters the _ mode after running
# Mode for the file picker (still needs if statements to be able to have 1 key for opening directories and files)
[keys.normal."_"]
esc = ":buffer-close!"
f = ["extend_to_line_bounds", "goto_file", ":buffer-previous", ":buffer-close!"]
d = ["extend_to_line_bounds", "yank", ":change-current-directory {{ \"paste_before\" }}", "select_all", "delete_selection", ":insert-output ls -F1 --indicator-style=none", ":goto 2", "handle_key_press _"] # Runs the `paste_before` command and parses the result to the `change_current_directory` command
h = [":change-current-directory ../", "select_all", "delete_selection", ":insert-output pwd; ls -F1 --indicator-style=none", ":goto 2"]
j = ["move_line_down", "handle_key_press _"]
k = ["move_line_up", "handle_key_press _"] |
Beta Was this translation helpful? Give feedback.
-
A lot of this might be covered by #1383 but in general this seems like something that should be accomplished with the plugin system / scripting instead |
Beta Was this translation helpful? Give feedback.
A lot of this might be covered by #1383 but in general this seems like something that should be accomplished with the plugin system / scripting instead