Update runtime files.
diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim
index b3d5cff..75b20f0 100644
--- a/runtime/ftplugin/git.vim
+++ b/runtime/ftplugin/git.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -10,7 +10,7 @@
let b:did_ftplugin = 1
if !exists('b:git_dir')
- if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
+ if expand('%:p') =~# '[\/]\.git[\/]modules[\/]\|:[\/][\/]\|^\a\a\+:'
" Stay out of the way
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim
index 6767ff7..9b1998a 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: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -13,8 +13,10 @@
setlocal comments=:# commentstring=#\ %s
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
-setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q
-let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<'
+setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
+setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
+
+let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<'
if exists("g:no_gitcommit_commands") || v:version < 700
finish
diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim
index 6f73b5c..2fed53c 100644
--- a/runtime/ftplugin/gitrebase.vim
+++ b/runtime/ftplugin/gitrebase.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -18,27 +18,31 @@
endif
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<"
-function! s:choose(word)
+function! s:choose(word) abort
s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
endfunction
-function! s:cycle()
- call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick'))
+function! s:cycle(count) abort
+ let words = ['pick', 'edit', 'fixup', 'squash', 'reword', 'drop']
+ let index = index(map(copy(words), 'v:val[0]'), getline('.')[0])
+ let index = ((index < 0 ? 0 : index) + 10000 * len(words) + a:count) % len(words)
+ call s:choose(words[index])
endfunction
-command! -buffer -bar Pick :call s:choose('pick')
-command! -buffer -bar Squash :call s:choose('squash')
-command! -buffer -bar Edit :call s:choose('edit')
-command! -buffer -bar Reword :call s:choose('reword')
-command! -buffer -bar Fixup :call s:choose('fixup')
-command! -buffer -bar Cycle :call s:cycle()
-" The above are more useful when they are mapped; for example:
-"nnoremap <buffer> <silent> S :Cycle<CR>
+command! -buffer -bar -range Pick :<line1>,<line2>call s:choose('pick')
+command! -buffer -bar -range Squash :<line1>,<line2>call s:choose('squash')
+command! -buffer -bar -range Edit :<line1>,<line2>call s:choose('edit')
+command! -buffer -bar -range Reword :<line1>,<line2>call s:choose('reword')
+command! -buffer -bar -range Fixup :<line1>,<line2>call s:choose('fixup')
+command! -buffer -bar -range Drop :<line1>,<line2>call s:choose('drop')
+command! -buffer -count=1 -bar -bang Cycle call s:cycle(<bang>0 ? -<count> : <count>)
if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
finish
endif
nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
+nnoremap <buffer> <silent> <C-A> :<C-U><C-R>=v:count1<CR>Cycle<CR>
+nnoremap <buffer> <silent> <C-X> :<C-U><C-R>=v:count1<CR>Cycle!<CR>
-let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K"
+let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap <buffer> K'|exe 'nunmap <buffer> <C-A>'|exe 'nunmap <buffer> <C-X>'"
diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim
index e74530b..6f30169 100644
--- a/runtime/ftplugin/haml.vim
+++ b/runtime/ftplugin/haml.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -37,6 +37,8 @@
runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
let b:did_ftplugin = 1
+let &l:define .= empty(&l:define ? '' : '\|') . '^\s*\%(%\w*\)\=\%(\.[[:alnum:]_-]\+\)*#'
+
" Combine the new set of values with those previously included.
if exists("b:undo_ftplugin")
let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
@@ -60,7 +62,7 @@
setlocal comments= commentstring=-#\ %s
-let b:undo_ftplugin = "setl cms< com< "
+let b:undo_ftplugin = "setl def< cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index 277ba94..fc1d9e0 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
if exists("b:did_ftplugin")
finish
@@ -9,7 +9,7 @@
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
+setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
@@ -19,32 +19,56 @@
let b:undo_ftplugin = "setl cms< com< fo< flp<"
endif
-function! MarkdownFold()
+function! s:NotCodeBlock(lnum) abort
+ return synIDattr(synID(v:lnum, 1, 1), 'name') !=# 'markdownCode'
+endfunction
+
+function! MarkdownFold() abort
let line = getline(v:lnum)
- " Regular headers
- let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
- if depth > 0
- return ">" . depth
+ if line =~# '^#\+ ' && s:NotCodeBlock(v:lnum)
+ return ">" . match(line, ' ')
endif
- " Setext style headings
let nextline = getline(v:lnum + 1)
- if (line =~ '^.\+$') && (nextline =~ '^=\+$')
+ if (line =~ '^.\+$') && (nextline =~ '^=\+$') && s:NotCodeBlock(v:lnum + 1)
return ">1"
endif
- if (line =~ '^.\+$') && (nextline =~ '^-\+$')
+ if (line =~ '^.\+$') && (nextline =~ '^-\+$') && s:NotCodeBlock(v:lnum + 1)
return ">2"
endif
return "="
endfunction
+function! s:HashIndent(lnum) abort
+ let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')
+ if len(hash_header)
+ return hash_header
+ else
+ let nextline = getline(a:lnum + 1)
+ if nextline =~# '^=\+\s*$'
+ return '#'
+ elseif nextline =~# '^-\+\s*$'
+ return '##'
+ endif
+ endif
+endfunction
+
+function! MarkdownFoldText() abort
+ let hash_indent = s:HashIndent(v:foldstart)
+ let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
+ let foldsize = (v:foldend - v:foldstart + 1)
+ let linecount = '['.foldsize.' lines]'
+ return hash_indent.' '.title.' '.linecount
+endfunction
+
if has("folding") && exists("g:markdown_folding")
setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr
- let b:undo_ftplugin .= " foldexpr< foldmethod<"
+ setlocal foldtext=MarkdownFoldText()
+ let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
endif
" vim:set sw=2:
diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim
index d6909e7..9ce4461 100644
--- a/runtime/ftplugin/sass.vim
+++ b/runtime/ftplugin/sass.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -13,11 +13,25 @@
setlocal comments=://
setlocal commentstring=//\ %s
-setlocal define=^\\s*\\%(@mixin\\\|=\\)
-setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
+setlocal includeexpr=SassIncludeExpr(v:fname)
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.sass,.scss,.css
+if &filetype =~# '\<s[ac]ss]\>'
+ setlocal iskeyword+=-
+ setlocal iskeyword+=$
+ setlocal iskeyword+=%
+ let b:undo_ftplugin .= ' isk<'
+endif
+let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
+function! SassIncludeExpr(file) abort
+ let partial = substitute(a:file, '\%(.*/\|^\)\zs', '_', '')
+ if !empty(findfile(partial))
+ return partial
+ endif
+ return a:file
+endfunction
+
" vim:set sw=2: