fish: use old bind syntax unless fish v4

This commit is contained in:
Charles Gould 2025-01-05 15:51:52 -06:00
parent 51f266f4be
commit f1888c970e
2 changed files with 27 additions and 7 deletions

View File

@ -24,5 +24,10 @@ abbr -a gr 'git restore'
abbr -a gs 'git status'
abbr -a gst 'git stash'
abbr -a gsw 'git switch'
set -l major_version (string sub --length 1 $version)
if test $major_version -gt 4
abbr -a --command git rbi 'rebase --interactive'
abbr -a --command git wipe 'restore --staged --worktree'
end

View File

@ -34,9 +34,16 @@ if status --is-interactive
set -g __fish_git_prompt_color_upstream yellow
# Bindings
set -l major_version (string sub --length 1 $version)
if test $major_version -ge 4
bind ctrl-q fkill
bind ctrl-p __fzf_files
bind ctrl-g __fzf_git_log
else
bind \cq fkill
bind \cp __fzf_files
bind \cg __fzf_git_log
end
# You can get the cancelled command with ctrl-z now
#bind ctrl-c __fish_cancel_commandline
@ -44,14 +51,22 @@ if status --is-interactive
# Shell history
if command -q atuin
atuin init fish --disable-up-arrow | source
else
if test $major_version -ge 4
bind ctrl-r __fzf_history
else
bind \cr __fzf_history
end
end
# By default, Ctrl+L clears the screen
# Add binding Ctrl+Alt+L to clear screen AND scrollback buffer
if test $major_version -ge 4
bind ctrl-alt-l 'clear; commandline -f repaint'
else
bind \e\f 'clear; commandline -f repaint'
end
end
if not set -q __universals_initialized
set -U __universals_initialized