Sanchayan Maity
4e2abc80df
The plugin is a pretty small ftplugin. Just add it to our ftplugin. This also fixes the issue where this plugin did not take affect when using interactive rebase from within fugitive.
31 lines
1 KiB
VimL
31 lines
1 KiB
VimL
" Taken from https://github.com/salcode/vim-interactive-rebase-reverse
|
|
" Reverse the order of all lines that do NOT:
|
|
" - Begin with #
|
|
" - nor are a blank link
|
|
function! s:Reverse()
|
|
global!/\(^#\)\|\(^$\)/m0
|
|
endfunction
|
|
|
|
" Reverse the order of all commits in the git interactive rebase screen,
|
|
" when this filetype (gitrebase) is loaded.
|
|
call s:Reverse()
|
|
|
|
" Set an autocmd to run when the Buffer is written
|
|
augroup fe_interactive_rebase_reverse
|
|
autocmd!
|
|
" Before saving (un)reverse the order of all commits.
|
|
autocmd BufWritePre <buffer> call s:Reverse()
|
|
" After saving reverse the order of the commits again.
|
|
autocmd BufWritePost <buffer> call s:Reverse()
|
|
augroup END
|
|
|
|
" See https://github.com/neovim/neovim/blob/master/runtime/ftplugin/gitrebase.vim
|
|
nmap <buffer> <silent> <Leader>p :Pick<CR>
|
|
nmap <buffer> <silent> <Leader>s :Squash<CR>
|
|
nmap <buffer> <silent> <Leader>e :Edit<CR>
|
|
nmap <buffer> <silent> <Leader>r :Reword<CR>
|
|
nmap <buffer> <silent> <Leader>f :Fixup<CR>
|
|
nmap <buffer> <silent> <Leader>c :Cycle<CR>
|
|
|
|
setlocal bufhidden=wipe
|