diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index 5dc88f1a..36622440 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -3,7 +3,7 @@ call ale#Set('go_staticcheck_executable', 'staticcheck') call ale#Set('go_staticcheck_options', '') -call ale#Set('go_staticcheck_lint_package', 0) +call ale#Set('go_staticcheck_lint_package', 1) call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#staticcheck#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index f00734e0..1ccbc505 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], @@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[3] is? 'warning' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 78f7dd10..5e231a3b 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:level = ale#Var(a:buffer, 'php_phpstan_level') let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') + let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist') - if empty(l:level) && empty(l:config_file_exists) + if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists) " if no configuration file is found, then use 4 as a default level let l:level = '4' endif diff --git a/sources_non_forked/ale/ale_linters/r/languageserver.vim b/sources_non_forked/ale/ale_linters/r/languageserver.vim index febe66bd..bab869d1 100644 --- a/sources_non_forked/ale/ale_linters/r/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/r/languageserver.vim @@ -1,4 +1,5 @@ " Author: Eric Zhao <21zhaoe@protonmail.com> +" Author: ourigen " Description: Implementation of the Language Server Protocol for R. call ale#Set('r_languageserver_cmd', 'languageserver::run()') @@ -7,7 +8,7 @@ call ale#Set('r_languageserver_config', {}) function! ale_linters#r#languageserver#GetCommand(buffer) abort let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') - return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) + return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) endfunction function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/racket/raco.vim b/sources_non_forked/ale/ale_linters/racket/raco.vim index e5ee4fb4..5b26065f 100644 --- a/sources_non_forked/ale/ale_linters/racket/raco.vim +++ b/sources_non_forked/ale/ale_linters/racket/raco.vim @@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { + \ 'filename': l:match[2], \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \ 'type': 'E', diff --git a/sources_non_forked/ale/ale_linters/solidity/solc.vim b/sources_non_forked/ale/ale_linters/solidity/solc.vim index e4f220ac..28977083 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solc.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solc.vim @@ -1,34 +1,52 @@ " Author: Karl Bartel - http://karl.berlin/ " Description: Report solc compiler errors in Solidity code +call ale#Set('solidity_solc_executable', 'solc') call ale#Set('solidity_solc_options', '') function! ale_linters#solidity#solc#Handle(buffer, lines) abort " Matches patterns like the following: - " /path/to/file/file.sol:1:10: Error: Identifier not found or not unique. - let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$' + " Error: Expected ';' but got '(' + " --> /path/to/file/file.sol:1:10:) + let l:pattern = '\v(Error|Warning): (.*)$' + let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'type': l:isError ? 'E' : 'W', - \}) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + let l:match = matchlist(l:line, l:line_and_column_pattern) + + if len(l:match) > 0 + let l:index = len(l:output) - 1 + let l:output[l:index]['lnum'] = l:match[1] + 0 + let l:output[l:index]['col'] = l:match[2] + 0 + endif + else + let l:isError = l:match[1] is? 'Error' + + call add(l:output, { + \ 'lnum': 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': l:isError ? 'E' : 'W', + \}) + endif endfor return l:output endfunction function! ale_linters#solidity#solc#GetCommand(buffer) abort - return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' + let l:executable = ale#Var(a:buffer, 'solidity_solc_executable') + + return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' endfunction call ale#linter#Define('solidity', { \ 'name': 'solc', -\ 'executable': 'solc', +\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')}, \ 'command': function('ale_linters#solidity#solc#GetCommand'), \ 'callback': 'ale_linters#solidity#solc#Handle', \ 'output_stream': 'stderr', diff --git a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim index 92ef4d63..5594e3b8 100644 --- a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim +++ b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim @@ -29,11 +29,18 @@ call ale#Set('spec_rpmlint_executable', 'rpmlint') call ale#Set('spec_rpmlint_options', '') -function! ale_linters#spec#rpmlint#GetCommand(buffer) abort +function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort + if ale#semver#GTE(a:version, [2, 0, 0]) + " The -o/--option flag was removed in version 2.0.0 + let l:version_dependent_args = '' + else + let l:version_dependent_args = ' -o "NetworkEnabled False"' + endif + return '%e' \ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options')) - \ . ' -o "NetworkEnabled False"' \ . ' -v' + \ . l:version_dependent_args \ . ' %t' endfunction @@ -73,6 +80,11 @@ endfunction call ale#linter#Define('spec', { \ 'name': 'rpmlint', \ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')}, -\ 'command': function('ale_linters#spec#rpmlint#GetCommand'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'spec_rpmlint_executable'), +\ '%e --version', +\ function('ale_linters#spec#rpmlint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#spec#rpmlint#Handle', \}) diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index ec9d4482..e729aec8 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -151,8 +151,6 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort \ || stridx(l:option, '-isystem') == 0 \ || stridx(l:option, '-idirafter') == 0 \ || stridx(l:option, '-iframework') == 0 - \ || stridx(l:option, '-include') == 0 - \ || stridx(l:option, '-imacros') == 0 if stridx(l:option, '-I') == 0 && l:option isnot# '-I' let l:arg = join(split(l:option, '\zs')[2:], '') let l:option = '-I' @@ -182,6 +180,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort " Options that have an argument (always separate) elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 \ || l:option is# '-isysroot' || l:option is# '-imultilib' + \ || l:option is# '-include' || l:option is# '-imacros' call add(l:items, [0, l:option]) call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 1cd5b6ef..0d110c79 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -316,6 +316,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['reason'], \ 'description': 'Fix ReasonML files with refmt.', \ }, +\ 'pandoc': { +\ 'function': 'ale#fixers#pandoc#Fix', +\ 'suggested_filetypes': ['markdown'], +\ 'description': 'Fix markdown files with pandoc.', +\ }, \ 'shfmt': { \ 'function': 'ale#fixers#shfmt#Fix', \ 'suggested_filetypes': ['sh'], @@ -441,6 +446,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with luafmt.', \ }, +\ 'stylua': { +\ 'function': 'ale#fixers#stylua#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with stylua.', +\ }, \ 'ormolu': { \ 'function': 'ale#fixers#ormolu#Fix', \ 'suggested_filetypes': ['haskell'], diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index 17697652..142cd983 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -18,20 +18,25 @@ endfunction function! ale#fixers#black#Fix(buffer) abort let l:executable = ale#fixers#black#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run black' - \ : '' - let l:options = ale#Var(a:buffer, 'python_black_options') + let l:cmd = [ale#Escape(l:executable)] - if expand('#' . a:buffer . ':e') is? 'pyi' - let l:options .= '--pyi' + if l:executable =~? 'pipenv$' + call extend(l:cmd, ['run', 'black']) endif - let l:result = { - \ 'command': ale#Escape(l:executable) . l:exec_args - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -', - \} + let l:options = ale#Var(a:buffer, 'python_black_options') + + if !empty(l:options) + call add(l:cmd, l:options) + endif + + if expand('#' . a:buffer . ':e') is? 'pyi' + call add(l:cmd, '--pyi') + endif + + call add(l:cmd, '-') + + let l:result = {'command': join(l:cmd, ' ')} if ale#Var(a:buffer, 'python_black_change_directory') let l:result.cwd = '%s:h' diff --git a/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim new file mode 100644 index 00000000..d704c8a2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 +" Author: Jesse Hathaway +" Description: Fix markdown files with pandoc. + +call ale#Set('markdown_pandoc_executable', 'pandoc') +call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -') + +function! ale#fixers#pandoc#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable') + let l:options = ale#Var(a:buffer, 'markdown_pandoc_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylua.vim b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim new file mode 100644 index 00000000..3521c935 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim @@ -0,0 +1,14 @@ +" Author: Robert Liebowitz +" Description: https://github.com/johnnymorganz/stylua + +call ale#Set('lua_stylua_executable', 'stylua') +call ale#Set('lua_stylua_options', '') + +function! ale#fixers#stylua#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_stylua_executable') + let l:options = ale#Var(a:buffer, 'lua_stylua_options') + + return { + \ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index c2ae5cc5..089aa2c0 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -44,6 +44,15 @@ function! s:ShouldOpen(buffer) abort return l:val is 1 || (l:val is# 'on_save' && l:saved) endfunction +function! s:Deduplicate(list) abort + let l:list = a:list + + call sort(l:list, function('ale#util#LocItemCompareWithText')) + call uniq(l:list, function('ale#util#LocItemCompareWithText')) + + return l:list +endfunction + function! ale#list#GetCombinedList() abort let l:list = [] @@ -51,10 +60,7 @@ function! ale#list#GetCombinedList() abort call extend(l:list, l:info.loclist) endfor - call sort(l:list, function('ale#util#LocItemCompareWithText')) - call uniq(l:list, function('ale#util#LocItemCompareWithText')) - - return l:list + return s:Deduplicate(l:list) endfunction function! s:FixList(buffer, list) abort @@ -99,11 +105,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort " but it's better than nothing. let l:ids = s:WinFindBuf(a:buffer) + let l:loclist = s:Deduplicate(a:loclist) + for l:id in l:ids if has('nvim') - call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) + call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title) else - call setloclist(l:id, s:FixList(a:buffer, a:loclist)) + call setloclist(l:id, s:FixList(a:buffer, l:loclist)) call setloclist(l:id, [], 'r', {'title': l:title}) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index 8b94aa7a..1aca03ea 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -1,7 +1,7 @@ " Author: w0rp " Description: Preview windows for showing whatever information in. -if !has_key(s:, 'last__list') +if !has_key(s:, 'last_list') let s:last_list = [] endif @@ -89,6 +89,13 @@ function! ale#preview#ShowSelection(item_list, ...) abort let b:ale_preview_item_list = a:item_list let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') + " Jump to an index for a previous selection, if set. + if has_key(l:options, 'jump_to_index') + let l:pos = getpos('.') + let l:pos[1] = l:options.jump_to_index + 1 + call setpos('.', l:pos) + endif + " Remember preview state, so we can repeat it later. call ale#preview#SetLastSelection(a:item_list, l:options) endfunction @@ -101,12 +108,16 @@ endfunction function! s:Open(open_in) abort let l:item_list = get(b:, 'ale_preview_item_list', []) - let l:item = get(l:item_list, getpos('.')[1] - 1, {}) + let l:index = getpos('.')[1] - 1 + let l:item = get(l:item_list, l:index, {}) if empty(l:item) return endif + " Remember an index to jump to when repeating a selection. + let s:last_options.jump_to_index = l:index + :q! call ale#util#Open( diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index 408f0c3c..db7c0924 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -46,5 +46,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* Default: `''` This variable can be set to pass additional options to the luafmt fixer. + + +=============================================================================== +stylua *ale-lua-stylua* + +g:ale_lua_stylua_executable *g:ale_lua_stylua_executable* + *b:ale_lua_stylua_executable* + Type: |String| + Default: `'stylua'` + + This variable can be set to use a different executable for stylua. + +g:ale_lua_stylua_options *g:ale_lua_stylua_options* + *b:ale_lua_stylua_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the stylua fixer. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt index 99848878..feb37fc9 100644 --- a/sources_non_forked/ale/doc/ale-markdown.txt +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -33,6 +33,25 @@ g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* This variable can be set to pass additional options to mdl. +=============================================================================== +pandoc *ale-markdown-pandoc* + +g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable* + *b:ale_markdown_pandoc_executable* + Type: |String| + Default: `'pandoc'` + + This variable can be set to specify where to find the pandoc executable + + +g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options* + *b:ale_markdown_pandoc_options* + Type: |String| + Default: `'-f gfm -t gfm -s -'` + + This variable can be set to change the default options passed to pandoc + + =============================================================================== prettier *ale-markdown-prettier* diff --git a/sources_non_forked/ale/doc/ale-solidity.txt b/sources_non_forked/ale/doc/ale-solidity.txt index b6e48675..c4d2f02f 100644 --- a/sources_non_forked/ale/doc/ale-solidity.txt +++ b/sources_non_forked/ale/doc/ale-solidity.txt @@ -5,6 +5,12 @@ ALE Solidity Integration *ale-solidity-options* =============================================================================== solc *ale-solidity-solc* +g:ale_solidity_solc_executable *g:ale_solidity_solc_executable* + *b:ale_solidity_solc_executable* + Type: |String| + Default: `'solc'` + + Override the invoked solc binary. For truffle/hardhat binaries. g:ale_solidity_solc_options *g:ale_solidity_solc_options* *b:ale_solidity_solc_options* @@ -33,4 +39,3 @@ solium *ale-solidity-solium* =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: - diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 4a901488..36399178 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -288,6 +288,7 @@ Notes: * `luac` * `luacheck` * `luafmt` + * `stylua` * Mail * `alex`!! * `languagetool`!! @@ -300,6 +301,7 @@ Notes: * `languagetool`!! * `markdownlint`!! * `mdl` + * `pandoc` * `prettier` * `proselint` * `redpen` diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index a126f360..5d2ff444 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -2843,9 +2843,11 @@ documented in additional help files. luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| luafmt................................|ale-lua-luafmt| + stylua................................|ale-lua-stylua| markdown................................|ale-markdown-options| markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| + pandoc................................|ale-markdown-pandoc| prettier..............................|ale-markdown-prettier| remark-lint...........................|ale-markdown-remark-lint| textlint..............................|ale-markdown-textlint| diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 7848d111..b94a8084 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -297,6 +297,7 @@ formatting. * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) * [luafmt](https://github.com/trixnz/lua-fmt) + * [stylua](https://github.com/johnnymorganz/stylua) * Mail * [alex](https://github.com/wooorm/alex) :floppy_disk: * [languagetool](https://languagetool.org/) :floppy_disk: @@ -309,6 +310,7 @@ formatting. * [languagetool](https://languagetool.org/) :floppy_disk: * [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk: * [mdl](https://github.com/mivok/markdownlint) + * [pandoc](https://pandoc.org) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index cb8a5147..14a95d64 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -553,7 +553,13 @@ endfunction function! s:NullError(...) abort let [out, exec_error] = s:SystemError(call('fugitive#Prepare', a:000)) - return [exec_error ? [] : split(out, "\1"), exec_error ? substitute(out, "\n$", "", "") : '', exec_error] + if exec_error + return [[], substitute(out, "\n$", "", "") : '', exec_error] + else + let list = split(out, "\1", 1) + call remove(list, -1) + return [list, '', exec_error] + endif endfunction function! s:TreeChomp(...) abort @@ -621,21 +627,23 @@ endfunction let s:config = {} function! fugitive#Config(...) abort - let dir = s:Dir() let name = '' let default = get(a:, 3, '') - if a:0 >= 2 && type(a:2) == type({}) + if a:0 >= 2 && type(a:2) == type({}) && !has_key(a:2, 'git_dir') let name = substitute(a:1, '^[^.]\+\|[^.]\+$', '\L&', 'g') return len(a:1) ? get(get(a:2, name, []), 0, default) : a:2 elseif a:0 >= 2 - let dir = a:2 + let dir = s:Dir(a:2) let name = a:1 - elseif a:0 == 1 && type(a:1) == type({}) + elseif a:0 == 1 && type(a:1) == type({}) && !has_key(a:1, 'git_dir') return a:1 - elseif a:0 == 1 && a:1 =~# '^[[:alnum:]-]\+\.' + elseif a:0 == 1 && type(a:1) == type('') && a:1 =~# '^[[:alnum:]-]\+\.' + let dir = s:Dir() let name = a:1 elseif a:0 == 1 - let dir = a:1 + let dir = s:Dir(a:1) + else + let dir = s:Dir() endif let name = substitute(name, '^[^.]\+\|[^.]\+$', '\L&', 'g') let dir_key = len(dir) ? dir : '_' @@ -664,6 +672,28 @@ function! fugitive#Config(...) abort return len(name) ? get(get(dict, name, []), 0, default) : dict endfunction +function! fugitive#ConfigGetAll(name, ...) abort + let config = fugitive#Config(a:0 ? a:1 : s:Dir()) + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + +function! fugitive#ConfigGetRegexp(pattern, ...) abort + let config = fugitive#Config(a:0 ? a:1 : s:Dir()) + let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)') + if a:pattern !~# '\\\@ '.tmp let sha1 = readfile(tmp)[0] let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+') @@ -2245,6 +2279,9 @@ function! fugitive#FileWriteCmd(...) abort return 'echoerr '.string('fugitive: '.error) endif finally + if exists('guioptions') + let &guioptions = guioptions + endif call delete(tmp) endtry endfunction @@ -2473,7 +2510,7 @@ augroup END function! s:AskPassArgs(dir) abort if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir)) + \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(fugitive#ConfigGetAll('core.askpass', a:dir)) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] elseif s:executable('ssh-askpass') @@ -2800,7 +2837,7 @@ function! fugitive#PagerFor(argv, ...) abort return 0 endif let config = a:0 ? a:1 : fugitive#Config() - let value = get(FugitiveConfigGetAll('pager.' . args[0], config), 0, -1) + let value = get(fugitive#ConfigGetAll('pager.' . args[0], config), 0, -1) if value =~# '^\%(true\|yes\|on\|1\)$' return 1 elseif value =~# '^\%(false\|no|off\|0\|\)$' @@ -3075,7 +3112,7 @@ function! s:CompletableSubcommands(dir) abort endif call extend(commands, s:path_subcommands[cpath]) endfor - call extend(commands, keys(FugitiveConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir))) + call extend(commands, keys(fugitive#ConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir))) let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+') let rejected = {} for command in configured @@ -3213,7 +3250,7 @@ function! s:StageSeek(info, fallback) abort if empty(info.heading) return a:fallback endif - let line = search('^' . escape(substitute(info.heading, '(\d\+)$', '', ''), '^$.*[]~\'), 'wn') + let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\+)$', 'wn') if !line for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, []) let line = search('^' . section, 'wn') @@ -3433,18 +3470,18 @@ function! s:StageInfo(...) abort endwhile endif let slnum = lnum + 1 - let section = '' + let heading = '' let index = 0 - while len(getline(slnum - 1)) && empty(section) + while len(getline(slnum - 1)) && empty(heading) let slnum -= 1 - let section = matchstr(getline(slnum), '^\u\l\+\ze.* (\d\+)$') - if empty(section) && getline(slnum) !~# '^[ @\+-]' + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') + if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif endwhile let text = matchstr(getline(lnum), '^[A-Z?] \zs.*') - return {'section': section, - \ 'heading': getline(slnum), + return {'section': matchstr(heading, '^\u\l\+'), + \ 'heading': heading, \ 'sigil': sigil, \ 'offset': offset, \ 'filename': text, @@ -3452,7 +3489,7 @@ function! s:StageInfo(...) abort \ 'paths': map(reverse(split(text, ' -> ')), 's:Tree() . "/" . v:val'), \ 'commit': matchstr(getline(lnum), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze '), \ 'status': matchstr(getline(lnum), '^[A-Z?]\ze \|^\%(\x\x\x\)\@!\l\+\ze [0-9a-f]'), - \ 'submodule': get(get(get(b:fugitive_files, section, {}), text, {}), 'submodule', ''), + \ 'submodule': get(get(get(b:fugitive_files, heading, {}), text, {}), 'submodule', ''), \ 'index': index} endfunction @@ -3486,11 +3523,11 @@ function! s:Selection(arg1, ...) abort let flnum -= 1 endwhile let slnum = flnum + 1 - let section = '' + let heading = '' let index = 0 - while len(getline(slnum - 1)) && empty(section) + while empty(heading) let slnum -= 1 - let heading = matchstr(getline(slnum), '^\u\l\+.* (\d\+)$') + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif @@ -3498,7 +3535,7 @@ function! s:Selection(arg1, ...) abort let results = [] let template = { \ 'heading': heading, - \ 'section': matchstr(heading, '^\u\l\+\ze.* (\d\+)$'), + \ 'section': matchstr(heading, '^\u\l\+'), \ 'filename': '', \ 'relative': [], \ 'paths': [], @@ -3510,9 +3547,10 @@ function! s:Selection(arg1, ...) abort let lnum = first - (arg1 == flnum ? 0 : 1) let root = s:Tree() . '/' while lnum <= last - if line =~# '^\u\l\+\ze.* (\d\+)$' - let template.heading = getline(lnum) - let template.section = matchstr(template.heading, '^\u\l\+\ze.* (\d\+)$') + let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\+)$') + if len(heading) + let template.heading = heading + let template.section = matchstr(heading, '^\u\l\+') let template.index = 0 elseif line =~# '^[ @\+-]' let template.index -= 1 @@ -5895,9 +5933,6 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort setlocal signcolumn=no endif execute "vertical resize ".(s:linechars('.\{-\}\s\+\d\+\ze)')+1) - call s:Map('n', 'A', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)", '') - call s:Map('n', 'C', ":exe 'vertical resize '.(linechars('^\\S\\+')+1+v:count)", '') - call s:Map('n', 'D', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)", '') redraw syncbind exe s:DoAutocmdChanged(temp_state) @@ -6128,6 +6163,9 @@ function! fugitive#BlameFileType() abort call s:Map('n', 'O', ':exe BlameCommit("tabedit")', '') call s:Map('n', 'p', ':exe BlameCommit("pedit")', '') call s:Map('n', '.', ": =substitute(BlameCommitFileLnum()[0],'^$','@','')") + call s:Map('n', 'A', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)", '') + call s:Map('n', 'C', ":exe 'vertical resize '.(linechars('^\\S\\+')+1+v:count)", '') + call s:Map('n', 'D', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)", '') endfunction augroup fugitive_blame diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 19f5ba2b..0df5068b 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -128,32 +128,20 @@ endfunction " structure of the return value as it is not guaranteed. If you want a full " dictionary of every config value, use FugitiveConfigGetRegexp('.*'). function! FugitiveConfig(...) abort - if a:0 >= 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir')) - return call('fugitive#Config', [a:1, FugitiveGitDir(a:2)] + a:000[2:-1]) - elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.') - return fugitive#Config(FugitiveGitDir(a:1)) - else - return call('fugitive#Config', a:000) - endif + return call('fugitive#Config', a:000) endfunction " FugitiveConfigGet() retrieves a Git configuration value. An optional second " argument provides the Git dir as with FugitiveFind(). Pass a blank string " to limit to the global config. function! FugitiveConfigGet(name, ...) abort - return call('FugitiveConfig', [a:name] + a:000) + return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, '')) endfunction " FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of " all values. function! FugitiveConfigGetAll(name, ...) abort - if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir') - let config = a:1 - else - let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) - endif - let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') - return copy(get(config, name, [])) + return call('fugitive#ConfigGetAll', [a:name] + a:000) endfunction " FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values @@ -161,23 +149,7 @@ endfunction " using a Vim regexp. Second argument has same semantics as " FugitiveConfigGet(). function! FugitiveConfigGetRegexp(pattern, ...) abort - if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir') - let config = a:1 - else - let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) - endif - let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)') - if a:pattern !~# '\\\@ 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index bae39ae8..292a8ce9 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -154,4 +154,7 @@ snippet us 'use strict'`!p snip.rv = semi(snip)` endsnippet +snippet imp "import" +import ${2} from ${1} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets index ee70ff0f..fd443156 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets @@ -48,3 +48,9 @@ endsnippet snippet useR "useRef(defaultValue)" b const ${1:ref} = useRef(${2:null}) endsnippet +snippet ir "import React" +import React from "react" +endsnippet +snippet irc "import React and Component" +import React, { Component } from "react" +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets b/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets index 11072ddd..aa4efb62 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets @@ -1,3 +1,18 @@ priority -50 extends javascript + +snippet int "interface" +interface ${1} { +} +endsnippet +snippet nspc "namespace" +namespace ${1} { +} +endsnippet +priority -49 +snippet fun "function (named)" b +function ${1:function_name} (${2:argument}: ${3:argument_type}) { + ${VISUAL}$0 +} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets new file mode 100644 index 00000000..566a20b0 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets @@ -0,0 +1,12 @@ +priority -50 +extends javascript_react +extends typescript + +priority -49 +snippet rfc "react functional component" +import React, { FC } from "react" + +interface ${1:function_name}Props {${4:props_types}} + +export const ${1:function_name}: FC<${1:function_name}Props> = (${2:props}) => ${3:function_body} +endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 2828f2fb..c769baab 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -38,7 +38,7 @@ snippet i ${0:${VISUAL}} } snippet t. - $this-> + \$this-> snippet f function ${1}(${3}) {