summaryrefslogtreecommitdiffstats
path: root/indent
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-03-01 13:44:50 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2021-03-01 13:44:50 +0100
commitcc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef (patch)
tree260360b1a32ca19635f8c8884b81fcec9ed51168 /indent
parent4c10562d2cc9b084518284c49a158558da5180a7 (diff)
downloadvim-polyglot-cc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef.tar.gz
vim-polyglot-cc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef.zip
Update
Diffstat (limited to 'indent')
-rw-r--r--indent/fortran.vim6
-rw-r--r--indent/haskell.vim28
-rw-r--r--indent/html.vim8
-rw-r--r--indent/julia.vim12
-rw-r--r--indent/puppet.vim9
-rw-r--r--indent/ruby.vim3
6 files changed, 37 insertions, 29 deletions
diff --git a/indent/fortran.vim b/indent/fortran.vim
index 0f08a996..9a3573ac 100644
--- a/indent/fortran.vim
+++ b/indent/fortran.vim
@@ -78,11 +78,15 @@ endif
if (b:fortran_fixed_source == 1)
setlocal indentexpr=FortranGetFixedIndent()
if exists("*FortranGetFixedIndent")
+ let &cpoptions = s:cposet
+ unlet s:cposet
finish
endif
else
setlocal indentexpr=FortranGetFreeIndent()
if exists("*FortranGetFreeIndent")
+ let &cpoptions = s:cposet
+ unlet s:cposet
finish
endif
endif
@@ -217,7 +221,7 @@ function FortranGetFixedIndent()
return ind
endfunction
-let &cpoptions=s:cposet
+let &cpoptions = s:cposet
unlet s:cposet
" vim:sw=2 tw=130
diff --git a/indent/haskell.vim b/indent/haskell.vim
index cefa0845..fa906630 100644
--- a/indent/haskell.vim
+++ b/indent/haskell.vim
@@ -193,13 +193,13 @@ function! GetHaskellIndent()
" operator at end of previous line
if l:prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
- return indent(v:lnum - 1) + &shiftwidth
+ return indent(v:lnum - 1) + shiftwidth()
endif
" let foo =
" >>>>>>bar
if l:prevline =~ '\C\<let\>\s\+[^=]\+=\s*$'
- return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + &shiftwidth
+ return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + shiftwidth()
endif
" let x = 1 in
@@ -247,7 +247,7 @@ function! GetHaskellIndent()
" >>foo
"
if l:prevline =~ '\C\<where\>\s*$'
- return indent(v:lnum - 1) + get(g:, 'haskell_indent_after_bare_where', &shiftwidth)
+ return indent(v:lnum - 1) + get(g:, 'haskell_indent_after_bare_where', shiftwidth())
endif
" do
@@ -256,7 +256,7 @@ function! GetHaskellIndent()
" foo =
" >>bar
if l:prevline =~ '\C\(\<do\>\|=\)\s*$'
- return indent(v:lnum - 1) + &shiftwidth
+ return indent(v:lnum - 1) + shiftwidth()
endif
" do foo
@@ -272,7 +272,7 @@ function! GetHaskellIndent()
" >>bar -> quux
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
if get(g:,'haskell_indent_case_alternative', 0)
- return indent(v:lnum - 1) + &shiftwidth
+ return indent(v:lnum - 1) + shiftwidth()
else
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
endif
@@ -305,7 +305,7 @@ function! GetHaskellIndent()
" newtype Foo = Foo
" >>deriving
if l:prevline =~ '\C^\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
- return indent(v:lnum - 1) + &shiftwidth
+ return indent(v:lnum - 1) + shiftwidth()
endif
" foo :: Int
@@ -318,7 +318,7 @@ function! GetHaskellIndent()
if l:line =~ '^\s*[-=]>'
return match(l:prevline, '::\s')
elseif match(l:prevline, '^\s\+::') > -1
- return match(l:prevline, '::\s') - &shiftwidth
+ return match(l:prevline, '::\s') - shiftwidth()
endif
endif
@@ -398,13 +398,13 @@ function! GetHaskellIndent()
">>>>>=> Int
if l:prevline =~ '^\s*)' && l:line =~ '^\s*=>'
let l:s = match(l:prevline, ')')
- return l:s - (&shiftwidth + 1)
+ return l:s - (shiftwidth() + 1)
endif
" module Foo
" >>( bar
if l:prevline =~ '\C^\<module\>'
- return &shiftwidth
+ return shiftwidth()
endif
" foo
@@ -412,7 +412,7 @@ function! GetHaskellIndent()
if l:line =~ '^\s*{'
let l:s = indent(v:lnum - 1)
if l:s >= 0
- return l:s + &shiftwidth
+ return l:s + shiftwidth()
endif
endif
@@ -428,7 +428,7 @@ function! GetHaskellIndent()
return match(l:prevline, 'in') - g:haskell_indent_in
endif
- return indent(v:lnum - 1) + get(g:, 'haskell_indent_before_where', &shiftwidth)
+ return indent(v:lnum - 1) + get(g:, 'haskell_indent_before_where', shiftwidth())
endif
" let x = 1
@@ -462,13 +462,13 @@ function! GetHaskellIndent()
" >>=
if l:line =~ '^\s*='
if l:prevline =~ '\C^\<data\>\s\+[^=]\+\s*$'
- return match(l:prevline, '\C\<data\>') + &shiftwidth
+ return match(l:prevline, '\C\<data\>') + shiftwidth()
else
let l:s = s:indentGuard(match(l:line, '='), l:prevline)
if l:s > 0
return l:s
else
- return &shiftwidth
+ return shiftwidth()
endif
endif
endif
@@ -493,7 +493,7 @@ function! GetHaskellIndent()
" foo
" >>:: Int
if l:line =~ '^\s*::\s'
- return indent(v:lnum - 1) + &shiftwidth
+ return indent(v:lnum - 1) + shiftwidth()
endif
" indent closing brace, paren or bracket
diff --git a/indent/html.vim b/indent/html.vim
index 07c6aa6f..96b32b62 100644
--- a/indent/html.vim
+++ b/indent/html.vim
@@ -5,7 +5,7 @@ endif
" Vim indent script for HTML
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
-" Last Change: 2020 Dec 11
+" Last Change: 2021 Jan 26
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -945,11 +945,11 @@ func! s:InsideTag(foundHtmlString)
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
endif
if idx == -1
- " after just "<tag" indent one level more
+ " after just "<tag" indent two levels more
let idx = match(text, '<' . s:tagname . '$')
if idx >= 0
- call cursor(lnum, idx)
- return virtcol('.') + shiftwidth()
+ call cursor(lnum, idx + 1)
+ return virtcol('.') - 1 + shiftwidth() * 2
endif
endif
if idx > 0
diff --git a/indent/julia.vim b/indent/julia.vim
index c2a55922..c4c17245 100644
--- a/indent/julia.vim
+++ b/indent/julia.vim
@@ -261,7 +261,7 @@ function GetJuliaNestingBrackets(lnum, c)
if len(brackets_stack) > 0
let first_open_bracket = brackets_stack[0][1]
let last_open_bracket = brackets_stack[-1][1]
- if brackets_stack[-1][0] == 'par' && IsFunctionArgPar(a:lnum, last_open_bracket)
+ if brackets_stack[-1][0] == 'par' && IsFunctionArgPar(a:lnum, last_open_bracket+1)
let infuncargs = 1
endif
endif
@@ -295,8 +295,8 @@ function IsFunctionArgPar(lnum, c)
if a:c == 0
return 0
endif
- let stack = map(synstack(a:lnum, a:c-1), 'synIDattr(v:val, "name")')
- return stack[-1] == 'juliaFunctionBlock'
+ let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
+ return len(stack) >= 3 && stack[-3] == 'juliaFunctionDefP'
endfunction
function JumpToMatch(lnum, last_closed_bracket)
@@ -394,13 +394,14 @@ function GetJuliaIndent()
let ind = indent(lnum)
endif
- " Does the current line starts with a closing bracket? Then depending on
+ " Does the current line start with a closing bracket? Then depending on
" the situation we align it with the opening one, or we let the rest of
" the code figure it out (the case in which we're closing a function
" argument list is special-cased)
if JuliaMatch(v:lnum, getline(v:lnum), '[])}]', indent(v:lnum)) == indent(v:lnum) && ind > 0
if !align_brackets && !align_funcargs
- let ind = -1
+ call JumpToMatch(v:lnum, indent(v:lnum))
+ return indent(line("."))
elseif (align_brackets && getline(v:lnum)[indent(v:lnum)] != ')') || align_funcargs
return ind - 1
else " must be a ')' and align_brackets==1 and align_funcargs==0
@@ -447,7 +448,6 @@ function GetJuliaIndent()
" if the opening line has a colon followed by non-comments, use it as
" reference point
let cind = JuliaMatch(lnum, prevline, ':', indent(lnum), lim)
- " echo "cind=".string(cind) | sleep 1
if cind >= 0
let nonwhiteind = JuliaMatch(lnum, prevline, '\S', cind+1)
if nonwhiteind >= 0
diff --git a/indent/puppet.vim b/indent/puppet.vim
index cabde843..1067e9e0 100644
--- a/indent/puppet.vim
+++ b/indent/puppet.vim
@@ -105,11 +105,16 @@ function! GetPuppetIndent(...)
let ind = indent(s:PrevNonMultilineString(pnum - 1))
endif
- if pline =~ '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
+ let l:bracketAtEndOfLinePattern = '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
+ if pline =~ l:bracketAtEndOfLinePattern
+ let l:i = match(pline, l:bracketAtEndOfLinePattern)
+ let l:syntaxType = synIDattr(synID(pnum, l:i + 1, 0), 'name')
+ if l:syntaxType !~# '\(Comment\|String\)$'
let ind += &sw
+ endif
elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*'
let ind -= &sw
- elseif pline =~ '^\s*include\s\+.*,$' && pline !~ '[=+]>'
+ elseif pline =~# '^\s*include\s\+.*,$' && pline !~ '[=+]>'
let ind += &sw
endif
diff --git a/indent/ruby.vim b/indent/ruby.vim
index d061edfb..afa72995 100644
--- a/indent/ruby.vim
+++ b/indent/ruby.vim
@@ -646,8 +646,7 @@ function! s:PreviousNotMSL(msl_info) abort
" TODO (2016-10-07) Wrong/unused? How could it be "1"?
return indent(info.plnum) - 1
" If previous line is a continuation return its indent.
- " TODO: the || s:IsInString() thing worries me a bit.
- elseif s:Match(info.plnum, s:non_bracket_continuation_regex) || s:IsInString(info.plnum, strlen(line))
+ elseif s:Match(info.plnum, s:non_bracket_continuation_regex)
return indent(info.plnum)
endif
endif