bind fzf shortcuts to fish commandline

This commit is contained in:
Noah Masur
2021-05-04 09:47:58 -04:00
parent e142382c44
commit 33ab04ffeb
4 changed files with 20 additions and 8 deletions

View File

@ -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

View File

@ -0,0 +1,6 @@
#!/usr/local/bin/fish
function fish_user_key_bindings
bind -M insert \co 'edit'
bind -M insert \ce 'recent'
end

View File

@ -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