Created
May 12, 2016 14:45
-
-
Save hail2u/2cccc8e82adfa715b35c69c07baf3167 to your computer and use it in GitHub Desktop.
~/vimfiles/ftplugin/gitrebase.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:CycleRebaseModes(num) | |
if type(a:num) != type(0) | |
return | |
endif | |
let modes = ['pick', 'reword', 'edit', 'squash', 'fixup', 'exec', 'drop'] | |
let i = index(modes, expand('<cword>')) | |
if (i == -1) | |
if (a:num > 0) | |
execute "normal! \<C-a>" | |
else | |
execute "normal! \<C-x>" | |
endif | |
return | |
endif | |
let i += a:num | |
if (i == -1) | |
let i = len(modes) - 1 | |
elseif (i == len(modes)) | |
let i = 0 | |
endif | |
let @" = modes[i] | |
execute "normal! viw\"\"p" | |
endfunction | |
nnoremap <buffer> <C-a> :silent call <SID>CycleRebaseModes(1)<Return> | |
nnoremap <buffer> <C-x> :silent call <SID>CycleRebaseModes(-1)<Return> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment