-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgitrebase.vim
More file actions
29 lines (25 loc) · 905 Bytes
/
gitrebase.vim
File metadata and controls
29 lines (25 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
" interactive-rebase-reverse.vim - Reverse the order of commits in an interactive rebase
" Author: Sal Ferrarello <https://salferrarello.com/>
" Version: 1.0.0
" Reverse the order of all lines that do NOT:
" - Begin with #
" - nor are a blank link
function! s:Reverse()
global!/\(^#\)\|\(^$\)/m0
endfunction
" Ensure we only load this file once.
if exists('g:ft_interactive_rebase_reverse')
finish
endif
let g:ft_interactive_rebase_reverse = 1"
" 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