Skip to content

Commit

Permalink
gitconfig: better line continuation handling
Browse files Browse the repository at this point in the history
* Extra level of indent on line continuations
* syn sync minlines=10 so line continuations are properly highlighted
  • Loading branch information
tpope committed Jun 4, 2008
1 parent 57d41fa commit 65fb760
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions indent/gitconfig.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
" Last Change: 2008 Jun 04

if exists("b:did_indent")
finish
Expand All @@ -18,11 +18,11 @@ if exists("*GetGitconfigIndent")
endif

function! GetGitconfigIndent()
let line = getline(v:lnum-1)
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
if line =~ '[^\\]\@<=\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
return -1
if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
return 2 * &sw
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
Expand Down
5 changes: 3 additions & 2 deletions syntax/gitconfig.vim
Expand Up @@ -2,15 +2,16 @@
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Filenames: gitconfig, .gitconfig, *.git/config
" Last Change: 2007 Dec 16
" Last Change: 2008 Jun 04

if exists("b:current_syntax")
finish
endif

syn case ignore
setlocal iskeyword+=-
setlocal iskeyword-=_
syn case ignore
syn sync minlines=10

syn match gitconfigComment "[#;].*"
syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
Expand Down

0 comments on commit 65fb760

Please sign in to comment.