From e99e9e9c3eae2b60502751f007cdd52796514600 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Mon, 17 Dec 2018 12:28:27 +0100 Subject: [PATCH] Updated vim plugins --- .../ale/ale_linters/elixir/elixir_ls.vim | 6 +- .../ale/ale_linters/go/golint.vim | 15 +- .../ale/ale_linters/haml/hamllint.vim | 10 +- .../ale/ale_linters/java/checkstyle.vim | 18 +- .../ale/ale_linters/java/javalsp.vim | 6 +- .../ale/ale_linters/php/php.vim | 6 +- .../ale/ale_linters/php/phpstan.vim | 36 +- .../ale/ale_linters/python/flake8.vim | 1 + .../ale/ale_linters/ruby/rubocop.vim | 32 +- .../ale/ale_linters/sass/sasslint.vim | 27 +- .../ale/ale_linters/scss/sasslint.vim | 28 +- .../ale/ale_linters/swift/swiftlint.vim | 32 +- .../ale/ale_linters/tex/lacheck.vim | 14 +- sources_non_forked/ale/autoload/ale/c.vim | 11 +- .../ale/autoload/ale/cursor.vim | 14 +- .../ale/autoload/ale/debugging.vim | 8 +- .../ale/autoload/ale/engine.vim | 6 + .../ale/autoload/ale/events.vim | 10 +- .../ale/autoload/ale/fix/registry.vim | 12 +- .../ale/autoload/ale/fixers/ocamlformat.vim | 6 +- .../ale/autoload/ale/fixers/prettier.vim | 1 + .../ale/autoload/ale/handlers/elixir.vim | 21 +- .../ale/autoload/ale/handlers/sasslint.vim | 8 - sources_non_forked/ale/autoload/ale/hover.vim | 38 +- .../ale/autoload/ale/linter.vim | 3 + .../ale/autoload/ale/lsp/response.vim | 4 + sources_non_forked/ale/autoload/ale/ruby.vim | 32 + sources_non_forked/ale/autoload/ale/test.vim | 10 + sources_non_forked/ale/autoload/ale/util.vim | 11 + sources_non_forked/ale/doc/ale-elixir.txt | 20 + sources_non_forked/ale/doc/ale-eruby.txt | 26 +- sources_non_forked/ale/doc/ale-go.txt | 21 +- sources_non_forked/ale/doc/ale-html.txt | 6 + sources_non_forked/ale/doc/ale-java.txt | 12 +- sources_non_forked/ale/doc/ale-php.txt | 10 + sources_non_forked/ale/doc/ale-python.txt | 40 + sources_non_forked/ale/doc/ale-ruby.txt | 22 + sources_non_forked/ale/doc/ale-sass.txt | 6 + sources_non_forked/ale/doc/ale-scss.txt | 27 + sources_non_forked/ale/doc/ale-typescript.txt | 4 +- sources_non_forked/ale/doc/ale.txt | 146 +++- sources_non_forked/ale/plugin/ale.vim | 12 +- .../ctrlp.vim/autoload/ctrlp.vim | 21 +- .../lightline.vim/autoload/lightline.vim | 11 +- .../lightline.vim/doc/lightline.txt | 19 +- .../lightline.vim/test/toggle.vim | 8 + sources_non_forked/nerdtree/doc/NERDTree.txt | 714 ++++++++++-------- .../nerdtree/lib/nerdtree/creator.vim | 2 +- .../nerdtree/lib/nerdtree/menu_controller.vim | 6 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 23 +- .../nerdtree/plugin/NERD_tree.vim | 6 +- .../nerdtree/syntax/nerdtree.vim | 8 +- .../vim-abolish/plugin/abolish.vim | 8 +- .../vim-fugitive/autoload/fugitive.vim | 2 +- .../vim-fugitive/plugin/fugitive.vim | 14 +- .../autoload/gitgutter/async.vim | 20 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 16 + .../autoload/gitgutter/utility.vim | 16 +- .../vim-gitgutter/test/test_gitgutter.vim | 45 ++ sources_non_forked/vim-go/CHANGELOG.md | 33 + .../vim-go/autoload/ctrlp/decls.vim | 20 +- .../vim-go/autoload/fzf/decls.vim | 8 + .../vim-go/autoload/go/alternate.vim | 8 + .../vim-go/autoload/go/asmfmt.vim | 8 + sources_non_forked/vim-go/autoload/go/cmd.vim | 8 + .../vim-go/autoload/go/cmd_test.vim | 8 + .../vim-go/autoload/go/complete.vim | 19 +- .../vim-go/autoload/go/complete_test.vim | 8 + .../vim-go/autoload/go/config.vim | 20 +- .../vim-go/autoload/go/coverage.vim | 8 + .../vim-go/autoload/go/debug.vim | 197 ++--- .../vim-go/autoload/go/decls.vim | 8 + sources_non_forked/vim-go/autoload/go/def.vim | 31 +- .../vim-go/autoload/go/def_test.vim | 8 + sources_non_forked/vim-go/autoload/go/doc.vim | 17 +- .../vim-go/autoload/go/fillstruct.vim | 8 + .../vim-go/autoload/go/fillstruct_test.vim | 8 + sources_non_forked/vim-go/autoload/go/fmt.vim | 8 + .../vim-go/autoload/go/fmt_test.vim | 8 + .../vim-go/autoload/go/guru.vim | 14 +- .../vim-go/autoload/go/guru_test.vim | 8 + .../vim-go/autoload/go/highlight_test.vim | 8 + .../vim-go/autoload/go/iferr.vim | 10 + .../vim-go/autoload/go/impl.vim | 8 + .../vim-go/autoload/go/impl_test.vim | 10 + .../vim-go/autoload/go/import.vim | 8 + .../vim-go/autoload/go/indent_test.vim | 10 + .../vim-go/autoload/go/issue.vim | 8 + sources_non_forked/vim-go/autoload/go/job.vim | 9 +- .../vim-go/autoload/go/keyify.vim | 8 + .../vim-go/autoload/go/lint.vim | 27 +- .../vim-go/autoload/go/lint_test.vim | 14 +- .../vim-go/autoload/go/list.vim | 8 + sources_non_forked/vim-go/autoload/go/mod.vim | 10 + .../vim-go/autoload/go/package.vim | 107 +-- .../vim-go/autoload/go/path.vim | 18 +- .../vim-go/autoload/go/play.vim | 8 + .../vim-go/autoload/go/rename.vim | 8 + .../vim-go/autoload/go/statusline.vim | 8 + .../vim-go/autoload/go/tags.vim | 8 + .../vim-go/autoload/go/tags_test.vim | 8 + .../vim-go/autoload/go/template.vim | 8 + .../vim-go/autoload/go/term.vim | 8 + .../vim-go/autoload/go/term_test.vim | 8 + .../vim-go/autoload/go/test.vim | 8 + .../vim-go/autoload/go/test_test.vim | 8 + .../vim-go/autoload/go/textobj.vim | 8 + .../vim-go/autoload/go/tool.vim | 8 + .../vim-go/autoload/go/tool_test.vim | 8 + sources_non_forked/vim-go/autoload/go/ui.vim | 8 + .../vim-go/autoload/go/util.vim | 8 + sources_non_forked/vim-go/autoload/gotest.vim | 8 + sources_non_forked/vim-go/compiler/go.vim | 8 + sources_non_forked/vim-go/doc/vim-go.txt | 49 +- .../vim-go/ftdetect/gofiletype.vim | 8 + sources_non_forked/vim-go/ftplugin/asm.vim | 8 + sources_non_forked/vim-go/ftplugin/go.vim | 8 + .../vim-go/ftplugin/go/commands.vim | 8 +- .../vim-go/ftplugin/go/mappings.vim | 4 +- .../vim-go/ftplugin/go/snippets.vim | 8 + .../vim-go/ftplugin/go/tagbar.vim | 8 + sources_non_forked/vim-go/ftplugin/gomod.vim | 8 + sources_non_forked/vim-go/indent/go.vim | 8 + .../vim-go/indent/gohtmltmpl.vim | 8 + sources_non_forked/vim-go/plugin/go.vim | 12 +- sources_non_forked/vim-go/scripts/docker-test | 4 +- sources_non_forked/vim-go/scripts/install-vim | 1 + sources_non_forked/vim-go/scripts/run-vim | 1 + .../vim-go/scripts/runbench.vim | 11 + sources_non_forked/vim-go/scripts/runtest.vim | 14 +- .../vim-go/test/gopath_test.vim | 10 + .../UltiSnips/javascript-ember.snippets | 69 +- .../vim-snippets/UltiSnips/rust.snippets | 39 +- .../vim-snippets/UltiSnips/texmath.snippets | 48 +- .../vim-snippets/snippets/elm.snippets | 2 + .../vim-snippets/snippets/rust.snippets | 48 +- .../vim-snippets/snippets/tex.snippets | 12 +- 137 files changed, 2129 insertions(+), 846 deletions(-) delete mode 100644 sources_non_forked/ale/autoload/ale/handlers/sasslint.vim 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 d5ad7cfc..3b299ec6 100644 --- a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim +++ b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim @@ -1,7 +1,8 @@ " Author: Jon Parise -" Description: elixir-ls integration (https://github.com/JakeBecker/elixir-ls) +" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls) call ale#Set('elixir_elixir_ls_release', 'elixir-ls') +call ale#Set('elixir_elixir_ls_config', {}) function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release')) @@ -15,5 +16,6 @@ call ale#linter#Define('elixir', { \ 'lsp': 'stdio', \ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable', \ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable', -\ 'project_root_callback': 'ale#handlers#elixir#FindMixProjectRoot', +\ 'project_root_callback': 'ale#handlers#elixir#FindMixUmbrellaRoot', +\ 'lsp_config_callback': ale#VarFunc('elixir_elixir_ls_config'), \}) diff --git a/sources_non_forked/ale/ale_linters/go/golint.vim b/sources_non_forked/ale/ale_linters/go/golint.vim index d580fda2..4bf14fcc 100644 --- a/sources_non_forked/ale/ale_linters/go/golint.vim +++ b/sources_non_forked/ale/ale_linters/go/golint.vim @@ -1,10 +1,21 @@ " Author: neersighted " Description: golint for Go files +call ale#Set('go_golint_executable', 'golint') +call ale#Set('go_golint_options', '') + +function! ale_linters#go#golint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'go_golint_options') + + return '%e' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' +endfunction + call ale#linter#Define('go', { \ 'name': 'golint', \ 'output_stream': 'both', -\ 'executable': 'golint', -\ 'command': 'golint %t', +\ 'executable_callback': ale#VarFunc('go_golint_executable'), +\ 'command_callback': 'ale_linters#go#golint#GetCommand', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) diff --git a/sources_non_forked/ale/ale_linters/haml/hamllint.vim b/sources_non_forked/ale/ale_linters/haml/hamllint.vim index d6633599..6598f81a 100644 --- a/sources_non_forked/ale/ale_linters/haml/hamllint.vim +++ b/sources_non_forked/ale/ale_linters/haml/hamllint.vim @@ -1,6 +1,12 @@ " Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman " Description: haml-lint for Haml files +call ale#Set('haml_hamllint_executable', 'haml-lint') + +function! ale_linters#haml#hamllint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'haml_hamllint_executable') +endfunction + function! ale_linters#haml#hamllint#GetCommand(buffer) abort let l:prefix = '' @@ -21,7 +27,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort endif return (!empty(l:prefix) ? l:prefix . ' ' : '') - \ . 'haml-lint' + \ . ale_linters#haml#hamllint#GetExecutable(a:buffer) \ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '') \ . ' %t' endfunction @@ -45,7 +51,7 @@ endfunction call ale#linter#Define('haml', { \ 'name': 'hamllint', -\ 'executable': 'haml-lint', +\ 'executable_callback': 'ale_linters#haml#hamllint#GetExecutable', \ 'command_callback': 'ale_linters#haml#hamllint#GetCommand', \ 'callback': 'ale_linters#haml#hamllint#Handle' \}) diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index 8155170a..c07b65d0 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -2,9 +2,11 @@ " Description: checkstyle for Java files function! ale_linters#java#checkstyle#Handle(buffer, lines) abort - let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$' let l:output = [] + " modern checkstyle versions + let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$' + for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', @@ -15,13 +17,24 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort \}) endfor + " old checkstyle versions + let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'type': l:match[3] is? 'warning' ? 'W' : 'E', + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[4], + \}) + endfor + return l:output endfunction function! ale_linters#java#checkstyle#GetCommand(buffer) abort return 'checkstyle ' \ . ale#Var(a:buffer, 'java_checkstyle_options') - \ . ' %t' + \ . ' %s' endfunction if !exists('g:ale_java_checkstyle_options') @@ -33,4 +46,5 @@ call ale#linter#Define('java', { \ 'executable': 'checkstyle', \ 'command_callback': 'ale_linters#java#checkstyle#GetCommand', \ 'callback': 'ale_linters#java#checkstyle#Handle', +\ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/java/javalsp.vim b/sources_non_forked/ale/ale_linters/java/javalsp.vim index 5d1a0c63..1436a52c 100644 --- a/sources_non_forked/ale/ale_linters/java/javalsp.vim +++ b/sources_non_forked/ale/ale_linters/java/javalsp.vim @@ -2,15 +2,17 @@ " Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac call ale#Set('java_javalsp_jar', 'javacs.jar') +call ale#Set('java_javalsp_executable', 'java') function! ale_linters#java#javalsp#Executable(buffer) abort - return 'java' + return ale#Var(a:buffer, 'java_javalsp_executable') endfunction function! ale_linters#java#javalsp#Command(buffer) abort let l:jar = ale#Var(a:buffer, 'java_javalsp_jar') + let l:executable = ale_linters#java#javalsp#Executable(a:buffer) - return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main') + return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main' endfunction call ale#linter#Define('java', { diff --git a/sources_non_forked/ale/ale_linters/php/php.vim b/sources_non_forked/ale/ale_linters/php/php.vim index 6470383b..5d87196c 100644 --- a/sources_non_forked/ale/ale_linters/php/php.vim +++ b/sources_non_forked/ale/ale_linters/php/php.vim @@ -1,6 +1,8 @@ " Author: Spencer Wood , Adriaan Zonnenberg " Description: This file adds support for checking PHP with php-cli +call ale#Set('php_php_executable', 'php') + function! ale_linters#php#php#Handle(buffer, lines) abort " Matches patterns like the following: " @@ -30,8 +32,8 @@ endfunction call ale#linter#Define('php', { \ 'name': 'php', -\ 'executable': 'php', +\ 'executable_callback': ale#VarFunc('php_php_executable'), \ 'output_stream': 'stdout', -\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --', +\ 'command': '%e -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --', \ 'callback': 'ale_linters#php#php#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index b3875216..1c831e1b 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -6,15 +6,40 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') -function! ale_linters#php#phpstan#GetCommand(buffer) abort +function! ale_linters#php#phpstan#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'php_phpstan_executable') +endfunction + +function! ale_linters#php#phpstan#VersionCheck(buffer) abort + let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer) + + " If we have previously stored the version number in a cache, then + " don't look it up again. + if ale#semver#HasVersion(l:executable) + " Returning an empty string skips this command. + return '' + endif + + let l:executable = ale#Escape(l:executable) + + return l:executable . ' --version' +endfunction + +function! ale_linters#php#phpstan#GetCommand(buffer, version_output) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) \ ? ' -c ' . l:configuration \ : '' + let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_output) + let l:error_format = ale#semver#GTE(l:version, [0, 10, 3]) + \ ? ' --error-format raw' + \ : ' --errorFormat raw' + return '%e analyze -l' \ . ale#Var(a:buffer, 'php_phpstan_level') - \ . ' --errorFormat raw' + \ . l:error_format \ . l:configuration_option \ . ' %s' endfunction @@ -40,7 +65,10 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', -\ 'executable_callback': ale#VarFunc('php_phpstan_executable'), -\ 'command_callback': 'ale_linters#php#phpstan#GetCommand', +\ 'executable_callback': 'ale_linters#php#phpstan#GetExecutable', +\ 'command_chain': [ +\ {'callback': 'ale_linters#php#phpstan#VersionCheck'}, +\ {'callback': 'ale_linters#php#phpstan#GetCommand'}, +\ ], \ 'callback': 'ale_linters#php#phpstan#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 9dcdacc6..14b67d77 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -110,6 +110,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, + \ 'vcol': 1, \ 'text': l:match[4], \ 'code': l:code, \ 'type': 'W', diff --git a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim index 45218394..790ca82c 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim @@ -13,36 +13,6 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) endfunction -function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort - try - let l:errors = json_decode(a:lines[0]) - catch - return [] - endtry - - if !has_key(l:errors, 'summary') - \|| l:errors['summary']['offense_count'] == 0 - \|| empty(l:errors['files']) - return [] - endif - - let l:output = [] - - for l:error in l:errors['files'][0]['offenses'] - let l:start_col = l:error['location']['column'] + 0 - call add(l:output, { - \ 'lnum': l:error['location']['line'] + 0, - \ 'col': l:start_col, - \ 'end_col': l:start_col + l:error['location']['length'] - 1, - \ 'code': l:error['cop_name'], - \ 'text': l:error['message'], - \ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']), - \}) - endfor - - return l:output -endfunction - function! ale_linters#ruby#rubocop#GetType(severity) abort if a:severity is? 'convention' \|| a:severity is? 'warning' @@ -57,5 +27,5 @@ call ale#linter#Define('ruby', { \ 'name': 'rubocop', \ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'), \ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand', -\ 'callback': 'ale_linters#ruby#rubocop#Handle', +\ 'callback': 'ale#ruby#HandleRubocopOutput', \}) diff --git a/sources_non_forked/ale/ale_linters/sass/sasslint.vim b/sources_non_forked/ale/ale_linters/sass/sasslint.vim index 4df56dfd..8d24185d 100644 --- a/sources_non_forked/ale/ale_linters/sass/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/sass/sasslint.vim @@ -1,9 +1,28 @@ -" Author: KabbAmine - https://github.com/KabbAmine, -" Ben Falconer +" Author: sQVe - https://github.com/sQVe + +call ale#Set('sass_sasslint_executable', 'sass-lint') +call ale#Set('sass_sasslint_options', '') +call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#sass#sasslint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [ + \ 'node_modules/sass-lint/bin/sass-lint.js', + \ 'node_modules/.bin/sass-lint', + \]) +endfunction + +function! ale_linters#sass#sasslint#GetCommand(buffer) abort + let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'sass_sasslint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -v -q -f compact %t' +endfunction call ale#linter#Define('sass', { \ 'name': 'sasslint', -\ 'executable': 'sass-lint', -\ 'command_callback': 'ale#handlers#sasslint#GetCommand', +\ 'executable_callback': 'ale_linters#sass#sasslint#GetExecutable', +\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/scss/sasslint.vim b/sources_non_forked/ale/ale_linters/scss/sasslint.vim index f6075001..8b725ba6 100644 --- a/sources_non_forked/ale/ale_linters/scss/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/scss/sasslint.vim @@ -1,18 +1,28 @@ -" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer -" +" Author: sQVe - https://github.com/sQVe + +call ale#Set('scss_sasslint_executable', 'sass-lint') +call ale#Set('scss_sasslint_options', '') +call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#scss#sasslint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [ + \ 'node_modules/sass-lint/bin/sass-lint.js', + \ 'node_modules/.bin/sass-lint', + \]) +endfunction function! ale_linters#scss#sasslint#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape('sass-lint') - \ . ' -v' - \ . ' -q' - \ . ' -f compact' - \ . ' %t' + let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'scss_sasslint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -v -q -f compact %t' endfunction call ale#linter#Define('scss', { \ 'name': 'sasslint', -\ 'executable': 'sass-lint', +\ 'executable_callback': 'ale_linters#scss#sasslint#GetExecutable', \ 'command_callback': 'ale_linters#scss#sasslint#GetCommand', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim index 697d246b..a1150658 100644 --- a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim +++ b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim @@ -1,6 +1,24 @@ -" Author: David Mohundro +" Author: David Mohundro , Gordon Fontenot " Description: swiftlint for swift files +call ale#Set('swift_swiftlint_executable', 'swiftlint') +call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [ + \ 'Pods/SwiftLint/swiftlint', + \ 'ios/Pods/SwiftLint/swiftlint', + \ 'swiftlint', + \]) +endfunction + +function! ale_linters#swift#swiftlint#GetCommand(buffer) abort + let l:executable = ale_linters#swift#swiftlint#GetExecutable(a:buffer) + let l:args = 'lint --use-stdin' + + return ale#Escape(l:executable) + \ . ' ' .l:args +endfunction function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' @@ -8,10 +26,10 @@ function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { - \ 'lnum': str2nr(l:match[2]), - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', - \ 'text': l:match[5], - \} + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'text': l:match[5], + \} if l:match[4] is# 'error' let l:item.type = 'E' @@ -45,7 +63,7 @@ endfunction call ale#linter#Define('swift', { \ 'name': 'swiftlint', -\ 'executable': 'swiftlint', -\ 'command': 'swiftlint lint --use-stdin', +\ 'executable_callback': 'ale_linters#swift#swiftlint#GetExecutable', +\ 'command_callback': 'ale_linters#swift#swiftlint#GetCommand', \ 'callback': 'ale_linters#swift#swiftlint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/tex/lacheck.vim b/sources_non_forked/ale/ale_linters/tex/lacheck.vim index 5e5a94f1..ee09fb41 100644 --- a/sources_non_forked/ale/ale_linters/tex/lacheck.vim +++ b/sources_non_forked/ale/ale_linters/tex/lacheck.vim @@ -8,20 +8,26 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort " " "book.tex", line 37: possible unwanted space at "{" " "book.tex", line 38: missing `\ ' after "etc." - let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$' + let l:pattern = '^"\(.\+\)", line \(\d\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " lacheck follows `\input{}` commands. If the cwd is not the same as the " file in the buffer then it will fail to find the inputed items. We do not " want warnings from those items anyway - if !empty(matchstr(l:match[2], '^Could not open ".\+"$')) + if !empty(matchstr(l:match[3], '^Could not open ".\+"$')) + continue + endif + + " lacheck follows `\input{}` commands. We are only interested in + " reporting errors for the current buffer only. + if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t'))) continue endif call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[2], + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[3], \ 'type': 'W', \}) endfor diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index ce59ae31..ce5105b6 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -50,12 +50,17 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort let l:cflags_list = [] let l:previous_options = [] - for l:option in split(a:cflag_line, '-') + let l:split_lines = split(a:cflag_line, '-') + let l:option_index = 0 + + while l:option_index < len(l:split_lines) + let l:option = l:split_lines[l:option_index] + let l:option_index = l:option_index + 1 call add(l:previous_options, l:option) " Check if cflag contained a '-' and should not have been splitted let l:option_list = split(l:option, '\zs') - if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' + if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' && l:option_index < len(l:split_lines) continue endif @@ -81,7 +86,7 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort call add(l:cflags_list, l:option) endif endif - endfor + endwhile return join(l:cflags_list, ' ') endfunction diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index 32ce8c84..6672c349 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -52,16 +52,6 @@ function! ale#cursor#TruncatedEcho(original_message) abort endtry endfunction -function! s:FindItemAtCursor(buffer) abort - let l:info = get(g:ale_buffer_info, a:buffer, {}) - let l:loclist = get(l:info, 'loclist', []) - let l:pos = getcurpos() - let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2]) - let l:loc = l:index >= 0 ? l:loclist[l:index] : {} - - return [l:info, l:loc] -endfunction - function! s:StopCursorTimer() abort if s:cursor_timer != -1 call timer_stop(s:cursor_timer) @@ -85,7 +75,7 @@ function! ale#cursor#EchoCursorWarning(...) abort return endif - let [l:info, l:loc] = s:FindItemAtCursor(l:buffer) + let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) if g:ale_echo_cursor if !empty(l:loc) @@ -169,7 +159,7 @@ function! ale#cursor#ShowCursorDetail() abort call s:StopCursorTimer() - let [l:info, l:loc] = s:FindItemAtCursor(l:buffer) + let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) if !empty(l:loc) call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0}) diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index 34c13770..3aed38fe 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -22,14 +22,14 @@ let s:global_variable_list = [ \ 'ale_lint_delay', \ 'ale_lint_on_enter', \ 'ale_lint_on_filetype_changed', +\ 'ale_lint_on_insert_leave', \ 'ale_lint_on_save', \ 'ale_lint_on_text_changed', -\ 'ale_lint_on_insert_leave', \ 'ale_linter_aliases', \ 'ale_linters', \ 'ale_linters_explicit', -\ 'ale_list_window_size', \ 'ale_list_vertical', +\ 'ale_list_window_size', \ 'ale_loclist_msg_format', \ 'ale_max_buffer_history_size', \ 'ale_max_signs', @@ -52,6 +52,7 @@ let s:global_variable_list = [ \ 'ale_statusline_format', \ 'ale_type_map', \ 'ale_use_global_executables', +\ 'ale_virtualtext_cursor', \ 'ale_warn_about_trailing_blank_lines', \ 'ale_warn_about_trailing_whitespace', \] @@ -236,10 +237,11 @@ function! ale#debugging#Info() abort endfunction function! ale#debugging#InfoToClipboard() abort - redir @+> + redir => l:output silent call ale#debugging#Info() redir END + let @+ = l:output call s:Echo('ALEInfo copied to your clipboard') endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index e85e4d66..b44be73c 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -304,6 +304,12 @@ function! ale#engine#SetResults(buffer, loclist) abort call ale#cursor#EchoCursorWarning() endif + if g:ale_virtualtext_cursor + " Try and show the warning now. + " This will only do something meaningful if we're in normal mode. + call ale#virtualtext#ShowCursorWarning() + endif + " Reset the save event marker, used for opening windows, etc. call setbufvar(a:buffer, 'ale_save_event_fired', 0) " Set a marker showing how many times a buffer has been checked. diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index e48ad488..c3dbd378 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -29,7 +29,7 @@ function! ale#events#SaveEvent(buffer) abort call setbufvar(a:buffer, 'ale_save_event_fired', 1) endif - if ale#Var(a:buffer, 'fix_on_save') + if ale#Var(a:buffer, 'fix_on_save') && !ale#events#QuitRecently(a:buffer) let l:will_fix = ale#fix#Fix(a:buffer, 'save_file') let l:should_lint = l:should_lint && !l:will_fix endif @@ -139,6 +139,14 @@ function! ale#events#Init() abort autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif endif + if g:ale_virtualtext_cursor + 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 g:ale_close_preview_on_insert autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif endif diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 98f52232..6a8fd382 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -17,6 +17,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with autopep8.', \ }, +\ 'bibclean': { +\ 'function': 'ale#fixers#bibclean#Fix', +\ 'suggested_filetypes': ['bib'], +\ 'description': 'Format bib files using bibclean.', +\ }, \ 'black': { \ 'function': 'ale#fixers#black#Fix', \ 'suggested_filetypes': ['python'], @@ -56,7 +61,7 @@ let s:default_registry = { \ }, \ 'prettier': { \ 'function': 'ale#fixers#prettier#Fix', -\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue'], +\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'], \ 'description': 'Apply prettier to a file.', \ }, \ 'prettier_eslint': { @@ -110,6 +115,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['javascript'], \ 'description': 'Fix JavaScript files using standard --fix', \ }, +\ 'standardrb': { +\ 'function': 'ale#fixers#standardrb#Fix', +\ 'suggested_filetypes': ['ruby'], +\ 'description': 'Fix ruby files with standardrb --fix', +\ }, \ 'stylelint': { \ 'function': 'ale#fixers#stylelint#Fix', \ 'suggested_filetypes': ['css', 'sass', 'scss', 'stylus'], diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim index fac142aa..9b7c3e12 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim @@ -5,14 +5,14 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat') call ale#Set('ocaml_ocamlformat_options', '') function! ale#fixers#ocamlformat#Fix(buffer) abort + let l:filename = expand('#' . a:buffer . ':p') let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' --inplace' - \ . ' %t', - \ 'read_temporary_file': 1, + \ . ' --name=' . ale#Escape(l:filename) + \ . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index 608240a5..58dea159 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -58,6 +58,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort \ 'markdown': 'markdown', \ 'vue': 'vue', \ 'yaml': 'yaml', + \ 'html': 'html', \} let l:parser = '' diff --git a/sources_non_forked/ale/autoload/ale/handlers/elixir.vim b/sources_non_forked/ale/autoload/ale/handlers/elixir.vim index 91b75aac..2fddf8e7 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/elixir.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/elixir.vim @@ -1,13 +1,28 @@ " Author: Matteo Centenaro (bugant) - https://github.com/bugant -" -" Description: find the root directory for an elixir project that uses mix +" Author: Jon Parise +" Description: Functions for working with Elixir projects +" Find the root directory for an elixir project that uses mix. function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs') if !empty(l:mix_file) - return fnamemodify(l:mix_file, ':p:h') + return fnamemodify(l:mix_file, ':p:h') endif return '.' endfunction + +" Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the +" search upward for a potential umbrella project root. If an umbrella root +" does not exist, the initial project root will be returned. +function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort + let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) + let l:umbrella_root = fnamemodify(l:app_root, ':h:h') + + if filereadable(l:umbrella_root . '/mix.exs') + return l:umbrella_root + endif + + return l:app_root +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/sasslint.vim b/sources_non_forked/ale/autoload/ale/handlers/sasslint.vim deleted file mode 100644 index 399bf47c..00000000 --- a/sources_non_forked/ale/autoload/ale/handlers/sasslint.vim +++ /dev/null @@ -1,8 +0,0 @@ -" Author: KabbAmine - https://github.com/KabbAmine, -" Ben Falconer - -function! ale#handlers#sasslint#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape('sass-lint') - \ . ' -v -q -f compact %t' -endfunction diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 69db276e..490cc406 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -24,7 +24,21 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'success', v:false) is v:true \&& get(a:response, 'body', v:null) isnot v:null - if get(l:options, 'hover_from_balloonexpr', 0) + " If we pass the show_documentation flag, we should show the full + " documentation, and always in the preview window. + if get(l:options, 'show_documentation', 0) + let l:documentation = get(a:response.body, 'documentation', '') + + " displayString is not included here, because it can be very + " noisy and run on for many lines for complex types. A less + " verbose alternative may be nice in future. + if !empty(l:documentation) + call ale#preview#Show(split(l:documentation, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) + endif + elseif get(l:options, 'hover_from_balloonexpr', 0) \&& exists('*balloon_show') \&& ale#Var(l:options.buffer, 'set_balloons') call balloon_show(a:response.body.displayString) @@ -126,6 +140,7 @@ function! s:OnReady(linter, lsp_details, line, column, opt, ...) abort \ 'line': a:line, \ 'column': l:column, \ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0), + \ 'show_documentation': get(a:opt, 'show_documentation', 0), \} endfunction @@ -153,9 +168,30 @@ endfunction " - in the balloon if opt.called_from_balloonexpr and balloon_show is detected " - as status message otherwise function! ale#hover#Show(buffer, line, col, opt) abort + let l:show_documentation = get(a:opt, 'show_documentation', 0) + for l:linter in ale#linter#Get(getbufvar(a:buffer, '&filetype')) + " Only tsserver supports documentation requests at the moment. if !empty(l:linter.lsp) + \&& (!l:show_documentation || l:linter.lsp is# 'tsserver') call s:ShowDetails(l:linter, a:buffer, a:line, a:col, a:opt) endif endfor endfunction + +" This function implements the :ALEHover command. +function! ale#hover#ShowAtCursor() abort + let l:buffer = bufnr('') + let l:pos = getcurpos() + + call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {}) +endfunction + +" This function implements the :ALEDocumentation command. +function! ale#hover#ShowDocumentationAtCursor() abort + let l:buffer = bufnr('') + let l:pos = getcurpos() + let l:options = {'show_documentation': 1} + + call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], l:options) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 114765e6..1cbc9ffe 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -16,6 +16,7 @@ let s:default_ale_linter_aliases = { \ 'systemverilog': 'verilog', \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', +\ 'vue': ['vue', 'javascript'], \ 'zsh': 'sh', \} @@ -31,6 +32,7 @@ let s:default_ale_linter_aliases = { " NOTE: Update the g:ale_linters documentation when modifying this. let s:default_ale_linters = { \ 'csh': ['shell'], +\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -40,6 +42,7 @@ let s:default_ale_linters = { \ 'rust': ['cargo'], \ 'spec': [], \ 'text': [], +\ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \} diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index 69e88d56..08b36808 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -66,6 +66,10 @@ function! ale#lsp#response#ReadDiagnostics(response) abort let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n") endif + if has_key(l:diagnostic, 'source') + let l:loclist_item.detail = printf('[%s] %s', l:diagnostic.source, l:diagnostic.message) + endif + call add(l:loclist, l:loclist_item) endfor diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim index 5f0aa50d..3d9c5a51 100644 --- a/sources_non_forked/ale/autoload/ale/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -42,3 +42,35 @@ function! ale#ruby#FindProjectRoot(buffer) abort return '' endfunction + +" Handle output from rubocop and linters that depend on it (e.b. standardrb) +function! ale#ruby#HandleRubocopOutput(buffer, lines) abort + try + let l:errors = json_decode(a:lines[0]) + catch + return [] + endtry + + if !has_key(l:errors, 'summary') + \|| l:errors['summary']['offense_count'] == 0 + \|| empty(l:errors['files']) + return [] + endif + + let l:output = [] + + for l:error in l:errors['files'][0]['offenses'] + let l:start_col = l:error['location']['column'] + 0 + call add(l:output, { + \ 'lnum': l:error['location']['line'] + 0, + \ 'col': l:start_col, + \ 'end_col': l:start_col + l:error['location']['length'] - 1, + \ 'code': l:error['cop_name'], + \ 'text': l:error['message'], + \ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']), + \}) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim index 083b546f..e6ec70dc 100644 --- a/sources_non_forked/ale/autoload/ale/test.vim +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -75,3 +75,13 @@ function! ale#test#GetQflistWithoutModule() abort return l:results endfunction + +function! ale#test#GetPreviewWindowText() abort + for l:window in range(1, winnr('$')) + if getwinvar(l:window, '&previewwindow', 0) + let l:buffer = winbufnr(l:window) + + return getbufline(l:buffer, 1, '$') + endif + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index e0491653..bb478957 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -452,3 +452,14 @@ function! ale#util#Col(str, chr) abort return strlen(join(split(a:str, '\zs')[0:a:chr - 2], '')) + 1 endfunction + +function! ale#util#FindItemAtCursor(buffer) abort + let l:info = get(g:ale_buffer_info, a:buffer, {}) + let l:loclist = get(l:info, 'loclist', []) + let l:pos = getcurpos() + let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2]) + let l:loc = l:index >= 0 ? l:loclist[l:index] : {} + + return [l:info, l:loc] +endfunction + diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index 769842a4..45c6de1d 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -5,6 +5,11 @@ ALE Elixir Integration *ale-elixir-options* =============================================================================== mix *ale-elixir-mix* + +The `mix` linter is disabled by default, as it can bee too expensive to run. +See `:help g:ale_linters` + + g:ale_elixir_mix_options *g:ale_elixir_mix_options* *b:ale_elixir_mix_options* Type: |String| @@ -53,5 +58,20 @@ g:ale_elixir_elixir_ls_release *g:ale_elixir_elixir_ls_release* Location of the elixir-ls release directory. This directory must contain the language server scripts (language_server.sh and language_server.bat). +g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config* + *b:ale_elixir_elixir_ls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example, to disable Dialyzer: > + { + \ 'elixirLS': { + \ 'dialyzerEnabled': v:false, + \ }, + \ } +< + Consult the ElixirLS documentation for more information about settings. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-eruby.txt b/sources_non_forked/ale/doc/ale-eruby.txt index a0f6f4f8..d75d3868 100644 --- a/sources_non_forked/ale/doc/ale-eruby.txt +++ b/sources_non_forked/ale/doc/ale-eruby.txt @@ -1,15 +1,37 @@ =============================================================================== ALE Eruby Integration *ale-eruby-options* -There are three linters for `eruby` files: +There are four linters for `eruby` files: - `erb` - `erubis` - `erubi` +- `ruumba` `erb` is in the Ruby standard library and is mostly universal. `erubis` is the default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails -5.1 and later. To selectively enable a subset, see |g:ale_linters|. +5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on +the result. To selectively enable a subset, see |g:ale_linters|. + +=============================================================================== +ruumba *ale-eruby-ruumba* + +g:ale_eruby_ruumba_executable *g:ale_eruby_ruumba_executable* + *b:ale_eruby_ruumba_executable* + Type: String + Default: `'ruumba` + + Override the invoked ruumba binary. This is useful for running ruumba + from binstubs or a bundle. + + +g:ale_eruby_ruumba_options *g:ale_ruby_ruumba_options* + *b:ale_ruby_ruumba_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to ruumba. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 71b248ee..43289bd5 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -27,7 +27,7 @@ g:ale_go_go_executable *g:ale_go_go_options* Default: `'go'` The executable that will be run for the `gobuild` and `govet` linters, and - the gomod` fixer. + the `gomod` fixer. =============================================================================== @@ -53,6 +53,25 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* This variable can be set to pass additional options to the gofmt fixer. +=============================================================================== +golint *ale-go-golint* + +g:ale_go_golint_executable *g:ale_go_golint_executable* + *b:ale_go_golint_executable* + Type: |String| + Default: `'golint'` + + This variable can be set to change the golint executable path. + + +g:ale_go_golint_options *g:ale_go_golint_options* + *b:ale_go_golint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the golint linter. + + =============================================================================== govet *ale-go-govet* diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index de48775f..1d30929f 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -79,6 +79,12 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global* See |ale-integrations-local-executables| +=============================================================================== +prettier *ale-html-prettier* + +See |ale-javascript-prettier| for information about the available options. + + =============================================================================== stylelint *ale-html-stylelint* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 7bba12a3..8e40aea0 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -88,14 +88,20 @@ This generates a out/fat-jar.jar file that contains the language server. To let ALE use this language server you need to set the g:ale_java_javalsp_jar variable to the absolute path of this jar file. +g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* + *b:ale_java_javalsp_executable* + Type: |String| + Default: `'java'` + +This variable can be changed to use a different executable for java. + g:ale_java_javalsp_jar *g:ale_java_javalsp_jar* *b:ale_java_javalsp_jar* - Type: String - Default: 'fat-jar.jar + Type: |String| + Default: `'fat-jar.jar'` Path to the location of the vscode-javac language server plugin. - and -d. They are added automatically. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 2eed838e..83bc0fd5 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -203,5 +203,15 @@ g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* This variable can be set to pass additional options to php-cs-fixer. +=============================================================================== +php *ale-php-php* + +g:ale_php_php_executable *g:ale_php_php_executable* + *b:ale_php_php_executable* + Type: |String| + Default: `'php'` + + This variable sets the executable used for php. + =============================================================================== 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 0b8e1746..f3f2801a 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -328,6 +328,46 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv* if true. This is overridden by a manually-set executable. +=============================================================================== +pydocstyle *ale-python-pydocstyle* + + +g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable* + *b:ale_python_pydocstyle_executable* + Type: |String| + Default: `'pydocstyle'` + + See |ale-integrations-local-executables| + + Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`. + + +g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options* + *b:ale_python_pydocstyle_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the + pydocstyle invocation. + + +g:ale_python_pydocstyle_use_global *g:ale_python_pydocstyle_use_global* + *b:ale_python_pydocstyle_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv* + *b:ale_python_pydocstyle_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. + + =============================================================================== pyflakes *ale-python-pyflakes* diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index f8a41999..bf971e7c 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -129,5 +129,27 @@ g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable* from binstubs or a bundle. +=============================================================================== +standardrb *ale-ruby-standardrb* + +g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* + *b:ale_ruby_standardrb_executable* + Type: String + Default: `'standardrb'` + + Override the invoked standardrb binary. Set this to `'bundle'` to invoke + `'bundle` `exec` standardrb'. + + +g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options* + *b:ale_ruby_standardrb_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to standardrb. + + +=============================================================================== + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-sass.txt b/sources_non_forked/ale/doc/ale-sass.txt index 08e9a381..735f44b2 100644 --- a/sources_non_forked/ale/doc/ale-sass.txt +++ b/sources_non_forked/ale/doc/ale-sass.txt @@ -2,6 +2,12 @@ ALE SASS Integration *ale-sass-options* +=============================================================================== +sasslint *ale-sass-sasslint* + +See |ale-scss-sasslint| for information about the available options. + + =============================================================================== stylelint *ale-sass-stylelint* diff --git a/sources_non_forked/ale/doc/ale-scss.txt b/sources_non_forked/ale/doc/ale-scss.txt index 3ad84fc1..07a94fe1 100644 --- a/sources_non_forked/ale/doc/ale-scss.txt +++ b/sources_non_forked/ale/doc/ale-scss.txt @@ -8,6 +8,33 @@ prettier *ale-scss-prettier* See |ale-javascript-prettier| for information about the available options. +=============================================================================== +sasslint *ale-scss-sasslint* + +g:ale_scss_sasslint_executable *g:ale_scss_sasslint_executable* + *b:ale_scss_sasslint_executable* + Type: |String| + Default: `'sass-lint'` + + See |ale-integrations-local-executables| + + +g:ale_scss_sasslint_options *g:ale_scss_sasslint_options* + *b:ale_scss_sasslint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to sass-lint. + + +g:ale_scss_sasslint_use_global *g:ale_scss_sasslint_use_global* + *b:ale_scss_sasslint_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== stylelint *ale-scss-stylelint* diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index 0cb0a7c2..7dc59820 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -21,9 +21,11 @@ tslint *ale-typescript-tslint* This linter isn't recommended, because TSLint can't be used for checking for problems while you type. You should probably use the tsserver plugin instead. +tsserver plugins are described here: +https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin Follow the instructions on the plugin website for installing it: -https://github.com/angelozerr/tsserver-plugins +https://github.com/Microsoft/typescript-tslint-plugin Then disable TSLint in vimrc or any other Vim configuration file. > let g:ale_linters_ignore = {'typescript': ['tslint']} diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 59b9f352..0b127725 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -21,6 +21,8 @@ CONTENTS *ale-contents* 6.1 Highlights........................|ale-highlights| 6.2 Options for write-good Linter.....|ale-write-good-options| 7. Integration Documentation............|ale-integrations| + ada...................................|ale-ada-options| + gcc.................................|ale-ada-gcc| ansible...............................|ale-ansible-options| ansible-lint........................|ale-ansible-ansible-lint| asciidoc..............................|ale-asciidoc-options| @@ -29,6 +31,8 @@ CONTENTS *ale-contents* gcc.................................|ale-asm-gcc| awk...................................|ale-awk-options| gawk................................|ale-awk-gawk| + bib...................................|ale-bib-options| + bibclean............................|ale-bib-bibclean| c.....................................|ale-c-options| clang...............................|ale-c-clang| clangd..............................|ale-c-clangd| @@ -92,6 +96,7 @@ CONTENTS *ale-contents* erlc................................|ale-erlang-erlc| syntaxerl...........................|ale-erlang-syntaxerl| eruby.................................|ale-eruby-options| + ruumba..............................|ale-eruby-ruumba| fish..................................|ale-fish-options| fortran...............................|ale-fortran-options| gcc.................................|ale-fortran-gcc| @@ -107,6 +112,7 @@ CONTENTS *ale-contents* go....................................|ale-go-options| gobuild.............................|ale-go-gobuild| gofmt...............................|ale-go-gofmt| + golint..............................|ale-go-golint| govet...............................|ale-go-govet| gometalinter........................|ale-go-gometalinter| staticcheck.........................|ale-go-staticcheck| @@ -138,10 +144,13 @@ CONTENTS *ale-contents* html..................................|ale-html-options| htmlhint............................|ale-html-htmlhint| tidy................................|ale-html-tidy| + prettier............................|ale-html-prettier| stylelint...........................|ale-html-stylelint| write-good..........................|ale-html-write-good| idris.................................|ale-idris-options| idris...............................|ale-idris-idris| + ispc..................................|ale-ispc-options| + ispc................................|ale-ispc-ispc| java..................................|ale-java-options| checkstyle..........................|ale-java-checkstyle| javac...............................|ale-java-javac| @@ -224,6 +233,7 @@ CONTENTS *ale-contents* phpstan.............................|ale-php-phpstan| psalm...............................|ale-php-psalm| php-cs-fixer........................|ale-php-php-cs-fixer| + php.................................|ale-php-php| po....................................|ale-po-options| write-good..........................|ale-po-write-good| pod...................................|ale-pod-options| @@ -250,6 +260,7 @@ CONTENTS *ale-contents* mypy................................|ale-python-mypy| prospector..........................|ale-python-prospector| pycodestyle.........................|ale-python-pycodestyle| + pydocstyle..........................|ale-python-pydocstyle| pyflakes............................|ale-python-pyflakes| pylint..............................|ale-python-pylint| pyls................................|ale-python-pyls| @@ -274,12 +285,14 @@ CONTENTS *ale-contents* ruby................................|ale-ruby-ruby| rufo................................|ale-ruby-rufo| solargraph..........................|ale-ruby-solargraph| + standardrb..........................|ale-ruby-standardrb| rust..................................|ale-rust-options| cargo...............................|ale-rust-cargo| rls.................................|ale-rust-rls| rustc...............................|ale-rust-rustc| rustfmt.............................|ale-rust-rustfmt| sass..................................|ale-sass-options| + sasslint............................|ale-sass-sasslint| stylelint...........................|ale-sass-stylelint| scala.................................|ale-scala-options| sbtserver...........................|ale-scala-sbtserver| @@ -287,6 +300,7 @@ CONTENTS *ale-contents* scalastyle..........................|ale-scala-scalastyle| scss..................................|ale-scss-options| prettier............................|ale-scss-prettier| + sasslint............................|ale-scss-sasslint| stylelint...........................|ale-scss-stylelint| sh....................................|ale-sh-options| sh-language-server..................|ale-sh-language-server| @@ -388,12 +402,14 @@ Notes: `^` No linters for text or Vim help filetypes are enabled by default. `!!` These linters check only files on disk. See |ale-lint-file-linters| +* Ada: `gcc` * ASM: `gcc` * Ansible: `ansible-lint` * API Blueprint: `drafter` -* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good` +* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good`, `vale` * Awk: `gawk` * Bash: `language-server`, `shell` (-n flag), `shellcheck`, `shfmt` +* BibTeX: `bibclean` * Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt` * C: `cppcheck`, `cpplint`!!, `clang`, `clangd`, `clangtidy`!!, `clang-format`, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls` * C++ (filetype cpp): `clang`, `clangd`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `clazy`!!, `cppcheck`, `cpplint`!!, `cquery`, `flawfinder`, `gcc`, `uncrustify`, `ccls` @@ -414,7 +430,7 @@ Notes: * Dockerfile: `dockerfile_lint`, `hadolint` * Elixir: `credo`, `dialyxir`, `dogma`, `mix`!!, `elixir-ls` * Elm: `elm-format, elm-make` -* Erb: `erb`, `erubi`, `erubis` +* Erb: `erb`, `erubi`, `erubis`, `ruumba` * Erlang: `erlc`, `SyntaxErl` * Fish: `fish` (-n flag) * Fortran: `gcc`, `language_server` @@ -429,8 +445,9 @@ Notes: * Handlebars: `ember-template-lint` * Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie` * HCL: `terraform-fmt` -* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good` +* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `prettier`, `write-good` * Idris: `idris` +* ISPC: `ispc`!! * Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`, `uncrustify` * JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo` * JSON: `fixjson`, `jsonlint`, `jq`, `prettier` @@ -463,14 +480,14 @@ Notes: * proto: `protoc-gen-lint` * Pug: `pug-lint` * Puppet: `languageserver`, `puppet`, `puppet-lint` -* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf` +* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pydocstyle`, `pyls`, `pyre`, `pylint`!!, `vulture`!!, `yapf` * QML: `qmlfmt`, `qmllint` * R: `lintr` * ReasonML: `merlin`, `ols`, `refmt` * reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good` * Re:VIEW: `redpen` * RPM spec: `rpmlint` -* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph` +* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`, `standardrb` * Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt` * SASS: `sass-lint`, `stylelint` * SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint` @@ -555,6 +572,7 @@ their relevant options. * By setting error highlights. - |g:ale_set_highlights| * By creating signs in the sign column. - |g:ale_set_signs| * By echoing messages based on your cursor. - |g:ale_echo_cursor| +* By inline text based on your cursor. - |g:ale_virtualtext_cursor| * By displaying the preview based on your cursor. - |g:ale_cursor_detail| * By showing balloons for your mouse cursor - |g:ale_set_balloons| @@ -859,6 +877,9 @@ settings. For example: > set ttymouse=xterm < +Documentation for symbols at the cursor can be retrieved using the +|ALEDocumentation| command. This command is only available for `tsserver`. + ------------------------------------------------------------------------------- 5.5 Symbol Search *ale-symbol-search* @@ -1184,6 +1205,9 @@ b:ale_fix_on_save *b:ale_fix_on_save* after files are fixed, only when the buffer is open, or re-opened. Changes to the file will be saved to the file on disk. + Files will not be fixed on `:wq`, so you should check your code before + closing a buffer. + Fixing files can be disabled or enabled for individual buffers by setting `b:ale_fix_on_save` to `0` or `1`. @@ -1362,6 +1386,7 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'systemverilog': 'verilog', \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', + \ 'vue': ['vue', 'javascript'], \ 'zsh': 'sh', \} < @@ -1410,6 +1435,7 @@ g:ale_linters *g:ale_linters* { \ 'csh': ['shell'], + \ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -1419,6 +1445,7 @@ g:ale_linters *g:ale_linters* \ 'rust': ['cargo'], \ 'spec': [], \ 'text': [], + \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \} < @@ -1866,6 +1893,49 @@ g:ale_use_global_executables *g:ale_use_global_executables* options. +g:ale_virtualtext_cursor *g:ale_virtualtext_cursor* + + Type: |Number| + Default: `0` + + When this option is set to `1`, a message will be shown when a cursor is + near a warning or error. ALE will attempt to find the warning or error at a + column nearest to the cursor when the cursor is resting on a line which + contains a warning or error. This option can be set to `0` to disable this + behavior. + + Messages are only displayed after a short delay. See |g:ale_virtualtext_delay|. + + Messages can be prefixed prefixed with a string. See |g:ale_virtualtext_prefix|. + + ALE will use the following highlight groups for problems: + + |ALEVirtualTextError| - Items with `'type': 'E'` + |ALEVirtualTextWarning| - Items with `'type': 'W'` + |ALEVirtualTextInfo| - Items with `'type': 'I'` + |ALEVirtualTextStyleError| - Items with `'type': 'E'` and `'sub_type': 'style'` + |ALEVirtualTextStyleWarning| - Items with `'type': 'W'` and `'sub_type': 'style'` + + +g:ale_virtualtext_delay *g:ale_virtualtext_delay* +b:ale_virtualtext_delay *b:ale_virtualtext_delay* + Type: |Number| + Default: `10` + + Given any integer, this option controls the number of milliseconds before + ALE will show a message for a problem near the cursor. + + The value can be increased to decrease the amount of processing ALE will do + for files displaying a large number of problems. + + +g:ale_virtualtext_prefix *g:ale_virtualtext_prefix* + + Type: |String| + Default: `'> '` + + Prefix to be used with |g:ale_virtualtext_cursor|. + g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names* @@ -1932,7 +2002,7 @@ ALEError *ALEError* Default: `highlight link ALEError SpellBad` - The highlight used for highlighted errors. See |g:ale_set_highlights|. + The highlight for highlighted errors. See |g:ale_set_highlights|. ALEErrorLine *ALEErrorLine* @@ -1949,21 +2019,21 @@ ALEErrorSign *ALEErrorSign* Default: `highlight link ALEErrorSign error` - The highlight used for error signs. See |g:ale_set_signs|. + The highlight for error signs. See |g:ale_set_signs|. ALEInfo *ALEInfo.* *ALEInfo-highlight* Default: `highlight link ALEInfo ALEWarning` - The highlight used for highlighted info messages. See |g:ale_set_highlights|. + The highlight for highlighted info messages. See |g:ale_set_highlights|. ALEInfoSign *ALEInfoSign* Default: `highlight link ALEInfoSign ALEWarningSign` - The highlight used for info message signs. See |g:ale_set_signs|. + The highlight for info message signs. See |g:ale_set_signs|. ALEInfoLine *ALEInfoLine* @@ -1980,35 +2050,70 @@ ALEStyleError *ALEStyleError* Default: `highlight link ALEStyleError ALEError` - The highlight used for highlighted style errors. See |g:ale_set_highlights|. + The highlight for highlighted style errors. See |g:ale_set_highlights|. ALEStyleErrorSign *ALEStyleErrorSign* Default: `highlight link ALEStyleErrorSign ALEErrorSign` - The highlight used for style error signs. See |g:ale_set_signs|. + The highlight for style error signs. See |g:ale_set_signs|. ALEStyleWarning *ALEStyleWarning* Default: `highlight link ALEStyleWarning ALEError` - The highlight used for highlighted style warnings. See |g:ale_set_highlights|. + The highlight for highlighted style warnings. See |g:ale_set_highlights|. ALEStyleWarningSign *ALEStyleWarningSign* Default: `highlight link ALEStyleWarningSign ALEWarningSign` - The highlight used for style warning signs. See |g:ale_set_signs|. + The highlight for style warning signs. See |g:ale_set_signs|. + + +ALEVirtualTextError *ALEVirtualTextError* + + Default: `highlight link ALEVirtualTextError ALEError` + + The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|. + + +ALEVirtualTextInfo *ALEVirtualTextInfo* + + Default: `highlight link ALEVirtualTextInfo ALEVirtualTextWarning` + + The highlight for virtualtext info. See |g:ale_virtualtext_cursor|. + + +ALEVirtualTextStyleError *ALEVirtualTextStyleError* + + Default: `highlight link ALEVirtualTextStyleError ALEVirtualTextError` + + The highlight for virtualtext style errors. See |g:ale_virtualtext_cursor|. + + +ALEVirtualTextStyleWarning *ALEVirtualTextStyleWarning* + + Default: `highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning` + + The highlight for virtualtext style warnings. See |g:ale_virtualtext_cursor|. + + +ALEVirtualTextWarning *ALEVirtualTextWarning* + + Default: `highlight link ALEVirtualTextWarning ALEWarning` + + The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|. ALEWarning *ALEWarning* Default: `highlight link ALEWarning SpellCap` - The highlight used for highlighted warnings. See |g:ale_set_highlights|. + The highlight for highlighted warnings. See |g:ale_set_highlights|. ALEWarningLine *ALEWarningLine* @@ -2025,7 +2130,7 @@ ALEWarningSign *ALEWarningSign* Default: `highlight link ALEWarningSign todo` - The highlight used for warning signs. See |g:ale_set_signs|. + The highlight for warning signs. See |g:ale_set_signs|. ------------------------------------------------------------------------------- @@ -2097,6 +2202,17 @@ ALE will use to search for Python executables. =============================================================================== 8. Commands/Keybinds *ale-commands* +ALEDocumentation *ALEDocumentation* + + Similar to the |ALEHover| command, retrieve documentation information for + the symbol at the cursor. Documentation data will always be shown in a + preview window, no matter how small the documentation content is. + + NOTE: This command is only available for `tsserver`. + + A plug mapping `(ale_documentation)` is defined for this command. + + ALEFindReferences *ALEFindReferences* Find references in the codebase for the symbol under the cursor using the diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index 7ef19775..610ff142 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -112,6 +112,9 @@ let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) " This flag can be set to 1 to automatically show errors in the preview window. let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0) +" This flag can be set to 1 to enable virtual text when the cursor moves. +let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', 0) + " This flag can be set to 1 to automatically close the preview window upon " entering Insert Mode. let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) @@ -190,9 +193,11 @@ command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in_tab': 1 " Find references for tsserver and LSP command! -bar ALEFindReferences :call ale#references#Find() -" Get information for the cursor. -command! -bar ALEHover :call ale#hover#Show(bufnr(''), getcurpos()[1], - \ getcurpos()[2], {}) +" Show summary information for the cursor. +command! -bar ALEHover :call ale#hover#ShowAtCursor() + +" Show documentation for the cursor. +command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor() " Search for appearances of a symbol, such as a type name or function name. command! -nargs=1 ALESymbolSearch :call ale#symbol#Search() @@ -219,6 +224,7 @@ nnoremap (ale_go_to_definition) :ALEGoToDefinition nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover +nnoremap (ale_documentation) :ALEDocumentation " Set up autocmd groups now. call ale#events#Init() diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index aef0204c..44e66ed2 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -2567,9 +2567,13 @@ fu! ctrlp#getvar(var) endf "}}}1 " * Initialization {{{1 -fu! ctrlp#setlines(...) +fu! s:setlines_pre(...) if a:0 | let s:itemtype = a:1 | en cal s:modevar() + let g:ctrlp_lines = [] +endf + +fu! s:setlines_post() let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'} let types = map(copy(g:ctrlp_types), 'inits[v:val]') if !empty(g:ctrlp_ext_vars) @@ -2578,6 +2582,11 @@ fu! ctrlp#setlines(...) let g:ctrlp_lines = eval(types[s:itemtype]) endf +fu! ctrlp#setlines(...) + cal call('s:setlines_pre', a:000) + cal s:setlines_post() +endf + " Returns [lname, sname] fu! s:CurTypeName() if s:itemtype < len(s:coretypes) @@ -2632,8 +2641,16 @@ fu! ctrlp#init(type, ...) retu en en - cal ctrlp#setlines(s:settype(type)) + " Fixed issue ctrlpvim/ctrlp.vim#463 : Opening 'ctrlp' in certain modes + " (':CtrlPBufTag', ':CtrlPLine') seems to trigger a partially deffective + " intialisation (for example, syntax highlighting not working as expected). + " Fix: ctrlp#setlines() split in two, as the second part (now in + " s:setlines_post()) seems to need '&filetype', and s:DetectFileType() seems + " to need the first part of the old ctrlp#setlines() (now in + " s:setlines_pre()). + cal s:setlines_pre(s:settype(type)) let &filetype = s:DetectFileType(type, &filetype) + cal s:setlines_post() cal ctrlp#syntax() cal s:SetDefTxt() let curName = s:CurTypeName() diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index ca4c9dd7..2076a114 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,16 +2,17 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2018/09/17 12:00:00. +" Last Change: 2018/11/24 12:00:00. " ============================================================================= let s:save_cpo = &cpo set cpo&vim -let s:_ = 1 +let s:_ = 1 " 1: uninitialized, 2: disabled function! lightline#update() abort if s:_ + if s:_ == 2 | return | endif call lightline#init() call lightline#colorscheme() endif @@ -40,11 +41,8 @@ function! lightline#update_disable() abort endfunction function! lightline#enable() abort - call lightline#colorscheme() + let s:_ = 1 call lightline#update() - if s:lightline.enable.tabline - set tabline=%!lightline#tabline() - endif augroup lightline autocmd! autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update() @@ -74,6 +72,7 @@ function! lightline#disable() abort autocmd! autocmd WinEnter * call lightline#update_disable() augroup END + let s:_ = 2 endfunction function! lightline#toggle() abort diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 6f3f176b..7c2a886b 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -452,13 +452,9 @@ In order to change the syntastic component more outstanding, you have to use \ 'syntastic': 'error', \ } \ } - let g:syntastic_mode_map = { 'mode': 'passive' } - augroup AutoSyntastic - autocmd! - autocmd BufWritePost *.c,*.cpp call s:syntastic() - augroup END - function! s:syntastic() - SyntasticCheck + " Syntastic can call a post-check hook, let's update lightline there + " For more information: :help syntastic-loclist-callback + function! SyntasticCheckHook(errors) call lightline#update() endfunction < @@ -908,12 +904,9 @@ For users who uses lots of plugins: return lightline#statusline(0) endfunction - augroup AutoSyntastic - autocmd! - autocmd BufWritePost *.c,*.cpp call s:syntastic() - augroup END - function! s:syntastic() - SyntasticCheck + " Syntastic can call a post-check hook, let's update lightline there + " For more information: :help syntastic-loclist-callback + function! SyntasticCheckHook(errors) call lightline#update() endfunction diff --git a/sources_non_forked/lightline.vim/test/toggle.vim b/sources_non_forked/lightline.vim/test/toggle.vim index c6042a86..7df270f8 100644 --- a/sources_non_forked/lightline.vim/test/toggle.vim +++ b/sources_non_forked/lightline.vim/test/toggle.vim @@ -11,6 +11,7 @@ endfunction function! s:suite.default() call s:assert.equals(exists('#lightline'), 1) call s:assert.equals(exists('#lightline-disable'), 0) + call s:assert.not_equals(&statusline, '') call s:assert.not_equals(&tabline, '') endfunction @@ -18,10 +19,15 @@ function! s:suite.disable_enable() call lightline#disable() call s:assert.equals(exists('#lightline'), 0) call s:assert.equals(exists('#lightline-disable'), 1) + call s:assert.equals(&statusline, '') + call s:assert.equals(&tabline, '') + call lightline#update() + call s:assert.equals(&statusline, '') call s:assert.equals(&tabline, '') call lightline#enable() call s:assert.equals(exists('#lightline'), 1) call s:assert.equals(exists('#lightline-disable'), 0) + call s:assert.not_equals(&statusline, '') call s:assert.not_equals(&tabline, '') endfunction @@ -29,9 +35,11 @@ function! s:suite.toggle() call lightline#toggle() call s:assert.equals(exists('#lightline'), 0) call s:assert.equals(exists('#lightline-disable'), 1) + call s:assert.equals(&statusline, '') call s:assert.equals(&tabline, '') call lightline#toggle() call s:assert.equals(exists('#lightline'), 1) call s:assert.equals(exists('#lightline-disable'), 0) + call s:assert.not_equals(&statusline, '') call s:assert.not_equals(&tabline, '') endfunction diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 42c31cca..b86cdf11 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1,23 +1,23 @@ -*NERDTree.txt* A tree explorer plugin that owns your momma! - - - - omg its ... ~ - - ________ ________ _ ____________ ____ __________ ____________~ - /_ __/ / / / ____/ / | / / ____/ __ \/ __ \ /_ __/ __ \/ ____/ ____/~ - / / / /_/ / __/ / |/ / __/ / /_/ / / / / / / / /_/ / __/ / __/ ~ - / / / __ / /___ / /| / /___/ _, _/ /_/ / / / / _, _/ /___/ /___ ~ - /_/ /_/ /_/_____/ /_/ |_/_____/_/ |_/_____/ /_/ /_/ |_/_____/_____/ ~ - - - Reference Manual~ - - - +*NERDTree.txt* A tree explorer plugin to rule the Vim world. Bwahahaha!! + # #### #### ~ + ### \/#|### |/#### ~ + d8 888 ##\/#/ \||/##/_/##/_# ~ + d88 888 ee ,e e, ### \/###|/ \/ # ### ~ + d88888 888 88b d88 88b ##_\_#\_\## | #/###_/_#### ~ + 888 888 888 888 , ## #### # \ #| / #### ##/## ~ + 888 888 888 "YeeP" __#_--###`. |{,###---###-~ ~ + \ % @% ~ + Y88b Y88 888'Y88 888 88e 888 88e \%@% 88P'888'Y88 ~ + Y88b Y8 888 ,'Y 888 888D 888 888b %o% P' 888 'Y 888,8, ,e e, ,e e, ~ + b Y88b Y 888C8 888 88" 888 8888D %@% 888 888 " d88 88b d88 88b ~ + 8b Y88b 888 ",d 888 b, 888 888P %@% 888 888 888 , 888 , ~ + 88b Y88b 888,d88 888 88b, 888 88" %@% 888 888 "YeeP" "YeeP" ~ + , -=-%{@%-^- _ ~ + ejm `} Reference Manual ~ + { ~ ============================================================================== -CONTENTS *NERDTree-contents* +CONTENTS *NERDTree-contents* 1.Intro...................................|NERDTree| 2.Functionality provided..................|NERDTreeFunctionality| @@ -28,9 +28,9 @@ CONTENTS *NERDTree-contents* 2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks| 2.3.NERD tree mappings................|NERDTreeMappings| 2.4.The NERD tree menu................|NERDTreeMenu| - 3.Options.................................|NERDTreeOptions| - 3.1.Option summary....................|NERDTreeOptionSummary| - 3.2.Option details....................|NERDTreeOptionDetails| + 3.Settings................................|NERDTreeSettings| + 3.1.Settings summary..................|NERDTreeSettingsSummary| + 3.2.Settings details..................|NERDTreeSettingsDetails| 4.The NERD tree API.......................|NERDTreeAPI| 4.1.Key map API.......................|NERDTreeKeymapAPI| 4.2.Menu API..........................|NERDTreeMenuAPI| @@ -40,7 +40,7 @@ CONTENTS *NERDTree-contents* 6.License.................................|NERDTreeLicense| ============================================================================== -1. Intro *NERDTree* +1. Intro *NERDTree* What is this "NERD tree"?? @@ -94,12 +94,12 @@ The following features and functionality are provided by the NERD tree: ============================================================================== -2. Functionality provided *NERDTreeFunctionality* +2. Functionality provided *NERDTreeFunctionality* ------------------------------------------------------------------------------ -2.1. Global Commands *NERDTreeGlobalCommands* +2.1. Global Commands *NERDTreeGlobalCommands* -:NERDTree [ | ] *:NERDTree* +:NERDTree [ | ] *:NERDTree* Opens a fresh NERD tree. The root of the tree depends on the argument given. There are 3 cases: If no argument is given, the current directory will be used. If a directory is given, that will be used. If a bookmark @@ -107,21 +107,29 @@ The following features and functionality are provided by the NERD tree: :NERDTree /home/marty/vim7/src :NERDTree foo (foo is the name of a bookmark) < -:NERDTreeFromBookmark *:NERDTreeFromBookmark* +:NERDTreeVCS [ | ] *:NERDTreeVCS* + Like |:NERDTree|, but searches up the directory tree to find the top of + the version control system repository, and roots the NERD tree there. It + works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A + couple of examples: > + :NERDTreeVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree) + :NERDTreeVCS (opens root of repository containing CWD) +< +:NERDTreeFromBookmark *:NERDTreeFromBookmark* Opens a fresh NERD tree with the root initialized to the dir for . The only reason to use this command over :NERDTree is for the completion (which is for bookmarks rather than directories). -:NERDTreeToggle [ | ] *:NERDTreeToggle* +:NERDTreeToggle [ | ] *:NERDTreeToggle* If a NERD tree already exists for this tab, it is reopened and rendered again. If no NERD tree exists for this tab then this command acts the same as the |:NERDTree| command. -:NERDTreeFocus *:NERDTreeFocus* +:NERDTreeFocus *:NERDTreeFocus* Opens (or reopens) the NERD Tree if it is not currently visible; otherwise, the cursor is moved to the already-open NERD Tree. -:NERDTreeMirror *:NERDTreeMirror* +:NERDTreeMirror *:NERDTreeMirror* Shares an existing NERD tree, from another tab, in the current tab. Changes made to one tree are reflected in both as they are actually the same buffer. @@ -129,10 +137,10 @@ The following features and functionality are provided by the NERD tree: If only one other NERD tree exists, that tree is automatically mirrored. If more than one exists, the script will ask which tree to mirror. -:NERDTreeClose *:NERDTreeClose* +:NERDTreeClose *:NERDTreeClose* Close the NERD tree in this tab. -:NERDTreeFind [] *:NERDTreeFind* +:NERDTreeFind [] *:NERDTreeFind* Without the optional argument, find and reveal the file for the active buffer in the NERDTree window. With the argument, find and reveal the specified path. @@ -141,29 +149,29 @@ The following features and functionality are provided by the NERD tree: placed on the tree node for the determined path. If a NERDTree for the current tab does not exist, a new one will be initialized. -:NERDTreeCWD *:NERDTreeCWD* +:NERDTreeCWD *:NERDTreeCWD* Change the NERDTree root to the current working directory. If no NERDTree exists for this tab, a new one is opened. -:NERDTreeRefreshRoot *:NERDTreeRefreshRoot* +:NERDTreeRefreshRoot *:NERDTreeRefreshRoot* Refreshes the NERD tree root node. ------------------------------------------------------------------------------ -2.2. Bookmarks *NERDTreeBookmarks* +2.2. Bookmarks *NERDTreeBookmarks* Bookmarks in the NERD tree are a way to tag files or directories of interest. For example, you could use bookmarks to tag all of your project directories. ------------------------------------------------------------------------------ -2.2.1. The Bookmark Table *NERDTreeBookmarkTable* +2.2.1. The Bookmark Table *NERDTreeBookmarkTable* If the bookmark table is active (see |NERDTree-B| and -|'NERDTreeShowBookmarks'|), it will be rendered above the tree. You can double +|NERDTreeShowBookmarks|), it will be rendered above the tree. You can double click bookmarks or use the |NERDTree-o| mapping to activate them. See also, |NERDTree-t| and |NERDTree-T| ------------------------------------------------------------------------------ -2.2.2. Bookmark commands *NERDTreeBookmarkCommands* +2.2.2. Bookmark commands *NERDTreeBookmarkCommands* Note: The following commands are only available within the NERDTree buffer. @@ -199,18 +207,18 @@ Note: The following commands are only available within the NERDTree buffer. Remove all bookmarks. :ReadBookmarks - Re-read the bookmarks in the |'NERDTreeBookmarksFile'|. + Re-read the bookmarks in the |NERDTreeBookmarksFile|. See also |:NERDTree| and |:NERDTreeFromBookmark|. ------------------------------------------------------------------------------ -2.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks* +2.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks* If invalid bookmarks are detected, the script will issue an error message and the invalid bookmarks will become unavailable for use. These bookmarks will still be stored in the bookmarks file (see -|'NERDTreeBookmarksFile'|), down the bottom. There will always be a blank line +|NERDTreeBookmarksFile|), down the bottom. There will always be a blank line after the valid bookmarks but before the invalid ones. Each line in the bookmarks file represents one bookmark. The proper format is: @@ -220,60 +228,59 @@ After you have corrected any invalid bookmarks, either restart vim, or go :ReadBookmarks from the NERD tree window. ------------------------------------------------------------------------------ -2.3. NERD tree Mappings *NERDTreeMappings* +2.3. NERD tree Mappings *NERDTreeMappings* -Default Description~ help-tag~ -Key~ +Default~ +Key Description help-tag~ -o.......Open files, directories and bookmarks....................|NERDTree-o| -go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go| -t.......Open selected node/bookmark in a new tab.................|NERDTree-t| -T.......Same as 't' but keep the focus on the current tab........|NERDTree-T| -i.......Open selected file in a split window.....................|NERDTree-i| -gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi| -s.......Open selected file in a new vsplit.......................|NERDTree-s| -gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs| -O.......Recursively open the selected directory..................|NERDTree-O| -x.......Close the current nodes parent...........................|NERDTree-x| -X.......Recursively close all children of the current node.......|NERDTree-X| -e.......Edit the current dir.....................................|NERDTree-e| +o........Open files, directories and bookmarks......................|NERDTree-o| +go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go| +t........Open selected node/bookmark in a new tab...................|NERDTree-t| +T........Same as 't' but keep the focus on the current tab..........|NERDTree-T| +i........Open selected file in a split window.......................|NERDTree-i| +gi.......Same as i, but leave the cursor on the NERDTree...........|NERDTree-gi| +s........Open selected file in a new vsplit.........................|NERDTree-s| +gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs| +O........Recursively open the selected directory....................|NERDTree-O| +x........Close the current nodes parent.............................|NERDTree-x| +X........Recursively close all children of the current node.........|NERDTree-X| +e........Edit the current dir.......................................|NERDTree-e| -...............same as |NERDTree-o|. -double-click.......same as the |NERDTree-o| map. -middle-click.......same as |NERDTree-i| for files, same as - |NERDTree-e| for dirs. +............same as |NERDTree-o|. +double-click....same as |NERDTree-o|. +middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs. -D.......Delete the current bookmark .............................|NERDTree-D| +D........Delete the current bookmark ...............................|NERDTree-D| -P.......Jump to the root node....................................|NERDTree-P| -p.......Jump to current nodes parent.............................|NERDTree-p| -K.......Jump up inside directories at the current tree depth.....|NERDTree-K| -J.......Jump down inside directories at the current tree depth...|NERDTree-J| -...Jump down to the next sibling of the current directory...|NERDTree-C-J| -...Jump up to the previous sibling of the current directory.|NERDTree-C-K| +P........Jump to the root node......................................|NERDTree-P| +p........Jump to current nodes parent...............................|NERDTree-p| +K........Jump up inside directories at the current tree depth.......|NERDTree-K| +J........Jump down inside directories at the current tree depth.....|NERDTree-J| +....Jump down to next sibling of the current directory.......|NERDTree-C-J| +....Jump up to previous sibling of the current directory.....|NERDTree-C-K| -C.......Change the tree root to the selected dir.................|NERDTree-C| -u.......Move the tree root up one directory......................|NERDTree-u| -U.......Same as 'u' except the old root node is left open........|NERDTree-U| -r.......Recursively refresh the current directory................|NERDTree-r| -R.......Recursively refresh the current root.....................|NERDTree-R| -m.......Display the NERD tree menu...............................|NERDTree-m| -cd......Change the CWD to the dir of the selected node...........|NERDTree-cd| -CD......Change tree root to the CWD..............................|NERDTree-CD| +C........Change the tree root to the selected dir...................|NERDTree-C| +u........Move the tree root up one directory........................|NERDTree-u| +U........Same as 'u' except the old root node is left open..........|NERDTree-U| +r........Recursively refresh the current directory..................|NERDTree-r| +R........Recursively refresh the current root.......................|NERDTree-R| +m........Display the NERD tree menu.................................|NERDTree-m| +cd.......Change the CWD to the dir of the selected node............|NERDTree-cd| +CD.......Change tree root to the CWD...............................|NERDTree-CD| -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| +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| -q.......Close the NERDTree window................................|NERDTree-q| -A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A| -?.......Toggle the display of the quick help.....................|NERDTree-?| +q........Close the NERDTree window..................................|NERDTree-q| +A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A| +?........Toggle the display of the quick help.......................|NERDTree-?| ------------------------------------------------------------------------------ - *NERDTree-o* + *NERDTree-o* Default key: o -Map option: NERDTreeMapActivateNode +Map setting: NERDTreeMapActivateNode Applies to: files and directories. If a file node is selected, it is opened in the previous window. @@ -288,9 +295,9 @@ If a bookmark that links to a file is selected then that file is opened in the previous window. ------------------------------------------------------------------------------ - *NERDTree-go* + *NERDTree-go* Default key: go -Map option: NERDTreeMapPreview +Map setting: NERDTreeMapPreview Applies to: files. If a file node is selected, it is opened in the previous window, but the @@ -300,9 +307,9 @@ The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see |NERDTree-o|). ------------------------------------------------------------------------------ - *NERDTree-t* + *NERDTree-t* Default key: t -Map option: NERDTreeMapOpenInTab +Map setting: NERDTreeMapOpenInTab Applies to: files and directories. Opens the selected file in a new tab. If a directory is selected, a fresh @@ -313,26 +320,26 @@ that directory in a new tab. If the bookmark points to a file, open that file in a new tab. ------------------------------------------------------------------------------ - *NERDTree-T* + *NERDTree-T* Default key: T -Map option: NERDTreeMapOpenInTabSilent +Map setting: NERDTreeMapOpenInTabSilent Applies to: files and directories. The same as |NERDTree-t| except that the focus is kept in the current tab. ------------------------------------------------------------------------------ - *NERDTree-i* + *NERDTree-i* Default key: i -Map option: NERDTreeMapOpenSplit +Map setting: NERDTreeMapOpenSplit Applies to: files. Opens the selected file in a new split window and puts the cursor in the new window. ------------------------------------------------------------------------------ - *NERDTree-gi* + *NERDTree-gi* Default key: gi -Map option: NERDTreeMapPreviewSplit +Map setting: NERDTreeMapPreviewSplit Applies to: files. The same as |NERDTree-i| except that the cursor is not moved. @@ -341,18 +348,18 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see |NERDTree-i|). ------------------------------------------------------------------------------ - *NERDTree-s* + *NERDTree-s* Default key: s -Map option: NERDTreeMapOpenVSplit +Map setting: NERDTreeMapOpenVSplit Applies to: files. -Opens the selected file in a new vertically split window and puts the cursor in -the new window. +Opens the selected file in a new vertically split window and puts the cursor +in the new window. ------------------------------------------------------------------------------ - *NERDTree-gs* + *NERDTree-gs* Default key: gs -Map option: NERDTreeMapPreviewVSplit +Map setting: NERDTreeMapPreviewVSplit Applies to: files. The same as |NERDTree-s| except that the cursor is not moved. @@ -361,30 +368,30 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see |NERDTree-s|). ------------------------------------------------------------------------------ - *NERDTree-O* + *NERDTree-O* Default key: O -Map option: NERDTreeMapOpenRecursively +Map setting: NERDTreeMapOpenRecursively Applies to: directories. Recursively opens the selected directory. All files and directories are cached, but if a directory would not be -displayed due to file filters (see |'NERDTreeIgnore'| |NERDTree-f|) or the -hidden file filter (see |'NERDTreeShowHidden'|) then its contents are not +displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the +hidden file filter (see |NERDTreeShowHidden|) then its contents are not cached. This is handy, especially if you have .svn directories. ------------------------------------------------------------------------------ - *NERDTree-x* + *NERDTree-x* Default key: x -Map option: NERDTreeMapCloseDir +Map setting: NERDTreeMapCloseDir Applies to: files and directories. Closes the parent of the selected node. ------------------------------------------------------------------------------ - *NERDTree-X* + *NERDTree-X* Default key: X -Map option: NERDTreeMapCloseChildren +Map setting: NERDTreeMapCloseChildren Applies to: directories. Recursively closes all children of the selected directory. @@ -392,43 +399,43 @@ Recursively closes all children of the selected directory. Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping. ------------------------------------------------------------------------------ - *NERDTree-e* + *NERDTree-e* Default key: e -Map option: NERDTreeMapOpenExpl +Map setting: NERDTreeMapOpenExpl Applies to: files and directories. |:edit|s the selected directory, or the selected file's directory. This could result in a NERD tree or a netrw being opened, depending on -|'NERDTreeHijackNetrw'|. +|NERDTreeHijackNetrw|. ------------------------------------------------------------------------------ - *NERDTree-D* + *NERDTree-D* Default key: D -Map option: NERDTreeMapDeleteBookmark +Map setting: NERDTreeMapDeleteBookmark Applies to: lines in the bookmarks table Deletes the currently selected bookmark. ------------------------------------------------------------------------------ - *NERDTree-P* + *NERDTree-P* Default key: P -Map option: NERDTreeMapJumpRoot +Map setting: NERDTreeMapJumpRoot Applies to: no restrictions. Jump to the tree root. ------------------------------------------------------------------------------ - *NERDTree-p* + *NERDTree-p* Default key: p -Map option: NERDTreeMapJumpParent +Map setting: NERDTreeMapJumpParent Applies to: files and directories. Jump to the parent node of the selected node. ------------------------------------------------------------------------------ - *NERDTree-K* + *NERDTree-K* Default key: K -Map option: NERDTreeMapJumpFirstChild +Map setting: NERDTreeMapJumpFirstChild Applies to: files and directories. Jump to the first child of the current nodes parent. @@ -439,9 +446,9 @@ If the cursor is already on the first node then do the following: * go to the first child of that node ------------------------------------------------------------------------------ - *NERDTree-J* + *NERDTree-J* Default key: J -Map option: NERDTreeMapJumpLastChild +Map setting: NERDTreeMapJumpLastChild Applies to: files and directories. Jump to the last child of the current nodes parent. @@ -452,50 +459,50 @@ If the cursor is already on the last node then do the following: * go to the last child of that node ------------------------------------------------------------------------------ - *NERDTree-C-J* + *NERDTree-C-J* Default key: -Map option: NERDTreeMapJumpNextSibling +Map setting: NERDTreeMapJumpNextSibling Applies to: files and directories. Jump to the next sibling of the selected node. ------------------------------------------------------------------------------ - *NERDTree-C-K* + *NERDTree-C-K* Default key: -Map option: NERDTreeMapJumpPrevSibling +Map setting: NERDTreeMapJumpPrevSibling Applies to: files and directories. Jump to the previous sibling of the selected node. ------------------------------------------------------------------------------ - *NERDTree-C* + *NERDTree-C* Default key: C -Map option: NERDTreeMapChangeRoot +Map setting: NERDTreeMapChangeRoot Applies to: files and directories. Make the selected directory node the new tree root. If a file is selected, its parent is used. ------------------------------------------------------------------------------ - *NERDTree-u* + *NERDTree-u* Default key: u -Map option: NERDTreeMapUpdir +Map setting: NERDTreeMapUpdir Applies to: no restrictions. Move the tree root up a dir (like doing a "cd .."). ------------------------------------------------------------------------------ - *NERDTree-U* + *NERDTree-U* Default key: U -Map option: NERDTreeMapUpdirKeepOpen +Map setting: NERDTreeMapUpdirKeepOpen Applies to: no restrictions. Like |NERDTree-u| except that the old tree root is kept open. ------------------------------------------------------------------------------ - *NERDTree-r* + *NERDTree-r* Default key: r -Map option: NERDTreeMapRefresh +Map setting: NERDTreeMapRefresh Applies to: files and directories. If a dir is selected, recursively refresh that dir, i.e. scan the filesystem @@ -504,95 +511,95 @@ for changes and represent them in the tree. If a file node is selected then the above is done on it's parent. ------------------------------------------------------------------------------ - *NERDTree-R* + *NERDTree-R* Default key: R -Map option: NERDTreeMapRefreshRoot +Map setting: NERDTreeMapRefreshRoot Applies to: no restrictions. Recursively refresh the tree root. ------------------------------------------------------------------------------ - *NERDTree-m* + *NERDTree-m* Default key: m -Map option: NERDTreeMapMenu +Map setting: NERDTreeMapMenu Applies to: files and directories. Display the NERD tree menu. See |NERDTreeMenu| for details. ------------------------------------------------------------------------------ - *NERDTree-cd* + *NERDTree-cd* Default key: cd -Map option: NERDTreeMapChdir +Map setting: NERDTreeMapChdir Applies to: files and directories. Change Vim's current working directory to that of the selected node. ------------------------------------------------------------------------------ - *NERDTree-CD* + *NERDTree-CD* Default key: CD -Map option: NERDTreeMapCWD +Map setting: NERDTreeMapCWD Applies to: no restrictions. Change the NERDTree root to Vim's current working directory. ------------------------------------------------------------------------------ - *NERDTree-I* + *NERDTree-I* Default key: I -Map option: NERDTreeMapToggleHidden +Map setting: NERDTreeMapToggleHidden Applies to: no restrictions. Toggles whether hidden files (i.e. "dot files") are displayed. ------------------------------------------------------------------------------ - *NERDTree-f* + *NERDTree-f* Default key: f -Map option: NERDTreeMapToggleFilters +Map setting: NERDTreeMapToggleFilters Applies to: no restrictions. -Toggles whether file filters are used. See |'NERDTreeIgnore'| for details. +Toggles whether file filters are used. See |NERDTreeIgnore| for details. ------------------------------------------------------------------------------ - *NERDTree-F* + *NERDTree-F* Default key: F -Map option: NERDTreeMapToggleFiles +Map setting: NERDTreeMapToggleFiles Applies to: no restrictions. Toggles whether file nodes are displayed. ------------------------------------------------------------------------------ - *NERDTree-B* + *NERDTree-B* Default key: B -Map option: NERDTreeMapToggleBookmarks +Map setting: NERDTreeMapToggleBookmarks Applies to: no restrictions. Toggles whether the bookmarks table is displayed. ------------------------------------------------------------------------------ - *NERDTree-q* + *NERDTree-q* Default key: q -Map option: NERDTreeMapQuit +Map setting: NERDTreeMapQuit Applies to: no restrictions. -Closes the NERDtree window. +Closes the NERDTree window. ------------------------------------------------------------------------------ - *NERDTree-A* + *NERDTree-A* Default key: A -Map option: NERDTreeMapToggleZoom +Map setting: NERDTreeMapToggleZoom Applies to: no restrictions. -Maximize (zoom) and minimize the NERDtree window. +Maximize (zoom) and minimize the NERDTree window. ------------------------------------------------------------------------------ - *NERDTree-?* + *NERDTree-?* Default key: ? -Map option: NERDTreeMapHelp +Map setting: NERDTreeMapHelp Applies to: no restrictions. Toggles whether the quickhelp is displayed. ------------------------------------------------------------------------------ -2.3. The NERD tree menu *NERDTreeMenu* +2.3. The NERD tree menu *NERDTreeMenu* The NERD tree has a menu that can be programmed via the an API (see |NERDTreeMenuAPI|). The idea is to simulate the "right click" menus that most @@ -605,127 +612,148 @@ menu item to execute executable files. Related tags: |NERDTree-m| |NERDTreeApi| +------------------------------------------------------------------------------ + *NERDTreeMenu-j* +Default key: j +Map option: NERDTreeMenuDown +Applies to: The NERD tree menu. + +Moves the cursor down. + +------------------------------------------------------------------------------ + *NERDTreeMenu-k* +Default key: k +Map option: NERDTreeMenuUp +Applies to: The NERD tree menu. + +Moves the cursor up. + ============================================================================== -3. Customisation *NERDTreeOptions* +3. Customisation *NERDTreeSettings* ------------------------------------------------------------------------------ -3.1. Customisation summary *NERDTreeOptionSummary* +3.1. Customisation summary *NERDTreeSettingsSummary* -The script provides the following options that can customise the behaviour the -NERD tree. These options should be set in your vimrc. +The plugin provides the following settings that can customise the behaviour +the NERD tree. These settings should be set in your vimrc, using `:let`. -|'loaded_nerd_tree'| Turns off the script. +|loaded_nerd_tree| Turns off the script. -|'NERDTreeAutoCenter'| Controls whether the NERD tree window centers - when the cursor moves within a specified - distance to the top/bottom of the window. +|NERDTreeAutoCenter| Controls whether the NERD tree window centers + when the cursor moves within a specified + distance to the top/bottom of the window. -|'NERDTreeAutoCenterThreshold'| Controls the sensitivity of autocentering. +|NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering. -|'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case - sensitive or not when sorting nodes. +|NERDTreeCaseSensitiveSort| Tells the NERD tree whether to be case + sensitive or not when sorting nodes. -|'NERDTreeNaturalSort'| Tells the NERD tree whether to use - natural sort order or not when sorting nodes. +|NERDTreeNaturalSort| Tells the NERD tree whether to use natural sort + order or not when sorting nodes. -|'NERDTreeSortHiddenFirst'| Tells the NERD tree whether to take the dot - at the beginning of the hidden file names - into account when sorting nodes. +|NERDTreeSortHiddenFirst| Tells the NERD tree whether to take the dot at + the beginning of the hidden file names into + account when sorting nodes. -|'NERDTreeChDirMode'| Tells the NERD tree if/when it should change - vim's current working directory. +|NERDTreeChDirMode| Tells the NERD tree if/when it should change + vim's current working directory. -|'NERDTreeHighlightCursorline'| Tell the NERD tree whether to highlight the - current cursor line. +|NERDTreeHighlightCursorline| Tell the NERD tree whether to highlight the + current cursor line. -|'NERDTreeHijackNetrw'| Tell the NERD tree whether to replace the netrw - autocommands for exploring local directories. +|NERDTreeHijackNetrw| Tell the NERD tree whether to replace the netrw + autocommands for exploring local directories. -|'NERDTreeIgnore'| Tells the NERD tree which files to ignore. +|NERDTreeIgnore| Tells the NERD tree which files to ignore. -|'NERDTreeRespectWildIgnore'| Tells the NERD tree to respect |'wildignore'|. +|NERDTreeRespectWildIgnore| Tells the NERD tree to respect `'wildignore'`. -|'NERDTreeBookmarksFile'| Where the bookmarks are stored. +|NERDTreeBookmarksFile| Where the bookmarks are stored. -|'NERDTreeBookmarksSort'| Control how the Bookmark table is sorted. +|NERDTreeBookmarksSort| Control how the Bookmark table is sorted. -|'NERDTreeMarkBookmarks'| Render bookmarked nodes with markers. +|NERDTreeMarkBookmarks| Render bookmarked nodes with markers. -|'NERDTreeMouseMode'| Manage the interpretation of mouse clicks. +|NERDTreeMouseMode| Manage the interpretation of mouse clicks. -|'NERDTreeQuitOnOpen'| Closes the tree window after opening a file. +|NERDTreeQuitOnOpen| Closes the tree window after opening a file. -|'NERDTreeShowBookmarks'| Tells the NERD tree whether to display the - bookmarks table on startup. +|NERDTreeShowBookmarks| Tells the NERD tree whether to display the + bookmarks table on startup. -|'NERDTreeShowFiles'| Tells the NERD tree whether to display files - in the tree on startup. +|NERDTreeShowFiles| Tells the NERD tree whether to display files in + the tree on startup. -|'NERDTreeShowHidden'| Tells the NERD tree whether to display hidden - files on startup. +|NERDTreeShowHidden| Tells the NERD tree whether to display hidden + files on startup. -|'NERDTreeShowLineNumbers'| Tells the NERD tree whether to display line - numbers in the tree window. +|NERDTreeShowLineNumbers| Tells the NERD tree whether to display line + numbers in the tree window. -|'NERDTreeSortOrder'| Tell the NERD tree how to sort the nodes in - the tree. +|NERDTreeSortOrder| Tell the NERD tree how to sort the nodes in the + tree. -|'NERDTreeStatusline'| Set a statusline for NERD tree windows. +|NERDTreeStatusline| Set a statusline for NERD tree windows. -|'NERDTreeWinPos'| Tells the script where to put the NERD tree - window. +|NERDTreeWinPos| Tells the script where to put the NERD tree + window. -|'NERDTreeWinSize'| Sets the window size when the NERD tree is - opened. +|NERDTreeWinSize| Sets the window size when the NERD tree is + opened. -|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and - 'Press ? for help' text. +|NERDTreeMinimalUI| Disables display of the 'Bookmarks' label and + 'Press ? for help' text. -|'NERDTreeCascadeSingleChildDir'| - Collapses on the same line directories that - have only one child directory. +|NERDTreeCascadeSingleChildDir| + Collapses on the same line directories that have + only one child directory. -|'NERDTreeCascadeOpenSingleChildDir'| - Cascade open while selected directory has only - one child that also is a directory. +|NERDTreeCascadeOpenSingleChildDir| + Cascade open while selected directory has only + one child that also is a directory. -|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove - a buffer when a file is being deleted or renamed - via a context menu command. +|NERDTreeAutoDeleteBuffer| Tells the NERD tree to automatically remove a + buffer when a file is being deleted or renamed + via a context menu command. -|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the - NERDTree window. +|NERDTreeCreatePrefix| Specify a prefix to be used when creating the + NERDTree window. -|'NERDTreeRemoveFileCmd'| Specify a custom shell command to be used when - deleting files. Note that it should include - one space character at the end of the command - and it applies only to files. +|NERDTreeRemoveFileCmd| Specify a custom shell command to be used when + deleting files. Note that it should include one + space character at the end of the command and it + applies only to files. -|'NERDTreeRemoveDirCmd'| Specify a custom shell command to be used when - deleting directories. Note that it should - include one space character at the end of the - command and it applies only to directories. +|NERDTreeRemoveDirCmd| Specify a custom shell command to be used when + deleting directories. Note that it should + include one space character at the end of the + command and it applies only to directories. + +|NERDTreeNodeDelimiter| A single character that is used to separate the + file or directory name from the rest of the + characters on the line of text. ------------------------------------------------------------------------------ -3.2. Customisation details *NERDTreeOptionDetails* +3.2. Customisation details *NERDTreeSettingsDetails* -To enable any of the below options you should put the given line in your -~/.vimrc +To enable any of the below settings you should put an appropriate > + let = + let loaded_nerd_tree=1 < ------------------------------------------------------------------------------ - *'NERDTreeAutoCenter'* + *NERDTreeAutoCenter* Values: 0 or 1. Default: 1 If set to 1, the NERD tree window will center around the cursor if it moves to -within |'NERDTreeAutoCenterThreshold'| lines of the top/bottom of the window. +within |NERDTreeAutoCenterThreshold| lines of the top/bottom of the window. This is ONLY done in response to tree navigation mappings, i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p| @@ -734,15 +762,15 @@ i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p| The centering is done with a |zz| operation. ------------------------------------------------------------------------------ - *'NERDTreeAutoCenterThreshold'* + *NERDTreeAutoCenterThreshold* Values: Any natural number. Default: 3 -This option controls the "sensitivity" of the NERD tree auto centering. See -|'NERDTreeAutoCenter'| for details. +This setting controls the "sensitivity" of the NERD tree auto centering. See +|NERDTreeAutoCenter| for details. ------------------------------------------------------------------------------ - *'NERDTreeCaseSensitiveSort'* + *NERDTreeCaseSensitiveSort* Values: 0 or 1. Default: 0. @@ -754,8 +782,8 @@ could appear like this: > boner.c Foo.c < -But, if you set this option to 1 then the case of the nodes will be taken into -account. The above nodes would then be sorted like this: > +But, if you set this setting to 1 then the case of the nodes will be taken +into account. The above nodes would then be sorted like this: > Baz.c Foo.c bar.c @@ -763,7 +791,7 @@ account. The above nodes would then be sorted like this: > boner.c < ------------------------------------------------------------------------------ - *'NERDTreeNaturalSort'* + *NERDTreeNaturalSort* Values: 0 or 1. Default: 0. @@ -778,7 +806,7 @@ could appear like this: > z20.txt z3.txt < -But if you set this option to 1 then the natural sort order will be used. The +But if you set this setting to 1 then the natural sort order will be used. The above nodes would then be sorted like this: > z1.txt z2.txt @@ -790,12 +818,12 @@ above nodes would then be sorted like this: > z110.txt < ------------------------------------------------------------------------------ - *'NERDTreeChDirMode'* + *NERDTreeChDirMode* Values: 0, 1 or 2. Default: 0. -Use this option to tell the script when (if at all) to change the current +Use this setting to tell the script when (if at all) to change the current working directory (CWD) for vim. If it is set to 0 then the CWD is never changed by the NERD tree. @@ -807,21 +835,21 @@ directory it is initialized in. For example, if you start the NERD tree with > then the CWD will be changed to /home/marty/foobar and will not be changed again unless you init another NERD tree with a similar command. -If the option is set to 2 then it behaves the same as if set to 1 except that +If the setting is set to 2 then it behaves the same as if set to 1 except that the CWD is changed whenever the tree root is changed. For example, if the CWD is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new root then the CWD will become /home/marty/foobar/baz. ------------------------------------------------------------------------------ - *'NERDTreeHighlightCursorline'* + *NERDTreeHighlightCursorline* Values: 0 or 1. Default: 1. If set to 1, the current cursor line in the NERD tree buffer will be -highlighted. This is done using the |'cursorline'| option. +highlighted. This is done using the `'cursorline'` Vim option. ------------------------------------------------------------------------------ - *'NERDTreeHijackNetrw'* + *NERDTreeHijackNetrw* Values: 0 or 1. Default: 1. @@ -837,13 +865,13 @@ following respects: 2. you can have one tree per window - instead of per tab. ------------------------------------------------------------------------------ - *'NERDTreeIgnore'* + *NERDTreeIgnore* Values: a list of regular expressions. Default: ['\~$']. -This option is used to specify which files the NERD tree should ignore. It +This setting is used to specify which files the NERD tree should ignore. It must be a list of regular expressions. When the NERD tree is rendered, any -files/dirs that match any of the regex's in 'NERDTreeIgnore' wont be +files/dirs that match any of the regex's in NERDTreeIgnore won't be displayed. For example if you put the following line in your vimrc: > @@ -868,25 +896,25 @@ The file filters can be turned on and off dynamically with the |NERDTree-f| mapping. ------------------------------------------------------------------------------ - *'NERDTreeRespectWildIgnore'* + *NERDTreeRespectWildIgnore* Values: 0 or 1. Default: 0. -If set to 1, the |'wildignore'| setting is respected. +If set to 1, the `'wildignore'` setting is respected. ------------------------------------------------------------------------------ - *'NERDTreeBookmarksFile'* + *NERDTreeBookmarksFile* Values: a path Default: $HOME/.NERDTreeBookmarks This is where bookmarks are saved. See |NERDTreeBookmarkCommands|. ------------------------------------------------------------------------------ - *'NERDTreeBookmarksSort'* + *NERDTreeBookmarksSort* Values: 0, 1, or 2 Default: 1 -This option controls the method by which the list of user bookmarks is +This setting controls the method by which the list of user bookmarks is sorted. When sorted, bookmarks will render in alphabetical order by name. If set to 0, the bookmarks list is not sorted. @@ -894,16 +922,16 @@ If set to 1, the bookmarks list is sorted in a case-insensitive manner. If set to 2, the bookmarks list is sorted in a case-sensitive manner. ------------------------------------------------------------------------------ - *'NERDTreeMarkBookmarks'* + *NERDTreeMarkBookmarks* Values: 0 or 1 Default: 1 If set to 1, Bookmarks will be specially marked whenever the NERDTree is -rendered. Users of the |'NERDTreeMinimalUI'| setting may prefer to disable +rendered. Users of the |NERDTreeMinimalUI| setting may prefer to disable this setting for even less visual clutter. ------------------------------------------------------------------------------ - *'NERDTreeMouseMode'* + *NERDTreeMouseMode* Values: 1, 2 or 3. Default: 1. @@ -921,7 +949,7 @@ then (to single click activate it) you must click somewhere in 'application.rb'. ------------------------------------------------------------------------------ - *'NERDTreeQuitOnOpen'* + *NERDTreeQuitOnOpen* Values: 0 or 1. Default: 0 @@ -930,67 +958,67 @@ If set to 1, the NERD tree window will close after opening a file with the |NERDTree-o|, |NERDTree-i|, |NERDTree-t| and |NERDTree-T| mappings. ------------------------------------------------------------------------------ - *'NERDTreeShowBookmarks'* + *NERDTreeShowBookmarks* Values: 0 or 1. Default: 0. -If this option is set to 1 then the bookmarks table will be displayed. +If this setting is set to 1 then the bookmarks table will be displayed. -This option can be toggled dynamically, per tree, with the |NERDTree-B| +This setting can be toggled dynamically, per tree, with the |NERDTree-B| mapping. ------------------------------------------------------------------------------ - *'NERDTreeShowFiles'* + *NERDTreeShowFiles* Values: 0 or 1. Default: 1. -If this option is set to 1 then files are displayed in the NERD tree. If it is -set to 0 then only directories are displayed. +If this setting is set to 1 then files are displayed in the NERD tree. If it +is set to 0 then only directories are displayed. -This option can be toggled dynamically, per tree, with the |NERDTree-F| +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. ------------------------------------------------------------------------------ - *'NERDTreeShowHidden'* + *NERDTreeShowHidden* Values: 0 or 1. Default: 0. -This option tells vim whether to display hidden files by default. This option -can be dynamically toggled, per tree, with the |NERDTree-I| mapping. Use one -of the follow lines to set this option: > +This setting tells vim whether to display hidden files by default. This +setting can be dynamically toggled, per tree, with the |NERDTree-I| mapping. +Use one of the follow lines for this setting: > let NERDTreeShowHidden=0 let NERDTreeShowHidden=1 < ------------------------------------------------------------------------------ - *'NERDTreeShowLineNumbers'* + *NERDTreeShowLineNumbers* Values: 0 or 1. Default: 0. -This option tells vim whether to display line numbers for the NERD tree -window. Use one of the follow lines to set this option: > +This setting tells vim whether to display line numbers for the NERD tree +window. Use one of the follow lines for this setting: > let NERDTreeShowLineNumbers=0 let NERDTreeShowLineNumbers=1 < ------------------------------------------------------------------------------ - *'NERDTreeSortOrder'* + *NERDTreeSortOrder* Values: a list of regular expressions. Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$'] -This option is set to a list of regular expressions which are used to -specify the order of nodes under their parent. +This setting is a list of regular expressions which are used to specify the +order of nodes under their parent. -For example, if the option is set to: > +For example, if the setting is: > ['\.vim$', '\.c$', '\.h$', '*', 'foobar'] < then all .vim files will be placed at the top, followed by all .c files then all .h files. All files containing the string 'foobar' will be placed at the end. The star is a special flag: it tells the script that every node that -doesnt match any of the other regexps should be placed here. +doesn't match any of the other regexps should be placed here. -If no star is present in 'NERDTreeSortOrder' then one is automatically +If no star is present in NERDTreeSortOrder then one is automatically appended to the array. The regex '\/$' should be used to match directory nodes. @@ -1004,7 +1032,7 @@ done secondarily. See examples 4, 5, and 6 below. After this sorting is done, the files in each group are sorted alphabetically. -Other examples: > +Examples: > (1) ['*', '\/$'] (2) [] (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$'] @@ -1024,100 +1052,123 @@ Other examples: > Each group is shown newest to oldest. ------------------------------------------------------------------------------ - *'NERDTreeStatusline'* -Values: Any valid |'statusline'| setting. + *NERDTreeStatusline* +Values: Any valid `'statusline'` setting. Default: %{exists('b:NERDTree')?b:NERDTree.root.path.str():''} -Defines the value for the |'statusline'| setting in NERDTree windows. +Defines the value for the `'statusline'` setting in NERDTree windows. Note: The setting is actually applied using |:let-&|, not |:set|, so escaping spaces is not necessary. -Setting this option to -1 will deactivate it so that your global -|'statusline'| setting is used. +Setting this to -1 will deactivate it so that your global `'statusline'` +setting is used. ------------------------------------------------------------------------------ - *'NERDTreeWinPos'* + *NERDTreeWinPos* Values: "left" or "right" Default: "left". -This option is used to determine where NERD tree window is placed on the +This setting is used to determine where NERD tree window is placed on the screen. -This option makes it possible to use two different explorer plugins +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 NERD tree on the right. ------------------------------------------------------------------------------ - *'NERDTreeWinSize'* + *NERDTreeWinSize* Values: a positive integer. Default: 31. -This option is used to change the size of the NERD tree when it is loaded. +This setting is used to change the size of the NERD tree when it is loaded. ------------------------------------------------------------------------------ - *'NERDTreeMinimalUI'* + *NERDTreeMinimalUI* Values: 0 or 1 Default: 0 -This options disables the 'Bookmarks' label 'Press ? for help' text. Use one -of the following lines to set this option: > +This setting disables the 'Bookmarks' label 'Press ? for help' text. Use one +of the following lines for this setting: > let NERDTreeMinimalUI=0 let NERDTreeMinimalUI=1 < ------------------------------------------------------------------------------ - *'NERDTreeCascadeSingleChildDir'* + *NERDTreeCascadeSingleChildDir* Values: 0 or 1 Default: 1. -When displaying dir nodes, this option tells NERDTree to collapse dirs that -have only one child. Use one of the follow lines to set this option: > +When displaying dir nodes, this setting tells NERDTree to collapse dirs that +have only one child. Use one of the following lines for this setting: > let NERDTreeCascadeSingleChildDir=0 let NERDTreeCascadeSingleChildDir=1 < ------------------------------------------------------------------------------ - *'NERDTreeCascadeOpenSingleChildDir'* + *NERDTreeCascadeOpenSingleChildDir* Values: 0 or 1 Default: 1. -When opening dir nodes, this option tells NERDTree to recursively open dirs +When opening dir nodes, this setting tells NERDTree to recursively open dirs that have only one child which is also a dir. NERDTree will stop when it finds -a dir that contains anything but another single dir. This option also causes -the |NERDTree-x| mapping to close dirs in the same manner. This option may be -useful for Java projects. Use one of the follow lines to set this option: > +a dir that contains anything but another single dir. This setting also causes +the |NERDTree-x| mapping to close dirs in the same manner. This setting may be +useful for Java projects. Use one of the following lines for this setting: > let NERDTreeCascadeOpenSingleChildDir=0 let NERDTreeCascadeOpenSingleChildDir=1 < ------------------------------------------------------------------------------ - *'NERDTreeAutoDeleteBuffer'* + *NERDTreeAutoDeleteBuffer* Values: 0 or 1 Default: 0. -When using a context menu to delete or rename a file you may also want to delete -the buffer which is no more valid. If the option is not set you will see a -confirmation if you really want to delete an old buffer. If you always press 'y' -then it worths to set this option to 1. Use one of the follow lines to set this -option: > +When using a context menu to delete or rename a file you may also want to +delete the buffer which is no more valid. If the setting is not set you will +see a confirmation if you really want to delete an old buffer. If you always +press 'y' then it's worth it to set this setting to 1. Use one of the +following lines for this setting: > let NERDTreeAutoDeleteBuffer=0 let NERDTreeAutoDeleteBuffer=1 < ------------------------------------------------------------------------------ - *'NERDTreeCreatePrefix'* + *NERDTreeCreatePrefix* Values: Any valid command prefix. Default: "silent". Internally, NERDTree uses the |:edit| command to create a buffer in which to display its tree view. You can augment this behavior by specifying a prefix string such as "keepalt" or similar. For example, to have NERDTree create its -tree window using `silent keepalt keepjumps edit`: +tree window using `silent keepalt keepjumps edit`: > let NERDTreeCreatePrefix='silent keepalt keepjumps' < +------------------------------------------------------------------------------ + *NERDTreeNodeDelimiter* +Values: Any single character. +Default: "\x07" - the non-printable character BELL. + +This character is used to separate the file or directory name from the rest of +the characters in the line of text. It allows filenames to contain special +characters that are otherwise used in the NERDTree, such as square brackets, +braces, trailing asterisk, and leading space. For more details, see the +resoponsible pull request: https://github.com/scrooloose/nerdtree/pull/868. + +The default should work in nearly every situation, but this setting exists for +those very rare cases where it doesn't. "\x07" was chosen because it's +non-printable, and very unlikely to be used purposefully in a filename or as a +flag by other NERDTree plugins. If you need to change the delimiter, be sure +to choose a character that won't appear in your filenames or any of the flags +set by your installed NERDTree plugins. The suggestions below are but a few of +the many possibilities. Remember to use double quotes when specifying by hex +or Unicode. > + let NERDTreeNodeDelimiter='😀' + let NERDTreeNodeDelimiter="\u00a0" + let NERDTreeNodeDelimiter="\xFF" +< ============================================================================== -4. The NERD tree API *NERDTreeAPI* +4. The NERD tree API *NERDTreeAPI* The NERD tree script allows you to add custom key mappings and menu items via a set of API calls. Any scripts that use this API should be placed in @@ -1140,9 +1191,9 @@ See this blog post for more details: http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html ------------------------------------------------------------------------------ -4.1. Key map API *NERDTreeKeymapAPI* +4.1. Key map API *NERDTreeKeymapAPI* -NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* +NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* Adds a new keymapping for all NERD tree buffers. {options} must be a dictionary, and must contain the following keys: "key" - the trigger key for the new mapping @@ -1182,7 +1233,7 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* ------------------------------------------------------------------------------ 4.2. Menu API *NERDTreeMenuAPI* -NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()* +NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()* Creates and returns a new submenu. {options} must be a dictionary and must contain the following keys: @@ -1191,15 +1242,15 @@ NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()* The following keys are optional: "isActiveCallback" - a function that will be called to determine whether - this submenu item will be displayed or not. The callback function must return - 0 or 1. + this submenu item will be displayed or not. The callback function must + return 0 or 1. "parent" - the parent submenu of the new submenu (returned from a previous invocation of NERDTreeAddSubmenu()). If this key is left out then the new submenu will sit under the top level menu. See below for an example. -NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()* +NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()* Adds a new menu item to the NERD tree menu (see |NERDTreeMenu|). {options} must be a dictionary and must contain the @@ -1219,7 +1270,7 @@ NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()* See below for an example. -NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()* +NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()* Adds a menu separator (a row of dashes). {options} is an optional dictionary that may contain the following keys: @@ -1262,7 +1313,7 @@ When any of the 3 concrete menu items are selected the function "SomeFunction" will be called. ------------------------------------------------------------------------------ -4.3 NERDTreeAddPathFilter(callback) *NERDTreeAddPathFilter()* +4.3 NERDTreeAddPathFilter(callback) *NERDTreeAddPathFilter()* Path filters are essentially a more powerful version of |NERDTreeIgnore|. If the simple regex matching in |NERDTreeIgnore| is not enough then use @@ -1279,7 +1330,7 @@ checked against when the decision to ignore them is made. Example > endfunction < ------------------------------------------------------------------------------ -4.4 Path Listener API *NERDTreePathListenerAPI* +4.4 Path Listener API *NERDTreePathListenerAPI* Use this API if you want to run a callback for events on Path objects. E.G > @@ -1291,7 +1342,7 @@ Use this API if you want to run a callback for events on Path objects. E.G > "This function will be called whenever a Path object is created. "a:event is an object that contains a bunch of relevant info - - "including the path in question. See lib/nerdtree/event.vim for details. + "including the affected path. See lib/nerdtree/event.vim for details. endfunction < Current events supported: @@ -1300,29 +1351,42 @@ Current events supported: refreshFlags ~ ------------------------------------------------------------------------------ -NERDTreeRender() *NERDTreeRender()* +NERDTreeRender() *NERDTreeRender()* Re-renders the NERD tree buffer. Useful if you change the state of the tree and you want to it to be reflected in the UI. ============================================================================== -5. About *NERDTreeAbout* +5. About *NERDTreeAbout* The author of the NERD tree is a terrible terrible monster called Martyzilla who gobbles up small children with milk and sugar for breakfast. He can be reached at martin.grenfell at gmail dot com. He would love to hear from you, so feel free to send him suggestions and/or comments about this -plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in -the fridge for later ;) +plugin. Don't be shy --- the worst he can do is slaughter you and stuff you +in the fridge for later ;) -The latest stable versions can be found at - http://www.vim.org/scripts/script.php?script_id=1658 +Martyzilla recruited two other unwitting accomplices to become his minions in +his quest to conquer the Vim plugin world. While he may still love to receive +your emails, the best way to send suggestions, bug reports, and questions is +to submit an issue at http://github.com/scrooloose/nerdtree/issues. -The latest dev versions are on github - http://github.com/scrooloose/nerdtree +The latest stable and development versions are on Github. + Stable: http://github.com/scrooloose/nerdtree (master branch) + Development: http://github.com/scrooloose/nerdtree/branches + +Title Credit: + * http://ascii.co.uk/art/tree + + * Patrick Gillespie's Text ASCII Art Generator + http://patorjk.com/software/taag + http://patorjk.com/software/taag/#p=display&f=Rozzo&t=the%20NERD%20Tree ============================================================================== -6. License *NERDTreeLicense* +6. License *NERDTreeLicense* The NERD tree is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. + +------------------------------------------------------------------------------ + vim:tw=78:ts=8:ft=help:noet:nospell diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 78dfd9eb..1afd0564 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -33,7 +33,7 @@ function! s:Creator._broadcastInitEvent() silent doautocmd User NERDTreeInit endfunction -" FUNCTION: s:Creator.BufNamePrefix() {{{2 +" FUNCTION: s:Creator.BufNamePrefix() {{{1 function! s:Creator.BufNamePrefix() return 'NERD_tree_' endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim index 68e4d304..84bdb26b 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim @@ -49,7 +49,7 @@ endfunction "FUNCTION: MenuController._echoPrompt() {{{1 function! s:MenuController._echoPrompt() - echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated" + echo "NERDTree Menu. Use " . g:NERDTreeMenuDown . "/" . g:NERDTreeMenuUp . "/enter and the shortcuts indicated" echo "==========================================================" for i in range(0, len(self.menuItems)-1) @@ -71,9 +71,9 @@ endfunction "change the selection (if appropriate) and return 1 if the user has made "their choice, 0 otherwise function! s:MenuController._handleKeypress(key) - if a:key == 'j' + if a:key == g:NERDTreeMenuDown call self._cursorDown() - elseif a:key == 'k' + elseif a:key == g:NERDTreeMenuUp call self._cursorUp() elseif a:key == nr2char(27) "escape let self.selection = -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 b7b7d8f9..658ff09e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -254,6 +254,13 @@ function! s:TreeDirNode.getChildIndex(path) return -1 endfunction +" FUNCTION: TreeDirNode.getDirChildren() {{{1 +" Return a list of all child nodes from "self.children" that are of type +" TreeDirNode. This function supports http://github.com/scrooloose/nerdtree-project-plugin.git. +function! s:TreeDirNode.getDirChildren() + return filter(copy(self.children), 'v:val.path.isDirectory == 1') +endfunction + " FUNCTION: TreeDirNode._glob(pattern, all) {{{1 " Return a list of strings naming the descendants of the directory in this " TreeDirNode object that match the specified glob pattern. @@ -370,12 +377,26 @@ function! s:TreeDirNode.hasVisibleChildren() endfunction " FUNCTION: TreeDirNode.isCascadable() {{{1 -" true if this dir has only one visible child - which is also a dir +" true if this dir has only one visible child that is also a dir +" false if this dir is bookmarked or symlinked. Why? Two reasons: +" 1. If cascaded, we don't know which dir is bookmarked or is a symlink. +" 2. If the parent is a symlink or is bookmarked, you end up with unparsable +" text, and NERDTree cannot get the path of any child node. function! s:TreeDirNode.isCascadable() if g:NERDTreeCascadeSingleChildDir == 0 return 0 endif + if self.path.isSymLink + return 0 + endif + + for i in g:NERDTreeBookmark.Bookmarks() + if i.path.equals(self.path) + return 0 + endif + endfor + let c = self.getVisibleChildren() return len(c) == 1 && c[0].path.isDirectory endfunction diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 62506e53..c3de3f21 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -86,8 +86,8 @@ let g:NERDTreeOldSortOrder = [] call s:initVariable("g:NERDTreeGlyphReadOnly", "RO") -" ASCII 160: non-breaking space used to delimit items in the tree's nodes. -call s:initVariable("g:NERDTreeNodeDelimiter", "\u00a0") +" ASCII 7: bell non-printing character used to delimit items in the tree's nodes. +call s:initVariable("g:NERDTreeNodeDelimiter", "\x07") if !exists('g:NERDTreeStatusline') @@ -148,6 +148,8 @@ call s:initVariable("g:NERDTreeMapToggleZoom", "A") call s:initVariable("g:NERDTreeMapUpdir", "u") call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U") call s:initVariable("g:NERDTreeMapCWD", "CD") +call s:initVariable("g:NERDTreeMenuDown", "j") +call s:initVariable("g:NERDTreeMenuUp", "k") "SECTION: Load class files{{{2 call nerdtree#loadClassFiles() diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 172806b8..99773bf1 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -33,15 +33,15 @@ exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# cont "highlighting for readonly files exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile' -syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile -syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir +syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile +syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir "highlighing to conceal the delimiter around the file/dir name if has("conceal") - exec 'syn match NERDTreeNodeDelimiters #' . g:NERDTreeNodeDelimiter . '# conceal containedin=NERDTreeFile,NERDTreeLinkFile,NERDTreeExecFile,NERDTreeRO,NERDTreeDir' + exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL' setlocal conceallevel=3 concealcursor=nvic else - exec 'syn match NERDTreeNodeDelimiters #' . g:NERDTreeNodeDelimiter . '# containedin=NERDTreeFile,NERDTreeLinkFile,NERDTreeExecFile,NERDTreeRO,NERDTreeDir' + exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL' hi! link NERDTreeNodeDelimiters Ignore endif diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim index db3e5d67..4a97542e 100644 --- a/sources_non_forked/vim-abolish/plugin/abolish.vim +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -527,7 +527,7 @@ function! s:commands.abbrev.process(bang,line1,line2,count,args) let cmd = cmd . " " endif let [bad, good] = s:badgood(a:args) - if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$' + if substitute(bad, '[{},]', '', 'g') !~# '^\k*$' call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")") endif if !self.options.delete && good == "" @@ -620,12 +620,14 @@ function! s:coerce(type) abort endtry endfunction -nnoremap (abolish-coerce) coerce(nr2char(getchar())).'iw' +nnoremap (abolish-coerce) coerce(nr2char(getchar())) +nnoremap (abolish-coerce) coerce(nr2char(getchar())) +nnoremap (abolish-coerce-word) coerce(nr2char(getchar())).'iw' " }}}1 if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings - nmap cr (abolish-coerce) + nmap cr (abolish-coerce-word) endif command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 622a2d07..d8063a61 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -2986,7 +2986,7 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort if empty(s:Relative('/')) call s:throw('file or blob required') endif - if filter(copy(a:args),'v:val !~# "^\\%(--root\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] + if filter(copy(a:args),'v:val !~# "^\\%(--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] call s:throw('unsupported option') endif call map(a:args,'s:sub(v:val,"^\\ze[^-]","-")') diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 8311d422..06b14625 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1,6 +1,6 @@ " fugitive.vim - A Git wrapper so awesome, it should be illegal " Maintainer: Tim Pope -" Version: 2.4 +" Version: 2.5 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') @@ -68,6 +68,10 @@ function! FugitiveParse(...) abort throw v:errmsg endfunction +function! FugitivePrepare(...) abort + return call('fugitive#Prepare', a:000) +endfunction + function! FugitiveConfig(key, ...) abort return fugitive#Config(a:key, FugitiveGitDir(a:0 ? a:1 : -1)) endfunction @@ -205,14 +209,6 @@ function! FugitiveDetect(path) abort endif endfunction -function! FugitiveRoute(...) abort - return call('FugitiveFind', a:000) -endfunction - -function! FugitiveGenerate(...) abort - throw 'Use FugitiveFind() instead' -endfunction - function! s:Slash(path) abort if exists('+shellslash') return tr(a:path, '\', '/') diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim index 7413930d..40f2ad29 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim @@ -77,13 +77,19 @@ endfunction function! s:on_stderr_vim(channel, _data) dict abort call self.handler.err(self.buffer) - try - call ch_close(a:channel) " so close_cb and its 'out' handler are not triggered - catch /E906/ - " noop - endtry endfunction -function! s:on_exit_vim(_channel) dict abort - call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n")) +function! s:on_exit_vim(channel) dict abort + let job = ch_getjob(a:channel) + while 1 + if job_status(job) == 'dead' + let exit_code = job_info(job).exitval + break + endif + sleep 5m + endwhile + + if !exit_code + call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n")) + endif endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 68b21172..b270db73 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -13,6 +13,7 @@ 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 " Returns a diff of the buffer against the index or the working tree. " @@ -89,6 +90,11 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " git-diff). let buff_file = s:temp_buffer.'.'.a:bufnr + " Add a counter to avoid a similar race with two quick writes of the same buffer. + " Use a modulus greater than a maximum reasonable number of visible buffers. + let s:counter = (s:counter + 1) % 20 + let buff_file .= '.'.s:counter + let extension = gitgutter#utility#extension(a:bufnr) if !empty(extension) let buff_file .= '.'.extension @@ -104,6 +110,9 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " reading it (with git-diff). let from_file = s:temp_from.'.'.a:bufnr + " Add a counter to avoid a similar race with two quick writes of the same buffer. + let from_file .= '.'.s:counter + if !empty(extension) let from_file .= '.'.extension endif @@ -365,6 +374,13 @@ endfunction function! s:write_buffer(bufnr, file) let bufcontents = getbufline(a:bufnr, 1, '$') + if bufcontents == [''] && line2byte(1) == -1 + " Special case: completely empty buffer. + " A nearly empty buffer of only a newline has line2byte(1) == 1. + call writefile([], a:file) + return + endif + if getbufvar(a:bufnr, '&fileformat') ==# 'dos' call map(bufcontents, 'v:val."\r"') endif diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim index 277be949..6486fa42 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -8,7 +8,12 @@ endfunction function! gitgutter#utility#setbufvar(buffer, varname, val) let buffer = +a:buffer - let dict = get(getbufvar(buffer, '', {}), 'gitgutter', {}) + " Default value for getbufvar() was introduced in Vim 7.3.831. + let bvars = getbufvar(buffer, '') + if empty(bvars) + let bvars = {} + endif + let dict = get(bvars, 'gitgutter', {}) let needs_setting = empty(dict) let dict[a:varname] = a:val if needs_setting @@ -115,7 +120,7 @@ function! gitgutter#utility#set_repo_path(bufnr) abort " * -2 - not tracked by git call gitgutter#utility#setbufvar(a:bufnr, 'path', -1) - let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -- '.gitgutter#utility#shellescape(s:filename(a:bufnr))) + let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -z -- '.gitgutter#utility#shellescape(s:filename(a:bufnr))) if g:gitgutter_async && gitgutter#async#available() if has('lambda') @@ -202,8 +207,13 @@ function! s:exists_file(bufnr) abort return filereadable(s:abs_path(a:bufnr, 0)) endfunction +" Get rid of any trailing new line or SOH character. +" +" git ls-files -z produces output with null line termination. +" Vim's system() replaces any null characters in the output +" with SOH (start of header), i.e. ^A. function! s:strip_trailing_new_line(line) abort - return substitute(a:line, '\n$', '', '') + return substitute(a:line, '[[:cntrl:]]$', '', '') endfunction function! gitgutter#utility#windows() diff --git a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim index 1e13cc60..855eca3d 100644 --- a/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/test/test_gitgutter.vim @@ -191,6 +191,20 @@ function Test_filename_leading_dash() endfunction +function Test_filename_umlaut() + call system('touch -- fixtüre.txt && git add -- fixtüre.txt') + edit fixtüre.txt + normal ggo* + call s:trigger_gitgutter() + + let expected = [ + \ 'line=1 id=3000 name=GitGutterLineAdded', + \ 'line=2 id=3001 name=GitGutterLineAdded' + \ ] + call assert_equal(expected, s:signs('fixtüre.txt')) +endfunction + + " FIXME: this test fails when it is the first (or only) test to be run function Test_follow_symlink() let tmp = 'symlink' @@ -273,6 +287,7 @@ function Test_untracked_file_within_repo() call s:trigger_gitgutter() call assert_equal([], s:signs(tmp)) + call assert_equal(-2, b:gitgutter.path) call system('rm '.tmp) endfunction @@ -633,3 +648,33 @@ function Test_encoding() call assert_equal([], s:signs('cp932.txt')) endfunction + + +function Test_empty_file() + " 0-byte file + call system('touch empty.txt && git add empty.txt') + edit empty.txt + + call s:trigger_gitgutter() + call assert_equal([], s:signs('empty.txt')) + + + " File consisting only of a newline + call system('echo "" > newline.txt && git add newline.txt') + edit newline.txt + + call s:trigger_gitgutter() + call assert_equal([], s:signs('newline.txt')) + + + " 1 line file without newline + " Vim will force a newline unless we tell it not to. + call system('echo -n a > oneline.txt && git add oneline.txt') + set noeol nofixeol + edit! oneline.txt + + call s:trigger_gitgutter() + call assert_equal([], s:signs('oneline.txt')) + + set eol fixeol +endfunction diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index cbbe6c4d..aa570e9d 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,5 +1,36 @@ ## unplanned +IMPROVEMENTS: +* Disable `g:go_gocode_propose_source` by default. + [[GH-2050]](https://github.com/fatih/vim-go/pull/2050) +* Don't spam users when Vim is run with vi compatibility. + [[GH-2055]](https://github.com/fatih/vim-go/pull/2055) +* Add bang support to lint commands to allow them to be run without jumping to + errors. + [[GH-2056]](https://github.com/fatih/vim-go/pull/2056) +* Use `go doc` for `:GoDoc` instead of `godoc`. + [[GH-2070]](https://github.com/fatih/vim-go/pull/2070) +* Detach from and shutdown dlv correctly. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Do not require `'autowrite'` or `'autowriteall'` to be set when using + autocompletion in module mode. + [[GH-2091]](https://github.com/fatih/vim-go/pull/2091) + +BUG FIXES: +* Fix opening of non-existent file from `:GoDeclsDir` when the current + directory is not the directory containing the current buffer. + [[GH-2048]](https://github.com/fatih/vim-go/pull/2048) +* Fix jumping to an identifier with godef from a modified buffer. + [[GH-2054]](https://github.com/fatih/vim-go/pull/2054) +* Fix errors when `g:go_debug` contains `debugger-commands`. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Fix errors from `:GoDebugStop` in Neovim. + [[GH-2075]](https://github.com/fatih/vim-go/pull/2075) +* Fix `:GoSameIdsToggle`. + [[GH-2086]](https://github.com/fatih/vim-go/pull/2086) + +## 1.19 - (November 4, 2018) + FEATURES: * **go.mod file support!** This is the first feature for upcoming Go modules @@ -64,6 +95,8 @@ IMPROVEMENTS: [[GH-2025]](https://github.com/fatih/vim-go/pull/2025) * Update autocompletion to work with Go modules. [[GH-1988]](https://github.com/fatih/vim-go/pull/1988) +* Add an option to search $GOPATH/bin or $GOBIN _after_ $PATH. + [[GH-2041]](https://github.com/fatih/vim-go/pull/2041) BUG FIXES: * Fix `:GoRun %` on Windows. diff --git a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim index 5e68b3f9..5d652998 100644 --- a/sources_non_forked/vim-go/autoload/ctrlp/decls.vim +++ b/sources_non_forked/vim-go/autoload/ctrlp/decls.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:go_decls_var = { \ 'init': 'ctrlp#decls#init()', \ 'exit': 'ctrlp#decls#exit()', @@ -20,7 +24,7 @@ function! ctrlp#decls#init() abort endfunction function! ctrlp#decls#exit() abort - unlet! s:decls s:current_dir s:target + unlet! s:decls s:target endfunction " The action to perform on the selected string @@ -32,10 +36,6 @@ function! ctrlp#decls#accept(mode, str) abort let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let dir = getcwd() try - " we jump to the file directory so we can get the fullpath via fnamemodify - " below - execute cd . s:current_dir - let vals = matchlist(a:str, '|\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)|') " i.e: main.go @@ -50,14 +50,10 @@ function! ctrlp#decls#accept(mode, str) abort call ctrlp#acceptfile(a:mode, filepath) call cursor(line, col) silent! norm! zvzz - finally - "jump back to old dir - execute cd . fnameescape(dir) endtry endfunction function! ctrlp#decls#enter() abort - let s:current_dir = fnameescape(expand('%:p:h')) let s:decls = [] let l:cmd = ['motion', @@ -117,7 +113,7 @@ function! ctrlp#decls#enter() abort call add(s:decls, printf("%s\t%s |%s:%s:%s|\t%s", \ decl.ident . space, \ decl.keyword, - \ fnamemodify(decl.filename, ":."), + \ fnamemodify(decl.filename, ":p"), \ decl.line, \ decl.col, \ decl.full, @@ -151,4 +147,8 @@ function! ctrlp#decls#cmd(mode, ...) abort return s:id endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/fzf/decls.vim b/sources_non_forked/vim-go/autoload/fzf/decls.vim index 246103ec..20e4f042 100644 --- a/sources_non_forked/vim-go/autoload/fzf/decls.vim +++ b/sources_non_forked/vim-go/autoload/fzf/decls.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! s:code(group, attr) abort let code = synIDattr(synIDtrans(hlID(a:group)), a:attr, "cterm") if code =~ '^[0-9]\+$' @@ -146,4 +150,8 @@ function! fzf#decls#cmd(...) abort \ })) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/alternate.vim b/sources_non_forked/vim-go/autoload/go/alternate.vim index 9d8af5a1..a0671905 100644 --- a/sources_non_forked/vim-go/autoload/go/alternate.vim +++ b/sources_non_forked/vim-go/autoload/go/alternate.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Test alternates between the implementation of code and the test code. function! go#alternate#Switch(bang, cmd) abort let file = expand('%') @@ -24,4 +28,8 @@ function! go#alternate#Switch(bang, cmd) abort endif endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/asmfmt.vim b/sources_non_forked/vim-go/autoload/go/asmfmt.vim index c450e334..9aa5f470 100644 --- a/sources_non_forked/vim-go/autoload/go/asmfmt.vim +++ b/sources_non_forked/vim-go/autoload/go/asmfmt.vim @@ -15,6 +15,10 @@ " " Flag to automatically call :Fmt when file is saved. +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:got_fmt_error = 0 " This is a trimmed-down version of the logic in fmt.vim. @@ -65,4 +69,8 @@ function! go#asmfmt#ToggleAsmFmtAutoSave() abort call go#util#EchoProgress("auto asmfmt disabled") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 64c695f8..fa57f3fe 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#cmd#autowrite() abort if &autowrite == 1 || &autowriteall == 1 silent! wall @@ -282,4 +286,8 @@ function! s:cmd_job(args) abort call go#job#Spawn(a:args.cmd, a:args) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/cmd_test.vim b/sources_non_forked/vim-go/autoload/go/cmd_test.vim index ef391100..708a3ab9 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd_test.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_GoBuildErrors() try let l:filename = 'cmd/bad.go' @@ -27,4 +31,8 @@ func! Test_GoBuildErrors() endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index da4600d4..662852e1 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -1,16 +1,11 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! s:gocodeCommand(cmd, args) abort let l:gocode_bin = "gocode" let l:gomod = go#util#gomod() if filereadable(l:gomod) - " Save the file when in module mode so that go list can read the - " imports. If the user doesn't have autowrite or autorwriteall enabled, - " they'll need to write the file manually to get reliable results. - " See https://github.com/fatih/vim-go/pull/1988#issuecomment-428576989. - " - " TODO(bc): don't save the file when in module mode once - " golang.org/x/tools/go/packages has support for an overlay and it's used - " by gocode. - call go#cmd#autowrite() let l:gocode_bin = "gocode-gomod" endif @@ -31,6 +26,8 @@ function! s:gocodeCommand(cmd, args) abort if go#config#GocodeProposeSource() let cmd = extend(cmd, ['-source']) + else + let cmd = extend(cmd, ['-fallback-to-source', '-cache']) endif if go#config#GocodeUnimportedPackages() @@ -248,4 +245,8 @@ function! go#complete#ToggleAutoTypeInfo() abort call go#util#EchoProgress("auto type info enabled") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/complete_test.vim b/sources_non_forked/vim-go/autoload/go/complete_test.vim index 7cd6297e..43971421 100644 --- a/sources_non_forked/vim-go/autoload/go/complete_test.vim +++ b/sources_non_forked/vim-go/autoload/go/complete_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_GetInfo() let l:filename = 'complete/complete.go' let l:tmp = gotest#load_fixture(l:filename) @@ -17,4 +21,8 @@ func! Test_GetInfo() unlet g:go_info_mode endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/config.vim b/sources_non_forked/vim-go/autoload/go/config.vim index e049ca6b..097b7ad2 100644 --- a/sources_non_forked/vim-go/autoload/go/config.vim +++ b/sources_non_forked/vim-go/autoload/go/config.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#config#AutodetectGopath() abort return get(g:, 'go_autodetect_gopath', 0) endfunction @@ -149,7 +153,7 @@ function! go#config#GocodeProposeBuiltins() abort endfunction function! go#config#GocodeProposeSource() abort - return get(g:, 'go_gocode_propose_source', 1) + return get(g:, 'go_gocode_propose_source', 0) endfunction function! go#config#EchoCommandInfo() abort @@ -202,7 +206,7 @@ endfunction function! go#config#DebugCommands() abort " make sure g:go_debug_commands is set so that it can be added to easily. - let g:go_debug_commands = get(g:, 'go_debug_commands', {}) + let g:go_debug_commands = get(g:, 'go_debug_commands', []) return g:go_debug_commands endfunction @@ -310,10 +314,6 @@ function! go#config#DeclsMode() abort return get(g:, "go_decls_mode", "") endfunction -function! go#config#DocCommand() abort - return get(g:, "go_doc_command", ["godoc"]) -endfunction - function! go#config#FmtCommand() abort return get(g:, "go_fmt_command", "gofmt") endfunction @@ -356,6 +356,10 @@ function! go#config#BinPath() abort return get(g:, "go_bin_path", "") endfunction +function! go#config#SearchBinPathFirst() abort + return get(g:, 'go_search_bin_path_first', 1) +endfunction + function! go#config#HighlightArrayWhitespaceError() abort return get(g:, 'go_highlight_array_whitespace_error', 0) endfunction @@ -441,4 +445,8 @@ if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 unlet g:go_gorename_prefill endif +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/coverage.vim b/sources_non_forked/vim-go/autoload/go/coverage.vim index 20848614..cfd5f4cb 100644 --- a/sources_non_forked/vim-go/autoload/go/coverage.vim +++ b/sources_non_forked/vim-go/autoload/go/coverage.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:toggle = 0 " Buffer creates a new cover profile with 'go test -coverprofile' and changes @@ -286,4 +290,8 @@ function! s:coverage_browser_callback(coverfile, job, exit_status, data) call delete(a:coverfile) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/debug.vim b/sources_non_forked/vim-go/autoload/go/debug.vim index 88646d9a..1562efbb 100644 --- a/sources_non_forked/vim-go/autoload/go/debug.vim +++ b/sources_non_forked/vim-go/autoload/go/debug.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + scriptencoding utf-8 if !exists('s:state') @@ -67,81 +71,40 @@ function! s:call_jsonrpc(method, ...) abort echom 'sending to dlv ' . a:method endif - if len(a:000) > 0 && type(a:000[0]) == v:t_func - let Cb = a:000[0] - let args = a:000[1:] - else - let args = a:000 - endif + let l:args = a:000 let s:state['rpcid'] += 1 - let req_json = json_encode({ + let l:req_json = json_encode({ \ 'id': s:state['rpcid'], \ 'method': a:method, - \ 'params': args, + \ 'params': l:args, \}) try - " Use callback - if exists('l:Cb') - if has('nvim') - let state = {'callback': Cb} - function! state.on_data(ch, msg, event) abort - call self.state.callback(a:ch, a:msg) - endfunction - let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state}) - call chansend(l:ch, req_json) - - if go#util#HasDebug('debugger-commands') - let g:go_debug_commands = add(g:go_debug_commands, { - \ 'request': req_json, - \ 'response': Cb, - \ }) - endif - return - endif - - let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'nl', 'callback': Cb}) - call ch_sendraw(l:ch, req_json) - - if go#util#HasDebug('debugger-commands') - let g:go_debug_commands = add(g:go_debug_commands, { - \ 'request': req_json, - \ 'response': Cb, - \ }) - endif - return - endif - + let l:ch = s:state['ch'] if has('nvim') - let state = {'done': 0} - function! state.on_data(ch, msg, event) abort - let self.state.resp = a:msg - let self.state.done = 1 - endfunction - let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': state.on_data, 'state': state}) - call chansend(l:ch, req_json) - while state.done == 0 + call chansend(l:ch, l:req_json) + while len(s:state.data) == 0 sleep 50m endwhile - let resp_json = state.resp + let resp_json = s:state.data[0] + let s:state.data = s:state.data[1:] else - let ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000}) - call ch_sendraw(ch, req_json) - let resp_json = ch_readraw(ch) + call ch_sendraw(l:ch, req_json) + let l:resp_raw = ch_readraw(l:ch) + let resp_json = json_decode(l:resp_raw) endif if go#util#HasDebug('debugger-commands') - let g:go_debug_commands = add(g:go_debug_commands, { - \ 'request': req_json, - \ 'response': resp_json, + let g:go_debug_commands = add(go#config#DebugCommands(), { + \ 'request': l:req_json, + \ 'response': l:resp_json, \ }) endif - let obj = json_decode(resp_json) - if type(obj) == v:t_dict && has_key(obj, 'error') && !empty(obj.error) - throw obj.error + if type(l:resp_json) == v:t_dict && has_key(l:resp_json, 'error') && !empty(l:resp_json.error) + throw l:resp_json.error endif - return obj + return l:resp_json catch throw substitute(v:exception, '^Vim', '', '') endtry @@ -247,12 +210,12 @@ function! s:clearState() abort let s:state['localVars'] = {} let s:state['functionArgs'] = {} let s:state['message'] = [] + silent! sign unplace 9999 endfunction function! s:stop() abort - " TODO(bc): call Detach - call go#job#Stop(s:state['job']) + let l:res = s:call_jsonrpc('RPCServer.Detach', {'kill': v:true}) call s:clearState() if has_key(s:state, 'job') @@ -262,9 +225,19 @@ function! s:stop() abort if has_key(s:state, 'ready') call remove(s:state, 'ready') endif + + if has_key(s:state, 'ch') + call remove(s:state, 'ch') + endif + + if has_key( s:state, 'data') + call remove(s:state, 'data') + endif endfunction function! go#debug#Stop() abort + " TODO(bc): don't remove breakpoints that were set before debugging started + " (see out_cb). " Remove signs. for k in keys(s:state['breakpoint']) let bt = s:state['breakpoint'][k] @@ -426,15 +399,11 @@ function! s:expand_var() abort endif endfunction -function! s:start_cb(ch, json) abort - let res = json_decode(a:json) - if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error) - throw res.error - endif - if empty(res) || !has_key(res, 'result') +function! s:start_cb(res) abort + if empty(a:res) || !has_key(a:res, 'result') return endif - for bt in res.result.Breakpoints + for bt in a:res.result.Breakpoints if bt.id >= 0 let s:state['breakpoint'][bt.id] = bt exe 'sign place '. bt.id .' line=' . bt.line . ' name=godebugbreakpoint file=' . bt.file @@ -534,6 +503,46 @@ function! s:out_cb(ch, msg) abort let s:state['message'] += [a:msg] if stridx(a:msg, go#config#DebugAddress()) != -1 + if has('nvim') + let s:state['data'] = [] + let l:state = {'databuf': ''} + function! s:on_data(ch, data, event) dict abort closure + let l:data = self.databuf + for msg in a:data + let l:data .= l:msg + endfor + + try + let l:res = json_decode(l:data) + let s:state['data'] = add(s:state['data'], l:res) + let self.databuf = '' + catch + " there isn't a complete message in databuf: buffer l:data and try + " again when more data comes in. + let self.databuf = l:data + finally + endtry + endfunction + " explicitly bind callback to state so that within it, self will + " always refer to state. See :help Partial for more information. + let l:state.on_data = function('s:on_data', [], l:state) + let l:ch = sockconnect('tcp', go#config#DebugAddress(), {'on_data': l:state.on_data, 'state': l:state}) + if l:ch == 0 + call go#util#EchoError("could not connect to debugger") + call go#job#Stop(s:state['job']) + return + endif + else + let l:ch = ch_open(go#config#DebugAddress(), {'mode': 'raw', 'timeout': 20000}) + if ch_status(l:ch) !=# 'open' + call go#util#EchoError("could not connect to debugger") + call go#job#Stop(s:state['job']) + return + endif + endif + + let s:state['ch'] = l:ch + " After this block executes, Delve will be running with all the " breakpoints setup, so this callback doesn't have to run again; just log " future messages. @@ -546,7 +555,8 @@ function! s:out_cb(ch, msg) abort call go#debug#Breakpoint(bt.line) endfor - call s:call_jsonrpc('RPCServer.ListBreakpoints', function('s:start_cb')) + let res = s:call_jsonrpc('RPCServer.ListBreakpoints') + call s:start_cb(res) endif endfunction @@ -571,13 +581,6 @@ function! go#debug#Start(is_test, ...) abort call go#config#SetDebugDiag(s:state) endif - " cd in to test directory; this is also what running "go test" does. - if a:is_test - lcd %:p:h - endif - - let s:state.is_test = a:is_test - let dlv = go#path#CheckBinPath("dlv") if empty(dlv) return @@ -586,14 +589,27 @@ function! go#debug#Start(is_test, ...) abort try if len(a:000) > 0 let l:pkgname = a:1 - " Expand .; otherwise this won't work from a tmp dir. if l:pkgname[0] == '.' - let l:pkgname = go#package#FromPath(getcwd()) . l:pkgname[1:] + let l:pkgname = go#package#FromPath(l:pkgname) endif else let l:pkgname = go#package#FromPath(getcwd()) endif + if l:pkgname is -1 + call go#util#EchoError('could not determine package name') + return + endif + + " cd in to test directory; this is also what running "go test" does. + if a:is_test + " TODO(bc): Either remove this if it's ok to do so or else record it and + " reset cwd after the job completes. + lcd %:p:h + endif + + let s:state.is_test = a:is_test + let l:args = [] if len(a:000) > 1 let l:args = ['--'] + a:000[1:] @@ -608,7 +624,6 @@ function! go#debug#Start(is_test, ...) abort \ '--api-version', '2', \ '--log', '--log-output', 'debugger,rpc', \ '--listen', go#config#DebugAddress(), - \ '--accept-multiclient', \] let buildtags = go#config#BuildTags() @@ -803,20 +818,13 @@ function! s:update_stacktrace() abort endtry endfunction -function! s:stack_cb(ch, json) abort +function! s:stack_cb(res) abort let s:stack_name = '' - let res = json_decode(a:json) - if type(res) == v:t_dict && has_key(res, 'error') && !empty(res.error) - call go#util#EchoError(res.error) - call s:clearState() - call go#debug#Restart() - return - endif - if empty(res) || !has_key(res, 'result') + if empty(a:res) || !has_key(a:res, 'result') return endif - call s:update_breakpoint(res) + call s:update_breakpoint(a:res) call s:update_stacktrace() call s:update_variables() endfunction @@ -847,7 +855,14 @@ function! go#debug#Stack(name) abort call s:call_jsonrpc('RPCServer.CancelNext') endif let s:stack_name = l:name - call s:call_jsonrpc('RPCServer.Command', function('s:stack_cb'), {'name': l:name}) + try + let res = s:call_jsonrpc('RPCServer.Command', {'name': l:name}) + call s:stack_cb(res) + catch + call go#util#EchoError(v:exception) + call s:clearState() + call go#debug#Restart() + endtry catch call go#util#EchoError(v:exception) endtry @@ -944,4 +959,8 @@ endfunction sign define godebugbreakpoint text=> texthl=GoDebugBreakpoint sign define godebugcurline text== linehl=GoDebugCurrent texthl=GoDebugCurrent +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/decls.vim b/sources_non_forked/vim-go/autoload/go/decls.vim index 1dcc4d3f..15743187 100644 --- a/sources_non_forked/vim-go/autoload/go/decls.vim +++ b/sources_non_forked/vim-go/autoload/go/decls.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#decls#Decls(mode, ...) abort let decls_mode = go#config#DeclsMode() if decls_mode == 'ctrlp' @@ -15,4 +19,8 @@ function! go#decls#Decls(mode, ...) abort end endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/def.vim b/sources_non_forked/vim-go/autoload/go/def.vim index 5cae5c83..2fc1b007 100644 --- a/sources_non_forked/vim-go/autoload/go/def.vim +++ b/sources_non_forked/vim-go/autoload/go/def.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:go_stack = [] let s:go_stack_level = 0 @@ -10,21 +14,18 @@ function! go#def#Jump(mode) abort " covers all edge cases, but now anyone can switch to godef if they wish let bin_name = go#config#DefMode() if bin_name == 'godef' - if &modified - " Write current unsaved buffer to a temp file and use the modified content - let l:tmpname = tempname() - call writefile(go#util#GetLines(), l:tmpname) - let fname = l:tmpname - endif - - let [l:out, l:err] = go#util#Exec(['godef', + let l:cmd = ['godef', \ '-f=' . l:fname, \ '-o=' . go#util#OffsetCursor(), - \ '-t']) - if exists("l:tmpname") - call delete(l:tmpname) - endif + \ '-t'] + if &modified + let l:stdin_content = join(go#util#GetLines(), "\n") + call add(l:cmd, "-i") + let [l:out, l:err] = go#util#Exec(l:cmd, l:stdin_content) + else + let [l:out, l:err] = go#util#Exec(l:cmd) + endif elseif bin_name == 'guru' let cmd = [go#path#CheckBinPath(bin_name)] let buildtags = go#config#BuildTags() @@ -35,7 +36,7 @@ function! go#def#Jump(mode) abort let stdin_content = "" if &modified - let content = join(go#util#GetLines(), "\n") + let content = join(go#util#GetLines(), "\n") let stdin_content = fname . "\n" . strlen(content) . "\n" . content call add(cmd, "-modified") endif @@ -317,4 +318,8 @@ function s:def_job(args, state) abort call go#job#Start(a:args.cmd, l:start_options) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/def_test.vim b/sources_non_forked/vim-go/autoload/go/def_test.vim index 18e5608f..9cfd1197 100644 --- a/sources_non_forked/vim-go/autoload/go/def_test.vim +++ b/sources_non_forked/vim-go/autoload/go/def_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_jump_to_declaration_guru() abort try let l:filename = 'def/jump.go' @@ -63,4 +67,8 @@ func! Test_Jump_leaves_lists() abort endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 83a00269..faae6548 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -2,6 +2,10 @@ " Use of this source code is governed by a BSD-style " license that can be found in the LICENSE file. +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:buf_nr = -1 function! go#doc#OpenBrowser(...) abort @@ -51,13 +55,8 @@ endfunction function! go#doc#Open(newmode, mode, ...) abort " With argument: run "godoc [arg]". if len(a:000) - if empty(go#path#CheckBinPath(go#config#DocCommand()[0])) - return - endif - - let [l:out, l:err] = go#util#Exec(go#config#DocCommand() + a:000) - " Without argument: run gogetdoc on cursor position. - else + let [l:out, l:err] = go#util#Exec(['go', 'doc'] + a:000) + else " Without argument: run gogetdoc on cursor position. let [l:out, l:err] = s:gogetdoc(0) if out == -1 return @@ -189,4 +188,8 @@ function! s:godocWord(args) abort return [pkg, exported_name] endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fillstruct.vim b/sources_non_forked/vim-go/autoload/go/fillstruct.vim index 7f1c4688..1e406d75 100644 --- a/sources_non_forked/vim-go/autoload/go/fillstruct.vim +++ b/sources_non_forked/vim-go/autoload/go/fillstruct.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#fillstruct#FillStruct() abort let l:cmd = ['fillstruct', \ '-file', bufname(''), @@ -61,4 +65,8 @@ function! go#fillstruct#FillStruct() abort endtry endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim b/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim index d677ab7d..956cd1ec 100644 --- a/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim +++ b/sources_non_forked/vim-go/autoload/go/fillstruct_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_fillstruct() abort try let l:tmp = gotest#write_file('a/a.go', [ @@ -87,4 +91,8 @@ func! Test_fillstruct_two_cursor() abort endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fmt.vim b/sources_non_forked/vim-go/autoload/go/fmt.vim index ce515487..908c0f5e 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt.vim @@ -5,6 +5,10 @@ " fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible " toorls, such as goimports). +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " we have those problems : " http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree " http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1 @@ -211,4 +215,8 @@ function! go#fmt#ToggleFmtAutoSave() abort call go#util#EchoProgress("auto fmt enabled") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/fmt_test.vim b/sources_non_forked/vim-go/autoload/go/fmt_test.vim index 2adbfba0..b1b740ae 100644 --- a/sources_non_forked/vim-go/autoload/go/fmt_test.vim +++ b/sources_non_forked/vim-go/autoload/go/fmt_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_run_fmt() abort let actual_file = tempname() call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file) @@ -46,4 +50,8 @@ func! Test_goimports() abort call assert_equal(expected, actual) endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 50d7de99..87265c57 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -1,5 +1,9 @@ " guru.vim -- Vim integration for the Go guru. +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " guru_cmd returns a dict that contains the command to execute guru. args " is dict with following options: " mode : guru mode, such as 'implements' @@ -483,7 +487,7 @@ function! s:same_ids_highlight(exit_val, output, mode) abort " is redisplayed: e.g. :edit, :GoRename, etc. augroup vim-go-sameids autocmd! - autocmd BufWinEnter nested call go#guru#SameIds() + autocmd BufWinEnter nested call go#guru#SameIds(0) augroup end endif endfunction @@ -515,11 +519,11 @@ endfunction function! go#guru#ToggleSameIds() abort if go#guru#ClearSameIds() != 0 - call go#guru#SameIds() + call go#guru#SameIds(1) endif endfunction -function! go#guru#AutoToogleSameIds() abort +function! go#guru#AutoToggleSameIds() abort if go#config#AutoSameids() call go#util#EchoProgress("sameids auto highlighting disabled") call go#guru#ClearSameIds() @@ -586,4 +590,8 @@ function! go#guru#Scope(...) abort endif endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/guru_test.vim b/sources_non_forked/vim-go/autoload/go/guru_test.vim index a4b5cc91..47e6bf64 100644 --- a/sources_non_forked/vim-go/autoload/go/guru_test.vim +++ b/sources_non_forked/vim-go/autoload/go/guru_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function Test_GuruScope_Set() abort silent call go#guru#Scope("example.com/foo/bar") let actual = go#config#GuruScope() @@ -12,4 +16,8 @@ function Test_GuruScope_Set() abort endif endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/highlight_test.vim b/sources_non_forked/vim-go/autoload/go/highlight_test.vim index 1ec7e451..2d8ed053 100644 --- a/sources_non_forked/vim-go/autoload/go/highlight_test.vim +++ b/sources_non_forked/vim-go/autoload/go/highlight_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! Test_gomodVersion_highlight() abort try syntax on @@ -92,4 +96,8 @@ function! Test_gomodVersion_incompatible_highlight() abort endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/iferr.vim b/sources_non_forked/vim-go/autoload/go/iferr.vim index 82d1ee5c..cc777b34 100644 --- a/sources_non_forked/vim-go/autoload/go/iferr.vim +++ b/sources_non_forked/vim-go/autoload/go/iferr.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#iferr#Generate() let [l:out, l:err] = go#util#Exec(['iferr', \ '-pos=' . go#util#OffsetCursor()], go#util#GetLines()) @@ -14,3 +18,9 @@ function! go#iferr#Generate() call setpos('.', l:pos) silent normal! 4j endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/impl.vim b/sources_non_forked/vim-go/autoload/go/impl.vim index 7ce8c8be..1a04d0cc 100644 --- a/sources_non_forked/vim-go/autoload/go/impl.vim +++ b/sources_non_forked/vim-go/autoload/go/impl.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#impl#Impl(...) abort let recv = "" let iface = "" @@ -164,4 +168,8 @@ function! go#impl#Complete(arglead, cmdline, cursorpos) abort endif endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/impl_test.vim b/sources_non_forked/vim-go/autoload/go/impl_test.vim index c417cd4f..0809836a 100644 --- a/sources_non_forked/vim-go/autoload/go/impl_test.vim +++ b/sources_non_forked/vim-go/autoload/go/impl_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_impl() abort try let l:tmp = gotest#write_file('a/a.go', [ @@ -35,3 +39,9 @@ func! Test_impl_get() abort call delete(l:tmp, 'rf') endtry endfunc + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/import.vim b/sources_non_forked/vim-go/autoload/go/import.vim index 42a61ef1..4e848968 100644 --- a/sources_non_forked/vim-go/autoload/go/import.vim +++ b/sources_non_forked/vim-go/autoload/go/import.vim @@ -4,6 +4,11 @@ " " Check out the docs for more information at /doc/vim-go.txt " + +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#import#SwitchImport(enabled, localname, path, bang) abort let view = winsaveview() let path = substitute(a:path, '^\s*\(.\{-}\)\s*$', '\1', '') @@ -220,5 +225,8 @@ function! s:Error(s) abort echohl Error | echo a:s | echohl None endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/indent_test.vim b/sources_non_forked/vim-go/autoload/go/indent_test.vim index f6566be8..c969fde7 100644 --- a/sources_non_forked/vim-go/autoload/go/indent_test.vim +++ b/sources_non_forked/vim-go/autoload/go/indent_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_indent_raw_string() abort " The goRawString discovery requires that syntax be enabled. syntax on @@ -60,3 +64,9 @@ func! Test_indent_raw_string() abort call delete(l:dir, 'rf') endtry endfunc + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/issue.vim b/sources_non_forked/vim-go/autoload/go/issue.vim index ab280410..f3aa0672 100644 --- a/sources_non_forked/vim-go/autoload/go/issue.vim +++ b/sources_non_forked/vim-go/autoload/go/issue.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:templatepath = go#util#Join(expand(':p:h:h:h'), '.github', 'ISSUE_TEMPLATE.md') function! go#issue#New() abort @@ -31,4 +35,8 @@ function! s:issuebody() abort return join(body, "\n") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim index 6134e8b5..2a14e6b0 100644 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ b/sources_non_forked/vim-go/autoload/go/job.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Spawn starts an asynchronous job. See the description of go#job#Options to " understand the args parameter. " @@ -88,7 +92,6 @@ function! go#job#Options(args) let state.errorformat = a:args.errorformat endif - " do nothing in state.complete by default. function state.complete(job, exit_status, data) if has_key(self, 'custom_complete') let l:winid = win_getid(winnr()) @@ -539,4 +542,8 @@ function! s:winjobarg(idx, val) abort return a:val endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/keyify.vim b/sources_non_forked/vim-go/autoload/go/keyify.vim index a77e8e24..41a543f3 100644 --- a/sources_non_forked/vim-go/autoload/go/keyify.vim +++ b/sources_non_forked/vim-go/autoload/go/keyify.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#keyify#Keyify() " Needs: https://github.com/dominikh/go-tools/pull/272 "\ '-tags', go#config#BuildTags(), @@ -53,4 +57,8 @@ function! s:chomp(string) return substitute(a:string, '\n\+$', '', '') endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 40faa879..46effcc2 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -1,4 +1,8 @@ -function! go#lint#Gometa(autosave, ...) abort +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +function! go#lint#Gometa(bang, autosave, ...) abort if a:0 == 0 let goargs = [expand('%:p:h')] else @@ -57,7 +61,7 @@ function! go#lint#Gometa(autosave, ...) abort let cmd += goargs if go#util#has_job() - call s:lint_job({'cmd': cmd}, a:autosave) + call s:lint_job({'cmd': cmd}, a:bang, a:autosave) return endif @@ -85,7 +89,7 @@ function! go#lint#Gometa(autosave, ...) abort let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !a:autosave + if !a:autosave && !a:bang call go#list#JumpToFirst(l:listtype) endif endif @@ -93,7 +97,7 @@ endfunction " Golint calls 'golint' on the current directory. Any warnings are populated in " the location list -function! go#lint#Golint(...) abort +function! go#lint#Golint(bang, ...) abort if a:0 == 0 let [l:out, l:err] = go#util#Exec([go#config#GolintBin(), go#package#ImportPath()]) else @@ -109,7 +113,9 @@ function! go#lint#Golint(...) abort call go#list#Parse(l:listtype, l:out, "GoLint") let l:errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(l:errors)) - call go#list#JumpToFirst(l:listtype) + if !a:bang + call go#list#JumpToFirst(l:listtype) + endif endfunction " Vet calls 'go vet' on the current directory. Any warnings are populated in @@ -143,7 +149,7 @@ endfunction " ErrCheck calls 'errcheck' for the given packages. Any warnings are populated in " the location list -function! go#lint#Errcheck(...) abort +function! go#lint#Errcheck(bang, ...) abort if a:0 == 0 let l:import_path = go#package#ImportPath() if import_path == -1 @@ -175,7 +181,7 @@ function! go#lint#Errcheck(...) abort if !empty(errors) call go#list#Populate(l:listtype, errors, 'Errcheck') call go#list#Window(l:listtype, len(errors)) - if !empty(errors) + if !a:bang call go#list#JumpToFirst(l:listtype) endif endif @@ -196,11 +202,12 @@ function! go#lint#ToggleMetaLinterAutoSave() abort call go#util#EchoProgress("auto metalinter enabled") endfunction -function! s:lint_job(args, autosave) +function! s:lint_job(args, bang, autosave) let l:opts = { \ 'statustype': "gometalinter", \ 'errorformat': '%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m', \ 'for': "GoMetaLinter", + \ 'bang': a:bang, \ } if a:autosave @@ -213,4 +220,8 @@ function! s:lint_job(args, autosave) call go#job#Spawn(a:args.cmd, l:opts) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/lint_test.vim b/sources_non_forked/vim-go/autoload/go/lint_test.vim index 61a14fd5..095a9987 100644 --- a/sources_non_forked/vim-go/autoload/go/lint_test.vim +++ b/sources_non_forked/vim-go/autoload/go/lint_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_Gometa() abort let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/lint' silent exe 'e ' . $GOPATH . '/src/lint/lint.go' @@ -11,7 +15,7 @@ func! Test_Gometa() abort let g:go_metalinter_enabled = ['golint'] - call go#lint#Gometa(0, $GOPATH . '/src/foo') + call go#lint#Gometa(0, 0, $GOPATH . '/src/foo') let actual = getqflist() let start = reltime() @@ -37,7 +41,7 @@ func! Test_GometaWithDisabled() abort let g:go_metalinter_disabled = ['vet'] - call go#lint#Gometa(0, $GOPATH . '/src/foo') + call go#lint#Gometa(0, 0, $GOPATH . '/src/foo') let actual = getqflist() let start = reltime() @@ -65,7 +69,7 @@ func! Test_GometaAutoSave() abort let g:go_metalinter_autosave_enabled = ['golint'] - call go#lint#Gometa(1) + call go#lint#Gometa(0, 1) let actual = getloclist(l:winnr) let start = reltime() @@ -105,4 +109,8 @@ func! Test_Vet() call gotest#assert_quickfix(actual, expected) endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/list.vim b/sources_non_forked/vim-go/autoload/go/list.vim index 8beabe52..f7a43ec1 100644 --- a/sources_non_forked/vim-go/autoload/go/list.vim +++ b/sources_non_forked/vim-go/autoload/go/list.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Window opens the list with the given height up to 10 lines maximum. " Otherwise g:go_loclist_height is used. " @@ -164,4 +168,8 @@ function! go#list#Type(for) abort return get(go#config#ListTypeCommands(), a:for, l:listtype) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/mod.vim b/sources_non_forked/vim-go/autoload/go/mod.vim index 0b00335e..021f7f92 100644 --- a/sources_non_forked/vim-go/autoload/go/mod.vim +++ b/sources_non_forked/vim-go/autoload/go/mod.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:go_major_version = "" function! go#mod#Format() abort @@ -138,3 +142,9 @@ function! go#mod#ToggleModFmtAutoSave() abort call go#config#SetModFmtAutosave(1) call go#util#EchoProgress("auto mod fmt enabled") endfunction + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index 0edfc5c3..21571101 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -5,6 +5,10 @@ " This file provides a utility function that performs auto-completion of " package names, for use by other commands. +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:goos = $GOOS let s:goarch = $GOARCH @@ -55,7 +59,7 @@ function! go#package#Paths() abort endfunction let s:import_paths = {} -" ImportPath returns the import path in the current directory it was executed +" ImportPath returns the import path of the package for current buffer. function! go#package#ImportPath() abort let dir = expand("%:p:h") if has_key(s:import_paths, dir) @@ -67,47 +71,50 @@ function! go#package#ImportPath() abort return -1 endif - let import_path = split(out, '\n')[0] + let l:importpath = split(out, '\n')[0] " go list returns '_CURRENTDIRECTORY' if the directory is not inside GOPATH. " Check it and retun an error if that is the case - if import_path[0] ==# '_' + if l:importpath[0] ==# '_' return -1 endif - let s:import_paths[dir] = import_path + let s:import_paths[dir] = l:importpath - return import_path + return l:importpath endfunction +" FromPath returns the import path of arg. function! go#package#FromPath(arg) abort - let path = fnamemodify(resolve(a:arg), ':p') - let dirs = go#package#Paths() + let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' + let l:dir = getcwd() - for dir in dirs - if len(dir) && match(path, dir) == 0 - let workspace = dir - break - endif - endfor + let l:path = a:arg + if !isdirectory(l:path) + let l:path = fnamemodify(l:path, ':h') + endif - if !exists('workspace') + execute l:cd fnameescape(l:path) + let [l:out, l:err] = go#util#Exec(['go', 'list']) + execute l:cd fnameescape(l:dir) + if l:err != 0 return -1 endif - let path = substitute(path, '/*$', '', '') - let workspace = substitute(workspace . '/src/', '/+', '', '') - if isdirectory(path) - return substitute(path, workspace, '', '') - else - return substitute(substitute(path, workspace, '', ''), - \ '/' . fnamemodify(path, ':t'), '', '') + let l:importpath = split(l:out, '\n')[0] + + " go list returns '_CURRENTDIRECTORY' if the directory is not inside GOPATH. + " Check it and retun an error if that is the case + if l:importpath[0] ==# '_' + return -1 endif + + return l:importpath endfunction function! go#package#CompleteMembers(package, member) abort - let [l:content, l:err] = go#util#Exec(['godoc', a:package]) + let [l:content, l:err] = go#util#Exec(['go', 'doc', a:package]) if l:err || !len(content) return [] endif @@ -137,37 +144,41 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort return go#package#CompleteMembers(words[1], words[2]) endif - let dirs = go#package#Paths() + let dirs = go#package#Paths() - if len(dirs) == 0 - " should not happen - return [] - endif + if len(dirs) == 0 + " should not happen + return [] + endif - let ret = {} - for dir in dirs - " this may expand to multiple lines - let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") - call add(root, expand(dir . '/src')) - for r in root - for i in split(globpath(r, a:ArgLead.'*'), "\n") - if isdirectory(i) - let i .= '/' - elseif i !~ '\.a$' - continue - endif - let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), - \ '\.a$', '', 'g') + let ret = {} + for dir in dirs + " this may expand to multiple lines + let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") + call add(root, expand(dir . '/src')) + for r in root + for i in split(globpath(r, a:ArgLead.'*'), "\n") + if isdirectory(i) + let i .= '/' + elseif i !~ '\.a$' + continue + endif + let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), + \ '\.a$', '', 'g') - " without this the result can have duplicates in form of - " 'encoding/json' and '/encoding/json/' - let i = go#util#StripPathSep(i) + " without this the result can have duplicates in form of + " 'encoding/json' and '/encoding/json/' + let i = go#util#StripPathSep(i) - let ret[i] = i - endfor - endfor + let ret[i] = i + endfor endfor - return sort(keys(ret)) + endfor + return sort(keys(ret)) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index 5c6a4395..51619d4e 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " initial_go_path is used to store the initial GOPATH that was set when Vim " was started. It's used with :GoPathClear to restore the GOPATH when the user " changed it explicitly via :GoPath. Initially it's empty. It's being set when @@ -142,7 +146,8 @@ function! go#path#BinPath() abort endfunction " CheckBinPath checks whether the given binary exists or not and returns the -" path of the binary. It returns an empty string doesn't exists. +" path of the binary, respecting the go_bin_path and go_search_bin_path_first +" settings. It returns an empty string if the binary doesn't exist. function! go#path#CheckBinPath(binpath) abort " remove whitespaces if user applied something like 'goimports ' let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '') @@ -155,7 +160,12 @@ function! go#path#CheckBinPath(binpath) abort if !empty(go_bin_path) " append our GOBIN and GOPATH paths and be sure they can be found there... " let us search in our GOBIN and GOPATH paths - let $PATH = go_bin_path . go#util#PathListSep() . $PATH + " respect the ordering specified by go_search_bin_path_first + if go#config#SearchBinPathFirst() + let $PATH = go_bin_path . go#util#PathListSep() . $PATH + else + let $PATH = $PATH . go#util#PathListSep() . go_bin_path + endif endif " if it's in PATH just return it @@ -195,4 +205,8 @@ function! s:CygwinPath(path) return substitute(a:path, '\\', '/', "g") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/play.vim b/sources_non_forked/vim-go/autoload/go/play.vim index 75aa55f4..441ee35b 100644 --- a/sources_non_forked/vim-go/autoload/go/play.vim +++ b/sources_non_forked/vim-go/autoload/go/play.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#play#Share(count, line1, line2) abort if !executable('curl') echohl ErrorMsg | echomsg "vim-go: require 'curl' command" | echohl None @@ -66,4 +70,8 @@ function! s:get_visual_selection() abort return join(lines, "\n") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/rename.vim b/sources_non_forked/vim-go/autoload/go/rename.vim index d7cf7218..72e8d8dc 100644 --- a/sources_non_forked/vim-go/autoload/go/rename.vim +++ b/sources_non_forked/vim-go/autoload/go/rename.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! go#rename#Rename(bang, ...) abort let to_identifier = "" if a:0 == 0 @@ -117,4 +121,8 @@ function! go#rename#Complete(lead, cmdline, cursor) \ 'strpart(v:val, 0, len(a:lead)) == a:lead') endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/statusline.vim b/sources_non_forked/vim-go/autoload/go/statusline.vim index 78ad4726..f0ec5cd0 100644 --- a/sources_non_forked/vim-go/autoload/go/statusline.vim +++ b/sources_non_forked/vim-go/autoload/go/statusline.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Statusline """""""""""""""""""""""""""""""" @@ -109,4 +113,8 @@ function! go#statusline#Clear(timer_id) abort exe 'let &ro = &ro' endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim index f9c0a6ad..83751d71 100644 --- a/sources_non_forked/vim-go/autoload/go/tags.vim +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " mapped to :GoAddTags function! go#tags#Add(start, end, count, ...) abort let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') @@ -208,4 +212,8 @@ func s:create_cmd(args) abort return {'cmd': cmd} endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/tags_test.vim b/sources_non_forked/vim-go/autoload/go/tags_test.vim index 7d4d32bc..a311a059 100644 --- a/sources_non_forked/vim-go/autoload/go/tags_test.vim +++ b/sources_non_forked/vim-go/autoload/go/tags_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_add_tags() abort try let l:tmp = gotest#load_fixture('tags/add_all_input.go') @@ -19,4 +23,8 @@ func! Test_remove_tags() abort endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/autoload/go/template.vim b/sources_non_forked/vim-go/autoload/go/template.vim index 437a49df..5062464b 100644 --- a/sources_non_forked/vim-go/autoload/go/template.vim +++ b/sources_non_forked/vim-go/autoload/go/template.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:current_file = expand("") function! go#template#create() abort @@ -50,4 +54,8 @@ function! go#template#ToggleAutoCreate() abort call go#util#EchoProgress("auto template create enabled") endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/term.vim b/sources_non_forked/vim-go/autoload/go/term.vim index a89c5fdc..8159c3d2 100644 --- a/sources_non_forked/vim-go/autoload/go/term.vim +++ b/sources_non_forked/vim-go/autoload/go/term.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " new creates a new terminal with the given command. Mode is set based on the " global variable g:go_term_mode, which is by default set to :vsplit function! go#term#new(bang, cmd) abort @@ -116,4 +120,8 @@ function! s:cleanlist(winid, listtype) abort call win_gotoid(l:winid) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/term_test.vim b/sources_non_forked/vim-go/autoload/go/term_test.vim index 7a630eef..2b3ce1f8 100644 --- a/sources_non_forked/vim-go/autoload/go/term_test.vim +++ b/sources_non_forked/vim-go/autoload/go/term_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_GoTermNewMode() if !has('nvim') return @@ -47,4 +51,8 @@ func! Test_GoTermNewMode_SplitRight() endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/test.vim b/sources_non_forked/vim-go/autoload/go/test.vim index ce29f736..5a2ee64b 100644 --- a/sources_non_forked/vim-go/autoload/go/test.vim +++ b/sources_non_forked/vim-go/autoload/go/test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Test runs `go test` in the current directory. If compile is true, it'll " compile the tests instead of running them (useful to catch errors in the " test files). Any other argument is appended to the final `go test` command. @@ -302,4 +306,8 @@ function! s:errorformat() abort return s:efm endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/test_test.vim b/sources_non_forked/vim-go/autoload/go/test_test.vim index 7a4cb498..c2d44074 100644 --- a/sources_non_forked/vim-go/autoload/go/test_test.vim +++ b/sources_non_forked/vim-go/autoload/go/test_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_GoTest() abort let expected = [ \ {'lnum': 12, 'bufnr': 2, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'log message'}, @@ -125,4 +129,8 @@ func! s:normalize_durations(str) abort return substitute(a:str, '[0-9]\+\(\.[0-9]\+\)\?s', '0.000s', 'g') endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/textobj.vim b/sources_non_forked/vim-go/autoload/go/textobj.vim index 164b7699..9a38c95b 100644 --- a/sources_non_forked/vim-go/autoload/go/textobj.vim +++ b/sources_non_forked/vim-go/autoload/go/textobj.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " ( ) motions " { } motions " s for sentence @@ -273,4 +277,8 @@ function! go#textobj#FunctionJump(mode, direction) abort keepjumps call cursor(info.func.line, 1) endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index b6fbc792..c293b67e 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " From "go list -h". function! go#tool#ValidFiles(...) let l:list = ["GoFiles", "CgoFiles", "IgnoredGoFiles", "CFiles", "CXXFiles", @@ -213,4 +217,8 @@ function! go#tool#OpenBrowser(url) abort endif endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/tool_test.vim b/sources_non_forked/vim-go/autoload/go/tool_test.vim index 0d51b148..f8477b58 100644 --- a/sources_non_forked/vim-go/autoload/go/tool_test.vim +++ b/sources_non_forked/vim-go/autoload/go/tool_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + func! Test_ExecuteInDir() abort let l:tmp = gotest#write_file('a/a.go', ['package a']) try @@ -20,4 +24,8 @@ func! Test_ExecuteInDir_nodir() abort endtry endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/ui.vim b/sources_non_forked/vim-go/autoload/go/ui.vim index 3f612576..9d5b249e 100644 --- a/sources_non_forked/vim-go/autoload/go/ui.vim +++ b/sources_non_forked/vim-go/autoload/go/ui.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let s:buf_nr = -1 "OpenWindow opens a new scratch window and put's the content into the window @@ -111,4 +115,8 @@ function! go#ui#OpenDefinition(filter) abort norm! zz endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 8dc942ff..ea97af2f 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " PathSep returns the appropriate OS specific path separator. function! go#util#PathSep() abort if go#util#IsWin() @@ -437,4 +441,8 @@ function! go#util#HasDebug(flag) return index(go#config#Debug(), a:flag) >= 0 endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/autoload/gotest.vim b/sources_non_forked/vim-go/autoload/gotest.vim index 8053b4bd..e010d52b 100644 --- a/sources_non_forked/vim-go/autoload/gotest.vim +++ b/sources_non_forked/vim-go/autoload/gotest.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " Write a Go file to a temporary directory and append this directory to $GOPATH. " " The file will written to a:path, which is relative to the temporary directory, @@ -127,4 +131,8 @@ func! gotest#assert_quickfix(got, want) abort endwhile endfunc +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/compiler/go.vim b/sources_non_forked/vim-go/compiler/go.vim index 523cb282..5f978bb4 100644 --- a/sources_non_forked/vim-go/compiler/go.vim +++ b/sources_non_forked/vim-go/compiler/go.vim @@ -9,6 +9,10 @@ if exists("g:current_compiler") endif let g:current_compiler = "go" +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + if exists(":CompilerSet") != 2 command -nargs=* CompilerSet setlocal endif @@ -38,4 +42,8 @@ CompilerSet errorformat+=%-G%.%# " All lines not matching a let &cpo = s:save_cpo unlet s:save_cpo +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index a2a990a2..1fd87d80 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -76,7 +76,7 @@ tools developed by the Go community to provide a seamless Vim experience. ============================================================================== INSTALL *go-install* -vim-go requires at least Vim 7.4.2009 or Neovim 0.2.2. On macOS, if you are +vim-go requires at least Vim 7.4.2009 or Neovim 0.3.1. On macOS, if you are still using your system version of vim, you can use homebrew to keep your version of Vim up-to-date with the following terminal command: > @@ -118,6 +118,7 @@ manager's install command. Copy all of the files into your `~/.vim` directory < + You will also need to install all the necessary binaries. vim-go makes it easy to install all of them by providing a command, |:GoInstallBinaries|, to `go get` all the required binaries. The binaries will be installed to $GOBIN @@ -195,11 +196,13 @@ COMMANDS *go-commands* displayed and the buffer will be untouched. *:GoLint* -:GoLint [packages] +:GoLint! [packages] Run golint for the directory under your current file, or for the given packages. + If [!] is not given the first error is jumped to. + *:GoDoc* :GoDoc [word] @@ -463,7 +466,7 @@ CTRL-t If [!] is not given the first error is jumped to. *:GoErrCheck* -:GoErrCheck [options] +:GoErrCheck! [options] Check for unchecked errors in you current package. Errors are populated in the quickfix window. @@ -471,6 +474,8 @@ CTRL-t You may optionally pass any valid errcheck flags/options. See `errcheck -h` for a full list. + If [!] is not given the first error is jumped to. + *:GoFiles* :GoFiles [source_files] @@ -637,7 +642,7 @@ CTRL-t disabled it clears and stops automatic highlighting. *:GoMetaLinter* -:GoMetaLinter [path] +:GoMetaLinter! [path] Calls the underlying `gometalinter` tool and displays all warnings and errors in the |quickfix| window. By default the following linters are @@ -646,6 +651,8 @@ CTRL-t use the variable |'g:go_metalinter_command'|. To override the maximum linters execution time use |'g:go_metalinter_deadline'| variable. + If [!] is not given the first error is jumped to. + *:GoBuildTags* :GoBuildTags [tags] @@ -1357,21 +1364,26 @@ mappings of |:GoDef|. By default it's disabled. > let g:go_def_reuse_buffer = 0 < - *'g:go_doc_command'* - -Command to use for |:GoDoc|; only used when invoked with a package name. The -`gogetdoc` command is always used when |:GoDoc| is used on the identifier -under the cursor (i.e. without argument or from |K|). > - - let g:go_doc_command = ["godoc"] - -< *'g:go_bin_path'* + *'g:go_bin_path'* Use this option to change default path for vim-go tools when using |:GoInstallBinaries| and |:GoUpdateBinaries|. If not set `$GOBIN` or `$GOPATH/bin` is used. > let g:go_bin_path = "" +< + *'g:go_search_bin_path_first'* + +This option lets |'g:go_bin_path'| (or its default value) take precedence over +$PATH when invoking a tool command such as |:GoFmt| or |:GoImports|. + +Enabling this option ensures that the binaries installed via +|:GoInstallBinaries| and |:GoUpdateBinaries| are the same ones that are +invoked via the tool commands. + +By default it is enabled. > + + let g:go_search_bin_path_first = 1 < *'g:go_snippet_engine'* @@ -1609,7 +1621,7 @@ Specifies whether `gocode` should use source files instead of binary packages for autocompletion proposals. When disabled, only identifiers from the current package and packages that have been installed will proposed. > - let g:go_gocode_propose_source = 1 + let g:go_gocode_propose_source = 0 < *'g:go_gocode_unimported_packages'* @@ -1739,8 +1751,7 @@ A list of options to debug; useful for development and/or reporting bugs. Currently accepted values: - shell-commands Echo all shell commands that vim-go runs (does not - include async jobs). + shell-commands Echo all shell commands that vim-go runs. debugger-state Expose debugger state in 'g:go_debug_diag'. debugger-commands Echo communication between vim-go and `dlv`; requests and responses are recorded in `g:go_debug_commands`. @@ -2266,9 +2277,9 @@ Using with NeoVim~ Note: Neovim currently is not a first class citizen for vim-go. You are free to open bug, however I'm not using Neovim so it's hard for me to test it. -vim-go might not work well as good as in Vim. I'm happy to accept pull -requests or very detailed bug reports. If you're interested to improve the -state of Neovim in vim-go you're always welcome! +vim-go might not work as well in Neovim as it does in Vim. I'm happy to accept +pull requests or very detailed bug reports. If you're interested to improve +the state of Neovim in vim-go you're always welcome! Run `:GoRun` in a new tab, horizontal split or vertical split terminal > diff --git a/sources_non_forked/vim-go/ftdetect/gofiletype.vim b/sources_non_forked/vim-go/ftdetect/gofiletype.vim index 976024fa..ebbe7c29 100644 --- a/sources_non_forked/vim-go/ftdetect/gofiletype.vim +++ b/sources_non_forked/vim-go/ftdetect/gofiletype.vim @@ -1,5 +1,9 @@ " vint: -ProhibitAutocmdWithNoGroup +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + " We take care to preserve the user's fileencodings and fileformats, " because those settings are global (not buffer local), yet we want " to override them for loading Go files, which are defined to be UTF-8. @@ -55,4 +59,8 @@ fun! s:gomod() endfor endfun +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/asm.vim b/sources_non_forked/vim-go/ftplugin/asm.vim index 99996aac..db1f10db 100644 --- a/sources_non_forked/vim-go/ftplugin/asm.vim +++ b/sources_non_forked/vim-go/ftplugin/asm.vim @@ -5,6 +5,10 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let b:undo_ftplugin = "setl fo< com< cms<" setlocal formatoptions-=t @@ -16,4 +20,8 @@ setlocal noexpandtab command! -nargs=0 AsmFmt call go#asmfmt#Format() +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim index 572bb958..7160d8bb 100644 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ b/sources_non_forked/vim-go/ftplugin/go.vim @@ -9,6 +9,10 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let b:undo_ftplugin = "setl fo< com< cms<" setlocal formatoptions-=t @@ -136,4 +140,8 @@ endif " return "nohlsearch" " endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/commands.vim b/sources_non_forked/vim-go/ftplugin/go/commands.vim index 1fe28f3a..981819d0 100644 --- a/sources_non_forked/vim-go/ftplugin/go/commands.vim +++ b/sources_non_forked/vim-go/ftplugin/go/commands.vim @@ -17,7 +17,7 @@ command! -range=% GoReferrers call go#guru#Referrers() command! -range=0 GoSameIds call go#guru#SameIds(1) command! -range=0 GoSameIdsClear call go#guru#ClearSameIds() command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds() -command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds() +command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToggleSameIds() " -- tags command! -nargs=* -range GoAddTags call go#tags#Add(, , , ) @@ -77,11 +77,11 @@ command! -nargs=1 -bang -complete=customlist,go#package#Complete GoImport call g command! -nargs=* -bang -complete=customlist,go#package#Complete GoImportAs call go#import#SwitchImport(1, , '') " -- linters -command! -nargs=* GoMetaLinter call go#lint#Gometa(0, ) +command! -nargs=* -bang GoMetaLinter call go#lint#Gometa(0, 0, ) command! -nargs=0 GoMetaLinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave() -command! -nargs=* GoLint call go#lint#Golint() +command! -nargs=* -bang GoLint call go#lint#Golint(0, ) command! -nargs=* -bang GoVet call go#lint#Vet(0, ) -command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck() +command! -nargs=* -bang -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(0, ) " -- alternate command! -bang GoAlternate call go#alternate#Switch(0, '') diff --git a/sources_non_forked/vim-go/ftplugin/go/mappings.vim b/sources_non_forked/vim-go/ftplugin/go/mappings.vim index 30562c36..1ca19007 100644 --- a/sources_non_forked/vim-go/ftplugin/go/mappings.vim +++ b/sources_non_forked/vim-go/ftplugin/go/mappings.vim @@ -68,8 +68,8 @@ nnoremap (go-doc-vertical) :call go#doc#Open("vnew", "vsplit nnoremap (go-doc-split) :call go#doc#Open("new", "split") nnoremap (go-doc-browser) :call go#doc#OpenBrowser() -nnoremap (go-metalinter) :call go#lint#Gometa(0) -nnoremap (go-lint) :call go#lint#Golint() +nnoremap (go-metalinter) :call go#lint#Gometa(!g:go_jump_to_error, 0) +nnoremap (go-lint) :call go#lint#Golint(!g:go_jump_to_error) nnoremap (go-vet) :call go#lint#Vet(!g:go_jump_to_error) nnoremap (go-alternate-edit) :call go#alternate#Switch(0, "edit") diff --git a/sources_non_forked/vim-go/ftplugin/go/snippets.vim b/sources_non_forked/vim-go/ftplugin/go/snippets.vim index f7a7d930..1fbc1ab8 100644 --- a/sources_non_forked/vim-go/ftplugin/go/snippets.vim +++ b/sources_non_forked/vim-go/ftplugin/go/snippets.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + if exists("g:go_loaded_gosnippets") finish endif @@ -64,4 +68,8 @@ elseif s:engine is? "minisnip" call s:GoMinisnip() endif +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim index 2d22fd7c..3ca244ba 100644 --- a/sources_non_forked/vim-go/ftplugin/go/tagbar.vim +++ b/sources_non_forked/vim-go/ftplugin/go/tagbar.vim @@ -9,6 +9,10 @@ elseif globpath(&rtp, 'plugin/tagbar.vim') == "" finish endif +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + if !exists("g:go_gotags_bin") let g:go_gotags_bin = "gotags" endif @@ -54,4 +58,8 @@ endfunction call s:SetTagbar() +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/ftplugin/gomod.vim b/sources_non_forked/vim-go/ftplugin/gomod.vim index 5f3dc412..107abc6c 100644 --- a/sources_non_forked/vim-go/ftplugin/gomod.vim +++ b/sources_non_forked/vim-go/ftplugin/gomod.vim @@ -5,6 +5,10 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + let b:undo_ftplugin = "setl fo< com< cms<" setlocal formatoptions-=t @@ -12,4 +16,8 @@ setlocal formatoptions-=t setlocal comments=s1:/*,mb:*,ex:*/,:// setlocal commentstring=//\ %s +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/indent/go.vim b/sources_non_forked/vim-go/indent/go.vim index de52d099..4c3ea042 100644 --- a/sources_non_forked/vim-go/indent/go.vim +++ b/sources_non_forked/vim-go/indent/go.vim @@ -24,6 +24,10 @@ if exists("*GoIndent") finish endif +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! GoIndent(lnum) abort let prevlnum = prevnonblank(a:lnum-1) if prevlnum == 0 @@ -75,4 +79,8 @@ function! GoIndent(lnum) abort return ind endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/indent/gohtmltmpl.vim b/sources_non_forked/vim-go/indent/gohtmltmpl.vim index 864913df..8cc544a2 100644 --- a/sources_non_forked/vim-go/indent/gohtmltmpl.vim +++ b/sources_non_forked/vim-go/indent/gohtmltmpl.vim @@ -13,6 +13,10 @@ if exists("*GetGoHTMLTmplIndent") finish endif +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! GetGoHTMLTmplIndent(lnum) " Get HTML indent if exists('*HtmlIndent') @@ -43,4 +47,8 @@ function! GetGoHTMLTmplIndent(lnum) return ind endfunction +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 22d179c0..e0e41476 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -4,6 +4,10 @@ if exists("g:go_loaded_install") endif let g:go_loaded_install = 1 +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + function! s:checkVersion() abort " Not using the has('patch-7.4.2009') syntax because that wasn't added until " 7.4.237, and we want to be sure this works for everyone (this is also why @@ -171,7 +175,7 @@ function! s:GoInstallBinaries(updateBinaries, ...) " and then build and install it let l:build_cmd = ['go', 'build', '-o', go_bin_path . go#util#PathSep() . bin, l:importPath] - let [l:out, l:err] = go#util#Exec(l:build_cmd + [l:importPath]) + let [l:out, l:err] = go#util#Exec(l:build_cmd) if l:err echom "Error installing " . l:importPath . ": " . l:out endif @@ -267,7 +271,7 @@ endfunction function! s:metalinter_autosave() " run gometalinter on save if get(g:, "go_metalinter_autosave", 0) - call go#lint#Gometa(1) + call go#lint#Gometa(0, 1) endif endfunction @@ -314,4 +318,8 @@ augroup vim-go \| endif augroup end +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/scripts/docker-test b/sources_non_forked/vim-go/scripts/docker-test index 2b56ad87..e984f610 100644 --- a/sources_non_forked/vim-go/scripts/docker-test +++ b/sources_non_forked/vim-go/scripts/docker-test @@ -8,6 +8,8 @@ vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd) cd "$vimgodir" docker build --tag vim-go-test . -docker run --rm vim-go-test +# seccomp=confined is required for dlv to run in a container, hence it's +# required for vim-go's debug tests. +docker run --rm --security-opt="seccomp=unconfined" vim-go-test # vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/scripts/install-vim b/sources_non_forked/vim-go/scripts/install-vim index 29ba49a9..709fccaa 100644 --- a/sources_non_forked/vim-go/scripts/install-vim +++ b/sources_non_forked/vim-go/scripts/install-vim @@ -91,6 +91,7 @@ fi # Make sure all Go tools and other dependencies are installed. echo "Installing Go binaries" export GOPATH=$installdir +export GO111MODULE=off export PATH=${GOPATH}/bin:$PATH "$vimgodir/scripts/run-vim" $vim +':silent :GoUpdateBinaries' +':qa' diff --git a/sources_non_forked/vim-go/scripts/run-vim b/sources_non_forked/vim-go/scripts/run-vim index 446bd235..864eeb4d 100644 --- a/sources_non_forked/vim-go/scripts/run-vim +++ b/sources_non_forked/vim-go/scripts/run-vim @@ -23,6 +23,7 @@ fi dir="/tmp/vim-go-test/$1-install" export GOPATH=$dir +export GO111MODULE=off export PATH=${GOPATH}/bin:$PATH shift diff --git a/sources_non_forked/vim-go/scripts/runbench.vim b/sources_non_forked/vim-go/scripts/runbench.vim index db582cb9..e1c6c88a 100644 --- a/sources_non_forked/vim-go/scripts/runbench.vim +++ b/sources_non_forked/vim-go/scripts/runbench.vim @@ -1,4 +1,9 @@ " vint: -ProhibitSetNoCompatible + +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + set nocompatible nomore shellslash encoding=utf-8 shortmess+=WIF lang mess C @@ -24,3 +29,9 @@ let s:report = execute('syntime report') execute ':e ' . fnameescape($RUNBENCH_OUT) call setline('.', split(s:report, '\n')) wq + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-go/scripts/runtest.vim b/sources_non_forked/vim-go/scripts/runtest.vim index 5543b0ce..ddb40af4 100644 --- a/sources_non_forked/vim-go/scripts/runtest.vim +++ b/sources_non_forked/vim-go/scripts/runtest.vim @@ -2,6 +2,11 @@ " English. " vint: -ProhibitSetNoCompatible + +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + set nocompatible nomore shellslash encoding=utf-8 shortmess+=WIF lang mess C @@ -31,7 +36,8 @@ source % " cd into the folder of the test file. let s:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let s:testfile = expand('%:t') -execute s:cd . expand('%:p:h') +let s:dir = expand('%:p:h') +execute s:cd . s:dir " Export root path to vim-go dir. let g:vim_go_root = fnamemodify(getcwd(), ':p') @@ -64,6 +70,8 @@ for s:test in sort(s:tests) " Restore GOPATH after each test. let $GOPATH = s:gopath + " Restore the working directory after each test. + execute s:cd . s:dir let s:elapsed_time = substitute(reltimestr(reltime(s:started)), '^\s*\(.\{-}\)\s*$', '\1', '') let s:done += 1 @@ -108,4 +116,8 @@ silent! write " Our work here is done. qall! +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + " vim:ts=2:sts=2:sw=2:et diff --git a/sources_non_forked/vim-go/test/gopath_test.vim b/sources_non_forked/vim-go/test/gopath_test.vim index fef9d50a..5036a598 100644 --- a/sources_non_forked/vim-go/test/gopath_test.vim +++ b/sources_non_forked/vim-go/test/gopath_test.vim @@ -1,3 +1,7 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + fun! Test_Detect_Gopath() abort let l:gopath = $GOPATH try @@ -53,3 +57,9 @@ fun! Test_Detect_Gopath_disabled() abort call delete(l:tmp2, 'rf') endtry endfun + +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2 ts=2 et diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript-ember.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript-ember.snippets index 1b7e7b8d..301e5d83 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript-ember.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript-ember.snippets @@ -6,53 +6,63 @@ priority -50 # Application snippet eapp "App.Name = Ember.Application.create({});" -${1:App.Name} = Ember.Application.create({}); -endsnippet +import Application from '@ember/application'; -# Models -snippet emod "App.ModelName = Ember.Model.extend({...});" -${1:model_name} = Ember.Model.extend({ +export default Application.extend({ ${0://Properties here...} }); endsnippet -# View -snippet eview "App.ViewName = Ember.Model.extend({...});" -${1:view_name} = Ember.View.extend({ +# Models +snippet emod "import DS from 'ember-data';" +import DS from 'ember-data'; + +export default DS.Model.extend({ ${0://Properties here...} }); endsnippet # Controller -snippet econtroller "App.ControllerName = Ember.Model.extend({...});" -${1:controller_name} = Ember.ObjectController.extend({ +snippet econtroller "import Controller from '@ember/controller';" +import Controller from '@ember/controller'; + +export default Controller.extend({ ${0://Properties here...} }); endsnippet # Route -snippet eroute "App.RouteName = Ember.Route.extend({...});" -${1:route_name} = Ember.Route.extend({ +snippet eroute "import Route from '@ember/routing/route';" +import Route from '@ember/routing/route'; + +export default Route.extend({ ${0://Properties here...} }); endsnippet -snippet eview "App.ViewName = Ember.Model.create({...});" -${1:view_name} = Ember.View.create({ +# Component +snippet ecomponent "import Component from '@ember/component';" +import Component from '@ember/component'; + +export default Component.extend({ ${0://Properties here...} }); endsnippet # Object -snippet eobj "App.ObjectName = Ember.Object.extend({...});" -${1:object_name} = Ember.Object.create({ +snippet eobj "import EmberObject from '@ember/object';" +import EmberObject from '@ember/object'; + +export default EmberObject.extend({ ${0://Properties here...} }); endsnippet # Mixin snippet emix "App.MixinName = Ember.Model.extend({...});" -${1:view_name} = Ember.Mixin.create({ +import Mixin from '@ember/object/mixin'; + +export default Mixin.create({ ${0://Properties here...} }); endsnippet @@ -66,25 +76,26 @@ snippet eset "this.set('property', value);" ${1:this}.set('${2:property}', ${3:value}); endsnippet -# Computer properties -snippet cpro "property_name: function() {...}.property()," -${1:property_name}: function() { - ${0://body...} -}.property('${3:argumenet}'), +# Computed properties +snippet cproimport "import { computed } from '@ember/object';" +import { computed } from '@ember/object'; endsnippet -snippet cpro ": function() {...}.property('property')," -${1:property_name}: function() { +snippet cpro "property_name: computed('...', function() {...})," +${1:property_name}: computed('${3:argument}', function() { ${0://body...} -}.property(), +}), endsnippet +# Observers +snippet prooimport "import { observer } from '@ember/object';" +import { observer } from '@ember/object'; +endsnippet -# Observes -snippet proo "property_name: function() {...}.property()" -${1:property_name}: function() { +snippet proo "property_name: observer('...', function() {...})," +${1:property_name}: observer('${3:argument}', function() { ${0://body...} -}.observes('${3:property}'), +}), endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 24af1b37..56351525 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -4,31 +4,32 @@ priority -50 - -snippet arg "Function Arguments" i -${1:a}: ${2:T}${3:, arg} -endsnippet - -snippet || "Closure, anonymous function (inline)" i -${1:move }|$2| { $3 } -endsnippet - -snippet |} "Closure, anonymous function (block)" i -${1:move }|$2| { - $3 +snippet fn "pub fn name(?) -> ? {}" +fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 } endsnippet -snippet macro "macro_rules!" b -macro_rules! ${1:name} { - (${2:matcher}) => ( - $3 - ) +snippet pfn "pub fn name(?) -> ? {}" +pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 } endsnippet -snippet fd "Struct field definition" w -${1:name}: ${2:Type}, +snippet pri "print!(..)" b +print!("$1"${2/..*/, /}$2); +endsnippet + +snippet pln "println!(..)" b +println!("$1"${2/..*/, /}$2); +endsnippet + +snippet fmt "format!(..)" +format!("$1"${2/..*/, /}$2); +endsnippet + +snippet it ".iter()" i +.iter()$0 endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets b/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets index 27f3a240..ccb4ec11 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets @@ -4,68 +4,36 @@ priority -50 # MATH STUFF # ############## -snippet eq "Equation" b -\begin{equation} - $0 -\end{equation} -endsnippet - -snippet eqnn "Equation without number" b +snippet eqnn "Equation without a number" b \begin{equation*} - $0 + ${0:${VISUAL}} \end{equation*} endsnippet snippet al "Align" b \begin{align} - $0 + ${0:${VISUAL}} \end{align} endsnippet -snippet alnn "Align without numbers" b +snippet alnn "Align without a number" b \begin{align*} - $0 + ${0:${VISUAL}} \end{align*} endsnippet snippet eqa "Equation array" b \begin{eqnarray} - $1 & $2 & $0 + ${1:${VISUAL}} & ${2:${VISUAL}} & ${0:${VISUAL}} \end{eqnarray} endsnippet -snippet eqann "Equation array without numbers" b +snippet eqann "Equation array without a number" b \begin{eqnarray*} - $1 & $2 & $0 + ${1:${VISUAL}} & ${2:${VISUAL}} & ${0:${VISUAL}} \end{eqnarray*} endsnippet -snippet frac "Fraction" w -\frac{${1:${VISUAL}}}{${2}} -endsnippet - -snippet mat "Smart Matrix" -\begin{${1:p/b/v/V/B/small}matrix} - $0 -\end{$1matrix} -endsnippet - -snippet lr( "left( right)" w -\left( ${1:${VISUAL}} \right) -endsnippet - -snippet lr| "left| right|" w -\left| ${1:${VISUAL}} \right| -endsnippet - -snippet lr{ "left\{ right\}" w -\left\\{ ${1:${VISUAL}} \right\\} -endsnippet - -snippet lr[ "left[ right]" w -\left[ ${1:${VISUAL}} \right] -endsnippet - ################# # PHYSICS STUFF # ################# diff --git a/sources_non_forked/vim-snippets/snippets/elm.snippets b/sources_non_forked/vim-snippets/snippets/elm.snippets index f967f512..8ae1d7d3 100644 --- a/sources_non_forked/vim-snippets/snippets/elm.snippets +++ b/sources_non_forked/vim-snippets/snippets/elm.snippets @@ -53,6 +53,8 @@ snippet tya ${0} snippet test test "${1}" <| \_ -> $0 +snippet desc + describe "${1}" [ $0 ] snippet doc {-| ${0} -} diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 24193db4..0d7885c7 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -11,11 +11,6 @@ snippet pfn "Function definition" pub fn ${1:function_name}(${2})${3} { ${0} } -snippet test "Unit test function" - #[test] - fn ${1:test_function_name}() { - ${0} - } snippet bench "Bench function" b #[bench] fn ${1:bench_function_name}(b: &mut test::Bencher) { @@ -24,7 +19,7 @@ snippet bench "Bench function" b }) } snippet new "Constructor function" - pub fn new(${2}) -> ${1:Name} { + pub fn new(${2}) -> ${1:Self} { $1 { ${3} } } snippet main "Main function" @@ -60,6 +55,16 @@ snippet mod mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { ${0} } /* $1 */ +# Testing +snippet as "assert!" + assert!(${1:predicate}); +snippet ase "assert_eq!" + assert_eq!(${1:expected}, ${2:actual}); +snippet test "Unit test function" + #[test] + fn ${1:function_name}_test() { + ${0} + } snippet testmod "Test module" b #[cfg(test)] mod tests { @@ -117,6 +122,8 @@ snippet mat "match pattern" } snippet case "Case clause of pattern match" ${1:_} => ${2:expression} +snippet = "=> " + => $0 snippet loop "loop {}" b loop { ${0:${VISUAL}} @@ -131,7 +138,7 @@ snippet for "for ... in ... loop" } # TODO commenting snippet todo "TODO comment" - // [TODO]: ${0:Description} + // TODO: $0 snippet fixme "FIXME comment" // FIXME: $0 # Struct @@ -153,12 +160,16 @@ snippet stn "Struct with new constructor" $1 { ${3} } } } -snippet type "Type alias" +snippet ty "Type alias" type ${1:NewName} = $2; snippet enum "enum definition" enum ${1:Name} { ${2}, } +snippet penum "pub enum definition" + pub enum ${1:Name} { + ${2}, + } # Traits snippet trait "Trait definition" trait ${1:Name} { @@ -186,11 +197,6 @@ snippet spawn "spawn a thread" }); snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()" let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel(); -# Testing -snippet as "assert!" - assert!(${1:predicate}); -snippet ase "assert_eq!" - assert_eq!(${1:expected}, ${2:actual}); # Implementations snippet asref "AsRef trait implementation" impl AsRef<${1:Ref}> for ${2:Type} { @@ -204,3 +210,19 @@ snippet asmut "AsMut trait implementation" &mut self.${0:field} } } +snippet fd "Struct field definition" w + ${1:name}: ${2:Type}, +snippet || "Closure, anonymous function (inline)" i + ${1:move }|$2| { $3 } +snippet |} "Closure, anonymous function (block)" i + ${1:move }|$2| { + $3 + } +snippet macro "macro_rules!" b + macro_rules! ${1:name} { + (${2:matcher}) => ( + $3 + ) + } +snippet box "Box::new()" + Box::new(${0:${VISUAL}}) diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 8351b393..49d3104f 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -321,17 +321,17 @@ snippet \{ \{ \} \\{ ${0} \\} #delimiter snippet lr left right - \\left${1} ${0} \\right$1 + \\left${1} ${0:${VISUAL}} \\right$1 snippet lr( left( right) - \\left( ${0} \\right) + \\left( ${0:${VISUAL}} \\right) snippet lr| left| right| - \\left| ${0} \\right| + \\left| ${0:${VISUAL}} \\right| snippet lr{ left\{ right\} - \\left\\{ ${0} \\right\\} + \\left\\{ ${0:${VISUAL}} \\right\\} snippet lr[ left[ right] - \\left[ ${0} \\right] + \\left[ ${0:${VISUAL}} \\right] snippet lra langle rangle - \\langle ${0} \\rangle + \\langle ${0:${VISUAL}} \\rangle # Code listings snippet lst \\begin{listing}[language=${1:language}]