mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:fda02d03c0cf
runtime(gitcommit): Updates to ftplugin and syntax
fda02d03c0
Co-authored-by: Tim Pope <code@tpope.net>
This commit is contained in:
parent
1d71e1d987
commit
419f038727
@ -1,7 +1,7 @@
|
|||||||
" Vim filetype plugin
|
" Vim filetype plugin
|
||||||
" Language: git commit file
|
" Language: git commit file
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" 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
|
" Only do this when not done yet for this buffer
|
||||||
if (exists("b:did_ftplugin"))
|
if (exists("b:did_ftplugin"))
|
||||||
@ -12,7 +12,7 @@ let b:did_ftplugin = 1
|
|||||||
|
|
||||||
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
|
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
|
||||||
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
|
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 include=^+++
|
||||||
setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
|
setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
|
||||||
|
|
||||||
@ -42,6 +42,11 @@ function! s:diffcomplete(A, L, P) abort
|
|||||||
return args
|
return args
|
||||||
endfunction
|
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
|
function! s:gitdiffcached(bang, ...) abort
|
||||||
let name = tempname()
|
let name = tempname()
|
||||||
if a:0
|
if a:0
|
||||||
@ -50,8 +55,6 @@ function! s:gitdiffcached(bang, ...) abort
|
|||||||
let extra = "-p --stat=".&columns
|
let extra = "-p --stat=".&columns
|
||||||
endif
|
endif
|
||||||
call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
|
call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
|
||||||
exe "pedit " . fnameescape(name)
|
exe 'pedit +call\ s:setupdiff()' fnameescape(name)
|
||||||
wincmd P
|
silent! 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
|
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: git commit file
|
" Language: git commit file
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Filenames: *.git/COMMIT_EDITMSG
|
" Filenames: *.git/COMMIT_EDITMSG
|
||||||
" Last Change: 2022 Jan 05
|
" Last Change: 2023 Dec 28
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@ -21,7 +21,11 @@ endif
|
|||||||
syn include @gitcommitDiff syntax/diff.vim
|
syn include @gitcommitDiff syntax/diff.vim
|
||||||
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff
|
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff
|
||||||
|
|
||||||
syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
if get(g:, 'gitcommit_summary_length') < 0
|
||||||
|
syn match gitcommitSummary "^.*$" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
||||||
|
elseif get(g:, 'gitcommit_summary_length', 1) > 0
|
||||||
|
exe 'syn match gitcommitSummary "^.*\%<' . (get(g:, 'gitcommit_summary_length', 50) + 1) . 'v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell'
|
||||||
|
endif
|
||||||
syn match gitcommitOverflow ".*" contained contains=@Spell
|
syn match gitcommitOverflow ".*" contained contains=@Spell
|
||||||
syn match gitcommitBlank "^.\+" contained contains=@Spell
|
syn match gitcommitBlank "^.\+" contained contains=@Spell
|
||||||
syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl
|
syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl
|
||||||
|
Loading…
Reference in New Issue
Block a user