diff --git a/fish/conf.d/abbr.fish b/fish/conf.d/abbr.fish index a699eb4..0191308 100644 --- a/fish/conf.d/abbr.fish +++ b/fish/conf.d/abbr.fish @@ -24,5 +24,10 @@ abbr -a gr 'git restore' abbr -a gs 'git status' abbr -a gst 'git stash' abbr -a gsw 'git switch' -abbr -a --command git rbi 'rebase --interactive' -abbr -a --command git wipe 'restore --staged --worktree' + +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 diff --git a/fish/config.fish b/fish/config.fish index aa9140b..1dd2383 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -34,9 +34,16 @@ if status --is-interactive set -g __fish_git_prompt_color_upstream yellow # Bindings - bind ctrl-q fkill - bind ctrl-p __fzf_files - bind ctrl-g __fzf_git_log + 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 @@ -45,12 +52,20 @@ if status --is-interactive if command -q atuin atuin init fish --disable-up-arrow | source else - bind \cr __fzf_history + 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 - bind \e\f 'clear; commandline -f repaint' + 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