Skip to content

Instantly share code, notes, and snippets.

@hail2u
Created May 12, 2016 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hail2u/2cccc8e82adfa715b35c69c07baf3167 to your computer and use it in GitHub Desktop.
Save hail2u/2cccc8e82adfa715b35c69c07baf3167 to your computer and use it in GitHub Desktop.
~/vimfiles/ftplugin/gitrebase.vim
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