Skip to content

Commit e536c9c

Browse files
committed
vim: update ftplugin/gitcommit.vim
1 parent 856eb31 commit e536c9c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

vim/ftplugin/gitcommit.vim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
" It scrolls to "Changes" in the buffer, splits the window etc.
33
" This allows for reviewing the diff (from `git commit -v`) while editing the
44
" commit message easily.
5-
if get(b:, 'fugitive_type', '') !=# 'index' " Skip with fugitive :Gstatus
5+
if has_key(b:, 'b:fugitive_commit_arguments')
6+
\ || get(b:, 'fugitive_type', '') !=# 'index' " Skip with fugitive :Gstatus
7+
if !(tabpagenr('$') == 1 && winnr('$') == 1)
8+
" Only with single windows (for Q mapping at least).
9+
finish
10+
endif
611
let b:my_auto_scrolloff=0
712
setlocal foldmethod=syntax foldlevel=1 nohlsearch spell spl=de,en sw=2 scrolloff=0
813

914
augroup vimrc_gitcommit
1015
autocmd BufWinEnter <buffer>
11-
\ exe 'g/^# \(Changes not staged\|Untracked files\)/norm! zc'
12-
\ | silent! exe '?^# Changes to be committed:'
16+
\ exe 'keeppatterns g/^# \(Changes not staged\|Untracked files\)/norm! zc'
17+
\ | silent! exe 'keeppatterns ?^# Changes to be committed:'
1318
\ | exe 'norm! zt'
1419
\ | belowright exe max([5, min([10, (winheight(0) / 3)])]).'split'
1520
\ | exe 'normal! gg'

0 commit comments

Comments
 (0)