git fuzzy binding

This commit is contained in:
Noah Masur 2021-05-04 11:38:00 -04:00
parent 0bd93f7aa3
commit 96dcac70d8
6 changed files with 22 additions and 2 deletions

View File

@ -597,6 +597,7 @@ key_bindings:
- { key: D, mods: Super, chars: "\x14" } # CMD-D sends CTRL-T for fzf - { 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: 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: R, mods: Super, chars: "\x05" } # CMD-R sends CTRL-E for fish/vim
- { key: G, mods: Super, chars: "\x07" } # CMD-G sends CTRL-G for fish/vim
- { key: Return, mods: Shift, chars: "\x1b[13;2u" } - { key: Return, mods: Shift, chars: "\x1b[13;2u" }
- { key: Return, mods: Control, chars: "\x1b[13;5u" } - { key: Return, mods: Control, chars: "\x1b[13;5u" }

View File

@ -50,7 +50,7 @@ function abbrs --description 'All abbreviations'
# Vim # Vim
if command -v nvim > /dev/null if command -v nvim > /dev/null
alias vim='nvim' alias --save vim='nvim'
abbr -a vimrc 'vim $HOME/.config/nvim/init.vim' abbr -a vimrc 'vim $HOME/.config/nvim/init.vim'
else else
abbr -a vimrc 'vim $HOME/.vimrc' abbr -a vimrc 'vim $HOME/.vimrc'

View File

@ -0,0 +1,10 @@
#!/usr/local/bin/fish
function commandline-git-commits
set commit (git-commits)
if [ $commit ]
commandline -i "$commit"
else
commandline -i "HEAD"
end
end

View File

@ -3,4 +3,5 @@
function fish_user_key_bindings function fish_user_key_bindings
bind -M insert \co 'edit' bind -M insert \co 'edit'
bind -M insert \ce 'recent' bind -M insert \ce 'recent'
bind -M insert \cg 'commandline-git-commits'
end end

View File

@ -1,4 +1,8 @@
function git-show-fuzzy function git-show-fuzzy
set commit (git log --pretty=oneline | fzf | cut -d' ' -f1) set commitline (git log \
--pretty="format:%C(auto)%ar %h%d %s" \
| fzf \
)
and set commit (echo $commitline | cut -d" " -f4 )
and git show $commit and git show $commit
end end

View File

@ -0,0 +1,4 @@
# Defined via `source`
function vim --wraps=nvim --description 'alias vim=nvim'
nvim $argv;
end