mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
parent
ac83c6eba6
commit
2081504a33
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
" Maintainer: Dávid Szabó ( complex857 AT gmail DOT com )
|
||||
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" URL: https://github.com/shawncplus/phpcomplete.vim
|
||||
" Last Change: 2018 Oct 10
|
||||
" Last Change: 2021 Feb 08
|
||||
"
|
||||
" OPTIONS:
|
||||
"
|
||||
@ -122,7 +122,6 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
" If exists b:php_menu it means completion was already constructed we
|
||||
" don't need to do anything more
|
||||
if exists("b:php_menu")
|
||||
@ -148,8 +147,6 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
||||
try
|
||||
let eventignore = &eventignore
|
||||
let &eventignore = 'all'
|
||||
let winheight = winheight(0)
|
||||
let winnr = winnr()
|
||||
|
||||
let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.')))
|
||||
|
||||
@ -183,7 +180,6 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
||||
endif
|
||||
|
||||
if filereadable(classlocation)
|
||||
let classfile = readfile(classlocation)
|
||||
let classcontent = ''
|
||||
let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname)
|
||||
let sccontent = split(classcontent, "\n")
|
||||
@ -217,7 +213,6 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{
|
||||
return phpcomplete#CompleteGeneral(a:base, current_namespace, imports)
|
||||
endif
|
||||
finally
|
||||
silent! exec winnr.'resize '.winheight
|
||||
let &eventignore = eventignore
|
||||
endtry
|
||||
endfunction
|
||||
@ -1025,7 +1020,7 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) "
|
||||
let c_var = '$'.c_var
|
||||
endif
|
||||
let c_variables[c_var] = ''
|
||||
if g:phpcomplete_parse_docblock_comments && len(get(variables, var_index)) > 0
|
||||
if g:phpcomplete_parse_docblock_comments && len(get(variables, var_index, '')) > 0
|
||||
let c_doc[c_var] = phpcomplete#GetDocBlock(a:sccontent, variables[var_index])
|
||||
endif
|
||||
let var_index += 1
|
||||
@ -2082,26 +2077,17 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
|
||||
" ...
|
||||
" ]
|
||||
"
|
||||
let full_file_path = fnamemodify(a:file_path, ':p')
|
||||
let class_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*'
|
||||
let cfile = join(a:file_lines, "\n")
|
||||
let full_file_path = fnamemodify(a:file_path, ':p')
|
||||
let result = []
|
||||
" We use new buffer and (later) normal! because
|
||||
" this is the most efficient way. The other way
|
||||
" is to go through the looong string looking for
|
||||
" matching {}
|
||||
let popup_id = popup_create(a:file_lines, {'hidden': v:true})
|
||||
|
||||
" remember the window we started at
|
||||
let phpcomplete_original_window = winnr()
|
||||
call win_execute(popup_id, 'call search(''\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)'')')
|
||||
call win_execute(popup_id, "let cfline = line('.')")
|
||||
call win_execute(popup_id, "call search('{')")
|
||||
call win_execute(popup_id, "let endline = line('.')")
|
||||
|
||||
silent! below 1new
|
||||
silent! 0put =cfile
|
||||
call search('\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)')
|
||||
let cfline = line('.')
|
||||
call search('{')
|
||||
let endline = line('.')
|
||||
|
||||
let content = join(getline(cfline, endline), "\n")
|
||||
call win_execute(popup_id, 'let content = join(getline('.cfline.', '.endline.'), "\n")')
|
||||
" Catch extends
|
||||
if content =~? 'extends'
|
||||
let extends_string = matchstr(content, '\(class\|interface\)\_s\+'.a:class_name.'\_.\+extends\_s\+\zs\('.class_name_pattern.'\(,\|\_s\)*\)\+\ze\(extends\|{\)')
|
||||
@ -2117,14 +2103,16 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
|
||||
else
|
||||
let implemented_interfaces = []
|
||||
endif
|
||||
call searchpair('{', '', '}', 'W')
|
||||
let class_closing_bracket_line = line('.')
|
||||
|
||||
call win_execute(popup_id, 'let [class_closing_bracket_line, class_closing_bracket_col] = searchpairpos("{", "", "}", "W")')
|
||||
|
||||
" Include class docblock
|
||||
let doc_line = cfline - 1
|
||||
if getline(doc_line) =~? '^\s*\*/'
|
||||
call win_execute(popup_id, 'let l = getline('.doc_line.')')
|
||||
if l =~? '^\s*\*/'
|
||||
while doc_line != 0
|
||||
if getline(doc_line) =~? '^\s*/\*\*'
|
||||
call win_execute(popup_id, 'let l = getline('.doc_line.')')
|
||||
if l =~? '^\s*/\*\*'
|
||||
let cfline = doc_line
|
||||
break
|
||||
endif
|
||||
@ -2132,22 +2120,22 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
|
||||
endwhile
|
||||
endif
|
||||
|
||||
let classcontent = join(getline(cfline, class_closing_bracket_line), "\n")
|
||||
call win_execute(popup_id, 'let classcontent = join(getline('.cfline.', '.class_closing_bracket_line.'), "\n")')
|
||||
|
||||
let used_traits = []
|
||||
" move back to the line next to the class's definition
|
||||
call cursor(endline + 1, 1)
|
||||
call win_execute(popup_id, 'call cursor('.(endline + 1).', 1)')
|
||||
let keep_searching = 1
|
||||
while keep_searching != 0
|
||||
" try to grab "use..." keywords
|
||||
let [lnum, col] = searchpos('\c^\s\+use\s\+'.class_name_pattern, 'cW', class_closing_bracket_line)
|
||||
let syn_name = synIDattr(synID(lnum, col, 0), "name")
|
||||
call win_execute(popup_id, 'let [lnum, col] = searchpos(''\c^\s\+use\s\+'.class_name_pattern.''', "cW", '.class_closing_bracket_line.')')
|
||||
call win_execute(popup_id, 'let syn_name = synIDattr(synID('.lnum.', '.col.', 0), "name")')
|
||||
if syn_name =~? 'string\|comment'
|
||||
call cursor(lnum + 1, 1)
|
||||
call win_execute(popup_id, 'call cursor('.(lnum + 1).', 1)')
|
||||
continue
|
||||
endif
|
||||
|
||||
let trait_line = getline(lnum)
|
||||
call win_execute(popup_id, 'let trait_line = getline('.lnum.')')
|
||||
if trait_line !~? ';'
|
||||
" try to find the next line containing ';'
|
||||
let l = lnum
|
||||
@ -2157,25 +2145,23 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
|
||||
while search_line !~? ';' && l > 0
|
||||
" file lines are reversed so we need to go backwards
|
||||
let l += 1
|
||||
let search_line = getline(l)
|
||||
call win_execute(popup_id, 'let search_line = getline('.l.')')
|
||||
let trait_line .= ' '.substitute(search_line, '\(^\s\+\|\s\+$\)', '', 'g')
|
||||
endwhile
|
||||
endif
|
||||
let use_expression = matchstr(trait_line, '^\s*use\s\+\zs.\{-}\ze;')
|
||||
let use_parts = map(split(use_expression, '\s*,\s*'), 'substitute(v:val, "\\s+", " ", "g")')
|
||||
let used_traits += map(use_parts, 'substitute(v:val, "\\s", "", "g")')
|
||||
call cursor(lnum + 1, 1)
|
||||
call win_execute(popup_id, 'call cursor('.(lnum + 1).', 1)')
|
||||
|
||||
if [lnum, col] == [0, 0]
|
||||
let keep_searching = 0
|
||||
endif
|
||||
endwhile
|
||||
|
||||
silent! bw! %
|
||||
call popup_close(popup_id)
|
||||
|
||||
let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(a:file_lines[0:cfline])
|
||||
" go back to original window
|
||||
exe phpcomplete_original_window.'wincmd w'
|
||||
call add(result, {
|
||||
\ 'class': a:class_name,
|
||||
\ 'content': classcontent,
|
||||
@ -2532,40 +2518,37 @@ function! phpcomplete#FormatDocBlock(info) " {{{
|
||||
endif
|
||||
|
||||
return res
|
||||
endfunction!
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{
|
||||
let original_window = winnr()
|
||||
|
||||
silent! below 1new
|
||||
silent! 0put =a:file_lines
|
||||
normal! G
|
||||
let popup_id = popup_create(a:file_lines, {'hidden': v:true})
|
||||
call win_execute(popup_id, 'normal! G')
|
||||
|
||||
" clear out classes, functions and other blocks
|
||||
while 1
|
||||
let block_start_pos = searchpos('\c\(class\|trait\|function\|interface\)\s\+\_.\{-}\zs{', 'Web')
|
||||
call win_execute(popup_id, 'let block_start_pos = searchpos(''\c\(class\|trait\|function\|interface\)\s\+\_.\{-}\zs{'', "Web")')
|
||||
if block_start_pos == [0, 0]
|
||||
break
|
||||
endif
|
||||
let block_end_pos = searchpairpos('{', '', '}\|\%$', 'W', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"')
|
||||
call win_execute(popup_id, 'let block_end_pos = searchpairpos("{", "", ''}\|\%$'', "W", ''synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'')')
|
||||
|
||||
let popup_lines = winbufnr(popup_id)->getbufline(1, '$')
|
||||
if block_end_pos != [0, 0]
|
||||
" end of the block found, just delete it
|
||||
silent! exec block_start_pos[0].','.block_end_pos[0].'d _'
|
||||
call remove(popup_lines, block_start_pos[0] - 1, block_end_pos[0] - 1)
|
||||
else
|
||||
" block pair not found, use block start as beginning and the end
|
||||
" of the buffer instead
|
||||
silent! exec block_start_pos[0].',$d _'
|
||||
call remove(popup_lines, block_start_pos[0] - 1, -1)
|
||||
endif
|
||||
call popup_settext(popup_id, popup_lines)
|
||||
endwhile
|
||||
normal! G
|
||||
call win_execute(popup_id, 'normal! G', 'silent!')
|
||||
|
||||
" grab the remains
|
||||
let file_lines = reverse(getline(1, line('.') - 1))
|
||||
|
||||
silent! bw! %
|
||||
exe original_window.'wincmd w'
|
||||
call win_execute(popup_id, "let file_lines = reverse(getline(1, line('.')-1))")
|
||||
call popup_close(popup_id)
|
||||
|
||||
let namespace_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*'
|
||||
let i = 0
|
||||
|
@ -606,14 +606,14 @@ the use of square and curly brackets, and otherwise by community convention.
|
||||
These conventions are not universally followed, so the Clojure indent script
|
||||
offers a few configurable options, listed below.
|
||||
|
||||
If the current vim does not include |searchpairpos()|, the indent script falls
|
||||
If the current vim does not include searchpairpos(), the indent script falls
|
||||
back to normal 'lisp' indenting, and the following options are ignored.
|
||||
|
||||
*g:clojure_maxlines*
|
||||
|
||||
Set maximum scan distance of |searchpairpos()|. Larger values trade
|
||||
performance for correctness when dealing with very long forms. A value of 0
|
||||
will scan without limits.
|
||||
Set maximum scan distance of searchpairpos(). Larger values trade performance
|
||||
for correctness when dealing with very long forms. A value of 0 will scan
|
||||
without limits.
|
||||
>
|
||||
" Default
|
||||
let g:clojure_maxlines = 100
|
||||
|
@ -3728,8 +3728,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
*lcs-lead*
|
||||
lead:c Character to show for leading spaces. When omitted,
|
||||
leading spaces are blank. Overrides the "space"
|
||||
setting for leading spaces.
|
||||
*lcs-trail*
|
||||
setting for leading spaces. You can combine it with
|
||||
"tab:", for example: >
|
||||
:set listchars+=tab:>-,lead:.
|
||||
< *lcs-trail*
|
||||
trail:c Character to show for trailing spaces. When omitted,
|
||||
trailing spaces are blank. Overrides the "space"
|
||||
setting for trailing spaces.
|
||||
|
@ -1006,6 +1006,12 @@ commands can be combined to create a NewGrep command: >
|
||||
'smartcase' is not used.
|
||||
If {pattern} is empty (e.g. // is specified), the last
|
||||
used search pattern is used. |last-pattern|
|
||||
|
||||
|QuickFixCmdPre| and |QuickFixCmdPost| are triggered.
|
||||
A file that is opened for matching may use a buffer
|
||||
number, but it is reused if possible to avoid
|
||||
consuming buffer numbers.
|
||||
|
||||
:{count}vim[grep] ...
|
||||
When a number is put before the command this is used
|
||||
as the maximum number of matches to find. Use
|
||||
|
@ -770,7 +770,11 @@ resulting file, when executed with a ":source" command:
|
||||
"options". Script-local mappings will not be written.
|
||||
2. Restores global variables that start with an uppercase letter and contain
|
||||
at least one lowercase letter, if 'sessionoptions' contains "globals".
|
||||
3. Unloads all currently loaded buffers.
|
||||
3. Closes all windows in the current tab page, except the current one; closes
|
||||
all tab pages except the current one (this results in currently loaded
|
||||
buffers to be unloaded, some may become hidden if 'hidden' is set or
|
||||
otherwise specified); wipes out the current buffer, if it is empty
|
||||
and unnamed.
|
||||
4. Restores the current directory if 'sessionoptions' contains "curdir", or
|
||||
sets the current directory to where the Session file is if 'sessionoptions'
|
||||
contains "sesdir".
|
||||
|
@ -186,7 +186,9 @@ CTRL-W CTRL_N *CTRL-W_CTRL-N*
|
||||
:[N]new [++opt] [+cmd] {file}
|
||||
:[N]sp[lit] [++opt] [+cmd] {file} *:split_f*
|
||||
Create a new window and start editing file {file} in it. This
|
||||
behaves like a ":split" first, and then an ":e" command.
|
||||
behaves almost like a ":split" first, and then an ":edit"
|
||||
command, but the alternate file name in the original window is
|
||||
set to {file}.
|
||||
If [+cmd] is given, execute the command when the file has been
|
||||
loaded |+cmd|.
|
||||
Also see |++opt|.
|
||||
|
@ -1,11 +1,11 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Clojure
|
||||
" Author: Meikel Brandmeyer <mb@kotka.de>
|
||||
"
|
||||
" 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_ftplugin")
|
||||
finish
|
||||
@ -43,7 +43,7 @@ setlocal commentstring=;\ %s
|
||||
" specially and hence are not indented specially.
|
||||
"
|
||||
" -*- LISPWORDS -*-
|
||||
" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj
|
||||
" Generated from https://github.com/clojure-vim/clojure.vim/blob/f8594e7030cdfb0b7990ac92953c77a08a7220f0/clj/src/vim_clojure_static/generate.clj
|
||||
setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test
|
||||
|
||||
" Provide insert mode completions for special forms and clojure.core. As
|
||||
@ -57,21 +57,6 @@ for s:setting in ['omnifunc', 'completefunc']
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Take all directories of the CLOJURE_SOURCE_DIRS environment variable
|
||||
" and add them to the path option.
|
||||
"
|
||||
" This is a legacy option for VimClojure users.
|
||||
if exists('$CLOJURE_SOURCE_DIRS')
|
||||
for s:dir in split($CLOJURE_SOURCE_DIRS, (has("win32") || has("win64")) ? ';' : ':')
|
||||
let s:dir = fnameescape(s:dir)
|
||||
" Whitespace escaping for Windows
|
||||
let s:dir = substitute(s:dir, '\', '\\\\', 'g')
|
||||
let s:dir = substitute(s:dir, '\ ', '\\ ', 'g')
|
||||
execute "setlocal path+=" . s:dir . "/**"
|
||||
endfor
|
||||
let b:undo_ftplugin .= ' | setlocal path<'
|
||||
endif
|
||||
|
||||
" Skip brackets in ignored syntax regions when using the % command
|
||||
if exists('loaded_matchit')
|
||||
let b:match_words = &matchpairs
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Vim
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Jan 23
|
||||
" Last Change: 2021 Feb 07
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@ -98,7 +98,7 @@ if exists("loaded_matchit")
|
||||
" func name
|
||||
" require a parenthesis following, then there can be an "endfunc".
|
||||
let b:match_words =
|
||||
\ '\<\%(fu\%[nction]\|def\)\s\+\S\+(:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
+ \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+(:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
\ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
|
||||
\ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' .
|
||||
\ '{:},' .
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types in scripts
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2020 Aug 15
|
||||
" Last change: 2021 Jan 22
|
||||
|
||||
" This file is called by an autocommand for every file that has just been
|
||||
" loaded into a buffer. It checks if the type of file can be recognized by
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,9 +2,9 @@
|
||||
" Language: Groovy
|
||||
" Original Author: Alessio Pace <billy.corgan AT tiscali.it>
|
||||
" Maintainer: Tobias Rapp <yahuxo+vim AT mailbox.org>
|
||||
" Version: 0.1.17
|
||||
" Version: 0.1.18
|
||||
" URL: http://www.vim.org/scripts/script.php?script_id=945
|
||||
" Last Change: 2020 May 26
|
||||
" Last Change: 2021 Feb 03
|
||||
|
||||
" THE ORIGINAL AUTHOR'S NOTES:
|
||||
"
|
||||
@ -253,7 +253,8 @@ if exists("groovy_regex_strings")
|
||||
endif
|
||||
" syn region groovyELExpr start=+${+ end=+}+ keepend contained
|
||||
syn match groovyELExpr /\${.\{-}}/ contained
|
||||
syn match groovyELExpr /\$[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE_][a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]*/ contained
|
||||
" Fix: force use of the NFA regexp engine (2), see GitHub issue #7280
|
||||
syn match groovyELExpr /\%#=2\$[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE_][a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE0-9_.]*/ contained
|
||||
hi def link groovyELExpr Identifier
|
||||
|
||||
" TODO: better matching. I am waiting to understand how it really works in groovy
|
||||
|
@ -4,6 +4,7 @@
|
||||
" Latest Revision: 2008-06-29
|
||||
" Changes: 2008-06-29 support for RFC3339 tuimestamps James Vega
|
||||
" 2016 Jan 19: messagesDate changed by Bram
|
||||
" 2021 Jan 27: messagesHourRFC3339 changed from #946
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@ -26,7 +27,7 @@ syn match messagesDateRFC3339 contained display '\d\{4}-\d\d-\d\d'
|
||||
syn match messagesRFC3339T contained display '\cT'
|
||||
\ nextgroup=messagesHourRFC3339
|
||||
|
||||
syn match messagesHourRFC3339 contained display '\c\d\d:\d\d:\d\d\(\.\d\+\)\=\([+-]\d\d:\d\d\|Z\)'
|
||||
syn match messagesHourRFC3339 contained display '\c\d\d:\d\d:\d\d\(\.\d\+\)\=\([+-]\d\d:\d\d\|Z\)\s*'
|
||||
\ nextgroup=messagesHost
|
||||
|
||||
syn match messagesHost contained display '\S*\s*'
|
||||
|
Loading…
Reference in New Issue
Block a user