diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-19 15:18:53 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-19 15:18:53 +0000 |
commit | 47c532e2bc55e8a48f7f47e1fae1ed30144f2fa1 (patch) | |
tree | 11fb0e3e2b944668fc416d816298badc8211d013 /runtime/indent | |
parent | 36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0 (diff) |
Update runtime files
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/bst.vim | 6 | ||||
-rw-r--r-- | runtime/indent/haml.vim | 4 | ||||
-rw-r--r-- | runtime/indent/liquid.vim | 23 | ||||
-rw-r--r-- | runtime/indent/sass.vim | 4 |
4 files changed, 21 insertions, 16 deletions
diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim index 47e3058810..3dd8d711a8 100644 --- a/runtime/indent/bst.vim +++ b/runtime/indent/bst.vim @@ -1,20 +1,18 @@ " Vim indent file " Language: bst " Author: Tim Pope <vimNOSPAM@tpope.info> -" $Id: bst.vim,v 1.1 2007/05/05 18:11:12 vimboss Exp $ +" Last Change: 2022 Mar 15 if exists("b:did_indent") finish endif let b:did_indent = 1 -setlocal expandtab setlocal indentexpr=GetBstIndent(v:lnum) -"setlocal smartindent setlocal cinkeys& setlocal cinkeys-=0# setlocal indentkeys& -"setlocal indentkeys+=0% +let b:undo_indent = 'setlocal indentexpr< cinkeys< indentkeys<' " Only define the function once. if exists("*GetBstIndent") diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index baca1d49d9..acd99d9c7d 100644 --- a/runtime/indent/haml.vim +++ b/runtime/indent/haml.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Haml " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2019 Dec 05 +" Last Change: 2022 Mar 15 if exists("b:did_indent") finish @@ -14,6 +14,8 @@ setlocal autoindent setlocal indentexpr=GetHamlIndent() setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when +let b:undo_indent = "setl ai< inde< indk<" + " Only define the function once. if exists("*GetHamlIndent") finish diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim index 7beb0388d1..6fc933797e 100644 --- a/runtime/indent/liquid.vim +++ b/runtime/indent/liquid.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Liquid " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2017 Jun 13 +" Last Change: 2022 Mar 15 if exists('b:did_indent') finish @@ -29,17 +29,19 @@ let b:did_indent = 1 setlocal indentexpr=GetLiquidIndent() setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty +let b:undo_indent = "setl inde< indk<" + " Only define the function once. if exists('*GetLiquidIndent') finish endif -function! s:count(string,pattern) +function! s:count(string, pattern) abort let string = substitute(a:string,'\C'.a:pattern,"\n",'g') return strlen(substitute(string,"[^\n]",'','g')) endfunction -function! GetLiquidIndent(...) +function! GetLiquidIndent(...) abort if a:0 && a:1 == '.' let v:lnum = line('.') elseif a:0 && a:1 =~ '^\d' @@ -51,13 +53,14 @@ function! GetLiquidIndent(...) let lnum = prevnonblank(v:lnum-1) let line = getline(lnum) let cline = getline(v:lnum) - let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') - let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') - let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') + let line = substitute(line,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','') + let line = substitute(line,'\C\%(\s*{%-\=\s*if.\+-\=%}.\+{%-\=\s*endif\s*-\=%}\)\+','','g') + let line .= matchstr(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+') + let cline = substitute(cline,'\C^\%(\s*{%-\=\s*end\w*\s*-\=%}\)\+','','') let sw = shiftwidth() - let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') - let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') - let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') - let ind -= sw * s:count(cline,'{%\s*end\w*$') + let ind += sw * s:count(line,'{%-\=\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') + let ind -= sw * s:count(line,'{%-\=\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') + let ind -= sw * s:count(cline,'{%-\=\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= sw * s:count(cline,'{%-\=\s*end\w*$') return ind endfunction diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim index d6dbf3a8bb..8c0ecd0746 100644 --- a/runtime/indent/sass.vim +++ b/runtime/indent/sass.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2017 Jun 13 +" Last Change: 2022 Mar 15 if exists("b:did_indent") finish @@ -12,6 +12,8 @@ setlocal autoindent sw=2 et setlocal indentexpr=GetSassIndent() setlocal indentkeys=o,O,*<Return>,<:>,!^F +let b:undo_indent = "setl ai< inde< indk<" + " Only define the function once. if exists("*GetSassIndent") finish |