diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_language_server.vim b/sources_non_forked/ale/ale_linters/ansible/language_server.vim similarity index 60% rename from sources_non_forked/ale/ale_linters/ansible/ansible_language_server.vim rename to sources_non_forked/ale/ale_linters/ansible/language_server.vim index d1f3fb7d..0c064353 100644 --- a/sources_non_forked/ale/ale_linters/ansible/ansible_language_server.vim +++ b/sources_non_forked/ale/ale_linters/ansible/language_server.vim @@ -4,17 +4,17 @@ call ale#Set('ansible_language_server_executable', 'ansible-language-server') call ale#Set('ansible_language_server_config', {}) -function! ale_linters#ansible#ansible_language_server#Executable(buffer) abort +function! ale_linters#ansible#language_server#Executable(buffer) abort return ale#Var(a:buffer, 'ansible_language_server_executable') endfunction -function! ale_linters#ansible#ansible_language_server#GetCommand(buffer) abort - let l:executable = ale_linters#ansible#ansible_language_server#Executable(a:buffer) +function! ale_linters#ansible#language_server#GetCommand(buffer) abort + let l:executable = ale_linters#ansible#language_server#Executable(a:buffer) return ale#Escape(l:executable) . ' --stdio' endfunction -function! ale_linters#ansible#ansible_language_server#FindProjectRoot(buffer) abort +function! ale_linters#ansible#language_server#FindProjectRoot(buffer) abort let l:dir = fnamemodify( \ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'), \ ':h' @@ -37,10 +37,11 @@ function! ale_linters#ansible#ansible_language_server#FindProjectRoot(buffer) ab endfunction call ale#linter#Define('ansible', { -\ 'name': 'ansible-language-server', +\ 'name': 'language_server', +\ 'aliases': ['ansible_language_server', 'ansible-language-server'], \ 'lsp': 'stdio', -\ 'executable': function('ale_linters#ansible#ansible_language_server#Executable'), -\ 'command': function('ale_linters#ansible#ansible_language_server#GetCommand'), -\ 'project_root': function('ale_linters#ansible#ansible_language_server#FindProjectRoot'), +\ 'executable': function('ale_linters#ansible#language_server#Executable'), +\ 'command': function('ale_linters#ansible#language_server#GetCommand'), +\ 'project_root': function('ale_linters#ansible#language_server#FindProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')} \}) diff --git a/sources_non_forked/ale/ale_linters/c/clangcheck.vim b/sources_non_forked/ale/ale_linters/c/clangcheck.vim new file mode 100644 index 00000000..54dad47b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/clangcheck.vim @@ -0,0 +1,38 @@ +" Author: gagbo +" : luibo +" : Jorengarenar +" Description: clang-check linter for C files +" modified from cpp/clangcheck.vim to match for C + +call ale#Set('c_clangcheck_executable', 'clang-check') +call ale#Set('c_clangcheck_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#c#clangcheck#GetCommand(buffer) abort + let l:user_options = ale#Var(a:buffer, 'c_clangcheck_options') + + " Try to find compilation database to link automatically + let l:build_dir = ale#Var(a:buffer, 'c_build_dir') + + if empty(l:build_dir) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + let l:build_dir = ale#path#Dirname(l:json_file) + endif + + " The extra arguments in the command are used to prevent .plist files from + " being generated. These are only added if no build directory can be + " detected. + return '%e -analyze %s' + \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '') + \ . ale#Pad(l:user_options) + \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') +endfunction + +call ale#linter#Define('c', { +\ 'name': 'clangcheck', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'c_clangcheck_executable')}, +\ 'command': function('ale_linters#c#clangcheck#GetCommand'), +\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/cairo/scarb.vim b/sources_non_forked/ale/ale_linters/cairo/scarb.vim new file mode 100644 index 00000000..48212f0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cairo/scarb.vim @@ -0,0 +1,31 @@ +" Author: 0xhyoga <0xhyoga@gmx.com>, +" Description: scarb for cairo files + +function! ale_linters#cairo#scarb#GetScarbExecutable(bufnr) abort + if ale#path#FindNearestFile(a:bufnr, 'Scarb.toml') isnot# '' + return 'scarb' + else + " if there is no Scarb.toml file, we don't use scarb even if it exists, + " so we return '', because executable('') apparently always fails + return '' + endif +endfunction + +function! ale_linters#cairo#scarb#GetCommand(buffer, version) abort + return 'scarb build' +endfunction + +call ale#linter#Define('cairo', { +\ 'name': 'scarb', +\ 'executable': function('ale_linters#cairo#scarb#GetScarbExecutable'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#cairo#scarb#GetScarbExecutable(buffer), +\ '%e --version', +\ function('ale_linters#cairo#scarb#GetCommand'), +\ )}, +\ 'callback': 'ale#handlers#cairo#HandleCairoErrors', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) + diff --git a/sources_non_forked/ale/ale_linters/dafny/dafny.vim b/sources_non_forked/ale/ale_linters/dafny/dafny.vim index 2a9f761a..8a114d22 100644 --- a/sources_non_forked/ale/ale_linters/dafny/dafny.vim +++ b/sources_non_forked/ale/ale_linters/dafny/dafny.vim @@ -1,4 +1,5 @@ " Author: Taylor Blau +call ale#Set('dafny_dafny_timelimit', 10) function! ale_linters#dafny#dafny#Handle(buffer, lines) abort let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)' @@ -31,7 +32,6 @@ function! ale_linters#dafny#dafny#GetCommand(buffer) abort return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit')) endfunction -call ale#Set('dafny_dafny_timelimit', 10) call ale#linter#Define('dafny', { \ 'name': 'dafny', \ 'executable': 'dafny', diff --git a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim index a7d7110c..c7dda600 100644 --- a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim +++ b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim @@ -12,7 +12,8 @@ function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort endfunction call ale#linter#Define('elixir', { -\ 'name': 'elixir-ls', +\ 'name': 'elixir_ls', +\ 'aliases': ['elixir-ls', 'elixirls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#elixir#elixir_ls#GetExecutable'), \ 'command': function('ale_linters#elixir#elixir_ls#GetExecutable'), diff --git a/sources_non_forked/ale/ale_linters/elixir/lexical.vim b/sources_non_forked/ale/ale_linters/elixir/lexical.vim new file mode 100644 index 00000000..ea13142e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elixir/lexical.vim @@ -0,0 +1,19 @@ +" Author: Axel Clark +" Description: Lexical integration (https://github.com/lexical-lsp/lexical) + +call ale#Set('elixir_lexical_release', 'lexical') + +function! ale_linters#elixir#lexical#GetExecutable(buffer) abort + let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_lexical_release')) + let l:cmd = has('win32') ? '\start_lexical.bat' : '/start_lexical.sh' + + return l:dir . l:cmd +endfunction + +call ale#linter#Define('elixir', { +\ 'name': 'lexical', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#elixir#lexical#GetExecutable'), +\ 'command': function('ale_linters#elixir#lexical#GetExecutable'), +\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim b/sources_non_forked/ale/ale_linters/elm/ls.vim similarity index 85% rename from sources_non_forked/ale/ale_linters/elm/elm_ls.vim rename to sources_non_forked/ale/ale_linters/elm/ls.vim index a02dbf42..38a5b234 100644 --- a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim +++ b/sources_non_forked/ale/ale_linters/elm/ls.vim @@ -10,13 +10,13 @@ call ale#Set('elm_ls_elm_format_path', '') call ale#Set('elm_ls_elm_test_path', '') call ale#Set('elm_ls_elm_analyse_trigger', 'change') -function! elm_ls#GetRootDir(buffer) abort +function! ale_linters#elm#ls#GetProjectRoot(buffer) abort let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' endfunction -function! elm_ls#GetOptions(buffer) abort +function! ale_linters#elm#ls#GetOptions(buffer) abort return { \ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'), \ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'), @@ -26,7 +26,8 @@ function! elm_ls#GetOptions(buffer) abort endfunction call ale#linter#Define('elm', { -\ 'name': 'elm_ls', +\ 'name': 'ls', +\ 'aliases': ['elm_ls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ \ 'node_modules/.bin/elm-language-server', @@ -34,7 +35,7 @@ call ale#linter#Define('elm', { \ 'elm-lsp' \ ])}, \ 'command': '%e --stdio', -\ 'project_root': function('elm_ls#GetRootDir'), +\ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'), \ 'language': 'elm', \ 'initialization_options': function('elm_ls#GetOptions') \}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erb.vim b/sources_non_forked/ale/ale_linters/eruby/erb.vim index eaaec577..0ca157aa 100644 --- a/sources_non_forked/ale/ale_linters/eruby/erb.vim +++ b/sources_non_forked/ale/ale_linters/eruby/erb.vim @@ -10,8 +10,8 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort " Rails-flavored eRuby does not comply with the standard as understood by " ERB, so we'll have to do some substitution. This does not reduce the - " effectiveness of the linter-the translated code is still evaluated. - return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c' + " effectiveness of the linter—the translated code is still evaluated. + return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c' endfunction call ale#linter#Define('eruby', { diff --git a/sources_non_forked/ale/ale_linters/fortran/language_server.vim b/sources_non_forked/ale/ale_linters/fortran/language_server.vim index 00aa0577..c885b699 100644 --- a/sources_non_forked/ale/ale_linters/fortran/language_server.vim +++ b/sources_non_forked/ale/ale_linters/fortran/language_server.vim @@ -12,6 +12,7 @@ endfunction call ale#linter#Define('fortran', { \ 'name': 'language_server', +\ 'aliases': ['fortls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'fortran_language_server_executable')}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim index 5210c5a8..0342a230 100644 --- a/sources_non_forked/ale/ale_linters/go/gobuild.vim +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -6,16 +6,6 @@ call ale#Set('go_go_executable', 'go') call ale#Set('go_gobuild_options', '') -function! ale_linters#go#gobuild#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'go_gobuild_options') - - " Run go test in local directory with relative path - return ale#go#EnvString(a:buffer) - \ . ale#Var(a:buffer, 'go_go_executable') . ' test' - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -c -o /dev/null ./' -endfunction - function! ale_linters#go#gobuild#GetMatches(lines) abort " Matches patterns like the following: " @@ -50,7 +40,12 @@ call ale#linter#Define('go', { \ 'aliases': ['go build'], \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', -\ 'command': function('ale_linters#go#gobuild#GetCommand'), +\ 'command': {b -> +\ ale#go#EnvString(b) +\ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test' +\ . ale#Pad(ale#Var(b, 'go_gobuild_options')) +\ . ' -c -o /dev/null ./' +\ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim index 5da8261c..414c8b11 100644 --- a/sources_non_forked/ale/ale_linters/go/govet.vim +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -1,28 +1,21 @@ -" Author: neersighted +" Author: neersighted , John Eikenberry " Description: go vet for Go files -" -" Author: John Eikenberry -" Description: updated to work with go1.10 call ale#Set('go_go_executable', 'go') call ale#Set('go_govet_options', '') -function! ale_linters#go#govet#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'go_govet_options') - - return ale#go#EnvString(a:buffer) - \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' .' -endfunction - call ale#linter#Define('go', { \ 'name': 'govet', \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', -\ 'command': function('ale_linters#go#govet#GetCommand'), +\ 'command': {b -> +\ ale#go#EnvString(b) +\ . '%e vet' +\ . ale#Pad(ale#Var(b, 'go_govet_options')) +\ . ' .' +\ }, \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim index 17c4d08e..14fa3b2e 100644 --- a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -16,12 +16,7 @@ function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) a return '%e --format=json --filename %s' endif - if ale#semver#GTE(a:version, [1, 6, 0]) - " Reading from stdin was introduced in ember-template-lint@1.6.0 - return '%e --json --filename %s' - endif - - return '%e --json %t' + return '%e --json --filename %s' endfunction function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/haskell/hls.vim b/sources_non_forked/ale/ale_linters/haskell/hls.vim index 7f9efc38..7f7f42e1 100644 --- a/sources_non_forked/ale/ale_linters/haskell/hls.vim +++ b/sources_non_forked/ale/ale_linters/haskell/hls.vim @@ -16,8 +16,9 @@ function! ale_linters#haskell#hls#FindRootFile(buffer) abort for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:root_file in l:serach_root_files - if filereadable(l:path . l:root_file) - return l:path + if filereadable(l:path . '/' . l:root_file) + " Add on / so fnamemodify(..., ':h') below keeps the path. + return l:path . '/' endif endfor endfor diff --git a/sources_non_forked/ale/ale_linters/html/angular.vim b/sources_non_forked/ale/ale_linters/html/angular.vim index 4f368fb4..05caf59d 100644 --- a/sources_non_forked/ale/ale_linters/html/angular.vim +++ b/sources_non_forked/ale/ale_linters/html/angular.vim @@ -48,7 +48,7 @@ endfunction call ale#linter#Define('html', { \ 'name': 'angular', -\ 'aliases': ['angular-language-server'], +\ 'aliases': ['angular-language-server', 'angularls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#html#angular#GetExecutable'), \ 'command': function('ale_linters#html#angular#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/java/javalsp.vim b/sources_non_forked/ale/ale_linters/java/javalsp.vim index baf584c8..fa3b0e2c 100644 --- a/sources_non_forked/ale/ale_linters/java/javalsp.vim +++ b/sources_non_forked/ale/ale_linters/java/javalsp.vim @@ -46,6 +46,7 @@ endfunction call ale#linter#Define('java', { \ 'name': 'javalsp', +\ 'aliases': ['java_language_server'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#java#javalsp#Executable'), \ 'command': function('ale_linters#java#javalsp#Command'), diff --git a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim index fec34011..9755ca4e 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim @@ -17,7 +17,8 @@ function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort endfunction call ale#linter#Define('javascript', { -\ 'name': 'flow-language-server', +\ 'name': 'flow_ls', +\ 'aliaes': ['flow-language-server'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'node_modules/.bin/flow', diff --git a/sources_non_forked/ale/ale_linters/json/vscodejson.vim b/sources_non_forked/ale/ale_linters/json/vscodejson.vim index dcaee010..be9eaf53 100644 --- a/sources_non_forked/ale/ale_linters/json/vscodejson.vim +++ b/sources_non_forked/ale/ale_linters/json/vscodejson.vim @@ -1,6 +1,22 @@ " Author: Dalius Dobravolskas " Description: VSCode json language server +call ale#Set('json_vscodejson_executable', '') + +function! ale_linters#json#vscodejson#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'json_vscodejson_executable') + + if l:executable is# '' + if ale#engine#IsExecutable(a:buffer, 'vscode-json-languageserver') + let l:executable = 'vscode-json-languageserver' + else + let l:executable = 'vscode-json-language-server' + endif + endif + + return l:executable +endfunction + function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') @@ -10,7 +26,7 @@ endfunction call ale#linter#Define('json', { \ 'name': 'vscodejson', \ 'lsp': 'stdio', -\ 'executable': 'vscode-json-language-server', +\ 'executable': function('ale_linters#json#vscodejson#GetExecutable'), \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/julia/languageserver.vim b/sources_non_forked/ale/ale_linters/julia/languageserver.vim index 999ad815..fbfab517 100644 --- a/sources_non_forked/ale/ale_linters/julia/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/julia/languageserver.vim @@ -13,6 +13,7 @@ endfunction call ale#linter#Define('julia', { \ 'name': 'languageserver', +\ 'aliases': ['julials'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'julia_executable')}, \ 'command': function('ale_linters#julia#languageserver#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/kotlin/languageserver.vim b/sources_non_forked/ale/ale_linters/kotlin/languageserver.vim index af78c0e0..18b153ae 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/languageserver.vim @@ -21,6 +21,7 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'languageserver', +\ 'aliaes': ['kotlin_language_server'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'kotlin_languageserver_executable')}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/lua/lua_language_server.vim b/sources_non_forked/ale/ale_linters/lua/lua_language_server.vim index ebddd4b5..0892ad3b 100644 --- a/sources_non_forked/ale/ale_linters/lua/lua_language_server.vim +++ b/sources_non_forked/ale/ale_linters/lua/lua_language_server.vim @@ -6,7 +6,7 @@ call ale#Set('lua_language_server_config', {}) call ale#linter#Define('lua', { \ 'name': 'lua_language_server', -\ 'aliases': ['lua-language-server'], +\ 'aliases': ['lua-language-server', 'lua_ls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'lua_language_server_executable')}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/lua/luacheck.vim b/sources_non_forked/ale/ale_linters/lua/luacheck.vim index 34be2b5a..16dc08a5 100644 --- a/sources_non_forked/ale/ale_linters/lua/luacheck.vim +++ b/sources_non_forked/ale/ale_linters/lua/luacheck.vim @@ -4,8 +4,43 @@ call ale#Set('lua_luacheck_executable', 'luacheck') call ale#Set('lua_luacheck_options', '') +function! s:IsInRuntimepath(buffer) abort + let l:runtimepath_dirs = split(&runtimepath, ',') + + for l:dir in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:runtime_dir in l:runtimepath_dirs + if l:dir is# l:runtime_dir + return 1 + endif + endfor + endfor + + return 0 +endfunction + function! ale_linters#lua#luacheck#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_luacheck_options')) + let l:options = ale#Var(a:buffer, 'lua_luacheck_options') + + " Add `--globals vim` by default if the file is in runtimepath. + if l:options !~# '--globals' + let l:in_runtime = getbufvar(a:buffer, 'ale_in_runtimepath', v:null) + + if l:in_runtime is v:null + let l:in_runtime = s:IsInRuntimepath(a:buffer) + " Save the result of check this buffer so we only check once. + call setbufvar(a:buffer, 'ale_in_runtimepath', l:in_runtime) + endif + + if l:in_runtime + if !empty(l:options) + let l:options .= ' ' + endif + + let l:options .= '--globals vim' + endif + endif + + return '%e' . ale#Pad(l:options) \ . ' --formatter plain --codes --filename %s -' endfunction diff --git a/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim index 949bed1c..99c0fbfa 100644 --- a/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim +++ b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim @@ -9,6 +9,7 @@ endfunction call ale#linter#Define('nix', { \ 'name': 'rnix_lsp', +\ 'aliases': ['rnix'], \ 'lsp': 'stdio', \ 'executable': 'rnix-lsp', \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/ocaml/ols.vim b/sources_non_forked/ale/ale_linters/ocaml/ols.vim index ec71bdb4..b26c7826 100644 --- a/sources_non_forked/ale/ale_linters/ocaml/ols.vim +++ b/sources_non_forked/ale/ale_linters/ocaml/ols.vim @@ -6,6 +6,7 @@ call ale#Set('ocaml_ols_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('ocaml', { \ 'name': 'ols', +\ 'aliases': ['ocaml-language-server'], \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/php/phpmd.vim b/sources_non_forked/ale/ale_linters/php/phpmd.vim index 9b1d1e44..368a66c3 100644 --- a/sources_non_forked/ale/ale_linters/php/phpmd.vim +++ b/sources_non_forked/ale/ale_linters/php/phpmd.vim @@ -7,9 +7,9 @@ let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd') let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode') function! ale_linters#php#phpmd#GetCommand(buffer) abort - return '%e %s text' + return '%e %t text' \ . ale#Pad(ale#Var(a:buffer, 'php_phpmd_ruleset')) - \ . ' --ignore-violations-on-exit %t' + \ . ' --ignore-violations-on-exit' endfunction function! ale_linters#php#phpmd#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/puppet/languageserver.vim b/sources_non_forked/ale/ale_linters/puppet/languageserver.vim index 2078695f..c6b12662 100644 --- a/sources_non_forked/ale/ale_linters/puppet/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/puppet/languageserver.vim @@ -29,6 +29,7 @@ endfunction call ale#linter#Define('puppet', { \ 'name': 'languageserver', +\ 'aliases': ['puppet_languageserver'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'puppet_languageserver_executable')}, \ 'command': '%e --stdio', diff --git a/sources_non_forked/ale/ale_linters/purescript/ls.vim b/sources_non_forked/ale/ale_linters/purescript/ls.vim index a20fae47..1eaf2af7 100644 --- a/sources_non_forked/ale/ale_linters/purescript/ls.vim +++ b/sources_non_forked/ale/ale_linters/purescript/ls.vim @@ -41,6 +41,7 @@ endfunction call ale#linter#Define('purescript', { \ 'name': 'purescript-language-server', +\ 'aliases': ['purescriptls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#purescript#ls#GetExecutable'), \ 'command': function('ale_linters#purescript#ls#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/python/jedils.vim b/sources_non_forked/ale/ale_linters/python/jedils.vim index d3e15bf2..e82abd1b 100644 --- a/sources_non_forked/ale/ale_linters/python/jedils.vim +++ b/sources_non_forked/ale/ale_linters/python/jedils.vim @@ -30,6 +30,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'jedils', +\ 'aliases': ['jedi_language_server'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#python#jedils#GetExecutable'), \ 'command': function('ale_linters#python#jedils#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/python/ruff.vim b/sources_non_forked/ale/ale_linters/python/ruff.vim index 34db0899..c4f8ad1b 100644 --- a/sources_non_forked/ale/ale_linters/python/ruff.vim +++ b/sources_non_forked/ale/ale_linters/python/ruff.vim @@ -46,22 +46,26 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort \ : '' " NOTE: ruff version `0.0.69` supports liniting input from stdin - return ale#Escape(l:executable) . l:exec_args + " NOTE: ruff version `0.1.0` deprecates `--format text` + return ale#Escape(l:executable) . l:exec_args . ' -q' \ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options')) - \ . ' --format text' - \ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s') + \ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format json-lines' : ' --format json-lines') + \ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s') endfunction function! ale_linters#python#ruff#Handle(buffer, lines) abort - "Example: path/to/file.py:10:5: E999 SyntaxError: unexpected indent - let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.+)$' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) + for l:line in a:lines + let l:item = json_decode(l:line) call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[3], + \ 'lnum': l:item.location.row, + \ 'col': l:item.location.column, + \ 'end_lnum': l:item.end_location.row, + \ 'end_col': l:item.end_location.column - 1, + \ 'code': l:item.code, + \ 'text': l:item.message, + \ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/r/languageserver.vim b/sources_non_forked/ale/ale_linters/r/languageserver.vim index bab869d1..1ff23fa9 100644 --- a/sources_non_forked/ale/ale_linters/r/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/r/languageserver.vim @@ -19,6 +19,7 @@ endfunction call ale#linter#Define('r', { \ 'name': 'languageserver', +\ 'aliases': ['r_language_server'], \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')}, \ 'executable': 'Rscript', diff --git a/sources_non_forked/ale/ale_linters/reason/ls.vim b/sources_non_forked/ale/ale_linters/reason/ls.vim index fb1114ae..a831b506 100644 --- a/sources_non_forked/ale/ale_linters/reason/ls.vim +++ b/sources_non_forked/ale/ale_linters/reason/ls.vim @@ -15,6 +15,7 @@ endfunction call ale#linter#Define('reason', { \ 'name': 'reason-language-server', +\ 'aliases': ['reason_ls'], \ 'lsp': 'stdio', \ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/reason/ols.vim b/sources_non_forked/ale/ale_linters/reason/ols.vim index 9fbd9b4f..e1f408f0 100644 --- a/sources_non_forked/ale/ale_linters/reason/ols.vim +++ b/sources_non_forked/ale/ale_linters/reason/ols.vim @@ -6,6 +6,7 @@ call ale#Set('reason_ols_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('reason', { \ 'name': 'ols', +\ 'aliases': ['ocaml-language-server'], \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/ruby/packwerk.vim b/sources_non_forked/ale/ale_linters/ruby/packwerk.vim new file mode 100644 index 00000000..4014b2da --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/packwerk.vim @@ -0,0 +1,55 @@ +" Author: ymap - https://github.com/ymap +" Description: Packwerk, a static analyzer used to enforce boundaries and modularize Rails applications. + +call ale#Set('ruby_packwerk_executable', 'packwerk') +call ale#Set('ruby_packwerk_options', '') + +function! ale_linters#ruby#packwerk#Handle(buffer, lines) abort + let l:pattern = '\v^[^:]+:(\d+):(\d+)$' + let l:index = 0 + let l:output = [] + + while l:index < len(a:lines) - 1 + let l:cleaned_line = substitute(a:lines[l:index], '\v\e\[[0-9;]*m', '', 'g') + let l:match = matchlist(l:cleaned_line, l:pattern) + + if len(l:match) > 0 + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': a:lines[l:index + 1], + \}) + endif + + let l:index += 1 + endwhile + + return l:output +endfunction + +function! ale_linters#ruby#packwerk#GetCommand(buffer) abort + let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) + + if l:rails_root is? '' + return '' + endif + + let l:executable = ale#Var(a:buffer, 'ruby_packwerk_executable') + let l:sep = has('win32') ? '\' : '/' + let l:abs_path = expand('#' . a:buffer . ':p') + let l:rel_path = substitute(l:abs_path, escape(l:rails_root . l:sep, '\'), '', '') + + return ale#ruby#EscapeExecutable(l:executable, 'packwerk') + \ . ' check' + \ . ale#Pad(ale#Var(a:buffer, 'ruby_packwerk_options')) + \ . ' ' + \ . ale#Escape(rel_path) +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'packwerk', +\ 'executable': {b -> ale#Var(b, 'ruby_packwerk_executable')}, +\ 'command': function('ale_linters#ruby#packwerk#GetCommand'), +\ 'callback': 'ale_linters#ruby#packwerk#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/analyzer.vim b/sources_non_forked/ale/ale_linters/rust/analyzer.vim index 3ead3871..e3141cd3 100644 --- a/sources_non_forked/ale/ale_linters/rust/analyzer.vim +++ b/sources_non_forked/ale/ale_linters/rust/analyzer.vim @@ -28,6 +28,7 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'analyzer', +\ 'aliases': ['rust_analyzer'], \ 'lsp': 'stdio', \ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')}, \ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, diff --git a/sources_non_forked/ale/ale_linters/sh/shell.vim b/sources_non_forked/ale/ale_linters/sh/shell.vim index 73ab3608..0605c285 100644 --- a/sources_non_forked/ale/ale_linters/sh/shell.vim +++ b/sources_non_forked/ale/ale_linters/sh/shell.vim @@ -1,11 +1,6 @@ " Author: w0rp " Description: Lints shell files by invoking the shell with -n -" Backwards compatibility -if exists('g:ale_linters_sh_shell_default_shell') - let g:ale_sh_shell_default_shell = g:ale_linters_sh_shell_default_shell -endif - " This option can be changed to change the default shell when the shell " cannot be taken from the hashbang line. if !exists('g:ale_sh_shell_default_shell') diff --git a/sources_non_forked/ale/ale_linters/solidity/solhint.vim b/sources_non_forked/ale/ale_linters/solidity/solhint.vim index 505bd5bb..9dc308fe 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solhint.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solhint.vim @@ -1,12 +1,83 @@ -" Authors: Franco Victorio - https://github.com/fvictorio, Henrique Barcelos -" https://github.com/hbarcelos +" Authors: Franco Victorio <@fvictorio>, Henrique Barcelos <@hbarcelos> " Description: Report errors in Solidity code with solhint +call ale#Set('solidity_solhint_options', '') +call ale#Set('solidity_solhint_executable', 'solhint') +call ale#Set('solidity_solhint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#solidity#solhint#Handle(buffer, lines) abort + let l:output = [] + + " Matches lines like the following: + " contracts/Bounty.sol:14:3: Expected indentation of 4 spaces but found 2 [Error/indent] + let l:lint_pattern = '\v^[^:]+:(\d+):(\d+): %(Parse error: )@ +\ ale#node#Executable(b, ale_linters#solidity#solhint#GetExecutable(b)) +\ . ale#Pad(ale#Var(b, 'solidity_solhint_options')) +\ . ' --formatter unix %s' +\ }, +\ 'callback': 'ale_linters#solidity#solhint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim index 560893bf..a403dcc1 100644 --- a/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim +++ b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim @@ -5,6 +5,7 @@ call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp') call ale#linter#Define('swift', { \ 'name': 'sourcekitlsp', +\ 'aliases': ['sourcekit'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim index ab35126e..7dc77941 100644 --- a/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim +++ b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim @@ -30,6 +30,7 @@ endfunction call ale#linter#Define('terraform', { \ 'name': 'terraform_ls', +\ 'aliases': ['terraformls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'terraform_ls_executable')}, \ 'command': function('ale_linters#terraform#terraform_ls#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/v/v.vim b/sources_non_forked/ale/ale_linters/v/v.vim index afa98c56..dfe6f562 100644 --- a/sources_non_forked/ale/ale_linters/v/v.vim +++ b/sources_non_forked/ale/ale_linters/v/v.vim @@ -4,17 +4,6 @@ call ale#Set('v_v_executable', 'v') call ale#Set('v_v_options', '') -function! ale_linters#v#v#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'v_v_options') - - " Run v in local directory with relative path - let l:command = ale#Var(a:buffer, 'v_v_executable') - \ . ale#Pad(l:options) - \ . ' .' . ' -o /tmp/vim-ale-v' - - return l:command -endfunction - function! ale_linters#v#v#Handler(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] @@ -73,9 +62,11 @@ endfunction call ale#linter#Define('v', { \ 'name': 'v', -\ 'aliases': [], \ 'executable': {b -> ale#Var(b, 'v_v_executable')}, -\ 'command': function('ale_linters#v#v#GetCommand'), +\ 'command': {b -> +\ '%e' . ale#Pad(ale#Var(b, 'v_v_options')) +\ . ' . -o /tmp/vim-ale-v' +\ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#v#v#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/vue/vls.vim b/sources_non_forked/ale/ale_linters/vue/vls.vim index 4bd75286..009effd0 100644 --- a/sources_non_forked/ale/ale_linters/vue/vls.vim +++ b/sources_non_forked/ale/ale_linters/vue/vls.vim @@ -12,6 +12,7 @@ endfunction call ale#linter#Define('vue', { \ 'name': 'vls', +\ 'aliases': ['vuels'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [ \ 'node_modules/.bin/vls', diff --git a/sources_non_forked/ale/ale_linters/yaml/actionlint.vim b/sources_non_forked/ale/ale_linters/yaml/actionlint.vim index 1e2fda49..75fe3162 100644 --- a/sources_non_forked/ale/ale_linters/yaml/actionlint.vim +++ b/sources_non_forked/ale/ale_linters/yaml/actionlint.vim @@ -1,11 +1,47 @@ -" Author: bretello +" Author: Peter Benjamin +" Description: Linter for GitHub Workflows call ale#Set('yaml_actionlint_executable', 'actionlint') call ale#Set('yaml_actionlint_options', '') +function! ale_linters#yaml#actionlint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'yaml_actionlint_options') + + if l:options !~# '-no-color' + let l:options .= ale#Pad('-no-color') + endif + + if l:options !~# '-oneline' + let l:options .= ale#Pad('-oneline') + endif + + return '%e' . ale#Pad(l:options) +endfunction + +function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort + " Matches patterns line the following: + ".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax] + let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'code': l:match[4], + \ 'type': 'E', + \} + + call add(l:output, l:item) + endfor + + return l:output +endfunction + call ale#linter#Define('yaml', { \ 'name': 'actionlint', \ 'executable': {b -> ale#Var(b, 'yaml_actionlint_executable')}, -\ 'command': function('ale#handlers#actionlint#GetCommand'), -\ 'callback': 'ale#handlers#actionlint#Handle', +\ 'command': function('ale_linters#yaml#actionlint#GetCommand'), +\ 'callback': 'ale_linters#yaml#actionlint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/yaml/ls.vim b/sources_non_forked/ale/ale_linters/yaml/ls.vim index 8e3f6d00..79510ffe 100644 --- a/sources_non_forked/ale/ale_linters/yaml/ls.vim +++ b/sources_non_forked/ale/ale_linters/yaml/ls.vim @@ -26,6 +26,7 @@ endfunction call ale#linter#Define('yaml', { \ 'name': 'yaml-language-server', +\ 'aliases': ['yamlls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#yaml#ls#GetExecutable'), \ 'command': function('ale_linters#yaml#ls#GetCommand'), diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 23315913..d1c1112a 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -7,9 +7,6 @@ let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error') let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log') let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') -" Ignoring linters, for disabling some, or ignoring LSP diagnostics. -let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) -let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0) " LSP window/showMessage format let g:ale_lsp_show_message_format = get(g:, 'ale_lsp_show_message_format', '%severity%:%linter%: %s') @@ -100,7 +97,24 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Use the filetype from the buffer let l:filetype = getbufvar(a:buffer, '&filetype') let l:linters = ale#linter#Get(l:filetype) - let l:linters = ale#linter#RemoveIgnored(a:buffer, l:filetype, l:linters) + + let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + " Load code to ignore linters only if we need to. + if ( + \ !empty(l:ignore_config) + \ || l:disable_lsp is 1 + \ || l:disable_lsp is v:true + \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) + \) + let l:linters = ale#engine#ignore#Exclude( + \ l:filetype, + \ l:linters, + \ l:ignore_config, + \ l:disable_lsp, + \) + endif " Tell other sources that they can start checking the buffer now. let g:ale_want_results_buffer = a:buffer @@ -208,7 +222,7 @@ endfunction " valid for cmd on Windows, or most shells on Unix. function! ale#Env(variable_name, value) abort if has('win32') - return 'set ' . a:variable_name . '=' . ale#Escape(a:value) . ' && ' + return 'set ' . ale#Escape(a:variable_name . '=' . a:value) . ' && ' endif return a:variable_name . '=' . ale#Escape(a:value) . ' ' diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim index db31aad5..4167e907 100644 --- a/sources_non_forked/ale/autoload/ale/code_action.vim +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -339,17 +339,7 @@ function! ale#code_action#GetCodeActions(options) abort silent! aunmenu PopUp.Refactor\.\.\. " Only display the menu items if there's an LSP server. - let l:has_lsp = 0 - - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - let l:has_lsp = 1 - - break - endif - endfor - - if l:has_lsp + if len(ale#lsp_linter#GetEnabled(bufnr(''))) > 0 if !empty(expand('')) silent! anoremenu PopUp.Rename :ALERename endif diff --git a/sources_non_forked/ale/autoload/ale/codefix.vim b/sources_non_forked/ale/autoload/ale/codefix.vim index 34ce3e15..6eaadb23 100644 --- a/sources_non_forked/ale/autoload/ale/codefix.vim +++ b/sources_non_forked/ale/autoload/ale/codefix.vim @@ -473,15 +473,9 @@ function! ale#codefix#Execute(range, ...) abort endif let l:MenuCallback = get(a:000, 0, v:null) - let l:lsp_linters = [] + let l:linters = ale#lsp_linter#GetEnabled(bufnr('')) - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call add(l:lsp_linters, l:linter) - endif - endfor - - if empty(l:lsp_linters) + if empty(l:linters) if l:MenuCallback is v:null call s:message('No active LSPs') else @@ -491,7 +485,7 @@ function! ale#codefix#Execute(range, ...) abort return endif - for l:lsp_linter in l:lsp_linters - call s:ExecuteGetCodeFix(l:lsp_linter, a:range, l:MenuCallback) + for l:linter in l:linters + call s:ExecuteGetCodeFix(l:linter, a:range, l:MenuCallback) endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index c05ca53d..4fd02721 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -824,6 +824,8 @@ endfunction " the current buffer. 1 will be returned if there's a potential source of " completion data ALE can use, and 0 will be returned otherwise. function! ale#completion#CanProvideCompletions() abort + " NOTE: We can report that ALE can provide completions to Deoplete from + " here, and we might ignore linters still below. for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) return 1 @@ -890,11 +892,9 @@ function! ale#completion#GetCompletions(...) abort let l:started = 0 - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - if ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) - let l:started = 1 - endif + for l:linter in ale#lsp_linter#GetEnabled(l:buffer) + if ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) + let l:started = 1 endif endfor diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index c100d6e6..89f5258f 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -1,6 +1,8 @@ " Author: w0rp " Description: This file implements debugging information for ALE +let g:ale_info_default_mode = get(g:, 'ale_info_default_mode', 'preview') + let s:global_variable_list = [ \ 'ale_cache_executable_check_failures', \ 'ale_change_sign_column_color', @@ -18,6 +20,7 @@ let s:global_variable_list = [ \ 'ale_fix_on_save', \ 'ale_fixers', \ 'ale_history_enabled', +\ 'ale_info_default_mode', \ 'ale_history_log_output', \ 'ale_keep_list_window_open', \ 'ale_lint_delay', @@ -53,7 +56,6 @@ let s:global_variable_list = [ \ 'ale_sign_style_warning', \ 'ale_sign_warning', \ 'ale_sign_highlight_linenrs', -\ 'ale_statusline_format', \ 'ale_type_map', \ 'ale_use_neovim_diagnostics_api', \ 'ale_use_global_executables', @@ -199,11 +201,42 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort endfor endfunction -function! ale#debugging#Info() abort +function! s:GetIgnoredLinters(buffer, enabled_linters) abort + let l:filetype = &filetype + let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + if ( + \ !empty(l:ignore_config) + \ || l:disable_lsp is 1 + \ || l:disable_lsp is v:true + \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) + \) + let l:non_ignored = ale#engine#ignore#Exclude( + \ l:filetype, + \ a:enabled_linters, + \ l:ignore_config, + \ l:disable_lsp, + \) + else + let l:non_ignored = copy(a:enabled_linters) + endif + + call map(l:non_ignored, 'v:val.name') + + return filter( + \ copy(a:enabled_linters), + \ 'index(l:non_ignored, v:val.name) < 0' + \) +endfunction + +function! ale#debugging#Info(...) abort + let l:options = (a:0 > 0) ? a:1 : {} + let l:show_preview_info = get(l:options, 'preview') + let l:buffer = bufnr('') let l:filetype = &filetype - " We get the list of enabled linters for free by the above function. let l:enabled_linters = deepcopy(ale#linter#Get(l:filetype)) " But have to build the list of available linters ourselves. @@ -227,13 +260,10 @@ function! ale#debugging#Info() abort let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1])) let l:fixers_string = join(map(copy(l:fixers), '"\n " . v:val'), '') - let l:non_ignored_names = map( - \ copy(ale#linter#RemoveIgnored(l:buffer, l:filetype, l:enabled_linters)), - \ 'v:val[''name'']', - \) - let l:ignored_names = filter( - \ copy(l:enabled_names), - \ 'index(l:non_ignored_names, v:val) < 0' + " Get the names of ignored linters. + let l:ignored_names = map( + \ s:GetIgnoredLinters(l:buffer, l:enabled_linters), + \ 'v:val.name' \) call s:Echo(' Current Filetype: ' . l:filetype) @@ -241,13 +271,31 @@ function! ale#debugging#Info() abort call s:EchoLinterAliases(l:all_linters) call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) call s:Echo(' Ignored Linters: ' . string(l:ignored_names)) - call s:Echo(' Suggested Fixers: ' . l:fixers_string) - call s:Echo(' Linter Variables:') - call s:Echo('') - call s:EchoLinterVariables(l:variable_list) + call s:Echo(' Suggested Fixers:' . l:fixers_string) + " We use this line with only a space to know where to end highlights. + call s:Echo(' ') + + " Only show Linter Variables directive if there are any. + if !empty(l:variable_list) + call s:Echo(' Linter Variables:') + + if l:show_preview_info + call s:Echo('" Press Space to read :help for a setting') + endif + + call s:EchoLinterVariables(l:variable_list) + " We use this line with only a space to know where to end highlights. + call s:Echo(' ') + endif + call s:Echo(' Global Variables:') - call s:Echo('') + + if l:show_preview_info + call s:Echo('" Press Space to read :help for a setting') + endif + call s:EchoGlobalVariables() + call s:Echo(' ') call s:EchoLSPErrorMessages(l:all_names) call s:Echo(' Command History:') call s:Echo('') @@ -275,3 +323,41 @@ function! ale#debugging#InfoToFile(filename) abort call writefile(split(l:output, "\n"), l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename) endfunction + +function! ale#debugging#InfoToPreview() abort + let l:output = execute('call ale#debugging#Info({''preview'': 1})') + + call ale#preview#Show(split(l:output, "\n"), { + \ 'filetype': 'ale-info', + \}) +endfunction + +function! ale#debugging#InfoCommand(...) abort + if len(a:000) > 1 + " no-custom-checks + echom 'Invalid ALEInfo arguments!' + + return + endif + + " Get 'echo' from '-echo', if there's an argument. + let l:mode = get(a:000, '')[1:] + + if empty(l:mode) + let l:mode = ale#Var(bufnr(''), 'info_default_mode') + endif + + if l:mode is# 'echo' + call ale#debugging#Info() + elseif l:mode is# 'clip' || l:mode is# 'clipboard' + call ale#debugging#InfoToClipboard() + else + call ale#debugging#InfoToPreview() + endif +endfunction + +function! ale#debugging#InfoToClipboardDeprecatedCommand() abort + " no-custom-checks + echom 'ALEInfoToClipboard is deprecated. Use ALEInfo -clipboard instead.' + call ale#debugging#InfoToClipboard() +endfunction diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index fd6cd2e1..251bdcc5 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -168,26 +168,20 @@ function! s:GoToLSPDefinition(linter, options, capability) abort endfunction function! ale#definition#GoTo(options) abort - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call s:GoToLSPDefinition(l:linter, a:options, 'definition') - endif + for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) + call s:GoToLSPDefinition(l:linter, a:options, 'definition') endfor endfunction function! ale#definition#GoToType(options) abort - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call s:GoToLSPDefinition(l:linter, a:options, 'typeDefinition') - endif + for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) + call s:GoToLSPDefinition(l:linter, a:options, 'typeDefinition') endfor endfunction function! ale#definition#GoToImpl(options) abort - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call s:GoToLSPDefinition(l:linter, a:options, 'implementation') - endif + for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) + call s:GoToLSPDefinition(l:linter, a:options, 'implementation') endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 185d54db..7e337191 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -253,7 +253,7 @@ function! ale#engine#SendResultsToNeovimDiagnostics(buffer, loclist) abort " Keep the Lua surface area really small in the VimL part of ALE, " and just require the diagnostics.lua module on demand. - let l:SendDiagnostics = luaeval('require("diagnostics").sendAleResultsToDiagnostics') + let l:SendDiagnostics = luaeval('require("ale.diagnostics").sendAleResultsToDiagnostics') call l:SendDiagnostics(a:buffer, a:loclist) endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine/ignore.vim b/sources_non_forked/ale/autoload/ale/engine/ignore.vim index 80574656..8ac36eb5 100644 --- a/sources_non_forked/ale/autoload/ale/engine/ignore.vim +++ b/sources_non_forked/ale/autoload/ale/engine/ignore.vim @@ -1,6 +1,26 @@ " Author: w0rp " Description: Code for ignoring linters. Only loaded and if configured. +" A map for remapping lspconfig server names to linter names or aliases in +" ALE. We should change the names where they will conflict with names in ALE. +" +" Notes on names from nvim-lspconfig not included here. +" +" * 'rubocop' is run in a language server mode +" * 'eslint' is run via 'vscode-eslint-language-server' +let s:lspconfig_map = { +\ 'als': 'adals', +\ 'ansiblels': 'ansible-language-server', +\ 'bicep': 'bicep_language_server', +\ 'cmake': 'cmake_language_server', +\ 'denols': 'deno', +\ 'erlangls': 'erlang_ls', +\ 'html': 'vscodehtml', +\ 'ocamlls': 'ocaml-language-server', +\ 'ols': 'odin-lsp', +\ 'puppet': 'puppet_languageserver', +\} + " Given a filetype and a configuration for ignoring linters, return a List of " Strings for linter names to ignore. function! ale#engine#ignore#GetList(filetype, config) abort @@ -21,24 +41,51 @@ function! ale#engine#ignore#GetList(filetype, config) abort return [] endfunction +" This function can be mocked in tests. +function! ale#engine#ignore#GetLSPConfigNames() abort + return luaeval('require ''ale.util''.configured_lspconfig_servers()') +endfunction + +function! s:GetMappedLSPConfigNames() abort + " Check the lspconfig flag before calling luaeval. + if !get(g:, 'lspconfig', 0) + return [] + endif + + let l:lspconfig_servers = ale#engine#ignore#GetLSPConfigNames() + + return map( + \ !empty(l:lspconfig_servers) ? l:lspconfig_servers : [], + \ {_, val -> get(s:lspconfig_map, val, val) } + \) +endfunction + " Given a List of linter descriptions, exclude the linters to be ignored. function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config) + + " If configured to automatically ignore otherwise configured LSP linter + " names, add them to the names to remove. This could ignore linters + " with matching names that are not marked as LSP linters. + if a:disable_lsp is# 'auto' + call extend(l:names_to_remove, s:GetMappedLSPConfigNames()) + endif + + let l:ignore_all_lsps = a:disable_lsp is 1 || a:disable_lsp is v:true let l:filtered_linters = [] for l:linter in a:all_linters - let l:name_list = [l:linter.name] + l:linter.aliases - let l:should_include = 1 + let l:should_include = index(l:names_to_remove, l:linter.name) == -1 + let l:i = 0 - for l:name in l:name_list - if index(l:names_to_remove, l:name) >= 0 - let l:should_include = 0 - break - endif - endfor + while l:should_include && l:i < len(l:linter.aliases) + let l:name = l:linter.aliases[l:i] + let l:should_include = index(l:names_to_remove, l:name) == -1 + let l:i += 1 + endwhile - if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# '' - let l:should_include = 0 + if l:should_include && l:ignore_all_lsps + let l:should_include = empty(get(l:linter, 'lsp')) endif if l:should_include diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index eec24f46..d5cd5151 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -92,6 +92,62 @@ function! ale#events#FileChangedEvent(buffer) abort endif endfunction +" A timer for emulating InsertLeave. +" +" We only need a single timer, and we'll lint the last buffer we entered +" insert mode on. +if !exists('s:insert_leave_timer') + let s:insert_leave_timer = -1 +endif + +function! ale#events#EmulateInsertLeave(buffer) abort + if mode() is# 'n' + call timer_stop(s:insert_leave_timer) + call ale#Queue(0, '', a:buffer) + endif +endfunction + +function! ale#events#InsertEnterEvent(buffer) abort + if g:ale_close_preview_on_insert && exists('*ale#preview#CloseIfTypeMatches') + call ale#preview#CloseIfTypeMatches('ale-preview') + endif + + " Start a repeating timer if the use might not trigger InsertLeave, so we + " can emulate its behavior. + if ale#Var(a:buffer, 'lint_on_insert_leave') + \&& maparg("\", 'i') isnot# '' + call timer_stop(s:insert_leave_timer) + let s:insert_leave_timer = timer_start( + \ 100, + \ {-> ale#events#EmulateInsertLeave(a:buffer) }, + \ {'repeat': -1} + \) + endif +endfunction + +function! ale#events#InsertLeaveEvent(buffer) abort + if ale#Var(a:buffer, 'lint_on_insert_leave') + " Kill the InsertLeave emulation if the event fired. + call timer_stop(s:insert_leave_timer) + call ale#Queue(0) + endif + + " Look for a warning to echo as soon as we leave Insert mode. + " The script's position variable used when moving the cursor will + " not be changed here. + " + " We don't echo this message in emulated insert leave mode, as the user + " may want less work to happen on pressing versus + if exists('*ale#engine#Cleanup') + call ale#cursor#EchoCursorWarning() + + if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1' + " Show a virtualtext message if enabled. + call ale#virtualtext#ShowCursorWarning() + endif + endif +endfunction + function! ale#events#Init() abort " This value used to be a Boolean as a Number, and is now a String. let l:text_changed = '' . g:ale_lint_on_text_changed @@ -127,33 +183,40 @@ function! ale#events#Init() abort \) endif - if g:ale_lint_on_insert_leave - autocmd InsertLeave * if ale#Var(str2nr(expand('')), 'lint_on_insert_leave') | call ale#Queue(0) | endif + " Add an InsertEnter event if we need to close the preview window + " on entering insert mode, or if we want to run ALE on leaving + " insert mode and is not the same as . + " + " We will emulate leaving insert mode for users that might not + " trigger InsertLeave. + if g:ale_close_preview_on_insert + \|| (g:ale_lint_on_insert_leave && maparg("\", 'i') isnot# '') + autocmd InsertEnter * call ale#events#InsertEnterEvent(str2nr(expand(''))) endif + let l:add_insert_leave_event = g:ale_lint_on_insert_leave + if g:ale_echo_cursor || g:ale_cursor_detail + " We need to make the message display on InsertLeave + let l:add_insert_leave_event = 1 + autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif - " Look for a warning to echo as soon as we leave Insert mode. - " The script's position variable used when moving the cursor will - " not be changed here. - autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif endif if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1' + " We need to make the message display on InsertLeave + let l:add_insert_leave_event = 1 + autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif - " Look for a warning to echo as soon as we leave Insert mode. - " The script's position variable used when moving the cursor will - " not be changed here. - autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarning() | endif + endif + + if l:add_insert_leave_event + autocmd InsertLeave * call ale#events#InsertLeaveEvent(str2nr(expand(''))) endif if g:ale_hover_cursor autocmd CursorHold * if exists('*ale#lsp#Send') | call ale#hover#ShowTruncatedMessageAtCursor() | endif endif - - if g:ale_close_preview_on_insert - autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif - endif endif augroup END diff --git a/sources_non_forked/ale/autoload/ale/filerename.vim b/sources_non_forked/ale/autoload/ale/filerename.vim index ec20d279..93cf78e1 100644 --- a/sources_non_forked/ale/autoload/ale/filerename.vim +++ b/sources_non_forked/ale/autoload/ale/filerename.vim @@ -94,9 +94,10 @@ function! s:ExecuteFileRename(linter, options) abort endfunction function! ale#filerename#Execute() abort + let l:buffer = bufnr('') let l:lsp_linters = [] - for l:linter in ale#linter#Get(&filetype) + for l:linter in ale#lsp_linter#GetEnabled(l:buffer) if l:linter.lsp is# 'tsserver' call add(l:lsp_linters, l:linter) endif @@ -108,7 +109,6 @@ function! ale#filerename#Execute() abort return endif - let l:buffer = bufnr('') let l:old_name = expand('#' . l:buffer . ':p') let l:new_name = ale#util#Input('New file name: ', l:old_name, 'file') diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index d9820847..786978d1 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -32,7 +32,7 @@ function! ale#fix#ApplyQueuedFixes(buffer) abort endif endif endif - catch /E21/ + catch /E21\|E5555/ " If we cannot modify the buffer now, try again later. let g:ale_fix_buffer_data[a:buffer] = l:data diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index d2de0fc2..050cc6c7 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -286,6 +286,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['fish'], \ 'description': 'Format fish scripts using fish_indent.', \ }, +\ 'forge': { +\ 'function': 'ale#fixers#forge#Fix', +\ 'suggested_filetypes': ['solidity'], +\ 'description': 'Fix Solidity files with forge fmt.', +\ }, \ 'gofmt': { \ 'function': 'ale#fixers#gofmt#Fix', \ 'suggested_filetypes': ['go'], @@ -606,6 +611,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix python files with ruff.', \ }, +\ 'ruff_format': { +\ 'function': 'ale#fixers#ruff_format#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix python files with the ruff formatter.', +\ }, \ 'pycln': { \ 'function': 'ale#fixers#pycln#Fix', \ 'suggested_filetypes': ['python'], @@ -625,7 +635,12 @@ let s:default_registry = { \ 'function': 'ale#fixers#erbformatter#Fix', \ 'suggested_filetypes': ['eruby'], \ 'description': 'Apply erb-formatter -w to eruby/erb files.', -\ } +\ }, +\ 'nickel_format': { +\ 'function': 'ale#fixers#nickel_format#Fix', +\ 'suggested_filetypes': ['nickel'], +\ 'description': 'Fix nickel files with nickel format', +\ }, \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/forge.vim b/sources_non_forked/ale/autoload/ale/fixers/forge.vim new file mode 100644 index 00000000..2efbb7da --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/forge.vim @@ -0,0 +1,11 @@ +call ale#Set('solidity_forge_executable', 'forge') + +function! ale#fixers#forge#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'solidity_forge_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' fmt %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/nickel_format.vim b/sources_non_forked/ale/autoload/ale/fixers/nickel_format.vim new file mode 100644 index 00000000..07eed8f9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/nickel_format.vim @@ -0,0 +1,16 @@ +" Author: Yining +" Description: nickel format as ALE fixer for Nickel files + +call ale#Set('nickel_nickel_format_executable', 'nickel') +call ale#Set('nickel_nickel_format_options', '') + +function! ale#fixers#nickel_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nickel_nickel_format_executable') + let l:options = ale#Var(a:buffer, 'nickel_nickel_format_options') + + return { + \ 'command': ale#Escape(l:executable) . ' format' + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/ruff_format.vim b/sources_non_forked/ale/autoload/ale/fixers/ruff_format.vim new file mode 100644 index 00000000..86858745 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ruff_format.vim @@ -0,0 +1,72 @@ +" Author: Yining , Joseph Henrich +" Description: ruff formatter as ALE fixer for python files + +call ale#Set('python_ruff_format_executable', 'ruff') +call ale#Set('python_ruff_format_options', '') +call ale#Set('python_ruff_format_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_ruff_format_change_directory', 1) +call ale#Set('python_ruff_format_auto_pipenv', 0) +call ale#Set('python_ruff_format_auto_poetry', 0) + +function! ale#fixers#ruff_format#GetCwd(buffer) abort + if ale#Var(a:buffer, 'python_ruff_format_change_directory') + " Run from project root if found, else from buffer dir. + let l:project_root = ale#python#FindProjectRoot(a:buffer) + + return !empty(l:project_root) ? l:project_root : '%s:h' + endif + + return '%s:h' +endfunction + +function! ale#fixers#ruff_format#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ruff_format_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ruff_format_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + return ale#python#FindExecutable(a:buffer, 'python_ruff_format', ['ruff']) +endfunction + +function! ale#fixers#ruff_format#GetCommand(buffer) abort + let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'pipenv\|poetry$' + \ ? ' run ruff' + \ : '' + + return ale#Escape(l:executable) . l:exec_args +endfunction + +function! ale#fixers#ruff_format#Fix(buffer) abort + let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer) + let l:cmd = [ale#Escape(l:executable)] + + if l:executable =~? 'pipenv\|poetry$' + call extend(l:cmd, ['run', 'ruff']) + endif + + let l:options = ale#Var(a:buffer, 'python_ruff_format_options') + + " when --stdin-filename present, ruff will use it for proj root resolution + " https://github.com/charliermarsh/ruff/pull/1281 + let l:fname = expand('#' . a:buffer . '...') + call add(l:cmd, 'format') + + if !empty(l:options) + call add(l:cmd, l:options) + endif + + call add(l:cmd, '--stdin-filename '.ale#Escape(ale#path#Simplify(l:fname))) + + call add(l:cmd, '-') + + return { + \ 'cwd': ale#fixers#ruff_format#GetCwd(a:buffer), + \ 'command': join(l:cmd, ' '), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim b/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim deleted file mode 100644 index 73843c08..00000000 --- a/sources_non_forked/ale/autoload/ale/handlers/actionlint.vim +++ /dev/null @@ -1,36 +0,0 @@ -function! ale#handlers#actionlint#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'yaml_actionlint_options') - - " automatically add --no-color option if not defined - if l:options !~# '--no-color' - let l:options .= ' --no-color' - endif - - " automatically add --oneline option if not defined - if l:options !~# '--oneline' - let l:options .= ' --oneline' - endif - - return '%e ' . l:options . ' %t' -endfunction - -function! ale#handlers#actionlint#Handle(buffer, lines) abort - " Matches patterns line the following: - ".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax] - let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:item = { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[3], - \ 'code': l:match[4], - \ 'type': 'E', - \} - - call add(l:output, l:item) - endfor - - return l:output -endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cairo.vim b/sources_non_forked/ale/autoload/ale/handlers/cairo.vim new file mode 100644 index 00000000..41029c8d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/cairo.vim @@ -0,0 +1,41 @@ +" Author: 0xhyoga <0xhyoga@gmx.com>, +" Description: This file implements handlers specific to Cairo +" +function! ale#handlers#cairo#HandleCairoErrors(buffer, lines) abort + " Matches patterns like the following: + " Error: Expected ';' but got '(' + " --> /path/to/file/file.cairo:1:10:) + let l:pattern = '\v(error|warning): (.*)$' + let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)' + let l:exclude_pattern = '\vcould not compile.*' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + let l:match = matchlist(l:line, l:line_and_column_pattern) + + if len(l:match) > 0 + let l:index = len(l:output) - 1 + let l:output[l:index]['lnum'] = l:match[1] + 0 + let l:output[l:index]['col'] = l:match[2] + 0 + endif + else + let l:text = l:match[2] + + if l:text !~# l:exclude_pattern + let l:isError = l:match[1] is? 'Error' + + call add(l:output, { + \ 'lnum': 0, + \ 'col': 0, + \ 'text': l:text, + \ 'type': l:isError ? 'E' : 'W', + \}) + endif + endif + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/deno.vim b/sources_non_forked/ale/autoload/ale/handlers/deno.vim index b762f983..1770559d 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/deno.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/deno.vim @@ -4,7 +4,7 @@ call ale#Set('deno_executable', 'deno') call ale#Set('deno_unstable', 0) -call ale#Set('deno_importMap', 'import_map.json') +call ale#Set('deno_import_map', 'import_map.json') call ale#Set('deno_lsp_project_root', '') function! ale#handlers#deno#GetExecutable(buffer) abort @@ -68,8 +68,19 @@ function! ale#handlers#deno#GetInitializationOptions(buffer) abort 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')) + " Look for a value set using the historical option name. + let l:import_map = getbufvar( + \ a:buffer, + \ 'ale_deno_importMap', + \ get(g:, 'ale_deno_importMap', '') + \) + + if empty(l:import_map) + let l:import_map = ale#Var(a:buffer, 'deno_import_map') + endif + + if !empty(l:import_map) + let l:options.importMap = ale#path#FindNearestFile(a:buffer, l:import_map) endif return l:options diff --git a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim index e871b083..d45f86e1 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim @@ -61,7 +61,8 @@ endfunction " Define the hdl_checker linter for a given filetype. function! ale#handlers#hdl_checker#DefineLinter(filetype) abort call ale#linter#Define(a:filetype, { - \ 'name': 'hdl-checker', + \ 'name': 'hdl_checker', + \ 'aliases': ['hdl-checker'], \ 'lsp': 'stdio', \ 'language': a:filetype, \ 'executable': function('ale#handlers#hdl_checker#GetExecutable'), @@ -70,4 +71,3 @@ function! ale#handlers#hdl_checker#DefineLinter(filetype) abort \ 'initialization_options': function('ale#handlers#hdl_checker#GetInitOptions'), \ }) endfunction - diff --git a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim index 17de2912..fd540e8e 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim @@ -102,7 +102,7 @@ function! ale#handlers#shellcheck#DefineLinter(filetype) abort " This global variable can be set with a string of comma-separated error " codes to exclude from shellcheck. For example: " let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' - call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) + call ale#Set('sh_shellcheck_exclusions', '') call ale#Set('sh_shellcheck_executable', 'shellcheck') call ale#Set('sh_shellcheck_dialect', 'auto') call ale#Set('sh_shellcheck_options', '') diff --git a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim deleted file mode 100644 index 611aa7bd..00000000 --- a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim +++ /dev/null @@ -1,98 +0,0 @@ -" Author: Henrique Barcelos <@hbarcelos> -" Description: Functions for working with local solhint for checking *.sol files. - -let s:executables = [ -\ 'node_modules/.bin/solhint', -\ 'node_modules/solhint/solhint.js', -\ 'solhint', -\] - -let s:sep = has('win32') ? '\' : '/' - -call ale#Set('solidity_solhint_options', '') -call ale#Set('solidity_solhint_executable', 'solhint') -call ale#Set('solidity_solhint_use_global', get(g:, 'ale_use_global_executables', 0)) - -function! ale#handlers#solhint#Handle(buffer, lines) abort - " Matches patterns like the following: - " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) - let l:output = [] - - let l:lint_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' - - for l:match in ale#util#GetMatches(a:lines, l:lint_pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'code': l:match[5], - \ 'type': l:isError ? 'E' : 'W', - \}) - endfor - - let l:syntax_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (Parse error): (.*)$' - - for l:match in ale#util#GetMatches(a:lines, l:syntax_pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[5], - \ 'code': l:match[4], - \ 'type': l:isError ? 'E' : 'W', - \}) - endfor - - return l:output -endfunction - -function! ale#handlers#solhint#FindConfig(buffer) abort - for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) - for l:basename in [ - \ '.solhintrc.js', - \ '.solhintrc.json', - \ '.solhintrc', - \] - let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep)) - - if filereadable(l:config) - return l:config - endif - endfor - endfor - - return ale#path#FindNearestFile(a:buffer, 'package.json') -endfunction - -function! ale#handlers#solhint#GetExecutable(buffer) abort - return ale#path#FindExecutable(a:buffer, 'solidity_solhint', s:executables) -endfunction - -" Given a buffer, return an appropriate working directory for solhint. -function! ale#handlers#solhint#GetCwd(buffer) abort - " If solhint is installed in a directory which contains the buffer, assume - " it is the solhint project root. Otherwise, use nearest node_modules. - " Note: If node_modules not present yet, can't load local deps anyway. - let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) - - if !empty(l:executable) - let l:nmi = strridx(l:executable, 'node_modules') - let l:project_dir = l:executable[0:l:nmi - 2] - else - let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') - let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' - endif - - return !empty(l:project_dir) ? l:project_dir : '' -endfunction - -function! ale#handlers#solhint#GetCommand(buffer) abort - let l:executable = ale#handlers#solhint#GetExecutable(a:buffer) - - let l:options = ale#Var(a:buffer, 'solidity_solhint_options') - - return ale#node#Executable(a:buffer, l:executable) - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --formatter compact %s' -endfunction diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 6ad43316..1202e08e 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -117,7 +117,7 @@ function! ale#hover#ParseLSPResult(contents) abort for l:line in split(l:item, "\n") if l:fence_language is v:null " Look for the start of a code fence. (```python, etc.) - let l:match = matchlist(l:line, '^```\(.*\)$') + let l:match = matchlist(l:line, '^``` *\([^ ]\+\) *$') if !empty(l:match) let l:fence_language = l:match[1] @@ -329,10 +329,9 @@ function! ale#hover#Show(buffer, line, col, opt) abort let l:show_documentation = get(a:opt, 'show_documentation', 0) let l:Callback = function('s:OnReady', [a:line, a:col, a:opt]) - for l:linter in ale#linter#Get(getbufvar(a:buffer, '&filetype')) + for l:linter in ale#lsp_linter#GetEnabled(a:buffer) " Only tsserver supports documentation requests at the moment. - if !empty(l:linter.lsp) - \&& (!l:show_documentation || l:linter.lsp is# 'tsserver') + if !l:show_documentation || l:linter.lsp is# 'tsserver' call ale#lsp_linter#StartLSP(a:buffer, l:linter, l:Callback) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index b5a32654..20104fbc 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -53,7 +53,7 @@ let s:default_ale_linters = { \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'], -\ 'rust': ['cargo', 'rls'], +\ 'rust': ['analyzer', 'cargo'], \ 'spec': [], \ 'text': [], \ 'vader': ['vimls'], @@ -417,16 +417,6 @@ function! ale#linter#Get(original_filetypes) abort return reverse(l:combined_linters) endfunction -function! ale#linter#RemoveIgnored(buffer, filetype, linters) abort - " Apply ignore lists for linters only if needed. - let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') - let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') - - return !empty(l:ignore_config) || l:disable_lsp - \ ? ale#engine#ignore#Exclude(a:filetype, a:linters, l:ignore_config, l:disable_lsp) - \ : a:linters -endfunction - " Given a buffer and linter, get the executable String for the linter. function! ale#linter#GetExecutable(buffer, linter) abort let l:Executable = a:linter.executable diff --git a/sources_non_forked/ale/autoload/ale/lsp/reset.vim b/sources_non_forked/ale/autoload/ale/lsp/reset.vim index 2fc7f0a2..1801db01 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/reset.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/reset.vim @@ -1,9 +1,16 @@ +" Author: w0rp +" Description: Functions for resetting LSP servers. + +function! s:Message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + " Stop all LSPs and remove all of the data for them. function! ale#lsp#reset#StopAllLSPs() abort call ale#lsp#StopAll() if exists('*ale#definition#ClearLSPData') - " Clear the mapping for connections, etc. + " Clear the go to definition mapping for everything. call ale#definition#ClearLSPData() endif @@ -15,6 +22,8 @@ function! ale#lsp#reset#StopAllLSPs() abort for l:buffer_string in keys(g:ale_buffer_info) let l:buffer = str2nr(l:buffer_string) + " Non-ignored and disabled linters are included here so we can + " clear results for them after we ignore or disable them. for l:linter in ale#linter#Get(getbufvar(l:buffer, '&filetype')) if !empty(l:linter.lsp) call ale#engine#HandleLoclist(l:linter.name, l:buffer, [], 0) @@ -23,3 +32,61 @@ function! ale#lsp#reset#StopAllLSPs() abort endfor endif endfunction + +function! ale#lsp#reset#Complete(arg, line, pos) abort + let l:linter_map = ale#lsp_linter#GetLSPLinterMap() + let l:candidates = map(values(l:linter_map), {_, linter -> linter.name}) + call uniq(sort(l:candidates)) + call filter(l:candidates, {_, name -> name =~? a:arg}) + + return l:candidates +endfunction + +function! ale#lsp#reset#StopLSP(name, bang) abort + let l:linter_map = ale#lsp_linter#GetLSPLinterMap() + let l:matched = filter( + \ items(l:linter_map), + \ {_, item -> item[1].name is# a:name} + \) + + if empty(l:matched) + if a:bang isnot# '!' + call s:Message('No running language server with name: ' . a:name) + endif + + return + endif + + " Stop LSP connections first. + for [l:conn_id, l:linter] in l:matched + call ale#lsp#Stop(l:conn_id) + endfor + + if exists('*ale#definition#ClearLSPData') + " Clear the go to definition mapping for everything. + call ale#definition#ClearLSPData() + endif + + " Remove connections from the lsp_linter map. + for [l:conn_id, l:linter] in l:matched + call remove(l:linter_map, l:conn_id) + endfor + + " Remove the problems for the LSP linters in every buffer. + for [l:buffer_string, l:info] in items(g:ale_buffer_info) + let l:buffer = str2nr(l:buffer_string) + let l:should_clear_buffer = 0 + + for l:item in l:info.loclist + if l:item.linter_name is# a:name + let l:should_clear_buffer = 1 + + break + endif + endfor + + if l:should_clear_buffer + call ale#engine#HandleLoclist(a:name, l:buffer, [], 0) + endif + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index 1c98d628..2507e400 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -8,13 +8,9 @@ if !has_key(s:, 'lsp_linter_map') let s:lsp_linter_map = {} endif -" A Dictionary to track one-shot handlers for custom LSP requests -let s:custom_handlers_map = get(s:, 'custom_handlers_map', {}) - " Clear LSP linter data for the linting engine. function! ale#lsp_linter#ClearLSPData() abort let s:lsp_linter_map = {} - let s:custom_handlers_map = {} endfunction " Only for internal use. @@ -27,28 +23,67 @@ function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort let s:lsp_linter_map = a:replacement_map endfunction -" Check if diagnostics for a particular linter should be ignored. -function! s:ShouldIgnore(buffer, linter_name) abort - " Ignore all diagnostics if LSP integration is disabled. - if ale#Var(a:buffer, 'disable_lsp') - return 1 - endif - - let l:config = ale#Var(a:buffer, 'linters_ignore') - - " Don't load code for ignoring diagnostics if there's nothing to ignore. - if empty(l:config) - return 0 - endif - +" Get all enabled LSP linters. +" This list still includes linters ignored with `ale_linters_ignore`. +" +" `ale_linters_ignore` is designed to allow language servers to be used for +" their functionality while ignoring the diagnostics they return. +function! ale#lsp_linter#GetEnabled(buffer) abort let l:filetype = getbufvar(a:buffer, '&filetype') - let l:ignore_list = ale#engine#ignore#GetList(l:filetype, l:config) + " Only LSP linters are included here. + let l:linters = filter(ale#linter#Get(l:filetype), '!empty(v:val.lsp)') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') - return index(l:ignore_list, a:linter_name) >= 0 + " Only load code for ignoring linters if we need it. + if ( + \ l:disable_lsp is 1 + \ || l:disable_lsp is v:true + \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) + \) + let l:linters = ale#engine#ignore#Exclude( + \ l:filetype, + \ l:linters, + \ [], + \ l:disable_lsp, + \) + endif + + return l:linters +endfunction + +" Check if diagnostics for a particular linter should be ignored. +function! s:ShouldIgnoreDiagnostics(buffer, linter) abort + let l:config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + " Only load code for ignoring linters if we need it. + if ( + \ !empty(l:config) + \ || l:disable_lsp is 1 + \ || l:disable_lsp is v:true + \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) + \) + " Re-use the ignore implementation just for this linter. + return empty( + \ ale#engine#ignore#Exclude( + \ getbufvar(a:buffer, '&filetype'), + \ [a:linter], + \ l:config, + \ l:disable_lsp, + \ ) + \) + endif + + return 0 endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort - let l:linter_name = s:lsp_linter_map[a:conn_id] + let l:linter = get(s:lsp_linter_map, a:conn_id) + + if empty(l:linter) + return + endif + let l:filename = ale#util#ToResource(a:response.params.uri) let l:escaped_name = escape( \ fnameescape(l:filename), @@ -61,17 +96,22 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort return endif - if s:ShouldIgnore(l:buffer, l:linter_name) + if s:ShouldIgnoreDiagnostics(l:buffer, l:linter) return endif let l:loclist = ale#lsp#response#ReadDiagnostics(a:response) - call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0) + call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist, 0) endfunction function! s:HandleTSServerDiagnostics(response, error_type) abort - let l:linter_name = 'tsserver' + " Re-create a fake linter object for tsserver. + let l:linter = { + \ 'name': 'tsserver', + \ 'aliases': [], + \ 'lsp': 'tsserver', + \} let l:escaped_name = escape( \ fnameescape(a:response.body.file), \ has('win32') ? '^' : '^,}]' @@ -83,9 +123,9 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort return endif - call ale#engine#MarkLinterInactive(l:info, l:linter_name) + call ale#engine#MarkLinterInactive(l:info, l:linter.name) - if s:ShouldIgnore(l:buffer, l:linter_name) + if s:ShouldIgnoreDiagnostics(l:buffer, l:linter) return endif @@ -123,15 +163,15 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort \ + get(l:info, 'suggestion_loclist', []) \ + get(l:info, 'syntax_loclist', []) - call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0) + call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist, 0) endfunction -function! s:HandleLSPErrorMessage(linter_name, response) abort +function! s:HandleLSPErrorMessage(linter, response) abort if !g:ale_history_enabled || !g:ale_history_log_output return endif - if empty(a:linter_name) + if empty(a:linter) return endif @@ -141,7 +181,7 @@ function! s:HandleLSPErrorMessage(linter_name, response) abort return endif - call ale#lsp_linter#AddErrorMessage(a:linter_name, l:message) + call ale#lsp_linter#AddErrorMessage(a:linter.name, l:message) endfunction function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort @@ -160,14 +200,14 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort let l:method = get(a:response, 'method', '') if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error') - let l:linter_name = get(s:lsp_linter_map, a:conn_id, '') + let l:linter = get(s:lsp_linter_map, a:conn_id, {}) - call s:HandleLSPErrorMessage(l:linter_name, a:response) + call s:HandleLSPErrorMessage(l:linter, a:response) elseif l:method is# 'textDocument/publishDiagnostics' call s:HandleLSPDiagnostics(a:conn_id, a:response) elseif l:method is# 'window/showMessage' call ale#lsp_window#HandleShowMessage( - \ s:lsp_linter_map[a:conn_id], + \ s:lsp_linter_map[a:conn_id].name, \ g:ale_lsp_show_message_format, \ a:response.params \) @@ -221,11 +261,7 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort endfunction function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort - let l:buffer_ale_root = getbufvar( - \ a:buffer, - \ 'ale_root', - \ getbufvar(a:buffer, 'ale_lsp_root', {}) - \) + let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {}) if type(l:buffer_ale_root) is v:t_string return l:buffer_ale_root @@ -242,15 +278,9 @@ function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort endif endif - let l:global_root = g:ale_root - - if empty(g:ale_root) && exists('g:ale_lsp_root') - let l:global_root = g:ale_lsp_root - endif - " Try to get a global setting for the root - if has_key(l:global_root, a:linter.name) - let l:Root = l:global_root[a:linter.name] + if has_key(g:ale_root, a:linter.name) + let l:Root = g:ale_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) @@ -472,7 +502,7 @@ function! s:CheckWithLSP(linter, details) abort call ale#lsp#RegisterCallback(l:id, l:Callback) " Remember the linter this connection is for. - let s:lsp_linter_map[l:id] = a:linter.name + let s:lsp_linter_map[l:id] = a:linter if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Geterr(l:buffer) @@ -501,9 +531,14 @@ endfunction function! s:HandleLSPResponseToCustomRequests(conn_id, response) abort if has_key(a:response, 'id') - \&& has_key(s:custom_handlers_map, a:response.id) - let l:Handler = remove(s:custom_handlers_map, a:response.id) - call l:Handler(a:response) + " Get the custom handlers Dictionary from the linter map. + let l:linter = get(s:lsp_linter_map, a:conn_id, {}) + let l:custom_handlers = get(l:linter, 'custom_handlers', {}) + + if has_key(l:custom_handlers, a:response.id) + let l:Handler = remove(l:custom_handlers, a:response.id) + call l:Handler(a:response) + endif endif endfunction @@ -514,7 +549,17 @@ function! s:OnReadyForCustomRequests(args, linter, lsp_details) abort if l:request_id > 0 && has_key(a:args, 'handler') let l:Callback = function('s:HandleLSPResponseToCustomRequests') call ale#lsp#RegisterCallback(l:id, l:Callback) - let s:custom_handlers_map[l:request_id] = a:args.handler + + " Remember the linter this connection is for. + let s:lsp_linter_map[l:id] = a:linter + + " Add custom_handlers to the linter Dictionary. + if !has_key(a:linter, 'custom_handlers') + let a:linter.custom_handlers = {} + endif + + " Put the handler function in the map to call later. + let a:linter.custom_handlers[l:request_id] = a:args.handler endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/organize_imports.vim b/sources_non_forked/ale/autoload/ale/organize_imports.vim index a6e77863..fb00bc21 100644 --- a/sources_non_forked/ale/autoload/ale/organize_imports.vim +++ b/sources_non_forked/ale/autoload/ale/organize_imports.vim @@ -19,7 +19,7 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort \ }, \ { \ 'conn_id': a:conn_id, - \ 'should_save': !&hidden, + \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endfunction @@ -57,9 +57,7 @@ function! s:OrganizeImports(linter) abort endfunction function! ale#organize_imports#Execute() abort - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call s:OrganizeImports(l:linter) - endif + for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) + call s:OrganizeImports(l:linter) endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 615986f9..2c7e0049 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -7,14 +7,17 @@ call ale#Set('python_auto_poetry', '0') let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. let s:bin_dir = has('unix') ? 'bin' : 'Scripts' +" The default virtualenv directory names are ordered from the likely most +" common names down to the least common. `.env` might be more common, but it's +" also likely to conflict with a `.env` file for environment variables, so we +" search for it last. (People really shouldn't use that name.) let g:ale_virtualenv_dir_names = get(g:, 'ale_virtualenv_dir_names', [ -\ '.env', \ '.venv', \ 'env', -\ 've-py3', \ 've', -\ 'virtualenv', \ 'venv', +\ 'virtualenv', +\ '.env', \]) function! ale#python#FindProjectRootIni(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index c32663fe..df253c9c 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -179,9 +179,7 @@ function! ale#references#Find(...) abort let l:column = min([l:column, len(getline(l:line))]) let l:Callback = function('s:OnReady', [l:line, l:column, l:options]) - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) - endif + for l:linter in ale#lsp_linter#GetEnabled(l:buffer) + call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/rename.vim b/sources_non_forked/ale/autoload/ale/rename.vim index a722cc94..d7bc8699 100644 --- a/sources_non_forked/ale/autoload/ale/rename.vim +++ b/sources_non_forked/ale/autoload/ale/rename.vim @@ -85,7 +85,7 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort \ }, \ { \ 'conn_id': a:conn_id, - \ 'should_save': !&hidden, + \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endfunction @@ -118,7 +118,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort \ }, \ { \ 'conn_id': a:conn_id, - \ 'should_save': !&hidden, + \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endif @@ -178,15 +178,9 @@ function! s:ExecuteRename(linter, options) abort endfunction function! ale#rename#Execute() abort - let l:lsp_linters = [] + let l:linters = ale#lsp_linter#GetEnabled(bufnr('')) - for l:linter in ale#linter#Get(&filetype) - if !empty(l:linter.lsp) - call add(l:lsp_linters, l:linter) - endif - endfor - - if empty(l:lsp_linters) + if empty(l:linters) call s:message('No active LSPs') return @@ -201,8 +195,8 @@ function! ale#rename#Execute() abort return endif - for l:lsp_linter in l:lsp_linters - call s:ExecuteRename(l:lsp_linter, { + for l:linter in l:linters + call s:ExecuteRename(l:linter, { \ 'old_name': l:old_name, \ 'new_name': l:new_name, \}) diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index e043216f..15517bf8 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -9,11 +9,11 @@ let g:ale_max_signs = get(g:, 'ale_max_signs', -1) " there are errors. let g:ale_change_sign_column_color = get(g:, 'ale_change_sign_column_color', 0) " These variables dictate what signs are used to indicate errors and warnings. -let g:ale_sign_error = get(g:, 'ale_sign_error', '>>') +let g:ale_sign_error = get(g:, 'ale_sign_error', 'E') let g:ale_sign_style_error = get(g:, 'ale_sign_style_error', g:ale_sign_error) -let g:ale_sign_warning = get(g:, 'ale_sign_warning', '--') +let g:ale_sign_warning = get(g:, 'ale_sign_warning', 'W') let g:ale_sign_style_warning = get(g:, 'ale_sign_style_warning', g:ale_sign_warning) -let g:ale_sign_info = get(g:, 'ale_sign_info', g:ale_sign_warning) +let g:ale_sign_info = get(g:, 'ale_sign_info', 'I') let g:ale_sign_priority = get(g:, 'ale_sign_priority', 30) " This variable sets an offset which can be set for sign IDs. " This ID can be changed depending on what IDs are set for other plugins. diff --git a/sources_non_forked/ale/autoload/ale/symbol.vim b/sources_non_forked/ale/autoload/ale/symbol.vim index 6c65f1b2..ba971e74 100644 --- a/sources_non_forked/ale/autoload/ale/symbol.vim +++ b/sources_non_forked/ale/autoload/ale/symbol.vim @@ -102,8 +102,8 @@ function! ale#symbol#Search(args) abort call setbufvar(l:buffer, 'ale_symbol_request_made', 0) let l:Callback = function('s:OnReady', [l:query, l:options]) - for l:linter in ale#linter#Get(getbufvar(l:buffer, '&filetype')) - if !empty(l:linter.lsp) && l:linter.lsp isnot# 'tsserver' + for l:linter in ale#lsp_linter#GetEnabled(l:buffer) + if l:linter.lsp isnot# 'tsserver' call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/uri/jdt.vim b/sources_non_forked/ale/autoload/ale/uri/jdt.vim index 46cea268..7df10b4e 100644 --- a/sources_non_forked/ale/autoload/ale/uri/jdt.vim +++ b/sources_non_forked/ale/autoload/ale/uri/jdt.vim @@ -21,11 +21,11 @@ function! s:OpenJDTLink(root, uri, line, column, options, result) abort call ale#util#Open(a:uri, a:line, a:column, a:options) autocmd AleURISchemes BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('')) - if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif - let b:ale_lsp_root = a:root + let b:ale_root = a:root set filetype=java call setline(1, split(l:contents, '\n')) @@ -39,6 +39,8 @@ endfunction function! ale#uri#jdt#OpenJDTLink(encoded_uri, line, column, options, conn_id) abort let l:found_eclipselsp = v:false + " We should only arrive here from a 'go to definition' request, so we'll + " assume the eclipselsp linter is enabled. for l:linter in ale#linter#Get('java') if l:linter.name is# 'eclipselsp' let l:found_eclipselsp = v:true @@ -81,14 +83,14 @@ endfunction " Read jdt:// contents, as part of current project, into current buffer. function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort - if !empty(getbufvar(bufnr(''), 'ale_lsp_root', '')) + if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif let l:linter_map = ale#lsp_linter#GetLSPLinterMap() - for l:conn_id in keys(l:linter_map) - if l:linter_map[l:conn_id] is# 'eclipselsp' + for [l:conn_id, l:linter] in items(l:linter_map) + if l:linter.name is# 'eclipselsp' let l:root = l:conn_id[stridx(l:conn_id, ':')+1:] endif endfor @@ -98,7 +100,7 @@ function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort endif let l:uri = a:encoded_uri - let b:ale_lsp_root = l:root + let b:ale_root = l:root set filetype=java call ale#lsp_linter#SendRequest( diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index 2dc71ce5..98af1635 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -522,7 +522,18 @@ function! ale#util#SetBufferContents(buffer, lines) abort " Use a Vim API for setting lines in other buffers, if available. if l:has_bufline_api - call setbufline(a:buffer, 1, l:new_lines) + if has('nvim') + " save and restore signs to avoid flickering + let signs = sign_getplaced(a:buffer, {'group': 'ale'})[0].signs + + call nvim_buf_set_lines(a:buffer, 0, l:first_line_to_remove, 0, l:new_lines) + + " restore signs (invalid line numbers will be skipped) + call sign_placelist(map(signs, {_, v -> extend(v, {'buffer': a:buffer})})) + else + call setbufline(a:buffer, 1, l:new_lines) + endif + call deletebufline(a:buffer, l:first_line_to_remove, '$') " Fall back on setting lines the old way, for the current buffer. else diff --git a/sources_non_forked/ale/autoload/ale/virtualtext.vim b/sources_non_forked/ale/autoload/ale/virtualtext.vim index 72bc8e6f..551211e8 100644 --- a/sources_non_forked/ale/autoload/ale/virtualtext.vim +++ b/sources_non_forked/ale/autoload/ale/virtualtext.vim @@ -31,7 +31,8 @@ let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10) " Controls the positioning of virtualtext let g:ale_virtualtext_column = get(g:, 'ale_virtualtext_column', 0) let g:ale_virtualtext_maxcolumn = get(g:, 'ale_virtualtext_maxcolumn', 0) -let g:ale_virtualtext_single = get(g:,'ale_virtualtext_single',0) +" If 1, only show the first problem with virtualtext. +let g:ale_virtualtext_single = get(g:, 'ale_virtualtext_single', 1) let s:cursor_timer = get(s:, 'cursor_timer', -1) let s:last_pos = get(s:, 'last_pos', [0, 0, 0]) @@ -273,6 +274,32 @@ function! ale#virtualtext#ShowCursorWarningWithDelay() abort endif endfunction +function! ale#virtualtext#CompareSeverityPerLine(left, right) abort + " Compare lines + if a:left.lnum < a:right.lnum + return -1 + endif + + if a:left.lnum > a:right.lnum + return 1 + endif + + let l:left_priority = ale#util#GetItemPriority(a:left) + let l:right_priority = ale#util#GetItemPriority(a:right) + + " Put highest priority items first. + if l:left_priority > l:right_priority + return -1 + endif + + if l:left_priority < l:right_priority + return 1 + endif + + " Put the first seen problem first. + return a:left.col - a:right.col +endfunction + function! ale#virtualtext#SetTexts(buffer, loclist) abort if !has('nvim') && s:emulate_virt return @@ -280,17 +307,19 @@ function! ale#virtualtext#SetTexts(buffer, loclist) abort call ale#virtualtext#Clear(a:buffer) - let l:filter = ale#Var(a:buffer,'virtualtext_single') - let l:seen = {} + let l:buffer_list = filter(copy(a:loclist), 'v:val.bufnr == a:buffer') - for l:item in a:loclist - if l:item.bufnr == a:buffer - let l:line = max([1, l:item.lnum]) + if ale#Var(a:buffer,'virtualtext_single') + " If we want a single problem per line, sort items on each line by + " highest severity and then lowest column position, then de-duplicate + " the items by line. + call uniq( + \ sort(l:buffer_list, function('ale#virtualtext#CompareSeverityPerLine')), + \ {a, b -> a.lnum - b.lnum} + \) + endif - if !has_key(l:seen,l:line) || l:filter == 0 - call ale#virtualtext#ShowMessage(a:buffer, l:item) - let l:seen[l:line] = 1 - endif - endif + for l:item in l:buffer_list + call ale#virtualtext#ShowMessage(a:buffer, l:item) endfor endfunction diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index d3517e79..b8b448fb 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -25,10 +25,10 @@ g:ale_c_build_dir_names *g:ale_c_build_dir_names* Type: |List| Default: `['build', 'bin']` - A list of directory names to be used when searching upwards from cpp files + A list of directory names to be used when searching upwards from C files to discover compilation databases with. For directory named `'foo'`, ALE will search for `'foo/compile_commands.json'` in all directories on and - above the directory containing the cpp file to find path to compilation + above the directory containing the C file to find path to compilation database. This feature is useful for the clang tools wrapped around LibTooling (namely here, clang-tidy) @@ -202,6 +202,37 @@ g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* https://github.com/MaskRay/ccls/wiki/Customization#initialization-options. +=============================================================================== +clangcheck *ale-c-clangcheck* + +`clang-check` will be run only when files are saved to disk, so that +`compile_commands.json` files can be used. It is recommended to use this +linter in combination with `compile_commands.json` files. +Therefore, `clang-check` linter reads the options |g:ale_c_build_dir| and +|g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually +overrides |g:ale_c_build_dir_names|. + + +g:ale_c_clangcheck_executable *g:ale_c_clangcheck_executable* + *b:ale_c_clangcheck_executable* + Type: |String| + Default: `'clang-check'` + + This variable can be changed to use a different executable for clangcheck. + + +g:ale_c_clangcheck_options *g:ale_c_clangcheck_options* + *b:ale_c_clangcheck_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-check. + + This variable should not be set to point to build subdirectory with + `-p path/to/build` option, as it is handled by the |g:ale_c_build_dir| + option. + + =============================================================================== clangd *ale-c-clangd* @@ -378,7 +409,7 @@ g:ale_c_cquery_executable *g:ale_c_cquery_executable* This variable can be changed to use a different executable for cquery. -g:ale_cpp_cquery_cache_directory *g:ale_c_cquery_cache_directory* +g:ale_c_cquery_cache_directory *g:ale_c_cquery_cache_directory* *b:ale_c_cquery_cache_directory* Type: |String| Default: `'~/.cache/cquery'` diff --git a/sources_non_forked/ale/doc/ale-cairo.txt b/sources_non_forked/ale/doc/ale-cairo.txt index 0a78e68a..070b76e5 100644 --- a/sources_non_forked/ale/doc/ale-cairo.txt +++ b/sources_non_forked/ale/doc/ale-cairo.txt @@ -2,6 +2,19 @@ ALE Cairo Integration *ale-cairo-options* +=============================================================================== +scarb *ale-cairo-scarb* + +g:ale_cairo_scarb_executable *g:ale_cairo_scarb_executable* + *b:ale_cairo_scarb_executable* + + Default: `'scarb build'` + + For Cairo1 projects using Scarb + + For more information read 'https://docs.swmansion.com/scarb/' + + =============================================================================== starknet *ale-cairo-starknet* @@ -13,3 +26,5 @@ g:ale_cairo_starknet_executable *g:ale_cairo_starknet_executable* Overrides the starknet-compile binary after installing the cairo-language. For more information read 'https://starknet.io/docs/quickstart.html' + +=============================================================================== diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 6bc009fd..6ba03da1 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -48,7 +48,7 @@ documented functions and options, until a major version is planned. Breaking changes should be preceded by a deprecation phase complete with warnings. Changes required for security may be an exception. -ALE supports Vim 8 and above, and NeoVim 0.2.0 or newer. These are the +ALE supports Vim 8 and above, and NeoVim 0.6.0 or newer. These are the earliest versions of Vim and NeoVim which support |job|, |timer|, |closure|, and |lambda| features. All ALE code should be written so it is compatible with these versions of Vim, or with version checks so particular features can @@ -156,7 +156,7 @@ environments. 1. Vim 8.0.0027 on Linux via GitHub Actions. 2. Vim 9.0.0297 on Linux via GitHub Actions. -3. NeoVim 0.2.0 on Linux via GitHub Actions. +3. NeoVim 0.6.0 on Linux via GitHub Actions. 4. NeoVim 0.8.0 on Linux via GitHub Actions. 6. Vim 8 (stable builds) on Windows via AppVeyor. diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index 693db5aa..351b442a 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -104,5 +104,23 @@ cspell *ale-elixir-cspell* See |ale-cspell-options| +=============================================================================== +lexical *ale-elixir-lexical* + +Lexical (https://github.com/lexical-lsp/lexical) + +g:ale_elixir_lexical_release *g:ale_elixir_lexical_release* + *b:ale_elixir_lexical_release* + Type: |String| + Default: `'lexical'` + + Location of the lexical release directory. This directory must contain + the language server scripts (start_lexical.sh and start_lexical.bat). + + For example, set release to: `/home/projects/lexical/_build/dev/rel/lexical` + + There are currnetly no configuration options for lexical. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 69611866..aed3aaf8 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -264,7 +264,7 @@ g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path* Type: |String| Default: `''` - If you have Eclipse installed is good idea to set this variable to the + If you have Eclipse installed it is a good idea to set this variable to the absolute path of the Eclipse workspace. If not set this value will be set to the parent folder of the project root. diff --git a/sources_non_forked/ale/doc/ale-nickel.txt b/sources_non_forked/ale/doc/ale-nickel.txt new file mode 100644 index 00000000..a8dd6af8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-nickel.txt @@ -0,0 +1,25 @@ +=============================================================================== +ALE Nickel Integration *ale-nickel-options* + + +=============================================================================== +nickel_format *ale-nickel-nickel-format* + +g:ale_nickel_nickel_format_executable *g:ale_nickel_nickel_format_executable* + *b:ale_nickel_nickel_format_executable* + Type: |String| + Default: `'nickel'` + + This option can be changed to change the path for `nickel`. + + +g:ale_nickel_nickel_format_options *g:ale_nickel_nickel_format_options* + *b:ale_nickel_nickel_format_options* + Type: |String| + Default: `''` + + This option can be changed to pass extra options to `'nickel format'` + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index d7c5cacc..ec118c5a 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -1322,6 +1322,70 @@ g:ale_python_ruff_auto_poetry *g:ale_python_ruff_auto_poetry* if true. This is overridden by a manually-set executable. +=============================================================================== +ruff-format *ale-python-ruff-format* + +g:ale_python_ruff_format_change_directory + *g:ale_python_ruff_format_change_directory* + *b:ale_python_ruff_format_change_directory* + Type: |Number| + Default: `1` + + If set to `1`, `ruff` will be run from a detected project root, per + |ale-python-root|. if set to `0` or no project root detected, + `ruff` will be run from the buffer's directory. + + +g:ale_python_ruff_format_executable *g:ale_python_ruff_format_executable* + *b:ale_python_ruff_format_executable* + Type: |String| + Default: `'ruff'` + + See |ale-integrations-local-executables| + + Set this to `'pipenv'` to invoke `'pipenv` `run` `ruff'`. + Set this to `'poetry'` to invoke `'poetry` `run` `ruff'`. + + +g:ale_python_ruff_format_options *g:ale_python_ruff_format_options* + *b:ale_python_ruff_format_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the ruff + invocation. + + For example, to select/enable and/or disable some error codes, + you may want to set > + let g:ale_python_ruff_format_options = '--ignore F401' + + +g:ale_python_ruff_format_use_global *g:ale_python_ruff_format_use_global* + *b:ale_python_ruff_format_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +g:ale_python_ruff_format_auto_pipenv *g:ale_python_ruff_format_auto_pipenv* + *b:ale_python_ruff_format_auto_pipenv* + Type: |Number| + Default: `0` + + 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_ruff_format_auto_poetry *g:ale_python_ruff_format_auto_poetry* + *b:ale_python_ruff_format_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. + + =============================================================================== unimport *ale-python-unimport* diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index b0773fdd..ff9aa798 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -48,6 +48,26 @@ g:ale_ruby_debride_options *g:ale_ruby_debride_options* This variable can be changed to modify flags given to debride. +=============================================================================== +packwerk *ale-ruby-packwerk* + +g:ale_ruby_packwerk_executable *g:ale_ruby_packwerk_executable* + *b:ale_ruby_packwerk_executable* + Type: |String| + Default: `'packwerk'` + + Override the invoked packwerk binary. Set this to `'bundle'` to invoke + `'bundle` `exec` packwerk'. + + +g:ale_ruby_packwerk_options *g:ale_ruby_packwerk_options* + *b:ale_ruby_packwerk_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to packwerk. + + =============================================================================== prettier *ale-ruby-prettier* diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 48f558e8..897fcaa1 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -33,11 +33,12 @@ Integration Information 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. - Only cargo and rls are enabled by default. To switch to using rustc instead - of cargo, configure |g:ale_linters| appropriately: > + Only cargo and rust-analyze are enabled by default. To switch to using rustc + instead of cargo, configure |b:ale_linters| in your ftplugin file + appropriately: > " See the help text for the option for more information. - let g:ale_linters = {'rust': ['rustc', 'rls']} + let b:ale_linters = ['analyzer', 'rustc'] < Also note that rustc 1.18. or later is needed. diff --git a/sources_non_forked/ale/doc/ale-solidity.txt b/sources_non_forked/ale/doc/ale-solidity.txt index c4d2f02f..6cf97344 100644 --- a/sources_non_forked/ale/doc/ale-solidity.txt +++ b/sources_non_forked/ale/doc/ale-solidity.txt @@ -36,6 +36,15 @@ solium *ale-solidity-solium* See the corresponding solium usage for detailed instructions (https://github.com/duaraghav8/Solium#usage). +=============================================================================== +forge *ale-solidity-forge* + + `forge fmt` is not a linter, only a formatter. It should be used only as a + fixer. + + `forge fmt` should work out-of-the-box. You can further configure it using + `foundry.toml`. See the corresponding documentation for detailed + instructions (https://book.getfoundry.sh/reference/config/formatter). =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 40c78f76..aa49a1b1 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 @@ -67,6 +67,7 @@ Notes: * `ccls` * `clang` (`cc`) * `clang-format` + * `clangcheck`!! * `clangd` * `clangtidy`!! * `cppcheck` @@ -101,6 +102,7 @@ Notes: * `gcc` (`cc`) * `uncrustify` * Cairo + * `scarb`!! * `starknet` * Chef * `cookstyle` @@ -168,6 +170,7 @@ Notes: * `dialyxir` * `dogma`!! * `elixir-ls` + * `lexical` * `mix`!! * Elm * `elm-format` @@ -380,6 +383,8 @@ Notes: * `mmc`!! * NASM * `nasm`!! +* Nickel + * `nickel_format` * Nim * `nim check`!! * `nimlsp` @@ -504,6 +509,7 @@ Notes: * `refurb` * `reorder-python-imports` * ruff + * ruff-format * `unimport` * `vulture`!! * `yapf` @@ -546,6 +552,7 @@ Notes: * `brakeman`!! * `cspell` * `debride` + * `packwerk`!! * `prettier` * `rails_best_practices`!! * `reek` @@ -586,6 +593,7 @@ Notes: * SML * `smlnj` * Solidity + * `forge` * `solc` * `solhint` * `solium` diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index 4a993793..ab3f17bd 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -42,8 +42,8 @@ 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* +g:ale_deno_import_map *g:ale_deno_import_map* + *b:ale_deno_import_map* Type: |String| Default: `'import_map.json'` diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index e73abc99..5f7999b8 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -121,7 +121,7 @@ circumstances. ALE will report problems with your code in the following ways, listed with their relevant options. -* Via the Neovim diagnostics API (Off by default) - |g:ale_use_neovim_diagnostics_api| +* Via Neovim diagnostics (On in Neovim 0.6+) - |g:ale_use_neovim_diagnostics_api| * By updating loclist. (On by default) - |g:ale_set_loclist| * By updating quickfix. (Off by default) - |g:ale_set_quickfix| * By setting error highlights. - |g:ale_set_highlights| @@ -455,6 +455,11 @@ If you want to use another plugin for LSP features and tsserver, you can use the |g:ale_disable_lsp| setting to disable ALE's own LSP integrations, or ignore particular linters with |g:ale_linters_ignore|. +If for any reason you want to stop a language server ALE starts, such as when +a project configuration has significantly changed, or new files have been +added the language server isn't aware of, use either |ALEStopLSP| or +|ALEStopAllLSPs| to stop the server until ALE automatically starts it again. + ------------------------------------------------------------------------------- 5.1 Completion *ale-completion* @@ -737,6 +742,7 @@ You may wish to remove some other menu items you don't want to see: > =============================================================================== 6. Global Options *ale-options* + g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled* Type: |Number| @@ -815,7 +821,6 @@ g:ale_command_wrapper *g:ale_command_wrapper* " Has the same effect as the above. let g:ale_command_wrapper = 'nice -n5 %*' < - For passing all of the arguments for a command as one argument to a wrapper, `%@` can be used instead. > @@ -840,7 +845,6 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* *b:ale_completion_enabled* - Type: |Number| Default: `0` @@ -881,7 +885,7 @@ g:ale_completion_autoimport *g:ale_completion_autoimport* When this option is set to `1`, ALE will try to automatically import completion results from external modules. It can be disabled by setting it to `0`. Some LSP servers include auto imports on every completion item so - disabling automatic imports may drop some or all completion items returnend + disabling automatic imports may drop some or all completion items returned by it (e.g. eclipselsp). @@ -906,7 +910,7 @@ g:ale_completion_excluded_words *g:ale_completion_excluded_words* g:ale_completion_symbols *g:ale_completion_symbols* Type: |Dictionary| - + Default: See `autoload/ale/completion.vim` A mapping from completion types to symbols for completions. See |ale-symbols| for more information. @@ -960,6 +964,7 @@ g:ale_completion_max_suggestions *g:ale_completion_max_suggestions* Adjust this option as needed, depending on the complexity of your codebase and your available processing power. + g:ale_cursor_detail *g:ale_cursor_detail* Type: |Number| @@ -984,7 +989,6 @@ g:ale_cursor_detail *g:ale_cursor_detail* g:ale_default_navigation *g:ale_default_navigation* *b:ale_default_navigation* - Type: |String| Default: `'buffer'` @@ -1003,12 +1007,16 @@ g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview* g:ale_disable_lsp *g:ale_disable_lsp* *b:ale_disable_lsp* + Type: |Number| OR |String| + Default: `'auto'` - Type: |Number| - Default: `0` + When this option is set to `'auto'`, ALE will automatically disable linters + that it detects as having already been configured with the nvim-lspconfig + plugin. When this option is set to `1`, ALE ignores all linters powered by + LSP, and also `tsserver`. - When this option is set to `1`, ALE ignores all linters powered by LSP, - and also `tsserver`. + Any linters that are disabled will also not be usable for LSP functionality + other than just linting. Please see also |ale-lsp|. @@ -1054,7 +1062,6 @@ g:ale_echo_msg_error_str *g:ale_echo_msg_error_str* g:ale_echo_msg_format *g:ale_echo_msg_format* *b:ale_echo_msg_format* - Type: |String| Default: `'%code: %%s'` @@ -1113,7 +1120,6 @@ g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str* g:ale_enabled *g:ale_enabled* *b:ale_enabled* - Type: |Number| Default: `1` @@ -1128,16 +1134,16 @@ g:ale_enabled *g:ale_enabled* " Disable linting for all minified JS files. let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}} < - See |g:ale_pattern_options| for more information on that option. g:ale_exclude_highlights *g:ale_exclude_highlights* *b:ale_exclude_highlights* - Type: |List| Default: `[]` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + A list of regular expressions for matching against highlight messages to remove. For example: > @@ -1149,7 +1155,6 @@ g:ale_exclude_highlights *g:ale_exclude_highlights* g:ale_fixers *g:ale_fixers* *b:ale_fixers* - Type: |Dictionary| Default: `{}` @@ -1171,7 +1176,6 @@ g:ale_fixers *g:ale_fixers* g:ale_fix_on_save *g:ale_fix_on_save* *b:ale_fix_on_save* - Type: |Number| Default: `0` @@ -1193,7 +1197,6 @@ g:ale_fix_on_save *g:ale_fix_on_save* g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* *b:ale_fix_on_save_ignore* - Type: |Dictionary| or |List| Default: `{}` @@ -1241,11 +1244,12 @@ g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts* Type: |String| or |Dictionary| Default: `''` - Either a dictionary of options or the string name of a function that returns a - dictionary of options. This will be used as an argument to |popup_create| for - Vim users or |nvim_open_win| for NeoVim users. Note that in either case, the - resulting dictionary is merged with ALE defaults rather than expliciting overriding - them. This only takes effect if |g:ale_floating_preview| is enabled. + Either a dictionary of options or the string name of a function that returns + a dictionary of options. This will be used as an argument to |popup_create| + for Vim users or |nvim_open_win| for NeoVim users. In either case, the + resulting dictionary is merged with ALE defaults rather than explicitly + overriding them. This only takes effect if |g:ale_floating_preview| is + enabled. NOTE: for Vim users see |popup_create-arguments|, for NeoVim users see |nvim_open_win| for argument details @@ -1260,23 +1264,22 @@ g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts* let g:ale_floating_preview_popup_opts = 'g:CustomOpts' < - g:ale_floating_window_border *g:ale_floating_window_border* Type: |List| Default: `['|', '-', '+', '+', '+', '+', '|', '-']` When set to `[]`, window borders are disabled. The elements in the list set - the the characters for the left side, top, top-left corner, top-right - corner, bottom-right corner, bottom-left corner, right side, and bottom of - the floating window, respectively. + the characters for the left side, top, top-left corner, top-right + corner, bottom-right corner, bottom-left corner, right side, and bottom of + the floating window, respectively. If the terminal supports Unicode, you might try setting the value to ` ['│', '─', '╭', '╮', '╯', '╰', '│', '─']`, to make it look nicer. NOTE: For compatibility with previous versions, if the list does not have - elements for the right side and bottom, the left side and top will be used - instead. + elements for the right side and bottom, the left side and top will be used + instead. g:ale_history_enabled *g:ale_history_enabled* @@ -1346,6 +1349,15 @@ g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview* hover messages. +g:ale_info_default_mode *g:ale_info_default_mode* + *b:ale_info_default_mode* + Type: |String| + Default: `'preview'` + + Changes the default mode used for |ALEInfo|. See documentation for |ALEInfo| + for more information. + + g:ale_keep_list_window_open *g:ale_keep_list_window_open* *b:ale_keep_list_window_open* Type: |Number| @@ -1457,7 +1469,6 @@ g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* *b:ale_lint_on_insert_leave* - Type: |Number| Default: `1` @@ -1545,7 +1556,6 @@ g:ale_linter_aliases *g:ale_linter_aliases* g:ale_filename_mappings *g:ale_filename_mappings* *b:ale_filename_mappings* - Type: |Dictionary| or |List| Default: `{}` @@ -1653,7 +1663,7 @@ g:ale_linters *g:ale_linters* \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'], - \ 'rust': ['cargo', 'rls'], + \ 'rust': ['analyzer', 'cargo'], \ 'spec': [], \ 'text': [], \ 'vader': ['vimls'], @@ -1713,7 +1723,6 @@ g:ale_linters_explicit *g:ale_linters_explicit* g:ale_linters_ignore *g:ale_linters_ignore* *b:ale_linters_ignore* - Type: |Dictionary| or |List| Default: `{}` @@ -1749,7 +1758,6 @@ g:ale_list_vertical *g:ale_list_vertical* g:ale_loclist_msg_format *g:ale_loclist_msg_format* *b:ale_loclist_msg_format* - Type: |String| Default: `g:ale_echo_msg_format` @@ -1826,6 +1834,8 @@ g:ale_max_signs *g:ale_max_signs* Type: |Number| Default: `-1` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + When set to any positive integer, ALE will not render any more than the given number of signs for any one buffer. @@ -1946,7 +1956,6 @@ g:ale_rename_tsserver_find_in_comments *g:ale_rename_tsserver_find_in_comments* g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* - Type: |Number| Default: `0` @@ -1957,7 +1966,6 @@ g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* g:ale_root *g:ale_root* *b:ale_root* - Type: |Dictionary| or |String| Default: `{}` @@ -1974,9 +1982,18 @@ g:ale_root *g:ale_root* LSP linter, it will not run. +g:ale_save_hidden *g:ale_save_hidden* + + Type: |Number| + Default: `0` + + When set to `1`, save buffers when 'hidden' is set when applying code + actions or rename operations, such as through |ALERename| or + |ALEOrganizeImports|. + + g:ale_set_balloons *g:ale_set_balloons* *b:ale_set_balloons* - Type: |Number| or |String| Default: `has('balloon_eval') && has('gui_running')` @@ -1994,7 +2011,6 @@ g:ale_set_balloons *g:ale_set_balloons* let g:ale_set_balloons = has('gui_running') ? 'hover' : 0 < - Balloons can be enabled for terminal versions of Vim that support balloons, but some versions of Vim will produce strange mouse behavior when balloons are enabled. To configure balloons for your terminal, you should first @@ -2028,6 +2044,11 @@ g:ale_set_highlights *g:ale_set_highlights* Type: |Number| Default: `has('syntax')` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + In addition, ALE's highlight groups will not be used when setting + highlights through Neovim's diagnostics API. See |diagnostic-highlights| for + how to configure Neovim diagnostic highlighting. + When this option is set to `1`, highlights will be set for problems. ALE will use the following highlight groups for problems: @@ -2088,6 +2109,12 @@ g:ale_set_signs *g:ale_set_signs* When this option is set to `1`, the |sign| column will be populated with signs marking where problems appear in the file. + When |g:ale_use_neovim_diagnostics_api| is `1`, the only other setting that + will be respected for signs is |g:ale_sign_priority|. ALE's highlight groups + will and other sign settings will not apply when setting signs through + Neovim's diagnostics API. See |diagnostic-signs| for how to configure signs + in Neovim. + ALE will use the following highlight groups for problems: |ALEErrorSign| - Items with `'type': 'E'` @@ -2141,7 +2168,6 @@ g:ale_sign_priority *g:ale_sign_priority* g:ale_shell *g:ale_shell* *b:ale_shell* - Type: |String| Default: not set @@ -2159,7 +2185,6 @@ g:ale_shell *g:ale_shell* g:ale_shell_arguments *g:ale_shell_arguments* *b:ale_shell_arguments* - Type: |String| Default: not set @@ -2173,6 +2198,8 @@ g:ale_sign_column_always *g:ale_sign_column_always* Type: |Number| Default: `0` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + By default, the sign gutter will disappear when all warnings and errors have been fixed for a file. When this option is set to `1`, the sign column will remain open. This can be preferable if you don't want the text in your file @@ -2182,7 +2209,9 @@ g:ale_sign_column_always *g:ale_sign_column_always* g:ale_sign_error *g:ale_sign_error* Type: |String| - Default: `'>>'` + Default: `'E'` + + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for errors in the sign gutter. @@ -2190,7 +2219,9 @@ g:ale_sign_error *g:ale_sign_error* g:ale_sign_info *g:ale_sign_info* Type: |String| - Default: `g:ale_sign_warning` + Default: `'I'` + + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for "info" markers in the sign gutter. @@ -2200,6 +2231,8 @@ g:ale_sign_style_error *g:ale_sign_style_error* Type: |String| Default: `g:ale_sign_error` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + The sign for style errors in the sign gutter. @@ -2208,6 +2241,8 @@ g:ale_sign_style_warning *g:ale_sign_style_warning* Type: |String| Default: `g:ale_sign_warning` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + The sign for style warnings in the sign gutter. @@ -2216,6 +2251,8 @@ g:ale_sign_offset *g:ale_sign_offset* Type: |Number| Default: `1000000` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + This variable controls offset from which numeric IDs will be generated for new signs. Signs cannot share the same ID values, so when two Vim plugins set signs at the same time, the IDs have to be configured such that they do @@ -2228,7 +2265,9 @@ g:ale_sign_offset *g:ale_sign_offset* g:ale_sign_warning *g:ale_sign_warning* Type: |String| - Default: `'--'` + Default: `'W'` + + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for warnings in the sign gutter. @@ -2238,6 +2277,8 @@ g:ale_sign_highlight_linenrs *g:ale_sign_highlight_linenrs* Type: |Number| Default: `0` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + When set to `1`, this option enables highlighting problems on the 'number' column in Vim versions that support `numhl` highlights. This option must be configured before ALE is loaded. @@ -2295,16 +2336,13 @@ g:ale_use_global_executables *g:ale_use_global_executables* g:ale_use_neovim_diagnostics_api *g:ale_use_neovim_diagnostics_api* Type: |Number| - Default: `0` + Default: `has('nvim-0.6')` If enabled, this option will disable ALE's standard UI, and instead send all linter output to Neovim's diagnostics API. This allows you to collect errors from nvim-lsp, ALE, and anything else that uses diagnostics all in - one place. The following options are ignored when using the diagnostics API: - - - |g:ale_set_highlights| - - |g:ale_set_signs| - - |g:ale_virtualtext_cursor| + one place. Many options for configuring how problems appear on the screen + will not apply when the API is enabled. To enable this option, set the value to `1`. @@ -2324,11 +2362,17 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor* `'current'`, `'1'`, or `1` - Show problems for the current line. `'disabled'`, `'0'`, or `0` - Do not show problems with virtual-text. + When |g:ale_use_neovim_diagnostics_api| is `1`, `'current'` will behave the + same as `'all'`. + Messages are only displayed after a short delay. See |g:ale_virtualtext_delay|. - Messages can be prefixed with a string. See |g:ale_virtualtext_prefix|. + Messages can be prefixed with a string if not using Neovim's diagnostics + API. See |g:ale_virtualtext_prefix|. - ALE will use the following highlight groups for problems: + If and only if not displaying problems via Neovim's diagnostics API, + highlights for configuring ALE's virtualtext messages can be configured with + custom highlight groups: |ALEVirtualTextError| - Items with `'type': 'E'` |ALEVirtualTextWarning| - Items with `'type': 'W'` @@ -2342,6 +2386,8 @@ g:ale_virtualtext_delay *g:ale_virtualtext_delay* Type: |Number| Default: `10` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + Given any integer, this option controls the number of milliseconds before ALE will show a message for a problem near the cursor. @@ -2354,6 +2400,8 @@ g:ale_virtualtext_prefix *g:ale_virtualtext_prefix* Type: |String| Default: `'%comment% %type%: '` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + Prefix to be used with |g:ale_virtualtext_cursor|. This setting can be changed in each buffer with `b:ale_virtualtext_prefix`. @@ -2375,6 +2423,8 @@ g:ale_virtualtext_maxcolumn *g:ale_virtualtext_maxcolumn* Type: |String| or |Number| Default: `0` + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + Virtualtext column range, from `column` to `maxcolumn`. If a line is `column` or less characters long, the virtualtext message is shifted right to `column`. @@ -2390,23 +2440,28 @@ g:ale_virtualtext_maxcolumn *g:ale_virtualtext_maxcolumn* When `column` is set to zero, column positioning is disabled, when `maxcolumn` is set to zero, no maximum line length is enforced. + g:ale_virtualtext_single *g:ale_virtualtext_single* *b:ale_virtualtext_single* Type: |Number| - Default: `0` + Default: `1` - Enable or disable concatenation of multiple virtualtext messages on a single - line. By default, if a line has multiple errors or warnings, each will be + This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. + + Enable or disable concatenation of multiple virtual text messages on a single + line. By default, if a line has multiple errors or warnings, each will be appended in turn. - With `single` set to a non-zero value, only the first message appears. - (No attempt is made to prefer message types such as errors over warnings) + With `single` set to a non-zero value, only the first problem on a line will + be printed with virtual text. The most severe problem on a line will be + printed. If two problems exist on a line of equal severity, the problem at + the left-most position will be printed. + g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* *b:ale_virtualenv_dir_names* - Type: |List| - Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']` + Default: `['.venv', 'env', 've', 'venv', 'virtualenv', '.env']` A list of directory names to be used when searching upwards from Python files to discover virtualenv directories with. @@ -2418,7 +2473,6 @@ g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* *b:ale_warn_about_trailing_blank_lines* - Type: |Number| Default: `1` @@ -2430,7 +2484,6 @@ g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* *b:ale_warn_about_trailing_whitespace* - Type: |Number| Default: `1` @@ -2447,7 +2500,6 @@ g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* g:ale_windows_node_executable_path *g:ale_windows_node_executable_path* *b:ale_windows_node_executable_path* - Type: |String| Default: `'node.exe'` @@ -2866,6 +2918,7 @@ documented in additional help files. astyle................................|ale-c-astyle| cc....................................|ale-c-cc| ccls..................................|ale-c-ccls| + clangcheck............................|ale-c-clangcheck| clangd................................|ale-c-clangd| clang-format..........................|ale-c-clangformat| clangtidy.............................|ale-c-clangtidy| @@ -2875,6 +2928,7 @@ documented in additional help files. flawfinder............................|ale-c-flawfinder| uncrustify............................|ale-c-uncrustify| cairo...................................|ale-cairo-options| + scarb.................................|ale-cairo-scarb| starknet..............................|ale-cairo-starknet| chef....................................|ale-chef-options| cookstyle.............................|ale-chef-cookstyle| @@ -2951,6 +3005,7 @@ documented in additional help files. elixir-ls.............................|ale-elixir-elixir-ls| credo.................................|ale-elixir-credo| cspell................................|ale-elixir-cspell| + lexical...............................|ale-elixir-lexical| elm.....................................|ale-elm-options| elm-format............................|ale-elm-elm-format| elm-ls................................|ale-elm-elm-ls| @@ -3134,6 +3189,8 @@ documented in additional help files. mmc...................................|ale-mercury-mmc| nasm....................................|ale-nasm-options| nasm..................................|ale-nasm-nasm| + nickel..................................|ale-nickel-options| + nickel_format.........................|ale-nickel-nickel-format| nim.....................................|ale-nim-options| nimcheck..............................|ale-nim-nimcheck| nimlsp................................|ale-nim-nimlsp| @@ -3250,6 +3307,7 @@ documented in additional help files. refurb................................|ale-python-refurb| reorder-python-imports................|ale-python-reorder_python_imports| ruff..................................|ale-python-ruff| + ruff-format...........................|ale-python-ruff-format| unimport..............................|ale-python-unimport| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| @@ -3281,6 +3339,7 @@ documented in additional help files. brakeman..............................|ale-ruby-brakeman| cspell................................|ale-ruby-cspell| debride...............................|ale-ruby-debride| + packwerk..............................|ale-ruby-packwerk| prettier..............................|ale-ruby-prettier| rails_best_practices..................|ale-ruby-rails_best_practices| reek..................................|ale-ruby-reek| @@ -3326,6 +3385,7 @@ documented in additional help files. solc..................................|ale-solidity-solc| solhint...............................|ale-solidity-solhint| solium................................|ale-solidity-solium| + forge.................................|ale-solidity-forge| spec....................................|ale-spec-options| rpmlint...............................|ale-spec-rpmlint| sql.....................................|ale-sql-options| @@ -3645,14 +3705,15 @@ ALERename *ALERename* The symbol where the cursor is resting will be the symbol renamed, and a prompt will open to request a new name. - The rename operation will save all modified buffers when `set nohidden` is - set, because that disables leaving unsaved buffers in the background. See - `:help hidden` for more details. + The rename operation will not save modified buffers when 'hidden' is on + unless |g:ale_save_hidden| is `1`. + ALEFileRename *ALEFileRename* Rename a file and fix imports using `tsserver`. + ALECodeAction *ALECodeAction* Apply a code action via LSP servers or `tsserver`. @@ -3825,7 +3886,7 @@ ALEDetail *ALEDetail* *:ALEInfo* ALEInfo *ALEInfo* -ALEInfoToClipboard *ALEInfoToClipboard* + *ALEInfoToFile* Print runtime information about ALE, including the values of global and buffer-local settings for ALE, the linters that are enabled, the commands @@ -3837,8 +3898,17 @@ ALEInfoToClipboard *ALEInfoToClipboard* |g:ale_history_log_output| to `1` to enable logging of output for commands. ALE will only log the output captured for parsing problems, etc. - The command `:ALEInfoToClipboard` can be used to output ALEInfo directly to - your clipboard. This might not work on every machine. + You can pass options to the command to control how ALE displays the + information, such as `:ALEInfo -echo`, etc. > + + -preview Show the info in a preview window. + -clip OR -clipboard Copy the information to your clipboard. + -echo echo all of the information with :echo +< + The default mode can be configured with |g:ale_info_default_mode|. + + When shown in a preview window, syntax highlights can be defined for the + `ale-info` filetype. `:ALEInfoToFile` will write the ALE runtime information to a given filename. The filename works just like |:w|. @@ -3871,6 +3941,17 @@ ALEStopAllLSPs *ALEStopAllLSPs* This command can be used when LSP clients mess up and need to be restarted. +ALEStopLSP `linter_name` *ALEStopLSP* + + `ALEStopLSP` will stop a specific language server with a given linter name. + Completion is supported for currently running language servers. All language + servers with the given name will be stopped across all buffers for all + projects. + + If the command is run with a bang (`:ALEStopLSP!`), all warnings will be + suppressed. + + =============================================================================== 9. API *ale-api* diff --git a/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim b/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim index 189a4dc2..42ade0fd 100644 --- a/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim +++ b/sources_non_forked/ale/ftplugin/ale-fix-suggest.vim @@ -1,2 +1,5 @@ " Close the ALEFixSuggest window with the q key. noremap q :q! + +let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') +let b:undo_ftplugin .= ' | execute "silent! unmap q"' diff --git a/sources_non_forked/ale/ftplugin/ale-info.vim b/sources_non_forked/ale/ftplugin/ale-info.vim new file mode 100644 index 00000000..c2c794b2 --- /dev/null +++ b/sources_non_forked/ale/ftplugin/ale-info.vim @@ -0,0 +1,22 @@ +" Close the ALEInfo preview window with the q key. +noremap q :q! + +" Explicitly use the default synmaxcol for ale-info. +setlocal synmaxcol=3000 + +function! ALEInfoOpenHelp() abort + let l:variable = matchstr(getline('.'), '\v[gb]:ale_[a-z0-9_]+') + + if !empty(l:variable) + execute('help ' . l:variable) + endif +endfunction + +" Press space to open :help for an ALE Variable +nnoremap :call ALEInfoOpenHelp() + +let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') +let b:undo_ftplugin .= ' | setlocal synmaxcol<' +let b:undo_ftplugin .= ' | execute "silent! unmap q"' +let b:undo_ftplugin .= ' | execute "silent! nunmap "' +let b:undo_ftplugin .= ' | delfunction! ALEInfoOpenHelp' diff --git a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim index 7ec84068..1ddd0abf 100644 --- a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim +++ b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim @@ -14,3 +14,18 @@ noremap O " Keybinds for opening selection items. noremap :call ale#preview#OpenSelection() noremap t :call ale#preview#OpenSelectionInTab() + +let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') +let b:undo_ftplugin .= ' | execute "silent! unmap q"' +let b:undo_ftplugin .= ' | execute "silent! unmap v"' +let b:undo_ftplugin .= ' | execute "silent! unmap i"' +let b:undo_ftplugin .= ' | execute "silent! unmap I"' +let b:undo_ftplugin .= ' | execute "silent! unmap "' +let b:undo_ftplugin .= ' | execute "silent! unmap "' +let b:undo_ftplugin .= ' | execute "silent! unmap "' +let b:undo_ftplugin .= ' | execute "silent! unmap a"' +let b:undo_ftplugin .= ' | execute "silent! unmap A"' +let b:undo_ftplugin .= ' | execute "silent! unmap o"' +let b:undo_ftplugin .= ' | execute "silent! unmap O"' +let b:undo_ftplugin .= ' | execute "silent! unmap "' +let b:undo_ftplugin .= ' | execute "silent! unmap t"' diff --git a/sources_non_forked/ale/ftplugin/ale-preview.vim b/sources_non_forked/ale/ftplugin/ale-preview.vim index ffbffbd5..75f3bb50 100644 --- a/sources_non_forked/ale/ftplugin/ale-preview.vim +++ b/sources_non_forked/ale/ftplugin/ale-preview.vim @@ -1,2 +1,5 @@ " Close the ALEPreviewWindow window with the q key. noremap q :q! + +let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') +let b:undo_ftplugin .= ' | execute "silent! unmap q"' diff --git a/sources_non_forked/ale/lspconfig.vim b/sources_non_forked/ale/lspconfig.vim new file mode 100644 index 00000000..0e25fdc2 --- /dev/null +++ b/sources_non_forked/ale/lspconfig.vim @@ -0,0 +1,3 @@ +if get(g:, 'lspconfig', 0) + " lspconfig is installed. +endif diff --git a/sources_non_forked/ale/lua/ale/diagnostics.lua b/sources_non_forked/ale/lua/ale/diagnostics.lua new file mode 100644 index 00000000..21f81e2a --- /dev/null +++ b/sources_non_forked/ale/lua/ale/diagnostics.lua @@ -0,0 +1,82 @@ +local module = {} + +local ale_type_to_diagnostic_severity = { + E = vim.diagnostic.severity.ERROR, + W = vim.diagnostic.severity.WARN, + I = vim.diagnostic.severity.INFO +} + +-- Equivalent to ale#Var, only we can't error on missing global keys. +module.aleVar = function(buffer, key) + key = "ale_" .. key + local exists, value = pcall(vim.api.nvim_buf_get_var, buffer, key) + + if exists then + return value + end + + return vim.g[key] +end + +module.sendAleResultsToDiagnostics = function(buffer, loclist) + local diagnostics = {} + + -- Convert all the ALE loclist items to the shape that Neovim's diagnostic + -- API is expecting. + for _, location in ipairs(loclist) do + if location.bufnr == buffer then + table.insert( + diagnostics, + -- All line numbers from ALE are 1-indexed, but all line numbers + -- in the diagnostics API are 0-indexed, so we have to subtract 1 + -- to make this work. + { + lnum = location.lnum - 1, + -- Ending line number, or if we don't have one, just make it the same + -- as the starting line number + end_lnum = (location.end_lnum or location.lnum) - 1, + -- Which column does the error start on? + col = math.max((location.col or 1) - 1, 0), + -- end_col does *not* appear to need 1 subtracted, so we don't. + end_col = location.end_col, + -- Which severity: error, warning, or info? + severity = ale_type_to_diagnostic_severity[location.type] or "E", + -- An error code + code = location.code, + -- The error message + message = location.text, + -- e.g. "rubocop" + source = location.linter_name, + } + ) + end + end + + local virtualtext_enabled_set = { + ['all'] = true, + ['2'] = true, + [2] = true, + ['current'] = true, + ['1'] = true, + [1] = true, + } + + local signs = module.aleVar(buffer, 'set_signs') == 1 + + if signs then + -- If signs are enabled, set the priority for them. + signs = {priority = vim.g.ale_sign_priority } + end + + vim.diagnostic.set( + vim.api.nvim_create_namespace('ale'), + buffer, + diagnostics, + { + virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil, + signs = signs, + } + ) +end + +return module diff --git a/sources_non_forked/ale/lua/ale/util.lua b/sources_non_forked/ale/lua/ale/util.lua new file mode 100644 index 00000000..98b3bbd9 --- /dev/null +++ b/sources_non_forked/ale/lua/ale/util.lua @@ -0,0 +1,14 @@ +local M = {} + +function M.configured_lspconfig_servers() + local configs = require 'lspconfig.configs' + local keys = {} + + for key, _ in pairs(configs) do + table.insert(keys, key) + end + + return keys +end + +return M diff --git a/sources_non_forked/ale/lua/diagnostics.lua b/sources_non_forked/ale/lua/diagnostics.lua deleted file mode 100644 index 9a3e1e4e..00000000 --- a/sources_non_forked/ale/lua/diagnostics.lua +++ /dev/null @@ -1,49 +0,0 @@ -local module = {} - -local ale_type_to_diagnostic_severity = { - E = vim.diagnostic.severity.ERROR, - W = vim.diagnostic.severity.WARN, - I = vim.diagnostic.severity.INFO -} - -module.sendAleResultsToDiagnostics = function(buffer, loclist) - local diagnostics = {} - - -- Convert all the ALE loclist items to the shape that Neovim's diagnostic - -- API is expecting. - for _, location in ipairs(loclist) do - table.insert( - diagnostics, - -- All line numbers from ALE are 1-indexed, but all line numbers - -- in the diagnostics API are 0-indexed, so we have to subtract 1 - -- to make this work. - { - lnum = location.lnum - 1, - -- Ending line number, or if we don't have one, just make it the same - -- as the starting line number - end_lnum = (location.end_lnum or location.lnum) - 1, - -- Which column does the error start on? - col = math.max((location.col or 1) - 1, 0), - -- end_col does *not* appear to need 1 subtracted, so we don't. - end_col = location.end_col, - -- Which severity: error, warning, or info? - severity = ale_type_to_diagnostic_severity[location.type] or "E", - -- The error message - message = location.text, - -- e.g. "rubocop" - source = location.linter_name, - } - ) - end - - local virtualtext_enabled_set = {['all'] = true, ['2'] = true, [2] = true, ['current'] = true, ['1'] = true, [1] = true} - - vim.diagnostic.set( - vim.api.nvim_create_namespace('ale'), - buffer, - diagnostics, - { virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil} - ) -end - -return module diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index f9b6cab8..47934fa0 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -14,6 +14,7 @@ let g:loaded_ale_dont_use_this_in_other_plugins_please = 1 " A flag for detecting if the required features are set. if has('nvim') + " We check for NeoVim 0.2.0+, but we only officially support NeoVim 0.6.0 let s:has_features = has('timers') && has('nvim-0.2.0') else " Check if Job and Channel functions are available, instead of the @@ -25,7 +26,7 @@ if !s:has_features " Only output a warning if editing some special files. if index(['', 'gitcommit'], &filetype) == -1 " no-custom-checks - echoerr 'ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel' + echoerr 'ALE requires NeoVim >= 0.6.0 or Vim 8 with +timers +job +channel' " no-custom-checks echoerr 'Please update your editor appropriately.' endif @@ -59,6 +60,10 @@ let g:ale_filetype_blacklist = [ let g:ale_linters = get(g:, 'ale_linters', {}) " This option can be changed to only enable explicitly selected linters. let g:ale_linters_explicit = get(g:, 'ale_linters_explicit', 0) +" Ignoring linters, for disabling some, or ignoring LSP diagnostics. +let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) +" Disabling all language server functionality. +let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 'auto') " This Dictionary configures which functions will be used for fixing problems. let g:ale_fixers = get(g:, 'ale_fixers', {}) @@ -191,9 +196,12 @@ 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')) +" If 0, save hidden files when code actions are applied. +let g:ale_save_hidden = get(g:, 'ale_save_hidden', 0) + " If 1, disables ALE's built in error display. Instead, all errors are piped " to the diagnostics API. -let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', 0) +let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', has('nvim-0.6')) if g:ale_use_neovim_diagnostics_api && !has('nvim-0.6') " no-custom-checks @@ -238,6 +246,8 @@ command! -bar ALEDisableBuffer :call ale#toggle#DisableBuffer(bufnr('')) command! -bar ALEResetBuffer :call ale#toggle#ResetBuffer(bufnr('')) " A command to stop all LSP-like clients, including tsserver. command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs() +" A command to stop a specific language server, or tsseserver. +command! -bar -bang -nargs=1 -complete=customlist,ale#lsp#reset#Complete ALEStopLSP :call ale#lsp#reset#StopLSP(, '') " A command for linting manually. command! -bar ALELint :call ale#Queue(0, 'lint_file') @@ -249,9 +259,9 @@ command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1) command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0) " Define a command to get information about current filetype. -command! -bar ALEInfo :call ale#debugging#Info() -" The same, but copy output to your clipboard. -command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard() +command! -bar -nargs=* ALEInfo :call ale#debugging#InfoCommand() +" Deprecated and scheduled for removal in 4.0.0. +command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboardDeprecatedCommand() " Copy ALE information to a file. command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile() @@ -349,6 +359,10 @@ nnoremap (ale_rename) :ALERename nnoremap (ale_filerename) :ALEFileRename nnoremap (ale_code_action) :ALECodeAction nnoremap (ale_repeat_selection) :ALERepeatSelection +nnoremap (ale_info) :ALEInfo +nnoremap (ale_info_echo) :ALEInfo -echo +nnoremap (ale_info_clipboard) :ALEInfo -clipboard +nnoremap (ale_info_preview) :ALEInfo -preview " Set up autocmd groups now. call ale#events#Init() diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 72b45671..6431cfe6 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -76,6 +76,7 @@ formatting. * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) + * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) @@ -110,6 +111,7 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * Cairo + * [scarb](https://docs.swmansion.com/scarb/) :floppy_disk: * [starknet](https://starknet.io/docs) * Chef * [cookstyle](https://docs.chef.io/cookstyle.html) @@ -177,6 +179,7 @@ formatting. * [dialyxir](https://github.com/jeremyjh/dialyxir) * [dogma](https://github.com/lpil/dogma) :floppy_disk: * [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: + * [lexical](https://github.com/lexical-lsp/lexical) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) @@ -389,6 +392,8 @@ formatting. * [mmc](http://mercurylang.org) :floppy_disk: * NASM * [nasm](https://www.nasm.us/) :floppy_disk: +* Nickel + * [nickel_format](https://github.com/tweag/nickel#formatting) * Nim * [nim check](https://nim-lang.org/docs/nimc.html) :floppy_disk: * [nimlsp](https://github.com/PMunch/nimlsp) @@ -513,6 +518,7 @@ formatting. * [refurb](https://github.com/dosisod/refurb) :floppy_disk: * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) * [ruff](https://github.com/charliermarsh/ruff) + * [ruff-format](https://docs.astral.sh/ruff/formatter/) * [unimport](https://github.com/hakancelik96/unimport) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) @@ -555,6 +561,7 @@ formatting. * [brakeman](http://brakemanscanner.org/) :floppy_disk: * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [debride](https://github.com/seattlerb/debride) + * [packwerk](https://github.com/Shopify/packwerk) :floppy_disk: * [prettier](https://github.com/prettier/plugin-ruby) * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk: * [reek](https://github.com/troessner/reek) @@ -595,6 +602,7 @@ formatting. * SML * [smlnj](http://www.smlnj.org/) * Solidity + * [forge](https://github.com/foundry-rs/forge) * [solc](https://solidity.readthedocs.io/) * [solhint](https://github.com/protofire/solhint) * [solium](https://github.com/duaraghav8/Solium) diff --git a/sources_non_forked/ale/syntax/ale-fix-suggest.vim b/sources_non_forked/ale/syntax/ale-fix-suggest.vim index b112f5b5..19734f4c 100644 --- a/sources_non_forked/ale/syntax/ale-fix-suggest.vim +++ b/sources_non_forked/ale/syntax/ale-fix-suggest.vim @@ -3,7 +3,7 @@ if exists('b:current_syntax') endif syn match aleFixerComment /^.*$/ -syn match aleFixerName /\(^\|, \)'[^']*'/ +syn match aleFixerName /\(^ *\|, \)'[^']*'/ syn match aleFixerHelp /^See :help ale-fix-configuration/ hi def link aleFixerComment Comment diff --git a/sources_non_forked/ale/syntax/ale-info.vim b/sources_non_forked/ale/syntax/ale-info.vim new file mode 100644 index 00000000..d47b58b8 --- /dev/null +++ b/sources_non_forked/ale/syntax/ale-info.vim @@ -0,0 +1,30 @@ +if exists('b:current_syntax') + finish +endif + +" Exhaustively list different ALE Info directives to match here. +" This should hopefully avoid matching too eagerly. +syn match aleInfoDirective /^ *Current Filetype:/ +syn match aleInfoDirective /^ *Available Linters:/ +syn match aleInfoDirective /^ *Enabled Linters:/ +syn match aleInfoDirective /^ *Ignored Linters:/ +syn match aleInfoDirective /^ *Suggested Fixers:/ +syn match aleInfoDirective /^ *Command History:/ + +syn match aleCommandNoOutput /^<<>>$/ + +hi def link aleInfoDirective Title +hi def link aleInfoDirective Title +hi def link aleCommandNoOutput Comment + +" Use Vim syntax highlighting for Vim options. +unlet! b:current_syntax +syntax include @srcVim syntax/vim.vim +syntax region aleInfoVimRegionLinter matchgroup=aleInfoDirective start="^ *Linter Variables:$" end="^ $" contains=@srcVim +syntax region aleInfoVimRegionGlobal matchgroup=aleInfoDirective start="^ *Global Variables:$" end="^ $" contains=@srcVim + +unlet! b:current_syntax +syntax include @srcAleFixSuggest syntax/ale-fix-suggest.vim +syntax region aleInfoFixSuggestRegion matchgroup=aleInfoDirective start="^ *Suggested Fixers:$" end="^ $" contains=@srcAleFixSuggest + +let b:current_syntax = 'ale-info' diff --git a/sources_non_forked/dracula/INSTALL.md b/sources_non_forked/dracula/INSTALL.md index 7fc0247d..52143b47 100644 --- a/sources_non_forked/dracula/INSTALL.md +++ b/sources_non_forked/dracula/INSTALL.md @@ -2,14 +2,13 @@ #### Install -These are the default instructions using Vim 8's `|packages|` feature. See -sections below, if you use other plugin managers. +These are the default instructions using Vim 8's `|packages|` feature. See sections below, if you use other plugin managers. 1. Create theme folder (in case you don't have it yet): +- `\*nix`: -- \*nix: -``` +```bash # vim 8.2+ mkdir -p ~/.vim/pack/themes/start # vim 8.0 @@ -21,9 +20,9 @@ mkdir -p ~/.vim/pack/themes/opt 2. Navigate to the folder above: +- `\*nix`: -- \*nix: -``` +```bash # vim 8.2+ cd ~/.vim/pack/themes/start # vim 8.0 @@ -34,9 +33,10 @@ cd ~/.vim/pack/themes/opt 3. Clone the repository using the "dracula" name: -``` +```bash git clone https://github.com/dracula/vim.git dracula ``` + (Or use your favorite GUI client, or download the ZIP) 4. Edit your `vimrc` file with the following content: @@ -50,16 +50,19 @@ colorscheme dracula ``` The location of the `vimrc` varies between platforms: -- \*nix: `~/.vim/vimrc` or `~/.vimrc` + +- `\*nix`: `~/.vim/vimrc` or `~/.vimrc` - Windows: `$HOME\vimfiles\vimrc` or `$HOME\_vimrc` #### Install using other plugin managers - If you [use vim + pathogen + submodules](http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/): -Navigate to your vim directory (\*nix: `~/.vim`; Windows: `$HOME\vimfiles`) +Navigate to your vim directory (`\*nix`: `~/.vim`; Windows: `$HOME\vimfiles`) - git submodule add git@github.com:dracula/vim.git bundle/dracula +```bash +git submodule add git@github.com:dracula/vim.git bundle/dracula +``` Place `colorscheme dracula` after `execute pathogen#infect()`. @@ -73,7 +76,7 @@ Plugin 'dracula/vim', { 'name': 'dracula' } Place `colorscheme dracula` after `call vundle#end()`. - If you [use vim-plug](https://github.com/junegunn/vim-plug) (\`as\` will install -the plugin in a directory called 'dracula' instead of just 'vim'): + the plugin in a directory called 'dracula' instead of just 'vim'): ```vim Plug 'dracula/vim', { 'as': 'dracula' } @@ -83,7 +86,7 @@ Plug 'dracula/vim', { 'as': 'dracula' } Place `colorscheme dracula` after `call plug#end()`. - If you [use spacevim](https://spacevim.org), put the -following in `~/.SpaceVim.d/init.toml`: + following in `~/.SpaceVim.d/init.toml`: ```toml [options] diff --git a/sources_non_forked/dracula/README.md b/sources_non_forked/dracula/README.md index d84d6db8..9d6ea3f7 100644 --- a/sources_non_forked/dracula/README.md +++ b/sources_non_forked/dracula/README.md @@ -4,8 +4,7 @@ ![Screenshot](./screenshot.png) -Screenshot taken with the [pangloss/vim-javascript](https://github.com/pangloss/vim-javascript) -syntax plugin for javascript. +Screenshot taken with the [pangloss/vim-javascript](https://github.com/pangloss/vim-javascript) syntax plugin for javascript. ## Install @@ -26,6 +25,10 @@ This theme is maintained by the following person(s) and a bunch of - [GitHub](https://github.com/dracula/dracula-theme/discussions) - Best for asking questions and discussing issues. - [Discord](https://draculatheme.com/discord-invite) - Best for hanging out with the community. +## Dracula PRO + +[![Dracula PRO](./dracula-pro.png)](https://draculatheme.com/pro) + ## License [MIT License](./LICENSE) diff --git a/sources_non_forked/dracula/colors/dracula.vim b/sources_non_forked/dracula/colors/dracula.vim index 9ec78c53..1725352f 100644 --- a/sources_non_forked/dracula/colors/dracula.vim +++ b/sources_non_forked/dracula/colors/dracula.vim @@ -210,6 +210,7 @@ else endif call s:h('DraculaDiffText', s:bg, s:orange) +call s:h('DraculaInlayHint', s:comment, s:bgdark) " }}}2 @@ -283,6 +284,7 @@ if has('nvim') hi! link LspDiagnosticsUnderlineHint DiagnosticUnderlineHint hi! link LspDiagnosticsUnderlineInformation DiagnosticUnderlineInfo hi! link LspDiagnosticsUnderlineWarning DiagnosticUnderlineWarn + hi! link LspInlayHint DraculaInlayHint hi! link DiagnosticInfo DraculaCyan hi! link DiagnosticHint DraculaCyan @@ -294,6 +296,24 @@ if has('nvim') hi! link DiagnosticUnderlineWarn DraculaWarnLine hi! link WinSeparator DraculaWinSeparator + + if has('nvim-0.9') + hi! link @lsp.type.class DraculaCyan + hi! link @lsp.type.decorator DraculaGreen + hi! link @lsp.type.enum DraculaCyan + hi! link @lsp.type.enumMember DraculaPurple + hi! link @lsp.type.function DraculaGreen + hi! link @lsp.type.interface DraculaCyan + hi! link @lsp.type.macro DraculaCyan + hi! link @lsp.type.method DraculaGreen + hi! link @lsp.type.namespace DraculaCyan + hi! link @lsp.type.parameter DraculaOrangeItalic + hi! link @lsp.type.property DraculaOrange + hi! link @lsp.type.struct DraculaCyan + hi! link @lsp.type.type DraculaCyanItalic + hi! link @lsp.type.typeParameter DraculaPink + hi! link @lsp.type.variable DraculaFg + endif else hi! link SpecialKey DraculaPink endif diff --git a/sources_non_forked/dracula/dracula-pro.png b/sources_non_forked/dracula/dracula-pro.png new file mode 100644 index 00000000..559212a7 Binary files /dev/null and b/sources_non_forked/dracula/dracula-pro.png differ diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim index 55d2dee4..c10c0366 100644 --- a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim @@ -190,7 +190,7 @@ function! s:parse(config_filename, target_filename, lines) endif return {'root': l:is_root, 'options': l:options} -endfunction! +endfunction " }}}1 " === Helpers =========================================================== {{{1 diff --git a/sources_non_forked/editorconfig-vim/doc/editorconfig.txt b/sources_non_forked/editorconfig-vim/doc/editorconfig.txt index 0d85a9e3..be234b06 100644 --- a/sources_non_forked/editorconfig-vim/doc/editorconfig.txt +++ b/sources_non_forked/editorconfig-vim/doc/editorconfig.txt @@ -1,36 +1,10 @@ -*editorconfig.txt* +*editorconfig.txt* EditorConfig plugin for vim. File: editorconfig.txt Version: 1.1.1 Maintainer: EditorConfig Team Description: EditorConfig vim plugin -License: - Copyright (c) 2011-2019 EditorConfig Team - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - CONTENTS~ *editorconfig-contents* ---------------------------------------------------------------------------- @@ -39,6 +13,7 @@ CONTENTS~ 3. Commands |editorconfig-commands| 4. Settings |editorconfig-settings| 5. Advanced |editorconfig-advanced| +6. License |editorconfig-license| OVERVIEW~ @@ -230,4 +205,34 @@ And add the following code to your .editorconfig file: Then try to open an Objective-C file, you will find the |filetype| is set to "objc". -vim:ft=help:tw=78 +License~ + *editorconfig-license* +---------------------------------------------------------------------------- + +License: + Copyright (c) 2011-2019 EditorConfig Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + +vim:ft=help:tw=78:cc= diff --git a/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim index 18addefa..76377269 100644 --- a/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim +++ b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim @@ -101,14 +101,14 @@ function! s:DisableShellSlash(bufnr) " {{{2 let l:shell = getbufvar(a:bufnr, '&shell') if has('win32') && empty(matchstr(l:shell, 'sh')) let s:old_shellslash = getbufvar(a:bufnr, '&shellslash') - setbufvar(a:bufnr, '&shellslash', 0) + call setbufvar(a:bufnr, '&shellslash', 0) endif endfunction " }}}2 function! s:ResetShellSlash(bufnr) " {{{2 " reset shellslash to the user-set value, if any if exists('s:old_shellslash') - setbufvar(a:bufnr, '&shellslash', s:old_shellslash) + call setbufvar(a:bufnr, '&shellslash', s:old_shellslash) unlet! s:old_shellslash endif endfunction " }}}2 @@ -454,7 +454,8 @@ function! s:ApplyConfig(bufnr, config) abort endif endif - if s:IsRuleActive('tab_width', a:config) + " Set tabstop. Skip this for terminal buffers, e.g., :FZF (#224). + if s:IsRuleActive('tab_width', a:config) && bufname(a:bufnr) !~# '^!\w*sh$' let l:tabstop = str2nr(a:config["tab_width"]) call setbufvar(a:bufnr, '&tabstop', l:tabstop) else diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index e1f09ca4..73e330c4 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -26,7 +26,11 @@ function! lightline#update() abort endif endfunction -if exists('*win_gettype') +if exists('*nvim_win_get_config') + function! s:skip() abort + return !nvim_win_get_config(0).focusable + endfunction +elseif exists('*win_gettype') function! s:skip() abort " Vim 8.2.0257 (00f3b4e007), 8.2.0991 (0fe937fd86), 8.2.0996 (40a019f157) return win_gettype() ==# 'popup' || win_gettype() ==# 'autocmd' endfunction diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/rosepine_moon.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/rosepine_moon.vim new file mode 100644 index 00000000..08bfc56e --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/rosepine_moon.vim @@ -0,0 +1,41 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/rosepine_moon.vim +" Author: lsculv (based on work by sheruost) +" License: MIT License +" Last Change: 2022/11/18 11:30:19. +" ============================================================================= + +" Reference: https://rosepinetheme.com/palette +" Rosé Pine Moon +let s:base = [ '#232136', 233 ] +let s:surface = [ '#2a273f', 234 ] + +let s:overlay = [ '#393552', 235 ] +let s:highlight_m = [ '#44415a', 59 ] +let s:muted = [ '#6e6a86', 60 ] +let s:subtle = [ '#908caa', 103 ] + +let s:iris = [ '#c4a7e7', 182 ] +let s:pine = [ '#3e8fb0', 30 ] +let s:foam = [ '#9ccfd8', 152 ] +let s:rose = [ '#ea9a97', 217 ] +let s:love = [ '#eb6f92', 204 ] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base, s:pine ], [ s:subtle, s:surface ] ] +let s:p.normal.right = [ [ s:overlay, s:subtle ], [ s:muted, s:overlay ], [ s:highlight_m, s:surface ] ] +let s:p.inactive.right = [ [ s:base, s:surface ], [ s:overlay, s:base ] ] +let s:p.inactive.left = [ [ s:overlay, s:base ], [ s:surface, s:base ] ] +let s:p.insert.left = [ [ s:base, s:foam ], [ s:subtle, s:surface ] ] +let s:p.replace.left = [ [ s:base, s:love ], [ s:subtle, s:surface ] ] +let s:p.visual.left = [ [ s:base, s:iris ], [ s:subtle, s:surface ] ] +let s:p.normal.middle = [ [ s:overlay, s:base ] ] +let s:p.inactive.middle = [ [ s:surface, s:base ] ] +let s:p.tabline.left = [ [ s:subtle, s:base ] ] +let s:p.tabline.tabsel = [ [ s:pine, s:base ] ] +let s:p.tabline.middle = [ [ s:surface, s:base ] ] +let s:p.tabline.right = copy(s:p.normal.right) +let s:p.normal.error = [ [ s:love, s:base ] ] +let s:p.normal.warning = [ [ s:rose, s:surface ] ] + +let g:lightline#colorscheme#rosepine_moon#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index 89a71574..0e7df04d 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -128,6 +128,10 @@ ![lightline.vim - rosepine_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/rosepine_light.png) +### rosepine_moon + +![lightline.vim - rosepine_moon](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/rosepine_moon.png) + ### srcery_drk ![lightline.vim - srcery_drk](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/srcery_drk.png) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 1e4e7bd0..ab1e89ea 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -3,7 +3,7 @@ Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2022/03/16 00:15:04. +Last Change: 2023/11/21 08:10:00. CONTENTS *lightline-contents* @@ -233,7 +233,7 @@ OPTIONS *lightline-option* Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor, landscape, one, materia, material, OldHope, nord, deus, simpleblack, srcery_drk, ayu_mirage, ayu_light, ayu_dark, - apprentice, rosepine, and 16color are available. + apprentice, rosepine, rosepine_moon, and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md index d2e3b7d4..911f4598 100644 --- a/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md +++ b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md @@ -5,18 +5,3 @@ Closes # +#### 7.1 +- **.0**: + - fix: typo in the docs. (bl4kraven) [#1390](https://github.com/preservim/nerdtree/pull/1390) + - feat: add NERDTreeExplore command. (msibal6) [#1389](https://github.com/preservim/nerdtree/pull/1389) + - fix: mapping description in NERDTree.txt. (roccomao) [#1393](https://github.com/preservim/nerdtree/pull/1393) +#### 7.0 +- **.1**: + - Fix NERDTreeFind to handle directory case sensitivity. (dangibson) [#1387](https://github.com/preservim/nerdtree/pull/1387) + - New Show file lines toggle. (hsnks100) [#1384](https://github.com/preservim/nerdtree/pull/1384) + - Add case sensitivity for refreshing nodes. (rzvxa) [#1382](https://github.com/preservim/nerdtree/pull/1382) + - Clarified the NERDTreeChangePermissions prompt. (rzvxa) [#1381](https://github.com/preservim/nerdtree/pull/1381) + - New reveal functionality for Windows. (rzvxa) [#1366](https://github.com/preservim/nerdtree/pull/1366) + - Fix bracket escaping in path names. (kai-patel) [#1359](https://github.com/preservim/nerdtree/pull/1359) + - Fix Case Sensitive Move Operation. (rzvxa) [#1375](https://github.com/preservim/nerdtree/pull/1375) + - New menu command for changing selected node permissions. (mjkloeckner) [#1348](https://github.com/preservim/nerdtree/pull/1348) + - Fix documentation errors. (BubuDavid) [#1372](https://github.com/preservim/nerdtree/pull/1372) + - Fix typo in nerdtree.vim file. (SandeshPyakurel) [#1380](https://github.com/preservim/nerdtree/pull/1380) +- **.0**: + - Now we warn about invalid files instead of ignoring them silently. (rmonico) [#1365](https://github.com/preservim/nerdtree/pull/1365) + - New g:NERDTreeWinPos options for top and bottom. (rzvxa) [#1363](https://github.com/preservim/nerdtree/pull/1363) + - Fix error in README. (nickspoons) [#1330](https://github.com/preservim/nerdtree/pull/1330) + - Fix typo in the documentation. (chapeupreto) [#1306](https://github.com/preservim/nerdtree/pull/1306) #### 6.10 - **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269) - **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266) diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 27aa3148..210ec312 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -1,9 +1,3 @@ -![Help Wanted](http://blog.ncce.org/wp-content/uploads/2013/12/help-wanted.jpg) - -**NERDTree** is on the lookout for a new maintainer. See [issue #1280](https://github.com/preservim/nerdtree/issues/1280) to submit your name for consideration. - ---- - # The NERDTree [![Vint](https://github.com/preservim/nerdtree/workflows/Vint/badge.svg)](https://github.com/preservim/nerdtree/actions?workflow=Vint) ## Introduction @@ -170,7 +164,7 @@ autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTa ```vim " If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. -autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | +autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif ``` @@ -178,7 +172,7 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_ ```vim " Open the existing NERDTree on each new tab. -autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif +autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif ``` or change your NERDTree-launching shortcut key like so: ```vim @@ -194,6 +188,28 @@ let g:NERDTreeDirArrowCollapsible = '?' ``` The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details. +### How can I show lines of files? + +```vim +let g:NERDTreeFileLines = 1 +``` + +Lines in the file are displayed as shown below. +``` +') command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('') + command! -n=? -complete=dir -bar NERDTreeExplore :call g:NERDTreeCreator.CreateExploreTree('') command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close() command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('') command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() @@ -685,6 +687,12 @@ function! s:toggleShowHidden() abort call b:NERDTree.ui.toggleShowHidden() endfunction +" FUNCTION: s:toggleShowFileLines() {{{1 +" toggles the display of hidden files +function! s:toggleShowFileLines() abort + call b:NERDTree.ui.toggleShowFileLines() +endfunction + " FUNCTION: s:toggleZoom() {{{1 function! s:toggleZoom() abort call b:NERDTree.ui.toggleZoom() diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 55c25cd1..9b8b6ba8 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -287,6 +287,7 @@ I........Toggle whether hidden files displayed......................|NERDTree-I| f........Toggle whether the file filters are used...................|NERDTree-f| F........Toggle whether files are displayed.........................|NERDTree-F| B........Toggle whether the bookmark table is displayed.............|NERDTree-B| +L........Toggle whether the number of lines in files is displayed...|NERDTree-L| q........Close the NERDTree window..................................|NERDTree-q| A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A| @@ -601,6 +602,14 @@ Applies to: no restrictions. Toggles whether the bookmarks table is displayed. +------------------------------------------------------------------------------ + *NERDTree-L* +Default key: L +Map setting: *NERDTreeMapToggleFileLines* +Applies to: no restrictions. + +Toggles whether the number of lines in files is displayed. + ------------------------------------------------------------------------------ *NERDTree-q* Default key: q @@ -673,6 +682,9 @@ the NERDTree. These settings should be set in your vimrc, using `:let`. |NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering. +|NERDTreeCaseSensitiveFS| Tells the NERDTree whether or not it is + running in on a case sensitive file system. + |NERDTreeCaseSensitiveSort| Tells the NERDTree whether to be case sensitive or not when sorting nodes. @@ -808,6 +820,26 @@ Default: 3 This setting controls the "sensitivity" of the NERDTree auto centering. See |NERDTreeAutoCenter| for details. +------------------------------------------------------------------------------ + *NERDTreeCaseSensitiveFS* +Values: 0, 1, 2 or 3. +Default: 2. + +If set to 0, the NERDTree will interact with the file system without case +sensitivity. + +If set to 1, the NERDTree will interact with the file system in a case-sensitive +manner. + +If set to 2, the NERDTree assumes its case sensitivity from the OS it is +running on. It Will default to case-insensitive on Windows and macOS +machines and case-sensitive on everything else. Since it's not a foolproof +way of detection, NERDTree won't proceed with any write actions when +the destination is ambiguous. + +Setting it to 3 will perform just like 2, but without suppressing write +actions. + ------------------------------------------------------------------------------ *NERDTreeCaseSensitiveSort* Values: 0 or 1. @@ -1040,6 +1072,20 @@ This setting can be toggled dynamically, per tree, with the |NERDTree-F| mapping and is useful for drastically shrinking the tree when you are navigating to a different part of the tree. +------------------------------------------------------------------------------ + *NERDTreeShowFilesLines* +Values: 0 or 1. +Default: 0. + +If this setting is set to 1 then the NERDTree shows number of lines for each +file. + +This setting can be toggled dynamically, per tree, with the |NERDTree-L| +mapping. +Use one of the follow lines for this setting: > + let NERDTreeShowFilesLines=0 + let NERDTreeShowFilesLines=1 +< ------------------------------------------------------------------------------ *NERDTreeShowHidden* Values: 0 or 1. @@ -1128,7 +1174,7 @@ setting is used. ------------------------------------------------------------------------------ *NERDTreeWinPos* -Values: "left" or "right" +Values: "left", "right", "top" or "bottom" Default: "left". This setting is used to determine where NERDTree window is placed on the @@ -1138,6 +1184,13 @@ This setting makes it possible to use two different explorer plugins simultaneously. For example, you could have the taglist plugin on the left of the window and the NERDTree on the right. +When setting this variable to "top" or "bottom" make sure to also change the +|NERDTreeWinSize| to a more reasonable size. + +For example: +> + let g:NERDTreeWinSize = 15 +< ------------------------------------------------------------------------------ *NERDTreeWinSize* Values: a positive integer. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index b9d45dc9..7e1940b8 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -38,6 +38,29 @@ function! s:Creator.BufNamePrefix() return 'NERD_tree_' endfunction +" FUNCTION: s:Creator.CreateExploreTree(dir) {{{1 +function! s:Creator.CreateExploreTree(dir) + try + let path = g:NERDTreePath.New(a:dir) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo('Invalid directory name:' . a:dir) + return + endtry + + let creator = s:Creator.New() + if getbufinfo('%')[0].changed && !&hidden && !&autowriteall + let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright ' + let l:splitDirection = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'right' ? 'vertical' : '' + silent! execute l:splitLocation . l:splitDirection . ' new' + else + silent! execute 'enew' + endif + + call creator.createWindowTree(a:dir) + "we want windowTree buffer to disappear after moving to any other buffer + setlocal bufhidden=wipe +endfunction + " FUNCTION: s:Creator.CreateTabTree(a:name) {{{1 function! s:Creator.CreateTabTree(name) let creator = s:Creator.New() @@ -182,16 +205,17 @@ endfunction " Initialize the NERDTree window. Open the window, size it properly, set all " local options, etc. function! s:Creator._createTreeWin() - let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright ' + let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright ' + let l:splitDirection = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'right' ? 'vertical' : '' let l:splitSize = g:NERDTreeWinSize if !g:NERDTree.ExistsForTab() let t:NERDTreeBufName = self._nextBufferName() - silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new' + silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' new' silent! execute 'edit ' . t:NERDTreeBufName - silent! execute 'vertical resize '. l:splitSize + silent! execute l:splitDirection . ' resize '. l:splitSize else - silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split' + silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' split' silent! execute 'buffer ' . t:NERDTreeBufName endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 997abf37..e0c1d954 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -65,6 +65,25 @@ function! s:Path.cacheDisplayString() abort let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest endif + if !self.isDirectory && b:NERDTree.ui.getShowFileLines() != 0 + let l:bufname = self.str({'format': 'Edit'}) + let l:lines = 0 + if executable('wc') + let l:lines = split(system('wc -l "'.l:bufname.'"'))[0] + elseif nerdtree#runningWindows() + let l:lines = substitute(system('type "'.l:bufname.'" | find /c /v ""'), '\n', '', 'g') + else + let s:lines = readfile(l:bufname) + let l:lines = 0 + for s:line in s:lines + let l:lines += 1 + if l:lines >= 20000 + break + endif + endfor + endif + let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ('.l:lines.')' + endif if self.isReadOnly let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']' endif @@ -530,7 +549,7 @@ function! s:Path.isUnder(parent) return 0 endif for i in range(0, l:that_count-1) - if self.pathSegments[i] !=# a:parent.pathSegments[i] + if !nerdtree#pathEquals(self.pathSegments[i], a:parent.pathSegments[i]) return 0 endif endfor @@ -554,11 +573,7 @@ endfunction " Args: " path: the other path obj to compare this with function! s:Path.equals(path) - if nerdtree#runningWindows() - return self.str() ==? a:path.str() - else - return self.str() ==# a:path.str() - endif + return nerdtree#pathEquals(self.str(), a:path.str()) endfunction " FUNCTION: Path.New(pathStr) {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim index f5f76829..3fb38331 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -121,8 +121,14 @@ function! s:TreeDirNode.findNode(path) if a:path.equals(self.path) return self endif - if stridx(a:path.str(), self.path.str(), 0) ==# -1 - return {} + if nerdtree#caseSensitiveFS() + if stridx(a:path.str(), self.path.str(), 0) ==# -1 + return {} + endif + else + if stridx(tolower(a:path.str()), tolower(self.path.str()), 0) ==# -1 + return {} + endif endif if self.path.isDirectory @@ -278,6 +284,10 @@ function! s:TreeDirNode._glob(pattern, all) else let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',') + if nerdtree#runningWindows() + let l:pathSpec = substitute(l:pathSpec, "\\[\\(.*\\]\\)", "[[]\\1", "g") + endif + " On Windows, the drive letter may be removed by "fnamemodify()". if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash() let l:pathSpec = self.path.drive . l:pathSpec @@ -421,6 +431,7 @@ function! s:TreeDirNode._initChildren(silent) endif let invalidFilesFound = 0 + let invalidFiles = [] for i in files try let path = g:NERDTreePath.New(i) @@ -428,6 +439,7 @@ function! s:TreeDirNode._initChildren(silent) call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {}) catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ let invalidFilesFound += 1 + let invalidFiles += [i] endtry endfor @@ -437,7 +449,7 @@ function! s:TreeDirNode._initChildren(silent) call nerdtree#echo('') if invalidFilesFound - call nerdtree#echoWarning(invalidFilesFound . ' file(s) could not be loaded into the NERD tree') + call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', ')) endif return self.getChildCount() endfunction @@ -564,12 +576,13 @@ function! s:TreeDirNode.refresh() let files = self._glob('*', 1) + self._glob('.*', 0) let newChildNodes = [] let invalidFilesFound = 0 + let invalidFiles = [] for i in files try "create a new path and see if it exists in this nodes children let path = g:NERDTreePath.New(i) let newNode = self.getChild(path) - if newNode !=# {} + if newNode !=# {} && path.str() ==# newNode.path.str() call newNode.refresh() call add(newChildNodes, newNode) @@ -580,7 +593,8 @@ function! s:TreeDirNode.refresh() call add(newChildNodes, newNode) endif catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ - let invalidFilesFound = 1 + let invalidFilesFound += 1 + let invalidFiles += [i] endtry endfor @@ -589,7 +603,7 @@ function! s:TreeDirNode.refresh() call self.sortChildren() if invalidFilesFound - call nerdtree#echoWarning('some files could not be loaded into the NERD tree') + call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', ')) endif endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index a481ba47..dffdecde 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -103,6 +103,7 @@ function! s:UI._dumpHelp() let help .= '" '. g:NERDTreeMapToggleFilters .': file filters (' . (self.isIgnoreFilterEnabled() ? 'on' : 'off') . ")\n" let help .= '" '. g:NERDTreeMapToggleFiles .': files (' . (self.getShowFiles() ? 'on' : 'off') . ")\n" let help .= '" '. g:NERDTreeMapToggleBookmarks .': bookmarks (' . (self.getShowBookmarks() ? 'on' : 'off') . ")\n" + let help .= '" '. g:NERDTreeMapToggleFileLines .': files lines (' . (self.getShowFileLines() ? 'on' : 'off') . ")\n" " add quickhelp entries for each custom key map let help .= "\"\n\" ----------------------------\n" @@ -147,6 +148,7 @@ function! s:UI.New(nerdtree) let newObj._showFiles = g:NERDTreeShowFiles let newObj._showHidden = g:NERDTreeShowHidden let newObj._showBookmarks = g:NERDTreeShowBookmarks + let newObj._showFileLines = g:NERDTreeFileLines return newObj endfunction @@ -284,6 +286,11 @@ function! s:UI.getShowHidden() return self._showHidden endfunction +" FUNCTION: s:UI.getShowFileLines() {{{1 +function! s:UI.getShowFileLines() + return self._showFileLines +endfunction + " FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) " Replace multi-character DirArrows with a single space so the @@ -512,10 +519,22 @@ function! s:UI.toggleShowHidden() call self.centerView() endfunction +" FUNCTION: s:UI.toggleShowFileLines() {{{1 +" toggles the display of file lines +function! s:UI.toggleShowFileLines() + let self._showFileLines = !self._showFileLines + call self.nerdtree.root.refresh() + call self.renderViewSavingPosition() + call self.centerView() +endfunction + " FUNCTION: s:UI.toggleZoom() {{{1 " zoom (maximize/minimize) the NERDTree window function! s:UI.toggleZoom() if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed + setlocal nowinfixwidth + wincmd = + setlocal winfixwidth call nerdtree#exec('silent vertical resize '. g:NERDTreeWinSize, 1) let b:NERDTreeZoomed = 0 else diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 05bee60d..45126dde 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -23,8 +23,8 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) -if has('gui_mac') || has('gui_macvim') || has('mac') - call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) +if nerdtree#runningMac() + call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Finder', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'}) call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'}) endif @@ -35,6 +35,7 @@ if executable('xdg-open') endif if nerdtree#runningWindows() + call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Explorer', 'shortcut': 'r', 'callback': 'NERDTreeRevealInExplorer'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'}) endif @@ -45,6 +46,7 @@ call NERDTreeAddMenuItem({'text': (has('clipboard')?'copy (p)ath to clipboard':' if has('unix') || has('osx') call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'}) + call NERDTreeAddMenuItem({'text': '(C)hange node permissions', 'shortcut':'C', 'callback': 'NERDTreeChangePermissions'}) else call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'}) endif @@ -148,21 +150,41 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) let quotedFileName = fnameescape(a:newNodeName) let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) endif - " 1. ensure that a new buffer is loaded - call nerdtree#exec('badd ' . quotedFileName, 0) - " 2. ensure that all windows which display the just deleted filename - " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0) - call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) - call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) - " 3. We don't need a previous buffer anymore + let l:tempBufferName = 'NERDTreeRenameTempBuffer' + + " 1. swap deleted file buffer with a temporary one + " this step is needed to compensate for case insensitive filesystems + + " 1.1. create an intermediate(temporary) buffer + call nerdtree#exec('badd ' . l:tempBufferName, 0) + let l:tempBufNum = bufnr(l:tempBufferName) + " 1.2. ensure that all windows which display the just deleted filename + " display the new temp buffer. + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . l:tempBufferName . "' | endif", 0) + " 1.3. We don't need the deleted file buffer anymore try call nerdtree#exec('confirm bwipeout ' . a:bufNum, 0) catch " This happens when answering Cancel if confirmation is needed. Do nothing. endtry + + " 2. swap temporary buffer with the new filename buffer + " 2.1. create the actual new file buffer + call nerdtree#exec('badd ' . quotedFileName, 0) + + " 2.2. ensure that all windows which display the temporary buffer + " display a buffer for the new filename. + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . l:tempBufNum . " | exec ':e! " . editStr . "' | endif", 0) + call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) + call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) + " 2.3. We don't need the temporary buffer anymore + try + call nerdtree#exec('confirm bwipeout ' . l:tempBufNum, 0) + catch + " This happens when answering Cancel if confirmation is needed. Do nothing. + endtry endfunction "FUNCTION: NERDTreeAddNode(){{{1 @@ -205,7 +227,24 @@ function! NERDTreeMoveNode() let prompt = s:inputPrompt('move') let newNodePath = input(prompt, curNode.path.str(), 'file') while filereadable(newNodePath) - call nerdtree#echoWarning('This destination already exists. Try again.') + " allow renames with different casing when g:NERDTreeCaseSensitiveFS + " is set to either 0 or 3 and the 2 paths are equal + if (g:NERDTreeCaseSensitiveFS == 0 || g:NERDTreeCaseSensitiveFS == 3) && + \nerdtree#pathEquals(curNode.path.str(), newNodePath) + break + endif + + call nerdtree#echoWarning('This destination already exists, Try again.') + + " inform the user about the flag if we think it is a false positive + " when g:NERDTreeCaseSensitiveFS is set to 2 + if g:NERDTreeCaseSensitiveFS == 2 && + \!nerdtree#osDefaultCaseSensitiveFS() && + \nerdtree#pathEquals(curNode.path.str(), newNodePath) + echon "\n(If it is a false positive please consider assigning NERDTreeCaseSensitiveFS's value)" + endif + + " prompt the user again let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g') endwhile @@ -333,6 +372,29 @@ function! NERDTreeListNodeWin32() call nerdtree#echo('node not recognized') endfunction +" FUNCTION: NERDTreeChangePermissions() {{{1 +function! NERDTreeChangePermissions() + let l:node = g:NERDTreeFileNode.GetSelected() + let l:prompt = "change node permissions (chmod args): " + let l:newNodePerm = input(l:prompt) + + if !empty(l:node) + let l:path = l:node.path.str() + let l:cmd = 'chmod ' .. newNodePerm .. ' ' .. path + let l:error = split(system(l:cmd), '\n') + + if !empty(l:error) + call nerdtree#echo(l:error[0]) + endif + + call b:NERDTree.root.refresh() + call b:NERDTree.render() + return + endif + + call nerdtree#echo('node not recognized') +endfunction + " FUNCTION: NERDTreeCopyNode() {{{1 function! NERDTreeCopyNode() let currentNode = g:NERDTreeFileNode.GetSelected() @@ -453,6 +515,17 @@ function! NERDTreeExecuteFileLinux() call system('xdg-open ' . shellescape(l:node.path.str())) endfunction +" FUNCTION: NERDTreeRevealInExplorer() {{{1 +function! NERDTreeRevealInExplorer() + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return + endif + + call system('cmd.exe /c explorer /select, ' . shellescape(l:node.path.str())) +endfunction + " FUNCTION: NERDTreeExecuteFileWindows() {{{1 function! NERDTreeExecuteFileWindows() let l:node = g:NERDTreeFileNode.GetSelected() diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index ef60cca1..a4276701 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -29,6 +29,7 @@ set cpoptions&vim "SECTION: Initialize variable calls and other random constants {{{2 let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1) let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3) +let g:NERDTreeCaseSensitiveFS = get(g:, 'NERDTreeCaseSensitiveFS', 2) let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0) let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0) let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1) @@ -52,6 +53,8 @@ let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1 let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0) let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0) let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1) +let g:NERDTreeFileLines = get(g:, 'NERDTreeFileLines', 0) + if !nerdtree#runningWindows() && !nerdtree#runningCygwin() let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '▸') @@ -128,6 +131,7 @@ let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B') let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F') let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f') let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I') +let g:NERDTreeMapToggleFileLines = get(g:, 'NERDTreeMapToggleFileLines', 'L') let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A') let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u') let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U') @@ -142,6 +146,7 @@ call nerdtree#loadClassFiles() "============================================================ call nerdtree#ui_glue#setupCommands() + " SECTION: Auto commands {{{1 "============================================================ augroup NERDTree diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index c4197eef..6aae6f28 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -28,7 +28,7 @@ else hi! link NERDTreeNodeDelimiters Ignore endif -"highlighing for directory nodes and file nodes +"highlighting for directory nodes and file nodes syn match NERDTreeDirSlash #/# containedin=NERDTreeDir if g:NERDTreeDirArrowExpandable !=# '' diff --git a/sources_non_forked/nginx.vim/syntax/nginx.vim b/sources_non_forked/nginx.vim/syntax/nginx.vim index 04760e4a..d036c123 100644 --- a/sources_non_forked/nginx.vim/syntax/nginx.vim +++ b/sources_non_forked/nginx.vim/syntax/nginx.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: nginx.conf " Maintainer: Chris Aumann -" Last Change: Jan 25, 2023 +" Last Change: Nov 25, 2023 if exists("b:current_syntax") finish @@ -260,6 +260,7 @@ syn keyword ngxDirective hls_forward_args syn keyword ngxDirective hls_fragment syn keyword ngxDirective hls_mp4_buffer_size syn keyword ngxDirective hls_mp4_max_buffer_size +syn keyword ngxDirective http2 syn keyword ngxDirective http2_chunk_size syn keyword ngxDirective http2_body_preread_size syn keyword ngxDirective http2_idle_timeout @@ -271,6 +272,7 @@ syn keyword ngxDirective http2_push syn keyword ngxDirective http2_push_preload syn keyword ngxDirective http2_recv_buffer_size syn keyword ngxDirective http2_recv_timeout +syn keyword ngxDirective http3 syn keyword ngxDirective http3_hq syn keyword ngxDirective http3_max_concurrent_pushes syn keyword ngxDirective http3_max_concurrent_streams diff --git a/sources_non_forked/typescript-vim/syntax/typescript.vim b/sources_non_forked/typescript-vim/syntax/typescript.vim index 5ae37226..f2738166 100644 --- a/sources_non_forked/typescript-vim/syntax/typescript.vim +++ b/sources_non_forked/typescript-vim/syntax/typescript.vim @@ -224,110 +224,104 @@ syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparen " }}} " Define the default highlighting. -" For version 5.7 and earlier: only when not done already by this script -" For version 5.8 and later: only when an item doesn't have highlighting yet -" For version 8.1.1486 and later, and nvim 0.5.0 and later: only when not done already by this script (need to override vim's new typescript support) -if version >= 508 || !exists("did_typescript_syn_inits") - if version < 508 || has('patch-8.1.1486') || has('nvim-0.5.0') - let did_typescript_syn_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - "typescript highlighting - HiLink typescriptParameters Operator - HiLink typescriptSuperBlock Operator - - HiLink typescriptEndColons Exception - HiLink typescriptOpSymbols Operator - HiLink typescriptLogicSymbols Boolean - HiLink typescriptBraces Function - HiLink typescriptParens Operator - HiLink typescriptComment Comment - HiLink typescriptLineComment Comment - HiLink typescriptRefComment Include - HiLink typescriptRefS String - HiLink typescriptRefD String - HiLink typescriptDocComment Comment - HiLink typescriptCommentTodo Todo - HiLink typescriptCvsTag Function - HiLink typescriptDocTags Special - HiLink typescriptDocSeeTag Function - HiLink typescriptDocParam Function - HiLink typescriptStringS String - HiLink typescriptStringD String - HiLink typescriptStringB String - HiLink typescriptInterpolationDelimiter Delimiter - HiLink typescriptRegexpString String - HiLink typescriptGlobal Constant - HiLink typescriptCharacter Character - HiLink typescriptPrototype Type - HiLink typescriptConditional Conditional - HiLink typescriptBranch Conditional - HiLink typescriptIdentifier Identifier - HiLink typescriptStorageClass StorageClass - HiLink typescriptRepeat Repeat - HiLink typescriptStatement Statement - HiLink typescriptFuncKeyword Keyword - HiLink typescriptMessage Keyword - HiLink typescriptDeprecated Exception - HiLink typescriptError Error - HiLink typescriptParensError Error - HiLink typescriptParensErrA Error - HiLink typescriptParensErrB Error - HiLink typescriptParensErrC Error - HiLink typescriptReserved Keyword - HiLink typescriptOperator Operator - HiLink typescriptType Type - HiLink typescriptNull Type - HiLink typescriptNumber Number - HiLink typescriptFloat Number - HiLink typescriptDecorators Special - HiLink typescriptBoolean Boolean - HiLink typescriptLabel Label - HiLink typescriptSpecial Special - HiLink typescriptSource Special - HiLink typescriptGlobalObjects Special - HiLink typescriptGlobalNodeObjects Special - HiLink typescriptExceptions Special - - HiLink typescriptDomErrNo Constant - HiLink typescriptDomNodeConsts Constant - HiLink typescriptDomElemAttrs Label - HiLink typescriptDomElemFuncs PreProc - - HiLink typescriptHtmlElemAttrs Label - HiLink typescriptHtmlElemFuncs PreProc - - HiLink typescriptCssStyles Label - - " Ajax Highlighting - HiLink typescriptBrowserObjects Constant - - HiLink typescriptDOMObjects Constant - HiLink typescriptDOMMethods Function - HiLink typescriptDOMProperties Special - - HiLink typescriptAjaxObjects Constant - HiLink typescriptAjaxMethods Function - HiLink typescriptAjaxProperties Special - - HiLink typescriptFuncDef Title - HiLink typescriptFuncArg Special - HiLink typescriptFuncComma Operator - - HiLink typescriptHtmlEvents Special - HiLink typescriptHtmlElemProperties Special - - HiLink typescriptEventListenerKeywords Keyword - - HiLink typescriptNumber Number - HiLink typescriptPropietaryObjects Constant - - delcommand HiLink +if version < 508 + command -nargs=+ HiLink hi link +else + command -nargs=+ HiLink hi def link endif +"typescript highlighting +HiLink typescriptParameters Operator +HiLink typescriptSuperBlock Operator + +HiLink typescriptEndColons Exception +HiLink typescriptOpSymbols Operator +HiLink typescriptLogicSymbols Boolean +HiLink typescriptBraces Function +HiLink typescriptParens Operator +HiLink typescriptComment Comment +HiLink typescriptLineComment Comment +HiLink typescriptRefComment Include +HiLink typescriptRefS String +HiLink typescriptRefD String +HiLink typescriptDocComment Comment +HiLink typescriptCommentTodo Todo +HiLink typescriptCvsTag Function +HiLink typescriptDocTags Special +HiLink typescriptDocSeeTag Function +HiLink typescriptDocParam Function +HiLink typescriptStringS String +HiLink typescriptStringD String +HiLink typescriptStringB String +HiLink typescriptInterpolationDelimiter Delimiter +HiLink typescriptRegexpString String +HiLink typescriptGlobal Constant +HiLink typescriptCharacter Character +HiLink typescriptPrototype Type +HiLink typescriptConditional Conditional +HiLink typescriptBranch Conditional +HiLink typescriptIdentifier Identifier +HiLink typescriptStorageClass StorageClass +HiLink typescriptRepeat Repeat +HiLink typescriptStatement Statement +HiLink typescriptFuncKeyword Keyword +HiLink typescriptMessage Keyword +HiLink typescriptDeprecated Exception +HiLink typescriptError Error +HiLink typescriptParensError Error +HiLink typescriptParensErrA Error +HiLink typescriptParensErrB Error +HiLink typescriptParensErrC Error +HiLink typescriptReserved Keyword +HiLink typescriptOperator Operator +HiLink typescriptType Type +HiLink typescriptNull Type +HiLink typescriptNumber Number +HiLink typescriptFloat Number +HiLink typescriptDecorators Special +HiLink typescriptBoolean Boolean +HiLink typescriptLabel Label +HiLink typescriptSpecial Special +HiLink typescriptSource Special +HiLink typescriptGlobalObjects Special +HiLink typescriptGlobalNodeObjects Special +HiLink typescriptExceptions Special + +HiLink typescriptDomErrNo Constant +HiLink typescriptDomNodeConsts Constant +HiLink typescriptDomElemAttrs Label +HiLink typescriptDomElemFuncs PreProc + +HiLink typescriptHtmlElemAttrs Label +HiLink typescriptHtmlElemFuncs PreProc + +HiLink typescriptCssStyles Label + +" Ajax Highlighting +HiLink typescriptBrowserObjects Constant + +HiLink typescriptDOMObjects Constant +HiLink typescriptDOMMethods Function +HiLink typescriptDOMProperties Special + +HiLink typescriptAjaxObjects Constant +HiLink typescriptAjaxMethods Function +HiLink typescriptAjaxProperties Special + +HiLink typescriptFuncDef Title +HiLink typescriptFuncArg Special +HiLink typescriptFuncComma Operator + +HiLink typescriptHtmlEvents Special +HiLink typescriptHtmlElemProperties Special + +HiLink typescriptEventListenerKeywords Keyword + +HiLink typescriptNumber Number +HiLink typescriptPropietaryObjects Constant + +delcommand HiLink + " Define the htmltypescript for HTML syntax html.vim "syntax clear htmltypescript "syntax clear typescriptExpression diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim index 1e9fb799..93d9adcd 100644 --- a/sources_non_forked/vim-abolish/plugin/abolish.vim +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -377,7 +377,7 @@ function! s:find_command(cmd,flags,word) " beginning of the line, and we can't use position flags (e.g., /foo/e). " If we use :norm /pattern, we leave ourselves vulnerable to "press enter" " prompts (even with :silent). - let cmd = (a:cmd =~ '[?!]' ? '?' : '/') + let cmd = (a:cmd =~ '[?!]$' ? '?' : '/') let @/ = s:pattern(dict,opts.boundaries) if opts.flags == "" || !search(@/,'n') return "norm! ".cmd."\" diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.md similarity index 100% rename from sources_non_forked/vim-flake8/README.mdown rename to sources_non_forked/vim-flake8/README.md diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index c407b9be..921e0fdb 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -24,6 +24,14 @@ function! flake8#Flake8ShowError() call s:ShowErrorMessage() endfunction +function! flake8#Flake8NextError() + call s:JumpNextError() +endfunction + +function! flake8#Flake8PrevError() + call s:JumpPrevError() +endfunction + "" }}} "" ** internal ** {{{ @@ -199,7 +207,6 @@ function! s:Flake8() " {{{ endfunction " }}} - "" markers function! s:PlaceMarkers(results) " {{{ " in gutter? @@ -292,6 +299,57 @@ function! s:ShowErrorMessage() " {{{ echo let b:showing_message = 0 endif +endfunction " }}} + +function! s:JumpNextError() " {{{ + let l:cursorLine = getpos(".")[1] + if !exists('s:resultDict') + return + endif + + " Convert list of strings to ints + let l:lineList = [] + for line in keys(s:resultDict) + call insert(l:lineList, line+0) + endfor + + let l:sortedLineList = sort(l:lineList, 'n') + for line in l:sortedLineList + let l:line_int = line + 0 + if line > l:cursorLine + call cursor(line, 1) + call s:ShowErrorMessage() + return + endif + endfor + call cursor(l:cursorLine, 1) + echo "Reached last error!" + +endfunction " }}} + +function! s:JumpPrevError() " {{{ + let l:cursorLine = getpos(".")[1] + if !exists('s:resultDict') + return + endif + + " Convert list of strings to ints + let l:lineList = [] + for line in keys(s:resultDict) + call insert(l:lineList, line+0) + endfor + + let l:sortedLineList = reverse(sort(l:lineList, 'n')) + for line in l:sortedLineList + let l:line_int = line + 0 + if line < l:cursorLine + call cursor(line, 1) + call s:ShowErrorMessage() + return + endif + endfor + call cursor(l:cursorLine, 1) + echo "Reached first error!" endfunction " }}} diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 6e5095fc..19d2d08c 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -116,16 +116,15 @@ function! s:VersionCheck() abort elseif !fugitive#GitVersion(1, 8, 5) return 'return ' . string('echoerr "fugitive: Git 1.8.5 or newer required"') else + if exists('b:git_dir') && empty(b:git_dir) + unlet! b:git_dir + endif return '' 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 - endif let dir = call('FugitiveGitDir', a:000) if !empty(dir) && FugitiveWorkTree(dir, 1) is# 0 return 'return ' . string('echoerr "fugitive: ' . s:worktree_error . '"') @@ -349,7 +348,6 @@ function! fugitive#Wait(job_or_jobs, ...) abort sleep 1m endif else - let sleep = has('patch-8.2.2366') ? 'sleep! 1m' : 'sleep 1m' for job in jobs if ch_status(job) ==# 'open' call ch_close_in(job) @@ -362,7 +360,7 @@ function! fugitive#Wait(job_or_jobs, ...) abort break endif let i += 1 - exe sleep + sleep 1m endwhile endfor endif @@ -400,8 +398,8 @@ function! s:JobExecute(argv, jopts, stdin, callback, ...) abort let dict.job = jobstart(a:argv, a:jopts) if !empty(a:stdin) call chansend(dict.job, a:stdin) - call chanclose(dict.job, 'stdin') endif + call chanclose(dict.job, 'stdin') catch /^Vim\%((\a\+)\)\=:E475:/ let [dict.exit_status, dict.stdout, dict.stderr] = [122, [''], ['']] endtry @@ -889,9 +887,8 @@ function! s:SystemList(cmd) abort \ 'exit_cb': { j, code -> add(exit, code) }} let job = job_start(a:cmd, jopts) call ch_close_in(job) - let sleep = has('patch-8.2.2366') ? 'sleep! 1m' : 'sleep 1m' while ch_status(job) !~# '^closed$\|^fail$' || job_status(job) ==# 'run' - exe sleep + sleep 1m endwhile return [lines, exit[0]] else @@ -959,12 +956,6 @@ function! s:LinesError(...) abort return [r.exit_status ? [] : r.stdout, r.exit_status] endfunction -function! s:NullError(cmd) abort - let r = fugitive#Execute(a:cmd) - let list = r.exit_status ? [] : split(tr(join(r.stdout, "\1"), "\1\n", "\n\1"), "\1", 1)[0:-2] - return [list, s:JoinChomp(r.stderr), r.exit_status] -endfunction - function! s:TreeChomp(...) abort let r = call('fugitive#Execute', a:000) if !r.exit_status @@ -1006,7 +997,7 @@ function! s:StdoutToFile(out, cmd, ...) abort endif call ch_close_in(job) while ch_status(job) !~# '^closed$\|^fail$' || job_status(job) ==# 'run' - exe has('patch-8.2.2366') ? 'sleep! 1m' : 'sleep 1m' + sleep 1m endwhile return [join(readfile(err, 'b'), "\n"), exit[0]] finally @@ -1576,11 +1567,15 @@ function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) ab call s:QuickfixSet(a:nr, buffer, 'a') exe s:DoAutocmd('QuickFixCmdPost ' . event) - if a:first && len(s:QuickfixGet(a:nr)) - return (a:nr < 0 ? 'cfirst' : 'lfirst') - else - return 'exe' + if a:first + let list = s:QuickfixGet(a:nr) + for index in range(len(list)) + if list[index].valid + return (index+1) . (a:nr < 0 ? 'cfirst' : 'lfirst') + endif + endfor endif + return 'exe' endfunction function! fugitive#Cwindow() abort @@ -2626,8 +2621,8 @@ function! s:AddSection(label, lines, ...) abort call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines)) endfunction -function! s:QueryLog(refspec, limit) abort - let [log, exec_error] = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s'] + a:refspec + ['--']) +function! s:QueryLog(refspec, limit, dir) abort + let [log, exec_error] = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s'] + a:refspec + ['--'], a:dir) call map(log, 'split(v:val, "\t", 1)') call map(log, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}') let result = {'error': exec_error ? 1 : 0, 'overflow': 0, 'entries': log} @@ -2638,11 +2633,11 @@ function! s:QueryLog(refspec, limit) abort return result endfunction -function! s:QueryLogRange(old, new) abort +function! s:QueryLogRange(old, new, dir) abort if empty(a:old) || empty(a:new) return {'error': 2, 'overflow': 0, 'entries': []} endif - return s:QueryLog([a:old . '..' . a:new], 256) + return s:QueryLog([a:old . '..' . a:new], 256, a:dir) endfunction function! s:AddLogSection(label, log) abort @@ -2667,16 +2662,15 @@ let s:rebase_abbrevs = { \ 'b': 'break', \ } -function! fugitive#BufReadStatus(...) abort +function! fugitive#BufReadStatus(cmdbang) abort let amatch = s:Slash(expand('%:p')) unlet! b:fugitive_reltime b:fugitive_type try - doautocmd BufReadPre let config = fugitive#Config() - let cmd = [s:Dir()] - setlocal noreadonly modifiable nomodeline buftype=nowrite - if amatch !~# '^fugitive:' && s:cpath($GIT_INDEX_FILE !=# '' ? resolve(s:GitIndexFileEnv()) : fugitive#Find('.git/index')) !=# s:cpath(amatch) + let dir = s:Dir() + let cmd = [dir] + if amatch !~# '^fugitive:' && s:cpath($GIT_INDEX_FILE !=# '' ? resolve(s:GitIndexFileEnv()) : fugitive#Find('.git/index', dir)) !=# s:cpath(amatch) let cmd += [{'env': {'GIT_INDEX_FILE': FugitiveGitPath(amatch)}}] endif @@ -2684,20 +2678,29 @@ function! fugitive#BufReadStatus(...) abort call add(cmd, '--no-optional-locks') endif + let tree = s:Tree(dir) + if !empty(tree) + let status_cmd = cmd + ['status', '-bz'] + call add(status_cmd, fugitive#GitVersion(2, 11) ? '--porcelain=v2' : '--porcelain') + let status = fugitive#Execute(status_cmd, function('len')) + endif + + doautocmd BufReadPre + setlocal noreadonly modifiable nomodeline buftype=nowrite let b:fugitive_files = {'Staged': {}, 'Unstaged': {}} + let [staged, unstaged, untracked] = [[], [], []] let props = {} - if empty(s:Tree()) - let branch = FugitiveHead(0) - let head = FugitiveHead(11) - elseif fugitive#GitVersion(2, 11) - let cmd += ['status', '--porcelain=v2', '-bz'] - let [output, message, exec_error] = s:NullError(cmd) - if exec_error - throw 'fugitive: ' . message - endif + if !exists('status') + let branch = FugitiveHead(0, dir) + let head = FugitiveHead(11, dir) + elseif fugitive#Wait(status).exit_status + throw 'fugitive: ' . s:JoinChomp(status.stderr) + + elseif status.args[-1] ==# '--porcelain=v2' + let output = split(tr(join(status.stdout, "\1"), "\1\n", "\n\1"), "\1", 1)[0:-2] let i = 0 while i < len(output) let line = output[i] @@ -2737,15 +2740,11 @@ function! fugitive#BufReadStatus(...) abort elseif has_key(props, 'branch.oid') let head = props['branch.oid'][0:10] else - let head = FugitiveHead(11) - endif - else " git < 2.11 - let cmd += ['status', '--porcelain', '-bz'] - let [output, message, exec_error] = s:NullError(cmd) - if exec_error - throw 'fugitive: ' . message + let head = FugitiveHead(11, dir) endif + else + let output = split(tr(join(status.stdout, "\1"), "\1\n", "\n\1"), "\1", 1)[0:-2] while get(output, 0, '') =~# '^\l\+:' call remove(output, 0) endwhile @@ -2754,7 +2753,7 @@ function! fugitive#BufReadStatus(...) abort let head = split(head, '\.\.\.')[0] let branch = head elseif head ==# 'HEAD' || empty(head) - let head = FugitiveHead(11) + let head = FugitiveHead(11, dir) let branch = '' else let branch = head @@ -2786,14 +2785,13 @@ function! fugitive#BufReadStatus(...) abort endwhile endif + let diff_cmd = cmd + ['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix'] let diff = {'Staged': {'stdout': ['']}, 'Unstaged': {'stdout': ['']}} if len(staged) - let diff['Staged'] = - \ fugitive#Execute(['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix', '--cached'], function('len')) + let diff['Staged'] = fugitive#Execute(diff_cmd + ['--cached'], function('len')) endif if len(unstaged) - let diff['Unstaged'] = - \ fugitive#Execute(['-c', 'diff.suppressBlankEmpty=false', '-c', 'core.quotePath=false', 'diff', '--color=never', '--no-ext-diff', '--no-prefix'], function('len')) + let diff['Unstaged'] = fugitive#Execute(diff_cmd + ['--'] + map(copy(unstaged), 'tree . "/" . v:val.relative[0]'), function('len')) endif for dict in staged @@ -2850,10 +2848,10 @@ function! fugitive#BufReadStatus(...) abort let push_short = substitute(push_ref, '^refs/\w\+/', '', '') let pull_short = substitute(pull_ref, '^refs/\w\+/', '', '') - if isdirectory(fugitive#Find('.git/rebase-merge/')) - let rebasing_dir = fugitive#Find('.git/rebase-merge/') - elseif isdirectory(fugitive#Find('.git/rebase-apply/')) - let rebasing_dir = fugitive#Find('.git/rebase-apply/') + if isdirectory(fugitive#Find('.git/rebase-merge/', dir)) + let rebasing_dir = fugitive#Find('.git/rebase-merge/', dir) + elseif isdirectory(fugitive#Find('.git/rebase-apply/', dir)) + let rebasing_dir = fugitive#Find('.git/rebase-apply/', dir) endif let rebasing = [] @@ -2885,25 +2883,25 @@ function! fugitive#BufReadStatus(...) abort endif let sequencing = [] - if filereadable(fugitive#Find('.git/sequencer/todo')) - for line in reverse(readfile(fugitive#Find('.git/sequencer/todo'))) + if filereadable(fugitive#Find('.git/sequencer/todo', dir)) + for line in reverse(readfile(fugitive#Find('.git/sequencer/todo', dir))) let match = matchlist(line, '^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)') if len(match) && match[1] !~# 'exec\|merge\|label' call add(sequencing, {'type': 'Rebase', 'status': get(s:rebase_abbrevs, match[1], match[1]), 'commit': match[2], 'subject': match[3]}) endif endfor - elseif filereadable(fugitive#Find('.git/MERGE_MSG')) - if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD')) - let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--']).stdout[0] - call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG')), 0, '')}) - elseif filereadable(fugitive#Find('.git/REVERT_HEAD')) - let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--']).stdout[0] - call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG')), 0, '')}) + elseif filereadable(fugitive#Find('.git/MERGE_MSG', dir)) + if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD', dir)) + let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--'], dir).stdout[0] + call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')}) + elseif filereadable(fugitive#Find('.git/REVERT_HEAD', dir)) + let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--'], dir).stdout[0] + call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')}) endif endif let b:fugitive_diff = diff - if get(a:, 1, v:cmdbang) + if a:cmdbang unlet! b:fugitive_expanded endif let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}}) @@ -2916,7 +2914,7 @@ function! fugitive#BufReadStatus(...) abort if push_ref !=# pull_ref call s:AddHeader('Push', push_short) endif - if empty(s:Tree()) + if empty(tree) if get(fugitive#ConfigGetAll('core.bare', config), 0, '') !~# '^\%(false\|no|off\|0\|\)$' call s:AddHeader('Bare', 'yes') else @@ -2936,11 +2934,11 @@ function! fugitive#BufReadStatus(...) abort let staged_end = len(staged) ? line('$') : 0 let unique_push_ref = push_ref ==# pull_ref ? '' : push_ref - let unpushed_push = s:QueryLogRange(unique_push_ref, head) + let unpushed_push = s:QueryLogRange(unique_push_ref, head, dir) if get(props, 'branch.ab') =~# '^+0 ' let unpushed_pull = {'error': 0, 'overflow': 0, 'entries': []} else - let unpushed_pull = s:QueryLogRange(pull_ref, head) + let unpushed_pull = s:QueryLogRange(pull_ref, head, dir) endif " If the push ref is defined but nowhere to be found at the remote, " pretend it's the same as the pull ref @@ -2951,11 +2949,11 @@ function! fugitive#BufReadStatus(...) abort call s:AddLogSection('Unpushed to ' . pull_short, unpushed_pull) if unpushed_push.error && unpushed_pull.error && empty(rebasing) && \ !empty(push_remote . fetch_remote) - call s:AddLogSection('Unpushed to *', s:QueryLog([head, '--not', '--remotes'], 256)) + call s:AddLogSection('Unpushed to *', s:QueryLog([head, '--not', '--remotes'], 256, dir)) endif - call s:AddLogSection('Unpulled from ' . push_short, s:QueryLogRange(head, unique_push_ref)) + call s:AddLogSection('Unpulled from ' . push_short, s:QueryLogRange(head, unique_push_ref, dir)) if len(pull_ref) && get(props, 'branch.ab') !~# ' -0$' - call s:AddLogSection('Unpulled from ' . pull_short, s:QueryLogRange(head, pull_ref)) + call s:AddLogSection('Unpulled from ' . pull_short, s:QueryLogRange(head, pull_ref, dir)) endif setlocal nomodified readonly noswapfile @@ -3935,6 +3933,8 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort let job = jobstart(argv, extend(jobopts, { \ 'pty': state.pty, \ 'TERM': 'dumb', + \ 'stdout_buffered': pager, + \ 'stderr_buffered': pager, \ 'on_stdout': function('s:RunReceive', [state, tmp, 'out']), \ 'on_stderr': function('s:RunReceive', [state, tmp, 'err']), \ 'on_exit': function('s:RunClose', [state, tmp]), @@ -4123,6 +4123,7 @@ function! fugitive#CdComplete(A, L, P) abort endfunction function! fugitive#Cd(path, ...) abort + exe s:VersionCheck() let path = substitute(a:path, '^:/:\=\|^:(\%(top\|top,literal\|literal,top\|literal\))', '', '') if path !~# '^/\|^\a\+:\|^\.\.\=\%(/\|$\)' let dir = s:Dir() @@ -4278,20 +4279,20 @@ function! s:DoAutocmdChanged(dir) abort return '' endfunction -function! s:ReloadStatusBuffer(...) abort +function! s:ReloadStatusBuffer() abort if get(b:, 'fugitive_type', '') !=# 'index' return '' endif - let original_lnum = a:0 ? a:1 : line('.') + let original_lnum = line('.') let info = s:StageInfo(original_lnum) exe fugitive#BufReadStatus(0) call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0]) return '' endfunction -function! s:ReloadStatus(...) abort +function! s:ReloadStatus() abort call s:ExpireStatus(-1) - call s:ReloadStatusBuffer(a:0 ? a:1 : line('.')) + call s:ReloadStatusBuffer() exe s:DoAutocmdChanged(-1) return '' endfunction @@ -4322,25 +4323,22 @@ function! s:ReloadWinStatus(...) abort return endif if !exists('b:fugitive_reltime') - exe s:ReloadStatusBuffer() + exe call('s:ReloadStatusBuffer', a:000) return endif let t = b:fugitive_reltime if reltimestr(reltime(s:last_time, t)) =~# '-\|\d\{10\}\.' || \ reltimestr(reltime(get(s:last_times, s:Tree() . '/', t), t)) =~# '-\|\d\{10\}\.' - exe s:ReloadStatusBuffer() + exe call('s:ReloadStatusBuffer', a:000) endif endfunction -function! s:ReloadTabStatus(...) abort - let mytab = tabpagenr() - let tab = a:0 ? a:1 : mytab +function! s:ReloadTabStatus() abort let winnr = 1 - while winnr <= tabpagewinnr(tab, '$') - if getbufvar(tabpagebuflist(tab)[winnr-1], 'fugitive_type') ==# 'index' - execute 'tabnext '.tab + while winnr <= winnr('$') + if getbufvar(winbufnr(winnr), 'fugitive_type') ==# 'index' if winnr != winnr() - execute winnr.'wincmd w' + execute 'noautocmd' winnr.'wincmd w' let restorewinnr = 1 endif try @@ -4348,9 +4346,8 @@ function! s:ReloadTabStatus(...) abort finally if exists('restorewinnr') unlet restorewinnr - wincmd p + noautocmd wincmd p endif - execute 'tabnext '.mytab endtry endif let winnr += 1 @@ -5706,7 +5703,8 @@ function! s:GrepParseLine(options, quiet, dir, line) abort if entry.module !~# ':' let entry.filename = s:PathJoin(a:options.prefix, entry.module) else - let entry.filename = fugitive#Find(entry.module, a:dir) + let entry.filename = fugitive#Find(matchstr(entry.module, '^[^:]*:') . + \ substitute(matchstr(entry.module, ':\zs.*'), '/\=:', '/', 'g'), a:dir) endif return entry endfunction @@ -5964,6 +5962,7 @@ function! s:LogParse(state, dir, prefix, line) abort endfunction function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort + exe s:VersionCheck() let dir = s:Dir() exe s:DirCheck(dir) let listnr = a:type =~# '^l' ? 0 : -1 @@ -6115,6 +6114,10 @@ function! s:OpenExpand(dir, file, wants_cmd) abort else let efile = s:Expand(a:file) endif + if efile =~# '^https\=://' + let [url, lnum] = s:ResolveUrl(efile, a:dir) + return [url, a:wants_cmd ? lnum : 0] + endif let url = s:Generate(efile, a:dir) if a:wants_cmd && a:file[0] ==# '>' && efile[0] !=# '>' && get(b:, 'fugitive_type', '') isnot# 'tree' && &filetype !=# 'netrw' let line = line('.') @@ -6667,6 +6670,7 @@ endfunction " Section: :GMove, :GRemove function! s:Move(force, rename, destination) abort + exe s:VersionCheck() let dir = s:Dir() exe s:DirCheck(dir) if s:DirCommitFile(@%)[1] !~# '^0\=$' || empty(@%) @@ -6740,6 +6744,7 @@ function! fugitive#RenameCommand(line1, line2, range, bang, mods, arg, ...) abor endfunction function! s:Remove(after, force) abort + exe s:VersionCheck() let dir = s:Dir() exe s:DirCheck(dir) if len(@%) && s:DirCommitFile(@%)[1] ==# '' @@ -7609,6 +7614,115 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor endtry endfunction +function! s:RemoteRefToLocalRef(repo, remote_url, ref_path) abort + let ref_path = substitute(a:ref_path, ':', '/', '') + let rev = '' + if ref_path =~# '^\x\{40,\}\%(/\|$\)' + let rev = substitute(ref_path, '/', ':', '') + elseif ref_path =~# '^[^:/^~]\+' + let first_component = matchstr(ref_path, '^[^:/^~]\+') + let lines = fugitive#Execute(['ls-remote', a:remote_url, first_component, first_component . '/*'], a:repo).stdout[0:-2] + for line in lines + let full = matchstr(line, "\t\\zs.*") + for candidate in [full, matchstr(full, '^refs/\w\+/\zs.*')] + if candidate ==# first_component || strpart(ref_path . '/', 0, len(candidate) + 1) ==# candidate . '/' + let rev = matchstr(line, '^\x\+') . substitute(strpart(ref_path, len(candidate)), '/', ':', '') + endif + endfor + endfor + endif + if empty(rev) + return '' + endif + let commitish = matchstr(rev, '^[^:^~]*') + let rev_parse = fugitive#Execute(['rev-parse', '--verify', commitish], a:repo) + if rev_parse.exit_status + if fugitive#Execute(['fetch', remote_url, commitish], a:repo).exit_status + return '' + endif + let rev_parse = fugitive#Execute(['rev-parse', '--verify', commitish], a:repo) + endif + if rev_parse.exit_status + return '' + endif + return rev_parse.stdout[0] . matchstr(rev, ':.*') +endfunction + +function! fugitive#ResolveUrl(target, ...) abort + let repo = call('s:Dir', a:000) + let origins = get(g:, 'fugitive_url_origins', {}) + let prefix = substitute(s:Slash(a:target), '#.*', '', '') + while prefix =~# '://' + let extracted = FugitiveExtractGitDir(expand(get(origins, prefix, ''))) + if !empty(extracted) + let repo = s:Dir(extracted) + break + endif + let prefix = matchstr(prefix, '.*\ze/') + endwhile + let git_dir = s:GitDir(repo) + for remote_name in keys(FugitiveConfigGetRegexp('^remote\.\zs.*\ze\.url$', repo)) + let remote_url = fugitive#RemoteUrl(remote_name, repo) + for [no_anchor; variant] in [[1, 'commit'], [1, 'tree'], [1, 'tree', 1], [1, 'blob', 1], [0, 'blob', 1, '1`line1`', '1`line1`'], [0, 'blob', 1, '1`line1`', '2`line2`']] + let handler_opts = { + \ 'git_dir': git_dir, + \ 'repo': {'git_dir': git_dir}, + \ 'remote': remote_url, + \ 'remote_name': remote_name, + \ 'commit': '1`commit`', + \ 'type': get(variant, 0), + \ 'path': get(variant, 1) ? '1`path`' : '', + \ 'line1': get(variant, 2), + \ 'line2': get(variant, 3)} + let url = '' + for l:.Handler in get(g:, 'fugitive_browse_handlers', []) + let l:.url = call(Handler, [copy(handler_opts)]) + if type(url) == type('') && url =~# '://' + break + endif + endfor + if type(url) != type('') || url !~# '://' + continue + endif + let keys = split(substitute(url, '\d`\(\w\+`\)\|.', '\1', 'g'), '`') + let pattern = substitute(url, '\d`\w\+`\|[][^$.*\~]', '\=len(submatch(0)) == 1 ? "\\" . submatch(0) : "\\([^#?&;]\\{-\\}\\)"', 'g') + let pattern = '^' . substitute(pattern, '^https\=:', 'https\\=:', '') . '$' + let target = s:Slash(no_anchor ? substitute(a:target, '#.*', '', '') : a:target) + let values = matchlist(s:Slash(a:target), pattern)[1:-1] + if empty(values) + continue + endif + let kvs = {} + for i in range(len(keys)) + let kvs[keys[i]] = values[i] + endfor + if has_key(kvs, 'commit') && has_key(kvs, 'path') + let ref_path = kvs.commit . '/' . kvs.path + elseif has_key(kvs, 'commit') && variant[0] ==# 'tree' + let ref_path = kvs.commit . '/' + elseif has_key(kvs, 'commit') + let ref_path = kvs.commit + else + continue + endif + let rev = s:RemoteRefToLocalRef(repo, remote_url, fugitive#UrlDecode(ref_path)) + return [fugitive#Find(rev, repo), empty(rev) ? 0 : +get(kvs, 'line1')] + endfor + endfor + return ['', 0] +endfunction + +function! s:ResolveUrl(target, ...) abort + try + let [url, lnum] = call('fugitive#ResolveUrl', [a:target] + a:000) + if !empty(url) + return [url, lnum] + endif + catch + endtry + return [substitute(a:target, '#.*', '', ''), 0] +endfunction + " Section: Maps let s:ref_header = '\%(Merge\|Rebase\|Upstream\|Pull\|Push\)' @@ -7784,7 +7898,7 @@ function! fugitive#MapJumps(...) abort exe s:Map('n', '<2-LeftMouse>', ':0,1Git ++curwin blame' . blame_tail, '') exe s:Map('n', '', ':0,1Git ++curwin blame' . blame_tail, '') exe s:Map('n', 'o', ':0,1Git blame' . blame_tail, '') - exe s:Map('n', 'p', ':0,1Git blame!' . blame_tail, '') + exe s:Map('n', 'p', ':0,1Git! blame' . blame_tail, '') if has('patch-7.4.1898') exe s:Map('n', 'gO', ':vertical 0,1Git blame' . blame_tail, '') exe s:Map('n', 'O', ':tab 0,1Git blame' . blame_tail, '') diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index c91c1048..d5d4300c 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -49,8 +49,9 @@ that are part of Git repositories). *fugitive-summary* :Git With no arguments, bring up a summary window vaguely - akin to git-status. Press g? or see |fugitive-maps| - for usage. + akin to git-status. If a summary window is already + open for the current repository, it is focused + instead. Press g? or see |fugitive-maps| for usage. *:Git_blame* :Git blame [flags] Run git-blame [flags] on the current file and open the @@ -71,6 +72,16 @@ that are part of Git repositories). p jump to patch or blob in preview window - reblame at commit + The maps |fugitive_P| and |fugitive_~| are also + supported to reblame on a parent commit, but this is + inherently fragile, as the line being blamed will no + longer exist. The preferred alternative is to use + to open up the commit, select the corresponding + `-` line that you care about, and press twice + more to reblame at that line. Viewing the commit also + gives you additional context as to why the line + changed. + *g:fugitive_dynamic_colors* In the GUI or a 256 color terminal, commit hashes will be highlighted in different colors. To disable this: diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 82e65bd3..cb9802a9 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -18,6 +18,7 @@ Features: * Stage partial hunks. * Provides a hunk text object. * Diffs against index (default) or any commit. +* Handles file moves / renames. * Heeds git's "assume unchanged" bit. * Allows folding all unchanged text. * Provides fold text showing whether folded lines have been changed. @@ -29,6 +30,7 @@ Features: * Fully customisable (signs, sign column, line (number) highlights, mappings, extra git-diff arguments, etc). * Can be toggled on/off, globally or per buffer. * Preserves signs from other plugins. +* Does the right thing when viewing revisions with [fugitive](https://github.com/tpope/vim-fugitive)'s `:0Gclog`. * Easy to integrate diff stats into status line; built-in integration with [vim-airline](https://github.com/bling/vim-airline/). * Works with fish shell (in addition to the usual shells). diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim index da1053d1..01bacdcd 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -46,8 +46,6 @@ function! gitgutter#process_buffer(bufnr, force) abort call gitgutter#debug#log('Not tracked: '.gitgutter#utility#file(a:bufnr)) catch /gitgutter assume unchanged/ call gitgutter#debug#log('Assume unchanged: '.gitgutter#utility#file(a:bufnr)) - catch /gitgutter file unknown in base/ - let diff = gitgutter#diff#hunk_header_showing_every_line_added(a:bufnr) catch /gitgutter diff failed/ call gitgutter#debug#log('Diff failed: '.gitgutter#utility#file(a:bufnr)) call gitgutter#hunk#reset(a:bufnr) @@ -197,6 +195,7 @@ function! s:clear(bufnr) call gitgutter#hunk#reset(a:bufnr) call s:reset_tick(a:bufnr) call gitgutter#utility#setbufvar(a:bufnr, 'path', '') + call gitgutter#utility#setbufvar(a:bufnr, 'basepath', '') endfunction @@ -223,13 +222,13 @@ function! gitgutter#quickfix(current_file) let lnum = 0 for line in diff if line =~ '^diff --git [^"]' - let paths = line[11:] - let mid = (len(paths) - 1) / 2 - let [fnamel, fnamer] = [paths[:mid-1], paths[mid+1:]] - let fname = fnamel ==# fnamer ? fnamel : fnamel[2:] + " No quotation mark therefore no spaces in filenames + let [fnamel, fnamer] = split(line)[2:3] + let fname = fnamel ==# fnamer ? fnamer : fnamer[2:] elseif line =~ '^diff --git "' + " Quotation mark therefore do not split on space let [_, fnamel, _, fnamer] = split(line, '"') - let fname = fnamel ==# fnamer ? fnamel : fnamel[2:] + let fname = fnamel ==# fnamer ? fnamer : fnamer[2:] elseif line =~ '^diff --cc [^"]' let fname = line[10:] elseif line =~ '^diff --cc "' @@ -251,7 +250,6 @@ endfunction function! gitgutter#difforig() let bufnr = bufnr('') - let path = gitgutter#utility#repo_path(bufnr, 1) let filetype = &filetype vertical new @@ -259,7 +257,7 @@ function! gitgutter#difforig() let &filetype = filetype if g:gitgutter_diff_relative_to ==# 'index' - let index_name = gitgutter#utility#get_diff_base(bufnr).':'.path + let index_name = gitgutter#utility#get_diff_base(bufnr).':'.gitgutter#utility#base_path(bufnr) let cmd = gitgutter#utility#cd_cmd(bufnr, \ gitgutter#git().' --no-pager show '.index_name \ ) @@ -267,7 +265,7 @@ function! gitgutter#difforig() " gitgutter#utility's use_known_shell() / restore_shell() functions. silent! execute "read ++edit !" cmd else - silent! execute "read ++edit" path + silent! execute "read ++edit" gitgutter#utility#repo_path(bufnr, 1) endif 0d_ diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 9e016a40..6325ca33 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -4,14 +4,6 @@ let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' -" True for git v1.7.2+. -function! s:git_supports_command_line_config_override() abort - call gitgutter#utility#system(gitgutter#git().' -c foo.bar=baz --version') - return !v:shell_error -endfunction - -let s:c_flag = s:git_supports_command_line_config_override() - let s:temp_from = tempname() let s:temp_buffer = tempname() let s:counter = 0 @@ -81,20 +73,6 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort throw 'gitgutter assume unchanged' endif - " If we are diffing against a specific branch/commit, handle the case - " where a file exists on the current branch but not in/at the diff base. - " We have to handle it here because the approach below (using git-show) - " doesn't work for this case. - if !empty(g:gitgutter_diff_base) - let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1) - let cmd = gitgutter#git().' --no-pager show '.index_name - let cmd = gitgutter#utility#cd_cmd(a:bufnr, cmd) - call gitgutter#utility#system(cmd) - if v:shell_error - throw 'gitgutter file unknown in base' - endif - endif - " Wrap compound commands in parentheses to make Windows happy. " bash doesn't mind the parentheses. let cmd = '(' @@ -137,8 +115,8 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort endif " Write file from index to temporary file. - let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1) - let cmd .= gitgutter#git().' --no-pager show --textconv '.index_name.' > '.from_file.' && ' + let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#base_path(a:bufnr) + let cmd .= gitgutter#git().' --no-pager show --textconv '.index_name.' > '.from_file.' || exit 0) && (' elseif a:from ==# 'working_tree' let from_file = gitgutter#utility#repo_path(a:bufnr, 1) @@ -146,7 +124,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " Call git-diff. let cmd .= gitgutter#git().' --no-pager' - if s:c_flag + if gitgutter#utility#git_supports_command_line_config_override() let cmd .= ' -c "diff.autorefreshindex=0"' let cmd .= ' -c "diff.noprefix=false"' let cmd .= ' -c "core.safecrlf=false"' @@ -176,9 +154,9 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort return 'async' else - let diff = gitgutter#utility#system(cmd) + let [diff, error_code] = gitgutter#utility#system(cmd) - if v:shell_error + if error_code call gitgutter#debug#log(diff) throw 'gitgutter diff failed' endif @@ -390,12 +368,6 @@ function! gitgutter#diff#hunk_diff(bufnr, full_diff, ...) endfunction -function! gitgutter#diff#hunk_header_showing_every_line_added(bufnr) - let buf_line_count = getbufinfo(a:bufnr)[0].linecount - return '@@ -0,0 +1,'.buf_line_count.' @@' -endfunction - - function! s:write_buffer(bufnr, file) let bufcontents = getbufline(a:bufnr, 1, '$') diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim index 45f3ccc5..7546917f 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -309,7 +309,7 @@ function! s:stage(hunk_diff) let cmd = gitgutter#utility#cd_cmd(bufnr, \ gitgutter#git().' add '. \ gitgutter#utility#shellescape(gitgutter#utility#filename(bufnr))) - call gitgutter#utility#system(cmd) + let [_, error_code] = gitgutter#utility#system(cmd) else return endif @@ -317,12 +317,12 @@ function! s:stage(hunk_diff) else let diff = s:adjust_header(bufnr, a:hunk_diff) " Apply patch to index. - call gitgutter#utility#system( + let [_, error_code] = gitgutter#utility#system( \ gitgutter#utility#cd_cmd(bufnr, gitgutter#git().' apply --cached --unidiff-zero - '), \ diff) endif - if v:shell_error + if error_code call gitgutter#utility#warn('Patch does not apply') else if exists('#User#GitGutterStage') diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim index f3bbd546..9c2b9c38 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -6,6 +6,15 @@ function! gitgutter#utility#supports_overscore_sign() endif endfunction +" True for git v1.7.2+. +function! gitgutter#utility#git_supports_command_line_config_override() abort + if !exists('s:c_flag') + let [_, error_code] = gitgutter#utility#system(gitgutter#git().' -c foo.bar=baz --version') + let s:c_flag = !error_code + endif + return s:c_flag +endfunction + function! gitgutter#utility#setbufvar(buffer, varname, val) let buffer = +a:buffer " Default value for getbufvar() was introduced in Vim 7.3.831. @@ -93,10 +102,13 @@ function! gitgutter#utility#system(cmd, ...) abort call gitgutter#debug#log(a:cmd, a:000) call s:use_known_shell() + let prev_error_code = v:shell_error silent let output = (a:0 == 0) ? system(a:cmd) : system(a:cmd, a:1) + let error_code = v:shell_error + silent call system('exit ' . prev_error_code) call s:restore_shell() - return output + return [output, error_code] endfunction function! gitgutter#utility#has_repo_path(bufnr) @@ -161,9 +173,9 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort return 'async' endif - let listing = gitgutter#utility#system(cmd) + let [listing, error_code] = gitgutter#utility#system(cmd) - if v:shell_error + if error_code call gitgutter#utility#setbufvar(a:bufnr, 'path', -2) return endif @@ -184,7 +196,7 @@ function! gitgutter#utility#clean_smudge_filter_applies(bufnr) let cmd = gitgutter#utility#cd_cmd(a:bufnr, \ gitgutter#git().' check-attr filter -- '. \ gitgutter#utility#shellescape(gitgutter#utility#filename(a:bufnr))) - let out = gitgutter#utility#system(cmd) + let [out, _] = gitgutter#utility#system(cmd) let filtered = out !~ 'unspecified' call gitgutter#utility#setbufvar(a:bufnr, 'filter', filtered) endif @@ -233,6 +245,87 @@ function! gitgutter#utility#get_diff_base(bufnr) return g:gitgutter_diff_base endfunction +" Returns the original path (shellescaped) at the buffer's diff base. +function! gitgutter#utility#base_path(bufnr) + let diffbase = gitgutter#utility#get_diff_base(a:bufnr) + + " If we already know the original path at this diff base, return it. + let basepath = gitgutter#utility#getbufvar(a:bufnr, 'basepath', '') + if !empty(basepath) + " basepath is diffbase:path + " Note that path can also contain colons. + " List destructuring / unpacking where the remaining items are assigned + " to a single variable (:help let-unpack) is only available in v8.2.0540. + let parts = split(basepath, ':', 1) + let base = parts[0] + let bpath = join(parts[1:], ':') + + if base == diffbase + return gitgutter#utility#shellescape(bpath) + endif + endif + + " Obtain buffers' paths. + let current_paths = {} + for bufnr in range(1, bufnr('$') + 1) + if gitgutter#utility#has_repo_path(bufnr) + let current_paths[gitgutter#utility#repo_path(bufnr, 0)] = bufnr + endif + endfor + + " Get a list of file renames at the buffer's diff base. + " Store the original paths on any corresponding buffers. + " If the buffer's file was one of them, return its original path. + let op = '' + let renames = s:obtain_file_renames(a:bufnr, diffbase) + for [current, original] in items(renames) + if has_key(current_paths, current) + let bufnr = current_paths[current] + let basepath = diffbase.':'.original + call gitgutter#utility#setbufvar(bufnr, 'basepath', basepath) + + if bufnr == a:bufnr + let op = original + endif + endif + endfor + if !empty(op) + return gitgutter#utility#shellescape(op) + endif + + " Buffer's file was not renamed, so store current path and return it. + let current_path = gitgutter#utility#repo_path(a:bufnr, 0) + let basepath = diffbase.':'.current_path + call gitgutter#utility#setbufvar(a:bufnr, 'basepath', basepath) + return gitgutter#utility#shellescape(current_path) +endfunction + +" Returns a dict of current path to original path at the given base. +function! s:obtain_file_renames(bufnr, base) + let renames = {} + let cmd = gitgutter#git() + if gitgutter#utility#git_supports_command_line_config_override() + let cmd .= ' -c "core.safecrlf=false"' + endif + let cmd .= ' diff --diff-filter=R --name-status '.a:base + let [out, error_code] = gitgutter#utility#system(gitgutter#utility#cd_cmd(a:bufnr, cmd)) + if error_code + " Assume the problem is the diff base. + call gitgutter#utility#warn('g:gitgutter_diff_base ('.a:base.') is invalid') + return {} + endif + for line in split(out, '\n') + let fields = split(line) + if len(fields) != 3 + call gitgutter#utility#warn('gitgutter: unable to list renamed files: '.line) + return {} + endif + let [original, current] = fields[1:] + let renames[current] = original + endfor + return renames +endfunction + function! s:abs_path(bufnr, shellesc) let p = resolve(expand('#'.a:bufnr.':p')) diff --git a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim index 678af341..a9b2340e 100644 --- a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim @@ -52,6 +52,7 @@ endfunction " function SetUp() + let g:gitgutter_diff_base = '' call system("git init ".s:test_repo. \ " && cd ".s:test_repo. \ " && cp ../.gitconfig .". @@ -195,6 +196,20 @@ function Test_filename_with_equals() endfunction +function Test_filename_with_colon() + call system('touch fix:ture.txt && git add fix:ture.txt') + edit fix:ture.txt + normal ggo* + call s:trigger_gitgutter() + + let expected = [ + \ {'lnum': 1, 'name': 'GitGutterLineAdded'}, + \ {'lnum': 2, 'name': 'GitGutterLineAdded'} + \ ] + call s:assert_signs(expected, 'fix:ture.txt') +endfunction + + function Test_filename_with_square_brackets() call system('touch fix[tu]re.txt && git add fix[tu]re.txt') edit fix[tu]re.txt @@ -280,6 +295,29 @@ function Test_saveas() endfunction +function Test_file_mv() + call system('git mv fixture.txt fixture_moved.txt') + edit fixture_moved.txt + normal ggo* + call s:trigger_gitgutter() + let expected = [{'lnum': 2, 'name': 'GitGutterLineAdded'}] + call s:assert_signs(expected, 'fixture_moved.txt') + + write + call system('git add fixture_moved.txt && git commit -m "moved and edited"') + GitGutterDisable + GitGutterEnable + let expected = [] + call s:assert_signs(expected, 'fixture_moved.txt') + + GitGutterDisable + let g:gitgutter_diff_base = 'HEAD^' + GitGutterEnable + let expected = [{'lnum': 2, 'name': 'GitGutterLineAdded'}] + call s:assert_signs(expected, 'fixture_moved.txt') +endfunction + + " FIXME: this test fails when it is the first (or only) test to be run function Test_follow_symlink() let tmp = 'symlink' @@ -382,8 +420,7 @@ endfunction function Test_file_unknown_in_base() - let starting_branch = system('git branch --show-current') - let starting_branch = 'main' + let starting_branch = split(system('git branch --show-current'))[0] call system('git checkout -b some-feature') let tmp = 'file-on-this-branch-only.tmp' call system('echo "hi" > '.tmp.' && git add '.tmp) @@ -396,6 +433,27 @@ function Test_file_unknown_in_base() endfunction +function Test_v_shell_error_not_clobbered() + " set gitgutter up to generate a shell error + let starting_branch = split(system('git branch --show-current'))[0] + call system('git checkout -b some-feature') + let tmp = 'file-on-this-branch-only.tmp' + call system('echo "hi" > '.tmp.' && git add '.tmp) + execute 'edit '.tmp + let g:gitgutter_diff_base = starting_branch + + " run a successful shell command + silent !echo foobar >/dev/null + + " run gitgutter + GitGutter + + call assert_equal(0, v:shell_error) + + let g:gitgutter_diff_base = '' +endfunction + + function Test_hunk_outside_noop() 5 GitGutterStageHunk diff --git a/sources_non_forked/vim-markdown/README.md b/sources_non_forked/vim-markdown/README.md index 08abbfde..250d3e5a 100644 --- a/sources_non_forked/vim-markdown/README.md +++ b/sources_non_forked/vim-markdown/README.md @@ -349,6 +349,27 @@ The following options control which syntax extensions will be turned on. They ar let g:vim_markdown_edit_url_in = 'tab' +### Borderless tables + +- `g:vim_markdown_borderless_table` + + Add support for borderless tables, such as: + ``` + header 1|header 2 + --|-- + data 1|data 2 + ``` + if set to `1`: + + let g:vim_markdown_borderless_table = 1 + + the table would be formatted as usual: + ``` + | header 1 | header 2 | + |----------|----------| + | data 1 | data 2 | + ``` + ## Mappings The following work on normal and visual modes: diff --git a/sources_non_forked/vim-markdown/doc/vim-markdown.txt b/sources_non_forked/vim-markdown/doc/vim-markdown.txt index 438a23dd..4aa8270c 100644 --- a/sources_non_forked/vim-markdown/doc/vim-markdown.txt +++ b/sources_non_forked/vim-markdown/doc/vim-markdown.txt @@ -490,6 +490,30 @@ Change how to open new files ~ > let g:vim_markdown_edit_url_in = 'tab' < +------------------------------------------------------------------------------- + *vim-markdown-support-borderless-tables* +Support borderless tables ~ + + *g:vim_markdown_borderless_table* +- 'g:vim_markdown_borderless_table' + + Add support for borderless tables, such as: +> + header 1|header 2 + --|-- + data 1|data 2 +< + if set to 1: +> + let g:vim_markdown_borderless_table = 1 +< + the table would be formatted as usual: +> + | header 1 | header 2 | + |----------|----------| + | data 1 | data 2 | +< + =============================================================================== *vim-markdown-mappings* Mappings ~ diff --git a/sources_non_forked/vim-markdown/ftplugin/markdown.vim b/sources_non_forked/vim-markdown/ftplugin/markdown.vim index 60505cd3..de239db4 100644 --- a/sources_non_forked/vim-markdown/ftplugin/markdown.vim +++ b/sources_non_forked/vim-markdown/ftplugin/markdown.vim @@ -1,6 +1,6 @@ "TODO print messages when on visual mode. I only see VISUAL, not the messages. -" Function interface phylosophy: +" Function interface philosophy: " " - functions take arbitrary line numbers as parameters. " Current cursor line is only a suitable default parameter. @@ -56,7 +56,7 @@ let s:levelRegexpDict = { \ 6: '\v^######[^#]@=' \ } -" Maches any header level of any type. +" Matches any header level of any type. " " This could be deduced from `s:levelRegexpDict`, but it is more " efficient to have a single regexp for this. @@ -538,6 +538,19 @@ endfunction " function! s:TableFormat() let l:pos = getpos('.') + + if get(g:, 'vim_markdown_borderless_table', 0) + " add `|` to the beginning of the line if it isn't present + normal! { + call search('|') + execute 'silent .,''}s/\v^(\s{0,})\|?([^\|])/\1|\2/e' + + " add `|` to the end of the line if it isn't present + normal! { + call search('|') + execute 'silent .,''}s/\v([^\|])\|?(\s{0,})$/\1|\2/e' + endif + normal! { " Search instead of `normal! j` because of the table at beginning of file edge case. call search('|') @@ -719,7 +732,7 @@ if !exists('*s:EditUrlUnderCursor') execute l:editmethod l:url endif if l:anchor !=# '' - silent! execute '/'.l:anchor + call search(l:anchor, 's') endif else execute l:editmethod . ' ' @@ -765,7 +778,7 @@ endif command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(, ) command! -buffer -range=% HeaderIncrease call s:HeaderDecrease(, , 1) command! -buffer -range=% SetexToAtx call s:SetexToAtx(, ) -command! -buffer TableFormat call s:TableFormat() +command! -buffer -range TableFormat call s:TableFormat() command! -buffer Toc call s:Toc() command! -buffer Toch call s:Toc('horizontal') command! -buffer Tocv call s:Toc('vertical') diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 4d54d3c3..37494832 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -86,14 +86,14 @@ syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained "HTML headings -syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell -syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell -syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell +syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=@mkdHeadingContent,@Spell +syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=@mkdHeadingContent,@Spell +syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=@mkdHeadingContent,@Spell +syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=@mkdHeadingContent,@Spell +syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=@mkdHeadingContent,@Spell +syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=@mkdHeadingContent,@Spell +syn match htmlH1 /^.\+\n=\+$/ contains=@mkdHeadingContent,@Spell +syn match htmlH2 /^.\+\n-\+$/ contains=@mkdHeadingContent,@Spell "define Markdown groups syn match mkdLineBreak / \+$/ @@ -156,6 +156,7 @@ if get(g:, 'vim_markdown_strikethrough', 0) HtmlHiLink mkdStrike htmlStrike endif +syn cluster mkdHeadingContent contains=htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdLink,mkdInlineURL,mkdStrike syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath,mkdStrike "highlighting for Markdown groups diff --git a/sources_non_forked/vim-markdown/test/strikethrough.vader b/sources_non_forked/vim-markdown/test/strikethrough.vader new file mode 100644 index 00000000..4fe392ab --- /dev/null +++ b/sources_non_forked/vim-markdown/test/strikethrough.vader @@ -0,0 +1,41 @@ +Before: + let g:vim_markdown_strikethrough = 1 + syn off | syn on + +After: + unlet! g:vim_markdown_strikethrough + +Given markdown; +a ~~b~~ c + +Execute (strikethrough): + AssertNotEqual SyntaxOf('a'), 'mkdStrike' + AssertEqual SyntaxOf('b'), 'mkdStrike' + AssertNotEqual SyntaxOf('c'), 'mkdStrike' + +Given markdown; +# ~~h1~~ +## ~~h2~~ +### ~~h3~~ +#### ~~h4~~ +##### ~~h5~~ +###### ~~h6~~ + +Execute (strikethrough in atx headings): + AssertEqual SyntaxOf('h1'), 'mkdStrike' + AssertEqual SyntaxOf('h2'), 'mkdStrike' + AssertEqual SyntaxOf('h3'), 'mkdStrike' + AssertEqual SyntaxOf('h4'), 'mkdStrike' + AssertEqual SyntaxOf('h5'), 'mkdStrike' + AssertEqual SyntaxOf('h6'), 'mkdStrike' + +Given markdown; +~~h1~~ += + +~~h2~~ +- + +Execute (strikethrough in setext headings): + AssertEqual SyntaxOf('h1'), 'mkdStrike' + AssertEqual SyntaxOf('h2'), 'mkdStrike' diff --git a/sources_non_forked/vim-markdown/test/syntax.vader b/sources_non_forked/vim-markdown/test/syntax.vader index 3d1a9911..b111de0d 100644 --- a/sources_non_forked/vim-markdown/test/syntax.vader +++ b/sources_non_forked/vim-markdown/test/syntax.vader @@ -1302,3 +1302,227 @@ Execute (HTML tag in text): AssertEqual SyntaxOf('span'), 'htmlTagName' AssertEqual SyntaxOf(''), 'htmlTag' AssertEqual SyntaxOf(''), 'htmlEndTag' + +Given markdown; +# _h1_ + +## _h2_ + +### _h3_ + +#### _h4_ + +##### _h5_ + +###### _h6_ + +Execute (underscore italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + AssertEqual SyntaxOf('h3'), 'htmlItalic' + AssertEqual SyntaxOf('h4'), 'htmlItalic' + AssertEqual SyntaxOf('h5'), 'htmlItalic' + AssertEqual SyntaxOf('h6'), 'htmlItalic' + +Given markdown; +# *h1* + +## *h2* + +### *h3* + +#### *h4* + +##### *h5* + +###### *h6* + +Execute (asterisk italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + AssertEqual SyntaxOf('h3'), 'htmlItalic' + AssertEqual SyntaxOf('h4'), 'htmlItalic' + AssertEqual SyntaxOf('h5'), 'htmlItalic' + AssertEqual SyntaxOf('h6'), 'htmlItalic' + +Given markdown; +_h1_ += + +_h2_ +- + +Execute (underscore italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + +Given markdown; +*h1* += + +*h2* +- + +Execute (asterisk italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlItalic' + AssertEqual SyntaxOf('h2'), 'htmlItalic' + +Given markdown; +# __h1__ + +## __h2__ + +### __h3__ + +#### __h4__ + +##### __h5__ + +###### __h6__ + +Execute (underscore bold text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + AssertEqual SyntaxOf('h3'), 'htmlBold' + AssertEqual SyntaxOf('h4'), 'htmlBold' + AssertEqual SyntaxOf('h5'), 'htmlBold' + AssertEqual SyntaxOf('h6'), 'htmlBold' + +Given markdown; +# **h1** + +## **h2** + +### **h3** + +#### **h4** + +##### **h5** + +###### **h6** + +Execute (asterisk bold text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + AssertEqual SyntaxOf('h3'), 'htmlBold' + AssertEqual SyntaxOf('h4'), 'htmlBold' + AssertEqual SyntaxOf('h5'), 'htmlBold' + AssertEqual SyntaxOf('h6'), 'htmlBold' + +Given markdown; +__h1__ += + +__h2__ +- + +Execute (underscore bold text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + +Given markdown; +**h1** += + +**h2** +- + +Execute (asterisk bold text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBold' + AssertEqual SyntaxOf('h2'), 'htmlBold' + +Given markdown; +# ___h1___ + +## ___h2___ + +### ___h3___ + +#### ___h4___ + +##### ___h5___ + +###### ___h6___ + +Execute (underscore bold italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h3'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h4'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h5'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h6'), 'htmlBoldItalic' + +Given markdown; +# ***h1*** + +## ***h2*** + +### ***h3*** + +#### ***h4*** + +##### ***h5*** + +###### ***h6*** + +Execute (asterisk bold italic text in atx headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h3'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h4'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h5'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h6'), 'htmlBoldItalic' + +Given markdown; +___h1___ += + +___h2___ +- + +Execute (underscore bold italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + +Given markdown; +***h1*** += + +***h2*** +- + +Execute (asterisk bold italic text in setext headings): + AssertEqual SyntaxOf('h1'), 'htmlBoldItalic' + AssertEqual SyntaxOf('h2'), 'htmlBoldItalic' + +Given markdown; +# [^h1] + +## [^h2] + +### [^h3] + +#### [^h4] + +##### [^h5] + +###### [^h6] + +Execute (footnotes in atx headings): + AssertEqual SyntaxOf('h1'), 'mkdFootnotes' + AssertEqual SyntaxOf('h2'), 'mkdFootnotes' + AssertEqual SyntaxOf('h3'), 'mkdFootnotes' + AssertEqual SyntaxOf('h4'), 'mkdFootnotes' + AssertEqual SyntaxOf('h5'), 'mkdFootnotes' + AssertEqual SyntaxOf('h6'), 'mkdFootnotes' + +Given markdown; +[^h1] += + +[^h2] +- + +Execute (footnotes in setext headings): + AssertEqual SyntaxOf('h1'), 'mkdFootnotes' + AssertEqual SyntaxOf('h2'), 'mkdFootnotes' diff --git a/sources_non_forked/vim-markdown/test/table-format.vader b/sources_non_forked/vim-markdown/test/table-format.vader index 82ce3f80..f7028cb0 100644 --- a/sources_non_forked/vim-markdown/test/table-format.vader +++ b/sources_non_forked/vim-markdown/test/table-format.vader @@ -68,3 +68,18 @@ Expect (preserve colons to align text): | left | right | center | | |:-----|------:|:------:|:--| | left | right | center | | + +Given markdown (borderless table); + left |right| center + :- | --: |:---: + left |right| center + +Execute (format borderless table): + let g:vim_markdown_borderless_table = 1 + TableFormat + unlet g:vim_markdown_borderless_table + +Expect (table with borders): + | left | right | center | + |:-----|------:|:------:| + | left | right | center | diff --git a/sources_non_forked/vim-ruby/autoload/rubycomplete.vim b/sources_non_forked/vim-ruby/autoload/rubycomplete.vim index 8eff8003..d62aa08b 100644 --- a/sources_non_forked/vim-ruby/autoload/rubycomplete.vim +++ b/sources_non_forked/vim-ruby/autoload/rubycomplete.vim @@ -2,7 +2,6 @@ " Language: Ruby " Maintainer: Mark Guzman " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -489,7 +488,7 @@ class VimRubyCompletion trail = "%s%s" % [ dir, sub ] tcfg = "%sconfig" % trail - if File.exists?( tcfg ) + if File.exist?( tcfg ) rails_base = trail break end @@ -502,7 +501,7 @@ class VimRubyCompletion bootfile = rails_base + "config/boot.rb" envfile = rails_base + "config/environment.rb" - if File.exists?( bootfile ) && File.exists?( envfile ) + if File.exist?( bootfile ) && File.exist?( envfile ) begin require bootfile require envfile diff --git a/sources_non_forked/vim-ruby/compiler/eruby.vim b/sources_non_forked/vim-ruby/compiler/eruby.vim index cb42a717..64fa2c1d 100644 --- a/sources_non_forked/vim-ruby/compiler/eruby.vim +++ b/sources_non_forked/vim-ruby/compiler/eruby.vim @@ -2,7 +2,6 @@ " Language: eRuby " Maintainer: Doug Kearns " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/sources_non_forked/vim-ruby/compiler/rake.vim b/sources_non_forked/vim-ruby/compiler/rake.vim index ba404c87..8dc468aa 100644 --- a/sources_non_forked/vim-ruby/compiler/rake.vim +++ b/sources_non_forked/vim-ruby/compiler/rake.vim @@ -2,7 +2,6 @@ " Language: Rake " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/sources_non_forked/vim-ruby/compiler/rspec.vim b/sources_non_forked/vim-ruby/compiler/rspec.vim index 06e4de42..a9b25c83 100644 --- a/sources_non_forked/vim-ruby/compiler/rspec.vim +++ b/sources_non_forked/vim-ruby/compiler/rspec.vim @@ -2,7 +2,6 @@ " Language: RSpec " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/sources_non_forked/vim-ruby/compiler/ruby.vim b/sources_non_forked/vim-ruby/compiler/ruby.vim index 64429a21..55c53640 100644 --- a/sources_non_forked/vim-ruby/compiler/ruby.vim +++ b/sources_non_forked/vim-ruby/compiler/ruby.vim @@ -3,7 +3,6 @@ " Function: Syntax check and/or error reporting " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/sources_non_forked/vim-ruby/compiler/rubyunit.vim b/sources_non_forked/vim-ruby/compiler/rubyunit.vim index ed0639b5..6d785056 100644 --- a/sources_non_forked/vim-ruby/compiler/rubyunit.vim +++ b/sources_non_forked/vim-ruby/compiler/rubyunit.vim @@ -2,7 +2,6 @@ " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("current_compiler") finish diff --git a/sources_non_forked/vim-ruby/ftplugin/eruby.vim b/sources_non_forked/vim-ruby/ftplugin/eruby.vim index f84ed7fe..3581eb8e 100644 --- a/sources_non_forked/vim-ruby/ftplugin/eruby.vim +++ b/sources_non_forked/vim-ruby/ftplugin/eruby.vim @@ -2,7 +2,6 @@ " Language: eRuby " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/sources_non_forked/vim-ruby/ftplugin/ruby.vim b/sources_non_forked/vim-ruby/ftplugin/ruby.vim index 07186d1e..841c4ec7 100644 --- a/sources_non_forked/vim-ruby/ftplugin/ruby.vim +++ b/sources_non_forked/vim-ruby/ftplugin/ruby.vim @@ -2,7 +2,6 @@ " Language: Ruby " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if (exists("b:did_ftplugin")) finish @@ -59,24 +58,38 @@ if !exists('g:ruby_version_paths') let g:ruby_version_paths = {} endif +let s:path_split = has('win32') ? ';' : ':' + function! s:query_path(root) abort - let code = "print $:.join %q{,}" - if &shell =~# 'sh' && empty(&shellxquote) - let prefix = 'env PATH='.shellescape($PATH).' ' - else - let prefix = '' + " Disabled by default for security reasons. + if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) || empty(a:root) + return map(split($RUBYLIB, s:path_split), 'v:val ==# "." ? "" : v:val') endif + let code = "print $:.join %q{,}" if &shellxquote == "'" - let path_check = prefix.'ruby --disable-gems -e "' . code . '"' + let args = ' --disable-gems -e "' . code . '"' else - let path_check = prefix."ruby --disable-gems -e '" . code . "'" + let args = " --disable-gems -e '" . code . "'" endif - let cd = haslocaldir() ? 'lcd' : 'cd' + let cd = haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd' let cwd = fnameescape(getcwd()) try exe cd fnameescape(a:root) - let path = split(system(path_check),',') + for dir in split($PATH, s:path_split) + if dir !=# '.' && executable(dir . '/ruby') == 1 + let exepath = dir . '/ruby' + break + endif + endfor + if exists('l:exepath') + let path = split(system(exepath . args),',') + if v:shell_error + let path = [] + endif + else + let path = [] + endif exe cd cwd return path finally @@ -117,10 +130,8 @@ else if !exists('g:ruby_default_path') if has("ruby") && has("win32") ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) ) - elseif executable('ruby') && !empty($HOME) - let g:ruby_default_path = s:query_path($HOME) else - let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val') + let g:ruby_default_path = s:query_path($HOME) endif endif let s:ruby_paths = g:ruby_default_path diff --git a/sources_non_forked/vim-ruby/indent/eruby.vim b/sources_non_forked/vim-ruby/indent/eruby.vim index 62cd6cfa..3cb07a44 100644 --- a/sources_non_forked/vim-ruby/indent/eruby.vim +++ b/sources_non_forked/vim-ruby/indent/eruby.vim @@ -2,7 +2,6 @@ " Language: eRuby " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("b:did_indent") finish diff --git a/sources_non_forked/vim-ruby/indent/ruby.vim b/sources_non_forked/vim-ruby/indent/ruby.vim index b65e3fd2..09b92a19 100644 --- a/sources_non_forked/vim-ruby/indent/ruby.vim +++ b/sources_non_forked/vim-ruby/indent/ruby.vim @@ -3,7 +3,6 @@ " Maintainer: Andrew Radev " Previous Maintainer: Nikolai Weibull " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns " 0. Initialization {{{1 " ================= diff --git a/sources_non_forked/vim-ruby/syntax/eruby.vim b/sources_non_forked/vim-ruby/syntax/eruby.vim index ab74c803..c0aed306 100644 --- a/sources_non_forked/vim-ruby/syntax/eruby.vim +++ b/sources_non_forked/vim-ruby/syntax/eruby.vim @@ -2,7 +2,6 @@ " Language: eRuby " Maintainer: Tim Pope " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns if exists("b:current_syntax") finish diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index c50cca2e..f52f3afc 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -2,7 +2,6 @@ " Language: Ruby " Maintainer: Doug Kearns " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato diff --git a/sources_non_forked/vim-snipmate/README.md b/sources_non_forked/vim-snipmate/README.md index 2072d7c5..ea7c9883 100644 --- a/sources_non_forked/vim-snipmate/README.md +++ b/sources_non_forked/vim-snipmate/README.md @@ -14,41 +14,34 @@ Originally authored by [Michael Sanders][msanders], SnipMate was forked in 2011 after a stagnation in development. This fork is currently maintained by [Rok Garbas][garbas], [Marc Weber][marcweber], and [Adnan Zafar][ajzafar]. - ## Installing SnipMate ## -We recommend one of the following methods for installing SnipMate and its -dependencies. SnipMate depends on [vim-addon-mw-utils][mw-utils] and -[tlib][tlib]. +SnipMate can be installed using a package manager or using Vim's built-in +package handling. It does depend on [vim-addon-mw-utils][mw-utils] and +optionally [tlib][tlib]. For example, to use Vim's built-in support, + + % mkdir -p ~/.vim/pack/SnipMate/start + % cd ~/.vim/pack/SnipMate/start + % git clone https://github.com/garbas/vim-snipmate.git + % git clone https://github.com/MarcWeber/vim-addon-mw-utils.git + + # Optional: + % git clone https://github.com/tomtom/tlib_vim.git + % git clone https://github.com/honza/vim-snippets.git > **NOTE:** SnipMate does not ship with any snippets out of the box. We suggest looking at the [vim-snippets][vim-snippets] repository. -* Using [VAM][vam], add `vim-snippets` to the list of packages to be installed. +If tlib is enabled, it is used for multisnip (`:h SnipMate-multisnip`). It's +also required for the `:SnipMateOpenSnippetFiles` command. -* Using [Pathogen][pathogen], run the following commands: - - % cd ~/.vim/bundle - % git clone https://github.com/tomtom/tlib_vim.git - % git clone https://github.com/MarcWeber/vim-addon-mw-utils.git - % git clone https://github.com/garbas/vim-snipmate.git - - # Optional: - % git clone https://github.com/honza/vim-snippets.git - -* Using [Vundle][vundle], add the following to your `vimrc` then run - `:PluginInstall` - - Plugin 'MarcWeber/vim-addon-mw-utils' - Plugin 'tomtom/tlib_vim' - Plugin 'garbas/vim-snipmate' - - " Optional: - Plugin 'honza/vim-snippets' +Remember to run `:helptags ALL` once your Vim has loaded SnipMate! ## Using SnipMate ## -Press and try :SnipMateOpenSnippetFiles for starting. -Also see doc/SnipMate.txt to learn all SnipMate + +Install and create some snippets (see `:h SnipMate-snippets`). Then type in the +trigger for one in the correct filetype and hit the expansion key (by default +bound to ``). ## FAQ ## @@ -116,6 +109,22 @@ be found in the docs at `:h SnipMate-parser-versions`. ## Release Notes ## +Some changes listed here were contributed by non-maintainers. A full list can be +found at [Contributors.md](Contributors.md). + +### Current ### + +- Make tlib an optional dependency. +- Add SnipLookupPre and SnipLookupPost autocommand events +- Make version 1 of the snippet parser the default with no message + +### 0.90 - 2023-12-29 ### + +- Remove empty lines at the end of a `${VISUAL}` expansion +- Fix code for opening folds when expanding a snippet +- Deprecate legacy snippet parser +- Fix jumps when `&sel == 'exclusive'` + ### 0.89 - 2016-05-29 ### * Various regex updates to legacy parser diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 9affc1d4..bd0276fa 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -3,12 +3,6 @@ if !exists('g:snipMate') let g:snipMate = {} endif -try - call tlib#input#List('mi', '', []) -catch /.*/ - echoe "tlib is missing. See install instructions at ".expand(':h:h').'/README.md' -endtry - fun! Filename(...) abort let filename = expand('%:t:r') if filename == '' | return a:0 == 2 ? a:2 : '' | endif @@ -26,6 +20,8 @@ function! snipMate#expandSnip(snip, version, col) abort if a:version == 1 let [snippet, b:snip_state.stops] = snipmate#parse#snippet(a:snip) + " only if zero stop doesn't exist + call s:add_zero_stop(snippet, b:snip_state.stops) " Build stop/mirror info let b:snip_state.stop_count = s:build_stops(snippet, b:snip_state.stops, lnum, col, indent) else @@ -57,6 +53,14 @@ function! snipMate#expandSnip(snip, version, col) abort return b:snip_state.set_stop(0) endfunction +function! s:add_zero_stop(snippet, stops) abort + if !exists("a:stops['0']") + let zero_stop = {'mirrors': [], 'placeholder': []} + call extend(a:snippet[-1], [[0, '', zero_stop]]) + call extend(a:stops, {'0': zero_stop}, 'keep') + endif +endfunction + function! s:insert_snippet_text(snippet, lnum, col, indent) let line = getline(a:lnum) let col = a:col @@ -147,10 +151,6 @@ function! s:build_stops(snippet, stops, lnum, col, indent) abort endif endfor - " add zero tabstop if it doesn't exist and then link it to the highest stop - " number - let stops[0] = get(stops, 0, - \ { 'placeholder' : [], 'line' : lnum, 'col' : col }) let stop_count = max(keys(stops)) + 2 let stops[stop_count - 1] = stops[0] @@ -175,6 +175,7 @@ function! s:build_loc_info(snippet, stops, lnum, col, seen_items) abort let stub.col = col call s:add_update_objects(stub, seen_items) + " if we've found a stop? if len(item) > 2 && type(item[1]) != type({}) let col = s:build_loc_info(item[1:-2], stops, lnum, col, seen_items) else @@ -211,7 +212,7 @@ fun! snipMate#ReadSnippetsFile(file) abort if !filereadable(a:file) | return [result, new_scopes] | endif let inSnip = 0 let line_no = 0 - let snipversion = get(g:snipMate, 'snippet_version', 0) + let snipversion = get(g:snipMate, 'snippet_version', 1) for line in readfile(a:file) + ["\n"] let line_no += 1 @@ -308,7 +309,7 @@ function! s:source_snippet() abort let new_snips = [] if fnamemodify(file, ':e') == 'snippet' call add(new_snips, [trigger, desc, join(readfile(file), "\n"), 0, - \ get(g:snipMate, 'snippet_version', 0)]) + \ get(g:snipMate, 'snippet_version', 1)]) else let [snippets, extends] = s:CachedSnips(file) let new_snips = deepcopy(snippets) @@ -421,6 +422,12 @@ function! s:snippet_dirs() abort endfunction function! snipMate#OpenSnippetFiles() abort + if !exists('g:loaded_tlib') || g:loaded_tlib < 41 + echom 'tlib is required for this command. ' + \ . 'Remember to run :packadd if necessary.' + return + endif + let files = [] let scopes_done = [] let exists = [] @@ -448,15 +455,50 @@ fun! snipMate#ScopesByFile() abort return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''") endf -" used by both: completion and insert snippet -fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort +function! snipMate#flatten_filter_empty(list) abort + let result = [] + for item in a:list + if type(item) == type([]) + call extend(result, snipMate#flatten_filter_empty(item)) + elseif !empty(item) + call extend(result, [item]) + endif + unlet item " Avoid E706 + endfor + return result +endf + +function! s:determine_lookups(word) abort + let b:snip_word = a:word + + " gather any lookups from the Pre au + if exists('#User#SnipLookupPre') + doautocmd User SnipLookupPre + endif + + " If none are found, add the standard lookups + if !exists('b:snip_lookups') || empty(b:snip_lookups) + let b:snip_lookups = s:standard_lookups(b:snip_word) + endif + + " Run the Post au + if exists('#User#SnipLookupPost') + doautocmd User SnipLookupPost + endif + + " return the appropriate data, deleting buffer variables. + let ret = b:snip_lookups + unlet! b:snip_lookups b:snip_word + return ret +endfunction + +function! s:standard_lookups(word) abort " Split non-word characters into their own piece " so 'foo.bar..baz' becomes ['foo', '.', 'bar', '.', '.', 'baz'] " First split just after a \W and then split each resultant string just " before a \W - let parts = filter(tlib#list#Flatten( - \ map(split(a:word, '\W\zs'), 'split(v:val, "\\ze\\W")')), - \ '!empty(v:val)') + let parts = snipMate#flatten_filter_empty( + \ map(split(a:word, '\W\zs'), 'split(v:val, "\\ze\\W")')) " Only look at the last few possibilities. Too many can be slow. if len(parts) > 5 let parts = parts[-5:] @@ -469,7 +511,12 @@ fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort call add(lookups, lookup) endif endfor + return lookups +endfunction +" used by both: completion and insert snippet +fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort + let lookups = s:determine_lookups(a:word) " Remove empty lookup entries, but only if there are other nonempty lookups if len(lookups) > 1 call filter(lookups, 'v:val != ""') @@ -504,18 +551,17 @@ fun! s:ChooseSnippet(snippets) abort let snippet += [i.'. '.snip] let i += 1 endfor - if len(snippet) == 1 || get(g:snipMate, 'always_choose_first', 0) == 1 - " there's only a single snippet, choose it - let idx = 0 - else - let idx = tlib#input#List('si','select snippet by name',snippet) -1 - if idx == -1 - return '' + let i = 0 + if len(snippet) > 1 && get(g:snipMate, 'always_choose_first', 0) != 1 + if exists('g:loaded_tlib') && g:loaded_tlib >= 41 + let i = tlib#input#List('si','select snippet by name',snippet) - 1 + else + let i = inputlist(snippet + ['Select a snippet by number']) - 1 endif endif " if a:snippets[..] is a String Call returns it " If it's a function or a function string the result is returned - return funcref#Call(a:snippets[keys(a:snippets)[idx]]) + return (i == -1) ? '' : funcref#Call(a:snippets[keys(a:snippets)[i]]) endf fun! snipMate#WordBelowCursor() abort diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index 42f54a39..584b20bf 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -17,7 +17,7 @@ For Vim version 7.0 or later. This plugin only works if 'compatible' is not set. {Vi does not have any of these features.} -SnipMate depends on vim-addon-mw-utils and tlib. +SnipMate depends on vim-addon-mw-utils and optionally on tlib. ============================================================================== DESCRIPTION *SnipMate-description* @@ -75,6 +75,9 @@ Commands~ files will be shown, with the existing files shown first. + The optional dependency tlib is required for + this command to work. + :SnipMateLoadScope[!] scope [scope ...] Load snippets from additional scopes. Without [!] the additional scopes are loaded only in @@ -221,6 +224,44 @@ The list of possible mappings is as follows: Additionally, is mapped in visual mode in .snippets files for retabbing snippets. + + *SnipMate-autocmds* +Autocommands~ + +Autocommands allow code written by the user to be executed automatically at +certain points within SnipMate's normal execution. Here is a list of events +available to the User. All of these are subject to change. + +SnipTriggerPre *SnipMate-SnipTriggerPre* +SnipTriggerPost *SnipMate-SnipTriggerPost* + + These two events are run when determining what text to use as + the trigger. The Pre version can be used to forgo SnipMate's + normal lookups entirely, and the Post version can be used to + add to whatever lookups already exist. + + Both events have access to b:snip_word, a variable + containining the WORD before the cursor when snippet + triggering began, and b:snip_lookups, a |List| containing all + possible lookups that SnipMate should try as possible + triggers. They are tried in order from the beginning. + + If SnipTriggerPre runs and puts anything in b:snip_lookups, + SnipMate's normal lookups will not be tried. SnipTriggerPost + runs regardless. + + The following example only allows a '.' as a possible trigger + if the WORD before the cursor is not "self.": > + + au User SnipLookupPost call My_func() + + function My_func() abort + if match(b:snip_word, 'self\.$') != -1 + call filter(b:snip_lookups, "v:val !~# '^\\.$'") + endif + endfunction + + ============================================================================== SNIPPETS *SnipMate-snippets* @@ -583,6 +624,14 @@ Perhaps some of these features will be added in a later release. ============================================================================== CHANGELOG *SnipMate-changelog* +0.90 - 2023-12-29 +----------------- + +- Remove empty lines at the end of a `${VISUAL}` expansion +- Fix code for opening folds when expanding a snippet +- Deprecate legacy snippet parser +- Fix jumps when `&sel == 'exclusive'` + 0.89 - 2016-05-29 ----------------- diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 068791ed..75e74aab 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -57,10 +57,6 @@ endif let g:snipMate['no_match_completion_feedkeys_chars'] = \ get(g:snipMate, 'no_match_completion_feedkeys_chars', "\t") -if !exists('g:snipMate.snippet_version') - echom 'The legacy SnipMate parser is deprecated. Please see :h SnipMate-deprecate.' -endif - " Add default scope aliases, without overriding user settings let g:snipMate.scope_aliases = get(g:snipMate, 'scope_aliases', {}) if exists('g:snipMate_no_default_aliases') diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md index a54c3134..8cf06c4b 100644 --- a/sources_non_forked/vim-snippets/README.md +++ b/sources_non_forked/vim-snippets/README.md @@ -169,6 +169,9 @@ on the fly adding those. Currently all snippets from UltiSnips have been put into `/UltiSnips` - some work on merging should be done (dropping duplicates etc). Also see engines section above. +Since UltiSnips supports both UltiSnip and vim-snipmate snippets, when +contributing fixes/new snippets, please prefer adding vim-snipmate snippets. + Related repositories -------------------- diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index 55883a36..9c7ed820 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -21,7 +21,7 @@ def nl(snip): snip.rv += " " def getArgs(group): import re - word = re.compile('[a-zA-Z0-9><.]+ \w+') + word = re.compile(r'[a-zA-Z0-9><.]+ \w+') return [i.split(" ") for i in word.findall(group) ] def camel(word): diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index f27ac8be..def1ca4d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -6,7 +6,7 @@ import vim # Set g:ultisnips_php_scalar_types to 1 if you'd like to enable PHP 7's scalar types for return values def isPHPScalarTypesEnabled(): isEnabled = vim.eval("get(g:, 'ultisnips_php_scalar_types', 0)") == "1" - return isEnabled or re.match('<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) + return isEnabled or re.match(r'<\?php\s+declare\(strict_types=[01]\);', '\n'.join(vim.current.window.buffer)) endglobal ## Snippets from SnipMate, taken from diff --git a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets index da9bc75e..6e31e616 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets @@ -285,7 +285,7 @@ snippet fnt "Footnote or Citation" i .. [$1] ${2:Reference} endsnippet -# Only for Nikola - Static Site Generator +# Only for Nikola — Static Site Generator snippet chart "Pygal chart for Nikola" b .. chart:: $1`!p snip.rv=complete(t[1], CHART_TYPES)` :title: '${2:Browser usage evolution (in %)}' diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 393b3eee..69d86f44 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -36,24 +36,6 @@ endglobal # ENVIRONMENT # ############### -snippet beg "begin{} / end{}" bi -\begin{$1} - ${0:${VISUAL}} -\end{$1} -endsnippet - -snippet cnt "Center" bi -\begin{center} - ${0:${VISUAL}} -\end{center} -endsnippet - -snippet desc "Description" bi -\begin{description} - \item[${1:${VISUAL}}] $0 -\end{description} -endsnippet - snippet lemma "Lemma" bi \begin{lemma} ${0:${VISUAL}} @@ -135,24 +117,6 @@ snippet fig "Figure environment" bi \end{figure} endsnippet -snippet enum "Enumerate" bi -\begin{enumerate} - \item ${0:${VISUAL}} -\end{enumerate} -endsnippet - -snippet item "Itemize" bi -\begin{itemize} - \item ${0:${VISUAL}} -\end{itemize} -endsnippet - -snippet case "cases" bi -\begin{cases} - ${0:${VISUAL}} -\end{cases} -endsnippet - snippet abs "abstract environment" b \begin{abstract} ${0:${VISUAL}} @@ -247,26 +211,6 @@ snippet srto "... Root" wi \sqrt[$1]{${2:${VISUAL}}}$0 endsnippet -snippet bf "Bold" wi -\bf{${1:${VISUAL}}}$0 -endsnippet - -snippet it "Italic" wi -\it{${1:${VISUAL}}}$0 -endsnippet - -snippet un "Underline" wi -\un{${1:${VISUAL}}}$0 -endsnippet - -snippet rm "Text" wi -\rm{${1:${VISUAL}}}$0 -endsnippet - -snippet itm "Item" wi -\item ${0:${VISUAL}} -endsnippet - snippet ceil "Ceil" w \left\lceil $1 \right\rceil $0 endsnippet @@ -283,34 +227,10 @@ snippet bmat "Bmat" w \begin{bmatrix} $1 \end{bmatrix} $0 endsnippet -snippet () "Left( right)" w -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr "left( right)" i -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr( "left( right)" i -\left( ${1:${VISUAL}} \right) $0 -endsnippet - -snippet lr| "left| right|" i -\left| ${1:${VISUAL}} \right| $0 -endsnippet - -snippet lr{ "left\{ right\}" i -\left\\{ ${1:${VISUAL}} \right\\} $0 -endsnippet - snippet lrb "left\{ right\}" i \left\\{ ${1:${VISUAL}} \right\\} $0 endsnippet -snippet lr[ "left[ right]" i -\left[ ${1:${VISUAL}} \right] $0 -endsnippet - snippet lra "leftangle rightangle" wi \left<${1:${VISUAL}} \right>$0 endsnippet @@ -467,112 +387,4 @@ snippet ac "Acroynm normal" bi \ac{${1:acronym}} endsnippet -snippet ni "Non-indented paragraph" bi -\noindent -endsnippet - - -############ -# SECTIONS # -############ - -snippet chap "Chapter" wi -\chapter{$1${VISUAL}} -endsnippet - -snippet sec "Section" wi -\section{$1${VISUAL}} -endsnippet - -snippet sec* "Section*" wi -\section*{$1${VISUAL}} -endsnippet - -snippet sub "Subsection" wi -\subsection{$1${VISUAL}} -endsnippet - -snippet sub* "Subsection*" wi -\subsection*{$1${VISUAL}} -endsnippet - -snippet subsub "Subsection" wi -\subsubsection{$1${VISUAL}} -endsnippet - -snippet subsub* "Subsubsection" wi -\subsubsection*{$1${VISUAL}} -endsnippet - -snippet par "Paragraph" wi -\paragraph{$1${VISUAL}} -endsnippet - -snippet par* "Paragraph*" wi -\paragraph*{$1${VISUAL}} -endsnippet - -snippet subpar "Sub Paragraph" wi -\subparagraph{$1${VISUAL}} -endsnippet - -snippet subpar* "Sub Paragraph*" wi -\subparagraph*{$1${VISUAL}} -endsnippet - -snippet chapl "Chapter with label" wi -\chapter{$1${VISUAL}} -\label{cha:${2:${1/\W+/-/g}}} -endsnippet - -snippet secl "Section with label" wi -\section{$1${VISUAL}} -\label{sec:${2:${1/\W+/-/g}}} -endsnippet - -snippet sec*l "Section* with label" wi -\section*{$1${VISUAL}} -\label{sec:${2:${1/\W+/-/g}}} -endsnippet - -snippet subl "Subsection with label" wi -\subsection{$1${VISUAL}} -\label{sub:${2:${1/\W+/-/g}}} -endsnippet - -snippet sub*l "Subsection* with label" wi -\subsection*{$1${VISUAL}} -\label{sub:${2:${1/\W+/-/g}}} -endsnippet - -snippet subsubl "Subsection with label" wi -\subsubsection{$1${VISUAL}} -\label{ssub:${2:${1/\W+/-/g}}} -endsnippet - -snippet subsub*l "Subsubsection with label" wi -\subsubsection*{$1${VISUAL}} -\label{ssub:${2:${1/\W+/-/g}}} -endsnippet - -snippet parl "Paragraph with label" wi -\paragraph{$1${VISUAL}} -\label{par:${2:${1/\W+/-/g}}} -endsnippet - -snippet par*l "Paragraph* with label" wi -\paragraph*{$1${VISUAL}} -\label{par:${2:${1/\W+/-/g}}} -endsnippet - -snippet subparl "Sub Paragraph with label" wi -\subparagraph{$1${VISUAL}} -\label{subp:${2:${1/\W+/-/g}}} -endsnippet - -snippet subpar*l "Sub Paragraph* with label" wi -\subparagraph*{$1${VISUAL}} -\label{subp:${2:${1/\W+/-/g}}} -endsnippet - # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/pythonx/vimsnippets.py b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py index eceb83c5..68b430e4 100644 --- a/sources_non_forked/vim-snippets/pythonx/vimsnippets.py +++ b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py @@ -14,7 +14,7 @@ def complete(tab, opts): :return: a string that match with tab """ el = [x for x in tab] - pat = "".join(list(map(lambda x: x + "\w*" if re.match("\w", x) else x, + pat = "".join(list(map(lambda x: x + r"\w*" if re.match(r"\w", x) else x, el))) try: opts = [x for x in opts if re.search(pat, x, re.IGNORECASE)] diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index df5595b9..a3f4d5c9 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -16,11 +16,9 @@ snippet mainn # #include <...> snippet inc #include <${1:stdio}.h> - $0 # #include "..." snippet Inc #include "${1:`vim_snippets#Filename("$1.h")`}" - $0 # ifndef...define...endif snippet ndef #ifndef $1 diff --git a/sources_non_forked/vim-snippets/snippets/cpp.snippets b/sources_non_forked/vim-snippets/snippets/cpp.snippets index 3bd1f001..bb9528a6 100644 --- a/sources_non_forked/vim-snippets/snippets/cpp.snippets +++ b/sources_non_forked/vim-snippets/snippets/cpp.snippets @@ -251,3 +251,29 @@ snippet sr "std::ranges::" # STL std::views:: snippet sv "std::views::" std::views:: +## +## Tests +# GTest:add main +snippet gtemain "GTest:add main" + int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + } +# GTest:add test +snippet gtetest "GTest:add test" + TEST(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:add fixture +snippet gtefix "GTest:add fixture" + TEST_F(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:add parameterized test +snippet gtepar "GTest:add parameterized test" + TEST_P(${1:SuiteName}, ${2:TestName}) { + ${0} + } +# GTest:instantiate parameterized test +snippet gteparins "GTest:instantiate parameterized test" + INSTANTIATE_TEST_SUITE_P(${1:InstantiationName}, ${2:SuiteName}, ${0}); diff --git a/sources_non_forked/vim-snippets/snippets/dart.snippets b/sources_non_forked/vim-snippets/snippets/dart.snippets index f4fd4f13..30ab3d5d 100644 --- a/sources_non_forked/vim-snippets/snippets/dart.snippets +++ b/sources_non_forked/vim-snippets/snippets/dart.snippets @@ -1,3 +1,10 @@ +snippet af + (${1}) {${2}}${0} +snippet pr + print(${1}); +snippet deb + debugger(); + ${0} snippet lib library ${1}; ${0} diff --git a/sources_non_forked/vim-snippets/snippets/scheme.snippets b/sources_non_forked/vim-snippets/snippets/scheme.snippets index 4c0c78a0..0aa13794 100644 --- a/sources_non_forked/vim-snippets/snippets/scheme.snippets +++ b/sources_non_forked/vim-snippets/snippets/scheme.snippets @@ -17,7 +17,7 @@ snippet * # Definition snippet def (define (${1:name}) - ${0:definition}) + ${0:definition}) # Definition with lambda snippet defl diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 3dddd184..4d54fe01 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -195,11 +195,21 @@ snippet par \paragraph \\paragraph{${1:paragraph name}}% \\label{par:${2:$1}} ${0} +# Paragraph* +snippet par* \paragraph* + \\paragraph*{${1:paragraph name}}% + \\label{par:${2:$1}} + ${0} # Sub Paragraph snippet subp \subparagraph \\subparagraph{${1:subparagraph name}}% \\label{subp:${2:$1}} ${0} +# Sub Paragraph* +snippet subp* \subparagraph* + \\subparagraph*{${1:subparagraph name}}% + \\label{subp:${2:$1}} + ${0} snippet ni \noindent \\noindent ${0} diff --git a/sources_non_forked/vim-surround/README.markdown b/sources_non_forked/vim-surround/README.markdown index 3deb96a5..d2a5c298 100644 --- a/sources_non_forked/vim-surround/README.markdown +++ b/sources_non_forked/vim-surround/README.markdown @@ -74,7 +74,7 @@ support: > How do I surround without adding a space? -Only the opening brackets (`[`, `{`, and `(`) add a space. Use a closing +Only the opening brackets—`[`, `{`, and `(`—add a space. Use a closing bracket, or the `b` (`(`) and `B` (`{`) aliases. ## Contributing