AutoYADM commit: 2025-03-28 14:55:17
This commit is contained in:
parent
fb7662f40a
commit
d241873ed4
3 changed files with 39 additions and 35 deletions
|
@ -30,7 +30,7 @@ SETUVAR fish_color_status:red
|
|||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_greeting:
|
||||
SETUVAR fish_key_bindings:fish_vi_key_bindings
|
||||
SETUVAR fish_key_bindings:fish_helix_key_bindings
|
||||
SETUVAR fish_pager_color_background:\x1d
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:yellow\x1e\x2d\x2ditalics
|
||||
|
|
|
@ -57,9 +57,24 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
for mode in insert default visual
|
||||
__fish_shared_key_bindings -s -M $mode
|
||||
end
|
||||
# Add a way to switch from insert to normal (command) mode.
|
||||
# Note if we are paging, we want to stay in insert mode
|
||||
# See #2871
|
||||
set -l on_escape '
|
||||
if commandline -P
|
||||
commandline -f cancel
|
||||
else
|
||||
set fish_bind_mode default
|
||||
if test (count (commandline --cut-at-cursor | tail -c2)) != 2
|
||||
commandline -f backward-char
|
||||
end
|
||||
commandline -f repaint-mode
|
||||
end
|
||||
'
|
||||
bind -s --preset -M insert escape $on_escape
|
||||
bind -s --preset -M insert ctrl-\[ $on_escape
|
||||
|
||||
bind -s --preset -M insert \r execute
|
||||
bind -s --preset -M insert \n execute
|
||||
bind -s --preset -M insert enter execute
|
||||
|
||||
bind -s --preset -M insert "" self-insert
|
||||
|
||||
|
@ -96,21 +111,20 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
bind -s --preset -M insert \e "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f begin-selection repaint-mode; end"
|
||||
|
||||
# Switching between normal and visual mode
|
||||
bind -s --preset -M default -m visual v repaint-mode
|
||||
for key in v \e
|
||||
bind -s --preset -M default -m visual s repaint-mode
|
||||
for key in s \e
|
||||
bind -s --preset -M visual -m default $key repaint-mode
|
||||
end
|
||||
|
||||
|
||||
# Motion and actions in normal/select mode
|
||||
for mode in default visual
|
||||
if test $mode = default
|
||||
set -f n_begin_selection "begin-selection" # only begin-selection if current mode is Normal
|
||||
set -f ns_move_extend "move"
|
||||
set -f n_begin_selection begin-selection # only begin-selection if current mode is Normal
|
||||
set -f ns_move_extend move
|
||||
set -f commandline_v_repaint ""
|
||||
else
|
||||
set -f n_begin_selection
|
||||
set -f ns_move_extend "extend"
|
||||
set -f ns_move_extend extend
|
||||
set -f commandline_v_repaint "commandline -f repaint-mode"
|
||||
end
|
||||
|
||||
|
@ -119,25 +133,25 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
# FIXME example to bind 0
|
||||
# FIXME backspace to edit count
|
||||
end
|
||||
for key in h \e\[D \eOD "-k left"
|
||||
for key in m \e\[D \eOD "-k left"
|
||||
bind -s --preset -M $mode $key "fish_helix_command "$ns_move_extend"_char_left"
|
||||
end
|
||||
for key in l \e\[C \eOC "-k right"
|
||||
for key in i \e\[C \eOC "-k right"
|
||||
bind -s --preset -M $mode $key "fish_helix_command "$ns_move_extend"_char_right"
|
||||
end
|
||||
for key in k \e\[A \eOA "-k up"
|
||||
for key in e \e\[A \eOA "-k up"
|
||||
bind -s --preset -M $mode $key "fish_helix_command char_up"
|
||||
end
|
||||
for key in j \e\[B \eOB "-k down"
|
||||
for key in n \e\[B \eOB "-k down"
|
||||
bind -s --preset -M $mode $key "fish_helix_command char_down"
|
||||
end
|
||||
|
||||
bind -s --preset -M $mode w "fish_helix_command next_word_start"
|
||||
bind -s --preset -M $mode b "fish_helix_command prev_word_start"
|
||||
bind -s --preset -M $mode e "fish_helix_command next_word_end"
|
||||
bind -s --preset -M $mode l "fish_helix_command next_word_end"
|
||||
bind -s --preset -M $mode W "fish_helix_command next_long_word_start"
|
||||
bind -s --preset -M $mode B "fish_helix_command prev_long_word_start"
|
||||
bind -s --preset -M $mode E "fish_helix_command next_long_word_end"
|
||||
bind -s --preset -M $mode L "fish_helix_command next_long_word_end"
|
||||
|
||||
bind -s --preset -M $mode t "fish_helix_command till_next_char"
|
||||
bind -s --preset -M $mode f "fish_helix_command find_next_char"
|
||||
|
@ -156,16 +170,16 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
bind -s --preset -M $mode F$enter "fish_helix_command find_prev_cr"
|
||||
end
|
||||
|
||||
for key in gh \e\[H \eOH "-k home"
|
||||
for key in gm \e\[H \eOH "-k home"
|
||||
bind -s --preset -M $mode $key "fish_helix_command goto_line_start"
|
||||
end
|
||||
for key in gl \e\[F \eOF "-k end"
|
||||
for key in gi \e\[F \eOF "-k end"
|
||||
bind -s --preset -M $mode $key "fish_helix_command goto_line_end"
|
||||
end
|
||||
bind -s --preset -M $mode gs "fish_helix_command goto_first_nonwhitespace"
|
||||
bind -s --preset -M $mode gg "fish_helix_command goto_file_start"
|
||||
bind -s --preset -M $mode G "fish_helix_command goto_line"
|
||||
bind -s --preset -M $mode ge "fish_helix_command goto_last_line"
|
||||
bind -s --preset -M $mode gl "fish_helix_command goto_last_line"
|
||||
|
||||
# FIXME alt-. doesn't work with t/T
|
||||
# FIXME alt-. doesn't work with [ftFT][\n\r]
|
||||
|
@ -238,7 +252,6 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
bind -s --preset -M replace_one -m default \r 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default \e cancel repaint-mode
|
||||
|
||||
|
||||
## FIXME Insert mode keys
|
||||
|
||||
## Old config from vi:
|
||||
|
@ -259,36 +272,27 @@ function fish_helix_key_bindings --description 'helix-like key bindings for fish
|
|||
bind -s --preset -M insert -k sdc backward-delete-char # shifted delete
|
||||
bind -s --preset -M default -k sdc backward-delete-char # shifted delete
|
||||
|
||||
|
||||
# bind -s --preset '~' togglecase-char forward-single-char
|
||||
# bind -s --preset gu downcase-word
|
||||
# bind -s --preset gU upcase-word
|
||||
#
|
||||
# bind -s --preset J end-of-line delete-char
|
||||
# bind -s --preset K 'man (commandline -t) 2>/dev/null; or echo -n \a'
|
||||
#
|
||||
|
||||
|
||||
# bind -s --preset '~' togglecase-char forward-single-char
|
||||
# bind -s --preset gu downcase-word
|
||||
# bind -s --preset gU upcase-word
|
||||
#
|
||||
# bind -s --preset J end-of-line delete-char
|
||||
# bind -s --preset K 'man (commandline -t) 2>/dev/null; or echo -n \a'
|
||||
#
|
||||
|
||||
# same vim 'pasting' note as upper
|
||||
bind -s --preset '"*p' forward-char "commandline -i ( xsel -p; echo )[1]"
|
||||
bind -s --preset '"*P' "commandline -i ( xsel -p; echo )[1]"
|
||||
|
||||
|
||||
|
||||
#
|
||||
# visual mode
|
||||
#
|
||||
|
||||
|
||||
|
||||
# bind -s --preset -M visual -m insert c kill-selection end-selection repaint-mode
|
||||
# bind -s --preset -M visual -m insert s kill-selection end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default '"*y' "fish_clipboard_copy; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M visual -m default '~' togglecase-selection end-selection repaint-mode
|
||||
|
||||
|
||||
|
||||
# Set the cursor shape
|
||||
# After executing once, this will have defined functions listening for the variable.
|
||||
# Therefore it needs to be before setting fish_bind_mode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue