diff options
author | Christian Clason <c.clason@uni-graz.at> | 2023-12-29 00:28:54 +0100 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2023-12-29 00:54:09 +0100 |
commit | 419f0387276f6b1b72ad2cb56366f31d3ad6265e (patch) | |
tree | 4717c13bd4246e487974c533ab78903bf267ef8b /runtime/ftplugin/gitcommit.vim | |
parent | 1d71e1d987f330cae33f3d6026c26ffbb6c5b585 (diff) | |
download | rneovim-419f0387276f6b1b72ad2cb56366f31d3ad6265e.tar.gz rneovim-419f0387276f6b1b72ad2cb56366f31d3ad6265e.tar.bz2 rneovim-419f0387276f6b1b72ad2cb56366f31d3ad6265e.zip |
vim-patch:fda02d03c0cf
runtime(gitcommit): Updates to ftplugin and syntax
https://github.com/vim/vim/commit/fda02d03c0cfe017e465c58b3baf8b3106287578
Co-authored-by: Tim Pope <code@tpope.net>
Diffstat (limited to 'runtime/ftplugin/gitcommit.vim')
-rw-r--r-- | runtime/ftplugin/gitcommit.vim | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index 9342799b56..3749328595 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2022 Jan 05 +" Last Change: 2023 Dec 28 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -12,7 +12,7 @@ let b:did_ftplugin = 1 setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n -setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+ setlocal include=^+++ setlocal includeexpr=substitute(v:fname,'^[bi]/','','') @@ -42,6 +42,11 @@ function! s:diffcomplete(A, L, P) abort return args endfunction +function! s:setupdiff() abort + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>) + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git +endfunction + function! s:gitdiffcached(bang, ...) abort let name = tempname() if a:0 @@ -50,8 +55,6 @@ function! s:gitdiffcached(bang, ...) abort let extra = "-p --stat=".&columns endif call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name)) - exe "pedit " . fnameescape(name) - wincmd P - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>) - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git + exe 'pedit +call\ s:setupdiff()' fnameescape(name) + silent! wincmd P endfunction |