summaryrefslogtreecommitdiffstats
path: root/indent/vim.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-07 23:52:17 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-07 23:52:17 +0200
commitb3763a917a6a3ca85ae51086fc8d29b28f66fc88 (patch)
treeb94a1a8590cb88cfd09fe78c2e43931714aea90b /indent/vim.vim
parent4bec20ec1a7cde0c29d9550d244f428484fa56ab (diff)
downloadvim-polyglot-b3763a917a6a3ca85ae51086fc8d29b28f66fc88.tar.gz
vim-polyglot-b3763a917a6a3ca85ae51086fc8d29b28f66fc88.zip
Use neovim version of .vim highlighting, #578
Diffstat (limited to 'indent/vim.vim')
-rw-r--r--indent/vim.vim36
1 files changed, 5 insertions, 31 deletions
diff --git a/indent/vim.vim b/indent/vim.vim
index c819c64f..47d1c4de 100644
--- a/indent/vim.vim
+++ b/indent/vim.vim
@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2020 Sep 27
+" Last Change: 2016 Jun 27
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -12,8 +12,7 @@ endif
let b:did_indent = 1
setlocal indentexpr=GetVimIndent()
-setlocal indentkeys+==end,=},=else,=cat,=finall,=END,0\\,0=\"\\\
-setlocal indentkeys-=0#
+setlocal indentkeys+==end,=else,=cat,=fina,=END,0\\,0=\"\\\
let b:undo_indent = "setl indentkeys< indentexpr<"
@@ -59,31 +58,6 @@ function GetVimIndentIntern()
" and :else. Add it three times for a line that starts with '\' or '"\ '
" after a line that doesn't (or g:vim_indent_cont if it exists).
let ind = indent(lnum)
-
- " In heredoc indenting works completely differently.
- if has('syntax_items')
- let syn_here = synIDattr(synID(v:lnum, 1, 1), "name")
- if syn_here =~ 'vimLetHereDocStop'
- " End of heredoc: use indent of matching start line
- let lnum = v:lnum - 1
- while lnum > 0
- if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
- return indent(lnum)
- endif
- let lnum -= 1
- endwhile
- return 0
- endif
- if syn_here =~ 'vimLetHereDoc'
- if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
- " First line in heredoc: increase indent
- return ind + shiftwidth()
- endif
- " Heredoc continues: no change in indent
- return ind
- endif
- endif
-
if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat
if exists("g:vim_indent_cont")
let ind = ind + g:vim_indent_cont
@@ -95,7 +69,7 @@ function GetVimIndentIntern()
else
" A line starting with :au does not increment/decrement indent.
if prev_text !~ '^\s*au\%[tocmd]'
- let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
+ let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
if i >= 0
let ind += shiftwidth()
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
@@ -118,8 +92,8 @@ function GetVimIndentIntern()
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
- " :endfun, :enddef, :else and :augroup END.
- if cur_text =~ '^\s*\(ene\@!\|}\|cat\|finall\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
+ " :endfun, :else and :augroup END.
+ if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)'
let ind = ind - shiftwidth()
endif