diff --git a/alacritty.configlink/alacritty.yml b/alacritty.configlink/alacritty.yml index a6750ed..bccf316 100644 --- a/alacritty.configlink/alacritty.yml +++ b/alacritty.configlink/alacritty.yml @@ -590,10 +590,13 @@ shell: # in the order they were defined in. key_bindings: - { key: F, mods: Super, action: ToggleSimpleFullscreen } - - { key: A, mods: Super, chars: "\x02" } # CMD-A sends CTRL-B for tmux - - { key: D, mods: Super, chars: "\x14" } # CMD-D sends CTRL-T for fzf - - { key: O, mods: Super, chars: "edit\x0D" } # CMD-O opens file in vim - - { key: R, mods: Super, chars: "recent\x0D" } # CMD-R opens file in vim + + # Reference for escape codes: https://www.gaijin.at/en/infos/ascii-ansi-character-table + + - { key: A, mods: Super, chars: "\x02" } # CMD-A sends CTRL-B for tmux + - { key: D, mods: Super, chars: "\x14" } # CMD-D sends CTRL-T for fzf + - { key: O, mods: Super, chars: "\x0f" } # CMD-O sends CTRL-O for fish/vim + - { key: R, mods: Super, chars: "\x05" } # CMD-R sends CTRL-E for fish/vim - { key: Return, mods: Shift, chars: "\x1b[13;2u" } - { key: Return, mods: Control, chars: "\x1b[13;5u" } diff --git a/fish.configlink/functions/edit.fish b/fish.configlink/functions/edit.fish index 732e15e..f86daee 100644 --- a/fish.configlink/functions/edit.fish +++ b/fish.configlink/functions/edit.fish @@ -1,5 +1,6 @@ function edit --description "Open a file in Vim" set vimfile (fzf) - and vim $vimfile + and set vimfile (echo $vimfile | tr -d '\r') + and commandline -r "vim $vimfile" + and commandline -f execute end - diff --git a/fish.configlink/functions/fish_user_key_bindings.fish b/fish.configlink/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..ec73bc2 --- /dev/null +++ b/fish.configlink/functions/fish_user_key_bindings.fish @@ -0,0 +1,6 @@ +#!/usr/local/bin/fish + +function fish_user_key_bindings + bind -M insert \co 'edit' + bind -M insert \ce 'recent' +end diff --git a/fish.configlink/functions/recent.fish b/fish.configlink/functions/recent.fish index 54aea64..b717f88 100644 --- a/fish.configlink/functions/recent.fish +++ b/fish.configlink/functions/recent.fish @@ -1,4 +1,6 @@ function recent --description "Open a recent file in Vim" - set vimfile (fd --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf) - and vim $vimfile + set vimfile (fd -t f --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf) + and set vimfile (echo $vimfile | tr -d '\r') + and commandline -r "vim $vimfile" + and commandline -f execute end