From 65de68fa883e2a24477b6a18e43893aecfaf1c28 Mon Sep 17 00:00:00 2001 From: Amir Date: Fri, 30 Jul 2021 22:52:54 +0200 Subject: [PATCH] Updated plugins --- .../ale/ale_linters/ansible/ansible_lint.vim | 4 +- .../ale/ale_linters/clojure/clj_kondo.vim | 14 +- .../ale/ale_linters/dart/dart_analyze.vim | 28 ++ .../ale/ale_linters/dockerfile/hadolint.vim | 6 +- .../ale/ale_linters/erlang/erlc.vim | 6 +- .../ale/ale_linters/php/phpstan.vim | 31 +- .../ale/ale_linters/python/bandit.vim | 10 +- .../ale/ale_linters/python/flake8.vim | 8 +- .../ale/ale_linters/python/mypy.vim | 8 +- .../ale/ale_linters/python/prospector.vim | 8 +- .../ale/ale_linters/python/pycodestyle.vim | 8 +- .../ale/ale_linters/python/pydocstyle.vim | 8 +- .../ale/ale_linters/python/pyflakes.vim | 8 +- .../ale/ale_linters/python/pylama.vim | 8 +- .../ale/ale_linters/python/pylint.vim | 8 +- .../ale/ale_linters/python/pyls.vim | 37 -- .../ale/ale_linters/python/pylsp.vim | 43 ++ .../ale/ale_linters/python/pyre.vim | 8 +- .../ale/ale_linters/python/vulture.vim | 2 +- .../ale/ale_linters/racket/langserver.vim | 7 + .../ale/ale_linters/typescript/deno.vim | 17 +- .../ale/ale_linters/verilog/yosys.vim | 42 ++ .../ale/autoload/ale/completion.vim | 2 +- .../ale/autoload/ale/fix/registry.vim | 15 + .../ale/autoload/ale/fixers/autoflake.vim | 28 ++ .../ale/autoload/ale/fixers/black.vim | 8 +- .../ale/autoload/ale/fixers/dart_format.vim | 18 + .../ale/autoload/ale/fixers/isort.vim | 1 + .../ale/autoload/ale/fixers/lua_format.vim | 16 + .../ale/autoload/ale/floating_preview.vim | 93 +++- .../ale/autoload/ale/handlers/deno.vim | 22 + .../ale/autoload/ale/python.vim | 7 + .../ale/autoload/ale/racket.vim | 12 + sources_non_forked/ale/autoload/ale/sign.vim | 2 +- sources_non_forked/ale/doc/ale-clojure.txt | 8 + sources_non_forked/ale/doc/ale-dart.txt | 61 +++ sources_non_forked/ale/doc/ale-java.txt | 4 +- sources_non_forked/ale/doc/ale-lua.txt | 18 + sources_non_forked/ale/doc/ale-purescript.txt | 2 +- sources_non_forked/ale/doc/ale-python.txt | 213 +++++++-- .../doc/ale-supported-languages-and-tools.txt | 8 +- sources_non_forked/ale/doc/ale-typescript.txt | 6 + sources_non_forked/ale/doc/ale-verilog.txt | 26 +- sources_non_forked/ale/doc/ale.txt | 25 +- sources_non_forked/ale/plugin/ale.vim | 6 + sources_non_forked/ale/supported-tools.md | 8 +- .../editorconfig-vim/plugin/editorconfig.vim | 10 +- .../nerdtree/.github/ISSUE_TEMPLATE/bug.md | 55 +-- .../.github/ISSUE_TEMPLATE/question.md | 21 +- sources_non_forked/nerdtree/CHANGELOG.md | 3 +- sources_non_forked/nerdtree/README.markdown | 14 +- .../vim-flake8/autoload/flake8.vim | 2 +- .../vim-fugitive/autoload/fugitive.vim | 444 ++++++++++++------ .../vim-fugitive/doc/fugitive.txt | 57 ++- .../vim-fugitive/plugin/fugitive.vim | 86 +++- .../vim-fugitive/syntax/fugitive.vim | 6 +- .../vim-gitgutter/autoload/gitgutter.vim | 5 +- .../vim-gitgutter/doc/gitgutter.txt | 5 + .../vim-gitgutter/plugin/gitgutter.vim | 3 +- .../vim-gitgutter/test/test_gitgutter.vim | 19 +- .../vim-multiple-cursors/Gemfile.lock | 2 +- sources_non_forked/vim-ruby/indent/ruby.vim | 36 +- .../spec/indent/end_constructs_spec.rb | 15 + .../spec/indent/method_definitions_spec.rb | 36 ++ sources_non_forked/vim-ruby/syntax/ruby.vim | 8 +- .../vim-snippets/UltiSnips/sh.snippets | 17 +- 66 files changed, 1368 insertions(+), 404 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/dart/dart_analyze.vim delete mode 100644 sources_non_forked/ale/ale_linters/python/pyls.vim create mode 100644 sources_non_forked/ale/ale_linters/python/pylsp.vim create mode 100644 sources_non_forked/ale/ale_linters/racket/langserver.vim create mode 100644 sources_non_forked/ale/ale_linters/verilog/yosys.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/autoflake.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dart_format.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/lua_format.vim create mode 100644 sources_non_forked/ale/autoload/ale/racket.vim diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim index f83de01a..e1b123ab 100644 --- a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim +++ b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim @@ -73,8 +73,8 @@ endfunction function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort let l:commands = { - \ '>=5.0.0': '%e --parseable-severity -x yaml', - \ '<5.0.0': '%e -p %t' + \ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml -', + \ '<5.0.0': '%e --nocolor -p %t' \} let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0'] diff --git a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim index eb60ce77..e3f93b6b 100644 --- a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim +++ b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim @@ -1,6 +1,18 @@ " Author: Masashi Iizuka " Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo +call ale#Set('clojure_clj_kondo_options', '--cache') + +function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options') + + let l:command = 'clj-kondo' + \ . ale#Pad(l:options) + \ . ' --lint %t' + + return l:command +endfunction + function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort " output format " ::: : @@ -29,6 +41,6 @@ call ale#linter#Define('clojure', { \ 'name': 'clj-kondo', \ 'output_stream': 'stdout', \ 'executable': 'clj-kondo', -\ 'command': 'clj-kondo --cache --lint %t', +\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'), \ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim b/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim new file mode 100644 index 00000000..a00162d8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim @@ -0,0 +1,28 @@ +" Author: ghsang +" Description: Check Dart files with dart analyze + +call ale#Set('dart_analyze_executable', 'dart') + +function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort + let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'text': l:match[6] . ': ' . l:match[5], + \ 'lnum': str2nr(l:match[3]), + \ 'col': str2nr(l:match[4]), + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('dart', { +\ 'name': 'dart_analyze', +\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')}, +\ 'command': '%e analyze %s', +\ 'callback': 'ale_linters#dart#dart_analyze#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim index e83cfdfd..45b03aed 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim @@ -7,7 +7,7 @@ call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint') function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort " Matches patterns line the following: " - " /dev/stdin:19 DL3001 Pipe chain should start with a raw value. + " -:19 DL3001 warning: Pipe chain should start with a raw value. " /dev/stdin:19:3 unexpected thing let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$' let l:output = [] @@ -38,6 +38,8 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort let l:text = l:match[8] let l:detail = l:match[8] let l:domain = 'https://github.com/hadolint/hadolint/wiki/' + let l:code = '' + let l:link = '' if l:match[4] is# 'SC' let l:domain = 'https://github.com/koalaman/shellcheck/wiki/' @@ -46,9 +48,11 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort if l:match[5] isnot# '' let l:code = l:match[4] . l:match[5] let l:link = ' ( ' . l:domain . l:code . ' )' + let l:text = l:code . ': ' . l:detail let l:detail = l:code . l:link . "\n\n" . l:detail else let l:type = 'E' + let l:detail = 'hadolint could not parse the file because of a syntax error.' endif call add(l:output, { diff --git a/sources_non_forked/ale/ale_linters/erlang/erlc.vim b/sources_non_forked/ale/ale_linters/erlang/erlc.vim index e78dc341..0c67a73f 100644 --- a/sources_non_forked/ale/ale_linters/erlang/erlc.vim +++ b/sources_non_forked/ale/ale_linters/erlang/erlc.vim @@ -25,7 +25,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort " error.erl:4: variable 'B' is unbound " error.erl:3: Warning: function main/0 is unused " error.erl:4: Warning: variable 'A' is unused - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$' + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+:)? (Warning: )?(.+)$' " parse_transforms are a special case. The error message does not indicate a location: " error.erl: undefined parse transform 'some_parse_transform' @@ -65,8 +65,8 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort endif let l:line = l:match[2] - let l:warning_or_text = l:match[3] - let l:text = l:match[4] + let l:warning_or_text = l:match[4] + let l:text = l:match[5] " If this file is a header .hrl, ignore the following expected messages: " - 'no module definition' diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 5e231a3b..58d4dce2 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -6,6 +6,7 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') +call ale#Set('php_phpstan_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') @@ -32,8 +33,8 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort \ : '' let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) - \ ? ' --error-format raw' - \ : ' --errorFormat raw' + \ ? ' --error-format json' + \ : ' --errorFormat json' return '%e analyze --no-progress' \ . l:error_format @@ -44,17 +45,17 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort endfunction function! ale_linters#php#phpstan#Handle(buffer, lines) abort - " Matches against lines like the following: - " - " filename.php:15:message - " C:\folder\filename.php:15:message - let l:pattern = '^\([a-zA-Z]:\)\?[^:]\+:\(\d\+\):\(.*\)$' + let l:res = ale#util#FuzzyJSONDecode(a:lines, {'files': []}) let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) + if type(l:res.files) is v:t_list + return l:output + endif + + for l:err in l:res.files[expand('#' . a:buffer .':p')].messages call add(l:output, { - \ 'lnum': l:match[2] + 0, - \ 'text': l:match[3], + \ 'lnum': l:err.line, + \ 'text': l:err.message, \ 'type': 'E', \}) endfor @@ -64,10 +65,16 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', -\ 'executable': {b -> ale#Var(b, 'php_phpstan_executable')}, +\ 'executable': {buffer -> ale#path#FindExecutable(buffer, 'php_phpstan', [ +\ 'vendor/bin/phpstan', +\ 'phpstan' +\ ])}, \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, -\ ale#Var(buffer, 'php_phpstan_executable'), +\ ale#path#FindExecutable(buffer, 'php_phpstan', [ +\ 'vendor/bin/phpstan', +\ 'phpstan' +\ ]), \ '%e --version', \ function('ale_linters#php#phpstan#GetCommand'), \ )}, diff --git a/sources_non_forked/ale/ale_linters/python/bandit.vim b/sources_non_forked/ale/ale_linters/python/bandit.vim index 554f5000..9cfca7c0 100644 --- a/sources_non_forked/ale/ale_linters/python/bandit.vim +++ b/sources_non_forked/ale/ale_linters/python/bandit.vim @@ -6,6 +6,7 @@ call ale#Set('python_bandit_options', '') call ale#Set('python_bandit_use_config', 1) call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_bandit_auto_pipenv', 0) +call ale#Set('python_bandit_auto_poetry', 0) function! ale_linters#python#bandit#GetExecutable(buffer) abort if ( @@ -15,6 +16,13 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort return 'pipenv' endif + if ( + \ ale#Var(a:buffer, 'python_auto_poetry') + \ || ale#Var(a:buffer, 'python_bandit_auto_poetry') + \) && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit']) endfunction @@ -31,7 +39,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort endif endif - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run bandit' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 1d49d03f..9950614a 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -6,6 +6,7 @@ call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_flake8_change_directory', 'project') call ale#Set('python_flake8_auto_pipenv', 0) +call ale#Set('python_flake8_auto_poetry', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' @@ -17,6 +18,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flake8_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) endif @@ -62,7 +68,7 @@ endfunction function! ale_linters#python#flake8#GetCommand(buffer, version) abort let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run flake8' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index 48697421..9d469a1a 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -7,6 +7,7 @@ call ale#Set('python_mypy_show_notes', 1) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) +call ale#Set('python_mypy_auto_poetry', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) @@ -14,6 +15,11 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_mypy_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) endfunction @@ -37,7 +43,7 @@ endfunction function! ale_linters#python#mypy#GetCommand(buffer) abort let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run mypy' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/prospector.vim b/sources_non_forked/ale/ale_linters/python/prospector.vim index ee47012f..3623bda0 100644 --- a/sources_non_forked/ale/ale_linters/python/prospector.vim +++ b/sources_non_forked/ale/ale_linters/python/prospector.vim @@ -2,6 +2,7 @@ " Description: prospector linter python files call ale#Set('python_prospector_auto_pipenv', 0) +call ale#Set('python_prospector_auto_poetry', 0) let g:ale_python_prospector_executable = \ get(g:, 'ale_python_prospector_executable', 'prospector') @@ -17,13 +18,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_prospector_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) endfunction function! ale_linters#python#prospector#GetCommand(buffer) abort let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run prospector' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim index fb521bc1..3fb94d69 100644 --- a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim @@ -5,6 +5,7 @@ call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pycodestyle_auto_pipenv', 0) +call ale#Set('python_pycodestyle_auto_poetry', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) @@ -12,13 +13,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycodestyle_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) endfunction function! ale_linters#python#pycodestyle#GetCommand(buffer) abort let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pycodestyle' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim index abf95fa1..aa0e8b20 100644 --- a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim @@ -5,6 +5,7 @@ call ale#Set('python_pydocstyle_executable', 'pydocstyle') call ale#Set('python_pydocstyle_options', '') call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pydocstyle_auto_pipenv', 0) +call ale#Set('python_pydocstyle_auto_poetry', 0) function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv')) @@ -12,12 +13,17 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pydocstyle_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle']) endfunction function! ale_linters#python#pydocstyle#GetCommand(buffer) abort let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pydocstyle' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pyflakes.vim b/sources_non_forked/ale/ale_linters/python/pyflakes.vim index b5127022..2567c533 100644 --- a/sources_non_forked/ale/ale_linters/python/pyflakes.vim +++ b/sources_non_forked/ale/ale_linters/python/pyflakes.vim @@ -4,6 +4,7 @@ call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyflakes_auto_pipenv', 0) +call ale#Set('python_pyflakes_auto_poetry', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) @@ -11,13 +12,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflakes_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) endfunction function! ale_linters#python#pyflakes#GetCommand(buffer) abort let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pyflakes' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pylama.vim b/sources_non_forked/ale/ale_linters/python/pylama.vim index bad69667..73b59b07 100644 --- a/sources_non_forked/ale/ale_linters/python/pylama.vim +++ b/sources_non_forked/ale/ale_linters/python/pylama.vim @@ -5,6 +5,7 @@ call ale#Set('python_pylama_executable', 'pylama') call ale#Set('python_pylama_options', '') call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylama_auto_pipenv', 0) +call ale#Set('python_pylama_auto_poetry', 0) call ale#Set('python_pylama_change_directory', 1) function! ale_linters#python#pylama#GetExecutable(buffer) abort @@ -13,6 +14,11 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylama_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama']) endfunction @@ -31,7 +37,7 @@ endfunction function! ale_linters#python#pylama#GetCommand(buffer) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pylama' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index f086a865..2ce5376f 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -6,6 +6,7 @@ call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) +call ale#Set('python_pylint_auto_poetry', 0) call ale#Set('python_pylint_use_msg_id', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort @@ -14,6 +15,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylint_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction @@ -32,7 +38,7 @@ endfunction function! ale_linters#python#pylint#GetCommand(buffer, version) abort let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pylint' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pyls.vim b/sources_non_forked/ale/ale_linters/python/pyls.vim deleted file mode 100644 index 10304b2c..00000000 --- a/sources_non_forked/ale/ale_linters/python/pyls.vim +++ /dev/null @@ -1,37 +0,0 @@ -" Author: aurieh -" Description: A language server for Python - -call ale#Set('python_pyls_executable', 'pyls') -call ale#Set('python_pyls_options', '') -call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('python_pyls_auto_pipenv', 0) -call ale#Set('python_pyls_config', {}) - -function! ale_linters#python#pyls#GetExecutable(buffer) abort - if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv')) - \ && ale#python#PipenvPresent(a:buffer) - return 'pipenv' - endif - - return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) -endfunction - -function! ale_linters#python#pyls#GetCommand(buffer) abort - let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run pyls' - \ : '' - - return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pyls_options')) -endfunction - -call ale#linter#Define('python', { -\ 'name': 'pyls', -\ 'lsp': 'stdio', -\ 'executable': function('ale_linters#python#pyls#GetExecutable'), -\ 'command': function('ale_linters#python#pyls#GetCommand'), -\ 'project_root': function('ale#python#FindProjectRoot'), -\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', -\ 'lsp_config': {b -> ale#Var(b, 'python_pyls_config')}, -\}) diff --git a/sources_non_forked/ale/ale_linters/python/pylsp.vim b/sources_non_forked/ale/ale_linters/python/pylsp.vim new file mode 100644 index 00000000..537d1e74 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pylsp.vim @@ -0,0 +1,43 @@ +" Author: aurieh +" Description: A language server for Python + +call ale#Set('python_pylsp_executable', 'pylsp') +call ale#Set('python_pylsp_options', '') +call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pylsp_auto_pipenv', 0) +call ale#Set('python_pylsp_auto_poetry', 0) +call ale#Set('python_pylsp_config', {}) + +function! ale_linters#python#pylsp#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylsp_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylsp_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp']) +endfunction + +function! ale_linters#python#pylsp#GetCommand(buffer) abort + let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer) + + let l:exec_args = l:executable =~? 'pipenv\|poetry$' + \ ? ' run pylsp' + \ : '' + + return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options')) +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pylsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#python#pylsp#GetExecutable'), +\ 'command': function('ale_linters#python#pylsp#GetCommand'), +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\ 'lsp_config': {b -> ale#Var(b, 'python_pylsp_config')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pyre.vim b/sources_non_forked/ale/ale_linters/python/pyre.vim index 4edd80f7..d9b46763 100644 --- a/sources_non_forked/ale/ale_linters/python/pyre.vim +++ b/sources_non_forked/ale/ale_linters/python/pyre.vim @@ -4,6 +4,7 @@ call ale#Set('python_pyre_executable', 'pyre') call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyre_auto_pipenv', 0) +call ale#Set('python_pyre_auto_poetry', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) @@ -11,13 +12,18 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyre_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre']) endfunction function! ale_linters#python#pyre#GetCommand(buffer) abort let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pyre persistent' \ : ' persistent' diff --git a/sources_non_forked/ale/ale_linters/python/vulture.vim b/sources_non_forked/ale/ale_linters/python/vulture.vim index 84ffd49a..a7ba1860 100644 --- a/sources_non_forked/ale/ale_linters/python/vulture.vim +++ b/sources_non_forked/ale/ale_linters/python/vulture.vim @@ -29,7 +29,7 @@ endfunction function! ale_linters#python#vulture#GetCommand(buffer) abort let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run vulture' \ : '' let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory') diff --git a/sources_non_forked/ale/ale_linters/racket/langserver.vim b/sources_non_forked/ale/ale_linters/racket/langserver.vim new file mode 100644 index 00000000..ec80ed7b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/racket/langserver.vim @@ -0,0 +1,7 @@ +call ale#linter#Define('racket', { +\ 'name': 'racket_langserver', +\ 'lsp': 'stdio', +\ 'executable': 'racket', +\ 'command': '%e -l racket-langserver', +\ 'project_root': function('ale#racket#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/deno.vim b/sources_non_forked/ale/ale_linters/typescript/deno.vim index 051cb208..f47fac7a 100644 --- a/sources_non_forked/ale/ale_linters/typescript/deno.vim +++ b/sources_non_forked/ale/ale_linters/typescript/deno.vim @@ -1,4 +1,5 @@ " Author: Mohammed Chelouti - https://github.com/motato1 +" Arnold Chand " Description: Deno lsp linter for TypeScript files. call ale#linter#Define('typescript', { @@ -7,19 +8,5 @@ call ale#linter#Define('typescript', { \ 'executable': function('ale#handlers#deno#GetExecutable'), \ 'command': '%e lsp', \ 'project_root': function('ale#handlers#deno#GetProjectRoot'), -\ 'initialization_options': function('ale_linters#typescript#deno#GetInitializationOptions'), +\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), \}) - -function! ale_linters#typescript#deno#GetInitializationOptions(buffer) abort - let l:options = { - \ 'enable': v:true, - \ 'lint': v:true, - \ 'unstable': v:false, - \ } - - if ale#Var(a:buffer, 'deno_unstable') - let l:options.unstable = v:true - endif - - return l:options -endfunction diff --git a/sources_non_forked/ale/ale_linters/verilog/yosys.vim b/sources_non_forked/ale/ale_linters/verilog/yosys.vim new file mode 100644 index 00000000..29657755 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/yosys.vim @@ -0,0 +1,42 @@ +" Author: Nathan Sharp +" Description: Yosys for Verilog files + +call ale#Set('verilog_yosys_executable', 'yosys') +call ale#Set('verilog_yosys_options', '-Q -T -p ''read_verilog %s''') + +function! ale_linters#verilog#yosys#GetCommand(buffer) abort + return '%e ' . ale#Var(a:buffer, 'verilog_yosys_options') . ' 2>&1' +endfunction + +function! ale_linters#verilog#yosys#Handle(buffer, lines) abort + let l:output = [] + let l:path = fnamemodify(bufname(a:buffer), ':p') + + for l:match in ale#util#GetMatches(a:lines, '^\([^:]\+\):\(\d\+\): \(WARNING\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'text': l:match[4], + \ 'type': l:match[3][0], + \ 'filename': l:match[1], + \}) + endfor + + for l:match in ale#util#GetMatches(a:lines, '^\(Warning\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': 1, + \ 'text': l:match[2], + \ 'type': l:match[1][0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'yosys', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'verilog_yosys_executable')}, +\ 'command': function('ale_linters#verilog#yosys#GetCommand'), +\ 'callback': 'ale_linters#verilog#yosys#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 4cf3a51a..5237288e 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -1002,7 +1002,7 @@ endfunction function! ale#completion#HandleUserData(completed_item) abort let l:user_data_json = get(a:completed_item, 'user_data', '') let l:user_data = !empty(l:user_data_json) - \ ? json_decode(l:user_data_json) + \ ? ale#util#FuzzyJSONDecode(l:user_data_json, v:null) \ : v:null if type(l:user_data) isnot v:t_dict diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 0d110c79..7a4d964e 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -17,6 +17,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix import issues with autoimport.', \ }, +\ 'autoflake': { +\ 'function': 'ale#fixers#autoflake#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix flake issues with autoflake.', +\ }, \ 'autopep8': { \ 'function': 'ale#fixers#autopep8#Fix', \ 'suggested_filetypes': ['python'], @@ -376,6 +381,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['dart'], \ 'description': 'Fix Dart files with dartfmt.', \ }, +\ 'dart-format': { +\ 'function': 'ale#fixers#dart_format#Fix', +\ 'suggested_filetypes': ['dart'], +\ 'description': 'Fix Dart files with dart format.', +\ }, \ 'xmllint': { \ 'function': 'ale#fixers#xmllint#Fix', \ 'suggested_filetypes': ['xml'], @@ -441,6 +451,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['html', 'htmldjango'], \ 'description': 'Fix HTML files with html-beautify.', \ }, +\ 'lua-format': { +\ 'function': 'ale#fixers#lua_format#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with lua-format.', +\ }, \ 'luafmt': { \ 'function': 'ale#fixers#luafmt#Fix', \ 'suggested_filetypes': ['lua'], diff --git a/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim b/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim new file mode 100644 index 00000000..e2ad6536 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim @@ -0,0 +1,28 @@ +" Author: circld +" Description: Fixing files with autoflake. + +call ale#Set('python_autoflake_executable', 'autoflake') +call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_autoflake_options', '') + +function! ale#fixers#autoflake#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_autoflake', + \ ['autoflake'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:options = ale#Var(a:buffer, 'python_autoflake_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --in-place ' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index 142cd983..4a88c5cd 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -5,6 +5,7 @@ call ale#Set('python_black_executable', 'black') call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_black_options', '') call ale#Set('python_black_auto_pipenv', 0) +call ale#Set('python_black_auto_poetry', 0) call ale#Set('python_black_change_directory', 1) function! ale#fixers#black#GetExecutable(buffer) abort @@ -13,6 +14,11 @@ function! ale#fixers#black#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_black_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_black', ['black']) endfunction @@ -20,7 +26,7 @@ function! ale#fixers#black#Fix(buffer) abort let l:executable = ale#fixers#black#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] - if l:executable =~? 'pipenv$' + if l:executable =~? 'pipenv\|poetry$' call extend(l:cmd, ['run', 'black']) endif diff --git a/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim b/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim new file mode 100644 index 00000000..4b8f730b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim @@ -0,0 +1,18 @@ +" Author: ghsang +" Description: Integration of dart format with ALE. + +call ale#Set('dart_format_executable', 'dart') +call ale#Set('dart_format_options', '') + +function! ale#fixers#dart_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'dart_format_executable') + let l:options = ale#Var(a:buffer, 'dart_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' format' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/isort.vim b/sources_non_forked/ale/autoload/ale/fixers/isort.vim index ba95bb10..a640d233 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/isort.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/isort.vim @@ -29,6 +29,7 @@ function! ale#fixers#isort#Fix(buffer) abort return { \ 'cwd': '%s:h', \ 'command': ale#Escape(l:executable) . l:exec_args + \ . ale#Pad('--filename %s') \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim b/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim new file mode 100644 index 00000000..98b155c0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim @@ -0,0 +1,16 @@ +" Author: Mathias Jean Johansen +" Description: Integration of LuaFormatter with ALE. + +call ale#Set('lua_lua_format_executable', 'lua-format') +call ale#Set('lua_lua_format_options', '') + +function! ale#fixers#lua_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_lua_format_executable') + let l:options = ale#Var(a:buffer, 'lua_lua_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ale#Pad(l:options) + \ . ' -i', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/floating_preview.vim b/sources_non_forked/ale/autoload/ale/floating_preview.vim index 729e04b4..f0bc8f80 100644 --- a/sources_non_forked/ale/autoload/ale/floating_preview.vim +++ b/sources_non_forked/ale/autoload/ale/floating_preview.vim @@ -1,26 +1,35 @@ " Author: Jan-Grimo Sobez " Author: Kevin Clark +" Author: D. Ben Knoble " Description: Floating preview window for showing whatever information in. -" Precondition: exists('*nvim_open_win') +" Precondition: exists('*nvim_open_win') || has('popupwin') function! ale#floating_preview#Show(lines, ...) abort - if !exists('*nvim_open_win') + if !exists('*nvim_open_win') && !has('popupwin') execute 'echom ''Floating windows not supported in this vim instance.''' return endif + let l:options = get(a:000, 0, {}) + + if has('nvim') + call s:NvimShow(a:lines, l:options) + else + call s:VimShow(a:lines, l:options) + endif +endfunction + +function! s:NvimShow(lines, options) abort " Remove the close autocmd so it doesn't happen mid update augroup ale_floating_preview_window autocmd! augroup END - let l:options = get(a:000, 0, {}) - " Only create a new window if we need it if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1 - call s:Create(l:options) + call s:NvimCreate(a:options) else call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true) endif @@ -30,7 +39,7 @@ function! ale#floating_preview#Show(lines, ...) abort call nvim_set_current_win(w:preview['id']) - for l:command in get(l:options, 'commands', []) + for l:command in get(a:options, 'commands', []) call execute(l:command) endfor @@ -41,13 +50,13 @@ function! ale#floating_preview#Show(lines, ...) abort autocmd! if g:ale_close_preview_on_insert - autocmd CursorMoved,TabLeave,WinLeave,InsertEnter ++once call s:Close() + autocmd CursorMoved,TabLeave,WinLeave,InsertEnter ++once call s:NvimClose() else - autocmd CursorMoved,TabLeave,WinLeave ++once call s:Close() + autocmd CursorMoved,TabLeave,WinLeave ++once call s:NvimClose() endif augroup END - let [l:lines, l:width, l:height] = s:PrepareWindowContent(a:lines) + let [l:lines, l:width, l:height] = s:NvimPrepareWindowContent(a:lines) call nvim_win_set_width(w:preview['id'], l:width) call nvim_win_set_height(w:preview['id'], l:height) @@ -56,7 +65,33 @@ function! ale#floating_preview#Show(lines, ...) abort call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false) endfunction -function! s:PrepareWindowContent(lines) abort +function! s:VimShow(lines, options) abort + if g:ale_close_preview_on_insert + " Remove the close autocmd so it doesn't happen mid update + silent! autocmd! ale_floating_preview_window + endif + + " Only create a new window if we need it + if !exists('w:preview') || index(popup_list(), w:preview['id']) is# -1 + call s:VimCreate(a:options) + endif + + " Execute commands in window context + for l:command in get(a:options, 'commands', []) + call win_execute(w:preview['id'], l:command) + endfor + + call popup_settext(w:preview['id'], a:lines) + + if g:ale_close_preview_on_insert + augroup ale_floating_preview_window + autocmd! + autocmd InsertEnter * ++once call s:VimClose() + augroup END + endif +endfunction + +function! s:NvimPrepareWindowContent(lines) abort let l:max_height = 10 let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)')) @@ -94,7 +129,7 @@ function! s:PrepareWindowContent(lines) abort return [l:lines, l:width, l:height] endfunction -function! s:Create(options) abort +function! s:NvimCreate(options) abort let l:buffer = nvim_create_buf(v:false, v:false) let l:winid = nvim_open_win(l:buffer, v:false, { \ 'relative': 'cursor', @@ -112,7 +147,32 @@ function! s:Create(options) abort let w:preview = {'id': l:winid, 'buffer': l:buffer} endfunction -function! s:Close() abort +function! s:VimCreate(options) abort + let l:popup_id = popup_create([], { + \ 'line': 'cursor+1', + \ 'col': 'cursor', + \ 'drag': v:true, + \ 'resize': v:true, + \ 'close': 'button', + \ 'padding': [0, 1, 0, 1], + \ 'border': [], + \ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [ + \ g:ale_floating_window_border[1], + \ g:ale_floating_window_border[0], + \ g:ale_floating_window_border[1], + \ g:ale_floating_window_border[0], + \ g:ale_floating_window_border[2], + \ g:ale_floating_window_border[3], + \ g:ale_floating_window_border[4], + \ g:ale_floating_window_border[5], + \ ], + \ 'moved': 'any', + \ }) + call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview')) + let w:preview = {'id': l:popup_id} +endfunction + +function! s:NvimClose() abort let l:mode = mode() let l:restore_visual = l:mode is# 'v' || l:mode is# 'V' || l:mode is# "\" @@ -132,3 +192,12 @@ function! s:Close() abort normal! gv endif endfunction + +function! s:VimClose() abort + if !exists('w:preview') + return + endif + + call popup_close(w:preview['id']) + unlet w:preview +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/deno.vim b/sources_non_forked/ale/autoload/ale/handlers/deno.vim index 4bf4546a..1b5e1718 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/deno.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/deno.vim @@ -1,8 +1,10 @@ " Author: Mohammed Chelouti - https://github.com/motato1 +" Arnold Chand " Description: Handler functions for Deno. call ale#Set('deno_executable', 'deno') call ale#Set('deno_unstable', 0) +call ale#Set('deno_importMap', 'import_map.json') call ale#Set('deno_lsp_project_root', '') function! ale#handlers#deno#GetExecutable(buffer) abort @@ -50,3 +52,23 @@ function! ale#handlers#deno#GetProjectRoot(buffer) abort return '' endfunction + +" Initialization Options for deno, for javascript and typescript +function! ale#handlers#deno#GetInitializationOptions(buffer) abort + let l:options = { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#FindNearestFile(a:buffer, 'import_map.json'), + \ } + + if ale#Var(a:buffer, 'deno_unstable') + let l:options.unstable = v:true + endif + + if ale#Var(a:buffer, 'deno_importMap') isnot# '' + let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap')) + endif + + return l:options +endfunction diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index fc6c1130..ee856a27 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -2,6 +2,7 @@ " Description: Functions for integrating with Python linters. call ale#Set('python_auto_pipenv', '0') +call ale#Set('python_auto_poetry', '0') let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. @@ -34,6 +35,7 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/Pipfile.lock') \|| filereadable(l:path . '/poetry.lock') \|| filereadable(l:path . '/pyproject.toml') + \|| filereadable(l:path . '/.tool-versions') return l:path endif endfor @@ -157,3 +159,8 @@ endfunction function! ale#python#PipenvPresent(buffer) abort return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' endfunction + +" Detects whether a poetry environment is present. +function! ale#python#PoetryPresent(buffer) abort + return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/racket.vim b/sources_non_forked/ale/autoload/ale/racket.vim new file mode 100644 index 00000000..ff896108 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/racket.vim @@ -0,0 +1,12 @@ +function! ale#racket#FindProjectRoot(buffer) abort + let l:cwd = expand('#' . a:buffer . ':p:h') + let l:highest_init = l:cwd + + for l:path in ale#path#Upwards(l:cwd) + if filereadable(l:path.'/init.rkt') + let l:highest_init = l:path + endif + endfor + + return l:highest_init +endfunction diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 0607e17a..21e06313 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -85,7 +85,7 @@ execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_st \ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine' execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info) \ . ' texthl=ALEInfoSign linehl=ALEInfoLine' -sign define ALEDummySign +sign define ALEDummySign text=\ texthl=SignColumn if g:ale_sign_highlight_linenrs && has('nvim-0.3.2') if !hlexists('ALEErrorSignLineNr') diff --git a/sources_non_forked/ale/doc/ale-clojure.txt b/sources_non_forked/ale/doc/ale-clojure.txt index 2bf00c03..3ff367f6 100644 --- a/sources_non_forked/ale/doc/ale-clojure.txt +++ b/sources_non_forked/ale/doc/ale-clojure.txt @@ -9,6 +9,14 @@ A minimal and opinionated linter for code that sparks joy. https://github.com/borkdude/clj-kondo +g:ale_clojure_clj_kondo_options *g:ale_clojure_clj_kondo_options* + *b:ale_clojure_clj_kondo_options* + Type: |String| + Default: `'--cache'` + + This variable can be changed to modify options passed to clj-kondo. + + =============================================================================== joker *ale-clojure-joker* diff --git a/sources_non_forked/ale/doc/ale-dart.txt b/sources_non_forked/ale/doc/ale-dart.txt index 01089252..a046808b 100644 --- a/sources_non_forked/ale/doc/ale-dart.txt +++ b/sources_non_forked/ale/doc/ale-dart.txt @@ -27,6 +27,67 @@ g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable* This variable can be set to change the path of dart. +=============================================================================== +dart-analyze *ale-dart-analyze* + +Installation +------------------------------------------------------------------------------- + +Installing Dart should probably ensure that `dart` is in your `$PATH`. + +In case it is not, try to set the executable option to its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' + > + +Install Dart via whatever means. `dart analyze` will be included in the SDK. + +Options +------------------------------------------------------------------------------- + +g:ale_dart_analyze_executable *g:ale_dart_analyze_executable* + *b:ale_dart_analyze_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to specify an absolute path to the + format executable (or to specify an alternate executable). + + +=============================================================================== +dart-format *ale-dart-format* + +Installation +------------------------------------------------------------------------------- + +Installing Dart should probably ensure that `dart` is in your `$PATH`. + +In case it is not, try to set the executable option to its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' + > + +Options +------------------------------------------------------------------------------- + +g:ale_dart_format_executable *g:ale_dart_format_executable* + *b:ale_dart_format_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to specify an absolute path to the + format executable (or to specify an alternate executable). + + +g:ale_dart_format_options *g:ale_dart_format_options* + *b:ale_dart_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the dart format fixer. + + + =============================================================================== dartanalyzer *ale-dart-dartanalyzer* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 0debc1af..6bd04ef9 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -193,13 +193,13 @@ The Java language server will look for the dependencies you specify in =============================================================================== eclipselsp *ale-java-eclipselsp* -To enable Eclipse LSP linter you need to clone and build the eclipse.jdt.ls +To enable Eclipse JDT LSP linter you need to clone and build the eclipse.jdt.ls language server from https://github.com/eclipse/eclipse.jdt.ls. Simply clone the source code repo and then build the plugin: ./mvnw clean verify -Note: currently, the build can only run when launched with JDK 8. JDK 9 or more +Note: currently, the build can only run when launched with JDK 11. More recent versions can be used to run the server though. After build completes the files required to run the language server will be diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index db7c0924..ac92b9ac 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -1,6 +1,24 @@ =============================================================================== ALE Lua Integration *ale-lua-options* +=============================================================================== +lua-format *ale-lua-lua-format* + +g:ale_lua_lua_format_executable *g:ale_lua_lua_format_executable* + *b:ale_lua_lua_format_executable* + Type: |String| + Default: `'lua-format'` + + This variable can be changed to change the path to lua-format. + +g:ale_lua_lua_format_options *g:ale_lua_lua_format_options* + *b:ale_lua_lua_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to lua-format. + + =============================================================================== luac *ale-lua-luac* diff --git a/sources_non_forked/ale/doc/ale-purescript.txt b/sources_non_forked/ale/doc/ale-purescript.txt index e809f2c9..454bb7e4 100644 --- a/sources_non_forked/ale/doc/ale-purescript.txt +++ b/sources_non_forked/ale/doc/ale-purescript.txt @@ -26,7 +26,7 @@ g:ale_purescript_ls_config g:ale_purescript_ls_config \ 'purescript': { \ 'addSpagoSources': v:true, \ 'addNpmPath': v:true, - \ 'buildCommand': 'spago build -- --json-errors' + \ 'buildCommand': 'spago --quiet build --purs-args --json-errors' \ } \} =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index d38d3055..7f746147 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -10,6 +10,14 @@ g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. +g:ale_python_auto_poetry *g:ale_python_auto_poetry* + *b:ale_python_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + =============================================================================== ALE Python Project Root Behavior *ale-python-root* @@ -36,13 +44,41 @@ ALE will look for configuration files with the following filenames. > .pylintrc Pipfile Pipfile.lock - poetry.lock + poetry.lock pyproject.toml + .tool-versions < The first directory containing any of the files named above will be used. +=============================================================================== +autoflake *ale-python-autoflake* + +g:ale_python_autoflake_executable *g:ale_python_autoflake_executable* + *b:ale_python_autoflake_executable* + Type: |String| + Default: `'autoflake'` + + See |ale-integrations-local-executables| + + +g:ale_python_autoflake_options *g:ale_python_autoflake_options* + *b:ale_python_autoflake_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to autoflake. + + +g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global* + *b:ale_python_autoflake_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== autoimport *ale-python-autoimport* @@ -69,6 +105,7 @@ g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_glob See |ale-integrations-local-executables| + =============================================================================== autopep8 *ale-python-autopep8* @@ -107,6 +144,7 @@ g:ale_python_bandit_executable *g:ale_python_bandit_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `bandit'`. + Set this to `'poetry'` to invoke `'poetry` `run` `bandit'`. g:ale_python_bandit_options *g:ale_python_bandit_options* @@ -146,6 +184,15 @@ g:ale_python_bandit_auto_pipenv *g:ale_python_bandit_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_bandit_auto_poetry *g:ale_python_bandit_auto_poetry* + *b:ale_python_bandit_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== black *ale-python-black* @@ -181,6 +228,14 @@ g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. +g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry* + *b:ale_python_black_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + g:ale_python_black_change_directory *g:ale_python_black_change_directory* *b:ale_python_black_change_directory* Type: |Number| @@ -213,7 +268,8 @@ g:ale_python_flake8_executable *g:ale_python_flake8_executable* Default: `'flake8'` This variable can be changed to modify the executable used for flake8. Set - this to `'pipenv'` to invoke `'pipenv` `run` `flake8'`. + this to `'pipenv'` to invoke `'pipenv` `run` `flake8'`. Set this to + `'poetry'` to invoke `'poetry` `run` `flake8'`. g:ale_python_flake8_options *g:ale_python_flake8_options* @@ -255,6 +311,15 @@ g:ale_python_flake8_auto_pipenv *g:ale_python_flake8_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry* + *b:ale_python_flake8_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== isort *ale-python-isort* @@ -310,6 +375,15 @@ g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_mypy_auto_poetry *g:ale_python_mypy_auto_poetry* + *b:ale_python_mypy_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + g:ale_python_mypy_executable *g:ale_python_mypy_executable* *b:ale_python_mypy_executable* Type: |String| @@ -318,6 +392,7 @@ g:ale_python_mypy_executable *g:ale_python_mypy_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `mypy'`. + Set this to `'poetry'` to invoke `'poetry` `run` `mypy'`. g:ale_python_mypy_ignore_invalid_syntax @@ -368,6 +443,7 @@ g:ale_python_prospector_executable *g:ale_python_prospector_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `prospector'`. + Set this to `'poetry'` to invoke `'poetry` `run` `prospector'`. g:ale_python_prospector_options *g:ale_python_prospector_options* @@ -408,6 +484,15 @@ g:ale_python_prospector_auto_pipenv *g:ale_python_prospector_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry* + *b:ale_python_prospector_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pycodestyle *ale-python-pycodestyle* @@ -420,6 +505,7 @@ g:ale_python_pycodestyle_executable *g:ale_python_pycodestyle_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pycodestyle'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pycodestyle'`. g:ale_python_pycodestyle_options *g:ale_python_pycodestyle_options* @@ -448,6 +534,15 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry* + *b:ale_python_pycodestyle_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pydocstyle *ale-python-pydocstyle* @@ -460,6 +555,7 @@ g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pydocstyle'`. g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options* @@ -488,6 +584,15 @@ g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry* + *b:ale_python_pydocstyle_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pyflakes *ale-python-pyflakes* @@ -500,6 +605,7 @@ g:ale_python_pyflakes_executable *g:ale_python_pyflakes_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyflakes'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyflakes'`. g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* @@ -511,6 +617,15 @@ g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry* + *b:ale_python_pyflakes_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pylama *ale-python-pylama* @@ -532,7 +647,8 @@ g:ale_python_pylama_executable *g:ale_python_pylama_executable* Default: `'pylama'` This variable can be changed to modify the executable used for pylama. Set - this to `'pipenv'` to invoke `'pipenv` `run` `pylama'`. + this to `'pipenv'` to invoke `'pipenv` `run` `pylama'`. Set this to + `'poetry'` to invoke `'poetry` `run` `pylama'`. g:ale_python_pylama_options *g:ale_python_pylama_options* @@ -565,6 +681,15 @@ g:ale_python_pylama_auto_pipenv *g:ale_python_pylama_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylama_auto_poetry *g:ale_python_pylama_auto_poetry* + *b:ale_python_pylama_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pylint *ale-python-pylint* @@ -589,6 +714,7 @@ g:ale_python_pylint_executable *g:ale_python_pylint_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pylint'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pylint'`. g:ale_python_pylint_options *g:ale_python_pylint_options* @@ -628,6 +754,15 @@ g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylint_auto_poetry *g:ale_python_pylint_auto_poetry* + *b:ale_python_pylint_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* *b:ale_python_pylint_use_msg_id* Type: |Number| @@ -638,31 +773,32 @@ g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* =============================================================================== -pyls *ale-python-pyls* +pylsp *ale-python-pylsp* -`pyls` will be run from a detected project root, per |ale-python-root|. +`pylsp` will be run from a detected project root, per |ale-python-root|. -g:ale_python_pyls_executable *g:ale_python_pyls_executable* - *b:ale_python_pyls_executable* +g:ale_python_pylsp_executable *g:ale_python_pylsp_executable* + *b:ale_python_pylsp_executable* Type: |String| - Default: `'pyls'` + Default: `'pylsp'` See |ale-integrations-local-executables| - Set this to `'pipenv'` to invoke `'pipenv` `run` `pyls'`. + Set this to `'pipenv'` to invoke `'pipenv` `run` `pylsp'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyls'`. -g:ale_python_pyls_use_global *g:ale_python_pyls_use_global* - *b:ale_python_pyls_use_global* +g:ale_python_pylsp_use_global *g:ale_python_pylsp_use_global* + *b:ale_python_pylsp_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| -g:ale_python_pyls_auto_pipenv *g:ale_python_pyls_auto_pipenv* - *b:ale_python_pyls_auto_pipenv* +g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv* + *b:ale_python_pylsp_auto_pipenv* Type: |Number| Default: `0` @@ -670,15 +806,24 @@ g:ale_python_pyls_auto_pipenv *g:ale_python_pyls_auto_pipenv* if true. This is overridden by a manually-set executable. -g:ale_python_pyls_config *g:ale_python_pyls_config* - *b:ale_python_pyls_config* +g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry* + *b:ale_python_pylsp_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + +g:ale_python_pylsp_config *g:ale_python_pylsp_config* + *b:ale_python_pylsp_config* Type: |Dictionary| Default: `{}` - Dictionary with configuration settings for pyls. For example, to disable + Dictionary with configuration settings for pylsp. For example, to disable the pycodestyle linter: > { - \ 'pyls': { + \ 'pylsp': { \ 'plugins': { \ 'pycodestyle': { \ 'enabled': v:false @@ -688,24 +833,24 @@ g:ale_python_pyls_config *g:ale_python_pyls_config* \ } < -g:ale_python_pyls_options *g:ale_python_pyls_options* - *b:ale_python_pyls_options* +g:ale_python_pylsp_options *g:ale_python_pylsp_options* + *b:ale_python_pylsp_options* Type: |String| Default: `''` - This variable can be changed to add command-line arguments to the pyls - invocation. Note that this is not the same thing as ale_python_pyls_config, - which allows configuration of how pyls functions; this is intended to - provide flexibility in how the pyls command is invoked. + This variable can be changed to add command-line arguments to the pylsp + invocation. Note that this is not the same thing as ale_python_pylsp_config, + which allows configuration of how pylsp functions; this is intended to + provide flexibility in how the pylsp command is invoked. - For example, if you had installed `pyls` but your `pyls` executable was not - on your `PATH` for some reason, an alternative way to run the pyls server + For example, if you had installed `pylsp` but your `pylsp` executable was not + on your `PATH` for some reason, an alternative way to run the pylsp server would be: - let g:ale_python_pyls_executable = 'python3' - let g:ale_python_pyls_options = '-m pyls' + let g:ale_python_pylsp_executable = 'python3' + let g:ale_python_pylsp_options = '-m pylsp' - An example stragety for installing `pyls`: - `python3 -m pip install --user pyls` + An example stragety for installing `pylsp`: + `python3 -m pip install --user pylsp` =============================================================================== pyre *ale-python-pyre* @@ -721,6 +866,7 @@ g:ale_python_pyre_executable *g:ale_python_pyre_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyre'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyre'`. g:ale_python_pyre_use_global *g:ale_python_pyre_use_global* @@ -740,6 +886,15 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pyre_auto_poetry *g:ale_python_pyre_auto_poetry* + *b:ale_python_pyre_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== pyright *ale-python-pyright* 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 36399178..f3d7767c 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 @@ -124,6 +124,8 @@ Notes: * `dafny`!! * Dart * `analysis_server` + * `dart-analyze`!! + * `dart-format`!! * `dartanalyzer`!! * `dartfmt`!! * `language_server` @@ -285,6 +287,7 @@ Notes: * LLVM * `llc` * Lua + * `lua-format` * `luac` * `luacheck` * `luafmt` @@ -398,6 +401,7 @@ Notes: * `purescript-language-server` * `purty` * Python + * `autoflake`!! * `autoimport` * `autopep8` * `bandit` @@ -411,7 +415,7 @@ Notes: * `pyflakes` * `pylama`!! * `pylint`!! - * `pyls` + * `pylsp` * `pyre` * `pyright` * `reorder-python-imports` @@ -425,6 +429,7 @@ Notes: * `lintr` * `styler` * Racket + * `racket-langserver` * `raco` * Re:VIEW * `redpen` @@ -549,6 +554,7 @@ Notes: * `verilator` * `vlog` * `xvlog` + * `yosys` * VHDL * `ghdl` * `vcom` diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index a2446c2c..e2ee49c2 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -34,6 +34,12 @@ g:ale_deno_unstable *g:ale_deno_unstable* Enable or disable unstable Deno features and APIs. +g:ale_deno_importMap *g:ale_deno_importMap* + *b:ale_deno_importMap* + Type: |String| + Default: `'import_map.json'` + + Specify the import map filename to load url maps in a deno project. =============================================================================== eslint *ale-typescript-eslint* diff --git a/sources_non_forked/ale/doc/ale-verilog.txt b/sources_non_forked/ale/doc/ale-verilog.txt index 01af63c2..11e988bb 100644 --- a/sources_non_forked/ale/doc/ale-verilog.txt +++ b/sources_non_forked/ale/doc/ale-verilog.txt @@ -3,7 +3,7 @@ ALE Verilog/SystemVerilog Integration *ale-verilog-options* =============================================================================== -ALE can use five different linters for Verilog HDL: +ALE can use six different linters for Verilog HDL: HDL Checker Using `hdl_checker --lsp` @@ -20,6 +20,9 @@ ALE can use five different linters for Verilog HDL: Vivado Using `xvlog` + Yosys + Using `ysoys -Q -T -p 'read_verilog'` + By default, both 'verilog' and 'systemverilog' filetypes are checked. You can limit 'systemverilog' files to be checked using only 'verilator' by @@ -114,5 +117,26 @@ g:ale_verilog_xvlog_options *g:ale_verilog_xvlog_options* This variable can be changed to modify the flags/options passed to 'xvlog'. +=============================================================================== +yosys *ale-verilog-yosys* + +g:ale_verilog_yosys_executable *g:ale_verilog_yosys_executable* + *b:ale_verilog_yosys_executable* + Type: |String| + Default: `'yosys'` + + This variable can be changed to the path to the 'yosys' executable. + + +g:ale_verilog_yosys_options *g:ale_verilog_yosys_options* + *b:ale_verilog_yosys_options* + Type: |String| + Default: `'-Q -T -p ''read_verilog %s'''` + + This variable can be changed to modify the flags/options passed to 'yosys'. + By default, Yosys is an interative program. To obtain linting functionality, + the `'read_verilog'` command is used. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 5d2ff444..2e5cd145 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -651,9 +651,9 @@ problem will be displayed in a balloon instead of hover information. Hover information can be displayed in the preview window instead by setting |g:ale_hover_to_preview| to `1`. -When using Neovim, if |g:ale_hover_to_floating_preview| or |g:ale_floating_preview| -is set to 1, the hover information will show in a floating window. And -|g:ale_floating_window_border| for the border setting. +When using Neovim or Vim with |popupwin|, if |g:ale_hover_to_floating_preview| +or |g:ale_floating_preview| is set to 1, the hover information will show in a +floating window. And |g:ale_floating_window_border| for the border setting. For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling |balloonexpr| commands in terminals can cause scrolling issues in terminals, @@ -968,8 +968,8 @@ g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview* Type: |Number| Default: `0` - When this option is set to `1`, Neovim will use a floating window for - ALEDetail output. + When this option is set to `1`, Neovim or Vim with |popupwin| will use a + floating window for ALEDetail output. g:ale_disable_lsp *g:ale_disable_lsp* @@ -1200,7 +1200,8 @@ g:ale_floating_preview *g:ale_floating_preview* Type: |Number| Default: `0` - When set to `1`, Neovim will use a floating window for ale's preview window. + When set to `1`, Neovim or Vim with |popupwin| will use a floating window + for ale's preview window. This is equivalent to setting |g:ale_hover_to_floating_preview| and |g:ale_detail_to_floating_preview| to `1`. @@ -1281,7 +1282,8 @@ g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview* Type: |Number| Default: `0` - If set to `1`, Neovim will use floating windows for hover messages. + If set to `1`, Neovim or Vim with |popupwin| will use floating windows for + hover messages. g:ale_keep_list_window_open *g:ale_keep_list_window_open* @@ -2698,6 +2700,8 @@ documented in additional help files. dafny.................................|ale-dafny-dafny| dart....................................|ale-dart-options| analysis_server.......................|ale-dart-analysis_server| + dart-analyze..........................|ale-dart-analyze| + dart-format...........................|ale-dart-format| dartanalyzer..........................|ale-dart-dartanalyzer| dartfmt...............................|ale-dart-dartfmt| desktop.................................|ale-desktop-options| @@ -2840,6 +2844,7 @@ documented in additional help files. llvm....................................|ale-llvm-options| llc...................................|ale-llvm-llc| lua.....................................|ale-lua-options| + lua-format............................|ale-lua-lua-format| luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| luafmt................................|ale-lua-luafmt| @@ -2932,6 +2937,7 @@ documented in additional help files. pyrex (cython)..........................|ale-pyrex-options| cython................................|ale-pyrex-cython| python..................................|ale-python-options| + autoflake.............................|ale-python-autoflake| autoimport............................|ale-python-autoimport| autopep8..............................|ale-python-autopep8| bandit................................|ale-python-bandit| @@ -2945,7 +2951,7 @@ documented in additional help files. pyflakes..............................|ale-python-pyflakes| pylama................................|ale-python-pylama| pylint................................|ale-python-pylint| - pyls..................................|ale-python-pyls| + pylsp.................................|ale-python-pylsp| pyre..................................|ale-python-pyre| pyright...............................|ale-python-pyright| reorder-python-imports................|ale-python-reorder_python_imports| @@ -3066,6 +3072,7 @@ documented in additional help files. verilator.............................|ale-verilog-verilator| vlog..................................|ale-verilog-vlog| xvlog.................................|ale-verilog-xvlog| + yosys.................................|ale-verilog-yosys| vhdl....................................|ale-vhdl-options| ghdl..................................|ale-vhdl-ghdl| hdl-checker...........................|ale-vhdl-hdl-checker| @@ -3104,7 +3111,7 @@ ALEComplete *ALEComplete* Manually trigger LSP autocomplete and show the menu. Works only when called from insert mode. > - inoremap :AleComplete + inoremap :ALEComplete < A plug mapping `(ale_complete)` is defined for this command. > diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index 7c79f261..d19824b1 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -172,9 +172,15 @@ let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) " Enable automatic detection of pipenv for Python linters. let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) +" Enable automatic detection of poetry for Python linters. +let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0) + " This variable can be overridden to set the GO111MODULE environment variable. let g:ale_go_go111module = get(g:, 'ale_go_go111module', '') +" Default executable for deno, needed set before plugin start +let g:ale_deno_executable = get(g:, 'ale_deno_executable', 'deno') + " If 1, enable a popup menu for commands. let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running')) diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index b94a8084..77c92112 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -133,6 +133,8 @@ formatting. * [dafny](https://rise4fun.com/Dafny) :floppy_disk: * Dart * [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) + * [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: + * [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [language_server](https://github.com/natebosch/dart_language_server) @@ -294,6 +296,7 @@ formatting. * LLVM * [llc](https://llvm.org/docs/CommandGuide/llc.html) * Lua + * [lua-format](https://github.com/Koihik/LuaFormatter) * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) * [luafmt](https://github.com/trixnz/lua-fmt) @@ -407,6 +410,7 @@ formatting. * [purescript-language-server](https://github.com/nwolverson/purescript-language-server) * [purty](https://gitlab.com/joneshf/purty) * Python + * [autoflake](https://github.com/myint/autoflake) * [autoimport](https://lyz-code.github.io/autoimport/) * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: @@ -420,7 +424,7 @@ formatting. * [pyflakes](https://github.com/PyCQA/pyflakes) * [pylama](https://github.com/klen/pylama) :floppy_disk: * [pylint](https://www.pylint.org/) :floppy_disk: - * [pyls](https://github.com/palantir/python-language-server) :warning: + * [pylsp](https://github.com/python-lsp/python-lsp-server) :warning: * [pyre](https://github.com/facebook/pyre-check) :warning: * [pyright](https://github.com/microsoft/pyright) * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) @@ -434,6 +438,7 @@ formatting. * [lintr](https://github.com/jimhester/lintr) * [styler](https://github.com/r-lib/styler) * Racket + * [racket-langserver](https://github.com/jeapostrophe/racket-langserver/tree/master) * [raco](https://docs.racket-lang.org/raco/) * Re:VIEW * [redpen](http://redpen.cc/) @@ -558,6 +563,7 @@ formatting. * [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) * [vlog](https://www.mentor.com/products/fv/questa/) * [xvlog](https://www.xilinx.com/products/design-tools/vivado.html) + * [yosys](http://www.clifford.at/yosys/) * VHDL * [ghdl](https://github.com/ghdl/ghdl) * [vcom](https://www.mentor.com/products/fv/questa/) diff --git a/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim index 2daaa0b1..e491ce7c 100644 --- a/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim +++ b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim @@ -24,12 +24,8 @@ " POSSIBILITY OF SUCH DAMAGE. " -if v:version < 700 - finish -endif - -" check whether this script is already loaded -if exists("g:loaded_EditorConfig") +" check for Vim versions and duplicate script loading. +if v:version < 700 || exists("g:loaded_EditorConfig") finish endif let g:loaded_EditorConfig = 1 @@ -507,7 +503,7 @@ function! s:TrimTrailingWhitespace() " {{{1 " don't lose user position when trimming trailing whitespace let s:view = winsaveview() try - silent! keeppatterns %s/\s\+$//e + silent! keeppatterns keepjumps %s/\s\+$//e finally call winrestview(s:view) endtry diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md index dd351350..e2ce07b9 100644 --- a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md @@ -5,41 +5,42 @@ labels: bug --- +Keep in mind that others may have the same question in the future. The better your information, +the more likely they'll be able to help themselves. +--> #### Self-Diagnosis - -- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question. -- [ ] I have reviewed the NERDTree documentation. `:h NERDTree` -- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki). -- [ ] I have searched the web for an answer to my question. +Before creating an issue, take some time to search these resources for an answer. It's possible that someone else has already seen and solved your issue. +- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue) +- NERDTree documentation - `:h NERDTree` +- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki) +- Other resources: , , etc. -#### Environment (for bug reports) -- [ ] Operating System: -- [ ] Vim/Neovim version `:echo v:version`: -- [ ] NERDTree version, found on 1st line in NERDTree quickhelp `?`: -- [ ] vimrc settings - - [ ] NERDTree variables - ```vim - ``` - - Other NERDTree-dependent Plugins - - [ ] jistr/vim-nerdtree-tabs - - [ ] ryanoasis/vim-devicons - - [ ] tiagofumo/vim-nerdtree-syntax-highlight - - [ ] Xuyuanp/nerdtree-git-plugin - - [ ] Others (specify): - - [ ] I've verified the issue occurs with only NERDTree installed. +#### Environment +- Operating System: +- Vim/Neovim version `:version`: +- NERDTree version, found on first line of quickhelp `?`: +- Are you using any of these NERDTree-dependent plugins? + - [ ] [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) + - [ ] [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons) + - [ ] [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) + - [ ] [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin) + - [ ] [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops) + - [ ] [PhilRunninger/nerdtree-visual-selection](https://github.com/PhilRunninger/nerdtree-visual-selection) + - [ ] [jistr/vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs) + - [ ] Others (specify): +- Provide a minimal **.vimrc** file that will reproduce the issue. +```vim +``` #### Steps to Reproduce the Issue 1. -#### Current Result (Include screenshots where appropriate.) +#### Current Behavior (Include screenshots where appropriate.) #### Expected Result diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md index 25f15b02..7e13b7ac 100644 --- a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md @@ -3,22 +3,11 @@ name: "General Question" about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here." labels: "general question" --- - - -#### Self-Diagnosis - -- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question. -- [ ] I have reviewed the NERDTree documentation. `:h NERDTree` -- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki). -- [ ] I have searched the web for an answer to my question. +Before creating an issue, take some time to search these resources. It's possible that someone else has already asked your question and gotten an answer. +- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue) +- NERDTree documentation - `:h NERDTree` +- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki) +- Other resource: , , etc. #### State Your Question diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index 2681b67f..8bbc8f2c 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -5,10 +5,11 @@ - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> #### 6.10 +- **.10**: Improve F.A.Q. Answers and Issue Templates (PhilRunninger) [#1249](https://github.com/preservim/nerdtree/pull/1249) - **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236) - **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230) - **.7**: Fix mouse-clicking a file to open it. (PhilRunninger) [#1225](https://github.com/preservim/nerdtree/pull/1225) -- **.6**: Restore the default behavior of the key. (PhilRunninger) [#1221](https://github.com/preservim/nerdtree/pull/1221) +- **.6**: Restore the default behavior of the `` key. (PhilRunninger) [#1221](https://github.com/preservim/nerdtree/pull/1221) - **.5**: Fix `{'keepopen':0}` in NERDTreeCustomOpenArgs (PhilRunninger) [#1217](https://github.com/preservim/nerdtree/pull/1217) - **.4**: Removed directory separator from sort key (Daniel E) [#1219](https://github.com/preservim/nerdtree/pull/1219) - **.3**: Add new FAQ and answer: How to prevent buffers replacing NERDTree. (PhilRunninger) [#1215](https://github.com/preservim/nerdtree/pull/1215) diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 135f41ad..ea10c119 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -148,12 +148,16 @@ autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif ``` -### How can I close Vim automatically when NERDTree is the last window? +### How can I close Vim or a tab automatically when NERDTree is the last window? ```vim -" Exit Vim if NERDTree is the only window left. -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | - \ quit | endif +" Exit Vim if NERDTree is the only window remaining in the only tab. +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +``` +--- +```vim +" Close the tab if NERDTree is the only window remaining in it. +autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif ``` ### How can I prevent other buffers replacing NERDTree in its window? @@ -168,7 +172,7 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_ ```vim " Open the existing NERDTree on each new tab. -autocmd BufWinEnter * silent NERDTreeMirror +autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif ``` or change your NERDTree-launching shortcut key like so: ```vim diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index 15d061ef..c407b9be 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -146,7 +146,7 @@ function! s:Flake8() " {{{ set t_te= " perform the grep itself - let &grepformat="%f:%l:%c: %m\,%f:%l: %m" + let &grepformat="%f:%l:%c: %m\,%f:%l: %m,%-G%\\d" let &grepprg=s:flake8_cmd silent! grep! "%" " close any existing cwindows, diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 14a95d64..cbe340dd 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -1,6 +1,9 @@ " Location: autoload/fugitive.vim " Maintainer: Tim Pope +" The functions contained within this file are for internal use only. For the +" official API, see the commented functions in plugin/fugitive.vim. + if exists('g:autoloaded_fugitive') finish endif @@ -88,11 +91,16 @@ function! s:VersionCheck() abort endif endfunction +let s:worktree_error = "core.worktree is required when using an external Git dir" function! s:DirCheck(...) abort let vcheck = s:VersionCheck() if !empty(vcheck) return vcheck - elseif !empty(a:0 ? s:Dir(a:1) : s:Dir()) + endif + let dir = a:0 ? s:Dir(a:1) : s:Dir() + if !empty(dir) && FugitiveWorkTree(dir, 1) is# 0 + return 'return ' . string('echoerr "fugitive: ' . s:worktree_error . '"') + elseif !empty(dir) return '' elseif empty(bufname('')) return 'return ' . string('echoerr "fugitive: working directory does not belong to a Git repository"') @@ -225,6 +233,12 @@ function! fugitive#Autowrite() abort return '' endfunction +function! s:add_methods(namespace, method_names) abort + for name in a:method_names + let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name) + endfor +endfunction + " Section: Git function! s:GitCmd() abort @@ -237,7 +251,7 @@ function! s:GitCmd() abort let string = g:fugitive_git_executable let list = [] if string =~# '^\w\+=' - call add(list, 'env') + call add(list, '/usr/bin/env') endif while string =~# '\S' let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+') @@ -307,7 +321,7 @@ let s:git_versions = {} function! fugitive#GitVersion(...) abort let git = s:GitShellCmd() if !has_key(s:git_versions, git) - let s:git_versions[git] = matchstr(s:SystemError(git.' --version')[0], '\d[^[:space:]]\+') + let s:git_versions[git] = matchstr(s:SystemError(s:GitCmd() + ['--version'])[0], '\d[^[:space:]]\+') endif if !a:0 return s:git_versions[git] @@ -460,12 +474,12 @@ function! s:BuildEnvPrefix(env) abort let env = items(a:env) if empty(env) return '' - elseif &shellcmdflag =~# '-Command' + elseif &shell =~? '\%(powershell\|pwsh\)\%(\.exe\)\=$' return join(map(env, '"$Env:" . v:val[0] . " = ''" . substitute(v:val[1], "''", "''''", "g") . "''; "'), '') elseif s:winshell() return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '') else - return 'env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' ' + return '/usr/bin/env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' ' endif endfunction @@ -477,7 +491,7 @@ function! s:JobOpts(cmd, env) abort endif let envlist = map(items(a:env), 'join(v:val, "=")') if !has('win32') - return [['env'] + envlist + a:cmd, {}] + return [['/usr/bin/env'] + envlist + a:cmd, {}] else let pre = join(map(envlist, '"set " . substitute(v:val, "[&|<>^]", "^^^&", "g") . "& "'), '') if len(a:cmd) == 3 && a:cmd[0] ==# 'cmd.exe' && a:cmd[1] ==# '/c' @@ -519,7 +533,7 @@ function! s:SystemError(cmd, ...) abort let guioptions = &guioptions set guioptions-=! endif - let out = call('system', [type(a:cmd) ==# type([]) ? fugitive#Prepare(a:cmd) : a:cmd] + a:000) + let out = call('system', [type(a:cmd) == type([]) ? s:shellesc(a:cmd) : a:cmd] + a:000) return [out, v:shell_error] catch /^Vim\%((\a\+)\)\=:E484:/ let opts = ['shell', 'shellcmdflag', 'shellredir', 'shellquote', 'shellxquote', 'shellxescape', 'shellslash'] @@ -554,7 +568,7 @@ endfunction function! s:NullError(...) abort let [out, exec_error] = s:SystemError(call('fugitive#Prepare', a:000)) if exec_error - return [[], substitute(out, "\n$", "", "") : '', exec_error] + return [[], substitute(out, "\n$", "", ""), exec_error] else let list = split(out, "\1", 1) call remove(list, -1) @@ -625,13 +639,14 @@ function! s:ConfigTimestamps(dir, dict) abort return join(map(files, 'getftime(expand(v:val))'), ',') endfunction +let s:config_prototype = {} + let s:config = {} function! fugitive#Config(...) abort let name = '' let default = get(a:, 3, '') - 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 + if a:0 >= 2 && type(a:2) == type({}) && has_key(a:2, 'GetAll') + return fugitive#ConfigGetAll(a:1, a:2) elseif a:0 >= 2 let dir = s:Dir(a:2) let name = a:1 @@ -650,7 +665,8 @@ function! fugitive#Config(...) abort if has_key(s:config, dir_key) && s:config[dir_key][0] ==# s:ConfigTimestamps(dir, s:config[dir_key][1]) let dict = s:config[dir_key][1] else - let dict = {} + let dict = copy(s:config_prototype) + let dict.git_dir = dir let [lines, message, exec_error] = s:NullError([dir, 'config', '--list', '-z']) if exec_error return {} @@ -694,6 +710,25 @@ function! fugitive#ConfigGetRegexp(pattern, ...) abort return transformed endfunction +function! s:config_GetAll(name) dict abort + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + if name =~# '\.' + return get(self, name, []) + else + return [] + endif +endfunction + +function! s:config_Get(name, ...) dict abort + return get(self.GetAll(a:name), 0, a:0 ? a:1 : '') +endfunction + +function! s:config_GetRegexp(pattern) dict abort + return fugitive#ConfigGetRegexp(self, a:pattern) +endfunction + +call s:add_methods('config', ['GetAll', 'Get', 'GetRegexp']) + function! s:Remote(dir) abort let head = FugitiveHead(0, a:dir) let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', a:dir) : '' @@ -706,32 +741,83 @@ function! s:Remote(dir) abort return remote =~# '^\.\=$' ? 'origin' : remote endfunction -unlet! s:ssh_aliases -function! fugitive#SshHostAlias(...) abort - if !exists('s:ssh_aliases') - let s:ssh_aliases = {} - if filereadable(expand('~/.ssh/config')) - let hosts = [] - for line in readfile(expand('~/.ssh/config')) - let key = matchstr(line, '^\s*\zs\w\+\ze\s') - let value = matchstr(line, '^\s*\w\+\s\+\zs.*\S') - if key ==? 'host' - let hosts = split(value, '\s\+') - elseif key ==? 'hostname' - for host in hosts - if !has_key(s:ssh_aliases, host) - let s:ssh_aliases[host] = tolower(value) - endif - endfor - endif - endfor +function! s:SshParseHost(value) abort + let patterns = [] + let negates = [] + for host in split(a:value, '\s\+') + let pattern = substitute(host, '[\\^$.*~?]', '\=submatch(0) == "*" ? ".*" : submatch(0) == "?" ? "." : "\\" . submatch(0)', 'g') + if pattern[0] ==# '!' + call add(negates, '\&\%(^' . pattern[1 : -1] . '$\)\@!') + else + call add(patterns, pattern) endif + endfor + return '^\%(' . join(patterns, '\|') . '\)$' . join(negates, '') +endfunction + +function! s:SshParseConfig(into, root, file, ...) abort + if !filereadable(a:file) + return a:into endif - if a:0 - return get(s:ssh_aliases, a:1, a:1) - else - return s:ssh_aliases + let host = a:0 ? a:1 : '^\%(.*\)$' + for line in readfile(a:file) + let key = tolower(matchstr(line, '^\s*\zs\w\+\ze\s')) + let value = matchstr(line, '^\s*\w\+\s\+\zs.*\S') + if key ==# 'match' + let host = value ==# 'all' ? '^\%(.*\)$' : '' + elseif key ==# 'host' + let host = s:SshParseHost(value) + elseif key ==# 'include' + call s:SshParseInclude(a:into, a:root, host, value) + elseif len(key) && len(host) + call extend(a:into, {key: []}, 'keep') + call add(a:into[key], [host, value]) + endif + endfor + return a:into +endfunction + +function! s:SshParseInclude(into, root, host, value) abort + for glob in split(a:value) + if glob !~# '^/' + let glob = a:root . glob + endif + for file in split(glob(glob), "\n") + call s:SshParseConfig(a:into, a:root, file, a:host) + endfor + endfor +endfunction + +unlet! s:ssh_config +function! fugitive#SshConfig(host, ...) abort + if !exists('s:ssh_config') + let s:ssh_config = {} + for file in [expand("~/.ssh/config"), "/etc/ssh/ssh_config"] + call s:SshParseConfig(s:ssh_config, substitute(file, '\w*$', '', ''), file) + endfor endif + let host_config = {} + for key in a:0 ? a:1 : keys(s:ssh_config) + for [host_pattern, value] in get(s:ssh_config, key, []) + if a:host =~# host_pattern + let host_config[key] = value + break + endif + endfor + endfor + return host_config +endfunction + +function! fugitive#SshHostAlias(authority) abort + let [_, user, host, port; __] = matchlist(a:authority, '^\%(\([^/@]\+\)@\)\=\(.\{-\}\)\%(:\(\d\+\)\)\=$') + let c = fugitive#SshConfig(host, ['user', 'hostname', 'port']) + if empty(user) + let user = get(c, 'user', '') + endif + if empty(port) + let port = get(c, 'port', '') + endif + return (len(user) ? user . '@' : '') . get(c, 'hostname', host) . (port =~# '^\%(22\)\=$' ? '' : ':' . port) endfunction let s:redirects = {} @@ -740,28 +826,55 @@ function! fugitive#ResolveRemote(remote) abort if a:remote =~# '^https\=://' && s:executable('curl') if !has_key(s:redirects, a:remote) let s:redirects[a:remote] = matchstr(s:SystemError( - \ 'curl --disable --silent --max-time 5 -I ' . - \ s:shellesc(a:remote . '/info/refs?service=git-upload-pack'))[0], + \ ['curl', '--disable', '--silent', '--max-time', '5', '-I', + \ a:remote . '/info/refs?service=git-upload-pack'])[0], \ 'Location: \zs\S\+\ze/info/refs?') endif if len(s:redirects[a:remote]) return s:redirects[a:remote] endif + elseif a:remote =~# '^ssh://' + let authority = matchstr(a:remote, '[^/?#]*', 6) + return 'ssh://' . fugitive#SshHostAlias(authority) . strpart(a:remote, 6 + len(authority)) endif - return substitute(a:remote, - \ '^ssh://\%([^@:/]\+@\)\=\zs[^/:]\+\|^\%([^@:/]\+@\)\=\zs[^/:]\+\ze:/\@!', - \ '\=fugitive#SshHostAlias(submatch(0))', '') + let scp_authority = matchstr(a:remote, '^[^:/]\+\ze:\%(//\)\@!') + if empty(scp_authority) + return a:remote + endif + let path = strpart(a:remote, len(scp_authority) + 1) + let alias = fugitive#SshHostAlias(scp_authority) + if alias !~# ':' + return alias . ':' . path + elseif path =~# '^/' + return 'ssh://' . alias . path + else + return a:remote + endif +endfunction + +function! s:ConfigLengthSort(i1, i2) abort + return len(a:i2[0]) - len(a:i1[0]) endfunction function! fugitive#RemoteUrl(...) abort - let dir = a:0 > 1 ? a:2 : s:Dir() + let dir = a:0 > 1 ? s:Dir(a:2) : s:Dir() let url = !a:0 || a:1 =~# '^\.\=$' ? s:Remote(dir) : a:1 if url !~# ':\|^/\|^\.\.\=/' - if !fugitive#GitVersion(2, 7) - let url = FugitiveConfigGet('remote.' . url . '.url') - else - let url = s:ChompDefault('', [dir, 'remote', 'get-url', url, '--']) - endif + let config = fugitive#Config(a:0 > 1 ? a:2 : s:Dir()) + let url = FugitiveConfigGet('remote.' . url . '.url', config) + let instead_of = [] + for [k, vs] in items(fugitive#ConfigGetRegexp('^url\.\zs.\{-\}\ze\.insteadof$', config)) + for v in vs + call add(instead_of, [v, k]) + endfor + endfor + call sort(instead_of, 's:ConfigLengthSort') + for [orig, replacement] in instead_of + if strpart(url, 0, len(orig)) ==# orig + let url = replacement . strpart(url, len(orig)) + break + endif + endfor endif if !get(a:, 3, 0) let url = fugitive#ResolveRemote(url) @@ -796,6 +909,7 @@ function! s:QuickfixCreate(nr, opts) abort endfunction function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) abort + call s:BlurStatus() let mods = s:Mods(a:mods) let opts = {'title': a:title, 'context': {'items': []}} call s:QuickfixCreate(a:nr, opts) @@ -808,7 +922,7 @@ function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) ab endif let buffer = [] - let lines = split(s:SystemError(s:shellesc(a:cmd))[0], "\n") + let lines = split(s:SystemError(a:cmd)[0], "\n") for line in lines call extend(buffer, call(a:callback, a:000 + [line])) if len(buffer) >= 20 @@ -829,7 +943,6 @@ function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) ab silent exe s:DoAutocmd('QuickFixCmdPost ' . event) if a:first && len(s:QuickfixGet(a:nr)) - call s:BlurStatus() return mods . (a:nr < 0 ? 'cfirst' : 'lfirst') else return 'exe' @@ -849,12 +962,6 @@ endfunction " Section: Repository Object -function! s:add_methods(namespace, method_names) abort - for name in a:method_names - let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name) - endfor -endfunction - let s:repo_prototype = {} let s:repos = {} @@ -1109,19 +1216,20 @@ function! fugitive#Find(object, ...) abort if rev ==# '.git' let f = len(tree) ? tree . '/.git' : dir elseif rev =~# '^\.git/' - let f = substitute(rev, '^\.git', '', '') - let cdir = fugitive#CommonDir(dir) - if f =~# '^/\.\./\.\.\%(/\|$\)' - let f = simplify(len(tree) ? tree . f[3:-1] : dir . f) - elseif f =~# '^/\.\.\%(/\|$\)' - let f = base . f[3:-1] - elseif cdir !=# dir && ( - \ f =~# '^/\%(config\|hooks\|info\|logs/refs\|objects\|refs\|worktrees\)\%(/\|$\)' || - \ f !~# '^/\%(index$\|index\.lock$\|\w*MSG$\|\w*HEAD$\|logs/\w*HEAD$\|logs$\|rebase-\w\+\)\%(/\|$\)' && - \ getftime(FugitiveVimPath(dir . f)) < 0 && getftime(FugitiveVimPath(cdir . f)) >= 0) + let f = strpart(rev, 5) + let fdir = dir . '/' + let cdir = fugitive#CommonDir(dir) . '/' + if f =~# '^\.\./\.\.\%(/\|$\)' + let f = simplify(len(tree) ? tree . f[2:-1] : fdir . f) + elseif f =~# '^\.\.\%(/\|$\)' + let f = base . f[2:-1] + elseif cdir !=# fdir && ( + \ f =~# '^\%(config\|hooks\|info\|logs/refs\|objects\|refs\|worktrees\)\%(/\|$\)' || + \ f !~# '^\%(index$\|index\.lock$\|\w*MSG$\|\w*HEAD$\|logs/\w*HEAD$\|logs$\|rebase-\w\+\)\%(/\|$\)' && + \ getftime(FugitiveVimPath(fdir . f)) < 0 && getftime(FugitiveVimPath(cdir . f)) >= 0) let f = simplify(cdir . f) else - let f = simplify(dir . f) + let f = simplify(fdir . f) endif elseif rev ==# ':/' let f = tree @@ -1146,10 +1254,9 @@ function! fugitive#Find(object, ...) abort elseif rev =~# '^:[0-3]:' let f = 'fugitive://' . dir . '//' . rev[1] . '/' . rev[3:-1] elseif rev ==# ':' - if $GIT_INDEX_FILE =~# '/[^/]*index[^/]*\.lock$' && s:cpath(fnamemodify($GIT_INDEX_FILE,':p')[0:strlen(dir)]) ==# s:cpath(dir . '/') && filereadable($GIT_INDEX_FILE) + let f = FugitiveFind('.git/index', dir) + if $GIT_INDEX_FILE =~# '/[^/]*index[^/]*\.lock$' && s:cpath(fnamemodify($GIT_INDEX_FILE,':p')[0:strlen(f)-6], s:cpath(f[0 : -6])) && filereadable($GIT_INDEX_FILE) let f = fnamemodify($GIT_INDEX_FILE, ':p') - else - let f = fugitive#Find('.git/index', dir) endif elseif rev =~# '^:(\%(top\|top,literal\|literal,top\|literal\))' let f = matchstr(rev, ')\zs.*') @@ -1278,44 +1385,50 @@ function! s:ExpandVar(other, var, flags, esc, ...) abort let owner = s:Owner(buffer) return len(owner) ? owner : '@' elseif a:var ==# '' - let bufname = expand('') + let bufnames = [expand('')] if v:version >= 704 && get(maparg('', 'c', 0, 1), 'expr') try - let bufname = eval(maparg('', 'c')) - if bufname ==# "\\" - let bufname = expand('') + let bufnames = [eval(maparg('', 'c'))] + if bufnames[0] ==# "\\" + let bufnames = [expand('')] endif catch endtry endif elseif a:var =~# '^<' - let bufname = s:BufName(a:var) + let bufnames = [s:BufName(a:var)] + elseif a:var ==# '##' + let bufnames = map(argv(), 'fugitive#Real(v:val)') else - let bufname = fugitive#Real(s:BufName(a:var)) + let bufnames = [fugitive#Real(s:BufName(a:var))] endif - let flags = a:flags - let file = s:DotRelative(bufname, cwd) - while len(flags) - let flag = matchstr(flags, s:flag) - let flags = strpart(flags, len(flag)) - if flag ==# ':.' - let file = s:DotRelative(fugitive#Real(file), cwd) - else - let file = fnamemodify(file, flag) + let files = [] + for bufname in bufnames + let flags = a:flags + let file = s:DotRelative(bufname, cwd) + while len(flags) + let flag = matchstr(flags, s:flag) + let flags = strpart(flags, len(flag)) + if flag ==# ':.' + let file = s:DotRelative(fugitive#Real(file), cwd) + else + let file = fnamemodify(file, flag) + endif + endwhile + let file = s:Slash(file) + if file =~# '^fugitive://' + let [dir, commit, file_candidate] = s:DirCommitFile(file) + let tree = s:Tree(dir) + if len(tree) && len(file_candidate) + let file = (commit =~# '^.$' ? ':' : '') . commit . ':' . + \ s:DotRelative(tree . file_candidate) + elseif empty(file_candidate) && commit !~# '^.$' + let file = commit + endif endif - endwhile - let file = s:Slash(file) - if file =~# '^fugitive://' - let [dir, commit, file_candidate] = s:DirCommitFile(file) - let tree = s:Tree(dir) - if len(tree) && len(file_candidate) - let file = (commit =~# '^.$' ? ':' : '') . commit . ':' . - \ s:DotRelative(tree . file_candidate) - elseif empty(file_candidate) && commit !~# '^.$' - let file = commit - endif - endif - return (len(a:esc) ? shellescape(file) : file) + call add(files, len(a:esc) ? shellescape(file) : file) + endfor + return join(files, "\1") endfunction function! s:Expand(rev, ...) abort @@ -1332,13 +1445,13 @@ function! s:Expand(rev, ...) abort endif return substitute(file, \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, - \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),"", a:0 ? a:1 : getcwd())', 'g') + \ '\=tr(s:ExpandVar(submatch(1),submatch(2),submatch(3),"", a:0 ? a:1 : getcwd()), "\1", " ")', 'g') endfunction function! fugitive#Expand(object) abort return substitute(a:object, \ '\(\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, - \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5))', 'g') + \ '\=tr(s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5)), "\1", " ")', 'g') endfunction function! s:SplitExpandChain(string, ...) abort @@ -1360,7 +1473,7 @@ function! s:SplitExpandChain(string, ...) abort let arg = substitute(arg, \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5), cwd)', 'g') - call add(list, arg) + call extend(list, split(arg, "\1", 1)) if arg ==# '--' let seen_separator = 1 endif @@ -1512,8 +1625,8 @@ endfunction function! s:UpdateIndex(dir, info) abort let info = join(a:info[0:-2]) . "\t" . a:info[-1] . "\n" - let [error, exec_error] = s:SystemError([a:dir, 'update-index', '--index-info'], info) - return !exec_error ? '' : len(error) ? error : 'fugitive: unknown update-index error' + let [error, exec_error] = s:SystemError(fugitive#Prepare([a:dir, 'update-index', '--index-info']), info) + return !exec_error ? '' : len(error) ? error : 'unknown update-index error' endfunction function! fugitive#setfperm(url, perm) abort @@ -1532,9 +1645,11 @@ function! s:TempCmd(out, cmd) abort try let cmd = (type(a:cmd) == type([]) ? fugitive#Prepare(a:cmd) : a:cmd) let redir = ' > ' . a:out - if (s:winshell() || &shellcmdflag ==# '-Command') && !has('nvim') + if s:winshell() && !has('nvim') let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' return s:SystemError('cmd /c "' . s:gsub(cmd, '[<>%]', cmd_escape_char . '&') . redir . '"') + elseif &shell =~? '\%(powershell\|pwsh\)\%(\.exe\)\=$' + return s:SystemError(&shell . ' ' . &shellcmdflag . ' ' . s:shellesc(cmd . redir)) elseif &shell =~# 'fish' return s:SystemError(' begin;' . cmd . redir . ';end ') else @@ -1714,12 +1829,13 @@ function! fugitive#CompletePath(base, ...) abort let stripped = matchstr(a:base, '^\%(:(literal)\|:\)') let base = strpart(a:base, len(stripped)) endif - if base =~# '^\.git/' + if base =~# '^\.git/' && len(dir) let pattern = s:gsub(base[5:-1], '/', '*&').'*' - let matches = s:GlobComplete(dir . '/', pattern) - let cdir = fugitive#CommonDir(dir) - if len(cdir) && s:cpath(dir) !=# s:cpath(cdir) - call extend(matches, s:GlobComplete(cdir . '/', pattern)) + let fdir = fugitive#Find(dir . '/') + let matches = s:GlobComplete(fdir, pattern) + let cdir = fugitive#Find('.git/refs', dir)[0 : -5] + if len(cdir) && s:cpath(fdir) !=# s:cpath(cdir) + call extend(matches, s:GlobComplete(cdir, pattern)) endif call s:Uniq(matches) call map(matches, "'.git/' . v:val") @@ -1761,7 +1877,8 @@ function! fugitive#CompleteObject(base, ...) abort if a:base =~# '^\.\=/\|^:(' || a:base !~# ':' let results = [] if a:base =~# '^refs/' - let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)') + let cdir = fugitive#Find('.git/refs', dir)[0 : -5] + let results += map(s:GlobComplete(cdir, a:base . '*'), 's:Slash(v:val)') call map(results, 's:fnameescape(v:val)') elseif a:base !~# '^\.\=/\|^:(' let heads = s:CompleteHeads(dir) @@ -1954,7 +2071,7 @@ function! fugitive#BufReadStatus() abort if len(prop) let props[prop[1]] = prop[2] elseif line[0] ==# '?' - call add(untracked, {'type': 'File', 'status': line[0], 'filename': line[2:-1]}) + call add(untracked, {'type': 'File', 'status': line[0], 'filename': line[2:-1], 'relative': [line[2:-1]]}) elseif line[0] !=# '#' if line[0] ==# 'u' let file = matchstr(line, '^.\{37\} \x\{40,\} \x\{40,\} \x\{40,\} \zs.*$') @@ -1964,17 +2081,18 @@ function! fugitive#BufReadStatus() abort if line[0] ==# '2' let i += 1 let file = matchstr(file, ' \zs.*') - let files = output[i] . ' -> ' . file + let relative = [file, output[i]] else - let files = file + let relative = [file] endif + let filename = join(reverse(copy(relative)), ' -> ') let sub = matchstr(line, '^[12u] .. \zs....') if line[2] !=# '.' - call add(staged, {'type': 'File', 'status': line[2], 'filename': files, 'submodule': sub}) + call add(staged, {'type': 'File', 'status': line[2], 'filename': filename, 'relative': relative, 'submodule': sub}) endif if line[3] !=# '.' let sub = matchstr(line, '^[12u] .. \zs....') - call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'submodule': sub}) + call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'relative': [file], 'submodule': sub}) endif endif let i += 1 @@ -2013,22 +2131,24 @@ function! fugitive#BufReadStatus() abort while i < len(output) let line = output[i] let file = line[3:-1] - let files = file let i += 1 if line[2] !=# ' ' continue endif if line[0:1] =~# '[RC]' - let files = output[i] . ' -> ' . file + let relative = [file, output[i]] let i += 1 + else + let relative = [file] endif + let filename = join(reverse(copy(relative)), ' -> ') if line[0] !~# '[ ?!#]' - call add(staged, {'type': 'File', 'status': line[0], 'filename': files, 'submodule': ''}) + call add(staged, {'type': 'File', 'status': line[0], 'filename': filename, 'relative': relative, 'submodule': ''}) endif if line[0:1] ==# '??' - call add(untracked, {'type': 'File', 'status': line[1], 'filename': files}) + call add(untracked, {'type': 'File', 'status': line[1], 'filename': filename, 'relative': relative}) elseif line[1] !~# '[ !#]' - call add(unstaged, {'type': 'File', 'status': line[1], 'filename': file, 'submodule': ''}) + call add(unstaged, {'type': 'File', 'status': line[1], 'filename': file, 'relative': [file], 'submodule': ''}) endif endwhile endif @@ -2129,8 +2249,10 @@ function! fugitive#BufReadStatus() abort if push !=# pull call s:AddHeader('Push', push) endif - if empty(s:Tree()) + if get(fugitive#ConfigGetAll('core.bare', config), 0, 'true') !~# '^\%(false\|no|off\|0\|\)$' call s:AddHeader('Bare', 'yes') + elseif empty(s:Tree()) + call s:AddHeader('Error', s:worktree_error) endif if get(fugitive#ConfigGetAll('advice.statusHints', config), 0, 'true') !~# '^\%(false\|no|off\|0\|\)$' call s:AddHeader('Help', 'g?') @@ -2264,7 +2386,7 @@ function! fugitive#FileWriteCmd(...) abort endif silent execute "'[,']write !".fugitive#Prepare(dir, 'hash-object', '-w', '--stdin', '--').' > '.tmp let sha1 = readfile(tmp)[0] - let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+') + let old_mode = matchstr(s:ChompError(['ls-files', '--stage', '.' . file], dir)[0], '^\d\+') if empty(old_mode) let old_mode = executable(s:Tree(dir) . file) ? '100755' : '100644' endif @@ -2549,7 +2671,7 @@ function! s:RunEdit(state, tmp, job) abort endif call remove(a:state, 'request') let sentinel = a:state.file . '.edit' - let file = FugitiveVimPath(readfile(sentinel, 1)[0]) + let file = FugitiveVimPath(readfile(sentinel, '', 1)[0]) exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) set bufhidden=wipe let s:edit_jobs[bufnr('')] = [a:state, a:tmp, a:job, sentinel] @@ -2862,6 +2984,9 @@ unlet s:colortype function! fugitive#Command(line1, line2, range, bang, mods, arg) abort exe s:VersionCheck() let dir = s:Dir() + if len(dir) + exe s:DirCheck(dir) + endif let config = copy(fugitive#Config(dir)) let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir)) let flags = [] @@ -3480,16 +3605,18 @@ function! s:StageInfo(...) abort endif endwhile let text = matchstr(getline(lnum), '^[A-Z?] \zs.*') + let file = get(get(b:fugitive_files, heading, {}), text, {}) + let relative = get(file, 'relative', len(text) ? [text] : []) return {'section': matchstr(heading, '^\u\l\+'), \ 'heading': heading, \ 'sigil': sigil, \ 'offset': offset, \ 'filename': text, - \ 'relative': reverse(split(text, ' -> ')), - \ 'paths': map(reverse(split(text, ' -> ')), 's:Tree() . "/" . v:val'), + \ 'relative': copy(relative), + \ 'paths': map(copy(relative), '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, heading, {}), text, {}), 'submodule', ''), + \ 'submodule': get(file, 'submodule', ''), \ 'index': index} endfunction @@ -3559,12 +3686,14 @@ function! s:Selection(arg1, ...) abort endif let results[-1].lnum = lnum elseif line =~# '^[A-Z?] ' - let filename = matchstr(line, '^[A-Z?] \zs.*') + let text = matchstr(line, '^[A-Z?] \zs.*') + let file = get(get(b:fugitive_files, template.heading, {}), text, {}) + let relative = get(file, 'relative', len(text) ? [text] : []) call add(results, extend(deepcopy(template), { \ 'lnum': lnum, - \ 'filename': filename, - \ 'relative': reverse(split(filename, ' -> ')), - \ 'paths': map(reverse(split(filename, ' -> ')), 'root . v:val'), + \ 'filename': text, + \ 'relative': copy(relative), + \ 'paths': map(copy(relative), 'root . v:val'), \ 'status': matchstr(line, '^[A-Z?]'), \ })) elseif line =~# '^\x\x\x\+ ' @@ -4553,12 +4682,12 @@ function! s:ToolStream(line1, line2, range, bang, mods, options, args, state) ab let filename = '' let cmd = [] let tabnr = tabpagenr() + 1 - for line in split(s:SystemError(s:shellesc(exec))[0], "\n") + for line in split(s:SystemError(exec)[0], "\n") for item in s:ToolParse(a:state, line) if len(get(item, 'filename', '')) && item.filename != filename call add(cmd, 'tabedit ' . s:fnameescape(item.filename)) for i in reverse(range(len(get(item.context, 'diff', [])))) - call add(cmd, (i ? 'rightbelow' : 'leftabove') . ' vert Gdiffsplit! ' . s:fnameescape(item.context.diff[i].filename)) + call add(cmd, (i ? 'rightbelow' : 'leftabove') . ' vertical Gdiffsplit! ' . s:fnameescape(item.context.diff[i].filename)) endfor call add(cmd, 'wincmd =') let filename = item.filename @@ -4717,7 +4846,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort let cmd = ['--no-pager', 'grep', '-n', '--no-color', '--full-name'] let tree = s:Tree(dir) let args = a:options.subcommand_args - if get(args, 0, '') =~# '^-O\|--open-files-in-pager$' + if get(args, 0, '') =~# '^\%(-O\|--open-files-in-pager\)$' let args = args[1:-1] endif let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') @@ -5066,7 +5195,7 @@ function! s:BlurStatus() abort endif endfunction -let s:bang_edits = {'split': 'Git', 'vsplit': 'vert Git', 'tabedit': 'tab Git', 'pedit': 'Git!'} +let s:bang_edits = {'split': 'Git', 'vsplit': 'vertical Git', 'tabedit': 'tab Git', 'pedit': 'Git!'} function! fugitive#Open(cmd, bang, mods, arg, args) abort exe s:VersionCheck() if a:bang @@ -5465,6 +5594,10 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort exe pre let mods = (a:autodir ? s:diff_modifier(len(parents) + 1) : '') . s:Mods(mods, 'leftabove') let nr = bufnr('') + if len(parents) > 1 && !&equalalways + let equalalways = 0 + set equalalways + endif execute mods 'split' s:fnameescape(fugitive#Find(parents[0])) call s:Map('n', 'dp', ':diffput '.nr.'diffupdate', '') let nr2 = bufnr('') @@ -5481,9 +5614,6 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort call s:Map('n', 'd' . (i + 2) . 'o', ':diffget '.nrx.'diffupdate', '') endfor call s:diffthis() - if len(parents) > 1 - wincmd = - endif return post elseif len(args) let arg = join(args, ' ') @@ -5547,6 +5677,9 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort catch /^fugitive:/ return 'echoerr ' . string(v:exception) finally + if exists('l:equalalways') + let &l:equalalways = equalalways + endif if exists('diffopt') let &diffopt = diffopt endif @@ -5760,7 +5893,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort let i += 1 if i == len(flags) echohl ErrorMsg - echo s:ChompError(['blame', arg])[0] + echo s:ChompError([dir, 'blame', arg])[0] echohl NONE return '' endif @@ -6217,15 +6350,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let rev = '' let result = fugitive#Result() if filereadable(get(result, 'file', '')) - for line in readfile(result.file, 4096) - let rev = s:fnameescape(matchstr(line, '\]*[^[:space:]<>.,;:"''!?]')) - if len(rev) - break - endif - endfor - if empty(rev) - return 'echoerr ' . string('fugitive: no URL found in output of last :Git') - endif + let rev = s:fnameescape(result.file) + else + return 'echoerr ' . string('fugitive: could not find prior :Git invocation') endif elseif !exists('l:remote') let remote = matchstr(arg, '@\zs\%('.validremote.'\)$') @@ -6242,6 +6369,20 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo if expanded =~? '^\a\a\+:[\/][\/]' && expanded !~? '^fugitive:' return s:BrowserOpen(s:Slash(expanded), a:mods, a:bang) endif + if !exists('l:result') + let result = s:TempState(empty(expanded) ? @% : expanded) + endif + if !empty(result) && filereadable(get(result, 'file', '')) + for line in readfile(result.file, '', 4096) + let rev = s:fnameescape(matchstr(line, '\]*[^[:space:]<>.,;:"''!?]')) + if len(rev) + break + endif + endfor + if empty(rev) + return 'echoerr ' . string('fugitive: no URL found in output of :Git') + endif + endif exe s:DirCheck(dir) if empty(expanded) let bufname = s:BufName('%') @@ -6256,9 +6397,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo endif endif endif - let cdir = FugitiveVimPath(fugitive#CommonDir(dir)) + let refdir = fugitive#Find('.git/refs', dir) for subdir in ['tags/', 'heads/', 'remotes/'] - if expanded !~# '^[./]' && filereadable(cdir . '/refs/' . subdir . expanded) + if expanded !~# '^[./]' && filereadable(refdir . '/' . subdir . expanded) let expanded = '.git/refs/' . subdir . expanded endif endfor @@ -6294,8 +6435,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo if type ==# 'tree' && !empty(path) let path = s:sub(path, '/\=$', '/') endif - if path =~# '^\.git/.*HEAD$' && filereadable(dir . '/' . path[5:-1]) - let body = readfile(dir . '/' . path[5:-1])[0] + let actual_dir = fugitive#Find('.git/', dir) + if path =~# '^\.git/.*HEAD$' && filereadable(actual_dir . path[5:-1]) + let body = readfile(actual_dir . path[5:-1])[0] if body =~# '^\x\{40,\}$' let commit = body let type = 'commit' @@ -6363,7 +6505,7 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let blame_list = tempname() call writefile([commit, ''], blame_list, 'b') let blame_in = tempname() - silent exe '%write' blame_in + silent exe 'noautocmd keepalt %write' blame_in let [blame, exec_error] = s:LinesError(['-c', 'blame.coloring=none', 'blame', '--contents', blame_in, '-L', line1.','.line2, '-S', blame_list, '-s', '--show-number', './' . path], dir) if !exec_error let blame_regex = '^\^\x\+\s\+\zs\d\+\ze\s' @@ -6382,7 +6524,7 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo endif let i = 0 while commit =~# '^ref: ' && i < 10 - let ref_file = cdir . '/' . commit[5:-1] + let ref_file = refdir[0 : -5] . commit[5:-1] if getfsize(ref_file) > 0 let commit = readfile(ref_file, '', 1)[0] else diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index efa2d774..fd0ab2e6 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -601,20 +601,47 @@ a statusline, this one matches the default when 'ruler' is set: > set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P < - *FugitiveHead(...)* *fugitive#head(...)* -Use FugitiveHead() to return the name of the current branch. If the current -HEAD is detached, FugitiveHead() will return the empty string, unless the -optional argument is given, in which case the hash of the current commit will -be truncated to the given number of characters. +AUTOCOMMANDS *fugitive-autocommands* + +A handful of |User| |autocommands| are provided to allow extending and +overriding Fugitive behaviors. Example usage: +> + autocmd User FugitiveBlob call s:BlobOverrides() +< + *User_FugitiveIndex* +FugitiveIndex After loading the |fugitive-summary| buffer. + + *User_FugitiveTag* +FugitiveTag After loading a tag object. + + *User_FugitiveCommit* +FugitiveCommit After loading a commit object. + + *User_FugitiveTree* +FugitiveTree After loading a tree (directory) object. + + *User_FugitiveBlob* +FugitiveBlob After loading a blob (file) object. This includes + both committed blobs which are read only, and staged + blobs which can be edited and written. Check + &modifiable to distinguish between the two. + + *User_FugitiveChanged* +FugitiveChanged After any event which can potentially change the + repository, for example, any invocation of |:Git|. + Originally intended for expiring caches, but can have + other uses. + +API *fugitive-api* + +Officially supported functions are documented inline in plugin/fugitive.vim. DEPRECATIONS *fugitive-deprecated* -The following commands are softly deprecated in favor of replacements that -adhere to a new naming scheme. They will eventually be removed, but probably -not in the near future. - -Remember that |:Git| can be shortened to |:G|, so replacements using it are -just one space character longer than the legacy version. +The following commands are deprecated in favor of replacements that adhere to +a new naming scheme. Remember that |:Git| can be shortened to |:G|, so +replacements using it are just one space character longer than the legacy +version. *:Gremove* Superseded by |:GRemove|. *:Gdelete* Superseded by |:GDelete|. @@ -640,6 +667,14 @@ just one space character longer than the legacy version. *:Gtabsplit!* Superseded by :tab Git --paginate. *:Gpedit!* Superseded by :Git! --paginate. + *User_Fugitive* +Fugitive used to support `:autocmd User Fugitive` to run an autocommand after +loading any buffer belonging to a Git repository, but this is being phased +out. Instead, one can leverage regular autocommand events like |BufNewFile| +and |BufReadPost|, and check !empty(FugitiveGitDir()) to confirm Fugitive has +found a repository. See also |fugitive-autocommands| for other, more +selective events. + ABOUT *fugitive-about* Grab the latest version or report a bug on GitHub: diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 0df5068b..a8eca443 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -10,6 +10,10 @@ let g:loaded_fugitive = 1 let s:bad_git_dir = '/$\|^fugitive:' +" FugitiveGitDir() returns the detected Git dir for the given buffer number, +" or the current buffer if no argument is passed. This will be an empty +" string if no Git dir was found. Use !empty(FugitiveGitDir()) to check if +" Fugitive is active in the current buffer. function! FugitiveGitDir(...) abort if v:version < 704 return '' @@ -18,7 +22,7 @@ function! FugitiveGitDir(...) abort return g:fugitive_event endif let dir = get(b:, 'git_dir', '') - if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$') + if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$') return FugitiveExtractGitDir(getcwd()) elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype) let b:git_dir = FugitiveExtractGitDir(expand('%:p')) @@ -95,9 +99,11 @@ function! FugitiveParse(...) abort endfunction " FugitiveResult() returns an object encapsulating the result of the most -" recend :Git command. Will be empty if no result is available. Pass in the -" name of a temp buffer to get the result object for that command instead. -" Contains the following keys: +" recent :Git command. Will be empty if no result is available. During a +" User FugitiveChanged event, this is guaranteed to correspond to the :Git +" command that triggered the event, or be empty if :Git was not the trigger. +" Pass in the name of a temp buffer to get the result object for that command +" instead. Contains the following keys: " " * "args": List of command arguments, starting with the subcommand. Will be " empty for usages like :Git --help. @@ -127,13 +133,17 @@ endfunction " when performing multiple config queries. Do not rely on the internal " structure of the return value as it is not guaranteed. If you want a full " dictionary of every config value, use FugitiveConfigGetRegexp('.*'). +" +" An optional argument provides the Git dir, or the buffer number of a +" buffer with a Git dir. The default is the current buffer. Pass a blank +" string to limit to the global config. function! FugitiveConfig(...) abort 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. +" argument can be either the object returned by FugitiveConfig(), or a Git +" dir or buffer number to be passed along to FugitiveConfig(). function! FugitiveConfigGet(name, ...) abort return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, '')) endfunction @@ -152,10 +162,24 @@ function! FugitiveConfigGetRegexp(pattern, ...) abort return call('fugitive#ConfigGetRegexp', [a:pattern] + a:000) endfunction +" FugitiveRemoteUrl() retrieves the remote URL for the given remote name, +" defaulting to the current branch's remote or "origin" if no argument is +" given. Similar to `git remote get-url`, but also attempts to resolve HTTP +" redirects and SSH host aliases. +" +" An optional second argument provides the Git dir, or the buffer number of a +" buffer with a Git dir. The default is the current buffer. function! FugitiveRemoteUrl(...) abort - return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1), a:0 > 2 ? a:3 : 0) + return fugitive#RemoteUrl(a:0 ? a:1 : '', a:0 > 1 ? a:2 : -1, a:0 > 2 ? a:3 : 0) endfunction +" FugitiveHead() retrieves the name of the current branch. If the current HEAD +" is detached, FugitiveHead() will return the empty string, unless the +" optional argument is given, in which case the hash of the current commit +" will be truncated to the given number of characters. +" +" An optional second argument provides the Git dir, or the buffer number of a +" buffer with a Git dir. The default is the current buffer. function! FugitiveHead(...) abort let dir = FugitiveGitDir(a:0 > 1 ? a:2 : -1) if empty(dir) @@ -176,11 +200,16 @@ function! FugitiveCommonDir(...) abort if empty(dir) return '' endif - return fugitive#CommonDir(dir) + return fugitive#Find('.git/refs/..', dir) endfunction function! FugitiveWorkTree(...) abort - return s:Tree(FugitiveGitDir(a:0 ? a:1 : -1)) + let tree = s:Tree(FugitiveGitDir(a:0 ? a:1 : -1)) + if tree isnot# 0 || a:0 > 1 + return tree + else + return '' + endif endfunction function! FugitiveIsGitDir(path) abort @@ -204,9 +233,14 @@ function! s:Tree(path) abort let config_file = dir . '/config' if filereadable(config_file) let config = readfile(config_file,'',10) - call filter(config,'v:val =~# "^\\s*worktree *="') - if len(config) == 1 - let worktree = FugitiveVimPath(matchstr(config[0], '= *\zs.*')) + let wt_config = filter(copy(config),'v:val =~# "^\\s*worktree *="') + if len(wt_config) == 1 + let worktree = FugitiveVimPath(matchstr(wt_config[0], '= *\zs.*')) + else + call filter(config,'v:val =~# "^\\s*bare *= *false *$"') + if len(config) + let s:worktree_for_dir[dir] = 0 + endif endif elseif filereadable(dir . '/gitdir') let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h') @@ -358,7 +392,7 @@ function! s:ProjectionistDetect() abort if empty(base) let base = s:Tree(dir) endif - if len(base) + if !empty(base) if exists('+shellslash') && !&shellslash let base = tr(base, '/', '\') endif @@ -380,13 +414,13 @@ command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(, , +"", 0, "", )' - \ '|echohl WarningMSG|echo ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE' + \ '|echohl WarningMSG|echomsg ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE' endif for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame'] if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd) - \ 'echohl WarningMSG|echo ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|' + \ 'echohl WarningMSG|echomsg ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|' \ 'exe fugitive#Command(, , +"", 0, "", "' . tolower(s:cmd) . ' " . )' endif endfor @@ -401,7 +435,7 @@ exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugiti if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(,,+"",0,"",, "")' - \ '|echohl WarningMSG|echo ":Glog is deprecated in favor of :Gclog"|echohl NONE' + \ '|echohl WarningMSG|echomsg ":Glog is deprecated in favor of :Gclog"|echohl NONE' endif exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(,,+"",0,"",, "c")' exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(,,+"",0,"",, "c")' @@ -422,37 +456,37 @@ exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist, exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, 0, "vert ", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, 0, "vertical ", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(, , +"", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(, , +"", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( , , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( , , +"", 0, "", , [])' exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(, , +"", 0, "", , [])' if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1) - exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' - \ '|echohl WarningMSG|echo ":Gremove is deprecated in favor of :GRemove"|echohl NONE' + exe 'command! -bar -bang -nargs=0 Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' + \ '|echohl WarningMSG|echomsg ":Gremove is deprecated in favor of :GRemove"|echohl NONE' endif if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 1) - exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' - \ '|echohl WarningMSG|echo ":Gdelete is deprecated in favor of :GDelete"|echohl NONE' + exe 'command! -bar -bang -nargs=0 Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' + \ '|echohl WarningMSG|echomsg ":Gdelete is deprecated in favor of :GDelete"|echohl NONE' endif if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( , , +"", 0, "", , [])' - \ '|echohl WarningMSG|echo ":Gmove is deprecated in favor of :GMove"|echohl NONE' + \ '|echohl WarningMSG|echomsg ":Gmove is deprecated in favor of :GMove"|echohl NONE' endif if exists(':Grename') != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(, , +"", 0, "", , [])' - \ '|echohl WarningMSG|echo ":Grename is deprecated in favor of :GRename"|echohl NONE' + \ '|echohl WarningMSG|echomsg ":Grename is deprecated in favor of :GRename"|echohl NONE' endif exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1) exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' - \ '|if 1|redraw!|endif|echohl WarningMSG|echo ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE' + \ '|if 1|redraw!|endif|echohl WarningMSG|echomsg ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE' endif if v:version < 704 diff --git a/sources_non_forked/vim-fugitive/syntax/fugitive.vim b/sources_non_forked/vim-fugitive/syntax/fugitive.vim index aab99c45..0ed82dd7 100644 --- a/sources_non_forked/vim-fugitive/syntax/fugitive.vim +++ b/sources_non_forked/vim-fugitive/syntax/fugitive.vim @@ -7,8 +7,9 @@ syn spell notoplevel syn include @fugitiveDiff syntax/diff.vim -syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite -syn match fugitiveBareHeader /^Bare:/ +syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ +syn match fugitiveHeader /^Head:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite +syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveSymbolicRef skipwhite syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite syn match fugitiveHelpTag /\S\+/ contained @@ -36,7 +37,6 @@ for s:section in ['Untracked', 'Unstaged', 'Staged'] endfor unlet s:section -hi def link fugitiveBareHeader fugitiveHeader hi def link fugitiveHelpHeader fugitiveHeader hi def link fugitiveHeader Label hi def link fugitiveHelpTag Tag diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim index c8f9e21e..0daa9064 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -179,7 +179,7 @@ endfunction " - this runs synchronously " - it ignores unsaved changes in buffers " - it does not change to the repo root -function! gitgutter#quickfix() +function! gitgutter#quickfix(current_file) let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' rev-parse --show-cdup' let path_to_repo = get(systemlist(cmd), 0, '') if !empty(path_to_repo) && path_to_repo[-1:] != '/' @@ -191,6 +191,9 @@ function! gitgutter#quickfix() \ ' diff --no-ext-diff --no-color -U0'. \ ' --src-prefix=a/'.path_to_repo.' --dst-prefix=b/'.path_to_repo.' '. \ g:gitgutter_diff_args. ' '. g:gitgutter_diff_base + if a:current_file + let cmd = cmd.' -- '.expand('%:p') + endif let diff = systemlist(cmd) let lnum = 0 for line in diff diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 56a96336..7da0b49b 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -158,6 +158,11 @@ Commands for jumping between hunks:~ > command! Gqf GitGutterQuickFix | copen < + *gitgutter-:GitGutterQuickFixCurrentFile* +:GitGutterQuickFixCurrentFile Same as :GitGutterQuickFix, but only load hunks for + the file in the focused buffer. This has the same + functionality as :GitGutterQuickFix when the focused + buffer is empty. Commands for operating on a hunk:~ diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index 2c829550..915c83fe 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -118,7 +118,8 @@ command! -bar GitGutterBufferDisable call gitgutter#buffer_disable() command! -bar GitGutterBufferEnable call gitgutter#buffer_enable() command! -bar GitGutterBufferToggle call gitgutter#buffer_toggle() -command! -bar GitGutterQuickFix call gitgutter#quickfix() +command! -bar GitGutterQuickFix call gitgutter#quickfix(0) +command! -bar GitGutterQuickFixCurrentFile call gitgutter#quickfix(1) " }}} diff --git a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim index e75f21bc..f9aac592 100644 --- a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim @@ -947,12 +947,27 @@ function Test_quickfix() call setline(5, ['A', 'B']) call setline(9, ['C', 'D']) write + let bufnr1 = bufnr('') + + edit fixture_dos.txt + call setline(2, ['A', 'B']) + write + let bufnr2 = bufnr('') GitGutterQuickFix let expected = [ - \ {'lnum': 5, 'bufnr': bufnr(''), 'text': '-e'}, - \ {'lnum': 9, 'bufnr': bufnr(''), 'text': '-i'} + \ {'lnum': 5, 'bufnr': bufnr1, 'text': '-e'}, + \ {'lnum': 9, 'bufnr': bufnr1, 'text': '-i'}, + \ {'lnum': 2, 'bufnr': bufnr2, 'text': "-b\r"} + \ ] + + call s:assert_list_of_dicts(expected, getqflist()) + + GitGutterQuickFixCurrentFile + + let expected = [ + \ {'lnum': 2, 'bufnr': bufnr(''), 'text': "-b\r"}, \ ] call s:assert_list_of_dicts(expected, getqflist()) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index 5e909c4a..e833b243 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (12.3.3) + rake (10.4.2) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-ruby/indent/ruby.vim b/sources_non_forked/vim-ruby/indent/ruby.vim index 657aa763..20a6f7df 100644 --- a/sources_non_forked/vim-ruby/indent/ruby.vim +++ b/sources_non_forked/vim-ruby/indent/ruby.vim @@ -89,6 +89,9 @@ let s:ruby_indent_keywords = \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' +" Def without an end clause: def method_call(...) = +let s:ruby_endless_def = '\' @@ -108,10 +111,26 @@ let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\ " Regex that defines the end-match for the 'end' keyword. let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\' -" Expression used for searchpair() call for finding match for 'end' keyword. -let s:end_skip_expr = s:skip_expr . - \ ' || (expand("") == "do"' . - \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")' +" Expression used for searchpair() call for finding a match for an 'end' keyword. +function! s:EndSkipExpr() + if eval(s:skip_expr) + return 1 + elseif expand('') == 'do' + \ && getline(".") =~ '^\s*\<\(while\|until\|for\):\@!\>' + return 1 + elseif getline('.') =~ s:ruby_endless_def + return 1 + elseif getline('.') =~ '\ 0 + if col > 0 && s:Match(info.plnum, s:ruby_endless_def) <= 0 call cursor(info.plnum, col) let ind = virtcol('.') - 1 + info.sw " TODO: make this better (we need to count them) (or, if a searchpair @@ -656,7 +680,7 @@ function! s:IndentingKeywordInMSL(msl_info) abort " TODO: this does not take into account contrived things such as " module Foo; class Bar; end let col = s:Match(info.plnum_msl, s:ruby_indent_keywords) - if col > 0 + if col > 0 && s:Match(info.plnum_msl, s:ruby_endless_def) <= 0 let ind = indent(info.plnum_msl) + info.sw if s:Match(info.plnum_msl, s:end_end_regex) let ind = ind - info.sw diff --git a/sources_non_forked/vim-ruby/spec/indent/end_constructs_spec.rb b/sources_non_forked/vim-ruby/spec/indent/end_constructs_spec.rb index e1bb1733..b18c8854 100644 --- a/sources_non_forked/vim-ruby/spec/indent/end_constructs_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/end_constructs_spec.rb @@ -27,5 +27,20 @@ describe "Indenting" do foo = bar; class One; end end EOF + + assert_correct_indenting <<~EOF + nested do + while true do + def foo + if bar + for i in collection + def baz + end + end + end + end + end + end + EOF end end diff --git a/sources_non_forked/vim-ruby/spec/indent/method_definitions_spec.rb b/sources_non_forked/vim-ruby/spec/indent/method_definitions_spec.rb index 3c085923..8160a080 100644 --- a/sources_non_forked/vim-ruby/spec/indent/method_definitions_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/method_definitions_spec.rb @@ -37,4 +37,40 @@ describe "Indenting" do end EOF end + + specify "endless methods" do + # Note: A case that doesn't work at this time: + # + # def foo() + # = 42 + # + assert_correct_indenting <<~EOF + indented_block do + def foo(bar) = puts(bar) + def foo!(bar) = puts(bar) + def foo?(bar) = puts(bar) + + def foo(bar)=puts(bar) + + def foo(bar) = bar + 1 + + def foo() = 1 + 1 + def foo = 1 + 1 + + private def foo(bar) = bar + 1 + + def foo(bar) = + bar + 1 + + def foo(bar = default_function()) = puts(bar) + + def foo(bar = default_function()) = + puts(bar) + + def foo( + bar + ) = puts(bar) + end + EOF + end end diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index 149f13cf..193e78f6 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -65,7 +65,7 @@ endfunction com! -nargs=* SynFold call s:run_syntax_fold() " Not-Top Cluster {{{1 -syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell +syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyDoubleQuoteSymbolDelimiter,rubySingleQuoteSymbolDelimiter,rubyParentheses,@Spell " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -464,6 +464,10 @@ syn match rubyDefinedOperator "\%#=1\