Update runtime files
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
" Vim indent file
|
||||
" Language: Clojure
|
||||
" Author: Meikel Brandmeyer <mb@kotka.de>
|
||||
" URL: http://kotka.de/projects/clojure/vimclojure.html
|
||||
"
|
||||
" Maintainer: Sung Pae <self@sungpae.com>
|
||||
" URL: https://github.com/guns/vim-clojure-static
|
||||
" License: Same as Vim
|
||||
" Last Change: 18 July 2016
|
||||
" Language: Clojure
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" Former Maintainers: Sung Pae <self@sungpae.com>
|
||||
" Meikel Brandmeyer <mb@kotka.de>
|
||||
" URL: https://github.com/clojure-vim/clojure.vim
|
||||
" License: Vim (see :h license)
|
||||
" Last Change: 2021-02-13
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
@ -87,7 +86,7 @@ if exists("*searchpairpos")
|
||||
function! s:match_pairs(open, close, stopat)
|
||||
" Stop only on vector and map [ resp. {. Ignore the ones in strings and
|
||||
" comments.
|
||||
if a:stopat == 0
|
||||
if a:stopat == 0 && g:clojure_maxlines > 0
|
||||
let stopat = max([line(".") - g:clojure_maxlines, 0])
|
||||
else
|
||||
let stopat = a:stopat
|
||||
@ -121,7 +120,7 @@ if exists("*searchpairpos")
|
||||
if s:syn_id_name() !~? "string"
|
||||
return -1
|
||||
endif
|
||||
if s:current_char() != '\\'
|
||||
if s:current_char() != '\'
|
||||
return -1
|
||||
endif
|
||||
call cursor(0, col("$") - 1)
|
||||
@ -170,7 +169,35 @@ if exists("*searchpairpos")
|
||||
|
||||
call search('\S', 'W')
|
||||
let w = s:strip_namespace_and_macro_chars(s:current_word())
|
||||
|
||||
if g:clojure_special_indent_words =~# '\V\<' . w . '\>'
|
||||
|
||||
" `letfn` is a special-special-case.
|
||||
if w ==# 'letfn'
|
||||
" Earlier code left the cursor at:
|
||||
" (letfn [...] ...)
|
||||
" ^
|
||||
|
||||
" Search and get coordinates of first `[`
|
||||
" (letfn [...] ...)
|
||||
" ^
|
||||
call search('\[', 'W')
|
||||
let pos = getcurpos()
|
||||
let letfn_bracket = [pos[1], pos[2]]
|
||||
|
||||
" Move cursor to start of the form this function was
|
||||
" initially called on. Grab the coordinates of the
|
||||
" closest outer `[`.
|
||||
call cursor(a:position)
|
||||
let outer_bracket = s:match_pairs('\[', '\]', 0)
|
||||
|
||||
" If the located square brackets are not the same,
|
||||
" don't use special-case formatting.
|
||||
if outer_bracket != letfn_bracket
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
|
||||
return 1
|
||||
endif
|
||||
|
||||
@ -190,11 +217,7 @@ if exists("*searchpairpos")
|
||||
" Check if form is a reader conditional, that is, it is prefixed by #?
|
||||
" or @#?
|
||||
function! s:is_reader_conditional_special_case(position)
|
||||
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||
endfunction
|
||||
|
||||
" Returns 1 for opening brackets, -1 for _anything else_.
|
||||
@ -261,7 +284,7 @@ if exists("*searchpairpos")
|
||||
call cursor(paren)
|
||||
|
||||
if s:is_method_special_case(paren)
|
||||
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
||||
endif
|
||||
|
||||
if s:is_reader_conditional_special_case(paren)
|
||||
@ -292,6 +315,19 @@ if exists("*searchpairpos")
|
||||
return paren
|
||||
endif
|
||||
|
||||
" If the keyword begins with #, check if it is an anonymous
|
||||
" function or set, in which case we indent by the shiftwidth
|
||||
" (minus one if g:clojure_align_subforms = 1), or if it is
|
||||
" ignored, in which case we use the ( position for indent.
|
||||
if w[0] == "#"
|
||||
" TODO: Handle #=() and other rare reader invocations?
|
||||
if w[1] == '(' || w[1] == '{'
|
||||
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
|
||||
elseif w[1] == '_'
|
||||
return paren
|
||||
endif
|
||||
endif
|
||||
|
||||
" Test words without namespace qualifiers and leading reader macro
|
||||
" metacharacters.
|
||||
"
|
||||
@ -299,19 +335,19 @@ if exists("*searchpairpos")
|
||||
let ww = s:strip_namespace_and_macro_chars(w)
|
||||
|
||||
if &lispwords =~# '\V\<' . ww . '\>'
|
||||
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
||||
endif
|
||||
|
||||
if g:clojure_fuzzy_indent
|
||||
\ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
|
||||
\ && s:match_one(g:clojure_fuzzy_indent_patterns, ww)
|
||||
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
||||
endif
|
||||
|
||||
call search('\v\_s', 'cW')
|
||||
call search('\v\S', 'W')
|
||||
if paren[0] < line(".")
|
||||
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : shiftwidth() - 1)]
|
||||
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
|
||||
endif
|
||||
|
||||
call search('\v\S', 'bW')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" 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.
|
||||
@ -941,11 +941,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
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
" Previous Maintainer: Nikolai Weibull <now at bitwi.se>
|
||||
" URL: https://github.com/vim-ruby/vim-ruby
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2019 Dec 08
|
||||
|
||||
" 0. Initialization {{{1
|
||||
" =================
|
||||
@ -27,7 +26,12 @@ endif
|
||||
|
||||
if !exists('g:ruby_indent_block_style')
|
||||
" Possible values: "expression", "do"
|
||||
let g:ruby_indent_block_style = 'expression'
|
||||
let g:ruby_indent_block_style = 'do'
|
||||
endif
|
||||
|
||||
if !exists('g:ruby_indent_hanging_elements')
|
||||
" Non-zero means hanging indents are enabled, zero means disabled
|
||||
let g:ruby_indent_hanging_elements = 1
|
||||
endif
|
||||
|
||||
setlocal nosmartindent
|
||||
@ -322,7 +326,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort
|
||||
|
||||
if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0
|
||||
if closing_bracket == ')' && col('.') != col('$') - 1
|
||||
let ind = virtcol('.') - 1
|
||||
if g:ruby_indent_hanging_elements
|
||||
let ind = virtcol('.') - 1
|
||||
else
|
||||
let ind = indent(line('.'))
|
||||
end
|
||||
elseif g:ruby_indent_block_style == 'do'
|
||||
let ind = indent(line('.'))
|
||||
else " g:ruby_indent_block_style == 'expression'
|
||||
@ -547,7 +555,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort
|
||||
let [opening, closing] = s:ExtraBrackets(info.plnum)
|
||||
|
||||
if opening.pos != -1
|
||||
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||
if !g:ruby_indent_hanging_elements
|
||||
return indent(info.plnum) + info.sw
|
||||
elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||
if col('.') + 1 == col('$')
|
||||
return indent(info.plnum) + info.sw
|
||||
else
|
||||
@ -632,8 +642,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
|
||||
|
||||
@ -19,7 +19,7 @@ div#d2 { color: green; }
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="foo bar">
|
||||
class="foo bar">
|
||||
text
|
||||
</div>
|
||||
|
||||
|
||||
@ -15,6 +15,21 @@ let x = [
|
||||
\ ]
|
||||
endif
|
||||
|
||||
" TODO: add searchpair() to find matching {
|
||||
"for x in [
|
||||
"{
|
||||
"key: 'value'
|
||||
"},
|
||||
"]
|
||||
"eval 0
|
||||
"endfor
|
||||
|
||||
for x in [
|
||||
{key: 'value'},
|
||||
]
|
||||
eval 0
|
||||
endfor
|
||||
|
||||
" END_INDENT
|
||||
|
||||
" START_INDENT
|
||||
|
||||
@ -15,6 +15,21 @@ if 1
|
||||
\ ]
|
||||
endif
|
||||
|
||||
" TODO: add searchpair() to find matching {
|
||||
"for x in [
|
||||
"{
|
||||
"key: 'value'
|
||||
"},
|
||||
"]
|
||||
"eval 0
|
||||
"endfor
|
||||
|
||||
for x in [
|
||||
{key: 'value'},
|
||||
]
|
||||
eval 0
|
||||
endfor
|
||||
|
||||
" END_INDENT
|
||||
|
||||
" START_INDENT
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: Vim script
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Jan 21
|
||||
" Last Change: 2021 Feb 13
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
@ -99,7 +99,9 @@ function GetVimIndentIntern()
|
||||
let ind = ind + shiftwidth()
|
||||
else
|
||||
" A line starting with :au does not increment/decrement indent.
|
||||
if prev_text !~ '^\s*au\%[tocmd]'
|
||||
" A { may start a block or a dict. Assume that when a } follows it's a
|
||||
" terminated dict.
|
||||
if prev_text !~ '^\s*au\%[tocmd]' && prev_text !~ '^\s*{.*}'
|
||||
let i = match(prev_text, '\(^\||\)\s*\(export\s\+\)\?\({\|\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\|finall\%[y]\|fu\%[nction]\|def\|el\%[seif]\)\>\)')
|
||||
if i >= 0
|
||||
let ind += shiftwidth()
|
||||
@ -152,13 +154,17 @@ function GetVimIndentIntern()
|
||||
endif
|
||||
|
||||
" Below a line starting with "]" we must be below the end of a list.
|
||||
if prev_text_end =~ '^\s*]'
|
||||
" Include a "}" and "},} in case a dictionary ends too.
|
||||
if prev_text_end =~ '^\s*\(},\=\s*\)\=]'
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
|
||||
let ends_in_comment = has('syntax_items')
|
||||
\ && synIDattr(synID(lnum, col('$'), 1), "name") =~ '\(Comment\|String\)$'
|
||||
|
||||
" A line ending in "{"/"[} is most likely the start of a dict/list literal,
|
||||
" indent the next line more. Not for a continuation line.
|
||||
if prev_text_end =~ '[{[]\s*$' && !found_cont
|
||||
" indent the next line more. Not for a continuation line or {{{.
|
||||
if !ends_in_comment && prev_text_end =~ '\s[{[]\s*$' && !found_cont
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user