From a224edb76ce449a48064557857e1665d271b9f7d Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 19 Apr 2019 10:33:56 +0200 Subject: [PATCH 01/91] Added a small note about Doist --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index adc63d24..711a8768 100644 --- a/README.md +++ b/README.md @@ -328,3 +328,10 @@ Cope mappings: Just do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` + + +## Doist + +Maintaining this Vim configuration isn't my day job. Daily I am the founder of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏). + +PS: Using Vim isn't a reqruiment 😄 From 95d2b0849035c90594b0b7a2f9f8112f38e561df Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 19 Apr 2019 10:55:47 +0200 Subject: [PATCH 02/91] Typo fix Thanks @rchrdchn --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 711a8768..9ba1275a 100644 --- a/README.md +++ b/README.md @@ -334,4 +334,4 @@ Just do following: Maintaining this Vim configuration isn't my day job. Daily I am the founder of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏). -PS: Using Vim isn't a reqruiment 😄 +PS: Using Vim isn't a requirement 😄 From fae0b73f0de26936b34c2eb012e5faae696b7d10 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 17 May 2019 16:09:13 +0200 Subject: [PATCH 03/91] Updated plugins --- .../ale/ale_linters/c/clang.vim | 5 +- sources_non_forked/ale/ale_linters/c/gcc.vim | 5 +- .../ale/ale_linters/chef/cookstyle.vim | 54 ++ .../ale/ale_linters/clojure/clj_kondo.vim | 34 ++ .../ale/ale_linters/cpp/clang.vim | 5 +- .../ale/ale_linters/cpp/gcc.vim | 5 +- .../ale/ale_linters/css/fecs.vim | 9 + sources_non_forked/ale/ale_linters/d/dmd.vim | 21 +- .../ale/ale_linters/elixir/elixir_ls.vim | 2 +- .../ale/ale_linters/erlang/syntaxerl.vim | 17 +- .../ale/ale_linters/eruby/erubi.vim | 17 +- .../ale/ale_linters/go/gopls.vim | 30 + .../ale/ale_linters/go/gotype.vim | 2 +- .../ale/ale_linters/haml/hamllint.vim | 2 +- .../ale/ale_linters/haskell/cabal_ghc.vim | 3 +- .../ale/ale_linters/haskell/stack_ghc.vim | 3 +- .../ale/ale_linters/html/fecs.vim | 9 + .../ale/ale_linters/java/eclipselsp.vim | 137 +++++ .../ale/ale_linters/java/javac.vim | 32 +- .../ale/ale_linters/javascript/fecs.vim | 10 + .../ale/ale_linters/javascript/flow.vim | 36 +- .../ale/ale_linters/kotlin/kotlinc.vim | 51 +- .../ale/ale_linters/php/phpstan.vim | 66 +-- .../ale/ale_linters/powershell/powershell.vim | 91 +++ .../powershell/psscriptanalyzer.vim | 76 +++ .../ale/ale_linters/python/flake8.vim | 28 +- .../ale/ale_linters/python/pylint.vim | 9 +- .../ale_linters/ruby/rails_best_practices.vim | 4 +- .../ale/ale_linters/ruby/reek.vim | 29 +- .../ale/ale_linters/rust/cargo.vim | 28 +- .../ale/ale_linters/rust/rls.vim | 2 +- .../ale/ale_linters/sh/shellcheck.vim | 40 +- .../ale/ale_linters/slim/slimlint.vim | 2 +- .../ale/ale_linters/swift/sourcekitlsp.vim | 13 + .../ale/ale_linters/typescript/xo.vim | 23 + .../ale/ale_linters/vim/vint.vim | 36 +- sources_non_forked/ale/autoload/ale.vim | 26 +- .../ale/autoload/ale/assert.vim | 170 ++++-- sources_non_forked/ale/autoload/ale/c.vim | 39 +- .../ale/autoload/ale/command.vim | 52 +- .../ale/autoload/ale/completion.vim | 120 ++-- .../ale/autoload/ale/cursor.vim | 2 +- .../ale/autoload/ale/definition.vim | 19 + .../ale/autoload/ale/engine.vim | 26 +- .../ale/autoload/ale/engine/ignore.vim | 6 +- sources_non_forked/ale/autoload/ale/fix.vim | 32 +- .../ale/autoload/ale/fix/registry.vim | 29 +- .../ale/autoload/ale/fixers/eslint.vim | 24 +- .../ale/autoload/ale/fixers/fecs.vim | 17 + .../ale/autoload/ale/fixers/floskell.vim | 20 + .../ale/autoload/ale/fixers/latexindent.vim | 18 + .../ale/autoload/ale/fixers/ocp_indent.vim | 18 + .../ale/autoload/ale/fixers/prettier.vim | 23 +- .../autoload/ale/fixers/prettier_eslint.vim | 34 +- .../ale/autoload/ale/fixers/styler.vim | 16 + .../ale/autoload/ale/handlers/eslint.vim | 5 + .../ale/autoload/ale/handlers/fecs.vim | 52 ++ .../ale/autoload/ale/handlers/redpen.vim | 4 +- .../ale/autoload/ale/highlight.vim | 140 ++++- .../ale/autoload/ale/linter.vim | 10 +- sources_non_forked/ale/autoload/ale/list.vim | 2 +- .../ale/autoload/ale/lsp/message.vim | 2 +- .../ale/autoload/ale/lsp/response.vim | 2 +- .../ale/autoload/ale/lsp_linter.vim | 20 +- sources_non_forked/ale/autoload/ale/node.vim | 2 +- .../ale/autoload/ale/powershell.vim | 32 ++ .../ale/autoload/ale/references.vim | 16 +- sources_non_forked/ale/autoload/ale/ruby.vim | 2 +- .../ale/autoload/ale/semver.vim | 49 +- sources_non_forked/ale/autoload/ale/sign.vim | 2 +- sources_non_forked/ale/autoload/ale/swift.vim | 13 + sources_non_forked/ale/autoload/ale/util.vim | 2 +- .../ale/autoload/ale/virtualtext.vim | 2 +- sources_non_forked/ale/doc/ale-chef.txt | 20 + sources_non_forked/ale/doc/ale-clojure.txt | 7 + sources_non_forked/ale/doc/ale-css.txt | 8 + .../ale/doc/ale-development.txt | 48 +- sources_non_forked/ale/doc/ale-go.txt | 179 +++--- sources_non_forked/ale/doc/ale-haskell.txt | 10 + sources_non_forked/ale/doc/ale-html.txt | 8 + sources_non_forked/ale/doc/ale-java.txt | 40 ++ sources_non_forked/ale/doc/ale-javascript.txt | 27 + sources_non_forked/ale/doc/ale-ocaml.txt | 28 + sources_non_forked/ale/doc/ale-php.txt | 16 +- sources_non_forked/ale/doc/ale-powershell.txt | 77 +++ sources_non_forked/ale/doc/ale-python.txt | 8 + sources_non_forked/ale/doc/ale-r.txt | 16 + sources_non_forked/ale/doc/ale-rust.txt | 8 +- sources_non_forked/ale/doc/ale-sh.txt | 12 + .../doc/ale-supported-languages-and-tools.txt | 16 + sources_non_forked/ale/doc/ale-swift.txt | 21 + sources_non_forked/ale/doc/ale-tex.txt | 21 + sources_non_forked/ale/doc/ale.txt | 526 +++++------------- sources_non_forked/ale/plugin/ale.vim | 2 +- .../rplugin/python3/deoplete/sources/ale.py | 54 ++ sources_non_forked/ale/supported-tools.md | 18 +- sources_non_forked/goyo.vim/doc/goyo.txt | 2 +- .../autoload/lightline/colorscheme/one.vim | 16 +- .../nerdtree/autoload/nerdtree.vim | 25 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 7 +- .../nerdtree/lib/nerdtree/bookmark.vim | 2 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 2 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 2 +- .../nerdtree/lib/nerdtree/ui.vim | 9 +- .../nerdtree/plugin/NERD_tree.vim | 5 +- sources_non_forked/vim-flake8/README.mdown | 4 +- .../vim-fugitive/autoload/fugitive.vim | 208 +++---- .../vim-go/.github/ISSUE_TEMPLATE.md | 20 +- sources_non_forked/vim-go/CHANGELOG.md | 49 +- sources_non_forked/vim-go/Dockerfile | 2 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 22 +- .../vim-go/autoload/go/complete.vim | 36 +- .../vim-go/autoload/go/config.vim | 10 +- .../vim-go/autoload/go/debug.vim | 60 +- sources_non_forked/vim-go/autoload/go/doc.vim | 8 +- .../vim-go/autoload/go/guru.vim | 2 +- .../vim-go/autoload/go/issue.vim | 2 +- sources_non_forked/vim-go/autoload/go/job.vim | 8 +- .../vim-go/autoload/go/lint.vim | 24 +- sources_non_forked/vim-go/autoload/go/lsp.vim | 145 ++++- .../vim-go/autoload/go/lsp/message.vim | 36 +- sources_non_forked/vim-go/autoload/go/mod.vim | 2 +- .../vim-go/autoload/go/package.vim | 133 ++++- .../vim-go/autoload/go/package_test.vim | 58 ++ .../vim-go/autoload/go/path.vim | 13 +- .../vim-go/autoload/go/tags.vim | 18 +- .../vim-go/autoload/go/tags_test.vim | 24 +- .../vim-go/autoload/go/term.vim | 132 +++-- .../vim-go/autoload/go/term_test.vim | 4 +- .../package/src/package/bar/.gitkeep | 0 .../package/src/package/baz/.gitkeep | 0 .../test-fixtures/package/src/package/go.mod | 3 + .../package/src/package/package.go | 7 + .../package/src/package/vendor/foo/.gitkeep | 0 .../vim-go/autoload/go/test.vim | 13 +- .../vim-go/autoload/go/test_test.vim | 8 +- .../vim-go/autoload/go/tool.vim | 21 +- sources_non_forked/vim-go/autoload/go/uri.vim | 6 +- .../vim-go/autoload/go/util.vim | 91 +-- sources_non_forked/vim-go/doc/vim-go.txt | 71 ++- sources_non_forked/vim-go/ftplugin/go.vim | 23 +- sources_non_forked/vim-go/plugin/go.vim | 32 +- sources_non_forked/vim-go/scripts/run-vim | 2 +- .../vim-markdown/doc/vim-markdown.txt | 22 + .../vim-markdown/syntax/markdown.vim | 2 +- .../vim-markdown/test/syntax.vader | 9 + .../vim-pug/{README.markdown => README.md} | 0 .../vim-repeat/autoload/repeat.vim | 26 +- .../vim-snippets/UltiSnips/cs.snippets | 6 +- .../vim-snippets/UltiSnips/python.snippets | 9 +- .../vim-snippets/snippets/eelixir.snippets | 2 +- .../vim-snippets/snippets/liquid.snippets | 263 +++++++++ .../vim-snippets/snippets/puppet.snippets | 8 +- .../vim-snippets/snippets/tex.snippets | 24 +- 154 files changed, 3522 insertions(+), 1370 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/chef/cookstyle.vim create mode 100644 sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim create mode 100644 sources_non_forked/ale/ale_linters/css/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/go/gopls.vim create mode 100644 sources_non_forked/ale/ale_linters/html/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/java/eclipselsp.vim create mode 100644 sources_non_forked/ale/ale_linters/javascript/fecs.vim create mode 100644 sources_non_forked/ale/ale_linters/powershell/powershell.vim create mode 100644 sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim create mode 100644 sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim create mode 100644 sources_non_forked/ale/ale_linters/typescript/xo.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/fecs.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/floskell.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/latexindent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/styler.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/fecs.vim create mode 100644 sources_non_forked/ale/autoload/ale/powershell.vim create mode 100644 sources_non_forked/ale/autoload/ale/swift.vim create mode 100644 sources_non_forked/ale/doc/ale-powershell.txt create mode 100644 sources_non_forked/ale/doc/ale-swift.txt create mode 100644 sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py create mode 100644 sources_non_forked/vim-go/autoload/go/package_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep rename sources_non_forked/vim-pug/{README.markdown => README.md} (100%) create mode 100644 sources_non_forked/vim-snippets/snippets/liquid.snippets diff --git a/sources_non_forked/ale/ale_linters/c/clang.vim b/sources_non_forked/ale/ale_linters/c/clang.vim index 5b243bfe..681101fc 100644 --- a/sources_non_forked/ale/ale_linters/c/clang.vim +++ b/sources_non_forked/ale/ale_linters/c/clang.vim @@ -19,9 +19,6 @@ call ale#linter#Define('c', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#clang#GetCommand'} -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clang#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim index ccb1912b..d965965d 100644 --- a/sources_non_forked/ale/ale_linters/c/gcc.vim +++ b/sources_non_forked/ale/ale_linters/c/gcc.vim @@ -19,9 +19,6 @@ call ale#linter#Define('c', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#gcc#GetCommand'} -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#gcc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/chef/cookstyle.vim b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim new file mode 100644 index 00000000..50bae2aa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim @@ -0,0 +1,54 @@ +" Author: Raphael Hoegger - https://github.com/pfuender +" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files + +call ale#Set('chef_cookstyle_executable', 'cookstyle') +call ale#Set('chef_cookstyle_options', '') + +function! ale_linters#chef#cookstyle#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'chef_cookstyle_options') + + return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s' +endfunction + +function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort + if len(a:lines) == 0 + return [] + endif + + let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {}) + + 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 = str2nr(l:error['location']['start_column']) + let l:end_col = str2nr(l:error['location']['last_column']) + + if !l:end_col + let l:end_col = l:start_col + 1 + endif + + call add(l:output, { + \ 'lnum': str2nr(l:error['location']['line']), + \ 'col': l:start_col, + \ 'end_col': l:end_col, + \ 'code': l:error['cop_name'], + \ 'text': l:error['message'], + \ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('chef', { +\ 'name': 'cookstyle', +\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')}, +\ 'command': function('ale_linters#chef#cookstyle#GetCommand'), +\ 'callback': 'ale_linters#chef#cookstyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim new file mode 100644 index 00000000..5dd11c12 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim @@ -0,0 +1,34 @@ +" Author: Masashi Iizuka +" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo + +function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort + " output format + " ::: : + let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:type = 'E' + + if l:match[4] is? 'warning' + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('clojure', { +\ 'name': 'clj-kondo', +\ 'output_stream': 'stdout', +\ 'executable': 'clj-kondo', +\ 'command': 'clj-kondo --lint %t', +\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clang.vim b/sources_non_forked/ale/ale_linters/cpp/clang.vim index 5a465812..e48291eb 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clang.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clang.vim @@ -19,9 +19,6 @@ call ale#linter#Define('cpp', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#clang#GetCommand'}, -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clang#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim index 831620d5..c427020b 100644 --- a/sources_non_forked/ale/ale_linters/cpp/gcc.vim +++ b/sources_non_forked/ale/ale_linters/cpp/gcc.vim @@ -20,9 +20,6 @@ call ale#linter#Define('cpp', { \ 'aliases': ['g++'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#gcc#GetCommand'}, -\ ], +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#gcc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) diff --git a/sources_non_forked/ale/ale_linters/css/fecs.vim b/sources_non_forked/ale/ale_linters/css/fecs.vim new file mode 100644 index 00000000..511847c6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for CSS files + +call ale#linter#Define('css', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/d/dmd.vim b/sources_non_forked/ale/ale_linters/d/dmd.vim index c816d592..14461ae6 100644 --- a/sources_non_forked/ale/ale_linters/d/dmd.vim +++ b/sources_non_forked/ale/ale_linters/d/dmd.vim @@ -1,7 +1,7 @@ " Author: w0rp " Description: "dmd for D files" -function! ale_linters#d#dmd#DUBCommand(buffer) abort +function! ale_linters#d#dmd#GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. if !executable('dub') " Returning an empty string skips to the DMD command. @@ -21,7 +21,18 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort \ . ' && dub describe --import-paths' endfunction -function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort +function! ale_linters#d#dmd#RunDUBCommand(buffer) abort + let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer) + + if empty(l:command) + " If we can't run DUB, just run DMD. + return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) + endif + + return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand')) +endfunction + +function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort let l:import_list = [] " Build a list of import paths generated from DUB, if available. @@ -57,9 +68,7 @@ endfunction call ale#linter#Define('d', { \ 'name': 'dmd', \ 'executable': 'dmd', -\ 'command_chain': [ -\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#d#dmd#RunDUBCommand'), \ 'callback': 'ale_linters#d#dmd#Handle', +\ 'output_stream': 'stderr', \}) 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 d5db7cd0..d5517de5 100644 --- a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim +++ b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim @@ -6,7 +6,7 @@ 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')) - let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh' + let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh' return l:dir . l:cmd endfunction diff --git a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim index 2b7276a1..5d555a8d 100644 --- a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim +++ b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim @@ -3,7 +3,17 @@ call ale#Set('erlang_syntaxerl_executable', 'syntaxerl') -function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort +function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable') + + return ale#command#Run( + \ a:buffer, + \ ale#Escape(l:executable) . ' -h', + \ function('ale_linters#erlang#syntaxerl#GetCommand'), + \) +endfunction + +function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1 return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t') @@ -27,9 +37,6 @@ endfunction call ale#linter#Define('erlang', { \ 'name': 'syntaxerl', \ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')}, -\ 'command_chain': [ -\ {'callback': {-> '%e -h'}}, -\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'}, -\ ], +\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)}, \ 'callback': 'ale_linters#erlang#syntaxerl#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erubi.vim b/sources_non_forked/ale/ale_linters/eruby/erubi.vim index 6f2d3ac6..ddca3f61 100644 --- a/sources_non_forked/ale/ale_linters/eruby/erubi.vim +++ b/sources_non_forked/ale/ale_linters/eruby/erubi.vim @@ -1,14 +1,10 @@ " Author: Eddie Lebow https://github.com/elebow " Description: eruby checker using `erubi` -function! ale_linters#eruby#erubi#CheckErubi(buffer) abort - return 'ruby -r erubi/capture_end -e ' . ale#Escape('""') -endfunction - -function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort +function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) - if (!empty(a:check_erubi_output)) + if !empty(a:output) " The empty command in CheckErubi returns nothing if erubi runs and " emits an error if erubi is not present return '' @@ -27,9 +23,10 @@ endfunction call ale#linter#Define('eruby', { \ 'name': 'erubi', \ 'executable': 'ruby', -\ 'command_chain': [ -\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'}, -\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': {buffer -> ale#command#Run( +\ buffer, +\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), +\ function('ale_linters#eruby#erubi#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim new file mode 100644 index 00000000..c411dc2b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -0,0 +1,30 @@ +" Author: w0rp +" Author: Jerko Steiner +" Description: https://github.com/saibing/gopls + +call ale#Set('go_gopls_executable', 'gopls') +call ale#Set('go_gopls_options', '--mode stdio') + +function! ale_linters#go#gopls#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) +endfunction + +function! ale_linters#go#gopls#FindProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:mods = ':h' + + if empty(l:project_root) + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + let l:mods = ':h:h' + endif + + return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : '' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'gopls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')}, +\ 'command': function('ale_linters#go#gopls#GetCommand'), +\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim index 159df892..d5d563aa 100644 --- a/sources_non_forked/ale/ale_linters/go/gotype.vim +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -6,7 +6,7 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort return '' endif - return ale#path#BufferCdString(a:buffer) . ' gotype .' + return ale#path#BufferCdString(a:buffer) . ' gotype -e .' endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/haml/hamllint.vim b/sources_non_forked/ale/ale_linters/haml/hamllint.vim index 7d7278aa..9fcd999f 100644 --- a/sources_non_forked/ale/ale_linters/haml/hamllint.vim +++ b/sources_non_forked/ale/ale_linters/haml/hamllint.vim @@ -19,7 +19,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort " See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89 " HamlLint::Linter::RuboCop#rubocop_flags if !empty(l:rubocop_config_file_path) - if ale#Has('win32') + if has('win32') let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&' else let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) diff --git a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim index 59978e7e..f3f248f5 100644 --- a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim @@ -4,7 +4,8 @@ call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort - return 'cabal exec -- ghc ' + return ale#path#BufferCdString(a:buffer) + \ . 'cabal exec -- ghc ' \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options') \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim index 06af7f6d..c345fe43 100644 --- a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim @@ -4,7 +4,8 @@ call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort - return ale#handlers#haskell#GetStackExecutable(a:buffer) + return ale#path#BufferCdString(a:buffer) + \ . ale#handlers#haskell#GetStackExecutable(a:buffer) \ . ' ghc -- ' \ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ' %t' diff --git a/sources_non_forked/ale/ale_linters/html/fecs.vim b/sources_non_forked/ale/ale_linters/html/fecs.vim new file mode 100644 index 00000000..15e00e12 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for HTMl files + +call ale#linter#Define('html', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim new file mode 100644 index 00000000..d0ea9d6c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -0,0 +1,137 @@ +" Author: Horacio Sanson +" Description: Support for the Eclipse language server https://github.com/eclipse/eclipse.jdt.ls + +let s:version_cache = {} + +call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls')) +call ale#Set('java_eclipselsp_executable', 'java') + +function! ale_linters#java#eclipselsp#Executable(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_executable') +endfunction + +function! ale_linters#java#eclipselsp#TargetPath(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_path') +endfunction + +function! ale_linters#java#eclipselsp#JarPath(buffer) abort + let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) + + " Search jar file within repository path when manually built using mvn + let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository' + let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) == 1 + return l:files[0] + endif + + " Search jar file within VSCode extensions folder. + let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) == 1 + return l:files[0] + endif + + return '' +endfunction + +function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort + let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h') + + if has('win32') + let l:path = l:path . '/config_win' + elseif has('macunix') + let l:path = l:path . '/config_mac' + else + let l:path = l:path . '/config_linux' + endif + + return ale#path#Simplify(l:path) +endfunction + +function! ale_linters#java#eclipselsp#VersionCheck(version_lines) abort + return s:GetVersion('', a:version_lines) +endfunction + +function! s:GetVersion(executable, version_lines) abort + let l:version = [] + + for l:line in a:version_lines + let l:match = matchlist(l:line, '\(\d\+\)\.\(\d\+\)\.\(\d\+\)') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0] + let s:version_cache[a:executable] = l:version + break + endif + endfor + + return l:version +endfunction + +function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, meta) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + let l:version = s:GetVersion(l:executable, a:version_lines) + + return ale_linters#java#eclipselsp#Command(a:buffer, l:version) +endfunction + +function! ale_linters#java#eclipselsp#Command(buffer, version) abort + let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') + + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + let l:cmd = [ ale#Escape(l:executable), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale_linters#java#eclipselsp#JarPath(a:buffer), + \ '-configuration', + \ ale_linters#java#eclipselsp#ConfigurationPath(a:buffer), + \ '-data', + \ ale#java#FindProjectRoot(a:buffer) + \ ] + + if ale#semver#GTE(a:version, [1, 9]) + call add(l:cmd, '--add-modules=ALL-SYSTEM') + call add(l:cmd, '--add-opens java.base/java.util=ALL-UNNAMED') + call add(l:cmd, '--add-opens java.base/java.lang=ALL-UNNAMED') + endif + + return join(l:cmd, ' ') +endfunction + +function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + if empty(l:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, l:executable) + return ale_linters#java#eclipselsp#Command(a:buffer, s:version_cache[l:executable]) + endif + + let l:command = ale#Escape(l:executable) . ' -version' + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#eclipselsp#CommandWithVersion') + \) +endfunction + +call ale#linter#Define('java', { +\ 'name': 'eclipselsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#java#eclipselsp#Executable'), +\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), +\ 'language': 'java', +\ 'project_root': function('ale#java#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 50cabacd..3883783b 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -7,21 +7,29 @@ call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') -function! ale_linters#java#javac#GetImportPaths(buffer) abort +function! ale_linters#java#javac#RunWithImportPaths(buffer) abort + let l:command = '' let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) + let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) \ . 'mvn dependency:build-classpath' endif - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let l:command = ale#gradle#BuildClasspathCommand(a:buffer) endif - return '' + if empty(l:command) + return ale_linters#java#javac#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#javac#GetCommand') + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort @@ -37,7 +45,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort \ : '' endfunction -function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort +function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) let l:sp_option = '' @@ -91,7 +99,7 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:16: error: ';' expected let l:directory = expand('#' . a:buffer . ':p:h') - let l:pattern = '\v^(.*):(\d+): (.+):(.+)$' + let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$' let l:col_pattern = '\v^(\s*\^)$' let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' let l:output = [] @@ -120,9 +128,7 @@ endfunction call ale#linter#Define('java', { \ 'name': 'javac', \ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#java#javac#RunWithImportPaths'), +\ 'output_stream': 'stderr', \ 'callback': 'ale_linters#java#javac#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/fecs.vim b/sources_non_forked/ale/ale_linters/javascript/fecs.vim new file mode 100644 index 00000000..e47c0a0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/fecs.vim @@ -0,0 +1,10 @@ +" Author: harttle +" Description: fecs for JavaScript files + +call ale#linter#Define('javascript', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'read_buffer': 0, +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim index 05aae030..3135e2e9 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -27,32 +27,13 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort \]) endfunction -function! ale_linters#javascript#flow#VersionCheck(buffer) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - return ale#Escape(l:executable) . ' --version' -endfunction - -function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - let l:version = ale#semver#GetVersion(l:executable, a:version_lines) - +function! ale_linters#javascript#flow#GetCommand(buffer, version) abort " If we can parse the version number, then only use --respect-pragma " if the version is >= 0.36.0, which added the argument. let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma') - \ && (empty(l:version) || ale#semver#GTE(l:version, [0, 36])) + \ && (empty(a:version) || ale#semver#GTE(a:version, [0, 36])) - return ale#Escape(l:executable) - \ . ' check-contents' + return '%e check-contents' \ . (l:use_respect_pragma ? ' --respect-pragma': '') \ . ' --json --from ale %s < %t' \ . (!has('win32') ? '; echo' : '') @@ -87,7 +68,6 @@ function! s:ExtraErrorMsg(current, new) abort return l:newMsg endfunction - function! s:GetDetails(error) abort let l:detail = '' @@ -169,10 +149,12 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow', \ 'executable': function('ale_linters#javascript#flow#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#javascript#flow#VersionCheck'}, -\ {'callback': 'ale_linters#javascript#flow#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#javascript#flow#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#javascript#flow#GetCommand'), +\ )}, \ 'callback': 'ale_linters#javascript#flow#Handle', \ 'read_buffer': 0, \}) diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 32dcc6d1..3c6854fa 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -11,26 +11,35 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi let s:classpath_sep = has('unix') ? ':' : ';' -function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort +function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort + let l:command = '' + " exec maven/gradle only if classpath is not set if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' - return '' - else - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') - - if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' - endif - - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command - endif - - return '' + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif + + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:pom_path) && executable('mvn') + let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) + \ . 'mvn dependency:build-classpath' + endif + + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let l:command = ale#gradle#BuildClasspathCommand(a:buffer) + endif + + if empty(l:command) + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#kotlin#kotlinc#GetCommand') + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort @@ -46,7 +55,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort \ : '' endfunction -function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort +function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths, meta) abort let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options') let l:command = 'kotlinc ' @@ -165,11 +174,7 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'kotlinc', \ 'executable': 'kotlinc', -\ 'command_chain': [ -\ {'callback': 'ale_linters#kotlin#kotlinc#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#kotlin#kotlinc#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'), \ 'callback': 'ale_linters#kotlin#kotlinc#Handle', \ 'lint_file': 1, \}) - diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 34d4e799..78f7dd10 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -3,44 +3,42 @@ " Set to change the ruleset let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan') -let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4') +let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') +let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') -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 +function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) - \ ? ' -c ' . l:configuration + \ ? ' -c ' . ale#Escape(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]) + let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload') + let l:autoload_option = !empty(l:autoload) + \ ? ' -a ' . ale#Escape(l:autoload) + \ : '' + + let l:level = ale#Var(a:buffer, 'php_phpstan_level') + let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') + + if empty(l:level) && empty(l:config_file_exists) + " if no configuration file is found, then use 4 as a default level + let l:level = '4' + endif + + let l:level_option = !empty(l:level) + \ ? ' -l ' . ale#Escape(l:level) + \ : '' + + let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) \ ? ' --error-format raw' \ : ' --errorFormat raw' - return '%e analyze -l' - \ . ale#Var(a:buffer, 'php_phpstan_level') + return '%e analyze --no-progress' \ . l:error_format \ . l:configuration_option + \ . l:autoload_option + \ . l:level_option \ . ' %s' endfunction @@ -56,7 +54,7 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'text': l:match[3], - \ 'type': 'W', + \ 'type': 'E', \}) endfor @@ -65,10 +63,12 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', -\ 'executable': function('ale_linters#php#phpstan#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#php#phpstan#VersionCheck'}, -\ {'callback': 'ale_linters#php#phpstan#GetCommand'}, -\ ], +\ 'executable': {b -> ale#Var(b, 'php_phpstan_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'php_phpstan_executable'), +\ '%e --version', +\ function('ale_linters#php#phpstan#GetCommand'), +\ )}, \ 'callback': 'ale_linters#php#phpstan#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/powershell/powershell.vim b/sources_non_forked/ale/ale_linters/powershell/powershell.vim new file mode 100644 index 00000000..51ded71d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/powershell.vim @@ -0,0 +1,91 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for powershell scripts synatax errors + +call ale#Set('powershell_powershell_executable', 'pwsh') + +function! ale_linters#powershell#powershell#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_powershell_executable') +endfunction + +" Some powershell magic to show syntax errors without executing the script +" thanks to keith hill: +" https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/ +function! ale_linters#powershell#powershell#GetCommand(buffer) abort + let l:script = ['Param($Script); + \ trap {$_;continue} & { + \ $Contents = Get-Content -Path $Script; + \ $Contents = [string]::Join([Environment]::NewLine, $Contents); + \ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents); + \ };'] + + return ale#powershell#RunPowerShell( + \ a:buffer, 'powershell_powershell', l:script) +endfunction + +" Parse powershell error output using regex into a list of dicts +function! ale_linters#powershell#powershell#Handle(buffer, lines) abort + let l:output = [] + " Our 3 patterns we need to scrape the data for the dicts + let l:patterns = [ + \ '\v^At line:(\d+) char:(\d+)', + \ '\v^(At|\+| )@!.*', + \ '\vFullyQualifiedErrorId : (\w+)', + \] + + let l:matchcount = 0 + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + " We want to work with 3 matches per syntax error + let l:matchcount = l:matchcount + 1 + + if l:matchcount == 1 || str2nr(l:match[1]) + " First match consists of 2 capture groups, and + " can capture the line and col + if exists('l:item') + " We may be here because the last syntax + " didn't emit a code, and so only had 2 + " matches + call add(l:output, l:item) + let l:matchcount = 1 + endif + + let l:item = { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'type': 'E', + \} + elseif l:matchcount == 2 + " Second match[0] grabs the full line in order + " to handles the text + let l:item['text'] = l:match[0] + else + " Final match handles the code, however + " powershell only emits 1 code for all errors + " so, we get the final code on the last error + " and loop over the previously added items to + " append the code we now know + call add(l:output, l:item) + unlet l:item + + if len(l:match[1]) > 0 + for l:i in l:output + let l:i['code'] = l:match[1] + endfor + endif + + " Reset the matchcount so we can begin gathering + " matches for the next syntax error + let l:matchcount = 0 + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'powershell', +\ 'executable_callback': 'ale_linters#powershell#powershell#GetExecutable', +\ 'command_callback': 'ale_linters#powershell#powershell#GetCommand', +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#powershell#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim new file mode 100644 index 00000000..4794d9d8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim @@ -0,0 +1,76 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for lintng powershell scripts +" using the PSScriptAnalyzer module. + +" let g:ale_powershell_psscriptanalyzer_exclusions = +" \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +call ale#Set('powershell_psscriptanalyzer_exclusions', '') +call ale#Set('powershell_psscriptanalyzer_executable', 'pwsh') +call ale#Set('powershell_psscriptanalyzer_module', +\ 'psscriptanalyzer') + +function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable') +endfunction + +" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines +" for each parsing +function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort + let l:exclude_option = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_exclusions') + let l:module = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_module') + let l:script = ['Param($Script); + \ Invoke-ScriptAnalyzer "$Script" ' + \ . (!empty(l:exclude_option) ? '-Exclude ' . l:exclude_option : '') + \ . '| ForEach-Object { + \ $_.Line; + \ $_.Severity; + \ $_.Message; + \ $_.RuleName}'] + + return ale#powershell#RunPowerShell( + \ a:buffer, + \ 'powershell_psscriptanalyzer', + \ l:script) +endfunction + +" add every 4 lines to an item(Dict) and every item to a list +" return the list +function! ale_linters#powershell#psscriptanalyzer#Handle(buffer, lines) abort + let l:output = [] + let l:lcount = 0 + + for l:line in a:lines + if l:lcount is# 0 + " the very first line + let l:item = {'lnum': str2nr(l:line)} + elseif l:lcount is# 1 + if l:line is# 'Error' + let l:item['type'] = 'E' + elseif l:line is# 'Information' + let l:item['type'] = 'I' + else + let l:item['type'] = 'W' + endif + elseif l:lcount is# 2 + let l:item['text'] = l:line + elseif l:lcount is# 3 + let l:item['code'] = l:line + call add(l:output, l:item) + let l:lcount = -1 + endif + + let l:lcount = l:lcount + 1 + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'psscriptanalyzer', +\ 'executable': function('ale_linters#powershell#psscriptanalyzer#GetExecutable'), +\ 'command': function('ale_linters#powershell#psscriptanalyzer#GetCommand'), +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 993d7adb..e2e7b743 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -24,28 +24,25 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort return ale#Var(a:buffer, 'python_flake8_executable') endfunction -function! ale_linters#python#flake8#VersionCheck(buffer) abort +function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#flake8#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) let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' + let l:command = ale#Escape(l:executable) . l:module_string . ' --version' - return l:executable . l:module_string . ' --version' + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale_linters#python#flake8#GetCommand'), + \) endfunction -function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort +function! ale_linters#python#flake8#GetCommand(buffer, version) abort let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory') \ ? ale#path#BufferCdString(a:buffer) \ : '' let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run flake8' @@ -53,7 +50,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort " Only include the --stdin-display-name argument if we can parse the " flake8 version, and it is recent enough to support it. - let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [3, 0, 0]) \ ? ' --stdin-display-name %s' \ : '' @@ -144,9 +141,6 @@ endfunction call ale#linter#Define('python', { \ 'name': 'flake8', \ 'executable': function('ale_linters#python#flake8#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#python#flake8#VersionCheck'}, -\ {'callback': 'ale_linters#python#flake8#GetCommand', 'output_stream': 'both'}, -\ ], +\ 'command': function('ale_linters#python#flake8#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flake8#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index 57e82691..b16d5355 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -6,6 +6,7 @@ call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) +call ale#Set('python_pylint_use_msg_id', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) @@ -64,11 +65,17 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort continue endif + if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1 + let l:code_out = l:code + else + let l:code_out = l:match[4] + endif + call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 1, \ 'text': l:match[5], - \ 'code': l:match[4], + \ 'code': l:code_out, \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim index 680cc364..a94fb671 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim @@ -30,8 +30,8 @@ function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort endif let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable') - let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout ' - let l:cat_file = ale#Has('win32') ? '; type %t' : '' + let l:output_file = has('win32') ? '%t ' : '/dev/stdout ' + let l:cat_file = has('win32') ? '; type %t' : '' return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim index 26f6e36c..e39e366f 100644 --- a/sources_non_forked/ale/ale_linters/ruby/reek.vim +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -6,26 +6,11 @@ call ale#Set('ruby_reek_show_wiki_link', 0) call ale#Set('ruby_reek_options', '') call ale#Set('ruby_reek_executable', 'reek') -function! ale_linters#ruby#reek#VersionCheck(buffer) abort - " If we have previously stored the version number in a cache, then - " don't look it up again. - if ale#semver#HasVersion('reek') - " Returning an empty string skips this command. - return '' - endif - - let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') - - return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') - \ . ' --version' -endfunction - -function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('reek', a:version_output) +function! ale_linters#ruby#reek#GetCommand(buffer, version) abort let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') " Tell reek what the filename is if the version of reek is new enough. - let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [5, 0, 0]) \ ? ' --stdin-filename %s' \ : '' @@ -70,9 +55,11 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', \ 'executable': {b -> ale#Var(b, 'ruby_reek_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#ruby#reek#VersionCheck'}, -\ {'callback': 'ale_linters#ruby#reek#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'ruby_reek_executable'), +\ '%e --version', +\ function('ale_linters#ruby#reek#GetCommand'), +\ )}, \ 'callback': 'ale_linters#ruby#reek#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index b4eabfae..f98dee9b 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -22,26 +22,18 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort endif endfunction -function! ale_linters#rust#cargo#VersionCheck(buffer) abort - return !ale#semver#HasVersion('cargo') - \ ? 'cargo --version' - \ : '' -endfunction - -function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('cargo', a:version_output) - +function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') - \ && ale#semver#GTE(l:version, [0, 17, 0]) + \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:use_all_targets = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_examples = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_examples') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_tests = l:use_check \ && ale#Var(a:buffer, 'rust_cargo_check_tests') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -94,10 +86,12 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#rust#cargo#VersionCheck'}, -\ {'callback': 'ale_linters#rust#cargo#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#rust#cargo#GetCargoExecutable(buffer), +\ '%e --version', +\ function('ale_linters#rust#cargo#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#rust#HandleRustErrors', \ 'output_stream': 'both', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/rust/rls.vim b/sources_non_forked/ale/ale_linters/rust/rls.vim index 0e5c326c..111d7558 100644 --- a/sources_non_forked/ale/ale_linters/rust/rls.vim +++ b/sources_non_forked/ale/ale_linters/rust/rls.vim @@ -2,7 +2,7 @@ " Description: A language server for Rust call ale#Set('rust_rls_executable', 'rls') -call ale#Set('rust_rls_toolchain', 'nightly') +call ale#Set('rust_rls_toolchain', '') call ale#Set('rust_rls_config', {}) function! ale_linters#rust#rls#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim index bb7048cd..1d8b6096 100644 --- a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim +++ b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim @@ -10,10 +10,7 @@ call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_excl call ale#Set('sh_shellcheck_executable', 'shellcheck') call ale#Set('sh_shellcheck_dialect', 'auto') call ale#Set('sh_shellcheck_options', '') - -function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'sh_shellcheck_executable') -endfunction +call ale#Set('sh_shellcheck_change_directory', 1) function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) @@ -39,30 +36,21 @@ function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort return '' endfunction -function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - - " Don't check the version again if we've already cached it. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - +function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') - let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : '' + let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' + let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory') + \ ? ale#path#BufferCdString(a:buffer) + \ : '' if l:dialect is# 'auto' let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) endif - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + return l:cd_string + \ . '%e' \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') @@ -108,10 +96,12 @@ endfunction call ale#linter#Define('sh', { \ 'name': 'shellcheck', -\ 'executable': function('ale_linters#sh#shellcheck#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'}, -\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'}, -\ ], +\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'sh_shellcheck_executable'), +\ '%e --version', +\ function('ale_linters#sh#shellcheck#GetCommand'), +\ )}, \ 'callback': 'ale_linters#sh#shellcheck#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/slim/slimlint.vim b/sources_non_forked/ale/ale_linters/slim/slimlint.vim index 1a4008ae..1b365e25 100644 --- a/sources_non_forked/ale/ale_linters/slim/slimlint.vim +++ b/sources_non_forked/ale/ale_linters/slim/slimlint.vim @@ -11,7 +11,7 @@ function! ale_linters#slim#slimlint#GetCommand(buffer) abort " " See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop if !empty(l:rubocop_config) - if ale#Has('win32') + if has('win32') let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command else let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command diff --git a/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim new file mode 100644 index 00000000..560893bf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim @@ -0,0 +1,13 @@ +" Author: Dan Loman +" Description: Support for sourcekit-lsp https://github.com/apple/sourcekit-lsp + +call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp') + +call ale#linter#Define('swift', { +\ 'name': 'sourcekitlsp', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale#swift#FindProjectRoot'), +\ 'language': 'swift', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/xo.vim b/sources_non_forked/ale/ale_linters/typescript/xo.vim new file mode 100644 index 00000000..8b015efd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/xo.vim @@ -0,0 +1,23 @@ +call ale#Set('typescript_xo_executable', 'xo') +call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_xo_options', '') + +function! ale_linters#typescript#xo#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'typescript_xo', [ + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale_linters#typescript#xo#GetCommand(buffer) abort + return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer)) + \ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options')) + \ . ' --reporter unix --stdin --stdin-filename %s' +endfunction + +" xo uses eslint and the output format is the same +call ale#linter#Define('typescript', { +\ 'name': 'xo', +\ 'executable': function('ale_linters#typescript#xo#GetExecutable'), +\ 'command': function('ale_linters#typescript#xo#GetCommand'), +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/vim/vint.vim b/sources_non_forked/ale/ale_linters/vim/vint.vim index 3808c47e..65e19126 100644 --- a/sources_non_forked/ale/ale_linters/vim/vint.vim +++ b/sources_non_forked/ale/ale_linters/vim/vint.vim @@ -7,29 +7,13 @@ call ale#Set('vim_vint_executable', 'vint') let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' -function! ale_linters#vim#vint#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'vim_vint_executable') -endfunction - -function! ale_linters#vim#vint#VersionCommand(buffer) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - - " Check the Vint version if we haven't checked it already. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - - let l:can_use_no_color_flag = empty(l:version) - \ || ale#semver#GTE(l:version, [0, 3, 7]) +function! ale_linters#vim#vint#GetCommand(buffer, version) abort + let l:can_use_no_color_flag = empty(a:version) + \ || ale#semver#GTE(a:version, [0, 3, 7]) let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' - return ale#Escape(l:executable) + return '%e' \ . ' ' . l:warning_flag \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim @@ -65,10 +49,12 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'vint', -\ 'executable': function('ale_linters#vim#vint#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, -\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, -\ ], +\ 'executable': {buffer -> ale#Var(buffer, 'vim_vint_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'vim_vint_executable'), +\ '%e --version', +\ function('ale_linters#vim#vint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#vim#vint#Handle', \}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 5aa5fbfc..04329dfd 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -8,6 +8,7 @@ let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') " Ignoring linters, for disabling some, or ignoring LSP diagnostics. let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) +let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0) let s:lint_timer = -1 let s:getcmdwintype_exists = exists('*getcmdwintype') @@ -42,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif + " Do nothing for diff buffers. + if getbufvar(a:buffer, '&diff') + return 1 + endif + " Do nothing for blacklisted files. if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0 return 1 @@ -90,8 +96,9 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Apply ignore lists for linters only if needed. let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') - let l:linters = !empty(l:ignore_config) - \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config) + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + let l:linters = !empty(l:ignore_config) || l:disable_lsp + \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp) \ : l:linters " Tell other sources that they can start checking the buffer now. @@ -149,12 +156,19 @@ function! ale#Queue(delay, ...) abort endif endfunction -let g:ale_has_override = get(g:, 'ale_has_override', {}) +let s:current_ale_version = [2, 4, 0] -" Call has(), but check a global Dictionary so we can force flags on or off -" for testing purposes. +" A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort - return get(g:ale_has_override, a:feature, has(a:feature)) + let l:match = matchlist(a:feature, '\c\v^ale-(\d+)\.(\d+)(\.(\d+))?$') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + + return ale#semver#GTE(s:current_ale_version, l:version) + endif + + return 0 endfunction " Given a buffer number and a variable name, look for that variable in the diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 6c2586a6..ed90792d 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -1,7 +1,7 @@ -let s:chain_results = [] +let s:command_output = [] -function! ale#assert#WithChainResults(...) abort - let s:chain_results = a:000 +function! ale#assert#GivenCommandOutput(...) abort + let s:command_output = a:000 endfunction function! s:GetLinter() abort @@ -19,6 +19,39 @@ function! s:GetLinter() abort return l:filetype_linters[0] endfunction +function! s:FormatExe(command, executable) abort + return substitute(a:command, '%e', '\=ale#Escape(a:executable)', 'g') +endfunction + +function! s:ProcessDeferredCommands(initial_result) abort + let l:result = a:initial_result + let l:command_index = 0 + let l:command = [] + + while ale#command#IsDeferred(l:result) + call add(l:command, s:FormatExe(l:result.command, l:result.executable)) + + if get(g:, 'ale_run_synchronously_emulate_commands') + " Don't run commands, but simulate the results. + let l:Callback = g:ale_run_synchronously_callbacks[0] + let l:output = get(s:command_output, l:command_index, []) + call l:Callback(0, l:output) + unlet g:ale_run_synchronously_callbacks + + let l:command_index += 1 + else + " Run the commands in the shell, synchronously. + call ale#test#FlushJobs() + endif + + let l:result = l:result.value + endwhile + + call add(l:command, l:result) + + return l:command +endfunction + " Load the currently loaded linter for a test case, and check that the command " matches the given string. function! ale#assert#Linter(expected_executable, expected_command) abort @@ -31,47 +64,20 @@ function! ale#assert#Linter(expected_executable, expected_command) abort let l:executable = l:executable.value endwhile - if has_key(l:linter, 'command_chain') - let l:callbacks = map(copy(l:linter.command_chain), 'v:val.callback') + let l:command = s:ProcessDeferredCommands( + \ ale#linter#GetCommand(l:buffer, l:linter), + \) - " If the expected command is a string, just check the last one. - if type(a:expected_command) is v:t_string - if len(l:callbacks) is 1 - let l:command = call(l:callbacks[0], [l:buffer]) - else - let l:input = get(s:chain_results, len(l:callbacks) - 2, []) - let l:command = call(l:callbacks[-1], [l:buffer, l:input]) - endif - else - let l:command = [] - let l:chain_index = 0 - - for l:Callback in l:callbacks - if l:chain_index is 0 - call add(l:command, call(l:Callback, [l:buffer])) - else - let l:input = get(s:chain_results, l:chain_index - 1, []) - call add(l:command, call(l:Callback, [l:buffer, l:input])) - endif - - let l:chain_index += 1 - endfor - endif - else - let l:command = ale#linter#GetCommand(l:buffer, l:linter) - - while ale#command#IsDeferred(l:command) - call ale#test#FlushJobs() - let l:command = l:command.value - endwhile + if type(a:expected_command) isnot v:t_list + let l:command = l:command[-1] endif if type(l:command) is v:t_string " Replace %e with the escaped executable, so tests keep passing after " linters are changed to use %e. - let l:command = substitute(l:command, '%e', '\=ale#Escape(l:executable)', 'g') + let l:command = s:FormatExe(l:command, l:executable) elseif type(l:command) is v:t_list - call map(l:command, 'substitute(v:val, ''%e'', ''\=ale#Escape(l:executable)'', ''g'')') + call map(l:command, 's:FormatExe(v:val, l:executable)') endif AssertEqual @@ -79,6 +85,17 @@ function! ale#assert#Linter(expected_executable, expected_command) abort \ [l:executable, l:command] endfunction +function! ale#assert#Fixer(expected_result) abort + let l:buffer = bufnr('') + let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer)) + + if type(a:expected_result) isnot v:t_list + let l:result = l:result[-1] + endif + + AssertEqual a:expected_result, l:result +endfunction + function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() @@ -128,7 +145,7 @@ function! ale#assert#LSPAddress(expected_address) abort endfunction function! ale#assert#SetUpLinterTestCommands() abort - command! -nargs=+ WithChainResults :call ale#assert#WithChainResults() + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() command! -nargs=+ AssertLinter :call ale#assert#Linter() command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted() command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() @@ -138,6 +155,11 @@ function! ale#assert#SetUpLinterTestCommands() abort command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress() endfunction +function! ale#assert#SetUpFixerTestCommands() abort + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertFixer :call ale#assert#Fixer() +endfunction + " A dummy function for making sure this module is loaded. function! ale#assert#SetUpLinterTest(filetype, name) abort " Set up a marker so ALE doesn't create real random temporary filenames. @@ -179,14 +201,21 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort endif call ale#assert#SetUpLinterTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 endfunction function! ale#assert#TearDownLinterTest() abort unlet! g:ale_create_dummy_temporary_file - let s:chain_results = [] + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] - if exists(':WithChainResults') - delcommand WithChainResults + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput endif if exists(':AssertLinter') @@ -229,3 +258,62 @@ function! ale#assert#TearDownLinterTest() abort call ale#semver#ResetVersionCache() endif endfunction + +function! ale#assert#SetUpFixerTest(filetype, name) abort + " Set up a marker so ALE doesn't create real random temporary filenames. + let g:ale_create_dummy_temporary_file = 1 + + let l:function_name = ale#fix#registry#GetFunc(a:name) + let s:FixerFunction = function(l:function_name) + + let l:prefix = 'ale_' . a:filetype . '_' . a:name + let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + + for l:key in filter(keys(g:), b:filter_expr) + execute 'Save g:' . l:key + unlet g:[l:key] + endfor + + for l:key in filter(keys(b:), b:filter_expr) + unlet b:[l:key] + endfor + + execute 'runtime autoload/ale/fixers/' . a:name . '.vim' + + if !exists('g:dir') + call ale#test#SetDirectory('/testplugin/test/fixers') + endif + + call ale#assert#SetUpFixerTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 +endfunction + +function! ale#assert#TearDownFixerTest() abort + unlet! g:ale_create_dummy_temporary_file + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] + unlet! s:FixerFunction + + if exists('g:dir') + call ale#test#RestoreDirectory() + endif + + Restore + + if exists('*ale#semver#ResetVersionCache') + call ale#semver#ResetVersionCache() + endif + + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput + endif + + if exists(':AssertFixer') + delcommand AssertFixer + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index d759b25a..a9289e22 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -219,9 +219,32 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort " Search for an exact file match first. let l:basename = tolower(expand('#' . a:buffer . ':t')) let l:file_list = get(a:file_lookup, l:basename, []) + " A source file matching the header filename. + let l:source_file = '' + + if empty(l:file_list) && l:basename =~? '\.h$\|\.hpp$' + for l:suffix in ['.c', '.cpp'] + let l:key = fnamemodify(l:basename, ':r') . l:suffix + let l:file_list = get(a:file_lookup, l:key, []) + + if !empty(l:file_list) + let l:source_file = l:key + break + endif + endfor + endif for l:item in l:file_list - if bufnr(l:item.file) is a:buffer && has_key(l:item, 'command') + " Load the flags for this file, or for a source file matching the + " header file. + if has_key(l:item, 'command') + \&& ( + \ bufnr(l:item.file) is a:buffer + \ || ( + \ !empty(l:source_file) + \ && l:item.file[-len(l:source_file):] is? l:source_file + \ ) + \) return ale#c#ParseCFlags(l:item.directory, l:item.command) endif endfor @@ -284,6 +307,20 @@ function! ale#c#GetMakeCommand(buffer) abort return '' endfunction +function! ale#c#RunMakeCommand(buffer, Callback) abort + let l:command = ale#c#GetMakeCommand(a:buffer) + + if empty(l:command) + return a:Callback(a:buffer, []) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ {b, output -> a:Callback(a:buffer, output)}, + \) +endfunction + " Given a buffer number, search for a project root, and output a List " of directories to include based on some heuristics. " diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim index 33ce577c..1bbc4f4c 100644 --- a/sources_non_forked/ale/autoload/ale/command.vim +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -329,30 +329,46 @@ function! ale#command#Run(buffer, command, Callback, ...) abort " " The `_deferred_job_id` is used for both checking the type of object, and " for checking the job ID and status. - let l:result = {'_deferred_job_id': l:job_id} + " + " The original command here is used in tests. + let l:result = { + \ '_deferred_job_id': l:job_id, + \ 'executable': get(l:options, 'executable', ''), + \ 'command': a:command, + \} if get(g:, 'ale_run_synchronously') == 1 && l:job_id - " Run a command synchronously if this test option is set. - call extend(l:line_list, systemlist( - \ type(l:command) is v:t_list - \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) - \ : l:command - \)) - - " Don't capture output when the callbacks aren't set. - if !has_key(l:job_options, 'out_cb') - \&& !has_key(l:job_options, 'err_cb') - let l:line_list = [] - endif - if !exists('g:ale_run_synchronously_callbacks') let g:ale_run_synchronously_callbacks = [] endif - call add( - \ g:ale_run_synchronously_callbacks, - \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} - \) + if get(g:, 'ale_run_synchronously_emulate_commands', 0) + call add( + \ g:ale_run_synchronously_callbacks, + \ {exit_code, output -> [ + \ extend(l:line_list, output), + \ l:job_options.exit_cb(l:job_id, exit_code), + \ ]} + \) + else + " Run a command synchronously if this test option is set. + call extend(l:line_list, systemlist( + \ type(l:command) is v:t_list + \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) + \ : l:command + \)) + + " Don't capture output when the callbacks aren't set. + if !has_key(l:job_options, 'out_cb') + \&& !has_key(l:job_options, 'err_cb') + let l:line_list = [] + endif + + call add( + \ g:ale_run_synchronously_callbacks, + \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} + \) + endif endif return l:result diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 682f4c43..03cc6471 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -159,18 +159,20 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort endfunction function! s:ReplaceCompletionOptions() abort - " Remember the old omnifunc value, if there is one. - " If we don't store an old one, we'll just never reset the option. - " This will stop some random exceptions from appearing. - if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) - let b:ale_old_omnifunc = &l:omnifunc + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + " Remember the old omnifunc value, if there is one. + " If we don't store an old one, we'll just never reset the option. + " This will stop some random exceptions from appearing. + if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) + let b:ale_old_omnifunc = &l:omnifunc + endif + + let &l:omnifunc = 'ale#completion#OmniFunc' endif - let &l:omnifunc = 'ale#completion#OmniFunc' - - let l:info = get(b:, 'ale_completion_info', {}) - - if !get(l:info, 'manual') + if l:source is# 'ale-automatic' if !exists('b:ale_old_completeopt') let b:ale_old_completeopt = &l:completeopt endif @@ -199,31 +201,49 @@ function! ale#completion#RestoreCompletionOptions() abort endif endfunction +function! ale#completion#GetCompletionPosition() abort + if !exists('b:ale_completion_info') + return 0 + endif + + let l:line = b:ale_completion_info.line + let l:column = b:ale_completion_info.column + let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) + let l:up_to_column = getline(l:line)[: l:column - 2] + let l:match = matchstr(l:up_to_column, l:regex) + + return l:column - len(l:match) - 1 +endfunction + +function! ale#completion#GetCompletionResult() abort + " Parse a new response if there is one. + if exists('b:ale_completion_response') + \&& exists('b:ale_completion_parser') + let l:response = b:ale_completion_response + let l:parser = b:ale_completion_parser + + unlet b:ale_completion_response + unlet b:ale_completion_parser + + let b:ale_completion_result = function(l:parser)(l:response) + endif + + if exists('b:ale_completion_result') + return b:ale_completion_result + endif + + return v:null +endfunction + function! ale#completion#OmniFunc(findstart, base) abort if a:findstart - let l:line = b:ale_completion_info.line - let l:column = b:ale_completion_info.column - let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) - let l:up_to_column = getline(l:line)[: l:column - 2] - let l:match = matchstr(l:up_to_column, l:regex) - - return l:column - len(l:match) - 1 + return ale#completion#GetCompletionPosition() else - " Parse a new response if there is one. - if exists('b:ale_completion_response') - \&& exists('b:ale_completion_parser') - let l:response = b:ale_completion_response - let l:parser = b:ale_completion_parser - - unlet b:ale_completion_response - unlet b:ale_completion_parser - - let b:ale_completion_result = function(l:parser)(l:response) - endif + let l:result = ale#completion#GetCompletionResult() call s:ReplaceCompletionOptions() - return get(b:, 'ale_completion_result', []) + return l:result isnot v:null ? l:result : [] endif endfunction @@ -239,7 +259,14 @@ function! ale#completion#Show(response, completion_parser) abort " Replace completion options shortly before opening the menu. call s:ReplaceCompletionOptions() - call timer_start(0, {-> ale#util#FeedKeys("\(ale_show_completion_menu)")}) + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + call timer_start( + \ 0, + \ {-> ale#util#FeedKeys("\(ale_show_completion_menu)")} + \) + endif endfunction function! s:CompletionStillValid(request_id) abort @@ -249,7 +276,10 @@ function! s:CompletionStillValid(request_id) abort \&& has_key(b:, 'ale_completion_info') \&& b:ale_completion_info.request_id == a:request_id \&& b:ale_completion_info.line == l:line - \&& b:ale_completion_info.column == l:column + \&& ( + \ b:ale_completion_info.column == l:column + \ || b:ale_completion_info.source is# 'deoplete' + \) endfunction function! ale#completion#ParseTSServerCompletions(response) abort @@ -356,6 +386,8 @@ function! ale#completion#ParseLSPCompletions(response) abort if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN \&& type(get(l:item, 'textEdit')) is v:t_dict let l:text = l:item.textEdit.newText + elseif type(get(l:item, 'insertText')) is v:t_string + let l:text = l:item.insertText else let l:text = l:item.label endif @@ -517,14 +549,27 @@ function! s:OnReady(linter, lsp_details) abort endif endfunction +" This function can be called to check if ALE can provide completion data for +" the current buffer. 1 will be returned if there's a potential source of +" completion data ALE can use, and 0 will be returned otherwise. +function! ale#completion#CanProvideCompletions() abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + return 1 + endif + endfor + + return 0 +endfunction + " This function can be used to manually trigger autocomplete, even when " g:ale_completion_enabled is set to false -function! ale#completion#GetCompletions(manual) abort +function! ale#completion#GetCompletions(source) abort let [l:line, l:column] = getpos('.')[1:2] let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) - if !a:manual && empty(l:prefix) + if a:source is# 'ale-automatic' && empty(l:prefix) return endif @@ -537,8 +582,9 @@ function! ale#completion#GetCompletions(manual) abort \ 'prefix': l:prefix, \ 'conn_id': 0, \ 'request_id': 0, - \ 'manual': a:manual, + \ 'source': a:source, \} + unlet! b:ale_completion_result let l:buffer = bufnr('') let l:Callback = function('s:OnReady') @@ -551,7 +597,7 @@ function! ale#completion#GetCompletions(manual) abort endfunction function! s:TimerHandler(...) abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif @@ -562,7 +608,7 @@ function! s:TimerHandler(...) abort " When running the timer callback, we have to be sure that the cursor " hasn't moved from where it was when we requested completions by typing. if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i' - call ale#completion#GetCompletions(0) + call ale#completion#GetCompletions('ale-automatic') endif endfunction @@ -576,7 +622,7 @@ function! ale#completion#StopTimer() abort endfunction function! ale#completion#Queue() abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index eea8ffe6..8c331c5c 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -25,7 +25,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort let l:cursor_position = getpos('.') " The message is truncated and saved to the history. - setlocal shortmess+=T + silent! setlocal shortmess+=T try exec "norm! :echomsg l:message\n" diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 521f0b45..3915cac1 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -3,6 +3,9 @@ let s:go_to_definition_map = {} +" Enable automatic updates of the tagstack +let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1) + " Used to get the definition map in tests. function! ale#definition#GetMap() abort return deepcopy(s:go_to_definition_map) @@ -17,6 +20,20 @@ function! ale#definition#ClearLSPData() abort let s:go_to_definition_map = {} endfunction +function! ale#definition#UpdateTagStack() abort + let l:should_update_tagstack = exists('*gettagstack') && exists('*settagstack') && g:ale_update_tagstack + + if l:should_update_tagstack + " Grab the old location (to jump back to) and the word under the + " cursor (as a label for the tagstack) + let l:old_location = [bufnr('%'), line('.'), col('.'), 0] + let l:tagname = expand('') + let l:winid = win_getid() + call settagstack(l:winid, {'items': [{'from': l:old_location, 'tagname': l:tagname}]}, 'a') + call settagstack(l:winid, {'curidx': len(gettagstack(l:winid)['items']) + 1}) + endif +endfunction + function! ale#definition#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') is# 'definition' \&& has_key(s:go_to_definition_map, a:response.request_seq) @@ -27,6 +44,7 @@ function! ale#definition#HandleTSServerResponse(conn_id, response) abort let l:line = a:response.body[0].start.line let l:column = a:response.body[0].start.offset + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) endif endif @@ -51,6 +69,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort let l:line = l:item.range.start.line + 1 let l:column = l:item.range.start.character + 1 + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) break endfor diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 340f6913..7db808d6 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -39,8 +39,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort endif endfunction -function! ale#engine#MarkLinterInactive(info, linter) abort - call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name') +function! ale#engine#MarkLinterInactive(info, linter_name) abort + call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name') endfunction function! ale#engine#ResetExecutableCache() abort @@ -107,24 +107,36 @@ endfunction " Register a temporary file to be managed with the ALE engine for " a current job run. function! ale#engine#ManageFile(buffer, filename) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#ManageFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + call ale#command#ManageFile(a:buffer, a:filename) endfunction " Same as the above, but manage an entire directory. function! ale#engine#ManageDirectory(buffer, directory) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#ManageDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + call ale#command#ManageDirectory(a:buffer, a:directory) endfunction function! ale#engine#CreateFile(buffer) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#CreateFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + return ale#command#CreateFile(a:buffer) endfunction " Create a new temporary directory and manage it in one go. function! ale#engine#CreateDirectory(buffer) abort - " TODO: Emit deprecation warning here later. + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''ale#engine#CreateDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + return ale#command#CreateDirectory(a:buffer) endfunction @@ -183,7 +195,7 @@ function! s:HandleExit(job_info, buffer, output, data) abort let l:next_chain_index = a:job_info.next_chain_index " Remove this job from the list. - call ale#engine#MarkLinterInactive(l:buffer_info, l:linter) + call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name) " Stop here if we land in the handle for a job completing if we're in " a sandbox. diff --git a/sources_non_forked/ale/autoload/ale/engine/ignore.vim b/sources_non_forked/ale/autoload/ale/engine/ignore.vim index 2db2c6c1..80574656 100644 --- a/sources_non_forked/ale/autoload/ale/engine/ignore.vim +++ b/sources_non_forked/ale/autoload/ale/engine/ignore.vim @@ -22,7 +22,7 @@ function! ale#engine#ignore#GetList(filetype, config) abort endfunction " Given a List of linter descriptions, exclude the linters to be ignored. -function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort +function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config) let l:filtered_linters = [] @@ -37,6 +37,10 @@ function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort endif endfor + if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# '' + let l:should_include = 0 + endif + if l:should_include call add(l:filtered_linters, l:linter) endif diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index b8674606..92ae3e14 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -1,3 +1,5 @@ +call ale#Set('fix_on_save_ignore', {}) + " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. function! ale#fix#ApplyQueuedFixes() abort @@ -117,6 +119,10 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort let l:input = a:job_info.input endif + if l:ChainCallback isnot v:null && !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom ''chain_with is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + let l:next_index = l:ChainCallback is v:null \ ? a:job_info.callback_index + 1 \ : a:job_info.callback_index @@ -261,7 +267,21 @@ function! s:AddSubCallbacks(full_list, callbacks) abort return 1 endfunction -function! s:GetCallbacks(buffer, fixers) abort +function! s:IgnoreFixers(callback_list, filetype, config) abort + if type(a:config) is v:t_list + let l:ignore_list = a:config + else + let l:ignore_list = [] + + for l:part in split(a:filetype , '\.') + call extend(l:ignore_list, get(a:config, l:part, [])) + endfor + endif + + call filter(a:callback_list, 'index(l:ignore_list, v:val) < 0') +endfunction + +function! s:GetCallbacks(buffer, fixing_flag, fixers) abort if len(a:fixers) let l:callback_list = a:fixers elseif type(get(b:, 'ale_fixers')) is v:t_list @@ -286,8 +306,12 @@ function! s:GetCallbacks(buffer, fixers) abort endif endif - if empty(l:callback_list) - return [] + if a:fixing_flag is# 'save_file' + let l:config = ale#Var(a:buffer, 'fix_on_save_ignore') + + if !empty(l:config) + call s:IgnoreFixers(l:callback_list, &filetype, l:config) + endif endif let l:corrected_list = [] @@ -335,7 +359,7 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort endif try - let l:callback_list = s:GetCallbacks(a:buffer, a:000) + let l:callback_list = s:GetCallbacks(a:buffer, a:fixing_flag, a:000) catch /E700\|BADNAME/ let l:function_name = join(split(split(v:exception, ':')[3])) let l:echo_message = printf( diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 7118c44a..3a36f367 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -27,6 +27,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'fecs': { +\ 'function': 'ale#fixers#fecs#Fix', +\ 'suggested_filetypes': ['javascript', 'css', 'html'], +\ 'description': 'Apply fecs format to a file.', +\ }, \ 'tidy': { \ 'function': 'ale#fixers#tidy#Fix', \ 'suggested_filetypes': ['html'], @@ -185,6 +190,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['hack'], \ 'description': 'Fix Hack files with hackfmt.', \ }, +\ 'floskell': { +\ 'function': 'ale#fixers#floskell#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with floskell.', +\ }, \ 'hfmt': { \ 'function': 'ale#fixers#hfmt#Fix', \ 'suggested_filetypes': ['haskell'], @@ -210,6 +220,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['ocaml'], \ 'description': 'Fix OCaml files with ocamlformat.', \ }, +\ 'ocp-indent': { +\ 'function': 'ale#fixers#ocp_indent#Fix', +\ 'suggested_filetypes': ['ocaml'], +\ 'description': 'Fix OCaml files with ocp-indent.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], @@ -247,8 +262,8 @@ let s:default_registry = { \ }, \ 'xo': { \ 'function': 'ale#fixers#xo#Fix', -\ 'suggested_filetypes': ['javascript'], -\ 'description': 'Fix JavaScript files using xo --fix.', +\ 'suggested_filetypes': ['javascript', 'typescript'], +\ 'description': 'Fix JavaScript/TypeScript files using xo --fix.', \ }, \ 'qmlfmt': { \ 'function': 'ale#fixers#qmlfmt#Fix', @@ -280,6 +295,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['kt'], \ 'description': 'Fix Kotlin files with ktlint.', \ }, +\ 'styler': { +\ 'function': 'ale#fixers#styler#Fix', +\ 'suggested_filetypes': ['r'], +\ 'description': 'Fix R files with styler.', +\ }, +\ 'latexindent': { +\ 'function': 'ale#fixers#latexindent#Fix', +\ 'suggested_filetypes': ['tex'], +\ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.', +\ }, \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index ea5b2a63..0f57cba6 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -3,15 +3,15 @@ function! ale#fixers#eslint#Fix(buffer) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + let l:command = ale#node#Executable(a:buffer, l:executable) + \ . ' --version' - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#node#Executable(a:buffer, l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale#fixers#eslint#ApplyFixForVersion'), + \) endfunction function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort @@ -33,10 +33,8 @@ function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - let l:config = ale#handlers#eslint#FindConfig(a:buffer) if empty(l:config) @@ -44,7 +42,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort endif " Use --fix-to-stdout with eslint_d - if l:executable =~# 'eslint_d$' && ale#semver#GTE(l:version, [3, 19, 0]) + if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ' --stdin-filename %s --stdin --fix-to-stdout', @@ -53,7 +51,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort endif " 4.9.0 is the first version with --fix-dry-run - if ale#semver#GTE(l:version, [4, 9, 0]) + if ale#semver#GTE(a:version, [4, 9, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', diff --git a/sources_non_forked/ale/autoload/ale/fixers/fecs.vim b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim new file mode 100644 index 00000000..d692bc97 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim @@ -0,0 +1,17 @@ +" Author: harttle +" Description: Apply fecs format to a file. + +function! ale#fixers#fecs#Fix(buffer) abort + let l:executable = ale#handlers#fecs#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:config_options = ' format --replace=true %t' + + return { + \ 'command': ale#Escape(l:executable) . l:config_options, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/floskell.vim b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim new file mode 100644 index 00000000..f0015db7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim @@ -0,0 +1,20 @@ +" Author: robertjlooby +" Description: Integration of floskell with ALE. + +call ale#Set('haskell_floskell_executable', 'floskell') + +function! ale#fixers#floskell#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell') +endfunction + +function! ale#fixers#floskell#Fix(buffer) abort + let l:executable = ale#fixers#floskell#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim new file mode 100644 index 00000000..b0a0884a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim @@ -0,0 +1,18 @@ +" Author: riley-martine +" Description: Integration of latexindent with ALE. + +call ale#Set('tex_latexindent_executable', 'latexindent') +call ale#Set('tex_latexindent_options', '') + +function! ale#fixers#latexindent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'tex_latexindent_executable') + let l:options = ale#Var(a:buffer, 'tex_latexindent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -l -w' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim new file mode 100644 index 00000000..e1b047b3 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim @@ -0,0 +1,18 @@ +" Author: Kanenobu Mitsuru +" Description: Integration of ocp-indent with ALE. + +call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent') +call ale#Set('ocaml_ocp_indent_options', '') +call ale#Set('ocaml_ocp_indent_config', '') + +function! ale#fixers#ocp_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable') + let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config') + let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config)) + \ . (empty(l:options) ? '': ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index 0f99ae97..b7f0ecd7 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -15,16 +15,12 @@ function! ale#fixers#prettier#GetExecutable(buffer) abort endfunction function! ale#fixers#prettier#Fix(buffer) abort - let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier#ApplyFixForVersion'), + \) endfunction function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort @@ -38,10 +34,9 @@ function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_prettier_options') - let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:parser = '' " Append the --parser flag depending on the current filetype (unless it's @@ -50,7 +45,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort " Mimic Prettier's defaults. In cases without a file extension or " filetype (scratch buffer), Prettier needs `parser` set to know how " to process the buffer. - if ale#semver#GTE(l:version, [1, 16, 0]) + if ale#semver#GTE(a:version, [1, 16, 0]) let l:parser = 'babel' else let l:parser = 'babylon' @@ -94,7 +89,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort endif " 1.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [1, 4, 0]) + if ale#semver#GTE(a:version, [1, 4, 0]) return { \ 'command': ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim index bc0caadd..1e66f49e 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -2,13 +2,9 @@ " w0rp , morhetz (Pavel Pertsev) " Description: Integration between Prettier and ESLint. -function! ale#fixers#prettier_eslint#SetOptionDefaults() abort - call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') - call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) - call ale#Set('javascript_prettier_eslint_options', '') -endfunction - -call ale#fixers#prettier_eslint#SetOptionDefaults() +call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') +call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ @@ -18,26 +14,20 @@ function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort endfunction function! ale#fixers#prettier_eslint#Fix(buffer) abort - let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier_eslint#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier_eslint#ApplyFixForVersion'), + \) endfunction -function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options') let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - " 4.2.0 is the first version with --eslint-config-path - let l:config = ale#semver#GTE(l:version, [4, 2, 0]) + let l:config = ale#semver#GTE(a:version, [4, 2, 0]) \ ? ale#handlers#eslint#FindConfig(a:buffer) \ : '' let l:eslint_config_option = !empty(l:config) @@ -45,7 +35,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) \ : '' " 4.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [4, 4, 0]) + if ale#semver#GTE(a:version, [4, 4, 0]) return { \ 'command': ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) diff --git a/sources_non_forked/ale/autoload/ale/fixers/styler.vim b/sources_non_forked/ale/autoload/ale/fixers/styler.vim new file mode 100644 index 00000000..7ff3275c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/styler.vim @@ -0,0 +1,16 @@ +" Author: tvatter +" Description: Fixing R files with styler. + +call ale#Set('r_styler_executable', 'Rscript') +call ale#Set('r_styler_options', 'tidyverse_style') + +function! ale#fixers#styler#Fix(buffer) abort + return { + \ 'command': 'Rscript --vanilla -e ' + \ . '"suppressPackageStartupMessages(library(styler));' + \ . 'style_file(commandArgs(TRUE), style = ' + \ . ale#Var(a:buffer, 'r_styler_options') . ')"' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index bc7c0321..5183f4cd 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -143,6 +143,11 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort " The code can be something like 'Error/foo/bar', or just 'Error' if !empty(get(l:split_code, 1)) let l:obj.code = join(l:split_code[1:], '/') + + if l:obj.code is# 'no-trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + continue + endif endif for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns) diff --git a/sources_non_forked/ale/autoload/ale/handlers/fecs.vim b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim new file mode 100644 index 00000000..5362edb9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim @@ -0,0 +1,52 @@ +" Author: harttle +" Description: fecs http://fecs.baidu.com/ + +call ale#Set('javascript_fecs_executable', 'fecs') +call ale#Set('javascript_fecs_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#handlers#fecs#GetCommand(buffer) abort + return '%e check --colors=false --rule=true %t' +endfunction + +function! ale#handlers#fecs#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'javascript_fecs', [ + \ 'node_modules/.bin/fecs', + \ 'node_modules/fecs/bin/fecs', + \]) +endfunction + +function! ale#handlers#fecs#Handle(buffer, lines) abort + " Matches patterns looking like the following + " + " fecs WARN → line 20, col 25: Unexpected console statement. (no-console) + " fecs ERROR → line 24, col 36: Missing radix parameter. (radix) + " + let l:pattern = '\v^.*(WARN|ERROR)\s+→\s+line (\d+),\s+col\s+(\d+):\s+(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4] + \} + + let l:code_match = matchlist(l:match[4], '\v^(.{-})\s*\((.+)\)$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[2] + let l:obj.text = l:code_match[1] + endif + + if l:match[1] is# 'WARN' + let l:obj.type = 'W' + elseif l:match[1] is# 'ERROR' + let l:obj.type = 'E' + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim index 84e331ed..195057ca 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim @@ -4,10 +4,10 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " Only one file was passed to redpen. So response array has only one " element. - let l:res = json_decode(join(a:lines))[0] + let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {}) let l:output = [] - for l:err in l:res.errors + for l:err in get(l:res, 'errors', []) let l:item = { \ 'text': l:err.message, \ 'type': 'W', diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index ae1f3e7d..172f9d54 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -26,6 +26,41 @@ endif let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) +" Check if we have neovim's buffer highlight API +" +" Below we define some functions' implementation conditionally if this API +" exists or not. +" +" The API itself is more ergonomic and neovim performs highlights positions +" rebases during edits so we see less stalled highlights. +let s:nvim_api = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') + +function! ale#highlight#HasNeovimApi() abort + return s:nvim_api +endfunction + +function! ale#highlight#nvim_buf_clear_namespace(...) abort + return call('nvim_buf_clear_namespace', a:000) +endfunction + +function! ale#highlight#nvim_buf_add_highlight(...) abort + return call('nvim_buf_add_highlight', a:000) +endfunction + +function! s:ale_nvim_highlight_id(bufnr) abort + let l:id = getbufvar(a:bufnr, 'ale_nvim_highlight_id', -1) + + if l:id is -1 + " NOTE: This will highlight nothing but will allocate new id + let l:id = ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, 0, '', 0, 0, -1 + \) + call setbufvar(a:bufnr, 'ale_nvim_highlight_id', l:id) + endif + + return l:id +endfunction + function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort if a:line >= a:end_line " For single lines, just return the one position. @@ -49,12 +84,90 @@ endfunction " Given a loclist for current items to highlight, remove all highlights " except these which have matching loclist item entries. + function! ale#highlight#RemoveHighlights() abort - for l:match in getmatches() - if l:match.group =~# '^ALE' - call matchdelete(l:match.id) + if ale#highlight#HasNeovimApi() + if get(b:, 'ale_nvim_highlight_id', 0) + let l:bufnr = bufnr('%') + " NOTE: 0, -1 means from 0 line till the end of buffer + call ale#highlight#nvim_buf_clear_namespace( + \ l:bufnr, + \ b:ale_nvim_highlight_id, + \ 0, -1 + \) endif - endfor + else + for l:match in getmatches() + if l:match.group =~# '^ALE' + call matchdelete(l:match.id) + endif + endfor + endif +endfunction + +function! s:highlight_line(bufnr, lnum, group) abort + if ale#highlight#HasNeovimApi() + let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ a:lnum - 1, 0, -1 + \) + else + call matchaddpos(a:group, [a:lnum]) + endif +endfunction + +function! s:highlight_range(bufnr, range, group) abort + if ale#highlight#HasNeovimApi() + let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) + " NOTE: lines and columns indicies are 0-based in nvim_buf_* API. + let l:lnum = a:range.lnum - 1 + let l:end_lnum = a:range.end_lnum - 1 + let l:col = a:range.col - 1 + let l:end_col = a:range.end_col + + if l:lnum >= l:end_lnum + " For single lines, just return the one position. + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:lnum, l:col, l:end_col + \) + else + " highlight first line from start till the line end + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:lnum, l:col, -1 + \) + + " highlight all lines between the first and last entirely + let l:cur = l:lnum + 1 + + while l:cur < l:end_lnum + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:cur, 0, -1 + \ ) + let l:cur += 1 + endwhile + + call ale#highlight#nvim_buf_add_highlight( + \ a:bufnr, l:highlight_id, a:group, + \ l:end_lnum, 0, l:end_col + \) + endif + else + " Set all of the positions, which are chunked into Lists which + " are as large as will be accepted by matchaddpos. + call map( + \ ale#highlight#CreatePositions( + \ a:range.lnum, + \ a:range.col, + \ a:range.end_lnum, + \ a:range.end_col + \ ), + \ 'matchaddpos(a:group, v:val)' + \) + endif endfunction function! ale#highlight#UpdateHighlights() abort @@ -79,17 +192,14 @@ function! ale#highlight#UpdateHighlights() abort let l:group = 'ALEError' endif - let l:line = l:item.lnum - let l:col = l:item.col - let l:end_line = get(l:item, 'end_lnum', l:line) - let l:end_col = get(l:item, 'end_col', l:col) + let l:range = { + \ 'lnum': l:item.lnum, + \ 'col': l:item.col, + \ 'end_lnum': get(l:item, 'end_lnum', l:item.lnum), + \ 'end_col': get(l:item, 'end_col', l:item.col) + \} - " Set all of the positions, which are chunked into Lists which - " are as large as will be accepted by matchaddpos. - call map( - \ ale#highlight#CreatePositions(l:line, l:col, l:end_line, l:end_col), - \ 'matchaddpos(l:group, v:val)' - \) + call s:highlight_range(l:item.bufnr, l:range, l:group) endfor " If highlights are enabled and signs are not enabled, we should still @@ -111,7 +221,7 @@ function! ale#highlight#UpdateHighlights() abort endif if l:available_groups[l:group] - call matchaddpos(l:group, [l:item.lnum]) + call s:highlight_line(l:item.bufnr, l:item.lnum, l:group) endif endfor endif diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 4937a6d7..8c657675 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -32,7 +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'], +\ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -340,7 +340,13 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`aliases` must be a List of String values' endif - " TODO: Emit deprecation warnings for deprecated options later. + for l:key in filter(keys(a:linter), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''') + if !get(g:, 'ale_ignore_2_4_warnings') + execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' + endif + + break + endfor return l:obj endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 3417575c..63d97f35 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -115,7 +115,7 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort let l:open_type = '' if ale#Var(a:buffer, 'list_vertical') == 1 - let l:open_type = 'vert ' + let l:open_type = 'vert rightbelow ' endif if g:ale_set_quickfix diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index 646dbd20..4ad94c4b 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -159,7 +159,7 @@ function! ale#lsp#message#Hover(buffer, line, column) abort endfunction function! ale#lsp#message#DidChangeConfiguration(buffer, config) abort - return [0, 'workspace/didChangeConfiguration', { + return [1, 'workspace/didChangeConfiguration', { \ 'settings': a:config, \}] endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index b91d875b..9ce05260 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort for l:diagnostic in a:response.params.diagnostics let l:severity = get(l:diagnostic, 'severity', 0) let l:loclist_item = { - \ 'text': l:diagnostic.message, + \ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'), \ 'type': 'E', \ 'lnum': l:diagnostic.range.start.line + 1, \ 'col': l:diagnostic.range.start.character + 1, diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index d544916a..f70042dd 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -10,6 +10,11 @@ endif " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnore(buffer, linter_name) abort + " Ignore all diagnostics if LSP integration is disabled. + if ale#Var(a:buffer, 'disable_lsp') + return 1 + endif + let l:config = ale#Var(a:buffer, 'linters_ignore') " Don't load code for ignoring diagnostics if there's nothing to ignore. @@ -27,12 +32,13 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] let l:filename = ale#path#FromURI(a:response.params.uri) let l:buffer = bufnr(l:filename) + let l:info = get(g:ale_buffer_info, l:buffer, {}) - if s:ShouldIgnore(l:buffer, l:linter_name) + if empty(l:info) return endif - if l:buffer <= 0 + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -50,6 +56,8 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort return endif + call ale#engine#MarkLinterInactive(l:info, l:linter_name) + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -376,6 +384,10 @@ function! s:CheckWithLSP(linter, details) abort if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Geterr(l:buffer) let l:notified = ale#lsp#Send(l:id, l:message) != 0 + + if l:notified + call ale#engine#MarkLinterActive(l:info, a:linter) + endif else let l:notified = ale#lsp#NotifyForChanges(l:id, l:buffer) endif @@ -386,10 +398,6 @@ function! s:CheckWithLSP(linter, details) abort let l:save_message = ale#lsp#message#DidSave(l:buffer) let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 endif - - if l:notified - call ale#engine#MarkLinterActive(l:info, a:linter) - endif endfunction function! ale#lsp_linter#CheckWithLSP(buffer, linter) abort diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim index f75280b7..69060122 100644 --- a/sources_non_forked/ale/autoload/ale/node.vim +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -32,7 +32,7 @@ endfunction " " The executable is only prefixed for Windows machines function! ale#node#Executable(buffer, executable) abort - if ale#Has('win32') && a:executable =~? '\.js$' + if has('win32') && a:executable =~? '\.js$' let l:node = ale#Var(a:buffer, 'windows_node_executable_path') return ale#Escape(l:node) . ' ' . ale#Escape(a:executable) diff --git a/sources_non_forked/ale/autoload/ale/powershell.vim b/sources_non_forked/ale/autoload/ale/powershell.vim new file mode 100644 index 00000000..8c163206 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/powershell.vim @@ -0,0 +1,32 @@ +" Author: zigford +" Description: Functions for integrating with Powershell linters. + +" Write a powershell script to a temp file for execution +" return the command used to execute it +function! s:TemporaryPSScript(buffer, input) abort + let l:filename = 'script.ps1' + " Create a temp dir to house our temp .ps1 script + " a temp dir is needed as powershell needs the .ps1 + " extension + let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/') + let l:tempscript = l:tempdir . l:filename + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:tempdir, '', 0750) + " Automatically delete the directory later. + call ale#command#ManageDirectory(a:buffer, l:tempdir) + " Write the script input out to a file. + call ale#util#Writefile(a:buffer, a:input, l:tempscript) + + return l:tempscript +endfunction + +function! ale#powershell#RunPowerShell(buffer, base_var_name, command) abort + let l:executable = ale#Var(a:buffer, a:base_var_name . '_executable') + let l:tempscript = s:TemporaryPSScript(a:buffer, a:command) + + return ale#Escape(l:executable) + \ . ' -Exe Bypass -NoProfile -File ' + \ . ale#Escape(l:tempscript) + \ . ' %t' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index 0e88afe2..b9725e1e 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -49,13 +49,15 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort let l:result = get(a:response, 'result', []) let l:item_list = [] - for l:response_item in l:result - call add(l:item_list, { - \ 'filename': ale#path#FromURI(l:response_item.uri), - \ 'line': l:response_item.range.start.line + 1, - \ 'column': l:response_item.range.start.character + 1, - \}) - endfor + if type(l:result) is v:t_list + for l:response_item in l:result + call add(l:item_list, { + \ 'filename': ale#path#FromURI(l:response_item.uri), + \ 'line': l:response_item.range.start.line + 1, + \ 'column': l:response_item.range.start.character + 1, + \}) + endfor + endif if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim index 69d7a0c0..15e835c9 100644 --- a/sources_non_forked/ale/autoload/ale/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -1,7 +1,7 @@ " Author: Eddie Lebow https://github.com/elebow " Description: Functions for integrating with Ruby tools -" Find the nearest dir contining "app", "db", and "config", and assume it is +" Find the nearest dir containing "app", "db", and "config", and assume it is " the root of a Rails app. function! ale#ruby#FindRailsRoot(buffer) abort for l:name in ['app', 'config', 'db'] diff --git a/sources_non_forked/ale/autoload/ale/semver.vim b/sources_non_forked/ale/autoload/ale/semver.vim index 5f1b46fc..e3eb49c0 100644 --- a/sources_non_forked/ale/autoload/ale/semver.vim +++ b/sources_non_forked/ale/autoload/ale/semver.vim @@ -5,31 +5,52 @@ function! ale#semver#ResetVersionCache() abort let s:version_cache = {} endfunction +function! ale#semver#ParseVersion(version_lines) abort + for l:line in a:version_lines + let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') + + if !empty(l:match) + return [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + endif + endfor + + return [] +endfunction + " Given an executable name and some lines of output, which can be empty, " parse the version from the lines of output, or return the cached version " triple [major, minor, patch] " " If the version cannot be found, an empty List will be returned instead. -function! ale#semver#GetVersion(executable, version_lines) abort +function! s:GetVersion(executable, version_lines) abort let l:version = get(s:version_cache, a:executable, []) + let l:parsed_version = ale#semver#ParseVersion(a:version_lines) - for l:line in a:version_lines - let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') - - if !empty(l:match) - let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] - let s:version_cache[a:executable] = l:version - - break - endif - endfor + if !empty(l:parsed_version) + let l:version = l:parsed_version + let s:version_cache[a:executable] = l:version + endif return l:version endfunction -" Return 1 if the semver version has been cached for a given executable. -function! ale#semver#HasVersion(executable) abort - return has_key(s:version_cache, a:executable) +function! ale#semver#RunWithVersionCheck(buffer, executable, command, Callback) abort + if empty(a:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, a:executable) + return a:Callback(a:buffer, s:version_cache[a:executable]) + endif + + return ale#command#Run( + \ a:buffer, + \ a:command, + \ {_, output -> a:Callback(a:buffer, s:GetVersion(a:executable, output))}, + \ {'output_stream': 'both', 'executable': a:executable} + \) endfunction " Given two triples of integers [major, minor, patch], compare the triples diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 933fc055..7395b0e2 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -66,7 +66,7 @@ endif " Spaces and backslashes need to be escaped for signs. function! s:EscapeSignText(sign_text) abort - return substitute(a:sign_text, '\\\| ', '\\\0', 'g') + return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g') endfunction " Signs show up on the left for error markers. diff --git a/sources_non_forked/ale/autoload/ale/swift.vim b/sources_non_forked/ale/autoload/ale/swift.vim new file mode 100644 index 00000000..b31b8dc5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/swift.vim @@ -0,0 +1,13 @@ +" Author: Dan Loman +" Description: Functions for integrating with Swift tools + +" Find the nearest dir containing a Package.swift file and assume it is the root of the Swift project. +function! ale#swift#FindProjectRoot(buffer) abort + let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') + + if !empty(l:swift_config) + return fnamemodify(l:swift_config, ':h') + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index e57307e4..e7563608 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -422,7 +422,7 @@ function! ale#util#Writefile(buffer, lines, filename) abort \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines - call writefile(l:corrected_lines, a:filename) " no-custom-checks + call writefile(l:corrected_lines, a:filename, 'S') " no-custom-checks endfunction if !exists('s:patial_timers') diff --git a/sources_non_forked/ale/autoload/ale/virtualtext.vim b/sources_non_forked/ale/autoload/ale/virtualtext.vim index 532427fb..d7c5360e 100644 --- a/sources_non_forked/ale/autoload/ale/virtualtext.vim +++ b/sources_non_forked/ale/autoload/ale/virtualtext.vim @@ -81,7 +81,7 @@ function! ale#virtualtext#ShowCursorWarning(...) abort call ale#virtualtext#Clear() if !empty(l:loc) - let l:msg = get(l:loc, 'detail', l:loc.text) + let l:msg = l:loc.text let l:hl_group = 'ALEVirtualTextInfo' let l:type = get(l:loc, 'type', 'E') diff --git a/sources_non_forked/ale/doc/ale-chef.txt b/sources_non_forked/ale/doc/ale-chef.txt index 5024e279..75e144ec 100644 --- a/sources_non_forked/ale/doc/ale-chef.txt +++ b/sources_non_forked/ale/doc/ale-chef.txt @@ -2,6 +2,26 @@ ALE Chef Integration *ale-chef-options* +=============================================================================== +cookstyle *ale-chef-cookstyle* + +g:ale_chef_cookstyle_options *g:ale_chef_cookstyle_options* + *b:ale_chef_cookstyle_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to cookstyle. + + +g:ale_chef_cookstyle_executable *g:ale_chef_cookstyle_executable* + *b:ale_chef_cookstyle_executable* + Type: |String| + Default: `'cookstyle'` + + This variable can be changed to point to the cookstyle binary in case it's + not on the $PATH or a specific version/path must be used. + + =============================================================================== foodcritic *ale-chef-foodcritic* diff --git a/sources_non_forked/ale/doc/ale-clojure.txt b/sources_non_forked/ale/doc/ale-clojure.txt index a83e336f..2bf00c03 100644 --- a/sources_non_forked/ale/doc/ale-clojure.txt +++ b/sources_non_forked/ale/doc/ale-clojure.txt @@ -2,6 +2,13 @@ ALE Clojure Integration *ale-clojure-options* +=============================================================================== +clj-kondo *ale-clojure-clj-kondo* + +A minimal and opinionated linter for code that sparks joy. + +https://github.com/borkdude/clj-kondo + =============================================================================== joker *ale-clojure-joker* diff --git a/sources_non_forked/ale/doc/ale-css.txt b/sources_non_forked/ale/doc/ale-css.txt index f3cae385..ff74b263 100644 --- a/sources_non_forked/ale/doc/ale-css.txt +++ b/sources_non_forked/ale/doc/ale-css.txt @@ -2,6 +2,14 @@ ALE CSS Integration *ale-css-options* +=============================================================================== +fecs *ale-css-fecs* + +`fecs` options for CSS is the same as the options for JavaScript, and both of +them reads `./.fecsrc` as the default configuration file. See: +|ale-javascript-fecs|. + + =============================================================================== prettier *ale-css-prettier* diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 408b176f..9c9f0394 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -12,6 +12,7 @@ CONTENTS *ale-development-contents* 3. Coding Standards.....................|ale-coding-standards| 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| + 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| =============================================================================== 1. Introduction *ale-development-introduction* @@ -288,10 +289,10 @@ and should be written like so. > AssertLinter 'some-command', ale#Escape('some-command') . ' --foo' Execute(Check chained commands): - " WithChainResults can be called with 1 or more list for passing output + " GivenCommandOutput can be called with 1 or more list for passing output " to chained commands. The output for each callback defaults to an empty " list. - WithChainResults ['v2.1.2'] + GivenCommandOutput ['v2.1.2'] " Given a List of commands, check all of them. " Given a String, only the last command in the chain will be checked. AssertLinter 'some-command', [ @@ -302,7 +303,7 @@ and should be written like so. > The full list of commands that will be temporarily defined for linter tests given the above setup are as follows. -`WithChainResults [...]` - Define output for command chain functions. +`GivenCommandOutput [...]` - Define output for ale#command#Run. `AssertLinter executable, command` - Check the executable and command. `AssertLinterNotExecuted` - Check that linters will not be executed. `AssertLSPLanguage language` - Check the language given to an LSP server. @@ -311,5 +312,46 @@ given the above setup are as follows. `AssertLSPProject project_root` - Check the root given to an LSP server. `AssertLSPAddress address` - Check the address to an LSP server. + +=============================================================================== +4.2 Writing Fixer Tests *ale-development-fixer-tests* + +Tests for ALE fixers should go in the `test/fixers` directory, and should +be written like so. > + + Before: + " Load the fixer and set up a series of commands, reset fixer variables, + " clear caches, etc. + " + " Vader's 'Save' command will be called here for fixer variables. + call ale#assert#SetUpFixerTest('filetype', 'fixer_name') + + After: + " Reset fixers, variables, etc. + " + " Vader's 'Restore' command will be called here. + call ale#assert#TearDownFixerTest() + + Execute(The default command should be correct): + " AssertFixer checks the result of the loaded fixer function. + AssertFixer {'command': ale#Escape('some-command') . ' --foo'} + + Execute(Check chained commands): + " Same as above for linter tests. + GivenCommandOutput ['v2.1.2'] + " Given a List of commands, check all of them. + " Given anything else, only the last result will be checked. + AssertFixer [ + \ ale#Escape('some-command') . ' --version', + \ {'command': ale#Escape('some-command') . ' --foo'} + \] +< +The full list of commands that will be temporarily defined for fixer tests +given the above setup are as follows. + +`GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertFixer results` - Check the fixer results + + =============================================================================== 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 3fbc6fb9..611e3fdd 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -30,6 +30,23 @@ g:ale_go_go_executable *g:ale_go_go_options* the `gomod` fixer. +=============================================================================== +bingo *ale-go-bingo* + +g:ale_go_bingo_executable *g:ale_go_bingo_executable* + *b:ale_go_bingo_executable* + Type: |String| + Default: `'bingo'` + + Location of the bingo binary file. + + +g:ale_go_bingo_options *g:ale_go_bingo_options* + *b:ale_go_bingo_options* + Type: |String| + Default: `''` + + =============================================================================== gobuild *ale-go-gobuild* @@ -53,6 +70,60 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* This variable can be set to pass additional options to the gofmt fixer. +=============================================================================== +golangci-lint *ale-go-golangci-lint* + +`golangci-lint` is a `lint_file` linter, which only lints files that are +written to disk. This differs from the default behavior of linting the buffer. +See: |ale-lint-file| + +g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* + *b:ale_go_golangci_lint_executable* + Type: |String| + Default: `'golangci-lint'` + + The executable that will be run for golangci-lint. + + +g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* + *b:ale_go_golangci_lint_options* + Type: |String| + Default: `'--enable-all'` + + This variable can be changed to alter the command-line arguments to the + golangci-lint invocation. + + +g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* + *b:ale_go_golangci_lint_package* + Type: |Number| + Default: `0` + + When set to `1`, the whole Go package will be checked instead of only the + current file. + + +=============================================================================== +golangserver *ale-go-golangserver* + +g:ale_go_langserver_executable *g:ale_go_langserver_executable* + *b:ale_go_langserver_executable* + Type: |String| + Default: `'go-langserver'` + + Location of the go-langserver binary file. + + +g:ale_go_langserver_options *g:ale_go_langserver_options* + *b:ale_go_langserver_options* + Type: |String| + Default: `''` + + Additional options passed to the go-langserver command. Note that the + `-gocodecompletion` option is ignored because it is handled automatically + by the |g:ale_completion_enabled| variable. + + =============================================================================== golint *ale-go-golint* @@ -72,17 +143,6 @@ g:ale_go_golint_options *g:ale_go_golint_options* This variable can be set to pass additional options to the golint linter. -=============================================================================== -govet *ale-go-govet* - -g:ale_go_govet_options *g:ale_go_govet_options* - *b:ale_go_govet_options* - Type: |String| - Default: `''` - - This variable can be set to pass additional options to the go vet linter. - - =============================================================================== gometalinter *ale-go-gometalinter* @@ -121,6 +181,34 @@ g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package* current file. +=============================================================================== +gopls *ale-go-gopls* + +g:ale_go_gopls_executable *g:ale_go_gopls_executable* + *b:ale_go_gopls_executable* + Type: |String| + Default: `'gopls'` + + Location of the gopls binary file. + + +g:ale_go_gopls_options *g:ale_go_gopls_options* + *b:ale_go_gopls_options* + Type: |String| + Default: `''` + + +=============================================================================== +govet *ale-go-govet* + +g:ale_go_govet_options *g:ale_go_govet_options* + *b:ale_go_govet_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the go vet linter. + + =============================================================================== staticcheck *ale-go-staticcheck* @@ -142,74 +230,5 @@ g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* current file. -=============================================================================== -golangserver *ale-go-golangserver* - -g:ale_go_langserver_executable *g:ale_go_langserver_executable* - *b:ale_go_langserver_executable* - Type: |String| - Default: `'go-langserver'` - - Location of the go-langserver binary file. - -g:ale_go_langserver_options *g:ale_go_langserver_options* - *b:ale_go_langserver_options* - Type: |String| - Default: `''` - - Additional options passed to the go-langserver command. Note that the - `-gocodecompletion` option is ignored because it is handled automatically - by the |g:ale_completion_enabled| variable. - - -=============================================================================== -golangci-lint *ale-go-golangci-lint* - -`golangci-lint` is a `lint_file` linter, which only lints files that are -written to disk. This differs from the default behavior of linting the buffer. -See: |ale-lint-file| - -g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* - *b:ale_go_golangci_lint_executable* - Type: |String| - Default: `'golangci-lint'` - - The executable that will be run for golangci-lint. - - -g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* - *b:ale_go_golangci_lint_options* - Type: |String| - Default: `'--enable-all'` - - This variable can be changed to alter the command-line arguments to the - golangci-lint invocation. - - -g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* - *b:ale_go_golangci_lint_package* - Type: |Number| - Default: `0` - - When set to `1`, the whole Go package will be checked instead of only the - current file. - - -=============================================================================== -bingo *ale-go-bingo* - -g:ale_go_bingo_executable *g:ale_go_bingo_executable* - *b:ale_go_bingo_executable* - Type: |String| - Default: `'go-bingo'` - - Location of the go-bingo binary file. - -g:ale_go_bingo_options *g:ale_go_bingo_options* - *b:ale_go_bingo_options* - Type: |String| - Default: `''` - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index 2247eddc..e2073e37 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -12,6 +12,16 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* This variable can be changed to use a different executable for brittany. +=============================================================================== +floskell *ale-haskell-floskell* + +g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable* + *b:ale_haskell_floskell_executable* + Type: |String| + Default: `'floskell'` + + This variable can be changed to use a different executable for floskell. + =============================================================================== ghc *ale-haskell-ghc* diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index 1d30929f..5d6b20e2 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -2,6 +2,14 @@ ALE HTML Integration *ale-html-options* +=============================================================================== +fecs *ale-html-fecs* + +`fecs` options for HTMl is the same as the options for JavaScript, +and both of them reads `./.fecsrc` as the default configuration file. +See: |ale-javascript-fecs|. + + =============================================================================== htmlhint *ale-html-htmlhint* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index aa226305..2805c9c8 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -101,6 +101,46 @@ g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* This variable can be changed to use a different executable for java. +=============================================================================== +eclipselsp *ale-java-eclipselsp* + +To enable Eclipse LSP linter you need to clone and build the eclipse.jdt.ls +language server from https://github.com/eclipse/eclipse.jdt.ls. Simply +clone the source code repo and then build the plugin: + + ./mvnw clean verify + +Note: currently, the build can only run when launched with JDK 8. JDK 9 or more +recent versions can be used to run the server though. + +After build completes the files required to run the language server will be +located inside the repository folder `eclipse.jdt.ls`. Please ensure to set +|g:ale_java_eclipselsp_path| to the absolute path of that folder. + +You could customize compiler options and code assists of the server. +Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` +with options presented at +https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html. + +g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* + *b:ale_java_eclipselsp_path* + + Type: |String| + Default: `'$HOME/eclipse.jdt.ls'` + + Absolute path to the location of the eclipse.jdt.ls repository folder. Or if + you have VSCode extension installed the absolute path to the VSCode extensions + folder (e.g. $HOME/.vscode/extensions in Linux). + + +g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* + *b:ale_java_eclipse_executable* + Type: |String| + Default: `'java'` + + This variable can be set to change the executable path used for java. + + =============================================================================== uncrustify *ale-java-uncrustify* diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt index 53a70fd7..ea0a7089 100644 --- a/sources_non_forked/ale/doc/ale-javascript.txt +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -73,6 +73,33 @@ g:ale_javascript_eslint_suppress_missing_config configuration files are found. +=============================================================================== +fecs *ale-javascript-fecs* + +`fecs` is a lint tool for HTML/CSS/JavaScript, can be installed via: + + `$ npm install --save-dev fecs` + +And the configuration file is located at `./fecsrc`, see http://fecs.baidu.com +for more options. + + +g:ale_javascript_fecs_executable *g:ale_javascript_fecs_executable* + *b:ale_javascript_fecs_executable* + Type: |String| + Default: `'fecs'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_fecs_use_global *g:ale_javascript_fecs_use_global* + *b:ale_javascript_fecs_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== flow *ale-javascript-flow* diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt index adf17716..8b644c17 100644 --- a/sources_non_forked/ale/doc/ale-ocaml.txt +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -50,5 +50,33 @@ g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options* This variable can be set to pass additional options to the ocamlformat fixer. +=============================================================================== +ocp-indent *ale-ocaml-ocp-indent* + +g:ale_ocaml_ocp_indent_executable *g:ale_ocaml_ocp_indent_executable* + *b:ale_ocaml_ocp_indent_executable* + Type: |String| + Default: `ocp-indent` + + This variable can be set to pass the path of the ocp-indent. + +g:ale_ocaml_ocp_indent_options *g:ale_ocaml_ocp_indent_options* + *b:ale_ocaml_ocp_indent_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the ocp-indent. + +g:ale_ocaml_ocp_indent_config *g:ale_ocaml_ocp_indent_config* + *b:ale_ocaml_ocp_indent_config* + Type: |String| + Default: `''` + + This variable can be set to pass additional config to the ocp-indent. + Expand after "--config=". + + "ocp-indent" can also be enabled from ocamlformat config. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 83bc0fd5..d41fb50d 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -154,11 +154,13 @@ g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* g:ale_php_phpstan_level *g:ale_php_phpstan_level* *b:ale_php_phpstan_level* - Type: |Number| - Default: `4` + Type: |String| + Default: `''` This variable controls the rule levels. 0 is the loosest and 4 is the - strictest. + strictest. If this option isn't set, the rule level will be controlled by + the configuration file. If no configuration file can be detected, `'4'` will + be used instead. g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* @@ -169,6 +171,14 @@ g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* This variable sets path to phpstan configuration file. +g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload* + *b:ale_php_phpstan_autoload* + Type: |String| + Default: `''` + + This variable sets path to phpstan autoload file. + + =============================================================================== psalm *ale-php-psalm* diff --git a/sources_non_forked/ale/doc/ale-powershell.txt b/sources_non_forked/ale/doc/ale-powershell.txt new file mode 100644 index 00000000..c28ef9ea --- /dev/null +++ b/sources_non_forked/ale/doc/ale-powershell.txt @@ -0,0 +1,77 @@ +=============================================================================== +ALE PowerShell Integration *ale-powershell-options* + + +=============================================================================== +powershell *ale-powershell-powershell* + +g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* + *b:ale_powershell_powershell_executable* + Type: String + Default: `'pwsh'` + + This variable can be changed to use a different executable for powershell. + +> + " Use powershell.exe rather than the default pwsh + let g:ale_powershell_powershell_executable = 'powershell.exe' +> + +=============================================================================== +psscriptanalyzer *ale-powershell-psscriptanalyzer* + +Installation +------------------------------------------------------------------------------- + +Install PSScriptAnalyzer by any means, so long as it can be automatically +imported in PowerShell. +Some PowerShell plugins set the filetype of files to `ps1`. To continue using +these plugins, use the ale_linter_aliases global to alias `ps1` to `powershell` + +> + " Allow ps1 filetype to work with powershell linters + let g:ale_linter_aliases = {'ps1': 'powershell'} +< + +g:ale_powershell_psscriptanalyzer_executable +*g:ale_powershell_psscriptanalyzer_executable* + *b:ale_powershell_psscriptanalyzer_executable* + Type: |String| + Default: `'pwsh'` + + This variable sets executable used for powershell. + + For example, on Windows you could set powershell to be Windows Powershell: +> + let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe' +< + +g:ale_powershell_psscriptanalyzer_module +*g:ale_powershell_psscriptanalyzer_module* + *b:ale_powershell_psscriptanalyzer_module* + Type: |String + Default: `'psscriptanalyzer'` + + This variable sets the name of the psscriptanalyzer module. + for psscriptanalyzer invocation. + + +g:ale_powershell_psscriptanalyzer_exclusions +*g:ale_powershell_psscriptanalyzer_exclusions* + *b:ale_powershell_psscriptanalyzer_exclusions* + Type: |String| + Default: `''` + + Set this variable to exclude test(s) for psscriptanalyzer + (-ExcludeRule option). To exclude more than one option, separate them with + commas. + +> + " Suppress Write-Host and Global vars warnings + let g:ale_powershell_psscriptanalyzer_exclusions = + \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +< + + +=============================================================================== + 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 dd946ad4..7dd3b65d 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -580,6 +580,14 @@ g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* + *b:ale_python_pylint_use_msg_id* + Type: |Number| + Default: `0` + + Use message for output (e.g. I0011) instead of symbolic name of the message + (e.g. locally-disabled). + =============================================================================== pyls *ale-python-pyls* diff --git a/sources_non_forked/ale/doc/ale-r.txt b/sources_non_forked/ale/doc/ale-r.txt index f85f48fd..b5ccebe5 100644 --- a/sources_non_forked/ale/doc/ale-r.txt +++ b/sources_non_forked/ale/doc/ale-r.txt @@ -25,5 +25,21 @@ g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* of `lintr::lint`. This prevents erroneous namespace warnings when linting package files. + +=============================================================================== +styler *ale-r-styler* + +g:ale_r_styler_options *g:ale_r_styler_options* + *b:ale_r_styler_options* + Type: |String| + Default: `'styler::tidyverse_style'` + + This option can be configured to change the options for styler. + + The value of this option will be used as the `style` argument for the + `styler::style_file` options. Consult the styler documentation + for more information. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 3393b9c0..44a79b18 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -164,10 +164,14 @@ g:ale_rust_rls_executable *g:ale_rust_rls_executable* g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* *b:ale_rust_rls_toolchain* Type: |String| - Default: `'nightly'` + Default: `''` This option can be set to change the toolchain used for `rls`. Possible - values include `'nightly'`, `'beta'`, and `'stable'`. + values include `'nightly'`, `'beta'`, `'stable'`, and `''`. When using + option `''`, rls will automatically find the default toolchain set by + rustup. If you want to use `rls` from a specific toolchain version, you may + also use values like `'channel-yyyy-mm-dd-arch-target'` as long as + `'rls +{toolchain_name} -V'` runs correctly in your command line. The `rls` server will only be started once per executable. diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt index 64f59609..3eac9038 100644 --- a/sources_non_forked/ale/doc/ale-sh.txt +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -62,6 +62,18 @@ g:ale_sh_shellcheck_options *g:ale_sh_shellcheck_options* < +g:ale_sh_shellcheck_change_directory *g:ale_sh_shellcheck_change_directory* + *b:ale_sh_shellcheck_change_directory* + Type: |Number| + Default: `1` + + If set to `1`, ALE will switch to the directory the shell file being + checked with `shellcheck` is in before checking it. This helps `shellcheck` + determine the path to sourced files more easily. This option can be turned + off if you want to control the directory `shellcheck` is executed from + yourself. + + g:ale_sh_shellcheck_dialect *g:ale_sh_shellcheck_dialect* *b:ale_sh_shellcheck_dialect* Type: |String| diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 9be28f87..d6fbafa6 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -71,8 +71,10 @@ Notes: * `gcc` * `uncrustify` * Chef + * `cookstyle` * `foodcritic` * Clojure + * `clj-kondo` * `joker` * CloudFormation * `cfn-python-lint` @@ -87,6 +89,7 @@ Notes: * `crystal`!! * CSS * `csslint` + * `fecs` * `prettier` * `stylelint` * Cucumber @@ -152,6 +155,7 @@ Notes: * `golint` * `gometalinter`!! * `go mod`!! + * `gopls` * `gosimple`!! * `gotype`!! * `go vet`!! @@ -171,6 +175,7 @@ Notes: * Haskell * `brittany` * `cabal-ghc` + * `floskell` * `ghc` * `ghc-mod` * `hdevtools` @@ -184,6 +189,7 @@ Notes: * `terraform-fmt` * HTML * `alex`!! + * `fecs` * `HTMLHint` * `prettier` * `proselint` @@ -195,6 +201,7 @@ Notes: * `ispc`!! * Java * `checkstyle` + * `eclipselsp` * `google-java-format` * `javac` * `javalsp` @@ -202,6 +209,7 @@ Notes: * `uncrustify` * JavaScript * `eslint` + * `fecs` * `flow` * `jscs` * `jshint` @@ -285,6 +293,7 @@ Notes: * OCaml * `merlin` (see |ale-ocaml-merlin|) * `ocamlformat` + * `ocp-indent` * `ols` * Pawn * `uncrustify` @@ -315,6 +324,9 @@ Notes: * `write-good` * Pony * `ponyc` +* PowerShell + * `powershell` + * `psscriptanalyzer` * Prolog * `swipl` * proto @@ -335,6 +347,7 @@ Notes: * `prospector` * `pycodestyle` * `pydocstyle` + * `pyflakes` * `pylama`!! * `pylint`!! * `pyls` @@ -346,6 +359,7 @@ Notes: * `qmllint` * R * `lintr` + * `styler` * Racket * `raco` * ReasonML @@ -407,6 +421,7 @@ Notes: * SugarSS * `stylelint` * Swift + * `sourcekit-lsp` * `swiftformat` * `swiftlint` * Tcl @@ -430,6 +445,7 @@ Notes: * `thrift` * TypeScript * `eslint` + * `fecs` * `prettier` * `tslint` * `tsserver` diff --git a/sources_non_forked/ale/doc/ale-swift.txt b/sources_non_forked/ale/doc/ale-swift.txt new file mode 100644 index 00000000..8fa0c06c --- /dev/null +++ b/sources_non_forked/ale/doc/ale-swift.txt @@ -0,0 +1,21 @@ +=============================================================================== +ALE Swift Integration *ale-swift-options* + + +=============================================================================== +sourcekitlsp *ale-swift-sourcekitlsp* + +To enable the SourceKit-LSP you need to install and build the executable as +described here: https://github.com/apple/sourcekit-lsp#building-sourcekit-lsp + + +g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* + *b:ale_sourcekit_lsp_executable* + Type: |String| + Default: `'sourcekit-lsp'` + + See |ale-integrations-local-executables| + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt index 24aa3112..b1b09117 100644 --- a/sources_non_forked/ale/doc/ale-tex.txt +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -32,5 +32,26 @@ g:ale_lacheck_executable *g:ale_lacheck_executable* This variable can be changed to change the path to lacheck. + +=============================================================================== +latexindent *ale-tex-latexindent* + +g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* + *b:ale_tex_latexindent_executable* + Type: |String| + Default: `'latexindent'` + + This variable can be changed to change the path to latexindent. + + +g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* + *b:ale_tex_latexindent_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to latexindent. + + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index f3ceacdb..2a086981 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -1,4 +1,4 @@ -*ale.txt* For Vim version 8.0. +*ale.txt* Plugin to lint and fix files asynchronously *ale* ALE - Asynchronous Lint Engine @@ -48,364 +48,6 @@ ALE supports the following key features for linting: 5. Setting |signs| with warnings and errors for error markers. 6. Using |echo| to show error messages when the cursor moves. 7. Setting syntax highlights for errors. - ada...................................|ale-ada-options| - gcc.................................|ale-ada-gcc| - ansible...............................|ale-ansible-options| - ansible-lint........................|ale-ansible-ansible-lint| - asciidoc..............................|ale-asciidoc-options| - write-good..........................|ale-asciidoc-write-good| - textlint............................|ale-asciidoc-textlint| - asm...................................|ale-asm-options| - 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| - clang-format........................|ale-c-clangformat| - clangtidy...........................|ale-c-clangtidy| - cppcheck............................|ale-c-cppcheck| - cquery..............................|ale-c-cquery| - flawfinder..........................|ale-c-flawfinder| - gcc.................................|ale-c-gcc| - uncrustify..........................|ale-c-uncrustify| - ccls................................|ale-c-ccls| - chef..................................|ale-chef-options| - foodcritic..........................|ale-chef-foodcritic| - clojure...............................|ale-clojure-options| - joker...............................|ale-clojure-joker| - cloudformation........................|ale-cloudformation-options| - cfn-python-lint.....................|ale-cloudformation-cfn-python-lint| - cmake.................................|ale-cmake-options| - cmakelint...........................|ale-cmake-cmakelint| - cmake-format........................|ale-cmake-cmakeformat| - cpp...................................|ale-cpp-options| - clang...............................|ale-cpp-clang| - clangd..............................|ale-cpp-clangd| - clangcheck..........................|ale-cpp-clangcheck| - clang-format........................|ale-cpp-clangformat| - clangtidy...........................|ale-cpp-clangtidy| - clazy...............................|ale-cpp-clazy| - cppcheck............................|ale-cpp-cppcheck| - cpplint.............................|ale-cpp-cpplint| - cquery..............................|ale-cpp-cquery| - flawfinder..........................|ale-cpp-flawfinder| - gcc.................................|ale-cpp-gcc| - uncrustify..........................|ale-cpp-uncrustify| - ccls................................|ale-cpp-ccls| - c#....................................|ale-cs-options| - mcs.................................|ale-cs-mcs| - mcsc................................|ale-cs-mcsc| - uncrustify..........................|ale-cs-uncrustify| - css...................................|ale-css-options| - prettier............................|ale-css-prettier| - stylelint...........................|ale-css-stylelint| - cuda..................................|ale-cuda-options| - nvcc................................|ale-cuda-nvcc| - clang-format........................|ale-cuda-clangformat| - d.....................................|ale-d-options| - dls.................................|ale-d-dls| - uncrustify..........................|ale-d-uncrustify| - dart..................................|ale-dart-options| - dartanalyzer........................|ale-dart-dartanalyzer| - dartfmt.............................|ale-dart-dartfmt| - dockerfile............................|ale-dockerfile-options| - dockerfile_lint.....................|ale-dockerfile-dockerfile_lint| - hadolint............................|ale-dockerfile-hadolint| - elixir................................|ale-elixir-options| - mix.................................|ale-elixir-mix| - mix_format..........................|ale-elixir-mix-format| - dialyxir............................|ale-elixir-dialyxir| - elixir-ls...........................|ale-elixir-elixir-ls| - credo...............................|ale-elixir-credo| - elm...................................|ale-elm-options| - elm-format..........................|ale-elm-elm-format| - elm-lsp.............................|ale-elm-elm-lsp| - elm-make............................|ale-elm-elm-make| - erlang................................|ale-erlang-options| - 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| - language_server.....................|ale-fortran-language-server| - fountain..............................|ale-fountain-options| - fusionscript..........................|ale-fuse-options| - fusion-lint.........................|ale-fuse-fusionlint| - git commit............................|ale-gitcommit-options| - gitlint.............................|ale-gitcommit-gitlint| - glsl..................................|ale-glsl-options| - glslang.............................|ale-glsl-glslang| - glslls..............................|ale-glsl-glslls| - 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| - golangserver........................|ale-go-golangserver| - golangci-lint.......................|ale-go-golangci-lint| - bingo...............................|ale-go-bingo| - graphql...............................|ale-graphql-options| - eslint..............................|ale-graphql-eslint| - gqlint..............................|ale-graphql-gqlint| - prettier............................|ale-graphql-prettier| - hack..................................|ale-hack-options| - hack................................|ale-hack-hack| - hackfmt.............................|ale-hack-hackfmt| - hhast...............................|ale-hack-hhast| - handlebars............................|ale-handlebars-options| - ember-template-lint.................|ale-handlebars-embertemplatelint| - haskell...............................|ale-haskell-options| - brittany............................|ale-haskell-brittany| - ghc.................................|ale-haskell-ghc| - ghc-mod.............................|ale-haskell-ghc-mod| - cabal-ghc...........................|ale-haskell-cabal-ghc| - hdevtools...........................|ale-haskell-hdevtools| - hfmt................................|ale-haskell-hfmt| - hlint...............................|ale-haskell-hlint| - stack-build.........................|ale-haskell-stack-build| - stack-ghc...........................|ale-haskell-stack-ghc| - stylish-haskell.....................|ale-haskell-stylish-haskell| - hie.................................|ale-haskell-hie| - hcl...................................|ale-hcl-options| - terraform-fmt.......................|ale-hcl-terraform-fmt| - 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| - google-java-format..................|ale-java-google-java-format| - pmd.................................|ale-java-pmd| - javalsp.............................|ale-java-javalsp| - uncrustify..........................|ale-java-uncrustify| - javascript............................|ale-javascript-options| - eslint..............................|ale-javascript-eslint| - flow................................|ale-javascript-flow| - importjs............................|ale-javascript-importjs| - jscs................................|ale-javascript-jscs| - jshint..............................|ale-javascript-jshint| - prettier............................|ale-javascript-prettier| - prettier-eslint.....................|ale-javascript-prettier-eslint| - prettier-standard...................|ale-javascript-prettier-standard| - standard............................|ale-javascript-standard| - xo..................................|ale-javascript-xo| - json..................................|ale-json-options| - fixjson.............................|ale-json-fixjson| - jsonlint............................|ale-json-jsonlint| - jq..................................|ale-json-jq| - prettier............................|ale-json-prettier| - julia.................................|ale-julia-options| - languageserver......................|ale-julia-languageserver| - kotlin................................|ale-kotlin-options| - kotlinc.............................|ale-kotlin-kotlinc| - ktlint..............................|ale-kotlin-ktlint| - languageserver......................|ale-kotlin-languageserver| - latex.................................|ale-latex-options| - write-good..........................|ale-latex-write-good| - textlint............................|ale-latex-textlint| - less..................................|ale-less-options| - lessc...............................|ale-less-lessc| - prettier............................|ale-less-prettier| - stylelint...........................|ale-less-stylelint| - llvm..................................|ale-llvm-options| - llc.................................|ale-llvm-llc| - lua...................................|ale-lua-options| - luac................................|ale-lua-luac| - luacheck............................|ale-lua-luacheck| - markdown..............................|ale-markdown-options| - mdl.................................|ale-markdown-mdl| - prettier............................|ale-markdown-prettier| - remark-lint.........................|ale-markdown-remark-lint| - textlint............................|ale-markdown-textlint| - write-good..........................|ale-markdown-write-good| - mercury...............................|ale-mercury-options| - mmc.................................|ale-mercury-mmc| - nasm..................................|ale-nasm-options| - nasm................................|ale-nasm-nasm| - nroff.................................|ale-nroff-options| - write-good..........................|ale-nroff-write-good| - objc..................................|ale-objc-options| - clang...............................|ale-objc-clang| - clangd..............................|ale-objc-clangd| - uncrustify..........................|ale-objc-uncrustify| - ccls................................|ale-objc-ccls| - objcpp................................|ale-objcpp-options| - clang...............................|ale-objcpp-clang| - clangd..............................|ale-objcpp-clangd| - uncrustify..........................|ale-objcpp-uncrustify| - ocaml.................................|ale-ocaml-options| - merlin..............................|ale-ocaml-merlin| - ols.................................|ale-ocaml-ols| - ocamlformat.........................|ale-ocaml-ocamlformat| - pawn..................................|ale-pawn-options| - uncrustify..........................|ale-pawn-uncrustify| - perl..................................|ale-perl-options| - perl................................|ale-perl-perl| - perlcritic..........................|ale-perl-perlcritic| - perltidy............................|ale-perl-perltidy| - perl6.................................|ale-perl6-options| - perl6...............................|ale-perl6-perl6| - php...................................|ale-php-options| - langserver..........................|ale-php-langserver| - phan................................|ale-php-phan| - phpcbf..............................|ale-php-phpcbf| - phpcs...............................|ale-php-phpcs| - phpmd...............................|ale-php-phpmd| - 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| - write-good..........................|ale-pod-write-good| - pony..................................|ale-pony-options| - ponyc...............................|ale-pony-ponyc| - prolog................................|ale-prolog-options| - swipl...............................|ale-prolog-swipl| - proto.................................|ale-proto-options| - protoc-gen-lint.....................|ale-proto-protoc-gen-lint| - pug...................................|ale-pug-options| - puglint.............................|ale-pug-puglint| - puppet................................|ale-puppet-options| - puppet..............................|ale-puppet-puppet| - puppetlint..........................|ale-puppet-puppetlint| - puppet-languageserver...............|ale-puppet-languageserver| - pyrex (cython)........................|ale-pyrex-options| - cython..............................|ale-pyrex-cython| - python................................|ale-python-options| - autopep8............................|ale-python-autopep8| - bandit..............................|ale-python-bandit| - black...............................|ale-python-black| - flake8..............................|ale-python-flake8| - isort...............................|ale-python-isort| - mypy................................|ale-python-mypy| - prospector..........................|ale-python-prospector| - pycodestyle.........................|ale-python-pycodestyle| - pydocstyle..........................|ale-python-pydocstyle| - pyflakes............................|ale-python-pyflakes| - pylama..............................|ale-python-pylama| - pylint..............................|ale-python-pylint| - pyls................................|ale-python-pyls| - pyre................................|ale-python-pyre| - vulture.............................|ale-python-vulture| - yapf................................|ale-python-yapf| - qml...................................|ale-qml-options| - qmlfmt..............................|ale-qml-qmlfmt| - r.....................................|ale-r-options| - lintr...............................|ale-r-lintr| - reasonml..............................|ale-reasonml-options| - merlin..............................|ale-reasonml-merlin| - ols.................................|ale-reasonml-ols| - refmt...............................|ale-reasonml-refmt| - restructuredtext......................|ale-restructuredtext-options| - textlint............................|ale-restructuredtext-textlint| - write-good..........................|ale-restructuredtext-write-good| - ruby..................................|ale-ruby-options| - brakeman............................|ale-ruby-brakeman| - rails_best_practices................|ale-ruby-rails_best_practices| - reek................................|ale-ruby-reek| - rubocop.............................|ale-ruby-rubocop| - 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| - scalafmt............................|ale-scala-scalafmt| - 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| - shell...............................|ale-sh-shell| - shellcheck..........................|ale-sh-shellcheck| - shfmt...............................|ale-sh-shfmt| - sml...................................|ale-sml-options| - smlnj...............................|ale-sml-smlnj| - solidity..............................|ale-solidity-options| - solhint.............................|ale-solidity-solhint| - solium..............................|ale-solidity-solium| - spec..................................|ale-spec-options| - rpmlint.............................|ale-spec-rpmlint| - sql...................................|ale-sql-options| - sqlfmt..............................|ale-sql-sqlfmt| - stylus................................|ale-stylus-options| - stylelint...........................|ale-stylus-stylelint| - sugarss...............................|ale-sugarss-options| - stylelint...........................|ale-sugarss-stylelint| - tcl...................................|ale-tcl-options| - nagelfar............................|ale-tcl-nagelfar| - terraform.............................|ale-terraform-options| - fmt.................................|ale-terraform-fmt| - tflint..............................|ale-terraform-tflint| - tex...................................|ale-tex-options| - chktex..............................|ale-tex-chktex| - lacheck.............................|ale-tex-lacheck| - texinfo...............................|ale-texinfo-options| - write-good..........................|ale-texinfo-write-good| - text..................................|ale-text-options| - textlint............................|ale-text-textlint| - write-good..........................|ale-text-write-good| - thrift................................|ale-thrift-options| - thrift..............................|ale-thrift-thrift| - typescript............................|ale-typescript-options| - eslint..............................|ale-typescript-eslint| - prettier............................|ale-typescript-prettier| - tslint..............................|ale-typescript-tslint| - tsserver............................|ale-typescript-tsserver| - vala..................................|ale-vala-options| - uncrustify..........................|ale-vala-uncrustify| - verilog/systemverilog.................|ale-verilog-options| - iverilog............................|ale-verilog-iverilog| - verilator...........................|ale-verilog-verilator| - vlog................................|ale-verilog-vlog| - xvlog...............................|ale-verilog-xvlog| - vhdl..................................|ale-vhdl-options| - ghdl................................|ale-vhdl-ghdl| - vcom................................|ale-vhdl-vcom| - xvhdl...............................|ale-vhdl-xvhdl| - vim...................................|ale-vim-options| - vint................................|ale-vim-vint| - vim help..............................|ale-vim-help-options| - write-good..........................|ale-vim-help-write-good| - vue...................................|ale-vue-options| - prettier............................|ale-vue-prettier| - vls.................................|ale-vue-vls| - xhtml.................................|ale-xhtml-options| - write-good..........................|ale-xhtml-write-good| - xml...................................|ale-xml-options| - xmllint.............................|ale-xml-xmllint| - yaml..................................|ale-yaml-options| - prettier............................|ale-yaml-prettier| - swaglint............................|ale-yaml-swaglint| - yamllint............................|ale-yaml-yamllint| - yang..................................|ale-yang-options| - yang-lsp............................|ale-yang-lsp| ALE can fix problems with files with the |ALEFix| command, using the same job control functionality used for checking for problems. Try using the @@ -500,6 +142,8 @@ ALE offers several options for controlling which linters are run. * Selecting linters to run. - |g:ale_linters| * Aliasing filetypes for linters - |g:ale_linter_aliases| * Only running linters you asked for. - |g:ale_linters_explicit| +* Disabling only a subset of linters. - |g:ale_linters_ignore| +* Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| ------------------------------------------------------------------------------- @@ -667,6 +311,9 @@ by default. |g:ale_fix_on_save| - Fix files when they are saved. +Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will +still be run when you manually run |ALEFix|. + =============================================================================== 5. Language Server Protocol Support *ale-lsp* @@ -676,40 +323,49 @@ servers. LSP linters can be used in combination with any other linter, and will automatically connect to LSP servers when needed. ALE also supports `tsserver` for TypeScript, which uses a different but very similar protocol. -ALE supports the following LSP/tsserver features: - -1. Diagnostics/linting - Enabled via selecting linters as usual. -2. Completion -3. Go to definition - +If you want to use another plugin for LSP features and tsserver, you can use +the |g:ale_disable_lsp| setting to disable ALE's own LSP integrations, or +ignore particular linters with |g:ale_linters_ignore|. ------------------------------------------------------------------------------- 5.1 Completion *ale-completion* -ALE offers limited support for automatic completion of code while you type. +ALE offers support for automatic completion of code while you type. Completion is only supported while at least one LSP linter is enabled. ALE will only suggest symbols provided by the LSP servers. -Suggestions will be made while you type after completion is enabled. -Completion can be enabled by setting |g:ale_completion_enabled| to `1`. This -setting must be set to `1` before ALE is loaded. The delay for completion can -be configured with |g:ale_completion_delay|. ALE will only suggest so many -possible matches for completion. The maximum number of items can be controlled -with |g:ale_completion_max_suggestions|. + *ale-deoplete-integration* + +ALE integrates with Deoplete for offering automatic completion data. ALE's +completion source for Deoplete is named `'ale'`, and should enabled +automatically if Deoplete is enabled and configured correctly. Deoplete +integration should not be combined with ALE's own implementation. + +ALE also offers its own completion implementation, which does not require any +other plugins. Suggestions will be made while you type after completion is +enabled. ALE's own completion implementation can be enabled by setting +|g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE +is loaded. The delay for completion can be configured with +|g:ale_completion_delay|. This setting should not be enabled if you wish to +use ALE as a completion source for other plugins. + +ALE will only suggest so many possible matches for completion. The maximum +number of items can be controlled with |g:ale_completion_max_suggestions|. If you don't like some of the suggestions you see, you can filter them out with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|. The |ALEComplete| command can be used to show completion suggestions manually, -even when |g:ale_completion_enabled| is set to `0`. +even when |g:ale_completion_enabled| is set to `0`. For manually requesting +completion information with Deoplete, consult Deoplete's documentation. *ale-completion-completeopt-bug* -Automatic completion replaces |completeopt| before opening the omnicomplete -menu with . In some versions of Vim, the value set for the option -will not be respected. If you experience issues with Vim automatically -inserting text while you type, set the following option in vimrc, and your -issues should go away. > +ALE Automatic completion implementation replaces |completeopt| before opening +the omnicomplete menu with . In some versions of Vim, the value set +for the option will not be respected. If you experience issues with Vim +automatically inserting text while you type, set the following option in +vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < @@ -726,6 +382,9 @@ information returned by LSP servers. The following commands are supported: |ALEGoToDefinitionInSplit| - The same, but in a new split. |ALEGoToDefinitionInVSplit| - The same, but in a new vertical split. +ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is +set to `0`. + ------------------------------------------------------------------------------- 5.3 Go To Type Definition *ale-go-to-type-definition* @@ -901,6 +560,7 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* +b:ale_completion_enabled *b:ale_completion_enabled* Type: |Number| Default: `0` @@ -910,6 +570,13 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting must be set to `1` before ALE is loaded for this behavior to be enabled. + This setting should not be enabled if you wish to use ALE as a completion + source for other completion plugins. + + A buffer-local version of this setting `b:ale_completion_enabled` can be set + to `0` to disable ALE's automatic completion support for a single buffer. + ALE's completion support must be enabled globally to be enabled locally. + See |ale-completion| @@ -969,6 +636,18 @@ g:ale_cursor_detail *g:ale_cursor_detail* loaded for messages to be displayed. See |ale-lint-settings-on-startup|. +g:ale_disable_lsp *g:ale_disable_lsp* + *b:ale_disable_lsp* + + Type: |Number| + Default: `0` + + When this option is set to `1`, ALE ignores all linters powered by LSP, + and also `tsserver`. + + Please see also |ale-lsp|. + + g:ale_echo_cursor *g:ale_echo_cursor* Type: |Number| @@ -1020,7 +699,7 @@ b:ale_echo_msg_format *b:ale_echo_msg_format* `%s` - replaced with the text for the problem `%...code...% `- replaced with the error code `%linter%` - replaced with the name of the linter - `%severity%` - replaced withe severity of the problem + `%severity%` - replaced with the severity of the problem The strings for `%severity%` can be configured with the following options. @@ -1037,7 +716,7 @@ b:ale_echo_msg_format *b:ale_echo_msg_format* |g:ale_echo_cursor| needs to be set to 1 for messages to be displayed. The echo message format can also be configured separately for each buffer, - so different formats can be used for differnt languages. (Say in ftplugin + so different formats can be used for different languages. (Say in ftplugin files.) @@ -1118,6 +797,43 @@ b:ale_fix_on_save *b:ale_fix_on_save* Fixing files can be disabled or enabled for individual buffers by setting `b:ale_fix_on_save` to `0` or `1`. + Some fixers can be excluded from being run automatically when you save files + with the |g:ale_fix_on_save_ignore| setting. + + +g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* +b:ale_fix_on_save_ignore *b:ale_fix_on_save_ignore* + + Type: |Dictionary| or |List| + Default: `{}` + + Given a |Dictionary| mapping filetypes to |Lists| of fixers to ignore, or + just a |List| of fixers to ignore, exclude those fixers from being run + automatically when files are saved. + + You can disable some fixers in your ftplugin file: > + + " Disable fixers 'b' and 'c' when fixing on safe for this buffer. + let b:ale_fix_on_save_ignore = ['b', 'c'] + " Alternatively, define ignore lists for different filetypes. + let b:ale_fix_on_save_ignore = {'foo': ['b'], 'bar': ['c']} +< + You can disable some fixers globally per filetype like so: > + + let g:ale_fixers = {'foo': ['a', 'b'], 'bar': ['c', 'd']} + let g:ale_fix_on_save = 1 + " For filetype `foo.bar`, only fixers 'b' and 'd' will be run on save. + let g:ale_fix_on_save_ignore = {'foo': ['a'], 'bar': ['c']} + " Alternatively, disable these fixers on save for all filetypes. + let g:ale_fix_on_save_ignore = ['a', 'c'] +< + You can ignore fixers based on matching |Funcref| values too: > + + let g:AddBar = {buffer, lines -> lines + ['bar']} + let g:ale_fixers = {'foo': g:AddBar} + " The lambda fixer will be ignored, as it will be found in the ignore list. + let g:ale_fix_on_save_ignore = [g:AddBar] +< g:ale_history_enabled *g:ale_history_enabled* @@ -1342,7 +1058,7 @@ g:ale_linters *g:ale_linters* { \ 'csh': ['shell'], - \ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], + \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], @@ -1802,6 +1518,14 @@ g:ale_sign_warning *g:ale_sign_warning* The sign for warnings in the sign gutter. +g:ale_update_tagstack *g:ale_update_tagstack* + *b:ale_update_tagstack* + Type: |Number| + Default: `1` + + This option can be set to disable updating Vim's |tagstack| automatically. + + g:ale_type_map *g:ale_type_map* *b:ale_type_map* Type: |Dictionary| @@ -2212,8 +1936,10 @@ documented in additional help files. uncrustify............................|ale-c-uncrustify| ccls..................................|ale-c-ccls| chef....................................|ale-chef-options| + cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| clojure.................................|ale-clojure-options| + clj-kondo.............................|ale-clojure-clj-kondo| joker.................................|ale-clojure-joker| cloudformation..........................|ale-cloudformation-options| cfn-python-lint.......................|ale-cloudformation-cfn-python-lint| @@ -2239,6 +1965,7 @@ documented in additional help files. mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| css.....................................|ale-css-options| + fecs..................................|ale-css-fecs| prettier..............................|ale-css-prettier| stylelint.............................|ale-css-stylelint| cuda....................................|ale-cuda-options| @@ -2281,15 +2008,16 @@ documented in additional help files. glslang...............................|ale-glsl-glslang| glslls................................|ale-glsl-glslls| go......................................|ale-go-options| + bingo.................................|ale-go-bingo| gobuild...............................|ale-go-gobuild| gofmt.................................|ale-go-gofmt| - golint................................|ale-go-golint| - govet.................................|ale-go-govet| - gometalinter..........................|ale-go-gometalinter| - staticcheck...........................|ale-go-staticcheck| - golangserver..........................|ale-go-golangserver| golangci-lint.........................|ale-go-golangci-lint| - bingo.................................|ale-go-bingo| + golangserver..........................|ale-go-golangserver| + golint................................|ale-go-golint| + gometalinter..........................|ale-go-gometalinter| + gopls.................................|ale-go-gopls| + govet.................................|ale-go-govet| + staticcheck...........................|ale-go-staticcheck| graphql.................................|ale-graphql-options| eslint................................|ale-graphql-eslint| gqlint................................|ale-graphql-gqlint| @@ -2302,6 +2030,7 @@ documented in additional help files. ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| + floskell..............................|ale-haskell-floskell| ghc...................................|ale-haskell-ghc| ghc-mod...............................|ale-haskell-ghc-mod| cabal-ghc.............................|ale-haskell-cabal-ghc| @@ -2315,6 +2044,7 @@ documented in additional help files. hcl.....................................|ale-hcl-options| terraform-fmt.........................|ale-hcl-terraform-fmt| html....................................|ale-html-options| + fecs..................................|ale-html-fecs| htmlhint..............................|ale-html-htmlhint| tidy..................................|ale-html-tidy| prettier..............................|ale-html-prettier| @@ -2330,9 +2060,11 @@ documented in additional help files. google-java-format....................|ale-java-google-java-format| pmd...................................|ale-java-pmd| javalsp...............................|ale-java-javalsp| + eclipselsp............................|ale-java-eclipselsp| uncrustify............................|ale-java-uncrustify| javascript..............................|ale-javascript-options| eslint................................|ale-javascript-eslint| + fecs..................................|ale-javascript-fecs| flow..................................|ale-javascript-flow| importjs..............................|ale-javascript-importjs| jscs..................................|ale-javascript-jscs| @@ -2390,6 +2122,7 @@ documented in additional help files. merlin................................|ale-ocaml-merlin| ols...................................|ale-ocaml-ols| ocamlformat...........................|ale-ocaml-ocamlformat| + ocp-indent............................|ale-ocaml-ocp-indent| pawn....................................|ale-pawn-options| uncrustify............................|ale-pawn-uncrustify| perl....................................|ale-perl-options| @@ -2414,6 +2147,9 @@ documented in additional help files. write-good............................|ale-pod-write-good| pony....................................|ale-pony-options| ponyc.................................|ale-pony-ponyc| + powershell............................|ale-powershell-options| + powershell..........................|ale-powershell-powershell| + psscriptanalyzer....................|ale-powershell-psscriptanalyzer| prolog..................................|ale-prolog-options| swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| @@ -2447,6 +2183,7 @@ documented in additional help files. qmlfmt................................|ale-qml-qmlfmt| r.......................................|ale-r-options| lintr.................................|ale-r-lintr| + styler................................|ale-r-styler| reasonml................................|ale-reasonml-options| merlin................................|ale-reasonml-merlin| ols...................................|ale-reasonml-ols| @@ -2497,6 +2234,8 @@ documented in additional help files. stylelint.............................|ale-stylus-stylelint| sugarss.................................|ale-sugarss-options| stylelint.............................|ale-sugarss-stylelint| + swift...................................|ale-swift-options| + sourcekitlsp..........................|ale-swift-sourcekitlsp| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| @@ -2505,6 +2244,7 @@ documented in additional help files. tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| lacheck...............................|ale-tex-lacheck| + latexindent...........................|ale-tex-latexindent| texinfo.................................|ale-texinfo-options| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| @@ -2736,7 +2476,7 @@ ALELast *ALELast* Flags can be combined to create create custom jumping. Thus you can use ":ALENext -wrap -error -nosyle" to jump to the next error which is not a - style error while going back to the begining of the file if needed. + style error while going back to the beginning of the file if needed. `ALEFirst` goes to the first error or warning in the buffer, while `ALELast` goes to the last one. @@ -2885,6 +2625,14 @@ ale#Env(variable_name, value) *ale#Env()* 'set VAR="some value" && command' # On Windows +ale#Has(feature) *ale#Has()* + + Return `1` if ALE supports a given feature, like |has()| for Vim features. + + ALE versions can be checked with version strings in the format + `ale#Has('ale-x.y.z')`, such as `ale#Has('ale-2.4.0')`. + + ale#Pad(string) *ale#Pad()* Given a string or any |empty()| value, return either the string prefixed @@ -3463,7 +3211,7 @@ ale#statusline#Count(buffer) *ale#statusline#Count()* ale#statusline#FirstProblem(buffer, type) *ale#statusline#FirstProblem()* Returns a copy of the first entry in the `loclist` that matches the supplied - buffer number and problem type. If there is no such enty, an empty dictionary + buffer number and problem type. If there is no such entry, an empty dictionary is returned. Problem type should be one of the strings listed below: diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index ad3d3e56..cf39d632 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -216,7 +216,7 @@ 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() -command! -bar ALEComplete :call ale#completion#GetCompletions(1) +command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual') " mappings for commands nnoremap (ale_previous) :ALEPrevious diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py new file mode 100644 index 00000000..7ed2f6c0 --- /dev/null +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -0,0 +1,54 @@ +""" +A Deoplete source for ALE completion via tsserver and LSP. +""" +__author__ = 'Joao Paulo, w0rp' + +try: + from deoplete.source.base import Base +except ImportError: + # Mock the Base class if deoplete isn't available, as mock isn't available + # in the Docker image. + class Base(object): + def __init__(self, vim): + pass + + +# Make sure this code is valid in Python 2, used for running unit tests. +class Source(Base): + + def __init__(self, vim): + super(Source, self).__init__(vim) + + self.name = 'ale' + self.mark = '[L]' + self.rank = 100 + self.is_bytepos = True + self.min_pattern_length = 1 + + # Returns an integer for the start position, as with omnifunc. + def get_completion_position(self): + return self.vim.call('ale#completion#GetCompletionPosition') + + def gather_candidates(self, context): + # Stop early if ALE can't provide completion data for this buffer. + if not self.vim.call('ale#completion#CanProvideCompletions'): + return None + + if context.get('is_refresh'): + context['is_async'] = False + + if context['is_async']: + # Result is the same as for omnifunc, or None. + result = self.vim.call('ale#completion#GetCompletionResult') + + if result is not None: + context['is_async'] = False + + return result + else: + context['is_async'] = True + + # Request some completion results. + self.vim.call('ale#completion#GetCompletions', 'deoplete') + + return [] diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index c044d9f3..18d69388 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -80,8 +80,10 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * Chef + * [cookstyle](https://docs.chef.io/cookstyle.html) * [foodcritic](http://www.foodcritic.io/) * Clojure + * [clj-kondo](https://github.com/borkdude/clj-kondo) * [joker](https://github.com/candid82/joker) * CloudFormation * [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) @@ -96,6 +98,7 @@ formatting. * [crystal](https://crystal-lang.org/) :floppy_disk: * CSS * [csslint](http://csslint.net/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [stylelint](https://github.com/stylelint/stylelint) * Cucumber @@ -123,7 +126,7 @@ formatting. * [credo](https://github.com/rrrene/credo) * [dialyxir](https://github.com/jeremyjh/dialyxir) * [dogma](https://github.com/lpil/dogma) - * [elixir-ls](https://github.com/JakeBecker/elixir-ls) + * [elixir-ls](https://github.com/JakeBecker/elixir-ls) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) @@ -161,6 +164,7 @@ formatting. * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [gopls](https://github.com/golang/go/wiki/gopls) :warning: * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [go vet](https://golang.org/cmd/vet/) :floppy_disk: @@ -180,6 +184,7 @@ formatting. * Haskell * [brittany](https://github.com/lspitzner/brittany) * [cabal-ghc](https://www.haskell.org/cabal/) + * [floskell](https://github.com/ennocramer/floskell) * [ghc](https://www.haskell.org/ghc/) * [ghc-mod](https://github.com/DanielG/ghc-mod) * [hdevtools](https://hackage.haskell.org/package/hdevtools) @@ -193,6 +198,7 @@ formatting. * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [fecs](http://fecs.baidu.com/) * [HTMLHint](http://htmlhint.com/) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) @@ -204,6 +210,7 @@ formatting. * [ispc](https://ispc.github.io/) :floppy_disk: * Java * [checkstyle](http://checkstyle.sourceforge.net) + * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) @@ -211,6 +218,7 @@ formatting. * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [flow](https://flowtype.org/) * [jscs](http://jscs.info/) * [jshint](http://jshint.com/) @@ -294,6 +302,7 @@ formatting. * OCaml * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions * [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) + * [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ols](https://github.com/freebroccolo/ocaml-language-server) * Pawn * [uncrustify](https://github.com/uncrustify/uncrustify) @@ -324,6 +333,9 @@ formatting. * [write-good](https://github.com/btford/write-good) * Pony * [ponyc](https://github.com/ponylang/ponyc) +* PowerShell + * [powershell](https://github.com/PowerShell/PowerShell) :floppy_disk + * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) :floppy_disk * Prolog * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto @@ -344,6 +356,7 @@ formatting. * [prospector](https://github.com/PyCQA/prospector) :warning: * [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning: * [pydocstyle](https://www.pydocstyle.org/) :warning: + * [pyflakes](https://github.com/PyCQA/pyflakes) * [pylama](https://github.com/klen/pylama) :floppy_disk: * [pylint](https://www.pylint.org/) :floppy_disk: * [pyls](https://github.com/palantir/python-language-server) :warning: @@ -355,6 +368,7 @@ formatting. * [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) * R * [lintr](https://github.com/jimhester/lintr) + * [styler](https://github.com/r-lib/styler) * Racket * [raco](https://docs.racket-lang.org/raco/) * ReasonML @@ -416,6 +430,7 @@ formatting. * SugarSS * [stylelint](https://github.com/stylelint/stylelint) * Swift + * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) * Tcl @@ -439,6 +454,7 @@ formatting. * [thrift](http://thrift.apache.org/) * TypeScript * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [tslint](https://github.com/palantir/tslint) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) diff --git a/sources_non_forked/goyo.vim/doc/goyo.txt b/sources_non_forked/goyo.vim/doc/goyo.txt index c703146f..b8050226 100644 --- a/sources_non_forked/goyo.vim/doc/goyo.txt +++ b/sources_non_forked/goyo.vim/doc/goyo.txt @@ -1,4 +1,4 @@ -goyo.txt goyo Last change: April 2 2017 +*goyo.txt* goyo Last change: April 2 2017 GOYO - TABLE OF CONTENTS *goyo* *goyo-toc* ============================================================================== diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim index a28fb8d4..9d0fba69 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/one.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colorscheme/one.vim " Author: Zoltan Dalmadi " License: MIT License -" Last Change: 2017/11/28 21:53:01. +" Last Change: 2019/05/12 20:30:51. " ============================================================================= " Common colors @@ -28,7 +28,7 @@ if lightline#colorscheme#background() ==# 'light' let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ] let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ] let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ] - let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ] + let s:p.inactive.right = [ [ s:bg, s:gray3 ] ] let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ] let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ] let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ] @@ -43,20 +43,20 @@ else let s:p.normal.middle = [ [ s:fg, s:gray2 ] ] let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ] let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ] - let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ] + let s:p.inactive.right = [ [ s:gray1, s:bg ] ] let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ] endif " Common -let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ] +let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ] let s:p.normal.error = [ [ s:red2, s:bg ] ] let s:p.normal.warning = [ [ s:yellow, s:bg ] ] -let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ] -let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ] -let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ] -let s:p.tabline.left = [ [ s:bg, s:gray3 ] ] +let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ] +let s:p.tabline.left = [ [ s:fg, s:gray3 ] ] let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ] let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ] let s:p.tabline.right = copy(s:p.normal.right) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index bdf3deb7..fd192827 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -10,6 +10,29 @@ endfunction " SECTION: General Functions {{{1 "============================================================ +"FUNCTION: nerdtree#and(x,y) {{{2 +" Implements and() function for Vim <= 7.2 +function! nerdtree#and(x,y) + if exists("*and") + return and(a:x, a:y) + else + let l:x = a:x + let l:y = a:y + let l:n = 0 + let l:result = 0 + while l:x > 0 && l:y > 0 + if (l:x % 2) && (l:y % 2) + let l:result += float2nr(pow(2, l:n)) + endif + echomsg l:x . ", " . l:y . " => " l:result + let l:x = float2nr(l:x / 2) + let l:y = float2nr(l:y / 2) + let l:n += 1 + endwhile + return l:result + endif +endfunction + "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "inits a window tree in the current buffer if appropriate function! nerdtree#checkForBrowse(dir) @@ -169,7 +192,7 @@ endfunction "msg: the message to echo function! nerdtree#echo(msg) redraw - echomsg "NERDTree: " . a:msg + echomsg empty(a:msg) ? "" : ("NERDTree: " . a:msg) endfunction "FUNCTION: nerdtree#echoError {{{2 diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 8da3640a..a82ff18e 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -492,7 +492,7 @@ function! s:openNodeRecursively(node) call nerdtree#echo("Recursively opening node. Please wait...") call a:node.openRecursively() call b:NERDTree.render() - redraw! + call nerdtree#echo("") endfunction " FUNCTION: s:previewBookmark(bookmark) {{{1 @@ -543,8 +543,9 @@ function! s:refreshRoot() call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w") call b:NERDTree.root.refresh() call b:NERDTree.render() - redraw! + redraw call nerdtree#exec(l:curWin . "wincmd w") + call nerdtree#echo("") endfunction " FUNCTION: s:refreshCurrent(node) {{{1 @@ -558,7 +559,7 @@ function! s:refreshCurrent(node) call nerdtree#echo("Refreshing node. This could take a while...") call node.refresh() call b:NERDTree.render() - redraw! + call nerdtree#echo("") endfunction " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index dad3dc8c..c633a8f2 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -256,7 +256,7 @@ endfunction function! s:Bookmark.open(nerdtree, ...) let opts = a:0 ? a:1 : {} - if and(g:NERDTreeQuitOnOpen,2) + if nerdtree#and(g:NERDTreeQuitOnOpen,2) call a:nerdtree.ui.toggleShowBookmarks() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index 5a4ebc50..c1ce5ed0 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -66,7 +66,7 @@ endfunction "FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1 "Closes the NERD tree window if the close on open option is set function! s:NERDTree.CloseIfQuitOnOpen() - if and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen() + if nerdtree#and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen() call s:NERDTree.Close() endif endfunction 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 0bea771b..a834e7c1 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -432,7 +432,7 @@ function! s:TreeDirNode._initChildren(silent) call self.sortChildren() - redraw! + call nerdtree#echo("") if invalidFilesFound call nerdtree#echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree") diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 9ae643bb..6ff9878e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -280,11 +280,10 @@ endfunction " FUNCTION: s:UI._indentLevelFor(line) {{{1 function! s:UI._indentLevelFor(line) - " have to do this work around because match() returns bytes, not chars - let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') - " The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+ - let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs')) - + " Replace multi-character DirArrows with a single space so the + " indentation calculation doesn't get messed up. + let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '') + let leadChars = match(l:line, '\M\[^ ]') return leadChars / s:UI.IndentWid() endfunction diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index a18082eb..595e780b 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -14,8 +14,8 @@ if exists("loaded_nerd_tree") finish endif -if v:version < 700 - echoerr "NERDTree: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!" +if v:version < 703 + echoerr "NERDTree: this plugin requires vim >= 7.3. DOWNLOAD IT! You'll thank me later!" finish endif let loaded_nerd_tree = 1 @@ -77,6 +77,7 @@ else call s:initVariable("g:NERDTreeDirArrowExpandable", "+") call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") endif + call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1) diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.mdown index d4c58111..5d4e00c8 100644 --- a/sources_non_forked/vim-flake8/README.mdown +++ b/sources_non_forked/vim-flake8/README.mdown @@ -47,7 +47,7 @@ If you don't want to use the `` key for flake8-checking, simply remap it to another key. It autodetects whether it has been remapped and won't register the `` key if so. For example, to remap it to `` instead, use: - autocmd FileType python map :call Flake8() + autocmd FileType python map :call flake8#Flake8() For flake8 configuration options please consult the following page: @@ -110,7 +110,7 @@ A tip might be to run the Flake8 check every time you write a Python file, to enable this, add the following line to your `.vimrc` file (thanks [Godefroid](https://github.com/gotcha)!): - autocmd BufWritePost *.py call Flake8() + autocmd BufWritePost *.py call flake8#Flake8() This plugin goes well together with the following plugin: diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 8e68428c..8521f551 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -427,8 +427,12 @@ function! s:add_methods(namespace, method_names) abort endfunction let s:commands = [] -function! s:command(definition) abort - let s:commands += [a:definition] +function! s:command(definition, ...) abort + if a:0 + call add(s:commands, a:definition . ' execute s:' . a:1 . "Command(, , +'', , 0, '', , , [])") + else + call add(s:commands, a:definition) + endif endfunction function! s:define_commands() abort @@ -520,7 +524,7 @@ endfunction call s:add_methods('repo',['prepare','git_command','git_chomp','git_chomp_in_tree','rev_parse']) function! s:repo_superglob(base) dict abort - return map(fugitive#Complete(a:base, self.git_dir), 'substitute(v:val, ''\\\(.\)'', ''\1'', "g")') + return map(fugitive#CompleteObject(a:base, self.git_dir), 'substitute(v:val, ''\\\(.\)'', ''\1'', "g")') endfunction call s:add_methods('repo',['superglob']) @@ -1127,7 +1131,7 @@ function! fugitive#glob(url, ...) abort let [dirglob, commit, glob] = s:DirCommitFile(a:url) let append = matchstr(glob, '/*$') let glob = substitute(glob, '/*$', '', '') - let pattern = '^' . substitute(glob, '/\=\*\*/\=\|/\=\*\|[.?\^$]', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g')[1:-1] . '$' + let pattern = '^' . substitute(glob, '/\=\*\*/\=\|/\=\*\|[.?\$]\|^^', '\=get(s:globsubs, submatch(0), "\\" . submatch(0))', 'g')[1:-1] . '$' let results = [] for dir in dirglob =~# '[*?]' ? split(glob(dirglob), "\n") : [dirglob] if empty(dir) || !get(g:, 'fugitive_file_api', 1) || !filereadable(dir . '/HEAD') @@ -1226,8 +1230,8 @@ function! s:GlobComplete(lead, pattern) abort return results endfunction -function! fugitive#PathComplete(base, ...) abort - let dir = a:0 == 1 ? a:1 : s:Dir() +function! fugitive#CompletePath(base, ...) abort + let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() let tree = s:Tree(dir) . '/' let strip = '^\%(:/:\=\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)' let base = substitute(a:base, strip, '', '') @@ -1253,8 +1257,12 @@ function! fugitive#PathComplete(base, ...) abort return matches endfunction -function! fugitive#Complete(base, ...) abort - let dir = a:0 == 1 ? a:1 : s:Dir() +function! fugitive#PathComplete(...) abort + return call('fugitive#CompletePath', a:000) +endfunction + +function! fugitive#CompleteObject(base, ...) abort + let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() let cwd = a:0 == 1 ? s:Tree(dir) : getcwd() let tree = s:Tree(dir) . '/' let subdir = '' @@ -1278,7 +1286,7 @@ function! fugitive#Complete(base, ...) abort endif call map(results, 's:fnameescape(v:val)') if !empty(tree) - let results += a:0 == 1 ? fugitive#PathComplete(a:base, dir) : fugitive#PathComplete(a:base) + let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base) endif return results @@ -1304,9 +1312,13 @@ function! fugitive#Complete(base, ...) abort return map(entries, 's:fnameescape(v:val)') endfunction +function! fugitive#Complete(...) abort + return call('fugitive#CompleteObject', a:000) +endfunction + " Section: Buffer auto-commands -function! s:ReplaceCmd(cmd, ...) abort +function! s:ReplaceCmd(cmd) abort let temp = tempname() let err = s:TempCmd(temp, a:cmd) if v:shell_error @@ -1318,11 +1330,7 @@ function! s:ReplaceCmd(cmd, ...) abort let modelines = &modelines try set modelines=0 - if a:0 - silent keepjumps noautocmd edit! - else - silent keepjumps edit! - endif + silent keepjumps noautocmd edit! finally let &modelines = modelines try @@ -1338,6 +1346,9 @@ endfunction function! s:QueryLog(refspec) abort let lines = split(system(FugitivePrepare('log', '-n', '256', '--format=%h%x09%s', a:refspec, '--')), "\n") + if v:shell_error + return [] + endif call map(lines, 'split(v:val, "\t")') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') return lines @@ -1580,7 +1591,7 @@ function! fugitive#BufReadStatus() abort nnoremap P :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap P :execute StagePatch(line("'<"),line("'>")) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif - nnoremap gq :if bufnr('$') == 1quitelsebdeleteendif + exe 'nnoremap ' nowait "gq :if bufnr('$') == 1quitelsebdeleteendif" nnoremap R :exe ReloadStatus() nnoremap U :echoerr 'Changed to X' nnoremap g :execute StageDelete(line('.'),v:count) @@ -1821,18 +1832,18 @@ augroup END " Section: :Git -call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(0,'',)") +call s:command("-bang -nargs=? -complete=customlist,fugitive#CompleteGit Git", "Git") -function! s:Git(bang, mods, args) abort +function! s:GitCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if a:bang - return s:Edit('edit', 1, a:mods, a:args) + return s:Open('edit', 1, a:mods, a:arg, a:args) endif let git = s:UserCommand() if has('gui_running') && !has('win32') let git .= ' --no-pager' endif - let args = matchstr(a:args,'\v\C.{-}%($|\\@ 1 ? strpart(a:1, 0, a:2) : '' if pre !~# ' [[:alnum:]-]\+ ' let cmds = s:Subcommands() - return filter(sort(cmds+keys(s:Aliases())), 'strpart(v:val, 0, strlen(a:A)) ==# a:A') + return filter(sort(cmds+keys(s:Aliases(dir))), 'strpart(v:val, 0, strlen(a:lead)) ==# a:lead') elseif pre =~# ' -- ' - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:lead, dir) else - return fugitive#Complete(a:A, s:Dir()) + return fugitive#CompleteObject(a:lead, dir) endif endfunction " Section: :Gcd, :Glcd function! s:DirComplete(A, L, P) abort - return filter(fugitive#PathComplete(a:A), 'v:val =~# "/$"') + return filter(fugitive#CompletePath(a:A), 'v:val =~# "/$"') endfunction function! s:DirArg(path) abort @@ -1910,10 +1921,10 @@ call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :exe " Section: :Gstatus -call s:command("-bar -bang -range=-1 Gstatus :execute s:Status(0, , '')") -call s:command("-bar -bang -range=-1 G :execute s:Status(0, , '')") +call s:command("-bar -bang -range=-1 Gstatus", "Status") +call s:command("-bar -bang -range=-1 G", "Status") -function! s:Status(bang, count, mods) abort +function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort try let mods = a:mods ==# '' || empty(a:mods) ? '' : a:mods . ' ' if mods !~# 'aboveleft\|belowright\|leftabove\|rightbelow\|topleft\|botright' @@ -2635,9 +2646,9 @@ endfunction " Section: :Gcommit -call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit('', )") +call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit", "Commit") -function! s:Commit(mods, args, ...) abort +function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args, ...) abort let mods = s:gsub(a:mods ==# '' ? '' : a:mods, '', '-tab') let dir = a:0 ? a:1 : s:Dir() let tree = s:Tree(dir) @@ -2658,11 +2669,11 @@ function! s:Commit(mods, args, ...) abort else let command = 'env GIT_EDITOR=false ' endif - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) let command .= s:UserCommand() . ' commit ' . args if &shell =~# 'csh' noautocmd silent execute '!('.escape(command, '!#%').' > '.outfile.') >& '.errorfile - elseif a:args =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' + elseif a:arg =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' noautocmd execute '!'.command.' 2> '.errorfile else noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile @@ -2696,7 +2707,7 @@ function! s:Commit(mods, args, ...) abort endif if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod execute mods 'keepalt edit' s:fnameescape(msgfile) - elseif a:args =~# '\%(^\| \)-\w*v' || mods =~# '\' + elseif a:arg =~# '\%(^\| \)-\w*v' || mods =~# '\' execute mods 'keepalt -tabedit' s:fnameescape(msgfile) else execute mods 'keepalt split' s:fnameescape(msgfile) @@ -2733,7 +2744,7 @@ function! s:CommitComplete(A,L,P) abort let args = ['-C', '-F', '-a', '-c', '-e', '-i', '-m', '-n', '-o', '-q', '-s', '-t', '-u', '-v', '--all', '--allow-empty', '--amend', '--author=', '--cleanup=', '--dry-run', '--edit', '--file=', '--fixup=', '--include', '--interactive', '--message=', '--no-verify', '--only', '--quiet', '--reedit-message=', '--reuse-message=', '--signoff', '--squash=', '--template=', '--untracked-files', '--verbose'] return filter(args,'v:val[0 : strlen(a:A)-1] ==# a:A') else - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:A, s:Dir()) endif return [] endfunction @@ -2747,7 +2758,7 @@ function! s:FinishCommit() abort call setbufvar(buf, 'fugitive_commit_rebase', 0) let s:rebase_continue = s:Dir(buf) endif - return s:Commit('', args, s:Dir(buf)) + return s:CommitCommand(-1, -1, 0, -1, 0, '', '', args, [], s:Dir(buf)) endif return '' endfunction @@ -2848,6 +2859,16 @@ function! s:Merge(cmd, bang, mods, args, ...) abort return s:RebaseEdit(mods . 'split', dir) elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --edit-todo' && filereadable(dir . '/rebase-merge/git-rebase-todo') return s:RebaseEdit(mods . 'split', dir) + elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --continue' && !a:0 + let rdir = dir . '/rebase-merge' + call system(fugitive#Prepare(dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--')) + if v:shell_error && isdirectory(rdir) + if getfsize(rdir . '/amend') <= 0 + return 'exe ' . string(mods . 'Gcommit -n -F ' . s:shellesc(dir . '/rebase-merge/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' + elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir) + return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:shellesc(dir . '/rebase-merge/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' + endif + endif endif let [mp, efm] = [&l:mp, &l:efm] let had_merge_msg = filereadable(dir . '/MERGE_MSG') @@ -2906,7 +2927,7 @@ function! s:Merge(cmd, bang, mods, args, ...) abort let $GIT_EDITOR = old_editor endif if exists('old_sequence_editor') - let $GIT_SEQUENCE_EDITOR = old_editor + let $GIT_SEQUENCE_EDITOR = old_sequence_editor endif execute cdback endtry @@ -2979,9 +3000,9 @@ endif function! s:GrepComplete(A, L, P) abort if strpart(a:L, 0, a:P) =~# ' -- ' - return fugitive#PathComplete(a:A, s:Dir()) + return fugitive#CompletePath(a:A, s:Dir()) else - return fugitive#Complete(a:A, s:Dir()) + return fugitive#CompleteObject(a:A, s:Dir()) endif endfunction @@ -3084,7 +3105,7 @@ function! s:UsableWin(nr) abort \ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0 endfunction -function! s:EditParse(args) abort +function! s:OpenParse(args) abort let pre = [] let args = copy(a:args) while !empty(args) && args[0] =~# '^+' @@ -3126,7 +3147,7 @@ function! s:BlurStatus() abort endif endfunction -function! s:Edit(cmd, bang, mods, args, ...) abort +function! s:Open(cmd, bang, mods, arg, args) abort let mods = a:mods ==# '' ? '' : a:mods if a:bang @@ -3134,7 +3155,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort try let cdback = s:Cd(s:Tree()) let git = s:UserCommand() - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) silent! execute '!' . escape(git . ' --no-pager ' . args, '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') finally @@ -3150,7 +3171,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort return 'redraw|echo ' . string(':!' . git . ' ' . args) endif - let [file, pre] = s:EditParse(a:000) + let [file, pre] = s:OpenParse(a:args) try let file = s:Generate(file) catch /^fugitive:/ @@ -3165,7 +3186,7 @@ function! s:Edit(cmd, bang, mods, args, ...) abort return mods . ' ' . a:cmd . pre . ' ' . s:fnameescape(file) endfunction -function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort +function! s:ReadCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort let mods = a:mods ==# '' ? '' : a:mods let after = a:line2 if a:count < 0 @@ -3180,7 +3201,7 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort try let cdback = s:Cd(s:Tree()) let git = s:UserCommand() - let args = s:ShellExpand(a:args) + let args = s:ShellExpand(a:arg) silent execute mods after.'read!' escape(git . ' --no-pager ' . args, '!#%') finally execute cdback @@ -3189,7 +3210,7 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort call fugitive#ReloadStatus() return 'redraw|echo '.string(':!'.git.' '.args) endif - let [file, pre] = s:EditParse(a:000) + let [file, pre] = s:OpenParse(a:args) try let file = s:Generate(file) catch /^fugitive:/ @@ -3204,29 +3225,29 @@ function! s:Read(count, line1, line2, range, bang, mods, args, ...) abort return mods . ' ' . after . 'read' . pre . ' ' . s:fnameescape(file) . '|' . delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '') endfunction -function! s:EditRunComplete(A,L,P) abort +function! s:ReadComplete(A,L,P) abort if a:L =~# '^\w\+!' - return s:GitComplete(a:A, a:L, a:P) + return fugitive#CompleteGit(a:A, a:L, a:P) else - return fugitive#Complete(a:A, a:L, a:P) + return fugitive#CompleteObject(a:A, a:L, a:P) endif endfunction -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Ge execute s:Edit('edit', 0, '', , )") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gedit execute s:Edit('edit', 0, '', , )") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditRunComplete Gpedit execute s:Edit('pedit', 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gsplit execute s:Edit(( > 0 ? : '').( ? 'split' : 'edit'), 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gvsplit execute s:Edit(( > 0 ? : '').( ? 'vsplit' : 'edit!'), 0, '', , )") -call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditRunComplete" . (has('patch-7.4.542') ? ' -addr=tabs' : '') . " Gtabedit execute s:Edit(( ? : '').'tabedit', 0, '', , )") -call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:EditRunComplete Gread execute s:Read(, , , +'', 0, '', , )") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Ge execute s:Open('edit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gedit execute s:Open('edit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -complete=customlist,s:ReadComplete Gpedit execute s:Open('pedit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gsplit execute s:Open(( > 0 ? : '').( ? 'split' : 'edit'), 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gvsplit execute s:Open(( > 0 ? : '').( ? 'vsplit' : 'edit!'), 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete" . (has('patch-7.4.542') ? ' -addr=tabs' : '') . " Gtabedit execute s:Open(( >= 0 ? : '').'tabedit', 0, '', , [])") +call s:command("-bar -bang -nargs=* -range=-1 -complete=customlist,s:ReadComplete Gread", "Read") " Section: :Gwrite, :Gwq -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gwrite :execute s:Write(0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gw :execute s:Write(0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#Complete Gwq :execute s:Wq(0,)") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gwrite", "Write") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gw", "Write") +call s:command("-bar -bang -nargs=* -complete=customlist,fugitive#CompleteObject Gwq", "Wq") -function! s:Write(force,...) abort +function! s:WriteCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if exists('b:fugitive_commit_arguments') return 'write|bdelete' elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != '' @@ -3246,7 +3267,7 @@ function! s:Write(force,...) abort if err !=# '' let v:errmsg = split(err,"\n")[0] return 'echoerr v:errmsg' - elseif a:force + elseif a:bang return 'bdelete' else return 'Gedit '.fnameescape(filename) @@ -3254,15 +3275,15 @@ function! s:Write(force,...) abort endif let mytab = tabpagenr() let mybufnr = bufnr('') - let file = a:0 ? s:Generate(s:Expand(join(a:000, ' '))) : fugitive#Real(@%) + let file = len(a:args) ? s:Generate(s:Expand(join(a:args, ' '))) : fugitive#Real(@%) if empty(file) return 'echoerr '.string('fugitive: cannot determine file path') endif if file =~# '^fugitive:' - return 'write' . (a:force ? '! ' : ' ') . s:fnameescape(file) + return 'write' . (a:bang ? '! ' : ' ') . s:fnameescape(file) endif let always_permitted = s:cpath(fugitive#Real(@%), file) && s:DirCommitFile(@%)[1] =~# '^0\=$' - if !always_permitted && !a:force && (len(s:TreeChomp('diff', '--name-status', 'HEAD', '--', file)) || len(s:TreeChomp('ls-files', '--others', '--', file))) + if !always_permitted && !a:bang && (len(s:TreeChomp('diff', '--name-status', 'HEAD', '--', file)) || len(s:TreeChomp('ls-files', '--others', '--', file))) let v:errmsg = 'fugitive: file has uncommitted changes (use ! to override)' return 'echoerr v:errmsg' endif @@ -3308,7 +3329,7 @@ function! s:Write(force,...) abort execute 'write! '.s:fnameescape(file) endif - if a:force + if a:bang let error = s:TreeChomp('add', '--force', '--', file) else let error = s:TreeChomp('add', '--', file) @@ -3366,12 +3387,12 @@ function! s:Write(force,...) abort return 'checktime' endfunction -function! s:Wq(force,...) abort - let bang = a:force ? '!' : '' +function! s:WqCommand(...) abort + let bang = a:5 ? '!' : '' if exists('b:fugitive_commit_arguments') return 'wq'.bang endif - let result = call(s:function('s:Write'),[a:force]+a:000) + let result = call(s:function('s:WriteCommand'),a:000) if result =~# '^\%(write\|wq\|echoerr\)' return s:sub(result,'^write','wq') else @@ -3413,9 +3434,9 @@ endfunction " Section: :Gdiff -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gdiff :execute s:Diff('',0,)") -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gvdiff :execute s:Diff('keepalt vert ',0,)") -call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#Complete Gsdiff :execute s:Diff('keepalt ',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gdiff :execute s:Diff('',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gvdiff :execute s:Diff('keepalt vert ',0,)") +call s:command("-bang -bar -nargs=* -complete=customlist,fugitive#CompleteObject Gsdiff :execute s:Diff('keepalt ',0,)") augroup fugitive_diff autocmd! @@ -3655,10 +3676,10 @@ endfunction function! s:RenameComplete(A,L,P) abort if a:A =~# '^[.:]\=/' - return fugitive#PathComplete(a:A) + return fugitive#CompletePath(a:A) else let pre = s:Slash(fnamemodify(expand('%:p:s?[\/]$??'), ':h')) . '/' - return map(fugitive#PathComplete(pre.a:A), 'strpart(v:val, len(pre))') + return map(fugitive#CompletePath(pre.a:A), 'strpart(v:val, len(pre))') endif endfunction @@ -3687,7 +3708,7 @@ endfunction augroup fugitive_remove autocmd! autocmd User Fugitive if s:DirCommitFile(@%)[1] =~# '^0\=$' | - \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,fugitive#PathComplete Gmove :execute s:Move(0,0,)" | + \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,fugitive#CompletePath Gmove :execute s:Move(0,0,)" | \ exe "command! -buffer -bar -bang -nargs=1 -complete=customlist,s:RenameComplete Grename :execute s:Move(0,1,)" | \ exe "command! -buffer -bar -bang Gremove :execute s:Remove('edit',0)" | \ exe "command! -buffer -bar -bang Gdelete :execute s:Remove('bdelete',0)" | @@ -3711,7 +3732,7 @@ augroup fugitive_blame autocmd Syntax fugitiveblame call s:BlameSyntax() autocmd User Fugitive \ if get(b:, 'fugitive_type') =~# '^\%(file\|blob\|blame\)$' || filereadable(@%) | - \ exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:Blame(0,,,,'',[])" | + \ exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:BlameCommand(,,+'',,0,'',,,[])" | \ endif autocmd ColorScheme,GUIEnter * call s:RehighlightBlame() autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') @@ -3727,7 +3748,7 @@ function! s:linechars(pattern) abort return chars endfunction -function! s:Blame(bang, line1, line2, count, mods, args) abort +function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort if exists('b:fugitive_blamed_bufnr') return 'bdelete' endif @@ -3735,7 +3756,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 !~# "^\\%(--relative-date\\|--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] + if filter(copy(a:args),'v:val !~# "^\\%(--abbrev=\\d*\\|--relative-date\\|--first-parent\\|--root\\|--show-name\\|-\\=\\%([ltfnsew]\\|[MC]\\d*\\)\\+\\)$"') != [] call s:throw('unsupported option') endif call map(a:args,'s:sub(v:val,"^\\ze[^-]","-")') @@ -3818,10 +3839,11 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort setlocal norelativenumber endif execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) + let nowait = v:version >= 704 ? '' : '' nnoremap :help fugitive-:Gblame nnoremap g? :help fugitive-:Gblame nnoremap q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdelete','^-1','','') - nnoremap gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand("%:p") =~# "^fugitive:[\\/][\\/]"Geditendif','^-1','','') + exe 'nnoremap ' nowait "gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand(''%:p'') =~# ''^fugitive:[\\/][\\/]''Geditendif','^-1','','')" nnoremap :exe BlameCommit("exe 'norm q'edit") nnoremap - :exe BlameJump('') nnoremap P :exe BlameJump('^'.v:count1) @@ -3829,7 +3851,7 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort nnoremap i :exe BlameCommit("exe 'norm q'edit") nnoremap o :exe BlameCommit((&splitbelow ? "botright" : "topleft")." split") nnoremap O :exe BlameCommit("tabedit") - nnoremap p :exe Edit((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), matchstr(getline('.'), '\x\+')) + nnoremap p :exe Open((&splitbelow ? "botright" : "topleft").' pedit', 0, '', matchstr(getline('.'), '\x\+'), [matchstr(getline('.'), '\x\+')]) nnoremap A :exe "vertical resize ".(linechars('.\{-\}\ze [0-9:/+-][0-9:/+ -]* \d\+)')+1+v:count) nnoremap C :exe "vertical resize ".(linechars('^\S\+')+1+v:count) nnoremap D :exe "vertical resize ".(linechars('.\{-\}\ze\d\ze\s\+\d\+)')+1-v:count) @@ -3848,7 +3870,7 @@ function! s:BlameCommit(cmd, ...) abort if line =~# '^0\{4,40\} ' return 'echoerr ' . string('Not Committed Yet') endif - let cmd = s:Edit(a:cmd, 0, '', matchstr(line, '\x\+'), matchstr(line, '\x\+')) + let cmd = s:Open(a:cmd, 0, '', matchstr(line, '\x\+'), [matchstr(line, '\x\+')]) if cmd =~# '^echoerr' return cmd endif @@ -3992,17 +4014,17 @@ endfunction " Section: :Gbrowse -call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,fugitive#Complete Gbrowse :execute s:Browse(0,,,)") +call s:command("-bar -bang -range=0 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse", "Browse") let s:redirects = {} -function! s:Browse(bang,line1,count,...) abort +function! s:BrowseCommand(line1, line2, range, count, bang, mods, reg, arg, args) abort let dir = s:Dir() try let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\=' - if a:0 - let remote = matchstr(join(a:000, ' '),'@\zs\%('.validremote.'\)$') - let rev = substitute(join(a:000, ' '),'@\%('.validremote.'\)$','','') + if len(a:args) + let remote = matchstr(join(a:args, ' '),'@\zs\%('.validremote.'\)$') + let rev = substitute(join(a:args, ' '),'@\%('.validremote.'\)$','','') else let remote = '' let rev = '' @@ -4110,7 +4132,7 @@ function! s:Browse(bang,line1,count,...) abort if v:shell_error let commit = '' endif - if a:count && !a:0 && commit =~# '^\x\{40\}$' + if a:count && empty(a:args) && commit =~# '^\x\{40\}$' let blame_list = tempname() call writefile([commit, ''], blame_list, 'b') let blame_in = tempname() diff --git a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md index f2272398..b01238f0 100644 --- a/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md +++ b/sources_non_forked/vim-go/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,8 @@ -### What did you do? (required. The issue will be **closed** when not provided.) +### What did you do? (required: The issue will be **closed** when not provided) + ### What did you expect to happen? @@ -9,13 +12,18 @@ ### Configuration (**MUST** fill this out): -* vim-go version: +#### vim-go version: -* `vimrc` you used to reproduce (use a *minimal* vimrc with other plugins disabled; do not link to a 2,000 line vimrc): +#### `vimrc` you used to reproduce (use a *minimal* vimrc with other plugins disabled; do not link to a 2,000 line vimrc): +
vimrc
 
-* Vim version (first three lines from `:version`):
+
-* Go version (`go version`): +#### Vim version (first three lines from `:version`): -* Go environment (`go env`): +#### Go version (`go version`): +#### Go environment +
go env Output:
+
+
diff --git a/sources_non_forked/vim-go/CHANGELOG.md b/sources_non_forked/vim-go/CHANGELOG.md index 404cc2d0..53c72cfd 100644 --- a/sources_non_forked/vim-go/CHANGELOG.md +++ b/sources_non_forked/vim-go/CHANGELOG.md @@ -1,11 +1,41 @@ ## unplanned +IMPROVEMENTS: +* Add a new option, `g:go_code_completion_enabled`, to control whether omnifunc + is set. + [[GH-2229]](https://github.com/fatih/vim-go/pull/2229) +* Use build tags with golangci-lint. + [[GH-2261]](https://github.com/fatih/vim-go/pull/2261) +* Allow debugging of packages outside of GOPATH without a go.mod file. + [[GH-2269]](https://github.com/fatih/vim-go/pull/2269) + +BUG FIXES: +* display info about function and function types whose parameters are + `interface{}` without truncating the function signature. + [[GH-2244]](https://github.com/fatih/vim-go/pull/2244) +* install tools that require GOPATH mode when in module mode. + [[GH-2253]](https://github.com/fatih/vim-go/pull/2253) +* Detect GOPATH when starting `gopls` + [[GH-2255]](https://github.com/fatih/vim-go/pull/2255) +* Handle `gopls` responses in the same window from which the respective request + originated. + [[GH-2266]](https://github.com/fatih/vim-go/pull/2266) +* Show completion matches from gocode. + [[GH-2267]](https://github.com/fatih/vim-go/pull/2267) +* Show the completion preview window. + [[GH-2268]](https://github.com/fatih/vim-go/pull/2268) +* Set the anchor for method documentation correctly. + [[GH-2276]](https://github.com/fatih/vim-go/pull/2276) + +## 1.20 - (April 22, 2019) + FEATURES: * ***gopls support!*** * use gopls for autocompletion by default in Vim8 and Neovim. * use gopls for `:GoDef` by setting `g:go_def_mode='gopls'`. + * use gopls for `:GoInfo` by setting `g:go_info_mode='gopls'`. * Add support for golangci-lint. - * set `g:go_metalinter_command='golanci-lint'` to use golangci-lint instead + * set `g:go_metalinter_command='golangci-lint'` to use golangci-lint instead of gometalinter. * New `:GoDefType` command to jump to a type definition from an instance of the type. @@ -60,6 +90,19 @@ IMPROVEMENTS: [[GH-2172]](https://github.com/fatih/vim-go/pull/2172) * Add support for golangci-lint. [[GH-2182]](https://github.com/fatih/vim-go/pull/2182) +* Show hover balloon using gopls instead of gocode. + [[GH-2202]](https://github.com/fatih/vim-go/pull/2202) +* Add a new option, `g:go_debug_log_output`, to control logging with the + debugger. + [[GH-2203]](https://github.com/fatih/vim-go/pull/2203) +* Do not jump to quickfix or location list window when bang is used for async + jobs or linting. + [[GH-2205]](https://github.com/fatih/vim-go/pull/2205) +* Tab complete package names for commands from vendor directories and in + modules. + [[GH-2213]](https://github.com/fatih/vim-go/pull/2213) +* Add support for `gopls` to `g:go_info_mode`. + [[GH-2224]](https://github.com/fatih/vim-go/pull/2224) BUG FIXES: * Fix opening of non-existent file from `:GoDeclsDir` when the current @@ -93,6 +136,10 @@ BUG FIXES: [[GH-2189]](https://github.com/fatih/vim-go/pull/2189) * Highlight pre-release and metadata in versions in go.mod. [[GH-2192]](https://github.com/fatih/vim-go/pull/2192) +* Handle runtime panics from `:GoRun` when using Neovim's terminal. + [[GH-2209]](https://github.com/fatih/vim-go/pull/2209) +* Fix adding tag option when a tag is added. + [[GH-2227]](https://github.com/fatih/vim-go/pull/2227) ## 1.19 - (November 4, 2018) diff --git a/sources_non_forked/vim-go/Dockerfile b/sources_non_forked/vim-go/Dockerfile index 7f03ba71..2408dfdf 100644 --- a/sources_non_forked/vim-go/Dockerfile +++ b/sources_non_forked/vim-go/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.1 +FROM golang:1.12.4 RUN apt-get update -y && \ apt-get install -y build-essential curl git libncurses5-dev python3-pip && \ diff --git a/sources_non_forked/vim-go/autoload/go/cmd.vim b/sources_non_forked/vim-go/autoload/go/cmd.vim index 3d06336e..fdf22990 100644 --- a/sources_non_forked/vim-go/autoload/go/cmd.vim +++ b/sources_non_forked/vim-go/autoload/go/cmd.vim @@ -115,7 +115,7 @@ function! go#cmd#RunTerm(bang, mode, files) abort else let cmd .= go#util#Shelljoin(map(copy(a:files), "expand(v:val)"), 1) endif - call go#term#newmode(a:bang, cmd, a:mode) + call go#term#newmode(a:bang, cmd, s:runerrorformat(), a:mode) endfunction " Run runs the current file (and their dependencies if any) and outputs it. @@ -167,21 +167,25 @@ function! go#cmd#Run(bang, ...) abort let l:listtype = go#list#Type("GoRun") try + + " backup user's errorformat, will be restored once we are finished + let l:old_errorformat = &errorformat + let &errorformat = s:runerrorformat() if l:listtype == "locationlist" exe 'lmake!' else exe 'make!' endif finally + "restore errorformat + let &errorformat = l:old_errorformat let &makeprg = default_makeprg endtry - let items = go#list#Get(l:listtype) - let errors = go#util#FilterValids(items) + let l:errors = go#list#Get(l:listtype) - call go#list#Populate(l:listtype, errors, &makeprg) - call go#list#Window(l:listtype, len(errors)) - if !empty(errors) && !a:bang + call go#list#Window(l:listtype, len(l:errors)) + if !empty(l:errors) && !a:bang call go#list#JumpToFirst(l:listtype) endif @@ -278,6 +282,12 @@ function! go#cmd#Generate(bang, ...) abort endfunction +function! s:runerrorformat() + let l:panicaddress = "%\\t%#%f:%l +0x%[0-9A-Fa-f]%\\+" + let l:errorformat = '%A' . l:panicaddress . "," . &errorformat + return l:errorformat +endfunction + " --------------------- " | Vim job callbacks | " --------------------- diff --git a/sources_non_forked/vim-go/autoload/go/complete.vim b/sources_non_forked/vim-go/autoload/go/complete.vim index e693ee65..072153ea 100644 --- a/sources_non_forked/vim-go/autoload/go/complete.vim +++ b/sources_non_forked/vim-go/autoload/go/complete.vim @@ -93,22 +93,6 @@ endfunction function! s:async_info(echo, showstatus) let state = {'echo': a:echo} - function! s:complete(job, exit_status, messages) abort dict - if a:exit_status != 0 - return - endif - - if &encoding != 'utf-8' - let i = 0 - while i < len(a:messages) - let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding) - let i += 1 - endwhile - endif - - let result = s:info_filter(self.echo, join(a:messages, "\n")) - call s:info_complete(self.echo, result) - endfunction " explicitly bind complete to state so that within it, self will " always refer to state. See :help Partial for more information. let state.complete = function('s:complete', [], state) @@ -151,6 +135,23 @@ function! s:async_info(echo, showstatus) call go#job#Start(cmd, opts) endfunction +function! s:complete(job, exit_status, messages) abort dict + if a:exit_status != 0 + return + endif + + if &encoding != 'utf-8' + let i = 0 + while i < len(a:messages) + let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding) + let i += 1 + endwhile + endif + + let result = s:info_filter(self.echo, join(a:messages, "\n")) + call s:info_complete(self.echo, result) +endfunction + function! s:gocodeFile() let file = tempname() call writefile(go#util#GetLines(), file) @@ -241,8 +242,7 @@ function! go#complete#GocodeComplete(findstart, base) abort if s =~ '[(){}\{\}]' return map(copy(s:completions[1]), 's:trim_bracket(v:val)') endif - - return s:completions[1] + return s:completions endif endfunction diff --git a/sources_non_forked/vim-go/autoload/go/config.vim b/sources_non_forked/vim-go/autoload/go/config.vim index 8af2840b..b325c29e 100644 --- a/sources_non_forked/vim-go/autoload/go/config.vim +++ b/sources_non_forked/vim-go/autoload/go/config.vim @@ -48,7 +48,7 @@ function! go#config#TermMode() abort endfunction function! go#config#TermEnabled() abort - return get(g:, 'go_term_enabled', 0) + return has('nvim') && get(g:, 'go_term_enabled', 0) endfunction function! go#config#SetTermEnabled(value) abort @@ -210,6 +210,10 @@ function! go#config#DebugCommands() abort return g:go_debug_commands endfunction +function! go#config#DebugLogOutput() abort + return get(g:, 'go_debug_log_output', 'debugger, rpc') +endfunction + function! go#config#LspLog() abort " make sure g:go_lsp_log is set so that it can be added to easily. let g:go_lsp_log = get(g:, 'go_lsp_log', []) @@ -462,6 +466,10 @@ function! go#config#EchoGoInfo() abort return get(g:, "go_echo_go_info", 1) endfunction +function! go#config#CodeCompletionEnabled() abort + return get(g:, "go_code_completion_enabled", 1) +endfunction + " Set the default value. A value of "1" is a shortcut for this, for " compatibility reasons. if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 diff --git a/sources_non_forked/vim-go/autoload/go/debug.vim b/sources_non_forked/vim-go/autoload/go/debug.vim index 22999544..e2d0b9fa 100644 --- a/sources_non_forked/vim-go/autoload/go/debug.vim +++ b/sources_non_forked/vim-go/autoload/go/debug.vim @@ -12,7 +12,6 @@ if !exists('s:state') \ 'localVars': {}, \ 'functionArgs': {}, \ 'message': [], - \ 'is_test': 0, \} if go#util#HasDebug('debugger-state') @@ -282,7 +281,7 @@ function! go#debug#Stop() abort silent! exe bufwinnr(bufnr('__GODEBUG_OUTPUT__')) 'wincmd c' if has('balloon_eval') - let &noballooneval=s:ballooneval + let &ballooneval=s:ballooneval let &balloonexpr=s:balloonexpr endif @@ -507,7 +506,7 @@ function! s:out_cb(ch, msg) abort if has('nvim') let s:state['data'] = [] let l:state = {'databuf': ''} - + " 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) @@ -589,50 +588,41 @@ function! go#debug#Start(is_test, ...) abort endif try - if len(a:000) > 0 - let l:pkgname = a:1 - if l:pkgname[0] == '.' - 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:] - endif - let l:cmd = [ \ dlv, \ (a:is_test ? 'test' : 'debug'), - \ l:pkgname, + \] + + " append the package when it's given. + if len(a:000) > 0 + let l:pkgname = go#package#FromPath(a:1) + if l:pkgname is -1 + call go#util#EchoError('could not determine package name') + return + endif + + let l:cmd += [l:pkgname] + endif + + let l:cmd += [ \ '--output', tempname(), \ '--headless', \ '--api-version', '2', - \ '--log', '--log-output', 'debugger,rpc', \ '--listen', go#config#DebugAddress(), \] + let l:debugLogOutput = go#config#DebugLogOutput() + if l:debugLogOutput != '' + let cmd += ['--log', '--log-output', l:debugLogOutput] + endif - let buildtags = go#config#BuildTags() + let l:buildtags = go#config#BuildTags() if buildtags isnot '' let l:cmd += ['--build-flags', '--tags=' . buildtags] endif - let l:cmd += l:args + + if len(a:000) > 1 + let l:cmd += ['--'] + a:000[1:] + endif let s:state['message'] = [] let l:opts = { diff --git a/sources_non_forked/vim-go/autoload/go/doc.vim b/sources_non_forked/vim-go/autoload/go/doc.vim index 5449bf7b..3960a1be 100644 --- a/sources_non_forked/vim-go/autoload/go/doc.vim +++ b/sources_non_forked/vim-go/autoload/go/doc.vim @@ -31,8 +31,12 @@ function! go#doc#OpenBrowser(...) abort let godoc_url = go#config#DocUrl() let godoc_url .= "/" . import - if decl !~ "^package" - let godoc_url .= "#" . name + if decl !~ '^package' + let anchor = name + if decl =~ '^func (' + let anchor = substitute(decl, '^func ([^ ]\+ \*\?\([^)]\+\)) ' . name . '(.*', '\1', '') . "." . name + endif + let godoc_url .= "#" . anchor endif call go#util#OpenBrowser(godoc_url) diff --git a/sources_non_forked/vim-go/autoload/go/guru.vim b/sources_non_forked/vim-go/autoload/go/guru.vim index 95c00caf..8ff3b3f3 100644 --- a/sources_non_forked/vim-go/autoload/go/guru.vim +++ b/sources_non_forked/vim-go/autoload/go/guru.vim @@ -246,7 +246,7 @@ function! go#guru#DescribeInfo(showstatus) abort \ 'selected': -1, \ 'needs_scope': 0, \ 'custom_parse': function('s:info'), - \ 'disable_progress': 1, + \ 'disable_progress': a:showstatus == 0, \ } call s:run_guru(args) diff --git a/sources_non_forked/vim-go/autoload/go/issue.vim b/sources_non_forked/vim-go/autoload/go/issue.vim index 38fcd61b..65db9d80 100644 --- a/sources_non_forked/vim-go/autoload/go/issue.vim +++ b/sources_non_forked/vim-go/autoload/go/issue.vim @@ -5,7 +5,7 @@ set cpo&vim let s:templatepath = go#util#Join(expand(':p:h:h:h'), '.github', 'ISSUE_TEMPLATE.md') function! go#issue#New() abort - let body = go#uriEncode(s:issuebody()) + let body = go#uri#Encode(s:issuebody()) let url = "https://github.com/fatih/vim-go/issues/new?body=" . l:body call go#util#OpenBrowser(l:url) endfunction diff --git a/sources_non_forked/vim-go/autoload/go/job.vim b/sources_non_forked/vim-go/autoload/go/job.vim index 4c4a8495..328572ef 100644 --- a/sources_non_forked/vim-go/autoload/go/job.vim +++ b/sources_non_forked/vim-go/autoload/go/job.vim @@ -214,7 +214,9 @@ function! go#job#Options(args) " the job was started. if self.winid == l:winid call go#list#Window(l:listtype, len(errors)) - if !self.bang + if self.bang + call win_gotoid(l:winid) + else call go#list#JumpToFirst(l:listtype) endif endif @@ -489,7 +491,9 @@ function! s:neocb(mode, ch, buf, data, callback) let l:buf = '' - " a single empty string means EOF was reached. + " A single empty string means EOF was reached. The first item will never be + " an empty string except for when it's the only item and is signaling that + " EOF was reached. if len(a:data) == 1 && a:data[0] == '' " when there's nothing buffered, return early so that an " erroneous message will not be added. diff --git a/sources_non_forked/vim-go/autoload/go/lint.vim b/sources_non_forked/vim-go/autoload/go/lint.vim index 0e645b79..d56f3da8 100644 --- a/sources_non_forked/vim-go/autoload/go/lint.vim +++ b/sources_non_forked/vim-go/autoload/go/lint.vim @@ -86,15 +86,18 @@ function! go#lint#Gometa(bang, autosave, ...) abort call go#list#Clean(l:listtype) echon "vim-go: " | echohl Function | echon "[metalinter] PASS" | echohl None else + let l:winid = win_getid(winnr()) " Parse and populate our location list call go#list#ParseFormat(l:listtype, errformat, split(out, "\n"), 'GoMetaLinter') let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !a:autosave && !a:bang - call go#list#JumpToFirst(l:listtype) + if a:autosave || a:bang + call win_gotoid(l:winid) + return endif + call go#list#JumpToFirst(l:listtype) endif endfunction @@ -112,13 +115,18 @@ function! go#lint#Golint(bang, ...) abort return endif + let l:winid = win_getid(winnr()) let l:listtype = go#list#Type("GoLint") 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)) - if !a:bang - call go#list#JumpToFirst(l:listtype) + + if a:bang + call win_gotoid(l:winid) + return endif + + call go#list#JumpToFirst(l:listtype) endfunction " Vet calls 'go vet' on the current directory. Any warnings are populated in @@ -138,12 +146,15 @@ function! go#lint#Vet(bang, ...) abort let l:listtype = go#list#Type("GoVet") if l:err != 0 + let l:winid = win_getid(winnr()) let errorformat = "%-Gexit status %\\d%\\+," . &errorformat call go#list#ParseFormat(l:listtype, l:errorformat, out, "GoVet") let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) if !empty(errors) && !a:bang call go#list#JumpToFirst(l:listtype) + else + call win_gotoid(l:winid) endif else call go#list#Clean(l:listtype) @@ -171,6 +182,7 @@ function! go#lint#Errcheck(bang, ...) abort let l:listtype = go#list#Type("GoErrCheck") if l:err != 0 + let l:winid = win_getid(winnr()) let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" " Parse and populate our location list @@ -187,6 +199,8 @@ function! go#lint#Errcheck(bang, ...) abort call go#list#Window(l:listtype, len(errors)) if !a:bang call go#list#JumpToFirst(l:listtype) + else + call win_gotoid(l:winid) endif endif else @@ -255,11 +269,13 @@ function! s:golangcilintcmd(bin_path) let cmd = [a:bin_path] let cmd += ["run"] let cmd += ["--print-issued-lines=false"] + let cmd += ['--build-tags', go#config#BuildTags()] let cmd += ["--disable-all"] " do not use the default exclude patterns, because doing so causes golint " problems about missing doc strings to be ignored and other things that " golint identifies. let cmd += ["--exclude-use-default=false"] + return cmd endfunction diff --git a/sources_non_forked/vim-go/autoload/go/lsp.vim b/sources_non_forked/vim-go/autoload/go/lsp.vim index d8bfa3bf..47205759 100644 --- a/sources_non_forked/vim-go/autoload/go/lsp.vim +++ b/sources_non_forked/vim-go/autoload/go/lsp.vim @@ -7,8 +7,7 @@ scriptencoding utf-8 let s:lspfactory = {} function! s:lspfactory.get() dict abort - if !has_key(self, 'current') - " TODO(bc): check that the lsp is still running. + if !has_key(self, 'current') || empty(self.current) let self.current = s:newlsp() endif @@ -21,7 +20,7 @@ function! s:lspfactory.reset() dict abort endif endfunction -function! s:newlsp() +function! s:newlsp() abort if !go#util#has_job() " TODO(bc): start the server in the background using a shell that waits for the right output before returning. call go#util#EchoError('This feature requires either Vim 8.0.0087 or newer with +job or Neovim.') @@ -115,16 +114,27 @@ function! s:newlsp() try let l:handler = self.handlers[l:response.id] + let l:winid = win_getid(winnr()) + " Always set the active window to the window that was active when + " the request was sent. Among other things, this makes sure that + " the correct window's location list will be populated when the + " list type is 'location' and the user has moved windows since + " sending the reques. + call win_gotoid(l:handler.winid) + if has_key(l:response, 'error') call l:handler.requestComplete(0) - call go#util#EchoError(l:response.error.message) if has_key(l:handler, 'error') call call(l:handler.error, [l:response.error.message]) + else + call go#util#EchoError(l:response.error.message) endif + call win_gotoid(l:winid) return endif call l:handler.requestComplete(1) call call(l:handler.handleResult, [l:response.result]) + call win_gotoid(l:winid) finally call remove(self.handlers, l:response.id) endtry @@ -149,9 +159,19 @@ function! s:newlsp() if !self.last_request_id " TODO(bc): run a server per module and one per GOPATH? (may need to " keep track of servers by rootUri). - let l:msg = self.newMessage(go#lsp#message#Initialize(getcwd())) + let l:wd = go#util#ModuleRoot() + if l:wd == -1 + call go#util#EchoError('could not determine appropriate working directory for gopls') + return + endif - let l:state = s:newHandlerState('gopls') + if l:wd == '' + let l:wd = getcwd() + endif + + let l:msg = self.newMessage(go#lsp#message#Initialize(l:wd)) + + let l:state = s:newHandlerState('') let l:state.handleResult = funcref('self.handleInitializeResult', [], l:self) let self.handlers[l:msg.id] = l:state @@ -251,10 +271,10 @@ function! s:newlsp() return l:lsp endfunction -function! s:noop() +function! s:noop(...) abort endfunction -function! s:newHandlerState(statustype) +function! s:newHandlerState(statustype) abort let l:state = { \ 'winid': win_getid(winnr()), \ 'statustype': a:statustype, @@ -324,7 +344,7 @@ endfunction " list of strings in the form 'file:line:col: message'. handler will be " attached to a dictionary that manages state (statuslines, sets the winid, " etc.) -function! go#lsp#Definition(fname, line, col, handler) +function! go#lsp#Definition(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -346,7 +366,7 @@ endfunction " list of strings in the form 'file:line:col: message'. handler will be " attached to a dictionary that manages state (statuslines, sets the winid, " etc.) -function! go#lsp#TypeDef(fname, line, col, handler) +function! go#lsp#TypeDef(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -363,11 +383,15 @@ function! s:typeDefinitionHandler(next, msg) abort dict call call(a:next, l:args) endfunction -function! go#lsp#DidOpen(fname) +function! go#lsp#DidOpen(fname) abort if get(b:, 'go_lsp_did_open', 0) return endif + if !filereadable(a:fname) + return + endif + let l:lsp = s:lspfactory.get() let l:msg = go#lsp#message#DidOpen(fnamemodify(a:fname, ':p'), join(go#util#GetLines(), "\n") . "\n") let l:state = s:newHandlerState('') @@ -377,9 +401,18 @@ function! go#lsp#DidOpen(fname) let b:go_lsp_did_open = 1 endfunction -function! go#lsp#DidChange(fname) - if get(b:, 'go_lsp_did_open', 0) - return go#lsp#DidOpen(a:fname) +function! go#lsp#DidChange(fname) abort + " DidChange is called even when fname isn't open in a buffer (e.g. via + " go#lsp#Info); don't report the file as open or as having changed when it's + " not actually a buffer. + if bufnr(a:fname) == -1 + return + endif + + call go#lsp#DidOpen(a:fname) + + if !filereadable(a:fname) + return endif let l:lsp = s:lspfactory.get() @@ -389,7 +422,11 @@ function! go#lsp#DidChange(fname) call l:lsp.sendMessage(l:msg, l:state) endfunction -function! go#lsp#DidClose(fname) +function! go#lsp#DidClose(fname) abort + if !filereadable(a:fname) + return + endif + if !get(b:, 'go_lsp_did_open', 0) return endif @@ -403,7 +440,7 @@ function! go#lsp#DidClose(fname) let b:go_lsp_did_open = 0 endfunction -function! go#lsp#Completion(fname, line, col, handler) +function! go#lsp#Completion(fname, line, col, handler) abort call go#lsp#DidChange(a:fname) let l:lsp = s:lspfactory.get() @@ -420,7 +457,7 @@ function! s:completionHandler(next, msg) abort dict for l:item in a:msg.items let l:match = {'abbr': l:item.label, 'word': l:item.textEdit.newText, 'info': '', 'kind': go#lsp#completionitemkind#Vim(l:item.kind)} if has_key(l:item, 'detail') - let l:item.info = l:item.detail + let l:match.info = l:item.detail endif if has_key(l:item, 'documentation') @@ -437,6 +474,80 @@ function! s:completionErrorHandler(next, error) abort dict call call(a:next, [[]]) endfunction +function! go#lsp#Hover(fname, line, col, handler) abort + call go#lsp#DidChange(a:fname) + + let l:lsp = s:lspfactory.get() + let l:msg = go#lsp#message#Hover(a:fname, a:line, a:col) + let l:state = s:newHandlerState('') + let l:state.handleResult = funcref('s:hoverHandler', [function(a:handler, [], l:state)], l:state) + let l:state.error = funcref('s:noop') + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:hoverHandler(next, msg) abort dict + let l:content = split(a:msg.contents.value, '; ') + if len(l:content) > 1 + let l:curly = stridx(l:content[0], '{') + let l:content = extend([l:content[0][0:l:curly]], map(extend([l:content[0][l:curly+1:]], l:content[1:]), '"\t" . v:val')) + let l:content[len(l:content)-1] = '}' + endif + + let l:args = [l:content] + call call(a:next, l:args) +endfunction + +function! go#lsp#Info(showstatus) + let l:fname = expand('%:p') + let [l:line, l:col] = getpos('.')[1:2] + + call go#lsp#DidChange(l:fname) + + let l:lsp = s:lspfactory.get() + + if a:showstatus + let l:state = s:newHandlerState('info') + else + let l:state = s:newHandlerState('') + endif + + let l:state.handleResult = funcref('s:infoDefinitionHandler', [function('s:info', []), a:showstatus], l:state) + let l:state.error = funcref('s:noop') + let l:msg = go#lsp#message#Definition(l:fname, l:line, l:col) + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:infoDefinitionHandler(next, showstatus, msg) abort dict + " gopls returns a []Location; just take the first one. + let l:msg = a:msg[0] + + let l:fname = go#path#FromURI(l:msg.uri) + let l:line = l:msg.range.start.line+1 + let l:col = l:msg.range.start.character+1 + + let l:lsp = s:lspfactory.get() + let l:msg = go#lsp#message#Hover(l:fname, l:line, l:col) + + if a:showstatus + let l:state = s:newHandlerState('info') + else + let l:state = s:newHandlerState('') + endif + + let l:state.handleResult = funcref('s:hoverHandler', [function('s:info', [], l:state)], l:state) + let l:state.error = funcref('s:noop') + call l:lsp.sendMessage(l:msg, l:state) +endfunction + +function! s:info(content) abort dict + let l:content = a:content[0] + " strip off the method set and fields of structs and interfaces. + if l:content =~# '^type [^ ]\+ \(struct\|interface\)' + let l:content = substitute(l:content, '{.*', '', '') + endif + call go#util#ShowInfo(l:content) +endfunction + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save diff --git a/sources_non_forked/vim-go/autoload/go/lsp/message.vim b/sources_non_forked/vim-go/autoload/go/lsp/message.vim index c182a56d..63981854 100644 --- a/sources_non_forked/vim-go/autoload/go/lsp/message.vim +++ b/sources_non_forked/vim-go/autoload/go/lsp/message.vim @@ -2,7 +2,7 @@ let s:cpo_save = &cpo set cpo&vim -function! go#lsp#message#Initialize(wd) +function! go#lsp#message#Initialize(wd) abort return { \ 'notification': 0, \ 'method': 'initialize', @@ -11,13 +11,17 @@ function! go#lsp#message#Initialize(wd) \ 'rootUri': go#path#ToURI(a:wd), \ 'capabilities': { \ 'workspace': {}, - \ 'textDocument': {} + \ 'textDocument': { + \ 'hover': { + \ 'contentFormat': ['plaintext'], + \ }, + \ } \ } \ } \ } endfunction -function! go#lsp#message#Definition(file, line, col) +function! go#lsp#message#Definition(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/definition', @@ -30,8 +34,7 @@ function! go#lsp#message#Definition(file, line, col) \ } endfunction - -function! go#lsp#message#TypeDefinition(file, line, col) +function! go#lsp#message#TypeDefinition(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/typeDefinition', @@ -44,7 +47,7 @@ function! go#lsp#message#TypeDefinition(file, line, col) \ } endfunction -function! go#lsp#message#DidOpen(file, content) +function! go#lsp#message#DidOpen(file, content) abort return { \ 'notification': 1, \ 'method': 'textDocument/didOpen', @@ -58,7 +61,7 @@ function! go#lsp#message#DidOpen(file, content) \ } endfunction -function! go#lsp#message#DidChange(file, content) +function! go#lsp#message#DidChange(file, content) abort return { \ 'notification': 1, \ 'method': 'textDocument/didChange', @@ -75,7 +78,7 @@ function! go#lsp#message#DidChange(file, content) \ } endfunction -function! go#lsp#message#DidClose(file) +function! go#lsp#message#DidClose(file) abort return { \ 'notification': 1, \ 'method': 'textDocument/didClose', @@ -87,7 +90,7 @@ function! go#lsp#message#DidClose(file) \ } endfunction -function! go#lsp#message#Completion(file, line, col) +function! go#lsp#message#Completion(file, line, col) abort return { \ 'notification': 0, \ 'method': 'textDocument/completion', @@ -100,7 +103,20 @@ function! go#lsp#message#Completion(file, line, col) \ } endfunction -function! s:position(line, col) +function! go#lsp#message#Hover(file, line, col) abort + return { + \ 'notification': 0, + \ 'method': 'textDocument/hover', + \ 'params': { + \ 'textDocument': { + \ 'uri': go#path#ToURI(a:file) + \ }, + \ 'position': s:position(a:line, a:col), + \ } + \ } +endfunction + +function! s:position(line, col) abort return {'line': a:line - 1, 'character': a:col-1} endfunction diff --git a/sources_non_forked/vim-go/autoload/go/mod.vim b/sources_non_forked/vim-go/autoload/go/mod.vim index 021f7f92..ab36d0b5 100644 --- a/sources_non_forked/vim-go/autoload/go/mod.vim +++ b/sources_non_forked/vim-go/autoload/go/mod.vim @@ -7,7 +7,7 @@ let s:go_major_version = "" function! go#mod#Format() abort " go mod only exists in `v1.11` if empty(s:go_major_version) - let tokens = matchlist(go#util#System("go version"), '\d\+.\(\d\+\)\(\.\d\+\)\? ') + let tokens = matchlist(go#util#Exec(['go', 'version']), '\d\+.\(\d\+\)\(\.\d\+\)\? ') let s:go_major_version = str2nr(tokens[1]) endif diff --git a/sources_non_forked/vim-go/autoload/go/package.vim b/sources_non_forked/vim-go/autoload/go/package.vim index 898ef535..796f62d7 100644 --- a/sources_non_forked/vim-go/autoload/go/package.vim +++ b/sources_non_forked/vim-go/autoload/go/package.vim @@ -32,7 +32,7 @@ if len(s:goarch) == 0 endif endif -function! go#package#Paths() abort +function! s:paths() abort let dirs = [] if !exists("s:goroot") @@ -58,6 +58,58 @@ function! go#package#Paths() abort return dirs endfunction +function! s:module() abort + let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Dir}}']) + if l:err != 0 + return {} + endif + let l:dir = split(l:out, '\n')[0] + + let [l:out, l:err] = go#util#ExecInDir(['go', 'list', '-m', '-f', '{{.Path}}']) + if l:err != 0 + return {} + endif + let l:path = split(l:out, '\n')[0] + + return {'dir': l:dir, 'path': l:path} +endfunction + +function! s:vendordirs() abort + let l:vendorsuffix = go#util#PathSep() . 'vendor' + let l:module = s:module() + if empty(l:module) + let [l:root, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Root}}']) + if l:err != 0 + return [] + endif + let l:root = split(l:root, '\n')[0] . go#util#PathSep() . 'src' + + let [l:dir, l:err] = go#util#ExecInDir(['go', 'list', '-f', '{{.Dir}}']) + if l:err != 0 + return [] + endif + let l:dir = split(l:dir, '\n')[0] + + let l:vendordirs = [] + while l:dir != l:root + let l:vendordir = l:dir . l:vendorsuffix + if isdirectory(l:vendordir) + let l:vendordirs = add(l:vendordirs, l:vendordir) + endif + + let l:dir = fnamemodify(l:dir, ':h') + endwhile + + return l:vendordirs + endif + + let l:vendordir = l:module.dir . l:vendorsuffix + if !isdirectory(l:vendordir) + return [] + endif + return [l:vendordir] +endfunction + let s:import_paths = {} " ImportPath returns the import path of the package for current buffer. function! go#package#ImportPath() abort @@ -85,7 +137,9 @@ function! go#package#ImportPath() abort endfunction -" FromPath returns the import path of arg. +" go#package#FromPath returns the import path of arg. -1 is returned when arg +" does not specify a package. -2 is returned when arg is a relative path +" outside of GOPATH and not in a module. function! go#package#FromPath(arg) abort let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let l:dir = getcwd() @@ -104,10 +158,10 @@ function! go#package#FromPath(arg) abort 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 + " go list returns '_CURRENTDIRECTORY' if the directory is neither in GOPATH + " nor in a module. Check it and retun an error if that is the case if l:importpath[0] ==# '_' - return -1 + return -2 endif return l:importpath @@ -144,33 +198,80 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos) abort return go#package#CompleteMembers(words[1], words[2]) endif - let dirs = go#package#Paths() + let dirs = s:paths() + let module = s:module() - if len(dirs) == 0 + if len(dirs) == 0 && empty(module) " should not happen return [] endif + let vendordirs = s:vendordirs() + 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$' + let root = add(root, expand(dir . '/src'), ) + let root = extend(root, vendordirs) + let root = add(root, module) + for item in root + " item may be a dictionary when operating in a module. + if type(item) == type({}) + if empty(item) continue endif - let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), + let dir = item.dir + let path = item.path + else + let dir = item + let path = item + endif + + if !empty(module) && dir ==# module.dir + if stridx(a:ArgLead, module.path) == 0 + if len(a:ArgLead) != len(module.path) + let glob = globpath(module.dir, substitute(a:ArgLead, module.path . '/\?', '', '').'*') + else + let glob = module.dir + endif + elseif stridx(module.path, a:ArgLead) == 0 && stridx(module.path, '/', len(a:ArgLead)) < 0 + " use the module directory when a:ArgLead is contained in + " module.path and module.path does not have any path segments after + " a:ArgLead. + let glob = module.dir + else + continue + endif + else + let glob = globpath(dir, a:ArgLead.'*') + endif + for candidate in split(glob) + if isdirectory(candidate) + " TODO(bc): use wildignore instead of filtering out vendor + " directories manually? + if fnamemodify(candidate, ':t') == 'vendor' + continue + endif + let candidate .= '/' + elseif candidate !~ '\.a$' + continue + endif + + if dir !=# path + let candidate = substitute(candidate, '^' . dir, path, 'g') + else + let candidate = candidate[len(dir)+1:] + endif + " replace a backslash with a forward slash and drop .a suffixes + let candidate = substitute(substitute(candidate, '[\\]', '/', 'g'), \ '\.a$', '', 'g') " without this the result can have duplicates in form of " 'encoding/json' and '/encoding/json/' - let i = go#util#StripPathSep(i) + let candidate = go#util#StripPathSep(candidate) - let ret[i] = i + let ret[candidate] = candidate endfor endfor endfor diff --git a/sources_non_forked/vim-go/autoload/go/package_test.vim b/sources_non_forked/vim-go/autoload/go/package_test.vim new file mode 100644 index 00000000..4938d480 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/package_test.vim @@ -0,0 +1,58 @@ +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim + +func! Test_Complete_GOPATH_simple() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package', ['package']) +endfunc + +func! Test_Complete_Module_simple() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package', ['package']) +endfunc + +func! Test_Complete_GOPATH_subdirs() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package/', ['package/bar', 'package/baz']) +endfunc + +func! Test_Complete_Module_subdirs() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package/', ['package/bar', 'package/baz']) +endfunc + +func! Test_Complete_GOPATH_baronly() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('package/bar', ['package/bar']) +endfunc + +func! Test_Complete_Module_baronly() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('package/bar', ['package/bar']) +endfunc + +func! Test_Complete_GOPATH_vendor() abort + let $GOPATH = fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package' + silent exe 'edit ' . $GOPATH . '/src/package/package.go' + call s:complete('foo', ['foo']) +endfunc + +func! Test_Complete_Module_vendor() abort + silent exe 'edit ' . fnameescape(fnamemodify(getcwd(), ':p')) . 'test-fixtures/package/src/package/package.go' + call s:complete('foo', ['foo']) +endfunc + +func! s:complete(arglead, expected) abort + let l:candidates = go#package#Complete(a:arglead, '', 1) + call assert_equal(a:expected, l:candidates) +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/path.vim b/sources_non_forked/vim-go/autoload/go/path.vim index 3c6173de..656afec6 100644 --- a/sources_non_forked/vim-go/autoload/go/path.vim +++ b/sources_non_forked/vim-go/autoload/go/path.vim @@ -209,13 +209,18 @@ endfunction " Relative paths cannot be properly converted to a URI; when path is a " relative path, the file scheme will not be prepended. function! go#path#ToURI(path) + let l:absolute = !go#util#IsWin() && a:path[0] is# '/' + let l:prefix = '' let l:path = a:path - if l:path[1:2] is# ':\' - let l:path = '/' . l:path[0:1] . l:path[3:] + + if go#util#IsWin() && l:path[1:2] is# ':\' + let l:absolute = 1 + let l:prefix = '/' . l:path[0:1] + let l:path = l:path[2:] endif return substitute( - \ (l:path[0] is# '/' ? 'file://' : '') . go#uri#EncodePath(l:path), + \ (l:absolute ? 'file://' : '') . l:prefix . go#uri#EncodePath(l:path), \ '\\', \ '/', \ 'g', @@ -229,7 +234,7 @@ function! go#path#FromURI(uri) abort let l:path = go#uri#Decode(l:encoded_path) " If the path is like /C:/foo/bar, it should be C:\foo\bar instead. - if l:path =~# '^/[a-zA-Z]:' + if go#util#IsWin() && l:path =~# '^/[a-zA-Z]:' let l:path = substitute(l:path[1:], '/', '\\', 'g') endif diff --git a/sources_non_forked/vim-go/autoload/go/tags.vim b/sources_non_forked/vim-go/autoload/go/tags.vim index 83751d71..c1239b02 100644 --- a/sources_non_forked/vim-go/autoload/go/tags.vim +++ b/sources_non_forked/vim-go/autoload/go/tags.vim @@ -163,17 +163,17 @@ func s:create_cmd(args) abort endfor endif - " construct options + " default value + if empty(l:tags) + let l:tags = ["json"] + endif + + " construct tags + call extend(cmd, ["-add-tags", join(l:tags, ",")]) + + " construct options if !empty(l:options) call extend(cmd, ["-add-options", join(l:options, ",")]) - else - " default value - if empty(l:tags) - let l:tags = ["json"] - endif - - " construct tags - call extend(cmd, ["-add-tags", join(l:tags, ",")]) endif elseif l:mode == "remove" if empty(l:cmd_args) 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 a311a059..17aec410 100644 --- a/sources_non_forked/vim-go/autoload/go/tags_test.vim +++ b/sources_non_forked/vim-go/autoload/go/tags_test.vim @@ -2,7 +2,7 @@ let s:cpo_save = &cpo set cpo&vim -func! Test_add_tags() abort +func! TestAddTags() abort try let l:tmp = gotest#load_fixture('tags/add_all_input.go') silent call go#tags#run(0, 0, 40, "add", bufname(''), 1) @@ -13,6 +13,28 @@ func! Test_add_tags() abort endfunc +func! TestAddTags_WithOptions() abort + try + let l:tmp = gotest#load_fixture('tags/add_all_input.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') + call gotest#assert_fixture('tags/add_all_golden_options.go') + finally + call delete(l:tmp, 'rf') + endtry +endfunc + +func! TestAddTags_AddOptions() abort + try + let l:tmp = gotest#load_fixture('tags/add_all_input.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json') + call gotest#assert_fixture('tags/add_all_golden.go') + silent call go#tags#run(0, 0, 40, "add", bufname(''), 1, 'json,omitempty') + call gotest#assert_fixture('tags/add_all_golden_options.go') + finally + call delete(l:tmp, 'rf') + endtry +endfunc + func! Test_remove_tags() abort try let l:tmp = gotest#load_fixture('tags/remove_all_input.go') diff --git a/sources_non_forked/vim-go/autoload/go/term.vim b/sources_non_forked/vim-go/autoload/go/term.vim index a835c5b2..d7a463eb 100644 --- a/sources_non_forked/vim-go/autoload/go/term.vim +++ b/sources_non_forked/vim-go/autoload/go/term.vim @@ -4,31 +4,33 @@ 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 - return go#term#newmode(a:bang, a:cmd, go#config#TermMode()) +function! go#term#new(bang, cmd, errorformat) abort + return go#term#newmode(a:bang, a:cmd, a:errorformat, go#config#TermMode()) endfunction -" new creates a new terminal with the given command and window mode. -function! go#term#newmode(bang, cmd, mode) abort - let mode = a:mode - if empty(mode) - let mode = go#config#TermMode() +" go#term#newmode creates a new terminal with the given command and window mode. +function! go#term#newmode(bang, cmd, errorformat, mode) abort + let l:mode = a:mode + if empty(l:mode) + let l:mode = go#config#TermMode() endif - let state = { + let l:state = { \ 'cmd': a:cmd, \ 'bang' : a:bang, \ 'winid': win_getid(winnr()), - \ 'stdout': [] + \ 'stdout': [], + \ 'stdout_buf': '', + \ 'errorformat': a:errorformat, \ } " execute go build in the files directory - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' - let dir = getcwd() + let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' + let l:dir = getcwd() - execute cd . fnameescape(expand("%:p:h")) + execute l:cd . fnameescape(expand("%:p:h")) - execute mode.' __go_term__' + execute l:mode . ' __go_term__' setlocal filetype=goterm setlocal bufhidden=delete @@ -41,83 +43,103 @@ function! go#term#newmode(bang, cmd, mode) abort " " Don't set an on_stderr, because it will be passed the same data as " on_stdout. See https://github.com/neovim/neovim/issues/2836 - let job = { + let l:job = { \ 'on_stdout': function('s:on_stdout', [], state), \ 'on_exit' : function('s:on_exit', [], state), \ } - let state.id = termopen(a:cmd, job) - let state.termwinid = win_getid(winnr()) + let l:state.id = termopen(a:cmd, l:job) + let l:state.termwinid = win_getid(winnr()) - execute cd . fnameescape(dir) + execute l:cd . fnameescape(l:dir) " resize new term if needed. - let height = go#config#TermHeight() - let width = go#config#TermWidth() + let l:height = go#config#TermHeight() + let l:width = go#config#TermWidth() " Adjust the window width or height depending on whether it's a vertical or " horizontal split. - if mode =~ "vertical" || mode =~ "vsplit" || mode =~ "vnew" - exe 'vertical resize ' . width + if l:mode =~ "vertical" || l:mode =~ "vsplit" || l:mode =~ "vnew" + exe 'vertical resize ' . l:width elseif mode =~ "split" || mode =~ "new" - exe 'resize ' . height + exe 'resize ' . l:height endif " we also need to resize the pty, so there you go... - call jobresize(state.id, width, height) + call jobresize(l:state.id, l:width, l:height) - call win_gotoid(state.winid) + call win_gotoid(l:state.winid) - return state.id + return l:state.id endfunction function! s:on_stdout(job_id, data, event) dict abort - call extend(self.stdout, a:data) + " A single empty string means EOF was reached. The first item will never be + " the empty string except for when it's the only item and is signaling that + " EOF was reached. + if len(a:data) == 1 && a:data[0] == '' + " when there's nothing buffered, return early so that an + " erroneous message will not be added. + if self.stdout_buf == '' + return + endif + + let self.stdout = add(self.stdout, self.stdout_buf) + else + let l:data = copy(a:data) + let l:data[0] = self.stdout_buf . l:data[0] + + " The last element may be a partial line; save it for next time. + let self.stdout_buf = l:data[-1] + let self.stdout = extend(self.stdout, l:data[:-2]) + endif endfunction function! s:on_exit(job_id, exit_status, event) dict abort + let l:winid = win_getid(winnr()) + call win_gotoid(self.winid) let l:listtype = go#list#Type("_term") - " usually there is always output so never branch into this clause - if empty(self.stdout) - call s:cleanlist(self.winid, l:listtype) + if a:exit_status == 0 + call go#list#Clean(l:listtype) + call win_gotoid(l:winid) return endif - let errors = go#util#ParseErrors(self.stdout) - let errors = go#util#FilterValids(errors) + call win_gotoid(self.winid) - if !empty(errors) - " close terminal; we don't need it anymore - call win_gotoid(self.termwinid) - close + let l:title = self.cmd + if type(l:title) == v:t_list + let l:title = join(self.cmd) + endif - call win_gotoid(self.winid) + let l:i = 0 + while l:i < len(self.stdout) + let self.stdout[l:i] = substitute(self.stdout[l:i], "\r$", '', 'g') + let l:i += 1 + endwhile - let title = self.cmd - if type(title) == v:t_list - let title = join(self.cmd) - endif - call go#list#Populate(l:listtype, errors, title) - call go#list#Window(l:listtype, len(errors)) - if !self.bang - call go#list#JumpToFirst(l:listtype) - endif + call go#list#ParseFormat(l:listtype, self.errorformat, self.stdout, l:title) + let l:errors = go#list#Get(l:listtype) + call go#list#Window(l:listtype, len(l:errors)) + if empty(l:errors) + call go#util#EchoError( '[' . l:title . '] ' . "FAIL") + call win_gotoid(l:winid) return endif - call s:cleanlist(self.winid, l:listtype) -endfunction + " close terminal; we don't need it anymore + call win_gotoid(self.termwinid) + close! -function! s:cleanlist(winid, listtype) abort - " There are no errors. Clean and close the list. Jump to the window to which - " the location list is attached, close the list, and then jump back to the - " current window. - let winid = win_getid(winnr()) - call win_gotoid(a:winid) - call go#list#Clean(a:listtype) - call win_gotoid(l:winid) + if self.bang + call win_gotoid(l:winid) + return + endif + + call win_gotoid(self.winid) + call go#list#JumpToFirst(l:listtype) endfunction " restore Vi compatibility settings 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 2b3ce1f8..40f0a52a 100644 --- a/sources_non_forked/vim-go/autoload/go/term_test.vim +++ b/sources_non_forked/vim-go/autoload/go/term_test.vim @@ -17,7 +17,7 @@ func! Test_GoTermNewMode() let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) set nosplitright - call go#term#newmode(0, cmd, '') + call go#term#new(0, cmd, &errorformat) let actual = expand('%:p') call assert_equal(actual, l:expected) @@ -41,7 +41,7 @@ func! Test_GoTermNewMode_SplitRight() let cmd = "go run ". go#util#Shelljoin(go#tool#Files()) set splitright - call go#term#newmode(0, cmd, '') + call go#term#new(0, cmd, &errorformat) let actual = expand('%:p') call assert_equal(actual, l:expected) diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/bar/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/baz/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod new file mode 100644 index 00000000..d414eac7 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/go.mod @@ -0,0 +1,3 @@ +module package + +go 1.12 diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go new file mode 100644 index 00000000..50e8d8d3 --- /dev/null +++ b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/package.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("vim-go") +} diff --git a/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep b/sources_non_forked/vim-go/autoload/go/test-fixtures/package/src/package/vendor/foo/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sources_non_forked/vim-go/autoload/go/test.vim b/sources_non_forked/vim-go/autoload/go/test.vim index 492a8838..f33d7d94 100644 --- a/sources_non_forked/vim-go/autoload/go/test.vim +++ b/sources_non_forked/vim-go/autoload/go/test.vim @@ -30,8 +30,8 @@ function! go#test#Test(bang, compile, ...) abort call add(args, printf("-timeout=%s", timeout)) endif - if has('nvim') && go#config#TermEnabled() - call go#term#new(a:bang, ["go"] + args) + if go#config#TermEnabled() + call go#term#new(a:bang, ["go"] + args, s:errorformat()) endif if go#util#has_job() @@ -75,14 +75,17 @@ function! go#test#Test(bang, compile, ...) abort execute cd fnameescape(expand("%:p:h")) if l:err != 0 + let l:winid = win_getid(winnr()) call go#list#ParseFormat(l:listtype, s:errorformat(), split(out, '\n'), l:cmd) let errors = go#list#Get(l:listtype) call go#list#Window(l:listtype, len(errors)) - if !empty(errors) && !a:bang - call go#list#JumpToFirst(l:listtype) - elseif empty(errors) + if empty(errors) " failed to parse errors, output the original content call go#util#EchoError(out) + elseif a:bang + call win_gotoid(l:winid) + else + call go#list#JumpToFirst(l:listtype) endif else call go#list#Clean(l:listtype) 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 500476ca..28d7993c 100644 --- a/sources_non_forked/vim-go/autoload/go/test_test.vim +++ b/sources_non_forked/vim-go/autoload/go/test_test.vim @@ -66,9 +66,9 @@ endfunc func! Test_GoTestShowName() abort let expected = [ \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld'}, - \ {'lnum': 6, 'bufnr': 9, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'}, + \ {'lnum': 6, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'so long'}, \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'TestHelloWorld/sub'}, - \ {'lnum': 9, 'bufnr': 9, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'}, + \ {'lnum': 9, 'bufnr': 7, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'thanks for all the fish'}, \ ] let g:go_test_show_name=1 @@ -78,14 +78,14 @@ endfunc func! Test_GoTestVet() abort let expected = [ - \ {'lnum': 6, 'bufnr': 16, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'}, + \ {'lnum': 6, 'bufnr': 10, 'col': 2, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'}, \ ] call s:test('veterror/veterror.go', expected) endfunc func! Test_GoTestTestCompilerError() abort let expected = [ - \ {'lnum': 10, 'bufnr': 11, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'}, + \ {'lnum': 10, 'bufnr': 8, 'col': 16, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'cannot use r (type struct {}) as type io.Reader in argument to ioutil.ReadAll:'}, \ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'struct {} does not implement io.Reader (missing Read method)'} \ ] diff --git a/sources_non_forked/vim-go/autoload/go/tool.vim b/sources_non_forked/vim-go/autoload/go/tool.vim index 547d8519..fdeaaf12 100644 --- a/sources_non_forked/vim-go/autoload/go/tool.vim +++ b/sources_non_forked/vim-go/autoload/go/tool.vim @@ -86,8 +86,10 @@ function! go#tool#Info(showstatus) abort call go#complete#Info(a:showstatus) elseif l:mode == 'guru' call go#guru#DescribeInfo(a:showstatus) + elseif l:mode == 'gopls' + call go#lsp#Info(a:showstatus) else - call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru]') + call go#util#EchoError('go_info_mode value: '. l:mode .' is not valid. Valid values are: [gocode, guru, gopls]') endif endfunction @@ -112,7 +114,22 @@ function! go#tool#Exists(importpath) abort endfunction function! go#tool#DescribeBalloon() - return go#guru#DescribeBalloon() + let l:fname = fnamemodify(bufname(v:beval_bufnr), ':p') + call go#lsp#Hover(l:fname, v:beval_lnum, v:beval_col, funcref('s:balloon', [])) + return '' +endfunction + +function! s:balloon(msg) + let l:msg = a:msg + if has('balloon_eval') + if has('balloon_multiline') + let l:msg = join(a:msg, "\n") + else + let l:msg = substitute(join(map(deepcopy(a:msg), 'substitute(v:val, "\t", "", "")'), '; '), '{;', '{', '') + endif + endif + + call balloon_show(l:msg) endfunction " restore Vi compatibility settings diff --git a/sources_non_forked/vim-go/autoload/go/uri.vim b/sources_non_forked/vim-go/autoload/go/uri.vim index f74de63d..e8f38ab8 100644 --- a/sources_non_forked/vim-go/autoload/go/uri.vim +++ b/sources_non_forked/vim-go/autoload/go/uri.vim @@ -7,7 +7,11 @@ function! go#uri#Encode(value) abort endfunction function! go#uri#EncodePath(value) abort - return s:encode(a:value, '[^/A-Za-z0-9_.~-]') + let l:separator = '/' + if go#util#IsWin() + let l:separator = '\\' + endif + return s:encode(a:value, '[^' . l:separator . 'A-Za-z0-9_.~-]') endfunction function! s:encode(value, unreserved) diff --git a/sources_non_forked/vim-go/autoload/go/util.vim b/sources_non_forked/vim-go/autoload/go/util.vim index 50b48cab..965f1e8b 100644 --- a/sources_non_forked/vim-go/autoload/go/util.vim +++ b/sources_non_forked/vim-go/autoload/go/util.vim @@ -137,11 +137,33 @@ function! go#util#gomod() abort return substitute(s:exec(['go', 'env', 'GOMOD'])[0], '\n', '', 'g') endfunction - function! go#util#osarch() abort return go#util#env("goos") . '_' . go#util#env("goarch") endfunction +" go#util#ModuleRoot returns the root directory of the module of the current +" buffer. +function! go#util#ModuleRoot() abort + let [l:out, l:err] = go#util#ExecInDir(['go', 'env', 'GOMOD']) + if l:err != 0 + return -1 + endif + + let l:module = split(l:out, '\n', 1)[0] + + " When run with `GO111MODULE=on and not in a module directory, the module will be reported as /dev/null. + let l:fakeModule = '/dev/null' + if go#util#IsWin() + let l:fakeModule = 'NUL' + endif + + if l:fakeModule == l:module + return expand('%:p:h') + endif + + return fnamemodify(l:module, ':p:h') +endfunction + " Run a shell command. " " It will temporary set the shell to /bin/sh for Unix-like systems if possible, @@ -511,42 +533,6 @@ function! go#util#ParseErrors(lines) abort return errors endfunction -" FilterValids filters the given items with only items that have a valid -" filename. Any non valid filename is filtered out. -function! go#util#FilterValids(items) abort - " Remove any nonvalid filename from the location list to avoid opening an - " empty buffer. See https://github.com/fatih/vim-go/issues/287 for - " details. - let filtered = [] - let is_readable = {} - - for item in a:items - if has_key(item, 'bufnr') - let filename = bufname(item.bufnr) - elseif has_key(item, 'filename') - let filename = item.filename - else - " nothing to do, add item back to the list - call add(filtered, item) - continue - endif - - if !has_key(is_readable, filename) - let is_readable[filename] = filereadable(filename) - endif - if is_readable[filename] - call add(filtered, item) - endif - endfor - - for k in keys(filter(is_readable, '!v:val')) - echo "vim-go: " | echohl Identifier | echon "[run] Dropped " | echohl Constant | echon '"' . k . '"' - echohl Identifier | echon " from location list (nonvalid filename)" | echohl None - endfor - - return filtered -endfunction - function! go#util#ShowInfo(info) if empty(a:info) return @@ -555,6 +541,37 @@ function! go#util#ShowInfo(info) echo "vim-go: " | echohl Function | echon a:info | echohl None endfunction +" go#util#SetEnv takes the name of an environment variable and what its value +" should be and returns a function that will restore it to its original value. +function! go#util#SetEnv(name, value) abort + let l:state = {} + + if len(a:name) == 0 + return function('s:noop', [], l:state) + endif + + let l:remove = 0 + if exists('$' . a:name) + let l:oldvalue = eval('$' . a:name) + else + let l:remove = 1 + endif + + call execute('let $' . a:name . ' = "' . a:value . '"') + + if l:remove + function! s:remove(name) abort + call execute('unlet $' . a:name) + endfunction + return function('s:remove', [a:name], l:state) + endif + + return function('go#util#SetEnv', [a:name, l:oldvalue], l:state) +endfunction + +function! s:noop(...) abort dict +endfunction + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save diff --git a/sources_non_forked/vim-go/doc/vim-go.txt b/sources_non_forked/vim-go/doc/vim-go.txt index aaf67a7a..8715995e 100644 --- a/sources_non_forked/vim-go/doc/vim-go.txt +++ b/sources_non_forked/vim-go/doc/vim-go.txt @@ -32,17 +32,18 @@ CONTENTS *go-contents* INTRO *go-intro* Go (golang) support for Vim. vim-go comes with sensible predefined settings -(e.g. automatic `gofmt` on save), has autocomplete, snippet support, improved -syntax highlighting, go toolchain commands, etc. It is highly customizable, -and individual features can be toggled easily. vim-go leverages a number of -tools developed by the Go community to provide a seamless Vim experience. +(e.g. automatic `gofmt` on save), has code completion, snippet support, +improved syntax highlighting, go toolchain commands, etc. It is highly +customizable, and individual features can be toggled easily. vim-go leverages +a number of tools developed by the Go community to provide a seamless Vim +experience. * Compile your package with |:GoBuild|, install it with |:GoInstall| or test it with |:GoTest|. Run a single test with |:GoTestFunc|). * Quickly execute your current file(s) with |:GoRun|. * Improved syntax highlighting and folding. * Debug programs with integrated `delve` support with |:GoDebugStart|. - * Completion support via `gocode` and `gopls`. + * Code completion support via `gocode` and `gopls`. * `gofmt` or `goimports` on save keeps the cursor position and undo history. * Go to symbol/declaration with |:GoDef|. * Look up documentation with |:GoDoc| or |:GoDocBrowser|. @@ -127,7 +128,7 @@ or $GOPATH/bin (default: $HOME/go/bin). It requires `git`. Depending on your installation method, you may have to generate the plugin's |:helptags| manually (e.g. `:helptags ALL`). -Autocompletion is enabled by default via 'omnifunc', which you can trigger +Code completion is enabled by default via 'omnifunc', which you can trigger with |i_CTRL-X_CTRL-O| (``). Supported Go plugins~ *vim-go-plugins* @@ -138,8 +139,12 @@ The following plugins are supported for use with vim-go: https://github.com/Shougo/neocomplete.vim * Real-time completion (Neovim and Vim 8): - https://github.com/Shougo/deoplete.nvim and - https://github.com/zchee/deoplete-go + https://github.com/Shougo/deoplete.nvim + + Add the following line to your vimrc. This instructs deoplete to use omni + completion for Go files. + + call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) * Display source code navigation in a sidebar: https://github.com/majutsushi/tagbar @@ -149,9 +154,6 @@ The following plugins are supported for use with vim-go: https://github.com/SirVer/ultisnips or https://github.com/joereynolds/vim-minisnip -* Integration with `delve` (Neovim only): - https://github.com/jodosha/vim-godebug - * Interactive |:GoDecls| and |:GoDeclsDir|: https://github.com/ctrlpvim/ctrlp.vim or https://github.com/junegunn/fzf.vim or @@ -1202,6 +1204,13 @@ balloonexpr`. ============================================================================== SETTINGS *go-settings* + *'g:go_code_completion_enabled'* + +Enable code completion with |'omnifunc'|. By default it is enabled. +> + let g:go_code_completion_enabled = 1 +< + *'g:go_test_show_name'* Show the name of each failed test before the errors and logs output by the @@ -1251,8 +1260,8 @@ updated. By default it's disabled. The delay can be configured with the Use this option to define the command to be used for |:GoInfo|. By default `gocode` is being used as it's the fastest option. But one might also use -`guru` as it's covers more cases and is more accurate. Current valid options -are: `[gocode, guru]` > +`gopls` or `guru` as they cover more cases and are more accurate. Current +valid options are: `[gocode, guru, gopls]` > let g:go_info_mode = 'gocode' < @@ -1635,15 +1644,15 @@ same. *'g:go_gocode_propose_builtins'* Specifies whether `gocode` should add built-in types, functions and constants -to an autocompletion proposals. By default it is enabled. +to code completion proposals. By default it is enabled. > let g:go_gocode_propose_builtins = 1 < *'g:go_gocode_propose_source'* 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. +for code completion proposals. When disabled, only identifiers from the +current package and packages that have been installed will proposed. > let g:go_gocode_propose_source = 0 < @@ -1732,8 +1741,8 @@ i.e: |go#statusline#Show()|. By default it's enabled < *'g:go_echo_go_info'* -Use this option to show the identifier information when completion is done. By -default it's enabled > +Use this option to show the identifier information when code completion is +done. By default it's enabled. > let g:go_echo_go_info = 1 < @@ -2017,8 +2026,9 @@ rest of the commands and mappings become available after starting debug mode. * Setup the debug windows according to |'g:go_debug_windows'|. * Make the `:GoDebug*` commands and `(go-debug-*)` mappings available. - The current directory is used if [pkg] is empty. Any other arguments will - be passed to the program. + The directory of the current buffer is used if [pkg] is empty. Any other + arguments will be passed to the program. When [pkg] is relative, it will + be interpreted relative to the directory of the current buffer. Use |:GoDebugStop| to stop `dlv` and exit debugging mode. @@ -2031,7 +2041,6 @@ rest of the commands and mappings become available after starting debug mode. Use `-test.flag` to pass flags to `go test` when debugging a test; for example `-test.v` or `-test.run TestFoo` - *:GoDebugRestart* :GoDebugRestart @@ -2153,6 +2162,16 @@ Defaults to `127.0.0.1:8181`: let g:go_debug_address = '127.0.0.1:8181' < + *'g:go_debug_log_output'* + +Specifies log output options for `dlv`. Value should be a single string +of comma-separated options suitable for passing to `dlv`. An empty string +(`''`) will suppress logging entirely. +Default: `'debugger, rpc'`: +> + let g:go_debug_log = 'debugger, rpc' +< + *'g:go_highlight_debug'* Highlight the current line and breakpoints in the debugger. @@ -2164,6 +2183,12 @@ Highlight the current line and breakpoints in the debugger. ============================================================================== FAQ TROUBLESHOOTING *go-troubleshooting* +I get "Unknown function: go#config#..." error when I open a Go file.~ + +This often happens to vim-polyglot users when new config options are added to +vim-go. Run vim-polyglot's `build` script or make sure that vim-go is loaded +before vim-polyglot. + I get "not an editor command" error when I invoke :GoXXX~ This happens if vim-go is not installed properly. Be sure you have added this @@ -2364,14 +2389,14 @@ You can install and test all Vim versions by running `make`. DONATION *go-donation* People have asked for this for a long time, now you can be a fully supporter -by being a patreon at: https://www.patreon.com/fatih +by being a patreon at: https://www.patreon.com/bhcleek By being a patron, you are enabling vim-go to grow and mature, helping me to invest in bug fixes, new documentation, and improving both current and future features. It's completely optional and is just a direct way to support vim-go's ongoing development. Thanks! -Check it out: https://www.patreon.com/fatih +Check it out: https://www.patreon.com/bhcleek ============================================================================== diff --git a/sources_non_forked/vim-go/ftplugin/go.vim b/sources_non_forked/vim-go/ftplugin/go.vim index c5fecd94..df2743dd 100644 --- a/sources_non_forked/vim-go/ftplugin/go.vim +++ b/sources_non_forked/vim-go/ftplugin/go.vim @@ -25,10 +25,12 @@ setlocal noexpandtab compiler go -" Set autocompletion -setlocal omnifunc=go#complete#Complete -if !go#util#has_job() - setlocal omnifunc=go#complete#GocodeComplete +if go#config#CodeCompletionEnabled() + " Set autocompletion + setlocal omnifunc=go#complete#Complete + if !go#util#has_job() + setlocal omnifunc=go#complete#GocodeComplete + endif endif if get(g:, "go_doc_keywordprg_enabled", 1) @@ -82,9 +84,16 @@ endif augroup vim-go-buffer autocmd! * - " TODO(bc): notify gopls about changes on CursorHold when the buffer is - " modified. - " TODO(bc): notify gopls that the file on disk is correct on BufWritePost + " The file is registered (textDocument/DidOpen) with gopls in plugin/go.vim + " on the FileType event. + " TODO(bc): handle all the other events that may be of interest to gopls, + " too (e.g. BufFilePost , CursorHold , CursorHoldI, FileReadPost, + " StdinReadPre, BufWritePost, TextChange, TextChangedI) + if go#util#has_job() + autocmd BufWritePost call go#lsp#DidChange(expand(':p')) + autocmd FileChangedShell call go#lsp#DidChange(expand(':p')) + autocmd BufDelete call go#lsp#DidClose(expand(':p')) + endif autocmd CursorHold call go#auto#auto_type_info() autocmd CursorHold call go#auto#auto_sameids() diff --git a/sources_non_forked/vim-go/plugin/go.vim b/sources_non_forked/vim-go/plugin/go.vim index 59f44e89..7b3832d3 100644 --- a/sources_non_forked/vim-go/plugin/go.vim +++ b/sources_non_forked/vim-go/plugin/go.vim @@ -101,11 +101,11 @@ function! s:GoInstallBinaries(updateBinaries, ...) " change $GOBIN so go get can automatically install to it let $GOBIN = go_bin_path - " old_path is used to restore users own path - let old_path = $PATH - " vim's executable path is looking in PATH so add our go_bin path to it - let $PATH = go_bin_path . go#util#PathListSep() . $PATH + let Restore_path = go#util#SetEnv('PATH', go_bin_path . go#util#PathListSep() . $PATH) + + " GO111MODULE must be off to install golanci-lint and gometalinter + let Restore_modules = go#util#SetEnv('GO111MODULE', 'off') " when shellslash is set on MS-* systems, shellescape puts single quotes " around the output string. cmd on Windows does not handle single quotes @@ -185,7 +185,9 @@ function! s:GoInstallBinaries(updateBinaries, ...) endfor " restore back! - let $PATH = old_path + call call(Restore_path, []) + call call(Restore_modules, []) + if resetshellslash set shellslash endif @@ -234,6 +236,22 @@ function! s:gofiletype_post() let &g:fileencodings = s:current_fileencodings endfunction +function! s:register() + if !(&modifiable && expand('') ==# 'go') + return + endif + + let l:RestoreGopath = function('s:noop') + if go#config#AutodetectGopath() + let l:RestoreGopath = go#util#SetEnv('GOPATH', go#path#Detect()) + endif + call go#lsp#DidOpen(expand(':p')) + call call(l:RestoreGopath, []) +endfunction + +function! s:noop(...) abort +endfunction + augroup vim-go autocmd! @@ -245,6 +263,10 @@ augroup vim-go autocmd BufNewFile *.s if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif autocmd BufRead *.s call s:gofiletype_pre() autocmd BufReadPost *.s call s:gofiletype_post() + + if go#util#has_job() + autocmd FileType * call s:register() + endif augroup end " restore Vi compatibility settings diff --git a/sources_non_forked/vim-go/scripts/run-vim b/sources_non_forked/vim-go/scripts/run-vim index 864eeb4d..18878079 100644 --- a/sources_non_forked/vim-go/scripts/run-vim +++ b/sources_non_forked/vim-go/scripts/run-vim @@ -23,7 +23,7 @@ fi dir="/tmp/vim-go-test/$1-install" export GOPATH=$dir -export GO111MODULE=off +export GO111MODULE=auto export PATH=${GOPATH}/bin:$PATH shift diff --git a/sources_non_forked/vim-markdown/doc/vim-markdown.txt b/sources_non_forked/vim-markdown/doc/vim-markdown.txt index 1e81ea2e..4e1c487e 100644 --- a/sources_non_forked/vim-markdown/doc/vim-markdown.txt +++ b/sources_non_forked/vim-markdown/doc/vim-markdown.txt @@ -133,6 +133,7 @@ Options ~ ------------------------------------------------------------------------------- *vim-markdown-disable-folding* + *g:vim_markdown_folding_disabled* Disable Folding ~ Add the following line to your '.vimrc' to disable the folding configuration: @@ -147,6 +148,8 @@ To enable/disable folding use Vim's standard folding configuration. < ------------------------------------------------------------------------------- *vim-markdown-change-fold-style* + *g:vim_markdown_folding_style_pythonic* + *g:vim_markdown_override_foldtext* Change fold style ~ To fold in a style like python-mode [6], add the following to your '.vimrc': @@ -162,6 +165,7 @@ To prevent foldtext from being set add the following to your '.vimrc': < ------------------------------------------------------------------------------- *vim-markdown-set-header-folding-level* + *g:vim_markdown_folding_level* Set header folding level ~ Folding level is a number between 1 and 6. By default, if not specified, it is @@ -176,6 +180,7 @@ Tip: it can be changed on the fly with: < ------------------------------------------------------------------------------- *vim-markdown-disable-default-key-mappings* + *g:vim_markdown_no_default_key_mappings* Disable Default Key Mappings ~ Add the following line to your '.vimrc' to disable default key mappings: @@ -186,6 +191,7 @@ You can also map them by yourself with '' mappings. ------------------------------------------------------------------------------- *vim-markdown-enable-toc-window-auto-fit* + *g:vim_markdown_toc_autofit* Enable TOC window auto-fit ~ Allow for the TOC window to auto-fit when it's possible for it to shrink. It @@ -195,6 +201,7 @@ never increases its default size (half screen), it only shrinks. < ------------------------------------------------------------------------------- *vim-markdown-text-emphasis-restriction-to-single-lines* + *g:vim_markdown_emphasis_multiline* Text emphasis restriction to single-lines ~ By default text emphasis works across multiple lines until a closing token is @@ -205,6 +212,7 @@ for it to be applied a closing token must be found on the same line). To do so: < ------------------------------------------------------------------------------- *vim-markdown-syntax-concealing* + *g:vim_markdown_conceal* Syntax Concealing ~ Concealing is set for some syntax. @@ -231,6 +239,7 @@ your '.vimrc': < ------------------------------------------------------------------------------- *vim-markdown-fenced-code-block-languages* + *g:vim_markdown_fenced_languages* Fenced code block languages ~ You can use filetype name as fenced code block languages for syntax @@ -249,6 +258,8 @@ Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']". ------------------------------------------------------------------------------- *vim-markdown-follow-named-anchors* + *g:vim_markdown_follow_anchor* + *g:vim_markdown_anchorexpr* Follow named anchors ~ This feature allows the 'ge' command to follow named anchors in links of the @@ -285,6 +296,7 @@ are off by default. ------------------------------------------------------------------------------- *vim-markdown-latex-math* + *g:vim_markdown_math* LaTeX math ~ Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'. @@ -293,6 +305,7 @@ Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'. < ------------------------------------------------------------------------------- *vim-markdown-yaml-front-matter* + *g:vim_markdown_frontmatter* YAML Front Matter ~ Highlight YAML front matter as used by Jekyll or Hugo [7]. @@ -301,6 +314,7 @@ Highlight YAML front matter as used by Jekyll or Hugo [7]. < ------------------------------------------------------------------------------- *vim-markdown-toml-front-matter* + *g:vim_markdown_toml_frontmatter* TOML Front Matter ~ Highlight TOML front matter as used by Hugo [7]. @@ -311,6 +325,7 @@ TOML syntax highlight requires vim-toml [8]. < ------------------------------------------------------------------------------- *vim-markdown-json-front-matter* + *g:vim_markdown_json_frontmatter* JSON Front Matter ~ Highlight JSON front matter as used by Hugo [7]. @@ -321,6 +336,7 @@ JSON syntax highlight requires vim-json [9]. < ------------------------------------------------------------------------------- *vim-markdown-strikethrough* + *g:vim_markdown_strikethrough* Strikethrough ~ Strikethrough uses two tildes. '~~Scratch this.~~' @@ -329,6 +345,7 @@ Strikethrough uses two tildes. '~~Scratch this.~~' < ------------------------------------------------------------------------------- *vim-markdown-adjust-new-list-item-indent* + *g:vim_markdown_new_list_item_indent* Adjust new list item indent ~ You can adjust a new list indent. For example, you insert a single line like @@ -349,6 +366,7 @@ of indent is 4. If you'd like to change the number as 2, just write: < ------------------------------------------------------------------------------- *vim-markdown-do-not-require-.md-extensions-for-markdown-links* + *g:vim_markdown_no_extensions_in_markdown* Do not require .md extensions for Markdown links ~ If you want to have a link like this '[link text](link-url)' and follow it for @@ -365,6 +383,7 @@ work. So this option adds some consistency between the two. ------------------------------------------------------------------------------- *vim-markdown-auto-write-when-following-link* + *g:vim_markdown_autowrite* Auto-write when following link ~ If you follow a link like this '[link text](link-url)' using the 'ge' shortcut, @@ -374,6 +393,7 @@ this option will automatically save any edits you made before moving you: < ------------------------------------------------------------------------------- *vim-markdown-change-default-file-extension* + *g:vim_markdown_auto_extension_ext* Change default file extension ~ If you would like to use a file extension other than '.md' you may do so using @@ -383,6 +403,7 @@ the 'vim_markdown_auto_extension_ext' variable: < ------------------------------------------------------------------------------- *vim-markdown-do-not-automatically-insert-bulletpoints* + *g:vim_markdown_auto_insert_bullets* Do not automatically insert bulletpoints ~ Automatically inserting bulletpoints can lead to problems when wrapping text @@ -397,6 +418,7 @@ well, or you will have to remove an indent each time you add a new list item: < ------------------------------------------------------------------------------- *vim-markdown-change-how-to-open-new-files* + *g:vim_markdown_edit_url_in* Change how to open new files ~ By default when following a link the target file will be opened in your current diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 7134f382..d8d34ea1 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -99,7 +99,7 @@ syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell syn match mkdLineBreak / \+$/ syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@ MyMap -" \ :silent! call repeat#setreg("\Plug>MyMap", v:register) +" \ :execute 'silent! call repeat#setreg("\Plug>MyMap", v:register)' " \ call MyFunction(v:register, ...) " \ silent! call repeat#set("\Plug>MyMap") @@ -73,17 +73,34 @@ function! repeat#setreg(sequence,register) let g:repeat_reg = [a:sequence, a:register] endfunction + +function! s:default_register() + let values = split(&clipboard, ',') + if index(values, 'unnamedplus') != -1 + return '+' + elseif index(values, 'unnamed') != -1 + return '*' + else + return '"' + endif +endfunction + function! repeat#run(count) try if g:repeat_tick == b:changedtick let r = '' if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1]) - if g:repeat_reg[1] ==# '=' + " Take the original register, unless another (non-default, we + " unfortunately cannot detect no vs. a given default register) + " register has been supplied to the repeat command (as an + " explicit override). + let regname = v:register ==# s:default_register() ? g:repeat_reg[1] : v:register + if regname ==# '=' " This causes a re-evaluation of the expression on repeat, which " is what we want. let r = '"=' . getreg('=', 1) . "\" else - let r = '"' . g:repeat_reg[1] + let r = '"' . regname endif endif @@ -92,6 +109,9 @@ function! repeat#run(count) let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : '')) if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) exe 'norm ' . r . cnt . s + elseif v:version <= 703 + call feedkeys(r . cnt, 'n') + call feedkeys(s, '') else call feedkeys(s, 'i') call feedkeys(r . cnt, 'ni') diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets index 13d3c971..303fd209 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -16,21 +16,21 @@ namespace ${1:MyNamespace} endsnippet snippet class "class" w -${1:public} class ${2:MyClass} +${1:public} class ${2:`!p snip.rv = snip.basename`} { $0 } endsnippet snippet struct "struct" w -struct ${1:MyStruct} +struct ${1:`!p snip.rv = snip.basename`} { $0 } endsnippet snippet interface "interface" w -interface I${1:Interface} +interface I${1:`!p snip.rv = snip.basename`} { $0 } diff --git a/sources_non_forked/vim-snippets/UltiSnips/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets index 79e7aff9..a6c7416e 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -51,7 +51,9 @@ DOUBLE_QUOTES = '"' class Arg(object): def __init__(self, arg): self.arg = arg - self.name = arg.split('=')[0].strip() + name_and_type = arg.split('=')[0].split(':') + self.name = name_and_type[0].strip() + self.type = name_and_type[1].strip() if len(name_and_type) == 2 else None def __str__(self): return self.name @@ -62,6 +64,9 @@ class Arg(object): def is_kwarg(self): return '=' in self.arg + def is_vararg(self): + return '*' in self.name + def get_args(arglist): args = [Arg(arg) for arg in arglist.split(',') if arg] @@ -211,7 +216,7 @@ def write_init_body(args, parents, snip): if parents: snip.rv += '\n' + snip.mkline('', indent='') - for arg in args: + for arg in filter(lambda arg: not arg.is_vararg(), args): snip += "self._%s = %s" % (arg, arg) diff --git a/sources_non_forked/vim-snippets/snippets/eelixir.snippets b/sources_non_forked/vim-snippets/snippets/eelixir.snippets index 84caaba6..9910975a 100644 --- a/sources_non_forked/vim-snippets/snippets/eelixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/eelixir.snippets @@ -17,7 +17,7 @@ snippet if snippet ife <%= if ${1} do %> ${2:${VISUAL}} - <%= else %> + <% else %> ${0} <% end %> snippet ft diff --git a/sources_non_forked/vim-snippets/snippets/liquid.snippets b/sources_non_forked/vim-snippets/snippets/liquid.snippets new file mode 100644 index 00000000..4f11f086 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/liquid.snippets @@ -0,0 +1,263 @@ +# Port of Shopify Liquid Template Snippets +# https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets + +snippet if + {% if ${1:condition} %} + ${0:${VISUAL}} + {% endif %} +snippet else + {% else %} +snippet elsif + {% elsif ${1:condition} %} +snippet ifelse + {% if ${1:condition} %} + ${2} + {% else %} + ${0} + {% endif %} +snippet unless + {% unless ${1:condition} %} + ${0:${VISUAL}} + {% endunless %} +snippet case + {% case ${1:variable} %} + {% when ${2:condition} %} + ${3} + {% else %} + ${0} + {% endcase %} +snippet when + {% when ${1:condition} %} + ${0} +snippet cycle + {% cycle '${1:odd}', '${2:even}' %} +snippet cyclegroup + {% cycle '${1:group name}': '${2:odd}', '${3:even}' %} +snippet for + {% for ${1:item} in ${2:collection} %} + ${0} + {% endfor %} +snippet limit + limit: ${1:5} +snippet offset + offset: ${1:0} +snippet reversed + reversed +snippet break + {% break %} +snippet continue + {% continue %} +snippet tablerow + {% tablerow ${1:item} in ${2:collection} cols: ${3:2} %} + ${0} + {% endtablerow %} +snippet assign + {% assign ${1:variable} = ${0:value} %} +snippet increment + {% increment ${0:variable} %} +snippet decrement + {% decrement ${0:variable} %} +snippet capture + {% capture ${1:variable} %}${0}{% endcapture %} +snippet include + {% include '${0:snippet}' %} +snippet includewith + {% include '${1:snippet}', ${2:variable}: ${0:value} %} +snippet section + {% section '${1:snippet}' %} +snippet raw + {% raw %}${0}{% endraw %} +snippet layout + {% layout '${1:layout}' %} +snippet layoutnone + {% layout none %} +snippet paginate + {% paginate ${1:collection.products} by ${2:12} %} + {% for ${3:product} in $1 %} + ${0} + {% endfor %} + {% endpaginate %} +snippet schema + {% schema %} + { + ${0} + } + {% endschema %} +snippet stylesheet + {% stylesheet %} + ${0} + {% endstylesheet %} +snippet stylesheet_scss + {% stylesheet '${1:scss}' %} + ${0} + {% endstylesheet %} +snippet javascript + {% javascript %} + ${0} + {% endjavascript %} +snippet comment- + {%- comment -%}${0}{%- endcomment -%} +snippet if- + {%- if ${1:condition} -%} + ${0:${VISUAL}} + {%- endif -%} +snippet else- + {%- else -%} +snippet elsif- + {%- elsif ${1:condition} -%} +snippet ifelse- + {%- if ${1:condition} -%} + ${2} + {%- else -%} + ${0} + {%- endif -%} +snippet unless- + {%- unless ${1:condition} -%} + ${0:${VISUAL}} + {%- endunless -%} +snippet case- + {%- case ${1:variable} -%} + {%- when ${2:condition} -%} + ${3} + {%- else -%} + ${0} + {%- endcase -%} +snippet when- + {%- when ${1:condition} -%} + ${0} +snippet cycle- + {%- cycle '${1:odd}', '${2:even}' -%} +snippet cyclegroup- + {%- cycle '${1:group name}': '${2:odd}', '${3:even}' -%} +snippet for- + {%- for ${1:item} in ${2:collection} -%} + ${0} + {%- endfor -%} +snippet continue- + {%- continue -%} +snippet tablerow- + {%- tablerow ${1:item} in ${2:collection} cols: ${3:2} -%} + ${0} + {%- endtablerow -%} +snippet assign- + {%- assign ${1:variable} = ${0:value} -%} +snippet capture- + {%- capture ${1:variable} -%}${0}{%- endcapture -%} +snippet include- + {%- include '${0:snippet}' -%} +snippet includewith- + {%- include '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet join + | join: '${1:, }' +snippet first + | first +snippet last + | last +snippet concat + | concat: ${1:array} +snippet map + | map: '${1:key}' +snippet reverse + | reverse +snippet size + | size +snippet sort + | sort: '${1:key}' +snippet uniq + | uniq +snippet img_tag + | img_tag +snippet img_tag_param + | img_tag: '${1:alt}', '${2:class}' +snippet script_tag + | script_tag +snippet stylesheet_tag + | stylesheet_tag +snippet abs + | abs +snippet ceil + | ceil +snippet divided_by + | divided_by: ${1:2} +snippet floor + | floor +snippet minus + | minus: ${1:1} +snippet plus + | plus: ${1:1} +snippet round + | round: ${1:0} +snippet times + | times: ${1:1} +snippet modulo + | modulo: ${1:2} +snippet money + | money +snippet money_with_currency + | money_with_currency +snippet money_without_trailing_zeros + | money_without_trailing_zeros +snippet money_without_currency + | money_without_currency +snippet append + | append: '${1:string}' +snippet camelcase + | camelcase +snippet capitalize + | capitalize +snippet downcase + | downcase +snippet escape + | escape +snippet handleize + | handleize +snippet md5 + | md5 +snippet newline_to_br + | newline_to_br +snippet pluralize + | pluralize: '${1:item}', '${2:items}' +snippet prepend + | prepend: '${1:string}' +snippet remove + | remove: '${1:string}' +snippet remove_first + | remove_first: '${1:string}' +snippet replace + | replace: '${1:target}', '${2:replace}' +snippet replace_first + | replace_first: '${1:target}', '${2:replace}' +snippet slice + | slice: ${1:0}, ${2:5} +snippet slice_single + | slice: ${1:at} +snippet split + | split: '${1:,}' +snippet strip + | strip +snippet lstrip + | lstrip +snippet rstrip + | rstrip +snippet strip_html + | strip_html +snippet strip_newlines + | strip_newlines +snippet truncate + | truncate: ${1:20}, '${2:...}' +snippet truncatewords + | truncatewords: ${1:5}, '${2:...}' +snippet upcase + | upcase +snippet url_encode + | url_encode +snippet url_escape + | url_escape +snippet url_param_escape + | url_param_escape +snippet asset_url + | asset_url +snippet asset_img_url + | asset_img_url: '${1:medium}' +snippet img_url + | img_url: '${1:medium}' diff --git a/sources_non_forked/vim-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets index 7d8e6d8a..adb781dd 100644 --- a/sources_non_forked/vim-snippets/snippets/puppet.snippets +++ b/sources_non_forked/vim-snippets/snippets/puppet.snippets @@ -7,16 +7,16 @@ # Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html # More info: https://github.com/puppetlabs/puppet-strings snippet classheader - # ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'class-name')`} + # ${1:`vim_snippets#Filename(substitute(expand('%:p:s?\v.{-}/(\w+)/manifests/(.+)\.pp?\1/\2?'), '/', '::', 'g'), 'class-name')`} # ${2:A description of what this class does} # # @summary ${3:A short summary of the purpose of this class} # - # @param ${4:parameter1} [${5:String}] + # @param ${4:parameter1} # ${6:Explanation of what this parameter affects.} # # @example Simple use - # class { '$1': } + # include $1 # # @example Use with params # class { '$1': @@ -28,7 +28,7 @@ snippet classheader # @note Copyright `strftime("%Y")` $8 # class $1( - $$4 = undef, + ${5:String} $$4 = undef, ) { ${0} } diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 79e70628..895fbe57 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -204,34 +204,34 @@ snippet fcite \footcite[]{} \\footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. snippet ita italic text - \\textit{${1:${VISUAL:text}}} ${0} + \\textit{${1:${VISUAL:text}}}${0} snippet bf bold face text - \\textbf{${1:${VISUAL:text}}} ${0} + \\textbf{${1:${VISUAL:text}}}${0} snippet under underline text - \\underline{${1:${VISUAL:text}}} ${0} + \\underline{${1:${VISUAL:text}}}${0} snippet over overline text - \\overline{${1:${VISUAL:text}}} ${0} + \\overline{${1:${VISUAL:text}}}${0} snippet emp emphasize text \\emph{${1:${VISUAL:text}}}${0} snippet sc small caps text - \\textsc{${1:${VISUAL:text}}} ${0} + \\textsc{${1:${VISUAL:text}}}${0} #Choosing font snippet sf sans serife text - \\textsf{${1:${VISUAL:text}}} ${0} + \\textsf{${1:${VISUAL:text}}}${0} snippet rm roman font text - \\textrm{${1:${VISUAL:text}}} ${0} + \\textrm{${1:${VISUAL:text}}}${0} snippet tt typewriter (monospace) text - \\texttt{${1:${VISUAL:text}}} ${0} + \\texttt{${1:${VISUAL:text}}}${0} #Math font snippet mf mathfrak - \\mathfrak{${1:${VISUAL:text}}} ${0} + \\mathfrak{${1:${VISUAL:text}}}${0} snippet mc mathcal - \\mathcal{${1:${VISUAL:text}}} ${0} + \\mathcal{${1:${VISUAL:text}}}${0} snippet ms mathscr - \\mathscr{${1:${VISUAL:text}}} ${0} + \\mathscr{${1:${VISUAL:text}}}${0} #misc snippet ft \footnote - \\footnote{${1:${VISUAL:text}}} ${0} + \\footnote{${1:${VISUAL:text}}}${0} snippet fig figure environment (includegraphics) \\begin{figure} \\begin{center} From 6711ae645336d5574840fa38fe54af34f77dab70 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Thu, 22 Aug 2019 17:34:32 +0200 Subject: [PATCH 04/91] Make sure that enter is never overriden in the quickfix window --- vimrcs/extended.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index a4f0c9b9..1c7ab82a 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -142,6 +142,8 @@ map co ggVGy:tabnew:set syntax=qfpgg map n :cn map p :cp +" Make sure that enter is never overriden in the quickfix window +autocmd BufReadPost quickfix nnoremap """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" From 3aefdbd21a18d5b83e42eaf4dc722b0c5918f6f2 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Thu, 22 Aug 2019 17:36:17 +0200 Subject: [PATCH 05/91] Updated plugins --- sources_non_forked/ale/LICENSE | 2 +- .../ale/ale_linters/asm/gcc.vim | 5 +- .../ale/ale_linters/c/clangd.vim | 8 +- .../ale/ale_linters/c/clangtidy.vim | 9 +- .../ale/ale_linters/c/cppcheck.vim | 22 +- .../ale/ale_linters/c/cquery.vim | 10 +- sources_non_forked/ale/ale_linters/c/gcc.vim | 6 +- .../ale/ale_linters/cpp/clangcheck.vim | 3 +- .../ale/ale_linters/cpp/clangd.vim | 8 +- .../ale/ale_linters/cpp/clangtidy.vim | 9 +- .../ale/ale_linters/cpp/cppcheck.vim | 22 +- .../ale/ale_linters/cpp/cquery.vim | 10 +- .../ale/ale_linters/cpp/gcc.vim | 6 +- sources_non_forked/ale/ale_linters/cs/csc.vim | 95 + .../ale/ale_linters/cs/mcsc.vim | 34 +- .../ale/ale_linters/elm/elm_ls.vim | 37 + .../ale/ale_linters/elm/elm_lsp.vim | 22 - .../ale/ale_linters/erlang/dialyzer.vim | 93 + .../ale/ale_linters/go/bingo.vim | 6 +- .../ale/ale_linters/go/gobuild.vim | 1 + .../ale/ale_linters/go/gofmt.vim | 8 +- .../ale/ale_linters/go/golangci_lint.vim | 3 + .../ale/ale_linters/go/golint.vim | 2 +- .../ale/ale_linters/go/gometalinter.vim | 2 + .../ale/ale_linters/go/gopls.vim | 8 +- .../ale/ale_linters/go/gosimple.vim | 3 +- .../ale/ale_linters/go/gotype.vim | 3 +- .../ale/ale_linters/go/govet.vim | 1 + .../ale/ale_linters/go/langserver.vim | 3 +- .../ale/ale_linters/go/staticcheck.vim | 5 +- .../ale/ale_linters/java/checkstyle.vim | 35 +- .../ale/ale_linters/java/eclipselsp.vim | 30 +- .../ale/ale_linters/java/javac.vim | 5 + .../ale/ale_linters/java/javalsp.vim | 36 +- .../ale/ale_linters/javascript/eslint.vim | 2 +- .../ale/ale_linters/javascript/xo.vim | 4 +- .../ale/ale_linters/objc/clangd.vim | 8 +- .../ale/ale_linters/objcpp/clangd.vim | 8 +- .../ale/ale_linters/php/phpcs.vim | 11 +- .../ale/ale_linters/powershell/powershell.vim | 22 +- .../ale/ale_linters/pug/puglint.vim | 16 +- .../ale/ale_linters/purescript/ls.vim | 49 + .../ale/ale_linters/python/mypy.vim | 1 + .../ale/ale_linters/reason/ls.vim | 23 + .../ale/ale_linters/ruby/sorbet.vim | 23 + .../ale/ale_linters/rust/cargo.vim | 19 +- .../ale/ale_linters/terraform/terraform.vim | 49 + .../ale/ale_linters/tex/texlab.vim | 21 + .../ale/ale_linters/typescript/eslint.vim | 2 +- .../ale/ale_linters/typescript/xo.vim | 4 +- sources_non_forked/ale/autoload/ale.vim | 2 +- sources_non_forked/ale/autoload/ale/ant.vim | 41 + .../ale/autoload/ale/assert.vim | 12 + sources_non_forked/ale/autoload/ale/c.vim | 220 +- .../ale/autoload/ale/completion.vim | 109 +- .../ale/autoload/ale/debugging.vim | 13 +- .../ale/autoload/ale/engine.vim | 4 + .../ale/autoload/ale/events.vim | 2 +- sources_non_forked/ale/autoload/ale/fix.vim | 61 +- .../ale/autoload/ale/fix/registry.vim | 32 +- .../ale/autoload/ale/fixers/black.vim | 4 + .../ale/autoload/ale/fixers/clangformat.vim | 13 +- .../ale/autoload/ale/fixers/clangtidy.vim | 52 + .../ale/autoload/ale/fixers/eslint.vim | 18 +- .../ale/autoload/ale/fixers/gnatpp.vim | 17 + .../ale/autoload/ale/fixers/gofmt.vim | 3 +- .../ale/autoload/ale/fixers/goimports.vim | 3 +- .../ale/autoload/ale/fixers/gomod.vim | 3 +- .../ale/autoload/ale/fixers/hindent.vim | 20 + .../ale/autoload/ale/fixers/pgformatter.vim | 12 + .../ale/autoload/ale/fixers/prettier.vim | 10 +- .../ale/fixers/reorder_python_imports.vim | 25 + .../ale/autoload/ale/fixers/sorbet.vim | 19 + sources_non_forked/ale/autoload/ale/go.vim | 17 + .../ale/autoload/ale/handlers/ccls.vim | 14 +- .../ale/autoload/ale/handlers/cppcheck.vim | 41 + .../ale/autoload/ale/handlers/eslint.vim | 143 +- .../ale/autoload/ale/handlers/gcc.vim | 24 + .../ale/autoload/ale/handlers/rust.vim | 10 +- .../ale/autoload/ale/highlight.vim | 126 +- sources_non_forked/ale/autoload/ale/java.vim | 6 + .../ale/autoload/ale/linter.vim | 9 +- sources_non_forked/ale/autoload/ale/list.vim | 84 +- .../ale/autoload/ale/loclist_jumping.vim | 2 +- sources_non_forked/ale/autoload/ale/lsp.vim | 93 +- .../ale/autoload/ale/lsp/message.vim | 7 +- .../ale/autoload/ale/lsp/response.vim | 2 +- .../ale/autoload/ale/lsp_linter.vim | 55 +- sources_non_forked/ale/autoload/ale/path.vim | 11 +- .../ale/autoload/ale/python.vim | 2 +- sources_non_forked/ale/autoload/ale/sign.vim | 28 + .../ale/autoload/asyncomplete/sources/ale.vim | 26 + sources_non_forked/ale/doc/ale-ada.txt | 11 + sources_non_forked/ale/doc/ale-c.txt | 19 +- sources_non_forked/ale/doc/ale-cpp.txt | 19 +- sources_non_forked/ale/doc/ale-cs.txt | 90 +- .../ale/doc/ale-development.txt | 5 +- sources_non_forked/ale/doc/ale-elm.txt | 38 +- sources_non_forked/ale/doc/ale-erlang.txt | 29 + sources_non_forked/ale/doc/ale-go.txt | 10 + sources_non_forked/ale/doc/ale-handlebars.txt | 7 + sources_non_forked/ale/doc/ale-haskell.txt | 22 + sources_non_forked/ale/doc/ale-hcl.txt | 2 +- sources_non_forked/ale/doc/ale-java.txt | 96 +- sources_non_forked/ale/doc/ale-purescript.txt | 33 + sources_non_forked/ale/doc/ale-python.txt | 32 +- sources_non_forked/ale/doc/ale-reasonml.txt | 38 +- sources_non_forked/ale/doc/ale-ruby.txt | 20 + sources_non_forked/ale/doc/ale-sql.txt | 18 + .../doc/ale-supported-languages-and-tools.txt | 10 + sources_non_forked/ale/doc/ale-terraform.txt | 14 +- sources_non_forked/ale/doc/ale-tex.txt | 20 + sources_non_forked/ale/doc/ale.txt | 138 +- sources_non_forked/ale/plugin/ale.vim | 11 +- .../rplugin/python3/deoplete/sources/ale.py | 16 +- sources_non_forked/ale/supported-tools.md | 16 +- sources_non_forked/goyo.vim/autoload/goyo.vim | 2 +- sources_non_forked/lightline.vim/.travis.yml | 4 +- sources_non_forked/lightline.vim/README.md | 6 + .../lightline.vim/autoload/lightline.vim | 10 +- .../lightline/colorscheme/ayu_mirage.vim | 39 + .../lightline/colorscheme/powerlineish.vim | 28 + .../lightline/colorscheme/selenized_dark.vim | 50 + .../lightline.vim/doc/lightline.txt | 19 +- .../lightline.vim/plugin/lightline.vim | 12 +- .../lightline.vim/test/.themisrc | 2 + .../lightline.vim/test/popup.vim | 19 + .../lightline.vim/test/quickfix.vim | 25 + .../nerdtree/.github/ISSUE_TEMPLATE.md | 28 - .../nerdtree/.github/ISSUE_TEMPLATE/bug.md | 45 + .../.github/ISSUE_TEMPLATE/feature_request.md | 8 + .../.github/ISSUE_TEMPLATE/question.md | 24 + .../nerdtree/.github/PULL_REQUEST_TEMPLATE.md | 13 + sources_non_forked/nerdtree/CHANGELOG | 179 - sources_non_forked/nerdtree/CHANGELOG.md | 222 ++ .../nerdtree/autoload/nerdtree.vim | 41 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 48 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 151 +- .../nerdtree/lib/nerdtree/bookmark.vim | 4 +- .../nerdtree/lib/nerdtree/creator.vim | 11 +- .../nerdtree/lib/nerdtree/menu_controller.vim | 8 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 16 +- .../nerdtree/lib/nerdtree/opener.vim | 30 +- .../nerdtree/lib/nerdtree/path.vim | 30 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 5 + .../nerdtree/lib/nerdtree/ui.vim | 16 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 32 +- .../nerdtree/plugin/NERD_tree.vim | 1 + sources_non_forked/nginx.vim/README.md | 40 +- .../nginx.vim/snippets/nginx.snippets | 166 - .../vim-bundle-mako/indent/mako.vim | 85 +- .../vim-fugitive/autoload/fugitive.vim | 3356 +++++++++++------ .../vim-fugitive/doc/fugitive.txt | 340 +- .../vim-fugitive/plugin/fugitive.vim | 121 +- .../vim-fugitive/syntax/fugitive.vim | 31 +- .../vim-fugitive/syntax/fugitiveblame.vim | 7 + .../vim-gitgutter/.github/issue_template.md | 4 - sources_non_forked/vim-gitgutter/README.mkd | 95 +- .../vim-gitgutter/autoload/gitgutter.vim | 53 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 12 +- .../autoload/gitgutter/highlight.vim | 103 +- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 98 +- .../vim-gitgutter/autoload/gitgutter/sign.vim | 170 +- .../autoload/gitgutter/utility.vim | 90 +- .../vim-gitgutter/doc/gitgutter.txt | 97 +- .../vim-gitgutter/plugin/gitgutter.vim | 31 +- sources_non_forked/vim-gitgutter/test/test | 2 +- .../vim-gitgutter/test/test_gitgutter.vim | 365 +- sources_non_forked/vim-go/.github/FUNDING.yml | 1 + .../vim-go/.github/ISSUE_TEMPLATE.md | 7 +- sources_non_forked/vim-go/CHANGELOG.md | 89 + sources_non_forked/vim-go/README.md | 11 +- .../vim-go/autoload/go/auto.vim | 12 +- sources_non_forked/vim-go/autoload/go/cmd.vim | 4 +- .../vim-go/autoload/go/complete.vim | 29 +- .../vim-go/autoload/go/complete_test.vim | 28 +- .../vim-go/autoload/go/config.vim | 21 +- .../vim-go/autoload/go/debug.vim | 23 +- .../vim-go/autoload/go/debug_test.vim | 12 + sources_non_forked/vim-go/autoload/go/def.vim | 4 +- .../vim-go/autoload/go/def_test.vim | 197 +- sources_non_forked/vim-go/autoload/go/doc.vim | 12 + .../vim-go/autoload/go/issue.vim | 16 +- .../vim-go/autoload/go/lint.vim | 34 +- .../vim-go/autoload/go/lint_test.vim | 129 +- sources_non_forked/vim-go/autoload/go/lsp.vim | 486 ++- .../autoload/go/lsp/completionitemkind.vim | 18 +- .../vim-go/autoload/go/lsp/lsp.vim | 58 + .../vim-go/autoload/go/lsp/lsp_test.vim | 32 + .../vim-go/autoload/go/lsp/message.vim | 80 +- .../vim-go/autoload/go/lsp_test.vim | 49 + sources_non_forked/vim-go/autoload/go/mod.vim | 8 +- .../vim-go/autoload/go/package.vim | 76 +- .../vim-go/autoload/go/promise.vim | 50 + .../vim-go/autoload/go/promise_test.vim | 41 + .../vim-go/autoload/go/statusline.vim | 16 +- .../vim-go/autoload/go/template.vim | 9 +- .../vim-go/autoload/go/term.vim | 28 +- .../vim-go/autoload/go/term_test.vim | 2 + .../test/src/example/example_test.go | 10 + .../vim-go/autoload/go/test.vim | 13 +- .../vim-go/autoload/go/test_test.vim | 15 +- .../vim-go/autoload/go/tool.vim | 10 +- .../vim-go/autoload/go/util.vim | 16 +- sources_non_forked/vim-go/autoload/gotest.vim | 21 +- sources_non_forked/vim-go/doc/vim-go.txt | 113 +- .../vim-go/ftplugin/go/commands.vim | 7 + .../vim-go/gosnippets/UltiSnips/go.snippets | 4 +- sources_non_forked/vim-go/plugin/go.vim | 102 +- sources_non_forked/vim-go/scripts/install-vim | 4 +- sources_non_forked/vim-go/scripts/runtest.vim | 10 +- sources_non_forked/vim-markdown/Makefile | 6 + sources_non_forked/vim-markdown/README.md | 303 +- .../vim-markdown/after/ftplugin/markdown.vim | 53 +- .../vim-markdown/doc/vim-markdown.txt | 269 +- .../vim-markdown/syntax/markdown.vim | 4 +- .../vim-markdown/test/python-folding.vader | 15 +- .../vim-markdown/test/toc.vader | 4 - .../vim-multiple-cursors/README.md | 28 +- .../doc/multiple_cursors.txt | 14 +- .../plugin/multiple_cursors.vim | 4 +- .../spec/multiple_cursors_spec.rb | 4 +- sources_non_forked/vim-repeat/README.markdown | 1 + .../vim-snippets/UltiSnips/html.snippets | 4 + .../UltiSnips/javascript-node.snippets | 2 +- .../vim-snippets/UltiSnips/lua.snippets | 2 +- .../vim-snippets/UltiSnips/python.snippets | 8 +- .../vim-snippets/UltiSnips/r.snippets | 3 +- .../vim-snippets/UltiSnips/ruby.snippets | 2 +- .../vim-snippets/UltiSnips/sh.snippets | 8 +- .../vim-snippets/UltiSnips/tex.snippets | 2 +- .../vim-snippets/UltiSnips/zsh.snippets | 9 +- .../vim-snippets/snippets/cpp.snippets | 4 + .../vim-snippets/snippets/css.snippets | 223 +- .../vim-snippets/snippets/eelixir.snippets | 34 +- .../vim-snippets/snippets/go.snippets | 6 - .../javascript/javascript-react.snippets | 17 +- .../javascript/javascript-redux.snippets | 37 + .../javascript/javascript.es6.snippets | 55 - .../snippets/javascript/javascript.snippets | 65 +- .../vim-snippets/snippets/sass.snippets | 228 ++ .../vim-snippets/snippets/stylus.snippets | 230 +- .../vim-snippets/snippets/tex.snippets | 2 +- .../vim-surround/plugin/surround.vim | 11 +- 244 files changed, 9486 insertions(+), 3395 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/cs/csc.vim create mode 100644 sources_non_forked/ale/ale_linters/elm/elm_ls.vim delete mode 100644 sources_non_forked/ale/ale_linters/elm/elm_lsp.vim create mode 100644 sources_non_forked/ale/ale_linters/erlang/dialyzer.vim create mode 100644 sources_non_forked/ale/ale_linters/purescript/ls.vim create mode 100644 sources_non_forked/ale/ale_linters/reason/ls.vim create mode 100644 sources_non_forked/ale/ale_linters/ruby/sorbet.vim create mode 100644 sources_non_forked/ale/ale_linters/terraform/terraform.vim create mode 100644 sources_non_forked/ale/ale_linters/tex/texlab.vim create mode 100644 sources_non_forked/ale/autoload/ale/ant.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/hindent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/sorbet.vim create mode 100644 sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim create mode 100644 sources_non_forked/ale/doc/ale-purescript.txt create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/powerlineish.vim create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim create mode 100644 sources_non_forked/lightline.vim/test/popup.vim create mode 100644 sources_non_forked/lightline.vim/test/quickfix.vim delete mode 100644 sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md create mode 100644 sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md create mode 100644 sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md create mode 100644 sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md create mode 100644 sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md delete mode 100644 sources_non_forked/nerdtree/CHANGELOG create mode 100644 sources_non_forked/nerdtree/CHANGELOG.md delete mode 100644 sources_non_forked/nginx.vim/snippets/nginx.snippets create mode 100644 sources_non_forked/vim-fugitive/syntax/fugitiveblame.vim create mode 100644 sources_non_forked/vim-go/.github/FUNDING.yml create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp/lsp_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/lsp_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/promise.vim create mode 100644 sources_non_forked/vim-go/autoload/go/promise_test.vim create mode 100644 sources_non_forked/vim-go/autoload/go/test-fixtures/test/src/example/example_test.go create mode 100644 sources_non_forked/vim-snippets/snippets/javascript/javascript-redux.snippets delete mode 100644 sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets diff --git a/sources_non_forked/ale/LICENSE b/sources_non_forked/ale/LICENSE index 739ccae0..f8f3524d 100644 --- a/sources_non_forked/ale/LICENSE +++ b/sources_non_forked/ale/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2018, w0rp +Copyright (c) 2016-2019, w0rp All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sources_non_forked/ale/ale_linters/asm/gcc.vim b/sources_non_forked/ale/ale_linters/asm/gcc.vim index 72b293c0..eecab6ef 100644 --- a/sources_non_forked/ale/ale_linters/asm/gcc.vim +++ b/sources_non_forked/ale/ale_linters/asm/gcc.vim @@ -5,7 +5,10 @@ call ale#Set('asm_gcc_executable', 'gcc') call ale#Set('asm_gcc_options', '-Wall') function! ale_linters#asm#gcc#GetCommand(buffer) abort - return '%e -x assembler -fsyntax-only ' + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -x assembler' + \ . ' -o ' . g:ale#util#nul_file \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/c/clangd.vim b/sources_non_forked/ale/ale_linters/c/clangd.vim index 918eadcc..79b600fa 100644 --- a/sources_non_forked/ale/ale_linters/c/clangd.vim +++ b/sources_non_forked/ale/ale_linters/c/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('c_clangd_executable', 'clangd') call ale#Set('c_clangd_options', '') -function! ale_linters#c#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#c#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('c', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c_clangd_executable')}, \ 'command': function('ale_linters#c#clangd#GetCommand'), -\ 'project_root': function('ale_linters#c#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/c/clangtidy.vim b/sources_non_forked/ale/ale_linters/c/clangtidy.vim index 6484f8af..f998866a 100644 --- a/sources_non_forked/ale/ale_linters/c/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/c/clangtidy.vim @@ -11,9 +11,12 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy') " http://clang.llvm.org/extra/clang-tidy/checks/list.html call ale#Set('c_clangtidy_checks', []) -" Set this option to manually set some options for clang-tidy. +" Set this option to manually set some options for clang-tidy to use as compile +" flags. " This will disable compile_commands.json detection. call ale#Set('c_clangtidy_options', '') +" Set this option to manually set options for clang-tidy directly. +call ale#Set('c_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') function! ale_linters#c#clangtidy#GetCommand(buffer) abort @@ -25,8 +28,12 @@ function! ale_linters#c#clangtidy#GetCommand(buffer) abort \ ? ale#Var(a:buffer, 'c_clangtidy_options') \ : '' + " Get the options to pass directly to clang-tidy + let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options') + return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') diff --git a/sources_non_forked/ale/ale_linters/c/cppcheck.vim b/sources_non_forked/ale/ale_linters/c/cppcheck.vim index 851f9f11..309b2851 100644 --- a/sources_non_forked/ale/ale_linters/c/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/c/cppcheck.vim @@ -5,23 +5,17 @@ call ale#Set('c_cppcheck_executable', 'cppcheck') call ale#Set('c_cppcheck_options', '--enable=style') function! ale_linters#c#cppcheck#GetCommand(buffer) abort - " Search upwards from the file for compile_commands.json. - " - " If we find it, we'll `cd` to where the compile_commands.json file is, - " then use the file to set up import paths, etc. - let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - let l:cd_command = !empty(l:compile_commmands_path) - \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) - \ : '' - let l:compile_commands_option = !empty(l:compile_commmands_path) - \ ? '--project=compile_commands.json ' + let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer) + let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) + let l:buffer_path_include = empty(l:compile_commands_option) + \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' return l:cd_command - \ . '%e -q --language=c ' - \ . l:compile_commands_option - \ . ale#Var(a:buffer, 'c_cppcheck_options') + \ . '%e -q --language=c' + \ . ale#Pad(l:compile_commands_option) + \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) + \ . l:buffer_path_include \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/c/cquery.vim b/sources_non_forked/ale/ale_linters/c/cquery.vim index d2be9cd9..ff0f34af 100644 --- a/sources_non_forked/ale/ale_linters/c/cquery.vim +++ b/sources_non_forked/ale/ale_linters/c/cquery.vim @@ -5,13 +5,15 @@ call ale#Set('c_cquery_executable', 'cquery') call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#c#cquery#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + " Try to find cquery configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim index d965965d..1df1018e 100644 --- a/sources_non_forked/ale/ale_linters/c/gcc.vim +++ b/sources_non_forked/ale/ale_linters/c/gcc.vim @@ -9,7 +9,11 @@ function! ale_linters#c#gcc#GetCommand(buffer, output) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. - return '%e -S -x c -fsyntax-only' + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c' + \ . ' -o ' . g:ale#util#nul_file \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ale#Pad(l:cflags) \ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -' diff --git a/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim index b511a413..7d32a57c 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim @@ -12,7 +12,8 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort let l:build_dir = ale#Var(a:buffer, 'c_build_dir') if empty(l:build_dir) - let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + let l:build_dir = ale#path#Dirname(l:json_file) endif " The extra arguments in the command are used to prevent .plist files from diff --git a/sources_non_forked/ale/ale_linters/cpp/clangd.vim b/sources_non_forked/ale/ale_linters/cpp/clangd.vim index 4a8ff4f6..fab605f4 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('cpp_clangd_executable', 'clangd') call ale#Set('cpp_clangd_options', '') -function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#cpp#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('cpp', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')}, \ 'command': function('ale_linters#cpp#clangd#GetCommand'), -\ 'project_root': function('ale_linters#cpp#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim index 841b795f..085bc332 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim @@ -5,9 +5,12 @@ call ale#Set('cpp_clangtidy_executable', 'clang-tidy') " Set this option to check the checks clang-tidy will apply. call ale#Set('cpp_clangtidy_checks', []) -" Set this option to manually set some options for clang-tidy. +" Set this option to manually set some options for clang-tidy to use as compile +" flags. " This will disable compile_commands.json detection. call ale#Set('cpp_clangtidy_options', '') +" Set this option to manually set options for clang-tidy directly. +call ale#Set('cpp_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort @@ -19,8 +22,12 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort \ ? ale#Var(a:buffer, 'cpp_clangtidy_options') \ : '' + " Get the options to pass directly to clang-tidy + let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options') + return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') diff --git a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim index 5173d698..7cd80dbc 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim @@ -5,23 +5,17 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck') call ale#Set('cpp_cppcheck_options', '--enable=style') function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort - " Search upwards from the file for compile_commands.json. - " - " If we find it, we'll `cd` to where the compile_commands.json file is, - " then use the file to set up import paths, etc. - let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - let l:cd_command = !empty(l:compile_commmands_path) - \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) - \ : '' - let l:compile_commands_option = !empty(l:compile_commmands_path) - \ ? '--project=compile_commands.json ' + let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer) + let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) + let l:buffer_path_include = empty(l:compile_commands_option) + \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' return l:cd_command - \ . '%e -q --language=c++ ' - \ . l:compile_commands_option - \ . ale#Var(a:buffer, 'cpp_cppcheck_options') + \ . '%e -q --language=c++' + \ . ale#Pad(l:compile_commands_option) + \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) + \ . l:buffer_path_include \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/cpp/cquery.vim b/sources_non_forked/ale/ale_linters/cpp/cquery.vim index 0dd9f6ad..2971cdcb 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cquery.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cquery.vim @@ -5,13 +5,15 @@ call ale#Set('cpp_cquery_executable', 'cquery') call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + " Try to find cquery configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim index c427020b..108d6d70 100644 --- a/sources_non_forked/ale/ale_linters/cpp/gcc.vim +++ b/sources_non_forked/ale/ale_linters/cpp/gcc.vim @@ -9,7 +9,11 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. - return '%e -S -x c++ -fsyntax-only' + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c++' + \ . ' -o ' . g:ale#util#nul_file \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ale#Pad(l:cflags) \ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -' diff --git a/sources_non_forked/ale/ale_linters/cs/csc.vim b/sources_non_forked/ale/ale_linters/cs/csc.vim new file mode 100644 index 00000000..308abc77 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cs/csc.vim @@ -0,0 +1,95 @@ +call ale#Set('cs_csc_options', '') +call ale#Set('cs_csc_source', '') +call ale#Set('cs_csc_assembly_path', []) +call ale#Set('cs_csc_assemblies', []) + +function! s:GetWorkingDirectory(buffer) abort + let l:working_directory = ale#Var(a:buffer, 'cs_csc_source') + + if !empty(l:working_directory) + return l:working_directory + endif + + return expand('#' . a:buffer . ':p:h') +endfunction + +function! ale_linters#cs#csc#GetCommand(buffer) abort + " Pass assembly paths via the -lib: parameter. + let l:path_list = ale#Var(a:buffer, 'cs_csc_assembly_path') + + let l:lib_option = !empty(l:path_list) + \ ? '/lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',') + \ : '' + + " Pass paths to DLL files via the -r: parameter. + let l:assembly_list = ale#Var(a:buffer, 'cs_csc_assemblies') + + let l:r_option = !empty(l:assembly_list) + \ ? '/r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',') + \ : '' + + " register temporary module target file with ale + " register temporary module target file with ALE. + let l:out = ale#command#CreateFile(a:buffer) + + " The code is compiled as a module and the output is redirected to a + " temporary file. + return ale#path#CdString(s:GetWorkingDirectory(a:buffer)) + \ . 'csc /unsafe' + \ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options')) + \ . ale#Pad(l:lib_option) + \ . ale#Pad(l:r_option) + \ . ' /out:' . l:out + \ . ' /t:module' + \ . ' /recurse:' . ale#Escape('*.cs') +endfunction + +function! ale_linters#cs#csc#Handle(buffer, lines) abort + " Look for lines like the following. + " + " Tests.cs(12,29): error CSXXXX: ; expected + " + " NOTE: pattern also captures file name as linter compiles all + " files within the source tree rooted at the specified source + " path and not just the file loaded in the buffer + let l:patterns = [ + \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', + \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', + \] + let l:output = [] + + let l:dir = s:GetWorkingDirectory(a:buffer) + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'code': l:match[5], + \ 'text': l:match[6] , + \}) + elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' + call add(l:output, { + \ 'filename':'', + \ 'lnum': -1, + \ 'col': -1, + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('cs',{ +\ 'name': 'csc', +\ 'output_stream': 'stdout', +\ 'executable': 'csc', +\ 'command': function('ale_linters#cs#csc#GetCommand'), +\ 'callback': 'ale_linters#cs#csc#Handle', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/cs/mcsc.vim b/sources_non_forked/ale/ale_linters/cs/mcsc.vim index dd067eba..0e4e5667 100644 --- a/sources_non_forked/ale/ale_linters/cs/mcsc.vim +++ b/sources_non_forked/ale/ale_linters/cs/mcsc.vim @@ -52,20 +52,34 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort " NOTE: pattern also captures file name as linter compiles all " files within the source tree rooted at the specified source " path and not just the file loaded in the buffer - let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$' + let l:patterns = [ + \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', + \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', + \] let l:output = [] let l:dir = s:GetWorkingDirectory(a:buffer) - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), - \ 'lnum': l:match[2] + 0, - \ 'col': l:match[3] + 0, - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', - \ 'code': l:match[5], - \ 'text': l:match[6], - \}) + for l:match in ale#util#GetMatches(a:lines, l:patterns) + if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'code': l:match[5], + \ 'text': l:match[6] , + \}) + elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' + call add(l:output, { + \ 'filename':'', + \ 'lnum': -1, + \ 'col': -1, + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endif endfor return l:output diff --git a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim new file mode 100644 index 00000000..374ef8de --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim @@ -0,0 +1,37 @@ +" Author: antew - https://github.com/antew +" Description: elm-language-server integration for elm (diagnostics, formatting, and more) + +call ale#Set('elm_ls_executable', 'elm-language-server') +call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1)) +call ale#Set('elm_ls_elm_path', 'elm') +call ale#Set('elm_ls_elm_format_path', 'elm-format') +call ale#Set('elm_ls_elm_test_path', 'elm-test') + +function! elm_ls#GetRootDir(buffer) abort + let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') + + return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' +endfunction + +function! elm_ls#GetOptions(buffer) abort + return { + \ 'runtime': 'node', + \ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'), + \ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'), + \ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'), + \} +endfunction + +call ale#linter#Define('elm', { +\ 'name': 'elm_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [ +\ 'node_modules/.bin/elm-language-server', +\ 'node_modules/.bin/elm-lsp', +\ 'elm-lsp' +\ ])}, +\ 'command': '%e --stdio', +\ 'project_root': function('elm_ls#GetRootDir'), +\ 'language': 'elm', +\ 'initialization_options': function('elm_ls#GetOptions') +\}) diff --git a/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim b/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim deleted file mode 100644 index 2259286f..00000000 --- a/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim +++ /dev/null @@ -1,22 +0,0 @@ -" Author: antew - https://github.com/antew -" Description: LSP integration for elm, currently supports diagnostics (linting) - -call ale#Set('elm_lsp_executable', 'elm-lsp') -call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0)) - -function! elm_lsp#GetRootDir(buffer) abort - let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') - - return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' -endfunction - -call ale#linter#Define('elm', { -\ 'name': 'elm_lsp', -\ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [ -\ 'node_modules/.bin/elm-lsp', -\ ])}, -\ 'command': '%e --stdio', -\ 'project_root': function('elm_lsp#GetRootDir'), -\ 'language': 'elm' -\}) diff --git a/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim new file mode 100644 index 00000000..7af64c4f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim @@ -0,0 +1,93 @@ +" Author: Autoine Gagne - https://github.com/AntoineGagne +" Description: Define a checker that runs dialyzer on Erlang files. + +let g:ale_erlang_dialyzer_executable = +\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer') +let g:ale_erlang_dialyzer_plt_file = +\ get(g:, 'ale_erlang_dialyzer_plt_file', '') +let g:ale_erlang_dialyzer_rebar3_profile = +\ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default') + +function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort + return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile') +endfunction + +function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort + let l:plt_file = '' + let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer) + let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build' . l:rebar3_profile) + + if !empty(l:plt_file_directory) + let l:plt_file = split(globpath(l:plt_file_directory, '/*_plt'), '\n') + endif + + if !empty(l:plt_file) + return l:plt_file[0] + endif + + if !empty($REBAR_PLT_DIR) + return expand('$REBAR_PLT_DIR/dialyzer/plt') + endif + + return expand('$HOME/.dialyzer_plt') +endfunction + +function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort + let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file') + + if !empty(l:plt_file) + return l:plt_file + endif + + return ale_linters#erlang#dialyzer#FindPlt(a:buffer) +endfunction + +function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'erlang_dialyzer_executable') +endfunction + +function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort + let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer)) + \ . ' -n' + \ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer)) + \ . ' -Wunmatched_returns' + \ . ' -Werror_handling' + \ . ' -Wrace_conditions' + \ . ' -Wunderspecs' + \ . ' %s' + + return l:command +endfunction + +function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort + " Match patterns like the following: + " + " erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available + let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) != 0 + let l:code = l:match[2] + + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'lcol': 0, + \ 'text': l:code, + \ 'type': 'W' + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('erlang', { +\ 'name': 'dialyzer', +\ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'), +\ 'command': function('ale_linters#erlang#dialyzer#GetCommand'), +\ 'callback': function('ale_linters#erlang#dialyzer#Handle'), +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/go/bingo.vim b/sources_non_forked/ale/ale_linters/go/bingo.vim index e446bdcc..1e43f8e4 100644 --- a/sources_non_forked/ale/ale_linters/go/bingo.vim +++ b/sources_non_forked/ale/ale_linters/go/bingo.vim @@ -5,11 +5,13 @@ call ale#Set('go_bingo_executable', 'bingo') call ale#Set('go_bingo_options', '--mode stdio') function! ale_linters#go#bingo#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options')) + return ale#go#EnvString(a:buffer) . '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options')) endfunction function! ale_linters#go#bingo#FindProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' + let l:project_root = l:go_modules_off ? + \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') let l:mods = ':h' if empty(l:project_root) diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim index 374ded35..1dfb6daa 100644 --- a/sources_non_forked/ale/ale_linters/go/gobuild.vim +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -11,6 +11,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort " Run go test in local directory with relative path return ale#path#BufferCdString(a:buffer) + \ . ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' diff --git a/sources_non_forked/ale/ale_linters/go/gofmt.vim b/sources_non_forked/ale/ale_linters/go/gofmt.vim index 337deef8..a233b422 100644 --- a/sources_non_forked/ale/ale_linters/go/gofmt.vim +++ b/sources_non_forked/ale/ale_linters/go/gofmt.vim @@ -1,10 +1,16 @@ " Author: neersighted " Description: gofmt for Go files +function! ale_linters#go#gofmt#GetCommand(buffer) abort + return ale#go#EnvString(a:buffer) + \ . '%e -e %t' +endfunction + + call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', \ 'executable': 'gofmt', -\ 'command': 'gofmt -e %t', +\ 'command': function('ale_linters#go#gofmt#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) diff --git a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim index 357f7949..dd0e975a 100644 --- a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim +++ b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim @@ -10,13 +10,16 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package') + if l:lint_package return ale#path#BufferCdString(a:buffer) + \ . ale#go#EnvString(a:buffer) \ . '%e run ' \ . l:options endif return ale#path#BufferCdString(a:buffer) + \ . ale#go#EnvString(a:buffer) \ . '%e run ' \ . ale#Escape(l:filename) \ . ' ' . l:options diff --git a/sources_non_forked/ale/ale_linters/go/golint.vim b/sources_non_forked/ale/ale_linters/go/golint.vim index 765e1477..79bfaeb5 100644 --- a/sources_non_forked/ale/ale_linters/go/golint.vim +++ b/sources_non_forked/ale/ale_linters/go/golint.vim @@ -7,7 +7,7 @@ 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' + return ale#go#EnvString(a:buffer) . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/go/gometalinter.vim b/sources_non_forked/ale/ale_linters/go/gometalinter.vim index 19d70a81..eed9550a 100644 --- a/sources_non_forked/ale/ale_linters/go/gometalinter.vim +++ b/sources_non_forked/ale/ale_linters/go/gometalinter.vim @@ -14,11 +14,13 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort " be calculated to absolute paths in the Handler if l:lint_package return ale#path#BufferCdString(a:buffer) + \ . ale#go#EnvString(a:buffer) \ . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif return ale#path#BufferCdString(a:buffer) + \ . ale#go#EnvString(a:buffer) \ . '%e' \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename)) \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim index c411dc2b..dcff5ec7 100644 --- a/sources_non_forked/ale/ale_linters/go/gopls.vim +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -6,11 +6,15 @@ call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_options', '--mode stdio') function! ale_linters#go#gopls#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) + return ale#go#EnvString(a:buffer) + \ . '%e' + \ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) endfunction function! ale_linters#go#gopls#FindProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' + let l:project_root = l:go_modules_off ? + \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') let l:mods = ':h' if empty(l:project_root) diff --git a/sources_non_forked/ale/ale_linters/go/gosimple.vim b/sources_non_forked/ale/ale_linters/go/gosimple.vim index 281a0e53..ad52c621 100644 --- a/sources_non_forked/ale/ale_linters/go/gosimple.vim +++ b/sources_non_forked/ale/ale_linters/go/gosimple.vim @@ -2,7 +2,8 @@ " Description: gosimple for Go files function! ale_linters#go#gosimple#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) . ' gosimple .' + return ale#path#BufferCdString(a:buffer) . ' ' + \ . ale#go#EnvString(a:buffer) . 'gosimple .' endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim index d5d563aa..6a5149ca 100644 --- a/sources_non_forked/ale/ale_linters/go/gotype.vim +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -6,7 +6,8 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort return '' endif - return ale#path#BufferCdString(a:buffer) . ' gotype -e .' + return ale#path#BufferCdString(a:buffer) . ' ' + \ . ale#go#EnvString(a:buffer) . 'gotype -e .' endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim index bb81d5d0..dddafe17 100644 --- a/sources_non_forked/ale/ale_linters/go/govet.vim +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -11,6 +11,7 @@ function! ale_linters#go#govet#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_govet_options') return ale#path#BufferCdString(a:buffer) . ' ' + \ . ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' .' diff --git a/sources_non_forked/ale/ale_linters/go/langserver.vim b/sources_non_forked/ale/ale_linters/go/langserver.vim index 776186c7..7130db40 100644 --- a/sources_non_forked/ale/ale_linters/go/langserver.vim +++ b/sources_non_forked/ale/ale_linters/go/langserver.vim @@ -15,8 +15,9 @@ function! ale_linters#go#langserver#GetCommand(buffer) abort endif let l:options = uniq(sort(l:options)) + let l:env = ale#go#EnvString(a:buffer) - return join(extend(l:executable, l:options), ' ') + return l:env . join(extend(l:executable, l:options), ' ') endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index 26fe0193..ed40c6c2 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -8,17 +8,18 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort let l:filename = expand('#' . a:buffer . ':t') let l:options = ale#Var(a:buffer, 'go_staticcheck_options') let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package') + let l:env = ale#go#EnvString(a:buffer) " BufferCdString is used so that we can be sure the paths output from " staticcheck can be calculated to absolute paths in the Handler if l:lint_package return ale#path#BufferCdString(a:buffer) - \ . 'staticcheck' + \ . l:env . 'staticcheck' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif return ale#path#BufferCdString(a:buffer) - \ . 'staticcheck' + \ . l:env . 'staticcheck' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' ' . ale#Escape(l:filename) endfunction diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index 3159cd55..7901ff7e 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -1,6 +1,10 @@ " Author: Devon Meunier " Description: checkstyle for Java files +call ale#Set('java_checkstyle_executable', 'checkstyle') +call ale#Set('java_checkstyle_config', '/google_checks.xml') +call ale#Set('java_checkstyle_options', '') + function! ale_linters#java#checkstyle#Handle(buffer, lines) abort let l:output = [] @@ -17,6 +21,10 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort \}) endfor + if !empty(l:output) + return l:output + endif + " old checkstyle versions let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$' @@ -31,19 +39,32 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort return l:output endfunction +function! s:GetConfig(buffer, config) abort + if ale#path#IsAbsolute(a:config) + return a:config + endif + + let s:file = ale#path#FindNearestFile(a:buffer, a:config) + + return !empty(s:file) ? s:file : a:config +endfunction + function! ale_linters#java#checkstyle#GetCommand(buffer) abort - return 'checkstyle ' - \ . ale#Var(a:buffer, 'java_checkstyle_options') + let l:options = ale#Var(a:buffer, 'java_checkstyle_options') + let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config') + let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option) + \ ? s:GetConfig(a:buffer, l:config_option) + \ : '' + + return '%e' + \ . ale#Pad(l:options) + \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' %s' endfunction -if !exists('g:ale_java_checkstyle_options') - let g:ale_java_checkstyle_options = '-c /google_checks.xml' -endif - call ale#linter#Define('java', { \ 'name': 'checkstyle', -\ 'executable': 'checkstyle', +\ 'executable': {b -> ale#Var(b, 'java_checkstyle_executable')}, \ 'command': function('ale_linters#java#checkstyle#GetCommand'), \ 'callback': 'ale_linters#java#checkstyle#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim index d0ea9d6c..2648893b 100644 --- a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -4,6 +4,8 @@ let s:version_cache = {} call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls')) +call ale#Set('java_eclipselsp_config_path', '') +call ale#Set('java_eclipselsp_workspace_path', '') call ale#Set('java_eclipselsp_executable', 'java') function! ale_linters#java#eclipselsp#Executable(buffer) abort @@ -32,11 +34,23 @@ function! ale_linters#java#eclipselsp#JarPath(buffer) abort return l:files[0] endif + " Search jar file within system package path + let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) == 1 + return l:files[0] + endif + return '' endfunction function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h') + let l:config_path = ale#Var(a:buffer, 'java_eclipselsp_config_path') + + if !empty(l:config_path) + return ale#path#Simplify(l:config_path) + endif if has('win32') let l:path = l:path . '/config_win' @@ -76,6 +90,16 @@ function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, return ale_linters#java#eclipselsp#Command(a:buffer, l:version) endfunction +function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort + let l:wspath = ale#Var(a:buffer, 'java_eclipselsp_workspace_path') + + if !empty(l:wspath) + return l:wspath + endif + + return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer)) +endfunction + function! ale_linters#java#eclipselsp#Command(buffer, version) abort let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') @@ -89,11 +113,11 @@ function! ale_linters#java#eclipselsp#Command(buffer, version) abort \ '-noverify', \ '-Xmx1G', \ '-jar', - \ ale_linters#java#eclipselsp#JarPath(a:buffer), + \ ale#Escape(ale_linters#java#eclipselsp#JarPath(a:buffer)), \ '-configuration', - \ ale_linters#java#eclipselsp#ConfigurationPath(a:buffer), + \ ale#Escape(ale_linters#java#eclipselsp#ConfigurationPath(a:buffer)), \ '-data', - \ ale#java#FindProjectRoot(a:buffer) + \ ale#Escape(ale_linters#java#eclipselsp#WorkspacePath(a:buffer)) \ ] if ale#semver#GTE(a:version, [1, 9]) diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 3883783b..8bb52c0b 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -21,6 +21,11 @@ function! ale_linters#java#javac#RunWithImportPaths(buffer) abort let l:command = ale#gradle#BuildClasspathCommand(a:buffer) endif + " Try to use Ant if Gradle and Maven aren't available + if empty(l:command) + let l:command = ale#ant#BuildClasspathCommand(a:buffer) + endif + if empty(l:command) return ale_linters#java#javac#GetCommand(a:buffer, [], {}) endif diff --git a/sources_non_forked/ale/ale_linters/java/javalsp.vim b/sources_non_forked/ale/ale_linters/java/javalsp.vim index a327363d..baf584c8 100644 --- a/sources_non_forked/ale/ale_linters/java/javalsp.vim +++ b/sources_non_forked/ale/ale_linters/java/javalsp.vim @@ -1,16 +1,47 @@ " Author: Horacio Sanson " Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac -call ale#Set('java_javalsp_executable', 'java') +call ale#Set('java_javalsp_executable', '') +call ale#Set('java_javalsp_config', {}) function! ale_linters#java#javalsp#Executable(buffer) abort return ale#Var(a:buffer, 'java_javalsp_executable') endfunction +function! ale_linters#java#javalsp#Config(buffer) abort + let l:defaults = { 'java': { 'classPath': [], 'externalDependencies': [] } } + let l:config = ale#Var(a:buffer, 'java_javalsp_config') + + " Ensure the config dictionary contains both classPath and + " externalDependencies keys to avoid a NPE crash on Java Language Server. + call extend(l:config, l:defaults, 'keep') + call extend(l:config['java'], l:defaults['java'], 'keep') + + return l:config +endfunction + function! ale_linters#java#javalsp#Command(buffer) abort let l:executable = ale_linters#java#javalsp#Executable(a:buffer) - return ale#Escape(l:executable) . ' -Xverify:none -m javacs/org.javacs.Main' + if fnamemodify(l:executable, ':t') is# 'java' + " For backward compatibility. + let l:cmd = [ + \ ale#Escape(l:executable), + \ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs', + \ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs', + \ '-m javacs/org.javacs.Main', + \] + + return join(l:cmd, ' ') + else + return ale#Escape(l:executable) + endif endfunction call ale#linter#Define('java', { @@ -20,4 +51,5 @@ call ale#linter#Define('java', { \ 'command': function('ale_linters#java#javalsp#Command'), \ 'language': 'java', \ 'project_root': function('ale#java#FindProjectRoot'), +\ 'lsp_config': function('ale_linters#java#javalsp#Config') \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/eslint.vim b/sources_non_forked/ale/ale_linters/javascript/eslint.vim index 8aeac2d8..31fb413f 100644 --- a/sources_non_forked/ale/ale_linters/javascript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/javascript/eslint.vim @@ -6,5 +6,5 @@ call ale#linter#Define('javascript', { \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'command': function('ale#handlers#eslint#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/xo.vim b/sources_non_forked/ale/ale_linters/javascript/xo.vim index 4ba39101..e24f4a82 100644 --- a/sources_non_forked/ale/ale_linters/javascript/xo.vim +++ b/sources_non_forked/ale/ale_linters/javascript/xo.vim @@ -14,7 +14,7 @@ endfunction function! ale_linters#javascript#xo#GetCommand(buffer) abort return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer)) \ . ' ' . ale#Var(a:buffer, 'javascript_xo_options') - \ . ' --reporter unix --stdin --stdin-filename %s' + \ . ' --reporter json --stdin --stdin-filename %s' endfunction " xo uses eslint and the output format is the same @@ -22,5 +22,5 @@ call ale#linter#Define('javascript', { \ 'name': 'xo', \ 'executable': function('ale_linters#javascript#xo#GetExecutable'), \ 'command': function('ale_linters#javascript#xo#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/objc/clangd.vim b/sources_non_forked/ale/ale_linters/objc/clangd.vim index ab52fec3..318d85b5 100644 --- a/sources_non_forked/ale/ale_linters/objc/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objc/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('objc_clangd_executable', 'clangd') call ale#Set('objc_clangd_options', '') -function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#objc#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objc_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('objc', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objc_clangd_executable')}, \ 'command': function('ale_linters#objc#clangd#GetCommand'), -\ 'project_root': function('ale_linters#objc#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim index 3991d2ac..29455325 100644 --- a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('objcpp_clangd_executable', 'clangd') call ale#Set('objcpp_clangd_options', '') -function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#objcpp#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objcpp_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('objcpp', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objcpp_clangd_executable')}, \ 'command': function('ale_linters#objcpp#clangd#GetCommand'), -\ 'project_root': function('ale_linters#objcpp#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/php/phpcs.vim b/sources_non_forked/ale/ale_linters/php/phpcs.vim index 1c92bbb2..11b81e84 100644 --- a/sources_non_forked/ale/ale_linters/php/phpcs.vim +++ b/sources_non_forked/ale/ale_linters/php/phpcs.vim @@ -10,13 +10,13 @@ call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpcs#GetCommand(buffer) abort let l:standard = ale#Var(a:buffer, 'php_phpcs_standard') let l:standard_option = !empty(l:standard) - \ ? '--standard=' . l:standard + \ ? '--standard=' . ale#Escape(l:standard) \ : '' - let l:options = ale#Var(a:buffer, 'php_phpcs_options') - return '%e -s --report=emacs --stdin-path=%s' - \ . ale#Pad(l:standard_option) - \ . ale#Pad(l:options) + return ale#path#BufferCdString(a:buffer) + \ . '%e -s --report=emacs --stdin-path=%s' + \ . ale#Pad(l:standard_option) + \ . ale#Pad(ale#Var(a:buffer, 'php_phpcs_options')) endfunction function! ale_linters#php#phpcs#Handle(buffer, lines) abort @@ -36,6 +36,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort \ 'col': l:match[2] + 0, \ 'text': l:text, \ 'type': l:type is# 'error' ? 'E' : 'W', + \ 'sub_type': 'style', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/powershell/powershell.vim b/sources_non_forked/ale/ale_linters/powershell/powershell.vim index 51ded71d..a63191fd 100644 --- a/sources_non_forked/ale/ale_linters/powershell/powershell.vim +++ b/sources_non_forked/ale/ale_linters/powershell/powershell.vim @@ -49,11 +49,19 @@ function! ale_linters#powershell#powershell#Handle(buffer, lines) abort let l:matchcount = 1 endif - let l:item = { - \ 'lnum': str2nr(l:match[1]), - \ 'col': str2nr(l:match[2]), - \ 'type': 'E', - \} + " If the match is 0, it was a failed match + " probably due to an unexpected token which + " contained a newline. Reset matchcount. to + " continue to the next match + if !empty(l:match[1]) + let l:item = { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'type': 'E', + \} + else + let l:matchcount = 0 + endif elseif l:matchcount == 2 " Second match[0] grabs the full line in order " to handles the text @@ -84,8 +92,8 @@ endfunction call ale#linter#Define('powershell', { \ 'name': 'powershell', -\ 'executable_callback': 'ale_linters#powershell#powershell#GetExecutable', -\ 'command_callback': 'ale_linters#powershell#powershell#GetCommand', +\ 'executable': function('ale_linters#powershell#powershell#GetExecutable'), +\ 'command': function('ale_linters#powershell#powershell#GetCommand'), \ 'output_stream': 'stdout', \ 'callback': 'ale_linters#powershell#powershell#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/pug/puglint.vim b/sources_non_forked/ale/ale_linters/pug/puglint.vim index c4e0e233..c819cc45 100644 --- a/sources_non_forked/ale/ale_linters/pug/puglint.vim +++ b/sources_non_forked/ale/ale_linters/pug/puglint.vim @@ -31,6 +31,20 @@ function! ale_linters#pug#puglint#GetCommand(buffer) abort \ . ' -r inline %t' endfunction +function! ale_linters#pug#puglint#Handle(buffer, lines) abort + for l:line in a:lines[:10] + if l:line =~# '^SyntaxError: ' + return [{ + \ 'lnum': 1, + \ 'text': 'puglint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + endfor + + return ale#handlers#unix#HandleAsError(a:buffer, a:lines) +endfunction + call ale#linter#Define('pug', { \ 'name': 'puglint', \ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [ @@ -38,5 +52,5 @@ call ale#linter#Define('pug', { \ ])}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#pug#puglint#GetCommand'), -\ 'callback': 'ale#handlers#unix#HandleAsError', +\ 'callback': 'ale_linters#pug#puglint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/purescript/ls.vim b/sources_non_forked/ale/ale_linters/purescript/ls.vim new file mode 100644 index 00000000..1c5f937f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/purescript/ls.vim @@ -0,0 +1,49 @@ +" Author: Drew Olson +" Description: Integrate ALE with purescript-language-server. + +call ale#Set('purescript_ls_executable', 'purescript-language-server') +call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('purescript_ls_config', {}) + +function! ale_linters#purescript#ls#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'purescript_ls', [ + \ 'node_modules/.bin/purescript-language-server', + \]) +endfunction + +function! ale_linters#purescript#ls#GetCommand(buffer) abort + let l:executable = ale_linters#purescript#ls#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' --stdio' +endfunction + +function! ale_linters#purescript#ls#FindProjectRoot(buffer) abort + let l:config = ale#path#FindNearestFile(a:buffer, 'bower.json') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + let l:config = ale#path#FindNearestFile(a:buffer, 'psc-package.json') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + let l:config = ale#path#FindNearestFile(a:buffer, 'spago.dhall') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + return '' +endfunction + +call ale#linter#Define('purescript', { +\ 'name': 'purescript-language-server', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#purescript#ls#GetExecutable'), +\ 'command': function('ale_linters#purescript#ls#GetCommand'), +\ 'project_root': function('ale_linters#purescript#ls#FindProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'purescript_ls_config')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index c4c6507f..dc4044e6 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -78,4 +78,5 @@ call ale#linter#Define('python', { \ 'executable': function('ale_linters#python#mypy#GetExecutable'), \ 'command': function('ale_linters#python#mypy#GetCommand'), \ 'callback': 'ale_linters#python#mypy#Handle', +\ 'output_stream': 'both' \}) diff --git a/sources_non_forked/ale/ale_linters/reason/ls.vim b/sources_non_forked/ale/ale_linters/reason/ls.vim new file mode 100644 index 00000000..fb1114ae --- /dev/null +++ b/sources_non_forked/ale/ale_linters/reason/ls.vim @@ -0,0 +1,23 @@ +" Author: David Buchan-Swanson +" Description: Integrate ALE with reason-language-server. + +call ale#Set('reason_ls_executable', '') + +function! ale_linters#reason#ls#FindProjectRoot(buffer) abort + let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json') + + if !empty(l:reason_config) + return fnamemodify(l:reason_config, ':h') + endif + + return '' +endfunction + +call ale#linter#Define('reason', { +\ 'name': 'reason-language-server', +\ 'lsp': 'stdio', +\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'), +\ 'language': 'reason', +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/sorbet.vim b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim new file mode 100644 index 00000000..ee765a6e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim @@ -0,0 +1,23 @@ +call ale#Set('ruby_sorbet_executable', 'srb') +call ale#Set('ruby_sorbet_options', '') + +function! ale_linters#ruby#sorbet#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') + let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'srb') + \ . ' tc' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --lsp --disable-watchman' +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'sorbet', +\ 'aliases': ['srb'], +\ 'lsp': 'stdio', +\ 'language': 'ruby', +\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')}, +\ 'command': function('ale_linters#ruby#sorbet#GetCommand'), +\ 'project_root': function('ale#ruby#FindProjectRoot') +\}) + diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index f98dee9b..99178585 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -25,14 +25,11 @@ endfunction function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') \ && ale#semver#GTE(a:version, [0, 17, 0]) - let l:use_all_targets = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') + let l:use_all_targets = ale#Var(a:buffer, 'rust_cargo_check_all_targets') \ && ale#semver#GTE(a:version, [0, 22, 0]) - let l:use_examples = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_examples') + let l:use_examples = ale#Var(a:buffer, 'rust_cargo_check_examples') \ && ale#semver#GTE(a:version, [0, 22, 0]) - let l:use_tests = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_tests') + let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests') \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -69,7 +66,15 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort if ale#Var(a:buffer, 'rust_cargo_use_clippy') let l:subcommand = 'clippy' - let l:clippy_options = ' ' . ale#Var(a:buffer, 'rust_cargo_clippy_options') + let l:clippy_options = ale#Var(a:buffer, 'rust_cargo_clippy_options') + + if l:clippy_options =~# '^-- ' + let l:clippy_options = join(split(l:clippy_options, '-- ')) + endif + + if l:clippy_options isnot# '' + let l:clippy_options = ' -- ' . l:clippy_options + endif endif return l:nearest_cargo_prefix . 'cargo ' diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform.vim b/sources_non_forked/ale/ale_linters/terraform/terraform.vim new file mode 100644 index 00000000..0429cb7a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform.vim @@ -0,0 +1,49 @@ +" Author: Keith Maxwell +" Description: terraform fmt to check for errors + +call ale#Set('terraform_terraform_executable', 'terraform') + +function! ale_linters#terraform#terraform#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'terraform_terraform_executable') +endfunction + +function! ale_linters#terraform#terraform#GetCommand(buffer) abort + return ale#Escape(ale_linters#terraform#terraform#GetExecutable(a:buffer)) + \ . ' fmt -no-color --check=true -' +endfunction + +function! ale_linters#terraform#terraform#Handle(buffer, lines) abort + let l:head = '^Error running fmt: In : ' + let l:output = [] + let l:patterns = [ + \ l:head.'At \(\d\+\):\(\d\+\): \(.*\)$', + \ l:head.'\(.*\)$' + \] + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + if len(l:match[2]) > 0 + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'text': l:match[3], + \ 'type': 'E', + \}) + else + call add(l:output, { + \ 'lnum': line('$'), + \ 'text': l:match[1], + \ 'type': 'E', + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform', +\ 'output_stream': 'stderr', +\ 'executable': function('ale_linters#terraform#terraform#GetExecutable'), +\ 'command': function('ale_linters#terraform#terraform#GetCommand'), +\ 'callback': 'ale_linters#terraform#terraform#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/texlab.vim b/sources_non_forked/ale/ale_linters/tex/texlab.vim new file mode 100644 index 00000000..5ead74b4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/texlab.vim @@ -0,0 +1,21 @@ +" Author: Ricardo Liang +" Description: Texlab language server (Rust rewrite) + +call ale#Set('tex_texlab_executable', 'texlab') +call ale#Set('tex_texlab_options', '') + +function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort + return '' +endfunction + +function! ale_linters#tex#texlab#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'tex_texlab_options')) +endfunction + +call ale#linter#Define('tex', { +\ 'name': 'texlab', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')}, +\ 'command': function('ale_linters#tex#texlab#GetCommand'), +\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/eslint.vim b/sources_non_forked/ale/ale_linters/typescript/eslint.vim index bf849337..33a21440 100644 --- a/sources_non_forked/ale/ale_linters/typescript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/typescript/eslint.vim @@ -5,5 +5,5 @@ call ale#linter#Define('typescript', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'command': function('ale#handlers#eslint#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/typescript/xo.vim b/sources_non_forked/ale/ale_linters/typescript/xo.vim index 8b015efd..0a3a717b 100644 --- a/sources_non_forked/ale/ale_linters/typescript/xo.vim +++ b/sources_non_forked/ale/ale_linters/typescript/xo.vim @@ -11,7 +11,7 @@ endfunction function! ale_linters#typescript#xo#GetCommand(buffer) abort return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer)) \ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options')) - \ . ' --reporter unix --stdin --stdin-filename %s' + \ . ' --reporter json --stdin --stdin-filename %s' endfunction " xo uses eslint and the output format is the same @@ -19,5 +19,5 @@ call ale#linter#Define('typescript', { \ 'name': 'xo', \ 'executable': function('ale_linters#typescript#xo#GetExecutable'), \ 'command': function('ale_linters#typescript#xo#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 04329dfd..3a4e79c8 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -156,7 +156,7 @@ function! ale#Queue(delay, ...) abort endif endfunction -let s:current_ale_version = [2, 4, 0] +let s:current_ale_version = [2, 5, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort diff --git a/sources_non_forked/ale/autoload/ale/ant.vim b/sources_non_forked/ale/autoload/ale/ant.vim new file mode 100644 index 00000000..689b444b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/ant.vim @@ -0,0 +1,41 @@ +" Author: Andrew Lee . +" Inspired by ale/gradle.vim by Michael Pardo +" Description: Functions for working with Ant projects. + +" Given a buffer number, find an Ant project root +function! ale#ant#FindProjectRoot(buffer) abort + let l:build_xml_path = ale#path#FindNearestFile(a:buffer, 'build.xml') + + if !empty(l:build_xml_path) + return fnamemodify(l:build_xml_path, ':h') + endif + + return '' +endfunction + +" Given a buffer number, find the path to the `ant` executable. Returns an empty +" string if cannot find the executable. +function! ale#ant#FindExecutable(buffer) abort + if executable('ant') + return 'ant' + endif + + return '' +endfunction + +" Given a buffer number, build a command to print the classpath of the root +" project. Returns an empty string if cannot build the command. +function! ale#ant#BuildClasspathCommand(buffer) abort + let l:executable = ale#ant#FindExecutable(a:buffer) + let l:project_root = ale#ant#FindProjectRoot(a:buffer) + + if !empty(l:executable) && !empty(l:project_root) + return ale#path#CdString(l:project_root) + \ . ale#Escape(l:executable) + \ . ' classpath' + \ . ' -S' + \ . ' -q' + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index ed90792d..dac5efb7 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -96,6 +96,13 @@ function! ale#assert#Fixer(expected_result) abort AssertEqual a:expected_result, l:result endfunction +function! ale#assert#FixerNotExecuted() abort + let l:buffer = bufnr('') + let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer))[-1] + + Assert empty(l:result), "The fixer will be executed when it shouldn't be" +endfunction + function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() @@ -158,6 +165,7 @@ endfunction function! ale#assert#SetUpFixerTestCommands() abort command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() command! -nargs=+ AssertFixer :call ale#assert#Fixer() + command! -nargs=0 AssertFixerNotExecuted :call ale#assert#FixerNotExecuted() endfunction " A dummy function for making sure this module is loaded. @@ -316,4 +324,8 @@ function! ale#assert#TearDownFixerTest() abort if exists(':AssertFixer') delcommand AssertFixer endif + + if exists(':AssertFixerNotExecuted') + delcommand AssertFixerNotExecuted + endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index a9289e22..5540ec14 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -23,104 +23,117 @@ function! ale#c#GetBuildDirectory(buffer) abort return l:build_dir endif - return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + + return ale#path#Dirname(l:json_file) endfunction - -function! ale#c#FindProjectRoot(buffer) abort - for l:project_filename in g:__ale_c_project_filenames - let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) - - if !empty(l:full_path) - let l:path = fnamemodify(l:full_path, ':h') - - " Correct .git path detection. - if fnamemodify(l:path, ':t') is# '.git' - let l:path = fnamemodify(l:path, ':h') - endif - - return l:path - endif - endfor - - return '' -endfunction - -function! ale#c#AreSpecialCharsBalanced(option) abort - " Escape \" - let l:option_escaped = substitute(a:option, '\\"', '', 'g') - - " Retain special chars only - let l:special_chars = substitute(l:option_escaped, '[^"''()`]', '', 'g') - let l:special_chars = split(l:special_chars, '\zs') - - " Check if they are balanced +function! ale#c#ShellSplit(line) abort let l:stack = [] + let l:args = [''] + let l:prev = '' - for l:char in l:special_chars - if l:char is# ')' - if len(l:stack) == 0 || get(l:stack, -1) isnot# '(' - return 0 - endif - - call remove(l:stack, -1) - elseif l:char is# '(' - call add(l:stack, l:char) - else - if len(l:stack) > 0 && get(l:stack, -1) is# l:char + for l:char in split(a:line, '\zs') + if l:char is# '''' + if len(l:stack) > 0 && get(l:stack, -1) is# '''' call remove(l:stack, -1) - else + elseif (len(l:stack) == 0 || get(l:stack, -1) isnot# '"') && l:prev isnot# '\' call add(l:stack, l:char) endif + elseif (l:char is# '"' || l:char is# '`') && l:prev isnot# '\' + if len(l:stack) > 0 && get(l:stack, -1) is# l:char + call remove(l:stack, -1) + elseif len(l:stack) == 0 || get(l:stack, -1) isnot# '''' + call add(l:stack, l:char) + endif + elseif (l:char is# '(' || l:char is# '[' || l:char is# '{') && l:prev isnot# '\' + if len(l:stack) == 0 || get(l:stack, -1) isnot# '''' + call add(l:stack, l:char) + endif + elseif (l:char is# ')' || l:char is# ']' || l:char is# '}') && l:prev isnot# '\' + if len(l:stack) > 0 && get(l:stack, -1) is# {')': '(', ']': '[', '}': '{'}[l:char] + call remove(l:stack, -1) + endif + elseif l:char is# ' ' && len(l:stack) == 0 + if len(get(l:args, -1)) > 0 + call add(l:args, '') + endif + + continue endif + + let l:args[-1] = get(l:args, -1) . l:char endfor - return len(l:stack) == 0 + return l:args endfunction function! ale#c#ParseCFlags(path_prefix, cflag_line) abort - let l:split_lines = split(a:cflag_line) + let l:cflags_list = [] + + let l:split_lines = ale#c#ShellSplit(a:cflag_line) let l:option_index = 0 while l:option_index < len(l:split_lines) - let l:next_option_index = l:option_index + 1 - - " Join space-separated option - while l:next_option_index < len(l:split_lines) - \&& stridx(l:split_lines[l:next_option_index], '-') != 0 - let l:next_option_index += 1 - endwhile - - let l:option = join(l:split_lines[l:option_index : l:next_option_index-1], ' ') - call remove(l:split_lines, l:option_index, l:next_option_index-1) - call insert(l:split_lines, l:option, l:option_index) - - " Ignore invalid or conflicting options - if stridx(l:option, '-') != 0 - \|| stridx(l:option, '-o') == 0 - \|| stridx(l:option, '-c') == 0 - call remove(l:split_lines, l:option_index) - let l:option_index = l:option_index - 1 - " Fix relative path - elseif stridx(l:option, '-I') == 0 - if !(stridx(l:option, ':') == 2+1 || stridx(l:option, '/') == 2+0) - let l:option = '-I' . a:path_prefix . s:sep . l:option[2:] - call remove(l:split_lines, l:option_index) - call insert(l:split_lines, l:option, l:option_index) - endif - endif - + let l:option = l:split_lines[l:option_index] let l:option_index = l:option_index + 1 + + " Include options, that may need relative path fix + if stridx(l:option, '-I') == 0 + \ || stridx(l:option, '-iquote') == 0 + \ || stridx(l:option, '-isystem') == 0 + \ || stridx(l:option, '-idirafter') == 0 + if stridx(l:option, '-I') == 0 && l:option isnot# '-I' + let l:arg = join(split(l:option, '\zs')[2:], '') + let l:option = '-I' + else + let l:arg = l:split_lines[l:option_index] + let l:option_index = l:option_index + 1 + endif + + " Fix relative paths if needed + if stridx(l:arg, s:sep) != 0 && stridx(l:arg, '/') != 0 + let l:rel_path = substitute(l:arg, '"', '', 'g') + let l:rel_path = substitute(l:rel_path, '''', '', 'g') + let l:arg = ale#Escape(a:path_prefix . s:sep . l:rel_path) + endif + + call add(l:cflags_list, l:option) + call add(l:cflags_list, l:arg) + " Options with arg that can be grouped with the option or separate + elseif stridx(l:option, '-D') == 0 || stridx(l:option, '-B') == 0 + call add(l:cflags_list, l:option) + + if l:option is# '-D' || l:option is# '-B' + call add(l:cflags_list, l:split_lines[l:option_index]) + let l:option_index = l:option_index + 1 + endif + " Options that have an argument (always separate) + elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 + \ || l:option is# '-isysroot' || l:option is# '-imultilib' + call add(l:cflags_list, l:option) + call add(l:cflags_list, l:split_lines[l:option_index]) + let l:option_index = l:option_index + 1 + " Options without argument + elseif (stridx(l:option, '-W') == 0 && stridx(l:option, '-Wa,') != 0 && stridx(l:option, '-Wl,') != 0 && stridx(l:option, '-Wp,') != 0) + \ || l:option is# '-w' || stridx(l:option, '-pedantic') == 0 + \ || l:option is# '-ansi' || stridx(l:option, '-std=') == 0 + \ || (stridx(l:option, '-f') == 0 && stridx(l:option, '-fdump') != 0 && stridx(l:option, '-fdiagnostics') != 0 && stridx(l:option, '-fno-show-column') != 0) + \ || stridx(l:option, '-O') == 0 + \ || l:option is# '-C' || l:option is# '-CC' || l:option is# '-trigraphs' + \ || stridx(l:option, '-nostdinc') == 0 || stridx(l:option, '-iplugindir=') == 0 + \ || stridx(l:option, '--sysroot=') == 0 || l:option is# '--no-sysroot-suffix' + \ || stridx(l:option, '-m') == 0 + call add(l:cflags_list, l:option) + endif endwhile - call uniq(l:split_lines) - - return join(l:split_lines, ' ') + return join(l:cflags_list, ' ') endfunction function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort if !g:ale_c_parse_makefile - return '' + return v:null endif let l:buffer_filename = expand('#' . a:buffer . ':t') @@ -140,14 +153,17 @@ function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort return ale#c#ParseCFlags(l:makefile_dir, l:cflag_line) endfunction -" Given a buffer number, find the build subdirectory with compile commands -" The subdirectory is returned without the trailing / +" Given a buffer number, find the project directory containing +" compile_commands.json, and the path to the compile_commands.json file. +" +" If compile_commands.json cannot be found, two empty strings will be +" returned. function! ale#c#FindCompileCommands(buffer) abort " Look above the current source file to find compile_commands.json let l:json_file = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') if !empty(l:json_file) - return l:json_file + return [fnamemodify(l:json_file, ':h'), l:json_file] endif " Search in build directories if we can't find it in the project. @@ -157,12 +173,42 @@ function! ale#c#FindCompileCommands(buffer) abort let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json' if filereadable(l:json_file) - return l:json_file + return [l:path, l:json_file] endif endfor endfor - return '' + return ['', ''] +endfunction + +" Find the project root for C/C++ projects. +" +" The location of compile_commands.json will be used to find project roots. +" +" If compile_commands.json cannot be found, other common configuration files +" will be used to detect the project root. +function! ale#c#FindProjectRoot(buffer) abort + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + + " Fall back on detecting the project root based on other filenames. + if empty(l:root) + for l:project_filename in g:__ale_c_project_filenames + let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) + + if !empty(l:full_path) + let l:path = fnamemodify(l:full_path, ':h') + + " Correct .git path detection. + if fnamemodify(l:path, ':t') is# '.git' + let l:path = fnamemodify(l:path, ':h') + endif + + return l:path + endif + endfor + endif + + return l:root endfunction " Cache compile_commands.json data in a Dictionary, so we don't need to read @@ -194,10 +240,14 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:raw_data = [] silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), '')) + if type(l:raw_data) isnot v:t_list + let l:raw_data = [] + endif + let l:file_lookup = {} let l:dir_lookup = {} - for l:entry in l:raw_data + for l:entry in (type(l:raw_data) is v:t_list ? l:raw_data : []) let l:basename = tolower(fnamemodify(l:entry.file, ':t')) let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry] @@ -274,25 +324,25 @@ function! ale#c#FlagsFromCompileCommands(buffer, compile_commands_file) abort endfunction function! ale#c#GetCFlags(buffer, output) abort - let l:cflags = ' ' + let l:cflags = v:null if ale#Var(a:buffer, 'c_parse_makefile') && !empty(a:output) let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) endif if ale#Var(a:buffer, 'c_parse_compile_commands') - let l:json_file = ale#c#FindCompileCommands(a:buffer) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) if !empty(l:json_file) let l:cflags = ale#c#FlagsFromCompileCommands(a:buffer, l:json_file) endif endif - if l:cflags is# ' ' + if l:cflags is v:null let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) endif - return l:cflags + return l:cflags isnot v:null ? l:cflags : '' endfunction function! ale#c#GetMakeCommand(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 03cc6471..ebf32909 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -52,6 +52,7 @@ let s:should_complete_map = { \ 'lisp': s:lisp_regex, \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', +\ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$', \} " Regular expressions for finding the start column to replace with completion. @@ -59,11 +60,13 @@ let s:omni_start_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$', \} -" A map of exact characters for triggering LSP completions. +" A map of exact characters for triggering LSP completions. Do not forget to +" update self.input_patterns in ale.py in updating entries in this map. let s:trigger_character_map = { \ '': ['.'], \ 'typescript': ['.', '''', '"'], \ 'rust': ['.', '::'], +\ 'cpp': ['.', '::', '->'], \} function! s:GetFiletypeValue(map, filetype) abort @@ -169,7 +172,7 @@ function! s:ReplaceCompletionOptions() abort let b:ale_old_omnifunc = &l:omnifunc endif - let &l:omnifunc = 'ale#completion#OmniFunc' + let &l:omnifunc = 'ale#completion#AutomaticOmniFunc' endif if l:source is# 'ale-automatic' @@ -215,19 +218,11 @@ function! ale#completion#GetCompletionPosition() abort return l:column - len(l:match) - 1 endfunction +function! ale#completion#GetCompletionPositionForDeoplete(input) abort + return match(a:input, '\k*$') +endfunction + function! ale#completion#GetCompletionResult() abort - " Parse a new response if there is one. - if exists('b:ale_completion_response') - \&& exists('b:ale_completion_parser') - let l:response = b:ale_completion_response - let l:parser = b:ale_completion_parser - - unlet b:ale_completion_response - unlet b:ale_completion_parser - - let b:ale_completion_result = function(l:parser)(l:response) - endif - if exists('b:ale_completion_result') return b:ale_completion_result endif @@ -235,7 +230,7 @@ function! ale#completion#GetCompletionResult() abort return v:null endfunction -function! ale#completion#OmniFunc(findstart, base) abort +function! ale#completion#AutomaticOmniFunc(findstart, base) abort if a:findstart return ale#completion#GetCompletionPosition() else @@ -247,15 +242,20 @@ function! ale#completion#OmniFunc(findstart, base) abort endif endfunction -function! ale#completion#Show(response, completion_parser) abort +function! ale#completion#Show(result) abort if ale#util#Mode() isnot# 'i' return endif " Set the list in the buffer, temporarily replace omnifunc with our " function, and then start omni-completion. - let b:ale_completion_response = a:response - let b:ale_completion_parser = a:completion_parser + let b:ale_completion_result = a:result + + " Don't try to open the completion menu if there's nothing to show. + if empty(b:ale_completion_result) + return + endif + " Replace completion options shortly before opening the menu. call s:ReplaceCompletionOptions() @@ -267,6 +267,14 @@ function! ale#completion#Show(response, completion_parser) abort \ {-> ale#util#FeedKeys("\(ale_show_completion_menu)")} \) endif + + if l:source is# 'ale-callback' + call b:CompleteCallback(b:ale_completion_result) + endif +endfunction + +function! ale#completion#GetAllTriggers() abort + return deepcopy(s:trigger_character_map) endfunction function! s:CompletionStillValid(request_id) abort @@ -279,6 +287,8 @@ function! s:CompletionStillValid(request_id) abort \&& ( \ b:ale_completion_info.column == l:column \ || b:ale_completion_info.source is# 'deoplete' + \ || b:ale_completion_info.source is# 'ale-omnifunc' + \ || b:ale_completion_info.source is# 'ale-callback' \) endfunction @@ -474,8 +484,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort endif elseif l:command is# 'completionEntryDetails' call ale#completion#Show( - \ a:response, - \ 'ale#completion#ParseTSServerCompletionEntryDetails', + \ ale#completion#ParseTSServerCompletionEntryDetails(a:response), \) endif endfunction @@ -487,8 +496,7 @@ function! ale#completion#HandleLSPResponse(conn_id, response) abort endif call ale#completion#Show( - \ a:response, - \ 'ale#completion#ParseLSPCompletions', + \ ale#completion#ParseLSPCompletions(a:response), \) endfunction @@ -529,10 +537,7 @@ function! s:OnReady(linter, lsp_details) abort let l:message = ale#lsp#message#Completion( \ l:buffer, \ b:ale_completion_info.line, - \ min([ - \ b:ale_completion_info.line_length, - \ b:ale_completion_info.column, - \ ]) + 1, + \ b:ale_completion_info.column, \ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix), \) endif @@ -564,13 +569,26 @@ endfunction " This function can be used to manually trigger autocomplete, even when " g:ale_completion_enabled is set to false -function! ale#completion#GetCompletions(source) abort +function! ale#completion#GetCompletions(...) abort + let l:source = get(a:000, 0, '') + let l:options = get(a:000, 1, {}) + + if len(a:000) > 2 + throw 'Too many arguments!' + endif + + let l:CompleteCallback = get(l:options, 'callback', v:null) + + if l:CompleteCallback isnot v:null + let b:CompleteCallback = l:CompleteCallback + endif + let [l:line, l:column] = getpos('.')[1:2] let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) - if a:source is# 'ale-automatic' && empty(l:prefix) - return + if l:source is# 'ale-automatic' && empty(l:prefix) + return 0 endif let l:line_length = len(getline('.')) @@ -582,18 +600,47 @@ function! ale#completion#GetCompletions(source) abort \ 'prefix': l:prefix, \ 'conn_id': 0, \ 'request_id': 0, - \ 'source': a:source, + \ 'source': l:source, \} unlet! b:ale_completion_result let l:buffer = bufnr('') let l:Callback = function('s:OnReady') + let l:started = 0 + for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) - call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) + if ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) + let l:started = 1 + endif endif endfor + + return l:started +endfunction + +function! ale#completion#OmniFunc(findstart, base) abort + if a:findstart + let l:started = ale#completion#GetCompletions('ale-omnifunc') + + if !l:started + " This is the special value for cancelling completions silently. + " See :help complete-functions + return -3 + endif + + return ale#completion#GetCompletionPosition() + else + let l:result = ale#completion#GetCompletionResult() + + while l:result is v:null && !complete_check() + sleep 2ms + let l:result = ale#completion#GetCompletionResult() + endwhile + + return l:result isnot v:null ? l:result : [] + endif endfunction function! s:TimerHandler(...) abort diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index e4bf5e7e..379c0d73 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -62,7 +62,7 @@ function! s:Echo(message) abort execute 'echo a:message' endfunction -function! s:GetLinterVariables(filetype, linter_names) abort +function! s:GetLinterVariables(filetype, exclude_linter_names) abort let l:variable_list = [] let l:filetype_parts = split(a:filetype, '\.') @@ -73,7 +73,7 @@ function! s:GetLinterVariables(filetype, linter_names) abort " Include matching variables. if !empty(l:match) \&& index(l:filetype_parts, l:match[1]) >= 0 - \&& index(a:linter_names, l:match[2]) >= 0 + \&& index(a:exclude_linter_names, l:match[2]) == -1 call add(l:variable_list, l:key) endif endfor @@ -211,10 +211,11 @@ function! ale#debugging#Info() abort let l:all_names = map(copy(l:all_linters), 'v:val[''name'']') let l:enabled_names = map(copy(l:enabled_linters), 'v:val[''name'']') + let l:exclude_names = filter(copy(l:all_names), 'index(l:enabled_names, v:val) == -1') " Load linter variables to display " This must be done after linters are loaded. - let l:variable_list = s:GetLinterVariables(l:filetype, l:enabled_names) + let l:variable_list = s:GetLinterVariables(l:filetype, l:exclude_names) let l:fixers = ale#fix#registry#SuggestedFixers(l:filetype) let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1])) @@ -238,6 +239,12 @@ function! ale#debugging#Info() abort endfunction function! ale#debugging#InfoToClipboard() abort + if !has('clipboard') + call s:Echo('clipboard not available. Try :ALEInfoToFile instead.') + + return + endif + redir => l:output silent call ale#debugging#Info() redir END diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 7db808d6..491d3c2e 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -710,6 +710,10 @@ function! ale#engine#Cleanup(buffer) abort return endif + if exists('*ale#lsp#CloseDocument') + call ale#lsp#CloseDocument(a:buffer) + endif + if !has_key(g:ale_buffer_info, a:buffer) return endif diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index c3dbd378..da554ef9 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -128,7 +128,7 @@ function! ale#events#Init() abort endif if g:ale_lint_on_insert_leave - autocmd InsertLeave * call ale#Queue(0) + autocmd InsertLeave * if ale#Var(str2nr(expand('')), 'lint_on_insert_leave') | call ale#Queue(0) | endif endif if g:ale_echo_cursor || g:ale_cursor_detail diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index 92ae3e14..9987fbdd 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -2,46 +2,60 @@ call ale#Set('fix_on_save_ignore', {}) " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. -function! ale#fix#ApplyQueuedFixes() abort - let l:buffer = bufnr('') - let l:data = get(g:ale_fix_buffer_data, l:buffer, {'done': 0}) +function! ale#fix#ApplyQueuedFixes(buffer) abort + let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0}) + let l:has_bufline_api = exists('*deletebufline') && exists('*setbufline') - if !l:data.done + if !l:data.done || (!l:has_bufline_api && a:buffer isnot bufnr('')) return endif - call remove(g:ale_fix_buffer_data, l:buffer) + call remove(g:ale_fix_buffer_data, a:buffer) if l:data.changes_made - let l:start_line = len(l:data.output) + 1 - let l:end_line = len(l:data.lines_before) - - if l:end_line >= l:start_line - let l:save = winsaveview() - silent execute l:start_line . ',' . l:end_line . 'd_' - call winrestview(l:save) - endif - " If the file is in DOS mode, we have to remove carriage returns from " the ends of lines before calling setline(), or we will see them " twice. - let l:lines_to_set = getbufvar(l:buffer, '&fileformat') is# 'dos' + let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' \ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')') \ : l:data.output + let l:first_line_to_remove = len(l:new_lines) + 1 - call setline(1, l:lines_to_set) + " Use a Vim API for setting lines in other buffers, if available. + if l:has_bufline_api + call setbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, l:first_line_to_remove, '$') + " Fall back on setting lines the old way, for the current buffer. + else + let l:old_line_length = len(l:data.lines_before) + + if l:old_line_length >= l:first_line_to_remove + let l:save = winsaveview() + silent execute + \ l:first_line_to_remove . ',' . l:old_line_length . 'd_' + call winrestview(l:save) + endif + + call setline(1, l:new_lines) + endif if l:data.should_save - if empty(&buftype) - noautocmd :w! + if a:buffer is bufnr('') + if empty(&buftype) + noautocmd :w! + else + set nomodified + endif else - set nomodified + call writefile(l:new_lines, expand(a:buffer . ':p')) " no-custom-checks + call setbufvar(a:buffer, '&modified', 0) endif endif endif if l:data.should_save - let l:should_lint = g:ale_fix_on_save + let l:should_lint = ale#Var(a:buffer, 'fix_on_save') + \ && ale#Var(a:buffer, 'lint_on_save') else let l:should_lint = l:data.changes_made endif @@ -52,7 +66,7 @@ function! ale#fix#ApplyQueuedFixes() abort " fixing problems. if g:ale_enabled \&& l:should_lint - \&& !ale#events#QuitRecently(l:buffer) + \&& !ale#events#QuitRecently(a:buffer) call ale#Queue(0, l:data.should_save ? 'lint_file' : '') endif endfunction @@ -83,7 +97,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort " We can only change the lines of a buffer which is currently open, " so try and apply the fixes to the current buffer. - call ale#fix#ApplyQueuedFixes() + call ale#fix#ApplyQueuedFixes(a:buffer) endfunction function! s:HandleExit(job_info, buffer, job_output, data) abort @@ -399,5 +413,4 @@ endfunction " Set up an autocmd command to try and apply buffer fixes when available. augroup ALEBufferFixGroup autocmd! - autocmd BufEnter * call ale#fix#ApplyQueuedFixes() -augroup END + autocmd BufEnter * call ale#fix#ApplyQueuedFixes(str2nr(expand(''))) diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 3a36f367..7a553ccc 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -115,6 +115,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['scala'], \ 'description': 'Fix Scala files using scalafmt', \ }, +\ 'sorbet': { +\ 'function': 'ale#fixers#sorbet#Fix', +\ 'suggested_filetypes': ['ruby'], +\ 'description': 'Fix ruby files with srb tc --autocorrect.', +\ }, \ 'standard': { \ 'function': 'ale#fixers#standard#Fix', \ 'suggested_filetypes': ['javascript'], @@ -145,6 +150,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with php-cs-fixer.', \ }, +\ 'clangtidy': { +\ 'function': 'ale#fixers#clangtidy#Fix', +\ 'suggested_filetypes': ['c', 'cpp', 'objc'], +\ 'description': 'Fix C/C++ and ObjectiveC files with clang-tidy.', +\ }, \ 'clang-format': { \ 'function': 'ale#fixers#clangformat#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'cuda'], @@ -205,6 +215,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with brittany.', \ }, +\ 'hindent': { +\ 'function': 'ale#fixers#hindent#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with hindent.', +\ }, \ 'hlint': { \ 'function': 'ale#fixers#hlint#Fix', \ 'suggested_filetypes': ['haskell'], @@ -297,7 +312,7 @@ let s:default_registry = { \ }, \ 'styler': { \ 'function': 'ale#fixers#styler#Fix', -\ 'suggested_filetypes': ['r'], +\ 'suggested_filetypes': ['r', 'rmarkdown'], \ 'description': 'Fix R files with styler.', \ }, \ 'latexindent': { @@ -305,6 +320,21 @@ let s:default_registry = { \ 'suggested_filetypes': ['tex'], \ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.', \ }, +\ 'pgformatter': { +\ 'function': 'ale#fixers#pgformatter#Fix', +\ 'suggested_filetypes': ['sql'], +\ 'description': 'A PostgreSQL SQL syntax beautifier', +\ }, +\ 'reorder-python-imports': { +\ 'function': 'ale#fixers#reorder_python_imports#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Sort Python imports with reorder-python-imports.', +\ }, +\ 'gnatpp': { +\ 'function': 'ale#fixers#gnatpp#Fix', +\ 'suggested_filetypes': ['ada'], +\ 'description': 'Format Ada files with gnatpp.', +\ }, \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index 367b8d52..fba6c3b4 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -29,6 +29,10 @@ function! ale#fixers#black#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'python_black_options') + if expand('#' . a:buffer . ':e') is? 'pyi' + let l:options .= '--pyi' + endif + return { \ 'command': l:cd_string . ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim index eae1a7b4..ea5743a5 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim @@ -13,10 +13,15 @@ function! ale#fixers#clangformat#GetExecutable(buffer) abort endfunction function! ale#fixers#clangformat#Fix(buffer) abort + let l:executable = ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) + let l:filename = ale#Escape(bufname(a:buffer)) let l:options = ale#Var(a:buffer, 'c_clangformat_options') - return { - \ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) - \ . ' ' . l:options, - \} + let l:command = l:executable . ' --assume-filename=' . l:filename + + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return {'command': l:command} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim b/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim new file mode 100644 index 00000000..b37360a7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim @@ -0,0 +1,52 @@ +scriptencoding utf-8 +" Author: ObserverOfTime +" Description: Fixing C/C++ files with clang-tidy. + +function! s:set_variables() abort + let l:use_global = get(g:, 'ale_use_global_executables', 0) + + for l:ft in ['c', 'cpp'] + call ale#Set(l:ft . '_clangtidy_executable', 'clang-tidy') + call ale#Set(l:ft . '_clangtidy_use_global', l:use_global) + call ale#Set(l:ft . '_clangtidy_checks', []) + call ale#Set(l:ft . '_clangtidy_options', '') + call ale#Set(l:ft . '_clangtidy_extra_options', '') + call ale#Set(l:ft . '_clangtidy_fix_errors', 1) + endfor + + call ale#Set('c_build_dir', '') +endfunction + +call s:set_variables() + +function! ale#fixers#clangtidy#Var(buffer, name) abort + let l:ft = getbufvar(str2nr(a:buffer), '&filetype') + let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' + + return ale#Var(a:buffer, l:ft . '_clangtidy_' . a:name) +endfunction + +function! ale#fixers#clangtidy#GetCommand(buffer) abort + let l:checks = join(ale#fixers#clangtidy#Var(a:buffer, 'checks'), ',') + let l:extra_options = ale#fixers#clangtidy#Var(a:buffer, 'extra_options') + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:options = empty(l:build_dir) + \ ? ale#fixers#clangtidy#Var(a:buffer, 'options') : '' + let l:fix_errors = ale#fixers#clangtidy#Var(a:buffer, 'fix_errors') + + return ' -fix' . (l:fix_errors ? ' -fix-errors' : '') + \ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks)) + \ . (empty(l:extra_options) ? '' : ' ' . l:extra_options) + \ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir)) + \ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options) +endfunction + +function! ale#fixers#clangtidy#Fix(buffer) abort + let l:executable = ale#fixers#clangtidy#Var(a:buffer, 'executable') + let l:command = ale#fixers#clangtidy#GetCommand(a:buffer) + + return { + \ 'command': ale#Escape(l:executable) . l:command, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index 0f57cba6..62e692b1 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -35,9 +35,18 @@ endfunction function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) - let l:config = ale#handlers#eslint#FindConfig(a:buffer) + let l:options = ale#Var(a:buffer, 'javascript_eslint_options') - if empty(l:config) + " Use the configuration file from the options, if configured. + if l:options =~# '\v(^| )-c|(^| )--config' + let l:config = '' + let l:has_config = 1 + else + let l:config = ale#handlers#eslint#FindConfig(a:buffer) + let l:has_config = !empty(l:config) + endif + + if !l:has_config return 0 endif @@ -45,6 +54,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-to-stdout', \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', \} @@ -54,6 +64,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort if ale#semver#GTE(a:version, [4, 9, 0]) return { \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', \} @@ -61,7 +72,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort return { \ 'command': ale#node#Executable(a:buffer, l:executable) - \ . ' -c ' . ale#Escape(l:config) + \ . ale#Pad(l:options) + \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' --fix %t', \ 'read_temporary_file': 1, \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim b/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim new file mode 100644 index 00000000..bf3d484e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim @@ -0,0 +1,17 @@ +" Author: tim +" Description: Fix files with gnatpp. + +call ale#Set('ada_gnatpp_executable', 'gnatpp') +call ale#Set('ada_gnatpp_options', '') + +function! ale#fixers#gnatpp#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ada_gnatpp_executable') + let l:options = ale#Var(a:buffer, 'ada_gnatpp_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim index 66b67a9e..d5a539b9 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim @@ -7,9 +7,10 @@ call ale#Set('go_gofmt_options', '') function! ale#fixers#gofmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_gofmt_executable') let l:options = ale#Var(a:buffer, 'go_gofmt_options') + let l:env = ale#go#EnvString(a:buffer) return { - \ 'command': ale#Escape(l:executable) + \ 'command': l:env . ale#Escape(l:executable) \ . ' -l -w' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', diff --git a/sources_non_forked/ale/autoload/ale/fixers/goimports.vim b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim index 783d0206..65f0fd98 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/goimports.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim @@ -7,13 +7,14 @@ call ale#Set('go_goimports_options', '') function! ale#fixers#goimports#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_goimports_executable') let l:options = ale#Var(a:buffer, 'go_goimports_options') + let l:env = ale#go#EnvString(a:buffer) if !executable(l:executable) return 0 endif return { - \ 'command': ale#Escape(l:executable) + \ 'command': l:env . ale#Escape(l:executable) \ . ' -l -w -srcdir %s' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', diff --git a/sources_non_forked/ale/autoload/ale/fixers/gomod.vim b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim index 68895f9b..ee8c46c9 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/gomod.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim @@ -2,9 +2,10 @@ call ale#Set('go_go_executable', 'go') function! ale#fixers#gomod#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_go_executable') + let l:env = ale#go#EnvString(a:buffer) return { - \ 'command': ale#Escape(l:executable) . ' mod edit -fmt %t', + \ 'command': l:env . ale#Escape(l:executable) . ' mod edit -fmt %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/hindent.vim b/sources_non_forked/ale/autoload/ale/fixers/hindent.vim new file mode 100644 index 00000000..b6009a2c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/hindent.vim @@ -0,0 +1,20 @@ +" Author: AlexeiDrake +" Description: Integration of hindent formatting with ALE. +" +call ale#Set('haskell_hindent_executable', 'hindent') + +function! ale#fixers#hindent#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hindent_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hindent') +endfunction + +function! ale#fixers#hindent#Fix(buffer) abort + let l:executable = ale#fixers#hindent#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim b/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim new file mode 100644 index 00000000..9ea08ec6 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim @@ -0,0 +1,12 @@ +call ale#Set('sql_pgformatter_executable', 'pg_format') +call ale#Set('sql_pgformatter_options', '') + +function! ale#fixers#pgformatter#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sql_pgformatter_executable') + let l:options = ale#Var(a:buffer, 'sql_pgformatter_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index b7f0ecd7..23120777 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -39,9 +39,15 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_options') let l:parser = '' + let l:filetypes = split(getbufvar(a:buffer, '&filetype'), '\.') + + if index(l:filetypes, 'handlebars') > -1 + let l:parser = 'glimmer' + endif + " Append the --parser flag depending on the current filetype (unless it's " already set in g:javascript_prettier_options). - if empty(expand('#' . a:buffer . ':e')) && match(l:options, '--parser') == -1 + if empty(expand('#' . a:buffer . ':e')) && l:parser is# '' && match(l:options, '--parser') == -1 " Mimic Prettier's defaults. In cases without a file extension or " filetype (scratch buffer), Prettier needs `parser` set to know how " to process the buffer. @@ -65,7 +71,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort \ 'html': 'html', \} - for l:filetype in split(getbufvar(a:buffer, '&filetype'), '\.') + for l:filetype in l:filetypes if has_key(l:prettier_parsers, l:filetype) let l:parser = l:prettier_parsers[l:filetype] break diff --git a/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim b/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim new file mode 100644 index 00000000..42a0a6e2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim @@ -0,0 +1,25 @@ +" Author: jake +" Description: Fixing Python imports with reorder-python-imports. + +call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports') +call ale#Set('python_reorder_python_imports_options', '') +call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#reorder_python_imports#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_reorder_python_imports', + \ ['reorder-python-imports'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim b/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim new file mode 100644 index 00000000..182f7300 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim @@ -0,0 +1,19 @@ +call ale#Set('ruby_sorbet_executable', 'srb') +call ale#Set('ruby_sorbet_options', '') + +function! ale#fixers#sorbet#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') + let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') + + return ale#handlers#ruby#EscapeExecutable(l:executable, 'srb') + \ . ' tc' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --autocorrect --file %t' +endfunction + +function! ale#fixers#sorbet#Fix(buffer) abort + return { + \ 'command': ale#fixers#sorbet#GetCommand(a:buffer), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/go.vim b/sources_non_forked/ale/autoload/ale/go.vim index cd7d9503..4a21e596 100644 --- a/sources_non_forked/ale/autoload/ale/go.vim +++ b/sources_non_forked/ale/autoload/ale/go.vim @@ -25,3 +25,20 @@ function! ale#go#FindProjectRoot(buffer) abort return '' endfunction + + +call ale#Set('go_go111module', '') + +" Return a string setting Go-specific environment variables +function! ale#go#EnvString(buffer) abort + let l:env = '' + + " GO111MODULE - turn go modules behavior on/off + let l:go111module = ale#Var(a:buffer, 'go_go111module') + + if !empty(l:go111module) + let l:env = ale#Env('GO111MODULE', l:go111module) . l:env + endif + + return l:env +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim index 29dd6aed..1e2aa318 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim @@ -3,15 +3,17 @@ scriptencoding utf-8 " Description: Utilities for ccls function! ale#handlers#ccls#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root') + " Try to find ccls configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.ccls-root') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + if empty(l:config) + let l:config = ale#path#FindNearestFile(a:buffer, '.ccls') endif - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim index dc56cd0b..6d8fa15d 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -1,5 +1,46 @@ " Description: Handle errors for cppcheck. +function! ale#handlers#cppcheck#GetCdCommand(buffer) abort + let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) + let l:cd_command = !empty(l:dir) ? ale#path#CdString(l:dir) : '' + + return l:cd_command +endfunction + +function! ale#handlers#cppcheck#GetBufferPathIncludeOptions(buffer) abort + let l:buffer_path_include = '' + + " Get path to this buffer so we can include it into cppcheck with -I + " This could be expanded to get more -I directives from the compile + " command in compile_commands.json, if it's found. + let l:buffer_path = fnamemodify(bufname(a:buffer), ':p:h') + let l:buffer_path_include = ' -I' . ale#Escape(l:buffer_path) + + return l:buffer_path_include +endfunction + +function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort + " If the current buffer is modified, using compile_commands.json does no + " good, so include the file's directory instead. It's not quite as good as + " using --project, but is at least equivalent to running cppcheck on this + " file manually from the file's directory. + let l:modified = getbufvar(a:buffer, '&modified') + + if l:modified + return '' + endif + + " Search upwards from the file for compile_commands.json. + " + " If we find it, we'll `cd` to where the compile_commands.json file is, + " then use the file to set up import paths, etc. + let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) + + return !empty(l:json_path) + \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) + \ : '' +endfunction + function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort " Look for lines like the following. " diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index 5183f4cd..4d533ff2 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -44,16 +44,9 @@ function! ale#handlers#eslint#GetCommand(buffer) abort return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -f unix --stdin --stdin-filename %s' + \ . ' -f json --stdin --stdin-filename %s' endfunction -let s:col_end_patterns = [ -\ '\vParsing error: Unexpected token (.+) ?', -\ '\v''(.+)'' is not defined.', -\ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', -\ '\vUnexpected (console) statement', -\] - function! s:AddHintsForTypeScriptParsingErrors(output) abort for l:item in a:output let l:item.text = substitute( @@ -90,22 +83,71 @@ function! s:CheckForBadConfig(buffer, lines) abort return 0 endfunction -function! ale#handlers#eslint#Handle(buffer, lines) abort - if s:CheckForBadConfig(a:buffer, a:lines) - return [{ - \ 'lnum': 1, - \ 'text': 'eslint configuration error (type :ALEDetail for more information)', - \ 'detail': join(a:lines, "\n"), - \}] +function! s:parseJSON(buffer, lines) abort + try + let l:parsed = json_decode(a:lines[-1]) + catch + return [] + endtry + + if type(l:parsed) != v:t_list || empty(l:parsed) + return [] endif - if a:lines == ['Could not connect'] - return [{ - \ 'lnum': 1, - \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', - \}] + let l:errors = l:parsed[0]['messages'] + + if empty(l:errors) + return [] endif + let l:output = [] + + for l:error in l:errors + let l:obj = ({ + \ 'lnum': get(l:error, 'line', 0), + \ 'text': get(l:error, 'message', ''), + \ 'type': 'E', + \}) + + if get(l:error, 'severity', 0) is# 1 + let l:obj.type = 'W' + endif + + if has_key(l:error, 'ruleId') + let l:code = l:error['ruleId'] + + " Sometimes ESLint returns null here + if !empty(l:code) + let l:obj.code = l:code + endif + endif + + if has_key(l:error, 'column') + let l:obj.col = l:error['column'] + endif + + if has_key(l:error, 'endColumn') + let l:obj.end_col = l:error['endColumn'] - 1 + endif + + if has_key(l:error, 'endLine') + let l:obj.end_lnum = l:error['endLine'] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + +let s:col_end_patterns = [ +\ '\vParsing error: Unexpected token (.+) ?', +\ '\v''(.+)'' is not defined.', +\ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', +\ '\vUnexpected (console) statement', +\] + +function! s:parseLines(buffer, lines) abort " Matches patterns line the following: " " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle] @@ -120,12 +162,6 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:parsing_pattern]) let l:text = l:match[3] - if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') - if l:text =~# '^File ignored' - continue - endif - endif - let l:obj = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, @@ -143,11 +179,6 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort " The code can be something like 'Error/foo/bar', or just 'Error' if !empty(get(l:split_code, 1)) let l:obj.code = join(l:split_code[1:], '/') - - if l:obj.code is# 'no-trailing-spaces' - \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - continue - endif endif for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns) @@ -157,9 +188,59 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort call add(l:output, l:obj) endfor + return l:output +endfunction + +function! s:FilterResult(buffer, obj) abort + if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') + if a:obj.text =~# '^File ignored' + return 0 + endif + endif + + if has_key(a:obj, 'code') && a:obj.code is# 'no-trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + return 0 + endif + + return 1 +endfunction + +function! s:HandleESLintOutput(buffer, lines, type) abort + if s:CheckForBadConfig(a:buffer, a:lines) + return [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + + if a:lines == ['Could not connect'] + return [{ + \ 'lnum': 1, + \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', + \}] + endif + + if a:type is# 'json' + let l:output = s:parseJSON(a:buffer, a:lines) + else + let l:output = s:parseLines(a:buffer, a:lines) + endif + + call filter(l:output, {idx, obj -> s:FilterResult(a:buffer, obj)}) + if expand('#' . a:buffer . ':t') =~? '\.tsx\?$' call s:AddHintsForTypeScriptParsingErrors(l:output) endif return l:output endfunction + +function! ale#handlers#eslint#HandleJSON(buffer, lines) abort + return s:HandleESLintOutput(a:buffer, a:lines, 'json') +endfunction + +function! ale#handlers#eslint#Handle(buffer, lines) abort + return s:HandleESLintOutput(a:buffer, a:lines, 'lines') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim index 72d639da..ec16b977 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim @@ -11,6 +11,7 @@ let s:pragma_error = '#pragma once in main file' " :10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' +let s:inline_pattern = '\v inlined from .* at \:(\d+):(\d+):$' function! s:IsHeaderFile(filename) abort return a:filename =~? '\v\.(h|hpp)$' @@ -25,6 +26,28 @@ function! s:RemoveUnicodeQuotes(text) abort return l:text endfunction +function! s:ParseInlinedFunctionProblems(buffer, lines) abort + let l:output = [] + let l:pos_match = [] + + for l:line in a:lines + let l:match = matchlist(l:line, s:pattern) + + if !empty(l:match) && !empty(l:pos_match) + call add(l:output, { + \ 'lnum': str2nr(l:pos_match[1]), + \ 'col': str2nr(l:pos_match[2]), + \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W', + \ 'text': s:RemoveUnicodeQuotes(l:match[5]), + \}) + endif + + let l:pos_match = matchlist(l:line, s:inline_pattern) + endfor + + return l:output +endfunction + " Report problems inside of header files just for gcc and clang function! s:ParseProblemsInHeaders(buffer, lines) abort let l:output = [] @@ -129,6 +152,7 @@ endfunction function! ale#handlers#gcc#HandleGCCFormatWithIncludes(buffer, lines) abort let l:output = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) + call extend(l:output, s:ParseInlinedFunctionProblems(a:buffer, a:lines)) call extend(l:output, s:ParseProblemsInHeaders(a:buffer, a:lines)) return l:output diff --git a/sources_non_forked/ale/autoload/ale/handlers/rust.vim b/sources_non_forked/ale/autoload/ale/handlers/rust.vim index dda6466e..a7fac464 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/rust.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/rust.vim @@ -56,14 +56,20 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort endif if !empty(l:span) - call add(l:output, { + let l:output_line = { \ 'lnum': l:span.line_start, \ 'end_lnum': l:span.line_end, \ 'col': l:span.column_start, \ 'end_col': l:span.column_end-1, \ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label), \ 'type': toupper(l:error.level[0]), - \}) + \} + + if has_key(l:error, 'rendered') && !empty(l:error.rendered) + let l:output_line.detail = l:error.rendered + endif + + call add(l:output, l:output_line) endif endfor endfor diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index 172f9d54..cb7911e1 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -26,41 +26,6 @@ endif let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) -" Check if we have neovim's buffer highlight API -" -" Below we define some functions' implementation conditionally if this API -" exists or not. -" -" The API itself is more ergonomic and neovim performs highlights positions -" rebases during edits so we see less stalled highlights. -let s:nvim_api = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') - -function! ale#highlight#HasNeovimApi() abort - return s:nvim_api -endfunction - -function! ale#highlight#nvim_buf_clear_namespace(...) abort - return call('nvim_buf_clear_namespace', a:000) -endfunction - -function! ale#highlight#nvim_buf_add_highlight(...) abort - return call('nvim_buf_add_highlight', a:000) -endfunction - -function! s:ale_nvim_highlight_id(bufnr) abort - let l:id = getbufvar(a:bufnr, 'ale_nvim_highlight_id', -1) - - if l:id is -1 - " NOTE: This will highlight nothing but will allocate new id - let l:id = ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, 0, '', 0, 0, -1 - \) - call setbufvar(a:bufnr, 'ale_nvim_highlight_id', l:id) - endif - - return l:id -endfunction - function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort if a:line >= a:end_line " For single lines, just return the one position. @@ -86,88 +51,29 @@ endfunction " except these which have matching loclist item entries. function! ale#highlight#RemoveHighlights() abort - if ale#highlight#HasNeovimApi() - if get(b:, 'ale_nvim_highlight_id', 0) - let l:bufnr = bufnr('%') - " NOTE: 0, -1 means from 0 line till the end of buffer - call ale#highlight#nvim_buf_clear_namespace( - \ l:bufnr, - \ b:ale_nvim_highlight_id, - \ 0, -1 - \) + for l:match in getmatches() + if l:match.group =~? '\v^ALE(Style)?(Error|Warning|Info)(Line)?$' + call matchdelete(l:match.id) endif - else - for l:match in getmatches() - if l:match.group =~# '^ALE' - call matchdelete(l:match.id) - endif - endfor - endif + endfor endfunction function! s:highlight_line(bufnr, lnum, group) abort - if ale#highlight#HasNeovimApi() - let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) - call ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, l:highlight_id, a:group, - \ a:lnum - 1, 0, -1 - \) - else - call matchaddpos(a:group, [a:lnum]) - endif + call matchaddpos(a:group, [a:lnum]) endfunction function! s:highlight_range(bufnr, range, group) abort - if ale#highlight#HasNeovimApi() - let l:highlight_id = s:ale_nvim_highlight_id(a:bufnr) - " NOTE: lines and columns indicies are 0-based in nvim_buf_* API. - let l:lnum = a:range.lnum - 1 - let l:end_lnum = a:range.end_lnum - 1 - let l:col = a:range.col - 1 - let l:end_col = a:range.end_col - - if l:lnum >= l:end_lnum - " For single lines, just return the one position. - call ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, l:highlight_id, a:group, - \ l:lnum, l:col, l:end_col - \) - else - " highlight first line from start till the line end - call ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, l:highlight_id, a:group, - \ l:lnum, l:col, -1 - \) - - " highlight all lines between the first and last entirely - let l:cur = l:lnum + 1 - - while l:cur < l:end_lnum - call ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, l:highlight_id, a:group, - \ l:cur, 0, -1 - \ ) - let l:cur += 1 - endwhile - - call ale#highlight#nvim_buf_add_highlight( - \ a:bufnr, l:highlight_id, a:group, - \ l:end_lnum, 0, l:end_col - \) - endif - else - " Set all of the positions, which are chunked into Lists which - " are as large as will be accepted by matchaddpos. - call map( - \ ale#highlight#CreatePositions( - \ a:range.lnum, - \ a:range.col, - \ a:range.end_lnum, - \ a:range.end_col - \ ), - \ 'matchaddpos(a:group, v:val)' - \) - endif + " Set all of the positions, which are chunked into Lists which + " are as large as will be accepted by matchaddpos. + call map( + \ ale#highlight#CreatePositions( + \ a:range.lnum, + \ a:range.col, + \ a:range.end_lnum, + \ a:range.end_col + \ ), + \ 'matchaddpos(a:group, v:val)' + \) endfunction function! ale#highlight#UpdateHighlights() abort diff --git a/sources_non_forked/ale/autoload/ale/java.vim b/sources_non_forked/ale/autoload/ale/java.vim index b7fd10bd..e641ac6c 100644 --- a/sources_non_forked/ale/autoload/ale/java.vim +++ b/sources_non_forked/ale/autoload/ale/java.vim @@ -16,5 +16,11 @@ function! ale#java#FindProjectRoot(buffer) abort return fnamemodify(l:maven_pom_file, ':h') endif + let l:ant_root = ale#ant#FindProjectRoot(a:buffer) + + if !empty(l:ant_root) + return l:ant_root + endif + return '' endfunction diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 8c657675..78dcd3a2 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -13,10 +13,13 @@ let s:default_ale_linter_aliases = { \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', \ 'plaintex': 'tex', +\ 'rmarkdown': 'r', \ 'systemverilog': 'verilog', \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], +\ 'xsd': ['xsd', 'xml'], +\ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} @@ -355,12 +358,14 @@ function! ale#linter#Define(filetype, linter) abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg + let l:new_linter = ale#linter#PreProcess(a:filetype, a:linter) + if !has_key(s:linters, a:filetype) let s:linters[a:filetype] = [] endif - let l:new_linter = ale#linter#PreProcess(a:filetype, a:linter) - + " Remove previously defined linters with the same name. + call filter(s:linters[a:filetype], 'v:val.name isnot# a:linter.name') call add(s:linters[a:filetype], l:new_linter) endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 63d97f35..4bfe2a7b 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -71,8 +71,8 @@ function! s:FixList(buffer, list) abort return l:new_list endfunction -function! s:BufWinId(buffer) abort - return exists('*bufwinid') ? bufwinid(str2nr(a:buffer)) : 0 +function! s:WinFindBuf(buffer) abort + return exists('*win_findbuf') ? win_findbuf(str2nr(a:buffer)) : [0] endfunction function! s:SetListsImpl(timer_id, buffer, loclist) abort @@ -88,19 +88,24 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort call setqflist([], 'r', {'title': l:title}) endif elseif g:ale_set_loclist - " If windows support is off, bufwinid() may not exist. + " If windows support is off, win_findbuf() may not exist. " We'll set result in the current window, which might not be correct, " but it's better than nothing. - let l:id = s:BufWinId(a:buffer) + let l:ids = s:WinFindBuf(a:buffer) - if has('nvim') - call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) - else - call setloclist(l:id, s:FixList(a:buffer, a:loclist)) - call setloclist(l:id, [], 'r', {'title': l:title}) - endif + for l:id in l:ids + if has('nvim') + call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) + else + call setloclist(l:id, s:FixList(a:buffer, a:loclist)) + call setloclist(l:id, [], 'r', {'title': l:title}) + endif + endfor endif + " Save the current view before opening/closing any window + call setbufvar(a:buffer, 'ale_winview', winsaveview()) + " Open a window to show the problems if we need to. " " We'll check if the current buffer's List is not empty here, so the @@ -108,8 +113,6 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort if s:ShouldOpen(a:buffer) && !empty(a:loclist) let l:winnr = winnr() let l:mode = mode() - let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\" - let l:reset_character_selection = l:mode is? 's' || l:mode is# "\" " open windows vertically instead of default horizontally let l:open_type = '' @@ -131,15 +134,18 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort wincmd p endif - if l:reset_visual_selection || l:reset_character_selection - " If we were in a selection mode before, select the last selection. - normal! gv - - if l:reset_character_selection - " Switch back to Select mode, if we were in that. + " Return to original mode when applicable + if mode() != l:mode + if l:mode is? 'v' || l:mode is# "\" + " Reset our last visual selection + normal! gv + elseif l:mode is? 's' || l:mode is# "\" + " Reset our last character selection normal! "\" endif endif + + call s:RestoreViewIfNeeded(a:buffer) endif " If ALE isn't currently checking for more problems, close the window if @@ -150,6 +156,30 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort endif endfunction +" Try to restore the window view after closing any of the lists to avoid making +" the it moving around, especially useful when on insert mode +function! s:RestoreViewIfNeeded(buffer) abort + let l:saved_view = getbufvar(a:buffer, 'ale_winview', {}) + + " Saved view is empty, can't do anything + if empty(l:saved_view) + return + endif + + " Check wether the cursor has moved since linting was actually requested. If + " the user has indeed moved lines, do nothing + let l:current_view = winsaveview() + + if l:current_view['lnum'] != l:saved_view['lnum'] + return + endif + + " Anchor view by topline if the list is set to open horizontally + if ale#Var(a:buffer, 'list_vertical') == 0 + call winrestview({'topline': l:saved_view['topline']}) + endif +endfunction + function! ale#list#SetLists(buffer, loclist) abort if get(g:, 'ale_set_lists_synchronously') == 1 \|| getbufvar(a:buffer, 'ale_save_event_fired', 0) @@ -173,21 +203,31 @@ function! s:CloseWindowIfNeeded(buffer) abort return endif + let l:did_close_any_list = 0 + try " Only close windows if the quickfix list or loclist is completely empty, " including errors set through other means. if g:ale_set_quickfix if empty(getqflist()) cclose + let l:did_close_any_list = 1 endif else - let l:win_id = s:BufWinId(a:buffer) + let l:win_ids = s:WinFindBuf(a:buffer) - if g:ale_set_loclist && empty(getloclist(l:win_id)) - lclose - endif + for l:win_id in l:win_ids + if g:ale_set_loclist && empty(getloclist(l:win_id)) + lclose + let l:did_close_any_list = 1 + endif + endfor endif " Ignore 'Cannot close last window' errors. catch /E444/ endtry + + if l:did_close_any_list + call s:RestoreViewIfNeeded(a:buffer) + endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/loclist_jumping.vim b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim index 1d3ef7e5..55097d12 100644 --- a/sources_non_forked/ale/autoload/ale/loclist_jumping.vim +++ b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim @@ -111,7 +111,7 @@ function! ale#loclist_jumping#Jump(direction, ...) abort if !empty(l:nearest) normal! m` - call cursor(l:nearest) + call cursor([l:nearest[0], max([l:nearest[1], 1])]) endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index 7186d2a9..017096cd 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -321,7 +321,69 @@ endfunction function! s:SendInitMessage(conn) abort let [l:init_id, l:init_data] = ale#lsp#CreateMessageData( - \ ale#lsp#message#Initialize(a:conn.root, a:conn.init_options), + \ ale#lsp#message#Initialize( + \ a:conn.root, + \ a:conn.init_options, + \ { + \ 'workspace': { + \ 'applyEdit': v:false, + \ 'didChangeConfiguration': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'symbol': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'workspaceFolders': v:false, + \ 'configuration': v:false, + \ }, + \ 'textDocument': { + \ 'synchronization': { + \ 'dynamicRegistration': v:false, + \ 'willSave': v:false, + \ 'willSaveWaitUntil': v:false, + \ 'didSave': v:true, + \ }, + \ 'completion': { + \ 'dynamicRegistration': v:false, + \ 'completionItem': { + \ 'snippetSupport': v:false, + \ 'commitCharactersSupport': v:false, + \ 'documentationFormat': ['plaintext'], + \ 'deprecatedSupport': v:false, + \ 'preselectSupport': v:false, + \ }, + \ 'contextSupport': v:false, + \ }, + \ 'hover': { + \ 'dynamicRegistration': v:false, + \ 'contentFormat': ['plaintext'], + \ }, + \ 'references': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'documentSymbol': { + \ 'dynamicRegistration': v:false, + \ 'hierarchicalDocumentSymbolSupport': v:false, + \ }, + \ 'definition': { + \ 'dynamicRegistration': v:false, + \ 'linkSupport': v:false, + \ }, + \ 'typeDefinition': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'publishDiagnostics': { + \ 'relatedInformation': v:true, + \ }, + \ 'codeAction': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'rename': { + \ 'dynamicRegistration': v:false, + \ }, + \ }, + \ }, + \ ), \) let a:conn.init_request_id = l:init_id call s:SendMessageData(a:conn, l:init_data) @@ -484,6 +546,35 @@ function! ale#lsp#OpenDocument(conn_id, buffer, language_id) abort return l:opened endfunction +" Notify LSP servers or tsserver that a document is closed, if opened before. +" If a document is closed, 1 will be returned, otherwise 0 will be returned. +" +" Only the buffer number is required here. A message will be sent to every +" language server that was notified previously of the document being opened. +function! ale#lsp#CloseDocument(buffer) abort + let l:closed = 0 + + " The connection keys are sorted so the messages are easier to test, and + " so messages are sent in a consistent order. + for l:conn_id in sort(keys(s:connections)) + let l:conn = s:connections[l:conn_id] + + if l:conn.initialized && has_key(l:conn.open_documents, a:buffer) + if l:conn.is_tsserver + let l:message = ale#lsp#tsserver_message#Close(a:buffer) + else + let l:message = ale#lsp#message#DidClose(a:buffer) + endif + + call ale#lsp#Send(l:conn_id, l:message) + call remove(l:conn.open_documents, a:buffer) + let l:closed = 1 + endif + endfor + + return l:closed +endfunction + " Notify LSP servers or tsserver that a document has changed, if needed. " If a notification is sent, 1 will be returned, otherwise 0 will be returned. function! ale#lsp#NotifyForChanges(conn_id, buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index 4ad94c4b..b6b14a22 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -28,14 +28,13 @@ function! ale#lsp#message#GetNextVersionID() abort return l:id endfunction -function! ale#lsp#message#Initialize(root_path, initialization_options) abort - " TODO: Define needed capabilities. +function! ale#lsp#message#Initialize(root_path, options, capabilities) abort " NOTE: rootPath is deprecated in favour of rootUri return [0, 'initialize', { \ 'processId': getpid(), \ 'rootPath': a:root_path, - \ 'capabilities': {}, - \ 'initializationOptions': a:initialization_options, + \ 'capabilities': a:capabilities, + \ 'initializationOptions': a:options, \ 'rootUri': ale#path#ToURI(a:root_path), \}] endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index 9ce05260..30da77e1 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -90,7 +90,7 @@ function! ale#lsp#response#ReadTSServerDiagnostics(response) abort \ 'lnum': l:diagnostic.start.line, \ 'col': l:diagnostic.start.offset, \ 'end_lnum': l:diagnostic.end.line, - \ 'end_col': l:diagnostic.end.offset, + \ 'end_col': l:diagnostic.end.offset - 1, \} if has_key(l:diagnostic, 'code') diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index f70042dd..190a16b4 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -8,6 +8,9 @@ if !has_key(s:, 'lsp_linter_map') let s:lsp_linter_map = {} endif +" A Dictionary to track one-shot handlers for custom LSP requests +let s:custom_handlers_map = get(s:, 'custom_handlers_map', {}) + " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnore(buffer, linter_name) abort " Ignore all diagnostics if LSP integration is disabled. @@ -31,7 +34,7 @@ endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] let l:filename = ale#path#FromURI(a:response.params.uri) - let l:buffer = bufnr(l:filename) + let l:buffer = bufnr('^' . l:filename . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) @@ -49,7 +52,7 @@ endfunction function! s:HandleTSServerDiagnostics(response, error_type) abort let l:linter_name = 'tsserver' - let l:buffer = bufnr(a:response.body.file) + let l:buffer = bufnr('^' . a:response.body.file . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) @@ -407,9 +410,57 @@ endfunction " Clear LSP linter data for the linting engine. function! ale#lsp_linter#ClearLSPData() abort let s:lsp_linter_map = {} + let s:custom_handlers_map = {} endfunction " Just for tests. function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort let s:lsp_linter_map = a:replacement_map endfunction + +function! s:HandleLSPResponseToCustomRequests(conn_id, response) abort + if has_key(a:response, 'id') + \&& has_key(s:custom_handlers_map, a:response.id) + let l:Handler = remove(s:custom_handlers_map, a:response.id) + call l:Handler(a:response) + endif +endfunction + +function! s:OnReadyForCustomRequests(args, linter, lsp_details) abort + let l:id = a:lsp_details.connection_id + let l:request_id = ale#lsp#Send(l:id, a:args.message) + + if l:request_id > 0 && has_key(a:args, 'handler') + let l:Callback = function('s:HandleLSPResponseToCustomRequests') + call ale#lsp#RegisterCallback(l:id, l:Callback) + let s:custom_handlers_map[l:request_id] = a:args.handler + endif +endfunction + +" Send a custom request to an LSP linter. +function! ale#lsp_linter#SendRequest(buffer, linter_name, message, ...) abort + let l:filetype = ale#linter#ResolveFiletype(getbufvar(a:buffer, '&filetype')) + let l:linter_list = ale#linter#GetAll(l:filetype) + let l:linter_list = filter(l:linter_list, {_, v -> v.name is# a:linter_name}) + + if len(l:linter_list) < 1 + throw 'Linter "' . a:linter_name . '" not found!' + endif + + let l:linter = l:linter_list[0] + + if empty(l:linter.lsp) + throw 'Linter "' . a:linter_name . '" does not support LSP!' + endif + + let l:is_notification = a:message[0] + let l:callback_args = {'message': a:message} + + if !l:is_notification && a:0 + let l:callback_args.handler = a:1 + endif + + let l:Callback = function('s:OnReadyForCustomRequests', [l:callback_args]) + + return ale#lsp_linter#StartLSP(a:buffer, l:linter, l:Callback) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index 60d42eb5..84c26d0a 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -3,13 +3,20 @@ " simplify a path, and fix annoying issues with paths on Windows. " -" Forward slashes are changed to back slashes so path equality works better. +" Forward slashes are changed to back slashes so path equality works better +" on Windows. Back slashes are changed to forward slashes on Unix. +" +" Unix paths can technically contain back slashes, but in practice no path +" should, and replacing back slashes with forward slashes makes linters work +" in environments like MSYS. " " Paths starting with more than one forward slash are changed to only one " forward slash, to prevent the paths being treated as special MSYS paths. function! ale#path#Simplify(path) abort if has('unix') - return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks + let l:unix_path = substitute(a:path, '\\', '/', 'g') + + return substitute(simplify(l:unix_path), '^//\+', '/', 'g') " no-custom-checks endif let l:win_path = substitute(a:path, '/', '\\', 'g') diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 2f28214b..7ed22367 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -25,7 +25,7 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/tox.ini') \|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/pycodestyle.cfg') - \|| filereadable(l:path . '/flake8.cfg') + \|| filereadable(l:path . '/.flake8') \|| filereadable(l:path . '/.flake8rc') \|| filereadable(l:path . '/pylama.ini') \|| filereadable(l:path . '/pylintrc') diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 7395b0e2..eb0dd1cd 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -82,6 +82,34 @@ execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info) \ . ' texthl=ALEInfoSign linehl=ALEInfoLine' sign define ALEDummySign +if has('nvim-0.3.2') + if !hlexists('ALEErrorSignLineNr') + highlight link ALEErrorSignLineNr CursorLineNr + endif + + if !hlexists('ALEStyleErrorSignLineNr') + highlight link ALEStyleErrorSignLineNr CursorLineNr + endif + + if !hlexists('ALEWarningSignLineNr') + highlight link ALEWarningSignLineNr CursorLineNr + endif + + if !hlexists('ALEStyleWarningSignLineNr') + highlight link ALEStyleWarningSignLineNr CursorLineNr + endif + + if !hlexists('ALEInfoSignLineNr') + highlight link ALEInfoSignLineNr CursorLineNr + endif + + sign define ALEErrorSign numhl=ALEErrorSignLineNr + sign define ALEStyleErrorSign numhl=ALEStyleErrorSignLineNr + sign define ALEWarningSign numhl=ALEWarningSignLineNr + sign define ALEStyleWarningSign numhl=ALEStyleWarningSignLineNr + sign define ALEInfoSign numhl=ALEInfoSignLineNr +endif + function! ale#sign#GetSignName(sublist) abort let l:priority = g:ale#util#style_warning_priority diff --git a/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim b/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim new file mode 100644 index 00000000..ce793773 --- /dev/null +++ b/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim @@ -0,0 +1,26 @@ +function! asyncomplete#sources#ale#get_source_options(...) abort + let l:default = extend({ + \ 'name': 'ale', + \ 'completor': function('asyncomplete#sources#ale#completor'), + \ 'whitelist': ['*'], + \ 'triggers': asyncomplete#sources#ale#get_triggers(), + \ }, a:0 >= 1 ? a:1 : {}) + + return extend(l:default, {'refresh_pattern': '\k\+$'}) +endfunction + +function! asyncomplete#sources#ale#get_triggers() abort + let l:triggers = ale#completion#GetAllTriggers() + let l:triggers['*'] = l:triggers[''] + + return l:triggers +endfunction + +function! asyncomplete#sources#ale#completor(options, context) abort + let l:keyword = matchstr(a:context.typed, '\w\+$') + let l:startcol = a:context.col - len(l:keyword) + + call ale#completion#GetCompletions('ale-callback', { 'callback': {completions -> + \ asyncomplete#complete(a:options.name, a:context, l:startcol, completions) + \ }}) +endfunction diff --git a/sources_non_forked/ale/doc/ale-ada.txt b/sources_non_forked/ale/doc/ale-ada.txt index 93e3261a..2ac30c0a 100644 --- a/sources_non_forked/ale/doc/ale-ada.txt +++ b/sources_non_forked/ale/doc/ale-ada.txt @@ -21,5 +21,16 @@ g:ale_ada_gcc_options *g:ale_ada_gcc_options* This variable can be set to pass additional options to gcc. +=============================================================================== +gnatpp *ale-ada-gnatpp* + +g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options* + *b:ale_ada_gnatpp_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to the gnatpp fixer. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index be0a3d77..c9eb79db 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -156,7 +156,7 @@ g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clang-tidy. + This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using @@ -169,6 +169,23 @@ g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* of the |g:ale_c_build_dir_names| directories of the project tree. +g:ale_c_clangtidy_extra_options *g:ale_c_clangtidy_extra_options* + *b:ale_c_clangtidy_extra_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + +g:ale_c_clangtidy_fix_errors *g:ale_c_clangtidy_fix_errors* + *b:ale_c_clangtidy_fix_errors* + Type: |Number| + Default: `1` + + This variable can be changed to disable the `-fix-errors` option for the + |clangtidy| fixer. + + =============================================================================== cppcheck *ale-c-cppcheck* diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt index e1f64ab5..ead3be28 100644 --- a/sources_non_forked/ale/doc/ale-cpp.txt +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -125,7 +125,7 @@ g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clang-tidy. + This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using @@ -138,6 +138,23 @@ g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* of the |g:ale_c_build_dir_names| directories of the project tree. +g:ale_cpp_clangtidy_extra_options *g:ale_cpp_clangtidy_extra_options* + *b:ale_cpp_clangtidy_extra_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + +g:ale_cpp_clangtidy_fix_errors *g:ale_cpp_clangtidy_fix_errors* + *b:ale_cpp_clangtidy_fix_errors* + Type: |Number| + Default: `1` + + This variable can be changed to disable the `-fix-errors` option for the + |clangtidy| fixer. + + =============================================================================== clazy *ale-cpp-clazy* diff --git a/sources_non_forked/ale/doc/ale-cs.txt b/sources_non_forked/ale/doc/ale-cs.txt index 01e6348f..abcc43eb 100644 --- a/sources_non_forked/ale/doc/ale-cs.txt +++ b/sources_non_forked/ale/doc/ale-cs.txt @@ -6,11 +6,97 @@ In addition to the linters that are provided with ALE, C# code can be checked with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim +=============================================================================== +csc *ale-cs-csc* + + The |ale-cs-csc| linter checks for semantic errors when files are opened or + saved. + + See |ale-lint-file-linters| for more information on linters which do not + check for problems while you type. + + The csc linter uses the mono csc compiler providing full c# 7 and newer + support to generate a temporary module target file (/t:module). The module + includes including all '*.cs' files contained in the directory tree rooted + at the path defined by the |g:ale_cs_csc_source| or |b:ale_cs_csc_source| + variabl and all sub directories. + + It will in future replace the |ale-cs-mcs| and |ale-cs-mcsc| linters as both + utilizer the mcsc compiler which according to mono porject ist further + developed and as of writint these lines only receives maintenance updates. + The down is that the csc compiler does not support the -sytax option any more + and therefore |ale-cs-csc| linter doese not offer any as you type syntax + checking like the |ale-cs-mcsc| linter doesn't. + + The paths to search for additional assembly files can be specified using the + |g:ale_cs_csc_assembly_path| or |b:ale_cs_csc_assembly_path| variables. + + NOTE: ALE will not find any errors in files apart from syntax errors if any + one of the source files contains a syntax error. Syntax errors must be fixed + first before other errors will be shown. + + +g:ale_cs_csc_options *g:ale_cs_csc_options* + *b:ale_cs_csc_options* + Type: |String| + Default: `''` + + This option can be set to pass additional arguments to the `csc` compiler. + + For example, to add the dotnet package which is not added per default: > + + let g:ale_cs_mcs_options = ' /warn:4 /langversion:7.2' +< + NOTE: the `/unsafe` option is always passed to `csc`. + + +g:ale_cs_csc_source *g:ale_cs_csc_source* + *b:ale_cs_csc_source* + Type: |String| + Default: `''` + + This variable defines the root path of the directory tree searched for the + '*.cs' files to be linted. If this option is empty, the source file's + directory will be used. + + NOTE: Currently it is not possible to specify sub directories and + directory sub trees which shall not be searched for *.cs files. + + +g:ale_cs_csc_assembly_path *g:ale_cs_csc_assembly_path* + *b:ale_cs_csc_assembly_path* + Type: |List| + Default: `[]` + + This variable defines a list of path strings to be searched for external + assembly files. The list is passed to the csc compiler using the `/lib:` + flag. + + +g:ale_cs_csc_assemblies *g:ale_cs_csc_assemblies* + *b:ale_cs_csc_assemblies* + Type: |List| + Default: `[]` + + This variable defines a list of external assembly (*.dll) files required + by the mono mcs compiler to generate a valid module target. The list is + passed the csc compiler using the `/r:` flag. + + For example: > + + " Compile C# programs with the Unity engine DLL file on Mac. + let g:ale_cs_mcsc_assemblies = [ + \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll', + \ 'path-to-unityproject/obj/Debug', + \] +< + =============================================================================== mcs *ale-cs-mcs* - The `mcs` linter looks only for syntax errors while you type. See |ale-cs-mcsc| - for the separately configured linter for checking for semantic errors. + The `mcs` linter looks only for syntax errors while you type. See + |ale-cs-mcsc| for the separately configured linter for checking for semantic + errors. g:ale_cs_mcs_options *g:ale_cs_mcs_options* diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 9c9f0394..16b16483 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -151,9 +151,9 @@ ALE is tested with a suite of tests executed in Travis CI and AppVeyor. ALE runs tests with the following versions of Vim in the following environments. 1. Vim 8.0.0027 on Linux via Travis CI. -2. Vim 8.1.0204 on Linux via Travis CI. +2. Vim 8.1.0519 on Linux via Travis CI. 3. NeoVim 0.2.0 on Linux via Travis CI. -4. NeoVim 0.3.0 on Linux via Travis CI. +4. NeoVim 0.3.5 on Linux via Travis CI. 5. Vim 8 (stable builds) on Windows via AppVeyor. If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs @@ -351,6 +351,7 @@ given the above setup are as follows. `GivenCommandOutput [...]` - Define output for ale#command#Run. `AssertFixer results` - Check the fixer results +`AssertFixerNotExecuted` - Check that fixers will not be executed. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-elm.txt b/sources_non_forked/ale/doc/ale-elm.txt index bb7a6132..823b53e1 100644 --- a/sources_non_forked/ale/doc/ale-elm.txt +++ b/sources_non_forked/ale/doc/ale-elm.txt @@ -29,20 +29,44 @@ g:ale_elm_format_options *g:ale_elm_format_options* This variable can be set to pass additional options to elm-format. =============================================================================== -elm-lsp *ale-elm-elm-lsp* +elm-ls *ale-elm-elm-ls* -g:ale_elm_lsp_executable *g:ale_elm_lsp_executable* - *b:ale_elm_lsp_executable* +g:ale_elm_ls_executable *g:ale_elm_ls_executable* + *b:ale_elm_ls_executable* Type: |String| - Default: `'elm-lsp'` + Default: `'elm-language-server'` See |ale-integrations-local-executables| -g:ale_elm_lsp_use_global *g:ale_elm_lsp_use_global* - *b:ale_elm_lsp_use_global* +g:ale_elm_ls_use_global *g:ale_elm_ls_use_global* + *b:ale_elm_ls_use_global* Type: |Number| - Default: `get(g:, 'ale_use_global_executables', 0)` + Default: `get(g:, 'ale_use_global_executables', 1)` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_path *g:ale_elm_ls_elm_path* + *b:ale_elm_ls_elm_path* + Type: |String| + Default: `'elm'` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_format_path *g:ale_elm_ls_elm_format_path* + *b:ale_elm_ls_elm_format_path* + Type: |String| + Default: `'elm-format'` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_test_path *g:ale_elm_ls_elm_test_path* + *b:ale_elm_ls_elm_test_path* + Type: |String| + Default: `'elm-test'` See |ale-integrations-local-executables| diff --git a/sources_non_forked/ale/doc/ale-erlang.txt b/sources_non_forked/ale/doc/ale-erlang.txt index ad3c1e5a..59993a99 100644 --- a/sources_non_forked/ale/doc/ale-erlang.txt +++ b/sources_non_forked/ale/doc/ale-erlang.txt @@ -3,6 +3,35 @@ ALE Erlang Integration *ale-erlang-options* =============================================================================== +dialyzer *ale-erlang-dialyzer* + +g:ale_erlang_dialyzer_executable *g:ale_erlang_dialyzer_executable* + *b:ale_erlang_dialyzer_executable* + Type: |String| + Default: `'dialyzer'` + + This variable can be changed to specify the dialyzer executable. + + +g:ale_erlang_dialyzer_plt_file *g:ale_erlang_dialyzer_plt_file* + *b:ale_erlang_dialyzer_plt_file* + Type: |String| + + This variable can be changed to specify the path to the PLT file. By + default, it will search for the PLT file inside the `_build` directory. If + there isn't one, it will fallback to the path `$REBAR_PLT_DIR/dialyzer/plt`. + Otherwise, it will default to `$HOME/.dialyzer_plt`. + + +g:ale_erlang_dialyzer_rebar3_profile *g:ale_erlang_dialyzer_rebar3_profile* + *b:ale_erlang_dialyzer_rebar3_profile* + Type: |String| + Default: `'default'` + + This variable can be changed to specify the profile that is used to + run dialyzer with rebar3. + +------------------------------------------------------------------------------- erlc *ale-erlang-erlc* g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 611e3fdd..be53783e 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -30,6 +30,16 @@ g:ale_go_go_executable *g:ale_go_go_options* the `gomod` fixer. +g:ale_go_go111module *g:ale_go_go111module* + *b:ale_go_go111module* + Type: |String| + Default: `''` + + Override the value of the `$GO111MODULE` environment variable for + golang tools. + + + =============================================================================== bingo *ale-go-bingo* diff --git a/sources_non_forked/ale/doc/ale-handlebars.txt b/sources_non_forked/ale/doc/ale-handlebars.txt index 061c5d3c..5daec5b3 100644 --- a/sources_non_forked/ale/doc/ale-handlebars.txt +++ b/sources_non_forked/ale/doc/ale-handlebars.txt @@ -2,6 +2,13 @@ ALE Handlebars Integration *ale-handlebars-options* +=============================================================================== +prettier *ale-handlebars-prettier* + +See |ale-javascript-prettier| for information about the available options. +Uses glimmer parser by default. + + =============================================================================== ember-template-lint *ale-handlebars-embertemplatelint* diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index e2073e37..5dd3ec15 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -12,6 +12,7 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* This variable can be changed to use a different executable for brittany. + =============================================================================== floskell *ale-haskell-floskell* @@ -22,6 +23,7 @@ g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable* This variable can be changed to use a different executable for floskell. + =============================================================================== ghc *ale-haskell-ghc* @@ -32,6 +34,7 @@ g:ale_haskell_ghc_options *g:ale_haskell_ghc_options* This variable can be changed to modify flags given to ghc. + =============================================================================== ghc-mod *ale-haskell-ghc-mod* @@ -42,6 +45,7 @@ g:ale_haskell_ghc_mod_executable *g:ale_haskell_ghc_mod_executable* This variable can be changed to use a different executable for ghc-mod. + =============================================================================== cabal-ghc *ale-haskell-cabal-ghc* @@ -53,6 +57,7 @@ g:ale_haskell_cabal_ghc_options *g:ale_haskell_cabal_ghc_options* This variable can be changed to modify flags given to ghc through cabal exec. + =============================================================================== hdevtools *ale-haskell-hdevtools* @@ -87,6 +92,18 @@ g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable* This variable can be changed to use a different executable for hfmt. + +=============================================================================== +hindent *ale-haskell-hindent* + +g:ale_haskell_hindent_executable *g:ale_haskell_hindent_executable* + *b:ale_haskell_hindent_executable* + Type: |String| + Default: `'hindent'` + + This variable can be changed to use a different executable for hindent. + + =============================================================================== hlint *ale-haskell-hlint* @@ -106,6 +123,7 @@ g:ale_haskell_hlint_options g:ale_haskell_hlint_options This variable can be used to pass extra options to the underlying hlint executable. + =============================================================================== stack-build *ale-haskell-stack-build* @@ -117,6 +135,7 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* We default to using `'--fast'`. Since Stack generates binaries, your programs will be slower unless you separately rebuild them outside of ALE. + =============================================================================== stack-ghc *ale-haskell-stack-ghc* @@ -128,6 +147,7 @@ g:ale_haskell_stack_ghc_options *g:ale_haskell_stack_ghc_options* This variable can be changed to modify flags given to ghc through `stack ghc` + =============================================================================== stylish-haskell *ale-haskell-stylish-haskell* @@ -139,6 +159,7 @@ g:ale_haskell_stylish_haskell_executable This variable can be changed to use a different executable for stylish-haskell. + =============================================================================== hie *ale-haskell-hie* @@ -150,5 +171,6 @@ g:ale_haskell_hie_executable *g:ale_haskell_hie_executable* This variable can be changed to use a different executable for the haskell ide engine. i.e. `'hie-wrapper'` + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-hcl.txt b/sources_non_forked/ale/doc/ale-hcl.txt index 8060ac44..59b0a9da 100644 --- a/sources_non_forked/ale/doc/ale-hcl.txt +++ b/sources_non_forked/ale/doc/ale-hcl.txt @@ -5,7 +5,7 @@ ALE HCL Integration *ale-hcl-options* =============================================================================== terraform-fmt *ale-hcl-terraform-fmt* -See |ale-terraform-fmt| for information about the available options. +See |ale-terraform-fmt-fixer| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 2805c9c8..32f0e6eb 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -5,14 +5,41 @@ ALE Java Integration *ale-java-options* =============================================================================== checkstyle *ale-java-checkstyle* +g:ale_java_checkstyle_config *g:ale_java_checkstyle_config* + *b:ale_java_checkstyle_config* + + Type: |String| + Default: `'/google_checks.xml'` + + A path to a checkstyle configuration file. + + If a configuration file is specified with |g:ale_java_checkstyle_options|, + it will be preferred over this setting. + + The path to the configuration file can be an absolute path or a relative + path. ALE will search for the relative path in parent directories. + + +g:ale_java_checkstyle_executable *g:ale_java_checkstyle_executable* + *b:ale_java_checkstyle_executable* + + Type: |String| + Default: 'checkstyle' + + This variable can be changed to modify the executable used for checkstyle. + + g:ale_java_checkstyle_options *g:ale_java_checkstyle_options* *b:ale_java_checkstyle_options* - Type: String - Default: '-c /google_checks.xml' + Type: |String| + Default: `''` This variable can be changed to modify flags given to checkstyle. + If a configuration file is specified with `-c`, it will be used instead of + configuration files set with |g:ale_java_checkstyle_config|. + =============================================================================== javac *ale-java-javac* @@ -90,16 +117,46 @@ or This generates a dist/mac or dist/windows directory that contains the language server. To let ALE use this language server you need to set the -g:ale_java_javalsp_executable variable to the absolute path of the java +g:ale_java_javalsp_executable variable to the absolute path of the launcher executable in this directory. g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* *b:ale_java_javalsp_executable* Type: |String| - Default: `'java'` + Default: `''` -This variable can be changed to use a different executable for java. +This variable must be set to the absolute path of the language server launcher +executable. For example: +> + let g:ale_java_javalsp_executable=/java-language-server/dist/mac/bin/launcher +< +g:ale_java_javalsp_config *g:ale_java_javalsp_config* + *b:ale_java_javalsp_config* + Type: |Dictionary| + Default: `{}` + +The javalsp linter automatically detects external depenencies for Maven and +Gradle projects. In case the javalsp fails to detect some of them, you can +specify them setting a dictionary to |g:ale_java_javalsp_config| variable. +> + let g:ale_java_javalsp_executable = + \ { + \ 'java': { + \ 'externalDependencies': [ + \ 'junit:junit:jar:4.12:test', " Maven format + \ 'junit:junit:4.1' " Gradle format + \ ], + \ 'classPath': [ + \ 'lib/some-dependency.jar', + \ '/android-sdk/platforms/android-28.jar' + \ ] + \ } + \ } + +The Java language server will look for the dependencies you specify in +`externalDependencies` array in your Maven and Gradle caches ~/.m2 and +~/.gradle. =============================================================================== eclipselsp *ale-java-eclipselsp* @@ -118,7 +175,7 @@ located inside the repository folder `eclipse.jdt.ls`. Please ensure to set |g:ale_java_eclipselsp_path| to the absolute path of that folder. You could customize compiler options and code assists of the server. -Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` +Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` with options presented at https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html. @@ -130,7 +187,7 @@ g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* Absolute path to the location of the eclipse.jdt.ls repository folder. Or if you have VSCode extension installed the absolute path to the VSCode extensions - folder (e.g. $HOME/.vscode/extensions in Linux). + folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in Linux). g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* @@ -141,6 +198,31 @@ g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* This variable can be set to change the executable path used for java. +g:ale_java_eclipselsp_config_path *g:ale_java_eclipse_config_path* + *b:ale_java_eclipse_config_path* + Type: |String| + Default: `''` + + Set this variable to change the configuration directory path used by + eclipselsp (e.g. `$HOME/.jdtls` in Linux). + By default ALE will attempt to use the configuration within the installation + directory. + This setting is particularly useful when eclipselsp is installed in a + non-writable directory like `/usr/share/java/jdtls`, as is the case when + installed via system package. + + +g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path* + *b:ale_java_eclipselsp_workspace_path* + + Type: |String| + Default: `''` + + If you have Eclipse installed is good idea to set this variable to the + absolute path of the Eclipse workspace. If not set this value will be set to + the parent folder of the project root. + + =============================================================================== uncrustify *ale-java-uncrustify* diff --git a/sources_non_forked/ale/doc/ale-purescript.txt b/sources_non_forked/ale/doc/ale-purescript.txt new file mode 100644 index 00000000..33fd2429 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-purescript.txt @@ -0,0 +1,33 @@ +=============================================================================== +ALE PureScript Integration *ale-purescript-options* + + +=============================================================================== +purescript-language-server *ale-purescript-language-server* + +PureScript Language Server + (https://github.com/nwolverson/purescript-language-server) + +g:ale_purescript_ls_executable g:ale_purescript_ls_executable + b:ale_purescript_ls_executable + Type: |String| + Default: `'purescript-language-server'` + + PureScript language server executable. + +g:ale_purescript_ls_config g:ale_purescript_ls_config + b:ale_purescript_ls_config + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example, with a spago project: + { + \ 'purescript': { + \ 'addSpagoSources': v:true, + \ 'addNpmPath': v:true, + \ 'buildCommand': 'spago build -- --json-errors' + \ } + \} +=============================================================================== + 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 7dd3b65d..9d5846d2 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -29,7 +29,7 @@ ALE will look for configuration files with the following filenames. > tox.ini mypy.ini pycodestyle.cfg - flake8.cfg + .flake8 .flake8rc pylama.ini pylintrc @@ -672,6 +672,36 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* if true. This is overridden by a manually-set executable. +=============================================================================== +reorder-python-imports *ale-python-reorder_python_imports* + +g:ale_python_reorder_python_imports_executable + *g:ale_python_reorder_python_imports_executable* + *b:ale_python_reorder_python_imports_executable* + Type: |String| + Default: `'reorder-python-imports'` + + See |ale-integrations-local-executables| + + +g:ale_python_reorder_python_imports_options + *g:ale_python_reorder_python_imports_options* + *b:ale_python_reorder_python_imports_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to reorder-python-imports. + + +g:ale_python_reorder_python_imports_use_global + *g:ale_python_reorder_python_imports_use_global* + *b:ale_python_reorder_python_imports_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vulture *ale-python-vulture* diff --git a/sources_non_forked/ale/doc/ale-reasonml.txt b/sources_non_forked/ale/doc/ale-reasonml.txt index 426d4c46..b8729a55 100644 --- a/sources_non_forked/ale/doc/ale-reasonml.txt +++ b/sources_non_forked/ale/doc/ale-reasonml.txt @@ -5,18 +5,19 @@ ALE ReasonML Integration *ale-reasonml-options* =============================================================================== merlin *ale-reasonml-merlin* - To use merlin linter for ReasonML source code you need to make sure Merlin - for Vim is correctly configured. See the corresponding Merlin wiki page for - detailed instructions - (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). +To use merlin linter for ReasonML source code you need to make sure Merlin for +Vim is correctly configured. See the corresponding Merlin wiki page for +detailed instructions: +https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch =============================================================================== ols *ale-reasonml-ols* - The `ocaml-language-server` is the engine that powers OCaml and ReasonML - editor support using the Language Server Protocol. See the installation - instructions: - https://github.com/freebroccolo/ocaml-language-server#installation +The `ocaml-language-server` is the engine that powers OCaml and ReasonML +editor support using the Language Server Protocol. See the installation +instructions: +https://github.com/freebroccolo/ocaml-language-server#installation + g:ale_reason_ols_executable *g:ale_reason_ols_executable* *b:ale_reason_ols_executable* @@ -25,6 +26,7 @@ g:ale_reason_ols_executable *g:ale_reason_ols_executable* This variable can be set to change the executable path for `ols`. + g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* *b:ale_reason_ols_use_global* Type: |String| @@ -33,6 +35,24 @@ g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* This variable can be set to `1` to always use the globally installed executable. See also |ale-integrations-local-executables|. + +=============================================================================== +reason-language-server *ale-reasonml-language-server* + +Note: You must set an executable - there is no 'default' install location. +Go to https://github.com/jaredly/reason-language-server and download the +latest release. You can place it anywhere, but ensure you set the executable +path. + + +g:ale_reason_ls_executable *g:ale_reason_ls_executable* + *b:ale_reason_ls_executable* + Type: |String| + + This variable defines the standard location of the language server + executable. This must be set. + + =============================================================================== refmt *ale-reasonml-refmt* @@ -43,6 +63,7 @@ g:ale_reasonml_refmt_executable *g:ale_reasonml_refmt_executable* This variable can be set to pass the path of the refmt fixer. + g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* *b:ale_reasonml_refmt_options* Type: |String| @@ -50,5 +71,6 @@ g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* This variable can be set to pass additional options to the refmt fixer. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index bf971e7c..e373ab8e 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -129,6 +129,26 @@ g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable* from binstubs or a bundle. +=============================================================================== +sorbet *ale-ruby-sorbet* + +g:ale_ruby_sorbet_executable *g:ale_ruby_sorbet_executable* + *b:ale_ruby_sorbet_executable* + Type: String + Default: `'srb'` + + Override the invoked sorbet binary. Set this to `'bundle'` to invoke + `'bundle` `exec` srb'. + + +g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* + *b:ale_ruby_sorbet_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to sorbet. + + =============================================================================== standardrb *ale-ruby-standardrb* diff --git a/sources_non_forked/ale/doc/ale-sql.txt b/sources_non_forked/ale/doc/ale-sql.txt index 75d4b0cf..f9bc6ac2 100644 --- a/sources_non_forked/ale/doc/ale-sql.txt +++ b/sources_non_forked/ale/doc/ale-sql.txt @@ -2,6 +2,24 @@ ALE SQL Integration *ale-sql-options* +=============================================================================== +pgformatter *ale-sql-pgformatter* + +g:ale_sql_pgformatter_executable *g:ale_sql_pgformatter_executable* + *b:ale_sql_pgformatter_executable* + Type: |String| + Default: `'pg_format'` + + This variable sets executable used for pgformatter. + +g:ale_sql_pgformatter_options *g:ale_sql_pgformatter_options* + *b:ale_sql_pgformatter_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the pgformatter fixer. + + =============================================================================== sqlfmt *ale-sql-sqlfmt* diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index d6fbafa6..37345f7b 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -14,6 +14,7 @@ Notes: * Ada * `gcc` + * `gnatpp` * Ansible * `ansible-lint` * API Blueprint @@ -53,6 +54,7 @@ Notes: * `gcc` * `uncrustify` * C# + * `csc`!! * `mcs` * `mcsc`!! * `uncrustify` @@ -181,6 +183,7 @@ Notes: * `hdevtools` * `hfmt` * `hie` + * `hindent` * `hlint` * `stack-build`!! * `stack-ghc` @@ -236,6 +239,7 @@ Notes: * `lacheck` * `proselint` * `redpen` + * `texlab` * `textlint` * `vale` * `write-good` @@ -337,6 +341,8 @@ Notes: * `languageserver` * `puppet` * `puppet-lint` +* PureScript + * `purescript-language-server` * Python * `autopep8` * `bandit` @@ -352,6 +358,7 @@ Notes: * `pylint`!! * `pyls` * `pyre` + * `reorder-python-imports` * `vulture`!! * `yapf` * QML @@ -365,6 +372,7 @@ Notes: * ReasonML * `merlin` * `ols` + * `reason-language-server` * `refmt` * reStructuredText * `alex`!! @@ -386,6 +394,7 @@ Notes: * `ruby` * `rufo` * `solargraph` + * `sorbet` * `standardrb` * Rust * `cargo`!! @@ -414,6 +423,7 @@ Notes: * `solhint` * `solium` * SQL + * `pgformatter` * `sqlfmt` * `sqlint` * Stylus diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt index 49a55028..387fd732 100644 --- a/sources_non_forked/ale/doc/ale-terraform.txt +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -3,7 +3,7 @@ ALE Terraform Integration *ale-terraform-options* =============================================================================== -fmt *ale-terraform-fmt* +terraform-fmt-fixer *ale-terraform-fmt-fixer* g:ale_terraform_fmt_executable *g:ale_terraform_fmt_executable* *b:ale_terraform_fmt_executable* @@ -20,6 +20,18 @@ g:ale_terraform_fmt_options *g:ale_terraform_fmt_options* Default: `''` +=============================================================================== +terraform *ale-terraform-terraform* + +g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable* + *b:ale_terraform_terraform_executable* + + Type: |String| + Default: `'terraform'` + + This variable can be changed to use a different executable for terraform. + + =============================================================================== tflint *ale-terraform-tflint* diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt index b1b09117..ceb9fa81 100644 --- a/sources_non_forked/ale/doc/ale-tex.txt +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -53,5 +53,25 @@ g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* +=============================================================================== +texlab *ale-tex-texlab* + +g:ale_tex_texlab_executable *g:ale_tex_texlab_executable* + *b:ale_tex_texlab_executable* + Type: |String| + Default: `'texlab'` + + This variable can be changed to change the path to texlab. + + +g:ale_tex_texlab_options *g:ale_tex_texlab_options* + *b:ale_tex_texlab_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to texlab. + + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 2a086981..beca8546 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -84,7 +84,7 @@ have even saved your changes. ALE will check your code in the following circumstances, which can be configured with the associated options. * When you modify a buffer. - |g:ale_lint_on_text_changed| -* On leaving insert mode. (off by default) - |g:ale_lint_on_insert_leave| +* On leaving insert mode. - |g:ale_lint_on_insert_leave| * When you open a new or modified buffer. - |g:ale_lint_on_enter| * When you save a buffer. - |g:ale_lint_on_save| * When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| @@ -341,6 +341,17 @@ completion source for Deoplete is named `'ale'`, and should enabled automatically if Deoplete is enabled and configured correctly. Deoplete integration should not be combined with ALE's own implementation. + *ale-asyncomplete-integration* + +ALE additionally integrates with asyncomplete.vim for offering automatic +completion data. ALE's asyncomplete source requires registration and should +use the defaults provided by the|asyncomplete#sources#ale#get_source_options| function > + + " Use ALE's function for asyncomplete defaults + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({ + \ 'priority': 10, " Provide your own overrides here + \ })) +> ALE also offers its own completion implementation, which does not require any other plugins. Suggestions will be made while you type after completion is enabled. ALE's own completion implementation can be enabled by setting @@ -349,6 +360,12 @@ is loaded. The delay for completion can be configured with |g:ale_completion_delay|. This setting should not be enabled if you wish to use ALE as a completion source for other plugins. +ALE provides an 'omnifunc' function |ale#completion#OmniFunc| for triggering +completion manually with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| > + + " Use ALE's function for omnicompletion. + set omnifunc=ale#completion#OmniFunc +< ALE will only suggest so many possible matches for completion. The maximum number of items can be controlled with |g:ale_completion_max_suggestions|. @@ -947,7 +964,7 @@ g:ale_lint_on_save *g:ale_lint_on_save* g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* Type: |String| - Default: `'always'` + Default: `'normal'` This option controls how ALE will check your files as you make changes. The following values can be used. @@ -972,9 +989,10 @@ g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* + *b:ale_lint_on_insert_leave* Type: |Number| - Default: `0` + Default: `1` When set to `1` in your vimrc file, this option will cause ALE to run linters when you leave insert mode. @@ -986,6 +1004,10 @@ g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* " Make using Ctrl+C do the same as Escape, to trigger autocmd commands inoremap < + A buffer-local version of this setting `b:ale_lint_on_insert_leave` can be + set to `0` to disable linting when leaving insert mode. The setting must + be enabled globally to be enabled locally. + You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. @@ -1006,10 +1028,13 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', \ 'plaintex': 'tex', + \ 'rmarkdown': 'r', \ 'systemverilog': 'verilog', \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], + \ 'xsd': ['xsd', 'xml'], + \ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} < @@ -1412,6 +1437,15 @@ g:ale_set_signs *g:ale_set_signs* |ALEWarningLine| - All items with `'type': 'W'` |ALEInfoLine| - All items with `'type': 'I'` + With Neovim 0.3.2 or higher, ALE uses `numhl` option to highlight 'number' + column. It uses the following highlight groups. + + |ALEErrorSignLineNr| - Items with `'type': 'E'` + |ALEWarningSignLineNr| - Items with `'type': 'W'` + |ALEInfoSignLineNr| - Items with `'type': 'I'` + |ALEStyleErrorSignLineNr| - Items with `'type': 'E'` and `'sub_type': 'style'` + |ALEStyleWarningSignLineNr| - Items with `'type': 'W'` and `'sub_type': 'style'` + The markers for the highlights can be customized with the following options: |g:ale_sign_error| @@ -1696,6 +1730,15 @@ ALEErrorSign *ALEErrorSign* The highlight for error signs. See |g:ale_set_signs|. +ALEErrorSignLineNr *ALEErrorSignLineNr* + + Default: `highlight link ALEErrorSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEInfo *ALEInfo.* *ALEInfo-highlight* Default: `highlight link ALEInfo ALEWarning` @@ -1720,6 +1763,15 @@ ALEInfoLine *ALEInfoLine* See |g:ale_set_signs| and |g:ale_set_highlights|. +ALEInfoSignLineNr *ALEInfoSignLineNr* + + Default: `highlight link ALEInfoSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEStyleError *ALEStyleError* Default: `highlight link ALEStyleError ALEError` @@ -1734,6 +1786,15 @@ ALEStyleErrorSign *ALEStyleErrorSign* The highlight for style error signs. See |g:ale_set_signs|. +ALEStyleErrorSignLineNr *ALEStyleErrorSignLineNr* + + Default: `highlight link ALEStyleErrorSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEStyleWarning *ALEStyleWarning* Default: `highlight link ALEStyleWarning ALEError` @@ -1748,6 +1809,15 @@ ALEStyleWarningSign *ALEStyleWarningSign* The highlight for style warning signs. See |g:ale_set_signs|. +ALEStyleWarningSignLineNr *ALEStyleWarningSignLineNr* + + Default: `highlight link ALEStyleWarningSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEVirtualTextError *ALEVirtualTextError* Default: `highlight link ALEVirtualTextError ALEError` @@ -1807,6 +1877,15 @@ ALEWarningSign *ALEWarningSign* The highlight for warning signs. See |g:ale_set_signs|. +ALEWarningSignLineNr *ALEWarningSignLineNr* + + Default: `highlight link ALEWarningSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + =============================================================================== 7. Linter/Fixer Options *ale-integration-options* @@ -1913,6 +1992,7 @@ documented in additional help files. ada.....................................|ale-ada-options| gcc...................................|ale-ada-gcc| + gnatpp................................|ale-ada-gnatpp| ansible.................................|ale-ansible-options| ansible-lint..........................|ale-ansible-ansible-lint| asciidoc................................|ale-asciidoc-options| @@ -1961,6 +2041,7 @@ documented in additional help files. uncrustify............................|ale-cpp-uncrustify| ccls..................................|ale-cpp-ccls| c#......................................|ale-cs-options| + csc...................................|ale-cs-csc| mcs...................................|ale-cs-mcs| mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| @@ -1988,9 +2069,10 @@ documented in additional help files. credo.................................|ale-elixir-credo| elm.....................................|ale-elm-options| elm-format............................|ale-elm-elm-format| - elm-lsp...............................|ale-elm-elm-lsp| + elm-ls................................|ale-elm-elm-ls| elm-make..............................|ale-elm-elm-make| erlang..................................|ale-erlang-options| + dialyzer..............................|ale-erlang-dialyzer| erlc..................................|ale-erlang-erlc| syntaxerl.............................|ale-erlang-syntaxerl| eruby...................................|ale-eruby-options| @@ -2027,6 +2109,7 @@ documented in additional help files. hackfmt...............................|ale-hack-hackfmt| hhast.................................|ale-hack-hhast| handlebars..............................|ale-handlebars-options| + prettier..............................|ale-handlebars-prettier| ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| @@ -2036,6 +2119,7 @@ documented in additional help files. cabal-ghc.............................|ale-haskell-cabal-ghc| hdevtools.............................|ale-haskell-hdevtools| hfmt..................................|ale-haskell-hfmt| + hindent...............................|ale-haskell-hindent| hlint.................................|ale-haskell-hlint| stack-build...........................|ale-haskell-stack-build| stack-ghc.............................|ale-haskell-stack-ghc| @@ -2160,6 +2244,8 @@ documented in additional help files. puppet................................|ale-puppet-puppet| puppetlint............................|ale-puppet-puppetlint| puppet-languageserver.................|ale-puppet-languageserver| + purescript..............................|ale-purescript-options| + purescript-language-server............|ale-purescript-language-server| pyrex (cython)..........................|ale-pyrex-options| cython................................|ale-pyrex-cython| python..................................|ale-python-options| @@ -2177,6 +2263,7 @@ documented in additional help files. pylint................................|ale-python-pylint| pyls..................................|ale-python-pyls| pyre..................................|ale-python-pyre| + reorder-python-imports................|ale-python-reorder_python_imports| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| qml.....................................|ale-qml-options| @@ -2187,6 +2274,7 @@ documented in additional help files. reasonml................................|ale-reasonml-options| merlin................................|ale-reasonml-merlin| ols...................................|ale-reasonml-ols| + reason-language-server................|ale-reasonml-language-server| refmt.................................|ale-reasonml-refmt| restructuredtext........................|ale-restructuredtext-options| textlint..............................|ale-restructuredtext-textlint| @@ -2199,6 +2287,7 @@ documented in additional help files. ruby..................................|ale-ruby-ruby| rufo..................................|ale-ruby-rufo| solargraph............................|ale-ruby-solargraph| + sorbet................................|ale-ruby-sorbet| standardrb............................|ale-ruby-standardrb| rust....................................|ale-rust-options| cargo.................................|ale-rust-cargo| @@ -2229,6 +2318,7 @@ documented in additional help files. spec....................................|ale-spec-options| rpmlint...............................|ale-spec-rpmlint| sql.....................................|ale-sql-options| + pgformatter...........................|ale-sql-pgformatter| sqlfmt................................|ale-sql-sqlfmt| stylus..................................|ale-stylus-options| stylelint.............................|ale-stylus-stylelint| @@ -2239,12 +2329,14 @@ documented in additional help files. tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| - fmt...................................|ale-terraform-fmt| + terraform-fmt-fixer...................|ale-terraform-fmt-fixer| + terraform.............................|ale-terraform-terraform| tflint................................|ale-terraform-tflint| tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| lacheck...............................|ale-tex-lacheck| latexindent...........................|ale-tex-latexindent| + texlab................................|ale-tex-texlab| texinfo.................................|ale-texinfo-options| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| @@ -2797,6 +2889,13 @@ ale#command#ManageFile(buffer, filename) *ale#command#ManageFile()* manages directories separately with the |ale#command#ManageDirectory| function. +ale#completion#OmniFunc(findstart, base) *ale#completion#OmniFunc()* + + A completion function to use with 'omnifunc'. + + See |ale-completion|. + + ale#engine#GetLoclist(buffer) *ale#engine#GetLoclist()* Given a buffer number, this function will return the list of problems @@ -3174,6 +3273,33 @@ ale#linter#PreventLoading(filetype) *ale#linter#PreventLoading()* |runtimepath| for that filetype. This function can be called from vimrc or similar to prevent ALE from loading linters. + +ale#lsp_linter#SendRequest(buffer, linter_name, message, [Handler]) + *ale#lsp_linter#SendRequest()* + + Send a custom request to an LSP linter. The arguments are defined as + follows: + + `buffer` A valid buffer number. + + `linter_name` A |String| identifying an LSP linter that is available and + enabled for the |filetype| of `buffer`. + + `message` A |List| in the form `[is_notification, method, parameters]`, + containing three elements: + `is_notification` - an |Integer| that has value 1 if the + request is a notification, 0 otherwise; + `method` - a |String|, identifying an LSP method supported + by `linter`; + `parameters` - a |dictionary| of LSP parameters that are + applicable to `method`. + + `Handler` Optional argument, meaningful only when `message[0]` is 0. + A |Funcref| that is called when a response to the request is + received, and takes as unique argument a dictionary + representing the response obtained from the server. + + ale#other_source#ShowResults(buffer, linter_name, loclist) *ale#other_source#ShowResults()* @@ -3312,7 +3438,7 @@ snazzy looking ale glass logo. Cheers, Mark! 11. Contact *ale-contact* If you like this plugin, and wish to get in touch, check out the GitHub -page for issues and more at https://github.com/w0rp/ale +page for issues and more at https://github.com/dense-analysis/ale If you wish to contact the author of this plugin directly, please feel free to send an email to devw0rp@gmail.com. diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index cf39d632..6262a7c4 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -71,12 +71,12 @@ let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {}) let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200) " This flag can be set to 'never' to disable linting when text is changed. -" This flag can also be set to 'insert' or 'normal' to lint when text is -" changed only in insert or normal mode respectively. -let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'always') +" This flag can also be set to 'always' or 'insert' to lint when text is +" changed in both normal and insert mode, or only in insert mode respectively. +let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'normal') " This flag can be set to 1 to enable linting when leaving insert mode. -let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 0) +let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 1) " This flag can be set to 0 to disable linting when the buffer is entered. let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1) @@ -142,6 +142,9 @@ let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) " Enable automatic detection of pipenv for Python linters. let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) +" This variable can be overridden to set the GO111MODULE environment variable. +let g:ale_go_go111module = get(g:, 'ale_go_go111module', '') + if g:ale_set_balloons call ale#balloon#Enable() endif diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py index 7ed2f6c0..3955ed2d 100644 --- a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -21,13 +21,23 @@ class Source(Base): self.name = 'ale' self.mark = '[L]' - self.rank = 100 + self.rank = 1000 self.is_bytepos = True self.min_pattern_length = 1 + # Do not forget to update s:trigger_character_map in completion.vim in + # updating entries in this map. + self.input_patterns = { + '_': r'\.\w*$', + 'rust': r'(\.|::)\w*$', + 'typescript': r'(\.|\'|")\w*$', + 'cpp': r'(\.|::|->)\w*$', + } # Returns an integer for the start position, as with omnifunc. - def get_completion_position(self): - return self.vim.call('ale#completion#GetCompletionPosition') + def get_complete_position(self, context): + return self.vim.call( + 'ale#completion#GetCompletionPositionForDeoplete', context['input'] + ) def gather_candidates(self, context): # Stop early if ALE can't provide completion data for this buffer. diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 18d69388..c933f510 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -23,6 +23,7 @@ formatting. * Ada * [gcc](https://gcc.gnu.org) + * [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk: * Ansible * [ansible-lint](https://github.com/willthames/ansible-lint) * API Blueprint @@ -62,6 +63,7 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * C# + * [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration * [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details * [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration * [uncrustify](https://github.com/uncrustify/uncrustify) @@ -124,14 +126,14 @@ formatting. * [hadolint](https://github.com/hadolint/hadolint) * Elixir * [credo](https://github.com/rrrene/credo) - * [dialyxir](https://github.com/jeremyjh/dialyxir) - * [dogma](https://github.com/lpil/dogma) + * [dialyxir](https://github.com/jeremyjh/dialyxir) :floppy_disk: + * [dogma](https://github.com/lpil/dogma) :floppy_disk: * [elixir-ls](https://github.com/JakeBecker/elixir-ls) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) * [elm-lsp](https://github.com/antew/elm-lsp) - * [elm-make](https://github.com/elm-lang/elm-make) + * [elm-make](https://github.com/elm/compiler) * Erb * [erb](https://apidock.com/ruby/ERB) * [erubi](https://github.com/jeremyevans/erubi) @@ -190,6 +192,7 @@ formatting. * [hdevtools](https://hackage.haskell.org/package/hdevtools) * [hfmt](https://github.com/danstiner/hfmt) * [hie](https://github.com/haskell/haskell-ide-engine) + * [hindent](https://hackage.haskell.org/package/hindent) * [hlint](https://hackage.haskell.org/package/hlint) * [stack-build](https://haskellstack.org/) :floppy_disk: * [stack-ghc](https://haskellstack.org/) @@ -245,6 +248,7 @@ formatting. * [lacheck](https://www.ctan.org/pkg/lacheck) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) + * [texlab](https://texlab.netlify.com) ([Rust rewrite](https://github.com/latex-lsp/texlab/tree/rust)) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) @@ -346,6 +350,8 @@ formatting. * [languageserver](https://github.com/lingua-pupuli/puppet-editor-services) * [puppet](https://puppet.com) * [puppet-lint](https://puppet-lint.com) +* PureScript + * [purescript-language-server](https://github.com/nwolverson/purescript-language-server) * Python * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: @@ -361,6 +367,7 @@ formatting. * [pylint](https://www.pylint.org/) :floppy_disk: * [pyls](https://github.com/palantir/python-language-server) :warning: * [pyre](https://github.com/facebook/pyre-check) :warning: + * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) * QML @@ -374,6 +381,7 @@ formatting. * ReasonML * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions * [ols](https://github.com/freebroccolo/ocaml-language-server) + * [reason-language-server](https://github.com/jaredly/reason-language-server) * [refmt](https://github.com/reasonml/reason-cli) * reStructuredText * [alex](https://github.com/wooorm/alex) :floppy_disk: @@ -395,6 +403,7 @@ formatting. * [ruby](https://www.ruby-lang.org) * [rufo](https://github.com/ruby-formatter/rufo) * [solargraph](https://solargraph.org) + * [sorbet](https://github.com/sorbet/sorbet) * [standardrb](https://github.com/testdouble/standard) * Rust * [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions) @@ -423,6 +432,7 @@ formatting. * [solhint](https://github.com/protofire/solhint) * [solium](https://github.com/duaraghav8/Solium) * SQL + * [pgformatter](https://github.com/darold/pgFormatter) * [sqlfmt](https://github.com/jackc/sqlfmt) * [sqlint](https://github.com/purcell/sqlint) * Stylus diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index 94216d1a..6667620e 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -260,7 +260,7 @@ function! s:goyo_on(dim) augroup goyo autocmd! - autocmd TabLeave * call s:goyo_off() + autocmd TabLeave * nested call s:goyo_off() autocmd VimResized * call s:resize_pads() autocmd ColorScheme * call s:tranquilize() autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline() diff --git a/sources_non_forked/lightline.vim/.travis.yml b/sources_non_forked/lightline.vim/.travis.yml index 179c66dc..9c8184a2 100644 --- a/sources_non_forked/lightline.vim/.travis.yml +++ b/sources_non_forked/lightline.vim/.travis.yml @@ -1,7 +1,5 @@ language: generic -sudo: false - install: - git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then @@ -18,6 +16,8 @@ cache: - $HOME/vim-$VIM_VERSION env: + - VIM_VERSION=8.1.1775 + - VIM_VERSION=8.1.1700 - VIM_VERSION=8.1.0000 - VIM_VERSION=8.0.0000 - VIM_VERSION=7.4 diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index 1e6eb816..656fe90c 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -52,11 +52,17 @@ landscape is my colorscheme, which is a high-contrast cterm-supported colorschem + Orthogonality. The plugin does not rely on the implementation of other plugins. Such plugin crossing settings should be configured by users. ## Installation +### [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528) + + git clone https://github.com/itchyny/lightline.vim ~/.vim/pack/plugins/start/lightline + ### [Pathogen](https://github.com/tpope/vim-pathogen) 1. Install with the following command. git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim +2. Generate help tags with `:Helptags`. + ### [Vundle](https://github.com/VundleVim/Vundle.vim) 1. Add the following configuration to your `.vimrc`. diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 2076a114..127622c0 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2018/11/24 12:00:00. +" Last Change: 2019/08/20 14:00:00. " ============================================================================= let s:save_cpo = &cpo @@ -11,6 +11,7 @@ set cpo&vim let s:_ = 1 " 1: uninitialized, 2: disabled function! lightline#update() abort + if &buftype ==# 'popup' | return | endif if s:_ if s:_ == 2 | return | endif call lightline#init() @@ -20,7 +21,7 @@ function! lightline#update() abort return endif let w = winnr() - let s = winnr('$') == 1 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)] + let s = winnr('$') == 1 && w > 0 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)] for n in range(1, winnr('$')) call setwinvar(n, '&statusline', s[n!=w]) call setwinvar(n, 'lightline', n!=w) @@ -45,7 +46,10 @@ function! lightline#enable() abort call lightline#update() augroup lightline autocmd! - autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update() + autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update() + if !has('patch-8.1.1715') + autocmd FileType qf call lightline#update() + endif autocmd SessionLoadPost * call lightline#highlight() autocmd ColorScheme * if !has('vim_starting') || expand('') !=# 'macvim' \ | call lightline#update() | call lightline#highlight() | endif diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim new file mode 100644 index 00000000..85da9025 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim @@ -0,0 +1,39 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/ayu_mirage.vim +" Author: impulse +" License: MIT License +" Last Change: 2019/08/11 11:52:20. +" ============================================================================= +let s:base0 = [ '#d9d7ce', 244 ] +let s:base1 = [ '#d9d7ce', 247 ] +let s:base2 = [ '#607080', 248 ] +let s:base3 = [ '#d9d7ce', 252 ] +let s:base00 = [ '#272d38', 242 ] +let s:base01 = [ '#272d38', 240 ] +let s:base02 = [ '#212733', 238 ] +let s:base023 = [ '#212733', 236 ] +let s:base03 = [ '#ffc44c', 235 ] +let s:yellow = [ '#ffc44c', 180 ] +let s:orange = [ '#ffae57', 173 ] +let s:red = [ '#f07178', 203 ] +let s:magenta = [ '#d4bfff', 216 ] +let s:blue = [ '#59c2ff', 117 ] +let s:cyan = s:blue +let s:green = [ '#bbe67e', 119 ] +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] +let s:p.normal.middle = [ [ s:base2, s:base02 ] ] +let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] +let s:p.inactive.left = [ [ s:base1, s:base01 ], [ s:base3, s:base01 ] ] +let s:p.inactive.middle = [ [ s:base1, s:base023 ] ] +let s:p.inactive.right = [ [ s:base1, s:base01 ], [ s:base2, s:base02 ] ] +let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] +let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ] +let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ] +let s:p.tabline.tabsel = [ [ s:base02, s:base03 ] ] +let s:p.tabline.left = [ [ s:base3, s:base00 ] ] +let s:p.tabline.middle = [ [ s:base2, s:base02 ] ] +let s:p.tabline.right = [ [ s:base2, s:base00 ] ] +let s:p.normal.error = [ [ s:base03, s:red ] ] +let s:p.normal.warning = [ [ s:base023, s:yellow ] ] +let g:lightline#colorscheme#ayu_mirage#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/powerlineish.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/powerlineish.vim new file mode 100644 index 00000000..34058a87 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/powerlineish.vim @@ -0,0 +1,28 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/powerlineish.vim +" Author: itchyny +" License: MIT License +" Last Change: 2019/06/12 18:47:00. +" ============================================================================= + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ ['darkestgreen', 'brightgreen', 'bold'], ['white', 'gray0'] ] +let s:p.normal.right = [ ['gray10', 'gray2'], ['white', 'gray1'], ['white', 'gray0'] ] +let s:p.inactive.right = [ ['gray1', 'gray5'], ['gray4', 'gray1'], ['gray4', 'gray0'] ] +let s:p.inactive.left = s:p.inactive.right[1:] +let s:p.insert.left = [ ['darkestcyan', 'white', 'bold'], ['mediumcyan', 'darkestblue'] ] +let s:p.insert.right = [ [ 'darkestblue', 'mediumcyan' ], [ 'mediumcyan', 'darkblue' ], [ 'mediumcyan', 'darkestblue' ] ] +let s:p.replace.left = [ ['white', 'brightred', 'bold'], ['white', 'gray0'] ] +let s:p.visual.left = [ ['black', 'brightestorange', 'bold'], ['white', 'gray0'] ] +let s:p.normal.middle = [ [ 'white', 'gray0' ] ] +let s:p.insert.middle = [ [ 'mediumcyan', 'darkestblue' ] ] +let s:p.replace.middle = s:p.normal.middle +let s:p.replace.right = s:p.normal.right +let s:p.tabline.left = [ [ 'gray9', 'gray0' ] ] +let s:p.tabline.tabsel = [ [ 'gray9', 'gray2' ] ] +let s:p.tabline.middle = [ [ 'gray2', 'gray0' ] ] +let s:p.tabline.right = [ [ 'gray9', 'gray1' ] ] +let s:p.normal.error = [ [ 'gray9', 'brightestred' ] ] +let s:p.normal.warning = [ [ 'gray1', 'yellow' ] ] + +let g:lightline#colorscheme#powerlineish#palette = lightline#colorscheme#fill(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim new file mode 100644 index 00000000..585b948b --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim @@ -0,0 +1,50 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/selenized_dark.vim +" Author: Charles Hall +" License: MIT License +" Last Change: 2019/07/22 11:05:34. +" ============================================================================= + +" https://github.com/jan-warchol/selenized/blob/master/the-values.md#selenized-dark +let s:black = [ "#184956", 0 ] +let s:red = [ "#fa5750", 1 ] +let s:green = [ "#75b938", 2 ] +let s:yellow = [ "#dbb32d", 3 ] +let s:blue = [ "#4695f7", 4 ] +let s:magenta = [ "#f275be", 5 ] +let s:cyan = [ "#41c7b9", 6 ] +let s:white = [ "#72898f", 7 ] +let s:brblack = [ "#2d5b69", 8 ] +let s:brred = [ "#ff665c", 9 ] +let s:brgreen = [ "#84c747", 10 ] +let s:bryellow = [ "#ebc13d", 11 ] +let s:brblue = [ "#58a3ff", 12 ] +let s:brmagenta = [ "#ff84cd", 13 ] +let s:brcyan = [ "#53d6c7", 14 ] +let s:brwhite = [ "#cad8d9", 15 ] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} + +let s:p.normal.right = [[ s:black, s:blue ],[ s:cyan, s:brblack ],[ s:white, s:black ]] +let s:p.normal.left = [[ s:black, s:blue ],[ s:cyan, s:brblack ]] +let s:p.normal.middle = [[ s:black, s:black ]] +let s:p.normal.error = [[ s:black, s:red ]] +let s:p.normal.warning = [[ s:black, s:yellow ]] + +let s:p.insert.right = [[ s:black, s:green ],[ s:cyan, s:brblack ],[ s:white, s:black ]] +let s:p.insert.left = [[ s:black, s:green ],[ s:cyan, s:brblack ]] + +let s:p.visual.right = [[ s:black, s:magenta ],[ s:cyan, s:brblack ],[ s:white, s:black ]] +let s:p.visual.left = [[ s:black, s:magenta ],[ s:cyan, s:brblack ]] + +let s:p.inactive.left = [[ s:brblue, s:brblack ],[ s:cyan, s:brblack ]] +let s:p.inactive.right = [[ s:brblue, s:brblack ],[ s:cyan, s:brblack ]] + +let s:p.replace.right = [[ s:black, s:red ],[ s:cyan, s:brblack ],[ s:white, s:black ]] +let s:p.replace.left = [[ s:black, s:red ],[ s:cyan, s:brblack ]] + +let s:p.tabline.right = [[ s:black, s:red ]] +let s:p.tabline.left = [[ s:cyan, s:brblack ]] +let s:p.tabline.tabsel = [[ s:black, s:blue ]] + +let g:lightline#colorscheme#selenized_dark#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 7c2a886b..cf64523b 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2018/04/28 00:08:18. +Last Change: 2019/08/14 10:46:55. CONTENTS *lightline-contents* @@ -226,10 +226,12 @@ OPTIONS *lightline-option* < g:lightline.colorscheme *g:lightline.colorscheme* The colorscheme for lightline.vim. - Currently, wombat, solarized, powerline, jellybeans, Tomorrow, - Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties, - PaperColor, seoul256, landscape, one, darcula, molokai, materia, - material, OldHope, nord, 16color and deus are available. + Currently, wombat, solarized, powerline, powerlineish, + jellybeans, molokai, seoul256, darcula, selenized_dark, + Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, + Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor, + landscape, one, materia, material, OldHope, nord, deus, + srcery_drk, ayu_mirage and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' @@ -986,12 +988,15 @@ Problem 1: *lightline-problem-1* 1. Put all the files under $VIM. - If you are using |vim-pathogen|, install this plugin with the - following command. + If you are to install this plugin using |vim-pathogen|: + + 1. Install this plugin with the following command. > git clone https://github.com/itchyny/lightline.vim \ ~/.vim/bundle/lightline.vim < + 2. Generate help tags with |:Helptags|. + If you are to install this plugin using |Vundle|: 1. Add the following configuration to your diff --git a/sources_non_forked/lightline.vim/plugin/lightline.vim b/sources_non_forked/lightline.vim/plugin/lightline.vim index fc8f5981..d08517d7 100644 --- a/sources_non_forked/lightline.vim/plugin/lightline.vim +++ b/sources_non_forked/lightline.vim/plugin/lightline.vim @@ -2,7 +2,7 @@ " Filename: plugin/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2018/06/22 08:49:00. +" Last Change: 2019/07/30 12:00:00. " ============================================================================= if exists('g:loaded_lightline') || v:version < 700 @@ -15,12 +15,20 @@ set cpo&vim augroup lightline autocmd! - autocmd WinEnter,BufWinEnter,FileType,SessionLoadPost * call lightline#update() + autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update() + if !has('patch-8.1.1715') + autocmd FileType qf call lightline#update() + endif autocmd SessionLoadPost * call lightline#highlight() autocmd ColorScheme * if !has('vim_starting') || expand('') !=# 'macvim' \ | call lightline#update() | call lightline#highlight() | endif autocmd CursorMoved,BufUnload * call lightline#update_once() augroup END +" This quickfix option was introduced at Vim 85850f3a5ef9, which is the commit +" just before 8.1.1715. Before this patch, autocmd FileType is required to +" overwrite the statusline of the quickfix and location windows. +let g:qf_disable_statusline = 1 + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/lightline.vim/test/.themisrc b/sources_non_forked/lightline.vim/test/.themisrc index c226c089..6e0121ce 100644 --- a/sources_non_forked/lightline.vim/test/.themisrc +++ b/sources_non_forked/lightline.vim/test/.themisrc @@ -18,3 +18,5 @@ endfunction function! SID(name) abort return function(printf("\%d_%s", s:sid('autoload/lightline.vim'), a:name)) endfunction + +filetype plugin on diff --git a/sources_non_forked/lightline.vim/test/popup.vim b/sources_non_forked/lightline.vim/test/popup.vim new file mode 100644 index 00000000..cc4e882a --- /dev/null +++ b/sources_non_forked/lightline.vim/test/popup.vim @@ -0,0 +1,19 @@ +if !exists('*popup_menu') || !exists('*win_execute') + finish +endif + +let s:suite = themis#suite('popup') +let s:assert = themis#helper('assert') + +function! s:suite.before_each() + let g:lightline = {} + call lightline#init() + tabnew + tabonly +endfunction + +function! s:suite.win_execute_setfiletype() + let id = popup_menu(['aaa', 'bbb'], {}) + call win_execute(id, 'setfiletype vim') + call popup_close(id) +endfunction diff --git a/sources_non_forked/lightline.vim/test/quickfix.vim b/sources_non_forked/lightline.vim/test/quickfix.vim new file mode 100644 index 00000000..df4fce7a --- /dev/null +++ b/sources_non_forked/lightline.vim/test/quickfix.vim @@ -0,0 +1,25 @@ +let s:suite = themis#suite('quickfix') +let s:assert = themis#helper('assert') + +function! s:suite.before_each() + let g:lightline = {} + call lightline#init() + tabnew + tabonly +endfunction + +function! s:suite.quickfix_statusline() + call setloclist(winnr(), []) + lopen + wincmd p + call setloclist(winnr(), []) + for n in range(1, winnr('$')) + let statusline = getwinvar(n, '&statusline') + call s:assert.match(statusline, 'lightline') + if has('patch-8.1.1715') + call s:assert.match(statusline, n == 1 ? '_active_' : '_inactive_') + else + call s:assert.match(statusline, n != 1 ? '_active_' : '_inactive_') + endif + endfor +endfunction diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index c3ca5eff..00000000 --- a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,28 +0,0 @@ - - -### Environment - - -* Operating System: -* Vim version `:version`: -* NERDTree version `git rev-parse --short HEAD`: -* NERDTree settings applied in your vimrc, if any: - ```vim - ``` - -### Process - - -1. - -### Current Result - - -### Expected Result - - -### Screenshot(s) - -### Possible Fix - - diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 00000000..dd351350 --- /dev/null +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,45 @@ +--- +name: "Bug Report" +about: "NERDTree is misbehaving? Tell us about it." +labels: bug +--- + + +#### Self-Diagnosis + +- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question. +- [ ] I have reviewed the NERDTree documentation. `:h NERDTree` +- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki). +- [ ] I have searched the web for an answer to my question. + +#### Environment (for bug reports) +- [ ] Operating System: +- [ ] Vim/Neovim version `:echo v:version`: +- [ ] NERDTree version, found on 1st line in NERDTree quickhelp `?`: +- [ ] vimrc settings + - [ ] NERDTree variables + ```vim + ``` + - Other NERDTree-dependent Plugins + - [ ] jistr/vim-nerdtree-tabs + - [ ] ryanoasis/vim-devicons + - [ ] tiagofumo/vim-nerdtree-syntax-highlight + - [ ] Xuyuanp/nerdtree-git-plugin + - [ ] Others (specify): + - [ ] I've verified the issue occurs with only NERDTree installed. + +#### Steps to Reproduce the Issue +1. + +#### Current Result (Include screenshots where appropriate.) + +#### Expected Result + diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..35db0f6a --- /dev/null +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,8 @@ +--- +name: "Feature Request" +about: "What new feature are you requesting for NERDTree?" +labels: "feature request" +--- + +#### Description + diff --git a/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 00000000..25f15b02 --- /dev/null +++ b/sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,24 @@ +--- +name: "General Question" +about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here." +labels: "general question" +--- + + +#### Self-Diagnosis + +- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question. +- [ ] I have reviewed the NERDTree documentation. `:h NERDTree` +- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki). +- [ ] I have searched the web for an answer to my question. + +#### State Your Question + diff --git a/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..ccd5bf8d --- /dev/null +++ b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +### Description of Changes +Closes # + + +--- +### New Version Info + +- [ ] Derive a new version number. Increment the: + - [ ] `MAJOR` version when you make incompatible API changes + - [ ] `MINOR` version when you add functionality in a backwards-compatible manner + - [ ] `PATCH` version when you make backwards-compatible bug fixes +- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern. +- [ ] Tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags` diff --git a/sources_non_forked/nerdtree/CHANGELOG b/sources_non_forked/nerdtree/CHANGELOG deleted file mode 100644 index 6dac46dd..00000000 --- a/sources_non_forked/nerdtree/CHANGELOG +++ /dev/null @@ -1,179 +0,0 @@ -Next - - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) #759 - - Update doc with already existing mapping variables (asnr) #699 - - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) #696 - - Correct NERDTreeIgnore pattern in doc (cntoplolicon) #648 - - Remove empty segments when splitting path (sooth-sayer) #574 - - Suppress autocmds less agressively (wincent) #578 #691 - - Add an Issues template to ask for more info initially. - - Fix markdown headers in readme (josephfrazier) #676 - - Don't touch @o and @h registers when rendering - - Fix bug with files and directories with dollar signs (alegen) #649 - - Reuse/reopen existing window trees where possible #244 - - Remove NERDTree.previousBuf() - - Change color of arrow (Leeiio) #630 - - Improved a tip in README.markdown (ggicci) #628 - - Shorten delete confimration of empty directory to 'y' (mikeperri) #530 - - Fix API call to open directory tree in window (devm33) #533 - - Change default arrows on non-Windows platforms (gwilk) #546 - - Update to README - combine cd and git clone (zwhitchcox) #584 - - Update to README - Tip: start NERDTree when vim starts (therealplato) #593 - - Escape filename when moving an open buffer (zacharyvoase) #595 - - Fixed incorrect :helptags command in README (curran) #619 - - Fixed incomplete escaping of folder arrows (adityanatraj) #548 - - Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558 - - Replace strchars() with backward compatible workaround. - - Add support for copy command in Windows (SkylerLipthay) #231 - - Fixed typo in README.markdown - :Helptags -> :helptags - - Rename "primary" and "secondary" trees to "tab" and "window" trees. - - Move a bunch of buffer level variables into the NERDTree and UI classes. - - Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing) - - Remove the old style UI - Remove 'NERDTreeDirArrows' option. - - On windows default to + and ~ for expand/collapse directory symbols. - - Lots more refactoring. Move a bunch of b: level vars into b:NERDTree and friends. - -5.0.0 - - Refactor the code significantly: - * Break the classes out into their own files. - * Make the majority of the code OO - previously large parts were - effectively a tangle of "global" methods. - - Add an API to assign flags to nodes. This allows VCS plugins like - https://github.com/Xuyuanp/nerdtree-git-plugin to exist. Thanks to - Xuyuanp for helping design/test/build said API. - - add 'scope' argument to the key map API see :help NERDTreeAddKeyMap() - - add magic [[dir]] and [[file]] flags to NERDTreeIgnore - - add support for custom path filters. See :help NERDTreeAddPathFilter() - - add path listener API. See :help NERDTreePathListenerAPI. - - expand the fs menu functionality to list file properties (PhilRunninger, - apbarrero, JESii) - - make bookmarks work with `~` home shortcuts (hiberabyss) - - show OSX specific fsmenu options in regular vim on mac (evindor) - - make dir arrow icons configurable (PickRelated) - - optimise node sorting performance when opening large dirs (vtsang) - - make the root note render prettier by truncating it at a path slash (gcmt) - - remove NERDChristmasTree option - its always christmas now - - add "cascade" open and closing for dirs containing only another single - dir. See :help NERDTreeCascadeOpenSingleChildDir (pendulm) - - Many other fixes, doc updates and contributions from: - actionshrimp - SchDen - egalpin - cperl82 - many small fixes - toiffel - WoLpH - handcraftedbits - devmanhinton - xiaodili - zhangoose - gastropoda - mixvin - alvan - lucascaton - kelaban - shanesmith - staeff - pendulm - stephenprater - franksort - agrussellknives - AndrewRadev - Twinside - -4.2.0 - - Add NERDTreeDirArrows option to make the UI use pretty arrow chars - instead of the old +~| chars to define the tree structure (sickill) - - shift the syntax highlighting out into its own syntax file (gnap) - - add some mac specific options to the filesystem menu - for macvim - only (andersonfreitas) - - Add NERDTreeMinimalUI option to remove some non functional parts of the - nerdtree ui (camthompson) - - tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the - new behaviour (benjamingeiger) - - if no name is given to :Bookmark, make it default to the name of the - target file/dir (minyoung) - - use 'file' completion when doing copying, create, and move - operations (EvanDotPro) - - lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly - Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!) - -4.1.0 - features: - - NERDTreeFind to reveal the node for the current buffer in the tree, - see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by - Doug McInnes) into the script. - - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan - Ritter and Rémi Prévost. - - truncate the root node if wider than the tree window. Thanks to Victor - Gonzalez. - - bugfixes: - - really fix window state restoring - - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky, - jfilip1024, and Chris Chambers - -4.0.0 - - add a new programmable menu system (see :help NERDTreeMenu). - - add new APIs to add menus/menu-items to the menu system as well as - custom key mappings to the NERD tree buffer (see :help NERDTreeAPI). - - removed the old API functions - - added a mapping to maximize/restore the size of nerd tree window, thanks - to Guillaume Duranceau for the patch. See :help NERDTree-A for details. - - - fix a bug where secondary nerd trees (netrw hijacked trees) and - NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey. - - fix a bug where the script ignored directories whose name ended in a dot, - thanks to Aggelos Orfanakos for the patch. - - fix a bug when using the x mapping on the tree root, thanks to Bryan - Venteicher for the patch. - - fix a bug where the cursor position/window size of the nerd tree buffer - wasnt being stored on closing the window, thanks to Richard Hart. - - fix a bug where NERDTreeMirror would mirror the wrong tree - -3.1.1 - - fix a bug where a non-listed no-name buffer was getting created every - time the tree windows was created, thanks to Derek Wyatt and owen1 - - make behave the same as the 'o' mapping - - some helptag fixes in the doc, thanks strull - - fix a bug when using :set nohidden and opening a file where the previous - buf was modified. Thanks iElectric - - other minor fixes - -3.1.0 - New features: - - add mappings to open files in a vsplit, see :help NERDTree-s and :help - NERDTree-gs - - make the statusline for the nerd tree window default to something - hopefully more useful. See :help 'NERDTreeStatusline' - Bugfixes: - - make the hijack netrw functionality work when vim is started with "vim - " (thanks to Alf Mikula for the patch). - - fix a bug where the CWD wasnt being changed for some operations even when - NERDTreeChDirMode==2 (thanks to Lucas S. Buchala) - - add -bar to all the nerd tree :commands so they can chain with other - :commands (thanks to tpope) - - fix bugs when ignorecase was set (thanks to nach) - - fix a bug with the relative path code (thanks to nach) - - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach) - - -3.0.1 - Bugfixes: - - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden - was not set - - fix a bug where :NERDTree would fail if was relative and - didnt start with a ./ or ../ Thanks to James Kanze. - - make the q mapping work with secondary (:e style) trees, - thanks to jamessan - - fix a bunch of small bugs with secondary trees - - More insane refactoring. - -3.0.0 - - hijack netrw so that doing an :edit will put a NERD tree in - the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw' - - allow sharing of trees across tabs, see :help :NERDTreeMirror - - remove "top" and "bottom" as valid settings for NERDTreeWinPos - - change the '' mapping to 'i' - - change the 'H' mapping to 'I' - - lots of refactoring diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md new file mode 100644 index 00000000..9e494175 --- /dev/null +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -0,0 +1,222 @@ +# Change Log + +#### 5.3... +- **.0**: Add file extension and size to sorting capabilities [#1029](https://github.com/scrooloose/nerdtree/pull/1029) +#### 5.2... +- **.9**: Suppress events for intermediate window/tab/buffer changes [#1026](https://github.com/scrooloose/nerdtree/pull/1026) +- **.8**: Revert [#1019](https://github.com/scrooloose/nerdtree/pull/1019) to fix nvim artifacts and flickering. (PhilRunninger) [#1021](https://github.com/scrooloose/nerdtree/pull/1021) +- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! [#1019](https://github.com/scrooloose/nerdtree/pull/1019) +- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. [#1017](https://github.com/scrooloose/nerdtree/pull/1017) +- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/scrooloose/nerdtree/pull/1016) +- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/scrooloose/nerdtree/pull/1015) +- **.3**: Fix `` key map on the bookmark (lkebin) [#1014](https://github.com/scrooloose/nerdtree/pull/1014) +- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) [#1013](https://github.com/scrooloose/nerdtree/pull/1013) +- **.1**: Fix nerdtree#version() on Windows. (PhilRunninger) +- **.0**: Expand functionality of `` mapping. (PhilRunninger) [#1011](https://github.com/scrooloose/nerdtree/pull/1011) +#### 5.1... +- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) [#1009](https://github.com/scrooloose/nerdtree/pull/1009) +- **.2**: Fix NERDTree opening with the wrong size. (PhilRunninger) [#1008](https://github.com/scrooloose/nerdtree/pull/1008) +- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/scrooloose/nerdtree/pull/1007) +- **.0**: Too many changes for one patch... + - Refresh a dir_node if the file wasn't found in it, and look once more. (PhilRunninger) [#1005](https://github.com/scrooloose/nerdtree/pull/1005) + - Add a "copy path to clipboard" menu option (PhilRunninger) [#1002](https://github.com/scrooloose/nerdtree/pull/1002) + - Enable root refresh on "vim ." a different way than [#999](https://github.com/scrooloose/nerdtree/pull/999). (PhilRunninger) [#1001](https://github.com/scrooloose/nerdtree/pull/1001) + - Fix refreshroot (PhilRunninger) [#999](https://github.com/scrooloose/nerdtree/pull/999) + - Change version check to look for 703 not 730 (vhalis) [#994](https://github.com/scrooloose/nerdtree/pull/994) + - Change minimum vim (PhilRunninger) [#991](https://github.com/scrooloose/nerdtree/pull/991) + - Allow multi-character DirArrows (PhilRunninger) [#985](https://github.com/scrooloose/nerdtree/pull/985) + - Remove redraw! while still clearing last message empty string. (PhilRunninger) [#979](https://github.com/scrooloose/nerdtree/pull/979) + - fix `_initChildren` function value set to numChildrenCached error (terryding77) [#969](https://github.com/scrooloose/nerdtree/pull/969) + - On Windows, do a case-insensitive comparison of paths. (PhilRunninger) [#967](https://github.com/scrooloose/nerdtree/pull/967) + - Remove the **Please wait... DONE** messages. (PhilRunninger) [#966](https://github.com/scrooloose/nerdtree/pull/966) + - Smarter delimiter default (PhilRunninger) [#963](https://github.com/scrooloose/nerdtree/pull/963) + - Update directory .vimdc readme example (spencerdcarlson) [#961](https://github.com/scrooloose/nerdtree/pull/961) + - Preview bookmarks (PhilRunninger) [#956](https://github.com/scrooloose/nerdtree/pull/956) + - Add new value to NERDTreeQuitOnOpen to close bookmark table (PhilRunninger) [#955](https://github.com/scrooloose/nerdtree/pull/955) + - Add an :EditBookmarks command to edit the bookmarks file (PhilRunninger) [#954](https://github.com/scrooloose/nerdtree/pull/954) + - Before copying, turn off &shellslash. Restore after copy is finished. (PhilRunninger) [#952](https://github.com/scrooloose/nerdtree/pull/952) + - Set a maximum window size when zooming. (PhilRunninger) [#950](https://github.com/scrooloose/nerdtree/pull/950) + - Confirm the wipeout of a unsaved buffer whose file has been renamed. (PhilRunninger) [#949](https://github.com/scrooloose/nerdtree/pull/949) + - Escape a backslash so it can be used in a key mapping. (PhilRunninger) [#948](https://github.com/scrooloose/nerdtree/pull/948) + - Add a NERDTreeMinimalMenu feature (tuzz) [#938](https://github.com/scrooloose/nerdtree/pull/938) + - fixed root path error for windows (zcodes) [#935](https://github.com/scrooloose/nerdtree/pull/935) + - Restore getDirChildren for use in nerdtree-project-plugin. (PhilRunninger) [#929](https://github.com/scrooloose/nerdtree/pull/929) + - Document NERDTreeNodeDelimiter [#912](https://github.com/scrooloose/nerdtree/pull/912) (PhilRunninger) [#926](https://github.com/scrooloose/nerdtree/pull/926) + - Allow modification of menu keybindings (Leandros) [#923](https://github.com/scrooloose/nerdtree/pull/923) + - Add two more disqualifications for isCascadable(). (PhilRunninger) [#914](https://github.com/scrooloose/nerdtree/pull/914) + - Allow highlighting more than one flag. (kristijanhusak) [#908](https://github.com/scrooloose/nerdtree/pull/908) + - Support sorting files and directories by modification time. (PhilRunninger) [#901](https://github.com/scrooloose/nerdtree/pull/901) + - Parse . and .. from path string with trailing slash. (PhilRunninger) [#899](https://github.com/scrooloose/nerdtree/pull/899) + - Force sort to recalculate the cached sortKey. (PhilRunninger) [#898](https://github.com/scrooloose/nerdtree/pull/898) + - Add NERDTreeRefreshRoot command (wgfm) [#897](https://github.com/scrooloose/nerdtree/pull/897) + - Call Resolve on the file's path when calling :NERDTreeFind. (PhilRunninger) [#896](https://github.com/scrooloose/nerdtree/pull/896) + - Catch all errors, not just NERDTree errors. (PhilRunninger) [#894](https://github.com/scrooloose/nerdtree/pull/894) + - Fix typo in help file (lvoisin) [#892](https://github.com/scrooloose/nerdtree/pull/892) + - Make NERDTreeCreator set the `'nolist'` option (lifecrisis) [#889](https://github.com/scrooloose/nerdtree/pull/889) + - Refresh buffers after `m`, `m` operation on a folder (PhilRunninger) [#888](https://github.com/scrooloose/nerdtree/pull/888) + - Use a better arg for FINDSTR when using the m,l command in Windows. (PhilRunninger) [#887](https://github.com/scrooloose/nerdtree/pull/887) + - Fix the / motions, which currently fail with cascades (lifecrisis) [#886](https://github.com/scrooloose/nerdtree/pull/886) + - Function "s:UI.getLineNum()" doesn't always work on cascades. (lifecrisis) [#882](https://github.com/scrooloose/nerdtree/pull/882) + - NERDTreeCWD: reset CWD if changed by NERDTreeFocus (PhilRunninger) [#878](https://github.com/scrooloose/nerdtree/pull/878) + - Use tabnext instead of gt to allow users to remap gt. (PhilRunninger) [#877](https://github.com/scrooloose/nerdtree/pull/877) + - Do a case sensitive comparison of new/existing buffers. (PhilRunninger) [#875](https://github.com/scrooloose/nerdtree/pull/875) + - Fix opening sub-directories that have commas in their name. (PhilRunninger) [#873](https://github.com/scrooloose/nerdtree/pull/873) + - Add new command to open NERDTree in the root of a VCS repository. (PhilRunninger) [#872](https://github.com/scrooloose/nerdtree/pull/872) + - Make sure the path to the bookmarks file exists before writing it. (PhilRunninger) [#871](https://github.com/scrooloose/nerdtree/pull/871) + - Unzoom NERDTree when opening a file (PhilRunninger) [#870](https://github.com/scrooloose/nerdtree/pull/870) + - Support unusual characters in file and directory names (PhilRunninger) [#868](https://github.com/scrooloose/nerdtree/pull/868) + - Reword renamed-buffer prompt to be more clear (aflock) [#867](https://github.com/scrooloose/nerdtree/pull/867) + - Default to placing cursor on root when closing bookmark table (lifecrisis) [#866](https://github.com/scrooloose/nerdtree/pull/866) + - Fix issues with sorting of nodes (PhilRunninger) [#856](https://github.com/scrooloose/nerdtree/pull/856) + - Better OSX detection (bubba-h57) [#853](https://github.com/scrooloose/nerdtree/pull/853) + - Bugfix - ensure keymaps dictionary exists before using it (mnussbaum) [#852](https://github.com/scrooloose/nerdtree/pull/852) + - Decrease startup-time by avoiding linear-time iteration over key mappings (mnussbaum) [#851](https://github.com/scrooloose/nerdtree/pull/851) + - Add code to sort mappings in quickhelp (lifecrisis) [#849](https://github.com/scrooloose/nerdtree/pull/849) + - Use ":clearjumps" in new NERDTree windows (lifecrisis) [#844](https://github.com/scrooloose/nerdtree/pull/844) + - Like m-c did before, create parent directories if needed on m-m. (PhilRunninger) [#840](https://github.com/scrooloose/nerdtree/pull/840) + - BUGFIX: Repair a problem with the `'u'` mapping. (lifecrisis) [#838](https://github.com/scrooloose/nerdtree/pull/838) + - Make the NERDTree buffer writable when rendering it. (PhilRunninger) [#837](https://github.com/scrooloose/nerdtree/pull/837) + - Code cleanup: Remove unsupported bookmark table mappings (lifecrisis) [#835](https://github.com/scrooloose/nerdtree/pull/835) + - Replace strcharpart() with substitute() for backward compatibility (bravestarr) [#834](https://github.com/scrooloose/nerdtree/pull/834) + - Fixed error `unknown function strcharpart` for older versions of Vim (hav4ik) [#833](https://github.com/scrooloose/nerdtree/pull/833) + - Clear output when NERDTree menu is aborted (lifecrisis) [#832](https://github.com/scrooloose/nerdtree/pull/832) + - Display a path with multi-byte characters correctly when it is truncated (bravestarr) [#830](https://github.com/scrooloose/nerdtree/pull/830) + - Support revealing file and executing file with xdg-open for Linux (ngnmhieu) [#824](https://github.com/scrooloose/nerdtree/pull/824) + - If node isn't open, count children on disk before deleting. (PhilRunninger) [#822](https://github.com/scrooloose/nerdtree/pull/822) + - Add new variable g:NERDTreeRemoveFileCmd (kutsan) [#816](https://github.com/scrooloose/nerdtree/pull/816) + - Use a better check for existence of the NERDTree buffer. (PhilRunninger) [#814](https://github.com/scrooloose/nerdtree/pull/814) + - Fix focussing previous buffer when closing NERDTree (mrubli) [#801](https://github.com/scrooloose/nerdtree/pull/801) + - Update the docs for "NERDTreeStatusline" (lifecrisis) [#796](https://github.com/scrooloose/nerdtree/pull/796) + - BUGFIX: Unstable behavior in the "getPath()" method (lifecrisis) [#795](https://github.com/scrooloose/nerdtree/pull/795) + - Revert the bugfix from pull request [#785](https://github.com/scrooloose/nerdtree/pull/785) (lifecrisis) [#794](https://github.com/scrooloose/nerdtree/pull/794) + - BUGFIX: Allow ":NERDTreeFind" to discover hidden files (lifecrisis) [#786](https://github.com/scrooloose/nerdtree/pull/786) + - BUGFIX: Allow ":NERDTreeFind" to reveal new files (lifecrisis) [#785](https://github.com/scrooloose/nerdtree/pull/785) + - Add modelines (lifecrisis) [#782](https://github.com/scrooloose/nerdtree/pull/782) + - Change the type of completion used by NERDTreeFind (lifecrisis) [#781](https://github.com/scrooloose/nerdtree/pull/781) + - change NERDTreeFind with args (zhenyangze) [#778](https://github.com/scrooloose/nerdtree/pull/778) + - Style Choice: Using confirm() when deleting a bookmark (lifecrisis) [#777](https://github.com/scrooloose/nerdtree/pull/777) + - remove useless substitute when `file =~# "/$"` (skyblueee) [#773](https://github.com/scrooloose/nerdtree/pull/773) + - remove useless removeLeadingSpaces in _stripMarkup (skyblueee) [#772](https://github.com/scrooloose/nerdtree/pull/772) + - Make the "o" mapping consistent with "x" (lifecrisis) [#769](https://github.com/scrooloose/nerdtree/pull/769) + - Fix a problem with the "x" handler (lifecrisis) [#768](https://github.com/scrooloose/nerdtree/pull/768) + - Clean up the handler for the "x" mapping (lifecrisis) [#767](https://github.com/scrooloose/nerdtree/pull/767) + - Revert change to tab opening method (lifecrisis) [#766](https://github.com/scrooloose/nerdtree/pull/766) + - BUGFIX: Add back support for "b:NERDTreeRoot" (lifecrisis) [#765](https://github.com/scrooloose/nerdtree/pull/765) + - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) [#759](https://github.com/scrooloose/nerdtree/pull/759) + - Update doc with already existing mapping variables (asnr) [#699](https://github.com/scrooloose/nerdtree/pull/699) + - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) [#696](https://github.com/scrooloose/nerdtree/pull/696) + - Correct NERDTreeIgnore pattern in doc (cntoplolicon) [#648](https://github.com/scrooloose/nerdtree/pull/648) + - Remove empty segments when splitting path (sooth-sayer) [#574](https://github.com/scrooloose/nerdtree/pull/574) + - Suppress autocmds less agressively (wincent) [#578](https://github.com/scrooloose/nerdtree/pull/578) [#691](https://github.com/scrooloose/nerdtree/pull/691) + - Add an Issues template to ask for more info initially. + - Fix markdown headers in readme (josephfrazier) [#676](https://github.com/scrooloose/nerdtree/pull/676) + - Don't touch `@o` and `@h` registers when rendering + - Fix bug with files and directories with dollar signs (alegen) [#649](https://github.com/scrooloose/nerdtree/pull/649) + - Reuse/reopen existing window trees where possible [#244](https://github.com/scrooloose/nerdtree/pull/244) + - Remove NERDTree.previousBuf() + - Change color of arrow (Leeiio) [#630](https://github.com/scrooloose/nerdtree/pull/630) + - Improved a tip in README.markdown (ggicci) [#628](https://github.com/scrooloose/nerdtree/pull/628) + - Shorten delete confimration of empty directory to `y` (mikeperri) [#530](https://github.com/scrooloose/nerdtree/pull/530) + - Fix API call to open directory tree in window (devm33) [#533](https://github.com/scrooloose/nerdtree/pull/533) + - Change default arrows on non-Windows platforms (gwilk) [#546](https://github.com/scrooloose/nerdtree/pull/546) + - Update to README - combine cd and git clone (zwhitchcox) [#584](https://github.com/scrooloose/nerdtree/pull/584) + - Update to README - Tip: start NERDTree when vim starts (therealplato) [#593](https://github.com/scrooloose/nerdtree/pull/593) + - Escape filename when moving an open buffer (zacharyvoase) [#595](https://github.com/scrooloose/nerdtree/pull/595) + - Fixed incorrect :helptags command in README (curran) [#619](https://github.com/scrooloose/nerdtree/pull/619) + - Fixed incomplete escaping of folder arrows (adityanatraj) [#548](https://github.com/scrooloose/nerdtree/pull/548) + - Added NERDTreeCascadeSingleChildDir option (juanibiapina) [#558](https://github.com/scrooloose/nerdtree/pull/558) + - Replace strchars() with backward compatible workaround. + - Add support for copy command in Windows (SkylerLipthay) [#231](https://github.com/scrooloose/nerdtree/pull/231) + - Fixed typo in README.markdown - :Helptags -> :helptags + - Rename "primary" and "secondary" trees to "tab" and "window" trees. + - Move a bunch of buffer level variables into the NERDTree and UI classes. + - Display cascading dirs on one line to save vertical/horizontal space (matt-gardner: brainstorming/testing) + - Remove the old style UI - Remove `NERDTreeDirArrows` option. + - On windows default to + and ~ for expand/collapse directory symbols. + - Lots more refactoring. Move a bunch of b: level vars into b:NERDTree and friends. + +#### 5.0.0 +- Refactor the code significantly: + * Break the classes out into their own files. + * Make the majority of the code OO - previously large parts were effectively a tangle of "global" methods. +- Add an API to assign flags to nodes. This allows VCS plugins like https://github.com/Xuyuanp/nerdtree-git-plugin to exist. Thanks to **Xuyuanp** for helping design/test/build said API. +- add `scope` argument to the key map API see :help NERDTreeAddKeyMap() +- add magic [[dir]] and [[file]] flags to NERDTreeIgnore +- add support for custom path filters. See :help NERDTreeAddPathFilter() +- add path listener API. See :help NERDTreePathListenerAPI. +- expand the fs menu functionality to list file properties (PhilRunninger, apbarrero, JESii) +- make bookmarks work with `~` home shortcuts (hiberabyss) +- show OSX specific fsmenu options in regular vim on mac (evindor) +- make dir arrow icons configurable (PickRelated) +- optimise node sorting performance when opening large dirs (vtsang) +- make the root note render prettier by truncating it at a path slash (gcmt) +- remove NERDChristmasTree option - its always christmas now +- add "cascade" open and closing for dirs containing only another single dir. See :help NERDTreeCascadeOpenSingleChildDir (pendulm) +- Many other fixes, doc updates and contributions from: **actionshrimp**, **agrussellknives**, **alvan**, **AndrewRadev**, **cperl82** (*many small fixes*), **devmanhinton**, **egalpin**, **franksort**, **gastropoda**, **handcraftedbits**, **kelaban**, **lucascaton**, **mixvin**, **pendulm**, **SchDen**, **shanesmith**, **staeff**, **stephenprater**, **toiffel**, **Twinside**, **WoLpH**, **xiaodili**, **zhangoose** + +#### 4.2.0 +- Add NERDTreeDirArrows option to make the UI use pretty arrow chars instead of the old +~| chars to define the tree structure (sickill) +- shift the syntax highlighting out into its own syntax file (gnap) +- add some mac specific options to the filesystem menu - for macvim only (andersonfreitas) +- Add NERDTreeMinimalUI option to remove some non functional parts of the nerdtree ui (camthompson) +- tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the new behaviour (benjamingeiger) +- if no name is given to :Bookmark, make it default to the name of the target file/dir (minyoung) +- use `file` completion when doing copying, create, and move operations (EvanDotPro) +- lots of misc bug fixes from: **AndrewRadev**, **Bogdanov**, **camthompson**, **kml**, **mathias**, **paddyoloughlin**, **scottstvnsn**, **sdewald**, **Vitaly**, **wycats**, me RAWR! + +#### 4.1.0 +- features: + - NERDTreeFind to reveal the node for the current buffer in the tree, see `|NERDTreeFind|`. This effectively merges the FindInNERDTree plugin (by **Doug McInnes**) into the script. + - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to **Stefan Ritter** and **Rémi Prévost**. + - truncate the root node if wider than the tree window. Thanks to **Victor Gonzalez**. + +- bugfixes: + - really fix window state restoring + - fix some win32 path escaping issues. Thanks to **Stephan Baumeister**, **Ricky**, **jfilip1024**, and **Chris Chambers**. + +#### 4.0.0 +- add a new programmable menu system (see `:help NERDTreeMenu`). +- add new APIs to add menus/menu-items to the menu system as well as custom key mappings to the NERD tree buffer (see `:help NERDTreeAPI`). +- removed the old API functions +- added a mapping to maximize/restore the size of nerd tree window, thanks to Guillaume Duranceau for the patch. See :help NERDTree-A for details. +- fix a bug where secondary nerd trees (netrw hijacked trees) and NERDTreeQuitOnOpen didnt play nicely, thanks to **Curtis Harvey**. +- fix a bug where the script ignored directories whose name ended in a dot, thanks to **Aggelos Orfanakos** for the patch. +- fix a bug when using the x mapping on the tree root, thanks to **Bryan Venteicher** for the patch. +- fix a bug where the cursor position/window size of the nerd tree buffer wasnt being stored on closing the window, thanks to **Richard Hart**. +- fix a bug where NERDTreeMirror would mirror the wrong tree + +#### 3.1.1 +- fix a bug where a non-listed no-name buffer was getting created every time the tree windows was created, thanks to **Derek Wyatt** and **owen1** +- make `` behave the same as the `o` mapping +- some helptag fixes in the doc, thanks **strull**. +- fix a bug when using `:set nohidden` and opening a file where the previous buf was modified. Thanks **iElectric**. +- other minor fixes + +#### 3.1.0 +- New features: + - add mappings to open files in a vsplit, see `:help NERDTree-s` and `:help NERDTree-gs` + - make the statusline for the nerd tree window default to something hopefully more useful. See `:help 'NERDTreeStatusline'` +- Bugfixes: + - make the hijack netrw functionality work when vim is started with `vim ` (thanks to **Alf Mikula** for the patch). + - fix a bug where the CWD wasnt being changed for some operations even when NERDTreeChDirMode==2 (thanks to **Lucas S. Buchala**) + - add -bar to all the nerd tree :commands so they can chain with other :commands (thanks to **tpope**) + - fix bugs when ignorecase was set (thanks to **nach**) + - fix a bug with the relative path code (thanks to **nach**) + - fix a bug where doing a `:cd` would cause `:NERDTreeToggle` to fail (thanks **nach**) + + +#### 3.0.1 +- Bugfixes: + - fix bugs with :NERDTreeToggle and :NERDTreeMirror when `'hidden'` was not set + - fix a bug where `:NERDTree ` would fail if `` was relative and didnt start with a `./` or `../` Thanks to **James Kanze**. + - make the `q` mapping work with secondary (`:e ` style) trees, thanks to **jamessan** + - fix a bunch of small bugs with secondary trees +- More insane refactoring. + +#### 3.0.0 +- hijack netrw so that doing an `:edit ` will put a NERD tree in the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw' +- allow sharing of trees across tabs, see `:help :NERDTreeMirror` +- remove "top" and "bottom" as valid settings for NERDTreeWinPos +- change the `''` mapping to `'i'` +- change the `'H'` mapping to `'I'` +- lots of refactoring diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index fd192827..4391565e 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -3,13 +3,38 @@ if exists("g:loaded_nerdtree_autoload") endif let g:loaded_nerdtree_autoload = 1 -function! nerdtree#version() - return '5.0.0' +let s:rootNERDTreePath = resolve(expand(":p:h:h")) +function! nerdtree#version(...) + let l:changelog = readfile(join([s:rootNERDTreePath, "CHANGELOG.md"], nerdtree#slash())) + let l:text = 'Unknown' + let l:line = 0 + while l:line <= len(l:changelog) + if l:changelog[l:line] =~ '\d\+\.\d\+' + let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '') + let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '') + break + endif + let l:line += 1 + endwhile + return l:text endfunction " SECTION: General Functions {{{1 "============================================================ +function! nerdtree#slash() + + if nerdtree#runningWindows() + if exists('+shellslash') && &shellslash + return '/' + endif + + return '\' + endif + + return '/' +endfunction + "FUNCTION: nerdtree#and(x,y) {{{2 " Implements and() function for Vim <= 7.2 function! nerdtree#and(x,y) @@ -129,13 +154,13 @@ function! nerdtree#deprecated(func, ...) endif endfunction -" FUNCTION: nerdtree#exec(cmd) {{{2 -" Same as :exec cmd but with eventignore set for the duration -" to disable the autocommands used by NERDTree (BufEnter, -" BufLeave and VimEnter) -function! nerdtree#exec(cmd) +" FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2 +" Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration +function! nerdtree#exec(cmd, ignoreAll) let old_ei = &ei - set ei=BufEnter,BufLeave,VimEnter + if a:ignoreAll + set ei=all + endif exec a:cmd let &ei = old_ei endfunction diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index a82ff18e..f0458680 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -14,6 +14,10 @@ function! nerdtree#ui_glue#createDefaultBindings() call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s."customOpenFile"}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s."customOpenDir"}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s."customOpenBookmark"}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'all', 'callback': s."activateAll" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) @@ -76,6 +80,35 @@ endfunction "SECTION: Interface bindings {{{1 "============================================================ +"FUNCTION: s:customOpenFile() {{{1 +" Open file node with the "custom" key, initially . +function! s:customOpenFile(node) + call a:node.activate(s:initCustomOpenArgs().file) +endfunction + +"FUNCTION: s:customOpenDir() {{{1 +" Open directory node with the "custom" key, initially . +function! s:customOpenDir(node) + call s:activateDirNode(a:node, s:initCustomOpenArgs().dir) +endfunction + +"FUNCTION: s:customOpenBookmark() {{{1 +" Open bookmark node with the "custom" key, initially . +function! s:customOpenBookmark(node) + if a:node.path.isDirectory + call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir) + else + call a:node.activate(b:NERDTree, s:initCustomOpenArgs().file) + endif +endfunction + +"FUNCTION: s:initCustomOpenArgs() {{{1 +" Make sure NERDTreeCustomOpenArgs has needed keys +function! s:initCustomOpenArgs() + let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) + return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep') +endfunction + "FUNCTION: s:activateAll() {{{1 "handle the user activating the updir line function! s:activateAll() @@ -84,15 +117,16 @@ function! s:activateAll() endif endfunction -" FUNCTION: s:activateDirNode(directoryNode) {{{1 -function! s:activateDirNode(directoryNode) +" FUNCTION: s:activateDirNode(directoryNode, options) {{{1 +" Open a directory with optional options +function! s:activateDirNode(directoryNode, ...) if a:directoryNode.isRoot() && a:directoryNode.isOpen call nerdtree#echo('cannot close tree root') return endif - call a:directoryNode.activate() + call a:directoryNode.activate((a:0 > 0) ? a:1 : {}) endfunction "FUNCTION: s:activateFileNode() {{{1 @@ -367,7 +401,7 @@ function! s:jumpToLastChild(node) call s:jumpToChild(a:node, 1) endfunction -" FUNCTION: s:jumpToChild(node, last) {{{2 +" FUNCTION: s:jumpToChild(node, last) {{{1 " Jump to the first or last child node at the same file system level. " " Args: @@ -425,7 +459,7 @@ function! s:jumpToPrevSibling(node) call s:jumpToSibling(a:node, 0) endfunction -" FUNCTION: s:jumpToSibling(node, forward) {{{2 +" FUNCTION: s:jumpToSibling(node, forward) {{{1 " Move the cursor to the next or previous node at the same file system level. " " Args: @@ -540,11 +574,11 @@ function! s:refreshRoot() call nerdtree#echo("Refreshing the root node. This could take a while...") let l:curWin = winnr() - call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w") + call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w", 1) call b:NERDTree.root.refresh() call b:NERDTree.render() redraw - call nerdtree#exec(l:curWin . "wincmd w") + call nerdtree#exec(l:curWin . "wincmd w", 1) call nerdtree#echo("") endfunction diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 93635bd0..14f70782 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -247,12 +247,12 @@ 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| +.....User-definable custom open action.......................|NERDTree-| 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 |NERDTree-o|. middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs. @@ -319,7 +319,7 @@ The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see ------------------------------------------------------------------------------ *NERDTree-t* Default key: t -Map setting: NERDTreeMapOpenInTab +Map setting: *NERDTreeMapOpenInTab* Applies to: files and directories. Opens the selected file in a new tab. If a directory is selected, a fresh @@ -332,7 +332,7 @@ in a new tab. ------------------------------------------------------------------------------ *NERDTree-T* Default key: T -Map setting: NERDTreeMapOpenInTabSilent +Map setting: *NERDTreeMapOpenInTabSilent* Applies to: files and directories. The same as |NERDTree-t| except that the focus is kept in the current tab. @@ -340,7 +340,7 @@ The same as |NERDTree-t| except that the focus is kept in the current tab. ------------------------------------------------------------------------------ *NERDTree-i* Default key: i -Map setting: NERDTreeMapOpenSplit +Map setting: *NERDTreeMapOpenSplit* Applies to: files. Opens the selected file in a new split window and puts the cursor in the new @@ -349,7 +349,7 @@ window. ------------------------------------------------------------------------------ *NERDTree-gi* Default key: gi -Map setting: NERDTreeMapPreviewSplit +Map setting: *NERDTreeMapPreviewSplit* Applies to: files. The same as |NERDTree-i| except that the cursor is not moved. @@ -360,7 +360,7 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see ------------------------------------------------------------------------------ *NERDTree-s* Default key: s -Map setting: NERDTreeMapOpenVSplit +Map setting: *NERDTreeMapOpenVSplit* Applies to: files. Opens the selected file in a new vertically split window and puts the cursor @@ -369,7 +369,7 @@ in the new window. ------------------------------------------------------------------------------ *NERDTree-gs* Default key: gs -Map setting: NERDTreeMapPreviewVSplit +Map setting: *NERDTreeMapPreviewVSplit* Applies to: files. The same as |NERDTree-s| except that the cursor is not moved. @@ -377,10 +377,19 @@ The same as |NERDTree-s| except that the cursor is not moved. The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see |NERDTree-s|). +------------------------------------------------------------------------------ + *NERDTree-* +Default key: +Map setting: *NERDTreeMapCustomOpen* +Applies to: files, directories, and bookmarks + +Performs a customized open action on the selected node. This allows the user +to define an action that behaves differently from any of the standard +keys. See |NERDTreeCustomOpenArgs| for more details. ------------------------------------------------------------------------------ *NERDTree-O* Default key: O -Map setting: NERDTreeMapOpenRecursively +Map setting: *NERDTreeMapOpenRecursively* Applies to: directories. Recursively opens the selected directory. @@ -393,7 +402,7 @@ cached. This is handy, especially if you have .svn directories. ------------------------------------------------------------------------------ *NERDTree-x* Default key: x -Map setting: NERDTreeMapCloseDir +Map setting: *NERDTreeMapCloseDir* Applies to: files and directories. Closes the parent of the selected node. @@ -401,7 +410,7 @@ Closes the parent of the selected node. ------------------------------------------------------------------------------ *NERDTree-X* Default key: X -Map setting: NERDTreeMapCloseChildren +Map setting: *NERDTreeMapCloseChildren* Applies to: directories. Recursively closes all children of the selected directory. @@ -411,7 +420,7 @@ Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping. ------------------------------------------------------------------------------ *NERDTree-e* Default key: e -Map setting: NERDTreeMapOpenExpl +Map setting: *NERDTreeMapOpenExpl* Applies to: files and directories. |:edit|s the selected directory, or the selected file's directory. This could @@ -421,7 +430,7 @@ result in a NERDTree or a netrw being opened, depending on ------------------------------------------------------------------------------ *NERDTree-D* Default key: D -Map setting: NERDTreeMapDeleteBookmark +Map setting: *NERDTreeMapDeleteBookmark* Applies to: lines in the bookmarks table Deletes the currently selected bookmark. @@ -429,7 +438,7 @@ Deletes the currently selected bookmark. ------------------------------------------------------------------------------ *NERDTree-P* Default key: P -Map setting: NERDTreeMapJumpRoot +Map setting: *NERDTreeMapJumpRoot* Applies to: no restrictions. Jump to the tree root. @@ -437,7 +446,7 @@ Jump to the tree root. ------------------------------------------------------------------------------ *NERDTree-p* Default key: p -Map setting: NERDTreeMapJumpParent +Map setting: *NERDTreeMapJumpParent* Applies to: files and directories. Jump to the parent node of the selected node. @@ -445,7 +454,7 @@ Jump to the parent node of the selected node. ------------------------------------------------------------------------------ *NERDTree-K* Default key: K -Map setting: NERDTreeMapJumpFirstChild +Map setting: *NERDTreeMapJumpFirstChild* Applies to: files and directories. Jump to the first child of the current nodes parent. @@ -458,7 +467,7 @@ If the cursor is already on the first node then do the following: ------------------------------------------------------------------------------ *NERDTree-J* Default key: J -Map setting: NERDTreeMapJumpLastChild +Map setting: *NERDTreeMapJumpLastChild* Applies to: files and directories. Jump to the last child of the current nodes parent. @@ -471,7 +480,7 @@ If the cursor is already on the last node then do the following: ------------------------------------------------------------------------------ *NERDTree-C-J* Default key: -Map setting: NERDTreeMapJumpNextSibling +Map setting: *NERDTreeMapJumpNextSibling* Applies to: files and directories. Jump to the next sibling of the selected node. @@ -479,7 +488,7 @@ Jump to the next sibling of the selected node. ------------------------------------------------------------------------------ *NERDTree-C-K* Default key: -Map setting: NERDTreeMapJumpPrevSibling +Map setting: *NERDTreeMapJumpPrevSibling* Applies to: files and directories. Jump to the previous sibling of the selected node. @@ -487,7 +496,7 @@ Jump to the previous sibling of the selected node. ------------------------------------------------------------------------------ *NERDTree-C* Default key: C -Map setting: NERDTreeMapChangeRoot +Map setting: *NERDTreeMapChangeRoot* Applies to: files and directories. Make the selected directory node the new tree root. If a file is selected, its @@ -496,7 +505,7 @@ parent is used. ------------------------------------------------------------------------------ *NERDTree-u* Default key: u -Map setting: NERDTreeMapUpdir +Map setting: *NERDTreeMapUpdir* Applies to: no restrictions. Move the tree root up a dir (like doing a "cd .."). @@ -504,7 +513,7 @@ Move the tree root up a dir (like doing a "cd .."). ------------------------------------------------------------------------------ *NERDTree-U* Default key: U -Map setting: NERDTreeMapUpdirKeepOpen +Map setting: *NERDTreeMapUpdirKeepOpen* Applies to: no restrictions. Like |NERDTree-u| except that the old tree root is kept open. @@ -512,7 +521,7 @@ Like |NERDTree-u| except that the old tree root is kept open. ------------------------------------------------------------------------------ *NERDTree-r* Default key: r -Map setting: NERDTreeMapRefresh +Map setting: *NERDTreeMapRefresh* Applies to: files and directories. If a dir is selected, recursively refresh that dir, i.e. scan the filesystem @@ -523,7 +532,7 @@ If a file node is selected then the above is done on it's parent. ------------------------------------------------------------------------------ *NERDTree-R* Default key: R -Map setting: NERDTreeMapRefreshRoot +Map setting: *NERDTreeMapRefreshRoot* Applies to: no restrictions. Recursively refresh the tree root. @@ -531,7 +540,7 @@ Recursively refresh the tree root. ------------------------------------------------------------------------------ *NERDTree-m* Default key: m -Map setting: NERDTreeMapMenu +Map setting: *NERDTreeMapMenu* Applies to: files and directories. Display the NERDTree menu. See |NERDTreeMenu| for details. @@ -539,7 +548,7 @@ Display the NERDTree menu. See |NERDTreeMenu| for details. ------------------------------------------------------------------------------ *NERDTree-cd* Default key: cd -Map setting: NERDTreeMapChdir +Map setting: *NERDTreeMapChdir* Applies to: files and directories. Change Vim's current working directory to that of the selected node. @@ -547,7 +556,7 @@ Change Vim's current working directory to that of the selected node. ------------------------------------------------------------------------------ *NERDTree-CD* Default key: CD -Map setting: NERDTreeMapCWD +Map setting: *NERDTreeMapCWD* Applies to: no restrictions. Change the NERDTree root to Vim's current working directory. @@ -555,7 +564,7 @@ Change the NERDTree root to Vim's current working directory. ------------------------------------------------------------------------------ *NERDTree-I* Default key: I -Map setting: NERDTreeMapToggleHidden +Map setting: *NERDTreeMapToggleHidden* Applies to: no restrictions. Toggles whether hidden files (i.e. "dot files") are displayed. @@ -563,7 +572,7 @@ Toggles whether hidden files (i.e. "dot files") are displayed. ------------------------------------------------------------------------------ *NERDTree-f* Default key: f -Map setting: NERDTreeMapToggleFilters +Map setting: *NERDTreeMapToggleFilters* Applies to: no restrictions. Toggles whether file filters are used. See |NERDTreeIgnore| for details. @@ -571,7 +580,7 @@ Toggles whether file filters are used. See |NERDTreeIgnore| for details. ------------------------------------------------------------------------------ *NERDTree-F* Default key: F -Map setting: NERDTreeMapToggleFiles +Map setting: *NERDTreeMapToggleFiles* Applies to: no restrictions. Toggles whether file nodes are displayed. @@ -579,7 +588,7 @@ Toggles whether file nodes are displayed. ------------------------------------------------------------------------------ *NERDTree-B* Default key: B -Map setting: NERDTreeMapToggleBookmarks +Map setting: *NERDTreeMapToggleBookmarks* Applies to: no restrictions. Toggles whether the bookmarks table is displayed. @@ -587,7 +596,7 @@ Toggles whether the bookmarks table is displayed. ------------------------------------------------------------------------------ *NERDTree-q* Default key: q -Map setting: NERDTreeMapQuit +Map setting: *NERDTreeMapQuit* Applies to: no restrictions. Closes the NERDTree window. @@ -595,7 +604,7 @@ Closes the NERDTree window. ------------------------------------------------------------------------------ *NERDTree-A* Default key: A -Map setting: NERDTreeMapToggleZoom +Map setting: *NERDTreeMapToggleZoom* Applies to: no restrictions. Maximize (zoom) and minimize the NERDTree window. @@ -603,7 +612,7 @@ Maximize (zoom) and minimize the NERDTree window. ------------------------------------------------------------------------------ *NERDTree-?* Default key: ? -Map setting: NERDTreeMapHelp +Map setting: *NERDTreeMapHelp* Applies to: no restrictions. Toggles whether the quickhelp is displayed. @@ -625,7 +634,7 @@ Related tags: |NERDTree-m| |NERDTreeApi| ------------------------------------------------------------------------------ *NERDTreeMenu-j* Default key: j -Map option: NERDTreeMenuDown +Map option: *NERDTreeMenuDown* Applies to: The NERDTree menu. Moves the cursor down. @@ -633,7 +642,7 @@ Moves the cursor down. ------------------------------------------------------------------------------ *NERDTreeMenu-k* Default key: k -Map option: NERDTreeMenuUp +Map option: *NERDTreeMenuUp* Applies to: The NERDTree menu. Moves the cursor up. @@ -754,6 +763,9 @@ the NERDTree. These settings should be set in your vimrc, using `:let`. file or directory name from the rest of the characters on the line of text. +|NERDTreeCustomOpenArgs| A dictionary with values that control how a node + is opened with the |NERDTree-| key. + ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeSettingsDetails* @@ -1031,28 +1043,31 @@ window. Use one of the follow lines for this setting: > Values: a list of regular expressions. Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$'] -This setting is 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 group or sort +the nodes under their parent. 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 +then all .vim files will be grouped 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 doesn't match any of the other regexps should be placed here. -If no star is present in NERDTreeSortOrder then one is automatically -appended to the array. +If no star is present in NERDTreeSortOrder, then one is automatically +appended to the end of the list. The regex '\/$' should be used to match directory nodes. -A special flag can be used to sort by the modification timestamps of files and -directories. It is either '[[timestamp]]' for ascending, or '[[-timestamp]]' -for descending. If placed at the beginning of the list, files and directories -are sorted by timestamp, and then by the remaining items in the sort order -list. If this flag is in any other position of the list, timestamp sorting is -done secondarily. See examples 4, 5, and 6 below. +Files can also be sorted by 1) the modification timestamp, 2) the size, or 3) +the extension. Directories are always sorted by name. To accomplish this, the +following special flags are used: + [[timestamp]] [[-timestamp]] [[size]] [[-size]] [[extension]] +The hyphen specifies a descending sort; extensions are sorted in ascending +order only. If placed at the beginning of the list, files are sorted according +to these flags first, and then grouped by the remaining items in the list. If +the flags are in any other position of the list, this special sorting is done +secondarily. See examples 4, 5, and 6 below. After this sorting is done, the files in each group are sorted alphabetically. @@ -1060,20 +1075,20 @@ Examples: > (1) ['*', '\/$'] (2) [] (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$'] - (4) ['[[timestamp]]'] - (5) ['\/$', '*', '[[-timestamp]]'] - (6) ['\.md$', '\.c$', '[[-timestamp]]', '*'] + (4) ['[[-size]]'] + (5) ['\/$', '*', '[[timestamp]]'] + (6) ['foo','\/$','[[extension]]'] < 1. Directories will appear last, everything else will appear above. 2. Everything will simply appear in alphabetical order. 3. Dirs will appear first, then ruby and php. Swap files, bak files and vim backup files will appear last with everything else preceding them. -4. All files and directories are sorted by timestamp, oldest first. If any - files have identical timestamps, they are sorted alphabetically. -5. Directories are first, newest to oldest, then everything else, newest to - oldest. -6. Markdown files first, followed by C source files, then everything else. - Each group is shown newest to oldest. +4. Everything is sorted by size, largest to smallest, with directories + considered to have size 0 bytes. +5. Directories will appear first alphabetically, followed by files, sorted by + timestamp, oldest first. +6. Files and directories matching 'foo' first, followed by other directories, + then all other files. Each section of files is sorted by file extension. ------------------------------------------------------------------------------ *NERDTreeStatusline* @@ -1233,6 +1248,32 @@ when specifying by hex or Unicode. > let NERDTreeNodeDelimiter="\u00a0" "non-breaking space let NERDTreeNodeDelimiter="😀" "smiley face < +------------------------------------------------------------------------------ + *NERDTreeCustomOpenArgs* +Values: A nested dictionary, as described below +Default: {'file': {'reuse': 'all', 'where': 'p'}, 'dir': {}} + +This dictionary contains two keys, 'file' and 'dir', whose values each are +another dictionary. The inner dictionary is a set of parameters used by +|NERDTree-| to open a file or directory. Setting these parameters allows you +to customize the way the node is opened. The default value matches what +|NERDTree-o| does. To change that behavior, use these keys and +values in the inner dictionaries: + +'where': specifies whether the node should be opened in a new split ("h" or + "v"), in a new tab ("t") or, in the last window ("p"). +'reuse': if file is already shown in a window, jump there; takes values + "all", "currenttab", or empty +'keepopen': boolean (0 or 1); if true, the tree window will not be closed +'stay': boolean (0 or 1); if true, remain in tree window after opening + +For example: +To open files and directories (creating a new NERDTree) in a new tab, > + {'file':{'where': 't'}, 'dir':{'where':'t'}} +< +To open a file always in the current tab, and expand directories in place, > + {'file': {'reuse':'currenttab', 'where':'p', 'keepopen':1, 'stay':1}} +< ============================================================================== 4. The NERDTree API *NERDTreeAPI* diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index c633a8f2..b206e7a4 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -159,8 +159,8 @@ endfunction " FUNCTION: s:Edit() {{{1 " opens the NERDTreeBookmarks file for manual editing function! s:Bookmark.Edit() - execute "wincmd w" - execute "edit ".g:NERDTreeBookmarksFile + call nerdtree#exec("wincmd w", 1) + call nerdtree#exec("edit ".g:NERDTreeBookmarksFile, 1) endfunction " FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 980cf805..efd3cc81 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -13,9 +13,6 @@ let g:NERDTreeCreator = s:Creator " FUNCTION: s:Creator._bindMappings() {{{1 function! s:Creator._bindMappings() - "make do the same as the activate node mapping - nnoremap :call nerdtree#ui_glue#invokeKeyMap(g:NERDTreeMapActivateNode) - call g:NERDTreeKeyMap.BindAll() command! -buffer -nargs=? Bookmark :call nerdtree#ui_glue#bookmarkNode('') @@ -189,18 +186,20 @@ function! s:Creator._createTreeWin() let t:NERDTreeBufName = self._nextBufferName() silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new' silent! execute 'edit ' . t:NERDTreeBufName + silent! execute 'vertical resize '. l:splitSize else silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split' silent! execute 'buffer ' . t:NERDTreeBufName endif + setlocal winfixwidth + call self._setCommonBufOptions() if has('patch-7.4.1925') clearjumps endif - setlocal winfixwidth endfunction " FUNCTION: s:Creator._isBufHidden(nr) {{{1 @@ -218,14 +217,14 @@ function! s:Creator.New() return newCreator endfunction -" FUNCTION: s:Creator._nextBufferName() {{{2 +" FUNCTION: s:Creator._nextBufferName() {{{1 " returns the buffer name for the next nerd tree function! s:Creator._nextBufferName() let name = s:Creator.BufNamePrefix() . self._nextBufferNumber() return name endfunction -" FUNCTION: s:Creator._nextBufferNumber() {{{2 +" FUNCTION: s:Creator._nextBufferNumber() {{{1 " the number to add to the nerd tree buffer name to make the buf name unique function! s:Creator._nextBufferNumber() if !exists("s:Creator._NextBufNum") diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim index 26dbd296..05e82d97 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim @@ -31,7 +31,11 @@ function! s:MenuController.showMenu() let l:done = 0 while !l:done - redraw! + if has('nvim') + mode + else + redraw! + endif call self._echoPrompt() let l:key = nr2char(getchar()) @@ -64,7 +68,7 @@ function! s:MenuController._echoPrompt() echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): " else - echo "NERDTree Menu. " . navHelp . " . or the shortcuts indicated" + echo "NERDTree Menu. " . navHelp . ", or the shortcuts indicated" echo "=========================================================" for i in range(0, len(self.menuItems)-1) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index c1ce5ed0..705d4f9b 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -44,19 +44,19 @@ function! s:NERDTree.Close() let l:useWinId = exists('*win_getid') && exists('*win_gotoid') if winnr() == s:NERDTree.GetWinNum() - call nerdtree#exec("wincmd p") + call nerdtree#exec("wincmd p", 1) let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("") - call nerdtree#exec("wincmd p") + call nerdtree#exec("wincmd p", 1) else let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("") endif - call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w") - close + call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1) + call nerdtree#exec("close", 1) if l:useWinId - call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")") + call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0) else - call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w") + call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w", 0) endif else close @@ -98,7 +98,7 @@ endfunction "Places the cursor in the nerd tree window function! s:NERDTree.CursorToTreeWin() call g:NERDTree.MustBeOpen() - call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w") + call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w", 1) endfunction " Function: s:NERDTree.ExistsForBuffer() {{{1 @@ -153,7 +153,7 @@ endfunction "FUNCTION: s:NERDTree.IsOpen() {{{1 function! s:NERDTree.IsOpen() - return s:NERDTree.GetWinNum() != -1 + return s:NERDTree.GetWinNum() != -1 || bufname('%') =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$' endfunction "FUNCTION: s:NERDTree.isTabTree() {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index f4bd6e06..5953eea2 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -107,10 +107,10 @@ function! s:Opener._isWindowUsable(winnumber) endif let oldwinnr = winnr() - call nerdtree#exec(a:winnumber . "wincmd p") + call nerdtree#exec(a:winnumber . "wincmd p", 1) let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') let modified = &modified - call nerdtree#exec(oldwinnr . "wincmd p") + call nerdtree#exec(oldwinnr . "wincmd p", 1) "if its a special window e.g. quickfix or another explorer plugin then we "have to split @@ -172,7 +172,7 @@ function! s:Opener._newSplit() let below=0 " Attempt to go to adjacent window - call nerdtree#exec(back) + call nerdtree#exec(back, 1) let onlyOneWin = (winnr("$") ==# 1) @@ -201,9 +201,9 @@ function! s:Opener._newSplit() "resize the tree window if no other window was open before if onlyOneWin let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - call nerdtree#exec(there) + call nerdtree#exec(there, 1) exec("silent ". splitMode ." resize ". size) - call nerdtree#exec('wincmd p') + call nerdtree#exec('wincmd p', 0) endif " Restore splitmode settings @@ -219,8 +219,8 @@ function! s:Opener._newVSplit() let l:winwidth = g:NERDTreeWinSize endif - call nerdtree#exec('wincmd p') - vnew + call nerdtree#exec('wincmd p', 1) + call nerdtree#exec('vnew', 1) let l:currentWindowNumber = winnr() @@ -228,7 +228,7 @@ function! s:Opener._newVSplit() call g:NERDTree.CursorToTreeWin() execute 'silent vertical resize ' . l:winwidth - call nerdtree#exec(l:currentWindowNumber . 'wincmd w') + call nerdtree#exec(l:currentWindowNumber . 'wincmd w', 0) endfunction " FUNCTION: Opener.open(target) {{{1 @@ -290,9 +290,9 @@ function! s:Opener._previousWindow() else try if !self._isWindowUsable(winnr("#")) - call nerdtree#exec(self._firstUsableWindow() . "wincmd w") + call nerdtree#exec(self._firstUsableWindow() . "wincmd w", 1) else - call nerdtree#exec('wincmd p') + call nerdtree#exec('wincmd p', 1) endif catch /^Vim\%((\a\+)\)\=:E37/ call g:NERDTree.CursorToTreeWin() @@ -305,8 +305,8 @@ endfunction " FUNCTION: Opener._restoreCursorPos() {{{1 function! s:Opener._restoreCursorPos() - call nerdtree#exec(self._tabnr . 'tabnext') - call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w') + call nerdtree#exec(self._tabnr . 'tabnext', 1) + call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w', 1) endfunction " FUNCTION: Opener._reuseWindow() {{{1 @@ -321,7 +321,7 @@ function! s:Opener._reuseWindow() "check the current tab for the window let winnr = bufwinnr('^' . self._path.str() . '$') if winnr != -1 - call nerdtree#exec(winnr . "wincmd w") + call nerdtree#exec(winnr . "wincmd w", 0) call self._checkToCloseTree(0) return 1 endif @@ -334,9 +334,9 @@ function! s:Opener._reuseWindow() let tabnr = self._path.tabnr() if tabnr call self._checkToCloseTree(1) - call nerdtree#exec(tabnr . 'tabnext') + call nerdtree#exec(tabnr . 'tabnext', 1) let winnr = bufwinnr('^' . self._path.str() . '$') - call nerdtree#exec(winnr . "wincmd w") + call nerdtree#exec(winnr . "wincmd w", 0) return 1 endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index c3af1952..d00bb898 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -380,7 +380,8 @@ endfunction function! s:Path.getSortOrderIndex() let i = 0 while i < len(g:NERDTreeSortOrder) - if self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i] + if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' && + \ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i] return i endif let i = i + 1 @@ -407,15 +408,26 @@ endfunction " FUNCTION: Path.getSortKey() {{{1 " returns a key used in compare function for sorting function! s:Path.getSortKey() - let l:ascending = index(g:NERDTreeSortOrder,'[[timestamp]]') - let l:descending = index(g:NERDTreeSortOrder,'[[-timestamp]]') - if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder || l:ascending >= 0 || l:descending >= 0 - let self._sortKey = [self.getSortOrderIndex()] + if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder + " Look for file metadata tags: [[timestamp]], [[extension]], [[size]] + let metadata = [] + for tag in g:NERDTreeSortOrder + if tag =~? '\[\[-\?timestamp\]\]' + let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~ '-' ? -1 : 1)] + elseif tag =~? '\[\[-\?size\]\]' + let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~ '-' ? -1 : 1)] + elseif tag =~? '\[\[extension\]\]' + let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$') + let metadata += [self.isDirectory ? '' : (extension == '' ? nr2char(str2nr('0x10ffff',16)) : extension)] + endif + endfor - if l:descending >= 0 - call insert(self._sortKey, -getftime(self.str()), l:descending == 0 ? 0 : len(self._sortKey)) - elseif l:ascending >= 0 - call insert(self._sortKey, getftime(self.str()), l:ascending == 0 ? 0 : len(self._sortKey)) + if g:NERDTreeSortOrder[0] =~ '\[\[.*\]\]' + " Apply tags' sorting first if specified first. + let self._sortKey = metadata + [self.getSortOrderIndex()] + else + " Otherwise, do regex grouping first. + let self._sortKey = [self.getSortOrderIndex()] + metadata endif let path = self.getLastPathComponent(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 a834e7c1..aa9dea6a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -620,6 +620,11 @@ function! s:TreeDirNode.reveal(path, ...) if self.path.equals(a:path.getParent()) let n = self.findNode(a:path) + " We may be looking for a newly-saved file that isn't in the tree yet. + if n == {} + call self.refresh() + let n = self.findNode(a:path) + endif if has_key(opts, "open") call n.open() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 6ff9878e..d384071d 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -6,7 +6,7 @@ let s:UI = {} let g:NERDTreeUI = s:UI -" FUNCTION: s:UI.centerView() {{{2 +" FUNCTION: s:UI.centerView() {{{1 " centers the nerd tree window around the cursor (provided the nerd tree " options permit) function! s:UI.centerView() @@ -28,7 +28,6 @@ function! s:UI._dumpHelp() let help .= "\" ============================\n" let help .= "\" File node mappings~\n" let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" - let help .= "\" ,\n" if self.nerdtree.isTabTree() let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n" else @@ -44,6 +43,7 @@ function! s:UI._dumpHelp() let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n" let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" + let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Directory node mappings~\n" @@ -52,6 +52,7 @@ function! s:UI._dumpHelp() let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n" let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" let help .= "\" current node recursively\n" @@ -66,6 +67,7 @@ function! s:UI._dumpHelp() let help .= "\" ". g:NERDTreeMapPreview .": find dir in tree\n" let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" let help .= "\"\n\" ----------------------------\n" @@ -252,7 +254,7 @@ endfunction " gets the line number of the root node function! s:UI.getRootLineNum() let rootLine = 1 - while getline(rootLine) !~# '^\(/\|<\)' + while rootLine <= line('$') && getline(rootLine) !~# '^\(/\|<\)' let rootLine = rootLine + 1 endwhile return rootLine @@ -338,7 +340,7 @@ function! s:UI.restoreScreenState() if !has_key(self, '_screenState') return endif - exec("silent vertical resize " . self._screenState['oldWindowSize']) + call nerdtree#exec("silent vertical resize " . self._screenState['oldWindowSize'], 1) let old_scrolloff=&scrolloff let &scrolloff=0 @@ -358,7 +360,7 @@ function! s:UI.saveScreenState() let self._screenState['oldPos'] = getpos(".") let self._screenState['oldTopLine'] = line("w0") let self._screenState['oldWindowSize']= winwidth("") - call nerdtree#exec(win . "wincmd w") + call nerdtree#exec(win . "wincmd w", 1) endfunction " FUNCTION: s:UI.setShowHidden(val) {{{1 @@ -504,10 +506,10 @@ endfunction function! s:UI.toggleZoom() if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - exec "silent vertical resize ". size + call nerdtree#exec("silent vertical resize ". size, 1) let b:NERDTreeZoomed = 0 else - exec "vertical resize ". get(g:, 'NERDTreeWinSizeMax', '') + call nerdtree#exec("vertical resize ". get(g:, 'NERDTreeWinSizeMax', ''), 1) let b:NERDTreeZoomed = 1 endif endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 3eef5176..0a5de8a4 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -37,6 +37,7 @@ endif if g:NERDTreePath.CopyingSupported() call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) endif +call NERDTreeAddMenuItem({'text': (has("clipboard")?'copy (p)ath to clipboard':'print (p)ath to screen'), 'shortcut': 'p', 'callback': 'NERDTreeCopyPath'}) if has("unix") || has("osx") call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'}) @@ -113,14 +114,14 @@ function! s:promptToDelBuffer(bufnum, msg) let l:listedBufferCount = 0 endif if l:listedBufferCount > 1 - exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif" + call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif", 1) else - exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif" + call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif", 1) endif - exec "tabnext " . s:originalTabNumber - exec s:originalWindowNumber . "wincmd w" + call nerdtree#exec("tabnext " . s:originalTabNumber, 1) + call nerdtree#exec(s:originalWindowNumber . "wincmd w", 1) " 3. We don't need a previous buffer anymore - exec "bwipeout! " . a:bufnum + call nerdtree#exec("bwipeout! " . a:bufnum, 0) endif endfunction @@ -140,17 +141,17 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) endif " 1. ensure that a new buffer is loaded - exec "badd " . quotedFileName + call nerdtree#exec("badd " . quotedFileName, 1) " 2. ensure that all windows which display the just deleted filename " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - exec "tabdo windo if winbufnr(0) == " . a:bufNum . " | exec ':e! " . editStr . "' | endif" - exec "tabnext " . s:originalTabNumber - exec s:originalWindowNumber . "wincmd w" + call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1) + call nerdtree#exec("tabnext " . s:originalTabNumber, 1) + call nerdtree#exec(s:originalWindowNumber . "wincmd w", 1) " 3. We don't need a previous buffer anymore try - exec "confirm bwipeout " . a:bufNum + call nerdtree#exec("confirm bwipeout " . a:bufNum, 0) catch " This happens when answering Cancel if confirmation is needed. Do nothing. endtry @@ -364,6 +365,17 @@ function! NERDTreeCopyNode() redraw! endfunction +" FUNCTION: NERDTreeCopyPath() {{{1 +function! NERDTreeCopyPath() + let l:nodePath = g:NERDTreeFileNode.GetSelected().path.str() + if has("clipboard") + let @* = l:nodePath + call nerdtree#echo("The path [" . l:nodePath . "] was copied to your clipboard.") + else + call nerdtree#echo("The full path is: " . l:nodePath) + endif +endfunction + " FUNCTION: NERDTreeQuickLook() {{{1 function! NERDTreeQuickLook() let treenode = g:NERDTreeFileNode.GetSelected() diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 595e780b..a8e26d4e 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -121,6 +121,7 @@ endif "SECTION: Init variable calls for key mappings {{{2 +call s:initVariable("g:NERDTreeMapCustomOpen", "") call s:initVariable("g:NERDTreeMapActivateNode", "o") call s:initVariable("g:NERDTreeMapChangeRoot", "C") call s:initVariable("g:NERDTreeMapChdir", "cd") diff --git a/sources_non_forked/nginx.vim/README.md b/sources_non_forked/nginx.vim/README.md index 856dff23..58eceefa 100644 --- a/sources_non_forked/nginx.vim/README.md +++ b/sources_non_forked/nginx.vim/README.md @@ -1,9 +1,12 @@ # nginx.vim ## Description + [Vim](http://www.vim.org/) plugin for [Nginx](http://www.nginx.org) + ## Features + The plugin is based on the recent vim-plugin distributed with `nginx-1.12.0` and additionally features the following syntax improvements: - Highlight IPv4 and IPv6 addresses @@ -24,6 +27,7 @@ Furthermore: ## Screenshots + A `server` block with highlighting of insecure `ssl_protocol` options: ![nginx server block with SSL configuration](https://chr4.org/images/nginx_ssl.png) @@ -37,46 +41,18 @@ Embedded LUA syntax highlighting: ![Embedded LUA syntax highlighting](https://chr4.org/images/nginx_lua.png) -## Snippets -The plugin comes with useful snippets which can be accessed using e.g. [vim-snipmate](https://github.com/garbas/vim-snipmate). - -Select a decent cipher for your requirements (all of them can provide [SSLLabs A+ ratings](https://www.ssllabs.com/ssltest/analyze.html)) - -- `ciphers-paranoid`: Even-more-secure ciphers (elliptic curves, no GCM), not compatible with IE < 11, OpenSSL-0.9.8, Safari < 7, Android != 4.4 -- **`ciphers-modern`: High-security ciphers (elliptic curves), not compatible with IE < 11, OpenSSL-0.9.8, Safari < 7, Android < 4.4 (recommended)** -- `ciphers-compat`: Medium-security ciphers with good compatibility (No IE on WinXP) but TLSv1 and SHA required -- `ciphers-old`: Low-security ciphers (using weak DES and SHA ciphers, TLSv1), but compatible with everything but IE6 and Java6 -- `ssl-options`: Bootstrap secure SSL options - -Example: -```nginx -# High-security ciphers (elliptic curves), less compatibility -# No IE < 10, OpenSSL-0.9.8, Safari < 7, Android < 4.4 -ssl_protocols TLSv1.1 TLSv1.2; -ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; -``` - -Or add a robots.txt file with `robots.txt`: -```nginx -# Tell bots to not index this site -location /robots.txt { - default_type text/plain; - return 200 'User-agent: *\nDisallow: /\n'; -} -``` - -It also has auto-completion for location and server blocks with `location` resp. `server`, and [many more](https://github.com/chr4/nginx.vim/blob/master/snippets/nginx.snippets)! - -- Add useful [snippets](https://github.com/chr4/nginx.vim/blob/master/snippets/nginx.snippets) - ## References + - Based on the original `nginx-1.12.0/contrib/vim` - IPv4 and IPv6 address highlighting, based on expressions found in [this forum post](http://vim.1045645.n5.nabble.com/IPv6-support-for-quot-dns-quot-zonefile-syntax-highlighting-td1197292.html) - [Blog post](https://chr4.org/blog/2017/04/14/better-syntax-highlighting-and-snippets-for-nginx-in-vim/) introducing this plugin including some more examples +For help with secure cipher selection, visit [Mozillas SSL Configuration Generator](https://ssl-config.mozilla.org/) + ## Installation ### Pathogen + ```bash git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim ``` diff --git a/sources_non_forked/nginx.vim/snippets/nginx.snippets b/sources_non_forked/nginx.vim/snippets/nginx.snippets deleted file mode 100644 index 68b1118a..00000000 --- a/sources_non_forked/nginx.vim/snippets/nginx.snippets +++ /dev/null @@ -1,166 +0,0 @@ -# vim: ft=nginx -snippet l80 - listen [::]:80 ipv6only=off; - $0 - -# Listen statements when using multiple http server blocks -snippet l80-multi - listen [::]:80 default_server; - listen 80 default_server; - $0 - -snippet l443 - listen [::]:443 ipv6only=off ssl http2 default_server; - $0 - -# Listen statements when using multiple ssl server blocks -snippet l443-multi - listen [::]:443 ssl http2 default_server; - listen 443 ssl http2 default_server; - $0 - -# Cipher suites are taken and adapted from Mozilla's recommendations -# https://wiki.mozilla.org/Security/Server_Side_TLS -# -# Paranoid mode -snippet ciphers-paranoid - # Paranoid ciphers, 256bit minimum, prefer ChaCha20/ Poly1305, bad compatibility - # No Android 5+6 (4.4 works), Chrome < 51, Firefox < 49, IE < 11, Java 6-8, GoogleBot - ssl_protocols TLSv1.2; - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384'; - $0 - -# Mozilla modern -snippet ciphers-modern - # High-security ciphers (elliptic curves), less compatibility - # No IE < 10, OpenSSL-0.9.8, Safari < 7, Android < 4.4 - ssl_protocols TLSv1.1 TLSv1.2; - ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; - $0 - -# Mozilla intermediate (Removed DES for more security) -snippet ciphers-compat - # Medium-security ciphers with good compatibility (Weak: SHA) - # No IE on WinXP - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!DSS'; - $0 - -# Mozilla old (Removed DSS, HIGH, SEED for more security) -snippet ciphers-low - # Low-security ciphers (Weak: DES, SHA) - # No IE6, Java6 - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:!SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!KRB5-DES-CBC3-SHA:!SRP:!DSS'; - $0 - -snippet ssl-options - # SSL certificate - ssl_certificate /etc/nginx/certs/${4:www.example.com}.crt; - ssl_certificate_key /etc/nginx/certs/${5:www.example.com}.key; - # ssl_dhparam /etc/nginx/certs/dhparam.pem; - - ssl_prefer_server_ciphers on; - ssl_stapling off; - ssl_stapling_verify off; - ssl_session_cache 'shared:SSL:10m'; - ssl_session_tickets off; - - # Enable HSTS (1 year) and some security options - add_header Strict-Transport-Security 'max-age=31536000 includeSubDomains; preload;'; - $0 - -snippet security-headers - add_header X-Frame-Options 'DENY'; - add_header X-Content-Type-Options 'nosniff'; - add_header X-Frame-Options 'SAMEORIGIN'; - add_header X-XSS-Protection '1; mode=block'; - add_header X-Robots-Tag 'none'; - add_header X-Download-Options 'noopen'; - add_header X-Permitted-Cross-Domain-Policies 'none'; - $0 - -snippet robots.txt - # Tell bots to not index this site - location /robots.txt { - default_type text/plain; - return 200 'User-agent: *\nDisallow: /\n'; - } - $0 - -snippet basic-auth - auth_basic 'Restricted'; - auth_basic_user_file ${1:/etc/nginx/htpasswd}; - $0 - -snippet proxy_pass - proxy_pass_header Date; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://${1:backend}; - $0 - -snippet php-fpm - location ~ \.php$ { - include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_index index.php; - fastcgi_intercept_errors on; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass ${1:127.0.0.1:9000}; - } - $0 - -snippet php-uwsgi - location ~ \.php$ { - include uwsgi_params; - uwsgi_max_temp_file_size 4096m; - uwsgi_modifier1 14; - uwsgi_read_timeout 900; - uwsgi_send_timeout 900; - uwsgi_pass ${1:unix:///run/uwsgi/php.sock}; - } - $0 - -snippet redirect-ssl - location / { - return 301 https://$http_host$request_uri; - } - $0 - -snippet redirect-other - # Redirect other requested hosts - if ($host != '${1:DOMAIN}') { - return 301 https://${2:DOMAIN}$request_uri; - } - $0 - -snippet letsencrypt - listen [::]:80 ipv6only=off; - - # Serve well-known path for letsencrypt - location /.well-known/acme-challenge { - root /etc/nginx/certs/acme; - default_type text/plain; - } - - location / { - return 301 https://$http_host$request_uri; - } - $0 - -snippet cut-trailing-slash - rewrite ^/(.*)/$ $scheme://$http_host:$server_port/$1 permanent; - $0 - -snippet location - location ${1:/} { - ${0:${VISUAL}} - } - -snippet server - server { - ${0:${VISUAL}} - } diff --git a/sources_non_forked/vim-bundle-mako/indent/mako.vim b/sources_non_forked/vim-bundle-mako/indent/mako.vim index 4433cc4a..f1f9482a 100644 --- a/sources_non_forked/vim-bundle-mako/indent/mako.vim +++ b/sources_non_forked/vim-bundle-mako/indent/mako.vim @@ -170,66 +170,101 @@ endfun " [-- --] call HtmlIndentPush('a') call HtmlIndentPush('abbr') -call HtmlIndentPush('acronym') call HtmlIndentPush('address') +call HtmlIndentPush('applet') +call HtmlIndentPush('article') +call HtmlIndentPush('aside') +call HtmlIndentPush('audio') call HtmlIndentPush('b') +call HtmlIndentPush('bdi') call HtmlIndentPush('bdo') -call HtmlIndentPush('big') call HtmlIndentPush('blockquote') call HtmlIndentPush('button') +call HtmlIndentPush('canvas') call HtmlIndentPush('caption') -call HtmlIndentPush('center') call HtmlIndentPush('cite') call HtmlIndentPush('code') call HtmlIndentPush('colgroup') +call HtmlIndentPush('content') +call HtmlIndentPush('data') +call HtmlIndentPush('datalist') call HtmlIndentPush('del') +call HtmlIndentPush('details') call HtmlIndentPush('dfn') +call HtmlIndentPush('dialog') call HtmlIndentPush('dir') call HtmlIndentPush('div') call HtmlIndentPush('dl') +call HtmlIndentPush('element') call HtmlIndentPush('em') call HtmlIndentPush('fieldset') -call HtmlIndentPush('font') +call HtmlIndentPush('figcaption') +call HtmlIndentPush('figure') +call HtmlIndentPush('footer') call HtmlIndentPush('form') -call HtmlIndentPush('frameset') call HtmlIndentPush('h1') call HtmlIndentPush('h2') call HtmlIndentPush('h3') call HtmlIndentPush('h4') call HtmlIndentPush('h5') call HtmlIndentPush('h6') +call HtmlIndentPush('header') +call HtmlIndentPush('hgroup') call HtmlIndentPush('i') call HtmlIndentPush('iframe') call HtmlIndentPush('ins') call HtmlIndentPush('kbd') call HtmlIndentPush('label') call HtmlIndentPush('legend') +call HtmlIndentPush('li') +call HtmlIndentPush('main') call HtmlIndentPush('map') +call HtmlIndentPush('mark') +call HtmlIndentPush('MediaStream') call HtmlIndentPush('menu') -call HtmlIndentPush('noframes') +call HtmlIndentPush('menuitem') +call HtmlIndentPush('meter') +call HtmlIndentPush('nav') +call HtmlIndentPush('noembed') call HtmlIndentPush('noscript') call HtmlIndentPush('object') call HtmlIndentPush('ol') call HtmlIndentPush('optgroup') +call HtmlIndentPush('option') +call HtmlIndentPush('output') +call HtmlIndentPush('picture') call HtmlIndentPush('pre') +call HtmlIndentPush('progress') call HtmlIndentPush('q') +call HtmlIndentPush('rb') +call HtmlIndentPush('rp') +call HtmlIndentPush('rt') +call HtmlIndentPush('rtc') +call HtmlIndentPush('ruby') call HtmlIndentPush('s') call HtmlIndentPush('samp') call HtmlIndentPush('script') +call HtmlIndentPush('section') call HtmlIndentPush('select') +call HtmlIndentPush('shadow') +call HtmlIndentPush('slot') call HtmlIndentPush('small') call HtmlIndentPush('span') call HtmlIndentPush('strong') call HtmlIndentPush('style') call HtmlIndentPush('sub') +call HtmlIndentPush('summary') call HtmlIndentPush('sup') call HtmlIndentPush('table') +call HtmlIndentPush('template') call HtmlIndentPush('textarea') +call HtmlIndentPush('time') call HtmlIndentPush('title') call HtmlIndentPush('tt') call HtmlIndentPush('u') call HtmlIndentPush('ul') call HtmlIndentPush('var') +call HtmlIndentPush('video') " For some reason the default HTML indentation script doesn't consider these " elements to be worthy of indentation. @@ -256,6 +291,44 @@ if !exists('g:html_indent_strict_table') call HtmlIndentPush('thead') endif +" [-- --] +call HtmlIndentPush('abbr') +call HtmlIndentPush('acronym') +call HtmlIndentPush('applet') +call HtmlIndentPush('audio') +call HtmlIndentPush('basefont') +call HtmlIndentPush('bgsound') +call HtmlIndentPush('big') +call HtmlIndentPush('blink') +call HtmlIndentPush('center') +call HtmlIndentPush('command') +call HtmlIndentPush('content') +call HtmlIndentPush('dir') +call HtmlIndentPush('element') +call HtmlIndentPush('embed') +call HtmlIndentPush('font') +call HtmlIndentPush('frame') +call HtmlIndentPush('frameset') +call HtmlIndentPush('image') +call HtmlIndentPush('img') +call HtmlIndentPush('isindex') +call HtmlIndentPush('keygen') +call HtmlIndentPush('listing') +call HtmlIndentPush('marquee') +call HtmlIndentPush('menuitem') +call HtmlIndentPush('multicol') +call HtmlIndentPush('nextid') +call HtmlIndentPush('nobr') +call HtmlIndentPush('noembed') +call HtmlIndentPush('noframes') +call HtmlIndentPush('object') +call HtmlIndentPush('plaintext') +call HtmlIndentPush('shadow') +call HtmlIndentPush('spacer') +call HtmlIndentPush('strike') +call HtmlIndentPush('tt') +call HtmlIndentPush('xmp') + " [-- --] call MakoIndentPush('%def') call MakoIndentPush('%block') diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 8521f551..b012f20d 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -8,6 +8,8 @@ let g:autoloaded_fugitive = 1 if !exists('g:fugitive_git_executable') let g:fugitive_git_executable = 'git' +elseif g:fugitive_git_executable =~# '^\w\+=' + let g:fugitive_git_executable = 'env ' . g:fugitive_git_executable endif " Section: Utility @@ -44,7 +46,9 @@ function! s:winshell() abort endfunction function! s:shellesc(arg) abort - if a:arg =~ '^[A-Za-z0-9_/.-]\+$' + if type(a:arg) == type([]) + return join(map(copy(a:arg), 's:shellesc(v:val)')) + elseif a:arg =~ '^[A-Za-z0-9_/:.-]\+$' return a:arg elseif s:winshell() return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' @@ -55,7 +59,9 @@ endfunction let s:fnameescape = " \t\n*?[{`$\\%#'\"|!<" function! s:fnameescape(file) abort - if exists('*fnameescape') + if type(a:file) == type([]) + return join(map(copy(a:file), 's:fnameescape(v:val)')) + elseif exists('*fnameescape') return fnameescape(a:file) else return escape(a:file, s:fnameescape) @@ -63,15 +69,23 @@ function! s:fnameescape(file) abort endfunction function! s:throw(string) abort - let v:errmsg = 'fugitive: '.a:string - throw v:errmsg + throw 'fugitive: '.a:string endfunction -function! s:warn(str) abort - echohl WarningMsg - echomsg a:str - echohl None - let v:warningmsg = a:str +function! s:DirCheck(...) abort + if empty(a:0 ? s:Dir(a:1) : s:Dir()) + return 'return ' . string('echoerr "fugitive: not a Git repository"') + endif + return '' +endfunction + +function! s:Mods(mods, ...) abort + let mods = substitute(a:mods, '\C', '', '') + let mods = mods =~# '\S$' ? mods . ' ' : mods + if a:0 && mods !~# '\<\%(aboveleft\|belowright\|leftabove\|rightbelow\|topleft\|botright\|tab\)\>' + let mods = a:1 . ' ' . mods + endif + return substitute(mods, '\s\+', ' ', 'g') endfunction function! s:Slash(path) abort @@ -82,27 +96,19 @@ function! s:Slash(path) abort endif endfunction -function! s:PlatformSlash(path) abort - if exists('+shellslash') && !&shellslash - return tr(a:path, '/', '\') - else - return a:path - endif -endfunction - function! s:Resolve(path) abort let path = resolve(a:path) if has('win32') - let path = s:PlatformSlash(fnamemodify(fnamemodify(path, ':h'), ':p') . fnamemodify(path, ':t')) + let path = FugitiveVimPath(fnamemodify(fnamemodify(path, ':h'), ':p') . fnamemodify(path, ':t')) endif return path endfunction function! s:cpath(path, ...) abort if exists('+fileignorecase') && &fileignorecase - let path = s:PlatformSlash(tolower(a:path)) + let path = FugitiveVimPath(tolower(a:path)) else - let path = s:PlatformSlash(a:path) + let path = FugitiveVimPath(a:path) endif return a:0 ? path ==# s:cpath(a:1) : path endfunction @@ -129,59 +135,119 @@ function! s:executable(binary) abort return s:executables[a:binary] endfunction -function! s:map(mode, lhs, rhs, ...) abort - let flags = (a:0 ? a:1 : '') . (a:rhs =~# '' ? '' : '${2} diff --git a/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet b/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet deleted file mode 100644 index 35e078b3..00000000 --- a/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/select.snippet b/sources_non_forked/snipmate-snippets/html/select.snippet deleted file mode 100644 index 252e3f77..00000000 --- a/sources_non_forked/snipmate-snippets/html/select.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic.snippet deleted file mode 100644 index 61ec2444..00000000 --- a/sources_non_forked/snipmate-snippets/html/skel/basic.snippet +++ /dev/null @@ -1,13 +0,0 @@ - - - - - ${1:Page Title} - - - - - ${2} - - diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet deleted file mode 100644 index b6de9f8d..00000000 --- a/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet +++ /dev/null @@ -1,15 +0,0 @@ - - - - - ${1:Page Title} - - - - - - - ${2} - - diff --git a/sources_non_forked/snipmate-snippets/html/style.snippet b/sources_non_forked/snipmate-snippets/html/style.snippet deleted file mode 100644 index 26ae0fe9..00000000 --- a/sources_non_forked/snipmate-snippets/html/style.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/t.snippet b/sources_non_forked/snipmate-snippets/html/t.snippet deleted file mode 100644 index ef504276..00000000 --- a/sources_non_forked/snipmate-snippets/html/t.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<${1:div}${2}> - ${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/html/table/basic.snippet b/sources_non_forked/snipmate-snippets/html/table/basic.snippet deleted file mode 100644 index 2100d13d..00000000 --- a/sources_non_forked/snipmate-snippets/html/table/basic.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} -
diff --git a/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet b/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet deleted file mode 100644 index 35fa01ae..00000000 --- a/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet +++ /dev/null @@ -1,9 +0,0 @@ -+>> - - <++> - - - - - - diff --git a/sources_non_forked/snipmate-snippets/html/textarea.snippet b/sources_non_forked/snipmate-snippets/html/textarea.snippet deleted file mode 100644 index 0b3fb84b..00000000 --- a/sources_non_forked/snipmate-snippets/html/textarea.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet deleted file mode 100644 index 3bd770e2..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet +++ /dev/null @@ -1,17 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${4}) { - ${5} - } - - public static void main(String args[]) { - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet deleted file mode 100644 index 05eabefa..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet +++ /dev/null @@ -1,14 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${5}){ - ${6} - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic.snippet b/sources_non_forked/snipmate-snippets/java/class/basic.snippet deleted file mode 100644 index 05eabefa..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic.snippet +++ /dev/null @@ -1,14 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${5}){ - ${6} - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/for.snippet b/sources_non_forked/snipmate-snippets/java/for.snippet deleted file mode 100644 index 70a41086..00000000 --- a/sources_non_forked/snipmate-snippets/java/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for(${1:int i=0}; ${2:condition}; ${3:i++}){ - ${4} -} diff --git a/sources_non_forked/snipmate-snippets/java/gs.snippet b/sources_non_forked/snipmate-snippets/java/gs.snippet deleted file mode 100644 index 954a9a09..00000000 --- a/sources_non_forked/snipmate-snippets/java/gs.snippet +++ /dev/null @@ -1,9 +0,0 @@ -//getter for $3 -public ${2:variable_type} get${1:VariableName}() { - return ${3:variableName}; -} - -//setter for $3 -public void set$1($2 $3) { - this.$3 = $3; -}${4} diff --git a/sources_non_forked/snipmate-snippets/java/if.snippet b/sources_non_forked/snipmate-snippets/java/if.snippet deleted file mode 100644 index b9d1c5c3..00000000 --- a/sources_non_forked/snipmate-snippets/java/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if(${1}){ - ${2} -} diff --git a/sources_non_forked/snipmate-snippets/java/ife.snippet b/sources_non_forked/snipmate-snippets/java/ife.snippet deleted file mode 100644 index a7e43d09..00000000 --- a/sources_non_forked/snipmate-snippets/java/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if(${1}){ - ${2} -}else{ -} diff --git a/sources_non_forked/snipmate-snippets/java/log.snippet b/sources_non_forked/snipmate-snippets/java/log.snippet deleted file mode 100644 index abb7c7d6..00000000 --- a/sources_non_forked/snipmate-snippets/java/log.snippet +++ /dev/null @@ -1 +0,0 @@ -System.${1:out}.println(${2}); diff --git a/sources_non_forked/snipmate-snippets/java/m.snippet b/sources_non_forked/snipmate-snippets/java/m.snippet deleted file mode 100644 index 67bf3fb0..00000000 --- a/sources_non_forked/snipmate-snippets/java/m.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * ${7:Method Description} - * ${5} - * @return ${6} - */ -${1:public} ${2:void} ${3:methodName}(${4}) { - ${8} -} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet deleted file mode 100644 index 3bf9756d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.add('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet deleted file mode 100644 index 68007744..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.addClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet deleted file mode 100644 index 34d1956d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.after('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet deleted file mode 100644 index 5453a257..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet +++ /dev/null @@ -1,18 +0,0 @@ -$.ajax({ - url: "${1:mydomain.com/url}", - type: "${2:POST}", - dataType: "${3:xml/html/script/json}", - data: $.param( $("${4:Element or Expression}") ), - - complete: function() { - ${5://called when complete} - }, - - success: function() { - ${6://called when successful} - }, - - error: function() { - ${7://called when there is an error} - }, -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet deleted file mode 100644 index 0f8ccdaf..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet +++ /dev/null @@ -1,4 +0,0 @@ -.ajaxError(function(${1:request, settings}) { - ${2://stuff to do when an AJAX call returns an error}; -}); -${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet deleted file mode 100644 index 1489859a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.get('${1:/test/ajax-test.xml}', function(xml){ - ${2:alert( ("title",xml).text() ) //optional stuff to do after get;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet deleted file mode 100644 index 0f4d1ef0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.getIfModified('${1:/test/test.cgi}', function(data){ - ${2:alert( "Data loaded: " + data ) //optional stuff to do after get;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet deleted file mode 100644 index f62bf102..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet +++ /dev/null @@ -1,5 +0,0 @@ -$.post('<+/path/to/file.cgi+>',{ - <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, - function(){ - <+//stuff to do after event occurs;+> -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet deleted file mode 100644 index 4b74cd98..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet +++ /dev/null @@ -1,4 +0,0 @@ -.ajaxSend(function(${1:request, settings}) { - ${2://stuff to do when an AJAX call returns an error}; -}); -${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet deleted file mode 100644 index c5b4ad02..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet +++ /dev/null @@ -1,18 +0,0 @@ -$.ajaxSetup({ - url: "${1:mydomain.com/url}", - type: "${2:POST}", - dataType: "${3:xml/html/script/json}", - data: $.param( $("${4:Element or Expression}") ), - - complete: function() { - ${5://called when complete} - }, - - success: function() { - ${6://called when successful} - }, - - error: function() { - ${7://called when there is an error} - }, -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet deleted file mode 100644 index 3caafd58..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxStart(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet deleted file mode 100644 index 6088a9f5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxStop(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet deleted file mode 100644 index ba2247dc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxSuccess(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet deleted file mode 100644 index 19135327..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet deleted file mode 100644 index bc4ff4d3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.append('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet deleted file mode 100644 index 97883710..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.appendTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet deleted file mode 100644 index fb7e2f42..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.attr('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet deleted file mode 100644 index 15685512..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet deleted file mode 100644 index e12c4aed..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.before('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet deleted file mode 100644 index dda284d9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.bind('${2:event name}', function(${3:event}) { - ${4:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet deleted file mode 100644 index 674623db..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.blur(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet deleted file mode 100644 index 184f8a99..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.change(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet deleted file mode 100644 index 2db688b1..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.children('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet deleted file mode 100644 index d17a047e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.click(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet deleted file mode 100644 index 83b0b421..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.clone()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet deleted file mode 100644 index 2a073948..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.contains('${2:text to find}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet deleted file mode 100644 index 408199eb..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.css('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet deleted file mode 100644 index 7eebe1e4..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet deleted file mode 100644 index 4b2d6b2a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.dblclick(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet deleted file mode 100644 index 05beed2e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.each(function(index) { - ${2:this.innerHTML = this + " is the element, " + index + " is the position";} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet deleted file mode 100644 index d2065238..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet +++ /dev/null @@ -1 +0,0 @@ -$('${1}')${2:} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet deleted file mode 100644 index 9cc0d692..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet +++ /dev/null @@ -1 +0,0 @@ -$.trim('${1:string}')${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet deleted file mode 100644 index 293102c4..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.end()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet deleted file mode 100644 index 23b0e650..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.error(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet deleted file mode 100644 index 549d8464..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeIn('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet deleted file mode 100644 index 9090853e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeIn('slow/400/fast', function() { - ${2://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet deleted file mode 100644 index 24d6c763..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeOut('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet deleted file mode 100644 index 76d54571..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeOut('slow/400/fast', function() { - ${2://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet deleted file mode 100644 index b0e584aa..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet deleted file mode 100644 index 17243b4c..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet deleted file mode 100644 index d33fdf2b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.filter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet deleted file mode 100644 index 1791e912..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.find('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet deleted file mode 100644 index 3b1b5719..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.focus(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet deleted file mode 100644 index 4374c183..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.get(${2:element index})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet deleted file mode 100644 index 518d676d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet +++ /dev/null @@ -1,5 +0,0 @@ -$.getJSON('<+/path/to/file.cgi+>',{ - <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, - function(json){ - <+//stuff to do after event occurs;+> -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet deleted file mode 100644 index 0b62d90b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.getScript('${1:somescript.js}', function(){ - ${2://optional stuff to do after getScript;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet deleted file mode 100644 index 1515d5c6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.height(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet deleted file mode 100644 index c8071cbc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.hide('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet deleted file mode 100644 index 62f2280a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.hide('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet deleted file mode 100644 index d8468c1a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet +++ /dev/null @@ -1,5 +0,0 @@ -${1:obj}.hover(function() { - ${2:// Stuff to do when the mouse enters the element;} -}, function() { - ${3:// Stuff to do when the mouse leaves the element;} -});${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet deleted file mode 100644 index 0c5a25e1..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.html('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet deleted file mode 100644 index 66c389eb..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.insertAfter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet deleted file mode 100644 index e7090d4d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.insertBefore('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet deleted file mode 100644 index 28eefb02..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.is('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet deleted file mode 100644 index 1f09fbc9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.load(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet deleted file mode 100644 index 2e7d9c8b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<+obj+>.load('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { - <+// Stuff to do after the page is loaded+> -}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet deleted file mode 100644 index fe45d05a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<+obj+>.loadIfModified('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { - <+// Stuff to do after the page is loaded+> -}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet deleted file mode 100644 index 3be70e1b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mousedown(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet deleted file mode 100644 index eb7ac052..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mousemove(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet deleted file mode 100644 index f2142756..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseout(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet deleted file mode 100644 index f1eb19cc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseover(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet deleted file mode 100644 index 04fb36a3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseup(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet deleted file mode 100644 index b6a65281..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.next('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet deleted file mode 100644 index c6a217f6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.not('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet deleted file mode 100644 index cacdbfb5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.one('${2:event name}', function(${3:event}) { - ${4:// Act on the event once} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet deleted file mode 100644 index 0490f05a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.parent('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet deleted file mode 100644 index fb0bd131..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.parents('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet deleted file mode 100644 index bc41d48f..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prepend('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet deleted file mode 100644 index e4406957..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prependTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet deleted file mode 100644 index b7aba645..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prev('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet deleted file mode 100644 index d0005318..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$(document).ready(function() { - ${1:// Stuff to do as soon as the DOM is ready;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet deleted file mode 100644 index 4c976a17..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.remove()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet deleted file mode 100644 index 267d584a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.removeAttr('${2:attribute name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet deleted file mode 100644 index f5538030..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.removeClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet deleted file mode 100644 index 777af958..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.reset(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet deleted file mode 100644 index b46ac0a0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.resize(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet deleted file mode 100644 index 7a512442..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.scroll(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet deleted file mode 100644 index b39840e9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideDown('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet deleted file mode 100644 index 3404b783..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.slideDown('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet deleted file mode 100644 index 873c6657..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.slideUp('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet deleted file mode 100644 index 986437ed..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.select(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet deleted file mode 100644 index 31819b1e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.show('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet deleted file mode 100644 index 6dc5bacc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.show('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet deleted file mode 100644 index 014f1f79..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.siblings('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet deleted file mode 100644 index 1ba15439..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.size()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet deleted file mode 100644 index daba37d2..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideToggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet deleted file mode 100644 index ae98d83e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.submit(function() { - ${2:// Act on the event once} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet deleted file mode 100644 index d844a68e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideUp('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet deleted file mode 100644 index 5f667c07..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.text(${2:'some text'})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet deleted file mode 100644 index b3cee8d3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet +++ /dev/null @@ -1 +0,0 @@ -$(this)${1} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet deleted file mode 100644 index 54f5f17a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet +++ /dev/null @@ -1,6 +0,0 @@ -${1:obj}.toggle(function() { - ${2:// Stuff to do every *odd* time the element is clicked;} -}, function() { - ${3:// Stuff to do every *even* time the element is clicked;} -}); -${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet deleted file mode 100644 index 023a4b7d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.toggleClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet deleted file mode 100644 index 265a62d0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.toggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet deleted file mode 100644 index f7105e08..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.trigger('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet deleted file mode 100644 index 0fe423d5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.unbind('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet deleted file mode 100644 index cafe0b0b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.val('${2:text}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet deleted file mode 100644 index 415631c6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.width(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet deleted file mode 100644 index 55df53ff..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript/anon.snippet b/sources_non_forked/snipmate-snippets/javascript/anon.snippet deleted file mode 100644 index d486c430..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/anon.snippet +++ /dev/null @@ -1 +0,0 @@ -function(${1}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/for.snippet b/sources_non_forked/snipmate-snippets/javascript/for.snippet deleted file mode 100644 index 3933153f..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for (var <+i+>=0; <+i+> < <+<+Things+>.length+>; <+i+>++) { -<+<+Things+>[<+i+>]+> -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/fun.snippet b/sources_non_forked/snipmate-snippets/javascript/fun.snippet deleted file mode 100644 index 064b9593..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/fun.snippet +++ /dev/null @@ -1,3 +0,0 @@ -function ${1:function_name} (${2:argument}) { - ${3:// body} -} diff --git a/sources_non_forked/snipmate-snippets/javascript/if.snippet b/sources_non_forked/snipmate-snippets/javascript/if.snippet deleted file mode 100644 index 931b9f17..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/if.snippet +++ /dev/null @@ -1 +0,0 @@ -if (${1:true}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/ife.snippet b/sources_non_forked/snipmate-snippets/javascript/ife.snippet deleted file mode 100644 index 6b172d07..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if (${1:true}) { - ${2} -} else { -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/log.snippet b/sources_non_forked/snipmate-snippets/javascript/log.snippet deleted file mode 100644 index b4cf84fe..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/log.snippet +++ /dev/null @@ -1 +0,0 @@ -console.log(${1}); diff --git a/sources_non_forked/snipmate-snippets/javascript/met.snippet b/sources_non_forked/snipmate-snippets/javascript/met.snippet deleted file mode 100644 index 1c30d617..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/met.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:method_name}: function(${2:attribute}){ - ${3} -}${4:, } diff --git a/sources_non_forked/snipmate-snippets/javascript/proto.snippet b/sources_non_forked/snipmate-snippets/javascript/proto.snippet deleted file mode 100644 index 37cd6d49..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/proto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { - ${4:// body} -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/timeout.snippet b/sources_non_forked/snipmate-snippets/javascript/timeout.snippet deleted file mode 100644 index 6ea2842c..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/timeout.snippet +++ /dev/null @@ -1 +0,0 @@ -setTimeout(function() { ${1} }, ${2:10}); diff --git a/sources_non_forked/snipmate-snippets/objc/I.snippet b/sources_non_forked/snipmate-snippets/objc/I.snippet deleted file mode 100644 index 0032f65f..00000000 --- a/sources_non_forked/snipmate-snippets/objc/I.snippet +++ /dev/null @@ -1,6 +0,0 @@ -+ (void) initialize -{ - [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: - ${1}@"value", @"key", - nil]]; -} diff --git a/sources_non_forked/snipmate-snippets/objc/Imp.snippet b/sources_non_forked/snipmate-snippets/objc/Imp.snippet deleted file mode 100644 index 91724d3f..00000000 --- a/sources_non_forked/snipmate-snippets/objc/Imp.snippet +++ /dev/null @@ -1 +0,0 @@ -#import "${1:`Filename()`.h}"${2} diff --git a/sources_non_forked/snipmate-snippets/objc/alloc.snippet b/sources_non_forked/snipmate-snippets/objc/alloc.snippet deleted file mode 100644 index e4d15993..00000000 --- a/sources_non_forked/snipmate-snippets/objc/alloc.snippet +++ /dev/null @@ -1 +0,0 @@ -[[${1:foo} alloc] init]${2};${3} diff --git a/sources_non_forked/snipmate-snippets/objc/array.snippet b/sources_non_forked/snipmate-snippets/objc/array.snippet deleted file mode 100644 index 45d3ef01..00000000 --- a/sources_non_forked/snipmate-snippets/objc/array.snippet +++ /dev/null @@ -1 +0,0 @@ -NSMutableArray *${1:array} = [NSMutable array];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/bez.snippet b/sources_non_forked/snipmate-snippets/objc/bez.snippet deleted file mode 100644 index 493aff69..00000000 --- a/sources_non_forked/snipmate-snippets/objc/bez.snippet +++ /dev/null @@ -1 +0,0 @@ -NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/cat.snippet b/sources_non_forked/snipmate-snippets/objc/cat.snippet deleted file mode 100644 index fd57aae3..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cat.snippet +++ /dev/null @@ -1,6 +0,0 @@ -@interface ${1:NSObject} (${2:Category}) -@end - -@implementation $1 ($2) -${3} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/cati.snippet b/sources_non_forked/snipmate-snippets/objc/cati.snippet deleted file mode 100644 index d2852600..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cati.snippet +++ /dev/null @@ -1,3 +0,0 @@ -@interface ${1:NSObject} (${2:Category}) -${3} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/cli.snippet b/sources_non_forked/snipmate-snippets/objc/cli.snippet deleted file mode 100644 index fa896224..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cli.snippet +++ /dev/null @@ -1,5 +0,0 @@ -@interface ${1:ClassName} : ${2:NSObject} -{${3} -} -${4} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/dict.snippet b/sources_non_forked/snipmate-snippets/objc/dict.snippet deleted file mode 100644 index 8b2d7e90..00000000 --- a/sources_non_forked/snipmate-snippets/objc/dict.snippet +++ /dev/null @@ -1 +0,0 @@ -NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/forarray.snippet b/sources_non_forked/snipmate-snippets/objc/forarray.snippet deleted file mode 100644 index d32215d0..00000000 --- a/sources_non_forked/snipmate-snippets/objc/forarray.snippet +++ /dev/null @@ -1,7 +0,0 @@ -unsigned int ${1:object}Count = [${2:array} count]; - -for (unsigned int index = 0; index < $1Count; index++) -{ - ${3:id} $1 = [$2 $1AtIndex:index]; - ${4} -} diff --git a/sources_non_forked/snipmate-snippets/objc/log.snippet b/sources_non_forked/snipmate-snippets/objc/log.snippet deleted file mode 100644 index 69f9c067..00000000 --- a/sources_non_forked/snipmate-snippets/objc/log.snippet +++ /dev/null @@ -1 +0,0 @@ -NSLog(@"${1}"${2});${3} diff --git a/sources_non_forked/snipmate-snippets/objc/m/class method.snippet b/sources_non_forked/snipmate-snippets/objc/m/class method.snippet deleted file mode 100644 index 191ee160..00000000 --- a/sources_non_forked/snipmate-snippets/objc/m/class method.snippet +++ /dev/null @@ -1,4 +0,0 @@ -+ (${1:id}) ${2:method} -{${3} - return nil; -} diff --git a/sources_non_forked/snipmate-snippets/objc/m/method.snippet b/sources_non_forked/snipmate-snippets/objc/m/method.snippet deleted file mode 100644 index 9f7390e2..00000000 --- a/sources_non_forked/snipmate-snippets/objc/m/method.snippet +++ /dev/null @@ -1,4 +0,0 @@ -- (${1:id}) ${2:method} -{${3} - ${4:return nil;} -} diff --git a/sources_non_forked/snipmate-snippets/objc/objacc.snippet b/sources_non_forked/snipmate-snippets/objc/objacc.snippet deleted file mode 100644 index 840ebfd0..00000000 --- a/sources_non_forked/snipmate-snippets/objc/objacc.snippet +++ /dev/null @@ -1,11 +0,0 @@ -- (${1:id})${2:thing} -{ - return $2; -} - -- (void) set$2:($1) -{ - $1 old$2 = $2; - $2 = [aValue retain]; - [old$2 release]; -} diff --git a/sources_non_forked/snipmate-snippets/objc/objc.snippet b/sources_non_forked/snipmate-snippets/objc/objc.snippet deleted file mode 100644 index d6671487..00000000 --- a/sources_non_forked/snipmate-snippets/objc/objc.snippet +++ /dev/null @@ -1,14 +0,0 @@ -@interface ${1:`Filename('', 'object')`} : ${2:NSObject} -{ -} -@end - -@implementation $1 -- (id) init -{ - if (self = [super init]) - {${3} - } - return self -} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/prop.snippet b/sources_non_forked/snipmate-snippets/objc/prop.snippet deleted file mode 100644 index d77495a6..00000000 --- a/sources_non_forked/snipmate-snippets/objc/prop.snippet +++ /dev/null @@ -1 +0,0 @@ -@property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4} diff --git a/sources_non_forked/snipmate-snippets/objc/rel.snippet b/sources_non_forked/snipmate-snippets/objc/rel.snippet deleted file mode 100644 index 5dea04dd..00000000 --- a/sources_non_forked/snipmate-snippets/objc/rel.snippet +++ /dev/null @@ -1 +0,0 @@ -[${1:foo} release];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/ret.snippet b/sources_non_forked/snipmate-snippets/objc/ret.snippet deleted file mode 100644 index ee8eba46..00000000 --- a/sources_non_forked/snipmate-snippets/objc/ret.snippet +++ /dev/null @@ -1 +0,0 @@ -[${1:foo} retain];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sel.snippet b/sources_non_forked/snipmate-snippets/objc/sel.snippet deleted file mode 100644 index 4d4996d1..00000000 --- a/sources_non_forked/snipmate-snippets/objc/sel.snippet +++ /dev/null @@ -1 +0,0 @@ -@selector(${1:method}:)${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sm.snippet b/sources_non_forked/snipmate-snippets/objc/sm.snippet deleted file mode 100644 index af139a90..00000000 --- a/sources_non_forked/snipmate-snippets/objc/sm.snippet +++ /dev/null @@ -1,5 +0,0 @@ -- (${1:id}) ${2:method}:(${3:id})${4:anArgument} -{ - $1 res = [super $2:$4];${5} - return res; -} diff --git a/sources_non_forked/snipmate-snippets/objc/syn.snippet b/sources_non_forked/snipmate-snippets/objc/syn.snippet deleted file mode 100644 index eef7581c..00000000 --- a/sources_non_forked/snipmate-snippets/objc/syn.snippet +++ /dev/null @@ -1 +0,0 @@ -@synthesize ${1:NSSomeClass};${2} diff --git a/sources_non_forked/snipmate-snippets/php/array.snippet b/sources_non_forked/snipmate-snippets/php/array.snippet deleted file mode 100644 index 922542e0..00000000 --- a/sources_non_forked/snipmate-snippets/php/array.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:arrayName} = array('${2}' => ${3});${4} diff --git a/sources_non_forked/snipmate-snippets/php/case.snippet b/sources_non_forked/snipmate-snippets/php/case.snippet deleted file mode 100644 index 8f9e4daf..00000000 --- a/sources_non_forked/snipmate-snippets/php/case.snippet +++ /dev/null @@ -1,3 +0,0 @@ -case '${1:value}': - ${2:// code...} - break;${3} diff --git a/sources_non_forked/snipmate-snippets/php/class.snippet b/sources_non_forked/snipmate-snippets/php/class.snippet deleted file mode 100644 index 4929a955..00000000 --- a/sources_non_forked/snipmate-snippets/php/class.snippet +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ${1} - */ -class ${2:ClassName} -{ - ${3} - function ${4:__construct}(${5:argument}) - { - ${6:// code...} - } -} diff --git a/sources_non_forked/snipmate-snippets/php/classe.snippet b/sources_non_forked/snipmate-snippets/php/classe.snippet deleted file mode 100644 index 2f2b0bc3..00000000 --- a/sources_non_forked/snipmate-snippets/php/classe.snippet +++ /dev/null @@ -1,12 +0,0 @@ -/** - * ${1} - */ -class ${2:ClassName} extends ${3:AnotherClass} -{ - ${4} - function ${5:__construct}(${6:argument}) - { - ${7:// code...} - } -} - diff --git a/sources_non_forked/snipmate-snippets/php/def.snippet b/sources_non_forked/snipmate-snippets/php/def.snippet deleted file mode 100644 index df0f5ebd..00000000 --- a/sources_non_forked/snipmate-snippets/php/def.snippet +++ /dev/null @@ -1 +0,0 @@ -define('${1}'${2});${3} diff --git a/sources_non_forked/snipmate-snippets/php/defd.snippet b/sources_non_forked/snipmate-snippets/php/defd.snippet deleted file mode 100644 index 6758cdad..00000000 --- a/sources_non_forked/snipmate-snippets/php/defd.snippet +++ /dev/null @@ -1 +0,0 @@ -${1}defined('${2}')${3} diff --git a/sources_non_forked/snipmate-snippets/php/do.snippet b/sources_non_forked/snipmate-snippets/php/do.snippet deleted file mode 100644 index e7dd5b06..00000000 --- a/sources_non_forked/snipmate-snippets/php/do.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do { - ${2:// code... } -} while (${1:/* condition */});" diff --git a/sources_non_forked/snipmate-snippets/php/doc_cp.snippet b/sources_non_forked/snipmate-snippets/php/doc_cp.snippet deleted file mode 100644 index d6d1b3fc..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_cp.snippet +++ /dev/null @@ -1,6 +0,0 @@ -/** - * ${1:undocumented class} - * - * @package ${2:default} - * @author ${3:`g:snips_author`} - **/${4} diff --git a/sources_non_forked/snipmate-snippets/php/doc_f.snippet b/sources_non_forked/snipmate-snippets/php/doc_f.snippet deleted file mode 100644 index a9adbb07..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_f.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * $2 - * @return ${4:void} - * @author ${5:`g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{${6} -} diff --git a/sources_non_forked/snipmate-snippets/php/doc_h.snippet b/sources_non_forked/snipmate-snippets/php/doc_h.snippet deleted file mode 100644 index a0c12e01..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_h.snippet +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ${1} - * - * @author ${2:`g:snips_author`} - * @version ${3:$Id$} - * @copyright ${4:$2}, `strftime('%d %B, %Y')` - * @package ${5:default} - **/ -/** - * Define DocBlock *// diff --git a/sources_non_forked/snipmate-snippets/php/doc_i.snippet b/sources_non_forked/snipmate-snippets/php/doc_i.snippet deleted file mode 100644 index e62eab72..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_i.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * $1 - * @package ${2:default} - * @author ${3:`g:snips_author`} - **/ -interface ${1:someClass} -{${4} -} // END interface $1" diff --git a/sources_non_forked/snipmate-snippets/php/ec.snippet b/sources_non_forked/snipmate-snippets/php/ec.snippet deleted file mode 100644 index 489d759b..00000000 --- a/sources_non_forked/snipmate-snippets/php/ec.snippet +++ /dev/null @@ -1 +0,0 @@ -echo "${1:string}"${2}; diff --git a/sources_non_forked/snipmate-snippets/php/else.snippet b/sources_non_forked/snipmate-snippets/php/else.snippet deleted file mode 100644 index b910e982..00000000 --- a/sources_non_forked/snipmate-snippets/php/else.snippet +++ /dev/null @@ -1,3 +0,0 @@ -else { - ${1:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/elseif.snippet b/sources_non_forked/snipmate-snippets/php/elseif.snippet deleted file mode 100644 index a57dec80..00000000 --- a/sources_non_forked/snipmate-snippets/php/elseif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -elseif (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/for.snippet b/sources_non_forked/snipmate-snippets/php/for.snippet deleted file mode 100644 index e9bc52aa..00000000 --- a/sources_non_forked/snipmate-snippets/php/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/foreach.snippet b/sources_non_forked/snipmate-snippets/php/foreach.snippet deleted file mode 100644 index 5fe47e5b..00000000 --- a/sources_non_forked/snipmate-snippets/php/foreach.snippet +++ /dev/null @@ -1,3 +0,0 @@ -foreach ($${1:variable} as $${2:key}){ - ${3:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/foreachk.snippet b/sources_non_forked/snipmate-snippets/php/foreachk.snippet deleted file mode 100644 index f78d57ae..00000000 --- a/sources_non_forked/snipmate-snippets/php/foreachk.snippet +++ /dev/null @@ -1,3 +0,0 @@ -foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/fun.snippet b/sources_non_forked/snipmate-snippets/php/fun.snippet deleted file mode 100644 index 0f5d3534..00000000 --- a/sources_non_forked/snipmate-snippets/php/fun.snippet +++ /dev/null @@ -1,4 +0,0 @@ -${1:public }function ${2:FunctionName}(${3}) -{ - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/get.snippet b/sources_non_forked/snipmate-snippets/php/get.snippet deleted file mode 100644 index af32e0a5..00000000 --- a/sources_non_forked/snipmate-snippets/php/get.snippet +++ /dev/null @@ -1 +0,0 @@ -$_GET['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/globals.snippet b/sources_non_forked/snipmate-snippets/php/globals.snippet deleted file mode 100644 index 6f5b04f3..00000000 --- a/sources_non_forked/snipmate-snippets/php/globals.snippet +++ /dev/null @@ -1 +0,0 @@ -$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} diff --git a/sources_non_forked/snipmate-snippets/php/if.snippet b/sources_non_forked/snipmate-snippets/php/if.snippet deleted file mode 100644 index 69ac0bd6..00000000 --- a/sources_non_forked/snipmate-snippets/php/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/ife.snippet b/sources_non_forked/snipmate-snippets/php/ife.snippet deleted file mode 100644 index b8621c1b..00000000 --- a/sources_non_forked/snipmate-snippets/php/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if (${1:/* condition */}) { - ${2:// code...} -} else { -} diff --git a/sources_non_forked/snipmate-snippets/php/inc.snippet b/sources_non_forked/snipmate-snippets/php/inc.snippet deleted file mode 100644 index 8df3966c..00000000 --- a/sources_non_forked/snipmate-snippets/php/inc.snippet +++ /dev/null @@ -1 +0,0 @@ -include '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/inc1.snippet b/sources_non_forked/snipmate-snippets/php/inc1.snippet deleted file mode 100644 index ba262818..00000000 --- a/sources_non_forked/snipmate-snippets/php/inc1.snippet +++ /dev/null @@ -1 +0,0 @@ -include_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/log.snippet b/sources_non_forked/snipmate-snippets/php/log.snippet deleted file mode 100644 index 2b8dcc4b..00000000 --- a/sources_non_forked/snipmate-snippets/php/log.snippet +++ /dev/null @@ -1 +0,0 @@ -error_log(var_export(${1}, true));${2} diff --git a/sources_non_forked/snipmate-snippets/php/php.snippet b/sources_non_forked/snipmate-snippets/php/php.snippet deleted file mode 100644 index ed2ed1ce..00000000 --- a/sources_non_forked/snipmate-snippets/php/php.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/php/post.snippet b/sources_non_forked/snipmate-snippets/php/post.snippet deleted file mode 100644 index 2de7aa5f..00000000 --- a/sources_non_forked/snipmate-snippets/php/post.snippet +++ /dev/null @@ -1 +0,0 @@ -$_POST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/req.snippet b/sources_non_forked/snipmate-snippets/php/req.snippet deleted file mode 100644 index c03ea36f..00000000 --- a/sources_non_forked/snipmate-snippets/php/req.snippet +++ /dev/null @@ -1 +0,0 @@ -require '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/req1.snippet b/sources_non_forked/snipmate-snippets/php/req1.snippet deleted file mode 100644 index e909c3bc..00000000 --- a/sources_non_forked/snipmate-snippets/php/req1.snippet +++ /dev/null @@ -1 +0,0 @@ -require_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/request.snippet b/sources_non_forked/snipmate-snippets/php/request.snippet deleted file mode 100644 index 9a839b1b..00000000 --- a/sources_non_forked/snipmate-snippets/php/request.snippet +++ /dev/null @@ -1 +0,0 @@ -$_REQUEST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/session.snippet b/sources_non_forked/snipmate-snippets/php/session.snippet deleted file mode 100644 index 5e3e11b9..00000000 --- a/sources_non_forked/snipmate-snippets/php/session.snippet +++ /dev/null @@ -1 +0,0 @@ -$_SESSION['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/switch.snippet b/sources_non_forked/snipmate-snippets/php/switch.snippet deleted file mode 100644 index 7fc47c63..00000000 --- a/sources_non_forked/snipmate-snippets/php/switch.snippet +++ /dev/null @@ -1,9 +0,0 @@ -switch ($${1:variable}) { - case '${2:value}': - ${3:// code...} - break; - ${5} - default: - ${4:// code...} - break; -} diff --git a/sources_non_forked/snipmate-snippets/php/t.snippet b/sources_non_forked/snipmate-snippets/php/t.snippet deleted file mode 100644 index e8deae52..00000000 --- a/sources_non_forked/snipmate-snippets/php/t.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} diff --git a/sources_non_forked/snipmate-snippets/php/try.snippet b/sources_non_forked/snipmate-snippets/php/try.snippet deleted file mode 100644 index 66a7f651..00000000 --- a/sources_non_forked/snipmate-snippets/php/try.snippet +++ /dev/null @@ -1,6 +0,0 @@ -try { - ${1:// code...} -} catch (${2:Exception} $e) { - ${3:// code...} -} - diff --git a/sources_non_forked/snipmate-snippets/php/var.snippet b/sources_non_forked/snipmate-snippets/php/var.snippet deleted file mode 100644 index 1f8cd08e..00000000 --- a/sources_non_forked/snipmate-snippets/php/var.snippet +++ /dev/null @@ -1 +0,0 @@ -var_export(${1});${2} diff --git a/sources_non_forked/snipmate-snippets/php/wh.snippet b/sources_non_forked/snipmate-snippets/php/wh.snippet deleted file mode 100644 index 36ae0ffc..00000000 --- a/sources_non_forked/snipmate-snippets/php/wh.snippet +++ /dev/null @@ -1,3 +0,0 @@ -while (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/po/msg.snippet b/sources_non_forked/snipmate-snippets/po/msg.snippet deleted file mode 100644 index 2ad6638a..00000000 --- a/sources_non_forked/snipmate-snippets/po/msg.snippet +++ /dev/null @@ -1,2 +0,0 @@ -msgid "${1}" -msgstr "${2}"${3} diff --git a/sources_non_forked/snipmate-snippets/python/class.snippet b/sources_non_forked/snipmate-snippets/python/class.snippet deleted file mode 100644 index d9e2b8e8..00000000 --- a/sources_non_forked/snipmate-snippets/python/class.snippet +++ /dev/null @@ -1,2 +0,0 @@ -class ${1:``Snippet_PythonClassNameFromFilename()``}(${2:data}): -${3} diff --git a/sources_non_forked/snipmate-snippets/python/def.snippet b/sources_non_forked/snipmate-snippets/python/def.snippet deleted file mode 100644 index c7cc9d38..00000000 --- a/sources_non_forked/snipmate-snippets/python/def.snippet +++ /dev/null @@ -1,2 +0,0 @@ -def ${1:name}(${2:data}): -${3} diff --git a/sources_non_forked/snipmate-snippets/python/for.snippet b/sources_non_forked/snipmate-snippets/python/for.snippet deleted file mode 100644 index fb69c05f..00000000 --- a/sources_non_forked/snipmate-snippets/python/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for ${1:var} in ${2:type}: -${3:pass} -${4} diff --git a/sources_non_forked/snipmate-snippets/python/from.snippet b/sources_non_forked/snipmate-snippets/python/from.snippet deleted file mode 100644 index 98d0d825..00000000 --- a/sources_non_forked/snipmate-snippets/python/from.snippet +++ /dev/null @@ -1,2 +0,0 @@ -from ${1:module} import ${2:name} -${3} diff --git a/sources_non_forked/snipmate-snippets/python/get.snippet b/sources_non_forked/snipmate-snippets/python/get.snippet deleted file mode 100644 index bc0bf63d..00000000 --- a/sources_non_forked/snipmate-snippets/python/get.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def get_${1:name}(self): -return self._$1 -${2} diff --git a/sources_non_forked/snipmate-snippets/python/ifmain.snippet b/sources_non_forked/snipmate-snippets/python/ifmain.snippet deleted file mode 100644 index f6e7a262..00000000 --- a/sources_non_forked/snipmate-snippets/python/ifmain.snippet +++ /dev/null @@ -1,2 +0,0 @@ -if __name__ == '__main__': -${1} diff --git a/sources_non_forked/snipmate-snippets/python/import.snippet b/sources_non_forked/snipmate-snippets/python/import.snippet deleted file mode 100644 index 58c9acdc..00000000 --- a/sources_non_forked/snipmate-snippets/python/import.snippet +++ /dev/null @@ -1,2 +0,0 @@ -import ${1:module} -${2} diff --git a/sources_non_forked/snipmate-snippets/python/init.snippet b/sources_non_forked/snipmate-snippets/python/init.snippet deleted file mode 100644 index c1a4f0fa..00000000 --- a/sources_non_forked/snipmate-snippets/python/init.snippet +++ /dev/null @@ -1,2 +0,0 @@ -def __init__(self, ${1:args}): -${2} diff --git a/sources_non_forked/snipmate-snippets/python/set.snippet b/sources_non_forked/snipmate-snippets/python/set.snippet deleted file mode 100644 index 6ab0b5aa..00000000 --- a/sources_non_forked/snipmate-snippets/python/set.snippet +++ /dev/null @@ -1 +0,0 @@ -def set_${1:name}(self, ${2:value}): diff --git a/sources_non_forked/snipmate-snippets/python/try.snippet b/sources_non_forked/snipmate-snippets/python/try.snippet deleted file mode 100644 index fd5f6e59..00000000 --- a/sources_non_forked/snipmate-snippets/python/try.snippet +++ /dev/null @@ -1,4 +0,0 @@ -try: -${1} -except ${2:Exception} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet deleted file mode 100644 index 05cc3e8e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet deleted file mode 100644 index 299c0335..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory.build(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet deleted file mode 100644 index 41d1503c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet +++ /dev/null @@ -1,4 +0,0 @@ -Factory.define(:${1:model}) do |${2:f}| - ${3} -end -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet deleted file mode 100644 index 7232308c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory.next(:${1:sequence-name})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet deleted file mode 100644 index 13fd5b9d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet +++ /dev/null @@ -1,4 +0,0 @@ -Factory.sequence :${1:sequence-name} do |${2:m}| - ${3} -end -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet deleted file mode 100644 index a5a7d34e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to ${1::action => "${2:index}"} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet deleted file mode 100644 index 2c9bfef0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>, <+@<+child+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet deleted file mode 100644 index becd79b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet deleted file mode 100644 index 55b9204a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+model+>_path(<+@<+model+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet deleted file mode 100644 index 1d1d203d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+model+>s_path+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet deleted file mode 100644 index 35ab7301..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet +++ /dev/null @@ -1,3 +0,0 @@ -assert_difference "${1:Model}.${2:count}", $1 do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet deleted file mode 100644 index c5124e04..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet +++ /dev/null @@ -1,3 +0,0 @@ -assert_no_difference "${1:Model}.${2:count}" do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet deleted file mode 100644 index d0ac6b26..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_response :${1:success}, @response.body${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet deleted file mode 100644 index 6ee13f2d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_rjs :<+replace+>, <+"<+dom id+>"+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet deleted file mode 100644 index 4cc696f6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_select '<+path+>'<+, :<+text+> => <+'<+inner_html+>'+>+> <+do<++>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet deleted file mode 100644 index ad25cc90..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet +++ /dev/null @@ -1 +0,0 @@ -before_filter :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet deleted file mode 100644 index b28e1e62..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet +++ /dev/null @@ -1 +0,0 @@ -belongs_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet deleted file mode 100644 index 3b1ab619..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet +++ /dev/null @@ -1 +0,0 @@ -cattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet deleted file mode 100644 index e878d3a6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet +++ /dev/null @@ -1,14 +0,0 @@ -def create - @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) - - respond_to do |wants| - if @$1.save - flash[:notice] = '$2 was successfully created.' - wants.html { redirect_to(@$1) } - wants.xml { render :xml => @$1, :status => :created, :location => @$1 } - else - wants.html { render :action => "new" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet deleted file mode 100644 index 9c340808..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet +++ /dev/null @@ -1,9 +0,0 @@ -def destroy - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - @$1.destroy - - respond_to do |wants| - wants.html { redirect_to($1s_url) } - wants.xml { head :ok } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet deleted file mode 100644 index 0e80dcb8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def edit - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet deleted file mode 100644 index aa776f9a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def index - @${1:model_class_name} = ${2:ModelClassName}.all - - respond_to do |wants| - wants.html # index.html.erb - wants.xml { render :xml => @$1s } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet deleted file mode 100644 index 0a4762b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def new - @${1:model_class_name} = ${2:ModelClassName}.new - - respond_to do |wants| - wants.html # new.html.erb - wants.xml { render :xml => @$1 } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet deleted file mode 100644 index ba745d52..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def show - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |wants| - wants.html # show.html.erb - wants.xml { render :xml => @$1 } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet deleted file mode 100644 index 0556895c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet +++ /dev/null @@ -1,14 +0,0 @@ -def update - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |wants| - if @$1.update_attributes(params[:$1]) - flash[:notice] = '$2 was successfully updated.' - wants.html { redirect_to(@$1) } - wants.xml { head :ok } - else - wants.html { render :action => "edit" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet deleted file mode 100644 index af5ec413..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:all<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet deleted file mode 100644 index 24ba2da3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:first<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet deleted file mode 100644 index 96d68a5f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet +++ /dev/null @@ -1 +0,0 @@ -find(<+id+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet deleted file mode 100644 index 7ee6efec..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:last<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet deleted file mode 100644 index 2a069307..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet +++ /dev/null @@ -1 +0,0 @@ -flash[:${1:notice}] = "${2}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet deleted file mode 100644 index 1b27396a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet +++ /dev/null @@ -1 +0,0 @@ -has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet deleted file mode 100644 index 9204df56..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet deleted file mode 100644 index 6aadd73b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :<+object+>s<+, :class_name => "<+object+>", :foreign_key => "<+reference+>_id"+>, :dependent => :destroy<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet deleted file mode 100644 index 4128e037..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :${1:object}, :through => :${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet deleted file mode 100644 index 77e14e7a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet +++ /dev/null @@ -1 +0,0 @@ -has_one :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet deleted file mode 100644 index 2a30fae0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet +++ /dev/null @@ -1 +0,0 @@ -I18n.t('${1:type.key}')${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet deleted file mode 100644 index d97d4829..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet +++ /dev/null @@ -1 +0,0 @@ -<%= image_submit_tag("<+agree.png+>"<+<+, :id => "<+id+>"+><+, :name => "<+name+>"+><+, :class => "<+class+>"+><+, :disabled => <+false+>+>+>) %> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet deleted file mode 100644 index 53360dd5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet +++ /dev/null @@ -1 +0,0 @@ -RAILS_DEFAULT_LOGGER.${1:debug} ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet deleted file mode 100644 index 36236a31..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.debug { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet deleted file mode 100644 index 4417ad2e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.error { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet deleted file mode 100644 index 1bd419c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.fatal { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet deleted file mode 100644 index bf508dc1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.info { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet deleted file mode 100644 index 447f6886..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.warn { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet deleted file mode 100644 index 548d4af0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet +++ /dev/null @@ -1 +0,0 @@ -add_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet deleted file mode 100644 index b14ec4ca..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.${2:connect} '${3:controller/:action/:id}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet deleted file mode 100644 index 9292ffe9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet deleted file mode 100644 index 424805b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.resource :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet deleted file mode 100644 index a18c4df3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.resources :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet deleted file mode 100644 index b3cf7911..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet deleted file mode 100644 index a3b34bb3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet +++ /dev/null @@ -1 +0,0 @@ -before_save :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet deleted file mode 100644 index 74dc7af0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet +++ /dev/null @@ -1 +0,0 @@ -change_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet deleted file mode 100644 index 2915a37f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet +++ /dev/null @@ -1 +0,0 @@ -t.column :${1:title}, :${2:string} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet deleted file mode 100644 index a71b4731..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet +++ /dev/null @@ -1,3 +0,0 @@ -change_table :${1:table_name} do |t| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet deleted file mode 100644 index 8a5bd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet deleted file mode 100644 index 8dbe1eab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet +++ /dev/null @@ -1,3 +0,0 @@ -create_table :${1:table_name} do |t| - t.column :${2:name}, :${3:type} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet deleted file mode 100644 index 9f54e0b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet +++ /dev/null @@ -1,8 +0,0 @@ -class ${1:`Snippet_MigrationNameFromFilename()`} < ActiveRecord::Migration - def self.up - ${2} - end - - def self.down - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet deleted file mode 100644 index 1264a595..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet +++ /dev/null @@ -1 +0,0 @@ -map(&:${1:id}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet deleted file mode 100644 index aaeba258..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet deleted file mode 100644 index 8a5bd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet deleted file mode 100644 index 6e167210..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet +++ /dev/null @@ -1 +0,0 @@ -rename_column :${1:table}, :${2:old}, :${3:new} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet deleted file mode 100644 index 9ef0f8fe..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet +++ /dev/null @@ -1 +0,0 @@ -mattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet deleted file mode 100644 index cfc42ca4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet +++ /dev/null @@ -1 +0,0 @@ -named_scope :<+name+><+, :joins => :<+table+>+>, :conditions => <+['<+<+field+> = ?+>', <+true+>]+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet deleted file mode 100644 index c420ef2f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet +++ /dev/null @@ -1 +0,0 @@ -named_scope :<+name+>, lambda { |<+param+>| { :conditions => <+['<+<+field+> = ?+>', <+param+>]+> } } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet deleted file mode 100644 index 14fa54fb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet +++ /dev/null @@ -1 +0,0 @@ -params[:${1:id}]${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet deleted file mode 100644 index 56a9bbf6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet +++ /dev/null @@ -1 +0,0 @@ -render :action => "${1:action}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet deleted file mode 100644 index 0a0b202d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet +++ /dev/null @@ -1 +0,0 @@ -render :action => "${1:action}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet deleted file mode 100644 index 7938f9d6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet +++ /dev/null @@ -1,3 +0,0 @@ -respond_to do |wants| - wants.${1:html} <+{ <++> }+> -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet deleted file mode 100644 index 76fcdb1d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet +++ /dev/null @@ -1 +0,0 @@ -render :file => "${1:filepath}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet deleted file mode 100644 index c0bb72bf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet +++ /dev/null @@ -1 +0,0 @@ -render :file => "${1:filepath}", :use_full_path => ${2:false} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet deleted file mode 100644 index 17a04048..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "<+<%= 'hello' %>+>" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet deleted file mode 100644 index b1801aa4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet deleted file mode 100644 index b3cd8343..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet deleted file mode 100644 index fece1fcc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet +++ /dev/null @@ -1 +0,0 @@ -render :json => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet deleted file mode 100644 index 53e8340a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :layout => "${1:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet deleted file mode 100644 index 6c6b0fec..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet +++ /dev/null @@ -1 +0,0 @@ -render :nothing => ${1:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet deleted file mode 100644 index d1a581f8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet +++ /dev/null @@ -1 +0,0 @@ -render :nothing => ${1:true}, :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet deleted file mode 100644 index 0c5daa25..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "${1:item}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet deleted file mode 100644 index 570644b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :collection => <+@<+item+>s+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet deleted file mode 100644 index 6981fbc3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :locals => { :<+item+> => <+@<+item+>+><++> } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet deleted file mode 100644 index bab9da96..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :object => <+@<+item+>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet deleted file mode 100644 index aef4c494..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "${1:item}", :status => ${2:500} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet deleted file mode 100644 index c464879c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet deleted file mode 100644 index fc78bf14..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet deleted file mode 100644 index 69618be0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :layout => ${2:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet deleted file mode 100644 index 04fe409d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet deleted file mode 100644 index 3a2d1ed0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet +++ /dev/null @@ -1,3 +0,0 @@ -render :update do |${1:page}| - $1.${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet deleted file mode 100644 index e4e721a0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet +++ /dev/null @@ -1 +0,0 @@ -render :xml => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet deleted file mode 100644 index 19847471..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet +++ /dev/null @@ -1 +0,0 @@ -Digest::SHA1.hexdigest(${1:string}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet deleted file mode 100644 index 659aeb0d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet +++ /dev/null @@ -1,15 +0,0 @@ -class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper - observe $1 - - def after_save(${2:model_class_name}) - expire_cache($2) - end - - def after_destroy($2) - expire_cache($2) - end - - def expire_cache($2) - expire_page - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet deleted file mode 100644 index 021740df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.boolean :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet deleted file mode 100644 index 3e6d3c9c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.binary :<+title+><+, :limit => <+2+>.megabytes+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet deleted file mode 100644 index 0932f2c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.decimal :<+title+><+<+, :precision => <+10+>+><+, :scale => <+2+>+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet deleted file mode 100644 index b716e8b0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.date :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet deleted file mode 100644 index d060532e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.datetime :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet deleted file mode 100644 index f09f7904..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.float :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet deleted file mode 100644 index bcce7271..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.change :<+name+><+, :<+string+><+, :<+limit+> => <+80+>+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet deleted file mode 100644 index 7cb011ca..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.integer :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet deleted file mode 100644 index ffa359f5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.integer :lock_version, :null => false, :default => 0 -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet deleted file mode 100644 index 2b421dd7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.references :<+taggable+><+, :polymorphic => <+{ :default => '<+Photo+>' }+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet deleted file mode 100644 index a7b8473b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.string :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet deleted file mode 100644 index f28518f4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.text :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet deleted file mode 100644 index 0006c819..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.time :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet deleted file mode 100644 index e46e844c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.timestamp :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet deleted file mode 100644 index f009ee62..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.timestamps -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet deleted file mode 100644 index 2d6250ab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet +++ /dev/null @@ -1 +0,0 @@ -t.remove :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet deleted file mode 100644 index 8f70788c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.rename :<+old_column_name+>, :<+new_column_name+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet deleted file mode 100644 index 12867868..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet +++ /dev/null @@ -1 +0,0 @@ -t.references :${1:model} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet deleted file mode 100644 index 064bb7b2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_associated :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet deleted file mode 100644 index 4c6c98b6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_acceptance_of :${1:terms} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet deleted file mode 100644 index 0aa1a75d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_confirmation_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet deleted file mode 100644 index b6a4c4d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet deleted file mode 100644 index adc142c7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_format_of :${1:attribute}, :with => /${2:regex}/ diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet deleted file mode 100644 index 8ba16d2e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi }) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet deleted file mode 100644 index 71d802bd..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_length_of :${1:attribute}, :within => ${2:3}..${3:20} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet deleted file mode 100644 index 34bfaa72..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_numericality_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet deleted file mode 100644 index c8fdff9c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_presence_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet deleted file mode 100644 index 0c06e655..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_uniqueness_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet deleted file mode 100644 index 909c8d59..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet +++ /dev/null @@ -1 +0,0 @@ -wants.<+js|xml|html+> <+{ <++> }+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet deleted file mode 100644 index 41184e9e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :delete, :${1:destroy}, :id => ${2:1}${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet deleted file mode 100644 index 1ae7834e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :get, :<+show+><+, :id => <+1+>+><++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet deleted file mode 100644 index 3681a95f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :post, :${1:create}, :${2:object} => { ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet deleted file mode 100644 index f046f2ea..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet deleted file mode 100644 index 528f1b30..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet +++ /dev/null @@ -1,3 +0,0 @@ -after(${1::each}) do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet deleted file mode 100644 index 7199170c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet +++ /dev/null @@ -1 +0,0 @@ -any_number_of_times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet deleted file mode 100644 index 573addd5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet +++ /dev/null @@ -1 +0,0 @@ -and_return(${1:value}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet deleted file mode 100644 index ab03deb4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet +++ /dev/null @@ -1 +0,0 @@ -and_raise(${1:exception}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet deleted file mode 100644 index e313a512..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet +++ /dev/null @@ -1 +0,0 @@ -and_return { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet deleted file mode 100644 index d230e92c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet +++ /dev/null @@ -1 +0,0 @@ -and_throw(${1:sym}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet deleted file mode 100644 index 34c08d69..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet +++ /dev/null @@ -1 +0,0 @@ -and_yield(${1:values}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet deleted file mode 100644 index b95128bb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet +++ /dev/null @@ -1 +0,0 @@ -at_least(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet deleted file mode 100644 index fa5c6060..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet +++ /dev/null @@ -1 +0,0 @@ -at_most(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet deleted file mode 100644 index f96608c5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet +++ /dev/null @@ -1,3 +0,0 @@ -before(${1::each}) do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet deleted file mode 100644 index 4bd9d239..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet +++ /dev/null @@ -1 +0,0 @@ -controller_name :${1:controller} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet deleted file mode 100644 index 44c75845..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe "${1:subject}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet deleted file mode 100644 index 6311aa1d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe ${1:`Snippet_RubyClassNameFromFilename()`} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet deleted file mode 100644 index a9c8ac2b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:controller}, "${2:GET|POST|PUT|DELETE} ${3:/some/path}${4}" do - ${5} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet deleted file mode 100644 index b3b3e01a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:Type} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet deleted file mode 100644 index 89e9372c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:Type}, "${2:description}" do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet deleted file mode 100644 index 2e5a4a01..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet +++ /dev/null @@ -1 +0,0 @@ -exactly(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet deleted file mode 100644 index 728223f0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet +++ /dev/null @@ -1 +0,0 @@ -it_should_behave_like '${1:do something}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet deleted file mode 100644 index 8af38db4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet +++ /dev/null @@ -1,3 +0,0 @@ -it "${1}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet deleted file mode 100644 index 963f4041..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet +++ /dev/null @@ -1 +0,0 @@ -it "should ${1:do something}" do${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet deleted file mode 100644 index 2f047710..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet +++ /dev/null @@ -1,24 +0,0 @@ -class ${1:ReverseTo} - def initialize(${2:param}) - @$2 = $2 - end - - def matches?(actual) - @actual = actual - # Satisfy expectation here. Return false or raise an error if it's not met. - ${3:@actual.reverse.should == @$2} - true - end - - def failure_message - "expected #{@actual.inspect} to ${4} #{@$2.inspect}, but it didn't" - end - - def negative_failure_message - "expected #{@actual.inspect} not to ${5} #{@$2.inspect}, but it did" - end -end - -def ${6:reverse_to}(${7:expected}) - ${8}.new($7) -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet deleted file mode 100644 index b10aa1d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet +++ /dev/null @@ -1 +0,0 @@ -mock_model(${1:model})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet deleted file mode 100644 index 4ff954f1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:var} = mock("${2:mock_name}"${3:, :null_object => true}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet deleted file mode 100644 index 09f93e07..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet +++ /dev/null @@ -1,3 +0,0 @@ -Spec::Runner.configure do |config| - config.mock_with :${1:mocha|flexmock|rr} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet deleted file mode 100644 index b2d1a776..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet +++ /dev/null @@ -1 +0,0 @@ -once diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet deleted file mode 100644 index 91cd5b06..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet +++ /dev/null @@ -1 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet deleted file mode 100644 index 89d34116..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet +++ /dev/null @@ -1,3 +0,0 @@ -shared_examples_for "${1:do something}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet deleted file mode 100644 index 67530e9d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should == ${2:value} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet deleted file mode 100644 index b909d9c0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be(${2:result}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet deleted file mode 100644 index 9080a3c2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_close(${2:result}, ${3:tolerance}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet deleted file mode 100644 index 98a73893..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_instance_of(${2:class}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet deleted file mode 100644 index 74bf8520..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_a_kind_of(${2:class}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet deleted file mode 100644 index 887ef800..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should be_redirect -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet deleted file mode 100644 index 602074b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should be_success -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet deleted file mode 100644 index 16206fa1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -lambda do - ${1} -end.should change(${2:target}, :${3:method}).from(${4:old_value}).to(${5:new_value}).by(${6:change}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet deleted file mode 100644 index e82d82e7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should match(/${2:regexp}/) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet deleted file mode 100644 index f896a26e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should eql(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet deleted file mode 100644 index e3c389e6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should equal(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet deleted file mode 100644 index 93189cb8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet deleted file mode 100644 index dabe237a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have_at_least(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet deleted file mode 100644 index 7072add1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have_at_most(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet deleted file mode 100644 index b8a8997f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have(${2:n}).records -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet deleted file mode 100644 index b19cbb67..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not == ${2:value} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet deleted file mode 100644 index a34d62e5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be(${2:result}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet deleted file mode 100644 index 55ac6d3a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_close(${2:result}, ${3:tolerance}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet deleted file mode 100644 index b6f15267..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_instance_of(${2:klass}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet deleted file mode 100644 index 0b0cfc7f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_a_kind_of(${2:klass}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet deleted file mode 100644 index 25519b08..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not be_redirect -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet deleted file mode 100644 index 7d35ab20..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not be_success -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet deleted file mode 100644 index 7baead27..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -lambda do - ${1} -end.should_not change(${2:target}, :${3:method}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet deleted file mode 100644 index 68a7451c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not eql(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet deleted file mode 100644 index da4f59b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet +++ /dev/null @@ -1,2 +0,0 @@ - ${1:target}.should_not equal(${2:value}) - ${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet deleted file mode 100644 index ee7b6043..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not match(/${2:regexp}/) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet deleted file mode 100644 index 9f1298b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:target}.should_not be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet deleted file mode 100644 index 98c0fc08..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:mock}.should_not_receive(:${2:message})${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet deleted file mode 100644 index fbf9604e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not raise_error(${2:error}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet deleted file mode 100644 index 2afb69cc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not redirect_to(${1:url}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet deleted file mode 100644 index c2c5f2cb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not respond_to(:${2:sym}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet deleted file mode 100644 index b73a71c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not satisfy { |${2:obj}| ${3} } -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet deleted file mode 100644 index 0353376b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -lambda { ${1} }.should_not throw_symbol(:${2:symbol}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet deleted file mode 100644 index 9267b612..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:target}.should be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet deleted file mode 100644 index 4effa2c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:mock}.should_receive(:${2:message})${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet deleted file mode 100644 index 420bbe80..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should raise_error(${2:error}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet deleted file mode 100644 index 979c1d6e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should redirect_to(${1:url}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet deleted file mode 100644 index a796ebd2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should respond_to(:${2:sym}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet deleted file mode 100644 index 08eb9419..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should satisfy { |${2:obj}| ${3} } -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet deleted file mode 100644 index 86f55fa3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should throw_symble(:${2:symbol}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet deleted file mode 100644 index 9b08c10e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should render_template(:${1:template}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet deleted file mode 100644 index 6ebb6d4a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet +++ /dev/null @@ -1 +0,0 @@ -twice diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet deleted file mode 100644 index 21eda197..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet +++ /dev/null @@ -1,2 +0,0 @@ -with(${1:args}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet deleted file mode 100644 index 0e5a7fd2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet +++ /dev/null @@ -1,5 +0,0 @@ -context "${1:context}" do - - ${2} - -end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet deleted file mode 100644 index cfd4e59f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet deleted file mode 100644 index 39cfd6f1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet +++ /dev/null @@ -1 +0,0 @@ -should_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet deleted file mode 100644 index 90d25c84..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet +++ /dev/null @@ -1 +0,0 @@ -should_belong_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet deleted file mode 100644 index 2fc48b4a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_at_least :${1:field}, ${2:min_length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet deleted file mode 100644 index 8bc2bf87..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_is :${1:field}, ${2:length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet deleted file mode 100644 index 1f0bdc98..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet deleted file mode 100644 index 68b895c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet +++ /dev/null @@ -1,3 +0,0 @@ -setup do - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet deleted file mode 100644 index 195f7484..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_value_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet deleted file mode 100644 index 03c70e24..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_and_belong_to_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet deleted file mode 100644 index 6948aea9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_class_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet deleted file mode 100644 index d841d650..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_db_columns :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet deleted file mode 100644 index d6d2b389..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_indices :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet deleted file mode 100644 index 1f442528..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_instance_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet deleted file mode 100644 index 8c98c17e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet deleted file mode 100644 index a652b4f5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_one :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet deleted file mode 100644 index 022015df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_read_only_attributes :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet deleted file mode 100644 index 236190b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_not_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet deleted file mode 100644 index 029c5bab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet +++ /dev/null @@ -1 +0,0 @@ -should_not_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet deleted file mode 100644 index 8eccb887..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_acceptance_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet deleted file mode 100644 index a90c1cab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_numericality_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet deleted file mode 100644 index 13598f86..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_presence_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet deleted file mode 100644 index 6e26912d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_uniqueness_of :${1:field}, :scoped_to => ${2:arrayofnames} diff --git a/sources_non_forked/snipmate-snippets/ruby/Md.snippet b/sources_non_forked/snipmate-snippets/ruby/Md.snippet deleted file mode 100644 index 1c2c9f10..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Md.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:dump_path}, "wb") { |${2:file}| Marshal.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Ml.snippet b/sources_non_forked/snipmate-snippets/ruby/Ml.snippet deleted file mode 100644 index 33c3200c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Ml.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:dump_path}, "rb") { |${2:file}| Marshal.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Pn.snippet b/sources_non_forked/snipmate-snippets/ruby/Pn.snippet deleted file mode 100644 index e2136913..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Pn.snippet +++ /dev/null @@ -1 +0,0 @@ -PStore.new(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/Yd.snippet b/sources_non_forked/snipmate-snippets/ruby/Yd.snippet deleted file mode 100644 index e667a081..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Yd.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Yl.snippet b/sources_non_forked/snipmate-snippets/ruby/Yl.snippet deleted file mode 100644 index b37d1bb5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Yl.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path_to_yml}) { |${2:file}| YAML.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/am.snippet b/sources_non_forked/snipmate-snippets/ruby/am.snippet deleted file mode 100644 index 91209b9b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/am.snippet +++ /dev/null @@ -1 +0,0 @@ -alias_method :${1:new_name}, :${2:old_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/as.snippet b/sources_non_forked/snipmate-snippets/ruby/as.snippet deleted file mode 100644 index a8c7f5cb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/as.snippet +++ /dev/null @@ -1 +0,0 @@ -assert ${1:test}, "${2:failure_message}" diff --git a/sources_non_forked/snipmate-snippets/ruby/asam.snippet b/sources_non_forked/snipmate-snippets/ruby/asam.snippet deleted file mode 100644 index 3c95b31c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asam.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_alias_method ${1:object}, ${2:alias_name}, ${3:original_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asb.snippet b/sources_non_forked/snipmate-snippets/ruby/asb.snippet deleted file mode 100644 index ab1eff71..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asb.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_boolean ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asc.snippet b/sources_non_forked/snipmate-snippets/ruby/asc.snippet deleted file mode 100644 index c6badc3e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asc.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_compare ${1:expected}, ${2:operator}, ${3:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/ascd.snippet b/sources_non_forked/snipmate-snippets/ruby/ascd.snippet deleted file mode 100644 index bc77908f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ascd.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/ase.snippet b/sources_non_forked/snipmate-snippets/ruby/ase.snippet deleted file mode 100644 index 5f650990..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ase.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_equal ${1:expected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asem.snippet b/sources_non_forked/snipmate-snippets/ruby/asem.snippet deleted file mode 100644 index 46428325..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asem.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asf.snippet b/sources_non_forked/snipmate-snippets/ruby/asf.snippet deleted file mode 100644 index 27ff6da5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asf.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_false ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asfa.snippet b/sources_non_forked/snipmate-snippets/ruby/asfa.snippet deleted file mode 100644 index f45fa53f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asfa.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_fail_assertion { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asi.snippet b/sources_non_forked/snipmate-snippets/ruby/asi.snippet deleted file mode 100644 index dedf94d2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asi.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asid.snippet b/sources_non_forked/snipmate-snippets/ruby/asid.snippet deleted file mode 100644 index 683fb06c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asid.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:delta_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asie.snippet b/sources_non_forked/snipmate-snippets/ruby/asie.snippet deleted file mode 100644 index f13d0a36..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asie.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asio.snippet b/sources_non_forked/snipmate-snippets/ruby/asio.snippet deleted file mode 100644 index 56f0ab7e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asio.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_instance_of ${1:ExpectedClass}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asko.snippet b/sources_non_forked/snipmate-snippets/ruby/asko.snippet deleted file mode 100644 index 555bf138..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asko.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_kind_of ${1:ExpectedKind}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asm.snippet b/sources_non_forked/snipmate-snippets/ruby/asm.snippet deleted file mode 100644 index 9860b4cf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_match /${1:expected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asn.snippet b/sources_non_forked/snipmate-snippets/ruby/asn.snippet deleted file mode 100644 index 36a2898e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asn.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asncd.snippet b/sources_non_forked/snipmate-snippets/ruby/asncd.snippet deleted file mode 100644 index b4dcd735..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asncd.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asne.snippet b/sources_non_forked/snipmate-snippets/ruby/asne.snippet deleted file mode 100644 index 91db286a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asne.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_equal ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnem.snippet b/sources_non_forked/snipmate-snippets/ruby/asnem.snippet deleted file mode 100644 index 43d07728..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnem.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asni.snippet b/sources_non_forked/snipmate-snippets/ruby/asni.snippet deleted file mode 100644 index d450d9ea..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asni.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnid.snippet b/sources_non_forked/snipmate-snippets/ruby/asnid.snippet deleted file mode 100644 index 23e039ad..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnid.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_in_delta ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnie.snippet b/sources_non_forked/snipmate-snippets/ruby/asnie.snippet deleted file mode 100644 index 25eb7515..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnie.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnm.snippet b/sources_non_forked/snipmate-snippets/ruby/asnm.snippet deleted file mode 100644 index 95dbf247..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_no_match /${1:unexpected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnn.snippet b/sources_non_forked/snipmate-snippets/ruby/asnn.snippet deleted file mode 100644 index 9227bc8a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnn.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnp.snippet b/sources_non_forked/snipmate-snippets/ruby/asnp.snippet deleted file mode 100644 index a540f84d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnr.snippet b/sources_non_forked/snipmate-snippets/ruby/asnr.snippet deleted file mode 100644 index fc9a8204..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nothing_raised { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet deleted file mode 100644 index fb063d28..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_respond_to ${1:object}, ${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asns.snippet b/sources_non_forked/snipmate-snippets/ruby/asns.snippet deleted file mode 100644 index 509e467a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asns.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_same ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnse.snippet b/sources_non_forked/snipmate-snippets/ruby/asnse.snippet deleted file mode 100644 index befde129..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnse.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnt.snippet deleted file mode 100644 index cb633c22..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nothing_thrown { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby/aso.snippet b/sources_non_forked/snipmate-snippets/ruby/aso.snippet deleted file mode 100644 index 5b7faf64..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aso.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_operator ${1:left}, :${2:operator}, ${3:right} diff --git a/sources_non_forked/snipmate-snippets/ruby/asp.snippet b/sources_non_forked/snipmate-snippets/ruby/asp.snippet deleted file mode 100644 index c23fd3f6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspe.snippet b/sources_non_forked/snipmate-snippets/ruby/aspe.snippet deleted file mode 100644 index 3a3eed4f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aspe.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_path_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspne.snippet b/sources_non_forked/snipmate-snippets/ruby/aspne.snippet deleted file mode 100644 index f7a8873a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aspne.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_path_not_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/asr.snippet b/sources_non_forked/snipmate-snippets/ruby/asr.snippet deleted file mode 100644 index 834038d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise(${1:Exception}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrko.snippet b/sources_non_forked/snipmate-snippets/ruby/asrko.snippet deleted file mode 100644 index f82820ed..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrko.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise_kind_of(${1:kinds...}) { ${2:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrm.snippet b/sources_non_forked/snipmate-snippets/ruby/asrm.snippet deleted file mode 100644 index f62f208b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise_message ${1:expected_message} diff --git a/sources_non_forked/snipmate-snippets/ruby/asrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asrt.snippet deleted file mode 100644 index ca8e84b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_respond_to ${1:object}, :${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asse.snippet b/sources_non_forked/snipmate-snippets/ruby/asse.snippet deleted file mode 100644 index 4fb9ef9a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asse.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/ast.snippet b/sources_non_forked/snipmate-snippets/ruby/ast.snippet deleted file mode 100644 index 8962cfb7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ast.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_throws(:${1:expected}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/astr.snippet b/sources_non_forked/snipmate-snippets/ruby/astr.snippet deleted file mode 100644 index b9d14f6e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/astr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_true ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/bm.snippet b/sources_non_forked/snipmate-snippets/ruby/bm.snippet deleted file mode 100644 index 681c5621..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/bm.snippet +++ /dev/null @@ -1,4 +0,0 @@ -TESTS = ${1:10_000} -Benchmark.bmbm do |results| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/case.snippet b/sources_non_forked/snipmate-snippets/ruby/case.snippet deleted file mode 100644 index 085a45db..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/case.snippet +++ /dev/null @@ -1,5 +0,0 @@ -case ${1} -when ${2} -else - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/class.snippet b/sources_non_forked/snipmate-snippets/ruby/class.snippet deleted file mode 100644 index cb396704..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/class.snippet +++ /dev/null @@ -1,3 +0,0 @@ -class ${1:`Snippet_RubyClassNameFromFilename()`}${2} - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/classe.snippet b/sources_non_forked/snipmate-snippets/ruby/classe.snippet deleted file mode 100644 index f683c688..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/classe.snippet +++ /dev/null @@ -1 +0,0 @@ -class ${1:ErrorClassName} < ${2:StandardError}; end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby/def.snippet b/sources_non_forked/snipmate-snippets/ruby/def.snippet deleted file mode 100644 index ad9bc8cf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/def.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def ${1:name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defi.snippet b/sources_non_forked/snipmate-snippets/ruby/defi.snippet deleted file mode 100644 index 12c354c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defi.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def initialize${1} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defmm.snippet b/sources_non_forked/snipmate-snippets/ruby/defmm.snippet deleted file mode 100644 index e3b263a8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defmm.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def method_missing(meth, *args, &blk) - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defs.snippet b/sources_non_forked/snipmate-snippets/ruby/defs.snippet deleted file mode 100644 index 837733f2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defs.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def self.${1:class_method_name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/deft.snippet b/sources_non_forked/snipmate-snippets/ruby/deft.snippet deleted file mode 100644 index 9c2adbff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/deft.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def test_${1:case_name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/detect.snippet b/sources_non_forked/snipmate-snippets/ruby/detect.snippet deleted file mode 100644 index 5fc24aaa..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/detect.snippet +++ /dev/null @@ -1 +0,0 @@ -detect { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/detecto.snippet b/sources_non_forked/snipmate-snippets/ruby/detecto.snippet deleted file mode 100644 index 904b2a67..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/detecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -detect do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/dglob.snippet b/sources_non_forked/snipmate-snippets/ruby/dglob.snippet deleted file mode 100644 index ca326ade..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/dglob.snippet +++ /dev/null @@ -1 +0,0 @@ -Dir.glob(${1:"<+dir}"+>) { |${2:file}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/do.snippet b/sources_non_forked/snipmate-snippets/ruby/do.snippet deleted file mode 100644 index 596c11a9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/do.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/dop.snippet b/sources_non_forked/snipmate-snippets/ruby/dop.snippet deleted file mode 100644 index 9bf1898a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/dop.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do |${1:param}| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ea.snippet b/sources_non_forked/snipmate-snippets/ruby/ea.snippet deleted file mode 100644 index 5f7edec0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ea.snippet +++ /dev/null @@ -1 +0,0 @@ -each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each.snippet b/sources_non_forked/snipmate-snippets/ruby/each.snippet deleted file mode 100644 index 5f7edec0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each.snippet +++ /dev/null @@ -1 +0,0 @@ -each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet deleted file mode 100644 index f4d3ef11..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet +++ /dev/null @@ -1 +0,0 @@ -each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet deleted file mode 100644 index e4fb7080..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet +++ /dev/null @@ -1,4 +0,0 @@ -each_with_index do |${1:element},${2:i}| - ${3:body} -end - diff --git a/sources_non_forked/snipmate-snippets/ruby/eacho.snippet b/sources_non_forked/snipmate-snippets/ruby/eacho.snippet deleted file mode 100644 index 7c133426..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eacho.snippet +++ /dev/null @@ -1,3 +0,0 @@ -each do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/eado.snippet b/sources_non_forked/snipmate-snippets/ruby/eado.snippet deleted file mode 100644 index 7c133426..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eado.snippet +++ /dev/null @@ -1,3 +0,0 @@ -each do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/eawi.snippet b/sources_non_forked/snipmate-snippets/ruby/eawi.snippet deleted file mode 100644 index f4d3ef11..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eawi.snippet +++ /dev/null @@ -1 +0,0 @@ -each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/eawido.snippet b/sources_non_forked/snipmate-snippets/ruby/eawido.snippet deleted file mode 100644 index e4fb7080..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eawido.snippet +++ /dev/null @@ -1,4 +0,0 @@ -each_with_index do |${1:element},${2:i}| - ${3:body} -end - diff --git a/sources_non_forked/snipmate-snippets/ruby/elsif.snippet b/sources_non_forked/snipmate-snippets/ruby/elsif.snippet deleted file mode 100644 index 84d8134e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/elsif.snippet +++ /dev/null @@ -1,2 +0,0 @@ -elsif ${1:condition} - ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet b/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet deleted file mode 100644 index 5076ef1a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet +++ /dev/null @@ -1 +0,0 @@ -File.foreach(${1:"<+path}"+>) { |${2:line}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fopen.snippet b/sources_non_forked/snipmate-snippets/ruby/fopen.snippet deleted file mode 100644 index b630bfeb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fopen.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path}, "${2:rwab}") { |${3:file}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fread.snippet b/sources_non_forked/snipmate-snippets/ruby/fread.snippet deleted file mode 100644 index d9e6074c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fread.snippet +++ /dev/null @@ -1 +0,0 @@ -File.read(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/http_get.snippet b/sources_non_forked/snipmate-snippets/ruby/http_get.snippet deleted file mode 100644 index cba6d589..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/http_get.snippet +++ /dev/null @@ -1,2 +0,0 @@ -require 'net/http' -res = Net::HTTP.get URI.parse('${1:url}') diff --git a/sources_non_forked/snipmate-snippets/ruby/http_post.snippet b/sources_non_forked/snipmate-snippets/ruby/http_post.snippet deleted file mode 100644 index 3b2036ad..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/http_post.snippet +++ /dev/null @@ -1,2 +0,0 @@ -require 'net/http' -res = Net::HTTP.post_form URI.parse('${1:url}')${2:, params} diff --git a/sources_non_forked/snipmate-snippets/ruby/if.snippet b/sources_non_forked/snipmate-snippets/ruby/if.snippet deleted file mode 100644 index b2d1e39e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ife.snippet b/sources_non_forked/snipmate-snippets/ruby/ife.snippet deleted file mode 100644 index 2a7468df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if ${1:condition} - ${2} -else -end diff --git a/sources_non_forked/snipmate-snippets/ruby/inj.snippet b/sources_non_forked/snipmate-snippets/ruby/inj.snippet deleted file mode 100644 index 90dea0d8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/inj.snippet +++ /dev/null @@ -1 +0,0 @@ -inject(${1:init}) { |${2:total}, ${3:next}| ${4:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injdo.snippet b/sources_non_forked/snipmate-snippets/ruby/injdo.snippet deleted file mode 100644 index d3235e90..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/injdo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -inject(${1:init}) do |${2:total}, ${3:next}| - ${4:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/inject.snippet b/sources_non_forked/snipmate-snippets/ruby/inject.snippet deleted file mode 100644 index 78ad721d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/inject.snippet +++ /dev/null @@ -1 +0,0 @@ -inject { |${1:total},${2:next}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injecto.snippet b/sources_non_forked/snipmate-snippets/ruby/injecto.snippet deleted file mode 100644 index 1631033d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/injecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -inject do |${1:total},${2:next}| - ${3:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ip.snippet b/sources_non_forked/snipmate-snippets/ruby/ip.snippet deleted file mode 100644 index 91769768..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ip.snippet +++ /dev/null @@ -1 +0,0 @@ -ip_addr = request.env['REMOTE_ADDR'] diff --git a/sources_non_forked/snipmate-snippets/ruby/map.snippet b/sources_non_forked/snipmate-snippets/ruby/map.snippet deleted file mode 100644 index b3e7719f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/map.snippet +++ /dev/null @@ -1 +0,0 @@ -map { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet deleted file mode 100644 index 316e7c7c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -map do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/mapo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapo.snippet deleted file mode 100644 index 316e7c7c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mapo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -map do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/mod.snippet b/sources_non_forked/snipmate-snippets/ruby/mod.snippet deleted file mode 100644 index 457fd615..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mod.snippet +++ /dev/null @@ -1,3 +0,0 @@ -module ${1:`Snippet_RubyClassNameFromFilename()`} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/module.snippet b/sources_non_forked/snipmate-snippets/ruby/module.snippet deleted file mode 100644 index 78e025a1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/module.snippet +++ /dev/null @@ -1,14 +0,0 @@ -module ${1:`Snippet_RubyClassNameFromFilename()`} - module ClassMethods - ${2} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby/nam.snippet b/sources_non_forked/snipmate-snippets/ruby/nam.snippet deleted file mode 100644 index 19b90a76..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/nam.snippet +++ /dev/null @@ -1,3 +0,0 @@ -namespace :${1:namespace} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ope.snippet b/sources_non_forked/snipmate-snippets/ruby/ope.snippet deleted file mode 100644 index cfe92471..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ope.snippet +++ /dev/null @@ -1 +0,0 @@ -open(${1:path}, "${2:rwab}") { |${3:io}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet b/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet deleted file mode 100644 index f4ed9440..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet +++ /dev/null @@ -1 +0,0 @@ -File.join(File.dirname(__FILE__), *%w[${1:rel_path_here}]) diff --git a/sources_non_forked/snipmate-snippets/ruby/r.snippet b/sources_non_forked/snipmate-snippets/ruby/r.snippet deleted file mode 100644 index f232fc94..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/r.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_reader :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/reject.snippet b/sources_non_forked/snipmate-snippets/ruby/reject.snippet deleted file mode 100644 index 07d2787f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/reject.snippet +++ /dev/null @@ -1 +0,0 @@ -reject { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet b/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet deleted file mode 100644 index e906bd7e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -reject do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/rep.snippet b/sources_non_forked/snipmate-snippets/ruby/rep.snippet deleted file mode 100644 index 04b77b0d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rep.snippet +++ /dev/null @@ -1 +0,0 @@ -results.report("${1:name}:") { TESTS.times { ${2} } } diff --git a/sources_non_forked/snipmate-snippets/ruby/rw.snippet b/sources_non_forked/snipmate-snippets/ruby/rw.snippet deleted file mode 100644 index 1862da33..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rw.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/select.snippet b/sources_non_forked/snipmate-snippets/ruby/select.snippet deleted file mode 100644 index 8ab228cc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/select.snippet +++ /dev/null @@ -1 +0,0 @@ -select { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/selecto.snippet b/sources_non_forked/snipmate-snippets/ruby/selecto.snippet deleted file mode 100644 index a22a6505..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/selecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -select do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/sinc.snippet b/sources_non_forked/snipmate-snippets/ruby/sinc.snippet deleted file mode 100644 index 20e2c4c9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sinc.snippet +++ /dev/null @@ -1 +0,0 @@ -class << self; self end diff --git a/sources_non_forked/snipmate-snippets/ruby/sort.snippet b/sources_non_forked/snipmate-snippets/ruby/sort.snippet deleted file mode 100644 index 08a67c1a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sort.snippet +++ /dev/null @@ -1 +0,0 @@ -sort { |${1:x},${2:y}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/sorto.snippet b/sources_non_forked/snipmate-snippets/ruby/sorto.snippet deleted file mode 100644 index 76c38e40..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sorto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -sort do |${1:x},${2:y}| - ${3:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/tas.snippet b/sources_non_forked/snipmate-snippets/ruby/tas.snippet deleted file mode 100644 index d949a6b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/tas.snippet +++ /dev/null @@ -1,4 +0,0 @@ -desc "${1:Task description}" -task :${2:task_name}${3: => [:dependent, :tasks]} do - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/task.snippet b/sources_non_forked/snipmate-snippets/ruby/task.snippet deleted file mode 100644 index d949a6b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/task.snippet +++ /dev/null @@ -1,4 +0,0 @@ -desc "${1:Task description}" -task :${2:task_name}${3: => [:dependent, :tasks]} do - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/tc.snippet b/sources_non_forked/snipmate-snippets/ruby/tc.snippet deleted file mode 100644 index 3e28f61a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/tc.snippet +++ /dev/null @@ -1,9 +0,0 @@ -require "test/unit" - -require "${1:library_file_name}" - -class Test${2:`Snippet_RubyClassNameFromFilename()`} < Test::Unit::TestCase - def test_${3:case_name} - ${4} - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby/unless.snippet b/sources_non_forked/snipmate-snippets/ruby/unless.snippet deleted file mode 100644 index 3495d2ba..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/unless.snippet +++ /dev/null @@ -1,3 +0,0 @@ -unless ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet b/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet deleted file mode 100644 index d190b45e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet +++ /dev/null @@ -1,4 +0,0 @@ -unless ${1:condition} - ${2} -else -end diff --git a/sources_non_forked/snipmate-snippets/ruby/w.snippet b/sources_non_forked/snipmate-snippets/ruby/w.snippet deleted file mode 100644 index 0650e955..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/w.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_writer :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/while.snippet b/sources_non_forked/snipmate-snippets/ruby/while.snippet deleted file mode 100644 index 6e878fa3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/while.snippet +++ /dev/null @@ -1,3 +0,0 @@ -while ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet b/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet deleted file mode 100644 index eeb35802..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet +++ /dev/null @@ -1 +0,0 @@ -REXML::Document.new(File.read(${1:path})) diff --git a/sources_non_forked/snipmate-snippets/ruby/xpa.snippet b/sources_non_forked/snipmate-snippets/ruby/xpa.snippet deleted file mode 100644 index 5bff9508..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/xpa.snippet +++ /dev/null @@ -1,3 +0,0 @@ -elements.each(${1}) do |${2:node}| - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/zip.snippet b/sources_non_forked/snipmate-snippets/ruby/zip.snippet deleted file mode 100644 index b2c831ab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/zip.snippet +++ /dev/null @@ -1 +0,0 @@ -zip(${1:enums}) { |${2:row}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/sinatra/get.snippet b/sources_non_forked/snipmate-snippets/sinatra/get.snippet deleted file mode 100644 index 08f3fd5a..00000000 --- a/sources_non_forked/snipmate-snippets/sinatra/get.snippet +++ /dev/null @@ -1,3 +0,0 @@ -get '${1:/}' do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/sshconfig/host.snippet b/sources_non_forked/snipmate-snippets/sshconfig/host.snippet deleted file mode 100644 index 5992a2d0..00000000 --- a/sources_non_forked/snipmate-snippets/sshconfig/host.snippet +++ /dev/null @@ -1,3 +0,0 @@ -Host ${1:name} - Hostname ${2:example.com} - User ${3:username} diff --git a/sources_non_forked/snipmate-snippets/support_functions.vim b/sources_non_forked/snipmate-snippets/support_functions.vim deleted file mode 100644 index a09e81da..00000000 --- a/sources_non_forked/snipmate-snippets/support_functions.vim +++ /dev/null @@ -1,115 +0,0 @@ -"ruby {{{1 -function! Snippet_RubyClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(substitute(name, '_spec$', '', '')) -endfunction - -function! Snippet_MigrationNameFromFilename(...) - let name = substitute(expand("%:t:r"), '^.\{-}_', '', '') - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(name) -endfunction - - -"python {{{1 -function! Snippet_PythonClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(name) -endfunction - -"php {{{1 -function! Snippet_PHPClassNameFromFilename(...) - let name = expand("%:t:r:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return name -endfunction - -"java {{{1 -function! Snippet_JavaClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return name -endfunction - -function! Snippet_JavaInstanceVarType(name) - let oldview = winsaveview() - if searchdecl(a:name) == 0 - normal! B - let old_reg = @" - normal! yaW - let type = @" - let @" = old_reg - call winrestview(oldview) - let type = substitute(type, '\s\+$', '', '') - - "searchdecl treats 'return foo;' as a declaration of foo - if type != 'return' - return type - endif - endif - return "<+type+>" -endfunction - - -"global {{{1 -function! s:start_comment() - return substitute(&commentstring, '^\([^ ]*\)\s*%s\(.*\)$', '\1', '') -endfunction - -function! s:end_comment() - return substitute(&commentstring, '^.*%s\(.*\)$', '\1', '') -endfunction - -function! Snippet_Modeline() - return s:start_comment() . " vim: set ${1:settings}:" . s:end_comment() -endfunction - -function! Snippet_Camelcase(s) - "upcase the first letter - let toReturn = substitute(a:s, '^\(.\)', '\=toupper(submatch(1))', '') - "turn all '_x' into 'X' - return substitute(toReturn, '_\(.\)', '\=toupper(submatch(1))', 'g') -endfunction - -function! Snippet_Underscore(s) - "down the first letter - let toReturn = substitute(a:s, '^\(.\)', '\=tolower(submatch(1))', '') - "turn all 'X' into '_x' - return substitute(toReturn, '\([A-Z]\)', '\=tolower("_".submatch(1))', 'g') -endfunction - - -" modeline {{{1 -" vim: set fdm=marker: diff --git a/sources_non_forked/snipmate-snippets/vim/au.snippet b/sources_non_forked/snipmate-snippets/vim/au.snippet deleted file mode 100644 index d59720a5..00000000 --- a/sources_non_forked/snipmate-snippets/vim/au.snippet +++ /dev/null @@ -1 +0,0 @@ -autocmd ${1:events} ${2:pattern} ${3:command} diff --git a/sources_non_forked/snipmate-snippets/vim/com.snippet b/sources_non_forked/snipmate-snippets/vim/com.snippet deleted file mode 100644 index b8eeb5b4..00000000 --- a/sources_non_forked/snipmate-snippets/vim/com.snippet +++ /dev/null @@ -1 +0,0 @@ -command! -nargs=${1:number_of_args} ${2:other_params} ${2:name} ${2:command} diff --git a/sources_non_forked/snipmate-snippets/vim/func.snippet b/sources_non_forked/snipmate-snippets/vim/func.snippet deleted file mode 100644 index 8591a835..00000000 --- a/sources_non_forked/snipmate-snippets/vim/func.snippet +++ /dev/null @@ -1,8 +0,0 @@ -"Function: $1 -"Desc: ${3:description} -" -"Arguments: -"${4} -function! ${1:name}(${2}) - ${5} -endfunction diff --git a/sources_non_forked/snipmate-snippets/vim/if.snippet b/sources_non_forked/snipmate-snippets/vim/if.snippet deleted file mode 100644 index 336e7a00..00000000 --- a/sources_non_forked/snipmate-snippets/vim/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if ${1} - ${2} -endif diff --git a/sources_non_forked/snipmate-snippets/vim/ife.snippet b/sources_non_forked/snipmate-snippets/vim/ife.snippet deleted file mode 100644 index c5d16939..00000000 --- a/sources_non_forked/snipmate-snippets/vim/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if ${1} - ${2} -else -endif diff --git a/sources_non_forked/snipmate-snippets/vim/log.snippet b/sources_non_forked/snipmate-snippets/vim/log.snippet deleted file mode 100644 index 5a867549..00000000 --- a/sources_non_forked/snipmate-snippets/vim/log.snippet +++ /dev/null @@ -1 +0,0 @@ -echomsg ${1} diff --git a/sources_non_forked/snipmate-snippets/vim/try.snippet b/sources_non_forked/snipmate-snippets/vim/try.snippet deleted file mode 100644 index cd4c0e72..00000000 --- a/sources_non_forked/snipmate-snippets/vim/try.snippet +++ /dev/null @@ -1,4 +0,0 @@ -try - ${2} -catch /${1}/ -endtry diff --git a/sources_non_forked/snipmate-snippets/xslt/call.snippet b/sources_non_forked/snipmate-snippets/xslt/call.snippet deleted file mode 100644 index 2fe4f9d1..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/call.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/choose.snippet b/sources_non_forked/snipmate-snippets/xslt/choose.snippet deleted file mode 100644 index 1a877543..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/choose.snippet +++ /dev/null @@ -1,7 +0,0 @@ - - - ${2} - - - - diff --git a/sources_non_forked/snipmate-snippets/xslt/mat.snippet b/sources_non_forked/snipmate-snippets/xslt/mat.snippet deleted file mode 100644 index a566e0ec..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/mat.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/out.snippet b/sources_non_forked/snipmate-snippets/xslt/out.snippet deleted file mode 100644 index 88e70c21..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/out.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/param.snippet b/sources_non_forked/snipmate-snippets/xslt/param.snippet deleted file mode 100644 index f4f9a504..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/param.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/sty.snippet b/sources_non_forked/snipmate-snippets/xslt/sty.snippet deleted file mode 100644 index f6751c74..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/sty.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${1} - diff --git a/sources_non_forked/snipmate-snippets/xslt/tem.snippet b/sources_non_forked/snipmate-snippets/xslt/tem.snippet deleted file mode 100644 index bcd86d6d..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/tem.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/value.snippet b/sources_non_forked/snipmate-snippets/xslt/value.snippet deleted file mode 100644 index 9128cc6d..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/value.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/var.snippet b/sources_non_forked/snipmate-snippets/xslt/var.snippet deleted file mode 100644 index d21b77c8..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/var.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/wparam.snippet b/sources_non_forked/snipmate-snippets/xslt/wparam.snippet deleted file mode 100644 index 2284b71c..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/wparam.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/xdec.snippet b/sources_non_forked/snipmate-snippets/xslt/xdec.snippet deleted file mode 100644 index f1e44209..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/xdec.snippet +++ /dev/null @@ -1,2 +0,0 @@ - - ${2} diff --git a/sources_non_forked/snipmate-snippets/zend/assert.snippet b/sources_non_forked/snipmate-snippets/zend/assert.snippet deleted file mode 100644 index ca928f25..00000000 --- a/sources_non_forked/snipmate-snippets/zend/assert.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->assertTrue(${1:somevar}, '${2:sometext}'); diff --git a/sources_non_forked/snipmate-snippets/zend/boolcol.snippet b/sources_non_forked/snipmate-snippets/zend/boolcol.snippet deleted file mode 100644 index 715fe19c..00000000 --- a/sources_non_forked/snipmate-snippets/zend/boolcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:active}', '${2:boolean}', ${3:1}, array('default' => '${4:1}','notnull' => true)); diff --git a/sources_non_forked/snipmate-snippets/zend/clac.snippet b/sources_non_forked/snipmate-snippets/zend/clac.snippet deleted file mode 100644 index 80972a11..00000000 --- a/sources_non_forked/snipmate-snippets/zend/clac.snippet +++ /dev/null @@ -1,20 +0,0 @@ -_flashMessenger->addMessage("${1}", '${2:error}'); diff --git a/sources_non_forked/snipmate-snippets/zend/getconf.snippet b/sources_non_forked/snipmate-snippets/zend/getconf.snippet deleted file mode 100644 index 10f2b202..00000000 --- a/sources_non_forked/snipmate-snippets/zend/getconf.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:conf} = Zend_Registry::get('${2:config}')->${3:general}; diff --git a/sources_non_forked/snipmate-snippets/zend/input.snippet b/sources_non_forked/snipmate-snippets/zend/input.snippet deleted file mode 100644 index 3c4ed27e..00000000 --- a/sources_non_forked/snipmate-snippets/zend/input.snippet +++ /dev/null @@ -1,4 +0,0 @@ -formInput(array( 'type' => '${1:hidden}', - 'name' => '${2}', - 'value' => ${3:}, - 'id' => '${4:}' )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/inputarr.snippet b/sources_non_forked/snipmate-snippets/zend/inputarr.snippet deleted file mode 100644 index 8e97bee5..00000000 --- a/sources_non_forked/snipmate-snippets/zend/inputarr.snippet +++ /dev/null @@ -1,6 +0,0 @@ -formInput(array( 'type' => '${1:dropdown}', - 'name' => '${2}', - 'label' => '${3:}', - 'errors' => ${4:}, - 'value' => ${5:}, - 'valueList' => ${6:} )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/intcol.snippet b/sources_non_forked/snipmate-snippets/zend/intcol.snippet deleted file mode 100644 index caacaa61..00000000 --- a/sources_non_forked/snipmate-snippets/zend/intcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:id}', '${2:integer}', ${3:11}, array(${4:'notnull' => true)}); diff --git a/sources_non_forked/snipmate-snippets/zend/lib.snippet b/sources_non_forked/snipmate-snippets/zend/lib.snippet deleted file mode 100644 index 683e22ef..00000000 --- a/sources_non_forked/snipmate-snippets/zend/lib.snippet +++ /dev/null @@ -1,5 +0,0 @@ -hasColumn('id', 'integer', 4, array('notnull' => true, - 'primary' => true, - 'autoincrement' => true)); - ${3} - } - -} diff --git a/sources_non_forked/snipmate-snippets/zend/navi.snippet b/sources_non_forked/snipmate-snippets/zend/navi.snippet deleted file mode 100644 index 2724ff9f..00000000 --- a/sources_non_forked/snipmate-snippets/zend/navi.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->view->navigationActive = array('topnavi' => '${1:home}','subnavi' => '${2:index}'); diff --git a/sources_non_forked/snipmate-snippets/zend/route.snippet b/sources_non_forked/snipmate-snippets/zend/route.snippet deleted file mode 100644 index cdf834b2..00000000 --- a/sources_non_forked/snipmate-snippets/zend/route.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->_redirector->gotoRoute(array('controller' => '${1}', 'action' => '${2:index}', 'id' => '${3:}'), '${4:admin_action}'); diff --git a/sources_non_forked/snipmate-snippets/zend/rp.snippet b/sources_non_forked/snipmate-snippets/zend/rp.snippet deleted file mode 100644 index b5dcd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/zend/rp.snippet +++ /dev/null @@ -1,2 +0,0 @@ -partial('${1:somefile}.phtml', - array(${2}))?> diff --git a/sources_non_forked/snipmate-snippets/zend/strcol.snippet b/sources_non_forked/snipmate-snippets/zend/strcol.snippet deleted file mode 100644 index 98d3cf34..00000000 --- a/sources_non_forked/snipmate-snippets/zend/strcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:title}', '${2:string}', ${3:255}, array(${4:'notnull' => true})); diff --git a/update_plugins.py b/update_plugins.py index a2799f6f..cbb08b7d 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -25,7 +25,6 @@ mayansmoke https://github.com/vim-scripts/mayansmoke nerdtree https://github.com/scrooloose/nerdtree nginx.vim https://github.com/chr4/nginx.vim open_file_under_cursor.vim https://github.com/amix/open_file_under_cursor.vim -snipmate-snippets https://github.com/scrooloose/snipmate-snippets tlib https://github.com/vim-scripts/tlib vim-addon-mw-utils https://github.com/MarcWeber/vim-addon-mw-utils vim-bundle-mako https://github.com/sophacles/vim-bundle-mako From 9c54d954f6f346f476869e69936fdb92193e7b0c Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 30 Nov 2019 13:06:56 +0100 Subject: [PATCH 32/91] Updated plugins --- .../ale/autoload/ale/handlers/eslint.vim | 13 ++++-- sources_non_forked/nerdtree/CHANGELOG.md | 3 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 8 ++++ .../nerdtree/nerdtree_plugin/vcs.vim | 9 ++++ .../rust.vim/autoload/cargo.vim | 12 ++++- sources_non_forked/rust.vim/autoload/rust.vim | 14 ++++-- sources_non_forked/rust.vim/doc/rust.txt | 11 ++++- sources_non_forked/rust.vim/ftplugin/rust.vim | 3 +- sources_non_forked/rust.vim/indent/rust.vim | 7 ++- sources_non_forked/rust.vim/syntax/rust.vim | 1 + sources_non_forked/rust.vim/test/indent.vader | 45 ++++++++++++++++++ .../vim-commentary/plugin/commentary.vim | 2 +- .../vim-fugitive/autoload/fugitive.vim | 28 ++++++----- .../vim-fugitive/plugin/fugitive.vim | 2 + sources_non_forked/vim-gitgutter/README.mkd | 32 +++++++++++-- .../vim-gitgutter/autoload/gitgutter.vim | 6 ++- .../vim-gitgutter/doc/gitgutter.txt | 13 +++++- .../vim-gitgutter/plugin/gitgutter.vim | 1 + .../vim-snippets/UltiSnips/rails.snippets | 8 ++-- .../vim-snippets/snippets/fortran.snippets | 46 +++++++++---------- .../vim-surround/plugin/surround.vim | 2 +- 21 files changed, 201 insertions(+), 65 deletions(-) diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index 4d533ff2..7ef63785 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -84,11 +84,14 @@ function! s:CheckForBadConfig(buffer, lines) abort endfunction function! s:parseJSON(buffer, lines) abort - try - let l:parsed = json_decode(a:lines[-1]) - catch - return [] - endtry + let l:parsed = [] + + for l:line in a:lines + try + let l:parsed = extend(l:parsed, json_decode(l:line)) + catch + endtry + endfor if type(l:parsed) != v:t_list || empty(l:parsed) return [] diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index ac12c9f0..fe5d51aa 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -7,7 +7,8 @@ in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> - +#### 6.3 +- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060) #### 6.2 - **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056) - **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032) diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 32b0b5d1..e88a6802 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -125,6 +125,14 @@ The following features and functionality are provided by the NERDTree: again. If no NERDTree exists for this tab then this command acts the same as the |:NERDTree| command. +:NERDTreeToggleVCS [ | ] *:NERDTreeToggleVCS* + Like |:NERDTreeToggle|, but searches up the directory tree to find the top of + the version control system repository, and roots the NERDTree there. It + works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A + couple of examples: > + :NERDTreeToggleVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree) + :NERDTreeToggleVCS (opens root of repository containing CWD) + :NERDTreeFocus *:NERDTreeFocus* Opens (or reopens) the NERDTree if it is not currently visible; otherwise, the cursor is moved to the already-open NERDTree. diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim index c30579ae..d9901b83 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim @@ -11,6 +11,7 @@ " " ============================================================================ command! -n=? -complete=dir -bar NERDTreeVCS :call CreateTabTreeVCS('') +command! -n=? -complete=dir -bar NERDTreeToggleVCS :call ToggleTabTreeVCS('') " FUNCTION: s:CreateTabTreeVCS(a:name) {{{1 function! s:CreateTabTreeVCS(name) @@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name) call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str()) endfunction +" FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1 +" Behaves the same as ToggleTabTree except roots directory at VCS root +function! s:ToggleTabTreeVCS(name) + let l:path = g:NERDTreeCreator._pathForString(a:name) + let l:path = s:FindParentVCSRoot(l:path) + call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? "" : l:path._str()) +endfunction + " FUNCTION: s:FindParentVCSRoot(a:path) {{{1 " Finds the root version control system folder of the given path. If a:path is " not part of a repository, return the original path. diff --git a/sources_non_forked/rust.vim/autoload/cargo.vim b/sources_non_forked/rust.vim/autoload/cargo.vim index b5d40e2f..01ab2ccc 100644 --- a/sources_non_forked/rust.vim/autoload/cargo.vim +++ b/sources_non_forked/rust.vim/autoload/cargo.vim @@ -3,7 +3,17 @@ function! cargo#Load() endfunction function! cargo#cmd(args) - execute "! cargo" a:args + " Trim trailing spaces. This is necessary since :terminal command parses + " trailing spaces as an empty argument. + let args = substitute(a:args, '\s\+$', '', '') + if has('terminal') + let cmd = 'terminal' + elseif has('nvim') + let cmd = 'noautocmd new | terminal' + else + let cmd = '!' + endif + execute cmd 'cargo' args endfunction function! s:nearest_cargo(...) abort diff --git a/sources_non_forked/rust.vim/autoload/rust.vim b/sources_non_forked/rust.vim/autoload/rust.vim index 080fa986..e0008ba5 100644 --- a/sources_non_forked/rust.vim/autoload/rust.vim +++ b/sources_non_forked/rust.vim/autoload/rust.vim @@ -1,4 +1,3 @@ -" Author: Kevin Ballard " Description: Helper functions for Rust commands/mappings " Last Modified: May 27, 2014 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim @@ -508,16 +507,23 @@ function! s:SearchTestFunctionNameUnderCursor() abort return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*') endfunction -function! rust#Test(all, options) abort +function! rust#Test(mods, winsize, all, options) abort let manifest = findfile('Cargo.toml', expand('%:p:h') . ';') if manifest ==# '' return rust#Run(1, '--test ' . a:options) endif + " defaults to 0, but we prefer an empty string + let winsize = a:winsize ? a:winsize : '' + if has('terminal') - let cmd = 'terminal ' + if has('patch-8.0.910') + let cmd = printf('%s noautocmd %snew | terminal ++curwin ', a:mods, winsize) + else + let cmd = printf('%s terminal ', a:mods) + endif elseif has('nvim') - let cmd = 'noautocmd new | terminal ' + let cmd = printf('%s noautocmd %snew | terminal ', a:mods, winsize) else let cmd = '!' let manifest = shellescape(manifest) diff --git a/sources_non_forked/rust.vim/doc/rust.txt b/sources_non_forked/rust.vim/doc/rust.txt index 2111e5ad..9ab018ed 100644 --- a/sources_non_forked/rust.vim/doc/rust.txt +++ b/sources_non_forked/rust.vim/doc/rust.txt @@ -426,12 +426,15 @@ functionality from other plugins. Running test(s) --------------- -:RustTest[!] [options] *:RustTest* +:[N]RustTest[!] [options] *:RustTest* Runs a test under the cursor when the current buffer is in a cargo project with "cargo test" command. If the command did not find any test function under the cursor, it stops with an error message. + When N is given, adjust the size of the new window to N lines + or columns. + When ! is given, runs all tests regardless of current cursor position. @@ -444,7 +447,11 @@ Running test(s) is no way to run specific test function with rustc. [options] is passed to "rustc" command arguments in the case. - + Takes optional modifiers (see ||): > + :tab RustTest + :belowright 16RustTest + :leftabove vert 80RustTest +< rust.vim Debugging ------------------ diff --git a/sources_non_forked/rust.vim/ftplugin/rust.vim b/sources_non_forked/rust.vim/ftplugin/rust.vim index d851a7a6..ac1b438a 100644 --- a/sources_non_forked/rust.vim/ftplugin/rust.vim +++ b/sources_non_forked/rust.vim/ftplugin/rust.vim @@ -1,7 +1,6 @@ " Language: Rust " Description: Vim ftplugin for Rust " Maintainer: Chris Morgan -" Maintainer: Kevin Ballard " Last Change: June 08, 2016 " For bugs, patches and license go to https://github.com/rust-lang/rust.vim @@ -137,7 +136,7 @@ command! -bar RustInfoToClipboard call rust#debugging#InfoToClipboard() command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile() " See |:RustTest| for docs -command! -buffer -nargs=* -bang RustTest call rust#Test(0, ) +command! -buffer -nargs=* -count -bang RustTest call rust#Test(, , 0, ) if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") let b:rust_last_rustc_args = [] diff --git a/sources_non_forked/rust.vim/indent/rust.vim b/sources_non_forked/rust.vim/indent/rust.vim index 78544989..6edce73f 100644 --- a/sources_non_forked/rust.vim/indent/rust.vim +++ b/sources_non_forked/rust.vim/indent/rust.vim @@ -191,7 +191,12 @@ function GetRustIndent(lnum) " A line that ends with '.;' is probably an end of a long list " of method operations. if prevline =~# '\V\^\s\*.' && l:last_prevline_character ==# ';' - return indent(prevlinenum) - s:shiftwidth() + call cursor(a:lnum - 1, 1) + let l:scope_start = searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') + if l:scope_start != 0 && l:scope_start < a:lnum + return indent(l:scope_start) + 4 + endif endif if l:last_prevline_character ==# "," diff --git a/sources_non_forked/rust.vim/syntax/rust.vim b/sources_non_forked/rust.vim/syntax/rust.vim index 97d3c1cf..423e8fba 100644 --- a/sources_non_forked/rust.vim/syntax/rust.vim +++ b/sources_non_forked/rust.vim/syntax/rust.vim @@ -53,6 +53,7 @@ syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipe syn keyword rustStorage move mut ref static const syn match rustDefault /\/ syn keyword rustAwait await +syn match rustKeyword /\!\@!/ display syn keyword rustPubScopeCrate crate contained syn match rustPubScopeDelim /[()]/ contained diff --git a/sources_non_forked/rust.vim/test/indent.vader b/sources_non_forked/rust.vim/test/indent.vader index 1e50a589..91f65806 100644 --- a/sources_non_forked/rust.vim/test/indent.vader +++ b/sources_non_forked/rust.vim/test/indent.vader @@ -225,6 +225,51 @@ Expect rust (issue #5): } } +############################################ +# Issue #366 + +Given rust: + fn f() { + g(|_| { + h(); + }) + .unwrap(); + h(); + } + +Do: + vip= + +Expect rust (issue #366): + fn f() { + g(|_| { + h(); + }) + .unwrap(); + h(); + } + +Given rust: + fn f() { + let a = g(|_| { + h(); + }) + .unwrap(); + h(); + } + +Do: + vip= + +Expect rust (issue #366, variation #2): + fn f() { + let a = g(|_| { + h(); + }) + .unwrap(); + h(); + } + ############################################ Given rust: diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim index 2b0d1ec0..17c285b7 100644 --- a/sources_non_forked/vim-commentary/plugin/commentary.vim +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -54,7 +54,7 @@ function! s:go(...) abort let line = getline(lnum) if strlen(r) > 2 && l.r !~# '\\' let line = substitute(line, - \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], + \'\M' . substitute(l, '\ze\S\s*$', '\\zs\\d\\*\\ze', '') . '\|' . substitute(r, '\S\zs', '\\zs\\d\\*\\ze', ''), \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') endif if uncomment diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 3e501d81..8f25832c 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -1400,10 +1400,11 @@ call s:add_methods('buffer', ['repo', 'type']) function! s:FilterEscape(items, ...) abort let items = copy(a:items) + call map(items, 's:fnameescape(v:val)') if a:0 && type(a:1) == type('') call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1') endif - return map(items, 's:fnameescape(v:val)') + return items endfunction function! s:GlobComplete(lead, pattern) abort @@ -1469,16 +1470,15 @@ function! fugitive#CompleteObject(base, ...) abort let results = [] if a:base =~# '^refs/' let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)') + call map(results, 's:fnameescape(v:val)') elseif a:base !~# '^\.\=/\|^:(' let heads = s:CompleteHeads(dir) if filereadable(fugitive#Find('.git/refs/stash', dir)) let heads += ["stash"] let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0]) endif - call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base') - let results += heads + let results += s:FilterEscape(heads, a:base) endif - call map(results, 's:fnameescape(v:val)') if !empty(tree) let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base) endif @@ -1724,6 +1724,10 @@ function! fugitive#BufReadStatus() abort endwhile endif + if empty(s:Tree()) + let [unstaged, untracked] = [[], []] + endif + for dict in staged let b:fugitive_files['Staged'][dict.filename] = dict endfor @@ -1820,6 +1824,9 @@ function! fugitive#BufReadStatus() abort if push !=# pull call s:AddHeader('Push', push) endif + if empty(s:Tree()) + call s:AddHeader('Bare', 'yes') + endif call s:AddSection('Rebasing ' . rebasing_head, rebasing) call s:AddSection('Untracked', untracked) call s:AddSection('Unstaged', unstaged) @@ -4518,14 +4525,11 @@ endfunction function! s:diffoff_all(dir) abort let curwin = winnr() for nr in range(1,winnr('$')) - if getwinvar(nr,'&diff') + if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore')) if nr != winnr() execute nr.'wincmd w' - let restorewinnr = 1 - endif - if s:Dir() ==# a:dir - call s:diffoff() endif + call s:diffoff() endif endfor execute curwin.'wincmd w' @@ -4626,6 +4630,8 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort elseif arg =~# '^:\d$' exe s:DirCheck() let file = s:Relative(arg . ':') + elseif arg =~# '^[~^]\d*$' + return 'echoerr ' . string('fugitive: change ' . arg . ' to !' . arg . ' to diff against ancestor') else try let file = arg =~# '^:/.' ? fugitive#RevParse(arg) . s:Relative(':') : s:Expand(arg) @@ -5130,12 +5136,10 @@ function! s:BlameJump(suffix, ...) abort let winnr = bufwinnr(blame_bufnr) if winnr > 0 exe winnr.'wincmd w' + exe bufnr.'bdelete' endif execute 'Gedit' s:fnameescape(commit . suffix . ':' . path) execute lnum - if winnr > 0 - exe bufnr.'bdelete' - endif endif if exists(':Gblame') let my_bufnr = bufnr('') diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index be3b99bb..99b78f12 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -181,6 +181,8 @@ function! FugitiveExtractGitDir(path) abort let path = s:Slash(a:path) if path =~# '^fugitive:' return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)') + elseif empty(path) + return '' elseif isdirectory(path) let path = fnamemodify(path, ':p:s?/$??') else diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 370d1f75..8cb86df9 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -18,7 +18,7 @@ Features: * Diffs against index (default) or any commit. * Allows folding all unchanged text. * Provides fold text showing whether folded lines have been changed. -* Can load all hunk locations into quickfix list. +* Can load all hunk locations into quickfix list or the current window's location list. * Handles line endings correctly, even with repos that do CRLF conversion. * Optional line highlighting. * Optional line number highlighting. (Only available in Neovim 0.3.2 or higher) @@ -147,7 +147,7 @@ nmap ]h (GitGutterNextHunk) nmap [h (GitGutterPrevHunk) ``` -You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. +You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. If the option `g:gitgutter_use_location_list` is set, this command will load hunks into the current window's location list instead. You can stage or undo an individual hunk when your cursor is in it: @@ -254,6 +254,7 @@ You can customise: * Whether to clobber or preserve non-gitgutter signs * The priority of gitgutter's signs. * Whether to use a floating/popup window for hunk previews +* Whether to populate the quickfix list or a location list with all hunks Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme. @@ -452,7 +453,12 @@ let g:gitgutter_async = 0 #### To use floating/popup windows for hunk previews -Add `let g:gitgutter_preview_win_floating = 1` to your vimrc. Note that on Vim this prevents you staging (partial) hunks via the preview window. +Add `let g:gitgutter_preview_win_floating = 1` to your `~/.vimrc`. Note that on Vim this prevents you staging (partial) hunks via the preview window. + + +#### To load all hunks into the current window's location list instead of the quickfix list + +Add `let g:gitgutter_use_location_list = 1` to your `~/.vimrc`. ### Extensions @@ -513,9 +519,25 @@ Let's say, for example, you want to remove trailing whitespace from all changed ``` +#### Cycle through hunks in current buffer + +This is like `:GitGutterNextHunk` but when it gets to the last hunk in the buffer it cycles around to the first. + +```viml +function! GitGutterNextHunkCycle() + let line = line('.') + silent! GitGutterNextHunk + if line('.') == line + 1 + GitGutterNextHunk + endif +endfunction +``` + + #### Cycle through hunks in all buffers -You can use `:GitGutterQuickFix` to load all hunks into the quickfix list. +You can use `:GitGutterQuickFix` to load all hunks into the quickfix list or the current window's location list. Alternatively, given that`]c` and `[c` jump from one hunk to the next in the current buffer, you can use this code to jump to the next hunk no matter which buffer it's in. @@ -534,7 +556,7 @@ function! NextHunkAllBuffers() return endif if !empty(GitGutterGetHunks()) - normal! 1G + 1 GitGutterNextHunk return endif diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim index 84c89af4..582ea4b0 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -207,5 +207,9 @@ function! gitgutter#quickfix() let lnum = 0 endif endfor - call setqflist(locations) + if !g:gitgutter_use_location_list + call setqflist(locations) + else + call setloclist(0, locations) + endif endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 2dc01f9c..23805145 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -140,7 +140,9 @@ Commands for jumping between hunks:~ *gitgutter-:GitGutterQuickFix* :GitGutterQuickFix Load all hunks into the |quickfix| list. Note this - ignores any unsaved changes in your buffers. + ignores any unsaved changes in your buffers. The + |g:gitgutter_use_location_list| option can be set to + populate the location list of the current window instead Commands for operating on a hunk:~ @@ -294,6 +296,7 @@ General:~ |g:gitgutter_map_keys| |g:gitgutter_async| |g:gitgutter_log| + |g:gitgutter_use_location_list| *g:gitgutter_preview_win_location* @@ -473,7 +476,7 @@ Controls whether or not the plugin is on at startup. *g:gitgutter_map_keys* Default: 1 -Controls whether or not the plugin provides mappings. See |gitgutter-mapppings|. +Controls whether or not the plugin provides mappings. See |gitgutter-mappings|. *g:gitgutter_async* Default: 1 @@ -487,6 +490,12 @@ Default: 0 When switched on, the plugin logs to gitgutter.log in the directory where it is installed. Additionally it logs channel activity to channel.log. + *g:gitgutter_use_location_list* +Default: 0 + +When switched on, the :GitGutterQuickFix command populates the location list +of the current window instead of the global quickfix list. + =============================================================================== HIGHLIGHTS *gitgutter-highlights* diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index c7073d0a..99e0bd28 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -61,6 +61,7 @@ call s:set('g:gitgutter_map_keys', 1) call s:set('g:gitgutter_terminal_reports_focus', 1) call s:set('g:gitgutter_async', 1) call s:set('g:gitgutter_log', 0) +call s:set('g:gitgutter_use_location_list', 0) call s:set('g:gitgutter_git_executable', 'git') if !executable(g:gitgutter_git_executable) diff --git a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets index ffd76613..22b71901 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets @@ -69,7 +69,7 @@ endsnippet # FIXME: handling literal bracket pair inside of nested tab groups? snippet tcr "Create references column" -t.references :${1:taggable}${2:, polymorphic ${3:{ :default: '${4:Photo}' \}}} +t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}} $0 endsnippet @@ -597,7 +597,7 @@ endsnippet snippet rest "respond_to" respond_to do |wants| - wants.${1:html}${2: { $0 \}} + wants.${1:html}${2: { $0 }} end endsnippet @@ -655,7 +655,7 @@ t.$0 endsnippet snippet t. "t.references (tcr)" -t.references :${1:taggable}${2:, polymorphic ${3:{ :default: '${4:Photo}' \}}} +t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}} t.$0 endsnippet @@ -780,7 +780,7 @@ verify only: [:$1], session: :user, params: :id, redirect_to {:action: '${2:inde endsnippet snippet wants "wants_format" -wants.${1:js|json|html}${2: { $0 \}} +wants.${1:js|json|html}${2: { $0 }} endsnippet snippet xdelete "xhr delete" diff --git a/sources_non_forked/vim-snippets/snippets/fortran.snippets b/sources_non_forked/vim-snippets/snippets/fortran.snippets index e04d4fda..8cb6f9a7 100644 --- a/sources_non_forked/vim-snippets/snippets/fortran.snippets +++ b/sources_non_forked/vim-snippets/snippets/fortran.snippets @@ -1,13 +1,13 @@ snippet impl implicit none - $0 + ${0} snippet prog program ${1:main} - $0 + ${0} end program $1 snippet mod module ${1:modulename} - $0 + ${0} end module $1 snippet proc procedure ${1:name} @@ -25,7 +25,7 @@ snippet doc ! Github: `g:snips_github` ! Description: $1 ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - $0 + ${0} snippet dox !> @brief ${1} !! @@ -37,45 +37,45 @@ snippet doxp # Variables definitions # Boolean snippet bool - logical :: $0 + logical :: ${0} # Integer snippet int - integer :: $0 + integer :: ${0} snippet real - real :: $0 + real :: ${0} # Double Precision snippet double - double precision :: $0 + double precision :: ${0} # Char snippet str character(len=${1:*}) :: ${0:} # Types snippet type type(${1:name}) - $0 + ${0} end type snippet const - ${1:type}, parameter :: $2 = $0 + ${1:type}, parameter :: $2 = ${0} snippet arr - ${1:type}, ${2:allocatable, }dimension(${3::}) :: $0 + ${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0} snippet intent - ${1:type}, intent(inout) :: $0 + ${1:type}, intent(inout) :: ${0} # Array snippet / - (/ $1 /) ${2:,&} $0 + (/ $1 /) ${2:,&} ${0} snippet if if (${1:condition}) then - $0 + ${0} end if snippet case select case (${1:expr}) case ($2) case default $3 - end select $0 + end select ${0} snippet do do ${1:i} = ${2:start}, ${3:end}, ${4:incr} - $0 + ${0} end do snippet dow do while (${1:condition}) @@ -83,21 +83,21 @@ snippet dow end do snippet sub subroutine ${1:name}($2) - $0 + ${0} end subroutine $1 snippet func function ${1:name}($2) result($3) - $0 + ${0} end function $1 snippet pr - write(*,*) $0 + write(*,*) ${0} snippet dpr write(*,*) '$1 = ', $1 snippet read - read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0 + read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0} snippet write - write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0 + write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0} snippet open - open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) $0 + open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) ${0} snippet close - close(unit = ${1:fp}) $0 + close(unit = ${1:fp}) ${0} diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 59092601..303bd2b3 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -447,7 +447,7 @@ function! s:dosurround(...) " {{{1 let keeper = substitute(keeper,'^\s\+','','') let keeper = substitute(keeper,'\s\+$','','') endif - if col("']") == col("$") && col('.') + 1 == col('$') + if col("']") == col("$") && virtcol('.') + 1 == virtcol('$') if oldhead =~# '^\s*$' && a:0 < 2 let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') endif From e4b4276499cea147e6fc1e2be0b96f0c85e22255 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 30 Nov 2019 18:47:48 +0100 Subject: [PATCH 33/91] Disable folding for Markdown It's not super useful. Ref: https://github.com/amix/vimrc/issues/445 --- vimrcs/filetypes.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index a4e17cbd..522bafd6 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -72,3 +72,9 @@ endif " => Twig section """""""""""""""""""""""""""""" autocmd BufRead *.twig set syntax=html filetype=html + + +"""""""""""""""""""""""""""""" +" => Markdown +"""""""""""""""""""""""""""""" +let vim_markdown_folding_disabled = 1 From 5d11b237a39186e51a876389f4658ae04414c4d1 Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 30 Nov 2019 18:51:57 +0100 Subject: [PATCH 34/91] Fix https://github.com/amix/vimrc/issues/453 --- update_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_plugins.py b/update_plugins.py index cbb08b7d..c4ee70a8 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -32,7 +32,7 @@ vim-coffee-script https://github.com/kchmck/vim-coffee-script vim-colors-solarized https://github.com/altercation/vim-colors-solarized vim-indent-object https://github.com/michaeljsmith/vim-indent-object vim-less https://github.com/groenewege/vim-less -vim-markdown https://github.com/tpope/vim-markdown +vim-markdown https://github.com/plasticboy/vim-markdown vim-pyte https://github.com/therubymug/vim-pyte vim-snipmate https://github.com/garbas/vim-snipmate vim-snippets https://github.com/honza/vim-snippets From 010fe6869f1cbbf13719b7eb83c5dfcd16dca63b Mon Sep 17 00:00:00 2001 From: amix Date: Sat, 30 Nov 2019 21:00:26 +0100 Subject: [PATCH 35/91] Fixed the path of vim-markdown in the readme file --- README.md | 2 +- update_plugins.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 4f8ef721..a745031f 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [vim-coffee-script](https://github.com/kchmck/vim-coffee-script) * [vim-less](https://github.com/groenewege/vim-less) * [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako) -* [vim-markdown](https://github.com/tpope/vim-markdown) +* [vim-markdown](https://github.com/plasticboy/vim-markdown) * [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx * [rust.vim](https://github.com/rust-lang/rust.vim) * [vim-ruby](https://github.com/vim-ruby/vim-ruby) diff --git a/update_plugins.py b/update_plugins.py index c4ee70a8..5e14e899 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -32,7 +32,6 @@ vim-coffee-script https://github.com/kchmck/vim-coffee-script vim-colors-solarized https://github.com/altercation/vim-colors-solarized vim-indent-object https://github.com/michaeljsmith/vim-indent-object vim-less https://github.com/groenewege/vim-less -vim-markdown https://github.com/plasticboy/vim-markdown vim-pyte https://github.com/therubymug/vim-pyte vim-snipmate https://github.com/garbas/vim-snipmate vim-snippets https://github.com/honza/vim-snippets From cf9b500ebc9bb74666bdcf622d3f1955167f2ae0 Mon Sep 17 00:00:00 2001 From: amix Date: Sun, 1 Dec 2019 20:18:45 +0100 Subject: [PATCH 36/91] Updated plugins --- .../vim-fugitive/autoload/fugitive.vim | 12 +++--------- .../vim-snippets/UltiSnips/ruby.snippets | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 8f25832c..1cf4e639 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -2429,12 +2429,6 @@ function! s:ExpireStatus(bufnr) abort return '' endfunction -function! FugitiveReloadCheck() abort - let t = b:fugitive_reltime - return [t, reltimestr(reltime(s:last_time, t)), - \ reltimestr(reltime(get(s:last_times, s:cpath(s:Dir()), t), t))] -endfunction - function! s:ReloadWinStatus(...) abort if get(b:, 'fugitive_type', '') !=# 'index' || &modified return @@ -2913,9 +2907,9 @@ function! s:PatchSearchExpr(reverse) abort let pattern = '^[+-]\s*' . escape(substitute(strpart(line, 1), '^\s*\|\s*$', '', ''), '^$.*[]~\') . '\s*$' endif if a:reverse - return '?' . escape(pattern, '/') . "\" + return '?' . escape(pattern, '/?') . "\" else - return '/' . escape(pattern, '/?') . "\" + return '/' . escape(pattern, '/') . "\" endif endif return a:reverse ? '#' : '*' @@ -4821,7 +4815,7 @@ function! s:BlameCommitFileLnum(...) abort let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '') endif let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)') - let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s\+\%(\%( \d\+ \)\@ def initialize ... end end" -class ${1:class_name} +class ${1:`!p snip.rv = snip.basename.title().replace('_', '')`} def initialize(${2:*args}) $0 end @@ -315,7 +315,7 @@ end endsnippet snippet module "module" -module ${1:module_name} +module ${1:`!p snip.rv = snip.basename.title().replace('_', '')`} $0 end endsnippet From 18d96984a028e805215c8a2a6418019efc34c5b7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 1 Dec 2019 11:19:19 -0800 Subject: [PATCH 37/91] Adding update plugins to update section of readme. (#549) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a745031f..657b8b6e 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Just do a git rebase! cd ~/.vim_runtime git pull --rebase + python3 update_plugins.py ## Some screenshots From 901655ef044990ba81cc972bcf63c171e511bafe Mon Sep 17 00:00:00 2001 From: amix Date: Sun, 1 Dec 2019 20:19:59 +0100 Subject: [PATCH 38/91] Removed the Python 3 refernce, should just be the default Python --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 657b8b6e..b7b09cb8 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Just do a git rebase! cd ~/.vim_runtime git pull --rebase - python3 update_plugins.py + python update_plugins.py ## Some screenshots From cb578907012a83789cce83f0e38f03a3716d69e8 Mon Sep 17 00:00:00 2001 From: amix Date: Thu, 12 Dec 2019 23:01:41 +0100 Subject: [PATCH 39/91] Updated plugins --- .../vim-fugitive/autoload/fugitive.vim | 23 +++++++++++++------ .../vim-fugitive/plugin/fugitive.vim | 19 ++++++++++++++- .../vim-gitgutter/plugin/gitgutter.vim | 2 +- sources_non_forked/vim-ruby/indent/ruby.vim | 1 + .../spec/indent/continuations_spec.rb | 9 ++++++++ .../snippets/systemverilog.snippets | 2 +- .../vim-snippets/snippets/verilog.snippets | 20 ++++++++++++++++ 7 files changed, 66 insertions(+), 10 deletions(-) diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 1cf4e639..f29aeac8 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -3489,7 +3489,7 @@ function! s:FinishCommit() abort call setbufvar(buf, 'fugitive_commit_arguments', []) if getbufvar(buf, 'fugitive_commit_rebase') call setbufvar(buf, 'fugitive_commit_rebase', 0) - let s:rebase_continue = s:Dir(buf) + let s:rebase_continue = [s:Dir(buf), 0] endif return s:CommitSubcommand(-1, -1, 0, 0, '', args, s:Dir(buf)) endif @@ -3696,11 +3696,11 @@ function! s:MergeRebase(cmd, bang, mods, args, ...) abort call fugitive#ReloadStatus(dir, 1) if empty(filter(getqflist(),'v:val.valid && v:val.type !=# "I"')) if a:cmd =~# '^rebase' && - \ filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) && \ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) && - \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^e]' + \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^bep]' cclose - return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' + let amend = filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) ? '--amend ' : '' + return 'exe ' . string(mods . 'Gcommit ' . amend . '-n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir)) cclose return mods . 'Gcommit --no-status -n -t '.s:fnameescape(fugitive#Find('.git/MERGE_MSG', dir)) @@ -3758,18 +3758,27 @@ function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort return s:MergeRebase('pull', a:bang, a:mods, a:args) endfunction +function! s:RebaseContinue(arg, ...) abort + let [dir, edit_todo] = a:arg + exe s:MergeRebase('rebase', 0, '', [edit_todo && getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) <= 0 ? '--abort' : '--continue'], dir) +endfunction + augroup fugitive_merge autocmd! autocmd VimLeavePre,BufDelete git-rebase-todo \ if getbufvar(+expand(''), '&bufhidden') ==# 'wipe' | \ call s:RebaseClean(expand('')) | \ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand(''))) == 0 | - \ let s:rebase_continue = FugitiveGitDir(+expand('')) | + \ let s:rebase_continue = [FugitiveGitDir(+expand('')), 1] | \ endif | \ endif autocmd BufEnter * nested \ if exists('s:rebase_continue') | - \ exe s:MergeRebase('rebase', 0, '', [getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', s:rebase_continue)) > 0 ? '--continue' : '--abort'], remove(s:, 'rebase_continue')) | + \ if has('timers') | + \ call timer_start(0, function('s:RebaseContinue', [remove(s:, 'rebase_continue')])) | + \ else | + \ call s:RebaseContinue(remove(s:, 'rebase_continue')) | + \ endif | \ endif augroup END @@ -4393,7 +4402,7 @@ endfunction function! s:AskPassArgs(dir) abort if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && fugitive#GitVersion(1, 8) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(fugitive#Config('core.askPass', a:dir)) + \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(get(fugitive#Config(a:dir), 'core.askpass', [])) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] elseif s:executable('ssh-askpass') diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 99b78f12..fbdb0e9e 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -177,6 +177,23 @@ function! s:Tree(path) abort endif endfunction +function! s:CeilingDirectories() abort + if !exists('s:ceiling_directories') + let s:ceiling_directories = [] + let resolve = 1 + for dir in split($GIT_CEILING_DIRECTORIES, has('win32') ? ';' : ':', 1) + if empty(dir) + let resolve = 0 + elseif resolve + call add(s:ceiling_directories, resolve(dir)) + else + call add(s:ceiling_directories, dir) + endif + endfor + endif + return s:ceiling_directories + get(g:, 'ceiling_directories', []) +endfunction + function! FugitiveExtractGitDir(path) abort let path = s:Slash(a:path) if path =~# '^fugitive:' @@ -203,7 +220,7 @@ function! FugitiveExtractGitDir(path) abort if root =~# '\v^//%([^/]+/?)?$' break endif - if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0 + if index(s:CeilingDirectories(), root) >= 0 break endif if root ==# $GIT_WORK_TREE && FugitiveIsGitDir(env_git_dir) diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index 99e0bd28..1e3cf23f 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -244,7 +244,7 @@ augroup gitgutter autocmd ShellCmdPost * call gitgutter#all(1) autocmd BufLeave term://* call gitgutter#all(1) - autocmd BufWritePost fugitive://*//0/* call gitgutter#all(1) + autocmd User FugitiveChanged call gitgutter#all(1) autocmd BufFilePre * GitGutterBufferDisable autocmd BufFilePost * GitGutterBufferEnable diff --git a/sources_non_forked/vim-ruby/indent/ruby.vim b/sources_non_forked/vim-ruby/indent/ruby.vim index 20f52b9e..bfc32e5a 100644 --- a/sources_non_forked/vim-ruby/indent/ruby.vim +++ b/sources_non_forked/vim-ruby/indent/ruby.vim @@ -64,6 +64,7 @@ let s:syng_strcom = s:syng_stringdoc + [ \ 'PercentStringDelimiter', \ 'PercentSymbolDelimiter', \ 'Regexp', + \ 'RegexpCharClass', \ 'RegexpDelimiter', \ 'RegexpEscape', \ 'StringDelimiter', diff --git a/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb b/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb index 22829d2f..727da7d3 100644 --- a/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb @@ -314,4 +314,13 @@ describe "Indenting" do end EOF end + + specify "wrong continuation within regex character class" do + # See https://github.com/vim-ruby/vim-ruby/issues/405 for details + + assert_correct_indenting <<~EOF + extname = file.extname(url).split(/[?#]/).first + target_file = tempfile.new() + EOF + end end diff --git a/sources_non_forked/vim-snippets/snippets/systemverilog.snippets b/sources_non_forked/vim-snippets/snippets/systemverilog.snippets index 70a9d2d3..f510750d 100644 --- a/sources_non_forked/vim-snippets/snippets/systemverilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/systemverilog.snippets @@ -1,7 +1,7 @@ extends verilog # Foreach Loop -snippet fe +snippet forea foreach (${1}) begin ${0} end diff --git a/sources_non_forked/vim-snippets/snippets/verilog.snippets b/sources_non_forked/vim-snippets/snippets/verilog.snippets index 5cd80f39..df5eeb81 100644 --- a/sources_non_forked/vim-snippets/snippets/verilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/verilog.snippets @@ -61,3 +61,23 @@ snippet mod module ${1:module_name} (${2}); ${0} endmodule +# For +snippet for + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin + ${4} + end +# Forever +snippet forev + forever begin + ${0} + end +# Function +snippet fun + function ${1:void} ${2:name}(${3}); + ${0} + endfunction: $2 +# Task +snippet task + task ${1:name}(${2}); + ${0} + endtask: $1 From b56966e13c90f810c42e93149298198cfebdc5c4 Mon Sep 17 00:00:00 2001 From: amix Date: Mon, 30 Dec 2019 14:28:38 +0100 Subject: [PATCH 40/91] Updated plugins --- sources_non_forked/lightline.vim/.travis.yml | 3 +- sources_non_forked/lightline.vim/README.md | 43 +++++++++- .../lightline.vim/doc/lightline.txt | 78 +++++++++---------- sources_non_forked/nerdtree/CHANGELOG.md | 3 + sources_non_forked/nerdtree/doc/NERDTree.txt | 4 + .../nerdtree/lib/nerdtree/key_map.vim | 2 +- .../nerdtree/lib/nerdtree/menu_item.vim | 8 +- .../nerdtree/lib/nerdtree/notifier.vim | 5 +- .../nerdtree/lib/nerdtree/path.vim | 5 +- sources_non_forked/rust.vim/doc/rust.txt | 15 ++-- sources_non_forked/typescript-vim/README.md | 7 +- .../typescript-vim/syntax/typescript.vim | 14 ++-- .../vim-fugitive/autoload/fugitive.vim | 4 +- .../vim-fugitive/plugin/fugitive.vim | 3 + .../vim-snippets/UltiSnips/puppet.snippets | 3 +- .../vim-snippets/UltiSnips/sh.snippets | 32 ++++---- 16 files changed, 145 insertions(+), 84 deletions(-) diff --git a/sources_non_forked/lightline.vim/.travis.yml b/sources_non_forked/lightline.vim/.travis.yml index 9c8184a2..e7e41c51 100644 --- a/sources_non_forked/lightline.vim/.travis.yml +++ b/sources_non_forked/lightline.vim/.travis.yml @@ -16,8 +16,7 @@ cache: - $HOME/vim-$VIM_VERSION env: - - VIM_VERSION=8.1.1775 - - VIM_VERSION=8.1.1700 + - VIM_VERSION=8.2.0000 - VIM_VERSION=8.1.0000 - VIM_VERSION=8.0.0000 - VIM_VERSION=7.4 diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index d47c02eb..f4061bd5 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -87,6 +87,13 @@ For screenshots of all available colorshemes, see [this file](colorscheme.md). 2. Install with `:PlugInstall`. +### [dein.vim](https://github.com/Shougo/dein.vim) +1. Add the following configuration to your `.vimrc`. + + call dein#add('itchyny/lightline.vim') + +2. Install with `:call dein#install()` + ## Introduction After installing this plugin, you restart the editor and will get a cool statusline. ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/1.png) @@ -323,7 +330,7 @@ let g:lightline = { \ } function! LightlineMode() - return expand('%:t') ==# '__Tagbar__' ? 'Tagbar': + return expand('%:t') =~# '^__Tagbar__' ? 'Tagbar': \ expand('%:t') ==# 'ControlP' ? 'CtrlP' : \ &filetype ==# 'unite' ? 'Unite' : \ &filetype ==# 'vimfiler' ? 'VimFiler' : @@ -377,6 +384,40 @@ endfunction You can control the visibility and contents by writing simple functions. Now you notice how much function component is important for the configurability of lightline.vim. +### more tips +#### Mode names are too long. Can I use shorter mode names? +Yes, configure `g:lightline.mode_map`. +```vim +let g:lightline = { + \ 'mode_map': { + \ 'n' : 'N', + \ 'i' : 'I', + \ 'R' : 'R', + \ 'v' : 'V', + \ 'V' : 'VL', + \ "\": 'VB', + \ 'c' : 'C', + \ 's' : 'S', + \ 'S' : 'SL', + \ "\": 'SB', + \ 't': 'T', + \ }, + \ } +``` + +#### How can I truncate the components from the right in narrow windows? +Please include `%<` to one of the right components. +```vim +let g:lightline = { + \ 'component': { + \ 'lineinfo': '%3l:%-2v%<', + \ }, + \ } +``` + +#### Where can I find the default components? +See `:h g:lightline.component`. + ## Note for developers of other plugins Appearance consistency matters. diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index cf64523b..5bb51eee 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2019/08/14 10:46:55. +Last Change: 2019/12/27 18:23:29. CONTENTS *lightline-contents* @@ -674,11 +674,11 @@ In order to define your own component: \ } \ } function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineReadonly() return &ft !~? 'help' && &readonly ? 'RO' : '' @@ -728,18 +728,18 @@ A nice example for non-patched font users. \ } \ } function! LightlineModified() - return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft =~# 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : '' endfunction function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() if &ft !~? 'vimfiler' && exists('*fugitive#head') @@ -763,18 +763,18 @@ A nice example for |vim-powerline| font users: \ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ } function! LightlineModified() - return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft =~# 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : '' endfunction function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() if &ft !~? 'vimfiler' && exists('*fugitive#head') @@ -815,7 +815,7 @@ For users who uses lots of plugins: \ } function! LightlineModified() - return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft ==# 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() @@ -824,15 +824,14 @@ For users who uses lots of plugins: function! LightlineFilename() let fname = expand('%:t') - return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item : - \ fname == '__Tagbar__' ? g:lightline.fname : - \ fname =~ '__Gundo\|NERD_tree' ? '' : - \ &ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ ('' != fname ? fname : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return fname ==# 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item : + \ fname =~# '^__Tagbar__\|__Gundo\|NERD_tree' ? '' : + \ &ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (fname !=# '' ? fname : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() @@ -861,19 +860,19 @@ For users who uses lots of plugins: function! LightlineMode() let fname = expand('%:t') - return fname == '__Tagbar__' ? 'Tagbar' : - \ fname == 'ControlP' ? 'CtrlP' : - \ fname == '__Gundo__' ? 'Gundo' : - \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : - \ fname =~ 'NERD_tree' ? 'NERDTree' : - \ &ft == 'unite' ? 'Unite' : - \ &ft == 'vimfiler' ? 'VimFiler' : - \ &ft == 'vimshell' ? 'VimShell' : + return fname =~# '^__Tagbar__' ? 'Tagbar' : + \ fname ==# 'ControlP' ? 'CtrlP' : + \ fname ==# '__Gundo__' ? 'Gundo' : + \ fname ==# '__Gundo_Preview__' ? 'Gundo Preview' : + \ fname =~# 'NERD_tree' ? 'NERDTree' : + \ &ft ==# 'unite' ? 'Unite' : + \ &ft ==# 'vimfiler' ? 'VimFiler' : + \ &ft ==# 'vimshell' ? 'VimShell' : \ winwidth(0) > 60 ? lightline#mode() : '' endfunction function! CtrlPMark() - if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item') + if expand('%:t') ==# 'ControlP' && has_key(g:lightline, 'ctrlp_item') call lightline#link('iR'[g:lightline.ctrlp_regex]) return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item \ , g:lightline.ctrlp_next], 0) @@ -902,7 +901,6 @@ For users who uses lots of plugins: let g:tagbar_status_func = 'TagbarStatusFunc' function! TagbarStatusFunc(current, sort, fname, ...) abort - let g:lightline.fname = a:fname return lightline#statusline(0) endfunction diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index fe5d51aa..cec006c9 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -7,6 +7,9 @@ in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.4 +- **.1**: Ensure backward compatibility. v:t_func is not available before Vim 8.0 (Phil Runninger) +- **.0**: Allow use of function references as callbacks (HiPhish) [#1067](https://github.com/scrooloose/nerdtree/pull/1067) #### 6.3 - **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060) #### 6.2 diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index e88a6802..be0011d2 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1315,6 +1315,10 @@ following code conventions are used: See this blog post for more details: http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html +A number of API functions take a callback argument to call. The callback can +be either a string with the name of a function to call, or a |Funcref| object +which will be called directly. + ------------------------------------------------------------------------------ 4.1. Key map API *NERDTreeKeymapAPI* diff --git a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim index 584da1f1..6714ee41 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim @@ -66,7 +66,7 @@ endfunction "FUNCTION: KeyMap.invoke() {{{1 "Call the KeyMaps callback function function! s:KeyMap.invoke(...) - let Callback = function(self.callback) + let Callback = type(self.callback) == type(function("tr")) ? self.callback : function(self.callback) if a:0 call Callback(a:1) else diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim index 92c1bbbf..8a74bb1a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim @@ -79,7 +79,7 @@ endfunction "specified function! s:MenuItem.enabled() if self.isActiveCallback != -1 - return {self.isActiveCallback}() + return type(self.isActiveCallback) == type(function("tr")) ? self.isActiveCallback() : {self.isActiveCallback}() endif return 1 endfunction @@ -94,7 +94,11 @@ function! s:MenuItem.execute() call mc.showMenu() else if self.callback != -1 - call {self.callback}() + if type(self.callback) == type(function("tr")) + call self.callback() + else + call {self.callback}() + endif endif endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim index d24fc8f8..dfd48b33 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -14,8 +14,9 @@ endfunction function! s:Notifier.NotifyListeners(event, path, nerdtree, params) let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params) - for listener in s:Notifier.GetListenersForEvent(a:event) - call {listener}(event) + for Listener in s:Notifier.GetListenersForEvent(a:event) + let Callback = type(Listener) == type(function("tr")) ? Listener : function(Listener) + call Callback(event) endfor endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index ccb94238..4ececf9e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -500,8 +500,9 @@ function! s:Path.ignore(nerdtree) endif endfor - for callback in g:NERDTree.PathFilters() - if {callback}({'path': self, 'nerdtree': a:nerdtree}) + for Callback in g:NERDTree.PathFilters() + let Callback = type(Callback) == type(function("tr")) ? Callback : function(Callback) + if Callback({'path': self, 'nerdtree': a:nerdtree}) return 1 endif endfor diff --git a/sources_non_forked/rust.vim/doc/rust.txt b/sources_non_forked/rust.vim/doc/rust.txt index 9ab018ed..c3efb461 100644 --- a/sources_non_forked/rust.vim/doc/rust.txt +++ b/sources_non_forked/rust.vim/doc/rust.txt @@ -128,15 +128,14 @@ g:rustfmt_autosave~ *g:rustfmt_autosave_if_config_present* g:rustfmt_autosave_if_config_present~ - Set this option to 1 to to have *b:rustfmt_autosave* be set automatically - if a `rustfmt.toml` file is present in any parent directly leading to + Set this option to 1 to have *b:rustfmt_autosave* be set automatically + if a `rustfmt.toml` file is present in any parent directly leading to the file being edited. If not set, default to 0: > - let g:rustfmt_autosave_if_config_present = 0 < This is useful to have `rustfmt` only execute on save, on projects that have `rustfmt.toml` configuration. - + There is also a buffer-local b:rustfmt_autosave_if_config_present that can be set for the same purpose, which can overrides the global setting. @@ -161,6 +160,7 @@ g:rustfmt_emit_files~ provided) instead of '--write-mode=overwrite'. > let g:rustfmt_emit_files = 0 + *g:rust_playpen_url* g:rust_playpen_url~ Set this option to override the url for the playpen to use: > @@ -192,9 +192,9 @@ Integration with Syntastic *rust-syntastic* -------------------------- This plugin automatically integrates with the Syntastic checker. There are two -checkers provided: 'rustc', and 'cargo'. The later invokes 'Cargo' in order to +checkers provided: 'rustc', and 'cargo'. The latter invokes 'Cargo' in order to build code, and the former delivers a single edited '.rs' file as a compilation -target directly to the Rust compiler, `rustc`. +target directly to the Rust compiler, `rustc`. Because Cargo is almost exclusively being used for building Rust code these days, 'cargo' is the default checker. > @@ -354,7 +354,8 @@ Playpen integration |g:rust_clip_command| is the command to run to copy the playpen url to the clipboard of your system. -Evaulation of a single Rust file + +Evaluation of a single Rust file -------------------------------- NOTE: These commands are useful only when working with standalone Rust files, diff --git a/sources_non_forked/typescript-vim/README.md b/sources_non_forked/typescript-vim/README.md index fdce308d..c4873812 100644 --- a/sources_non_forked/typescript-vim/README.md +++ b/sources_non_forked/typescript-vim/README.md @@ -11,11 +11,16 @@ and other features for TypeScript editing. Install ------- -From Vim 8 onward, the plugin can be installed as simply as: +From Vim 8 onward, the plugin can be installed as simply as (Unix/Mac): ``` git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/pack/typescript/start/typescript-vim ``` +On Windows/Powershell, use the following: +``` +git clone https://github.com/leafgarland/typescript-vim.git $home/vimfiles/pack/typescript/start/typescript-vim +``` + For older versions of Vim, the simplest way to install is via a Vim add-in manager such as [Plug](https://github.com/junegunn/vim-plug), [Vundle](https://github.com/gmarik/vundle) or diff --git a/sources_non_forked/typescript-vim/syntax/typescript.vim b/sources_non_forked/typescript-vim/syntax/typescript.vim index 09f2ef68..705016d1 100644 --- a/sources_non_forked/typescript-vim/syntax/typescript.vim +++ b/sources_non_forked/typescript-vim/syntax/typescript.vim @@ -87,22 +87,22 @@ syntax keyword typescriptPrototype contained prototype """""""""""""""""""""""" if get(g:, 'typescript_ignore_browserwords', 0) syntax keyword typescriptBrowserObjects window navigator screen history location - + syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName - + syntax keyword typescriptAjaxObjects XMLHttpRequest syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader - + syntax keyword typescriptPropietaryObjects ActiveXObject syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue - + syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title - + syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item - + syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation endif " }}} @@ -267,7 +267,7 @@ if version >= 508 || !exists("did_typescript_syn_inits") HiLink typescriptStorageClass StorageClass HiLink typescriptRepeat Repeat HiLink typescriptStatement Statement - HiLink typescriptFuncKeyword Function + HiLink typescriptFuncKeyword Keyword HiLink typescriptMessage Keyword HiLink typescriptDeprecated Exception HiLink typescriptError Error diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index f29aeac8..302d074b 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -934,7 +934,7 @@ function! fugitive#Find(object, ...) abort let commit = matchstr(s:ChompDefault('', [dir, 'merge-base'] + commits + ['--']), '\<[0-9a-f]\{40,\}\>') endif if commit !~# '^[0-9a-f]\{40,\}$' - let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit, '--']), '\<[0-9a-f]\{40,\}\>') + let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit . (len(file) ? '^{}' : ''), '--']), '\<[0-9a-f]\{40,\}\>') endif if len(commit) let f = 'fugitive://' . dir . '//' . commit . file @@ -1559,7 +1559,7 @@ function! s:ReplaceCmd(cmd) abort endtry call delete(temp) if s:cpath(fnamemodify(bufname('$'), ':p'), temp) - silent execute 'bwipeout '.bufnr('$') + silent! execute 'bwipeout '.bufnr('$') endif endtry endfunction diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index fbdb0e9e..e98f437d 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -304,6 +304,9 @@ function! s:ProjectionistDetect() abort endif endfunction +if v:version + has('patch061') < 703 + runtime! autoload/fugitive.vim +endif let g:io_fugitive = { \ 'simplify': function('fugitive#simplify'), \ 'resolve': function('fugitive#resolve'), diff --git a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets index 7b39094c..eacc8fc8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets @@ -67,7 +67,8 @@ endsnippet snippet exec "Exec resource type" b exec { '${1:command}': - refreshonly => true, + command => "${2:$1}", + user => "${3:root}", } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets index 9bacc725..37bf0c4f 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets @@ -29,14 +29,14 @@ snippet #! "#!/usr/bin/env (!env)" b `!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n" ` endsnippet -snippet sbash "safe bash options" +snippet sbash "safe bash options" b #!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' `!p snip.rv ='\n\n' ` endsnippet -snippet temp "Tempfile" +snippet temp "Tempfile" b ${1:TMPFILE}="$(mktemp -t ${3:--suffix=${4:.SUFFIX}} ${2:`!p snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled" `}.XXXXXX)" @@ -44,27 +44,27 @@ ${5:${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'}${6/(.+)/" 0 # EXIT\ endsnippet -snippet case "case .. esac (case)" +snippet /case|sw(itch)?/ "case .. esac (case)" rb case ${1:word} in ${2:pattern} ) - $0;; + ${0:${VISUAL}};; esac endsnippet -snippet elif "elif .. (elif)" +snippet elif "elif .. (elif)" b elif ${2:[[ ${1:condition} ]]}; then - ${0:#statements} + ${0:${VISUAL}} endsnippet -snippet for "for ... done (for)" +snippet for "for ... done (for)" b for (( i = 0; i < ${1:10}; i++ )); do - ${0:#statements} + ${0:${VISUAL}} done endsnippet -snippet forin "for ... in ... done (forin)" +snippet forin "for ... in ... done (forin)" b for ${1:i}${2/.+/ in /}${2:words}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet @@ -74,21 +74,21 @@ snippet here "here document (here)" ${1/['"`](.+)['"`]/$1/} endsnippet -snippet if "if ... then (if)" +snippet if "if ... then (if)" b if ${2:[[ ${1:condition} ]]}; then - ${0:#statements} + ${0:${VISUAL}} fi endsnippet -snippet until "until ... (done)" +snippet until "until ... (done)" b until ${2:[[ ${1:condition} ]]}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet -snippet while "while ... (done)" +snippet /wh(ile)?/ "while ... (done)" rb while ${2:[[ ${1:condition} ]]}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet From 46195e4ca4d732b9e0c0cac1602f19fe1f5e9ea4 Mon Sep 17 00:00:00 2001 From: Amir Date: Tue, 7 Jan 2020 13:45:07 +0100 Subject: [PATCH 41/91] Updated plugins --- .../ale/ale_linters/graphql/eslint.vim | 2 +- .../ale/ale_linters/python/mypy.vim | 23 +- .../ale/autoload/ale/completion.vim | 7 +- .../ale/autoload/ale/handlers/eslint.vim | 13 +- sources_non_forked/ale/autoload/ale/hover.vim | 10 + sources_non_forked/ale/doc/ale-python.txt | 30 +- sources_non_forked/ale/doc/ale.txt | 22 +- sources_non_forked/ale/plugin/ale.vim | 3 + .../rplugin/python3/deoplete/sources/ale.py | 22 +- .../nerdtree/.github/workflows/vint.yml | 15 + sources_non_forked/nerdtree/.vintrc.yaml | 5 + sources_non_forked/nerdtree/CHANGELOG.md | 266 ++++++------- sources_non_forked/nerdtree/README.markdown | 18 +- sources_non_forked/nerdtree/_config.yml | 1 + .../nerdtree/autoload/nerdtree.vim | 76 ++-- .../nerdtree/autoload/nerdtree/ui_glue.vim | 260 ++++++------ sources_non_forked/nerdtree/doc/NERDTree.txt | 8 +- .../nerdtree/lib/nerdtree/bookmark.vim | 44 +-- .../nerdtree/lib/nerdtree/creator.vim | 42 +- .../nerdtree/lib/nerdtree/flag_set.vim | 4 +- .../nerdtree/lib/nerdtree/key_map.vim | 24 +- .../nerdtree/lib/nerdtree/menu_controller.vim | 42 +- .../nerdtree/lib/nerdtree/menu_item.vim | 10 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 42 +- .../nerdtree/lib/nerdtree/notifier.vim | 4 +- .../nerdtree/lib/nerdtree/opener.vim | 70 ++-- .../nerdtree/lib/nerdtree/path.vim | 86 ++-- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 90 ++--- .../nerdtree/lib/nerdtree/tree_file_node.vim | 14 +- .../nerdtree/lib/nerdtree/ui.vim | 178 ++++----- .../nerdtree_plugin/exec_menuitem.vim | 6 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 148 +++---- .../nerdtree/nerdtree_plugin/vcs.vim | 8 +- .../nerdtree/plugin/NERD_tree.vim | 188 ++++----- .../nerdtree/syntax/nerdtree.vim | 6 +- .../vim-fugitive/autoload/fugitive.vim | 369 ++++++++++++++++-- .../vim-fugitive/doc/fugitive.txt | 16 +- sources_non_forked/vim-gitgutter/README.mkd | 8 +- .../vim-gitgutter/doc/gitgutter.txt | 5 +- .../vim-snippets/UltiSnips/octave.snippets | 2 + .../vim-snippets/snippets/octave.snippets | 2 + .../vim-snippets/snippets/pandoc.snippets | 2 + 42 files changed, 1299 insertions(+), 892 deletions(-) create mode 100644 sources_non_forked/nerdtree/.github/workflows/vint.yml create mode 100644 sources_non_forked/nerdtree/.vintrc.yaml create mode 100644 sources_non_forked/nerdtree/_config.yml create mode 100644 sources_non_forked/vim-snippets/UltiSnips/octave.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/octave.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/pandoc.snippets diff --git a/sources_non_forked/ale/ale_linters/graphql/eslint.vim b/sources_non_forked/ale/ale_linters/graphql/eslint.vim index 654b8c17..aed1a371 100644 --- a/sources_non_forked/ale/ale_linters/graphql/eslint.vim +++ b/sources_non_forked/ale/ale_linters/graphql/eslint.vim @@ -5,5 +5,5 @@ call ale#linter#Define('graphql', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'command': function('ale#handlers#eslint#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index dc4044e6..94dfae7d 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -3,6 +3,7 @@ call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) +call ale#Set('python_mypy_show_notes', 1) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) @@ -18,6 +19,15 @@ endfunction " The directory to change to before running mypy function! s:GetDir(buffer) abort + " If we find a directory with "mypy.ini" in it use that, + " else try and find the "python project" root, or failing + " that, run from the same folder as the current file + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + if filereadable(l:path . '/mypy.ini') + return l:path + endif + endfor + let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) @@ -51,7 +61,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort " Lines like these should be ignored below: " " file.py:4: note: (Stub files are from https://github.com/python/typeshed) - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$' + + let l:types = 'error|warning' + + if ale#Var(a:buffer, 'python_mypy_show_notes') + let l:types = 'error|warning|note' + endif + + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (' + \ . l:types + \ . '): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -65,7 +84,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'), \ 'text': l:match[5], \}) endfor diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index da24e839..80684a30 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -261,6 +261,8 @@ function! s:ReplaceCompletionOptions() abort if &l:completeopt =~# 'preview' let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' + elseif &l:completeopt =~# 'popup' + let &l:completeopt = 'menu,menuone,popup,noselect,noinsert' else let &l:completeopt = 'menu,menuone,noselect,noinsert' endif @@ -386,7 +388,6 @@ function! s:CompletionStillValid(request_id) abort \&& b:ale_completion_info.line == l:line \&& ( \ b:ale_completion_info.column == l:column - \ || b:ale_completion_info.source is# 'deoplete' \ || b:ale_completion_info.source is# 'ale-omnifunc' \ || b:ale_completion_info.source is# 'ale-callback' \) @@ -803,7 +804,9 @@ endfunction function! ale#completion#HandleUserData(completed_item) abort let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') - if l:source isnot# 'ale-automatic' && l:source isnot# 'ale-manual' && l:source isnot# 'ale-callback' + if l:source isnot# 'ale-automatic' + \&& l:source isnot# 'ale-manual' + \&& l:source isnot# 'ale-callback' return endif diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index 7ef63785..156b939f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -42,7 +42,18 @@ function! ale#handlers#eslint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'javascript_eslint_options') - return ale#node#Executable(a:buffer, l:executable) + " ESLint 6 loads plugins/configs/parsers from the project root + " By default, the project root is simply the CWD of the running process. + " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md + " https://github.com/dense-analysis/ale/issues/2787 + " Identify project root from presence of node_modules dir. + " Note: If node_modules not present yet, can't load local deps anyway. + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') + let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + let l:cd_command = !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : '' + + return l:cd_command + \ . ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f json --stdin --stdin-filename %s' endfunction diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 2af35aa4..8fdd288c 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -42,6 +42,11 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort \&& exists('*balloon_show') \&& ale#Var(l:options.buffer, 'set_balloons') call balloon_show(a:response.body.displayString) + elseif g:ale_hover_to_preview + call ale#preview#Show(split(a:response.body.displayString, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) else call ale#util#ShowMessage(a:response.body.displayString) endif @@ -98,6 +103,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort \&& exists('*balloon_show') \&& ale#Var(l:options.buffer, 'set_balloons') call balloon_show(l:str) + elseif g:ale_hover_to_preview + call ale#preview#Show(split(l:str, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) else call ale#util#ShowMessage(l:str) endif diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index 9d5846d2..93f1d668 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -145,8 +145,8 @@ g:ale_python_black_use_global *g:ale_python_black_use_global* See |ale-integrations-local-executables| -g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* - *b:ale_python_black_auto_pipenv* +g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* + *b:ale_python_black_auto_pipenv* Type: |Number| Default: `0` @@ -263,6 +263,15 @@ to check for errors while you type. `mypy` will be run from a detected project root, per |ale-python-root|. +g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* + *b:ale_python_mypy_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + g:ale_python_mypy_executable *g:ale_python_mypy_executable* *b:ale_python_mypy_executable* Type: |String| @@ -272,6 +281,7 @@ g:ale_python_mypy_executable *g:ale_python_mypy_executable* Set this to `'pipenv'` to invoke `'pipenv` `run` `mypy'`. + g:ale_python_mypy_ignore_invalid_syntax *g:ale_python_mypy_ignore_invalid_syntax* *b:ale_python_mypy_ignore_invalid_syntax* @@ -292,6 +302,14 @@ g:ale_python_mypy_options *g:ale_python_mypy_options* invocation. +g:ale_python_mypy_show_notes *g:ale_python_mypy_show_notes* + *b:ale_python_mypy_show_notes* + Type: |Number| + Default: `1` + + If enabled, notes on lines will be displayed as 'I' (info) messages. + + g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* *b:ale_python_mypy_use_global* Type: |Number| @@ -300,14 +318,6 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* See |ale-integrations-local-executables| -g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* - *b:ale_python_mypy_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. - =============================================================================== prospector *ale-python-prospector* diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 847a9777..eafbc119 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -432,6 +432,11 @@ vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < + +Or alternatively, if you want to show documentation in popups: > + + set completeopt=menu,menuone,popup,noselect,noinsert +< *ale-symbols* ALE provides a set of basic completion symbols. If you want to replace those @@ -525,6 +530,9 @@ the mouse over a symbol in a buffer. Diagnostic information will take priority over hover information for balloons. If a line contains a problem, that problem will be displayed in a balloon instead of hover information. +Hover information can be displayed in the preview window instead by setting +|g:ale_hover_to_preview| to `1`. + For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling |balloonexpr| commands in terminals can cause scrolling issues in terminals, so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to @@ -1023,6 +1031,16 @@ g:ale_history_log_output *g:ale_history_log_output* if you want to save on some memory usage. +g:ale_hover_to_preview *g:ale_hover_to_preview* + *b:ale_hover_to_preview* + + Type: |Number| + Default: `0` + + If set to `1`, hover messages will be displayed in the preview window, + instead of in balloons or the message line. + + g:ale_keep_list_window_open *g:ale_keep_list_window_open* *b:ale_keep_list_window_open* Type: |Number| @@ -1337,7 +1355,7 @@ b:ale_loclist_msg_format *b:ale_loclist_msg_format* The strings for configuring `%severity%` are also used for this option. -g:ale_lsp_show_message_format *g:ale_lsp_show_message_format* +g:ale_lsp_show_message_format *g:ale_lsp_show_message_format* Type: |String| Default: `'%severity%:%linter%: %s'` @@ -1359,7 +1377,7 @@ g:ale_lsp_show_message_format *g:ale_lsp_show_message_ separately for each buffer like |g:ale_echo_msg_format| can. -g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* +g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* Type: |String| Default: `'error'` diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index 1912a9c0..8fea3bb4 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -125,6 +125,9 @@ let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) " This flag can be set to 0 to disable balloon support. let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running')) +" Use preview window for hover messages. +let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0) + " This flag can be set to 0 to disable warnings for trailing whitespace let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1) " This flag can be set to 0 to disable warnings for trailing blank lines diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py index 3955ed2d..ae1f4039 100644 --- a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -24,6 +24,7 @@ class Source(Base): self.rank = 1000 self.is_bytepos = True self.min_pattern_length = 1 + self.is_volatile = True # Do not forget to update s:trigger_character_map in completion.vim in # updating entries in this map. self.input_patterns = { @@ -44,21 +45,16 @@ class Source(Base): if not self.vim.call('ale#completion#CanProvideCompletions'): return None - if context.get('is_refresh'): - context['is_async'] = False + event = context.get('event') - if context['is_async']: - # Result is the same as for omnifunc, or None. + if event == 'Async': result = self.vim.call('ale#completion#GetCompletionResult') + return result or [] - if result is not None: - context['is_async'] = False - - return result - else: - context['is_async'] = True - - # Request some completion results. - self.vim.call('ale#completion#GetCompletions', 'deoplete') + if context.get('is_refresh'): + self.vim.command( + "call ale#completion#GetCompletions('ale-callback', " + \ + "{'callback': {completions -> deoplete#auto_complete() }})" + ) return [] diff --git a/sources_non_forked/nerdtree/.github/workflows/vint.yml b/sources_non_forked/nerdtree/.github/workflows/vint.yml new file mode 100644 index 00000000..36d72580 --- /dev/null +++ b/sources_non_forked/nerdtree/.github/workflows/vint.yml @@ -0,0 +1,15 @@ +name: Vint +on: [push, pull_request] +jobs: + vint: + strategy: + fail-fast: false + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Run vint with reviewdog + uses: reviewdog/action-vint@v1.0.1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review diff --git a/sources_non_forked/nerdtree/.vintrc.yaml b/sources_non_forked/nerdtree/.vintrc.yaml new file mode 100644 index 00000000..c44b6aba --- /dev/null +++ b/sources_non_forked/nerdtree/.vintrc.yaml @@ -0,0 +1,5 @@ +cmdargs: + severity: style_problem + color: true + env: + neovim: false diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index cec006c9..c8989ef3 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -8,152 +8,154 @@ - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> #### 6.4 +- **.3**: Fix regex that finds keyword for minimal menu. (PhilRunninger) [#1075](https://github.com/preservim/nerdtree/pull/1075) +- **.2**: Lint vimscript, fix errors and warnings, add CI job to review PRs (Caleb Maclennan) [#1071](https://github.com/preservim/nerdtree/pull/1071) - **.1**: Ensure backward compatibility. v:t_func is not available before Vim 8.0 (Phil Runninger) -- **.0**: Allow use of function references as callbacks (HiPhish) [#1067](https://github.com/scrooloose/nerdtree/pull/1067) +- **.0**: Allow use of function references as callbacks (HiPhish) [#1067](https://github.com/preservim/nerdtree/pull/1067) #### 6.3 -- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060) +- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/preservim/nerdtree/pull/1060) #### 6.2 -- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056) -- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032) +- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/preservim/nerdtree/pull/1056) +- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/preservim/nerdtree/pull/1032) #### 6.1 -- **.4**: Add VIM built-in package management to read me file. (pesarkhobeee) [#1049](https://github.com/scrooloose/nerdtree/pull/1049) -- **.3**: Save/Set screen state also on WinLeave and WinEnter. (PhilRunninger) [#1048](https://github.com/scrooloose/nerdtree/pull/1048) -- **.2**: Wrap saveScreenState's statements in a try-catch block. (PhilRunninger) [#1047](https://github.com/scrooloose/nerdtree/pull/1047) -- **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/scrooloose/nerdtree/pull/1045) -- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043) +- **.4**: Add VIM built-in package management to read me file. (pesarkhobeee) [#1049](https://github.com/preservim/nerdtree/pull/1049) +- **.3**: Save/Set screen state also on WinLeave and WinEnter. (PhilRunninger) [#1048](https://github.com/preservim/nerdtree/pull/1048) +- **.2**: Wrap saveScreenState's statements in a try-catch block. (PhilRunninger) [#1047](https://github.com/preservim/nerdtree/pull/1047) +- **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/preservim/nerdtree/pull/1045) +- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/preservim/nerdtree/pull/1043) #### 6.0 -- **.1**: Reintroduce necessary variable mistakenly removed. (PhilRunninger) [#1040](https://github.com/scrooloose/nerdtree/pull/1040) -- **.0**: Make the behavior of window splits consistent (dragonxlwang, PhilRunninger) [#1035](https://github.com/scrooloose/nerdtree/pull/1035) +- **.1**: Reintroduce necessary variable mistakenly removed. (PhilRunninger) [#1040](https://github.com/preservim/nerdtree/pull/1040) +- **.0**: Make the behavior of window splits consistent (dragonxlwang, PhilRunninger) [#1035](https://github.com/preservim/nerdtree/pull/1035) #### 5.3 -- **.3**: Fix (p)ath not displaying in the minimal menu (tuzz) [#1038](https://github.com/scrooloose/nerdtree/pull/1038) -- **.2**: Enable events when closing NerdTree window. (PhilRunninger) [#1037](https://github.com/scrooloose/nerdtree/pull/1037) -- **.1**: Fix the `e` key mapping to use netrw if desired (PhilRunninger) [#1031](https://github.com/scrooloose/nerdtree/pull/1031) -- **.0**: Add file extension and size to sorting capabilities (PhilRunninger) [#1029](https://github.com/scrooloose/nerdtree/pull/1029) +- **.3**: Fix (p)ath not displaying in the minimal menu (tuzz) [#1038](https://github.com/preservim/nerdtree/pull/1038) +- **.2**: Enable events when closing NerdTree window. (PhilRunninger) [#1037](https://github.com/preservim/nerdtree/pull/1037) +- **.1**: Fix the `e` key mapping to use netrw if desired (PhilRunninger) [#1031](https://github.com/preservim/nerdtree/pull/1031) +- **.0**: Add file extension and size to sorting capabilities (PhilRunninger) [#1029](https://github.com/preservim/nerdtree/pull/1029) #### 5.2 -- **.9**: Suppress events for intermediate window/tab/buffer changes (PhilRunninger) [#1026](https://github.com/scrooloose/nerdtree/pull/1026) -- **.8**: Revert [#1019](https://github.com/scrooloose/nerdtree/pull/1019) to fix nvim artifacts and flickering. (PhilRunninger) [#1021](https://github.com/scrooloose/nerdtree/pull/1021) -- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! (PhilRunninger) [#1019](https://github.com/scrooloose/nerdtree/pull/1019) -- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. (PhilRunninger) [#1017](https://github.com/scrooloose/nerdtree/pull/1017) -- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/scrooloose/nerdtree/pull/1016) -- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/scrooloose/nerdtree/pull/1015) -- **.3**: Fix `` key map on the bookmark (lkebin) [#1014](https://github.com/scrooloose/nerdtree/pull/1014) -- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) [#1013](https://github.com/scrooloose/nerdtree/pull/1013) +- **.9**: Suppress events for intermediate window/tab/buffer changes (PhilRunninger) [#1026](https://github.com/preservim/nerdtree/pull/1026) +- **.8**: Revert [#1019](https://github.com/preservim/nerdtree/pull/1019) to fix nvim artifacts and flickering. (PhilRunninger) [#1021](https://github.com/preservim/nerdtree/pull/1021) +- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! (PhilRunninger) [#1019](https://github.com/preservim/nerdtree/pull/1019) +- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. (PhilRunninger) [#1017](https://github.com/preservim/nerdtree/pull/1017) +- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/preservim/nerdtree/pull/1016) +- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/preservim/nerdtree/pull/1015) +- **.3**: Fix `` key map on the bookmark (lkebin) [#1014](https://github.com/preservim/nerdtree/pull/1014) +- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) [#1013](https://github.com/preservim/nerdtree/pull/1013) - **.1**: Fix nerdtree#version() on Windows. (PhilRunninger) -- **.0**: Expand functionality of `` mapping. (PhilRunninger) [#1011](https://github.com/scrooloose/nerdtree/pull/1011) +- **.0**: Expand functionality of `` mapping. (PhilRunninger) [#1011](https://github.com/preservim/nerdtree/pull/1011) #### 5.1 -- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) [#1009](https://github.com/scrooloose/nerdtree/pull/1009) -- **.2**: Fix NERDTree opening with the wrong size. (PhilRunninger) [#1008](https://github.com/scrooloose/nerdtree/pull/1008) -- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/scrooloose/nerdtree/pull/1007) +- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) [#1009](https://github.com/preservim/nerdtree/pull/1009) +- **.2**: Fix NERDTree opening with the wrong size. (PhilRunninger) [#1008](https://github.com/preservim/nerdtree/pull/1008) +- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/preservim/nerdtree/pull/1007) - **.0**: Too many changes for one patch... - - Refresh a dir_node if the file wasn't found in it, and look once more. (PhilRunninger) [#1005](https://github.com/scrooloose/nerdtree/pull/1005) - - Add a "copy path to clipboard" menu option (PhilRunninger) [#1002](https://github.com/scrooloose/nerdtree/pull/1002) - - Enable root refresh on "vim ." a different way than [#999](https://github.com/scrooloose/nerdtree/pull/999). (PhilRunninger) [#1001](https://github.com/scrooloose/nerdtree/pull/1001) - - Fix refreshroot (PhilRunninger) [#999](https://github.com/scrooloose/nerdtree/pull/999) - - Change version check to look for 703 not 730 (vhalis) [#994](https://github.com/scrooloose/nerdtree/pull/994) - - Change minimum vim (PhilRunninger) [#991](https://github.com/scrooloose/nerdtree/pull/991) - - Allow multi-character DirArrows (PhilRunninger) [#985](https://github.com/scrooloose/nerdtree/pull/985) - - Remove redraw! while still clearing last message empty string. (PhilRunninger) [#979](https://github.com/scrooloose/nerdtree/pull/979) - - fix `_initChildren` function value set to numChildrenCached error (terryding77) [#969](https://github.com/scrooloose/nerdtree/pull/969) - - On Windows, do a case-insensitive comparison of paths. (PhilRunninger) [#967](https://github.com/scrooloose/nerdtree/pull/967) - - Remove the **Please wait... DONE** messages. (PhilRunninger) [#966](https://github.com/scrooloose/nerdtree/pull/966) - - Smarter delimiter default (PhilRunninger) [#963](https://github.com/scrooloose/nerdtree/pull/963) - - Update directory .vimdc readme example (spencerdcarlson) [#961](https://github.com/scrooloose/nerdtree/pull/961) - - Preview bookmarks (PhilRunninger) [#956](https://github.com/scrooloose/nerdtree/pull/956) - - Add new value to NERDTreeQuitOnOpen to close bookmark table (PhilRunninger) [#955](https://github.com/scrooloose/nerdtree/pull/955) - - Add an :EditBookmarks command to edit the bookmarks file (PhilRunninger) [#954](https://github.com/scrooloose/nerdtree/pull/954) - - Before copying, turn off &shellslash. Restore after copy is finished. (PhilRunninger) [#952](https://github.com/scrooloose/nerdtree/pull/952) - - Set a maximum window size when zooming. (PhilRunninger) [#950](https://github.com/scrooloose/nerdtree/pull/950) - - Confirm the wipeout of a unsaved buffer whose file has been renamed. (PhilRunninger) [#949](https://github.com/scrooloose/nerdtree/pull/949) - - Escape a backslash so it can be used in a key mapping. (PhilRunninger) [#948](https://github.com/scrooloose/nerdtree/pull/948) - - Add a NERDTreeMinimalMenu feature (tuzz) [#938](https://github.com/scrooloose/nerdtree/pull/938) - - fixed root path error for windows (zcodes) [#935](https://github.com/scrooloose/nerdtree/pull/935) - - Restore getDirChildren for use in nerdtree-project-plugin. (PhilRunninger) [#929](https://github.com/scrooloose/nerdtree/pull/929) - - Document NERDTreeNodeDelimiter [#912](https://github.com/scrooloose/nerdtree/pull/912) (PhilRunninger) [#926](https://github.com/scrooloose/nerdtree/pull/926) - - Allow modification of menu keybindings (Leandros) [#923](https://github.com/scrooloose/nerdtree/pull/923) - - Add two more disqualifications for isCascadable(). (PhilRunninger) [#914](https://github.com/scrooloose/nerdtree/pull/914) - - Allow highlighting more than one flag. (kristijanhusak) [#908](https://github.com/scrooloose/nerdtree/pull/908) - - Support sorting files and directories by modification time. (PhilRunninger) [#901](https://github.com/scrooloose/nerdtree/pull/901) - - Parse . and .. from path string with trailing slash. (PhilRunninger) [#899](https://github.com/scrooloose/nerdtree/pull/899) - - Force sort to recalculate the cached sortKey. (PhilRunninger) [#898](https://github.com/scrooloose/nerdtree/pull/898) - - Add NERDTreeRefreshRoot command (wgfm) [#897](https://github.com/scrooloose/nerdtree/pull/897) - - Call Resolve on the file's path when calling :NERDTreeFind. (PhilRunninger) [#896](https://github.com/scrooloose/nerdtree/pull/896) - - Catch all errors, not just NERDTree errors. (PhilRunninger) [#894](https://github.com/scrooloose/nerdtree/pull/894) - - Fix typo in help file (lvoisin) [#892](https://github.com/scrooloose/nerdtree/pull/892) - - Make NERDTreeCreator set the `'nolist'` option (lifecrisis) [#889](https://github.com/scrooloose/nerdtree/pull/889) - - Refresh buffers after `m`, `m` operation on a folder (PhilRunninger) [#888](https://github.com/scrooloose/nerdtree/pull/888) - - Use a better arg for FINDSTR when using the m,l command in Windows. (PhilRunninger) [#887](https://github.com/scrooloose/nerdtree/pull/887) - - Fix the / motions, which currently fail with cascades (lifecrisis) [#886](https://github.com/scrooloose/nerdtree/pull/886) - - Function "s:UI.getLineNum()" doesn't always work on cascades. (lifecrisis) [#882](https://github.com/scrooloose/nerdtree/pull/882) - - NERDTreeCWD: reset CWD if changed by NERDTreeFocus (PhilRunninger) [#878](https://github.com/scrooloose/nerdtree/pull/878) - - Use tabnext instead of gt to allow users to remap gt. (PhilRunninger) [#877](https://github.com/scrooloose/nerdtree/pull/877) - - Do a case sensitive comparison of new/existing buffers. (PhilRunninger) [#875](https://github.com/scrooloose/nerdtree/pull/875) - - Fix opening sub-directories that have commas in their name. (PhilRunninger) [#873](https://github.com/scrooloose/nerdtree/pull/873) - - Add new command to open NERDTree in the root of a VCS repository. (PhilRunninger) [#872](https://github.com/scrooloose/nerdtree/pull/872) - - Make sure the path to the bookmarks file exists before writing it. (PhilRunninger) [#871](https://github.com/scrooloose/nerdtree/pull/871) - - Unzoom NERDTree when opening a file (PhilRunninger) [#870](https://github.com/scrooloose/nerdtree/pull/870) - - Support unusual characters in file and directory names (PhilRunninger) [#868](https://github.com/scrooloose/nerdtree/pull/868) - - Reword renamed-buffer prompt to be more clear (aflock) [#867](https://github.com/scrooloose/nerdtree/pull/867) - - Default to placing cursor on root when closing bookmark table (lifecrisis) [#866](https://github.com/scrooloose/nerdtree/pull/866) - - Fix issues with sorting of nodes (PhilRunninger) [#856](https://github.com/scrooloose/nerdtree/pull/856) - - Better OSX detection (bubba-h57) [#853](https://github.com/scrooloose/nerdtree/pull/853) - - Bugfix - ensure keymaps dictionary exists before using it (mnussbaum) [#852](https://github.com/scrooloose/nerdtree/pull/852) - - Decrease startup-time by avoiding linear-time iteration over key mappings (mnussbaum) [#851](https://github.com/scrooloose/nerdtree/pull/851) - - Add code to sort mappings in quickhelp (lifecrisis) [#849](https://github.com/scrooloose/nerdtree/pull/849) - - Use ":clearjumps" in new NERDTree windows (lifecrisis) [#844](https://github.com/scrooloose/nerdtree/pull/844) - - Like m-c did before, create parent directories if needed on m-m. (PhilRunninger) [#840](https://github.com/scrooloose/nerdtree/pull/840) - - BUGFIX: Repair a problem with the `'u'` mapping. (lifecrisis) [#838](https://github.com/scrooloose/nerdtree/pull/838) - - Make the NERDTree buffer writable when rendering it. (PhilRunninger) [#837](https://github.com/scrooloose/nerdtree/pull/837) - - Code cleanup: Remove unsupported bookmark table mappings (lifecrisis) [#835](https://github.com/scrooloose/nerdtree/pull/835) - - Replace strcharpart() with substitute() for backward compatibility (bravestarr) [#834](https://github.com/scrooloose/nerdtree/pull/834) - - Fixed error `unknown function strcharpart` for older versions of Vim (hav4ik) [#833](https://github.com/scrooloose/nerdtree/pull/833) - - Clear output when NERDTree menu is aborted (lifecrisis) [#832](https://github.com/scrooloose/nerdtree/pull/832) - - Display a path with multi-byte characters correctly when it is truncated (bravestarr) [#830](https://github.com/scrooloose/nerdtree/pull/830) - - Support revealing file and executing file with xdg-open for Linux (ngnmhieu) [#824](https://github.com/scrooloose/nerdtree/pull/824) - - If node isn't open, count children on disk before deleting. (PhilRunninger) [#822](https://github.com/scrooloose/nerdtree/pull/822) - - Add new variable g:NERDTreeRemoveFileCmd (kutsan) [#816](https://github.com/scrooloose/nerdtree/pull/816) - - Use a better check for existence of the NERDTree buffer. (PhilRunninger) [#814](https://github.com/scrooloose/nerdtree/pull/814) - - Fix focussing previous buffer when closing NERDTree (mrubli) [#801](https://github.com/scrooloose/nerdtree/pull/801) - - Update the docs for "NERDTreeStatusline" (lifecrisis) [#796](https://github.com/scrooloose/nerdtree/pull/796) - - BUGFIX: Unstable behavior in the "getPath()" method (lifecrisis) [#795](https://github.com/scrooloose/nerdtree/pull/795) - - Revert the bugfix from pull request [#785](https://github.com/scrooloose/nerdtree/pull/785) (lifecrisis) [#794](https://github.com/scrooloose/nerdtree/pull/794) - - BUGFIX: Allow ":NERDTreeFind" to discover hidden files (lifecrisis) [#786](https://github.com/scrooloose/nerdtree/pull/786) - - BUGFIX: Allow ":NERDTreeFind" to reveal new files (lifecrisis) [#785](https://github.com/scrooloose/nerdtree/pull/785) - - Add modelines (lifecrisis) [#782](https://github.com/scrooloose/nerdtree/pull/782) - - Change the type of completion used by NERDTreeFind (lifecrisis) [#781](https://github.com/scrooloose/nerdtree/pull/781) - - change NERDTreeFind with args (zhenyangze) [#778](https://github.com/scrooloose/nerdtree/pull/778) - - Style Choice: Using confirm() when deleting a bookmark (lifecrisis) [#777](https://github.com/scrooloose/nerdtree/pull/777) - - remove useless substitute when `file =~# "/$"` (skyblueee) [#773](https://github.com/scrooloose/nerdtree/pull/773) - - remove useless removeLeadingSpaces in _stripMarkup (skyblueee) [#772](https://github.com/scrooloose/nerdtree/pull/772) - - Make the "o" mapping consistent with "x" (lifecrisis) [#769](https://github.com/scrooloose/nerdtree/pull/769) - - Fix a problem with the "x" handler (lifecrisis) [#768](https://github.com/scrooloose/nerdtree/pull/768) - - Clean up the handler for the "x" mapping (lifecrisis) [#767](https://github.com/scrooloose/nerdtree/pull/767) - - Revert change to tab opening method (lifecrisis) [#766](https://github.com/scrooloose/nerdtree/pull/766) - - BUGFIX: Add back support for "b:NERDTreeRoot" (lifecrisis) [#765](https://github.com/scrooloose/nerdtree/pull/765) - - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) [#759](https://github.com/scrooloose/nerdtree/pull/759) - - Update doc with already existing mapping variables (asnr) [#699](https://github.com/scrooloose/nerdtree/pull/699) - - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) [#696](https://github.com/scrooloose/nerdtree/pull/696) - - Correct NERDTreeIgnore pattern in doc (cntoplolicon) [#648](https://github.com/scrooloose/nerdtree/pull/648) - - Remove empty segments when splitting path (sooth-sayer) [#574](https://github.com/scrooloose/nerdtree/pull/574) - - Suppress autocmds less agressively (wincent) [#578](https://github.com/scrooloose/nerdtree/pull/578) [#691](https://github.com/scrooloose/nerdtree/pull/691) + - Refresh a dir_node if the file wasn't found in it, and look once more. (PhilRunninger) [#1005](https://github.com/preservim/nerdtree/pull/1005) + - Add a "copy path to clipboard" menu option (PhilRunninger) [#1002](https://github.com/preservim/nerdtree/pull/1002) + - Enable root refresh on "vim ." a different way than [#999](https://github.com/preservim/nerdtree/pull/999). (PhilRunninger) [#1001](https://github.com/preservim/nerdtree/pull/1001) + - Fix refreshroot (PhilRunninger) [#999](https://github.com/preservim/nerdtree/pull/999) + - Change version check to look for 703 not 730 (vhalis) [#994](https://github.com/preservim/nerdtree/pull/994) + - Change minimum vim (PhilRunninger) [#991](https://github.com/preservim/nerdtree/pull/991) + - Allow multi-character DirArrows (PhilRunninger) [#985](https://github.com/preservim/nerdtree/pull/985) + - Remove redraw! while still clearing last message empty string. (PhilRunninger) [#979](https://github.com/preservim/nerdtree/pull/979) + - fix `_initChildren` function value set to numChildrenCached error (terryding77) [#969](https://github.com/preservim/nerdtree/pull/969) + - On Windows, do a case-insensitive comparison of paths. (PhilRunninger) [#967](https://github.com/preservim/nerdtree/pull/967) + - Remove the **Please wait... DONE** messages. (PhilRunninger) [#966](https://github.com/preservim/nerdtree/pull/966) + - Smarter delimiter default (PhilRunninger) [#963](https://github.com/preservim/nerdtree/pull/963) + - Update directory .vimdc readme example (spencerdcarlson) [#961](https://github.com/preservim/nerdtree/pull/961) + - Preview bookmarks (PhilRunninger) [#956](https://github.com/preservim/nerdtree/pull/956) + - Add new value to NERDTreeQuitOnOpen to close bookmark table (PhilRunninger) [#955](https://github.com/preservim/nerdtree/pull/955) + - Add an :EditBookmarks command to edit the bookmarks file (PhilRunninger) [#954](https://github.com/preservim/nerdtree/pull/954) + - Before copying, turn off &shellslash. Restore after copy is finished. (PhilRunninger) [#952](https://github.com/preservim/nerdtree/pull/952) + - Set a maximum window size when zooming. (PhilRunninger) [#950](https://github.com/preservim/nerdtree/pull/950) + - Confirm the wipeout of a unsaved buffer whose file has been renamed. (PhilRunninger) [#949](https://github.com/preservim/nerdtree/pull/949) + - Escape a backslash so it can be used in a key mapping. (PhilRunninger) [#948](https://github.com/preservim/nerdtree/pull/948) + - Add a NERDTreeMinimalMenu feature (tuzz) [#938](https://github.com/preservim/nerdtree/pull/938) + - fixed root path error for windows (zcodes) [#935](https://github.com/preservim/nerdtree/pull/935) + - Restore getDirChildren for use in nerdtree-project-plugin. (PhilRunninger) [#929](https://github.com/preservim/nerdtree/pull/929) + - Document NERDTreeNodeDelimiter [#912](https://github.com/preservim/nerdtree/pull/912) (PhilRunninger) [#926](https://github.com/preservim/nerdtree/pull/926) + - Allow modification of menu keybindings (Leandros) [#923](https://github.com/preservim/nerdtree/pull/923) + - Add two more disqualifications for isCascadable(). (PhilRunninger) [#914](https://github.com/preservim/nerdtree/pull/914) + - Allow highlighting more than one flag. (kristijanhusak) [#908](https://github.com/preservim/nerdtree/pull/908) + - Support sorting files and directories by modification time. (PhilRunninger) [#901](https://github.com/preservim/nerdtree/pull/901) + - Parse . and .. from path string with trailing slash. (PhilRunninger) [#899](https://github.com/preservim/nerdtree/pull/899) + - Force sort to recalculate the cached sortKey. (PhilRunninger) [#898](https://github.com/preservim/nerdtree/pull/898) + - Add NERDTreeRefreshRoot command (wgfm) [#897](https://github.com/preservim/nerdtree/pull/897) + - Call Resolve on the file's path when calling :NERDTreeFind. (PhilRunninger) [#896](https://github.com/preservim/nerdtree/pull/896) + - Catch all errors, not just NERDTree errors. (PhilRunninger) [#894](https://github.com/preservim/nerdtree/pull/894) + - Fix typo in help file (lvoisin) [#892](https://github.com/preservim/nerdtree/pull/892) + - Make NERDTreeCreator set the `'nolist'` option (lifecrisis) [#889](https://github.com/preservim/nerdtree/pull/889) + - Refresh buffers after `m`, `m` operation on a folder (PhilRunninger) [#888](https://github.com/preservim/nerdtree/pull/888) + - Use a better arg for FINDSTR when using the m,l command in Windows. (PhilRunninger) [#887](https://github.com/preservim/nerdtree/pull/887) + - Fix the / motions, which currently fail with cascades (lifecrisis) [#886](https://github.com/preservim/nerdtree/pull/886) + - Function "s:UI.getLineNum()" doesn't always work on cascades. (lifecrisis) [#882](https://github.com/preservim/nerdtree/pull/882) + - NERDTreeCWD: reset CWD if changed by NERDTreeFocus (PhilRunninger) [#878](https://github.com/preservim/nerdtree/pull/878) + - Use tabnext instead of gt to allow users to remap gt. (PhilRunninger) [#877](https://github.com/preservim/nerdtree/pull/877) + - Do a case sensitive comparison of new/existing buffers. (PhilRunninger) [#875](https://github.com/preservim/nerdtree/pull/875) + - Fix opening sub-directories that have commas in their name. (PhilRunninger) [#873](https://github.com/preservim/nerdtree/pull/873) + - Add new command to open NERDTree in the root of a VCS repository. (PhilRunninger) [#872](https://github.com/preservim/nerdtree/pull/872) + - Make sure the path to the bookmarks file exists before writing it. (PhilRunninger) [#871](https://github.com/preservim/nerdtree/pull/871) + - Unzoom NERDTree when opening a file (PhilRunninger) [#870](https://github.com/preservim/nerdtree/pull/870) + - Support unusual characters in file and directory names (PhilRunninger) [#868](https://github.com/preservim/nerdtree/pull/868) + - Reword renamed-buffer prompt to be more clear (aflock) [#867](https://github.com/preservim/nerdtree/pull/867) + - Default to placing cursor on root when closing bookmark table (lifecrisis) [#866](https://github.com/preservim/nerdtree/pull/866) + - Fix issues with sorting of nodes (PhilRunninger) [#856](https://github.com/preservim/nerdtree/pull/856) + - Better OSX detection (bubba-h57) [#853](https://github.com/preservim/nerdtree/pull/853) + - Bugfix - ensure keymaps dictionary exists before using it (mnussbaum) [#852](https://github.com/preservim/nerdtree/pull/852) + - Decrease startup-time by avoiding linear-time iteration over key mappings (mnussbaum) [#851](https://github.com/preservim/nerdtree/pull/851) + - Add code to sort mappings in quickhelp (lifecrisis) [#849](https://github.com/preservim/nerdtree/pull/849) + - Use ":clearjumps" in new NERDTree windows (lifecrisis) [#844](https://github.com/preservim/nerdtree/pull/844) + - Like m-c did before, create parent directories if needed on m-m. (PhilRunninger) [#840](https://github.com/preservim/nerdtree/pull/840) + - BUGFIX: Repair a problem with the `'u'` mapping. (lifecrisis) [#838](https://github.com/preservim/nerdtree/pull/838) + - Make the NERDTree buffer writable when rendering it. (PhilRunninger) [#837](https://github.com/preservim/nerdtree/pull/837) + - Code cleanup: Remove unsupported bookmark table mappings (lifecrisis) [#835](https://github.com/preservim/nerdtree/pull/835) + - Replace strcharpart() with substitute() for backward compatibility (bravestarr) [#834](https://github.com/preservim/nerdtree/pull/834) + - Fixed error `unknown function strcharpart` for older versions of Vim (hav4ik) [#833](https://github.com/preservim/nerdtree/pull/833) + - Clear output when NERDTree menu is aborted (lifecrisis) [#832](https://github.com/preservim/nerdtree/pull/832) + - Display a path with multi-byte characters correctly when it is truncated (bravestarr) [#830](https://github.com/preservim/nerdtree/pull/830) + - Support revealing file and executing file with xdg-open for Linux (ngnmhieu) [#824](https://github.com/preservim/nerdtree/pull/824) + - If node isn't open, count children on disk before deleting. (PhilRunninger) [#822](https://github.com/preservim/nerdtree/pull/822) + - Add new variable g:NERDTreeRemoveFileCmd (kutsan) [#816](https://github.com/preservim/nerdtree/pull/816) + - Use a better check for existence of the NERDTree buffer. (PhilRunninger) [#814](https://github.com/preservim/nerdtree/pull/814) + - Fix focussing previous buffer when closing NERDTree (mrubli) [#801](https://github.com/preservim/nerdtree/pull/801) + - Update the docs for "NERDTreeStatusline" (lifecrisis) [#796](https://github.com/preservim/nerdtree/pull/796) + - BUGFIX: Unstable behavior in the "getPath()" method (lifecrisis) [#795](https://github.com/preservim/nerdtree/pull/795) + - Revert the bugfix from pull request [#785](https://github.com/preservim/nerdtree/pull/785) (lifecrisis) [#794](https://github.com/preservim/nerdtree/pull/794) + - BUGFIX: Allow ":NERDTreeFind" to discover hidden files (lifecrisis) [#786](https://github.com/preservim/nerdtree/pull/786) + - BUGFIX: Allow ":NERDTreeFind" to reveal new files (lifecrisis) [#785](https://github.com/preservim/nerdtree/pull/785) + - Add modelines (lifecrisis) [#782](https://github.com/preservim/nerdtree/pull/782) + - Change the type of completion used by NERDTreeFind (lifecrisis) [#781](https://github.com/preservim/nerdtree/pull/781) + - change NERDTreeFind with args (zhenyangze) [#778](https://github.com/preservim/nerdtree/pull/778) + - Style Choice: Using confirm() when deleting a bookmark (lifecrisis) [#777](https://github.com/preservim/nerdtree/pull/777) + - remove useless substitute when `file =~# "/$"` (skyblueee) [#773](https://github.com/preservim/nerdtree/pull/773) + - remove useless removeLeadingSpaces in _stripMarkup (skyblueee) [#772](https://github.com/preservim/nerdtree/pull/772) + - Make the "o" mapping consistent with "x" (lifecrisis) [#769](https://github.com/preservim/nerdtree/pull/769) + - Fix a problem with the "x" handler (lifecrisis) [#768](https://github.com/preservim/nerdtree/pull/768) + - Clean up the handler for the "x" mapping (lifecrisis) [#767](https://github.com/preservim/nerdtree/pull/767) + - Revert change to tab opening method (lifecrisis) [#766](https://github.com/preservim/nerdtree/pull/766) + - BUGFIX: Add back support for "b:NERDTreeRoot" (lifecrisis) [#765](https://github.com/preservim/nerdtree/pull/765) + - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) [#759](https://github.com/preservim/nerdtree/pull/759) + - Update doc with already existing mapping variables (asnr) [#699](https://github.com/preservim/nerdtree/pull/699) + - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) [#696](https://github.com/preservim/nerdtree/pull/696) + - Correct NERDTreeIgnore pattern in doc (cntoplolicon) [#648](https://github.com/preservim/nerdtree/pull/648) + - Remove empty segments when splitting path (sooth-sayer) [#574](https://github.com/preservim/nerdtree/pull/574) + - Suppress autocmds less agressively (wincent) [#578](https://github.com/preservim/nerdtree/pull/578) [#691](https://github.com/preservim/nerdtree/pull/691) - Add an Issues template to ask for more info initially. - - Fix markdown headers in readme (josephfrazier) [#676](https://github.com/scrooloose/nerdtree/pull/676) + - Fix markdown headers in readme (josephfrazier) [#676](https://github.com/preservim/nerdtree/pull/676) - Don't touch `@o` and `@h` registers when rendering - - Fix bug with files and directories with dollar signs (alegen) [#649](https://github.com/scrooloose/nerdtree/pull/649) - - Reuse/reopen existing window trees where possible [#244](https://github.com/scrooloose/nerdtree/pull/244) + - Fix bug with files and directories with dollar signs (alegen) [#649](https://github.com/preservim/nerdtree/pull/649) + - Reuse/reopen existing window trees where possible [#244](https://github.com/preservim/nerdtree/pull/244) - Remove NERDTree.previousBuf() - - Change color of arrow (Leeiio) [#630](https://github.com/scrooloose/nerdtree/pull/630) - - Improved a tip in README.markdown (ggicci) [#628](https://github.com/scrooloose/nerdtree/pull/628) - - Shorten delete confimration of empty directory to `y` (mikeperri) [#530](https://github.com/scrooloose/nerdtree/pull/530) - - Fix API call to open directory tree in window (devm33) [#533](https://github.com/scrooloose/nerdtree/pull/533) - - Change default arrows on non-Windows platforms (gwilk) [#546](https://github.com/scrooloose/nerdtree/pull/546) - - Update to README - combine cd and git clone (zwhitchcox) [#584](https://github.com/scrooloose/nerdtree/pull/584) - - Update to README - Tip: start NERDTree when vim starts (therealplato) [#593](https://github.com/scrooloose/nerdtree/pull/593) - - Escape filename when moving an open buffer (zacharyvoase) [#595](https://github.com/scrooloose/nerdtree/pull/595) - - Fixed incorrect :helptags command in README (curran) [#619](https://github.com/scrooloose/nerdtree/pull/619) - - Fixed incomplete escaping of folder arrows (adityanatraj) [#548](https://github.com/scrooloose/nerdtree/pull/548) - - Added NERDTreeCascadeSingleChildDir option (juanibiapina) [#558](https://github.com/scrooloose/nerdtree/pull/558) + - Change color of arrow (Leeiio) [#630](https://github.com/preservim/nerdtree/pull/630) + - Improved a tip in README.markdown (ggicci) [#628](https://github.com/preservim/nerdtree/pull/628) + - Shorten delete confimration of empty directory to `y` (mikeperri) [#530](https://github.com/preservim/nerdtree/pull/530) + - Fix API call to open directory tree in window (devm33) [#533](https://github.com/preservim/nerdtree/pull/533) + - Change default arrows on non-Windows platforms (gwilk) [#546](https://github.com/preservim/nerdtree/pull/546) + - Update to README - combine cd and git clone (zwhitchcox) [#584](https://github.com/preservim/nerdtree/pull/584) + - Update to README - Tip: start NERDTree when vim starts (therealplato) [#593](https://github.com/preservim/nerdtree/pull/593) + - Escape filename when moving an open buffer (zacharyvoase) [#595](https://github.com/preservim/nerdtree/pull/595) + - Fixed incorrect :helptags command in README (curran) [#619](https://github.com/preservim/nerdtree/pull/619) + - Fixed incomplete escaping of folder arrows (adityanatraj) [#548](https://github.com/preservim/nerdtree/pull/548) + - Added NERDTreeCascadeSingleChildDir option (juanibiapina) [#558](https://github.com/preservim/nerdtree/pull/558) - Replace strchars() with backward compatible workaround. - - Add support for copy command in Windows (SkylerLipthay) [#231](https://github.com/scrooloose/nerdtree/pull/231) + - Add support for copy command in Windows (SkylerLipthay) [#231](https://github.com/preservim/nerdtree/pull/231) - Fixed typo in README.markdown - :Helptags -> :helptags - Rename "primary" and "secondary" trees to "tab" and "window" trees. - Move a bunch of buffer level variables into the NERDTree and UI classes. diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 9e539523..e7632420 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -1,4 +1,4 @@ -The NERDTree +The NERDTree [![Vint](https://github.com/preservim/nerdtree/workflows/Vint/badge.svg)](https://github.com/preservim/nerdtree/actions?workflow=Vint) ============= Introduction @@ -12,7 +12,7 @@ This plugin can also be extended with custom mappings using a special API. The details of this API and of other NERDTree features are described in the included documentation. -![NERDTree Screenshot](https://github.com/scrooloose/nerdtree/raw/master/screenshot.png) +![NERDTree Screenshot](https://github.com/preservim/nerdtree/raw/master/screenshot.png) Installation ------------ @@ -24,7 +24,7 @@ Below are just some of the methods for installing NERDTree. Do not follow all of If you are using VIM version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal: ```bash -git clone https://github.com/scrooloose/nerdtree.git ~/.vim/pack/vendor/start/nerdtree +git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q ``` @@ -34,7 +34,7 @@ Otherwise, these are some of the several 3rd-party plugin managers you can choos In the terminal, ```bash -git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree +git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree ``` In your vimrc, ```vim @@ -48,23 +48,23 @@ Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`. #### [Vundle.vim](https://github.com/VundleVim/Vundle.vim) ```vim call vundle#begin() -Plugin 'scrooloose/nerdtree' +Plugin 'preservim/nerdtree' call vundle#end() ``` #### [vim-plug](https://github.com/junegunn/vim-plug) ```vim call plug#begin() -Plug 'scrooloose/nerdtree' +Plug 'preservim/nerdtree' call plug#end() ``` #### [apt-vim](https://github.com/egalpin/apt-vim) ```bash -apt-vim install -y https://github.com/scrooloose/nerdtree.git +apt-vim install -y https://github.com/preservim/nerdtree.git ``` -F.A.Q. (here, and in the [Wiki](https://github.com/scrooloose/nerdtree/wiki)) +F.A.Q. (here, and in the [Wiki](https://github.com/preservim/nerdtree/wiki)) ------ #### Is there any support for `git` flags? @@ -133,7 +133,7 @@ autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isT --- #### Can I have different highlighting for different file extensions? -See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696 +See here: https://github.com/preservim/nerdtree/issues/433#issuecomment-92590696 --- #### How can I change default arrows? diff --git a/sources_non_forked/nerdtree/_config.yml b/sources_non_forked/nerdtree/_config.yml new file mode 100644 index 00000000..c4192631 --- /dev/null +++ b/sources_non_forked/nerdtree/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 76c076e9..5c9af895 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -1,21 +1,21 @@ -if exists("g:loaded_nerdtree_autoload") +if exists('g:loaded_nerdtree_autoload') finish endif let g:loaded_nerdtree_autoload = 1 -let s:rootNERDTreePath = resolve(expand(":p:h:h")) +let s:rootNERDTreePath = resolve(expand(':p:h:h')) "FUNCTION: nerdtree#version(...) {{{1 " If any value is given as an argument, the entire line of text from the " change log is shown for the current version; otherwise, only the version " number is shown. -function! nerdtree#version(...) +function! nerdtree#version(...) abort let l:text = 'Unknown' try - let l:changelog = readfile(join([s:rootNERDTreePath, "CHANGELOG.md"], nerdtree#slash())) + let l:changelog = readfile(join([s:rootNERDTreePath, 'CHANGELOG.md'], nerdtree#slash())) let l:line = 0 while l:line <= len(l:changelog) - if l:changelog[l:line] =~ '\d\+\.\d\+' + if l:changelog[l:line] =~# '\d\+\.\d\+' let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '') let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '') break @@ -31,7 +31,7 @@ endfunction "============================================================ "FUNCTION: nerdtree#slash() {{{2 -function! nerdtree#slash() +function! nerdtree#slash() abort if nerdtree#runningWindows() if exists('+shellslash') && &shellslash @@ -46,8 +46,8 @@ endfunction "FUNCTION: nerdtree#and(x,y) {{{2 " Implements and() function for Vim <= 7.2 -function! nerdtree#and(x,y) - if exists("*and") +function! nerdtree#and(x,y) abort + if exists('*and') return and(a:x, a:y) else let l:x = a:x @@ -68,7 +68,7 @@ endfunction "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "inits a window tree in the current buffer if appropriate -function! nerdtree#checkForBrowse(dir) +function! nerdtree#checkForBrowse(dir) abort if !isdirectory(a:dir) return endif @@ -83,18 +83,18 @@ endfunction "FUNCTION: s:reuseWin(dir) {{{2 "finds a NERDTree buffer with root of dir, and opens it. function! s:reuseWin(dir) abort - let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p")) + let path = g:NERDTreePath.New(fnamemodify(a:dir, ':p')) - for i in range(1, bufnr("$")) + for i in range(1, bufnr('$')) unlet! nt - let nt = getbufvar(i, "NERDTree") + let nt = getbufvar(i, 'NERDTree') if empty(nt) continue endif if nt.isWinTree() && nt.root.path.equals(path) - call nt.setPreviousBuf(bufnr("#")) - exec "buffer " . i + call nt.setPreviousBuf(bufnr('#')) + exec 'buffer ' . i return 1 endif endfor @@ -104,17 +104,17 @@ endfunction " FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2 " completion function for the bookmark commands -function! nerdtree#completeBookmarks(A,L,P) +function! nerdtree#completeBookmarks(A,L,P) abort return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') endfunction "FUNCTION: nerdtree#compareNodes(dir) {{{2 -function! nerdtree#compareNodes(n1, n2) +function! nerdtree#compareNodes(n1, n2) abort return a:n1.path.compareTo(a:n2.path) endfunction "FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2 -function! nerdtree#compareNodesBySortKey(n1, n2) +function! nerdtree#compareNodesBySortKey(n1, n2) abort let sortKey1 = a:n1.path.getSortKey() let sortKey2 = a:n2.path.getSortKey() let i = 0 @@ -122,15 +122,15 @@ function! nerdtree#compareNodesBySortKey(n1, n2) " Compare chunks upto common length. " If chunks have different type, the one which has " integer type is the lesser. - if type(sortKey1[i]) == type(sortKey2[i]) + if type(sortKey1[i]) ==# type(sortKey2[i]) if sortKey1[i] <# sortKey2[i] return - 1 elseif sortKey1[i] ># sortKey2[i] return 1 endif - elseif type(sortKey1[i]) == v:t_number + elseif type(sortKey1[i]) ==# v:t_number return -1 - elseif type(sortKey2[i]) == v:t_number + elseif type(sortKey2[i]) ==# v:t_number return 1 endif let i = i + 1 @@ -150,7 +150,7 @@ endfunction " FUNCTION: nerdtree#deprecated(func, [msg]) {{{2 " Issue a deprecation warning for a:func. If a second arg is given, use this " as the deprecation message -function! nerdtree#deprecated(func, ...) +function! nerdtree#deprecated(func, ...) abort let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated' if !exists('s:deprecationWarnings') @@ -164,22 +164,22 @@ endfunction " FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2 " Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration -function! nerdtree#exec(cmd, ignoreAll) - let old_ei = &ei +function! nerdtree#exec(cmd, ignoreAll) abort + let old_ei = &eventignore if a:ignoreAll - set ei=all + set eventignore=all endif exec a:cmd - let &ei = old_ei + let &eventignore = old_ei endfunction " FUNCTION: nerdtree#has_opt(options, name) {{{2 -function! nerdtree#has_opt(options, name) - return has_key(a:options, a:name) && a:options[a:name] == 1 +function! nerdtree#has_opt(options, name) abort + return has_key(a:options, a:name) && a:options[a:name] ==# 1 endfunction " FUNCTION: nerdtree#loadClassFiles() {{{2 -function! nerdtree#loadClassFiles() +function! nerdtree#loadClassFiles() abort runtime lib/nerdtree/path.vim runtime lib/nerdtree/menu_controller.vim runtime lib/nerdtree/menu_item.vim @@ -197,7 +197,7 @@ function! nerdtree#loadClassFiles() endfunction " FUNCTION: nerdtree#postSourceActions() {{{2 -function! nerdtree#postSourceActions() +function! nerdtree#postSourceActions() abort call g:NERDTreeBookmark.CacheBookmarks(1) call nerdtree#ui_glue#createDefaultBindings() @@ -206,13 +206,13 @@ function! nerdtree#postSourceActions() endfunction "FUNCTION: nerdtree#runningWindows(dir) {{{2 -function! nerdtree#runningWindows() - return has("win16") || has("win32") || has("win64") +function! nerdtree#runningWindows() abort + return has('win16') || has('win32') || has('win64') endfunction "FUNCTION: nerdtree#runningCygwin(dir) {{{2 -function! nerdtree#runningCygwin() - return has("win32unix") +function! nerdtree#runningCygwin() abort + return has('win32unix') endfunction " SECTION: View Functions {{{1 @@ -223,16 +223,16 @@ endfunction " "Args: "msg: the message to echo -function! nerdtree#echo(msg) +function! nerdtree#echo(msg) abort redraw - echomsg empty(a:msg) ? "" : ("NERDTree: " . a:msg) + echomsg empty(a:msg) ? '' : ('NERDTree: ' . a:msg) endfunction "FUNCTION: nerdtree#echoError {{{2 "Wrapper for nerdtree#echo, sets the message type to errormsg for this message "Args: "msg: the message to echo -function! nerdtree#echoError(msg) +function! nerdtree#echoError(msg) abort echohl errormsg call nerdtree#echo(a:msg) echohl normal @@ -242,14 +242,14 @@ endfunction "Wrapper for nerdtree#echo, sets the message type to warningmsg for this message "Args: "msg: the message to echo -function! nerdtree#echoWarning(msg) +function! nerdtree#echoWarning(msg) abort echohl warningmsg call nerdtree#echo(a:msg) echohl normal endfunction "FUNCTION: nerdtree#renderView {{{2 -function! nerdtree#renderView() +function! nerdtree#renderView() abort call b:NERDTree.render() endfunction diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 4ba5b05f..400e52dc 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -1,80 +1,80 @@ -if exists("g:loaded_nerdtree_ui_glue_autoload") +if exists('g:loaded_nerdtree_ui_glue_autoload') finish endif let g:loaded_nerdtree_ui_glue_autoload = 1 " FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1 -function! nerdtree#ui_glue#createDefaultBindings() +function! nerdtree#ui_glue#createDefaultBindings() abort let s = '' . s:SID() . '_' call NERDTreeAddKeyMap({ 'key': '', 'scope': 'all', 'callback': s . 'handleMiddleMouse' }) - call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) + call NERDTreeAddKeyMap({ 'key': '', 'scope': 'all', 'callback': s.'handleLeftClick' }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'DirNode', 'callback': s.'activateDirNode' }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'FileNode', 'callback': s.'activateFileNode' }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'Bookmark', 'callback': s.'activateBookmark' }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'all', 'callback': s.'activateAll' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s."customOpenFile"}) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s."customOpenDir"}) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s."customOpenBookmark"}) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'all', 'callback': s."activateAll" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s.'customOpenFile'}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s.'customOpenDir'}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s.'customOpenBookmark'}) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'all', 'callback': s.'activateAll' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewBookmark" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'DirNode', 'callback': s.'activateDirNode' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'FileNode', 'callback': s.'activateFileNode' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'Bookmark', 'callback': s.'activateBookmark' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': 'all', 'callback': s . 'upDirCurrentRootClosed' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': 'all', 'callback': s . 'upDirCurrentRootOpen' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': 'Node', 'callback': s . 'chRoot' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': 'Node', 'callback': s.'chCwd' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': 'all', 'callback': s.'closeTreeWindow' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#ui_glue#chRootCwd" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': 'all', 'callback': 'nerdtree#ui_glue#chRootCwd' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': 'all', 'callback': s.'refreshRoot' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': 'Node', 'callback': s.'refreshCurrent' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': 'all', 'callback': s.'displayHelp' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': 'all', 'callback': s.'toggleZoom' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': 'all', 'callback': s.'toggleShowHidden' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': 'all', 'callback': s.'toggleIgnoreFilter' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': 'all', 'callback': s.'toggleShowFiles' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': 'all', 'callback': s.'toggleShowBookmarks' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': 'Node', 'callback': s.'closeCurrentDir' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': 'DirNode', 'callback': s.'closeChildren' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': 'Node', 'callback': s.'showMenu' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': 'Node', 'callback': s.'jumpToParent' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': 'Node', 'callback': s.'jumpToFirstChild' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': 'Node', 'callback': s.'jumpToLastChild' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': 'all', 'callback': s.'jumpToRoot' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': 'Node', 'callback': s.'jumpToNextSibling' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': 'Node', 'callback': s.'jumpToPrevSibling' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Bookmark', 'callback': s . 'openInNewTab' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "FileNode", 'callback': s."openExplorer" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': 'DirNode', 'callback': s.'openExplorer' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': 'FileNode', 'callback': s.'openExplorer' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': 'Bookmark', 'callback': s.'deleteBookmark' }) endfunction @@ -82,20 +82,20 @@ endfunction "============================================================ "FUNCTION: s:customOpenFile() {{{1 -" Open file node with the "custom" key, initially . -function! s:customOpenFile(node) +" Open file node with the 'custom' key, initially . +function! s:customOpenFile(node) abort call a:node.activate(s:initCustomOpenArgs().file) endfunction "FUNCTION: s:customOpenDir() {{{1 -" Open directory node with the "custom" key, initially . -function! s:customOpenDir(node) +" Open directory node with the 'custom' key, initially . +function! s:customOpenDir(node) abort call s:activateDirNode(a:node, s:initCustomOpenArgs().dir) endfunction "FUNCTION: s:customOpenBookmark() {{{1 -" Open bookmark node with the "custom" key, initially . -function! s:customOpenBookmark(node) +" Open bookmark node with the 'custom' key, initially . +function! s:customOpenBookmark(node) abort if a:node.path.isDirectory call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir) else @@ -105,22 +105,22 @@ endfunction "FUNCTION: s:initCustomOpenArgs() {{{1 " Make sure NERDTreeCustomOpenArgs has needed keys -function! s:initCustomOpenArgs() +function! s:initCustomOpenArgs() abort let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep') endfunction "FUNCTION: s:activateAll() {{{1 "handle the user activating the updir line -function! s:activateAll() - if getline(".") ==# g:NERDTreeUI.UpDirLine() +function! s:activateAll() abort + if getline('.') ==# g:NERDTreeUI.UpDirLine() return nerdtree#ui_glue#upDir(0) endif endfunction " FUNCTION: s:activateDirNode(directoryNode, options) {{{1 " Open a directory with optional options -function! s:activateDirNode(directoryNode, ...) +function! s:activateDirNode(directoryNode, ...) abort if a:directoryNode.isRoot() && a:directoryNode.isOpen call nerdtree#echo('cannot close tree root') @@ -132,21 +132,21 @@ endfunction "FUNCTION: s:activateFileNode() {{{1 "handle the user activating a tree node -function! s:activateFileNode(node) +function! s:activateFileNode(node) abort call a:node.activate({'reuse': 'all', 'where': 'p'}) endfunction "FUNCTION: s:activateBookmark(bookmark) {{{1 "handle the user activating a bookmark -function! s:activateBookmark(bm) +function! s:activateBookmark(bm) abort call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {}) endfunction " FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 " Associate the current node with the given name -function! nerdtree#ui_glue#bookmarkNode(...) +function! nerdtree#ui_glue#bookmarkNode(...) abort let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} + if currentNode !=# {} let name = a:1 if empty(name) let name = currentNode.path.getLastPathComponent(0) @@ -155,39 +155,39 @@ function! nerdtree#ui_glue#bookmarkNode(...) call currentNode.bookmark(name) call b:NERDTree.render() catch /^NERDTree.IllegalBookmarkNameError/ - call nerdtree#echo("bookmark names must not contain spaces") + call nerdtree#echo('bookmark names must not contain spaces') endtry else - call nerdtree#echo("select a node first") + call nerdtree#echo('select a node first') endif endfunction " FUNCTION: s:chCwd(node) {{{1 -function! s:chCwd(node) +function! s:chCwd(node) abort try call a:node.path.changeToDir() catch /^NERDTree.PathChangeError/ - call nerdtree#echoWarning("could not change cwd") + call nerdtree#echoWarning('could not change cwd') endtry endfunction " FUNCTION: s:chRoot(node) {{{1 " changes the current root to the selected one -function! s:chRoot(node) +function! s:chRoot(node) abort call b:NERDTree.changeRoot(a:node) endfunction " FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 " Change the NERDTree root to match the current working directory. -function! nerdtree#ui_glue#chRootCwd() +function! nerdtree#ui_glue#chRootCwd() abort NERDTreeCWD endfunction " FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 -function! nerdtree#ui_glue#clearBookmarks(bookmarks) +function! nerdtree#ui_glue#clearBookmarks(bookmarks) abort if a:bookmarks ==# '' let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} + if currentNode !=# {} call currentNode.clearBookmarks() endif else @@ -202,7 +202,7 @@ endfunction " FUNCTION: s:closeChildren(node) {{{1 " closes all childnodes of the current node -function! s:closeChildren(node) +function! s:closeChildren(node) abort call a:node.closeChildren() call b:NERDTree.render() call a:node.putCursorHere(0, 0) @@ -210,7 +210,7 @@ endfunction " FUNCTION: s:closeCurrentDir(node) {{{1 " Close the parent directory of the current node. -function! s:closeCurrentDir(node) +function! s:closeCurrentDir(node) abort if a:node.isRoot() call nerdtree#echo('cannot close parent of tree root') @@ -235,30 +235,30 @@ endfunction " FUNCTION: s:closeTreeWindow() {{{1 " close the tree window -function! s:closeTreeWindow() - if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1 - exec "buffer " . b:NERDTree.previousBuf() +function! s:closeTreeWindow() abort + if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() !=# -1 + exec 'buffer ' . b:NERDTree.previousBuf() else - if winnr("$") > 1 + if winnr('$') > 1 call g:NERDTree.Close() else - call nerdtree#echo("Cannot close last window") + call nerdtree#echo('Cannot close last window') endif endif endfunction " FUNCTION: s:deleteBookmark(bookmark) {{{1 " Prompt the user to confirm the deletion of the selected bookmark. -function! s:deleteBookmark(bookmark) - let l:message = "Delete the bookmark \"" . a:bookmark.name - \ . "\" from the bookmark list?" +function! s:deleteBookmark(bookmark) abort + let l:message = 'Delete the bookmark "' . a:bookmark.name + \ . '" from the bookmark list?' let l:choices = "&Yes\n&No" echo | redraw let l:selection = confirm(l:message, l:choices, 1, 'Warning') - if l:selection != 1 + if l:selection !=# 1 call nerdtree#echo('bookmark not deleted') return endif @@ -275,14 +275,14 @@ endfunction " FUNCTION: s:displayHelp() {{{1 " toggles the help display -function! s:displayHelp() +function! s:displayHelp() abort call b:NERDTree.ui.toggleHelp() call b:NERDTree.render() call b:NERDTree.ui.centerView() endfunction " FUNCTION: s:findAndRevealPath(pathStr) {{{1 -function! s:findAndRevealPath(pathStr) +function! s:findAndRevealPath(pathStr) abort let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') if !filereadable(l:pathStr) let l:pathStr = fnamemodify(l:pathStr, ':h') @@ -333,15 +333,15 @@ endfunction "FUNCTION: s:handleLeftClick() {{{1 "Checks if the click should open the current node -function! s:handleLeftClick() +function! s:handleLeftClick() abort let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} + if currentNode !=# {} "the dir arrows are multibyte chars, and vim's string functions only "deal with single bytes - so split the line up with the hack below and "take the line substring manually - let line = split(getline(line(".")), '\zs') - let startToCur = "" + let line = split(getline(line('.')), '\zs') + let startToCur = '' for i in range(0,len(line)-1) let startToCur .= line[i] endfor @@ -368,7 +368,7 @@ function! s:handleLeftClick() endfunction " FUNCTION: s:handleMiddleMouse() {{{1 -function! s:handleMiddleMouse() +function! s:handleMiddleMouse() abort " A middle mouse click does not automatically position the cursor as one " would expect. Forcing the execution of a regular left mouse click here @@ -391,17 +391,17 @@ endfunction " FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1 "this is needed since I cant figure out how to invoke dict functions from a "key map -function! nerdtree#ui_glue#invokeKeyMap(key) +function! nerdtree#ui_glue#invokeKeyMap(key) abort call g:NERDTreeKeyMap.Invoke(a:key) endfunction " FUNCTION: s:jumpToFirstChild(node) {{{1 -function! s:jumpToFirstChild(node) +function! s:jumpToFirstChild(node) abort call s:jumpToChild(a:node, 0) endfunction " FUNCTION: s:jumpToLastChild(node) {{{1 -function! s:jumpToLastChild(node) +function! s:jumpToLastChild(node) abort call s:jumpToChild(a:node, 1) endfunction @@ -411,7 +411,7 @@ endfunction " Args: " node: the node on which the cursor currently sits " last: 1 (true) if jumping to last child, 0 (false) if jumping to first -function! s:jumpToChild(node, last) +function! s:jumpToChild(node, last) abort let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node if l:node.isRoot() @@ -430,7 +430,7 @@ endfunction " FUNCTION: s:jumpToParent(node) {{{1 " Move the cursor to the parent of the specified node. For a cascade, move to " the parent of the cascade's first node. At the root node, do nothing. -function! s:jumpToParent(node) +function! s:jumpToParent(node) abort let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node if l:node.isRoot() @@ -448,18 +448,18 @@ endfunction " FUNCTION: s:jumpToRoot() {{{1 " moves the cursor to the root node -function! s:jumpToRoot() +function! s:jumpToRoot() abort call b:NERDTree.root.putCursorHere(1, 0) call b:NERDTree.ui.centerView() endfunction " FUNCTION: s:jumpToNextSibling(node) {{{1 -function! s:jumpToNextSibling(node) +function! s:jumpToNextSibling(node) abort call s:jumpToSibling(a:node, 1) endfunction " FUNCTION: s:jumpToPrevSibling(node) {{{1 -function! s:jumpToPrevSibling(node) +function! s:jumpToPrevSibling(node) abort call s:jumpToSibling(a:node, 0) endfunction @@ -469,7 +469,7 @@ endfunction " Args: " node: the node on which the cursor currently sits " forward: 0 to jump to previous sibling, 1 to jump to next sibling -function! s:jumpToSibling(node, forward) +function! s:jumpToSibling(node, forward) abort let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node let l:sibling = l:node.findSibling(a:forward) @@ -483,8 +483,8 @@ endfunction " FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1 " Open the Bookmark that has the specified name. This function provides the -" implementation for the ":OpenBookmark" command. -function! nerdtree#ui_glue#openBookmark(name) +" implementation for the :OpenBookmark command. +function! nerdtree#ui_glue#openBookmark(name) abort try let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) catch /^NERDTree.BookmarkNotFoundError/ @@ -499,42 +499,42 @@ function! nerdtree#ui_glue#openBookmark(name) endfunction " FUNCTION: s:openHSplit(target) {{{1 -function! s:openHSplit(target) +function! s:openHSplit(target) abort call a:target.activate({'where': 'h'}) endfunction " FUNCTION: s:openVSplit(target) {{{1 -function! s:openVSplit(target) +function! s:openVSplit(target) abort call a:target.activate({'where': 'v'}) endfunction " FUNCTION: s:openExplorer(node) {{{1 -function! s:openExplorer(node) +function! s:openExplorer(node) abort call a:node.openExplorer() endfunction " FUNCTION: s:openInNewTab(target) {{{1 -function! s:openInNewTab(target) +function! s:openInNewTab(target) abort let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'}) call l:opener.open(a:target) endfunction " FUNCTION: s:openInNewTabSilent(target) {{{1 -function! s:openInNewTabSilent(target) +function! s:openInNewTabSilent(target) abort let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1}) call l:opener.open(a:target) endfunction " FUNCTION: s:openNodeRecursively(node) {{{1 -function! s:openNodeRecursively(node) - call nerdtree#echo("Recursively opening node. Please wait...") +function! s:openNodeRecursively(node) abort + call nerdtree#echo('Recursively opening node. Please wait...') call a:node.openRecursively() call b:NERDTree.render() - call nerdtree#echo("") + call nerdtree#echo('') endfunction " FUNCTION: s:previewBookmark(bookmark) {{{1 -function! s:previewBookmark(bookmark) +function! s:previewBookmark(bookmark) abort if a:bookmark.path.isDirectory execute 'NERDTreeFind '.a:bookmark.path.str() else @@ -543,65 +543,65 @@ function! s:previewBookmark(bookmark) endfunction "FUNCTION: s:previewNodeCurrent(node) {{{1 -function! s:previewNodeCurrent(node) +function! s:previewNodeCurrent(node) abort call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) endfunction "FUNCTION: s:previewNodeHSplit(node) {{{1 -function! s:previewNodeHSplit(node) +function! s:previewNodeHSplit(node) abort call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) endfunction "FUNCTION: s:previewNodeVSplit(node) {{{1 -function! s:previewNodeVSplit(node) +function! s:previewNodeVSplit(node) abort call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) endfunction " FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1 " put the cursor on the node associate with the given name -function! nerdtree#ui_glue#revealBookmark(name) +function! nerdtree#ui_glue#revealBookmark(name) abort try let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree) call targetNode.putCursorHere(0, 1) catch /^NERDTree.BookmarkNotFoundError/ - call nerdtree#echo("Bookmark isnt cached under the current root") + call nerdtree#echo('Bookmark isnt cached under the current root') endtry endfunction " FUNCTION: s:refreshRoot() {{{1 " Reloads the current root. All nodes below this will be lost and the root dir " will be reloaded. -function! s:refreshRoot() +function! s:refreshRoot() abort if !g:NERDTree.IsOpen() return endif - call nerdtree#echo("Refreshing the root node. This could take a while...") + call nerdtree#echo('Refreshing the root node. This could take a while...') let l:curWin = winnr() - call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w", 1) + call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', 1) call b:NERDTree.root.refresh() call b:NERDTree.render() redraw - call nerdtree#exec(l:curWin . "wincmd w", 1) - call nerdtree#echo("") + call nerdtree#exec(l:curWin . 'wincmd w', 1) + call nerdtree#echo('') endfunction " FUNCTION: s:refreshCurrent(node) {{{1 " refreshes the root for the current node -function! s:refreshCurrent(node) +function! s:refreshCurrent(node) abort let node = a:node if !node.path.isDirectory let node = node.parent endif - call nerdtree#echo("Refreshing node. This could take a while...") + call nerdtree#echo('Refreshing node. This could take a while...') call node.refresh() call b:NERDTree.render() - call nerdtree#echo("") + call nerdtree#echo('') endfunction " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 -function! nerdtree#ui_glue#setupCommands() +function! nerdtree#ui_glue#setupCommands() abort command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('') command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('') command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close() @@ -614,42 +614,42 @@ function! nerdtree#ui_glue#setupCommands() endfunction " Function: s:SID() {{{1 -function s:SID() - if !exists("s:sid") +function! s:SID() abort + if !exists('s:sid') let s:sid = matchstr(expand(''), '\zs\d\+\ze_SID$') endif return s:sid endfun " FUNCTION: s:showMenu(node) {{{1 -function! s:showMenu(node) +function! s:showMenu(node) abort let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) call mc.showMenu() endfunction " FUNCTION: s:toggleIgnoreFilter() {{{1 -function! s:toggleIgnoreFilter() +function! s:toggleIgnoreFilter() abort call b:NERDTree.ui.toggleIgnoreFilter() endfunction " FUNCTION: s:toggleShowBookmarks() {{{1 -function! s:toggleShowBookmarks() +function! s:toggleShowBookmarks() abort call b:NERDTree.ui.toggleShowBookmarks() endfunction " FUNCTION: s:toggleShowFiles() {{{1 -function! s:toggleShowFiles() +function! s:toggleShowFiles() abort call b:NERDTree.ui.toggleShowFiles() endfunction " FUNCTION: s:toggleShowHidden() {{{1 " toggles the display of hidden files -function! s:toggleShowHidden() +function! s:toggleShowHidden() abort call b:NERDTree.ui.toggleShowHidden() endfunction " FUNCTION: s:toggleZoom() {{{1 -function! s:toggleZoom() +function! s:toggleZoom() abort call b:NERDTree.ui.toggleZoom() endfunction @@ -659,7 +659,7 @@ endfunction " Args: " preserveState: if 1, the current root is left open when the new tree is " rendered; if 0, the current root node is closed -function! nerdtree#ui_glue#upDir(preserveState) +function! nerdtree#ui_glue#upDir(preserveState) abort try call b:NERDTree.root.cacheParent() @@ -683,12 +683,12 @@ function! nerdtree#ui_glue#upDir(preserveState) endfunction " FUNCTION: s:upDirCurrentRootOpen() {{{1 -function! s:upDirCurrentRootOpen() +function! s:upDirCurrentRootOpen() abort call nerdtree#ui_glue#upDir(1) endfunction " FUNCTION: s:upDirCurrentRootClosed() {{{1 -function! s:upDirCurrentRootClosed() +function! s:upDirCurrentRootClosed() abort call nerdtree#ui_glue#upDir(0) endfunction diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index be0011d2..857e6823 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1238,7 +1238,7 @@ 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 -responsible pull request: https://github.com/scrooloose/nerdtree/pull/868. +responsible pull request: https://github.com/preservim/nerdtree/pull/868. The default value of this variable depends on the features compiled into your vim and the values of |NERDTreeDirArrowCollapsible| and @@ -1498,11 +1498,11 @@ in the fridge for later ;) 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. +to submit an issue at http://github.com/preservim/nerdtree/issues. The latest stable and development versions are on Github. - Stable: http://github.com/scrooloose/nerdtree (master branch) - Development: http://github.com/scrooloose/nerdtree/branches + Stable: http://github.com/preservim/nerdtree (master branch) + Development: http://github.com/preservim/nerdtree/branches Title Credit: * http://ascii.co.uk/art/tree diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index b206e7a4..248bb074 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -33,7 +33,7 @@ endfunction " Class method to get all bookmarks. Lazily initializes the bookmarks global " variable function! s:Bookmark.Bookmarks() - if !exists("g:NERDTreeBookmarks") + if !exists('g:NERDTreeBookmarks') let g:NERDTreeBookmarks = [] endif return g:NERDTreeBookmarks @@ -53,7 +53,7 @@ endfunction " FUNCTION: Bookmark.BookmarkFor(name) {{{1 " Class method that returns the Bookmark object having the specified name. -" Throws "NERDTree.BookmarkNotFoundError" if no Bookmark is found. +" Throws NERDTree.BookmarkNotFoundError if no Bookmark is found. function! s:Bookmark.BookmarkFor(name) let l:result = {} for l:bookmark in s:Bookmark.Bookmarks() @@ -93,7 +93,7 @@ function! s:Bookmark.CacheBookmarks(silent) for i in bookmarkStrings "ignore blank lines - if i != '' + if i !=# '' let name = substitute(i, '^\(.\{-}\) .*$', '\1', '') let path = substitute(i, '^.\{-} \(.*\)$', '\1', '') @@ -111,7 +111,7 @@ function! s:Bookmark.CacheBookmarks(silent) if invalidBookmarksFound call s:Bookmark.Write() if !a:silent - call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.") + call nerdtree#echo(invalidBookmarksFound . ' invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.') endif endif endif @@ -120,16 +120,16 @@ endfunction " FUNCTION: Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark) {{{1 " Class method that indicates the relative position of two bookmarks when " placed in alphabetical order by name. Case-sensitivity is determined by an -" option. Supports the "s:Bookmark.SortBookmarksList()" method. +" option. Supports the s:Bookmark.SortBookmarksList() method. function! s:Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark) let l:result = 0 - if g:NERDTreeBookmarksSort == 1 + if g:NERDTreeBookmarksSort ==# 1 if a:firstBookmark.name ? a:secondBookmark.name let l:result = 1 endif - elseif g:NERDTreeBookmarksSort == 2 + elseif g:NERDTreeBookmarksSort ==# 2 if a:firstBookmark.name <# a:secondBookmark.name let l:result = -1 elseif a:firstBookmark.name ># a:secondBookmark.name @@ -159,13 +159,13 @@ endfunction " FUNCTION: s:Edit() {{{1 " opens the NERDTreeBookmarks file for manual editing function! s:Bookmark.Edit() - call nerdtree#exec("wincmd w", 1) - call nerdtree#exec("edit ".g:NERDTreeBookmarksFile, 1) + call nerdtree#exec('wincmd w', 1) + call nerdtree#exec('edit '.g:NERDTreeBookmarksFile, 1) endfunction " FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1 " Returns the tree node object associated with this Bookmark. -" Throws "NERDTree.BookmarkedNodeNotFoundError" if the node is not found. +" Throws NERDTree.BookmarkedNodeNotFoundError if the node is not found. " " Args: " searchFromAbsoluteRoot: boolean flag, search from the highest cached node @@ -185,8 +185,8 @@ endfunction " FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1 " Class method that returns the tree node object for the Bookmark with the -" given name. Throws "NERDTree.BookmarkNotFoundError" if a Bookmark with the -" name does not exist. Throws "NERDTree.BookmarkedNodeNotFoundError" if a +" given name. Throws NERDTree.BookmarkNotFoundError if a Bookmark with the +" name does not exist. Throws NERDTree.BookmarkedNodeNotFoundError if a " tree node for the named Bookmark could not be found. function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) let l:bookmark = s:Bookmark.BookmarkFor(a:name) @@ -196,9 +196,9 @@ endfunction " FUNCTION: Bookmark.GetSelected() {{{1 " returns the Bookmark the cursor is over, or {} function! s:Bookmark.GetSelected() - let line = getline(".") + let line = getline('.') let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '') - if name != line + if name !=# line try return s:Bookmark.BookmarkFor(name) catch /^NERDTree.BookmarkNotFoundError/ @@ -212,7 +212,7 @@ endfunction " Class method to get all invalid bookmark strings read from the bookmarks " file function! s:Bookmark.InvalidBookmarks() - if !exists("g:NERDTreeInvalidBookmarks") + if !exists('g:NERDTreeInvalidBookmarks') let g:NERDTreeInvalidBookmarks = [] endif return g:NERDTreeInvalidBookmarks @@ -222,8 +222,8 @@ endfunction function! s:Bookmark.mustExist() if !self.path.exists() call s:Bookmark.CacheBookmarks(1) - throw "NERDTree.BookmarkPointsToInvalidLocationError: the bookmark \"". - \ self.name ."\" points to a non existing location: \"". self.path.str() + throw 'NERDTree.BookmarkPointsToInvalidLocationError: the bookmark "'. + \ self.name .'" points to a non existing location: "'. self.path.str() endif endfunction @@ -231,7 +231,7 @@ endfunction " Create a new bookmark object with the given name and path object function! s:Bookmark.New(name, path) if a:name =~# ' ' - throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name + throw 'NERDTree.IllegalBookmarkNameError: illegal name:' . a:name endif let newBookmark = copy(self) @@ -292,7 +292,7 @@ endfunction " Get the string that should be rendered in the view for this bookmark function! s:Bookmark.str() let pathStrMaxLen = winwidth(g:NERDTree.GetWinNum()) - 4 - strdisplaywidth(self.name) - if &nu + if &number let pathStrMaxLen = pathStrMaxLen - &numberwidth endif @@ -335,7 +335,7 @@ function! s:Bookmark.validate() return 1 else call s:Bookmark.CacheBookmarks(1) - call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.") + call nerdtree#echo(self.name . 'now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.') return 0 endif endfunction @@ -349,7 +349,7 @@ function! s:Bookmark.Write() endfor "add a blank line before the invalid ones - call add(bookmarkStrings, "") + call add(bookmarkStrings, '') for j in s:Bookmark.InvalidBookmarks() call add(bookmarkStrings, j) @@ -358,7 +358,7 @@ function! s:Bookmark.Write() try call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) catch - call nerdtree#echoError("Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.") + call nerdtree#echoError('Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.') endtry endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index efd3cc81..39e3f554 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -82,20 +82,20 @@ function! s:Creator.createWindowTree(dir) try let path = g:NERDTreePath.New(a:dir) catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("Invalid directory name:" . a:name) + call nerdtree#echo('Invalid directory name:' . a:dir) return endtry "we want the directory buffer to disappear when we do the :edit below setlocal bufhidden=wipe - let previousBuf = expand("#") + let previousBuf = expand('#') "we need a unique name for each window tree buffer to ensure they are "all independent - exec g:NERDTreeCreatePrefix . " edit " . self._nextBufferName() + exec g:NERDTreeCreatePrefix . ' edit ' . self._nextBufferName() - call self._createNERDTree(path, "window") + call self._createNERDTree(path, 'window') let b:NERDTree._previousBuf = bufnr(previousBuf) call self._setCommonBufOptions() @@ -109,7 +109,7 @@ function! s:Creator._createNERDTree(path, type) let b:NERDTree = g:NERDTree.New(a:path, a:type) " TODO: This assignment is kept for compatibility reasons. Many other - " plugins use "b:NERDTreeRoot" instead of "b:NERDTree.root". Remove this + " plugins use b:NERDTreeRoot instead of b:NERDTree.root. Remove this " assignment in the future. let b:NERDTreeRoot = b:NERDTree.root @@ -126,9 +126,9 @@ endfunction function! s:Creator.createMirror() "get the names off all the nerd tree buffers let treeBufNames = [] - for i in range(1, tabpagenr("$")) + for i in range(1, tabpagenr('$')) let nextName = self._tabpagevar(i, 'NERDTreeBufName') - if nextName != -1 && (!exists("t:NERDTreeBufName") || nextName != t:NERDTreeBufName) + if nextName != -1 && (!exists('t:NERDTreeBufName') || nextName != t:NERDTreeBufName) call add(treeBufNames, nextName) endif endfor @@ -140,7 +140,7 @@ function! s:Creator.createMirror() let i = 0 while i < len(treeBufNames) let bufName = treeBufNames[i] - let treeRoot = getbufvar(bufName, "NERDTree").root + let treeRoot = getbufvar(bufName, 'NERDTree').root let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName let i = i + 1 endwhile @@ -148,7 +148,7 @@ function! s:Creator.createMirror() "work out which tree to mirror, if there is more than 1 then ask the user let bufferName = '' if len(keys(options)) > 1 - let choices = ["Choose a tree to mirror"] + let choices = ['Choose a tree to mirror'] let choices = extend(choices, sort(keys(options))) let choice = inputlist(choices) if choice < 1 || choice > len(options) || choice ==# '' @@ -159,7 +159,7 @@ function! s:Creator.createMirror() elseif len(keys(options)) ==# 1 let bufferName = values(options)[0] else - call nerdtree#echo("No trees to mirror") + call nerdtree#echo('No trees to mirror') return endif @@ -227,7 +227,7 @@ endfunction " FUNCTION: s:Creator._nextBufferNumber() {{{1 " the number to add to the nerd tree buffer name to make the buf name unique function! s:Creator._nextBufferNumber() - if !exists("s:Creator._NextBufNum") + if !exists('s:Creator._NextBufNum') let s:Creator._NextBufNum = 1 else let s:Creator._NextBufNum += 1 @@ -254,7 +254,7 @@ function! s:Creator._pathForString(str) try let path = g:NERDTreePath.New(dir) catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("No bookmark or directory found for: " . a:str) + call nerdtree#echo('No bookmark or directory found for: ' . a:str) return {} endtry endif @@ -274,7 +274,7 @@ function! s:Creator._removeTreeBufForTab() "nerdtree buf may be mirrored/displayed elsewhere if self._isBufHidden(buf) - exec "bwipeout " . buf + exec 'bwipeout ' . buf endif endif @@ -300,11 +300,11 @@ function! s:Creator._setCommonBufOptions() setlocal nowrap if g:NERDTreeShowLineNumbers - setlocal nu + setlocal number else - setlocal nonu + setlocal nonumber if v:version >= 703 - setlocal nornu + setlocal norelativenumber endif endif @@ -330,17 +330,17 @@ endfunction " FUNCTION: s:Creator._tabpagevar(tabnr, var) {{{1 function! s:Creator._tabpagevar(tabnr, var) let currentTab = tabpagenr() - let old_ei = &ei - set ei=all + let old_ei = &eventignore + set eventignore=all - exec "tabnext " . a:tabnr + exec 'tabnext ' . a:tabnr let v = -1 if exists('t:' . a:var) exec 'let v = t:' . a:var endif - exec "tabnext " . currentTab + exec 'tabnext ' . currentTab - let &ei = old_ei + let &eventignore = old_ei return v endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim b/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim index bc6e8879..75528674 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim @@ -43,13 +43,13 @@ endfunction "FUNCTION: FlagSet.renderToString() {{{1 function! s:FlagSet.renderToString() - let flagstring = "" + let flagstring = '' for i in values(self._flags) let flagstring .= join(i) endfor if len(flagstring) == 0 - return "" + return '' endif return '[' . flagstring . ']' diff --git a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim index 6714ee41..f3268c26 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim @@ -53,7 +53,7 @@ function! s:KeyMap.bind() endif let keymapInvokeString = escape(keymapInvokeString, '\') - let premap = self.key == "" ? " " : " " + let premap = self.key ==# '' ? ' ' : ' ' exec 'nnoremap '. self.key . premap . ':call nerdtree#ui_glue#invokeKeyMap("'. keymapInvokeString .'")' endfunction @@ -66,7 +66,7 @@ endfunction "FUNCTION: KeyMap.invoke() {{{1 "Call the KeyMaps callback function function! s:KeyMap.invoke(...) - let Callback = type(self.callback) == type(function("tr")) ? self.callback : function(self.callback) + let Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback) if a:0 call Callback(a:1) else @@ -78,11 +78,11 @@ endfunction "Find a keymapping for a:key and the current scope invoke it. " "Scope is determined as follows: -" * if the cursor is on a dir node then "DirNode" -" * if the cursor is on a file node then "FileNode" -" * if the cursor is on a bookmark then "Bookmark" +" * if the cursor is on a dir node then DirNode +" * if the cursor is on a file node then FileNode +" * if the cursor is on a bookmark then Bookmark " -"If a keymap has the scope of "all" then it will be called if no other keymap +"If a keymap has the scope of 'all' then it will be called if no other keymap "is found for a:key and the scope. function! s:KeyMap.Invoke(key) @@ -100,7 +100,7 @@ function! s:KeyMap.Invoke(key) "try file node if !node.path.isDirectory - let km = s:KeyMap.FindFor(a:key, "FileNode") + let km = s:KeyMap.FindFor(a:key, 'FileNode') if !empty(km) return km.invoke(node) endif @@ -108,14 +108,14 @@ function! s:KeyMap.Invoke(key) "try dir node if node.path.isDirectory - let km = s:KeyMap.FindFor(a:key, "DirNode") + let km = s:KeyMap.FindFor(a:key, 'DirNode') if !empty(km) return km.invoke(node) endif endif "try generic node - let km = s:KeyMap.FindFor(a:key, "Node") + let km = s:KeyMap.FindFor(a:key, 'Node') if !empty(km) return km.invoke(node) endif @@ -125,14 +125,14 @@ function! s:KeyMap.Invoke(key) "try bookmark let bm = g:NERDTreeBookmark.GetSelected() if !empty(bm) - let km = s:KeyMap.FindFor(a:key, "Bookmark") + let km = s:KeyMap.FindFor(a:key, 'Bookmark') if !empty(km) return km.invoke(bm) endif endif "try all - let km = s:KeyMap.FindFor(a:key, "all") + let km = s:KeyMap.FindFor(a:key, 'all') if !empty(km) return km.invoke() endif @@ -143,7 +143,7 @@ function! s:KeyMap.Create(options) let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options)) "dont override other mappings unless the 'override' option is given - if get(opts, 'override', 0) == 0 && !empty(s:KeyMap.FindFor(opts['key'], opts['scope'])) + if get(opts, 'override', 0) ==# 0 && !empty(s:KeyMap.FindFor(opts['key'], opts['scope'])) return end diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim index 874c09dc..952c67bd 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_controller.vim @@ -44,13 +44,13 @@ function! s:MenuController.showMenu() finally call self._restoreOptions() - " Redraw when "Ctrl-C" or "Esc" is received. - if !l:done || self.selection == -1 + " Redraw when Ctrl-C or Esc is received. + if !l:done || self.selection ==# -1 redraw! endif endtry - if self.selection != -1 + if self.selection !=# -1 let l:m = self._current() call l:m.execute() endif @@ -58,25 +58,25 @@ endfunction "FUNCTION: MenuController._echoPrompt() {{{1 function! s:MenuController._echoPrompt() - let navHelp = "Use " . g:NERDTreeMenuDown . "/" . g:NERDTreeMenuUp . "/enter" + let navHelp = 'Use ' . g:NERDTreeMenuDown . '/' . g:NERDTreeMenuUp . '/enter' if self.isMinimal() let selection = self.menuItems[self.selection].text - let keyword = matchstr(selection, "\([^ ]*") + let keyword = matchstr(selection, '[^ ]*([^ ]*') let shortcuts = map(copy(self.menuItems), "v:val['shortcut']") - let shortcuts[self.selection] = " " . keyword . " " + let shortcuts[self.selection] = ' ' . keyword . ' ' - echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): " + echo 'Menu: [' . join(shortcuts, ',') . '] (' . navHelp . ' or shortcut): ' else - echo "NERDTree Menu. " . navHelp . ", or the shortcuts indicated" - echo "=========================================================" + echo 'NERDTree Menu. ' . navHelp . ', or the shortcuts indicated' + echo '=========================================================' for i in range(0, len(self.menuItems)-1) - if self.selection == i - echo "> " . self.menuItems[i].text + if self.selection ==# i + echo '> ' . self.menuItems[i].text else - echo " " . self.menuItems[i].text + echo ' ' . self.menuItems[i].text endif endfor endif @@ -92,20 +92,20 @@ 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 == g:NERDTreeMenuDown + if a:key ==# g:NERDTreeMenuDown call self._cursorDown() - elseif a:key == g:NERDTreeMenuUp + elseif a:key ==# g:NERDTreeMenuUp call self._cursorUp() - elseif a:key == nr2char(27) "escape + elseif a:key ==# nr2char(27) "escape let self.selection = -1 return 1 - elseif a:key == "\r" || a:key == "\n" "enter and ctrl-j + elseif a:key ==# "\r" || a:key ==# "\n" "enter and ctrl-j return 1 else let index = self._nextIndexFor(a:key) - if index != -1 + if index !=# -1 let self.selection = index - if len(self._allIndexesFor(a:key)) == 1 + if len(self._allIndexesFor(a:key)) ==# 1 return 1 endif endif @@ -120,7 +120,7 @@ function! s:MenuController._allIndexesFor(shortcut) let toReturn = [] for i in range(0, len(self.menuItems)-1) - if self.menuItems[i].shortcut == a:shortcut + if self.menuItems[i].shortcut ==# a:shortcut call add(toReturn, i) endif endfor @@ -133,13 +133,13 @@ endfunction "current cursor location and wraps around to the top again if need be function! s:MenuController._nextIndexFor(shortcut) for i in range(self.selection+1, len(self.menuItems)-1) - if self.menuItems[i].shortcut == a:shortcut + if self.menuItems[i].shortcut ==# a:shortcut return i endif endfor for i in range(0, self.selection) - if self.menuItems[i].shortcut == a:shortcut + if self.menuItems[i].shortcut ==# a:shortcut return i endif endfor diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim index 8a74bb1a..7f259171 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim @@ -6,7 +6,7 @@ let g:NERDTreeMenuItem = s:MenuItem "FUNCTION: MenuItem.All() {{{1 "get all top level menu items function! s:MenuItem.All() - if !exists("s:menuItems") + if !exists('s:menuItems') let s:menuItems = [] endif return s:menuItems @@ -58,7 +58,7 @@ function! s:MenuItem.CreateSeparator(options) let standard_options = { 'text': '--------------------', \ 'shortcut': -1, \ 'callback': -1 } - let options = extend(a:options, standard_options, "force") + let options = extend(a:options, standard_options, 'force') return s:MenuItem.Create(options) endfunction @@ -67,7 +67,7 @@ endfunction "make a new submenu and add it to global list function! s:MenuItem.CreateSubmenu(options) let standard_options = { 'callback': -1 } - let options = extend(a:options, standard_options, "force") + let options = extend(a:options, standard_options, 'force') return s:MenuItem.Create(options) endfunction @@ -79,7 +79,7 @@ endfunction "specified function! s:MenuItem.enabled() if self.isActiveCallback != -1 - return type(self.isActiveCallback) == type(function("tr")) ? self.isActiveCallback() : {self.isActiveCallback}() + return type(self.isActiveCallback) == type(function('tr')) ? self.isActiveCallback() : {self.isActiveCallback}() endif return 1 endfunction @@ -94,7 +94,7 @@ function! s:MenuItem.execute() call mc.showMenu() else if self.callback != -1 - if type(self.callback) == type(function("tr")) + if type(self.callback) == type(function('tr')) call self.callback() else call {self.callback}() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index 3e7ade8a..a48f6a86 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -37,26 +37,26 @@ function! s:NERDTree.Close() return endif - if winnr("$") != 1 + if winnr('$') !=# 1 " Use the window ID to identify the currently active window or fall " back on the buffer ID if win_getid/win_gotoid are not available, in " which case we'll focus an arbitrary window showing the buffer. let l:useWinId = exists('*win_getid') && exists('*win_gotoid') - if winnr() == s:NERDTree.GetWinNum() - call nerdtree#exec("wincmd p", 1) - let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("") - call nerdtree#exec("wincmd p", 1) + if winnr() ==# s:NERDTree.GetWinNum() + call nerdtree#exec('wincmd p', 1) + let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr('') + call nerdtree#exec('wincmd p', 1) else - let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("") + let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr('') endif - call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1) - call nerdtree#exec("close", 0) + call nerdtree#exec(s:NERDTree.GetWinNum() . ' wincmd w', 1) + call nerdtree#exec('close', 0) if l:useWinId - call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0) + call nerdtree#exec('call win_gotoid(' . l:activeBufOrWin . ')', 0) else - call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w", 0) + call nerdtree#exec(bufwinnr(l:activeBufOrWin) . ' wincmd w', 0) endif else close @@ -75,7 +75,7 @@ endfunction "Places the cursor at the top of the bookmarks table function! s:NERDTree.CursorToBookmarkTable() if !b:NERDTree.ui.getShowBookmarks() - throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active" + throw 'NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active' endif if g:NERDTreeMinimalUI @@ -88,7 +88,7 @@ function! s:NERDTree.CursorToBookmarkTable() while getline(line) !~# '^>-\+Bookmarks-\+$' let line = line + 1 if line >= rootNodeLine - throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table" + throw 'NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table' endif endwhile call cursor(line, 2) @@ -98,19 +98,19 @@ endfunction "Places the cursor in the nerd tree window function! s:NERDTree.CursorToTreeWin() call g:NERDTree.MustBeOpen() - call nerdtree#exec(g:NERDTree.GetWinNum() . "wincmd w", 1) + call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', 1) endfunction " Function: s:NERDTree.ExistsForBuffer() {{{1 " Returns 1 if a nerd tree root exists in the current buffer function! s:NERDTree.ExistsForBuf() - return exists("b:NERDTree") + return exists('b:NERDTree') endfunction " Function: s:NERDTree.ExistsForTab() {{{1 " Returns 1 if a nerd tree root exists in the current tab function! s:NERDTree.ExistsForTab() - if !exists("t:NERDTreeBufName") + if !exists('t:NERDTreeBufName') return end @@ -133,7 +133,7 @@ function! s:NERDTree.ForCurrentTab() endif let bufnr = bufnr(t:NERDTreeBufName) - return getbufvar(bufnr, "NERDTree") + return getbufvar(bufnr, 'NERDTree') endfunction "FUNCTION: s:NERDTree.getRoot() {{{1 @@ -144,7 +144,7 @@ endfunction "FUNCTION: s:NERDTree.GetWinNum() {{{1 "gets the nerd tree window number for this tab function! s:NERDTree.GetWinNum() - if exists("t:NERDTreeBufName") + if exists('t:NERDTreeBufName') return bufwinnr(t:NERDTreeBufName) endif @@ -160,23 +160,23 @@ endfunction "FUNCTION: s:NERDTree.IsOpen() {{{1 function! s:NERDTree.IsOpen() - return s:NERDTree.GetWinNum() != -1 + return s:NERDTree.GetWinNum() !=# -1 endfunction "FUNCTION: s:NERDTree.isTabTree() {{{1 function! s:NERDTree.isTabTree() - return self._type == "tab" + return self._type ==# 'tab' endfunction "FUNCTION: s:NERDTree.isWinTree() {{{1 function! s:NERDTree.isWinTree() - return self._type == "window" + return self._type ==# 'window' endfunction "FUNCTION: s:NERDTree.MustBeOpen() {{{1 function! s:NERDTree.MustBeOpen() if !s:NERDTree.IsOpen() - throw "NERDTree.TreeNotOpen" + throw 'NERDTree.TreeNotOpen' endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim index dfd48b33..fc3155d7 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -15,13 +15,13 @@ function! s:Notifier.NotifyListeners(event, path, nerdtree, params) let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params) for Listener in s:Notifier.GetListenersForEvent(a:event) - let Callback = type(Listener) == type(function("tr")) ? Listener : function(Listener) + let Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener) call Callback(event) endfor endfunction function! s:Notifier.GetListenersMap() - if !exists("s:refreshListenersMap") + if !exists('s:refreshListenersMap') let s:refreshListenersMap = {} endif return s:refreshListenersMap diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index fa0c9884..d8dba34e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -1,7 +1,7 @@ " ============================================================================ " CLASS: Opener " -" The Opener class defines an API for "opening" operations. +" The Opener class defines an API for 'opening' operations. " ============================================================================ @@ -45,7 +45,7 @@ function! s:Opener._checkToCloseTree(newtab) return endif - if (a:newtab && self._where == 't') || !a:newtab + if (a:newtab && self._where ==# 't') || !a:newtab call g:NERDTree.CloseIfQuitOnOpen() endif endfunction @@ -54,9 +54,9 @@ endfunction " find the window number of the first normal window function! s:Opener._firstUsableWindow() let i = 1 - while i <= winnr("$") + while i <= winnr('$') let bnum = winbufnr(i) - if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' + if bnum !=# -1 && getbufvar(bnum, '&buftype') ==# '' \ && !getwinvar(i, '&previewwindow') \ && (!getbufvar(bnum, '&modified') || &hidden) return i @@ -70,23 +70,23 @@ endfunction " FUNCTION: Opener._gotoTargetWin() {{{1 function! s:Opener._gotoTargetWin() if b:NERDTree.isWinTree() - if self._where == 'v' + if self._where ==# 'v' call self._newVSplit() - elseif self._where == 'h' + elseif self._where ==# 'h' call self._newSplit() - elseif self._where == 't' + elseif self._where ==# 't' tabnew endif else call self._checkToCloseTree(1) - if self._where == 'v' + if self._where ==# 'v' call self._newVSplit() - elseif self._where == 'h' + elseif self._where ==# 'h' call self._newSplit() - elseif self._where == 't' + elseif self._where ==# 't' tabnew - elseif self._where == 'p' + elseif self._where ==# 'p' call self._previousWindow() endif @@ -102,15 +102,15 @@ endfunction " winnumber: the number of the window in question function! s:Opener._isWindowUsable(winnumber) "gotta split if theres only one window (i.e. the NERD tree) - if winnr("$") ==# 1 + if winnr('$') ==# 1 return 0 endif let oldwinnr = winnr() - call nerdtree#exec(a:winnumber . "wincmd p", 1) - let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') + call nerdtree#exec(a:winnumber . 'wincmd p', 1) + let specialWindow = getbufvar('%', '&buftype') !=# '' || getwinvar('%', '&previewwindow') let modified = &modified - call nerdtree#exec(oldwinnr . "wincmd p", 1) + call nerdtree#exec(oldwinnr . 'wincmd p', 1) "if its a special window e.g. quickfix or another explorer plugin then we "have to split @@ -131,9 +131,9 @@ endfunction " a:path: the path object that is to be opened " a:opts: a dictionary containing the following optional keys... " 'where': specifies whether the node should be opened in new split, in -" a new tab or, in the last window; takes values "v", "h", or "t" +" a new tab or, in the last window; takes values 'v', 'h', or 't' " 'reuse': if file is already shown in a window, jump there; takes values -" "all", "currenttab", or empty +" 'all', 'currenttab', or empty " 'keepopen': boolean (0 or 1); if true, the tree window will not be closed " 'stay': boolean (0 or 1); if true, remain in tree window after opening function! s:Opener.New(path, opts) @@ -153,21 +153,21 @@ endfunction " FUNCTION: Opener._newSplit() {{{1 function! s:Opener._newSplit() - let onlyOneWin = (winnr("$") ==# 1) + let onlyOneWin = (winnr('$') ==# 1) let savesplitright = &splitright if onlyOneWin - let &splitright = (g:NERDTreeWinPos ==# "left") + let &splitright = (g:NERDTreeWinPos ==# 'left') endif " If only one window (ie. NERDTree), split vertically instead. - let splitMode = onlyOneWin ? "vertical" : "" + let splitMode = onlyOneWin ? 'vertical' : '' " Open the new window try call nerdtree#exec('wincmd p', 1) - call nerdtree#exec(splitMode . " split",1) + call nerdtree#exec(splitMode . ' split',1) catch /^Vim\%((\a\+)\)\=:E37/ call g:NERDTree.CursorToTreeWin() - throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." + throw 'NERDTree.FileAlreadyOpenAndModifiedError: '. self._path.str() .' is already open and modified.' catch /^Vim\%((\a\+)\)\=:/ "do nothing endtry @@ -187,10 +187,10 @@ endfunction function! s:Opener._newVSplit() let l:winwidth = winwidth('.') - let onlyOneWin = (winnr("$") ==# 1) + let onlyOneWin = (winnr('$') ==# 1) let savesplitright = &splitright if onlyOneWin - let &splitright = (g:NERDTreeWinPos ==# "left") + let &splitright = (g:NERDTreeWinPos ==# 'left') let l:winwidth = g:NERDTreeWinSize endif @@ -219,7 +219,7 @@ endfunction " FUNCTION: Opener._openFile() {{{1 function! s:Opener._openFile() - if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists("b:NERDTreeZoomed") && b:NERDTreeZoomed + if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed call b:NERDTree.ui.toggleZoom() endif @@ -247,7 +247,7 @@ function! s:Opener._openDirectory(node) else if empty(self._where) call b:NERDTree.changeRoot(a:node) - elseif self._where == 't' + elseif self._where ==# 't' call g:NERDTreeCreator.CreateTabTree(a:node.path.str()) else call g:NERDTreeCreator.CreateWindowTree(a:node.path.str()) @@ -261,18 +261,18 @@ endfunction " FUNCTION: Opener._previousWindow() {{{1 function! s:Opener._previousWindow() - if !self._isWindowUsable(winnr("#")) && self._firstUsableWindow() ==# -1 + if !self._isWindowUsable(winnr('#')) && self._firstUsableWindow() ==# -1 call self._newSplit() else try - if !self._isWindowUsable(winnr("#")) - call nerdtree#exec(self._firstUsableWindow() . "wincmd w", 1) + if !self._isWindowUsable(winnr('#')) + call nerdtree#exec(self._firstUsableWindow() . 'wincmd w', 1) else call nerdtree#exec('wincmd p', 1) endif catch /^Vim\%((\a\+)\)\=:E37/ call g:NERDTree.CursorToTreeWin() - throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified." + throw 'NERDTree.FileAlreadyOpenAndModifiedError: '. self._path.str() .' is already open and modified.' catch /^Vim\%((\a\+)\)\=:/ echo v:exception endtry @@ -296,13 +296,13 @@ function! s:Opener._reuseWindow() "check the current tab for the window let winnr = bufwinnr('^' . self._path.str() . '$') - if winnr != -1 - call nerdtree#exec(winnr . "wincmd w", 0) + if winnr !=# -1 + call nerdtree#exec(winnr . 'wincmd w', 0) call self._checkToCloseTree(0) return 1 endif - if self._reuse == 'currenttab' + if self._reuse ==# 'currenttab' return 0 endif @@ -312,7 +312,7 @@ function! s:Opener._reuseWindow() call self._checkToCloseTree(1) call nerdtree#exec(tabnr . 'tabnext', 1) let winnr = bufwinnr('^' . self._path.str() . '$') - call nerdtree#exec(winnr . "wincmd w", 0) + call nerdtree#exec(winnr . 'wincmd w', 0) return 1 endif @@ -321,7 +321,7 @@ endfunction " FUNCTION: Opener._saveCursorPos() {{{1 function! s:Opener._saveCursorPos() - let self._bufnr = bufnr("") + let self._bufnr = bufnr('') let self._tabnr = tabpagenr() endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 4ececf9e..6a23c7ba 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -25,7 +25,7 @@ function! s:Path.AbsolutePathFor(pathStr) if l:prependWorkingDir let l:result = getcwd() - if l:result[-1:] == s:Path.Slash() + if l:result[-1:] ==# s:Path.Slash() let l:result = l:result . a:pathStr else let l:result = l:result . s:Path.Slash() . a:pathStr @@ -37,7 +37,7 @@ endfunction " FUNCTION: Path.bookmarkNames() {{{1 function! s:Path.bookmarkNames() - if !exists("self._bookmarkNames") + if !exists('self._bookmarkNames') call self.cacheDisplayString() endif return self._bookmarkNames @@ -57,7 +57,7 @@ function! s:Path.cacheDisplayString() abort call add(self._bookmarkNames, i.name) endif endfor - if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks == 1 + if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks ==# 1 let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' {' . join(self._bookmarkNames) . '}' endif @@ -87,22 +87,22 @@ function! s:Path.changeToDir() endif try - if g:NERDTreeUseTCD && exists(":tcd") == 2 - execute "tcd " . dir + if g:NERDTreeUseTCD && exists(':tcd') ==# 2 + execute 'tcd ' . dir call nerdtree#echo("Tab's CWD is now: " . getcwd()) else - execute "cd " . dir - call nerdtree#echo("CWD is now: " . getcwd()) + execute 'cd ' . dir + call nerdtree#echo('CWD is now: ' . getcwd()) endif catch - throw "NERDTree.PathChangeError: cannot change CWD to " . dir + throw 'NERDTree.PathChangeError: cannot change CWD to ' . dir endtry endfunction " FUNCTION: Path.compareTo() {{{1 " " Compares this Path to the given path and returns 0 if they are equal, -1 if -" this Path is "less than" the given path, or 1 if it is "greater". +" this Path is 'less than' the given path, or 1 if it is 'greater'. " " Args: " path: the path object to compare this to @@ -188,7 +188,7 @@ endfunction " dest: the location to copy this dir/file to function! s:Path.copy(dest) if !s:Path.CopyingSupported() - throw "NERDTree.CopyingNotSupportedError: Copying is not supported on this OS" + throw 'NERDTree.CopyingNotSupportedError: Copying is not supported on this OS' endif call s:Path.createParentDirectories(a:dest) @@ -199,10 +199,10 @@ function! s:Path.copy(dest) let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd) endif - let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars()) + let cmd = cmd_prefix . ' ' . escape(self.str(), self._escChars()) . ' ' . escape(a:dest, self._escChars()) let success = system(cmd) - if v:shell_error != 0 - throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'" + if v:shell_error !=# 0 + throw "NERDTree.CopyError: Could not copy '". self.str() ."' to: '" . a:dest . "'" endif endfunction @@ -258,7 +258,7 @@ function! s:Path.delete() let cmd = g:NERDTreeRemoveDirCmd . self.str({'escape': 1}) let success = system(cmd) - if v:shell_error != 0 + if v:shell_error !=# 0 throw "NERDTree.PathDeletionError: Could not delete directory: '" . self.str() . "'" endif else @@ -269,7 +269,7 @@ function! s:Path.delete() let success = delete(self.str()) endif - if success != 0 + if success !=# 0 throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str() . "'" endif endif @@ -286,7 +286,7 @@ endfunction " Returns a string that specifies how the path should be represented as a " string function! s:Path.displayString() - if self.cachedDisplayString ==# "" + if self.cachedDisplayString ==# '' call self.cacheDisplayString() endif @@ -295,7 +295,7 @@ endfunction " FUNCTION: Path.edit() {{{1 function! s:Path.edit() - exec "edit " . self.str({'format': 'Edit'}) + exec 'edit ' . self.str({'format': 'Edit'}) endfunction " FUNCTION: Path.extractDriveLetter(fullpath) {{{1 @@ -303,10 +303,10 @@ endfunction " If running windows, cache the drive letter for this path function! s:Path.extractDriveLetter(fullpath) if nerdtree#runningWindows() - if a:fullpath =~ '^\(\\\\\|\/\/\)' + if a:fullpath =~# '^\(\\\\\|\/\/\)' "For network shares, the 'drive' consists of the first two parts of the path, i.e. \\boxname\share let self.drive = substitute(a:fullpath, '^\(\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\).*', '\1', '') - let self.drive = substitute(self.drive, '/', '\', "g") + let self.drive = substitute(self.drive, '/', '\', 'g') else let self.drive = substitute(a:fullpath, '\(^[a-zA-Z]:\).*', '\1', '') endif @@ -402,7 +402,7 @@ function! s:Path._splitChunks(path) let i = 0 while i < len(chunks) "convert number literals to numbers - if match(chunks[i], '^\d\+$') == 0 + if match(chunks[i], '^\d\+$') ==# 0 let chunks[i] = str2nr(chunks[i]) endif let i = i + 1 @@ -413,21 +413,21 @@ endfunction " FUNCTION: Path.getSortKey() {{{1 " returns a key used in compare function for sorting function! s:Path.getSortKey() - if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder + if !exists('self._sortKey') || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder " Look for file metadata tags: [[timestamp]], [[extension]], [[size]] let metadata = [] for tag in g:NERDTreeSortOrder if tag =~? '\[\[-\?timestamp\]\]' - let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~ '-' ? -1 : 1)] + let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~# '-' ? -1 : 1)] elseif tag =~? '\[\[-\?size\]\]' - let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~ '-' ? -1 : 1)] + let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~# '-' ? -1 : 1)] elseif tag =~? '\[\[extension\]\]' let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$') - let metadata += [self.isDirectory ? '' : (extension == '' ? nr2char(str2nr('0x10ffff',16)) : extension)] + let metadata += [self.isDirectory ? '' : (extension ==# '' ? nr2char(str2nr('0x10ffff',16)) : extension)] endif endfor - if g:NERDTreeSortOrder[0] =~ '\[\[.*\]\]' + if g:NERDTreeSortOrder[0] =~# '\[\[.*\]\]' " Apply tags' sorting first if specified first. let self._sortKey = metadata + [self.getSortOrderIndex()] else @@ -501,7 +501,7 @@ function! s:Path.ignore(nerdtree) endfor for Callback in g:NERDTree.PathFilters() - let Callback = type(Callback) == type(function("tr")) ? Callback : function(Callback) + let Callback = type(Callback) ==# type(function('tr')) ? Callback : function(Callback) if Callback({'path': self, 'nerdtree': a:nerdtree}) return 1 endif @@ -524,12 +524,12 @@ endfunction " returns true if this path matches the given ignore pattern function! s:Path._ignorePatternMatches(pattern) let pat = a:pattern - if strpart(pat,len(pat)-7) == '[[dir]]' + if strpart(pat,len(pat)-7) ==# '[[dir]]' if !self.isDirectory return 0 endif let pat = strpart(pat,0, len(pat)-7) - elseif strpart(pat,len(pat)-8) == '[[file]]' + elseif strpart(pat,len(pat)-8) ==# '[[file]]' if self.isDirectory return 0 endif @@ -550,19 +550,19 @@ function! s:Path.isAncestor(path) let this = self.str() let that = a:path.str() - return stridx(that, this) == 0 + return stridx(that, this) ==# 0 endfunction " FUNCTION: Path.isUnder(path) {{{1 " return 1 if this path is somewhere under the given path in the filesystem. function! s:Path.isUnder(path) - if a:path.isDirectory == 0 + if a:path.isDirectory ==# 0 return 0 endif let this = self.str() let that = a:path.str() - return stridx(this, that . s:Path.Slash()) == 0 + return stridx(this, that . s:Path.Slash()) ==# 0 endfunction " FUNCTION: Path.JoinPathStrings(...) {{{1 @@ -637,8 +637,8 @@ function! s:Path.readInfoFromDisk(fullpath) let fullpath = s:Path.WinToUnixPath(a:fullpath) - if getftype(fullpath) ==# "fifo" - throw "NERDTree.InvalidFiletypeError: Cant handle FIFO files: " . a:fullpath + if getftype(fullpath) ==# 'fifo' + throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath endif let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)') @@ -650,7 +650,7 @@ function! s:Path.readInfoFromDisk(fullpath) let self.isDirectory = 0 let self.isReadOnly = filewritable(a:fullpath) ==# 0 else - throw "NERDTree.InvalidArgumentsError: Invalid path = " . a:fullpath + throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath endif let self.isExecutable = 0 @@ -665,7 +665,7 @@ function! s:Path.readInfoFromDisk(fullpath) let hardPath = s:Path.Resolve(self.strTrunk()) . '/' . lastPathComponent "if the last part of the path is a symlink then flag it as such - let self.isSymLink = (s:Path.Resolve(hardPath) != hardPath) + let self.isSymLink = (s:Path.Resolve(hardPath) !=# hardPath) if self.isSymLink let self.symLinkDest = s:Path.Resolve(fullpath) @@ -700,13 +700,13 @@ endfunction " Renames this node on the filesystem function! s:Path.rename(newPath) if a:newPath ==# '' - throw "NERDTree.InvalidArgumentsError: Invalid newPath for renaming = ". a:newPath + throw 'NERDTree.InvalidArgumentsError: Invalid newPath for renaming = '. a:newPath endif call s:Path.createParentDirectories(a:newPath) let success = rename(self.str(), a:newPath) - if success != 0 + if success !=# 0 throw "NERDTree.PathRenameError: Could not rename: '" . self.str() . "'" . 'to:' . a:newPath endif call self.readInfoFromDisk(a:newPath) @@ -742,7 +742,7 @@ endfunction " value associated with 'truncateTo'. A '<' is prepended. function! s:Path.str(...) let options = a:0 ? a:1 : {} - let toReturn = "" + let toReturn = '' if has_key(options, 'format') let format = options['format'] @@ -779,7 +779,7 @@ endfunction " FUNCTION: Path._strForUI() {{{1 function! s:Path._strForUI() let toReturn = '/' . join(self.pathSegments, '/') - if self.isDirectory && toReturn != '/' + if self.isDirectory && toReturn !=# '/' let toReturn = toReturn . '/' endif return toReturn @@ -802,7 +802,7 @@ function! s:Path._strForEdit() " On Windows, the drive letter may be removed by "fnamemodify()". Add it " back, if necessary. - if nerdtree#runningWindows() && l:result[0] == s:Path.Slash() + if nerdtree#runningWindows() && l:result[0] ==# s:Path.Slash() let l:result = self.drive . l:result endif @@ -883,13 +883,13 @@ function! s:Path.WinToUnixPath(pathstr) let toReturn = a:pathstr "remove the x:\ of the front - let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', "") + let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', '') "remove the \\ network share from the front - let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', "") + let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', '') "convert all \ chars to / - let toReturn = substitute(toReturn, '\', '/', "g") + let toReturn = substitute(toReturn, '\', '/', 'g') return toReturn endfunction 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 4015f0be..1502ea73 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -14,7 +14,7 @@ let g:NERDTreeDirNode = s:TreeDirNode " Class method that returns the highest cached ancestor of the current root. function! s:TreeDirNode.AbsoluteTreeRoot() let currentNode = b:NERDTree.root - while currentNode.parent != {} + while currentNode.parent !=# {} let currentNode = currentNode.parent endwhile return currentNode @@ -100,7 +100,7 @@ function! s:TreeDirNode.displayString() let l:cascade = self.getCascade() for l:dirNode in l:cascade let l:next = l:dirNode.path.displayString() - let l:label .= l:label == '' ? l:next : substitute(l:next,'^.','','') + let l:label .= l:label ==# '' ? l:next : substitute(l:next,'^.','','') endfor " Select the appropriate open/closed status indicator symbol. @@ -133,7 +133,7 @@ function! s:TreeDirNode.findNode(path) if self.path.isDirectory for i in self.children let retVal = i.findNode(a:path) - if retVal != {} + if retVal !=# {} return retVal endif endfor @@ -169,7 +169,7 @@ function! s:TreeDirNode.getCascadeRoot() while !empty(l:parent) && !l:parent.isRoot() - if index(l:parent.getCascade(), self) == -1 + if index(l:parent.getCascade(), self) ==# -1 break endif @@ -218,7 +218,7 @@ endfunction function! s:TreeDirNode.getChildByIndex(indx, visible) let array_to_search = a:visible? self.getVisibleChildren() : self.children if a:indx > len(array_to_search) - throw "NERDTree.InvalidArgumentsError: Index is out of bounds." + throw 'NERDTree.InvalidArgumentsError: Index is out of bounds.' endif return array_to_search[a:indx] endfunction @@ -255,10 +255,10 @@ function! s:TreeDirNode.getChildIndex(path) endfunction " FUNCTION: TreeDirNode.getDirChildren() {{{1 -" Return a list of all child nodes from "self.children" that are of type +" 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') + return filter(copy(self.children), 'v:val.path.isDirectory ==# 1') endfunction " FUNCTION: TreeDirNode._glob(pattern, all) {{{1 @@ -267,7 +267,7 @@ endfunction " " Args: " pattern: (string) the glob pattern to apply -" all: (0 or 1) if 1, include "." and ".." if they match "pattern"; if 0, +" all: (0 or 1) if 1, include '.' and '..' if they match 'pattern'; if 0, " always exclude them " " Note: If the pathnames in the result list are below the working directory, @@ -276,28 +276,28 @@ endfunction " relative paths. function! s:TreeDirNode._glob(pattern, all) - " Construct a path specification such that "globpath()" will return + " Construct a path specification such that globpath() will return " relative pathnames, if possible. - if self.path.str() == getcwd() + if self.path.str() ==# getcwd() let l:pathSpec = ',' else let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',') - " On Windows, the drive letter may be removed by "fnamemodify()". - if nerdtree#runningWindows() && l:pathSpec[0] == g:NERDTreePath.Slash() + " On Windows, the drive letter may be removed by fnamemodify(). + if nerdtree#runningWindows() && l:pathSpec[0] ==# g:NERDTreePath.Slash() let l:pathSpec = self.path.drive . l:pathSpec endif endif let l:globList = [] - " See ":h version7.txt" and ":h version8.txt" for details on the - " development of the "glob()" and "globpath()" functions. - if v:version > 704 || (v:version == 704 && has('patch654')) + " See ':h version7.txt' and ':h version8.txt' for details on the + " development of the glob() and globpath() functions. + if v:version > 704 || (v:version ==# 704 && has('patch654')) let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0) - elseif v:version == 704 && has('patch279') + elseif v:version ==# 704 && has('patch279') let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1) - elseif v:version > 702 || (v:version == 702 && has('patch051')) + elseif v:version > 702 || (v:version ==# 702 && has('patch051')) let l:globString = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore) let l:globList = split(l:globString, "\n") else @@ -305,7 +305,7 @@ function! s:TreeDirNode._glob(pattern, all) let l:globList = split(l:globString, "\n") endif - " If "a:all" is false, filter "." and ".." from the output. + " If a:all is false, filter '.' and '..' from the output. if !a:all let l:toRemove = [] @@ -315,13 +315,13 @@ function! s:TreeDirNode._glob(pattern, all) " If l:file has a trailing slash, then its :tail will be ''. Use " :h to drop the slash and the empty string after it; then use :t " to get the directory name. - if l:tail == '' + if l:tail ==# '' let l:tail = fnamemodify(l:file, ':h:t') endif - if l:tail == '.' || l:tail == '..' + if l:tail ==# '.' || l:tail ==# '..' call add(l:toRemove, l:file) - if len(l:toRemove) == 2 + if len(l:toRemove) ==# 2 break endif endif @@ -341,7 +341,7 @@ endfunction unlet s:TreeDirNode.GetSelected function! s:TreeDirNode.GetSelected() let currentDir = g:NERDTreeFileNode.GetSelected() - if currentDir != {} && !currentDir.isRoot() + if currentDir !=# {} && !currentDir.isRoot() if currentDir.path.isDirectory ==# 0 let currentDir = currentDir.parent endif @@ -373,7 +373,7 @@ endfunction " FUNCTION: TreeDirNode.hasVisibleChildren() {{{1 " returns 1 if this node has any childre, 0 otherwise.. function! s:TreeDirNode.hasVisibleChildren() - return self.getVisibleChildCount() != 0 + return self.getVisibleChildCount() !=# 0 endfunction " FUNCTION: TreeDirNode.isCascadable() {{{1 @@ -383,7 +383,7 @@ endfunction " 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 + if g:NERDTreeCascadeSingleChildDir ==# 0 return 0 endif @@ -398,14 +398,14 @@ function! s:TreeDirNode.isCascadable() endfor let c = self.getVisibleChildren() - return len(c) == 1 && c[0].path.isDirectory + return len(c) ==# 1 && c[0].path.isDirectory endfunction " FUNCTION: TreeDirNode._initChildren() {{{1 " Removes all childen from this node and re-reads them " " Args: -" silent: 1 if the function should not echo any "please wait" messages for +" silent: 1 if the function should not echo any 'please wait' messages for " large directories " " Return: the number of child nodes read @@ -416,7 +416,7 @@ function! s:TreeDirNode._initChildren(silent) let files = self._glob('*', 1) + self._glob('.*', 0) if !a:silent && len(files) > g:NERDTreeNotificationThreshold - call nerdtree#echo("Please wait, caching a large dir ...") + call nerdtree#echo('Please wait, caching a large dir ...') endif let invalidFilesFound = 0 @@ -432,10 +432,10 @@ function! s:TreeDirNode._initChildren(silent) call self.sortChildren() - call nerdtree#echo("") + call nerdtree#echo('') if invalidFilesFound - call nerdtree#echoWarning(invalidFilesFound . " file(s) could not be loaded into the NERD tree") + call nerdtree#echoWarning(invalidFilesFound . ' file(s) could not be loaded into the NERD tree') endif return self.getChildCount() endfunction @@ -447,8 +447,8 @@ endfunction " path: dir that the node represents " nerdtree: the tree the node belongs to function! s:TreeDirNode.New(path, nerdtree) - if a:path.isDirectory != 1 - throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object." + if a:path.isDirectory !=# 1 + throw 'NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object.' endif let newTreeNode = copy(self) @@ -510,7 +510,7 @@ function! s:TreeDirNode.openAlong(...) while node.path.isDirectory call node.open(opts) let level += 1 - if node.getVisibleChildCount() == 1 + if node.getVisibleChildCount() ==# 1 let node = node.getChildByIndex(0, 1) else break @@ -523,8 +523,8 @@ endfunction " Open an explorer window for this node in the previous window. The explorer " can be a NERDTree window or a netrw window. function! s:TreeDirNode.openExplorer() - execute "wincmd p" - execute "edit ".self.path.str({'format':'Edit'}) + execute 'wincmd p' + execute 'edit '.self.path.str({'format':'Edit'}) endfunction " FUNCTION: TreeDirNode.openInNewTab(options) {{{1 @@ -567,7 +567,7 @@ function! s:TreeDirNode.refresh() "create a new path and see if it exists in this nodes children let path = g:NERDTreePath.New(i) let newNode = self.getChild(path) - if newNode != {} + if newNode !=# {} call newNode.refresh() call add(newChildNodes, newNode) @@ -587,7 +587,7 @@ function! s:TreeDirNode.refresh() call self.sortChildren() if invalidFilesFound - call nerdtree#echoWarning("some files could not be loaded into the NERD tree") + call nerdtree#echoWarning('some files could not be loaded into the NERD tree') endif endif endfunction @@ -614,7 +614,7 @@ function! s:TreeDirNode.reveal(path, ...) let opts = a:0 ? a:1 : {} if !a:path.isUnder(self.path) - throw "NERDTree.InvalidArgumentsError: " . a:path.str() . " should be under " . self.path.str() + throw 'NERDTree.InvalidArgumentsError: ' . a:path.str() . ' should be under ' . self.path.str() endif call self.open() @@ -622,11 +622,11 @@ function! s:TreeDirNode.reveal(path, ...) if self.path.equals(a:path.getParent()) let n = self.findNode(a:path) " We may be looking for a newly-saved file that isn't in the tree yet. - if n == {} + if n ==# {} call self.refresh() let n = self.findNode(a:path) endif - if has_key(opts, "open") + if has_key(opts, 'open') call n.open() endif return n @@ -642,8 +642,8 @@ function! s:TreeDirNode.reveal(path, ...) endfunction " FUNCTION: TreeDirNode.removeChild(treenode) {{{1 -" Remove the given treenode from "self.children". -" Throws "NERDTree.ChildNotFoundError" if the node is not found. +" Remove the given treenode from self.children. +" Throws NERDTree.ChildNotFoundError if the node is not found. " " Args: " treenode: the node object to remove @@ -655,16 +655,16 @@ function! s:TreeDirNode.removeChild(treenode) endif endfor - throw "NERDTree.ChildNotFoundError: child node was not found" + throw 'NERDTree.ChildNotFoundError: child node was not found' endfunction " FUNCTION: TreeDirNode.sortChildren() {{{1 -" Sort "self.children" by alphabetical order and directory priority. +" Sort self.children by alphabetical order and directory priority. function! s:TreeDirNode.sortChildren() if count(g:NERDTreeSortOrder, '*') < 1 call add(g:NERDTreeSortOrder, '*') endif - let CompareFunc = function("nerdtree#compareNodesBySortKey") + let CompareFunc = function('nerdtree#compareNodesBySortKey') call sort(self.children, CompareFunc) let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder endfunction @@ -676,7 +676,7 @@ function! s:TreeDirNode.toggleOpen(...) if self.isOpen ==# 1 call self.close() else - if g:NERDTreeCascadeOpenSingleChildDir == 0 + if g:NERDTreeCascadeOpenSingleChildDir ==# 0 call self.open(opts) else call self.openAlong(opts) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim index c14f62a9..34074a25 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim @@ -1,7 +1,7 @@ " ============================================================================ " CLASS: TreeFileNode " -" This class is the parent of the "TreeDirNode" class and is the "Component" +" This class is the parent of the TreeDirNode class and is the 'Component' " part of the composite design pattern between the NERDTree node classes. " ============================================================================ @@ -42,7 +42,7 @@ function! s:TreeFileNode.cacheParent() if empty(self.parent) let parentPath = self.path.getParent() if parentPath.equals(self.path) - throw "NERDTree.CannotCacheParentError: already at root" + throw 'NERDTree.CannotCacheParentError: already at root' endif let self.parent = s:TreeFileNode.New(parentPath, self.getNerdtree()) endif @@ -195,7 +195,7 @@ endfunction " FUNCTION: TreeFileNode.isRoot() {{{1 function! s:TreeFileNode.isRoot() if !g:NERDTree.ExistsForBuf() - throw "NERDTree.NoTreeError: No tree exists for the current buffer" + throw 'NERDTree.NoTreeError: No tree exists for the current buffer' endif return self.equals(self.getNerdtree().root) @@ -248,8 +248,8 @@ endfunction " FUNCTION: TreeFileNode.openExplorer() function! s:TreeFileNode.openExplorer() - execute "wincmd p" - execute "edit ".self.path.getParent().str({'format':'Edit'}) + execute 'wincmd p' + execute 'edit '.self.path.getParent().str({'format':'Edit'}) endfunction " FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1 @@ -265,7 +265,7 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) if a:isJump mark ' endif - call cursor(ln, col(".")) + call cursor(ln, col('.')) else if a:recurseUpward let node = self @@ -317,7 +317,7 @@ endfunction " child nodes are rendered only) " for each depth in the tree function! s:TreeFileNode._renderToString(depth, drawText) - let output = "" + let output = '' if a:drawText ==# 1 let treeParts = repeat(' ', a:depth - 1) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index 5e8b3b64..fc9db71e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -27,94 +27,94 @@ function! s:UI._dumpHelp() let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n" let help .= "\" ============================\n" let help .= "\" File node mappings~\n" - let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n" + let help .= '" '. (g:NERDTreeMouseMode ==# 3 ? 'single' : 'double') ."-click,\n" if self.nerdtree.isTabTree() - let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n" + let help .= '" '. g:NERDTreeMapActivateNode .": open in prev window\n" else - let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n" + let help .= '" '. g:NERDTreeMapActivateNode .": open in current window\n" endif if self.nerdtree.isTabTree() - let help .= "\" ". g:NERDTreeMapPreview .": preview\n" + let help .= '" '. g:NERDTreeMapPreview .": preview\n" endif - let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" let help .= "\" middle-click,\n" - let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n" - let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n" - let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n" - let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n" - let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" + let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n" + let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n" + let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n" + let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n" + let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Directory node mappings~\n" - let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n" - let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n" - let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n" - let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" - let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n" - let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n" + let help .= '" '. (g:NERDTreeMouseMode ==# 1 ? 'double' : 'single') ."-click,\n" + let help .= '" '. g:NERDTreeMapActivateNode .": open & close node\n" + let help .= '" '. g:NERDTreeMapOpenRecursively .": recursively open node\n" + let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n" + let help .= '" '. g:NERDTreeMapCloseDir .": close parent of node\n" + let help .= '" '. g:NERDTreeMapCloseChildren .": close all child nodes of\n" let help .= "\" current node recursively\n" let help .= "\" middle-click,\n" - let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n" + let help .= '" '. g:NERDTreeMapOpenExpl.": explore selected dir\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Bookmark table mappings~\n" let help .= "\" double-click,\n" - let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n" - let help .= "\" ". g:NERDTreeMapPreview .": preview file\n" - let help .= "\" ". g:NERDTreeMapPreview .": find dir in tree\n" - let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n" - let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" - let help .= "\" ". g:NERDTreeMapCustomOpen .": custom open\n" - let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n" + let help .= '" '. g:NERDTreeMapActivateNode .": open bookmark\n" + let help .= '" '. g:NERDTreeMapPreview .": preview file\n" + let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n" + let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n" + let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n" + let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n" + let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Tree navigation mappings~\n" - let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n" - let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n" - let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n" - let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n" - let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n" - let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" + let help .= '" '. g:NERDTreeMapJumpRoot .": go to root\n" + let help .= '" '. g:NERDTreeMapJumpParent .": go to parent\n" + let help .= '" '. g:NERDTreeMapJumpFirstChild .": go to first child\n" + let help .= '" '. g:NERDTreeMapJumpLastChild .": go to last child\n" + let help .= '" '. g:NERDTreeMapJumpNextSibling .": go to next sibling\n" + let help .= '" '. g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Filesystem mappings~\n" - let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n" + let help .= '" '. g:NERDTreeMapChangeRoot .": change tree root to the\n" let help .= "\" selected dir\n" - let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n" - let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" + let help .= '" '. g:NERDTreeMapUpdir .": move tree root up a dir\n" + let help .= '" '. g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n" let help .= "\" but leave old root open\n" - let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n" - let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n" - let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n" - let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n" + let help .= '" '. g:NERDTreeMapRefresh .": refresh cursor dir\n" + let help .= '" '. g:NERDTreeMapRefreshRoot .": refresh current root\n" + let help .= '" '. g:NERDTreeMapMenu .": Show menu\n" + let help .= '" '. g:NERDTreeMapChdir .":change the CWD to the\n" let help .= "\" selected dir\n" - let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n" + let help .= '" '. g:NERDTreeMapCWD .":change tree root to CWD\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Tree filtering mappings~\n" - let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n" - let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n" - let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n" - let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n" + let help .= '" '. g:NERDTreeMapToggleHidden .': hidden files (' . (self.getShowHidden() ? 'on' : 'off') . ")\n" + let help .= '" '. g:NERDTreeMapToggleFilters .': file filters (' . (self.isIgnoreFilterEnabled() ? 'on' : 'off') . ")\n" + let help .= '" '. g:NERDTreeMapToggleFiles .': files (' . (self.getShowFiles() ? 'on' : 'off') . ")\n" + let help .= '" '. g:NERDTreeMapToggleBookmarks .': bookmarks (' . (self.getShowBookmarks() ? 'on' : 'off') . ")\n" " add quickhelp entries for each custom key map let help .= "\"\n\" ----------------------------\n" let help .= "\" Custom mappings~\n" for i in g:NERDTreeKeyMap.All() if !empty(i.quickhelpText) - let help .= "\" ". i.key .": ". i.quickhelpText ."\n" + let help .= '" '. i.key .': '. i.quickhelpText ."\n" endif endfor let help .= "\"\n\" ----------------------------\n" let help .= "\" Other mappings~\n" - let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n" - let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" + let help .= '" '. g:NERDTreeMapQuit .": Close the NERDTree window\n" + let help .= '" '. g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n" let help .= "\" the NERDTree window\n" - let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n" + let help .= '" '. g:NERDTreeMapHelp .": toggle help\n" let help .= "\"\n\" ----------------------------\n" let help .= "\" Bookmark commands~\n" let help .= "\" :Bookmark []\n" @@ -128,7 +128,7 @@ function! s:UI._dumpHelp() let help .= "\" :EditBookmarks\n" silent! put =help elseif !self.isMinimal() - let help ="\" Press ". g:NERDTreeMapHelp ." for help\n" + let help ='" Press '. g:NERDTreeMapHelp ." for help\n" silent! put =help endif endfunction @@ -148,8 +148,8 @@ function! s:UI.New(nerdtree) endfunction " FUNCTION: s:UI.getPath(ln) {{{1 -" Return the "Path" object for the node that is rendered on the given line -" number. If the "up a dir" line is selected, return the "Path" object for +" Return the Path object for the node that is rendered on the given line +" number. If the 'up a dir' line is selected, return the Path object for " the parent of the root. Return the empty dictionary if the given line " does not reference a tree node. function! s:UI.getPath(ln) @@ -157,7 +157,7 @@ function! s:UI.getPath(ln) let rootLine = self.getRootLineNum() - if a:ln == rootLine + if a:ln ==# rootLine return self.nerdtree.root.path endif @@ -174,7 +174,7 @@ function! s:UI.getPath(ln) " remove the tree parts and the leading space let curFile = self._stripMarkup(line) - let dir = "" + let dir = '' let lnum = a:ln while lnum > 0 let lnum = lnum - 1 @@ -182,7 +182,7 @@ function! s:UI.getPath(ln) let curLineStripped = self._stripMarkup(curLine) " have we reached the top of the tree? - if lnum == rootLine + if lnum ==# rootLine let dir = self.nerdtree.root.path.str({'format': 'UI'}) . dir break endif @@ -191,7 +191,7 @@ function! s:UI.getPath(ln) if lpindent < indent let indent = indent - 1 - let dir = substitute (curLineStripped,'^\\', "", "") . dir + let dir = substitute (curLineStripped,'^\\', '', '') . dir continue endif endif @@ -219,17 +219,17 @@ function! s:UI.getLineNum(node) let l:currentLine = getline(l:lineNumber) let l:indentLevel = self._indentLevelFor(l:currentLine) - if l:indentLevel != l:currentPathComponent + if l:indentLevel !=# l:currentPathComponent continue endif let l:currentLine = self._stripMarkup(l:currentLine) let l:currentPath = join(l:pathComponents, '/') . '/' . l:currentLine - " Directories: If the current path "starts with" the full path, then + " Directories: If the current path 'starts with' the full path, then " either the paths are equal or the line is a cascade containing the " full path. - if l:fullPath[-1:] == '/' && stridx(l:currentPath, l:fullPath) == 0 + if l:fullPath[-1:] ==# '/' && stridx(l:currentPath, l:fullPath) ==# 0 return l:lineNumber endif @@ -240,7 +240,7 @@ function! s:UI.getLineNum(node) " Otherwise: If the full path starts with the current path and the " current path is a directory, we add a new path component. - if stridx(l:fullPath, l:currentPath) == 0 && l:currentPath[-1:] == '/' + if stridx(l:fullPath, l:currentPath) ==# 0 && l:currentPath[-1:] ==# '/' let l:currentLine = substitute(l:currentLine, '/\s*$', '', '') call add(l:pathComponents, l:currentLine) let l:currentPathComponent += 1 @@ -296,7 +296,7 @@ endfunction " FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1 function! s:UI.isIgnoreFilterEnabled() - return self._ignoreEnabled == 1 + return self._ignoreEnabled ==# 1 endfunction " FUNCTION: s:UI.isMinimal() {{{1 @@ -313,21 +313,21 @@ endfunction function! s:UI._renderBookmarks() if !self.isMinimal() - call setline(line(".")+1, ">----------Bookmarks----------") - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, '>----------Bookmarks----------') + call cursor(line('.')+1, col('.')) endif - if g:NERDTreeBookmarksSort == 1 || g:NERDTreeBookmarksSort == 2 + if g:NERDTreeBookmarksSort ==# 1 || g:NERDTreeBookmarksSort ==# 2 call g:NERDTreeBookmark.SortBookmarksList() endif for i in g:NERDTreeBookmark.Bookmarks() - call setline(line(".")+1, i.str()) - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, i.str()) + call cursor(line('.')+1, col('.')) endfor - call setline(line(".")+1, '') - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, '') + call cursor(line('.')+1, col('.')) endfunction " FUNCTION: s:UI.restoreScreenState() {{{1 @@ -340,13 +340,13 @@ function! s:UI.restoreScreenState() if !has_key(self, '_screenState') return endif - call nerdtree#exec("silent vertical resize " . self._screenState['oldWindowSize'], 1) + call nerdtree#exec('silent vertical resize ' . self._screenState['oldWindowSize'], 1) let old_scrolloff=&scrolloff let &scrolloff=0 call cursor(self._screenState['oldTopLine'], 0) normal! zt - call setpos(".", self._screenState['oldPos']) + call setpos('.', self._screenState['oldPos']) let &scrolloff=old_scrolloff endfunction @@ -358,10 +358,10 @@ function! s:UI.saveScreenState() let self._screenState = {} try call g:NERDTree.CursorToTreeWin() - let self._screenState['oldPos'] = getpos(".") - let self._screenState['oldTopLine'] = line("w0") - let self._screenState['oldWindowSize']= winwidth("") - call nerdtree#exec(win . "wincmd w", 1) + let self._screenState['oldPos'] = getpos('.') + let self._screenState['oldTopLine'] = line('w0') + let self._screenState['oldWindowSize']= winwidth('') + call nerdtree#exec(win . 'wincmd w', 1) catch endtry endfunction @@ -387,9 +387,9 @@ function! s:UI.render() " remember the top line of the buffer and the current line so we can " restore the view exactly how it was - let curLine = line(".") - let curCol = col(".") - let topLine = line("w0") + let curLine = line('.') + let curCol = col('.') + let topLine = line('w0') " delete all lines in the buffer (being careful not to clobber a register) silent 1,$delete _ @@ -398,8 +398,8 @@ function! s:UI.render() " delete the blank line before the help and add one after it if !self.isMinimal() - call setline(line(".")+1, "") - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, '') + call cursor(line('.')+1, col('.')) endif if self.getShowBookmarks() @@ -408,14 +408,14 @@ function! s:UI.render() " add the 'up a dir' line if !self.isMinimal() - call setline(line(".")+1, s:UI.UpDirLine()) - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, s:UI.UpDirLine()) + call cursor(line('.')+1, col('.')) endif " draw the header line let header = self.nerdtree.root.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) - call setline(line(".")+1, header) - call cursor(line(".")+1, col(".")) + call setline(line('.')+1, header) + call cursor(line('.')+1, col('.')) " draw the tree silent put =self.nerdtree.root.renderToString() @@ -443,13 +443,13 @@ function! s:UI.renderViewSavingPosition() " go up the tree till we find a node that will be visible or till we run " out of nodes - while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot() + while currentNode !=# {} && !currentNode.isVisible() && !currentNode.isRoot() let currentNode = currentNode.parent endwhile call self.render() - if currentNode != {} + if currentNode !=# {} call currentNode.putCursorHere(0, 0) endif endfunction @@ -507,12 +507,12 @@ endfunction " FUNCTION: s:UI.toggleZoom() {{{1 " zoom (maximize/minimize) the NERDTree window function! s:UI.toggleZoom() - if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed - let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - call nerdtree#exec("silent vertical resize ". size, 1) + if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed + let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize + call nerdtree#exec('silent vertical resize '. size, 1) let b:NERDTreeZoomed = 0 else - call nerdtree#exec("vertical resize ". get(g:, 'NERDTreeWinSizeMax', ''), 1) + call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1) let b:NERDTreeZoomed = 1 endif endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim b/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim index c53650a5..fb6c4862 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/exec_menuitem.vim @@ -9,7 +9,7 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " " ============================================================================ -if exists("g:loaded_nerdtree_exec_menuitem") +if exists('g:loaded_nerdtree_exec_menuitem') finish endif let g:loaded_nerdtree_exec_menuitem = 1 @@ -32,9 +32,9 @@ function! NERDTreeExecFile() let cmd = treenode.path.str({'escape': 1}) let cmd = input(':!', cmd . ' ') - if cmd != '' + if cmd !=# '' exec ':!' . cmd else - echo "Aborted" + echo 'Aborted' endif endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 4167df00..3ecfa816 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -9,13 +9,13 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " " ============================================================================ -if exists("g:loaded_nerdtree_fs_menu") +if exists('g:loaded_nerdtree_fs_menu') finish endif let g:loaded_nerdtree_fs_menu = 1 "Automatically delete the buffer after deleting or renaming a file -if !exists("g:NERDTreeAutoDeleteBuffer") +if !exists('g:NERDTreeAutoDeleteBuffer') let g:NERDTreeAutoDeleteBuffer = 0 endif @@ -23,13 +23,13 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) -if has("gui_mac") || has("gui_macvim") || has("mac") +if has('gui_mac') || has('gui_macvim') || has('mac') call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'}) call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'}) endif -if executable("xdg-open") +if executable('xdg-open') call NERDTreeAddMenuItem({'text': '(r)eveal the current node in file manager', 'shortcut': 'r', 'callback': 'NERDTreeRevealFileLinux'}) call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'}) endif @@ -37,9 +37,9 @@ endif if g:NERDTreePath.CopyingSupported() call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) endif -call NERDTreeAddMenuItem({'text': (has("clipboard")?'copy (p)ath to clipboard':'print (p)ath to screen'), 'shortcut': 'p', 'callback': 'NERDTreeCopyPath'}) +call NERDTreeAddMenuItem({'text': (has('clipboard')?'copy (p)ath to clipboard':'print (p)ath to screen'), 'shortcut': 'p', 'callback': 'NERDTreeCopyPath'}) -if has("unix") || has("osx") +if has('unix') || has('osx') call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'}) else call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'}) @@ -51,37 +51,37 @@ endif "Args: "action: the action that is being performed, e.g. 'delete' function! s:inputPrompt(action) - if a:action == "add" - let title = "Add a childnode" + if a:action ==# 'add' + let title = 'Add a childnode' let info = "Enter the dir/file name to be created. Dirs end with a '/'" - let minimal = "Add node:" + let minimal = 'Add node:' - elseif a:action == "copy" - let title = "Copy the current node" - let info = "Enter the new path to copy the node to:" - let minimal = "Copy to:" + elseif a:action ==# 'copy' + let title = 'Copy the current node' + let info = 'Enter the new path to copy the node to:' + let minimal = 'Copy to:' - elseif a:action == "delete" - let title = "Delete the current node" - let info = "Are you sure you wish to delete the node:" - let minimal = "Delete?" + elseif a:action ==# 'delete' + let title = 'Delete the current node' + let info = 'Are you sure you wish to delete the node:' + let minimal = 'Delete?' - elseif a:action == "deleteNonEmpty" - let title = "Delete the current node" + elseif a:action ==# 'deleteNonEmpty' + let title = 'Delete the current node' let info = "STOP! Directory is not empty! To delete, type 'yes'" - let minimal = "Delete directory?" + let minimal = 'Delete directory?' - elseif a:action == "move" - let title = "Rename the current node" - let info = "Enter the new path for the node:" - let minimal = "Move to:" + elseif a:action ==# 'move' + let title = 'Rename the current node' + let info = 'Enter the new path for the node:' + let minimal = 'Move to:' endif if g:NERDTreeMenuController.isMinimal() redraw! " Clear the menu - return minimal . " " + return minimal . ' ' else - let divider = "==========================================================" + let divider = '==========================================================' return title . "\n" . divider . "\n" . info . "\n" end endfunction @@ -114,14 +114,14 @@ function! s:promptToDelBuffer(bufnum, msg) let l:listedBufferCount = 0 endif if l:listedBufferCount > 1 - call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif", 1) + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufnum . " | exec ':bnext! ' | endif", 1) else - call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif", 1) + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufnum . " | exec ':enew! ' | endif", 1) endif - call nerdtree#exec("tabnext " . s:originalTabNumber, 1) - call nerdtree#exec(s:originalWindowNumber . "wincmd w", 1) + call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) + call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) " 3. We don't need a previous buffer anymore - call nerdtree#exec("bwipeout! " . a:bufnum, 0) + call nerdtree#exec('bwipeout! ' . a:bufnum, 0) endif endfunction @@ -141,17 +141,17 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) endif " 1. ensure that a new buffer is loaded - call nerdtree#exec("badd " . quotedFileName, 1) + call nerdtree#exec('badd ' . quotedFileName, 1) " 2. ensure that all windows which display the just deleted filename " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - call nerdtree#exec("tabdo windo if winbufnr(0) == " . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1) - call nerdtree#exec("tabnext " . s:originalTabNumber, 1) - call nerdtree#exec(s:originalWindowNumber . "wincmd w", 1) + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1) + call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) + call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) " 3. We don't need a previous buffer anymore try - call nerdtree#exec("confirm bwipeout " . a:bufNum, 0) + call nerdtree#exec('confirm bwipeout ' . a:bufNum, 0) catch " This happens when answering Cancel if confirmation is needed. Do nothing. endtry @@ -160,11 +160,11 @@ endfunction "FUNCTION: NERDTreeAddNode(){{{1 function! NERDTreeAddNode() let curDirNode = g:NERDTreeDirNode.GetSelected() - let prompt = s:inputPrompt("add") - let newNodeName = input(prompt, curDirNode.path.str() . g:NERDTreePath.Slash(), "file") + let prompt = s:inputPrompt('add') + let newNodeName = input(prompt, curDirNode.path.str() . g:NERDTreePath.Slash(), 'file') if newNodeName ==# '' - call nerdtree#echo("Node Creation Aborted.") + call nerdtree#echo('Node Creation Aborted.') return endif @@ -187,26 +187,26 @@ function! NERDTreeAddNode() redraw! catch /^NERDTree/ - call nerdtree#echoWarning("Node Not Created.") + call nerdtree#echoWarning('Node Not Created.') endtry endfunction "FUNCTION: NERDTreeMoveNode(){{{1 function! NERDTreeMoveNode() let curNode = g:NERDTreeFileNode.GetSelected() - let prompt = s:inputPrompt("move") - let newNodePath = input(prompt, curNode.path.str(), "file") + let prompt = s:inputPrompt('move') + let newNodePath = input(prompt, curNode.path.str(), 'file') if newNodePath ==# '' - call nerdtree#echo("Node Renaming Aborted.") + call nerdtree#echo('Node Renaming Aborted.') return endif try if curNode.path.isDirectory - let l:openBuffers = filter(range(1,bufnr("$")),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"') + let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"') else - let l:openBuffers = filter(range(1,bufnr("$")),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()') + let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()') endif call curNode.rename(newNodePath) @@ -221,9 +221,9 @@ function! NERDTreeMoveNode() " renamed files. if !empty(l:openBuffers) if curNode.path.isDirectory - echo "\nDirectory renamed.\n\nFiles with the old directory name are open in buffers " . join(l:openBuffers, ', ') . ". Replace these buffers with the new files? (yN)" + echo "\nDirectory renamed.\n\nFiles with the old directory name are open in buffers " . join(l:openBuffers, ', ') . '. Replace these buffers with the new files? (yN)' else - echo "\nFile renamed.\n\nThe old file is open in buffer " . l:openBuffers[0] . ". Replace this buffer with the new file? (yN)" + echo "\nFile renamed.\n\nThe old file is open in buffer " . l:openBuffers[0] . '. Replace this buffer with the new file? (yN)' endif if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y' for bufNum in l:openBuffers @@ -236,7 +236,7 @@ function! NERDTreeMoveNode() redraw! catch /^NERDTree/ - call nerdtree#echoWarning("Node Not Renamed.") + call nerdtree#echoWarning('Node Not Renamed.') endtry endfunction @@ -249,11 +249,11 @@ function! NERDTreeDeleteNode() if currentNode.path.isDirectory && ((currentNode.isOpen && currentNode.getChildCount() > 0) || \ (len(currentNode._glob('*', 1)) > 0)) - let prompt = s:inputPrompt("deleteNonEmpty") . currentNode.path.str() . ": " + let prompt = s:inputPrompt('deleteNonEmpty') . currentNode.path.str() . ': ' let choice = input(prompt) let confirmed = choice ==# 'yes' else - let prompt = s:inputPrompt("delete") . currentNode.path.str() . " (yN): " + let prompt = s:inputPrompt('delete') . currentNode.path.str() . ' (yN): ' echo prompt let choice = nr2char(getchar()) let confirmed = choice ==# 'y' @@ -266,18 +266,18 @@ function! NERDTreeDeleteNode() "if the node is open in a buffer, ask the user if they want to "close that buffer - let bufnum = bufnr("^".currentNode.path.str()."$") + let bufnum = bufnr('^'.currentNode.path.str().'$') if buflisted(bufnum) - let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)" + let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? ' (hidden)' : '') .'. Delete this buffer? (yN)' call s:promptToDelBuffer(bufnum, prompt) endif redraw! catch /^NERDTree/ - call nerdtree#echoWarning("Could not remove node") + call nerdtree#echoWarning('Could not remove node') endtry else - call nerdtree#echo("delete aborted") + call nerdtree#echo('delete aborted') endif let &shellslash = l:shellslash endfunction @@ -286,10 +286,10 @@ endfunction function! NERDTreeListNode() let treenode = g:NERDTreeFileNode.GetSelected() if !empty(treenode) - let s:uname = system("uname") + let s:uname = system('uname') let stat_cmd = 'stat -c "%s" ' - if s:uname =~? "Darwin" + if s:uname =~? 'Darwin' let stat_cmd = 'stat -f "%z" ' endif @@ -300,7 +300,7 @@ function! NERDTreeListNode() let metadata = split(system(cmd),'\n') call nerdtree#echo(metadata[0]) else - call nerdtree#echo("No information available") + call nerdtree#echo('No information available') endif endfunction @@ -310,10 +310,10 @@ function! NERDTreeListNodeWin32() if !empty(l:node) let l:path = l:node.path.str() - call nerdtree#echo(printf("%s:%s MOD:%s BYTES:%d PERMISSIONS:%s", + call nerdtree#echo(printf('%s:%s MOD:%s BYTES:%d PERMISSIONS:%s', \ toupper(getftype(l:path)), \ fnamemodify(l:path, ':t'), - \ strftime("%c", getftime(l:path)), + \ strftime('%c', getftime(l:path)), \ getfsize(l:path), \ getfperm(l:path))) return @@ -327,16 +327,16 @@ function! NERDTreeCopyNode() let l:shellslash = &shellslash let &shellslash = 0 let currentNode = g:NERDTreeFileNode.GetSelected() - let prompt = s:inputPrompt("copy") - let newNodePath = input(prompt, currentNode.path.str(), "file") + let prompt = s:inputPrompt('copy') + let newNodePath = input(prompt, currentNode.path.str(), 'file') - if newNodePath != "" + if newNodePath !=# '' "strip trailing slash let newNodePath = substitute(newNodePath, '\/$', '', '') let confirmed = 1 if currentNode.path.copyingWillOverwrite(newNodePath) - call nerdtree#echo("Warning: copying may overwrite files! Continue? (yN)") + call nerdtree#echo('Warning: copying may overwrite files! Continue? (yN)') let choice = nr2char(getchar()) let confirmed = choice ==# 'y' endif @@ -355,11 +355,11 @@ function! NERDTreeCopyNode() call newNode.putCursorHere(0, 0) endif catch /^NERDTree/ - call nerdtree#echoWarning("Could not copy node") + call nerdtree#echoWarning('Could not copy node') endtry endif else - call nerdtree#echo("Copy aborted.") + call nerdtree#echo('Copy aborted.') endif let &shellslash = l:shellslash redraw! @@ -368,22 +368,22 @@ endfunction " FUNCTION: NERDTreeCopyPath() {{{1 function! NERDTreeCopyPath() let l:nodePath = g:NERDTreeFileNode.GetSelected().path.str() - if has("clipboard") - if &clipboard == "unnamedplus" + if has('clipboard') + if &clipboard ==# 'unnamedplus' let @+ = l:nodePath else let @* = l:nodePath endif - call nerdtree#echo("The path [" . l:nodePath . "] was copied to your clipboard.") + call nerdtree#echo('The path [' . l:nodePath . '] was copied to your clipboard.') else - call nerdtree#echo("The full path is: " . l:nodePath) + call nerdtree#echo('The full path is: ' . l:nodePath) endif endfunction " FUNCTION: NERDTreeQuickLook() {{{1 function! NERDTreeQuickLook() let treenode = g:NERDTreeFileNode.GetSelected() - if treenode != {} + if treenode !=# {} call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'") endif endfunction @@ -391,7 +391,7 @@ endfunction " FUNCTION: NERDTreeRevealInFinder() {{{1 function! NERDTreeRevealInFinder() let treenode = g:NERDTreeFileNode.GetSelected() - if treenode != {} + if treenode !=# {} call system("open -R '" . treenode.path.str() . "'") endif endfunction @@ -399,7 +399,7 @@ endfunction " FUNCTION: NERDTreeExecuteFile() {{{1 function! NERDTreeExecuteFile() let treenode = g:NERDTreeFileNode.GetSelected() - if treenode != {} + if treenode !=# {} call system("open '" . treenode.path.str() . "'") endif endfunction @@ -408,7 +408,7 @@ endfunction function! NERDTreeRevealFileLinux() let treenode = g:NERDTreeFileNode.GetSelected() let parentnode = treenode.parent - if parentnode != {} + if parentnode !=# {} call system("xdg-open '" . parentnode.path.str() . "' &") endif endfunction @@ -416,7 +416,7 @@ endfunction " FUNCTION: NERDTreeExecuteFileLinux() {{{1 function! NERDTreeExecuteFileLinux() let treenode = g:NERDTreeFileNode.GetSelected() - if treenode != {} + if treenode !=# {} call system("xdg-open '" . treenode.path.str() . "' &") endif endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim index d9901b83..36d5427e 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim @@ -17,7 +17,7 @@ command! -n=? -complete=dir -bar NERDTreeToggleVCS :call ToggleTabTreeVCS(' function! s:CreateTabTreeVCS(name) let l:path = g:NERDTreeCreator._pathForString(a:name) let l:path = s:FindParentVCSRoot(l:path) - call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str()) + call g:NERDTreeCreator.createTabTree(empty(l:path) ? '' : l:path._str()) endfunction " FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1 @@ -25,7 +25,7 @@ endfunction function! s:ToggleTabTreeVCS(name) let l:path = g:NERDTreeCreator._pathForString(a:name) let l:path = s:FindParentVCSRoot(l:path) - call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? "" : l:path._str()) + call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? '' : l:path._str()) endfunction " FUNCTION: s:FindParentVCSRoot(a:path) {{{1 @@ -34,7 +34,7 @@ endfunction function! s:FindParentVCSRoot(path) let l:path = a:path while !empty(l:path) && - \ l:path._str() !~ '^\(\a:\\\|\/\)$' && + \ l:path._str() !~# '^\(\a:\\\|\/\)$' && \ !isdirectory(l:path._str() . '/.git') && \ !isdirectory(l:path._str() . '/.svn') && \ !isdirectory(l:path._str() . '/.hg') && @@ -42,6 +42,6 @@ function! s:FindParentVCSRoot(path) \ !isdirectory(l:path._str() . '/_darcs') let l:path = l:path.getParent() endwhile - return (empty(l:path) || l:path._str() =~ '^\(\a:\\\|\/\)$') ? a:path : l:path + return (empty(l:path) || l:path._str() =~# '^\(\a:\\\|\/\)$') ? a:path : l:path endfunction diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 5faebaaf..639f87bb 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -11,7 +11,9 @@ " " SECTION: Script init stuff {{{1 "============================================================ -if exists("loaded_nerd_tree") +scriptencoding utf-8 + +if exists('loaded_nerd_tree') finish endif if v:version < 703 @@ -20,9 +22,9 @@ if v:version < 703 endif let loaded_nerd_tree = 1 -"for line continuation - i.e dont want C in &cpo -let s:old_cpo = &cpo -set cpo&vim +"for line continuation - i.e dont want C in &cpoptions +let s:old_cpo = &cpoptions +set cpoptions&vim "Function: s:initVariable() function {{{2 "This function is used to initialise a given variable to a given value. The @@ -36,65 +38,65 @@ set cpo&vim "1 if the var is set, 0 otherwise function! s:initVariable(var, value) if !exists(a:var) - exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", "g") . "'" + exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", 'g') . "'" return 1 endif return 0 endfunction "SECTION: Init variable calls and other random constants {{{2 -call s:initVariable("g:NERDTreeAutoCenter", 1) -call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) -call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) -call s:initVariable("g:NERDTreeNaturalSort", 0) -call s:initVariable("g:NERDTreeSortHiddenFirst", 1) -call s:initVariable("g:NERDTreeUseTCD", 0) -call s:initVariable("g:NERDTreeChDirMode", 0) -call s:initVariable("g:NERDTreeCreatePrefix", "silent") -call s:initVariable("g:NERDTreeMinimalUI", 0) -call s:initVariable("g:NERDTreeMinimalMenu", 0) -if !exists("g:NERDTreeIgnore") +call s:initVariable('g:NERDTreeAutoCenter', 1) +call s:initVariable('g:NERDTreeAutoCenterThreshold', 3) +call s:initVariable('g:NERDTreeCaseSensitiveSort', 0) +call s:initVariable('g:NERDTreeNaturalSort', 0) +call s:initVariable('g:NERDTreeSortHiddenFirst', 1) +call s:initVariable('g:NERDTreeUseTCD', 0) +call s:initVariable('g:NERDTreeChDirMode', 0) +call s:initVariable('g:NERDTreeCreatePrefix', 'silent') +call s:initVariable('g:NERDTreeMinimalUI', 0) +call s:initVariable('g:NERDTreeMinimalMenu', 0) +if !exists('g:NERDTreeIgnore') let g:NERDTreeIgnore = ['\~$'] endif -call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks') -call s:initVariable("g:NERDTreeBookmarksSort", 1) -call s:initVariable("g:NERDTreeHighlightCursorline", 1) -call s:initVariable("g:NERDTreeHijackNetrw", 1) +call s:initVariable('g:NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks') +call s:initVariable('g:NERDTreeBookmarksSort', 1) +call s:initVariable('g:NERDTreeHighlightCursorline', 1) +call s:initVariable('g:NERDTreeHijackNetrw', 1) call s:initVariable('g:NERDTreeMarkBookmarks', 1) -call s:initVariable("g:NERDTreeMouseMode", 1) -call s:initVariable("g:NERDTreeNotificationThreshold", 100) -call s:initVariable("g:NERDTreeQuitOnOpen", 0) -call s:initVariable("g:NERDTreeRespectWildIgnore", 0) -call s:initVariable("g:NERDTreeShowBookmarks", 0) -call s:initVariable("g:NERDTreeShowFiles", 1) -call s:initVariable("g:NERDTreeShowHidden", 0) -call s:initVariable("g:NERDTreeShowLineNumbers", 0) -call s:initVariable("g:NERDTreeSortDirs", 1) +call s:initVariable('g:NERDTreeMouseMode', 1) +call s:initVariable('g:NERDTreeNotificationThreshold', 100) +call s:initVariable('g:NERDTreeQuitOnOpen', 0) +call s:initVariable('g:NERDTreeRespectWildIgnore', 0) +call s:initVariable('g:NERDTreeShowBookmarks', 0) +call s:initVariable('g:NERDTreeShowFiles', 1) +call s:initVariable('g:NERDTreeShowHidden', 0) +call s:initVariable('g:NERDTreeShowLineNumbers', 0) +call s:initVariable('g:NERDTreeSortDirs', 1) if !nerdtree#runningWindows() && !nerdtree#runningCygwin() - call s:initVariable("g:NERDTreeDirArrowExpandable", "▸") - call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾") + call s:initVariable('g:NERDTreeDirArrowExpandable', '▸') + call s:initVariable('g:NERDTreeDirArrowCollapsible', '▾') else - call s:initVariable("g:NERDTreeDirArrowExpandable", "+") - call s:initVariable("g:NERDTreeDirArrowCollapsible", "~") + call s:initVariable('g:NERDTreeDirArrowExpandable', '+') + call s:initVariable('g:NERDTreeDirArrowCollapsible', '~') endif -call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1) -call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1) +call s:initVariable('g:NERDTreeCascadeOpenSingleChildDir', 1) +call s:initVariable('g:NERDTreeCascadeSingleChildDir', 1) -if !exists("g:NERDTreeSortOrder") +if !exists('g:NERDTreeSortOrder') let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$'] endif let g:NERDTreeOldSortOrder = [] -call s:initVariable("g:NERDTreeGlyphReadOnly", "RO") +call s:initVariable('g:NERDTreeGlyphReadOnly', 'RO') -if has("conceal") - call s:initVariable("g:NERDTreeNodeDelimiter", "\x07") -elseif (g:NERDTreeDirArrowExpandable == "\u00a0" || g:NERDTreeDirArrowCollapsible == "\u00a0") - call s:initVariable("g:NERDTreeNodeDelimiter", "\u00b7") +if has('conceal') + call s:initVariable('g:NERDTreeNodeDelimiter', "\x07") +elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0") + call s:initVariable('g:NERDTreeNodeDelimiter', "\u00b7") else - call s:initVariable("g:NERDTreeNodeDelimiter", "\u00a0") + call s:initVariable('g:NERDTreeNodeDelimiter', "\u00a0") endif if !exists('g:NERDTreeStatusline') @@ -105,60 +107,60 @@ if !exists('g:NERDTreeStatusline') let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}" endif -call s:initVariable("g:NERDTreeWinPos", "left") -call s:initVariable("g:NERDTreeWinSize", 31) +call s:initVariable('g:NERDTreeWinPos', 'left') +call s:initVariable('g:NERDTreeWinSize', 31) "init the shell commands that will be used to copy nodes, and remove dir trees " "Note: the space after the command is important if nerdtree#runningWindows() - call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ') - call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ') - call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ') + call s:initVariable('g:NERDTreeRemoveDirCmd', 'rmdir /s /q ') + call s:initVariable('g:NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ') + call s:initVariable('g:NERDTreeCopyFileCmd', 'copy /y ') else - call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ') - call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ') + call s:initVariable('g:NERDTreeRemoveDirCmd', 'rm -rf ') + call s:initVariable('g:NERDTreeCopyCmd', 'cp -r ') endif "SECTION: Init variable calls for key mappings {{{2 -call s:initVariable("g:NERDTreeMapCustomOpen", "") -call s:initVariable("g:NERDTreeMapActivateNode", "o") -call s:initVariable("g:NERDTreeMapChangeRoot", "C") -call s:initVariable("g:NERDTreeMapChdir", "cd") -call s:initVariable("g:NERDTreeMapCloseChildren", "X") -call s:initVariable("g:NERDTreeMapCloseDir", "x") -call s:initVariable("g:NERDTreeMapDeleteBookmark", "D") -call s:initVariable("g:NERDTreeMapMenu", "m") -call s:initVariable("g:NERDTreeMapHelp", "?") -call s:initVariable("g:NERDTreeMapJumpFirstChild", "K") -call s:initVariable("g:NERDTreeMapJumpLastChild", "J") -call s:initVariable("g:NERDTreeMapJumpNextSibling", "") -call s:initVariable("g:NERDTreeMapJumpParent", "p") -call s:initVariable("g:NERDTreeMapJumpPrevSibling", "") -call s:initVariable("g:NERDTreeMapJumpRoot", "P") -call s:initVariable("g:NERDTreeMapOpenExpl", "e") -call s:initVariable("g:NERDTreeMapOpenInTab", "t") -call s:initVariable("g:NERDTreeMapOpenInTabSilent", "T") -call s:initVariable("g:NERDTreeMapOpenRecursively", "O") -call s:initVariable("g:NERDTreeMapOpenSplit", "i") -call s:initVariable("g:NERDTreeMapOpenVSplit", "s") -call s:initVariable("g:NERDTreeMapPreview", "g" . NERDTreeMapActivateNode) -call s:initVariable("g:NERDTreeMapPreviewSplit", "g" . NERDTreeMapOpenSplit) -call s:initVariable("g:NERDTreeMapPreviewVSplit", "g" . NERDTreeMapOpenVSplit) -call s:initVariable("g:NERDTreeMapQuit", "q") -call s:initVariable("g:NERDTreeMapRefresh", "r") -call s:initVariable("g:NERDTreeMapRefreshRoot", "R") -call s:initVariable("g:NERDTreeMapToggleBookmarks", "B") -call s:initVariable("g:NERDTreeMapToggleFiles", "F") -call s:initVariable("g:NERDTreeMapToggleFilters", "f") -call s:initVariable("g:NERDTreeMapToggleHidden", "I") -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") +call s:initVariable('g:NERDTreeMapCustomOpen', '') +call s:initVariable('g:NERDTreeMapActivateNode', 'o') +call s:initVariable('g:NERDTreeMapChangeRoot', 'C') +call s:initVariable('g:NERDTreeMapChdir', 'cd') +call s:initVariable('g:NERDTreeMapCloseChildren', 'X') +call s:initVariable('g:NERDTreeMapCloseDir', 'x') +call s:initVariable('g:NERDTreeMapDeleteBookmark', 'D') +call s:initVariable('g:NERDTreeMapMenu', 'm') +call s:initVariable('g:NERDTreeMapHelp', '?') +call s:initVariable('g:NERDTreeMapJumpFirstChild', 'K') +call s:initVariable('g:NERDTreeMapJumpLastChild', 'J') +call s:initVariable('g:NERDTreeMapJumpNextSibling', '') +call s:initVariable('g:NERDTreeMapJumpParent', 'p') +call s:initVariable('g:NERDTreeMapJumpPrevSibling', '') +call s:initVariable('g:NERDTreeMapJumpRoot', 'P') +call s:initVariable('g:NERDTreeMapOpenExpl', 'e') +call s:initVariable('g:NERDTreeMapOpenInTab', 't') +call s:initVariable('g:NERDTreeMapOpenInTabSilent', 'T') +call s:initVariable('g:NERDTreeMapOpenRecursively', 'O') +call s:initVariable('g:NERDTreeMapOpenSplit', 'i') +call s:initVariable('g:NERDTreeMapOpenVSplit', 's') +call s:initVariable('g:NERDTreeMapPreview', 'g' . NERDTreeMapActivateNode) +call s:initVariable('g:NERDTreeMapPreviewSplit', 'g' . NERDTreeMapOpenSplit) +call s:initVariable('g:NERDTreeMapPreviewVSplit', 'g' . NERDTreeMapOpenVSplit) +call s:initVariable('g:NERDTreeMapQuit', 'q') +call s:initVariable('g:NERDTreeMapRefresh', 'r') +call s:initVariable('g:NERDTreeMapRefreshRoot', 'R') +call s:initVariable('g:NERDTreeMapToggleBookmarks', 'B') +call s:initVariable('g:NERDTreeMapToggleFiles', 'F') +call s:initVariable('g:NERDTreeMapToggleFilters', 'f') +call s:initVariable('g:NERDTreeMapToggleHidden', 'I') +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() @@ -171,20 +173,20 @@ call nerdtree#ui_glue#setupCommands() "============================================================ augroup NERDTree "Save the cursor position whenever we close the nerd tree - exec "autocmd BufLeave,WinLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif" + exec 'autocmd BufLeave,WinLeave '. g:NERDTreeCreator.BufNamePrefix() .'* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif' "disallow insert mode in the NERDTree - exec "autocmd BufEnter,WinEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert" + exec 'autocmd BufEnter,WinEnter '. g:NERDTreeCreator.BufNamePrefix() .'* stopinsert' augroup END if g:NERDTreeHijackNetrw augroup NERDTreeHijackNetrw autocmd VimEnter * silent! autocmd! FileExplorer - au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand("")) + au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand('')) augroup END endif -if g:NERDTreeChDirMode == 3 +if g:NERDTreeChDirMode ==# 3 augroup NERDTreeChDirOnTabSwitch autocmd TabEnter * if g:NERDTree.ExistsForTab()|call g:NERDTree.ForCurrentTab().getRoot().path.changeToDir()|endif augroup END @@ -217,7 +219,7 @@ function! NERDTreeFocus() if g:NERDTree.IsOpen() call g:NERDTree.CursorToTreeWin() else - call g:NERDTreeCreator.ToggleTabTree("") + call g:NERDTreeCreator.ToggleTabTree('') endif endfunction @@ -253,7 +255,7 @@ endfunction " SECTION: Post Source Actions {{{1 call nerdtree#postSourceActions() -"reset &cpo back to users setting -let &cpo = s:old_cpo +"reset &cpoptions back to users setting +let &cpoptions = s:old_cpo " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 99773bf1..0df9d12e 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -3,7 +3,7 @@ syn match NERDTreeIgnore #\~# exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#' "highlighting for the .. (up dir) line at the top of the tree -execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" +execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line .'#' "quickhelp syntax elements syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1 @@ -27,7 +27,7 @@ exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-') exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#' -syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark +syn match NERDTreeExecFile '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' "highlighting for readonly files @@ -37,7 +37,7 @@ syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExec syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir "highlighing to conceal the delimiter around the file/dir name -if has("conceal") +if has('conceal') exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL' setlocal conceallevel=3 concealcursor=nvic else diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 302d074b..fbd90e17 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -206,8 +206,11 @@ function! s:QuickfixCreate(nr, opts) abort endif endfunction -function! s:QuickfixStream(nr, title, cmd, first, callback, ...) abort - call s:QuickfixCreate(a:nr, {'title': a:title}) +function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort + let opts = {'title': a:title, 'context': {'items': []}} + call s:QuickfixCreate(a:nr, opts) + let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event + silent exe s:DoAutocmd('QuickFixCmdPre ' . event) let winnr = winnr() exe a:nr < 0 ? 'copen' : 'lopen' if winnr != winnr() @@ -219,12 +222,20 @@ function! s:QuickfixStream(nr, title, cmd, first, callback, ...) abort for line in lines call extend(buffer, call(a:callback, a:000 + [line])) if len(buffer) >= 20 + let contexts = map(copy(buffer), 'get(v:val, "context", {})') + lockvar contexts + call extend(opts.context.items, contexts) + unlet contexts call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a') redraw endif endfor - call s:QuickfixSet(a:nr, extend(buffer, call(a:callback, a:000 + [0])), 'a') + call extend(buffer, call(a:callback, a:000 + [0])) + call extend(opts.context.items, map(copy(buffer), 'get(v:val, "context", {})')) + lockvar opts.context.items + call s:QuickfixSet(a:nr, buffer, 'a') + silent exe s:DoAutocmd('QuickFixCmdPost ' . event) if a:first && len(s:QuickfixGet(a:nr)) call s:BlurStatus() return a:nr < 0 ? 'cfirst' : 'lfirst' @@ -914,8 +925,8 @@ function! fugitive#Find(object, ...) abort let f = 'fugitive://' . dir . '//0/' . rev[1:-1] else if !exists('f') - let commit = substitute(matchstr(rev, '^[^:.-][^:]*\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') - let file = substitute(matchstr(rev, '^[^:.-][^:]*\zs:.*'), '^:', '/', '') + let commit = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') + let file = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\zs:.*'), '^:', '/', '') if file =~# '^/\.\.\=\%(/\|$\)\|^//\|^/\a\+:' let file = file =~# '^/\.' ? simplify(getcwd() . file) : file[1:-1] if s:cpath(base . '/', (file . '/')[0 : len(base)]) @@ -2160,7 +2171,10 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort if exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try exe s:DirCheck(dir) - return 'exe ' . string(s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1])) . after + let result = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) + if type(result) == type('') + return 'exe ' . string(result) . after + endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -3782,6 +3796,240 @@ augroup fugitive_merge \ endif augroup END +" Section: :Git difftool, :Git mergetool + +function! s:ToolItems(state, from, to, offsets, text, ...) abort + let items = [] + for i in range(len(a:state.diff)) + let diff = a:state.diff[i] + let path = (i == len(a:state.diff) - 1) ? a:to : a:from + if empty(path) + return [] + endif + let item = { + \ 'valid': a:0 ? a:1 : 1, + \ 'filename': diff.filename . FugitiveVimPath(path), + \ 'lnum': matchstr(get(a:offsets, i), '\d\+'), + \ 'text': a:text} + if len(get(diff, 'module', '')) + let item.module = diff.module . path + endif + call add(items, item) + endfor + let diff = items[0:-2] + let items[-1].context = {'diff': items[0:-2]} + return [items[-1]] +endfunction + +function! s:ToolToFrom(str) abort + if a:str =~# ' => ' + let str = a:str =~# '{.* => .*}' ? a:str : '{' . a:str . '}' + return [substitute(str, '{.* => \(.*\)}', '\1', ''), + \ substitute(str, '{\(.*\) => .*}', '\1', '')] + else + return [a:str, a:str] + endif +endfunction + +function! s:ToolParse(state, line) abort + if type(a:line) !=# type('') || a:state.mode ==# 'hunk' && a:line =~# '^[ +-]' + return [] + elseif a:line =~# '^diff ' + let a:state.mode = 'diffhead' + let a:state.from = '' + let a:state.to = '' + elseif a:state.mode ==# 'diffhead' && a:line =~# '^--- [^/]' + let a:state.from = a:line[4:-1] + let a:state.to = a:state.from + elseif a:state.mode ==# 'diffhead' && a:line =~# '^+++ [^/]' + let a:state.to = a:line[4:-1] + if empty(get(a:state, 'from', '')) + let a:state.from = a:state.to + endif + elseif a:line[0] ==# '@' + let a:state.mode = 'hunk' + if has_key(a:state, 'from') + let offsets = split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' ') + return s:ToolItems(a:state, a:state.from, a:state.to, offsets, matchstr(a:line, ' @@\+ \zs.*')) + endif + elseif a:line =~# '^[A-Z]\d*\t.\|^:.*\t.' + " --raw, --name-status + let [status; files] = split(a:line, "\t") + return s:ToolItems(a:state, files[0], files[-1], [], a:state.name_only ? '' : status) + elseif a:line =~# '^ \S.* |' + " --stat + let [_, to, changes; __] = matchlist(a:line, '^ \(.\{-\}\) \+|\zs \(.*\)$') + let [to, from] = s:ToolToFrom(to) + return s:ToolItems(a:state, from, to, [], changes) + elseif a:line =~# '^ *\([0-9.]\+%\) .' + " --dirstat + let [_, changes, to; __] = matchlist(a:line, '^ *\([0-9.]\+%\) \(.*\)') + return s:ToolItems(a:state, to, to, [], changes) + elseif a:line =~# '^\(\d\+\|-\)\t\(\d\+\|-\)\t.' + " --numstat + let [_, add, remove, to; __] = matchlist(a:line, '^\(\d\+\|-\)\t\(\d\+\|-\)\t\(.*\)') + let [to, from] = s:ToolToFrom(to) + return s:ToolItems(a:state, from, to, [], add ==# '-' ? 'Binary file' : '+' . add . ' -' . remove, add !=# '-') + elseif a:state.mode !=# 'diffhead' && a:state.mode !=# 'hunk' && len(a:line) || a:line =~# '^git: \|^usage: \|^error: \|^fatal: ' + return [{'text': a:line}] + endif + return [] +endfunction + +function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) abort + let i = 0 + let argv = copy(a:args) + let prompt = 1 + let state = a:state + while i < len(argv) + let match = matchlist(argv[i], '^\(-[a-zABDFH-KN-RT-Z]\)\ze\(.*\)') + if len(match) && len(match[2]) + call insert(argv, match[1]) + let argv[i+1] = '-' . match[2] + continue + endif + let arg = argv[i] + if arg =~# '^-t$\|^--tool=\|^--tool-help$\|^--help$' + return -1 + elseif arg =~# '^-y$\|^--no-prompt$' + let prompt = 0 + call remove(argv, i) + continue + elseif arg ==# '--prompt' + let prompt = 1 + call remove(argv, i) + continue + elseif arg =~# '^--\%(no-\)\=\(symlinks\|trust-exit-code\|gui\)$' + call remove(argv, i) + continue + elseif arg ==# '--' + break + endif + let i += 1 + endwhile + let a:state.mode = 'init' + let a:state.from = '' + let a:state.to = '' + let exec = s:UserCommandList(a:dir) + ['--no-pager', '-c', 'diff.context=0', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv + if prompt + return s:QuickfixStream(a:line2, 'difftool', a:title, exec, !a:bang, s:function('s:ToolParse'), a:state) + else + let filename = '' + let cmd = [] + let tabnr = tabpagenr() + 1 + for line in split(s:SystemError(s:shellesc(exec))[0], "\n") + for item in s:ToolParse(a:state, line) + if len(get(item, 'filename', '')) && item.filename != filename + call add(cmd, 'tabedit ' . s:fnameescape(item.filename)) + for i in reverse(range(len(get(item.context, 'diff', [])))) + call add(cmd, (i ? 'rightbelow' : 'leftabove') . ' vert Gdiffsplit! ' . s:fnameescape(item.context.diff[i].filename)) + endfor + call add(cmd, 'wincmd =') + let filename = item.filename + endif + endfor + endfor + return join(cmd, '|') . (empty(cmd) ? '' : '|' . tabnr . 'tabnext') + endif +endfunction + +function! s:MergetoolSubcommand(line1, line2, range, bang, mods, args) abort + let dir = s:Dir() + let i = 0 + let argv = copy(a:args) + let prompt = 1 + let title = ':Git mergetool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') + let cmd = ['diff', '--diff-filter=U'] + let state = {'name_only': 0} + let state.diff = [{'prefix': ':2:', 'module': ':2:'}, {'prefix': ':3:', 'module': ':3:'}, {'prefix': ':(top)'}] + call map(state.diff, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') + return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, ['--diff-filter=U'] + a:args, state, title) +endfunction + +function! s:DifftoolSubcommand(line1, line2, range, bang, mods, args) abort + let dir = s:Dir() + let i = 0 + let argv = copy(a:args) + let commits = [] + let cached = 0 + let reverse = 1 + let prompt = 1 + let state = {'name_only': 0} + let merge_base_against = {} + let dash = (index(argv, '--') > i ? ['--'] : []) + while i < len(argv) + let match = matchlist(argv[i], '^\(-[a-zABDFH-KN-RT-Z]\)\ze\(.*\)') + if len(match) && len(match[2]) + call insert(argv, match[1]) + let argv[i+1] = '-' . match[2] + continue + endif + let arg = argv[i] + if arg ==# '--cached' + let cached = 1 + elseif arg ==# '-R' + let reverse = 1 + elseif arg ==# '--name-only' + let state.name_only = 1 + let argv[0] = '--name-status' + elseif arg ==# '--' + break + elseif arg !~# '^-\|^\.\.\=\%(/\|$\)' + let parsed = s:LinesError(['rev-parse', '--revs-only', substitute(arg, ':.*', '', '')] + dash)[0] + call map(parsed, '{"uninteresting": v:val =~# "^\\^", "prefix": substitute(v:val, "^\\^", "", "") . ":"}') + let merge_base_against = {} + if arg =~# '\.\.\.' && len(parsed) > 2 + let display = map(split(arg, '\.\.\.', 1), 'empty(v:val) ? "@" : v:val') + if len(display) == 2 + let parsed[0].module = display[1] . ':' + let parsed[1].module = display[0] . ':' + endif + let parsed[2].module = arg . ':' + if empty(commits) + let merge_base_against = parsed[0] + let parsed = [parsed[2]] + endif + elseif arg =~# '\.\.' && len(parsed) == 2 + let display = map(split(arg, '\.\.', 1), 'empty(v:val) ? "@" : v:val') + if len(display) == 2 + let parsed[0].module = display[0] . ':' + let parsed[1].module = display[1] . ':' + endif + elseif len(parsed) == 1 + let parsed[0].module = arg . ':' + endif + call extend(commits, parsed) + endif + let i += 1 + endwhile + let title = ':Git difftool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') + if len(merge_base_against) + call add(commits, merge_base_against) + endif + let commits = filter(copy(commits), 'v:val.uninteresting') + filter(commits, '!v:val.uninteresting') + if cached + if empty(commits) + call add(commits, {'prefix': '@:', 'module': '@:'}) + endif + call add(commits, {'prefix': ':0:', 'module': ':0:'}) + elseif len(commits) < 2 + call add(commits, {'prefix': ':(top)'}) + if len(commits) < 2 + call insert(commits, {'prefix': ':0:', 'module': ':0:'}) + endif + endif + if reverse + let commits = [commits[-1]] + repeat([commits[0]], len(commits) - 1) + call reverse(commits) + endif + if len(commits) > 2 + call add(commits, remove(commits, 0)) + endif + call map(commits, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') + let state.diff = commits + return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, argv, state, title) +endfunction + " Section: :Ggrep, :Glog if !exists('g:fugitive_summary_format') @@ -3869,10 +4117,16 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort endif endfunction -function! s:LogFlushQueue(state) abort +let s:log_diff_context = '{"filename": fugitive#Find(v:val . from, a:dir), "lnum": get(offsets, v:key), "module": strpart(v:val, 0, len(a:state.base_module)) . from}' + +function! s:LogFlushQueue(state, dir) abort let queue = remove(a:state, 'queue') - if a:state.child_found + if a:state.child_found && get(a:state, 'ignore_summary') call remove(queue, 0) + elseif len(queue) && len(a:state.target) && len(get(a:state, 'parents', [])) + let from = substitute(a:state.target, '^/', ':', '') + let offsets = [] + let queue[0].context.diff = map(copy(a:state.parents), s:log_diff_context) endif if len(queue) && queue[-1] ==# {'text': ''} call remove(queue, -1) @@ -3881,41 +4135,65 @@ function! s:LogFlushQueue(state) abort endfunction function! s:LogParse(state, dir, line) abort - if a:state.context ==# 'hunk' && a:line =~# '^[-+ ]' + if a:state.mode ==# 'hunk' && a:line =~# '^[-+ ]' return [] endif let list = matchlist(a:line, '^\%(fugitive \(.\{-\}\)\t\|commit \|From \)\=\(\x\{40,\}\)\%( \(.*\)\)\=$') if len(list) - let a:state.context = 'commit' + let queue = s:LogFlushQueue(a:state, a:dir) + let a:state.mode = 'commit' let a:state.base = 'fugitive://' . a:dir . '//' . list[2] - let a:state.base_module = len(list[1]) ? list[1] : list[2] - let a:state.message = list[3] - if has_key(a:state, 'diffing') - call remove(a:state, 'diffing') + if len(list[1]) + let [a:state.base_module; a:state.parents] = split(list[1], ' ') + else + let a:state.base_module = list[2] + let a:state.parents = [] endif - let queue = s:LogFlushQueue(a:state) + let a:state.message = list[3] + let a:state.from = '' + let a:state.to = '' + let context = {} let a:state.queue = [{ \ 'valid': 1, + \ 'context': context, \ 'filename': a:state.base . a:state.target, \ 'module': a:state.base_module . substitute(a:state.target, '^/', ':', ''), \ 'text': a:state.message}] let a:state.child_found = 0 return queue elseif type(a:line) == type(0) - return s:LogFlushQueue(a:state) + return s:LogFlushQueue(a:state, a:dir) elseif a:line =~# '^diff' - let a:state.context = 'diffhead' - elseif a:line =~# '^[+-]\{3\} \w/' && a:state.context ==# 'diffhead' - let a:state.diffing = a:line[5:-1] - elseif a:line =~# '^@@[^@]*+\d' && has_key(a:state, 'diffing') && has_key(a:state, 'base') - let a:state.context = 'hunk' - if empty(a:state.target) || a:state.target ==# a:state.diffing + let a:state.mode = 'diffhead' + let a:state.from = '' + let a:state.to = '' + elseif a:state.mode ==# 'diffhead' && a:line =~# '^--- \w/' + let a:state.from = a:line[6:-1] + let a:state.to = a:state.from + elseif a:state.mode ==# 'diffhead' && a:line =~# '^+++ \w/' + let a:state.to = a:line[6:-1] + if empty(get(a:state, 'from', '')) + let a:state.from = a:state.to + endif + elseif a:line =~# '^@@[^@]*+\d' && len(get(a:state, 'to', '')) && has_key(a:state, 'base') + let a:state.mode = 'hunk' + if empty(a:state.target) || a:state.target ==# '/' . a:state.to + if !a:state.child_found && len(a:state.queue) && a:state.queue[-1] ==# {'text': ''} + call remove(a:state.queue, -1) + endif let a:state.child_found = 1 + let offsets = map(split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' '), '+matchstr(v:val, "\\d\\+")') + let context = {} + if len(a:state.parents) + let from = ":" . a:state.from + let context.diff = map(copy(a:state.parents), s:log_diff_context) + endif call add(a:state.queue, { \ 'valid': 1, - \ 'filename': a:state.base . a:state.diffing, - \ 'module': a:state.base_module . substitute(a:state.diffing, '^/', ':', ''), - \ 'lnum': +matchstr(a:line, '+\zs\d\+'), + \ 'context': context, + \ 'filename': FugitiveVimPath(a:state.base . '/' . a:state.to), + \ 'module': a:state.base_module . ':' . a:state.to, + \ 'lnum': offsets[-1], \ 'text': a:state.message . matchstr(a:line, ' @@\+ .\+')}) endif elseif a:state.follow && @@ -3930,7 +4208,7 @@ function! s:LogParse(state, dir, line) abort if !get(a:state, 'ignore_summary') call add(a:state.queue, {'text': a:line}) endif - elseif a:state.context ==# 'commit' || a:state.context ==# 'init' + elseif a:state.mode ==# 'commit' || a:state.mode ==# 'init' call add(a:state.queue, {'text': a:line}) endif return [] @@ -3953,32 +4231,36 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort endif if a:line1 == 0 && a:count let path = fugitive#Path(bufname(a:count), '/', dir) + let titlepre = ':0,' . a:count elseif a:count >= 0 let path = fugitive#Path(@%, '/', dir) + let titlepre = a:count == 0 ? ':0,' . bufnr('') : ':' else - let path = '' + let titlepre = ':' + let path = '' endif let range = '' - let extra = [] - let state = {'context': 'init', 'child_found': 0, 'queue': [], 'follow': 0} + let extra_args = [] + let extra_paths = [] + let state = {'mode': 'init', 'child_found': 0, 'queue': [], 'follow': 0} if path =~# '^/\.git\%(/\|$\)\|^$' let path = '' elseif a:line1 == 0 let range = "0," . (a:count ? a:count : bufnr('')) - let extra = ['.' . path] + let extra_paths = ['.' . path] if (empty(paths) || paths ==# ['--']) && !s:HasOpt(args, '--no-follow') let state.follow = 1 if !s:HasOpt(args, '--follow') - call insert(args, '--follow') + call insert(extra_args, '--follow') endif if !s:HasOpt(args, '--summary') - call insert(args, '--summary') + call insert(extra_args, '--summary') let state.ignore_summary = 1 endif endif elseif a:count > 0 if !s:HasOpt(args, '--merges', '--no-merges') - call insert(args, '--no-merges') + call insert(extra_args, '--no-merges') endif call add(args, '-L' . a:line1 . ',' . a:count . ':' . path[1:-1]) endif @@ -3988,13 +4270,13 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort call add(args, owner) endif endif - if empty(extra) + if empty(extra_paths) let path = '' endif if s:HasOpt(args, '-g', '--walk-reflogs') - let format = "%gd\t%H %gs" + let format = "%gd %P\t%H %gs" else - let format = "%h\t%H " . g:fugitive_summary_format + let format = "%h %P\t%H " . g:fugitive_summary_format endif let cmd = ['--no-pager'] if fugitive#GitVersion(1, 9) @@ -4004,13 +4286,13 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort endif call extend(cmd, \ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] + - \ args + paths + extra) + \ args + extra_args + paths + extra_paths) let state.target = path - let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra) && empty(a:type) && len(s:Relative('/')) + let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths) + if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/')) let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after endif - return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after + return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after endfunction " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread @@ -5428,7 +5710,12 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo endif let i = 0 while commit =~# '^ref: ' && i < 10 - let commit = readfile(cdir . '/' . commit[5:-1], '', 1)[0] + let ref_file = cdir . '/' . commit[5:-1] + if getfsize(ref_file) > 0 + let commit = readfile(ref_file, '', 1)[0] + else + let commit = fugitive#RevParse(commit[5:-1], dir) + endif let i -= 1 endwhile endif diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index 999bfdf1..e4d04aeb 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -103,9 +103,23 @@ that are part of Git repositories). :Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. :0Git[!] grep [args] + *:Git-difftool* +:Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the + quickfix list. Each changed hunk gets a separate + quickfix entry unless you pass an option like + --name-only or --name-status. Jumps to the first + change unless [!] is given. + +:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a + new tab, and invoke `:Gdiffsplit` against the + appropriate commit. + + *:Git-mergetool* +:Git mergetool [args] Like |:Git-difftool|, but target merge conflicts. + *:Gclog* *:Glog* :Gclog[!] [args] Use git-log [args] to load the commit history into the -:Glog[!] [args] |quickfix| list. Jump to the first commit unless [!] +:Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!] is given. :{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 8cb86df9..4f8495c8 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -82,7 +82,7 @@ This is to avoid a problem which occurs if you have file named `git.*` (i.e. wit ### Getting started -When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is `4000`, i.e. 4 seconds, but I suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc). +When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is `4000`, i.e. 4 seconds, but I suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc). Note `updatetime` also controls the delay before vim writes its swap file (see `:help updatetime`). You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `hp`, `hs`, and `hu` respectively. @@ -115,13 +115,15 @@ And you can turn line highlighting on and off (defaults to off): * turn off with `:GitGutterLineHighlightsDisable` * toggle with `:GitGutterLineHighlightsToggle`. +Note that if you have line highlighting on and signs off, you will have an empty sign column – more accurately, a sign column with invisible signs. This is because line highlighting requires signs and Vim/NeoVim always shows the sign column when there are signs even if the signs are invisible. + With Neovim 0.3.2 or higher, you can turn line number highlighting on and off (defaults to off): * turn on with `:GitGutterLineNrHighlightsEnable` * turn off with `:GitGutterLineNrHighlightsDisable` * toggle with `:GitGutterLineNrHighlightsToggle`. -Note that if you have line highlighting on and signs off, you will have an empty sign column – more accurately, a sign column with invisible signs. This is because line highlighting requires signs and Vim always shows the sign column even if the signs are invisible. +The same caveat applies to line number highlighting as to line highlighting just above. If you switch off both line highlighting and signs, you won't see the sign column. @@ -649,7 +651,7 @@ Here are some things you can check: #### When signs take a few seconds to appear -* Try reducing `updatetime`, e.g. `set updatetime=100`. +* Try reducing `updatetime`, e.g. `set updatetime=100`. Note this also controls the delay before vim writes its swap file. #### When signs don't update after focusing Vim diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 23805145..f3c09b87 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -249,7 +249,8 @@ OPTIONS *gitgutter-options* The most important option is 'updatetime' which determines how long (in milliseconds) the plugin will wait after you stop typing before it updates the -signs. Vim's default is 4000. I recommend 100. +signs. Vim's default is 4000. I recommend 100. Note this also controls how +long vim waits before writing its swap file. Most important option:~ @@ -624,6 +625,8 @@ Try reducing 'updatetime': set updatetime=100 < +Note this also controls how long vim waits before writing its swap file. + When signs don't update after focusing Vim:~ diff --git a/sources_non_forked/vim-snippets/UltiSnips/octave.snippets b/sources_non_forked/vim-snippets/UltiSnips/octave.snippets new file mode 100644 index 00000000..c11805ff --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/octave.snippets @@ -0,0 +1,2 @@ +extends matlab + diff --git a/sources_non_forked/vim-snippets/snippets/octave.snippets b/sources_non_forked/vim-snippets/snippets/octave.snippets new file mode 100644 index 00000000..c11805ff --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/octave.snippets @@ -0,0 +1,2 @@ +extends matlab + diff --git a/sources_non_forked/vim-snippets/snippets/pandoc.snippets b/sources_non_forked/vim-snippets/snippets/pandoc.snippets new file mode 100644 index 00000000..1dd9e82e --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/pandoc.snippets @@ -0,0 +1,2 @@ +extends markdown + From 32dc236a0082c9a4c328710fed6ae944d9deb6e3 Mon Sep 17 00:00:00 2001 From: George Muraru Date: Mon, 20 Jan 2020 10:26:31 +0200 Subject: [PATCH 42/91] Fix sh script --- install_awesome_parameterized.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/install_awesome_parameterized.sh b/install_awesome_parameterized.sh index d83f6dc6..f7d4bf11 100755 --- a/install_awesome_parameterized.sh +++ b/install_awesome_parameterized.sh @@ -16,9 +16,10 @@ source $1/my_configs.vim catch endtry" -if [ $2 == "--all" ]; then - USERS=($(ls -l /home | awk '{if(NR>1)print $9}')) - for user in ${USERS[*]}; do + +if [ "$2" = "--all" ]; then + USERS=$(ls -l /home | awk '{if(NR>1)print $9}') + for user in $USERS; do homepath=$(eval echo "~$user") IFS='' echo $VIMRC > ${homepath}/.vimrc @@ -28,10 +29,10 @@ if [ $2 == "--all" ]; then echo "Installed the Ultimate Vim configuration successfully! Enjoy :-)" exit 0 else - SELECTED_USERS=(${@:2}) - echo "Selected users: ${SELECTED_USERS[@]}" - for user in ${SELECTED_USERS[@]}; do - homepath=$(eval echo "~$user") + SELECTED_USERS=${@:2} + echo "Selected users: $SELECTED_USERS" + for user in $SELECTED_USERS; do + homepath=$(eval echo "~/$user") IFS='' echo $VIMRC > ${homepath}/.vimrc unset IFS From dbcdace7be8d63e82206d7fd52dee2c1c860ffd1 Mon Sep 17 00:00:00 2001 From: Amir Date: Tue, 28 Jan 2020 23:07:36 -0300 Subject: [PATCH 43/91] Updated plugins --- sources_non_forked/bufexplorer/README.md | 14 +- .../bufexplorer/plugin/bufexplorer.vim | 8 +- sources_non_forked/gist-vim/README.md | 3 + sources_non_forked/gist-vim/autoload/gist.vim | 4 +- sources_non_forked/lightline-ale/README.md | 14 +- .../lightline-ale/autoload/lightline/ale.vim | 14 +- sources_non_forked/lightline.vim/LICENSE | 2 +- sources_non_forked/lightline.vim/README.md | 2 +- .../lightline.vim/autoload/lightline.vim | 4 +- .../lightline.vim/doc/lightline.txt | 24 +- sources_non_forked/nerdtree/CHANGELOG.md | 5 + .../nerdtree/autoload/nerdtree.vim | 7 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 7 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 5 +- .../nerdtree/lib/nerdtree/creator.vim | 30 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 9 +- sources_non_forked/nginx.vim/README.md | 25 +- .../rust.vim/autoload/cargo.vim | 4 + .../rust.vim/autoload/rustfmt.vim | 22 +- sources_non_forked/rust.vim/plugin/cargo.vim | 1 + .../vim-fugitive/autoload/fugitive.vim | 899 ++++++++---------- .../vim-fugitive/doc/fugitive.txt | 89 +- .../vim-fugitive/plugin/fugitive.vim | 46 +- sources_non_forked/vim-gitgutter/README.mkd | 14 + .../vim-gitgutter/autoload/gitgutter/diff.vim | 2 +- .../vim-gitgutter/doc/gitgutter.txt | 18 + .../vim-javascript/syntax/javascript.vim | 2 +- .../vim-ruby/ftdetect/ruby_extra.vim | 3 + sources_non_forked/vim-ruby/syntax/ruby.vim | 4 +- .../vim-snippets/UltiSnips/tex.snippets | 21 + .../vim-snippets/snippets/elixir.snippets | 2 + .../vim-snippets/snippets/sh.snippets | 4 +- 32 files changed, 644 insertions(+), 664 deletions(-) diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md index a5eab5bc..5ee9346e 100644 --- a/sources_non_forked/bufexplorer/README.md +++ b/sources_non_forked/bufexplorer/README.md @@ -5,10 +5,10 @@ BufExplorer Plugin for Vim With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: - 'be' (normal open) or - 'bt' (toggle open / close) or - 'bs' (force horizontal split open) or - 'bv' (force vertical split open) + '\be' (normal open) or + '\bt' (toggle open / close) or + '\bs' (force horizontal split open) or + '\bv' (force vertical split open) Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. @@ -28,8 +28,8 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id ## Installation ### Manually -1. If you do not want to use on the the bundle handlers, you can take the zip - file from vim.org and unzip it and copy the plugin to your vimfiles\plugin +1. If you do not want to use one of the the bundle handlers, you can take the + zip file from vim.org and unzip it and copy the plugin to your vimfiles\plugin directory and the txt file to your vimfiles\doc directory. If you do that, make sure you generate the help by executing @@ -65,7 +65,7 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim ## License -Copyright (c) 2001-2019, Jeff Lanzarotta +Copyright (c) 2001-2020, Jeff Lanzarotta All rights reserved. diff --git a/sources_non_forked/bufexplorer/plugin/bufexplorer.vim b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim index aa19a36f..6a7ef4f0 100644 --- a/sources_non_forked/bufexplorer/plugin/bufexplorer.vim +++ b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim @@ -919,7 +919,7 @@ function! s:SelectBuffer(...) endif " Switch to the selected buffer. - execute "keepalt silent b!" _bufNbr + execute "keepjumps keepalt silent b!" _bufNbr endif " Make the buffer 'listed' again. @@ -957,12 +957,6 @@ function! s:RemoveBuffer(mode) let mode = a:mode - " Do not allow this buffer to be deleted if it is the last one. - if len(s:MRUList) == 1 - call s:Error("Sorry, you are not allowed to delete the last buffer") - return - endif - " These commands are to temporarily suspend the activity of winmanager. if exists("b:displayMode") && b:displayMode == "winmanager" call WinManagerSuspendAUs() diff --git a/sources_non_forked/gist-vim/README.md b/sources_non_forked/gist-vim/README.md index 95e3e234..e91463f1 100644 --- a/sources_non_forked/gist-vim/README.md +++ b/sources_non_forked/gist-vim/README.md @@ -266,6 +266,9 @@ Then gist-vim will ask for your password in order to create an access token. If you have two-factor authentication enabled, gist-vim will also prompt you to enter the two-factor key you receive. +NOTE: +If you want you can set it directly to `g:github_user` and `g:gist_token`. + Whichever type of authentication you use, your GitHub password will not be stored, only a OAuth access token produced specifically for gist-vim. The token is stored in `~/.gist-vim`. If you stop using the plugin, you can diff --git a/sources_non_forked/gist-vim/autoload/gist.vim b/sources_non_forked/gist-vim/autoload/gist.vim index 50d88427..afe797e7 100644 --- a/sources_non_forked/gist-vim/autoload/gist.vim +++ b/sources_non_forked/gist-vim/autoload/gist.vim @@ -961,7 +961,9 @@ function! s:GistGetAuthHeader() abort return printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password)) endif let auth = '' - if filereadable(s:gist_token_file) + if !empty(get(g:, 'gist_token', $GITHUB_TOKEN)) + let auth = 'token ' . get(g:, 'gist_token', $GITHUB_TOKEN) + elseif filereadable(s:gist_token_file) let str = join(readfile(s:gist_token_file), '') if type(str) == 1 let auth = str diff --git a/sources_non_forked/lightline-ale/README.md b/sources_non_forked/lightline-ale/README.md index a2e345b0..ebfbc7e6 100644 --- a/sources_non_forked/lightline-ale/README.md +++ b/sources_non_forked/lightline-ale/README.md @@ -30,6 +30,7 @@ let g:lightline = {} let g:lightline.component_expand = { \ 'linter_checking': 'lightline#ale#checking', + \ 'linter_infos': 'lightline#ale#infos', \ 'linter_warnings': 'lightline#ale#warnings', \ 'linter_errors': 'lightline#ale#errors', \ 'linter_ok': 'lightline#ale#ok', @@ -40,17 +41,18 @@ let g:lightline.component_expand = { ```viml let g:lightline.component_type = { - \ 'linter_checking': 'left', + \ 'linter_checking': 'right', + \ 'linter_infos': 'right', \ 'linter_warnings': 'warning', \ 'linter_errors': 'error', - \ 'linter_ok': 'left', + \ 'linter_ok': 'right', \ } ``` 3. Add the components to the lightline, for example to the right side: ```viml -let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]] } +let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ]] } ``` ## Configuration @@ -59,6 +61,10 @@ let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'lint The indicator to use when ALE is in progress. Default is `Linting...`. +##### `g:lightline#ale#indicator_infos` + +The indicator to use when there are infos. Default is `I:`. + ##### `g:lightline#ale#indicator_warnings` The indicator to use when there are warnings. Default is `W:`. @@ -78,6 +84,7 @@ If you would like to replace the default indicators with symbols like on the scr The following icons from the Font Awesome font are used in the screenshot: * Checking: [f110](https://fontawesome.com/icons/spinner) +* Infos: [f129](https://fontawesome.com/icons/info) * Warnings: [f071](https://fontawesome.com/icons/exclamation-triangle) * Errors: [f05e](https://fontawesome.com/icons/ban) * OK: [f00c](https://fontawesome.com/icons/check) (although I prefer to disable this component) @@ -93,6 +100,7 @@ Here's the configuration snippet used in the screenshot: ```viml let g:lightline#ale#indicator_checking = "\uf110" +let g:lightline#ale#indicator_infos = "\uf129" let g:lightline#ale#indicator_warnings = "\uf071" let g:lightline#ale#indicator_errors = "\uf05e" let g:lightline#ale#indicator_ok = "\uf00c" diff --git a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim index 06aa90c1..0b34f7bc 100644 --- a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim +++ b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim @@ -1,3 +1,4 @@ +let s:indicator_infos = get(g:, 'lightline#ale#indicator_infos', 'I: ') let s:indicator_warnings = get(g:, 'lightline#ale#indicator_warnings', 'W: ') let s:indicator_errors = get(g:, 'lightline#ale#indicator_errors', 'E: ') let s:indicator_ok = get(g:, 'lightline#ale#indicator_ok', 'OK') @@ -7,14 +8,21 @@ let s:indicator_checking = get(g:, 'lightline#ale#indicator_checking', 'Linting. """""""""""""""""""""" " Lightline components +function! lightline#ale#infos() abort + if !lightline#ale#linted() + return '' + endif + let l:counts = ale#statusline#Count(bufnr('')) + return l:counts.info == 0 ? '' : printf(s:indicator_infos . '%d', l:counts.info) +endfunction + function! lightline#ale#warnings() abort if !lightline#ale#linted() return '' endif let l:counts = ale#statusline#Count(bufnr('')) - let l:all_errors = l:counts.error + l:counts.style_error - let l:all_non_errors = l:counts.total - l:all_errors - return l:all_non_errors == 0 ? '' : printf(s:indicator_warnings . '%d', all_non_errors) + let l:all_warnings = l:counts.warning + l:counts.style_warning + return l:all_warnings == 0 ? '' : printf(s:indicator_warnings . '%d', all_warnings) endfunction function! lightline#ale#errors() abort diff --git a/sources_non_forked/lightline.vim/LICENSE b/sources_non_forked/lightline.vim/LICENSE index 56144fc6..ee9e0c80 100644 --- a/sources_non_forked/lightline.vim/LICENSE +++ b/sources_non_forked/lightline.vim/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2019 itchyny +Copyright (c) 2013-2020 itchyny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index f4061bd5..bb116378 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -246,7 +246,7 @@ let g:lightline = { \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { - \ 'gitbranch': 'fugitive#head' + \ 'gitbranch': 'FugitiveHead' \ }, \ } ``` diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 127622c0..07800f42 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2019/08/20 14:00:00. +" Last Change: 2020/01/27 19:41:58. " ============================================================================= let s:save_cpo = &cpo @@ -432,7 +432,7 @@ function! s:line(tabline, inactive) abort let _ .= i < l + len(lt) - len(l_) && ll[i] < l || ll[i] != ll[i + 1] ? p.left : len(lt[i]) ? s.left : '' endfor let _ .= '%#LightlineMiddle_' . mode . '#%=' - for i in reverse(range(len(rt))) + for i in range(len(rt) - 1, 0, -1) let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#' let _ .= i < r + len(rt) - len(r_) && rl[i] < r || rl[i] != rl[i + 1] ? p.right : len(rt[i]) ? s.right : '' let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '#' diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 5bb51eee..c94b63d0 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2019/12/27 18:23:29. +Last Change: 2020/01/28 18:40:21. CONTENTS *lightline-contents* @@ -148,7 +148,7 @@ OPTIONS *lightline-option* \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { - \ 'gitbranch': 'fugitive#head' + \ 'gitbranch': 'FugitiveHead' \ }, \ } < @@ -316,8 +316,8 @@ nice. return &readonly ? '' : '' endfunction function! LightlineFugitive() - if exists('*fugitive#head') - let branch = fugitive#head() + if exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? ''.branch : '' endif return '' @@ -341,8 +341,8 @@ look nice. return &readonly ? '⭤' : '' endfunction function! LightlineFugitive() - if exists('*fugitive#head') - let branch = fugitive#head() + if exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? '⭠ '.branch : '' endif return '' @@ -742,8 +742,8 @@ A nice example for non-patched font users. \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*fugitive#head') - return fugitive#head() + if &ft !~? 'vimfiler' && exists('*FugitiveHead') + return FugitiveHead() endif return '' endfunction @@ -777,8 +777,8 @@ A nice example for |vim-powerline| font users: \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*fugitive#head') - let branch = fugitive#head() + if &ft !~? 'vimfiler' && exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? '⭠ '.branch : '' endif return '' @@ -836,9 +836,9 @@ For users who uses lots of plugins: function! LightlineFugitive() try - if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') + if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*FugitiveHead') let mark = '' " edit here for cool mark - let branch = fugitive#head() + let branch = FugitiveHead() return branch !=# '' ? mark.branch : '' endif catch diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index c8989ef3..e163c6c9 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -7,7 +7,12 @@ in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.5 +- **.0**: `NERDTreeToggle ` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083) #### 6.4 +- **.6**: NERDTreeFind shows expected message if file doesn't exist e.g. with vim-startify (andys8). [#1081](https://github.com/preservim/nerdtree/pull/1081) +- **.5**: Ensure events are (or aren't) being ignored correctly. (PhilRunninger) [#1080](https://github.com/preservim/nerdtree/pull/1080) +- **.4**: Prevent overwriting existing files/dirs on node move. (PhilRunninger) [#1079](https://github.com/preservim/nerdtree/pull/1079) - **.3**: Fix regex that finds keyword for minimal menu. (PhilRunninger) [#1075](https://github.com/preservim/nerdtree/pull/1075) - **.2**: Lint vimscript, fix errors and warnings, add CI job to review PRs (Caleb Maclennan) [#1071](https://github.com/preservim/nerdtree/pull/1071) - **.1**: Ensure backward compatibility. v:t_func is not available before Vim 8.0 (Phil Runninger) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 5c9af895..156b2602 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -169,8 +169,11 @@ function! nerdtree#exec(cmd, ignoreAll) abort if a:ignoreAll set eventignore=all endif - exec a:cmd - let &eventignore = old_ei + try + exec a:cmd + finally + let &eventignore = old_ei + endtry endfunction " FUNCTION: nerdtree#has_opt(options, name) {{{2 diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 400e52dc..57af126b 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -284,15 +284,16 @@ endfunction " FUNCTION: s:findAndRevealPath(pathStr) {{{1 function! s:findAndRevealPath(pathStr) abort let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') - if !filereadable(l:pathStr) - let l:pathStr = fnamemodify(l:pathStr, ':h') - endif if empty(l:pathStr) call nerdtree#echoWarning('no file for the current buffer') return endif + if !filereadable(l:pathStr) + let l:pathStr = fnamemodify(l:pathStr, ':h') + endif + try let l:pathStr = g:NERDTreePath.Resolve(l:pathStr) let l:pathObj = g:NERDTreePath.New(l:pathStr) diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 857e6823..e2dd56a3 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -122,8 +122,9 @@ The following features and functionality are provided by the NERDTree: :NERDTreeToggle [ | ] *:NERDTreeToggle* If a NERDTree already exists for this tab, it is reopened and rendered - again. If no NERDTree exists for this tab then this command acts the - same as the |:NERDTree| command. + again. If or is given, the root of NERDTree + is set to that path. If no NERDTree exists for this tab then this command + acts the same as the |:NERDTree| command. :NERDTreeToggleVCS [ | ] *:NERDTreeToggleVCS* Like |:NERDTreeToggle|, but searches up the directory tree to find the top of diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 39e3f554..e2b3fa0a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -333,14 +333,17 @@ function! s:Creator._tabpagevar(tabnr, var) let old_ei = &eventignore set eventignore=all - exec 'tabnext ' . a:tabnr - let v = -1 - if exists('t:' . a:var) - exec 'let v = t:' . a:var - endif - exec 'tabnext ' . currentTab + try + exec 'tabnext ' . a:tabnr + let v = -1 + if exists('t:' . a:var) + exec 'let v = t:' . a:var + endif + exec 'tabnext ' . currentTab - let &eventignore = old_ei + finally + let &eventignore = old_ei + endtry return v endfunction @@ -352,17 +355,20 @@ function! s:Creator.ToggleTabTree(dir) endfunction " FUNCTION: s:Creator.toggleTabTree(dir) {{{1 -" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is -" closed it is restored or initialized (if it doesnt exist) +" Toggles the NERD tree. I.e if the NERD tree is open, it is closed. If it is +" closed, it is restored or initialized. If dir is not empty, it will be set +" as the new root. " " Args: -" dir: the full path for the root node (is only used if the NERD tree is being -" initialized. +" dir: the full path for the root node (is used if the NERD tree is being +" initialized, or to change the root to a new dir.) function! s:Creator.toggleTabTree(dir) if g:NERDTree.ExistsForTab() if !g:NERDTree.IsOpen() call self._createTreeWin() - if !&hidden + if !empty(a:dir) + call self.createTabTree(a:dir) + elseif !&hidden call b:NERDTree.render() endif call b:NERDTree.ui.restoreScreenState() diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 3ecfa816..281116fd 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -141,12 +141,12 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) endif " 1. ensure that a new buffer is loaded - call nerdtree#exec('badd ' . quotedFileName, 1) + call nerdtree#exec('badd ' . quotedFileName, 0) " 2. ensure that all windows which display the just deleted filename " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1) + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0) call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) " 3. We don't need a previous buffer anymore @@ -196,6 +196,11 @@ function! NERDTreeMoveNode() let curNode = g:NERDTreeFileNode.GetSelected() let prompt = s:inputPrompt('move') let newNodePath = input(prompt, curNode.path.str(), 'file') + while filereadable(newNodePath) + call nerdtree#echoWarning('This destination already exists. Try again.') + let newNodePath = input(prompt, curNode.path.str(), 'file') + endwhile + if newNodePath ==# '' call nerdtree#echo('Node Renaming Aborted.') diff --git a/sources_non_forked/nginx.vim/README.md b/sources_non_forked/nginx.vim/README.md index 58eceefa..669159ad 100644 --- a/sources_non_forked/nginx.vim/README.md +++ b/sources_non_forked/nginx.vim/README.md @@ -51,22 +51,27 @@ For help with secure cipher selection, visit [Mozillas SSL Configuration Generat ## Installation -### Pathogen +Install using any vim plugin manager. If you're not familiar with any, go with Plug ([``vim-plug``](https://github.com/junegunn/vim-plug)). +Then install this plugin using the your vim's plugin manager as follows: -```bash -git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim +### Plug +``` +Plug 'chr4/nginx.vim' ``` -### Other (Plug, Dein.vim, Vundle) -```vim -" Plug -Plug 'chr4/nginx.vim' - -" Dein.vim +### Dein.vim +``` call dein#add('chr4/nginx.vim') +``` -" Vundle +### Vundle +``` Plugin 'chr4/nginx.vim' ``` +### Pathogen +``` +git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim +``` + Optionally, if you like [Jinja](http://jinja.pocoo.org/) template syntax highlighting, install `lepture/vim-jinja`, too. diff --git a/sources_non_forked/rust.vim/autoload/cargo.vim b/sources_non_forked/rust.vim/autoload/cargo.vim index 01ab2ccc..b84f62a8 100644 --- a/sources_non_forked/rust.vim/autoload/cargo.vim +++ b/sources_non_forked/rust.vim/autoload/cargo.vim @@ -65,6 +65,10 @@ function! cargo#build(args) call cargo#cmd("build " . a:args) endfunction +function! cargo#check(args) + call cargo#cmd("check " . a:args) +endfunction + function! cargo#clean(args) call cargo#cmd("clean " . a:args) endfunction diff --git a/sources_non_forked/rust.vim/autoload/rustfmt.vim b/sources_non_forked/rust.vim/autoload/rustfmt.vim index 7fd9b43c..4a5f86cc 100644 --- a/sources_non_forked/rust.vim/autoload/rustfmt.vim +++ b/sources_non_forked/rust.vim/autoload/rustfmt.vim @@ -60,18 +60,19 @@ function! s:RustfmtWriteMode() endif endfunction -function! s:RustfmtConfig() +function! s:RustfmtConfigOptions() let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';') if l:rustfmt_toml !=# '' - return '--config-path '.l:rustfmt_toml + return '--config-path '.fnamemodify(l:rustfmt_toml, ":p") endif let l:_rustfmt_toml = findfile('.rustfmt.toml', expand('%:p:h') . ';') if l:_rustfmt_toml !=# '' - return '--config-path '.l:_rustfmt_toml + return '--config-path '.fnamemodify(l:_rustfmt_toml, ":p") endif - return '' + " Default to edition 2018 in case no rustfmt.toml was found. + return '--edition 2018' endfunction function! s:RustfmtCommandRange(filename, line1, line2) @@ -82,7 +83,7 @@ function! s:RustfmtCommandRange(filename, line1, line2) let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} let l:write_mode = s:RustfmtWriteMode() - let l:rustfmt_config = s:RustfmtConfig() + let l:rustfmt_config = s:RustfmtConfigOptions() " FIXME: When --file-lines gets to be stable, add version range checking " accordingly. @@ -96,14 +97,9 @@ function! s:RustfmtCommandRange(filename, line1, line2) endfunction function! s:RustfmtCommand() - if g:rustfmt_emit_files - let l:write_mode = "--emit=stdout" - else - let l:write_mode = "--write-mode=display" - endif - " rustfmt will pick on the right config on its own due to the - " current directory change. - return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options + let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display' + let config = s:RustfmtConfigOptions() + return join([g:rustfmt_command, write_mode, config, g:rustfmt_options]) endfunction function! s:DeleteLines(start, end) abort diff --git a/sources_non_forked/rust.vim/plugin/cargo.vim b/sources_non_forked/rust.vim/plugin/cargo.vim index 5cd413cc..efc38768 100644 --- a/sources_non_forked/rust.vim/plugin/cargo.vim +++ b/sources_non_forked/rust.vim/plugin/cargo.vim @@ -7,6 +7,7 @@ set cpoptions&vim command! -nargs=+ Cargo call cargo#cmd() command! -nargs=* Cbuild call cargo#build() +command! -nargs=* Ccheck call cargo#check() command! -nargs=* Cclean call cargo#clean() command! -nargs=* Cdoc call cargo#doc() command! -nargs=+ Cnew call cargo#new() diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index fbd90e17..2823ec13 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -42,7 +42,7 @@ function! s:Uniq(list) abort endfunction function! s:winshell() abort - return has('win32') && &shellcmdflag =~# '^/\|^-Command$' + return has('win32') && &shellcmdflag !~# '^-' endfunction function! s:shellesc(arg) abort @@ -138,6 +138,19 @@ function! s:executable(binary) abort return s:executables[a:binary] endfunction +if !exists('s:temp_scripts') + let s:temp_scripts = {} +endif +function! s:TempScript(...) abort + let body = join(a:000, "\n") + if !has_key(s:temp_scripts, body) + let temp = tempname() . '.sh' + call writefile(['#!/bin/sh'] + a:000, temp) + let s:temp_scripts[body] = temp + endif + return FugitiveGitPath(s:temp_scripts[body]) +endfunction + function! s:DoAutocmd(cmd) abort if v:version >= 704 || (v:version == 703 && has('patch442')) return 'doautocmd ' . a:cmd @@ -244,6 +257,25 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort endif endfunction +let s:common_efm = '' + \ . '%+Egit:%.%#,' + \ . '%+Eusage:%.%#,' + \ . '%+Eerror:%.%#,' + \ . '%+Efatal:%.%#,' + \ . '%-G%.%#%\e[K%.%#,' + \ . '%-G%.%#%\r%.%\+' + +function! fugitive#Cwindow() abort + if &buftype == 'quickfix' + cwindow + else + botright cwindow + if &buftype == 'quickfix' + wincmd p + endif + endif +endfunction + " Section: Git function! s:UserCommandList(...) abort @@ -414,17 +446,24 @@ function! fugitive#PrepareDirEnvArgv(...) abort return [dir, env, cmd] endfunction +function! s:BuildEnvPrefix(env) abort + let pre = '' + let env = items(a:env) + if empty(env) + return '' + elseif &shellcmdflag =~# '-Command' + return join(map(env, '"$Env:" . v:val[0] . " = ''" . substitute(v:val[1], "''", "''''", "g") . "''; "'), '') + elseif s:winshell() + return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '') + else + return 'env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' ' + endif +endfunction + function! s:BuildShell(dir, env, args) abort let cmd = copy(a:args) let tree = s:Tree(a:dir) - let pre = '' - for [var, val] in items(a:env) - if s:winshell() - let pre .= 'set ' . var . '=' . s:shellesc(val) . '& ' - else - let pre = (len(pre) ? pre : 'env ') . var . '=' . s:shellesc(val) . ' ' - endif - endfor + let pre = s:BuildEnvPrefix(a:env) if empty(tree) || index(cmd, '--') == len(cmd) - 1 call insert(cmd, '--git-dir=' . FugitiveGitPath(a:dir)) elseif fugitive#GitVersion(1, 8, 5) @@ -1260,17 +1299,16 @@ function! fugitive#setfperm(url, perm) abort endfunction function! s:TempCmd(out, cmd) abort - let prefix = '' try let cmd = (type(a:cmd) == type([]) ? fugitive#Prepare(a:cmd) : a:cmd) let redir = ' > ' . a:out - if s:winshell() + if (s:winshell() || &shellcmdflag ==# '-Command') && !has('nvim') let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' - return s:SystemError('cmd /c "' . prefix . s:gsub(cmd, '[<>]', cmd_escape_char . '&') . redir . '"') + return s:SystemError('cmd /c "' . s:gsub(cmd, '[<>%]', cmd_escape_char . '&') . redir . '"') elseif &shell =~# 'fish' - return s:SystemError(' begin;' . prefix . cmd . redir . ';end ') + return s:SystemError(' begin;' . cmd . redir . ';end ') else - return s:SystemError(' (' . prefix . cmd . redir . ') ') + return s:SystemError(' (' . cmd . redir . ') ') endif endtry endfunction @@ -1555,28 +1593,16 @@ function! s:ReplaceCmd(cmd) abort if exec_error call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) endif - let temp = s:Resolve(temp) - let fn = expand('%:p') - silent exe 'keepalt file '.temp - let modelines = &modelines - try - set modelines=0 - silent keepjumps noautocmd edit! - finally - let &modelines = modelines - try - silent exe 'keepalt file '.s:fnameescape(fn) - catch /^Vim\%((\a\+)\)\=:E302:/ - endtry - call delete(temp) - if s:cpath(fnamemodify(bufname('$'), ':p'), temp) - silent! execute 'bwipeout '.bufnr('$') - endif - endtry + silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp) + silent keepjumps $delete _ + call delete(temp) + if s:cpath(fnamemodify(bufname('$'), ':p'), temp) + silent! execute bufnr('$') . 'bwipeout' + endif endfunction function! s:QueryLog(refspec) abort - let lines = s:LinesError(['log', '-n', '256', '--format=%h%x09%s', a:refspec, '--'])[0] + let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] call map(lines, 'split(v:val, "\t")') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') return lines @@ -1626,12 +1652,28 @@ function! s:AddSection(label, lines, ...) abort call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines)) endfunction +let s:rebase_abbrevs = { + \ 'p': 'pick', + \ 'r': 'reword', + \ 'e': 'edit', + \ 's': 'squash', + \ 'f': 'fixup', + \ 'x': 'exec', + \ 'd': 'drop', + \ 'l': 'label', + \ 't': 'reset', + \ 'm': 'merge', + \ 'b': 'break', + \ } + function! fugitive#BufReadStatus() abort let amatch = s:Slash(expand('%:p')) let b:fugitive_type = 'index' unlet! b:fugitive_reltime try silent doautocmd BufReadPre + let config = fugitive#Config() + let cmd = [fnamemodify(amatch, ':h')] setlocal noro ma nomodeline buftype=nowrite if s:cpath(fnamemodify($GIT_INDEX_FILE !=# '' ? $GIT_INDEX_FILE : fugitive#Find('.git/index'), ':p')) !=# s:cpath(amatch) @@ -1746,15 +1788,13 @@ function! fugitive#BufReadStatus() abort let b:fugitive_files['Unstaged'][dict.filename] = dict endfor - let config = fugitive#Config() - let pull_type = 'Pull' if len(pull) let rebase = fugitive#Config('branch.' . branch . '.rebase', config) if empty(rebase) let rebase = fugitive#Config('pull.rebase', config) endif - if rebase =~# '^\%(true\|yes\|on\|1\|interactive\)$' + if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$' let pull_type = 'Rebase' elseif rebase =~# '^\%(false\|no|off\|0\|\)$' let pull_type = 'Merge' @@ -1765,20 +1805,22 @@ function! fugitive#BufReadStatus() abort if empty(push_remote) let push_remote = fugitive#Config('remote.pushDefault', config) endif - let push = len(push_remote) && len(branch) ? push_remote . '/' . branch : '' - if empty(push) - let push = pull + let fetch_remote = fugitive#Config('branch.' . branch . '.remote', config) + if empty(fetch_remote) + let fetch_remote = 'origin' + endif + if empty(push_remote) + let push_remote = fetch_remote endif - if len(pull) && get(props, 'branch.ab') !~# ' -0$' - let unpulled = s:QueryLog(head . '..' . pull) - else - let unpulled = [] + let push_default = fugitive#Config('push.default') + if empty(push_default) + let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching' endif - if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') - let unpushed = s:QueryLog(push . '..' . head) + if push_default ==# 'upstream' + let push = pull else - let unpushed = [] + let push = len(branch) ? (push_remote ==# '.' ? '' : push_remote . '/') . branch : '' endif if isdirectory(fugitive#Find('.git/rebase-merge/')) @@ -1844,8 +1886,19 @@ function! fugitive#BufReadStatus() abort let unstaged_end = len(unstaged) ? line('$') : 0 call s:AddSection('Staged', staged) let staged_end = len(staged) ? line('$') : 0 - call s:AddSection('Unpushed to ' . push, unpushed) - call s:AddSection('Unpulled from ' . pull, unpulled) + + if len(pull) && get(props, 'branch.ab') !~# ' -0$' + call s:AddSection('Unpulled from ' . pull, s:QueryLog(head . '..' . pull)) + endif + if len(push) && push !=# pull + call s:AddSection('Unpulled from ' . push, s:QueryLog(head . '..' . push)) + endif + if len(pull) && push !=# pull + call s:AddSection('Unpushed to ' . pull, s:QueryLog(pull . '..' . head)) + endif + if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') + call s:AddSection('Unpushed to ' . push, s:QueryLog(push . '..' . head)) + endif setlocal nomodified readonly noswapfile silent doautocmd BufReadPost @@ -1916,7 +1969,7 @@ function! fugitive#BufReadStatus() abort endfor let b:fugitive_reltime = reltime() - return '' + return 'silent ' . s:DoAutocmd('User FugitiveIndex') catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -2019,7 +2072,7 @@ function! fugitive#BufReadCmd(...) abort setlocal endofline try - silent doautocmd BufReadPre + silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' let b:fugitive_display_format = b:fugitive_display_format % 2 if b:fugitive_display_format @@ -2043,6 +2096,7 @@ function! fugitive#BufReadCmd(...) abort call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) else call s:ReplaceCmd([dir, 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) + keepjumps 1 keepjumps call search('^parent ') if getline('.') ==# 'parent ' silent keepjumps delete_ @@ -2079,8 +2133,16 @@ function! fugitive#BufReadCmd(...) abort endtry setlocal modifiable + + let browsex = maparg('NetrwBrowseX', 'n') + let remote_check = '\Cnetrw#CheckIfRemote(\%(netrw#GX()\)\=)' + if browsex =~# remote_check + exe 'nnoremap NetrwBrowseX' substitute(browsex, remote_check, '0', 'g') + endif + return 'silent ' . s:DoAutocmd('BufReadPost') . - \ (modifiable ? '' : '|setl nomodifiable') + \ (modifiable ? '' : '|setl nomodifiable') . '|silent ' . + \ s:DoAutocmd('User Fugitive' . substitute(b:fugitive_type, '^\l', '\u&', '')) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -2119,9 +2181,7 @@ function! s:TempReadPre(file) abort setlocal nomodeline setlocal bufhidden=delete nobuflisted setlocal buftype=nowrite - if has_key(dict, 'modifiable') - let &l:modifiable = dict.modifiable - endif + setlocal nomodifiable if len(dict.dir) let b:git_dir = dict.dir call extend(b:, {'fugitive_type': 'temp'}, 'keep') @@ -2154,6 +2214,124 @@ augroup END " Section: :Git +function! s:RunJobs() abort + return exists('*job_start') || exists('*jobstart') +endfunction + +function! s:RunReceive(state, job, data, ...) abort + call add(a:state.log, a:data) + let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data + if has_key(a:state, 'buffer') + let data = remove(a:state, 'buffer') . data + endif + let escape = "\033]51;[^\007]*" + let a:state.buffer = matchstr(data, escape . "$\\|[\r\n]\\+$") + if len(a:state.buffer) + let data = strpart(data, 0, len(data) - len(a:state.buffer)) + endif + let cmd = matchstr(data, escape . "\007")[5:-2] + let data = substitute(data, escape . "\007", '', 'g') + echon substitute(data, "\r\\ze\n", '', 'g') + if cmd =~# '^fugitive:' + let a:state.request = strpart(cmd, 9) + endif +endfunction + +function! s:RunSend(job, str) abort + try + if type(a:job) == type(0) + call chansend(a:job, a:str) + else + call ch_sendraw(a:job, a:str) + endif + return len(a:str) + catch /^Vim\%((\a\+)\)\=:E90[06]:/ + return 0 + endtry +endfunction + +if !exists('s:edit_jobs') + let s:edit_jobs = {} +endif +function! s:RunWait(state, job) abort + let finished = 0 + try + while get(a:state, 'request', '') !=# 'edit' && (type(a:job) == type(0) ? jobwait([a:job], 1)[0] == -1 : ch_status(a:job) !=# 'closed') + if !exists('*jobwait') + sleep 1m + endif + let peek = getchar(1) + if peek != 0 && !(has('win32') && peek == 128) + let c = getchar() + let c = type(c) == type(0) ? nr2char(c) : c + call s:RunSend(a:job, c) + if !a:state.pty + echon c + endif + endif + endwhile + sleep 1m + echo + if get(a:state, 'request', '') == 'edit' + call remove(a:state, 'request') + let file = readfile(a:state.temp . '.edit')[0] + exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) + set bufhidden=wipe + let s:edit_jobs[bufnr('')] = [a:state, a:job] + endif + let finished = 1 + finally + if !finished + try + if a:state.pty + call s:RunSend(a:job, "\") + elseif type(a:job) == type(0) + call jobstop(a:job) + else + call job_stop(a:job) + endif + catch /.*/ + endtry + endif + endtry + call fugitive#ReloadStatus(a:state.dir, 1) + return '' +endfunction + +if !exists('s:resume_queue') + let s:resume_queue = [] +endif +function! fugitive#Resume() abort + while len(s:resume_queue) + let [state, job] = remove(s:resume_queue, 0) + call s:RunWait(state, job) + endwhile +endfunction + +function! s:RunBufDelete(bufnr) abort + if has_key(s:edit_jobs, a:bufnr) | + if filereadable(s:edit_jobs[a:bufnr][0].temp . '.edit') + call delete(s:edit_jobs[a:bufnr][0].temp . '.edit') + endif + call add(s:resume_queue, remove(s:edit_jobs, a:bufnr)) + call feedkeys(":redraw!|call fugitive#Resume()|silent checktime\r", 'n') + endif +endfunction + +augroup fugitive_job + autocmd! + autocmd BufDelete * call s:RunBufDelete(expand('')) + autocmd VimLeave * + \ for s:jobbuf in keys(s:edit_jobs) | + \ call writefile([], remove(s:edit_jobs, s:jobbuf)[0].temp . '.exit') | + \ endfor +augroup END + +let s:disable_colors = [] +for s:colortype in ['advice', 'branch', 'diff', 'grep', 'interactive', 'pager', 'push', 'remote', 'showBranch', 'status', 'transport', 'ui'] + call extend(s:disable_colors, ['-c', 'color.' . s:colortype . '=false']) +endfor +unlet s:colortype function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let dir = s:Dir() let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir)) @@ -2171,22 +2349,27 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort if exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try exe s:DirCheck(dir) - let result = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) - if type(result) == type('') - return 'exe ' . string(result) . after + let opts = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) + if type(opts) == type('') + return 'exe ' . string(opts) . after endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry + else + let opts = {} endif - if a:bang || args[0] =~# '^-P$\|^--no-pager$\|diff\%(tool\)\@!\|log\|^show$' || + let args = get(opts, 'args', args) + if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') + if args[0] =~# '^-p$\|^--paginate$' + call remove(args, 0) + endif return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after endif if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || - \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || - \ index(['--paginate', '-p'], args[0]) >= 0 + \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') @@ -2197,16 +2380,81 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . assign . after endif endif - if has('gui_running') && !has('win32') - call insert(args, '--no-pager') + let env = get(opts, 'env', {}) + if s:RunJobs() + let state = {'dir': dir, 'mods': s:Mods(a:mods), 'temp': tempname(), 'log': []} + let state.pty = get(g:, 'fugitive_pty', has('unix') && (has('patch-8.0.0744') || has('nvim'))) + if !state.pty + let args = s:AskPassArgs(dir) + args + endif + let env.FUGITIVE_TEMP = state.temp + let editor = 'sh ' . s:TempScript( + \ '[ -f "$FUGITIVE_TEMP.exit" ] && exit 1', + \ 'echo "$1" > "$FUGITIVE_TEMP.edit"', + \ 'printf "\033]51;fugitive:edit\007"', + \ 'while [ -f "$FUGITIVE_TEMP.edit" -a ! -f "$FUGITIVE_TEMP.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done', + \ 'exit 0') + call extend(env, { + \ 'NO_COLOR': '1', + \ 'GIT_EDITOR': editor, + \ 'GIT_SEQUENCE_EDITOR': editor, + \ 'GIT_MERGE_AUTOEDIT': '1', + \ 'GIT_PAGER': 'cat', + \ 'PAGER': 'cat'}, 'keep') + let args = ['-c', 'advice.waitingForEditor=false'] + s:disable_colors + args + let argv = s:UserCommandList(dir) + args + if !has('patch-8.0.0902') || has('nvim') + let envlist = map(items(env), 'join(v:val, "=")') + if s:executable('env') + let argv = ['env'] + envlist + argv + elseif has('win32') + let argv = ['cmd.exe', '/c', + \ join(map(envlist, { _, v -> 'set ' . substitute(v, '[&|<>^]', '^^^&', 'g') }) + + \ [s:shellesc(argv)], '& ')] + else + return 'echoerr ' . string('fugitive: "env" command missing') + endif + let env = {} + endif + let state.cmd = argv + let g:_fugitive_last_job = state + if &autowrite || &autowriteall | silent! wall | endif + if exists('*job_start') + let jobopts = { + \ 'mode': 'raw', + \ 'callback': function('s:RunReceive', [state]), + \ } + if state.pty + let jobopts.pty = 1 + endif + if len(env) + let jobopts.env = env + endif + let job = job_start(argv, jobopts) + else + let job = jobstart(argv, { + \ 'pty': state.pty, + \ 'env': env, + \ 'TERM': 'dumb', + \ 'on_stdout': function('s:RunReceive', [state]), + \ 'on_stderr': function('s:RunReceive', [state]), + \ }) + endif + let state.job = job + call s:RunWait(state, job) + return 'silent checktime' . after + else + if has('gui_running') && !has('win32') + call insert(args, '--no-pager') + endif + if has('nvim') + let env.GIT_TERMINAL_PROMPT = '0' + endif + let pre = s:BuildEnvPrefix(env) + return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . + \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . + \ after endif - let pre = '' - if has('nvim') && executable('env') - let pre .= 'env GIT_TERMINAL_PROMPT=0 ' - endif - return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . - \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . - \ after endfunction let s:exec_paths = {} @@ -3206,7 +3454,7 @@ function! s:DoStageUnpushedHeading(heading) abort let remote = '.' endif let branch = matchstr(a:heading, 'to \%([^/]\+/\)\=\zs\S\+') - call feedkeys(':Gpush ' . remote . ' ' . 'HEAD:' . branch) + call feedkeys(':Git push ' . remote . ' ' . 'HEAD:' . 'refs/heads/' . branch) endfunction function! s:DoToggleUnpushedHeading(heading) abort @@ -3219,7 +3467,7 @@ function! s:DoStageUnpushed(record) abort let remote = '.' endif let branch = matchstr(a:record.heading, 'to \%([^/]\+/\)\=\zs\S\+') - call feedkeys(':Gpush ' . remote . ' ' . a:record.commit . ':' . branch) + call feedkeys(':Git push ' . remote . ' ' . a:record.commit . ':' . 'refs/heads/' . branch) endfunction function! s:DoToggleUnpushed(record) abort @@ -3227,7 +3475,7 @@ function! s:DoToggleUnpushed(record) abort endfunction function! s:DoUnstageUnpulledHeading(heading) abort - call feedkeys(':Grebase') + call feedkeys(':Git rebase') endfunction function! s:DoToggleUnpulledHeading(heading) abort @@ -3235,7 +3483,7 @@ function! s:DoToggleUnpulledHeading(heading) abort endfunction function! s:DoUnstageUnpulled(record) abort - call feedkeys(':Grebase ' . a:record.commit) + call feedkeys(':Git rebase ' . a:record.commit) endfunction function! s:DoToggleUnpulled(record) abort @@ -3243,7 +3491,7 @@ function! s:DoToggleUnpulled(record) abort endfunction function! s:DoUnstageUnpushed(record) abort - call feedkeys(':Grebase --autosquash ' . a:record.commit . '^') + call feedkeys(':Git rebase --autosquash ' . a:record.commit . '^') endfunction function! s:DoToggleStagedHeading(...) abort @@ -3370,109 +3618,28 @@ function! s:CommitInteractive(line1, line2, range, bang, mods, args, patch) abor endif endfunction -function! s:CommitSubcommand(line1, line2, range, bang, mods, args, ...) abort - let mods = substitute(s:Mods(a:mods), '\C\', '-tab', 'g') - let dir = a:0 ? a:1 : s:Dir() - let tree = s:Tree(dir) - let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir) - let outfile = tempname() - try - if s:winshell() - let command = 'set GIT_EDITOR=false& ' +function! s:CommitSubcommand(line1, line2, range, bang, mods, args) abort + let argv = copy(a:args) + let i = 0 + while get(argv, i, '--') !=# '--' + if argv[i] =~# '^-[apzsneiovq].' + call insert(argv, argv[i][0:1]) + let argv[i+1] = '-' . argv[i+1][2:-1] else - let command = 'env GIT_EDITOR=false ' + let i += 1 endif - let argv = a:args - let i = 0 - while get(argv, i, '--') !=# '--' - if argv[i] =~# '^-[apzsneiovq].' - call insert(argv, argv[i][0:1]) - let argv[i+1] = '-' . argv[i+1][2:-1] - else - let i += 1 - endif - endwhile - let command .= s:UserCommand(dir, ['commit'] + argv) - if (&autowrite || &autowriteall) && !a:0 - silent! wall - endif - if s:HasOpt(argv, '-i', '--interactive') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) - elseif s:HasOpt(argv, '-p', '--patch') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) - else - let [error_string, exec_error] = s:TempCmd(outfile, command) - let errors = split(error_string, "\n") - endif - if !has('gui_running') - redraw! - endif - if !exec_error - echo join(errors, "\n") - if filereadable(outfile) - echo join(readfile(outfile), "\n") - endif - call fugitive#ReloadStatus(dir, 1) - return '' - else - let error = get(errors,-2,get(errors,-1,'!')) - if error =~# 'false''\=\.$' - let i = 0 - while get(argv, i, '--') !=# '--' - if argv[i] =~# '^\%(-[eips]\|-[CcFm].\+\|--edit\|--interactive\|--patch\|--signoff\|--reedit-message=.*\|--reuse-message=.*\|--file=.*\|--message=.*\)$' - call remove(argv, i) - elseif argv[i] =~# '^\%(-[CcFm]\|--reedit-message\|--reuse-message\|--file\|--message\)$' - call remove(argv, i, i + 1) - else - if argv[i] =~# '^--cleanup\>' - let cleanup = 1 - endif - let i += 1 - endif - endwhile - call insert(argv, '--no-signoff', i) - call insert(argv, '--no-interactive', i) - call insert(argv, '--no-edit', i) - if !exists('cleanup') - call insert(argv, '--cleanup=strip') - endif - call extend(argv, ['-F', msgfile], 'keep') - if (bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&modified) || a:line2 == 0 - execute mods . 'keepalt edit' s:fnameescape(msgfile) - elseif s:HasOpt(argv, '-v') || mods =~# '\' - execute mods . 'keepalt -tabedit' s:fnameescape(msgfile) - else - execute mods . 'keepalt split' s:fnameescape(msgfile) - endif - let b:fugitive_commit_arguments = argv - setlocal bufhidden=wipe filetype=gitcommit - return '1' - elseif empty(errors) - let out = readfile(outfile) - echo get(out, -1, '') =~# 'stash\|\d' ? get(out, -2, '') : get(out, -1, '') - return '' - else - echo join(errors, "\n") - return '' - endif - endif - catch /^fugitive:/ - return 'echoerr ' . string(v:exception) - finally - call delete(outfile) - endtry + endwhile + if s:HasOpt(argv, '-i', '--interactive') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) + elseif s:HasOpt(argv, '-p', '--patch') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) + else + return {} + endif endfunction function! s:RevertSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() - let no_commit = s:HasOpt(a:args, '-n', '--no-commit', '--no-edit', '--abort', '--continue', '--quit') - let cmd = s:UserCommand(dir, ['revert'] + (no_commit ? [] : ['-n']) + a:args) - let [out, exec_error] = s:SystemError(cmd) - call fugitive#ReloadStatus(dir, 1) - if no_commit || exec_error - return 'echo ' . string(substitute(out, "\n$", '', '')) - endif - return s:CommitSubcommand(a:line1, a:line2, a:range, a:bang, a:mods, [], dir) + return {'args': ['revert', '--edit'] + a:args} endfunction function! fugitive#CommitComplete(A, L, P) abort @@ -3496,20 +3663,6 @@ function! fugitive#RevertComplete(A, L, P) abort return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision')) endfunction -function! s:FinishCommit() abort - let buf = +expand('') - let args = getbufvar(buf, 'fugitive_commit_arguments') - if !empty(args) - call setbufvar(buf, 'fugitive_commit_arguments', []) - if getbufvar(buf, 'fugitive_commit_rebase') - call setbufvar(buf, 'fugitive_commit_rebase', 0) - let s:rebase_continue = [s:Dir(buf), 0] - endif - return s:CommitSubcommand(-1, -1, 0, 0, '', args, s:Dir(buf)) - endif - return '' -endfunction - " Section: :Gmerge, :Grebase, :Gpull function! fugitive#MergeComplete(A, L, P) abort @@ -3524,278 +3677,24 @@ function! fugitive#PullComplete(A, L, P) abort return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote')) endfunction -function! s:RebaseSequenceAborter() abort - if !exists('s:rebase_sequence_aborter') - let temp = tempname() . '.sh' - call writefile( - \ ['#!/bin/sh', - \ 'echo exec false | cat - "$1" > "$1.fugitive"', - \ 'mv "$1.fugitive" "$1"'], - \ temp) - let s:rebase_sequence_aborter = temp - endif - return s:rebase_sequence_aborter -endfunction - -function! fugitive#Cwindow() abort - if &buftype == 'quickfix' - cwindow - else - botright cwindow - if &buftype == 'quickfix' - wincmd p - endif - endif -endfunction - -let s:common_efm = '' - \ . '%+Egit:%.%#,' - \ . '%+Eusage:%.%#,' - \ . '%+Eerror:%.%#,' - \ . '%+Efatal:%.%#,' - \ . '%-G%.%#%\e[K%.%#,' - \ . '%-G%.%#%\r%.%\+' - -let s:rebase_abbrevs = { - \ 'p': 'pick', - \ 'r': 'reword', - \ 'e': 'edit', - \ 's': 'squash', - \ 'f': 'fixup', - \ 'x': 'exec', - \ 'd': 'drop', - \ 'l': 'label', - \ 't': 'reset', - \ 'm': 'merge', - \ 'b': 'break', - \ } - -function! s:RebaseEdit(cmd, dir) abort - let rebase_todo = s:fnameescape(fugitive#Find('.git/rebase-merge/git-rebase-todo', a:dir)) - - if filereadable(rebase_todo) - let new = readfile(rebase_todo) - let sha_length = 0 - let shas = {} - - for i in range(len(new)) - if new[i] =~# '^\l\+\s\+[0-9a-f]\{5,\}\>' - let sha = matchstr(new[i], '\C\<[a-f0-9]\{5,\}\>') - if !sha_length - let sha_length = len(s:TreeChomp(a:dir, 'rev-parse', '--short', sha)) - endif - let shortened_sha = strpart(sha, 0, sha_length) - let shas[shortened_sha] = sha - let new[i] = substitute(new[i], sha, shortened_sha, '') - endif - endfor - call writefile(new, rebase_todo) - endif - return a:cmd . ' +setlocal\ bufhidden=wipe\|' . escape('let b:fugitive_rebase_shas = ' . string(shas), ' ') . ' ' . rebase_todo -endfunction - -function! s:MergeRebase(cmd, bang, mods, args, ...) abort - let dir = a:0 ? a:1 : s:Dir() - let args = a:args - let mods = s:Mods(a:mods) - if a:cmd =~# '^rebase' && s:HasOpt(args, '-i', '--interactive') - let cmd = fugitive#Prepare(dir, '-c', 'sequence.editor=sh ' . s:RebaseSequenceAborter(), 'rebase') . ' ' . s:shellesc(args) - let out = system(cmd)[0:-2] - for file in ['end', 'msgnum'] - let file = fugitive#Find('.git/rebase-merge/' . file, dir) - if !filereadable(file) - return 'echoerr ' . string("fugitive: " . out) - endif - call writefile([readfile(file)[0] - 1], file) - endfor - call writefile([], fugitive#Find('.git/rebase-merge/done', dir)) - if a:bang - return 'exe' - endif - return s:RebaseEdit(mods . 'split', dir) - elseif a:cmd =~# '^rebase' && s:HasOpt(args, '--edit-todo') && filereadable(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) - return s:RebaseEdit(mods . 'split', dir) - elseif a:cmd =~# '^rebase' && s:HasOpt(args, '--continue') && !a:0 - let rdir = fugitive#Find('.git/rebase-merge', dir) - let exec_error = s:ChompError([dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--'])[1] - if exec_error && isdirectory(rdir) - if getfsize(rdir . '/amend') <= 0 - return 'exe ' . string(mods . 'Gcommit -n -F ' . s:fnameescape(rdir .'/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' - elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir) - return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(rdir . '/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' - endif - endif - endif - let had_merge_msg = filereadable(fugitive#Find('.git/MERGE_MSG', dir)) - let argv = [] - if a:cmd ==# 'pull' - let argv += s:AskPassArgs(dir) + ['pull', '--progress'] - else - call add(argv, a:cmd) - endif - if !s:HasOpt(args, '--no-edit', '--abort', '-m') && a:cmd !=# 'rebase' - call add(argv, '--edit') - endif - if a:cmd ==# 'rebase' && s:HasOpt(args, '--autosquash') && !s:HasOpt(args, '--interactive', '-i') - call add(argv, '--interactive') - endif - call extend(argv, args) - - let [mp, efm] = [&l:mp, &l:efm] - try - let cdback = s:Cd(s:Tree(dir)) - let &l:errorformat = '' - \ . '%-Gerror:%.%#false''.,' - \ . '%-G%.%# ''git commit'' %.%#,' - \ . '%+Emerge:%.%#,' - \ . s:common_efm . ',' - \ . '%+ECannot %.%#: You have unstaged changes.,' - \ . '%+ECannot %.%#: Your index contains uncommitted changes.,' - \ . '%+EThere is no tracking information for the current branch.,' - \ . '%+EYou are not currently on a branch. Please specify which,' - \ . '%+I %#git rebase --continue,' - \ . 'CONFLICT (%m): %f deleted in %.%#,' - \ . 'CONFLICT (%m): Merge conflict in %f,' - \ . 'CONFLICT (%m): Rename \"%f\"->%.%#,' - \ . 'CONFLICT (%m): Rename %.%#->%f %.%#,' - \ . 'CONFLICT (%m): There is a directory with name %f in %.%#,' - \ . '%+ECONFLICT %.%#,' - \ . '%+EKONFLIKT %.%#,' - \ . '%+ECONFLIT %.%#,' - \ . "%+EXUNG \u0110\u1ed8T %.%#," - \ . "%+E\u51b2\u7a81 %.%#," - \ . 'U%\t%f' - if a:cmd =~# '^merge' && empty(args) && - \ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) || - \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - let cmd = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' - else - let cmd = s:UserCommand(dir, argv) - endif - if !empty($GIT_SEQUENCE_EDITOR) || has('win32') - let old_sequence_editor = $GIT_SEQUENCE_EDITOR - let $GIT_SEQUENCE_EDITOR = 'true' - else - let cmd = 'env GIT_SEQUENCE_EDITOR=true ' . cmd - endif - if !empty($GIT_EDITOR) || has('win32') - let old_editor = $GIT_EDITOR - let $GIT_EDITOR = 'false' - else - let cmd = 'env GIT_EDITOR=false ' . substitute(cmd, '^env ', '', '') - endif - if !has('patch-8.1.0334') && has('terminal') && &autowrite - let autowrite_was_set = 1 - set noautowrite - silent! wall - endif - let &l:makeprg = cmd - silent noautocmd make! - catch /^Vim\%((\a\+)\)\=:E211/ - let err = v:exception - finally - if exists('autowrite_was_set') - set autowrite - endif - redraw! - let [&l:mp, &l:efm] = [mp, efm] - if exists('old_editor') - let $GIT_EDITOR = old_editor - endif - if exists('old_sequence_editor') - let $GIT_SEQUENCE_EDITOR = old_sequence_editor - endif - execute cdback - endtry - call fugitive#ReloadStatus(dir, 1) - if empty(filter(getqflist(),'v:val.valid && v:val.type !=# "I"')) - if a:cmd =~# '^rebase' && - \ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) && - \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^bep]' - cclose - let amend = filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) ? '--amend ' : '' - return 'exe ' . string(mods . 'Gcommit ' . amend . '-n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' - elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir)) - cclose - return mods . 'Gcommit --no-status -n -t '.s:fnameescape(fugitive#Find('.git/MERGE_MSG', dir)) - endif - endif - let qflist = getqflist() - let found = 0 - for e in qflist - if !empty(e.bufnr) - let found = 1 - let e.pattern = '^<<<<<<<' - endif - endfor - call fugitive#Cwindow() - if found - call setqflist(qflist, 'r') - if !a:bang - call s:BlurStatus() - return 'cfirst' - endif - endif - return exists('err') ? 'echoerr '.string(err) : 'exe' -endfunction - -function! s:RebaseClean(file) abort - if !filereadable(a:file) - return '' - endif - let old = readfile(a:file) - let new = copy(old) - for i in range(len(new)) - let new[i] = substitute(new[i], '^\l\>', '\=get(s:rebase_abbrevs,submatch(0),submatch(0))', '') - - let sha = matchstr(new[i], '\C\<[a-f0-9]\{5,\}\>') - let rebase_shas = getbufvar(a:file, 'fugitive_rebase_shas') - if len(sha) && type(rebase_shas) == type({}) && has_key(rebase_shas, sha) - let new[i] = substitute(new[i], '\C\<' . sha . '\>', rebase_shas[sha], '') - endif - endfor - if new !=# old - call writefile(new, a:file) - endif - return '' -endfunction - function! s:MergeSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('merge', a:bang, a:mods, a:args) + let dir = s:Dir() + if empty(a:args) && ( + \ filereadable(fugitive#Find('.git/MERGE_MSG', dir)) || + \ isdirectory(fugitive#Find('.git/rebase-apply', dir)) || + \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) + return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . ' mergetool' + endif + return {} endfunction function! s:RebaseSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('rebase', a:bang, a:mods, a:args) + if s:HasOpt(a:args, '--autosquash') && !s:HasOpt(a:args, '-i', '--interactive') + return {'env': {'GIT_SEQUENCE_EDITOR': 'true'}, 'args': ['rebase', '--interactive'] + a:args} + endif + return {} endfunction -function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('pull', a:bang, a:mods, a:args) -endfunction - -function! s:RebaseContinue(arg, ...) abort - let [dir, edit_todo] = a:arg - exe s:MergeRebase('rebase', 0, '', [edit_todo && getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) <= 0 ? '--abort' : '--continue'], dir) -endfunction - -augroup fugitive_merge - autocmd! - autocmd VimLeavePre,BufDelete git-rebase-todo - \ if getbufvar(+expand(''), '&bufhidden') ==# 'wipe' | - \ call s:RebaseClean(expand('')) | - \ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand(''))) == 0 | - \ let s:rebase_continue = [FugitiveGitDir(+expand('')), 1] | - \ endif | - \ endif - autocmd BufEnter * nested - \ if exists('s:rebase_continue') | - \ if has('timers') | - \ call timer_start(0, function('s:RebaseContinue', [remove(s:, 'rebase_continue')])) | - \ else | - \ call s:RebaseContinue(remove(s:, 'rebase_continue')) | - \ endif | - \ endif -augroup END - " Section: :Git difftool, :Git mergetool function! s:ToolItems(state, from, to, offsets, text, ...) abort @@ -3852,6 +3751,9 @@ function! s:ToolParse(state, line) abort let offsets = split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' ') return s:ToolItems(a:state, a:state.from, a:state.to, offsets, matchstr(a:line, ' @@\+ \zs.*')) endif + elseif a:line =~# '^\* Unmerged path .' + let file = a:line[16:-1] + return s:ToolItems(a:state, file, file, [], '') elseif a:line =~# '^[A-Z]\d*\t.\|^:.*\t.' " --raw, --name-status let [status; files] = split(a:line, "\t") @@ -3890,7 +3792,7 @@ function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) endif let arg = argv[i] if arg =~# '^-t$\|^--tool=\|^--tool-help$\|^--help$' - return -1 + return {} elseif arg =~# '^-y$\|^--no-prompt$' let prompt = 0 call remove(argv, i) @@ -4084,12 +3986,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort call add(cmd, '--column') endif let tree = s:Tree(dir) - if type(a:args) == type([]) - let [args, after] = [a:args, ''] - else - let [args, after] = s:SplitExpandChain(a:args, tree) - endif - let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? 'fugitive://' . dir . '//0/' : tree . '/') + let args = a:args let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args if listnr > 0 @@ -4102,6 +3999,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort let tempfile = tempname() let event = listnr < 0 ? 'grep-fugitive' : 'lgrep-fugitive' silent exe s:DoAutocmd('QuickFixCmdPre ' . event) + let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? + \ 'fugitive://' . dir . '//0/' : + \ s:cpath(getcwd(), tree) ? '' : tree . '/') exe '!' . escape(s:UserCommand(dir, cmd + args), '%#!') \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)') @@ -4111,9 +4011,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort redraw endif if !a:bang && !empty(list) - return (listnr < 0 ? 'c' : 'l').'first' . after + return (listnr < 0 ? 'c' : 'l').'first' else - return after[1:-1] + return '' endif endfunction @@ -4408,13 +4308,7 @@ function! s:OpenExec(cmd, mods, args, ...) abort let dir = a:0 ? s:Dir(a:1) : s:Dir() let temp = tempname() let columns = get(g:, 'fugitive_columns', 80) - if columns <= 0 - let env = '' - elseif s:winshell() - let env = 'set COLUMNS=' . columns . '& ' - else - let env = 'env COLUMNS=' . columns . ' ' - endif + let env = s:BuildEnvPrefix({'COLUMNS': columns}) silent! execute '!' . escape(env . s:UserCommand(dir, ['--no-pager'] + a:args), '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') redraw! @@ -4425,7 +4319,7 @@ function! s:OpenExec(cmd, mods, args, ...) abort else let filetype = 'git' endif - let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype, 'modifiable': first =~# '^diff ' } + let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype } if a:cmd ==# 'edit' call s:BlurStatus() endif @@ -4512,26 +4406,8 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor return 'wq' elseif get(b:, 'fugitive_type', '') ==# 'index' return 'Gcommit' - elseif &buftype ==# 'nowrite' && getline(4) =~# '^+++ ' - let filename = getline(4)[6:-1] - setlocal buftype= - silent write - setlocal buftype=nowrite - if matchstr(getline(2),'index [[:xdigit:]]\+\.\.\zs[[:xdigit:]]\{7\}') ==# fugitive#RevParse(':0:'.filename)[0:6] - let [message, exec_error] = s:ChompError(['apply', '--cached', '--reverse', '--', expand('%:p')]) - else - let [message, exec_error] = s:ChompError(['apply', '--cached', '--', expand('%:p')]) - endif - if exec_error - echohl ErrorMsg - echo message - echohl NONE - return '' - elseif a:bang - return 'bdelete' - else - return 'Gedit '.fnameescape(filename) - endif + elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} ' + return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit') endif let mytab = tabpagenr() let mybufnr = bufnr('') @@ -4667,11 +4543,6 @@ function! fugitive#WqCommand(...) abort endif endfunction -augroup fugitive_commit - autocmd! - autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute substitute(s:FinishCommit(), '\C^echoerr \(''[^'']*''\)*', 'redraw|echohl ErrorMsg|echo \1|echohl NONE', '') -augroup END - " Section: :Gpush, :Gfetch function! fugitive#PushComplete(A, L, P) abort @@ -5258,7 +5129,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort endfor return '' endif - let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file, 'modifiable': 0} + let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file} if s:HasOpt(flags, '--reverse') let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*') endif @@ -5911,14 +5782,14 @@ function! fugitive#MapJumps(...) abort nnoremap c :Git commit nnoremap c :Git commit - nnoremap cv :Git commit -v - nnoremap cv :Git commit -v + nnoremap cv :tab Git commit -v + nnoremap cv :tab Git commit -v nnoremap ca :Gcommit --amend nnoremap cc :Gcommit nnoremap ce :Gcommit --amend --no-edit nnoremap cw :Gcommit --amend --only - nnoremap cva :Gcommit -v --amend - nnoremap cvc :Gcommit -v + nnoremap cva :tab Gcommit -v --amend + nnoremap cvc :tab Gcommit -v nnoremap cRa :Gcommit --reset-author --amend nnoremap cRe :Gcommit --reset-author --amend --no-edit nnoremap cRw :Gcommit --reset-author --amend --only @@ -5937,6 +5808,7 @@ function! fugitive#MapJumps(...) abort nnoremap cm :Git merge nnoremap cm :Git merge + nnoremap cmt :Git mergetool nnoremap cm? :help fugitive_cm nnoremap cz :Git stash @@ -6302,43 +6174,22 @@ function! fugitive#foldtext() abort return fugitive#Foldtext() endfunction -augroup fugitive_folding - autocmd! - autocmd User Fugitive - \ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' | - \ set foldtext=fugitive#Foldtext() | - \ endif -augroup END - " Section: Initialization function! fugitive#Init() abort - if exists('#User#FugitiveBoot') - exe s:DoAutocmd('User FugitiveBoot') - endif - let dir = s:Dir() - if &tags !~# '\.git' && @% !~# '\.git' && !exists('s:tags_warning') - let actualdir = fugitive#Find('.git/', dir) - if filereadable(actualdir . 'tags') - let s:tags_warning = 1 - echohl WarningMsg - echo "Fugitive .git/tags support removed in favor of `:set tags^=./.git/tags;`" - echohl NONE - endif - endif - exe s:DoAutocmd('User Fugitive') + throw 'Third party code is using fugitive#Init() which has been removed. Contact the author if you have a reason to still use it' endfunction function! fugitive#is_git_dir(path) abort - return FugitiveIsGitDir(a:path) + throw 'Third party code is using fugitive#is_git_dir() which has been removed. Change it to FugitiveIsGitDir()' endfunction function! fugitive#extract_git_dir(path) abort - return FugitiveExtractGitDir(a:path) + throw 'Third party code is using fugitive#extract_git_dir() which has been removed. Change it to FugitiveExtractGitDir()' endfunction function! fugitive#detect(path) abort - return FugitiveDetect(a:path) + throw 'Third party code is using fugitive#detect() which has been removed. Contact the author if you have a reason to still use it' endfunction " Section: End diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index e4d04aeb..efb4425a 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -16,14 +16,18 @@ These commands are local to the buffers in which they work (generally, buffers that are part of Git repositories). *:Git* *fugitive-:G* -:Git {args} Run an arbitrary git command. Similar to :!git [args] -:G {args} but chdir to the repository tree first. For some - subcommands, a Fugitive command is called instead. +:Git {args} Run an arbitrary git command and display any output. +:G {args} On UNIX this uses a pty and on other platforms it uses + a pipe, which will cause some behavior differences + such as the absence of progress bars. Any file the + command edits (for example, a commit message) will be + loaded into a split window. Closing that window will + resume running the command. A few Git subcommands + have different behavior; these are documented below. - *:Git!* -:Git! {args} Like |:Git|, but capture the output into a temp file, -:Git --no-pager {args} and |:split| that temp file. Use :0Git to -:Git -P {args} |:edit| the temp file instead. A temp file is always +:Git! {args} Run an arbitrary git command, capture output to a temp +:Git --paginate {args} file, and |:split| that temp file. Use :0Git to +:Git -p {args} |:edit| the temp file instead. A temp file is always used for diff and log commands. *:Gstatus* @@ -31,44 +35,6 @@ that are part of Git repositories). :G Press g? or see |fugitive-maps| for usage. :Gstatus - *:Git-commit* *:Gcommit* -:Git commit [args] A wrapper around git-commit. Unless the arguments -:Gcommit [args] given would skip the invocation of an editor (e.g., - -m), a split window will be used to obtain a commit - message, or a new tab if -v is given. Write and close - the window (:wq) to finish the commit. To cancel, use - an empty message. - - *:Git-revert* *:Grevert* -:Git revert [args] A wrapper around git-revert. Similar to |:Gcommit|. -:Grevert [args] - - *:Git-merge* *:Gmerge* -:Git merge [args] Calls git-merge and loads errors and conflicted files -:Gmerge [args] into the |quickfix| list. Opens a |:Gcommit| style - split window for the commit message if the merge - succeeds. If called during a merge conflict, the - conflicted files from the current index are loaded - into the |quickfix| list. - - *:Git-pull* *:Gpull* -:Git pull [args] Like |:Gmerge|, but for git-pull. -:Gpull [args] - - *:Git-rebase* *:Grebase* -:Git rebase [args] Like |:Gmerge|, but for git-rebase. Interactive -:Grebase [args] rebase is experimentally supported. - - *:Git-push* *:Gpush* -:Git push [args] Invoke git-push, load the results into the |quickfix| -:Gpush [args] list, and invoke |:cwindow| to reveal any errors. - |:Dispatch| is used if available for asynchronous - invocation. - - *:Git-fetch* *:Gfetch* -:Git fetch [args] Like |:Gpush|, but for git-fetch. -:Gfetch [args] - *:Git-blame* *:Gblame* :Git blame [flags] Run git-blame [flags] on the current file and open the :Gblame [flags] results in a scroll-bound vertical split. The @@ -111,12 +77,39 @@ that are part of Git repositories). change unless [!] is given. :Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a - new tab, and invoke `:Gdiffsplit` against the + new tab, and invoke `:Gdiffsplit!` against the appropriate commit. *:Git-mergetool* :Git mergetool [args] Like |:Git-difftool|, but target merge conflicts. + *:Git-push* *:Gpush* +:Git push [args] Invoke git-push, load the results into the |quickfix| +:Gpush [args] list, and invoke |:cwindow| to reveal any errors. + |:Dispatch| is used if available for asynchronous + invocation. + + *:Git-fetch* *:Gfetch* +:Git fetch [args] Like |:Gpush|, but for git-fetch. +:Gfetch [args] + + *:Git-merge* *:Gmerge* +:Gmerge [args] Deprecated alias for |:Git| merge. Use |:Git-mergetool| + to get the old behavior of loading merge conflicts + into the quickfix list. + + *:Git-pull* *:Gpull* +:Gpull [args] Deprecated alias for |:Git| pull. + + *:Git-rebase* *:Grebase* +:Grebase [args] Deprecated alias for |:Git| rebase. + + *:Git-commit* *:Gcommit* +:Gcommit [args] Deprecated alias for |:Git| commit. + + *:Git-revert* *:Grevert* +:Grevert [args] Deprecated alias for |:Git| revert. + *:Gclog* *:Glog* :Gclog[!] [args] Use git-log [args] to load the commit history into the :Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!] @@ -208,7 +201,7 @@ that are part of Git repositories). focus on the current window. During a merge conflict, this is a three-way diff against the "ours" and "theirs" ancestors. Additional d2o and d3o maps are - provided to to obtain the hunk from the "ours" or + provided to obtain the hunk from the "ours" or "theirs" ancestor, respectively. :Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current @@ -315,7 +308,7 @@ P under the cursor. On untracked files, this instead *fugitive_d* Diff maps ~ *fugitive_dp* -dp Invoke |:Git!| diff on the file under the cursor. +dp Invoke |:Git| diff on the file under the cursor. Deprecated in favor of inline diffs. *fugitive_dd* diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index e98f437d..a1e66fb6 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: 3.1 +" Version: 3.2 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') @@ -66,8 +66,8 @@ function! FugitivePath(...) abort endfunction " FugitiveParse() takes a fugitive:// URL and returns a 2 element list -" containing the Git dir and an object name ("commit:file"). It's effectively -" then inverse of FugitiveFind(). +" containing an object name ("commit:file") and the Git dir. It's effectively +" the inverse of FugitiveFind(). function! FugitiveParse(...) abort let path = s:Slash(a:0 ? a:1 : @%) if path !~# '^fugitive:' @@ -103,6 +103,24 @@ function! FugitiveConfig(...) abort endif endfunction +" Retrieve a Git configuration value. An optional second argument provides +" the Git dir as with FugitiveFind(). Pass a blank string to limit to the +" global config. +function! FugitiveConfigGet(name, ...) abort + return call('FugitiveConfig', [a:name] + a:000) +endfunction + +" Like FugitiveConfigGet(), but return a list of all values. +function! FugitiveConfigGetAll(name, ...) abort + if a:0 && type(a:1) ==# type({}) + let config = a:1 + else + let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) + endif + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + function! FugitiveRemoteUrl(...) abort return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction @@ -261,9 +279,23 @@ function! FugitiveDetect(path) abort let b:git_dir = dir endif endif - if exists('b:git_dir') - return fugitive#Init() + if !exists('b:git_dir') || !exists('#User#Fugitive') + return '' endif + if v:version >= 704 || (v:version == 703 && has('patch442')) + doautocmd User Fugitive + elseif &modelines > 0 + let modelines = &modelines + try + set modelines=0 + doautocmd User Fugitive + finally + let &modelines = modelines + endtry + else + doautocmd User Fugitive + endif + return '' endfunction function! FugitiveVimPath(path) abort @@ -339,6 +371,10 @@ augroup fugitive \ if len(FugitiveGitDir()) | \ call fugitive#MapCfile('fugitive#MessageCfile()') | \ endif + autocmd FileType git,gitcommit + \ if len(FugitiveGitDir()) && &foldtext ==# 'foldtext()' | + \ setlocal foldtext=fugitive#Foldtext() | + \ endif autocmd FileType fugitive \ if len(FugitiveGitDir()) | \ call fugitive#MapCfile('fugitive#StatusCfile()') | diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 4f8495c8..0c21f3c1 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -234,6 +234,20 @@ gitgutter#fold#foldtext(): +-- 45 lines (*): abcdef You can use `gitgutter#fold#is_changed()` in your own `foldtext` expression to find out whether the folded lines have been changed. +### Status line + +Call the `GitGutterGetHunkSummary()` function from your status line to get a list of counts of added, modified, and removed lines in the current buffer. For example: + +```viml +" Your vimrc +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) +endfunction +set statusline+=%{GitStatus()} +``` + + ### Customisation You can customise: diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 498fe9e9..be8a685f 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -4,7 +4,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' " True for git v1.7.2+. function! s:git_supports_command_line_config_override() abort - call system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version') + call gitgutter#utility#system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version') return !v:shell_error endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index f3c09b87..1f52989f 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -17,6 +17,7 @@ CONTENTS *gitgutter* Commands ..................... |gitgutter-commands| Mappings ..................... |gitgutter-mappings| Autocommand .................. |gitgutter-autocommand| + Status line .................. |gitgutter-statusline| Options ...................... |gitgutter-options| Highlights ................... |gitgutter-highlights| FAQ .......................... |gitgutter-faq| @@ -244,6 +245,23 @@ trailing empty lines. < +=============================================================================== +STATUS LINE *gitgutter-statusline* + + +Call the `GitGutterGetHunkSummary()` function from your status line to get a +list of counts of added, modified, and removed lines in the current buffer. +For example: +> + " Your vimrc + function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) + endfunction + set statusline+=%{GitStatus()} +< + + =============================================================================== OPTIONS *gitgutter-options* diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index c8daec93..4d1a7e50 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -199,7 +199,7 @@ syntax match jsDestructuringNoise contained /[,[\]]/ syntax region jsDestructuringPropertyComputed contained matchgroup=jsDestructuringBraces start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringValueAssignment,jsDestructuringNoise extend fold " Comments -syntax keyword jsCommentTodo contained TODO FIXME XXX TBD +syntax keyword jsCommentTodo contained TODO FIXME XXX TBD NOTE syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend syntax region jsEnvComment start=/\%^#!/ end=/$/ display diff --git a/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim b/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim index 8a02d736..68e1567a 100644 --- a/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim +++ b/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim @@ -57,6 +57,9 @@ au BufNewFile,BufRead [rR]outefile call s:setf('ruby') " SimpleCov au BufNewFile,BufRead .simplecov call s:setf('ruby') +" Sorbet RBI files +au BufNewFile,BufRead *.rbi call s:setf('ruby') + " Thor au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby') diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index 6dbaf9a8..563885ed 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -91,7 +91,7 @@ if exists("ruby_operators") || exists("ruby_pseudo_operators") syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^=" - syn match rubyAssignmentOperator "=>\@!" containedin=rubyBlockParameterList " TODO: this is inelegant + syn match rubyAssignmentOperator "=>\@!" contained containedin=rubyBlockParameterList " TODO: this is inelegant syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~" syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop @@ -192,7 +192,7 @@ SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"': syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@\%(\s*(\)\@=" -syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop containedin=rubyBlockParameterList +syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop contained containedin=rubyBlockParameterList syn region rubyBlockParameterList start="\%(\%(\\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator if exists('ruby_global_variable_error') diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 355d9e46..b5be4b74 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -220,4 +220,25 @@ ${2:${VISUAL:code}} $0 endsnippet + +snippet gln "New glossary item" b +\newglossaryentry{${1:identifier}} +{ + name={${2:name}}, + first={${3:first occurrence}}, + sort={${4:sort value}}, + description={${0:description}}, +} +endsnippet +snippet glnl "New long glossary item" b +\longnewglossaryentry{${1:identifier}} +{ + name={${2:name}}, + first={${3:first occurrence}}, + sort={${4:sort value}}, +} +{ + ${0:description} +} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 64b63f6e..468575d0 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -188,6 +188,8 @@ snippet try try .. rescue .. end snippet pry require IEx; IEx.pry ${0} +snippet ppry + |> (fn x -> require IEx; IEx.pry; x end).()${0} snippet qu quote do ${1} diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index 35afa301..2ce67ec4 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -4,10 +4,10 @@ snippet #! snippet s#! #!/usr/bin/env sh - set -euo pipefail + set -eu snippet safe - set -euo pipefail + set -eu snippet bash #!/usr/bin/env bash From 27ad0d07862847896f691309a544a206783c94d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 16:02:27 -0300 Subject: [PATCH 44/91] Bump rake in /sources_non_forked/vim-multiple-cursors (#565) Bumps [rake](https://github.com/ruby/rake) from 10.4.2 to 12.3.3. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v10.4.2...v12.3.3) Signed-off-by: dependabot[bot] --- sources_non_forked/vim-multiple-cursors/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index e833b243..5e909c4a 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (10.4.2) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From d6b7961e24bf28235f7ea939224562e784ab0ec7 Mon Sep 17 00:00:00 2001 From: Niklas Tanskanen Date: Thu, 16 Apr 2020 05:39:13 +0300 Subject: [PATCH 45/91] change to new fugitive syntax (#567) Co-authored-by: tanskann --- vimrcs/plugins_config.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 3ca2c6f6..e997747a 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -124,12 +124,12 @@ let g:lightline = { \ 'component': { \ 'readonly': '%{&filetype=="help"?"":&readonly?"🔒":""}', \ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}', - \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' + \ 'fugitive': '%{exists("*FugitiveHead")?FugitiveHead():""}' \ }, \ 'component_visible_condition': { \ 'readonly': '(&filetype!="help"&& &readonly)', \ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))', - \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())' + \ 'fugitive': '(exists("*FugitiveHead") && ""!=FugitiveHead())' \ }, \ 'separator': { 'left': ' ', 'right': ' ' }, \ 'subseparator': { 'left': ' ', 'right': ' ' } From d98c510eeebf0adf7f704dcb3bc810ac0dc07bcb Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 15 Apr 2020 22:41:14 -0400 Subject: [PATCH 46/91] Fixed https://github.com/amix/vimrc/pull/563/files --- update_plugins.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/update_plugins.py b/update_plugins.py index 5e14e899..634df7ae 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -53,16 +53,16 @@ vim-abolish https://github.com/tpope/tpope-vim-abolish mru.vim https://github.com/vim-scripts/mru.vim rust.vim https://github.com/rust-lang/rust.vim vim-markdown https://github.com/plasticboy/vim-markdown -gist-vim https://github.com/mattn/gist-vim +vim-gist https://github.com/mattn/vim-gist vim-ruby https://github.com/vim-ruby/vim-ruby typescript-vim https://github.com/leafgarland/typescript-vim vim-javascript https://github.com/pangloss/vim-javascript vim-python-pep8-indent https://github.com/Vimjas/vim-python-pep8-indent """.strip() -GITHUB_ZIP = '%s/archive/master.zip' +GITHUB_ZIP = "%s/archive/master.zip" -SOURCE_DIR = path.join(path.dirname(__file__), 'sources_non_forked') +SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked") def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): @@ -70,13 +70,14 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): # Download and extract file in temp dir req = requests.get(zip_path) - open(temp_zip_path, 'wb').write(req.content) + open(temp_zip_path, "wb").write(req.content) zip_f = zipfile.ZipFile(temp_zip_path) zip_f.extractall(temp_dir) plugin_temp_path = path.join( - temp_dir, path.join(temp_dir, '%s-master' % plugin_name)) + temp_dir, path.join(temp_dir, "%s-master" % plugin_name) + ) # Remove the current plugin and replace it with the extracted plugin_dest_path = path.join(source_dir, plugin_name) @@ -87,16 +88,16 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): pass shutil.move(plugin_temp_path, plugin_dest_path) - print('Updated {0}'.format(plugin_name)) + print("Updated {0}".format(plugin_name)) def update(plugin): - name, github_url = plugin.split(' ') + name, github_url = plugin.split(" ") zip_path = GITHUB_ZIP % github_url download_extract_replace(name, zip_path, temp_directory, SOURCE_DIR) -if __name__ == '__main__': +if __name__ == "__main__": temp_directory = tempfile.mkdtemp() try: From 31256d6be65d930d7089e602dc4e0fbda75a701b Mon Sep 17 00:00:00 2001 From: Ma Chao Date: Thu, 16 Apr 2020 10:47:00 +0800 Subject: [PATCH 47/91] chore: make it straightforward (#562) Co-authored-by: luc <814640709@qq.com> --- install_awesome_parameterized.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_awesome_parameterized.sh b/install_awesome_parameterized.sh index d83f6dc6..f93f6fba 100755 --- a/install_awesome_parameterized.sh +++ b/install_awesome_parameterized.sh @@ -17,7 +17,7 @@ catch endtry" if [ $2 == "--all" ]; then - USERS=($(ls -l /home | awk '{if(NR>1)print $9}')) + USERS=($(ls /home)) for user in ${USERS[*]}; do homepath=$(eval echo "~$user") IFS='' From fef069af241a64d347be100c57396b2d365f5b3d Mon Sep 17 00:00:00 2001 From: Amir Date: Sat, 25 Apr 2020 21:56:16 -0400 Subject: [PATCH 48/91] Updated plugins --- .../ale/ale_linters/clojure/clj_kondo.vim | 2 +- .../ale/ale_linters/kotlin/kotlinc.vim | 1 + .../ale/ale_linters/scala/metals.vim | 2 + .../ale_linters/terraform/terraform_lsp.vim | 25 + .../ale/ale_linters/verilog/verilator.vim | 27 +- .../ale/ale_linters/vim/vimls.vim | 61 + sources_non_forked/ale/autoload/ale.vim | 2 +- sources_non_forked/ale/autoload/ale/ant.vim | 2 +- .../ale/autoload/ale/code_action.vim | 20 +- .../ale/autoload/ale/completion.vim | 2 +- .../ale/autoload/ale/definition.vim | 39 + sources_non_forked/ale/autoload/ale/fix.vim | 29 +- .../ale/autoload/ale/highlight.vim | 6 + .../ale/autoload/ale/organize_imports.vim | 2 +- .../ale/autoload/ale/preview.vim | 37 +- .../ale/autoload/ale/references.vim | 19 +- .../ale/autoload/ale/rename.vim | 4 +- sources_non_forked/ale/autoload/ale/sign.vim | 2 +- sources_non_forked/ale/autoload/ale/util.vim | 61 +- .../doc/ale-supported-languages-and-tools.txt | 1 + sources_non_forked/ale/doc/ale-terraform.txt | 19 + sources_non_forked/ale/doc/ale-vim.txt | 55 + sources_non_forked/ale/doc/ale.txt | 163 +-- .../ale/ftplugin/ale-preview-selection.vim | 2 +- sources_non_forked/ale/plugin/ale.vim | 41 +- sources_non_forked/ale/supported-tools.md | 1 + sources_non_forked/bufexplorer/README.md | 12 +- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 8 +- sources_non_forked/gruvbox/README.md | 2 +- sources_non_forked/gruvbox/colors/gruvbox.vim | 25 + .../lightline.vim/.github/workflows/ci.yaml | 33 + sources_non_forked/lightline.vim/.travis.yml | 28 - .../lightline.vim/autoload/lightline.vim | 14 +- .../lightline/colorscheme/ayu_light.vim | 39 + .../autoload/lightline/colorscheme/deus.vim | 3 +- .../lightline/colorscheme/molokai.vim | 4 +- .../lightline/colorscheme/solarized.vim | 4 +- .../lightline.vim/colorscheme.md | 4 + .../lightline.vim/doc/lightline.txt | 4 +- .../lightline.vim/plugin/lightline.vim | 5 +- sources_non_forked/nerdtree/CHANGELOG.md | 21 +- sources_non_forked/nerdtree/README.markdown | 12 + .../nerdtree/autoload/nerdtree/ui_glue.vim | 4 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 14 +- .../nerdtree/lib/nerdtree/creator.vim | 2 +- .../nerdtree/lib/nerdtree/opener.vim | 2 +- .../nerdtree/lib/nerdtree/path.vim | 7 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 11 +- .../nerdtree/lib/nerdtree/tree_file_node.vim | 6 +- .../nerdtree/lib/nerdtree/ui.vim | 6 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 60 +- .../nerdtree/nerdtree_plugin/vcs.vim | 4 +- .../nerdtree/syntax/nerdtree.vim | 40 +- .../rust.vim/autoload/cargo.vim | 24 +- sources_non_forked/rust.vim/autoload/rust.vim | 33 +- .../rust.vim/compiler/rustc.vim | 2 +- sources_non_forked/rust.vim/doc/rust.txt | 12 +- sources_non_forked/rust.vim/ftplugin/rust.vim | 2 +- sources_non_forked/rust.vim/triagebot.toml | 1 + .../typescript-vim/indent/typescript.vim | 7 +- .../typescript-vim/syntax/typescript.vim | 5 +- .../autoload/glob_linux.vim | 5 +- sources_non_forked/vim-flake8/README.mdown | 6 + .../vim-flake8/autoload/flake8.vim | 40 +- .../vim-fugitive/autoload/fugitive.vim | 1087 ++++++++------- .../vim-fugitive/doc/fugitive.txt | 163 +-- .../vim-fugitive/plugin/fugitive.vim | 55 +- .../vim-gist/.github/FUNDING.yml | 12 + sources_non_forked/vim-gist/README.md | 281 ++++ sources_non_forked/vim-gist/autoload/gist.vim | 1165 +++++++++++++++++ sources_non_forked/vim-gist/doc/gist-vim.txt | 358 +++++ sources_non_forked/vim-gist/plugin/gist.vim | 23 + sources_non_forked/vim-gitgutter/README.mkd | 51 +- .../vim-gitgutter/autoload/gitgutter.vim | 14 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 16 +- .../autoload/gitgutter/highlight.vim | 22 + .../vim-gitgutter/autoload/gitgutter/hunk.vim | 27 +- .../autoload/gitgutter/utility.vim | 43 +- .../vim-gitgutter/doc/gitgutter.txt | 32 +- .../vim-javascript/syntax/javascript.vim | 2 +- .../vim-multiple-cursors/Gemfile.lock | 2 +- .../vim-multiple-cursors/README.md | 3 + .../autoload/multiple_cursors.vim | 2 +- .../doc/multiple_cursors.txt | 4 + .../plugin/multiple_cursors.vim | 1 + .../vim-python-pep8-indent/indent/python.vim | 6 +- .../spec/indent/indent_spec.rb | 20 + .../vim-ruby/autoload/rubycomplete.vim | 9 +- sources_non_forked/vim-ruby/ftplugin/ruby.vim | 2 +- .../spec/syntax/maxmempattern_limit_spec.rb | 12 + sources_non_forked/vim-ruby/syntax/ruby.vim | 2 +- .../vim-snipmate/autoload/snipmate/parse.vim | 2 +- .../vim-snippets/UltiSnips/cs.snippets | 25 +- .../vim-snippets/UltiSnips/ejs.snippets | 10 + .../UltiSnips/javascript_react.snippets | 42 + .../vim-snippets/UltiSnips/markdown.snippets | 9 + .../vim-snippets/UltiSnips/rust.snippets | 2 +- .../vim-snippets/UltiSnips/svelte.snippets | 1 + .../vim-snippets/UltiSnips/tex.snippets | 2 +- .../vim-snippets/snippets/awk.snippets | 20 - .../vim-snippets/snippets/c.snippets | 2 +- .../snippets/dart-flutter.snippets | 59 + .../vim-snippets/snippets/haskell.snippets | 4 +- .../snippets/javascript/javascript.snippets | 4 +- .../vim-snippets/snippets/julia.snippets | 30 +- .../vim-snippets/snippets/liquid.snippets | 4 + .../vim-snippets/snippets/markdown.snippets | 6 + .../vim-snippets/snippets/perl.snippets | 4 + .../vim-snippets/snippets/python.snippets | 6 + .../vim-snippets/snippets/r.snippets | 4 + .../vim-snippets/snippets/rmd.snippets | 205 +++ .../vim-snippets/snippets/svelte.snippets | 1 + .../vim-snippets/snippets/tex.snippets | 4 +- .../vim-snippets/snippets/vhdl.snippets | 10 + 114 files changed, 4018 insertions(+), 988 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim create mode 100644 sources_non_forked/ale/ale_linters/vim/vimls.vim create mode 100644 sources_non_forked/lightline.vim/.github/workflows/ci.yaml delete mode 100644 sources_non_forked/lightline.vim/.travis.yml create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim create mode 100644 sources_non_forked/rust.vim/triagebot.toml create mode 100644 sources_non_forked/vim-gist/.github/FUNDING.yml create mode 100644 sources_non_forked/vim-gist/README.md create mode 100644 sources_non_forked/vim-gist/autoload/gist.vim create mode 100644 sources_non_forked/vim-gist/doc/gist-vim.txt create mode 100644 sources_non_forked/vim-gist/plugin/gist.vim create mode 100644 sources_non_forked/vim-ruby/spec/syntax/maxmempattern_limit_spec.rb create mode 100644 sources_non_forked/vim-snippets/UltiSnips/ejs.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets create mode 100644 sources_non_forked/vim-snippets/UltiSnips/svelte.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/dart-flutter.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/rmd.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/svelte.snippets diff --git a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim index 5dd11c12..eb60ce77 100644 --- a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim +++ b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim @@ -29,6 +29,6 @@ call ale#linter#Define('clojure', { \ 'name': 'clj-kondo', \ 'output_stream': 'stdout', \ 'executable': 'clj-kondo', -\ 'command': 'clj-kondo --lint %t', +\ 'command': 'clj-kondo --cache --lint %t', \ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 3c6854fa..66c075be 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -174,6 +174,7 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'kotlinc', \ 'executable': 'kotlinc', +\ 'output_stream': 'stderr', \ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'), \ 'callback': 'ale_linters#kotlin#kotlinc#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/scala/metals.vim b/sources_non_forked/ale/ale_linters/scala/metals.vim index f78c7119..da9e855d 100644 --- a/sources_non_forked/ale/ale_linters/scala/metals.vim +++ b/sources_non_forked/ale/ale_linters/scala/metals.vim @@ -32,6 +32,8 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort \) endif endfor + + return '' endfunction function! ale_linters#scala#metals#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim b/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim new file mode 100644 index 00000000..e2408c15 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim @@ -0,0 +1,25 @@ +" Author: OJFord +" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp) + +call ale#Set('terraform_langserver_executable', 'terraform-lsp') +call ale#Set('terraform_langserver_options', '') + +function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options')) +endfunction + +function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort + let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') + + return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform_lsp', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')}, +\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'), +\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'), +\ 'language': 'terraform', +\}) diff --git a/sources_non_forked/ale/ale_linters/verilog/verilator.vim b/sources_non_forked/ale/ale_linters/verilog/verilator.vim index 64bb6e41..029dd4c9 100644 --- a/sources_non_forked/ale/ale_linters/verilog/verilator.vim +++ b/sources_non_forked/ale/ale_linters/verilog/verilator.vim @@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk " %Warning-UNUSED: test.v:4: Signal is not used: dout " %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=). - let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$' + " Since version 4.032 (04/2020) verilator linter messages also contain the column number, + " and look like: + " %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';' + " + " to stay compatible with old versions of the tool, the column number is + " optional in the researched pattern + let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:line = l:match[3] + 0 - let l:type = l:match[1] is# 'Error' ? 'E' : 'W' - let l:text = l:match[4] + let l:item = { + \ 'lnum': str2nr(l:match[3]), + \ 'text': l:match[5], + \ 'type': l:match[1] is# 'Error' ? 'E' : 'W', + \} + + if !empty(l:match[4]) + let l:item.col = str2nr(l:match[4]) + endif + let l:file = l:match[2] if l:file =~# '_verilator_linted.v' - call add(l:output, { - \ 'lnum': l:line, - \ 'text': l:text, - \ 'type': l:type, - \}) + call add(l:output, l:item) endif endfor diff --git a/sources_non_forked/ale/ale_linters/vim/vimls.vim b/sources_non_forked/ale/ale_linters/vim/vimls.vim new file mode 100644 index 00000000..26014d66 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vim/vimls.vim @@ -0,0 +1,61 @@ +" Author: Jeffrey Lau - https://github.com/zoonfafer +" Description: Vim Language Server integration for ALE + +call ale#Set('vim_vimls_executable', 'vim-language-server') +call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('vim_vimls_config', {}) + +function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort + let l:trigger_file_candidates = [ + \ '.vimrc', + \ 'init.vim', + \] + + for l:candidate in l:trigger_file_candidates + let l:trigger_file = fnamemodify(bufname(a:buffer), ':t') + + if l:trigger_file is# l:candidate + return fnamemodify( + \ bufname(a:buffer), + \ ':h', + \) + endif + endfor + + let l:trigger_dir_candidates = [ + \ 'autoload', + \ 'plugin', + \ '.git', + \] + + let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h')) + + for l:path in l:path_upwards + for l:candidate in l:trigger_dir_candidates + let l:trigger_dir = ale#path#Simplify( + \ l:path . '/' . l:candidate, + \) + + if isdirectory(l:trigger_dir) + return fnamemodify( + \ l:trigger_dir, + \ ':p:h:h', + \) + endif + endfor + endfor + + return '' +endfunction + +call ale#linter#Define('vim', { +\ 'name': 'vimls', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')}, +\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [ +\ 'node_modules/.bin/vim-language-server', +\ ])}, +\ 'command': '%e --stdio', +\ 'language': 'vim', +\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index ee1a0d54..01e17b15 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -258,9 +258,9 @@ function! ale#GetLocItemMessage(item, format_string) abort " Replace special markers with certain information. " \=l:variable is used to avoid escaping issues. + let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g') let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g') let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g') - let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g') " Replace %s with the text. let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g') diff --git a/sources_non_forked/ale/autoload/ale/ant.vim b/sources_non_forked/ale/autoload/ale/ant.vim index 689b444b..7d02484e 100644 --- a/sources_non_forked/ale/autoload/ale/ant.vim +++ b/sources_non_forked/ale/autoload/ale/ant.vim @@ -1,4 +1,4 @@ -" Author: Andrew Lee . +" Author: Andrew Lee . " Inspired by ale/gradle.vim by Michael Pardo " Description: Functions for working with Ant projects. diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim index 0af1bb70..60c3bbef 100644 --- a/sources_non_forked/ale/autoload/ale/code_action.vim +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -1,7 +1,7 @@ " Author: Jerko Steiner " Description: Code action support for LSP / tsserver -function! ale#code_action#HandleCodeAction(code_action) abort +function! ale#code_action#HandleCodeAction(code_action, should_save) abort let l:current_buffer = bufnr('') let l:changes = a:code_action.changes @@ -17,11 +17,14 @@ function! ale#code_action#HandleCodeAction(code_action) abort for l:file_code_edit in l:changes call ale#code_action#ApplyChanges( - \ l:file_code_edit.fileName, l:file_code_edit.textChanges) + \ l:file_code_edit.fileName, + \ l:file_code_edit.textChanges, + \ a:should_save, + \ ) endfor endfunction -function! ale#code_action#ApplyChanges(filename, changes) abort +function! ale#code_action#ApplyChanges(filename, changes, should_save) abort let l:current_buffer = bufnr('') " The buffer is used to determine the fileformat, if available. let l:buffer = bufnr(a:filename) @@ -106,10 +109,17 @@ function! ale#code_action#ApplyChanges(filename, changes) abort call remove(l:lines, -1) endif - call ale#util#Writefile(l:buffer, l:lines, a:filename) + if a:should_save + call ale#util#Writefile(l:buffer, l:lines, a:filename) + else + call ale#util#SetBufferContents(l:buffer, l:lines) + endif if l:is_current_buffer - call ale#util#Execute(':e!') + if a:should_save + call ale#util#Execute(':e!') + endif + call setpos('.', [0, l:pos[0], l:pos[1], 0]) endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 80684a30..2b5756e4 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -823,7 +823,7 @@ function! ale#completion#HandleUserData(completed_item) abort endif for l:code_action in get(l:user_data, 'codeActions', []) - call ale#code_action#HandleCodeAction(l:code_action) + call ale#code_action#HandleCodeAction(l:code_action, v:false) endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 3915cac1..ffcd9d10 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -5,6 +5,7 @@ let s:go_to_definition_map = {} " Enable automatic updates of the tagstack let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1) +let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') " Used to get the definition map in tests. function! ale#definition#GetMap() abort @@ -134,6 +135,10 @@ function! s:GoToLSPDefinition(linter, options, capability) abort endfunction function! ale#definition#GoTo(options) abort + if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command') + execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.''' + endif + for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) call s:GoToLSPDefinition(l:linter, a:options, 'definition') @@ -142,6 +147,10 @@ function! ale#definition#GoTo(options) abort endfunction function! ale#definition#GoToType(options) abort + if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command') + execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.''' + endif + for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) " TODO: handle typeDefinition for tsserver if supported by the @@ -154,3 +163,33 @@ function! ale#definition#GoToType(options) abort endif endfor endfunction + +function! ale#definition#GoToCommandHandler(command, ...) abort + let l:options = {} + + if len(a:000) > 0 + for l:option in a:000 + if l:option is? '-tab' + let l:options.open_in = 'tab' + elseif l:option is? '-split' + let l:options.open_in = 'split' + elseif l:option is? '-vsplit' + let l:options.open_in = 'vsplit' + endif + endfor + endif + + if !has_key(l:options, 'open_in') + let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') + + if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 + let l:options.open_in = l:default_navigation + endif + endif + + if a:command is# 'type' + call ale#definition#GoToType(l:options) + else + call ale#definition#GoTo(l:options) + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index dad9e2bc..69817b36 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -4,40 +4,15 @@ call ale#Set('fix_on_save_ignore', {}) " Vim doesn't let you modify hidden buffers. function! ale#fix#ApplyQueuedFixes(buffer) abort let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0}) - let l:has_bufline_api = exists('*deletebufline') && exists('*setbufline') - if !l:data.done || (!l:has_bufline_api && a:buffer isnot bufnr('')) + if !l:data.done || (!ale#util#HasBuflineApi() && a:buffer isnot bufnr('')) return endif call remove(g:ale_fix_buffer_data, a:buffer) if l:data.changes_made - " If the file is in DOS mode, we have to remove carriage returns from - " the ends of lines before calling setline(), or we will see them - " twice. - let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' - \ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')') - \ : l:data.output - let l:first_line_to_remove = len(l:new_lines) + 1 - - " Use a Vim API for setting lines in other buffers, if available. - if l:has_bufline_api - call setbufline(a:buffer, 1, l:new_lines) - call deletebufline(a:buffer, l:first_line_to_remove, '$') - " Fall back on setting lines the old way, for the current buffer. - else - let l:old_line_length = len(l:data.lines_before) - - if l:old_line_length >= l:first_line_to_remove - let l:save = winsaveview() - silent execute - \ l:first_line_to_remove . ',' . l:old_line_length . 'd_' - call winrestview(l:save) - endif - - call setline(1, l:new_lines) - endif + let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output) if l:data.should_save if a:buffer is bufnr('') diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index 82ad57e0..473ad354 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -210,6 +210,12 @@ function! ale#highlight#SetHighlights(buffer, loclist) abort " Set the list in the buffer variable. call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list) + let l:exclude_list = ale#Var(a:buffer, 'exclude_highlights') + + if !empty(l:exclude_list) + call filter(l:new_list, 'empty(ale#util#GetMatches(v:val.text, l:exclude_list))') + endif + " Update highlights for the current buffer, which may or may not " be the buffer we just set highlights for. call ale#highlight#UpdateHighlights() diff --git a/sources_non_forked/ale/autoload/ale/organize_imports.vim b/sources_non_forked/ale/autoload/ale/organize_imports.vim index bc9b829e..e89c832c 100644 --- a/sources_non_forked/ale/autoload/ale/organize_imports.vim +++ b/sources_non_forked/ale/autoload/ale/organize_imports.vim @@ -15,7 +15,7 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort call ale#code_action#HandleCodeAction({ \ 'description': 'Organize Imports', \ 'changes': l:file_code_edits, - \}) + \}, v:false) endfunction function! s:OnReady(linter, lsp_details) abort diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index 6d58aca9..7902ec63 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -1,6 +1,14 @@ " Author: w0rp " Description: Preview windows for showing whatever information in. +if !has_key(s:, 'last_selection_list') + let s:last_selection_list = [] +endif + +if !has_key(s:, 'last_selection_open_in') + let s:last_selection_open_in = 'current-buffer' +endif + " Open a preview window and show some lines in it. " A second argument can be passed as a Dictionary with options. They are... " @@ -67,9 +75,24 @@ function! ale#preview#ShowSelection(item_list, ...) abort call ale#preview#Show(l:lines, {'filetype': 'ale-preview-selection'}) let b:ale_preview_item_list = a:item_list + let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') + + " Remove the last preview + let s:last_selection_list = b:ale_preview_item_list + let s:last_selection_open_in = b:ale_preview_item_open_in endfunction -function! s:Open(open_in_tab) abort +function! ale#preview#RepeatSelection() abort + if empty(s:last_selection_list) + return + endif + + call ale#preview#ShowSelection(s:last_selection_list, { + \ 'open_in': s:last_selection_open_in, + \}) +endfunction + +function! s:Open(open_in) abort let l:item_list = get(b:, 'ale_preview_item_list', []) let l:item = get(l:item_list, getpos('.')[1] - 1, {}) @@ -77,22 +100,20 @@ function! s:Open(open_in_tab) abort return endif - if !a:open_in_tab - :q! - endif + :q! call ale#util#Open( \ l:item.filename, \ l:item.line, \ l:item.column, - \ {'open_in_tab': a:open_in_tab}, + \ {'open_in': a:open_in}, \) endfunction -function! ale#preview#OpenSelectionInBuffer() abort - call s:Open(0) +function! ale#preview#OpenSelection() abort + call s:Open(b:ale_preview_item_open_in) endfunction function! ale#preview#OpenSelectionInTab() abort - call s:Open(1) + call s:Open('tab') endfunction diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index b9725e1e..38ff0d3d 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -1,3 +1,5 @@ +let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') + let s:references_map = {} " Used to get the references map in tests. @@ -99,7 +101,8 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort let l:request_id = ale#lsp#Send(l:id, l:message) let s:references_map[l:request_id] = { - \ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0 + \ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0, + \ 'open_in': get(a:options, 'open_in', 'current-buffer'), \} endfunction @@ -110,10 +113,24 @@ function! ale#references#Find(...) abort for l:option in a:000 if l:option is? '-relative' let l:options.use_relative_paths = 1 + elseif l:option is? '-tab' + let l:options.open_in = 'tab' + elseif l:option is? '-split' + let l:options.open_in = 'split' + elseif l:option is? '-vsplit' + let l:options.open_in = 'vsplit' endif endfor endif + if !has_key(l:options, 'open_in') + let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') + + if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 + let l:options.open_in = l:default_navigation + endif + endif + let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:column = min([l:column, len(getline(l:line))]) diff --git a/sources_non_forked/ale/autoload/ale/rename.vim b/sources_non_forked/ale/autoload/ale/rename.vim index 02b7b579..fbd6c2ad 100644 --- a/sources_non_forked/ale/autoload/ale/rename.vim +++ b/sources_non_forked/ale/autoload/ale/rename.vim @@ -80,7 +80,7 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort call ale#code_action#HandleCodeAction({ \ 'description': 'rename', \ 'changes': l:changes, - \}) + \}, v:true) endfunction function! ale#rename#HandleLSPResponse(conn_id, response) abort @@ -134,7 +134,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort call ale#code_action#HandleCodeAction({ \ 'description': 'rename', \ 'changes': l:changes, - \}) + \}, v:true) endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index db0e1ab6..8109c60e 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -23,7 +23,7 @@ let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000) let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0) let g:ale_sign_highlight_linenrs = get(g:, 'ale_sign_highlight_linenrs', 0) -let s:supports_sign_groups = has('nvim-0.4.2') || (v:version >= 801 && has('patch614')) +let s:supports_sign_groups = has('nvim-0.4.2') || has('patch-8.1.614') if !hlexists('ALEErrorSign') highlight link ALEErrorSign error diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index 99cd856a..ee62af28 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -91,17 +91,17 @@ endfunction " options['open_in'] can be: " current-buffer (default) " tab -" vertical-split -" horizontal-split +" split +" vsplit function! ale#util#Open(filename, line, column, options) abort let l:open_in = get(a:options, 'open_in', 'current-buffer') let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename) if l:open_in is# 'tab' call ale#util#Execute('tabedit ' . l:args_to_open) - elseif l:open_in is# 'horizontal-split' + elseif l:open_in is# 'split' call ale#util#Execute('split ' . l:args_to_open) - elseif l:open_in is# 'vertical-split' + elseif l:open_in is# 'vsplit' call ale#util#Execute('vsplit ' . l:args_to_open) elseif bufnr(a:filename) isnot bufnr('') " Open another file only if we need to. @@ -336,15 +336,11 @@ function! ale#util#GetMatches(lines, patterns) abort endfunction function! s:LoadArgCount(function) abort - let l:Function = a:function - - redir => l:output - silent! function Function - redir END - - if !exists('l:output') + try + let l:output = execute('function a:function') + catch /E123/ return 0 - endif + endtry let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2] let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''') @@ -480,3 +476,44 @@ endfunction function! ale#util#Input(message, value) abort return input(a:message, a:value) endfunction + +function! ale#util#HasBuflineApi() abort + return exists('*deletebufline') && exists('*setbufline') +endfunction + +" Sets buffer contents to lines +function! ale#util#SetBufferContents(buffer, lines) abort + let l:has_bufline_api = ale#util#HasBuflineApi() + + if !l:has_bufline_api && a:buffer isnot bufnr('') + return + endif + + " If the file is in DOS mode, we have to remove carriage returns from + " the ends of lines before calling setline(), or we will see them + " twice. + let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' + \ ? map(copy(a:lines), 'substitute(v:val, ''\r\+$'', '''', '''')') + \ : a:lines + let l:first_line_to_remove = len(l:new_lines) + 1 + + " Use a Vim API for setting lines in other buffers, if available. + if l:has_bufline_api + call setbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, l:first_line_to_remove, '$') + " Fall back on setting lines the old way, for the current buffer. + else + let l:old_line_length = line('$') + + if l:old_line_length >= l:first_line_to_remove + let l:save = winsaveview() + silent execute + \ l:first_line_to_remove . ',' . l:old_line_length . 'd_' + call winrestview(l:save) + endif + + call setline(1, l:new_lines) + endif + + return l:new_lines +endfunction diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 29dabab7..636985fb 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -485,6 +485,7 @@ Notes: * `vcom` * `xvhdl` * Vim + * `vimls` * `vint` * Vim help^ * `alex`!! diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt index 387fd732..f62db190 100644 --- a/sources_non_forked/ale/doc/ale-terraform.txt +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -32,6 +32,25 @@ g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable* This variable can be changed to use a different executable for terraform. +=============================================================================== +terraform-lsp *ale-terraform-terraform-lsp* + +g:ale_terraform_langserver_executable *g:ale_terraform_langserver_executable* + *b:ale_terraform_langserver_executable* + Type: |String| + Default: `'terraform-lsp'` + + This variable can be changed to use a different executable for terraform-lsp. + + +g:ale_terraform_langserver_options *g:ale_terraform_langserver_options* + *b:ale_terraform_langserver_options* + Type: |String| + Default: `''` + + This variable can be changed to pass custom CLI flags to terraform-lsp. + + =============================================================================== tflint *ale-terraform-tflint* diff --git a/sources_non_forked/ale/doc/ale-vim.txt b/sources_non_forked/ale/doc/ale-vim.txt index 772bad23..f85b43eb 100644 --- a/sources_non_forked/ale/doc/ale-vim.txt +++ b/sources_non_forked/ale/doc/ale-vim.txt @@ -2,6 +2,61 @@ ALE Vim Integration *ale-vim-options* +=============================================================================== +vimls *ale-vim-vimls* + + The `vim-language-server` is the engine that powers VimL editor support + using the Language Server Protocol. See the installation instructions: + https://github.com/iamcco/vim-language-server#install + +g:ale_vim_vimls_executable *g:ale_vim_vimls_executable* + *b:ale_vim_vimls_executable* + Type: |String| + Default: `'vim-language-server'` + + This option can be set to change the executable path for vimls. + + +g:ale_vim_vimls_config *g:ale_vim_vimls_config* + *b:ale_vim_vimls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example: > + { + \ 'vim': { + \ 'iskeyword': '@,48-57,_,192-255,-#', + \ 'vimruntime': '', + \ 'runtimepath': '', + \ 'diagnostic': { + \ 'enable': v:true + \ }, + \ 'indexes': { + \ 'runtimepath': v:true, + \ 'gap': 100, + \ 'count': 3, + \ 'projectRootPatterns' : ['.git', 'autoload', 'plugin'] + \ }, + \ 'suggest': { + \ 'fromVimruntime': v:true, + \ 'fromRuntimepath': v:false + \ }, + \ } + \} +< + Consult the vim-language-server documentation for more information about + settings. + + +g:ale_vim_vimls_use_global *g:ale_vim_vimls_use_global* + *b:ale_vim_vimls_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vint *ale-vim-vint* diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index eafbc119..16b204a4 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -478,12 +478,9 @@ would like to use. An example here shows the available options for symbols > ALE supports jumping to the files and locations where symbols are defined through any enabled LSP linters. The locations ALE will jump to depend on the -information returned by LSP servers. The following commands are supported: - -|ALEGoToDefinition| - Open the definition of the symbol under the cursor. -|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab. -|ALEGoToDefinitionInSplit| - The same, but in a new split. -|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split. +information returned by LSP servers. The |ALEGoToDefinition| command will jump +to the definition of symbols under the cursor. See the documentation for the +command for configuring how the location will be displayed. ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is set to `0`. @@ -493,15 +490,10 @@ set to `0`. ALE supports jumping to the files and locations where symbols' types are defined through any enabled LSP linters. The locations ALE will jump to depend -on the information returned by LSP servers. The following commands are -supported: - -|ALEGoToTypeDefinition| - Open the definition of the symbol's type under - the cursor. -|ALEGoToTypeDefinitionInTab| - The same, but for opening the file in a new tab. -|ALEGoToTypeDefinitionInSplit| - The same, but in a new split. -|ALEGoToTypeDefinitionInVSplit| - The same, but in a new vertical split. - +on the information returned by LSP servers. The |ALEGoToTypeDefinition| +command will jump to the definition of symbols under the cursor. See the +documentation for the command for configuring how the location will be +displayed. ------------------------------------------------------------------------------- 5.4 Find References *ale-find-references* @@ -666,7 +658,7 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* -b:ale_completion_enabled *b:ale_completion_enabled* + *b:ale_completion_enabled* Type: |Number| Default: `0` @@ -793,6 +785,16 @@ g:ale_cursor_detail *g:ale_cursor_detail* loaded for messages to be displayed. See |ale-lint-settings-on-startup|. +g:ale_default_navigation *g:ale_default_navigation* + *b:ale_default_navigation* + + Type: |String| + Default: `'buffer'` + + The default method for navigating away from the current buffer to another + buffer, such as for |ALEFindReferences:|, or |ALEGoToDefinition|. + + g:ale_disable_lsp *g:ale_disable_lsp* *b:ale_disable_lsp* @@ -845,7 +847,7 @@ g:ale_echo_msg_error_str *g:ale_echo_msg_error_str* g:ale_echo_msg_format *g:ale_echo_msg_format* -b:ale_echo_msg_format *b:ale_echo_msg_format* + *b:ale_echo_msg_format* Type: |String| Default: `'%code: %%s'` @@ -923,6 +925,21 @@ g:ale_enabled *g:ale_enabled* See |g:ale_pattern_options| for more information on that option. +g:ale_exclude_highlights *g:ale_exclude_highlights* + *b:ale_exclude_highlights* + + Type: |List| + Default: `[]` + + A list of regular expressions for matching against highlight messages to + remove. For example: > + + " Do not highlight messages matching strings like these. + let b:ale_exclude_highlights = ['line too long', 'foo.*bar'] +< + See also: |g:ale_set_highlights| + + g:ale_fixers *g:ale_fixers* *b:ale_fixers* @@ -946,7 +963,7 @@ g:ale_fixers *g:ale_fixers* < g:ale_fix_on_save *g:ale_fix_on_save* -b:ale_fix_on_save *b:ale_fix_on_save* + *b:ale_fix_on_save* Type: |Number| Default: `0` @@ -968,7 +985,7 @@ b:ale_fix_on_save *b:ale_fix_on_save* g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* -b:ale_fix_on_save_ignore *b:ale_fix_on_save_ignore* + *b:ale_fix_on_save_ignore* Type: |Dictionary| or |List| Default: `{}` @@ -1344,7 +1361,7 @@ g:ale_list_vertical *g:ale_list_vertical* g:ale_loclist_msg_format *g:ale_loclist_msg_format* -b:ale_loclist_msg_format *b:ale_loclist_msg_format* + *b:ale_loclist_msg_format* Type: |String| Default: `g:ale_echo_msg_format` @@ -1396,7 +1413,7 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* g:ale_lsp_root *g:ale_lsp_root* -b:ale_lsp_root *b:ale_lsp_root* + *b:ale_lsp_root* Type: |Dictionary| or |String| Default: {} @@ -1609,6 +1626,8 @@ g:ale_set_highlights *g:ale_set_highlights* match highlights, whereas the line highlights when signs are enabled will run to the edge of the screen. + Highlights can be excluded with the |g:ale_exclude_highlights| option. + g:ale_set_loclist *g:ale_set_loclist* @@ -1875,7 +1894,8 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor* g:ale_virtualtext_delay *g:ale_virtualtext_delay* -b:ale_virtualtext_delay *b:ale_virtualtext_delay* + *b:ale_virtualtext_delay* + Type: |Number| Default: `10` @@ -1894,7 +1914,7 @@ g:ale_virtualtext_prefix *g:ale_virtualtext_prefix* 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* + *b:ale_virtualenv_dir_names* Type: |List| Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']` @@ -1908,7 +1928,7 @@ b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names* g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* -b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines* + *b:ale_warn_about_trailing_blank_lines* Type: |Number| Default: `1` @@ -1920,7 +1940,7 @@ b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines* g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* -b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace* + *b:ale_warn_about_trailing_whitespace* Type: |Number| Default: `1` @@ -2603,6 +2623,7 @@ documented in additional help files. terraform...............................|ale-terraform-options| terraform-fmt-fixer...................|ale-terraform-fmt-fixer| terraform.............................|ale-terraform-terraform| + terraform-lsp.........................|ale-terraform-terraform-lsp| tflint................................|ale-terraform-tflint| tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| @@ -2634,6 +2655,7 @@ documented in additional help files. vcom..................................|ale-vhdl-vcom| xvhdl.................................|ale-vhdl-xvhdl| vim.....................................|ale-vim-options| + vimls.................................|ale-vim-vimls| vint..................................|ale-vim-vint| vim help................................|ale-vim-help-options| write-good............................|ale-vim-help-write-good| @@ -2687,11 +2709,23 @@ ALEFindReferences *ALEFindReferences* Enter key (``) can be used to jump to a referencing location, or the `t` key can be used to jump to the location in a new tab. + The locations opened in different ways using the following variations. + + `:ALEFindReferences -tab` - Open the location in a new tab. + `:ALEFindReferences -split` - Open the location in a horizontal split. + `:ALEFindReferences -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + + The selection can be opened again with the |ALERepeatSelection| command. + You can jump back to the position you were at before going to a reference of something with jump motions like CTRL-O. See |jump-motions|. A plug mapping `(ale_find_references)` is defined for this command. + ALEFix *ALEFix* Fix problems with the current buffer. See |ale-fix| for more information. @@ -2706,42 +2740,31 @@ ALEFixSuggest *ALEFixSuggest* See |ale-fix| for more information. -ALEGoToDefinition *ALEGoToDefinition* +ALEGoToDefinition `` *ALEGoToDefinition* Jump to the definition of a symbol under the cursor using the enabled LSP linters for the buffer. ALE will jump to a definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. + The locations opened in different ways using the following variations. + + `:ALEGoToDefinition -tab` - Open the location in a new tab. + `:ALEGoToDefinition -split` - Open the location in a horizontal split. + `:ALEGoToDefinition -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. + You should consider using the 'hidden' option in combination with this + command. Otherwise, Vim will refuse to leave the buffer you're jumping from + unless you have saved your edits. + A plug mapping `(ale_go_to_definition)` is defined for this command. -ALEGoToDefinitionInTab *ALEGoToDefinitionInTab* - - The same as |ALEGoToDefinition|, but opens results in a new tab. - - A plug mapping `(ale_go_to_definition_in_tab)` is defined for this - command. - - -ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit* - - The same as |ALEGoToDefinition|, but opens results in a new split. - - A plug mapping `(ale_go_to_definition_in_split)` is defined for this - command. - - -ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit* - - The same as |ALEGoToDefinition|, but opens results in a new vertical split. - - A plug mapping `(ale_go_to_definition_in_vsplit)` is defined for this - command. - - ALEGoToTypeDefinition *ALEGoToTypeDefinition* This works similar to |ALEGoToDefinition| but instead jumps to the @@ -2749,6 +2772,15 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. + The locations opened in different ways using the following variations. + + `:ALEGoToTypeDefinition -tab` - Open the location in a new tab. + `:ALEGoToTypeDefinition -split` - Open the location in a horizontal split. + `:ALEGoToTypeDefinition -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. @@ -2756,31 +2788,6 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* command. -ALEGoToTypeDefinitionInTab *ALEGoToTypeDefinitionInTab* - - The same as |ALEGoToTypeDefinition|, but opens results in a new tab. - - A plug mapping `(ale_go_to_type_definition_in_tab)` is defined for - this command. - - -ALEGoToTypeDefinitionInSplit *ALEGoToTypeDefinitionInSplit* - - The same as |ALEGoToTypeDefinition|, but opens results in a new split. - - A plug mapping `(ale_go_to_type_definition_in_split)` is defined for - this command. - - -ALEGoToTypeDefinitionInVSplit *ALEGoToTypeDefinitionInVSplit* - - The same as |ALEGoToTypeDefinition|, but opens results in a new vertical - split. - - A plug mapping `(ale_go_to_type_definition_in_vsplit)` is defined for - this command. - - ALEHover *ALEHover* Print brief information about the symbol under the cursor, taken from any @@ -2806,6 +2813,11 @@ ALERename *ALERename* The user will be prompted for a new name. +ALERepeatSelection *ALERepeatSelection* + + Repeat the last selection displayed in the preview window. + + ALESymbolSearch `` *ALESymbolSearch* Search for symbols in the workspace, taken from any available LSP linters. @@ -3114,7 +3126,6 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* 'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))} < - The following `options` can be provided. `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for diff --git a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim index d77b4f98..7ec84068 100644 --- a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim +++ b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim @@ -12,5 +12,5 @@ noremap A noremap o noremap O " Keybinds for opening selection items. -noremap :call ale#preview#OpenSelectionInBuffer() +noremap :call ale#preview#OpenSelection() noremap t :call ale#preview#OpenSelectionInTab() diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index 8fea3bb4..e1ddf7b7 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -109,6 +109,9 @@ let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs')) " This flag can be set to 0 to disable setting error highlights. let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) +" This List can be configured to exclude particular highlights. +let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', []) + " This flag can be set to 0 to disable echoing when the cursor moves. let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) @@ -199,16 +202,23 @@ command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEF command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype) " Go to definition for tsserver and LSP -command! -bar ALEGoToDefinition :call ale#definition#GoTo({}) -command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'}) -command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'}) -command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'}) +command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', ) + +" Deprecated commands we have to keep for now. +command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab', 'deprecated_command': 'ALEGoToDefinitionInTab'}) +command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'split', 'deprecated_command': 'ALEGoToDefinitionInSplit'}) +command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToDefinitionInVSplit'}) " Go to type definition for tsserver and LSP -command! -bar ALEGoToTypeDefinition :call ale#definition#GoToType({}) -command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab'}) -command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'horizontal-split'}) -command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vertical-split'}) +command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', ) + +" Deprecated commands we have to keep for now. +command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab', 'deprecated_command': 'ALEGoToTypeDefinitionInTab'}) +command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'split', 'deprecated_command': 'ALEGoToTypeDefinitionInSplit'}) +command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToTypeDefinitionInVSplit'}) + +" Repeat a previous selection in the preview window +command! -bar ALERepeatSelection :call ale#preview#RepeatSelection() " Find references for tsserver and LSP command! -bar -nargs=* ALEFindReferences :call ale#references#Find() @@ -257,18 +267,21 @@ nnoremap (ale_lint) :ALELint nnoremap (ale_detail) :ALEDetail nnoremap (ale_fix) :ALEFix nnoremap (ale_go_to_definition) :ALEGoToDefinition -nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab -nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit -nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit nnoremap (ale_go_to_type_definition) :ALEGoToTypeDefinition -nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab -nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit -nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete nnoremap (ale_rename) :ALERename +nnoremap (ale_repeat_selection) :ALERepeatSelection + +" Deprecated mappings +nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab +nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit +nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit +nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab +nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit +nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit " Set up autocmd groups now. call ale#events#Init() diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 0abc6b75..d5c0c9d4 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -494,6 +494,7 @@ formatting. * [vcom](https://www.mentor.com/products/fv/questa/) * [xvhdl](https://www.xilinx.com/products/design-tools/vivado.html) * Vim + * [vimls](https://github.com/iamcco/vim-language-server) * [vint](https://github.com/Kuniwak/vint) * Vim help * [alex](https://github.com/wooorm/alex) :warning: :floppy_disk: diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md index 5ee9346e..2987bdd9 100644 --- a/sources_non_forked/bufexplorer/README.md +++ b/sources_non_forked/bufexplorer/README.md @@ -5,10 +5,14 @@ BufExplorer Plugin for Vim With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: - '\be' (normal open) or - '\bt' (toggle open / close) or - '\bs' (force horizontal split open) or - '\bv' (force vertical split open) +`\be` normal open + +`\bt` toggle open / close + +`\bs` force horizontal split open + +`\bv` force vertical split open + Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index 424dd36d..56e3e5d8 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -1107,13 +1107,13 @@ c) End the string with a colon ':' followed by a Vim command to execute that See also: Vim's |++opt| and |+cmd|. -d) Submit two dots '..' to go upward the directory tree by 1 level. To go up +d) Input two dots '..' and then hit the key to go upward the directory tree by 1 level. To go up multiple levels, use one extra dot for each extra level: > Raw input Interpreted as - .. ../ - ... ../../ - .... ../../../ + .. ../ + ... ../../ + .... ../../../ < Note: if the parent directories are large and uncached, this can be slow. diff --git a/sources_non_forked/gruvbox/README.md b/sources_non_forked/gruvbox/README.md index 4269786c..cd07e486 100644 --- a/sources_non_forked/gruvbox/README.md +++ b/sources_non_forked/gruvbox/README.md @@ -13,7 +13,7 @@ Attention 1. [Read this first](https://github.com/morhetz/gruvbox/wiki/Terminal-specific) 2. Typeface from gallery is [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans) -3. Typeface from screenshots below is [Fira Mono](http://www.carrois.com/fira-4-1/) +3. Typeface from screenshots below is [Fira Mono](https://mozilla.github.io/Fira/) Screenshots ----------- diff --git a/sources_non_forked/gruvbox/colors/gruvbox.vim b/sources_non_forked/gruvbox/colors/gruvbox.vim index a0c2c0ba..66246fba 100644 --- a/sources_non_forked/gruvbox/colors/gruvbox.vim +++ b/sources_non_forked/gruvbox/colors/gruvbox.vim @@ -454,6 +454,7 @@ call s:HL('GruvboxYellowSign', s:yellow, s:sign_column, s:invert_signs) call s:HL('GruvboxBlueSign', s:blue, s:sign_column, s:invert_signs) call s:HL('GruvboxPurpleSign', s:purple, s:sign_column, s:invert_signs) call s:HL('GruvboxAquaSign', s:aqua, s:sign_column, s:invert_signs) +call s:HL('GruvboxOrangeSign', s:orange, s:sign_column, s:invert_signs) " }}} @@ -888,6 +889,30 @@ hi! link NERDTreeToggleOff GruvboxRed call s:HL('multiple_cursors_cursor', s:none, s:none, s:inverse) call s:HL('multiple_cursors_visual', s:none, s:bg2) +" }}} +" coc.nvim: {{{ + +hi! link CocErrorSign GruvboxRedSign +hi! link CocWarningSign GruvboxOrangeSign +hi! link CocInfoSign GruvboxYellowSign +hi! link CocHintSign GruvboxBlueSign +hi! link CocErrorFloat GruvboxRed +hi! link CocWarningFloat GruvboxOrange +hi! link CocInfoFloat GruvboxYellow +hi! link CocHintFloat GruvboxBlue +hi! link CocDiagnosticsError GruvboxRed +hi! link CocDiagnosticsWarning GruvboxOrange +hi! link CocDiagnosticsInfo GruvboxYellow +hi! link CocDiagnosticsHint GruvboxBlue + +hi! link CocSelectedText GruvboxRed +hi! link CocCodeLens GruvboxGray + +call s:HL('CocErrorHighlight', s:none, s:none, s:undercurl, s:red) +call s:HL('CocWarningHighlight', s:none, s:none, s:undercurl, s:orange) +call s:HL('CocInfoHighlight', s:none, s:none, s:undercurl, s:yellow) +call s:HL('CocHintHighlight', s:none, s:none, s:undercurl, s:blue) + " }}} " Filetype specific ----------------------------------------------------------- diff --git a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml new file mode 100644 index 00000000..0a3e5685 --- /dev/null +++ b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + strategy: + matrix: + vim: + - v8.2.0000 + - v8.1.0000 + - v8.0.0000 + - v7.4 + - v7.3 + steps: + - name: Checkout code + uses: actions/checkout@master + - name: Checkout vim-themis + uses: actions/checkout@master + with: + repository: thinca/vim-themis + path: vim-themis + - name: Setup Vim + uses: rhysd/action-setup-vim@v1 + id: vim + with: + version: ${{ matrix.vim }} + - name: Test + env: + THEMIS_VIM: ${{ steps.vim.outputs.executable }} + run: ./vim-themis/bin/themis --reporter spec diff --git a/sources_non_forked/lightline.vim/.travis.yml b/sources_non_forked/lightline.vim/.travis.yml deleted file mode 100644 index e7e41c51..00000000 --- a/sources_non_forked/lightline.vim/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: generic - -install: - - git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis - - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then - git clone https://github.com/vim/vim $HOME/vim && - cd $HOME/vim && - git checkout v$VIM_VERSION && - ./configure --prefix=$HOME/vim-$VIM_VERSION && - make && - make install; - fi) - -cache: - directories: - - $HOME/vim-$VIM_VERSION - -env: - - VIM_VERSION=8.2.0000 - - VIM_VERSION=8.1.0000 - - VIM_VERSION=8.0.0000 - - VIM_VERSION=7.4 - - VIM_VERSION=7.3 - -script: - - export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH - - vim --version - - /tmp/themis/bin/themis --reporter spec diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 07800f42..0e5d401a 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2020/01/27 19:41:58. +" Last Change: 2020/03/16 19:10:15. " ============================================================================= let s:save_cpo = &cpo @@ -24,16 +24,9 @@ function! lightline#update() abort let s = winnr('$') == 1 && w > 0 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)] for n in range(1, winnr('$')) call setwinvar(n, '&statusline', s[n!=w]) - call setwinvar(n, 'lightline', n!=w) endfor endfunction -function! lightline#update_once() abort - if !exists('w:lightline') || w:lightline - call lightline#update() - endif -endfunction - function! lightline#update_disable() abort if !s:lightline.enable.statusline return @@ -46,14 +39,13 @@ function! lightline#enable() abort call lightline#update() augroup lightline autocmd! - autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update() + autocmd WinEnter,BufEnter,BufDelete,SessionLoadPost,FileChangedShellPost * call lightline#update() if !has('patch-8.1.1715') autocmd FileType qf call lightline#update() endif autocmd SessionLoadPost * call lightline#highlight() autocmd ColorScheme * if !has('vim_starting') || expand('') !=# 'macvim' \ | call lightline#update() | call lightline#highlight() | endif - autocmd CursorMoved,BufUnload * call lightline#update_once() augroup END augroup lightline-disable autocmd! @@ -224,7 +216,7 @@ endfunction let s:mode = '' function! lightline#link(...) abort let mode = get(s:lightline._mode_, a:0 ? a:1 : mode(), 'normal') - if s:mode == mode + if s:mode ==# mode return '' endif let s:mode = mode diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim new file mode 100644 index 00000000..9505c01d --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim @@ -0,0 +1,39 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/ayu_light.vim +" Author: christalib +" License: MIT License +" Last Change: 2020/02/15 18:45:57. +" ============================================================================= +let s:base0 = [ '#5C6773', 244 ] +let s:base1 = [ '#5C6773', 247 ] +let s:base2 = [ '#828C99', 248 ] +let s:base3 = [ '#5C6773', 252 ] +let s:base00 = [ '#FFFFFF', 242 ] +let s:base01 = [ '#FFFFFF', 240 ] +let s:base02 = [ '#FAFAFA', 238 ] +let s:base023 = [ '#FAFAFA', 236 ] +let s:base03 = [ '#E6B673', 235 ] +let s:yellow = [ '#E6B673', 180 ] +let s:orange = [ '#FF7733', 173 ] +let s:red = [ '#f07178', 203 ] +let s:magenta = [ '#A37ACC', 216 ] +let s:blue = [ '#59c2ff', 117 ] +let s:cyan = s:blue +let s:green = [ '#86B300', 119 ] +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] +let s:p.normal.middle = [ [ s:base2, s:base02 ] ] +let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] +let s:p.inactive.left = [ [ s:base1, s:base01 ], [ s:base3, s:base01 ] ] +let s:p.inactive.middle = [ [ s:base1, s:base023 ] ] +let s:p.inactive.right = [ [ s:base1, s:base01 ], [ s:base2, s:base02 ] ] +let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] +let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ] +let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ] +let s:p.tabline.tabsel = [ [ s:base02, s:base03 ] ] +let s:p.tabline.left = [ [ s:base3, s:base00 ] ] +let s:p.tabline.middle = [ [ s:base2, s:base02 ] ] +let s:p.tabline.right = [ [ s:base2, s:base00 ] ] +let s:p.normal.error = [ [ s:base03, s:red ] ] +let s:p.normal.warning = [ [ s:base023, s:yellow ] ] +let g:lightline#colorscheme#ayu_light#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim index 0a7da609..7471a6b5 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colorscheme/deus.vim " Author: nikersify " License: MIT License -" Last Change: 2018/01/24 13:26:00 +" Last Change: 2020/02/15 20:56:45. " ============================================================================= let s:term_red = 204 @@ -20,7 +20,6 @@ let s:p.normal.left = [ [ '#292c33', '#98c379', s:term_black, s:term_green, 'bol let s:p.normal.right = [ [ '#292c33', '#98c379', s:term_black, s:term_green ], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ], [ '#98c379', '#292c33', s:term_green, s:term_black ] ] let s:p.inactive.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ] ] let s:p.inactive.left = s:p.inactive.right[1:] -" her let s:p.insert.left = [ [ '#292c33', '#61afef', s:term_black, s:term_blue, 'bold' ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ] let s:p.insert.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue ], [ '#ABB2BF', '#3E4452', s:term_white, s:term_grey ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ] let s:p.replace.left = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/molokai.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/molokai.vim index 9d066a1b..c17cafbc 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/molokai.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/molokai.vim @@ -2,9 +2,9 @@ " Filename: autoload/lightline/colorscheme/molokai.vim " Author: challsted " License: MIT License -" Last Change: 2016/11/17 00:27:58. +" Last Change: 2020/02/15 20:57:45. " ============================================================================= -" + let s:black = [ '#232526', 233 ] let s:gray = [ '#808080', 244 ] let s:white = [ '#f8f8f2', 234 ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim index d6ee9c6b..53788311 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/solarized.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colorscheme/solarized.vim " Author: itchyny " License: MIT License -" Last Change: 2017/11/25 11:13:46. +" Last Change: 2020/04/06 19:22:53. " ============================================================================= let s:cuicolors = { @@ -73,7 +73,7 @@ let s:p.inactive.middle = [ [ s:base01, s:base02 ] ] let s:p.tabline.left = [ [ s:base03, s:base00 ] ] let s:p.tabline.tabsel = [ [ s:base03, s:base1 ] ] let s:p.tabline.middle = [ [ s:base0, s:base02 ] ] -let s:p.tabline.right = copy(s:p.normal.right) +let s:p.tabline.right = copy(s:p.tabline.left) let s:p.normal.error = [ [ s:base03, s:red ] ] let s:p.normal.warning = [ [ s:base03, s:yellow ] ] diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index 5b944ab6..14fa1787 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -48,6 +48,10 @@ ![lightline.vim - ayu mirage](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_mirage.png) +### ayu_light + +![lightline.vim - ayu light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_light.png) + ### darcula ![lightline.vim - darcula](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/darcula.png) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index c94b63d0..10ab0987 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2020/01/28 18:40:21. +Last Change: 2020/02/15 18:44:06. CONTENTS *lightline-contents* @@ -231,7 +231,7 @@ OPTIONS *lightline-option* Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor, landscape, one, materia, material, OldHope, nord, deus, - srcery_drk, ayu_mirage and 16color are available. + srcery_drk, ayu_mirage, ayu_light and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/lightline.vim/plugin/lightline.vim b/sources_non_forked/lightline.vim/plugin/lightline.vim index d08517d7..a11d6622 100644 --- a/sources_non_forked/lightline.vim/plugin/lightline.vim +++ b/sources_non_forked/lightline.vim/plugin/lightline.vim @@ -2,7 +2,7 @@ " Filename: plugin/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2019/07/30 12:00:00. +" Last Change: 2020/03/16 19:08:41. " ============================================================================= if exists('g:loaded_lightline') || v:version < 700 @@ -15,14 +15,13 @@ set cpo&vim augroup lightline autocmd! - autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update() + autocmd WinEnter,BufEnter,BufDelete,SessionLoadPost,FileChangedShellPost * call lightline#update() if !has('patch-8.1.1715') autocmd FileType qf call lightline#update() endif autocmd SessionLoadPost * call lightline#highlight() autocmd ColorScheme * if !has('vim_starting') || expand('') !=# 'macvim' \ | call lightline#update() | call lightline#highlight() | endif - autocmd CursorMoved,BufUnload * call lightline#update_once() augroup END " This quickfix option was introduced at Vim 85850f3a5ef9, which is the commit diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index e163c6c9..d0de2be7 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -1,12 +1,21 @@ # NERDTree Change Log - - +#### 6.7 +- **.7**: Put '%' argument in bufname() for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105) +- **.6**: If a file's already open in the window, don't edit it again. (PhilRunninger) [#1103](https://github.com/preservim/nerdtree/pull/1103) +- **.5**: Prevent unneeded tree creation in `:NERDTreeToggle[VCS] ` (PhilRunninger) [#1101](https://github.com/preservim/nerdtree/pull/1101) +- **.4**: Add missing calls to the `shellescape()` function (lifecrisis) [#1099](https://github.com/preservim/nerdtree/pull/1099) +- **.3**: Fix vsplit to not open empty buffers when opening previously closed file (AwkwardKore) [#1098](https://github.com/preservim/nerdtree/pull/1098) +- **.2**: Fix infinity loop (on winvim) in FindParentVCSRoot (Eugenij-W) [#1095](https://github.com/preservim/nerdtree/pull/1095) +- **.1**: File Move: Escape existing directory name when looking for open files. (PhilRunninger) [#1094](https://github.com/preservim/nerdtree/pull/1094) +- **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090) +#### 6.6 +- **.1**: [add] How to install using dein.vim (kazukazuinaina) [#1087](https://github.com/preservim/nerdtree/pull/1087) +- **.0**: Add the ability to turn off directory arrows (PhilRunninger) [#1085](https://github.com/preservim/nerdtree/pull/1085) #### 6.5 - **.0**: `NERDTreeToggle ` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083) #### 6.4 diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index e7632420..09173a65 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -59,6 +59,13 @@ Plug 'preservim/nerdtree' call plug#end() ``` +#### [dein.vim](https://github.com/Shougo/dein.vim) +```vim +call dein#begin() +call dein#add('preservim/nerdtree') +call dein#end() +``` + #### [apt-vim](https://github.com/egalpin/apt-vim) ```bash apt-vim install -y https://github.com/preservim/nerdtree.git @@ -143,3 +150,8 @@ Use these variables in your vimrc. Note that below are default arrow symbols let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowCollapsible = '▾' ``` +You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left. +```vim +let g:NERDTreeDirArrowExpandable = '' +let g:NERDTreeDirArrowCollapsible = '' +``` diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 57af126b..aef1b046 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -284,6 +284,7 @@ endfunction " FUNCTION: s:findAndRevealPath(pathStr) {{{1 function! s:findAndRevealPath(pathStr) abort let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') + let l:revealOpts = {} if empty(l:pathStr) call nerdtree#echoWarning('no file for the current buffer') @@ -292,6 +293,7 @@ function! s:findAndRevealPath(pathStr) abort if !filereadable(l:pathStr) let l:pathStr = fnamemodify(l:pathStr, ':h') + let l:revealOpts['open'] = 1 endif try @@ -327,7 +329,7 @@ function! s:findAndRevealPath(pathStr) abort call b:NERDTree.ui.setShowHidden(1) endif - let l:node = b:NERDTree.root.reveal(l:pathObj) + let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts) call b:NERDTree.render() call l:node.putCursorHere(1, 0) endfunction diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index e2dd56a3..47d65ccc 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1223,13 +1223,19 @@ Values: Any single character. Defaults: Windows: ~ and + Others: ▾ and ▸ These characters indicate whether a directory is collapsible or expandable. - -They can be set to "\u00a0" to hide the arrows, but if you do this you may -need to change the node delimiter. See |NERDTreeNodeDelimiter|. You cannot use -the same character for both the arrows and the delimiter. Example: > +Example: > let NERDTreeDirArrowExpandable=">" let NERDTreeDirArrowCollapsible="v" < +They can be set to "\u00a0" to replace the arrows with a non-breaking space. +If you do this you may need to change the node delimiter. See +|NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows +and the delimiter. + +Alternatively, they can be set to '' (an empty string). This removes the +arrows and the single space that follows them, shifting the entire tree two +character positions to the left. + ------------------------------------------------------------------------------ *NERDTreeNodeDelimiter* Values: Any single character. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index e2b3fa0a..abaa8dbe 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -366,7 +366,7 @@ function! s:Creator.toggleTabTree(dir) if g:NERDTree.ExistsForTab() if !g:NERDTree.IsOpen() call self._createTreeWin() - if !empty(a:dir) + if !empty(a:dir) && a:dir !=# b:NERDTree.root.path.str() call self.createTabTree(a:dir) elseif !&hidden call b:NERDTree.render() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index d8dba34e..0d9f9ba8 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -195,7 +195,7 @@ function! s:Opener._newVSplit() endif call nerdtree#exec('wincmd p', 1) - call nerdtree#exec('vnew', 1) + call nerdtree#exec('vsplit', 1) let l:currentWindowNumber = winnr() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 6a23c7ba..2ac8c71c 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -199,7 +199,7 @@ function! s:Path.copy(dest) let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd) endif - let cmd = cmd_prefix . ' ' . escape(self.str(), self._escChars()) . ' ' . escape(a:dest, self._escChars()) + let cmd = cmd_prefix . ' ' . shellescape(self.str()) . ' ' . shellescape(a:dest) let success = system(cmd) if v:shell_error !=# 0 throw "NERDTree.CopyError: Could not copy '". self.str() ."' to: '" . a:dest . "'" @@ -295,7 +295,10 @@ endfunction " FUNCTION: Path.edit() {{{1 function! s:Path.edit() - exec 'edit ' . self.str({'format': 'Edit'}) + let l:bufname = self.str({'format': 'Edit'}) + if bufname('%') !=# l:bufname + exec 'edit ' . l:bufname + endif endfunction " FUNCTION: Path.extractDriveLetter(fullpath) {{{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 1502ea73..88ac319f 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -104,16 +104,11 @@ function! s:TreeDirNode.displayString() endfor " Select the appropriate open/closed status indicator symbol. - if l:cascade[-1].isOpen - let l:symbol = g:NERDTreeDirArrowCollapsible - else - let l:symbol = g:NERDTreeDirArrowExpandable - endif - + let l:symbol = (l:cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable ) + let l:symbol .= (g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ') let l:flags = l:cascade[-1].path.flagSet.renderToString() - let l:result = l:symbol . ' ' . l:flags . l:label - return l:result + return l:symbol . l:flags . l:label endfunction " FUNCTION: TreeDirNode.findNode(path) {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim index 34074a25..957b98ac 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim @@ -321,13 +321,9 @@ function! s:TreeFileNode._renderToString(depth, drawText) if a:drawText ==# 1 let treeParts = repeat(' ', a:depth - 1) - - if !self.path.isDirectory - let treeParts = treeParts . ' ' - endif + let treeParts .= (self.path.isDirectory || g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ') let line = treeParts . self.displayString() - let output = output . line . "\n" endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim index fc9db71e..9ffadf6e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -284,7 +284,11 @@ endfunction function! s:UI._indentLevelFor(line) " Replace multi-character DirArrows with a single space so the " indentation calculation doesn't get messed up. - let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '') + if g:NERDTreeDirArrowExpandable ==# '' + let l:line = ' '.a:line + else + let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '') + endif let leadChars = match(l:line, '\M\[^ ]') return leadChars / s:UI.IndentWid() endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 281116fd..9750976f 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -209,7 +209,8 @@ function! NERDTreeMoveNode() try if curNode.path.isDirectory - let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"') + let l:curPath = escape(curNode.path.str(),'\') . (nerdtree#runningWindows()?'\\':'/') . '.*' + let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# "'.escape(l:curPath,'\').'"') else let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()') endif @@ -387,44 +388,67 @@ endfunction " FUNCTION: NERDTreeQuickLook() {{{1 function! NERDTreeQuickLook() - let treenode = g:NERDTreeFileNode.GetSelected() - if treenode !=# {} - call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'") + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return endif + + call system('qlmanage -p 2>/dev/null ' . shellescape(l:node.path.str())) endfunction " FUNCTION: NERDTreeRevealInFinder() {{{1 function! NERDTreeRevealInFinder() - let treenode = g:NERDTreeFileNode.GetSelected() - if treenode !=# {} - call system("open -R '" . treenode.path.str() . "'") + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return endif + + call system('open -R ' . shellescape(l:node.path.str())) endfunction " FUNCTION: NERDTreeExecuteFile() {{{1 function! NERDTreeExecuteFile() - let treenode = g:NERDTreeFileNode.GetSelected() - if treenode !=# {} - call system("open '" . treenode.path.str() . "'") + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return endif + + call system('open ' . shellescape(l:node.path.str())) endfunction " FUNCTION: NERDTreeRevealFileLinux() {{{1 function! NERDTreeRevealFileLinux() - let treenode = g:NERDTreeFileNode.GetSelected() - let parentnode = treenode.parent - if parentnode !=# {} - call system("xdg-open '" . parentnode.path.str() . "' &") + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return endif + + " Handle the edge case of "/", which has no parent. + if l:node.path.str() ==# '/' + call system('xdg-open /') + return + endif + + if empty(l:node.parent) + return + endif + + call system('xdg-open ' . shellescape(l:node.parent.path.str())) endfunction " FUNCTION: NERDTreeExecuteFileLinux() {{{1 function! NERDTreeExecuteFileLinux() - let treenode = g:NERDTreeFileNode.GetSelected() - if treenode !=# {} - call system("xdg-open '" . treenode.path.str() . "' &") + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return endif + + call system('xdg-open ' . shellescape(l:node.path.str())) endfunction " vim: set sw=4 sts=4 et fdm=marker: - diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim index 36d5427e..d20e35e5 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/vcs.vim @@ -34,7 +34,7 @@ endfunction function! s:FindParentVCSRoot(path) let l:path = a:path while !empty(l:path) && - \ l:path._str() !~# '^\(\a:\\\|\/\)$' && + \ l:path._str() !~# '^\(\a:[\\\/]\|\/\)$' && \ !isdirectory(l:path._str() . '/.git') && \ !isdirectory(l:path._str() . '/.svn') && \ !isdirectory(l:path._str() . '/.hg') && @@ -42,6 +42,6 @@ function! s:FindParentVCSRoot(path) \ !isdirectory(l:path._str() . '/_darcs') let l:path = l:path.getParent() endwhile - return (empty(l:path) || l:path._str() =~# '^\(\a:\\\|\/\)$') ? a:path : l:path + return (empty(l:path) || l:path._str() =~# '^\(\a:[\\\/]\|\/\)$') ? a:path : l:path endfunction diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 0df9d12e..df0c8046 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -19,24 +19,7 @@ syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir -"highlighing for directory nodes and file nodes -syn match NERDTreeDirSlash #/# containedin=NERDTreeDir - -exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile' -exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile' - -let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-') -exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#' -syn match NERDTreeExecFile '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark -exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' - -"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 - -"highlighing to conceal the delimiter around the file/dir name +"highlighting to conceal the delimiter around the file/dir name if has('conceal') exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL' setlocal conceallevel=3 concealcursor=nvic @@ -45,6 +28,27 @@ else hi! link NERDTreeNodeDelimiters Ignore endif +"highlighing for directory nodes and file nodes +syn match NERDTreeDirSlash #/# containedin=NERDTreeDir + +if g:NERDTreeDirArrowExpandable !=# '' + exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile' + exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile' + let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-') + exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#' + exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark' + exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' +else + exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#' + exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark' + exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' +endif + +"highlighting for readonly files +exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile' + +exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir' + syn match NERDTreeCWD #^[(MatchitNormalForward)') ==# '' + keepjumps normal! % + else + " Prefer matchit.vim official plugin to native % since the plugin + " provides better behavior than original % (#391) + " To load the plugin, run: + " :packadd matchit + execute 'keepjumps' 'normal' "\(MatchitNormalForward)" + endif if line('.') < cursor_line return '' endif @@ -541,21 +549,20 @@ function! rust#Test(mods, winsize, all, options) abort let saved = getpos('.') try let func_name = s:SearchTestFunctionNameUnderCursor() - if func_name ==# '' - echohl ErrorMsg - echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests' - echohl None - return - endif - if a:options ==# '' - execute cmd . 'cargo test --manifest-path' manifest func_name - else - execute cmd . 'cargo test --manifest-path' manifest func_name a:options - endif - return finally call setpos('.', saved) endtry + if func_name ==# '' + echohl ErrorMsg + echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests' + echohl None + return + endif + if a:options ==# '' + execute cmd . 'cargo test --manifest-path' manifest func_name + else + execute cmd . 'cargo test --manifest-path' manifest func_name a:options + endif endfunction " }}}1 diff --git a/sources_non_forked/rust.vim/compiler/rustc.vim b/sources_non_forked/rust.vim/compiler/rustc.vim index c8e77005..9b70732a 100644 --- a/sources_non_forked/rust.vim/compiler/rustc.vim +++ b/sources_non_forked/rust.vim/compiler/rustc.vim @@ -24,7 +24,7 @@ else if has('patch-7.4.191') CompilerSet makeprg=rustc\ \%:S else - CompilerSet makeprg=rustc\ \% + CompilerSet makeprg=rustc\ \"%\" endif endif diff --git a/sources_non_forked/rust.vim/doc/rust.txt b/sources_non_forked/rust.vim/doc/rust.txt index c3efb461..9d5eb8cc 100644 --- a/sources_non_forked/rust.vim/doc/rust.txt +++ b/sources_non_forked/rust.vim/doc/rust.txt @@ -125,7 +125,7 @@ g:rustfmt_autosave~ < There is also a buffer-local b:rustfmt_autosave that can be set for the same purpose, and can override the global setting. - + *g:rustfmt_autosave_if_config_present* g:rustfmt_autosave_if_config_present~ Set this option to 1 to have *b:rustfmt_autosave* be set automatically @@ -187,6 +187,16 @@ g:cargo_makeprg_params~ let g:cargo_makeprg_params = 'build' < + *g:cargo_shell_command_runner* +g:cargo_shell_command_runner~ + Set this option to change how to run shell commands for cargo commands + |:Cargo|, |:Cbuild|, |:Crun|, ... + By default, |:terminal| is used to run shell command in terminal window + asynchronously. But if you prefer |:!| for running the commands, it can + be specified: > + let g:cargo_shell_command_runner = '!' +< + Integration with Syntastic *rust-syntastic* -------------------------- diff --git a/sources_non_forked/rust.vim/ftplugin/rust.vim b/sources_non_forked/rust.vim/ftplugin/rust.vim index ac1b438a..ce48116e 100644 --- a/sources_non_forked/rust.vim/ftplugin/rust.vim +++ b/sources_non_forked/rust.vim/ftplugin/rust.vim @@ -121,7 +121,7 @@ command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", ) command! -range=% RustPlay :call rust#Play(, , , ) " See |:RustFmt| for docs -command! -buffer RustFmt call rustfmt#Format() +command! -bar -buffer RustFmt call rustfmt#Format() " See |:RustFmtRange| for docs command! -range -buffer RustFmtRange call rustfmt#FormatRange(, ) diff --git a/sources_non_forked/rust.vim/triagebot.toml b/sources_non_forked/rust.vim/triagebot.toml new file mode 100644 index 00000000..fa0824ac --- /dev/null +++ b/sources_non_forked/rust.vim/triagebot.toml @@ -0,0 +1 @@ +[assign] diff --git a/sources_non_forked/typescript-vim/indent/typescript.vim b/sources_non_forked/typescript-vim/indent/typescript.vim index 81373985..3ee9aa01 100644 --- a/sources_non_forked/typescript-vim/indent/typescript.vim +++ b/sources_non_forked/typescript-vim/indent/typescript.vim @@ -169,7 +169,7 @@ endfunction function s:PrevCodeLine(lnum) let l:n = prevnonblank(a:lnum) while l:n - if getline(l:n) =~ '^\s*\/[/*]' + if getline(l:n) =~ '^\s*\/[/*]' if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') && \ s:syn_at(l:n,1) =~? s:syng_str return l:n @@ -293,8 +293,9 @@ function GetTypescriptIndent() let l:line = '' endif - " the containing paren, bracket, or curly. Many hacks for performance - let idx = index([']',')','}'],l:line[0]) + " the containing paren, bracket, curly, or closing '>'. + " Many hacks for performance + let idx = index([']',')','}','>'],l:line[0]) if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum)) call call('cursor',b:js_cache[1:]) diff --git a/sources_non_forked/typescript-vim/syntax/typescript.vim b/sources_non_forked/typescript-vim/syntax/typescript.vim index 705016d1..8c6ecf22 100644 --- a/sources_non_forked/typescript-vim/syntax/typescript.vim +++ b/sources_non_forked/typescript-vim/syntax/typescript.vim @@ -223,10 +223,11 @@ syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparen " }}} " Define the default highlighting. -" For version 5.7 and earlier: only when not done already +" For version 5.7 and earlier: only when not done already by this script " For version 5.8 and later: only when an item doesn't have highlighting yet +" For version 8.1.1486 and later: only when not done already by this script (need to override vim's new typescript support) if version >= 508 || !exists("did_typescript_syn_inits") - if version < 508 + if version < 508 || has('patch-8.1.1486') let did_typescript_syn_inits = 1 command -nargs=+ HiLink hi link else diff --git a/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim b/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim index 6fd3f044..e93820c2 100644 --- a/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim +++ b/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim @@ -2,7 +2,8 @@ " TODO refactor: create glob function " noremap \og :callglob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"\\.git\\\\.hg\\node_modules\\\\.pyc" ) " noremap \og :callglob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"default" ) -function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern) +function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern, ...) + let opts = a:0 > 0 ? a:1 : {} if a:exclude_pattern == "default" let exclude_pattern = '\.git\|\.hg\|node_modules\|\.pyc' else @@ -16,7 +17,7 @@ function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern) let exclude = exclude_pattern == '' ? '' : ' | grep -v -e '.shellescape(exclude_pattern) - let cmd = 'find | grep -e '.shellescape(g).exclude + let cmd = get(opts, 'cmd_find', 'find'). ' . | grep -e '.shellescape(g).exclude let files = split(system(cmd),"\n") " for nom in a:excludes " call filter(files,nom) diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.mdown index 5d4e00c8..338e4450 100644 --- a/sources_non_forked/vim-flake8/README.mdown +++ b/sources_non_forked/vim-flake8/README.mdown @@ -104,6 +104,12 @@ To customize the colors used for markers, define the highlight groups, `Flake8_E highlight link Flake8_Naming WarningMsg highlight link Flake8_PyFlake WarningMsg +To show the error message of the current line in the ruler, call `flake8#ShowError()`: + + " add binding to call the function + nnoremap :call flake8#Flake8ShowError() + + Tips ---- A tip might be to run the Flake8 check every time you write a Python file, to diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index cf592cf7..180bcadb 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -20,6 +20,10 @@ function! flake8#Flake8UnplaceMarkers() call s:Warnings() endfunction +function! flake8#Flake8ShowError() + call s:ShowErrorMessage() +endfunction + "" }}} "" ** internal ** {{{ @@ -101,6 +105,7 @@ function! s:Setup() " {{{ let s:markerdata['F'].marker = s:flake8_pyflake_marker let s:markerdata['C'].marker = s:flake8_complexity_marker let s:markerdata['N'].marker = s:flake8_naming_marker + endfunction " }}} "" do flake8 @@ -154,11 +159,20 @@ function! s:Flake8() " {{{ let &shellpipe=l:old_shellpipe let &t_ti=l:old_t_ti let &t_te=l:old_t_te + " store mapping of line number to error string " process results + let s:resultDict = {} + let l:results=getqflist() let l:has_results=results != [] if l:has_results + " save line number of each error message + for result in l:results + let linenum = result.lnum + let s:resultDict[linenum] = result.text + endfor + " markers if !s:flake8_show_in_gutter == 0 || !s:flake8_show_in_file == 0 call s:PlaceMarkers(l:results) @@ -184,8 +198,9 @@ function! s:Flake8() " {{{ endif endfunction " }}} -"" markers + +"" markers function! s:PlaceMarkers(results) " {{{ " in gutter? if !s:flake8_show_in_gutter == 0 @@ -253,6 +268,29 @@ function! s:UnplaceMarkers() " {{{ endfor endfunction " }}} +function! s:ShowErrorMessage() " {{{ + let l:cursorPos = getpos(".") + if !exists('s:resultDict') + return + endif + + " if there is a message on the current line, + " then echo it + if has_key(s:resultDict, l:cursorPos[1]) + let l:errorText = get(s:resultDict, l:cursorPos[1]) + echo strpart(l:errorText, 0, &columns-1) + let b:showing_message = 1 + endif + + " if a message is already being shown, + " then clear it + if !b:showing_message == 0 + echo + let b:showing_message = 0 + endif + +endfunction " }}} + "" }}} let &cpo = s:save_cpo diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 2823ec13..78a572c4 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -45,13 +45,23 @@ function! s:winshell() abort return has('win32') && &shellcmdflag !~# '^-' endfunction +function! s:WinShellEsc(arg) abort + if type(a:arg) == type([]) + return join(map(copy(a:arg), 's:shellesc(v:val)')) + elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' + return a:arg + else + return '"' . s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"') . '"' + endif +endfunction + function! s:shellesc(arg) abort if type(a:arg) == type([]) return join(map(copy(a:arg), 's:shellesc(v:val)')) - elseif a:arg =~ '^[A-Za-z0-9_/:.-]\+$' + elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' return a:arg elseif s:winshell() - return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' + return '"' . s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"') . '"' else return shellescape(a:arg) endif @@ -107,8 +117,13 @@ function! s:Resolve(path) abort return path endfunction +function! s:FileIgnoreCase(for_completion) abort + return (exists('+fileignorecase') && &fileignorecase) + \ || (a:for_completion && exists('+wildignorecase') && &wildignorecase) +endfunction + function! s:cpath(path, ...) abort - if exists('+fileignorecase') && &fileignorecase + if s:FileIgnoreCase(0) let path = FugitiveVimPath(tolower(a:path)) else let path = FugitiveVimPath(a:path) @@ -116,19 +131,6 @@ function! s:cpath(path, ...) abort return a:0 ? path ==# s:cpath(a:1) : path endfunction -function! s:Cd(...) abort - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd' - if !a:0 - return cd - endif - let cwd = getcwd() - if s:cpath(cwd, a:1) - return '' - endif - exe cd s:fnameescape(a:1) - return cd . ' ' . s:fnameescape(cwd) -endfunction - let s:executables = {} function! s:executable(binary) abort @@ -193,94 +195,20 @@ function! s:Map(mode, lhs, rhs, ...) abort endfor endfunction -" Section: Quickfix - -function! s:QuickfixGet(nr, ...) abort - if a:nr < 0 - return call('getqflist', a:000) - else - return call('getloclist', [a:nr] + a:000) - endif -endfunction - -function! s:QuickfixSet(nr, ...) abort - if a:nr < 0 - return call('setqflist', a:000) - else - return call('setloclist', [a:nr] + a:000) - endif -endfunction - -function! s:QuickfixCreate(nr, opts) abort - if has('patch-7.4.2200') - call s:QuickfixSet(a:nr, [], ' ', a:opts) - else - call s:QuickfixSet(a:nr, [], ' ') - endif -endfunction - -function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort - let opts = {'title': a:title, 'context': {'items': []}} - call s:QuickfixCreate(a:nr, opts) - let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event - silent exe s:DoAutocmd('QuickFixCmdPre ' . event) - let winnr = winnr() - exe a:nr < 0 ? 'copen' : 'lopen' - if winnr != winnr() - wincmd p - endif - - let buffer = [] - let lines = split(s:SystemError(s:shellesc(a:cmd))[0], "\n") - for line in lines - call extend(buffer, call(a:callback, a:000 + [line])) - if len(buffer) >= 20 - let contexts = map(copy(buffer), 'get(v:val, "context", {})') - lockvar contexts - call extend(opts.context.items, contexts) - unlet contexts - call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a') - redraw - endif - endfor - call extend(buffer, call(a:callback, a:000 + [0])) - call extend(opts.context.items, map(copy(buffer), 'get(v:val, "context", {})')) - lockvar opts.context.items - call s:QuickfixSet(a:nr, buffer, 'a') - - silent exe s:DoAutocmd('QuickFixCmdPost ' . event) - if a:first && len(s:QuickfixGet(a:nr)) - call s:BlurStatus() - return a:nr < 0 ? 'cfirst' : 'lfirst' - else - return 'exe' - endif -endfunction - -let s:common_efm = '' - \ . '%+Egit:%.%#,' - \ . '%+Eusage:%.%#,' - \ . '%+Eerror:%.%#,' - \ . '%+Efatal:%.%#,' - \ . '%-G%.%#%\e[K%.%#,' - \ . '%-G%.%#%\r%.%\+' - -function! fugitive#Cwindow() abort - if &buftype == 'quickfix' - cwindow - else - botright cwindow - if &buftype == 'quickfix' - wincmd p - endif - endif -endfunction - " Section: Git function! s:UserCommandList(...) abort let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+') - let dir = a:0 ? s:Dir(a:1) : '' + let flags = [] + if a:0 && type(a:1) == type({}) + let git = copy(get(a:1, 'git', git)) + let flags = get(a:1, 'flags', flags) + let dir = a:1.dir + elseif a:0 + let dir = a:1 + else + let dir = '' + endif if len(dir) let tree = s:Tree(dir) if empty(tree) @@ -293,7 +221,7 @@ function! s:UserCommandList(...) abort endif endif endif - return git + return git + flags endfunction function! s:UserCommand(...) abort @@ -409,9 +337,9 @@ function! fugitive#PrepareDirEnvArgv(...) abort let i = 0 while i < len(cmd) if cmd[i] =~# '^$\|[\/.]' && cmd[i] !~# '^-' - let dir = remove(cmd, 0) + let dir = remove(cmd, i) elseif cmd[i] =~# '^--git-dir=' - let dir = remove(cmd, 0)[10:-1] + let dir = remove(cmd, i)[10:-1] elseif type(cmd[i]) ==# type(0) let dir = s:Dir(remove(cmd, i)) elseif cmd[i] ==# '-c' && len(cmd) > i + 1 @@ -460,6 +388,25 @@ function! s:BuildEnvPrefix(env) abort endif endfunction +function! s:JobOpts(cmd, env) abort + if empty(a:env) + return [a:cmd, {}] + elseif has('patch-8.2.0239') || has('patch-8.1.0902') && !has('nvim') && (!has('win32') || empty(filter(keys(a:env), 'exists("$" . v:val)'))) + return [a:cmd, {'env': a:env}] + endif + let envlist = map(items(a:env), 'join(v:val, "=")') + if !has('win32') + return [['env'] + envlist + a:cmd, {}] + else + let pre = join(map(envlist, '"set " . substitute(v:val, "[&|<>^]", "^^^&", "g") . "& "'), '') + if len(a:cmd) == 3 && a:cmd[0] ==# 'cmd.exe' && a:cmd[1] ==# '/c' + return [a:cmd[0:1] + [pre . a:cmd[2]], {}] + else + return [['cmd.exe', '/c', pre . s:WinShellEsc(a:cmd)], {}] + endif + endif +endfunction + function! s:BuildShell(dir, env, args) abort let cmd = copy(a:args) let tree = s:Tree(a:dir) @@ -534,9 +481,13 @@ function! s:TreeChomp(...) abort endfunction function! s:EchoExec(...) abort - echo call('s:ChompError', a:000)[0] - call fugitive#ReloadStatus(-1, 1) - return 'checktime' + if s:RunJobs() + return 'Git ' . s:fnameescape(a:000) + else + echo call('s:ChompError', a:000)[0] + call fugitive#ReloadStatus(-1, 1) + return 'checktime' + endif endfunction let s:head_cache = {} @@ -614,7 +565,11 @@ function! fugitive#Config(...) abort if !has_key(dict, key) let dict[key] = [] endif - call add(dict[key], strpart(line, len(key) + 1)) + if len(key) ==# len(line) + call add(dict[key], 1) + else + call add(dict[key], strpart(line, len(key) + 1)) + endif endfor let s:config[dir] = [s:ConfigTimestamps(dir, dict), dict] lockvar! dict @@ -643,6 +598,89 @@ function! fugitive#RemoteUrl(...) abort return s:ChompDefault('', [dir, 'remote', 'get-url', remote, '--']) endfunction +" Section: Quickfix + +function! s:QuickfixGet(nr, ...) abort + if a:nr < 0 + return call('getqflist', a:000) + else + return call('getloclist', [a:nr] + a:000) + endif +endfunction + +function! s:QuickfixSet(nr, ...) abort + if a:nr < 0 + return call('setqflist', a:000) + else + return call('setloclist', [a:nr] + a:000) + endif +endfunction + +function! s:QuickfixCreate(nr, opts) abort + if has('patch-7.4.2200') + call s:QuickfixSet(a:nr, [], ' ', a:opts) + else + call s:QuickfixSet(a:nr, [], ' ') + endif +endfunction + +function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort + let opts = {'title': a:title, 'context': {'items': []}} + call s:QuickfixCreate(a:nr, opts) + let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event + silent exe s:DoAutocmd('QuickFixCmdPre ' . event) + let winnr = winnr() + exe a:nr < 0 ? 'copen' : 'lopen' + if winnr != winnr() + wincmd p + endif + + let buffer = [] + let lines = split(s:SystemError(s:shellesc(a:cmd))[0], "\n") + for line in lines + call extend(buffer, call(a:callback, a:000 + [line])) + if len(buffer) >= 20 + let contexts = map(copy(buffer), 'get(v:val, "context", {})') + lockvar contexts + call extend(opts.context.items, contexts) + unlet contexts + call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a') + redraw + endif + endfor + call extend(buffer, call(a:callback, a:000 + [0])) + call extend(opts.context.items, map(copy(buffer), 'get(v:val, "context", {})')) + lockvar opts.context.items + call s:QuickfixSet(a:nr, buffer, 'a') + + silent exe s:DoAutocmd('QuickFixCmdPost ' . event) + if a:first && len(s:QuickfixGet(a:nr)) + call s:BlurStatus() + return a:nr < 0 ? 'cfirst' : 'lfirst' + else + return 'exe' + endif +endfunction + +let s:common_efm = '' + \ . '%+Egit:%.%#,' + \ . '%+Eusage:%.%#,' + \ . '%+Eerror:%.%#,' + \ . '%+Efatal:%.%#,' + \ . '%-G%.%#%\e[K%.%#,' + \ . '%-G%.%#%\r%.%\+' + +function! fugitive#Cwindow() abort + if &buftype == 'quickfix' + cwindow + else + botright cwindow + if &buftype == 'quickfix' + wincmd p + endif + endif +endfunction + " Section: Repository Object function! s:add_methods(namespace, method_names) abort @@ -708,23 +746,16 @@ function! s:repo_prepare(...) dict abort endfunction function! s:repo_git_command(...) dict abort - let git = s:UserCommand() . ' --git-dir='.s:shellesc(self.git_dir) + let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') endfunction function! s:repo_git_chomp(...) dict abort - let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) - let output = git . join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') - return s:sub(system(output), '\n$', '') + return s:sub(system(FugitivePrepare(a:000, self.git_dir)), '\n$', '') endfunction function! s:repo_git_chomp_in_tree(...) dict abort - let cdback = s:Cd(self.tree()) - try - return call(self.git_chomp, a:000, self) - finally - execute cdback - endtry + return call(self.git_chomp, a:000, self) endfunction function! s:repo_rev_parse(rev) dict abort @@ -1285,6 +1316,12 @@ function! fugitive#getfperm(url) abort return perm ==# '---------' ? '' : perm endfunction +function s:UpdateIndex(dir, info) abort + let info = join(a:info[0:-2]) . "\t" . a:info[-1] . "\n" + let [error, exec_error] = s:SystemError([a:dir, 'update-index', '--index-info'], info) + return !exec_error ? '' : len(error) ? error : 'fugitive: unknown update-index error' +endfunction + function! fugitive#setfperm(url, perm) abort let [dir, commit, file] = s:DirCommitFile(a:url) let entry = s:PathInfo(a:url) @@ -1293,9 +1330,8 @@ function! fugitive#setfperm(url, perm) abort \ substitute(perm, 'x', '-', 'g') !=# substitute(a:perm, 'x', '-', 'g') return -2 endif - let exec_error = s:SystemError([dir, 'update-index', '--index-info'], - \ (a:perm =~# 'x' ? '000755 ' : '000644 ') . entry[3] . ' ' . commit . "\t" . file[1:-1])[1] - return exec_error ? -1 : 0 + let error = s:UpdateIndex(dir, [a:perm =~# 'x' ? '000755' : '000644', entry[3], commit, file[1:-1]]) + return len(error) ? -1 : 0 endfunction function! s:TempCmd(out, cmd) abort @@ -1365,9 +1401,8 @@ function! fugitive#writefile(lines, url, ...) abort let [hash, exec_error] = s:ChompError([dir, 'hash-object', '-w', temp]) let mode = len(entry[1]) ? entry[1] : '100644' if !exec_error && hash =~# '^\x\{40,\}$' - let exec_error = s:SystemError([dir, 'update-index', '--index-info'], - \ mode . ' ' . hash . ' ' . commit . "\t" . file[1:-1])[1] - if !exec_error + let error = s:UpdateIndex(dir, [mode, hash, commit, file[1:-1]]) + if empty(error) return 0 endif endif @@ -1420,9 +1455,8 @@ function! fugitive#delete(url, ...) abort if entry[2] !=# 'blob' return -1 endif - let exec_error = s:SystemError([dir, 'update-index', '--index-info'], - \ '000000 0000000000000000000000000000000000000000 ' . commit . "\t" . file[1:-1])[1] - return exec_error ? -1 : 0 + let error = s:UpdateIndex(dir, ['000000', '0000000000000000000000000000000000000000', commit, file[1:-1]]) + return len(error) ? -1 : 0 endfunction " Section: Buffer Object @@ -1451,7 +1485,8 @@ function! s:FilterEscape(items, ...) abort let items = copy(a:items) call map(items, 's:fnameescape(v:val)') if a:0 && type(a:1) == type('') - call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1') + let cmp = s:FileIgnoreCase(1) ? '==?' : '==#' + call filter(items, 'strpart(v:val, 0, strlen(a:1)) ' . cmp . ' a:1') endif return items endfunction @@ -1470,10 +1505,21 @@ function! s:GlobComplete(lead, pattern) abort endfunction function! fugitive#CompletePath(base, ...) abort - let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() - let tree = s:Tree(dir) . '/' - let strip = '^\%(:/:\=\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)' - let base = substitute(a:base, strip, '', '') + let dir = a:0 == 1 ? a:1 : a:0 >= 3 ? a:3 : s:Dir() + let stripped = matchstr(a:base, '^\%(:/:\=\|:(top)\|:(top,literal)\|:(literal,top)\)') + let base = strpart(a:base, len(stripped)) + if len(stripped) || a:0 < 4 + let root = s:Tree(dir) + else + let root = a:4 + endif + if root !=# '/' && len(root) + let root .= '/' + endif + if empty(stripped) + let stripped = matchstr(a:base, '^\%(:(literal)\|:\)') + let base = strpart(a:base, len(stripped)) + endif if base =~# '^\.git/' let pattern = s:gsub(base[5:-1], '/', '*&').'*' let matches = s:GlobComplete(dir . '/', pattern) @@ -1485,14 +1531,14 @@ function! fugitive#CompletePath(base, ...) abort call map(matches, "'.git/' . v:val") elseif base =~# '^\~/' let matches = map(s:GlobComplete(expand('~/'), base[2:-1] . '*'), '"~/" . v:val') - elseif a:base =~# '^/\|^\a\+:\|^\.\.\=/\|^:(literal)' + elseif a:base =~# '^/\|^\a\+:\|^\.\.\=/' let matches = s:GlobComplete('', base . '*') - elseif len(tree) > 1 - let matches = s:GlobComplete(tree, s:gsub(base, '/', '*&').'*') + elseif len(root) + let matches = s:GlobComplete(root, s:gsub(base, '/', '*&').'*') else let matches = [] endif - call map(matches, 's:fnameescape(s:Slash(matchstr(a:base, strip) . v:val))') + call map(matches, 's:fnameescape(s:Slash(stripped . v:val))') return matches endfunction @@ -1501,18 +1547,21 @@ function! fugitive#PathComplete(...) abort endfunction function! s:CompleteHeads(dir) abort + if empty(a:dir) + return [] + endif let dir = fugitive#Find('.git/', a:dir) return sort(filter(['HEAD', 'FETCH_HEAD', 'ORIG_HEAD'] + s:merge_heads, 'filereadable(dir . v:val)')) + - \ sort(s:LinesError('rev-parse', '--symbolic', '--branches', '--tags', '--remotes')[0]) + \ sort(s:LinesError([a:dir, 'rev-parse', '--symbolic', '--branches', '--tags', '--remotes'])[0]) endfunction function! fugitive#CompleteObject(base, ...) abort - let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() + let dir = a:0 == 1 ? a:1 : a:0 >= 3 ? a:3 : s:Dir() + let tree = s:Tree(dir) let cwd = getcwd() - let tree = s:Tree(dir) . '/' let subdir = '' - if len(tree) > 1 && s:cpath(tree, cwd[0 : len(tree) - 1]) - let subdir = strpart(cwd, len(tree)) . '/' + if len(tree) && s:cpath(tree . '/', cwd[0 : len(tree)]) + let subdir = strpart(cwd, len(tree) + 1) . '/' endif if a:base =~# '^\.\=/\|^:(' || a:base !~# ':' @@ -1528,9 +1577,7 @@ function! fugitive#CompleteObject(base, ...) abort endif let results += s:FilterEscape(heads, a:base) endif - if !empty(tree) - let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base) - endif + let results += a:0 == 1 || a:0 >= 3 ? fugitive#CompletePath(a:base, 0, '', dir, a:0 >= 4 ? a:4 : tree) : fugitive#CompletePath(a:base) return results elseif a:base =~# '^:' @@ -1545,8 +1592,8 @@ function! fugitive#CompleteObject(base, ...) abort endif else - let tree = matchstr(a:base, '.*[:/]') - let entries = s:LinesError(['ls-tree', substitute(tree, ':\zs\./', '\=subdir', '')], dir)[0] + let parent = matchstr(a:base, '.*[:/]') + let entries = s:LinesError(['ls-tree', substitute(parent, ':\zs\./', '\=subdir', '')], dir)[0] call map(entries,'s:sub(v:val,"^04.*\\zs$","/")') call map(entries,'tree.s:sub(v:val,".*\t","")') @@ -1563,24 +1610,25 @@ function! s:CompleteSub(subcommand, A, L, P, ...) abort elseif !a:0 return fugitive#CompleteObject(a:A, s:Dir()) elseif type(a:1) == type(function('tr')) - return call(a:1, [a:A, a:L, a:P]) + return call(a:1, [a:A, a:L, a:P] + (a:0 > 1 ? a:2 : [])) else return s:FilterEscape(a:1, a:A) endif endfunction function! s:CompleteRevision(A, L, P, ...) abort - return s:FilterEscape(s:CompleteHeads(s:Dir()), a:A) + return s:FilterEscape(s:CompleteHeads(a:0 ? a:1 : s:Dir()), a:A) endfunction -function! s:CompleteRemote(A, L, P) abort +function! s:CompleteRemote(A, L, P, ...) abort + let dir = a:0 ? a:1 : s:Dir() let remote = matchstr(a:L, '\u\w*[! ] *\zs\S\+\ze ') if !empty(remote) - let matches = s:LinesError('ls-remote', remote)[0] + let matches = s:LinesError([dir, 'ls-remote', remote])[0] call filter(matches, 'v:val =~# "\t" && v:val !~# "{"') call map(matches, 's:sub(v:val, "^.*\t%(refs/%(heads/|tags/)=)=", "")') else - let matches = s:LinesError('remote')[0] + let matches = s:LinesError([dir, 'remote'])[0] endif return s:FilterEscape(matches, a:A) endfunction @@ -1594,7 +1642,13 @@ function! s:ReplaceCmd(cmd) abort call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) endif silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp) - silent keepjumps $delete _ + if &foldenable && foldlevel('$') > 0 + set nofoldenable + silent keepjumps $delete _ + set foldenable + else + silent keepjumps $delete _ + endif call delete(temp) if s:cpath(fnamemodify(bufname('$'), ':p'), temp) silent! execute bufnr('$') . 'bwipeout' @@ -1680,6 +1734,10 @@ function! fugitive#BufReadStatus() abort let cmd += ['-c', 'GIT_INDEX_FILE=' . amatch] endif + if fugitive#GitVersion(2, 15) + call add(cmd, '--no-optional-locks') + endif + let b:fugitive_files = {'Staged': {}, 'Unstaged': {}} let [staged, unstaged, untracked] = [[], [], []] let props = {} @@ -1906,7 +1964,7 @@ function! fugitive#BufReadStatus() abort if &bufhidden ==# '' setlocal bufhidden=delete endif - let b:dispatch = ':Gfetch --all' + let b:dispatch = ':Git fetch --all' call fugitive#MapJumps() call s:Map('n', '-', ":execute Do('Toggle',0)", '') call s:Map('x', '-', ":execute Do('Toggle',1)", '') @@ -1921,7 +1979,7 @@ function! fugitive#BufReadStatus() abort call s:MapMotion('gp', "exe StageJump(v:count, 'Unpushed')") call s:MapMotion('gP', "exe StageJump(v:count, 'Unpulled')") call s:MapMotion('gr', "exe StageJump(v:count, 'Rebasing')") - call s:Map('n', 'C', ":Gcommit:echohl WarningMsgecho ':Gstatus C is deprecated in favor of cc'echohl NONE", '') + call s:Map('n', 'C', ":echoerr ':Gstatus C has been removed in favor of cc'", '') call s:Map('n', 'a', ":execute Do('Toggle',0)", '') call s:Map('n', 'i', ":execute NextExpandedHunk(v:count1)", '') call s:Map('n', "=", ":execute StageInline('toggle',line('.'),v:count)", '') @@ -2008,9 +2066,8 @@ function! fugitive#FileWriteCmd(...) abort if empty(old_mode) let old_mode = executable(s:Tree(dir) . file) ? '100755' : '100644' endif - let info = old_mode.' '.sha1.' '.commit."\t".file[1:-1] - let [error, exec_error] = s:SystemError([dir, 'update-index', '--index-info'], info . "\n") - if !exec_error + let error = s:UpdateIndex(dir, [old_mode, sha1, commit, file[1:-1]]) + if empty(error) setlocal nomodified if exists('#' . autype . 'WritePost') execute s:DoAutocmd(autype . 'WritePost ' . s:fnameescape(amatch)) @@ -2179,7 +2236,7 @@ function! s:TempReadPre(file) abort if has_key(s:temp_files, s:cpath(a:file)) let dict = s:temp_files[s:cpath(a:file)] setlocal nomodeline - setlocal bufhidden=delete nobuflisted + setlocal bufhidden=delete setlocal buftype=nowrite setlocal nomodifiable if len(dict.dir) @@ -2192,6 +2249,7 @@ endfunction function! s:TempReadPost(file) abort if has_key(s:temp_files, s:cpath(a:file)) let dict = s:temp_files[s:cpath(a:file)] + setlocal nobuflisted if has_key(dict, 'filetype') && dict.filetype !=# &l:filetype let &l:filetype = dict.filetype endif @@ -2260,13 +2318,24 @@ function! s:RunWait(state, job) abort if !exists('*jobwait') sleep 1m endif - let peek = getchar(1) - if peek != 0 && !(has('win32') && peek == 128) - let c = getchar() - let c = type(c) == type(0) ? nr2char(c) : c - call s:RunSend(a:job, c) - if !a:state.pty - echon c + if !get(a:state, 'closed') + let peek = getchar(1) + if peek != 0 && !(has('win32') && peek == 128) + let c = getchar() + let c = type(c) == type(0) ? nr2char(c) : c + if c ==# "\" + let a:state.closed = 1 + if type(a:job) ==# type(0) + call chanclose(a:job, 'stdin') + else + call ch_close_in(a:job) + endif + else + call s:RunSend(a:job, c) + if !a:state.pty + echon c + endif + endif endif endif endwhile @@ -2304,15 +2373,15 @@ endif function! fugitive#Resume() abort while len(s:resume_queue) let [state, job] = remove(s:resume_queue, 0) + if filereadable(state.temp . '.edit') + call delete(state.temp . '.edit') + endif call s:RunWait(state, job) endwhile endfunction function! s:RunBufDelete(bufnr) abort if has_key(s:edit_jobs, a:bufnr) | - if filereadable(s:edit_jobs[a:bufnr][0].temp . '.edit') - call delete(s:edit_jobs[a:bufnr][0].temp . '.edit') - endif call add(s:resume_queue, remove(s:edit_jobs, a:bufnr)) call feedkeys(":redraw!|call fugitive#Resume()|silent checktime\r", 'n') endif @@ -2323,10 +2392,44 @@ augroup fugitive_job autocmd BufDelete * call s:RunBufDelete(expand('')) autocmd VimLeave * \ for s:jobbuf in keys(s:edit_jobs) | - \ call writefile([], remove(s:edit_jobs, s:jobbuf)[0].temp . '.exit') | + \ call writefile([], s:edit_jobs[s:jobbuf][0].temp . '.exit') | + \ redraw! | + \ call call('s:RunWait', remove(s:edit_jobs, s:jobbuf)) | \ endfor augroup END +function! fugitive#PagerFor(argv, ...) abort + let args = a:argv + if empty(args) + return 0 + elseif (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') + return 1 + endif + if args[0] ==# 'config' && (s:HasOpt(args, '-e', '--edit') || + \ !s:HasOpt(args, '--list', '--get-all', '--get-regexp', '--get-urlmatch')) || + \ args[0] =~# '^\%(tag\|branch\)$' && ( + \ s:HasOpt(args, '--edit-description', '--unset-upstream', '-m', '-M', '--move', '-c', '-C', '--copy', '-d', '-D', '--delete') || + \ len(filter(args[1:-1], 'v:val =~# "^[^-]\\|^--set-upstream-to="')) && + \ !s:HasOpt(args, '--contains', '--no-contains', '--merged', '--no-merged', '--points-at')) + return 0 + endif + let config = a:0 ? a:1 : fugitive#Config() + let value = get(FugitiveConfigGetAll('pager.' . args[0], config), 0, -1) + if value =~# '^\%(true\|yes\|on\|1\)$' + return 1 + elseif value =~# '^\%(false\|no|off\|0\|\)$' + return 0 + elseif type(value) == type('') + return value + elseif args[0] =~# 'diff\%(tool\)\@!\|log\|^show$\|^config$\|^branch$\|^tag$' || + \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || + \ (args[0] ==# 'am' && s:HasOpt(args, '--show-current-patch')) + return 1 + else + return 0 + endif +endfunction + let s:disable_colors = [] for s:colortype in ['advice', 'branch', 'diff', 'grep', 'interactive', 'pager', 'push', 'remote', 'showBranch', 'status', 'transport', 'ui'] call extend(s:disable_colors, ['-c', 'color.' . s:colortype . '=false']) @@ -2334,53 +2437,106 @@ endfor unlet s:colortype function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let dir = s:Dir() + let config = copy(fugitive#Config(dir)) let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir)) - if empty(args) + let flags = [] + let pager = -1 + while len(args) + if args[0] ==# '-c' && len(args) > 1 + call extend(flags, remove(args, 0, 1)) + elseif args[0] =~# '^-p$\|^--paginate$' + let pager = 1 + call remove(args, 0) + elseif args[0] =~# '^-P$\|^--no-pager$' + let pager = 0 + call remove(args, 0) + elseif args[0] =~# '^--\%([[:lower:]-]\+-pathspecs\|no-optional-locks\)$' + call add(flags, remove(args, 0)) + elseif args[0] =~# '^-C$\|^--\%(exec-path=\|git-dir=\|work-tree=\|bare$\)' + return 'echoerr ' . string('fugitive: ' . args[0] . ' is not supported') + else + break + endif + endwhile + if pager is# 0 + call add(flags, '--no-pager') + endif + if empty(args) && pager is# -1 let cmd = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', []) return (empty(cmd) ? 'exe' : cmd) . after endif - let alias = get(s:Aliases(dir), args[0], '!') - if get(args, 1, '') !=# '--help' && alias !~# '^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0]) + let alias = fugitive#Config('alias.' . get(args, 0, ''), config) + if get(args, 1, '') !=# '--help' && alias !~# '^$\|^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0]) \ && !(has('win32') && filereadable(s:ExecPath() . '/git-' . args[0] . '.exe')) call remove(args, 0) call extend(args, split(alias, '\s\+'), 'keep') endif - let name = substitute(args[0], '\%(^\|-\)\(\l\)', '\u\1', 'g') - if exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' + let name = substitute(get(args, 0, ''), '\%(^\|-\)\(\l\)', '\u\1', 'g') + let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+') + let options = {'git': git, 'dir': dir, 'flags': flags} + if pager is# -1 && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try - exe s:DirCheck(dir) - let opts = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) - if type(opts) == type('') - return 'exe ' . string(opts) . after + let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'command': args[0], 'args': args[1:-1]}, options)) + if type(overrides) == type('') + return 'exe ' . string(overrides) . after endif + let args = [get(overrides, 'command', args[0])] + get(overrides, 'insert_args', []) + args[1:-1] catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry else - let opts = {} + let overrides = {} endif - let args = get(opts, 'args', args) - if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' || - \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || - \ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') - if args[0] =~# '^-p$\|^--paginate$' - call remove(args, 0) + let env = get(overrides, 'env', {}) + let i = 0 + while i < len(flags) - 1 + if flags[i] ==# '-c' + let i += 1 + let config_name = tolower(matchstr(flags[i], '^[^=]\+')) + if has_key(s:prepare_env, config_name) && flags[i] =~# '=.' + let env[s:prepare_env[config_name]] = matchstr(flags[i], '=\zs.*') + endif + if flags[i] =~# '=' + let config[config_name] = [matchstr(flags[i], '=\zs.*')] + else + let config[config_name] = [1] + endif + endif + let i += 1 + endwhile + let editcmd = a:line2 ? 'split' : 'edit' + if pager is# 1 + if a:bang && a:line2 >= 0 + let editcmd = 'read' + elseif a:bang + let editcmd = 'pedit' + endif + elseif pager is# -1 + let pager = fugitive#PagerFor(args, config) + if a:bang && pager isnot# 1 + return 'echoerr ' . string('fugitive: :Git! for temp buffer output has been replaced by :Git --paginate') + endif + endif + if pager is# 1 + if editcmd ==# 'read' + return s:ReadExec(a:line1, a:line2, a:range, a:mods, env, args, options) . after + else + return s:OpenExec(editcmd, a:mods, env, args, options) . after endif - return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after endif if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || - \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') + \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || + \ type(pager) == type('') let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') if &autowrite || &autowriteall | silent! wall | endif - return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(dir, args)) . assign . '|startinsert' . after + return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(options, args)) . assign . '|startinsert' . after elseif has('terminal') if &autowrite || &autowriteall | silent! wall | endif - return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . assign . after + return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(options) + args, 's:fnameescape(v:val)'))) . assign . after endif endif - let env = get(opts, 'env', {}) if s:RunJobs() let state = {'dir': dir, 'mods': s:Mods(a:mods), 'temp': tempname(), 'log': []} let state.pty = get(g:, 'fugitive_pty', has('unix') && (has('patch-8.0.0744') || has('nvim'))) @@ -2401,57 +2557,39 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort \ 'GIT_MERGE_AUTOEDIT': '1', \ 'GIT_PAGER': 'cat', \ 'PAGER': 'cat'}, 'keep') - let args = ['-c', 'advice.waitingForEditor=false'] + s:disable_colors + args - let argv = s:UserCommandList(dir) + args - if !has('patch-8.0.0902') || has('nvim') - let envlist = map(items(env), 'join(v:val, "=")') - if s:executable('env') - let argv = ['env'] + envlist + argv - elseif has('win32') - let argv = ['cmd.exe', '/c', - \ join(map(envlist, { _, v -> 'set ' . substitute(v, '[&|<>^]', '^^^&', 'g') }) + - \ [s:shellesc(argv)], '& ')] - else - return 'echoerr ' . string('fugitive: "env" command missing') - endif - let env = {} - endif + let args = s:disable_colors + flags + ['-c', 'advice.waitingForEditor=false'] + args + let argv = s:UserCommandList({'git': git, 'dir': dir}) + args + let [argv, jobopts] = s:JobOpts(argv, env) let state.cmd = argv let g:_fugitive_last_job = state if &autowrite || &autowriteall | silent! wall | endif if exists('*job_start') - let jobopts = { + call extend(jobopts, { \ 'mode': 'raw', \ 'callback': function('s:RunReceive', [state]), - \ } + \ }) if state.pty let jobopts.pty = 1 endif - if len(env) - let jobopts.env = env - endif let job = job_start(argv, jobopts) else - let job = jobstart(argv, { + let job = jobstart(argv, extend(jobopts, { \ 'pty': state.pty, - \ 'env': env, \ 'TERM': 'dumb', \ 'on_stdout': function('s:RunReceive', [state]), \ 'on_stderr': function('s:RunReceive', [state]), - \ }) + \ })) endif let state.job = job call s:RunWait(state, job) return 'silent checktime' . after + elseif has('win32') + return 'echoerr ' . string('fugitive: Vim 8 with job support required to use :Git on Windows') + elseif has('gui_running') + return 'echoerr ' . string('fugitive: Vim 8 with job support required to use :Git in GVim') else - if has('gui_running') && !has('win32') - call insert(args, '--no-pager') - endif - if has('nvim') - let env.GIT_TERMINAL_PROMPT = '0' - endif let pre = s:BuildEnvPrefix(env) - return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . + return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(options, args), '!#%')) . \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . \ after endif @@ -2483,21 +2621,31 @@ function! s:Aliases(dir) abort endfunction function! fugitive#Complete(lead, ...) abort - let dir = a:0 == 1 ? a:1 : a:0 == 3 ? a:3 : s:Dir() + let dir = a:0 == 1 ? a:1 : a:0 >= 3 ? a:3 : s:Dir() + let root = a:0 >= 4 ? a:4 : s:Tree(s:Dir()) let pre = a:0 > 1 ? strpart(a:1, 0, a:2) : '' let subcmd = matchstr(pre, '\u\w*[! ] *\zs[[:alnum:]-]\+\ze ') if empty(subcmd) let results = sort(s:Subcommands() + keys(s:Aliases(dir))) + elseif a:0 ==# 2 && subcmd =~# '^\%(commit\|revert\|push\|fetch\|pull\|merge\|rebase\)$' + let cmdline = substitute(a:1, '\u\w*\([! ] *\)' . subcmd, 'G' . subcmd, '') + let caps_subcmd = substitute(subcmd, '\%(^\|-\)\l', '\u&', 'g') + return fugitive#{caps_subcmd}Complete(a:lead, cmdline, a:2 + len(cmdline) - len(a:1), dir, root) elseif pre =~# ' -- ' - return fugitive#CompletePath(a:lead, dir) + return fugitive#CompletePath(a:lead, a:1, a:2, dir, root) elseif a:lead =~# '^-' let results = split(s:ChompDefault('', dir, subcmd, '--git-completion-helper'), ' ') else - return fugitive#CompleteObject(a:lead, dir) + return fugitive#CompleteObject(a:lead, a:1, a:2, dir, root) endif return filter(results, 'strpart(v:val, 0, strlen(a:lead)) ==# a:lead') endfunction +function! fugitive#CompleteForWorkingDir(A, L, P, ...) abort + let path = a:0 ? a:1 : getcwd() + return fugitive#Complete(a:A, a:L, a:P, FugitiveExtractGitDir(path), path) +endfunction + " Section: :Gcd, :Glcd function! fugitive#CdComplete(A, L, P) abort @@ -2542,7 +2690,7 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args elseif a:bang return mods . 'pedit' . arg . '|wincmd P' else - return mods . (a:count > 0 ? a:count : '') . 'split' . arg + return mods . 'keepalt split' . arg endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) @@ -3232,6 +3380,8 @@ function! s:StageInline(mode, ...) abort endif let start = index let mode = 'head' + elseif mode ==# 'head' && line =~# '^diff ' + let start = index elseif mode ==# 'head' && substitute(line, "\t$", '', '') ==# '--- ' . info.relative[-1] let mode = 'await' elseif mode ==# 'head' && substitute(line, "\t$", '', '') ==# '+++ ' . info.relative[0] @@ -3267,16 +3417,16 @@ function! s:StageDiff(diff) abort let prefix = info.offset > 0 ? '+' . info.offset : '' if info.sub =~# '^S' if info.section ==# 'Staged' - return 'Git! diff --no-ext-diff --submodule=log --cached -- ' . info.paths[0] + return 'Git --paginate diff --no-ext-diff --submodule=log --cached -- ' . info.paths[0] elseif info.sub =~# '^SC' - return 'Git! diff --no-ext-diff --submodule=log -- ' . info.paths[0] + return 'Git --paginate diff --no-ext-diff --submodule=log -- ' . info.paths[0] else - return 'Git! diff --no-ext-diff --submodule=diff -- ' . info.paths[0] + return 'Git --paginate diff --no-ext-diff --submodule=diff -- ' . info.paths[0] endif elseif empty(info.paths) && info.section ==# 'Staged' - return 'Git! diff --no-ext-diff --cached' + return 'Git --paginate diff --no-ext-diff --cached' elseif empty(info.paths) - return 'Git! diff --no-ext-diff' + return 'Git --paginate diff --no-ext-diff' elseif len(info.paths) > 1 execute 'Gedit' . prefix s:fnameescape(':0:' . info.paths[0]) return a:diff . '! HEAD:'.s:fnameescape(info.paths[1]) @@ -3299,12 +3449,12 @@ function! s:StageDiffEdit() abort let info = s:StageInfo(line('.')) let arg = (empty(info.paths) ? s:Tree() : info.paths[0]) if info.section ==# 'Staged' - return 'Git! diff --no-ext-diff --cached '.s:fnameescape(arg) + return 'Git --paginate diff --no-ext-diff --cached '.s:fnameescape(arg) elseif info.status ==# '?' call s:TreeChomp('add', '--intent-to-add', '--', arg) return s:ReloadStatus() else - return 'Git! diff --no-ext-diff '.s:fnameescape(arg) + return 'Git --paginate diff --no-ext-diff '.s:fnameescape(arg) endif endfunction @@ -3448,6 +3598,19 @@ function! s:DoToggleHeadHeader(value) abort call search('\C^index$', 'wc') endfunction +function! s:DoStagePushHeader(value) abort + let remote = matchstr(a:value, '\zs[^/]\+\ze/') + if empty(remote) + let remote = '.' + endif + let branch = matchstr(a:value, '\%([^/]\+/\)\=\zs\S\+') + call feedkeys(':Git push ' . remote . ' ' . branch) +endfunction + +function! s:DoTogglePushHeader(value) abort + return s:DoStagePushHeader(a:value) +endfunction + function! s:DoStageUnpushedHeading(heading) abort let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/') if empty(remote) @@ -3491,7 +3654,7 @@ function! s:DoToggleUnpulled(record) abort endfunction function! s:DoUnstageUnpushed(record) abort - call feedkeys(':Git rebase --autosquash ' . a:record.commit . '^') + call feedkeys(':Git -c sequence.editor=true rebase --interactive --autosquash ' . a:record.commit . '^') endfunction function! s:DoToggleStagedHeading(...) abort @@ -3606,10 +3769,10 @@ function! s:StagePatch(lnum1,lnum2) abort return s:ReloadStatus() endfunction -" Section: :Gcommit, :Grevert +" Section: :Git commit, :Git revert -function! s:CommitInteractive(line1, line2, range, bang, mods, args, patch) abort - let status = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', []) +function! s:CommitInteractive(line1, line2, range, bang, mods, options, patch) abort + let status = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', [], a:options.dir) let status = len(status) ? status . '|' : '' if a:patch return status . 'if search("^Unstaged")|exe "normal >"|exe "+"|endif' @@ -3618,8 +3781,8 @@ function! s:CommitInteractive(line1, line2, range, bang, mods, args, patch) abor endif endfunction -function! s:CommitSubcommand(line1, line2, range, bang, mods, args) abort - let argv = copy(a:args) +function! s:CommitSubcommand(line1, line2, range, bang, mods, options) abort + let argv = copy(a:options.args) let i = 0 while get(argv, i, '--') !=# '--' if argv[i] =~# '^-[apzsneiovq].' @@ -3630,21 +3793,22 @@ function! s:CommitSubcommand(line1, line2, range, bang, mods, args) abort endif endwhile if s:HasOpt(argv, '-i', '--interactive') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, a:options, 0) elseif s:HasOpt(argv, '-p', '--patch') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, a:options, 1) else return {} endif endfunction -function! s:RevertSubcommand(line1, line2, range, bang, mods, args) abort - return {'args': ['revert', '--edit'] + a:args} +function! s:RevertSubcommand(line1, line2, range, bang, mods, options) abort + return {'insert_args': ['--edit']} endfunction -function! fugitive#CommitComplete(A, L, P) abort +function! fugitive#CommitComplete(A, L, P, ...) abort + let dir = a:0 ? a:1 : s:Dir() if a:A =~# '^--fixup=\|^--squash=' - let commits = s:LinesError(['log', '--pretty=format:%s', '@{upstream}..'])[0] + let commits = s:LinesError([dir, 'log', '--pretty=format:%s', '@{upstream}..'])[0] let pre = matchstr(a:A, '^--\w*=''\=') . ':/^' if pre =~# "'" call map(commits, 'pre . string(tr(v:val, "|\"^$*[]", "......."))[1:-1]') @@ -3654,43 +3818,44 @@ function! fugitive#CommitComplete(A, L, P) abort return s:FilterEscape(map(commits, 'pre . tr(v:val, "\\ !^$*?[]()''\"`&;<>|#", "....................")'), a:A) endif else - return s:CompleteSub('commit', a:A, a:L, a:P, function('fugitive#CompletePath')) + return s:CompleteSub('commit', a:A, a:L, a:P, function('fugitive#CompletePath'), a:000) endif return [] endfunction -function! fugitive#RevertComplete(A, L, P) abort - return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision')) +function! fugitive#RevertComplete(A, L, P, ...) abort + return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision'), a:000) endfunction -" Section: :Gmerge, :Grebase, :Gpull +" Section: :Git merge, :Git rebase, :Git pull -function! fugitive#MergeComplete(A, L, P) abort - return s:CompleteSub('merge', a:A, a:L, a:P, function('s:CompleteRevision')) +function! fugitive#MergeComplete(A, L, P, ...) abort + return s:CompleteSub('merge', a:A, a:L, a:P, function('s:CompleteRevision'), a:000) endfunction -function! fugitive#RebaseComplete(A, L, P) abort - return s:CompleteSub('rebase', a:A, a:L, a:P, function('s:CompleteRevision')) +function! fugitive#RebaseComplete(A, L, P, ...) abort + return s:CompleteSub('rebase', a:A, a:L, a:P, function('s:CompleteRevision'), a:000) endfunction -function! fugitive#PullComplete(A, L, P) abort - return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote')) +function! fugitive#PullComplete(A, L, P, ...) abort + return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote'), a:000) endfunction -function! s:MergeSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() - if empty(a:args) && ( +function! s:MergeSubcommand(line1, line2, range, bang, mods, options) abort + let dir = a:options.dir + if empty(a:options.args) && ( \ filereadable(fugitive#Find('.git/MERGE_MSG', dir)) || \ isdirectory(fugitive#Find('.git/rebase-apply', dir)) || \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . ' mergetool' + return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . s:fnameescape(a:options.flags + ['mergetool']) endif return {} endfunction -function! s:RebaseSubcommand(line1, line2, range, bang, mods, args) abort - if s:HasOpt(a:args, '--autosquash') && !s:HasOpt(a:args, '-i', '--interactive') - return {'env': {'GIT_SEQUENCE_EDITOR': 'true'}, 'args': ['rebase', '--interactive'] + a:args} +function! s:RebaseSubcommand(line1, line2, range, bang, mods, options) abort + let args = a:options.args + if s:HasOpt(args, '--autosquash') && !s:HasOpt(args, '-i', '--interactive') + return {'env': {'GIT_SEQUENCE_EDITOR': 'true'}, 'insert_args': ['--interactive']} endif return {} endfunction @@ -3778,7 +3943,7 @@ function! s:ToolParse(state, line) abort return [] endfunction -function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) abort +function! s:ToolStream(line1, line2, range, bang, mods, options, args, state) abort let i = 0 let argv = copy(a:args) let prompt = 1 @@ -3812,9 +3977,14 @@ function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) let a:state.mode = 'init' let a:state.from = '' let a:state.to = '' - let exec = s:UserCommandList(a:dir) + ['--no-pager', '-c', 'diff.context=0', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv + let exec = s:UserCommandList({'git': a:options.git, 'dir': a:options.dir}) + if fugitive#GitVersion(1, 9) || (!s:HasOpt(argv, '--name-status') && !prompt) + let exec += ['-c', 'diff.context=0'] + endif + let exec += a:options.flags + ['--no-pager', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv if prompt - return s:QuickfixStream(a:line2, 'difftool', a:title, exec, !a:bang, s:function('s:ToolParse'), a:state) + let title = ':Git ' . s:fnameescape(a:options.flags + [a:options.command] + a:options.args) + return s:QuickfixStream(a:line2, 'difftool', title, exec, !a:bang, s:function('s:ToolParse'), a:state) else let filename = '' let cmd = [] @@ -3835,23 +4005,23 @@ function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) endif endfunction -function! s:MergetoolSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() +function! s:MergetoolSubcommand(line1, line2, range, bang, mods, options) abort + let dir = a:options.dir + exe s:DirCheck(dir) let i = 0 - let argv = copy(a:args) let prompt = 1 - let title = ':Git mergetool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') let cmd = ['diff', '--diff-filter=U'] let state = {'name_only': 0} let state.diff = [{'prefix': ':2:', 'module': ':2:'}, {'prefix': ':3:', 'module': ':3:'}, {'prefix': ':(top)'}] call map(state.diff, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') - return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, ['--diff-filter=U'] + a:args, state, title) + return s:ToolStream(a:line1, a:line2, a:range, a:bang, a:mods, a:options, ['--diff-filter=U'] + a:options.args, state) endfunction -function! s:DifftoolSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() +function! s:DifftoolSubcommand(line1, line2, range, bang, mods, options) abort + let dir = a:options.dir + exe s:DirCheck(dir) let i = 0 - let argv = copy(a:args) + let argv = copy(a:options.args) let commits = [] let cached = 0 let reverse = 1 @@ -3904,7 +4074,6 @@ function! s:DifftoolSubcommand(line1, line2, range, bang, mods, args) abort endif let i += 1 endwhile - let title = ':Git difftool' . (len(a:args) ? ' ' . s:fnameescape(a:args) : '') if len(merge_base_against) call add(commits, merge_base_against) endif @@ -3929,7 +4098,7 @@ function! s:DifftoolSubcommand(line1, line2, range, bang, mods, args) abort endif call map(commits, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') let state.diff = commits - return s:ToolStream(dir, a:line1, a:line2, a:range, a:bang, a:mods, argv, state, title) + return s:ToolStream(a:line1, a:line2, a:range, a:bang, a:mods, a:options, argv, state) endfunction " Section: :Ggrep, :Glog @@ -3977,16 +4146,16 @@ function! s:GrepParseLine(prefix, name_only, dir, line) abort return entry endfunction -function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() +function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort + let dir = a:options.dir exe s:DirCheck(dir) let listnr = a:line1 == 0 ? a:line1 : a:line2 let cmd = ['--no-pager', 'grep', '-n', '--no-color', '--full-name'] - if fugitive#GitVersion(2, 19) - call add(cmd, '--column') - endif let tree = s:Tree(dir) - let args = a:args + let args = a:options.args + if get(args, 0, '') =~# '^-O\|--open-files-in-pager$' + let args = args[1:-1] + endif let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args if listnr > 0 @@ -4002,7 +4171,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? \ 'fugitive://' . dir . '//0/' : \ s:cpath(getcwd(), tree) ? '' : tree . '/') - exe '!' . escape(s:UserCommand(dir, cmd + args), '%#!') + exe '!' . escape(s:UserCommand(a:options, cmd + args), '%#!') \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)') call s:QuickfixSet(listnr, list, 'a') @@ -4017,11 +4186,16 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort endif endfunction +function! fugitive#GrepCommand(line1, line2, range, bang, mods, arg) abort + return fugitive#Command(a:line1, a:line2, a:range, a:bang, a:mods, + \ "grep -O " . (fugitive#GitVersion(2, 19) ? "--column " : "") . a:arg) +endfunction + let s:log_diff_context = '{"filename": fugitive#Find(v:val . from, a:dir), "lnum": get(offsets, v:key), "module": strpart(v:val, 0, len(a:state.base_module)) . from}' function! s:LogFlushQueue(state, dir) abort let queue = remove(a:state, 'queue') - if a:state.child_found && get(a:state, 'ignore_summary') + if a:state.child_found && get(a:state, 'ignore_commit') call remove(queue, 0) elseif len(queue) && len(a:state.target) && len(get(a:state, 'parents', [])) let from = substitute(a:state.target, '^/', ':', '') @@ -4158,11 +4332,13 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort let state.ignore_summary = 1 endif endif + let state.ignore_commit = 1 elseif a:count > 0 if !s:HasOpt(args, '--merges', '--no-merges') call insert(extra_args, '--no-merges') endif call add(args, '-L' . a:line1 . ',' . a:count . ':' . path[1:-1]) + let state.ignore_commit = 1 endif if len(path) && empty(filter(copy(args), 'v:val =~# "^[^-]"')) let owner = s:Owner(@%, dir) @@ -4189,7 +4365,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort \ args + extra_args + paths + extra_paths) let state.target = path let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/')) + if empty(paths + extra_paths) && empty(a:type) && a:count < 0 && len(s:Relative('/')) let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after endif return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after @@ -4304,12 +4480,12 @@ function! s:BlurStatus() abort endif endfunction -function! s:OpenExec(cmd, mods, args, ...) abort - let dir = a:0 ? s:Dir(a:1) : s:Dir() +function! s:OpenExec(cmd, mods, env, args, ...) abort + let options = a:0 ? a:1 : {'dir': s:Dir()} let temp = tempname() let columns = get(g:, 'fugitive_columns', 80) - let env = s:BuildEnvPrefix({'COLUMNS': columns}) - silent! execute '!' . escape(env . s:UserCommand(dir, ['--no-pager'] + a:args), '!#%') . + let env = s:BuildEnvPrefix(extend({'COLUMNS': columns}, a:env)) + silent! execute '!' . escape(env . s:UserCommand(options, ['--no-pager'] + a:args), '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') redraw! let temp = s:Resolve(temp) @@ -4319,18 +4495,18 @@ function! s:OpenExec(cmd, mods, args, ...) abort else let filetype = 'git' endif - let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype } + let s:temp_files[s:cpath(temp)] = { 'dir': options.dir, 'filetype': filetype } if a:cmd ==# 'edit' call s:BlurStatus() endif silent execute s:Mods(a:mods) . a:cmd temp - call fugitive#ReloadStatus(dir, 1) - return 'echo ' . string(':!' . s:UserCommand(dir, a:args)) + call fugitive#ReloadStatus(options.dir, 1) + return 'echo ' . string(':!' . s:UserCommand(options, a:args)) endfunction function! fugitive#Open(cmd, bang, mods, arg, args) abort if a:bang - return s:OpenExec(a:cmd, a:mods, s:SplitExpand(a:arg, s:Tree())) + return s:OpenExec(a:cmd, a:mods, {}, s:SplitExpand(a:arg, s:Tree())) endif let mods = s:Mods(a:mods) @@ -4348,7 +4524,7 @@ function! fugitive#Open(cmd, bang, mods, arg, args) abort return mods . a:cmd . pre . ' ' . s:fnameescape(file) endfunction -function! fugitive#ReadCommand(line1, count, range, bang, mods, arg, args) abort +function! s:ReadPrepare(line1, count, range, mods) abort let mods = s:Mods(a:mods) let after = a:count if a:count < 0 @@ -4359,26 +4535,39 @@ function! fugitive#ReadCommand(line1, count, range, bang, mods, arg, args) abort else let delete = '' endif + if foldlevel(after) + let pre = after . 'foldopen!|' + else + let pre = '' + endif + return [pre . mods . after . 'read', delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '')] +endfunction + +function! s:ReadExec(line1, count, range, mods, env, args, options) abort + let [read, post] = s:ReadPrepare(a:line1, a:count, a:range, a:mods) + let env = s:BuildEnvPrefix(extend({'COLUMNS': &tw ? &tw : 80}, a:env)) + silent execute read . '!' escape(env . s:UserCommand(a:options, ['--no-pager'] + a:args), '!#%') + execute post + call fugitive#ReloadStatus(a:options.dir, 1) + return 'redraw|echo '.string(':!'.s:UserCommand(a:options, a:args)) +endfunction + +function! fugitive#ReadCommand(line1, count, range, bang, mods, arg, args) abort if a:bang let dir = s:Dir() let args = s:SplitExpand(a:arg, s:Tree(dir)) - silent execute mods . after . 'read!' escape(s:UserCommand(dir, ['--no-pager'] + args), '!#%') - execute delete . 'diffupdate' - call fugitive#ReloadStatus(dir, 1) - return 'redraw|echo '.string(':!'.s:UserCommand(dir, args)) + return s:ReadExec(a:line1, a:count, a:range, a:mods, {}, args, {'dir': dir}) endif + let [read, post] = s:ReadPrepare(a:line1, a:count, a:range, a:mods) try let [file, pre] = s:OpenParse(a:args, 0) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry - if file =~# '^fugitive:' && after is# 0 - return 'exe ' .string(mods . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate' + if file =~# '^fugitive:' && a:count is# 0 + return 'exe ' .string(s:Mods(a:mods) . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate' endif - if foldlevel(after) - exe after . 'foldopen!' - endif - return mods . after . 'read' . pre . ' ' . s:fnameescape(file) . '|' . delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '') + return read . ' ' . pre . ' ' . s:fnameescape(file) . '|' . post endfunction function! fugitive#EditComplete(A, L, P) abort @@ -4405,7 +4594,7 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != '' return 'wq' elseif get(b:, 'fugitive_type', '') ==# 'index' - return 'Gcommit' + return 'Git commit' elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} ' return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit') endif @@ -4543,19 +4732,19 @@ function! fugitive#WqCommand(...) abort endif endfunction -" Section: :Gpush, :Gfetch +" Section: :Git push, :Git fetch -function! fugitive#PushComplete(A, L, P) abort - return s:CompleteSub('push', a:A, a:L, a:P, function('s:CompleteRemote')) +function! fugitive#PushComplete(A, L, P, ...) abort + return s:CompleteSub('push', a:A, a:L, a:P, function('s:CompleteRemote'), a:000) endfunction -function! fugitive#FetchComplete(A, L, P) abort - return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote')) +function! fugitive#FetchComplete(A, L, P, ...) abort + return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'), a:000) endfunction function! s:AskPassArgs(dir) abort if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && fugitive#GitVersion(1, 8) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(get(fugitive#Config(a:dir), 'core.askpass', [])) + \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir)) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] elseif s:executable('ssh-askpass') @@ -4565,14 +4754,15 @@ function! s:AskPassArgs(dir) abort return [] endfunction -function! s:Dispatch(bang, cmd, args) abort - let dir = s:Dir() +function! s:Dispatch(bang, options) abort + let dir = a:options.dir + exe s:DirCheck(dir) let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] try let b:current_compiler = 'git' let &l:errorformat = s:common_efm . \ ',%\&git_dir=' . escape(substitute(dir, '%', '%%', 'g'), '\,') - let &l:makeprg = s:UserCommand(dir, s:AskPassArgs(dir) + [a:cmd] + a:args) + let &l:makeprg = s:UserCommand({'git': a:options.git, 'dir': dir}, s:AskPassArgs(dir) + a:options.flags + [a:options.command] + a:options.args) if exists(':Make') == 2 Make return '' @@ -4595,12 +4785,12 @@ function! s:Dispatch(bang, cmd, args) abort endtry endfunction -function! s:PushSubcommand(line1, line2, range, bang, mods, args) abort - return s:Dispatch(a:bang ? '!' : '', 'push', a:args) +function! s:PushSubcommand(line1, line2, range, bang, mods, options) abort + return s:Dispatch(a:bang ? '!' : '', a:options) endfunction -function! s:FetchSubcommand(line1, line2, range, bang, mods, args) abort - return s:Dispatch(a:bang ? '!' : '', 'fetch', a:args) +function! s:FetchSubcommand(line1, line2, range, bang, mods, options) abort + return s:Dispatch(a:bang ? '!' : '', a:options) endfunction " Section: :Gdiff @@ -4851,9 +5041,7 @@ function! s:Move(force, rename, destination) abort if s:DirCommitFile(@%)[1] !~# '^0\=$' || empty(@%) return 'echoerr ' . string('fugitive: mv not supported for this buffer') endif - if a:destination =~# '^\.\.\=\%(/\|$\)' - let destination = simplify(getcwd() . '/' . a:destination) - elseif a:destination =~# '^\a\+:\|^/' + if a:destination =~# '^\a\+:\|^/' let destination = a:destination elseif a:destination =~# '^:/:\=' let destination = s:Tree(dir) . substitute(a:destination, '^:/:\=', '', '') @@ -4862,7 +5050,9 @@ function! s:Move(force, rename, destination) abort elseif a:destination =~# '^:(literal)' let destination = simplify(getcwd() . '/' . matchstr(a:destination, ')\zs.*')) elseif a:rename - let destination = expand('%:p:s?[\/]$??:h') . '/' . a:destination + let destination = simplify(expand('%:p:s?[\/]$??:h') . '/' . a:destination) + elseif a:destination =~# '^\.\.\=\%(/\|$\)' + let destination = simplify(getcwd() . '/' . a:destination) else let destination = s:Tree(dir) . '/' . a:destination endif @@ -4937,14 +5127,14 @@ function! fugitive#DeleteCommand(line1, line2, range, bang, mods, arg, args) abo return s:Remove('bdelete', a:bang) endfunction -" Section: :Gblame +" Section: :Git blame function! s:Keywordprg() abort let args = ' --git-dir='.escape(s:Dir(),"\\\"' ") if has('gui_running') && !has('win32') - return s:UserCommand() . ' --no-pager' . args . ' log -1' + return g:fugitive_git_executable . ' --no-pager' . args . ' log -1' else - return s:UserCommand() . args . ' show' + return g:fugitive_git_executable . args . ' show' endif endfunction @@ -4974,7 +5164,7 @@ function! s:BlameCommitFileLnum(...) abort if commit =~# '^0\+$' let commit = '' elseif has_key(state, 'blame_reverse_end') - let commit = get(s:LinesError('rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '') + let commit = get(s:LinesError(state.dir, 'rev-list', '--ancestry-path', '--reverse', commit . '..' . state.blame_reverse_end)[0], 0, '') endif let lnum = +matchstr(line, ' \zs\d\+\ze \%((\| *\d\+)\)') let path = matchstr(line, '^\^\=[?*]*\x* \+\%(\d\+ \+\d\+ \+\)\=\zs.\{-\}\ze\s*\d\+ \%((\| *\d\+)\)') @@ -5009,9 +5199,10 @@ function! fugitive#BlameComplete(A, L, P) abort return s:CompleteSub('blame', a:A, a:L, a:P) endfunction -function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort - exe s:DirCheck() - let flags = copy(a:args) +function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort + let dir = s:Dir() + exe s:DirCheck(dir) + let flags = copy(a:options.args) let i = 0 let raw = 0 let commits = [] @@ -5066,7 +5257,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort continue endif try - let dcf = s:DirCommitFile(fugitive#Find(arg)) + let dcf = s:DirCommitFile(fugitive#Find(arg, dir)) if len(dcf[1]) && empty(dcf[2]) call add(commits, remove(flags, i)) continue @@ -5078,13 +5269,13 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort endif let i += 1 endwhile - let file = substitute(get(files, 0, get(s:TempState(), 'blame_file', s:Relative('./'))), '^\.\%(/\|$\)', '', '') + let file = substitute(get(files, 0, get(s:TempState(), 'blame_file', s:Relative('./', dir))), '^\.\%(/\|$\)', '', '') if empty(commits) && len(files) > 1 call add(commits, remove(files, 1)) endif exe s:BlameLeave() try - let cmd = ['--no-pager', '-c', 'blame.coloring=none', '-c', 'blame.blankBoundary=false', 'blame', '--show-number'] + let cmd = a:options.flags + ['--no-pager', '-c', 'blame.coloring=none', '-c', 'blame.blankBoundary=false', a:options.command, '--show-number'] call extend(cmd, filter(copy(flags), 'v:val !~# "\\v^%(-b|--%(no-)=color-.*|--progress)$"')) if a:count > 0 && empty(ranges) let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))] @@ -5097,7 +5288,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort elseif empty(files) && !s:HasOpt(flags, '--reverse') let cmd += ['--contents', '-'] endif - let basecmd = escape(fugitive#Prepare(cmd) . ' -- ' . s:shellesc(len(files) ? files : file), '!#%') + let basecmd = escape(s:UserCommand({'git': a:options.git, 'dir': dir}, cmd + ['--'] + (len(files) ? files : [file])), '!#%') let tempname = tempname() let error = tempname . '.err' let temp = tempname . (raw ? '' : '.fugitiveblame') @@ -5129,7 +5320,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort endfor return '' endif - let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file} + let temp_state = {'dir': dir, 'filetype': (raw ? '' : 'fugitiveblame'), 'options': a:options, 'blame_flags': flags, 'blame_file': file} if s:HasOpt(flags, '--reverse') let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*') endif @@ -5153,29 +5344,38 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort if a:mods =~# '\' silent tabedit % endif + let bufnr = bufnr('') + let temp_state.bufnr = bufnr + let restore = [] let mods = substitute(a:mods, '\', '', 'g') for winnr in range(winnr('$'),1,-1) if getwinvar(winnr, '&scrollbind') - call setwinvar(winnr, '&scrollbind', 0) + if !&l:scrollbind + call setwinvar(winnr, '&scrollbind', 0) + elseif winnr != winnr() && getwinvar(winnr, '&foldenable') + call setwinvar(winnr, '&foldenable', 0) + call add(restore, 'call setwinvar(bufwinnr('.winbufnr(winnr).'),"&foldenable",1)') + endif endif - if exists('+cursorbind') && getwinvar(winnr, '&cursorbind') + if exists('+cursorbind') && !&l:cursorbind && getwinvar(winnr, '&cursorbind') call setwinvar(winnr, '&cursorbind', 0) endif if s:BlameBufnr(winbufnr(winnr)) > 0 execute winbufnr(winnr).'bdelete' endif endfor - let bufnr = bufnr('') - let temp_state.bufnr = bufnr - let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)' - if exists('+cursorbind') - let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&cursorbind",0)' + let restore_winnr = 'bufwinnr(' . bufnr . ')' + if !&l:scrollbind + call add(restore, 'call setwinvar(' . restore_winnr . ',"&scrollbind",0)') + endif + if exists('+cursorbind') && !&l:cursorbind + call add(restore, 'call setwinvar(' . restore_winnr . ',"&cursorbind",0)') endif if &l:wrap - let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&wrap",1)' + call add(restore, 'call setwinvar(' . restore_winnr . ',"&wrap",1)') endif if &l:foldenable - let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&foldenable",1)' + call add(restore, 'call setwinvar(' . restore_winnr . ',"&foldenable",1)') endif setlocal scrollbind nowrap nofoldenable if exists('+cursorbind') @@ -5184,7 +5384,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort let top = line('w0') + &scrolloff let current = line('.') exe 'silent keepalt' (a:bang ? s:Mods(mods) . 'split' : s:Mods(mods, 'leftabove') . 'vsplit') s:fnameescape(temp) - let w:fugitive_leave = restore + let w:fugitive_leave = join(restore, '|') execute top normal! zt execute current @@ -5278,7 +5478,8 @@ function! s:BlameJump(suffix, ...) abort let suffix = '' endif let offset = line('.') - line('w0') - let flags = get(s:TempState(), 'blame_flags', []) + let state = s:TempState() + let flags = get(state, 'blame_flags', []) if a:0 && a:1 if s:HasOpt(flags, '--reverse') call remove(flags, '--reverse') @@ -5297,30 +5498,28 @@ function! s:BlameJump(suffix, ...) abort execute 'Gedit' s:fnameescape(commit . suffix . ':' . path) execute lnum endif - if exists(':Gblame') - let my_bufnr = bufnr('') - if blame_bufnr < 0 - let blame_args = flags + [commit . suffix, '--', path] - let result = s:BlameSubcommand(0, 0, 0, 0, '', blame_args) - else - let blame_args = flags - let result = s:BlameSubcommand(-1, -1, 0, 0, '', blame_args) - endif - if bufnr('') == my_bufnr - return result - endif - execute result - execute lnum - let delta = line('.') - line('w0') - offset - if delta > 0 - execute 'normal! '.delta."\" - elseif delta < 0 - execute 'normal! '.(-delta)."\" - endif - keepjumps syncbind - redraw - echo ':Gblame' s:fnameescape(blame_args) + let my_bufnr = bufnr('') + if blame_bufnr < 0 + let blame_args = flags + [commit . suffix, '--', path] + let result = s:BlameSubcommand(0, 0, 0, 0, '', extend({'args': blame_args}, state.options, 'keep')) + else + let blame_args = flags + let result = s:BlameSubcommand(-1, -1, 0, 0, '', extend({'args': blame_args}, state.options, 'keep')) endif + if bufnr('') == my_bufnr + return result + endif + execute result + execute lnum + let delta = line('.') - line('w0') - offset + if delta > 0 + execute 'normal! '.delta."\" + elseif delta < 0 + execute 'normal! '.(-delta)."\" + endif + keepjumps syncbind + redraw + echo ':Git blame' s:fnameescape(blame_args) return '' endfunction @@ -5328,12 +5527,11 @@ let s:hash_colors = {} function! fugitive#BlameSyntax() abort let conceal = has('conceal') ? ' conceal' : '' - let config = fugitive#Config() let flags = get(s:TempState(), 'blame_flags', []) syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite syn match FugitiveblameHash "\%(^\^\=[?*]*\)\@<=\<\x\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite - if get(get(config, 'blame.blankboundary', ['x']), 0, 'x') =~# '^$\|^true$' || s:HasOpt(flags, '-b') + if s:HasOpt(flags, '-b') || FugitiveConfigGet('blame.blankBoundary') =~# '^1$\|^true$' syn match FugitiveblameBoundaryIgnore "^\^[*?]*\x\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite else syn match FugitiveblameBoundary "^\^" @@ -5409,10 +5607,10 @@ function! s:BlameFileType() abort if &modifiable return '' endif - call s:Map('n', '', ':help :Gblame', '') - call s:Map('n', 'g?', ':help :Gblame', '') + call s:Map('n', '', ':help :Git_blame', '') + call s:Map('n', 'g?', ':help :Git_blame', '') if mapcheck('q', 'n') =~# '^$\|bdelete' - call s:Map('n', 'q', ':exe BlameQuit()echohl WarningMsgecho ":Gblame q is deprecated in favor of gq"echohl NONE', '') + call s:Map('n', 'q', ':exe BlameQuit()echohl WarningMsgecho ":Git blame q is deprecated in favor of gq"echohl NONE', '') endif call s:Map('n', 'gq', ':exe BlameQuit()', '') call s:Map('n', '<2-LeftMouse>', ':exe BlameCommit("exe BlameLeave()edit")', '') @@ -5483,6 +5681,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let type = 'blob' endif let path = path[1:-1] + elseif full =~? '^\a\a\+:[\/][\/]' + let path = s:Slash(full) + let type = 'url' elseif empty(s:Tree(dir)) let path = '.git/' . full[strlen(dir)+1:-1] let type = '' @@ -5621,13 +5822,17 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo \ 'line1': line1, \ 'line2': line2} - let url = '' - for Handler in get(g:, 'fugitive_browse_handlers', []) - let url = call(Handler, [copy(opts)]) - if !empty(url) - break - endif - endfor + if type ==# 'url' + let url = path + else + let url = '' + for Handler in get(g:, 'fugitive_browse_handlers', []) + let url = call(Handler, [copy(opts)]) + if !empty(url) + break + endif + endfor + endif if empty(url) call s:throw("No Gbrowse handler installed for '".raw."'") @@ -5658,6 +5863,8 @@ endfunction " Section: Go to file +let s:ref_header = '\%(Merge\|Rebase\|Upstream\|Pull\|Push\)' + nnoremap : :=v:count ? v:count : '' function! fugitive#MapCfile(...) abort exe 'cnoremap ' (a:0 ? a:1 : 'fugitive#Cfile()') @@ -5678,7 +5885,7 @@ endfunction function! s:SquashArgument(...) abort if &filetype == 'fugitive' - let commit = matchstr(getline('.'), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze ') + let commit = matchstr(getline('.'), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze \|^' . s:ref_header . ': \zs\S\+') elseif has_key(s:temp_files, s:cpath(expand('%:p'))) let commit = matchstr(getline('.'), '\<\x\{4,\}\>') else @@ -5720,7 +5927,7 @@ endfunction function! fugitive#MapJumps(...) abort if !&modifiable if get(b:, 'fugitive_type', '') ==# 'blob' - let blame_map = 'Gblame=v:count ? " --reverse" : ""' + let blame_map = 'Git blame=v:count ? " --reverse" : ""' call s:Map('n', '<2-LeftMouse>', ':0,1' . blame_map, '') call s:Map('n', '', ':0,1' . blame_map, '') call s:Map('n', 'o', ':0,2' . blame_map, '') @@ -5780,73 +5987,73 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'gi', ":exe 'Gsplit' (v:count ? '.gitignore' : '.git/info/exclude')", '') call s:Map('x', 'gi', ":exe 'Gsplit' (v:count ? '.gitignore' : '.git/info/exclude')", '') - nnoremap c :Git commit - nnoremap c :Git commit - nnoremap cv :tab Git commit -v - nnoremap cv :tab Git commit -v - nnoremap ca :Gcommit --amend - nnoremap cc :Gcommit - nnoremap ce :Gcommit --amend --no-edit - nnoremap cw :Gcommit --amend --only - nnoremap cva :tab Gcommit -v --amend - nnoremap cvc :tab Gcommit -v - nnoremap cRa :Gcommit --reset-author --amend - nnoremap cRe :Gcommit --reset-author --amend --no-edit - nnoremap cRw :Gcommit --reset-author --amend --only - nnoremap cf :Gcommit --fixup==SquashArgument() - nnoremap cF :Grebase --autosquash=RebaseArgument()Gcommit --fixup==SquashArgument() - nnoremap cs :Gcommit --no-edit --squash==SquashArgument() - nnoremap cS :Grebase --autosquash=RebaseArgument()Gcommit --no-edit --squash==SquashArgument() - nnoremap cA :Gcommit --edit --squash==SquashArgument() - nnoremap c? :help fugitive_c + call s:Map('n', 'c', ':Git commit') + call s:Map('n', 'c', ':Git commit') + call s:Map('n', 'cv', ':tab Git commit -v') + call s:Map('n', 'cv', ':tab Git commit -v') + call s:Map('n', 'ca', ':Git commit --amend', '') + call s:Map('n', 'cc', ':Git commit', '') + call s:Map('n', 'ce', ':Git commit --amend --no-edit', '') + call s:Map('n', 'cw', ':Git commit --amend --only', '') + call s:Map('n', 'cva', ':tab Git commit -v --amend', '') + call s:Map('n', 'cvc', ':tab Git commit -v', '') + call s:Map('n', 'cRa', ':Git commit --reset-author --amend', '') + call s:Map('n', 'cRe', ':Git commit --reset-author --amend --no-edit', '') + call s:Map('n', 'cRw', ':Git commit --reset-author --amend --only', '') + call s:Map('n', 'cf', ':Git commit --fixup==SquashArgument()') + call s:Map('n', 'cF', ':Git -c sequence.editor=true rebase --interactive --autosquash=RebaseArgument()Git commit --fixup==SquashArgument()') + call s:Map('n', 'cs', ':Git commit --no-edit --squash==SquashArgument()') + call s:Map('n', 'cS', ':Git -c sequence.editor=true rebase --interactive --autosquash=RebaseArgument()Git commit --no-edit --squash==SquashArgument()') + call s:Map('n', 'cA', ':Git commit --edit --squash==SquashArgument()') + call s:Map('n', 'c?', ':help fugitive_c', '') - nnoremap cr :Git revert - nnoremap cr :Git revert - nnoremap crc :Grevert =SquashArgument() - nnoremap crn :Grevert --no-commit =SquashArgument() - nnoremap cr? :help fugitive_cr + call s:Map('n', 'cr', ':Git revert') + call s:Map('n', 'cr', ':Git revert') + call s:Map('n', 'crc', ':Git revert =SquashArgument()', '') + call s:Map('n', 'crn', ':Git revert --no-commit =SquashArgument()', '') + call s:Map('n', 'cr?', ':help fugitive_cr', '') - nnoremap cm :Git merge - nnoremap cm :Git merge - nnoremap cmt :Git mergetool - nnoremap cm? :help fugitive_cm + call s:Map('n', 'cm', ':Git merge') + call s:Map('n', 'cm', ':Git merge') + call s:Map('n', 'cmt', ':Git mergetool') + call s:Map('n', 'cm?', ':help fugitive_cm', '') - nnoremap cz :Git stash - nnoremap cz :Git stash - nnoremap cza :exe EchoExec(['stash', 'apply', '--quiet', '--index', 'stash@{' . v:count . '}']) - nnoremap czA :exe EchoExec(['stash', 'apply', '--quiet', 'stash@{' . v:count . '}']) - nnoremap czp :exe EchoExec(['stash', 'pop', '--quiet', '--index', 'stash@{' . v:count . '}']) - nnoremap czP :exe EchoExec(['stash', 'pop', '--quiet', 'stash@{' . v:count . '}']) - nnoremap czv :exe 'Gedit' fugitive#RevParse('stash@{' . v:count . '}') - nnoremap czw :exe EchoExec(['stash', '--keep-index'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : [])) - nnoremap czz :exe EchoExec(['stash'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : [])) - nnoremap cz? :help fugitive_cz + call s:Map('n', 'cz', ':Git stash') + call s:Map('n', 'cz', ':Git stash') + call s:Map('n', 'cza', ':Git stash apply --quiet --index stash@{=v:count}') + call s:Map('n', 'czA', ':Git stash apply --quiet stash@{=v:count}') + call s:Map('n', 'czp', ':Git stash pop --quiet --index stash@{=v:count}') + call s:Map('n', 'czP', ':Git stash pop --quiet stash@{=v:count}') + call s:Map('n', 'czv', ':exe "Gedit" fugitive#RevParse("stash@{" . v:count . "}")', '') + call s:Map('n', 'czw', ':Git stash --keep-index=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""') + call s:Map('n', 'czz', ':Git stash =v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""') + call s:Map('n', 'cz?', ':help fugitive_cz', '') - nnoremap co :Git checkout - nnoremap co :Git checkout - nnoremap coo :exe EchoExec(['checkout'] + split(SquashArgument()) + ['--']) - nnoremap co? :help fugitive_co + call s:Map('n', 'co', ':Git checkout') + call s:Map('n', 'co', ':Git checkout') + call s:Map('n', 'coo', ':Git checkout =SquashArgument() --') + call s:Map('n', 'co?', ':help fugitive_co', '') - nnoremap cb :Git branch - nnoremap cb :Git branch - nnoremap cb? :help fugitive_cb + call s:Map('n', 'cb', ':Git branch') + call s:Map('n', 'cb', ':Git branch') + call s:Map('n', 'cb?', ':help fugitive_cb', '') - nnoremap r :Git rebase - nnoremap r :Git rebase - nnoremap ri :Grebase --interactive=RebaseArgument() - nnoremap rf :Grebase --autosquash=RebaseArgument() - nnoremap ru :Grebase --interactive @{upstream} - nnoremap rp :Grebase --interactive @{push} - nnoremap rw :Grebase --interactive=RebaseArgument()s/^pick/reword/e - nnoremap rm :Grebase --interactive=RebaseArgument()s/^pick/edit/e - nnoremap rd :Grebase --interactive=RebaseArgument()s/^pick/drop/e - nnoremap rk :Grebase --interactive=RebaseArgument()s/^pick/drop/e - nnoremap rx :Grebase --interactive=RebaseArgument()s/^pick/drop/e - nnoremap rr :Grebase --continue - nnoremap rs :Grebase --skip - nnoremap re :Grebase --edit-todo - nnoremap ra :Grebase --abort - nnoremap r? :help fugitive_r + call s:Map('n', 'r', ':Git rebase') + call s:Map('n', 'r', ':Git rebase') + call s:Map('n', 'ri', ':Git rebase --interactive=RebaseArgument()', '') + call s:Map('n', 'rf', ':Git -c sequence.editor=true rebase --interactive --autosquash=RebaseArgument()', '') + call s:Map('n', 'ru', ':Git rebase --interactive @{upstream}', '') + call s:Map('n', 'rp', ':Git rebase --interactive @{push}', '') + call s:Map('n', 'rw', ':Git rebase --interactive=RebaseArgument()s/^pick/reword/e', '') + call s:Map('n', 'rm', ':Git rebase --interactive=RebaseArgument()s/^pick/edit/e', '') + call s:Map('n', 'rd', ':Git rebase --interactive=RebaseArgument()s/^pick/drop/e', '') + call s:Map('n', 'rk', ':Git rebase --interactive=RebaseArgument()s/^pick/drop/e', '') + call s:Map('n', 'rx', ':Git rebase --interactive=RebaseArgument()s/^pick/drop/e', '') + call s:Map('n', 'rr', ':Git rebase --continue', '') + call s:Map('n', 'rs', ':Git rebase --skip', '') + call s:Map('n', 're', ':Git rebase --edit-todo', '') + call s:Map('n', 'ra', ':Git rebase --abort', '') + call s:Map('n', 'r?', ':help fugitive_r', '') call s:Map('n', '.', ": =fnameescape(fugitive#Real(@%))") call s:Map('x', '.', ": =fnameescape(fugitive#Real(@%))") @@ -5872,7 +6079,7 @@ function! s:StatusCfile(...) abort return [lead . info.relative[0]] elseif len(info.commit) return [info.commit] - elseif line =~# '^\%(Head\|Merge\|Rebase\|Upstream\|Pull\|Push\): ' + elseif line =~# '^' . s:ref_header . ': \|^Head: ' return [matchstr(line, ' \zs.*')] else return [''] diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index efb4425a..e950a310 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -25,19 +25,22 @@ that are part of Git repositories). resume running the command. A few Git subcommands have different behavior; these are documented below. -:Git! {args} Run an arbitrary git command, capture output to a temp -:Git --paginate {args} file, and |:split| that temp file. Use :0Git to -:Git -p {args} |:edit| the temp file instead. A temp file is always - used for diff and log commands. + *:Git_--paginate* *:Git_-p* +:Git --paginate {args} Run an arbitrary git command, capture output to a temp +:Git -p {args} file, and |:split| that temp file. Use :0Git to +:G --paginate {args} |:edit| the temp file instead. A temp file is always +:G -p {args} used for commands like diff and log that typically + user a pager, and for any command that has the + pager. Git configuration option set. - *:Gstatus* -:Git Bring up a summary window vaguely akin to git-status. -:G Press g? or see |fugitive-maps| for usage. -:Gstatus + *fugitive-summary* +:Git With no arguments, bring up a summary window vaguely +:G akin to git-status. Press g? or see |fugitive-maps| + for usage. - *:Git-blame* *:Gblame* + *:Git_blame* :Git blame [flags] Run git-blame [flags] on the current file and open the -:Gblame [flags] results in a scroll-bound vertical split. The + results in a scroll-bound vertical split. The following maps, which work on the cursor line commit where sensible, are provided: @@ -56,20 +59,12 @@ that are part of Git repositories). ~ reblame at [count]th first grandparent P reblame at [count]th parent (like HEAD^[count]) -:[range]Gblame [flags] If a range is given, just that part of the file will -:Gblame [flags] {file} be blamed, and a horizontal split without -:Git blame ... scrollbinding is used. You can also give an arbitrary +:[range]Git blame [...] If a range is given, just that part of the file will +:Git blame [...] {file} be blamed, and a horizontal split without + scrollbinding is used. You can also give an arbitrary filename. - *:Ggrep* *:Gcgrep* *:Git-grep* -:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'. -:Git[!] grep [args] - - *:Glgrep* -:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. -:0Git[!] grep [args] - - *:Git-difftool* + *:Git_difftool* :Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the quickfix list. Each changed hunk gets a separate quickfix entry unless you pass an option like @@ -77,42 +72,32 @@ that are part of Git repositories). change unless [!] is given. :Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a - new tab, and invoke `:Gdiffsplit!` against the + new tab, and invoke |:Gdiffsplit!| against the appropriate commit. - *:Git-mergetool* -:Git mergetool [args] Like |:Git-difftool|, but target merge conflicts. + *:Git_mergetool* +:Git mergetool [args] Like |:Git_difftool|, but target merge conflicts. - *:Git-push* *:Gpush* + *:Git_push* :Git push [args] Invoke git-push, load the results into the |quickfix| -:Gpush [args] list, and invoke |:cwindow| to reveal any errors. + list, and invoke |:cwindow| to reveal any errors. |:Dispatch| is used if available for asynchronous invocation. - *:Git-fetch* *:Gfetch* -:Git fetch [args] Like |:Gpush|, but for git-fetch. -:Gfetch [args] + *:Git_fetch* +:Git fetch [args] Like |:Git_push|, but for git-fetch. - *:Git-merge* *:Gmerge* -:Gmerge [args] Deprecated alias for |:Git| merge. Use |:Git-mergetool| - to get the old behavior of loading merge conflicts - into the quickfix list. + *:Ggrep* *:Gcgrep* *:Git_grep* +:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'. +:Git[!] grep [args] - *:Git-pull* *:Gpull* -:Gpull [args] Deprecated alias for |:Git| pull. + *:Glgrep* +:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'. +:0Git[!] grep [args] - *:Git-rebase* *:Grebase* -:Grebase [args] Deprecated alias for |:Git| rebase. - - *:Git-commit* *:Gcommit* -:Gcommit [args] Deprecated alias for |:Git| commit. - - *:Git-revert* *:Grevert* -:Grevert [args] Deprecated alias for |:Git| revert. - - *:Gclog* *:Glog* + *:Gclog* :Gclog[!] [args] Use git-log [args] to load the commit history into the -:Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!] + |quickfix| list. Jumps to the first commit unless [!] is given. :{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given @@ -146,13 +131,6 @@ that are part of Git repositories). *:Gpedit* :Gpedit [object] |:pedit| a |fugitive-object|. -:Gsplit! [args] *:Gsplit!* *:Gvsplit!* -:Gvsplit! [args] *:Gtabedit!* *:Gpedit!* -:Gtabedit! [args] Capture the output of `git [args]` to a temp file and -:Gpedit! [args] open it in a split, tab, or preview window. Use - :0Gsplit! to suppress the split and open it in the - current window. - *:Gread* *fugitive-:Gr* :Gread [object] Empty the buffer and |:read| a |fugitive-object|. When the argument is omitted, this is similar to @@ -210,28 +188,28 @@ that are part of Git repositories). *:Gvdiffsplit* :Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically. - *:Ghdiffsplit* *:Gsdiff* + *:Ghdiffsplit* :Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally. - *:Gmove* -:Gmove {destination} Wrapper around git-mv that renames the buffer + *:GMove* +:GMove {destination} Wrapper around git-mv that renames the buffer afterward. Add a ! to pass -f. - *:Grename* -:Grename {destination} Like |:Gmove| but operates relative to the parent + *:GRename* +:GRename {destination} Like |:GMove| but operates relative to the parent directory of the current file. - *:Gdelete* -:Gdelete Wrapper around git-rm that deletes the buffer + *:GDelete* +:GDelete Wrapper around git-rm that deletes the buffer afterward. When invoked in an index file, --cached is passed. Add a ! to pass -f and forcefully discard the buffer. - *:Gremove* -:Gremove Like :Gdelete, but keep the (now empty) buffer around. + *:GRemove* +:GRemove Like |:GDelete|, but keep the (now empty) buffer around. - *:Gbrowse* -:Gbrowse Open the current file, blob, tree, commit, or tag + *:GBrowse* +:GBrowse Open the current file, blob, tree, commit, or tag in your browser at the upstream hosting provider. If a range is given, it is appropriately appended to the URL as an anchor. @@ -241,27 +219,27 @@ that are part of Git repositories). supported by installing rhubarb.vim, available at . -:Gbrowse {object} Like :Gbrowse, but for a given |fugitive-object|. +:GBrowse {object} Like :GBrowse, but for a given |fugitive-object|. -:Gbrowse [...]@{remote} Force using the given remote rather than the remote +:GBrowse [...]@{remote} Force using the given remote rather than the remote for the current branch. The remote is used to determine which upstream repository to link to. -:{range}Gbrowse [args] Appends an anchor to the URL that emphasizes the +:{range}GBrowse [args] Appends an anchor to the URL that emphasizes the selected lines. This also forces the URL to include a commit rather than a branch name so it remains valid if the file changes. You can give a range of "0" to force this behavior without including an anchor. -:[range]Gbrowse! [args] Like :Gbrowse, but put the URL on the clipboard rather +:[range]GBrowse! [args] Like :GBrowse, but put the URL on the clipboard rather than opening it. MAPS *fugitive-maps* -These maps are available in both the |:Gstatus| buffer and Fugitive object -buffers, although not all maps make sense in all buffers. Mappings that -operate on the file or hunk under the cursor are generally available in visual -mode to operate on multiple files or partial hunks. +These maps are available in both the |fugitive-summary| buffer and Fugitive +object buffers, although not all maps make sense in all buffers. Mappings +that operate on the file or hunk under the cursor are generally available in +visual mode to operate on multiple files or partial hunks. *fugitive-staging-maps* Staging/unstaging maps ~ @@ -407,7 +385,7 @@ i Jump to the next file or hunk, expanding inline diffs ][ Jump [count] section ends forward. *fugitive_star* -* One the first column of a + or - diff line, search for +* On the first column of a + or - diff line, search for the corresponding - or + line. Otherwise, defer to built-in |star|. @@ -502,7 +480,7 @@ czz Push stash. Pass a [count] of 1 to add `--include-untracked` or 2 to add `--all`. czw Push stash of worktree. Like `czz` with - `--include-index`. + `--keep-index`. czA Apply topmost stash, or stash@{count}. @@ -611,7 +589,7 @@ Makefile The file named Makefile in the work tree !:Makefile The file named Makefile in the commit owning the current file !3^2 The second parent of the commit owning buffer #3 .git/config The repo config file -: Same as |:Gstatus| +: The |fugitive-summary| buffer. STATUSLINE *fugitive-statusline* @@ -628,6 +606,39 @@ HEAD is detached, FugitiveHead() will return the empty string, unless the optional argument is given, in which case the hash of the current commit will be truncated to the given number of characters. +DEPRECATIONS *fugitive-deprecated* + +The following commands are softly deprecated in favor of replacements that +adhere to a new naming scheme. They will eventually be removed, but probably +not in the near future. + +Remember that |:Git| can be shortened to |:G|, so replacements using it are +just one space character longer than the legacy version. + +*:Gremove* Superseded by |:GRemove|. +*:Gdelete* Superseded by |:GDelete|. +*:Gmove* Superseded by |:GMove|. +*:Grename* Superseded by |:GRename|. +*:Gbrowse* Superseded by |:GBrowse|. +*:Gdiff* Superseded by |:Gdiffsplit| +*:Gsdiff* Superseded by |:Ghdiffsplit| +*:Gvdiff* Superseded by |:Gvdiffsplit| or |:vert| |:Gdiffsplit|. +*:Gblame* Superseded by |:Git_blame|. +*:Gcommit* Superseded by |:Git| commit. +*:Gmerge* Superseded by |:Git| merge and |:Git_mergetool|. +*:Gpull* Superseded by |:Git| pull. +*:Grebase* Superseded by |:Git| rebase. +*:Grevert* Superseded by |:Git| revert. +*:Gpush* Superseded by |:Git_push|. +*:Gfetch* Superseded by |:Git_fetch|. +*:Glog* Superseded by |:Gclog|. +*:Gstatus* Superseded by |:Git| (with no arguments). +*:Git!* Superseded by |:Git_--paginate|. +*:Gsplit!* Superseded by |:Git_--paginate|. +*:Gvsplit!* Superseded by :vert Git --paginate. +*:Gtabsplit!* Superseded by :tab Git --paginate. +*:Gpedit!* Superseded by :Git! --paginate. + ABOUT *fugitive-about* Grab the latest version or report a bug on GitHub: diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index a1e66fb6..2b9e4d90 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -420,30 +420,32 @@ let s:addr_other = has('patch-8.1.560') ? '-addr=other' : '' let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : '' let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : '' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", )' +command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", ) +command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", ) -exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(, , +"", 0, "", )' +if exists(':Gstatus') !=# 2 + exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(, , +"", 0, "", )' +endif -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#CommitComplete Gcommit exe fugitive#Command(, , +"", 0, "", "commit " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RevertComplete Grevert exe fugitive#Command(, , +"", 0, "", "revert " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#MergeComplete Gmerge exe fugitive#Command(, , +"", 0, "", "merge " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RebaseComplete Grebase exe fugitive#Command(, , +"", 0, "", "rebase " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PullComplete Gpull exe fugitive#Command(, , +"", 0, "", "pull " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PushComplete Gpush exe fugitive#Command(, , +"", 0, "", "push " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#FetchComplete Gfetch exe fugitive#Command(, , +"", 0, "", "fetch " . )' -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#BlameComplete Gblame exe fugitive#Command(, , +"", 0, "", "blame " . )' +for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame'] + if exists(':G' . tolower(s:cmd)) != 2 + exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd) 'exe fugitive#Command(, , +"", 0, "", "' . tolower(s:cmd) . ' " . )' + endif +endfor +unlet s:cmd exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(, 0)" exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(, 1)" -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#Command(, , +"", 0, "", "grep " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#Command(, , +"", 0, "", "grep " . )' -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#Command(0, > 0 ? : 0, +"", 0, "", "grep " . )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(, , +"", 0, "", )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(, , +"", 0, "", )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, > 0 ? : 0, +"", 0, "", )' exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(,,+"",0,"",, "")' exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(,,+"",0,"",, "c")' +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(,,+"",0,"",, "c")' exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(,,+"",0,"",, "l")' +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(,,+"",0,"",, "l")' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit", 0, "", , [])' @@ -465,12 +467,27 @@ exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(, , +"", 0, "", , [])' exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( , , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( , , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( , , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(, , +"", 0, "", , [])' +if exists(':Gremove') != 2 + exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' +endif +if exists(':Gdelete') != 2 + exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' +endif +if exists(':Gmove') != 2 + exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( , , +"", 0, "", , [])' +endif +if exists(':Grename') != 2 + exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(, , +"", 0, "", , [])' +endif -exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' +if exists(':Gbrowse') != 2 + exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' +endif if get(g:, 'fugitive_no_maps') finish diff --git a/sources_non_forked/vim-gist/.github/FUNDING.yml b/sources_non_forked/vim-gist/.github/FUNDING.yml new file mode 100644 index 00000000..351ae11a --- /dev/null +++ b/sources_non_forked/vim-gist/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: mattn # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/sources_non_forked/vim-gist/README.md b/sources_non_forked/vim-gist/README.md new file mode 100644 index 00000000..f2df1bb7 --- /dev/null +++ b/sources_non_forked/vim-gist/README.md @@ -0,0 +1,281 @@ +# Gist.vim + +This is a vimscript for creating gists (http://gist.github.com). + +For the latest version please see https://github.com/mattn/vim-gist. + +## Usage: + +- Post current buffer to gist, using default privacy option. + + :Gist + +- Post selected text to gist, using default privacy option. + This applies to all permutations listed below (except multi). + + :'<,'>Gist + +- Create a private gist. + + :Gist -p + +- Create a public gist. + (Only relevant if you've set gists to be private by default.) + + :Gist -P + +> This is only relevant if you've set gists to be private by default; +> if you get an empty gist list, try ":Gist --abandon". + +- Create a gist anonymously. + + :Gist -a + +- Create a gist with all open buffers. + + :Gist -m + +- Edit the gist (you need to have opened the gist buffer first). + You can update the gist with the ":w" command within the gist buffer. + + :Gist -e + +- Edit the gist with name 'foo.js' (you need to have opened the gist buffer + first). + + :Gist -e foo.js + +- Post/Edit with the description " (you need to have opened the gist buffer + first). > + + :Gist -s something + :Gist -e -s something + +- Delete the gist (you need to have opened the gist buffer first). + Password authentication is needed. + + :Gist -d + +- Fork the gist (you need to have opened the gist buffer first). + Password authentication is needed. + + :Gist -f + +- Star the gist (you need to have opened the gist buffer first). + Password authentication is needed. + + :Gist +1 + +- Unstar the gist (you need to have opened the gist buffer first). + Password authentication is needed. + + :Gist -1 + +- Get gist XXXXX. + + :Gist XXXXX + +- Get gist XXXXX and add to clipboard. + + :Gist -c XXXXX + +- List your public gists. + + :Gist -l + +- List gists from user "mattn". + + :Gist -l mattn + +- List everyone's gists. + + :Gist -la + +- List gists from your starred gists. + + :Gist -ls + +- Open the gist on browser after you post or update it. + + :Gist -b + +## List Feature + +- Useful mappings on the gist-listing buffer: + - Both `o` or `Enter` open the gist file in a new buffer, and close the + vim-gist listing one. + - `b` opens the gist file in a browser; this is necessary because + `Shift-Enter` (as was originally) only works for GUI vim. + - `y` copies the contents of the selected gist to the clipboard, and + closes the vim-gist buffer. + - `p` pastes the contents of the selected gist to the buffer from where + vim-gist was called, and closes the vim-gist buffer. + - Hitting `Escape` or `Tab` at the vim-gist buffer closes it. + +- Gist listing has fixed-length columns now, more amenable to eye inspection. + Every line on the gist-listing buffer contains the gist id, name and + description, in that order. Columns are now padded and truncated to offer a + faster browsing, in the following way: + - The gist id string is fixed at 32 characters. + - The length (in characters) of the name of the gist is fixed and + can be set by the user using, for example: + + `let g:gistvim_namelength = 20` + + The default value for `gistvim_namelength` is 30. If the gist (file)name + exceeds that length, it is truncated to the specified length. + - Finally, the gist description is truncated in length to fit the remaining + of the line, avoiding wrapped lines that mess up the table layout. + - Note that the gist listing buffer now does not show the field 'code' + (not sure what that did in the first place). + +## Tips: + +If you set g:gist_clip_command, gist.vim will copy the gist code with option +'-c'. + +- Mac: + + let g:gist_clip_command = 'pbcopy' + +- Linux: + + let g:gist_clip_command = 'xclip -selection clipboard' + +- Others (cygwin?): + + let g:gist_clip_command = 'putclip' + +If you want to detect filetype from the filename: + + let g:gist_detect_filetype = 1 + +If you want to open browser after the post: + + let g:gist_open_browser_after_post = 1 + +If you want to change the browser: + + let g:gist_browser_command = 'w3m %URL%' + +or: + + let g:gist_browser_command = 'opera %URL% &' + +On windows, this should work with your user settings. + +If you want to show your private gists with ":Gist -l": + + let g:gist_show_privates = 1 + +If you want your gist to be private by default: + + let g:gist_post_private = 1 + +If you want your gist to be anonymous by default: + + let g:gist_post_anonymous = 1 + +If you want to manipulate multiple files in a gist: + + let g:gist_get_multiplefile = 1 + +If you want to use on GitHub Enterprise: + + let g:gist_api_url = 'http://your-github-enterprise-domain/api/v3' + +You need to either set global git config: + + $ git config --global github.user Username + +## License: + + Copyright 2010 by Yasuhiro Matsumoto + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + + +## Install: + +Copy it to your plugin directory. +gist.vim will create a curl cookie-jar file in your runtimepath. + +- rtp: + - autoload/gist.vim + - plugin/gist.vim + +If you want to uninstall gist.vim, remember to also remove `~/.gist-vim`. + +You need to install webapi-vim also: + + http://www.vim.org/scripts/script.php?script_id=4019 + +If you want to use latest one: + + https://github.com/mattn/webapi-vim + +### Install with [Vundle](https://github.com/gmarik/vundle) + +Add the following lines to your `.vimrc`. + + Bundle 'mattn/webapi-vim' + Bundle 'mattn/vim-gist' + +Now restart Vim and run `:BundleInstall`. + +### Install with [NeoBundle](https://github.com/Shougo/neobundle.vim) + +Add the following line to your `.vimrc`. + + NeoBundle 'mattn/vim-gist', {'depends': 'mattn/webapi-vim'} + +## Requirements: + +- curl command (http://curl.haxx.se/) +- webapi-vim (https://github.com/mattn/webapi-vim) +- and if you want to use your git profile, the git command-line client. + +## Setup: + +This plugin supports both basic and two-factor authentication using GitHub +API v3. The plugin stores its credentials in `~/.gist-vim`. + +First, you need to set your GitHub username in git's global configuration: + + $ git config --global github.user + +Then vim-gist will ask for your password in order to create an access +token. If you have two-factor authentication enabled, vim-gist will also +prompt you to enter the two-factor key you receive. + +NOTE: +If you want you can set it directly to `g:github_user` and `g:gist_token`. + +Whichever type of authentication you use, your GitHub password will not be +stored, only a OAuth access token produced specifically for vim-gist. The +token is stored in `~/.gist-vim`. If you stop using the plugin, you can +easily remove this file. To revoke the associated GitHub token, go to the +list of ["Authorized applications" on GitHub's "Account Settings" +page][uas]. + +[uas]: https://github.com/settings/applications + +**Note:** the username is optional if you only send anonymous gists. diff --git a/sources_non_forked/vim-gist/autoload/gist.vim b/sources_non_forked/vim-gist/autoload/gist.vim new file mode 100644 index 00000000..7f803c6c --- /dev/null +++ b/sources_non_forked/vim-gist/autoload/gist.vim @@ -0,0 +1,1165 @@ +"============================================================================= +" File: gist.vim +" Author: Yasuhiro Matsumoto +" Last Change: 10-Oct-2016. +" Version: 7.3 +" WebPage: http://github.com/mattn/vim-gist +" License: BSD + +let s:save_cpo = &cpoptions +set cpoptions&vim + +if exists('g:gist_disabled') && g:gist_disabled == 1 + function! gist#Gist(...) abort + endfunction + finish +endif + +if !exists('g:github_user') && !executable('git') + echohl ErrorMsg | echomsg 'Gist: require ''git'' command' | echohl None + finish +endif + +if !executable('curl') + echohl ErrorMsg | echomsg 'Gist: require ''curl'' command' | echohl None + finish +endif + +if globpath(&rtp, 'autoload/webapi/http.vim') ==# '' + echohl ErrorMsg | echomsg 'Gist: require ''webapi'', install https://github.com/mattn/webapi-vim' | echohl None + finish +else + call webapi#json#true() +endif + +let s:gist_token_file = expand(get(g:, 'gist_token_file', '~/.gist-vim')) +let s:system = function(get(g:, 'webapi#system_function', 'system')) + +if !exists('g:github_user') + let g:github_user = substitute(s:system('git config --get github.user'), "\n", '', '') + if strlen(g:github_user) == 0 + let g:github_user = $GITHUB_USER + end +endif + +if !exists('g:gist_api_url') + let g:gist_api_url = substitute(s:system('git config --get github.apiurl'), "\n", '', '') + if strlen(g:gist_api_url) == 0 + let g:gist_api_url = 'https://api.github.com/' + end + if exists('g:github_api_url') && !exists('g:gist_shutup_issue154') + if matchstr(g:gist_api_url, 'https\?://\zs[^/]\+\ze') != matchstr(g:github_api_url, 'https\?://\zs[^/]\+\ze') + echohl WarningMsg + echo '--- Warning ---' + echo 'It seems that you set different URIs for github_api_url/gist_api_url.' + echo 'If you want to remove this message: let g:gist_shutup_issue154 = 1' + echohl None + if confirm('Continue?', '&Yes\n&No') != 1 + let g:gist_disabled = 1 + finish + endif + redraw! + endif + endif +endif +if g:gist_api_url !~# '/$' + let g:gist_api_url .= '/' +endif + +if !exists('g:gist_update_on_write') + let g:gist_update_on_write = 1 +endif + +function! s:get_browser_command() abort + let gist_browser_command = get(g:, 'gist_browser_command', '') + if gist_browser_command ==# '' + if has('win32') || has('win64') + let gist_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' + elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin' + let gist_browser_command = 'open %URL%' + elseif executable('xdg-open') + let gist_browser_command = 'xdg-open %URL%' + elseif executable('firefox') + let gist_browser_command = 'firefox %URL% &' + else + let gist_browser_command = '' + endif + endif + return gist_browser_command +endfunction + +function! s:open_browser(url) abort + let cmd = s:get_browser_command() + if len(cmd) == 0 + redraw + echohl WarningMsg + echo 'It seems that you don''t have general web browser. Open URL below.' + echohl None + echo a:url + return + endif + let quote = &shellxquote == '"' ? "'" : '"' + if cmd =~# '^!' + let cmd = substitute(cmd, '%URL%', '\=quote.a:url.quote', 'g') + silent! exec cmd + elseif cmd =~# '^:[A-Z]' + let cmd = substitute(cmd, '%URL%', '\=a:url', 'g') + exec cmd + else + let cmd = substitute(cmd, '%URL%', '\=quote.a:url.quote', 'g') + call system(cmd) + endif +endfunction + +function! s:shellwords(str) abort + let words = split(a:str, '\%(\([^ \t\''"]\+\)\|''\([^\'']*\)''\|"\(\%([^\"\\]\|\\.\)*\)"\)\zs\s*\ze') + let words = map(words, 'substitute(v:val, ''\\\([\\ ]\)'', ''\1'', "g")') + let words = map(words, 'matchstr(v:val, ''^\%\("\zs\(.*\)\ze"\|''''\zs\(.*\)\ze''''\|.*\)$'')') + return words +endfunction + +function! s:truncate(str, num) + let mx_first = '^\(.\)\(.*\)$' + let str = a:str + let ret = '' + let width = 0 + while 1 + let char = substitute(str, mx_first, '\1', '') + let cells = strdisplaywidth(char) + if cells == 0 || width + cells > a:num + break + endif + let width = width + cells + let ret .= char + let str = substitute(str, mx_first, '\2', '') + endwhile + while width + 1 <= a:num + let ret .= " " + let width = width + 1 + endwhile + return ret +endfunction + +function! s:format_gist(gist) abort + let files = sort(keys(a:gist.files)) + if empty(files) + return '' + endif + let file = a:gist.files[files[0]] + let name = file.filename + if has_key(file, 'content') + let code = file.content + let code = "\n".join(map(split(code, "\n"), '" ".v:val'), "\n") + else + let code = '' + endif + let desc = type(a:gist.description)==0 || a:gist.description ==# '' ? '' : a:gist.description + let name = substitute(name, '[\r\n\t]', ' ', 'g') + let name = substitute(name, ' ', ' ', 'g') + let desc = substitute(desc, '[\r\n\t]', ' ', 'g') + let desc = substitute(desc, ' ', ' ', 'g') + " Display a nice formatted (and truncated if needed) table of gists on screen + " Calculate field lengths for gist-listing formatting on screen + redir =>a |exe "sil sign place buffer=".bufnr('')|redir end + let signlist = split(a, '\n') + let width = winwidth(0) - ((&number||&relativenumber) ? &numberwidth : 0) - &foldcolumn - (len(signlist) > 2 ? 2 : 0) + let idlen = 33 + let namelen = get(g:, 'gist_namelength', 30) + let desclen = width - (idlen + namelen + 10) + return printf('gist: %s %s %s', s:truncate(a:gist.id, idlen), s:truncate(name, namelen), s:truncate(desc, desclen)) +endfunction + +" Note: A colon in the file name has side effects on Windows due to NTFS Alternate Data Streams; avoid it. +let s:bufprefix = 'gist' . (has('unix') ? ':' : '_') +function! s:GistList(gistls, page) abort + if a:gistls ==# '-all' + let url = g:gist_api_url.'gists/public' + elseif get(g:, 'gist_show_privates', 0) && a:gistls ==# 'starred' + let url = g:gist_api_url.'gists/starred' + elseif get(g:, 'gist_show_privates') && a:gistls ==# 'mine' + let url = g:gist_api_url.'gists' + else + let url = g:gist_api_url.'users/'.a:gistls.'/gists' + endif + let winnum = bufwinnr(bufnr(s:bufprefix.a:gistls)) + if winnum != -1 + if winnum != bufwinnr('%') + exe winnum 'wincmd w' + endif + setlocal modifiable + else + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd vsplit +set\ winfixwidth ' s:bufprefix.a:gistls + elseif get(g:, 'gist_list_rightbelow', 0) + exec 'silent noautocmd rightbelow 5 split +set\ winfixheight ' s:bufprefix.a:gistls + else + exec 'silent noautocmd split' s:bufprefix.a:gistls + endif + endif + if a:page > 1 + let oldlines = getline(0, line('$')) + let url = url . '?page=' . a:page + endif + + setlocal modifiable + let old_undolevels = &undolevels + let oldlines = [] + silent %d _ + + redraw | echon 'Listing gists... ' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + bw! + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let res = webapi#http#get(url, '', { "Authorization": auth }) + if v:shell_error != 0 + bw! + redraw + echohl ErrorMsg | echomsg 'Gists not found' | echohl None + return + endif + let content = webapi#json#decode(res.content) + if type(content) == 4 && has_key(content, 'message') && len(content.message) + bw! + redraw + echohl ErrorMsg | echomsg content.message | echohl None + if content.message ==# 'Bad credentials' + call delete(s:gist_token_file) + endif + return + endif + + let lines = map(filter(content, '!empty(v:val.files)'), 's:format_gist(v:val)') + call setline(1, split(join(lines, "\n"), "\n")) + + $put='more...' + + let b:gistls = a:gistls + let b:page = a:page + setlocal buftype=nofile bufhidden=hide noswapfile + setlocal cursorline + setlocal nomodified + setlocal nomodifiable + syntax match SpecialKey /^gist:/he=e-1 + syntax match Title /^gist: \S\+/hs=s+5 contains=ALL + nnoremap :call GistListAction(0) + nnoremap o :call GistListAction(0) + nnoremap b :call GistListAction(1) + nnoremap y :call GistListAction(2) + nnoremap p :call GistListAction(3) + nnoremap :bw + nnoremap :call GistListAction(1) + + cal cursor(1+len(oldlines),1) + nohlsearch + redraw | echo '' +endfunction + +function! gist#list_recursively(user, ...) abort + let use_cache = get(a:000, 0, 1) + let limit = get(a:000, 1, -1) + let verbose = get(a:000, 2, 1) + if a:user ==# 'mine' + let url = g:gist_api_url . 'gists' + elseif a:user ==# 'starred' + let url = g:gist_api_url . 'gists/starred' + else + let url = g:gist_api_url.'users/'.a:user.'/gists' + endif + + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + " anonymous user cannot get gists to prevent infinite recursive loading + return [] + endif + + if use_cache && exists('g:gist_list_recursively_cache') + if has_key(g:gist_list_recursively_cache, a:user) + return webapi#json#decode(g:gist_list_recursively_cache[a:user]) + endif + endif + + let page = 1 + let gists = [] + let lastpage = -1 + + function! s:get_lastpage(res) abort + let links = split(a:res.header[match(a:res.header, 'Link')], ',') + let link = links[match(links, 'rel=[''"]last[''"]')] + let page = str2nr(matchlist(link, '\%(page=\)\(\d\+\)')[1]) + return page + endfunction + + if verbose > 0 + redraw | echon 'Loading gists...' + endif + + while limit == -1 || page <= limit + let res = webapi#http#get(url.'?page='.page, '', {'Authorization': auth}) + if limit == -1 + " update limit to the last page + let limit = s:get_lastpage(res) + endif + if verbose > 0 + redraw | echon 'Loading gists... ' . page . '/' . limit . ' pages has loaded.' + endif + let gists = gists + webapi#json#decode(res.content) + let page = page + 1 + endwhile + let g:gist_list_recursively_cache = get(g:, 'gist_list_recursively_cache', {}) + let g:gist_list_recursively_cache[a:user] = webapi#json#encode(gists) + return gists +endfunction + +function! gist#list(user, ...) abort + let page = get(a:000, 0, 0) + if a:user ==# '-all' + let url = g:gist_api_url.'gists/public' + elseif get(g:, 'gist_show_privates', 0) && a:user ==# 'starred' + let url = g:gist_api_url.'gists/starred' + elseif get(g:, 'gist_show_privates') && a:user ==# 'mine' + let url = g:gist_api_url.'gists' + else + let url = g:gist_api_url.'users/'.a:user.'/gists' + endif + + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return [] + endif + let res = webapi#http#get(url, '', { "Authorization": auth }) + return webapi#json#decode(res.content) +endfunction + +function! s:GistGetFileName(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return '' + endif + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let gist = webapi#json#decode(res.content) + if has_key(gist, 'files') + return sort(keys(gist.files))[0] + endif + return '' +endfunction + +function! s:GistDetectFiletype(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + return '' + endif + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let gist = webapi#json#decode(res.content) + let filename = sort(keys(gist.files))[0] + let ext = fnamemodify(filename, ':e') + if has_key(s:extmap, ext) + let type = s:extmap[ext] + else + let type = get(gist.files[filename], 'type', 'text') + endif + silent! exec 'setlocal ft='.tolower(type) +endfunction + +function! s:GistWrite(fname) abort + if substitute(a:fname, '\\', '/', 'g') == expand("%:p:gs@\\@/@") + if g:gist_update_on_write != 2 || v:cmdbang + Gist -e + else + echohl ErrorMsg | echomsg 'Please type ":w!" to update a gist.' | echohl None + endif + else + exe 'w'.(v:cmdbang ? '!' : '') fnameescape(v:cmdarg) fnameescape(a:fname) + silent! exe 'file' fnameescape(a:fname) + silent! au! BufWriteCmd + endif +endfunction + +function! s:GistGet(gistid, clipboard) abort + redraw | echon 'Getting gist... ' + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": s:GistGetAuthHeader() }) + if res.status =~# '^2' + try + let gist = webapi#json#decode(res.content) + catch + redraw + echohl ErrorMsg | echomsg 'Gist seems to be broken' | echohl None + return + endtry + if get(g:, 'gist_get_multiplefile', 0) != 0 + let num_file = len(keys(gist.files)) + else + let num_file = 1 + endif + redraw + if num_file > len(keys(gist.files)) + echohl ErrorMsg | echomsg 'Gist not found' | echohl None + return + endif + augroup GistWrite + au! + augroup END + for n in range(num_file) + try + let old_undolevels = &undolevels + let filename = sort(keys(gist.files))[n] + + let winnum = bufwinnr(bufnr(s:bufprefix.a:gistid.'/'.filename)) + if winnum != -1 + if winnum != bufwinnr('%') + exe winnum 'wincmd w' + endif + setlocal modifiable + else + if num_file == 1 + if get(g:, 'gist_edit_with_buffers', 0) + let found = -1 + for wnr in range(1, winnr('$')) + let bnr = winbufnr(wnr) + if bnr != -1 && !empty(getbufvar(bnr, 'gist')) + let found = wnr + break + endif + endfor + if found != -1 + exe found 'wincmd w' + setlocal modifiable + else + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd rightbelow vnew' + else + exec 'silent noautocmd rightbelow new' + endif + endif + else + silent only! + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd rightbelow vnew' + else + exec 'silent noautocmd rightbelow new' + endif + endif + else + if get(g:, 'gist_list_vsplit', 0) + exec 'silent noautocmd rightbelow vnew' + else + exec 'silent noautocmd rightbelow new' + endif + endif + setlocal noswapfile + silent exec 'noautocmd file' s:bufprefix.a:gistid.'/'.fnameescape(filename) + endif + set undolevels=-1 + filetype detect + silent %d _ + + let content = gist.files[filename].content + call setline(1, split(content, "\n")) + let b:gist = { + \ "filename": filename, + \ "id": gist.id, + \ "description": gist.description, + \ "private": gist.public =~ 'true', + \} + catch + let &undolevels = old_undolevels + bw! + redraw + echohl ErrorMsg | echomsg 'Gist contains binary' | echohl None + return + endtry + let &undolevels = old_undolevels + setlocal buftype=acwrite bufhidden=hide noswapfile + setlocal nomodified + doau StdinReadPost,BufRead,BufReadPost + let gist_detect_filetype = get(g:, 'gist_detect_filetype', 0) + if (&ft ==# '' && gist_detect_filetype == 1) || gist_detect_filetype == 2 + call s:GistDetectFiletype(a:gistid) + endif + if a:clipboard + if exists('g:gist_clip_command') + exec 'silent w !'.g:gist_clip_command + elseif has('clipboard') + silent! %yank + + else + %yank + endif + endif + 1 + augroup GistWrite + au! BufWriteCmd call s:GistWrite(expand("")) + augroup END + endfor + else + bw! + redraw + echohl ErrorMsg | echomsg 'Gist not found' | echohl None + return + endif +endfunction + +function! s:GistListAction(mode) abort + let line = getline('.') + let mx = '^gist:\s*\zs\(\w\+\)\ze.*' + if line =~# mx + let gistid = matchstr(line, mx) + if a:mode == 1 + call s:open_browser('https://gist.github.com/' . gistid) + elseif a:mode == 0 + call s:GistGet(gistid, 0) + wincmd w + bw + elseif a:mode == 2 + call s:GistGet(gistid, 1) + " TODO close with buffe rname + bdelete + bdelete + elseif a:mode == 3 + call s:GistGet(gistid, 1) + " TODO close with buffe rname + bdelete + bdelete + normal! "+p + endif + return + endif + if line =~# '^more\.\.\.$' + call s:GistList(b:gistls, b:page+1) + return + endif +endfunction + +function! s:GistUpdate(content, gistid, gistnm, desc) abort + let gist = { "id": a:gistid, "files" : {}, "description": "","public": function('webapi#json#true') } + if exists('b:gist') + if has_key(b:gist, 'filename') && len(a:gistnm) > 0 + let gist.files[b:gist.filename] = { "content": '', "filename": b:gist.filename } + let b:gist.filename = a:gistnm + endif + if has_key(b:gist, 'private') && b:gist.private | let gist['public'] = function('webapi#json#false') | endif + if has_key(b:gist, 'description') | let gist['description'] = b:gist.description | endif + if has_key(b:gist, 'filename') | let filename = b:gist.filename | endif + else + let filename = a:gistnm + if len(filename) == 0 | let filename = s:GistGetFileName(a:gistid) | endif + if len(filename) == 0 | let filename = s:get_current_filename(1) | endif + endif + + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + + " Update description + " If no new description specified, keep the old description + if a:desc !=# ' ' + let gist['description'] = a:desc + else + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + if res.status =~# '^2' + let old_gist = webapi#json#decode(res.content) + let gist['description'] = old_gist.description + endif + endif + + let gist.files[filename] = { "content": a:content, "filename": filename } + + redraw | echon 'Updating gist... ' + let res = webapi#http#post(g:gist_api_url.'gists/' . a:gistid, + \ webapi#json#encode(gist), { + \ "Authorization": auth, + \ "Content-Type": "application/json", + \}) + if res.status =~# '^2' + let obj = webapi#json#decode(res.content) + let loc = obj['html_url'] + let b:gist = {"id": a:gistid, "filename": filename} + setlocal nomodified + redraw | echomsg 'Done: '.loc + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None + endif + return loc +endfunction + +function! s:GistDelete(gistid) abort + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + + redraw | echon 'Deleting gist... ' + let res = webapi#http#post(g:gist_api_url.'gists/'.a:gistid, '', { + \ "Authorization": auth, + \ "Content-Type": "application/json", + \}, 'DELETE') + if res.status =~# '^2' + if exists('b:gist') + unlet b:gist + endif + redraw | echomsg 'Done: ' + else + echohl ErrorMsg | echomsg 'Delete failed: ' . res.message | echohl None + endif +endfunction + +function! s:get_current_filename(no) abort + let filename = expand('%:t') + if len(filename) == 0 && &ft !=# '' + let pair = filter(items(s:extmap), 'v:val[1] == &ft') + if len(pair) > 0 + let filename = printf('gistfile%d%s', a:no, pair[0][0]) + endif + endif + if filename ==# '' + let filename = printf('gistfile%d.txt', a:no) + endif + return filename +endfunction + +function! s:update_GistID(id) abort + let view = winsaveview() + normal! gg + let ret = 0 + if search('\:\s*$') + let line = getline('.') + let line = substitute(line, '\s\+$', '', 'g') + call setline('.', line . ' ' . a:id) + let ret = 1 + endif + call winrestview(view) + return ret +endfunction + +" GistPost function: +" Post new gist to github +" +" if there is an embedded gist url or gist id in your file, +" it will just update it. +" -- by c9s +" +" embedded gist id format: +" +" GistID: 123123 +" +function! s:GistPost(content, private, desc, anonymous) abort + let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + if a:desc !=# ' ' | let gist['description'] = a:desc | endif + if a:private | let gist['public'] = function('webapi#json#false') | endif + let filename = s:get_current_filename(1) + let gist.files[filename] = { "content": a:content, "filename": filename } + + let header = {"Content-Type": "application/json"} + if !a:anonymous + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let header['Authorization'] = auth + endif + + redraw | echon 'Posting it to gist... ' + let res = webapi#http#post(g:gist_api_url.'gists', webapi#json#encode(gist), header) + if res.status =~# '^2' + let obj = webapi#json#decode(res.content) + let loc = obj['html_url'] + let b:gist = { + \ "filename": filename, + \ "id": matchstr(loc, '[^/]\+$'), + \ "description": gist['description'], + \ "private": a:private, + \} + if s:update_GistID(b:gist['id']) + Gist -e + endif + redraw | echomsg 'Done: '.loc + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: '. res.message | echohl None + endif + return loc +endfunction + +function! s:GistPostBuffers(private, desc, anonymous) abort + let bufnrs = range(1, bufnr('$')) + let bn = bufnr('%') + let query = [] + + let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + if a:desc !=# ' ' | let gist['description'] = a:desc | endif + if a:private | let gist['public'] = function('webapi#json#false') | endif + + let index = 1 + for bufnr in bufnrs + if !bufexists(bufnr) || buflisted(bufnr) == 0 + continue + endif + echo 'Creating gist content'.index.'... ' + silent! exec 'buffer!' bufnr + let content = join(getline(1, line('$')), "\n") + let filename = s:get_current_filename(index) + let gist.files[filename] = { "content": content, "filename": filename } + let index = index + 1 + endfor + silent! exec 'buffer!' bn + + let header = {"Content-Type": "application/json"} + if !a:anonymous + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + redraw + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + endif + let header['Authorization'] = auth + endif + + redraw | echon 'Posting it to gist... ' + let res = webapi#http#post(g:gist_api_url.'gists', webapi#json#encode(gist), header) + if res.status =~# '^2' + let obj = webapi#json#decode(res.content) + let loc = obj['html_url'] + let b:gist = { + \ "filename": filename, + \ "id": matchstr(loc, '[^/]\+$'), + \ "description": gist['description'], + \ "private": a:private, + \} + if s:update_GistID(b:gist['id']) + Gist -e + endif + redraw | echomsg 'Done: '.loc + else + let loc = '' + echohl ErrorMsg | echomsg 'Post failed: ' . res.message | echohl None + endif + return loc +endfunction + +function! gist#Gist(count, bang, line1, line2, ...) abort + redraw + let bufname = bufname('%') + " find GistID: in content , then we should just update + let gistid = '' + let gistls = '' + let gistnm = '' + let gistdesc = ' ' + let private = get(g:, 'gist_post_private', 0) + let multibuffer = 0 + let clipboard = 0 + let deletepost = 0 + let editpost = 0 + let anonymous = get(g:, 'gist_post_anonymous', 0) + let openbrowser = 0 + let listmx = '^\%(-l\|--list\)\s*\([^\s]\+\)\?$' + let bufnamemx = '^' . s:bufprefix .'\(\zs[0-9a-f]\+\ze\|\zs[0-9a-f]\+\ze[/\\].*\)$' + if strlen(g:github_user) == 0 && anonymous == 0 + echohl ErrorMsg | echomsg 'You have not configured a Github account. Read '':help gist-setup''.' | echohl None + return + endif + if a:bang == '!' + let gistidbuf = '' + elseif bufname =~# bufnamemx + let gistidbuf = matchstr(bufname, bufnamemx) + elseif exists('b:gist') && has_key(b:gist, 'id') + let gistidbuf = b:gist['id'] + else + let gistidbuf = matchstr(join(getline(a:line1, a:line2), "\n"), 'GistID:\s*\zs\w\+') + endif + + let args = (a:0 > 0) ? s:shellwords(a:1) : [] + for arg in args + if arg =~# '^\(-h\|--help\)$\C' + help :Gist + return + elseif arg =~# '^\(-g\|--git\)$\C' && gistidbuf !=# '' && g:gist_api_url ==# 'https://api.github.com/' && has_key(b:, 'gist') && has_key(b:gist, 'id') + echo printf('git clone git@github.com:%s', b:gist['id']) + return + elseif arg =~# '^\(-G\|--gitclone\)$\C' && gistidbuf !=# '' && g:gist_api_url ==# 'https://api.github.com/' && has_key(b:, 'gist') && has_key(b:gist, 'id') + exe '!' printf('git clone git@github.com:%s', b:gist['id']) + return + elseif arg =~# '^\(-la\|--listall\)$\C' + let gistls = '-all' + elseif arg =~# '^\(-ls\|--liststar\)$\C' + let gistls = 'starred' + elseif arg =~# '^\(-l\|--list\)$\C' + if get(g:, 'gist_show_privates') + let gistls = 'mine' + else + let gistls = g:github_user + endif + elseif arg =~# '^\(-m\|--multibuffer\)$\C' + let multibuffer = 1 + elseif arg =~# '^\(-p\|--private\)$\C' + let private = 1 + elseif arg =~# '^\(-P\|--public\)$\C' + let private = 0 + elseif arg =~# '^\(-a\|--anonymous\)$\C' + let anonymous = 1 + elseif arg =~# '^\(-s\|--description\)$\C' + let gistdesc = '' + elseif arg =~# '^\(-c\|--clipboard\)$\C' + let clipboard = 1 + elseif arg =~# '^--rawurl$\C' && gistidbuf !=# '' && g:gist_api_url ==# 'https://api.github.com/' + let gistid = gistidbuf + echo 'https://gist.github.com/raw/'.gistid + return + elseif arg =~# '^\(-d\|--delete\)$\C' && gistidbuf !=# '' + let gistid = gistidbuf + let deletepost = 1 + elseif arg =~# '^\(-e\|--edit\)$\C' + if gistidbuf !=# '' + let gistid = gistidbuf + endif + let editpost = 1 + elseif arg =~# '^\(+1\|--star\)$\C' && gistidbuf !=# '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'PUT') + if res.status =~# '^2' + echomsg 'Starred' gistid + else + echohl ErrorMsg | echomsg 'Star failed' | echohl None + endif + endif + return + elseif arg =~# '^\(-1\|--unstar\)$\C' && gistidbuf !=# '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'DELETE') + if res.status =~# '^2' + echomsg 'Unstarred' gistid + else + echohl ErrorMsg | echomsg 'Unstar failed' | echohl None + endif + endif + return + elseif arg =~# '^\(-f\|--fork\)$\C' && gistidbuf !=# '' + let auth = s:GistGetAuthHeader() + if len(auth) == 0 + echohl ErrorMsg | echomsg v:errmsg | echohl None + return + else + let gistid = gistidbuf + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/fork', '', { "Authorization": auth }) + if res.status =~# '^2' + let obj = webapi#json#decode(res.content) + let gistid = obj['id'] + else + echohl ErrorMsg | echomsg 'Fork failed' | echohl None + return + endif + endif + elseif arg =~# '^\(-b\|--browser\)$\C' + let openbrowser = 1 + elseif arg !~# '^-' && len(gistnm) == 0 + if gistdesc !=# ' ' + let gistdesc = matchstr(arg, '^\s*\zs.*\ze\s*$') + elseif editpost == 1 || deletepost == 1 + let gistnm = arg + elseif len(gistls) > 0 && arg !=# '^\w\+$\C' + let gistls = arg + elseif arg =~# '^[0-9a-z]\+$\C' + let gistid = arg + else + echohl ErrorMsg | echomsg 'Invalid arguments: '.arg | echohl None + unlet args + return 0 + endif + elseif len(arg) > 0 + echohl ErrorMsg | echomsg 'Invalid arguments: '.arg | echohl None + unlet args + return 0 + endif + endfor + unlet args + "echom "gistid=".gistid + "echom "gistls=".gistls + "echom "gistnm=".gistnm + "echom "gistdesc=".gistdesc + "echom "private=".private + "echom "clipboard=".clipboard + "echom "editpost=".editpost + "echom "deletepost=".deletepost + + if gistidbuf !=# '' && gistid ==# '' && editpost == 0 && deletepost == 0 && anonymous == 0 + let editpost = 1 + let gistid = gistidbuf + endif + + if len(gistls) > 0 + call s:GistList(gistls, 1) + elseif len(gistid) > 0 && editpost == 0 && deletepost == 0 + call s:GistGet(gistid, clipboard) + else + let url = '' + if multibuffer == 1 + let url = s:GistPostBuffers(private, gistdesc, anonymous) + else + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + if editpost == 1 + let url = s:GistUpdate(content, gistid, gistnm, gistdesc) + elseif deletepost == 1 + call s:GistDelete(gistid) + else + let url = s:GistPost(content, private, gistdesc, anonymous) + endif + if a:count >= 1 && get(g:, 'gist_keep_selection', 0) == 1 + silent! normal! gv + endif + endif + if type(url) == 1 && len(url) > 0 + if get(g:, 'gist_open_browser_after_post', 0) == 1 || openbrowser + call s:open_browser(url) + endif + let gist_put_url_to_clipboard_after_post = get(g:, 'gist_put_url_to_clipboard_after_post', 1) + if gist_put_url_to_clipboard_after_post > 0 || clipboard + if gist_put_url_to_clipboard_after_post == 2 + let url = url . "\n" + endif + if exists('g:gist_clip_command') + call system(g:gist_clip_command, url) + elseif has('clipboard') + let @+ = url + else + let @" = url + endif + endif + endif + endif + return 1 +endfunction + +function! s:GistGetAuthHeader() abort + if get(g:, 'gist_use_password_in_gitconfig', 0) != 0 + let password = substitute(system('git config --get github.password'), "\n", '', '') + if password =~# '^!' | let password = system(password[1:]) | endif + return printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password)) + endif + let auth = '' + if !empty(get(g:, 'gist_token', $GITHUB_TOKEN)) + let auth = 'token ' . get(g:, 'gist_token', $GITHUB_TOKEN) + elseif filereadable(s:gist_token_file) + let str = join(readfile(s:gist_token_file), '') + if type(str) == 1 + let auth = str + endif + endif + if len(auth) > 0 + return auth + endif + + redraw + echohl WarningMsg + echo 'Gist.vim requires authorization to use the GitHub API. These settings are stored in "~/.gist-vim". If you want to revoke, do "rm ~/.gist-vim".' + echohl None + let password = inputsecret('GitHub Password for '.g:github_user.':') + if len(password) == 0 + let v:errmsg = 'Canceled' + return '' + endif + let note = 'Gist.vim on '.hostname().' '.strftime('%Y/%m/%d-%H:%M:%S') + let note_url = 'http://www.vim.org/scripts/script.php?script_id=2423' + let insecureSecret = printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password)) + let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ + \ "scopes" : ["gist"], + \ "note" : note, + \ "note_url" : note_url, + \}), { + \ "Content-Type" : "application/json", + \ "Authorization" : insecureSecret, + \}) + let h = filter(res.header, 'stridx(v:val, "X-GitHub-OTP:") == 0') + if len(h) + let otp = inputsecret('OTP:') + if len(otp) == 0 + let v:errmsg = 'Canceled' + return '' + endif + let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ + \ "scopes" : ["gist"], + \ "note" : note, + \ "note_url" : note_url, + \}), { + \ "Content-Type" : "application/json", + \ "Authorization" : insecureSecret, + \ "X-GitHub-OTP" : otp, + \}) + endif + let authorization = webapi#json#decode(res.content) + if has_key(authorization, 'token') + let secret = printf('token %s', authorization.token) + call writefile([secret], s:gist_token_file) + if !(has('win32') || has('win64')) + call system('chmod go= '.s:gist_token_file) + endif + elseif has_key(authorization, 'message') + let secret = '' + let v:errmsg = authorization.message + endif + return secret +endfunction + +let s:extmap = extend({ +\".adb": "ada", +\".ahk": "ahk", +\".arc": "arc", +\".as": "actionscript", +\".asm": "asm", +\".asp": "asp", +\".aw": "php", +\".b": "b", +\".bat": "bat", +\".befunge": "befunge", +\".bmx": "bmx", +\".boo": "boo", +\".c-objdump": "c-objdump", +\".c": "c", +\".cfg": "cfg", +\".cfm": "cfm", +\".ck": "ck", +\".cl": "cl", +\".clj": "clj", +\".cmake": "cmake", +\".coffee": "coffee", +\".cpp": "cpp", +\".cppobjdump": "cppobjdump", +\".cs": "csharp", +\".css": "css", +\".cw": "cw", +\".d-objdump": "d-objdump", +\".d": "d", +\".darcspatch": "darcspatch", +\".diff": "diff", +\".duby": "duby", +\".dylan": "dylan", +\".e": "e", +\".ebuild": "ebuild", +\".eclass": "eclass", +\".el": "lisp", +\".erb": "erb", +\".erl": "erlang", +\".f90": "f90", +\".factor": "factor", +\".feature": "feature", +\".fs": "fs", +\".fy": "fy", +\".go": "go", +\".groovy": "groovy", +\".gs": "gs", +\".gsp": "gsp", +\".haml": "haml", +\".hs": "haskell", +\".html": "html", +\".hx": "hx", +\".ik": "ik", +\".ino": "ino", +\".io": "io", +\".j": "j", +\".java": "java", +\".js": "javascript", +\".json": "json", +\".jsp": "jsp", +\".kid": "kid", +\".lhs": "lhs", +\".lisp": "lisp", +\".ll": "ll", +\".lua": "lua", +\".ly": "ly", +\".m": "objc", +\".mak": "mak", +\".man": "man", +\".mao": "mao", +\".matlab": "matlab", +\".md": "markdown", +\".minid": "minid", +\".ml": "ml", +\".moo": "moo", +\".mu": "mu", +\".mustache": "mustache", +\".mxt": "mxt", +\".myt": "myt", +\".n": "n", +\".nim": "nim", +\".nu": "nu", +\".numpy": "numpy", +\".objdump": "objdump", +\".ooc": "ooc", +\".parrot": "parrot", +\".pas": "pas", +\".pasm": "pasm", +\".pd": "pd", +\".phtml": "phtml", +\".pir": "pir", +\".pl": "perl", +\".po": "po", +\".py": "python", +\".pytb": "pytb", +\".pyx": "pyx", +\".r": "r", +\".raw": "raw", +\".rb": "ruby", +\".rhtml": "rhtml", +\".rkt": "rkt", +\".rs": "rs", +\".rst": "rst", +\".s": "s", +\".sass": "sass", +\".sc": "sc", +\".scala": "scala", +\".scm": "scheme", +\".scpt": "scpt", +\".scss": "scss", +\".self": "self", +\".sh": "sh", +\".sml": "sml", +\".sql": "sql", +\".st": "smalltalk", +\".swift": "swift", +\".tcl": "tcl", +\".tcsh": "tcsh", +\".tex": "tex", +\".textile": "textile", +\".tpl": "smarty", +\".twig": "twig", +\".txt" : "text", +\".v": "verilog", +\".vala": "vala", +\".vb": "vbnet", +\".vhd": "vhdl", +\".vim": "vim", +\".weechatlog": "weechatlog", +\".xml": "xml", +\".xq": "xquery", +\".xs": "xs", +\".yml": "yaml", +\}, get(g:, 'gist_extmap', {})) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:set et: diff --git a/sources_non_forked/vim-gist/doc/gist-vim.txt b/sources_non_forked/vim-gist/doc/gist-vim.txt new file mode 100644 index 00000000..88c46d10 --- /dev/null +++ b/sources_non_forked/vim-gist/doc/gist-vim.txt @@ -0,0 +1,358 @@ +*Gist.vim* Vimscript for creating gists (http://gist.github.com) + +Usage |vim-gist-usage| +Tips |vim-gist-tips| +License |vim-gist-license| +Install |vim-gist-install| +Requirements |vim-gist-requirements| +Setup |vim-gist-setup| +FAQ |vim-gist-faq| + +This is a vimscript for creating gists (http://gist.github.com) + +For the latest version please see https://github.com/mattn/vim-gist. + +============================================================================== +USAGE *:Gist* *vim-gist-usage* + +- Post current buffer to gist, using default privacy option. > + + :Gist +< +- Post selected text to gist, using default privacy option. + This applies to all permutations listed below (except multi). > + + :'<,'>Gist +< +- Create a private gist. > + + :Gist -p + :Gist --private +< +- Create a public gist. + (Only relevant if you've set gists to be private by default.) > + + :Gist -P + :Gist --public +< +- Post whole text to gist as public. + This is only relevant if you've set gists to be private by default. +> + :Gist -P +< +- Create a gist anonymously. > + + :Gist -a + :Gist --anonymous +< +- Create a gist with all open buffers. > + + :Gist -m + :Gist --multibuffer +< +- Edit the gist (you need to have opened the gist buffer first). + You can update the gist with the {:w} command within the gist buffer. > + + :Gist -e + :Gist --edit +< +- Edit the gist with name "foo.js" (you need to have opened the gist buffer + first). > + + :Gist -e foo.js +< +- Post/Edit with the description " (you need to have opened the gist buffer + first). > + + :Gist -s something + :Gist --description something + :Gist -e -s something +< +- Delete the gist (you need to have opened the gist buffer first). + Password authentication is needed. > + + :Gist -d + :Gist --delete +< +- Fork the gist (you need to have opened the gist buffer first). + Password authentication is needed. > + + :Gist -f + :Gist --fork +< +- Star the gist (you need to have opened the gist buffer first). + Password authentication is needed. +> + :Gist +1 +< +- Unstar the gist (you need to have opened the gist buffer first). + Password authentication is needed. +> + :Gist -1 +< +- Get gist XXXXX. > + + :Gist XXXXX +< +- Get gist XXXXX and add to clipboard. > + + :Gist -c XXXXX +< +- List your public gists. > + + :Gist -l + :Gist --list +< +- List gists from user "mattn". > + + :Gist -l mattn +< +- List everyone's gists. > + + :Gist -la + :Gist --listall +< +- List gists from your starred gists. +> + :Gist -ls + :Gist --liststar + +- While the gist list is visible, the following mappings apply: + + - 'o' or 'Enter' will open the selected gist file in a new buffer + and close the vim-gist listing split. + - 'b' will open the selected gist file in a browser. If you are in + GUI vim you can also achieve this by pressing 'Shift-Enter'. + - 'y' will copy the contents of the selected gist to the clipboard, + and close the vim-gist listing split. + - 'p' will (copy and) paste the contents of the selected gist to the + buffer from which vim-gist was called, and close the vim-gist + listing split. + - 'Esc' will close the vim-gist listing split without performing any + further action. + +- Open the gist on browser after you post or update it. +> + :Gist -b + :Gist --browser +< +- Post as new gist after editing on the buffer. +> + :Gist! +< +============================================================================== +TIPS *vim-gist-tips* + +If you set "g:gist_clip_command", gist.vim will copy the gist code with option +"-c". + + - Mac: > + let g:gist_clip_command = 'pbcopy' +< + - Linux: > + let g:gist_clip_command = 'xclip -selection clipboard' +< + - Others (cygwin?): > + let g:gist_clip_command = 'putclip' +< +If you want to detect filetype from the filename: > + + let g:gist_detect_filetype = 1 +< +If you want to open the browser after the post: > + + let g:gist_open_browser_after_post = 1 +< +If you want to change the browser: > + + let g:gist_browser_command = 'w3m %URL%' +< +or: > + + let g:gist_browser_command = 'opera %URL% &' +< +On windows, this should work with your user settings. + +If you want to show your private gists with ":Gist -l": > + + let g:gist_show_privates = 1 +< +If you want your gist to be private by default: > + + let g:gist_post_private = 1 +< +If you want your gist to be anonymous by default: > + + let g:gist_post_anonymous = 1 +< +If you want to edit all files for gists containing more than one: > + + let g:gist_get_multiplefile = 1 +< +If you want to use on GitHub Enterprise: > + + let g:gist_api_url = 'http://your-github-enterprise-domain/api/v3' +< +If you want to open gist with current editing buffers: > + + let g:gist_edit_with_buffers = 1 + +If you want to open gist list/buffer as vertical split: > + + let g:gist_list_vsplit = 1 + +If you want to modify filetype for the file on github, or add mapping of +filetype/file-extension: > + + let g:gist_extmap = { ".swift": "swift" } +< + key is file-extension, value is filetype. + +If you want to update a gist, embed > + + GistID: xxxxx +> +in your local file, then call > + + :Gist + +The vim-gist listing split lists gists ids, names (filenames) as well as +their description. This is done following a table layout, with fixed space +for each column. For offering quick browsing, vim-gist will truncate all +output exceeding the available horizontal space, assuring that every gist +listed only takes one line on the table. Although the gist id field width is +fixed internally, the user can define the length of the (file)name field on +the vim-gist listing. This can be done by the following declaration: + + let g:gist_namelength = 20 + +Note that the default value for gist_namelength is 30. Again, if the gist +(file)name exceeds the specified number of characters, it will be truncated. + +If you want to update a gist when only |:w!|: > + + " :w and :w! update a gist. + let g:gist_update_on_write = 1 + + " Only :w! updates a gist. + let g:gist_update_on_write = 2 +> +All other values are treated as 1. +This variable's value is 1 by default. + +============================================================================== +LICENSE *vim-gist-license* + + + Copyright 2010 by Yasuhiro Matsumoto + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +============================================================================== +INSTALL *vim-gist-install* + +Copy following files into your plugin directory. + +rtp: + - autoload/gist.vim + - plugin/gist.vim + +If you want to uninstall gist.vim, remember to also remove `~/.vim-gist`. + +You need to install webapi-vim also: + + http://www.vim.org/scripts/script.php?script_id=4019 + +If you want to use latest one: + + https://github.com/mattn/webapi-vim + +============================================================================== +REQUIREMENTS *vim-gist-requirements* + + - curl command (http://curl.haxx.se/) + - webapi-vim (https://github.com/mattn/webapi-vim) + - and, if you want to use your git profile, the git command-line client. + +============================================================================== +SETUP *vim-gist-setup* + +This plugin uses GitHub API v3. The authentication value is stored in `~/.vim-gist`. +vim-gist provides two ways to authenticate against the GitHub APIs. + +First, you need to set your GitHub username in global git config: +> + $ git config --global github.user Username +< +Then, gist.vim will ask for your password to create an authorization when you +first use it. The password is not stored and only the OAuth access token will +be kept for later use. You can revoke the token at any time from the list of +"Authorized applications" on GitHub's "Account Settings" page. +(https://github.com/settings/applications) + +If you have two-factor authentication enabled on GitHub, you'll see the message +"Must specify two-factor authentication OTP code." In this case, you need to +create a "Personal Access Token" on GitHub's "Account Settings" page +(https://github.com/settings/applications) and place it in a file +named ~/.vim-gist like this: +> + token xxxxx +< +If you happen to have your password already written in ~/.gitconfig like +below: +> + [github] + password = xxxxx +< +Then, add following into your ~/.vimrc +> + let g:gist_use_password_in_gitconfig = 1 +< +This is not secure at all, so strongly discouraged. + +NOTE: the username is optional if you only send anonymous gists. + +============================================================================== +FAQ *vim-gist-faq* + +Q. :Gist returns a Forbidden error +A. Try deleting ~/.vim-gist and authenticating again. + +============================================================================== +THANKS *vim-gist-thanks* + + AD7six + Bruno Bigras + c9s + Daniel Bretoi + Jeremy Michael Cantrell + Kien N + kongo2002 + MATSUU Takuto + Matthew Weier O'Phinney + ornicar + Roland Schilter + steve + tyru + Will Gray + netj + + vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-gist/plugin/gist.vim b/sources_non_forked/vim-gist/plugin/gist.vim new file mode 100644 index 00000000..4d4efe67 --- /dev/null +++ b/sources_non_forked/vim-gist/plugin/gist.vim @@ -0,0 +1,23 @@ +"============================================================================= +" File: gist.vim +" Author: Yasuhiro Matsumoto +" WebPage: http://github.com/mattn/vim-gist +" License: BSD +" GetLatestVimScripts: 2423 1 :AutoInstall: gist.vim +" script type: plugin + +if &compatible || (exists('g:loaded_gist_vim') && g:loaded_gist_vim) + finish +endif +let g:loaded_gist_vim = 1 + +function! s:CompleteArgs(arg_lead,cmdline,cursor_pos) + return filter(copy(["-p", "-P", "-a", "-m", "-e", "-s", "-d", "+1", "-1", "-f", "-c", "-l", "-la", "-ls", "-b", + \ "--listall", "--liststar", "--list", "--multibuffer", "--private", "--public", "--anonymous", "--description", "--clipboard", + \ "--rawurl", "--delete", "--edit", "--star", "--unstar", "--fork", "--browser" + \ ]), 'stridx(v:val, a:arg_lead)==0') +endfunction + +command! -nargs=? -range=% -bang -complete=customlist,s:CompleteArgs Gist :call gist#Gist(, "", , , ) + +" vim:set et: diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 0c21f3c1..9c5e48c2 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -1,9 +1,11 @@ ## vim-gitgutter -A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object. +A Vim plugin which shows a git diff in the sign column. It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object. The signs are always up to date and the plugin never saves your buffer. +The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this in 2013. + Features: * Shows signs for added, modified, and removed lines. @@ -33,6 +35,10 @@ Constraints: * Supports git only. If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify). * Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, `set -g focus-events on` in your tmux.conf. +Compatibility: + +Compatible back to Vim 7.4, and probably 7.3. + ### Screenshot @@ -88,6 +94,10 @@ You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo You cannot unstage a staged hunk. +After updating the signs, the plugin fires the `GitGutter` User autocommand. + +After staging a hunk or part of a hunk, the plugin fires the `GitGutterStage` User autocommand. + #### Activation @@ -308,31 +318,20 @@ let g:gitgutter_sign_allow_clobber = 1 #### Signs' colours and symbols -By default vim-gitgutter uses your colourscheme's `Diff*` highlight groups' foreground colours for the signs' foreground colours. For example, your `DiffAdd` foreground colour will be used for the `+` sign's foreground colour. +If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use those for the signs' colours. -The signs' background colours will all be set to the sign column's background colour. +Otherwise it will use your colourscheme's `Diff*` highlight groups. -If you don't like the default colours, you can either fix your colourscheme's `Diff*` highlights or configure your own `GitGutter*` highlight groups. These groups are: +Either way the signs' background colours will be set to the sign column's background colour. + +If you don't like the colours, specify the ones you want in your vimrc (see `:help highlight-guifg` and `:help highlight-ctermfg`). For example, to get vim-gitgutter's original colours (based on git-diff's colours in my terminal): ```viml -GitGutterAdd " an added line (default: links to DiffAdd) -GitGutterChange " a changed line (default: links to DiffChange) -GitGutterDelete " at least one removed line (default: links to DiffDelete) -GitGutterChangeDelete " a changed line followed by at least one removed line (default: links to GitGutterChange) +highlight GitGutterAdd guifg=#009900 ctermfg=2 +highlight GitGutterChange guifg=#bbbb00 ctermfg=3 +highlight GitGutterDelete guifg=#ff2222 ctermfg=1 ``` -You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd MyDiffAdd`. - -To get vim-gitgutter's original colours (based on git-diff's colours in my terminal): - -```viml -highlight GitGutterAdd guifg=#009900 guibg= ctermfg=2 ctermbg= -highlight GitGutterChange guifg=#bbbb00 guibg= ctermfg=3 ctermbg= -highlight GitGutterDelete guifg=#ff2222 guibg= ctermfg=1 ctermbg= -``` - -– where you would replace `` and `` with the background colour of your `SignColumn` in the gui and the terminal respectively. For example, with the solarized colorscheme and a dark background, `guibg=#073642` and `ctermbg=0`. - To customise the symbols, add the following to your `~/.vimrc`: ```viml @@ -399,6 +398,8 @@ By default buffers are diffed against the index. However you can diff against a let g:gitgutter_diff_base = '' ``` +If you are looking at a previous version of a file with Fugitive (e.g. via `:0Gclog`), gitgutter sets the diff base to the parent of the current revision. + This setting is ignored when the diffs are relative to the working tree. @@ -632,16 +633,6 @@ This plugin is for showing changes between the buffer and the index (and staging Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column. -> Why are the colours in the preview window weird? - -Probably because your colourscheme doesn't configure the `diff{Added,Changed,Removed}` highlight groups. Try this in `after/syntax/diff.vim`: - -```viml -highlight link diffAdded DiffAdd -highlight link diffChanged DiffChange -highlight link diffRemoved DiffDelete -``` - > What happens if I also use another plugin which uses signs (e.g. Syntastic)? You can configure whether GitGutter preserves or clobbers other signs using `g:gitgutter_sign_allow_clobber`. Set to `1` to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or `0` to preserve them. diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim index 582ea4b0..d56a8d9b 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -1,5 +1,3 @@ -let s:t_string = type('') - " Primary functions {{{ function! gitgutter#all(force) abort @@ -37,7 +35,7 @@ function! gitgutter#process_buffer(bufnr, force) abort if a:force || s:has_fresh_changes(a:bufnr) - let diff = '' + let diff = 'NOT SET' try let diff = gitgutter#diff#run_diff(a:bufnr, g:gitgutter_diff_relative_to, 0) catch /gitgutter not tracked/ @@ -47,7 +45,7 @@ function! gitgutter#process_buffer(bufnr, force) abort call gitgutter#hunk#reset(a:bufnr) endtry - if diff != 'async' + if diff != 'async' && diff != 'NOT SET' call gitgutter#diff#handler(a:bufnr, diff) endif @@ -156,11 +154,7 @@ function! gitgutter#setup_maps() endfunction function! s:setup_path(bufnr, continuation) - let p = gitgutter#utility#repo_path(a:bufnr, 0) - - if type(p) == s:t_string && !empty(p) " if path is known - return - endif + if gitgutter#utility#has_repo_path(a:bufnr) | return | endif return gitgutter#utility#set_repo_path(a:bufnr, a:continuation) endfunction @@ -188,7 +182,7 @@ endfunction function! gitgutter#quickfix() let locations = [] let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager '.g:gitgutter_git_args. - \ ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args + \ ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args. ' '. g:gitgutter_diff_base let diff = systemlist(cmd) let lnum = 0 for line in diff diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index be8a685f..04a0de97 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -1,3 +1,5 @@ +scriptencoding utf8 + let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '' : '' let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' @@ -10,9 +12,6 @@ endfunction let s:c_flag = s:git_supports_command_line_config_override() - -let s:temp_from = tempname() -let s:temp_buffer = tempname() let s:counter = 0 " Returns a diff of the buffer against the index or the working tree. @@ -76,6 +75,9 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort throw 'gitgutter not tracked' endif + let temp_from = tempname() + let temp_buffer = tempname() + " Wrap compound commands in parentheses to make Windows happy. " bash doesn't mind the parentheses. let cmd = '(' @@ -88,7 +90,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " second gitgutter#process_buffer() writing the file (synchronously, below) " and the first gitgutter#process_buffer()'s async job reading it (with " git-diff). - let buff_file = s:temp_buffer.'.'.a:bufnr + let buff_file = 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. @@ -108,7 +110,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " Without the buffer number, from_file would have a race in the shell " between the second process writing it (with git-show) and the first " reading it (with git-diff). - let from_file = s:temp_from.'.'.a:bufnr + let from_file = 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 @@ -118,7 +120,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort endif " Write file from index to temporary file. - let index_name = g:gitgutter_diff_base.':'.gitgutter#utility#repo_path(a:bufnr, 1) + let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1) let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager show '.index_name.' > '.from_file.' && ' elseif a:from ==# 'working_tree' @@ -405,5 +407,3 @@ endfunction function! s:save_last_seen_change(bufnr) abort call gitgutter#utility#setbufvar(a:bufnr, 'tick', getbufvar(a:bufnr, 'changedtick')) endfunction - - diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim index e8ac1a25..da8ecbd0 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim @@ -84,6 +84,20 @@ function! gitgutter#highlight#define_highlights() abort highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible " When they are visible. + + " If GitGutter* highlights are already defined, either by the user or the colourscheme, + " set their backgrounds to the sign column's. + for type in ["Add", "Change", "Delete"] + if hlexists("GitGutter".type) + " Were the highlight self-contained we could just declare the + " background attributes and they would be merged. But it might be a + " link, in which case it would be overwritten. So re-declare it in its + " entirety. + let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type) + execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg + endif + endfor + " By default use Diff* foreground colors with SignColumn's background. for type in ['Add', 'Change', 'Delete'] let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type) @@ -107,6 +121,14 @@ function! gitgutter#highlight#define_highlights() abort " Highlights used intra line. highlight GitGutterAddIntraLine gui=reverse cterm=reverse highlight GitGutterDeleteIntraLine gui=reverse cterm=reverse + " Set diff syntax colours (used in the preview window) - diffAdded,diffChanged,diffRemoved - + " to match the signs, if not set aleady. + for [dtype,type] in [['Added','Add'], ['Changed','Change'], ['Removed','Delete']] + if !hlexists('diff'.dtype) + let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type) + execute "highlight diff".dtype." guifg=".guifg." ctermfg=".ctermfg." guibg=NONE ctermbg=NONE" + endif + endfor endfunction function! gitgutter#highlight#define_signs() abort diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim index c51dd7a5..2404f087 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -1,4 +1,6 @@ let s:winid = 0 +let s:preview_bufnr = 0 +let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '' : '' function! gitgutter#hunk#set_hunks(bufnr, hunks) abort call gitgutter#utility#setbufvar(a:bufnr, 'hunks', a:hunks) @@ -172,6 +174,8 @@ endfunction function! gitgutter#hunk#stage(...) abort + if !s:in_hunk_preview_window() && !gitgutter#utility#has_repo_path(bufnr('')) | return | endif + if a:0 && (a:1 != 1 || a:2 != line('$')) call s:hunk_op(function('s:stage'), a:1, a:2) else @@ -181,11 +185,15 @@ function! gitgutter#hunk#stage(...) abort endfunction function! gitgutter#hunk#undo() abort + if !gitgutter#utility#has_repo_path(bufnr('')) | return | endif + call s:hunk_op(function('s:undo')) silent! call repeat#set("\(GitGutterUndoHunk)", -1) endfunction function! gitgutter#hunk#preview() abort + if !gitgutter#utility#has_repo_path(bufnr('')) | return | endif + call s:hunk_op(function('s:preview')) silent! call repeat#set("\(GitGutterPreviewHunk)", -1) endfunction @@ -268,6 +276,10 @@ function! s:stage(hunk_diff) \ diff) if v:shell_error call gitgutter#utility#warn('patch does not apply') + else + if exists('#User#GitGutterStage') + execute 'doautocmd' s:nomodeline 'User GitGutterStage' + endif endif " Refresh gitgutter's view of buffer. @@ -430,7 +442,12 @@ function! s:open_hunk_preview_window() silent! wincmd P if !&previewwindow noautocmd execute g:gitgutter_preview_win_location &previewheight 'new gitgutter://hunk-preview' - let s:winid = win_getid() + doautocmd WinEnter + if exists('*win_getid') + let s:winid = win_getid() + else + let s:preview_bufnr = bufnr('') + endif set previewwindow setlocal filetype=diff buftype=acwrite bufhidden=delete " Reset some defaults in case someone else has changed them. @@ -499,18 +516,21 @@ endfunction function! s:enable_staging_from_hunk_preview_window() augroup gitgutter_hunk_preview autocmd! - execute 'autocmd BufWriteCmd GitGutterStageHunk' + let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr + execute 'autocmd BufWriteCmd GitGutterStageHunk' augroup END endfunction function! s:goto_original_window() noautocmd wincmd p + doautocmd WinEnter endfunction function! s:close_hunk_preview_window() - call setbufvar(winbufnr(s:winid), '&modified', 0) + let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr + call setbufvar(bufnr, '&modified', 0) if g:gitgutter_preview_win_floating if win_id2win(s:winid) > 0 @@ -521,4 +541,5 @@ function! s:close_hunk_preview_window() endif let s:winid = 0 + let s:preview_bufnr = 0 endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim index 3f533ba4..4151aea2 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -9,25 +9,19 @@ endfunction function! gitgutter#utility#setbufvar(buffer, varname, val) let buffer = +a:buffer " 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 - call setbufvar(buffer, 'gitgutter', dict) + let ggvars = getbufvar(buffer, 'gitgutter') + if type(ggvars) == type('') + unlet ggvars + let ggvars = {} + call setbufvar(buffer, 'gitgutter', ggvars) endif + let ggvars[a:varname] = a:val endfunction function! gitgutter#utility#getbufvar(buffer, varname, ...) - let bvars = getbufvar(a:buffer, '') - if !empty(bvars) - let dict = get(bvars, 'gitgutter', {}) - if has_key(dict, a:varname) - return dict[a:varname] - endif + let ggvars = getbufvar(a:buffer, 'gitgutter') + if type(ggvars) == type({}) && has_key(ggvars, a:varname) + return ggvars[a:varname] endif if a:0 return a:1 @@ -105,6 +99,10 @@ function! gitgutter#utility#system(cmd, ...) abort return output endfunction +function! gitgutter#utility#has_repo_path(bufnr) + return index(['', -1, -2], gitgutter#utility#repo_path(a:bufnr, 0)) == -1 +endfunction + " Path of file relative to repo root. " " * empty string - not set @@ -112,7 +110,7 @@ endfunction " * -1 - pending " * -2 - not tracked by git function! gitgutter#utility#repo_path(bufnr, shellesc) abort - let p = gitgutter#utility#getbufvar(a:bufnr, 'path') + let p = gitgutter#utility#getbufvar(a:bufnr, 'path', '') return a:shellesc ? gitgutter#utility#shellescape(p) : p endfunction @@ -186,8 +184,21 @@ function! s:restore_shell() abort endif endfunction +function! gitgutter#utility#get_diff_base(bufnr) + let p = resolve(expand('#'.a:bufnr.':p')) + let ml = matchlist(p, '\v^fugitive:/.*/(\x{40,})/') + if !empty(ml) && !empty(ml[1]) + return ml[1].'^' + endif + return g:gitgutter_diff_base +endfunction + function! s:abs_path(bufnr, shellesc) let p = resolve(expand('#'.a:bufnr.':p')) + + " Remove extra parts from fugitive's filepaths + let p = substitute(substitute(p, '^fugitive:', '', ''), '\v\.git/\x{40,}/', '', '') + return a:shellesc ? gitgutter#utility#shellescape(p) : p endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 1f52989f..e8f81789 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -1,7 +1,7 @@ *gitgutter.txt* A Vim plugin which shows a git diff in the gutter. - Vim Git Gutter + Vim GitGutter Author: Andy Stewart @@ -27,13 +27,16 @@ CONTENTS *gitgutter* =============================================================================== INTRODUCTION *gitgutter-introduction* -GitGutter is a Vim plugin which shows a git diff in the 'gutter' (sign column). +GitGutter is a Vim plugin which shows a git diff in the sign column. It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks. The plugin also provides a hunk text object. The signs are always up to date and the plugin never saves your buffer. +The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this +one in 2013. + =============================================================================== INSTALLATION *gitgutter-installation* @@ -177,7 +180,7 @@ Commands for folds:~ =============================================================================== -AUTOCOMMAND *gitgutter-autocommand* +AUTOCOMMANDS *gitgutter-autocommands* User GitGutter~ @@ -189,6 +192,10 @@ event GitGutter. You can listen for this event, for example: A dictionary `g:gitgutter_hook_context` is made available during its execution, which contains an entry `bufnr` that contains the buffer number being updated. +User GitGutterStage~ + +After staging a hunk or part of a hunk vim-gitgutter fires a |User| |autocmd| +with the event GitGutterStage. Staging always happens in the current buffer. =============================================================================== MAPPINGS *gitgutter-mappings* @@ -366,6 +373,9 @@ a revision instead. For example: let g:gitgutter_diff_base = '' < +If you are looking at a previous version of a file with Fugitive (e.g. +via :0Gclog), gitgutter sets the diff base to the parent of the current revision. + This setting is ignore when the diff is relative to the working tree (|g:gitgutter_diff_relative_to|). @@ -519,20 +529,14 @@ of the current window instead of the global quickfix list. =============================================================================== HIGHLIGHTS *gitgutter-highlights* -To change the signs' colours, set up the following highlight groups in your -colorscheme or |vimrc|: +To change the signs' colours, specify these highlight groups in your |vimrc|: > - GitGutterAdd " an added line - GitGutterChange " a changed line - GitGutterDelete " at least one removed line - GitGutterChangeDelete " a changed line followed by at least one removed line + highlight GitGutterAdd guifg=#009900 ctermfg=2 + highlight GitGutterChange guifg=#bbbb00 ctermfg=3 + highlight GitGutterDelete guifg=#ff2222 ctermfg=1 < -You can either set these with `highlight GitGutterAdd {key}={arg}...` or link -them to existing highlight groups with, say: -> - highlight link GitGutterAdd MyDiffAdd -< +See |highlight-guifg| and |highlight-ctermfg| for the values you can use. To change the line highlights, set up the following highlight groups in your colorscheme or |vimrc|: diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index 4d1a7e50..3b3689b2 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -184,7 +184,7 @@ syntax match jsClassNoise contained /\./ syntax match jsClassFuncName contained /\<\K\k*\ze\s*[(<]/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowClassFunctionGroup syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsClassFuncName,jsClassProperty syntax region jsClassDefinition start=/\/ end=/\(\\s\+\)\@ 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 7a6eb479..43dcfee8 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -103,6 +103,9 @@ let g:multi_cursor_quit_key = '' ## Settings Currently there are four additional global settings one can tweak: +### ```g:multi_cursor_support_imap``` (Default: 1) +If set to 0, insert mappings won't be supported in _Insert_ mode anymore. + ### ```g:multi_cursor_exit_from_visual_mode``` (Default: 0) If set to 1, then pressing `g:multi_cursor_quit_key` in _Visual_ mode will quit and delete all existing cursors, just skipping normal mode with multiple cursors. diff --git a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim index c2739755..cdc8d978 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -1234,7 +1234,7 @@ function! s:wait_for_user_input(mode) " imap jj JJ " imap jjj JJJ " will always trigger the 'jj' mapping - if s:from_mode ==# 'i' && mapcheck(s:char, "i") != "" + if s:from_mode ==# 'i' && mapcheck(s:char, "i") != "" && g:multi_cursor_support_imap let map_dict = {} let s_time = s:get_time_in_ms() while 1 diff --git a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt index a01b4ed0..ab86815b 100644 --- a/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt +++ b/sources_non_forked/vim-multiple-cursors/doc/multiple_cursors.txt @@ -94,6 +94,10 @@ otherwise you'll have a tough time quitting from multicursor mode. Currently there are four additional global settings one can tweak: +*g:multi_cursor_support_imap* (Default: 1) + +If set to 0, insert mappings won't be supported in |insert-mode| anymore. + *g:multi_cursor_exit_from_visual_mode* (Default: 0) If set to 0, then pressing |g:multi_cursor_quit_key| in |visual-mode| will quit diff --git a/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim index 0f6e41f4..e7f975a1 100644 --- a/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/plugin/multiple_cursors.vim @@ -31,6 +31,7 @@ let s:settings = { \ 'exit_from_insert_mode': 0, \ 'use_default_mapping': 1, \ 'debug_latency': 0, + \ 'support_imap': 1, \ } let s:settings_if_default = { diff --git a/sources_non_forked/vim-python-pep8-indent/indent/python.vim b/sources_non_forked/vim-python-pep8-indent/indent/python.vim index aca216e7..047ae3d7 100644 --- a/sources_non_forked/vim-python-pep8-indent/indent/python.vim +++ b/sources_non_forked/vim-python-pep8-indent/indent/python.vim @@ -158,8 +158,8 @@ function! s:find_start_of_block(lnum, types, skip, multiple) abort else let re_skip = '' endif - let lnum = a:lnum - let last_indent = indent(lnum) + 1 + let last_indent = indent(a:lnum) + 1 + let lnum = a:lnum - 1 while lnum > 0 && last_indent > 0 let indent = indent(lnum) if indent < last_indent @@ -260,7 +260,7 @@ function! s:indent_like_block(lnum) endif let [blocks, skip] = blocks_ignore - let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple) + let indents = s:find_start_of_block(a:lnum, blocks, skip, multiple) if empty(indents) return -1 endif diff --git a/sources_non_forked/vim-python-pep8-indent/spec/indent/indent_spec.rb b/sources_non_forked/vim-python-pep8-indent/spec/indent/indent_spec.rb index 55e2fba4..745e939d 100644 --- a/sources_non_forked/vim-python-pep8-indent/spec/indent/indent_spec.rb +++ b/sources_non_forked/vim-python-pep8-indent/spec/indent/indent_spec.rb @@ -774,3 +774,23 @@ describe "elif after else" do indent.should == 4 end end + +describe "elif after two ifs" do + before { + vim.feedkeys '\ggdG' + } + + it "keeps its indent to the outer if" do + vim.feedkeys 'iif 1:\if 2:\pass\elif 3:\pass\' + indent.should == 4 + vim.feedkeys '\' + indent.should == 0 + proposed_indent.should == shiftwidth + vim.feedkeys 'ielif 4:' + indent.should == 0 + proposed_indent.should == 0 + vim.feedkeys '\' + indent.should == 4 + proposed_indent.should == 4 + end +end diff --git a/sources_non_forked/vim-ruby/autoload/rubycomplete.vim b/sources_non_forked/vim-ruby/autoload/rubycomplete.vim index c77884ad..8eff8003 100644 --- a/sources_non_forked/vim-ruby/autoload/rubycomplete.vim +++ b/sources_non_forked/vim-ruby/autoload/rubycomplete.vim @@ -500,13 +500,8 @@ class VimRubyCompletion return if rails_base == nil $:.push rails_base unless $:.index( rails_base ) - rails_config = rails_base + "config/" - rails_lib = rails_base + "lib/" - $:.push rails_config unless $:.index( rails_config ) - $:.push rails_lib unless $:.index( rails_lib ) - - bootfile = rails_config + "boot.rb" - envfile = rails_config + "environment.rb" + bootfile = rails_base + "config/boot.rb" + envfile = rails_base + "config/environment.rb" if File.exists?( bootfile ) && File.exists?( envfile ) begin require bootfile diff --git a/sources_non_forked/vim-ruby/ftplugin/ruby.vim b/sources_non_forked/vim-ruby/ftplugin/ruby.vim index 90a9bda8..81457288 100644 --- a/sources_non_forked/vim-ruby/ftplugin/ruby.vim +++ b/sources_non_forked/vim-ruby/ftplugin/ruby.vim @@ -111,7 +111,7 @@ else if !exists('g:ruby_default_path') if has("ruby") && has("win32") ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) ) - elseif executable('ruby') + elseif executable('ruby') && !empty($HOME) let g:ruby_default_path = s:query_path($HOME) else let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val') diff --git a/sources_non_forked/vim-ruby/spec/syntax/maxmempattern_limit_spec.rb b/sources_non_forked/vim-ruby/spec/syntax/maxmempattern_limit_spec.rb new file mode 100644 index 00000000..365ed63f --- /dev/null +++ b/sources_non_forked/vim-ruby/spec/syntax/maxmempattern_limit_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "Maxmempattern limit" do + specify "maxmempattern=1000 is enough even for long strings" do + str = <<~'EOF' + hash = { + "A-NOT-Managed-Strings" => "ABCDEfghe910dmckamks019292djdjOOOjjjd/cr3wdCA+1n/xHfHMgG+cC0EoUNngcBjgWvBMEF1CurBwTtDswJjQYa5wYRAQEBAQECCwGwAQEvI50CnwMNAwRrAQYBr9PPAoK7sQMBAQMCBAkICAQIAwEBAwYBAQQFFQEBAhQDAwMDCwEBAQUBAQHGAQEWBAEBDecBfS8CHQEKkAEMMxcMCQoUDwYHIjd3DQ4MFk0JWGYALSKLAQOLAYEBFBAjCBGDAQICAgMANjsZAg9fCxkCgLZKAwSEAQIBiwEZGAsrBCgFMmUEJShyFSfRBQEOSQY62AG0AVlCrQ", + } + EOF + assert_correct_highlighting str, %w[ABCDE], 'rubyString' + end +end diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index 563885ed..8f7a51c2 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -461,7 +461,7 @@ endif syn match rubyDefinedOperator "\%#=1\= 0 diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets index 303fd209..4c58bcbe 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -308,16 +308,29 @@ endsnippet # methods # ############# -snippet equals "Equals method" b -public override bool Equals(object obj) +snippet equals "Equality for a type" b +public override bool Equals(object obj) => Equals(obj as ${1:TYPE}); + +public bool Equals($1 other) // IEquatable<$1> { - if (obj == null || GetType() != obj.GetType()) - { + if (object.ReferenceEquals(other, null)) + return false; + if (object.ReferenceEquals(this, other)) + return true; + if (this.GetType() != other.GetType()) return false; - } $0 - return base.Equals(obj); + return base.Equals(other); } + +public override int GetHashCode() => base.GetHashCode(); + +public static bool operator ==($1 x, $1 y) => + (object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null)) + || (!object.ReferenceEquals(x, null) && x.Equals(y)); + +public static bool operator !=($1 x, $1 y) => !(x == y); + endsnippet snippet mth "Method" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/ejs.snippets b/sources_non_forked/vim-snippets/UltiSnips/ejs.snippets new file mode 100644 index 00000000..1e3c0044 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/ejs.snippets @@ -0,0 +1,10 @@ +snippet for "ejs for loop" b +<% for (let ${1:i = 0}; ${2:i + ${0:body} +<% } %> +endsnippet +snippet forE "ejs for Each loop" b +<% ${1:array}.forEach((${2:single var}) => { %> + ${0:body} +<% }) %> +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets new file mode 100644 index 00000000..d529c54c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets @@ -0,0 +1,42 @@ +# Functional components +snippet rfc "react functional component" b +import React, {useState} from "react" + +function ${1:`!p snip.rv = snip.basename`}(${2}){ + return( +
+ ${3:

Body

} +
+ ) +} + +export default $4`!p snip.rv = snip.basename` +endsnippet +# React Hooks +snippet useS "useState Hook" b +const [${1}, set$1`!p snip.rv=t[1].title()`] = useState(${3:"${4}"}) +endsnippet +snippet useE "useEffect Hook" b +useEffect(() => { + ${1:${0}} + }${2}) +endsnippet +snippet useC "useContext Hook" b +const ${1:context} = useContext(${2}) +endsnippet +snippet useRe "useReducer Hook" b +const [${3:state}, ${4:dispatch}] = useReducer(${5:reducer}, ${2:initial_value}) +endsnippet +snippet useCB "useCallback(fn, inputs)" b +const ${1:callback} = useCallback((${2})) => ${3:{ + ${4} +}}, [${5}] +endsnippet +snippet useM "useMemo(fn, inputs)" b +const ${1:memorized} = useMemo(() => ${2:{ + ${3} +}}, [${4}]) +endsnippet +snippet useR "useRef(defaultValue)" b +const ${1:ref} = useRef(${2:null}) +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index bc8664bb..b9962a10 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -96,6 +96,9 @@ snippet *** "bold italics" ***${1:${VISUAL}}***$0 endsnippet +snippet /* "Comment" +$0 +endsnippet ################ # Common stuff # @@ -131,6 +134,12 @@ snippet fnt "Footnote" [^$1]:${2:Text} endsnippet +snippet detail "Disclosure" + + ${1:summary>${2}}$0 + +endsnippet + post_jump "create_table(snip)" snippet "tb([1-9][1-9])" "Fancy table" br `!p snip.rv = match.group(1)` diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index fbf459d1..39dff8f0 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -4,7 +4,7 @@ priority -50 -snippet fn "pub fn name(?) -> ? {}" +snippet fn "fn name(?) -> ? {}" fn ${1:function_name}($2)${3/..*/ -> /}$3 { ${VISUAL}$0 } diff --git a/sources_non_forked/vim-snippets/UltiSnips/svelte.snippets b/sources_non_forked/vim-snippets/UltiSnips/svelte.snippets new file mode 100644 index 00000000..4e09d0cc --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/svelte.snippets @@ -0,0 +1 @@ +extends html, javascript, css diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index b5be4b74..0243b468 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -44,7 +44,7 @@ def add_row(snip): endglobal -snippet "b(egin)?" "begin{} / end{}" br +snippet "\\?b(egin)?" "begin{} / end{}" br \begin{${1:something}} ${0:${VISUAL}} \end{$1} diff --git a/sources_non_forked/vim-snippets/snippets/awk.snippets b/sources_non_forked/vim-snippets/snippets/awk.snippets index 5c94734a..64f61c0c 100644 --- a/sources_non_forked/vim-snippets/snippets/awk.snippets +++ b/sources_non_forked/vim-snippets/snippets/awk.snippets @@ -1,88 +1,70 @@ # cannot use /usr/bin/env because it does not support parameters (as -f) snippet #! #!/usr/bin/awk -f #!/usr/bin/awk -f - # @include is a gawk extension snippet inc @include @include "${1}"${0} - # @load is a gawk extension snippet loa @load @load "${1}"${0} - snippet beg BEGIN { ... } BEGIN { ${0} } - # BEGINFILE is a gawk extension snippet begf BEGINFILE { ... } BEGINFILE { ${0} } - snippet end END { ... } END { ${0} } - # ENDFILE is a gawk extension snippet endf ENDFILE { ... } ENDFILE { ${0} } - snippet pri print print ${1:"${2}"}${0} - snippet printf printf printf("${1:%s}\n", ${2})${0} - snippet ign IGNORECASE IGNORECASE = ${1:1} - snippet if if {...} if (${1}) { ${0:${VISUAL}} } - snippet ife if ... else ... if (${1}) { ${2:${VISUAL}} } else { ${0} } - snippet eif else if ... else if (${1}) { ${0} } - snippet el else {...} else { ${0} } - snippet wh while while (${1}) { ${2} } - snippet do do ... while do { ${0} } while (${1}) - snippet for for for (${2:i} = 0; i < ${1:n}; ${3:++i}) { ${0} } - snippet fore for each for (${1:i} in ${2:array}) { ${0} } - # the switch is a gawk extension snippet sw switch switch (${1}) { @@ -93,10 +75,8 @@ snippet sw switch ${0} break } - # the switch is a gawk extension snippet case case case ${1}: ${0} break - diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index 614a4882..5c084154 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -1,7 +1,7 @@ ## Main # main snippet main - int main(int argc, const char *argv[]) + int main(int argc, char *argv[]) { ${0} return 0; diff --git a/sources_non_forked/vim-snippets/snippets/dart-flutter.snippets b/sources_non_forked/vim-snippets/snippets/dart-flutter.snippets new file mode 100644 index 00000000..f3ded26a --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/dart-flutter.snippets @@ -0,0 +1,59 @@ +# Snippets for dart in flutter project, to use add the following to your .vimrc +# `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter` +# Flutter stateless widget +snippet stless + class $1 extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + $2 + ); + } + } + +# Flutter stateful widget +snippet stful + class $1 extends StatefulWidget { + @override + _$1State createState() => _$1State(); + } + + class _$1State extends State<$1> { + @override + Widget build(BuildContext context) { + return Container( + $2 + ); + } + } + +# Flutter widget with AnimationController +snippet stanim + class $1 extends StatefulWidget { + @override + _$1State createState() => _$1State(); + } + + class _$1State extends State<$1> + with SingleTickerProviderStateMixin { + AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController(vsync: this); + } + + @override + void dispose() { + super.dispose(); + _controller.dispose(); + } + + @override + Widget build(BuildContext context) { + return Container( + $2 + ); + } + } diff --git a/sources_non_forked/vim-snippets/snippets/haskell.snippets b/sources_non_forked/vim-snippets/snippets/haskell.snippets index 3965f1da..585d3522 100644 --- a/sources_non_forked/vim-snippets/snippets/haskell.snippets +++ b/sources_non_forked/vim-snippets/snippets/haskell.snippets @@ -21,9 +21,9 @@ snippet info snippet imp import ${0:Data.Text} snippet import - import ${0:Data.Text} + import ${0:Data.Text} snippet import2 - import ${1:Data.Text} (${0:head}) + import ${1:Data.Text} (${0:head}) snippet impq import qualified ${1:Data.Text} as ${0:T} snippet importq diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 147e897f..c3d5a8b8 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -327,7 +327,9 @@ snippet => (${1}) => { ${0:${VISUAL}} } -snippet af +snippet af "() =>" + (${1}) => ${0:${VISUAL}} +snippet afb "() => {}" (${1}) => { ${0:${VISUAL}} } diff --git a/sources_non_forked/vim-snippets/snippets/julia.snippets b/sources_non_forked/vim-snippets/snippets/julia.snippets index 490d050d..1e0d3f2f 100644 --- a/sources_non_forked/vim-snippets/snippets/julia.snippets +++ b/sources_non_forked/vim-snippets/snippets/julia.snippets @@ -89,14 +89,26 @@ snippet thr throw ${0} # Messages -snippet in - info("${1}") - ${0} +snippet @i + @info "${1}" ${0} -snippet wa - warn("${1}") - ${0} +snippet @w + @warn "${1}" ${0} -snippet err - error("${1}") - ${0} +snippet @e + @error "${1}" ${0} + +snippet @d + @debug "${1}" ${0} + +snippet @t @testset with @test + @testset "${1}" begin + ${2} + @test ${0} + end + +snippet @tt @testset with @test_throws + @testset "${1}" begin + ${2} + @test_throws ${0} + end diff --git a/sources_non_forked/vim-snippets/snippets/liquid.snippets b/sources_non_forked/vim-snippets/snippets/liquid.snippets index 4f11f086..a39a0876 100644 --- a/sources_non_forked/vim-snippets/snippets/liquid.snippets +++ b/sources_non_forked/vim-snippets/snippets/liquid.snippets @@ -63,6 +63,10 @@ snippet include {% include '${0:snippet}' %} snippet includewith {% include '${1:snippet}', ${2:variable}: ${0:value} %} +snippet render + {% render '${0:snippet}' %} +snippet renderwith + {% render '${1:snippet}', ${2:variable}: ${0:value} %} snippet section {% section '${1:snippet}' %} snippet raw diff --git a/sources_non_forked/vim-snippets/snippets/markdown.snippets b/sources_non_forked/vim-snippets/snippets/markdown.snippets index 303271ed..b1aa3e14 100644 --- a/sources_non_forked/vim-snippets/snippets/markdown.snippets +++ b/sources_non_forked/vim-snippets/snippets/markdown.snippets @@ -129,6 +129,12 @@ snippet img snippet youtube {% youtube ${0:video_id} %} +snippet tb + | ${0:factors} | ${1:a} | ${2:b} | + | ------------- |------------- | ------- | + | ${3:f1} | Y | N | + | ${4:f2} | Y | N | + # The quote should appear only once in the text. It is inherently part of it. # See http://octopress.org/docs/plugins/pullquote/ for more info. diff --git a/sources_non_forked/vim-snippets/snippets/perl.snippets b/sources_non_forked/vim-snippets/snippets/perl.snippets index 2ed2932a..b318d18c 100644 --- a/sources_non_forked/vim-snippets/snippets/perl.snippets +++ b/sources_non_forked/vim-snippets/snippets/perl.snippets @@ -357,6 +357,10 @@ snippet dump use Data::Dump qw(dump); warn dump ${1:variable} +snippet ddp + use DDP; + p ${1:variable} + snippet subtest subtest '${1: test_name}' => sub { ${2} diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index 42832815..cd1224df 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -123,6 +123,8 @@ snippet ret return ${0} snippet . self. +snippet sa self.attribute = attribute + self.${1:attribute} = $1 snippet try Try/Except try: ${1:${VISUAL}} @@ -182,6 +184,10 @@ snippet ptpython # python console debugger (pudb) snippet pudb __import__('pudb').set_trace() +# python console debugger remote (pudb) +snippet pudbr + from pudb.remote import set_trace + set_trace() # pdb in nosetests snippet nosetrace __import__('nose').tools.set_trace() diff --git a/sources_non_forked/vim-snippets/snippets/r.snippets b/sources_non_forked/vim-snippets/snippets/r.snippets index 7bdeeec0..9dbe0f39 100644 --- a/sources_non_forked/vim-snippets/snippets/r.snippets +++ b/sources_non_forked/vim-snippets/snippets/r.snippets @@ -32,6 +32,10 @@ snippet for for (${1:item} in ${2:list}) { ${3} } +snippet foreach + foreach (${1:item} = ${2:list}) { + ${3} + } # functions snippet fun diff --git a/sources_non_forked/vim-snippets/snippets/rmd.snippets b/sources_non_forked/vim-snippets/snippets/rmd.snippets new file mode 100644 index 00000000..96b0ea0e --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/rmd.snippets @@ -0,0 +1,205 @@ +# +# Snipmate Snippets for Pandoc Markdown +# +# Many snippets have starred versions, i.e., versions +# that end with an asterisk (`*`). These snippets use +# vim's `"*` register---i.e., the contents of the +# system clipboard---to insert text. + +# Insert Title Block +snippet %% + % ${1:`Filename('', 'title')`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %B %Y")`} + + ${4} +snippet %%* + % ${1:`Filename('', @*)`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %b %Y")`} + + ${4} + +# Insert Definition List +snippet :: + ${1:term} + ~ ${2:definition} + +# Underline with `=`s or `-`s +snippet === + `repeat('=', strlen(getline(line(".") - 1)))` + + ${1} +snippet --- + `repeat('-', strlen(getline(line(".") - 1)))` + + ${1} + +# Links and their kin +# ------------------- +# +# (These don't play very well with delimitMate) +# + +snippet [ + [${1:link}](http://${2:url} "${3:title}")${4} +snippet [* + [${1:link}](${2:`@*`} "${3:title}")${4} + +snippet [: + [${1:id}]: http://${2:url} "${3:title}" +snippet [:* + [${1:id}]: ${2:`@*`} "${3:title}" + +snippet [@ + [${1:link}](mailto:${2:email})${3} +snippet [@* + [${1:link}](mailto:${2:`@*`})${3} + +snippet [:@ + [${1:id}]: mailto:${2:email} "${3:title}" +snippet [:@* + [${1:id}]: mailto:${2:`@*`} "${3:title}" + +snippet ![ + ![${1:alt}](${2:url} "${3:title}")${4} +snippet ![* + ![${1:alt}](${2:`@*`} "${3:title}")${4} + +snippet ![: + ![${1:id}]: ${2:url} "${3:title}" +snippet ![:* + ![${1:id}]: ${2:`@*`} "${3:title}" + +snippet [^: + [^${1:id}]: ${2:note} +snippet [^:* + [^${1:id}]: ${2:`@*`} + +# + +# library() +snippet req + require(${1:}, quietly = TRUE) +# If Condition +snippet if + if ( ${1:condition} ) + { + ${2:} + } +snippet el + else + { + ${1:} + } + +# Function +snippet fun + ${1:funname} <- # ${2:} + function + ( + ${3:} + ) + { + ${4:} + } +# repeat +snippet re + repeat{ + ${2:} + if(${1:condition}) break + } + +# matrix +snippet ma + matrix(NA, nrow = ${1:}, ncol = ${2:}) + +# data frame +snippet df + data.frame(${1:}, header = TRUE) + +snippet cmdarg + args <- commandArgs(TRUE) + if (length(args) == 0) + stop("Please give ${1:}!") + if (!all(file.exists(args))) + stop("Couln't find input files!") + +snippet getopt + require('getopt', quietly = TRUE) + opt_spec <- matrix(c( + 'help', 'h', 0, "logical", "Getting help", + 'file', 'f', 1, "character","File to process" + ), ncol = 5, byrow = TRUE) + opt <- getopt(spec = opt_spec) + if ( !is.null(opt$help) || is.null(commandArgs()) ) { + cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd")) + q(status=0) + } + # some inital value + if ( is.null(opt$???) ) { opt$??? <- ??? } + +snippet optparse + require("optparse", quietly = TRUE) + option_list <- + list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE, + help="Print line number at the beginning of each line [default]") + ) + parser <- OptionParser(usage = "%prog [options] file", option_list=option_list) + arguments <- parse_args(parser, positional_arguments = TRUE) + opt <- arguments$options + + if(length(arguments$args) != 1) { + cat("Incorrect number of required positional arguments\n\n") + print_help(parser) + stop() + } else { + file <- arguments$args + } + + if( file.access(file) == -1) { + stop(sprintf("Specified file ( %s ) does not exist", file)) + } else { + file_text <- readLines(file) + } + +snippet #! + #!/usr/bin/env Rscript + +snippet debug + # Development & Debugging, don't forget to uncomment afterwards! + #-------------------------------------------------------------------------------- + #setwd("~/Projekte/${1:}") + #opt <- list(${2:} + # ) + #-------------------------------------------------------------------------------- + + +# Took from pandoc-plugin <<<< +# Underline with `=`s or `-`s +snippet #=== + #`repeat('=', strlen(getline(line(".") - 1)))` + ${1} +snippet #--- + #`repeat('-', strlen(getline(line(".") - 1)))` + ${1} + +# >>>> + +snippet r + \`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}} + ${3:} + \`\`\` +snippet ri + \`{r ${1:}}\` + +snippet copt + \`\`\` {r setup, echo = FALSE} + opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-' + , fig.align='center', fig.show='hold', par=TRUE) + #opts_knit$set(upload.fun = imgur_upload) # upload images + \`\`\` + + +# End of File =================================================================== +# vim: set noexpandtab: diff --git a/sources_non_forked/vim-snippets/snippets/svelte.snippets b/sources_non_forked/vim-snippets/snippets/svelte.snippets new file mode 100644 index 00000000..4e09d0cc --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/svelte.snippets @@ -0,0 +1 @@ +extends html, javascript, css diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 0f8f9c03..c02d3401 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -289,7 +289,9 @@ snippet sum \sum^{}_{} snippet lim \lim_{} \\lim_{${1:n \\to \\infty}} ${0} snippet frame frame environment - \\begin{frame}[${1:t}]{${2:title}} + \\begin{frame}[${1:t}] + \frametitle{${2:title}} + \framesubtitle{${3:subtitle}} ${0:${VISUAL}} \\end{frame} snippet block block environment diff --git a/sources_non_forked/vim-snippets/snippets/vhdl.snippets b/sources_non_forked/vim-snippets/snippets/vhdl.snippets index f13f5bf9..7a991344 100644 --- a/sources_non_forked/vim-snippets/snippets/vhdl.snippets +++ b/sources_non_forked/vim-snippets/snippets/vhdl.snippets @@ -75,6 +75,16 @@ snippet prc ${2} end if; end process; +# process with clock and reset +snippet prcr + process (${1:clk}, ${2:nrst}) + begin + if ($2 = '${3:0}') then + ${4} + elsif rising_edge($1) then + ${5} + end if; + end process; # process all snippet pra process (${1:all}) From d895af51c9d71b530bf346ed9f612f61bad901c3 Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 10 May 2020 10:24:38 -0400 Subject: [PATCH 49/91] Updated plugins --- .../ale/ale_linters/bats/shellcheck.vim | 4 + .../ale/ale_linters/rust/analyzer.vim | 24 ++++ .../ale/ale_linters/sh/shellcheck.vim | 107 +------------- .../ale/autoload/ale/handlers/shellcheck.vim | 107 ++++++++++++++ sources_non_forked/ale/doc/ale-bats.txt | 13 ++ sources_non_forked/ale/doc/ale-rust.txt | 28 +++- .../doc/ale-supported-languages-and-tools.txt | 3 + sources_non_forked/ale/doc/ale.txt | 3 + sources_non_forked/ale/supported-tools.md | 3 + .../lightline-ale/autoload/lightline/ale.vim | 1 + .../lightline.vim/.github/workflows/ci.yaml | 6 +- sources_non_forked/lightline.vim/README.md | 18 ++- .../lightline/colorscheme/ayu_dark.vim | 42 ++++++ .../lightline/colorscheme/ayu_light.vim | 37 ++--- .../lightline/colorscheme/ayu_mirage.vim | 37 ++--- .../autoload/lightline/colorscheme/deus.vim | 4 +- .../lightline/colorscheme/selenized_black.vim | 49 +++++++ .../lightline/colorscheme/selenized_dark.vim | 65 +++++---- .../lightline/colorscheme/selenized_light.vim | 49 +++++++ .../lightline/colorscheme/selenized_white.vim | 49 +++++++ .../lightline.vim/colorscheme.md | 30 +++- .../lightline.vim/doc/lightline.txt | 8 +- sources_non_forked/nerdtree/CHANGELOG.md | 5 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 6 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 4 +- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 6 + .../nerdtree/plugin/NERD_tree.vim | 2 +- sources_non_forked/vim-gitgutter/README.mkd | 32 ++--- .../vim-gitgutter/autoload/gitgutter/diff.vim | 2 +- .../autoload/gitgutter/highlight.vim | 53 ++++--- .../autoload/gitgutter/utility.vim | 6 +- .../vim-gitgutter/doc/gitgutter.txt | 42 +++--- .../vim-gitgutter/plugin/gitgutter.vim | 23 ++- .../vim-javascript/syntax/javascript.vim | 10 +- .../UltiSnips/javascript_react.snippets | 2 +- .../vim-snippets/UltiSnips/rust.snippets | 12 ++ .../vim-snippets/snippets/racket.snippets | 131 +++++++++++++----- .../vim-snippets/snippets/rust.snippets | 8 ++ 38 files changed, 724 insertions(+), 307 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/bats/shellcheck.vim create mode 100644 sources_non_forked/ale/ale_linters/rust/analyzer.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim create mode 100644 sources_non_forked/ale/doc/ale-bats.txt create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_dark.vim create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim diff --git a/sources_non_forked/ale/ale_linters/bats/shellcheck.vim b/sources_non_forked/ale/ale_linters/bats/shellcheck.vim new file mode 100644 index 00000000..5c2a0ea9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/bats/shellcheck.vim @@ -0,0 +1,4 @@ +" Author: Ian2020 +" Description: shellcheck linter for bats scripts. + +call ale#handlers#shellcheck#DefineLinter('bats') diff --git a/sources_non_forked/ale/ale_linters/rust/analyzer.vim b/sources_non_forked/ale/ale_linters/rust/analyzer.vim new file mode 100644 index 00000000..3666ec03 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/analyzer.vim @@ -0,0 +1,24 @@ +" Author: Jon Gjengset +" Description: The next generation language server for Rust + +call ale#Set('rust_analyzer_executable', 'rust-analyzer') +call ale#Set('rust_analyzer_config', {}) + +function! ale_linters#rust#analyzer#GetCommand(buffer) abort + return '%e' +endfunction + +function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort + let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + + return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : '' +endfunction + +call ale#linter#Define('rust', { +\ 'name': 'analyzer', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')}, +\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, +\ 'command': function('ale_linters#rust#analyzer#GetCommand'), +\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim index 1d8b6096..d9945126 100644 --- a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim +++ b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim @@ -1,107 +1,4 @@ " Author: w0rp -" Description: This file adds support for using the shellcheck linter with -" shell scripts. +" Description: shellcheck linter for shell scripts. -" This global variable can be set with a string of comma-separated error -" codes to exclude from shellcheck. For example: -" -" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' -call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) -call ale#Set('sh_shellcheck_executable', 'shellcheck') -call ale#Set('sh_shellcheck_dialect', 'auto') -call ale#Set('sh_shellcheck_options', '') -call ale#Set('sh_shellcheck_change_directory', 1) - -function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort - let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) - - if !empty(l:shell_type) - " Use the dash dialect for /bin/ash, etc. - if l:shell_type is# 'ash' - return 'dash' - endif - - return l:shell_type - endif - - " If there's no hashbang, try using Vim's buffer variables. - if getbufvar(a:buffer, 'is_bash', 0) - return 'bash' - elseif getbufvar(a:buffer, 'is_sh', 0) - return 'sh' - elseif getbufvar(a:buffer, 'is_kornshell', 0) - return 'ksh' - endif - - return '' -endfunction - -function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort - let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') - let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') - let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') - let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' - let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' - - if l:dialect is# 'auto' - let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) - endif - - return l:cd_string - \ . '%e' - \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') - \ . l:external_option - \ . ' -f gcc -' -endfunction - -function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - if l:match[4] is# 'error' - let l:type = 'E' - elseif l:match[4] is# 'note' - let l:type = 'I' - else - let l:type = 'W' - endif - - let l:item = { - \ 'lnum': str2nr(l:match[2]), - \ 'type': l:type, - \ 'text': l:match[5], - \ 'code': l:match[6], - \} - - if !empty(l:match[3]) - let l:item.col = str2nr(l:match[3]) - endif - - " If the filename is something like , or -, then - " this is an error for the file we checked. - if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' - let l:item['filename'] = l:match[1] - endif - - call add(l:output, l:item) - endfor - - return l:output -endfunction - -call ale#linter#Define('sh', { -\ 'name': 'shellcheck', -\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, -\ 'command': {buffer -> ale#semver#RunWithVersionCheck( -\ buffer, -\ ale#Var(buffer, 'sh_shellcheck_executable'), -\ '%e --version', -\ function('ale_linters#sh#shellcheck#GetCommand'), -\ )}, -\ 'callback': 'ale_linters#sh#shellcheck#Handle', -\}) +call ale#handlers#shellcheck#DefineLinter('sh') diff --git a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim new file mode 100644 index 00000000..b16280f0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim @@ -0,0 +1,107 @@ +" Author: w0rp +" Description: This file adds support for using the shellcheck linter + +function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort + let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + + if !empty(l:shell_type) + " Use the dash dialect for /bin/ash, etc. + if l:shell_type is# 'ash' + return 'dash' + endif + + return l:shell_type + endif + + " If there's no hashbang, try using Vim's buffer variables. + if getbufvar(a:buffer, 'is_bash', 0) + return 'bash' + elseif getbufvar(a:buffer, 'is_sh', 0) + return 'sh' + elseif getbufvar(a:buffer, 'is_kornshell', 0) + return 'ksh' + endif + + return '' +endfunction + +function! ale#handlers#shellcheck#GetCommand(buffer, version) abort + let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') + let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') + let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') + let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' + let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory') + \ ? ale#path#BufferCdString(a:buffer) + \ : '' + + if l:dialect is# 'auto' + let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer) + endif + + return l:cd_string + \ . '%e' + \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') + \ . l:external_option + \ . ' -f gcc -' +endfunction + +function! ale#handlers#shellcheck#Handle(buffer, lines) abort + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if l:match[4] is# 'error' + let l:type = 'E' + elseif l:match[4] is# 'note' + let l:type = 'I' + else + let l:type = 'W' + endif + + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:type, + \ 'text': l:match[5], + \ 'code': l:match[6], + \} + + if !empty(l:match[3]) + let l:item.col = str2nr(l:match[3]) + endif + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +function! ale#handlers#shellcheck#DefineLinter(filetype) abort + " This global variable can be set with a string of comma-separated error + " codes to exclude from shellcheck. For example: + " let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' + call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) + call ale#Set('sh_shellcheck_executable', 'shellcheck') + call ale#Set('sh_shellcheck_dialect', 'auto') + call ale#Set('sh_shellcheck_options', '') + call ale#Set('sh_shellcheck_change_directory', 1) + + call ale#linter#Define(a:filetype, { + \ 'name': 'shellcheck', + \ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, + \ 'command': {buffer -> ale#semver#RunWithVersionCheck( + \ buffer, + \ ale#Var(buffer, 'sh_shellcheck_executable'), + \ '%e --version', + \ function('ale#handlers#shellcheck#GetCommand'), + \ )}, + \ 'callback': 'ale#handlers#shellcheck#Handle', + \}) +endfunction diff --git a/sources_non_forked/ale/doc/ale-bats.txt b/sources_non_forked/ale/doc/ale-bats.txt new file mode 100644 index 00000000..cf2199ec --- /dev/null +++ b/sources_non_forked/ale/doc/ale-bats.txt @@ -0,0 +1,13 @@ +=============================================================================== +ALE Bats Integration *ale-bats-options* + + +=============================================================================== +shellcheck *ale-bats-shellcheck* + +The `shellcheck` linter for Bats uses the sh options for `shellcheck`; see: +|ale-sh-shellcheck|. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 44a79b18..46d4714b 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -9,7 +9,7 @@ Integration Information files for Rust distributed in Vim >=8.0.0501 or upstream: https://github.com/rust-lang/rust.vim - Note that there are three possible linters for Rust files: + Note that there are several possible linters and fixers for Rust files: 1. rustc -- The Rust compiler is used to check the currently edited file. So, if your project consists of multiple files, you will get some errors @@ -23,7 +23,12 @@ Integration Information over cargo. rls implements the Language Server Protocol for incremental compilation of Rust code, and can check Rust files while you type. `rls` requires Rust files to contained in Cargo projects. - 4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to + 4. analyzer -- If you have rust-analyzer installed, you might prefer using + this linter over cargo and rls. rust-analyzer also implements the + Language Server Protocol for incremental compilation of Rust code, and is + the next iteration of rls. rust-analyzer, like rls, requires Rust files + to contained in Cargo projects. + 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. Only cargo is enabled by default. To switch to using rustc instead of cargo, @@ -36,6 +41,25 @@ Integration Information Also note that rustc 1.12. or later is needed. +=============================================================================== +analyzer *ale-rust-analyzer* + +g:ale_rust_analyzer_executable *g:ale_rust_analyzer_executable* + *b:ale_rust_analyzer_executable* + Type: |String| + Default: `'rust-analyzer'` + + This variable can be modified to change the executable path for + `rust-analyzer`. + + +g:ale_rust_analyzer_config *g:ale_rust_analyzer_config* + *b:ale_rust_analyzer_config* + Type: |Dictionary| + Default: `{}` + + Dictionary with configuration settings for rust-analyzer. + =============================================================================== cargo *ale-rust-cargo* diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 636985fb..bd2d5b4a 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -35,6 +35,8 @@ Notes: * `shell` (-n flag) * `shellcheck` * `shfmt` +* Bats + * `shellcheck` * BibTeX * `bibclean` * Bourne Shell @@ -408,6 +410,7 @@ Notes: * Rust * `cargo`!! * `rls` + * `rust-analyzer` * `rustc` (see |ale-integration-rust|) * `rustfmt` * Sass diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 16b204a4..8d5b8820 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -2279,6 +2279,8 @@ documented in additional help files. gcc...................................|ale-asm-gcc| awk.....................................|ale-awk-options| gawk..................................|ale-awk-gawk| + bats....................................|ale-bats-options| + shellcheck............................|ale-bats-shellcheck| bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| c.......................................|ale-c-options| @@ -2579,6 +2581,7 @@ documented in additional help files. sorbet................................|ale-ruby-sorbet| standardrb............................|ale-ruby-standardrb| rust....................................|ale-rust-options| + analyzer..............................|ale-rust-analyzer| cargo.................................|ale-rust-cargo| rls...................................|ale-rust-rls| rustc.................................|ale-rust-rustc| diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index d5c0c9d4..f6b26458 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -44,6 +44,8 @@ formatting. * shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) +* Bats + * [shellcheck](https://www.shellcheck.net/) * BibTeX * [bibclean](http://ftp.math.utah.edu/pub/bibclean/) * Bourne Shell @@ -417,6 +419,7 @@ formatting. * Rust * [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions) * [rls](https://github.com/rust-lang-nursery/rls) :warning: + * [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning: * [rustc](https://www.rust-lang.org/) :warning: * [rustfmt](https://github.com/rust-lang-nursery/rustfmt) * Sass diff --git a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim index 0b34f7bc..c04f5ab7 100644 --- a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim +++ b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim @@ -52,6 +52,7 @@ endfunction function! lightline#ale#linted() abort return get(g:, 'ale_enabled', 0) == 1 + \ && getbufvar(bufnr(''), 'ale_enabled', 1) \ && getbufvar(bufnr(''), 'ale_linted', 0) > 0 \ && ale#engine#IsCheckingBuffer(bufnr('')) == 0 endfunction diff --git a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml index 0a3e5685..967fbb2e 100644 --- a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml +++ b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml @@ -1,6 +1,10 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: jobs: test: diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index bb116378..583f02ea 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -17,23 +17,31 @@ https://github.com/itchyny/lightline.vim ### solarized dark -![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) +![lightline.vim - solarized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) ### solarized light -![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) +![lightline.vim - solarized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) + +### PaperColor dark + +![lightline.vim - PaperColor dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_dark.png) ### PaperColor light -![lightline.vim - PaperColor](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor.png) +![lightline.vim - PaperColor light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) ### seoul256 ![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png) -### one +### one dark -![lightline.vim - one](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one.png) +![lightline.vim - one dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) + +### one light + +![lightline.vim - one light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) ### landscape diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_dark.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_dark.vim new file mode 100644 index 00000000..cb10a258 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_dark.vim @@ -0,0 +1,42 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/ayu_dark.vim +" Author: danielpeng2 +" License: MIT License +" Last Change: 2020/05/01 19:37:33. +" ============================================================================= + +let s:base0 = '#e6e1cf' +let s:base1 = '#e6e1cf' +let s:base2 = '#3e4b59' +let s:base3 = '#e6e1cf' +let s:base00 = '#14191f' +let s:base01 = '#14191f' +let s:base02 = '#0f1419' +let s:base023 = '#0f1419' +let s:base03 = '#e6b673' +let s:yellow = '#e6b673' +let s:orange = '#ff7733' +let s:red = '#f07178' +let s:magenta = '#ffee99' +let s:blue = '#36a3d9' +let s:cyan = s:blue +let s:green = '#b8cc52' + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} +let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] +let s:p.normal.middle = [ [ s:base2, s:base02 ] ] +let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] +let s:p.inactive.left = [ [ s:base1, s:base01 ], [ s:base3, s:base01 ] ] +let s:p.inactive.middle = [ [ s:base1, s:base023 ] ] +let s:p.inactive.right = [ [ s:base1, s:base01 ], [ s:base2, s:base02 ] ] +let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] +let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ] +let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ] +let s:p.tabline.tabsel = [ [ s:base02, s:base03 ] ] +let s:p.tabline.left = [ [ s:base3, s:base00 ] ] +let s:p.tabline.middle = [ [ s:base2, s:base02 ] ] +let s:p.tabline.right = [ [ s:base2, s:base00 ] ] +let s:p.normal.error = [ [ s:base03, s:red ] ] +let s:p.normal.warning = [ [ s:base023, s:yellow ] ] + +let g:lightline#colorscheme#ayu_dark#palette = lightline#colorscheme#fill(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim index 9505c01d..d1f781aa 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_light.vim @@ -2,24 +2,26 @@ " Filename: autoload/lightline/colorscheme/ayu_light.vim " Author: christalib " License: MIT License -" Last Change: 2020/02/15 18:45:57. +" Last Change: 2020/05/01 19:38:21. " ============================================================================= -let s:base0 = [ '#5C6773', 244 ] -let s:base1 = [ '#5C6773', 247 ] -let s:base2 = [ '#828C99', 248 ] -let s:base3 = [ '#5C6773', 252 ] -let s:base00 = [ '#FFFFFF', 242 ] -let s:base01 = [ '#FFFFFF', 240 ] -let s:base02 = [ '#FAFAFA', 238 ] -let s:base023 = [ '#FAFAFA', 236 ] -let s:base03 = [ '#E6B673', 235 ] -let s:yellow = [ '#E6B673', 180 ] -let s:orange = [ '#FF7733', 173 ] -let s:red = [ '#f07178', 203 ] -let s:magenta = [ '#A37ACC', 216 ] -let s:blue = [ '#59c2ff', 117 ] + +let s:base0 = '#5C6773' +let s:base1 = '#5C6773' +let s:base2 = '#828C99' +let s:base3 = '#5C6773' +let s:base00 = '#FFFFFF' +let s:base01 = '#FFFFFF' +let s:base02 = '#FAFAFA' +let s:base023 = '#FAFAFA' +let s:base03 = '#E6B673' +let s:yellow = '#E6B673' +let s:orange = '#FF7733' +let s:red = '#f07178' +let s:magenta = '#A37ACC' +let s:blue = '#59c2ff' let s:cyan = s:blue -let s:green = [ '#86B300', 119 ] +let s:green = '#86B300' + let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] let s:p.normal.middle = [ [ s:base2, s:base02 ] ] @@ -36,4 +38,5 @@ let s:p.tabline.middle = [ [ s:base2, s:base02 ] ] let s:p.tabline.right = [ [ s:base2, s:base00 ] ] let s:p.normal.error = [ [ s:base03, s:red ] ] let s:p.normal.warning = [ [ s:base023, s:yellow ] ] -let g:lightline#colorscheme#ayu_light#palette = lightline#colorscheme#flatten(s:p) + +let g:lightline#colorscheme#ayu_light#palette = lightline#colorscheme#fill(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim index 85da9025..fe7506fb 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/ayu_mirage.vim @@ -2,24 +2,26 @@ " Filename: autoload/lightline/colorscheme/ayu_mirage.vim " Author: impulse " License: MIT License -" Last Change: 2019/08/11 11:52:20. +" Last Change: 2020/05/01 19:37:21. " ============================================================================= -let s:base0 = [ '#d9d7ce', 244 ] -let s:base1 = [ '#d9d7ce', 247 ] -let s:base2 = [ '#607080', 248 ] -let s:base3 = [ '#d9d7ce', 252 ] -let s:base00 = [ '#272d38', 242 ] -let s:base01 = [ '#272d38', 240 ] -let s:base02 = [ '#212733', 238 ] -let s:base023 = [ '#212733', 236 ] -let s:base03 = [ '#ffc44c', 235 ] -let s:yellow = [ '#ffc44c', 180 ] -let s:orange = [ '#ffae57', 173 ] -let s:red = [ '#f07178', 203 ] -let s:magenta = [ '#d4bfff', 216 ] -let s:blue = [ '#59c2ff', 117 ] + +let s:base0 = '#d9d7ce' +let s:base1 = '#d9d7ce' +let s:base2 = '#607080' +let s:base3 = '#d9d7ce' +let s:base00 = '#272d38' +let s:base01 = '#272d38' +let s:base02 = '#212733' +let s:base023 = '#212733' +let s:base03 = '#ffc44c' +let s:yellow = '#ffc44c' +let s:orange = '#ffae57' +let s:red = '#f07178' +let s:magenta = '#d4bfff' +let s:blue = '#59c2ff' let s:cyan = s:blue -let s:green = [ '#bbe67e', 119 ] +let s:green = '#bbe67e' + let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] let s:p.normal.middle = [ [ s:base2, s:base02 ] ] @@ -36,4 +38,5 @@ let s:p.tabline.middle = [ [ s:base2, s:base02 ] ] let s:p.tabline.right = [ [ s:base2, s:base00 ] ] let s:p.normal.error = [ [ s:base03, s:red ] ] let s:p.normal.warning = [ [ s:base023, s:yellow ] ] -let g:lightline#colorscheme#ayu_mirage#palette = lightline#colorscheme#flatten(s:p) + +let g:lightline#colorscheme#ayu_mirage#palette = lightline#colorscheme#fill(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim index 7471a6b5..3f9f2265 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/deus.vim @@ -23,9 +23,9 @@ let s:p.inactive.left = s:p.inactive.right[1:] let s:p.insert.left = [ [ '#292c33', '#61afef', s:term_black, s:term_blue, 'bold' ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ] let s:p.insert.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue ], [ '#ABB2BF', '#3E4452', s:term_white, s:term_grey ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ] let s:p.replace.left = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ] -let s:p.replace.right = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], s:p.normal.right[1], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ] +let s:p.replace.right = [ [ '#292c33', '#e06c75', s:term_black, s:term_red ], s:p.normal.right[1], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ] let s:p.visual.left = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ] -let s:p.visual.right = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], s:p.normal.right[1], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ] +let s:p.visual.right = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple ], s:p.normal.right[1], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ] let s:p.normal.middle = [ [ '#abb2bf', '#292c33', s:term_white, s:term_black ] ] let s:p.insert.middle = s:p.normal.middle let s:p.replace.middle = s:p.normal.middle diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim new file mode 100644 index 00000000..4b497938 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim @@ -0,0 +1,49 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/selenized_black.vim +" Author: itchyny +" License: MIT License +" Last Change: 2020/05/02 16:56:50. +" ============================================================================= + +" https://github.com/jan-warchol/selenized/blob/master/the-values.md#selenized-black +let s:bg_1 = ['#252525', 0] +let s:bg_2 = ['#3b3b3b', 8] +let s:dim_0 = ['#777777', 7] +let s:red = ['#ed4a46', 1] +let s:green = ['#70b433', 2] +let s:yellow = ['#dbb32d', 3] +let s:blue = ['#368aeb', 4] +let s:magenta = ['#eb6eb7', 5] +let s:cyan = ['#3fc5b7', 6] +let s:brred = ['#ff5e56', 9] +let s:brgreen = ['#83c746', 10] +let s:bryellow = ['#efc541', 11] +let s:brblue = ['#4f9cfe', 12] +let s:brmagenta = ['#ff81ca', 13] +let s:brcyan = ['#56d8c9', 14] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} + +let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] +let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.error = [[ s:bg_1, s:red ]] +let s:p.normal.warning = [[ s:bg_1, s:yellow ]] + +let s:p.insert.right = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.insert.left = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ]] + +let s:p.visual.right = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.visual.left = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ]] + +let s:p.inactive.left = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] +let s:p.inactive.right = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] + +let s:p.replace.right = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.replace.left = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ]] + +let s:p.tabline.right = [[ s:bg_1, s:red ]] +let s:p.tabline.left = [[ s:cyan, s:bg_2 ]] +let s:p.tabline.tabsel = [[ s:bg_1, s:blue ]] + +let g:lightline#colorscheme#selenized_black#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim index 585b948b..619ee8c9 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim @@ -2,49 +2,48 @@ " Filename: autoload/lightline/colorscheme/selenized_dark.vim " Author: Charles Hall " License: MIT License -" Last Change: 2019/07/22 11:05:34. +" Last Change: 2020/05/02 16:53:17. " ============================================================================= " https://github.com/jan-warchol/selenized/blob/master/the-values.md#selenized-dark -let s:black = [ "#184956", 0 ] -let s:red = [ "#fa5750", 1 ] -let s:green = [ "#75b938", 2 ] -let s:yellow = [ "#dbb32d", 3 ] -let s:blue = [ "#4695f7", 4 ] -let s:magenta = [ "#f275be", 5 ] -let s:cyan = [ "#41c7b9", 6 ] -let s:white = [ "#72898f", 7 ] -let s:brblack = [ "#2d5b69", 8 ] -let s:brred = [ "#ff665c", 9 ] -let s:brgreen = [ "#84c747", 10 ] -let s:bryellow = [ "#ebc13d", 11 ] -let s:brblue = [ "#58a3ff", 12 ] -let s:brmagenta = [ "#ff84cd", 13 ] -let s:brcyan = [ "#53d6c7", 14 ] -let s:brwhite = [ "#cad8d9", 15 ] +let s:bg_1 = ['#184956', 0] +let s:bg_2 = ['#2d5b69', 8] +let s:dim_0 = ['#72898f', 7] +let s:red = ['#fa5750', 1] +let s:green = ['#75b938', 2] +let s:yellow = ['#dbb32d', 3] +let s:blue = ['#4695f7', 4] +let s:magenta = ['#f275be', 5] +let s:cyan = ['#41c7b9', 6] +let s:brred = ['#ff665c', 9] +let s:brgreen = ['#84c747', 10] +let s:bryellow = ['#ebc13d', 11] +let s:brblue = ['#58a3ff', 12] +let s:brmagenta = ['#ff84cd', 13] +let s:brcyan = ['#53d6c7', 14] let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.right = [[ s:black, s:blue ],[ s:cyan, s:brblack ],[ s:white, s:black ]] -let s:p.normal.left = [[ s:black, s:blue ],[ s:cyan, s:brblack ]] -let s:p.normal.middle = [[ s:black, s:black ]] -let s:p.normal.error = [[ s:black, s:red ]] -let s:p.normal.warning = [[ s:black, s:yellow ]] +let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] +let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.error = [[ s:bg_1, s:red ]] +let s:p.normal.warning = [[ s:bg_1, s:yellow ]] -let s:p.insert.right = [[ s:black, s:green ],[ s:cyan, s:brblack ],[ s:white, s:black ]] -let s:p.insert.left = [[ s:black, s:green ],[ s:cyan, s:brblack ]] +let s:p.insert.right = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.insert.left = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ]] -let s:p.visual.right = [[ s:black, s:magenta ],[ s:cyan, s:brblack ],[ s:white, s:black ]] -let s:p.visual.left = [[ s:black, s:magenta ],[ s:cyan, s:brblack ]] +let s:p.visual.right = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.visual.left = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ]] -let s:p.inactive.left = [[ s:brblue, s:brblack ],[ s:cyan, s:brblack ]] -let s:p.inactive.right = [[ s:brblue, s:brblack ],[ s:cyan, s:brblack ]] +let s:p.inactive.left = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] +let s:p.inactive.right = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] -let s:p.replace.right = [[ s:black, s:red ],[ s:cyan, s:brblack ],[ s:white, s:black ]] -let s:p.replace.left = [[ s:black, s:red ],[ s:cyan, s:brblack ]] +let s:p.replace.right = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.replace.left = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ]] -let s:p.tabline.right = [[ s:black, s:red ]] -let s:p.tabline.left = [[ s:cyan, s:brblack ]] -let s:p.tabline.tabsel = [[ s:black, s:blue ]] +let s:p.tabline.right = [[ s:bg_1, s:red ]] +let s:p.tabline.left = [[ s:cyan, s:bg_2 ]] +let s:p.tabline.tabsel = [[ s:bg_1, s:blue ]] let g:lightline#colorscheme#selenized_dark#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim new file mode 100644 index 00000000..1b3f2110 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim @@ -0,0 +1,49 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/selenized_light.vim +" Author: itchyny +" License: MIT License +" Last Change: 2020/05/02 16:58:00. +" ============================================================================= + +" https://github.com/jan-warchol/selenized/blob/master/the-values.md#selenized-light +let s:bg_1 = ['#ece3cc', 0] +let s:bg_2 = ['#d5cdb6', 8] +let s:dim_0 = ['#909995', 7] +let s:red = ['#d2212d', 1] +let s:green = ['#489100', 2] +let s:yellow = ['#ad8900', 3] +let s:blue = ['#0072d4', 4] +let s:magenta = ['#ca4898', 5] +let s:cyan = ['#009c8f', 6] +let s:brred = ['#cc1729', 9] +let s:brgreen = ['#428b00', 10] +let s:bryellow = ['#a78300', 11] +let s:brblue = ['#006dce', 12] +let s:brmagenta = ['#c44392', 13] +let s:brcyan = ['#00978a', 14] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} + +let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] +let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.error = [[ s:bg_1, s:red ]] +let s:p.normal.warning = [[ s:bg_1, s:yellow ]] + +let s:p.insert.right = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.insert.left = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ]] + +let s:p.visual.right = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.visual.left = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ]] + +let s:p.inactive.left = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] +let s:p.inactive.right = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] + +let s:p.replace.right = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.replace.left = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ]] + +let s:p.tabline.right = [[ s:bg_1, s:red ]] +let s:p.tabline.left = [[ s:cyan, s:bg_2 ]] +let s:p.tabline.tabsel = [[ s:bg_1, s:blue ]] + +let g:lightline#colorscheme#selenized_light#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim new file mode 100644 index 00000000..402818e4 --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim @@ -0,0 +1,49 @@ +" ============================================================================= +" Filename: autoload/whiteline/colorscheme/selenized_white.vim +" Author: itchyny +" License: MIT License +" Last Change: 2020/05/03 19:34:07. +" ============================================================================= + +" https://github.com/jan-warchol/selenized/blob/master/the-values.md#selenized-white +let s:bg_1 = ['#ebebeb', 0] +let s:bg_2 = ['#cdcdcd', 8] +let s:dim_0 = ['#878787', 7] +let s:red = ['#d6000c', 1] +let s:green = ['#1d9700', 2] +let s:yellow = ['#c49700', 3] +let s:blue = ['#0064e4', 4] +let s:magenta = ['#dd0f9d', 5] +let s:cyan = ['#00ad9c', 6] +let s:brred = ['#bf0000', 9] +let s:brgreen = ['#008400', 10] +let s:bryellow = ['#af8500', 11] +let s:brblue = ['#0054cf', 12] +let s:brmagenta = ['#c7008b', 13] +let s:brcyan = ['#009a8a', 14] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} + +let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] +let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.error = [[ s:bg_1, s:red ]] +let s:p.normal.warning = [[ s:bg_1, s:yellow ]] + +let s:p.insert.right = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.insert.left = [[ s:bg_1, s:green ], [ s:cyan, s:bg_2 ]] + +let s:p.visual.right = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.visual.left = [[ s:bg_1, s:magenta ], [ s:cyan, s:bg_2 ]] + +let s:p.inactive.left = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] +let s:p.inactive.right = [[ s:brblue, s:bg_2 ], [ s:cyan, s:bg_2 ]] + +let s:p.replace.right = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] +let s:p.replace.left = [[ s:bg_1, s:red ], [ s:cyan, s:bg_2 ]] + +let s:p.tabline.right = [[ s:bg_1, s:red ]] +let s:p.tabline.left = [[ s:cyan, s:bg_2 ]] +let s:p.tabline.tabsel = [[ s:bg_1, s:blue ]] + +let g:lightline#colorscheme#selenized_white#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index 14fa1787..6d431830 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -22,7 +22,7 @@ ### PaperColor light -![lightline.vim - PaperColor light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor.png) +![lightline.vim - PaperColor light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) ### Tomorrow @@ -52,6 +52,10 @@ ![lightline.vim - ayu light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_light.png) +### ayu_dark + +![lightline.vim - ayu dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_dark.png) + ### darcula ![lightline.vim - darcula](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/darcula.png) @@ -68,13 +72,25 @@ ![lightline.vim - selenized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_dark.png) +### selenized black + +![lightline.vim - selenized black](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_black.png) + +### selenized light + +![lightline.vim - selenized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_light.png) + +### selenized white + +![lightline.vim - selenized white](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_white.png) + ### solarized dark -![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) +![lightline.vim - solarized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) ### solarized light -![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) +![lightline.vim - solarized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) ### materia @@ -96,9 +112,13 @@ ![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png) -### one +### one dark -![lightline.vim - one](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one.png) +![lightline.vim - one dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) + +### one light + +![lightline.vim - one light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) ### srcery_drk diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 10ab0987..1b308e99 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2020/02/15 18:44:06. +Last Change: 2020/05/02 17:05:15. CONTENTS *lightline-contents* @@ -227,11 +227,13 @@ OPTIONS *lightline-option* g:lightline.colorscheme *g:lightline.colorscheme* The colorscheme for lightline.vim. Currently, wombat, solarized, powerline, powerlineish, - jellybeans, molokai, seoul256, darcula, selenized_dark, + jellybeans, molokai, seoul256, darcula, + selenized_dark, selenized_black, selenized_light, selenized_white, Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor, landscape, one, materia, material, OldHope, nord, deus, - srcery_drk, ayu_mirage, ayu_light and 16color are available. + simpleblack, srcery_drk, ayu_mirage, ayu_light, ayu_dark and + 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index d0de2be7..0bcf4d74 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -5,7 +5,10 @@ - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> #### 6.7 -- **.7**: Put '%' argument in bufname() for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105) +- **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120) +- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118) +- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116) +- **.7**: Put `'%'` argument in `bufname()` for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105) - **.6**: If a file's already open in the window, don't edit it again. (PhilRunninger) [#1103](https://github.com/preservim/nerdtree/pull/1103) - **.5**: Prevent unneeded tree creation in `:NERDTreeToggle[VCS] ` (PhilRunninger) [#1101](https://github.com/preservim/nerdtree/pull/1101) - **.4**: Add missing calls to the `shellescape()` function (lifecrisis) [#1099](https://github.com/preservim/nerdtree/pull/1099) diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 47d65ccc..6c11a94d 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1353,12 +1353,12 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* Example: > call NERDTreeAddKeyMap({ \ 'key': 'foo', - \ 'callback': 'NERDTreeCDHandler', + \ 'callback': 'NERDTreeEchoPathHandler', \ 'quickhelpText': 'echo full path of current node', \ 'scope': 'DirNode' }) - function! NERDTreeCDHandler(dirnode) - call a:dirnode.changeToDir() + function! NERDTreeEchoPathHandler(dirnode) + echo a:dirnode.path.str() endfunction < This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index a48f6a86..982db16c 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -96,9 +96,9 @@ endfunction "FUNCTION: s:NERDTree.CursorToTreeWin(){{{1 "Places the cursor in the nerd tree window -function! s:NERDTree.CursorToTreeWin() +function! s:NERDTree.CursorToTreeWin(...) call g:NERDTree.MustBeOpen() - call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', 1) + call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', a:0 >0 ? a:1 : 1) endfunction " Function: s:NERDTree.ExistsForBuffer() {{{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 88ac319f..14d29964 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -377,11 +377,17 @@ endfunction " 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. +" Also, return false if this directory is the tree root, which should never be +" part of a cascade. function! s:TreeDirNode.isCascadable() if g:NERDTreeCascadeSingleChildDir ==# 0 return 0 endif + if self.isRoot() + return 0 + endif + if self.path.isSymLink return 0 endif diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 639f87bb..ca8070d1 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -217,7 +217,7 @@ endfunction function! NERDTreeFocus() if g:NERDTree.IsOpen() - call g:NERDTree.CursorToTreeWin() + call g:NERDTree.CursorToTreeWin(0) else call g:NERDTreeCreator.ToggleTabTree('') endif diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 9c5e48c2..350cebe6 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -137,12 +137,15 @@ The same caveat applies to line number highlighting as to line highlighting just If you switch off both line highlighting and signs, you won't see the sign column. -To keep your Vim snappy, vim-gitgutter will suppress the signs when a file has more than 500 changes. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with: +In older Vims (pre 8.1.0614 / Neovim 0.4.0) vim-gitgutter will suppress the signs when a file has more than 500 changes, to avoid slowing down the UI. As soon as the number of changes falls below the limit vim-gitgutter will show the signs again. You can configure the threshold with: ```viml -let g:gitgutter_max_signs = 500 " default value +let g:gitgutter_max_signs = 500 " default value (Vim < 8.1.0614, Neovim < 0.4.0) +let g:gitgutter_max_signs = -1 " default value (otherwise) ``` +You can also remove the limit by setting `g:gitgutter_max_signs = -1`. + #### Hunks You can jump between hunks: @@ -287,19 +290,14 @@ Please note that vim-gitgutter won't override any colours or highlights you've s #### Sign column -By default vim-gitgutter will make the sign column look like the line number column. - -To customise your sign column's background color, first tell vim-gitgutter to leave it alone: +Set the `SignColumn` highlight group to change the sign column's colour. For example: ```viml -let g:gitgutter_override_sign_column_highlight = 0 -``` +" vim-gitgutter used to do this by default: +highlight! link SignColumn LineNr -And then either update your colorscheme's `SignColumn` highlight group or set it in your vimrc: - -```viml -highlight SignColumn ctermbg=whatever " terminal Vim -highlight SignColumn guibg=whatever " gVim/MacVim +" or you could do this: +highlight SignColumn guibg=whatever ctermbg=whatever ``` By default the sign column will appear when there are signs to show and disappear when there aren't. To always have the sign column, add to your vimrc: @@ -318,13 +316,15 @@ let g:gitgutter_sign_allow_clobber = 1 #### Signs' colours and symbols -If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use those for the signs' colours. +If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use them for the signs' colours. -Otherwise it will use your colourscheme's `Diff*` highlight groups. +If you want the background colours to match the sign column, but don't want to update the `GitGutter*` groups yourself, you can get the plugin to do it: -Either way the signs' background colours will be set to the sign column's background colour. +```viml +let g:gitgutter_set_sign_backgrounds = 1 +``` -If you don't like the colours, specify the ones you want in your vimrc (see `:help highlight-guifg` and `:help highlight-ctermfg`). For example, to get vim-gitgutter's original colours (based on git-diff's colours in my terminal): +If no `GitGutter*` highlight groups exist, the plugin will check the `Diff*` highlight groups. If their foreground colours differ the plugin will use them; if not, these colours will be used: ```viml highlight GitGutterAdd guifg=#009900 ctermfg=2 diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 04a0de97..55670092 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -182,7 +182,7 @@ function! gitgutter#diff#handler(bufnr, diff) abort let modified_lines = gitgutter#diff#process_hunks(a:bufnr, gitgutter#hunk#hunks(a:bufnr)) let signs_count = len(modified_lines) - if signs_count > g:gitgutter_max_signs + if g:gitgutter_max_signs != -1 && signs_count > g:gitgutter_max_signs call gitgutter#utility#warn_once(a:bufnr, printf( \ 'exceeded maximum number of signs (%d > %d, configured by g:gitgutter_max_signs).', \ signs_count, g:gitgutter_max_signs), 'max_signs') diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim index da8ecbd0..1439b721 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim @@ -64,14 +64,6 @@ function! gitgutter#highlight#linenr_toggle() abort endfunction -function! gitgutter#highlight#define_sign_column_highlight() abort - if g:gitgutter_override_sign_column_highlight - highlight! link SignColumn LineNr - else - highlight default link SignColumn LineNr - endif -endfunction - function! gitgutter#highlight#define_highlights() abort let [guibg, ctermbg] = s:get_background_colors('SignColumn') @@ -84,26 +76,24 @@ function! gitgutter#highlight#define_highlights() abort highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible " When they are visible. - - " If GitGutter* highlights are already defined, either by the user or the colourscheme, - " set their backgrounds to the sign column's. for type in ["Add", "Change", "Delete"] if hlexists("GitGutter".type) - " Were the highlight self-contained we could just declare the - " background attributes and they would be merged. But it might be a - " link, in which case it would be overwritten. So re-declare it in its - " entirety. - let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type) - execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg + if g:gitgutter_set_sign_backgrounds + execute "highlight GitGutter".type." guibg=".guibg." ctermbg=".ctermbg + endif + continue + elseif s:useful_diff_colours() + let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type) + else + let [guifg, ctermfg] = s:get_foreground_fallback_colors(type) endif + execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg endfor - " By default use Diff* foreground colors with SignColumn's background. - for type in ['Add', 'Change', 'Delete'] - let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type) - execute "highlight GitGutter".type."Default guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg - execute "highlight default link GitGutter".type." GitGutter".type."Default" - endfor + if hlexists("GitGutterChangeDelete") && g:gitgutter_set_sign_backgrounds + execute "highlight GitGutterChangeDelete guibg=".guibg." ctermbg=".ctermbg + endif + highlight default link GitGutterChangeDelete GitGutterChange " Highlights used for the whole line. @@ -236,3 +226,20 @@ function! s:get_background_colors(group) abort let guibg = s:get_hl(a:group, 'bg', 'gui') return [guibg, ctermbg] endfunction + +function! s:useful_diff_colours() + let [guifg_add, ctermfg_add] = s:get_foreground_colors('DiffAdd') + let [guifg_del, ctermfg_del] = s:get_foreground_colors('DiffDelete') + + return guifg_add != guifg_del && ctermfg_add != ctermfg_del +endfunction + +function! s:get_foreground_fallback_colors(type) + if a:type == 'Add' + return ['#009900', '2'] + elseif a:type == 'Change' + return ['#bbbb00', '3'] + elseif a:type == 'Delete' + return ['#ff2222', '1'] + endif +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim index 4151aea2..4a02c2fb 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -162,7 +162,7 @@ endfunction function! gitgutter#utility#cd_cmd(bufnr, cmd) abort - let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() ? 'cd /d' : 'cd') + let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() && s:dos_shell() ? 'cd /d' : 'cd') return cd.' '.s:dir(a:bufnr).' && '.a:cmd endfunction @@ -170,6 +170,10 @@ function! s:unc_path(bufnr) return s:abs_path(a:bufnr, 0) =~ '^\\\\' endfunction +function! s:dos_shell() + return &shell == 'cmd.exe' || &shell == 'command.com' +endfunction + function! s:use_known_shell() abort if has('unix') && &shell !=# 'sh' let [s:shell, s:shellcmdflag, s:shellredir] = [&shell, &shellcmdflag, &shellredir] diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index e8f81789..2d744a8e 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -306,7 +306,7 @@ Signs:~ |g:gitgutter_sign_removed| |g:gitgutter_sign_removed_first_line| |g:gitgutter_sign_modified_removed| - |g:gitgutter_override_sign_column_highlight| + |g:gitgutter_set_sign_backgrounds| Hunk previews:~ @@ -412,13 +412,16 @@ Default: 0 Determines whether or not to show line number highlights. *g:gitgutter_max_signs* -Default: 500 +Default: 500 (Vim < 8.1.0614, Neovim < 0.4.0) + -1 (otherwise) Sets the maximum number of signs to show in a buffer. Vim is slow at updating signs, so to avoid slowing down the GUI the number of signs is capped. When the number of changed lines exceeds this value, the plugin removes all signs and displays a warning message. +When set to -1 the limit is not applied. + *g:gitgutter_sign_priority* Default: 10 @@ -447,26 +450,14 @@ Defaults: You can use unicode characters but not images. Signs must not take up more than 2 columns. - *g:gitgutter_override_sign_column_highlight* -Default: 1 + *g:gitgutter_set_sign_backgrounds* +Default: 0 -Controls whether to make the sign column look like the line-number column (i.e. -the |hl-LineNr| highlight group). - -To customise your sign column's background color, first tell vim-gitgutter to -leave it alone: -> - let g:gitgutter_override_sign_column_highlight = 0 -< - -And then either update your colorscheme's |hlSignColumn| highlight group or set -it in your |vimrc|: - - Desired appearance Command ~ - Same as line-number column highlight clear SignColumn - User-defined (terminal Vim) highlight SignColumn ctermbg={whatever} - User-defined (graphical Vim) highlight SignColumn guibg={whatever} +Only applies to existing GitGutter* highlight groups. See +|gitgutter-highlights|. +Controls whether to override the signs' background colours to match the +|hl-SignColumn|. *g:gitgutter_preview_win_floating* Default: 0 (Vim) @@ -538,6 +529,10 @@ To change the signs' colours, specify these highlight groups in your |vimrc|: See |highlight-guifg| and |highlight-ctermfg| for the values you can use. +If you do not like the signs' background colours and you do not want to update +the GitGutter* highlight groups yourself, you can get the plugin to do it +|g:gitgutter_set_sign_backgrounds|. + To change the line highlights, set up the following highlight groups in your colorscheme or |vimrc|: > @@ -593,8 +588,11 @@ c. Why can't I unstage staged changes? d. Why are the colours in the sign column weird? Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly. - Please see |g:gitgutter_override_sign_column_highlight| on customising the - sign column. + Here are two ways you could change the colours: +> + highlight! link SignColumn LineNr + highlight SignColumn guibg=whatever ctermbg=whatever +< e. What happens if I also use another plugin which uses signs (e.g. Syntastic)? diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index 1e3cf23f..1b624037 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -22,6 +22,13 @@ function! s:set(var, default) abort endif endfunction +function! s:obsolete(var) + if exists(a:var) + call gitgutter#utility#warn(a:var.' is obsolete and has no effect.') + endif +endfunction + + call s:set('g:gitgutter_preview_win_location', 'bo') if exists('*nvim_open_win') call s:set('g:gitgutter_preview_win_floating', 1) @@ -29,7 +36,11 @@ else call s:set('g:gitgutter_preview_win_floating', 0) endif call s:set('g:gitgutter_enabled', 1) -call s:set('g:gitgutter_max_signs', 500) +if exists('*sign_unplace') + call s:set('g:gitgutter_max_signs', -1) +else + call s:set('g:gitgutter_max_signs', 500) +endif call s:set('g:gitgutter_signs', 1) call s:set('g:gitgutter_highlight_lines', 0) call s:set('g:gitgutter_highlight_linenrs', 0) @@ -40,7 +51,7 @@ if (has('nvim-0.4.0') || exists('*sign_place')) && !exists('g:gitgutter_sign_all let g:gitgutter_sign_allow_clobber = 1 endif call s:set('g:gitgutter_sign_allow_clobber', 0) -call s:set('g:gitgutter_override_sign_column_highlight', 1) +call s:set('g:gitgutter_set_sign_backgrounds', 0) call s:set('g:gitgutter_sign_added', '+') call s:set('g:gitgutter_sign_modified', '~') call s:set('g:gitgutter_sign_removed', '_') @@ -65,7 +76,10 @@ call s:set('g:gitgutter_use_location_list', 0) call s:set('g:gitgutter_git_executable', 'git') if !executable(g:gitgutter_git_executable) - call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.') + if g:gitgutter_enabled + call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.') + endif + finish endif let default_grep = 'grep' @@ -83,7 +97,6 @@ if !empty(g:gitgutter_grep) endif endif -call gitgutter#highlight#define_sign_column_highlight() call gitgutter#highlight#define_highlights() call gitgutter#highlight#define_signs() @@ -260,7 +273,7 @@ augroup gitgutter autocmd VimResume * call gitgutter#all(1) endif - autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights() + autocmd ColorScheme * call gitgutter#highlight#define_highlights() " Disable during :vimgrep autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0 diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index 3b3689b2..6a13434a 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -51,8 +51,8 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword " Strings, Templates, Numbers -syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial,@Spell extend -syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend +syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial extend +syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial extend syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/ syntax keyword jsNumber Infinity @@ -74,14 +74,14 @@ syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBa " Objects syntax match jsObjectShorthandProp contained /\<\k*\ze\s*/ skipwhite skipempty nextgroup=jsObjectSeparator syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue -syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue +syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial skipwhite skipempty nextgroup=jsObjectValue syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend syntax match jsObjectSeparator contained /,/ syntax region jsObjectValue contained matchgroup=jsObjectColon start=/:/ end=/[,}]\@=/ contains=@jsExpression extend syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/ syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName -syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue +syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '') exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite nextgroup=@jsExpression' @@ -187,7 +187,7 @@ syntax region jsClassDefinition start=/\/ end=/\(\ { diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 39dff8f0..0e3db68e 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -16,6 +16,18 @@ pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { } endsnippet +snippet afn "async fn name(?) -> ? {}" +fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 +} +endsnippet + +snippet pafn "pub async fn name(?) -> ? {}" +pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { + ${VISUAL}$0 +} +endsnippet + snippet pri "print!(..)" b print!("$1"${2/..*/, /}$2); endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/racket.snippets b/sources_non_forked/vim-snippets/snippets/racket.snippets index 723d7383..5304cd8b 100644 --- a/sources_non_forked/vim-snippets/snippets/racket.snippets +++ b/sources_non_forked/vim-snippets/snippets/racket.snippets @@ -1,3 +1,4 @@ +# Languages snippet #r #lang racket snippet #tr @@ -10,56 +11,38 @@ snippet #d #lang datalog snippet #wi #lang web-server/insta + +# Defines snippet def (define ${1} ${0}) snippet defun (define (${1}) ${0}) +snippet defv "define-values" + (define-values (${1}) (${0})) +snippet defm "define/match" + (define/match (${1}) + [(${2}) ${3}] + ${0}) +snippet defs "define-syntax" + (define-syntax (${1}) + ${0}) + +# Conditionals snippet if (if ${1} ${2} ${0}) snippet ifn - (if (not ${1}) ${2} {0}) + (if (not ${1}) ${2} ${0}) snippet ifl (if ${1} - (let () - ${2}) + (let (${2}) + ${3}) ${0}) snippet ifnl (if (not ${1}) - (let () - ${2}) + (let (${2}) + ${3}) ${0}) -snippet when - (when ${1} - ${0}) -snippet cond - (cond - [(${1}) - ${0}]) -snippet case - (case ${1} - [(${2}) - ${0}]) -snippet match - (match ${1} - [(${2}) - ${0}]) -snippet letcc - (let/cc here (set! ${1} here) ${0}) -snippet for - (for ([${1} ${2}]) - ${0}) -snippet req - (require ${0}) -snippet unless - (unless ${1} ${2} ${0}) -snippet let - (let ([${1}]) ${0}) -snippet begin - (begin - ${0}) -snippet lambda - (lambda (${1}) ${0}) snippet ifb (if ${1} (begin @@ -70,3 +53,79 @@ snippet ifnb (begin ${2}) ${0}) +snippet when + (when ${1} + ${0}) +snippet unless + (unless ${1} ${2} ${0}) +snippet cond + (cond + [(${1}) ${0}]) +snippet conde + (cond + [(${1}) ${2}] + [else ${0}]) +snippet case + (case ${1} + [(${2}) ${0}]) +snippet match + (match ${1} + [(${2}) ${0}]) + +# For iterations +snippet for + (for ([${1}]) + ${0}) +snippet forl "for/list" + (for/list ([${1}]) + ${0}) +snippet forf "for/fold" + (for/fold + ([${1}]) + ([${2}]) + ${0}) +snippet forfr "for/foldr" + (for/foldr + ([${1}]) + ([${2}]) + ${0}) +snippet fora "for/and" + (for/and ([${1}]) + ${0}) +snippet foro "for/or" + (for/or ([${1}]) + ${0}) +snippet fors "for/sum" + (for/sum ([${1}]) + ${0}) +snippet forp "for/product" + (for/product ([${1}]) + ${0}) +snippet forfi "for/first" + (for/first ([${1}]) + ${0}) +snippet forla "for/last" + (for/last ([${1}]) + ${0}) + +snippet lambda + (lambda (${1}) ${0}) +snippet apply + (apply ${1} ${0}) +snippet map + (map ${1} ${0}) +snippet filter + (filter ${1} ${0}) + +snippet req + (require ${0}) +snippet prov + (provide ${0}) + +snippet let + (let ([${1}]) ${0}) +snippet letcc + (let/cc here (set! ${1} here) ${0}) +snippet begin + (begin + ${0}) diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 692a0bf1..98088b0f 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -11,6 +11,14 @@ snippet pfn "Function definition" pub fn ${1:function_name}(${2})${3} { ${0} } +snippet afn "Async function definition" + async fn ${1:function_name}(${2})${3} { + ${0} + } +snippet pafn "Async function definition" + pub async fn ${1:function_name}(${2})${3} { + ${0} + } snippet bench "Bench function" b #[bench] fn ${1:bench_function_name}(b: &mut test::Bencher) { From 69ebd4c3727a58f20526c1e35e777598b4f24b69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 10 May 2020 10:44:58 -0400 Subject: [PATCH 50/91] Bump rake in /sources_non_forked/vim-multiple-cursors (#575) Bumps [rake](https://github.com/ruby/rake) from 10.4.2 to 12.3.3. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v10.4.2...v12.3.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sources_non_forked/vim-multiple-cursors/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index e833b243..5e909c4a 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (10.4.2) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From 708e4f0d48060f6c6b2a257ad9de387f2c11bdf6 Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 10 May 2020 11:04:55 -0400 Subject: [PATCH 51/91] Replace mru.vim with CtrlPMRU Removes mru.vim and remaps `f` to `CtrlPMRU` Fixes https://github.com/amix/vimrc/issues/556 Thanks @dessalines --- README.md | 16 +- sources_non_forked/mru.vim/README | 192 ---- sources_non_forked/mru.vim/plugin/mru.vim | 1039 --------------------- update_plugins.py | 1 - vimrcs/plugins_config.vim | 8 +- 5 files changed, 14 insertions(+), 1242 deletions(-) delete mode 100644 sources_non_forked/mru.vim/README delete mode 100644 sources_non_forked/mru.vim/plugin/mru.vim diff --git a/README.md b/README.md index b7b09cb8..bcc4bf47 100644 --- a/README.md +++ b/README.md @@ -73,10 +73,6 @@ Colors when editing a Python file: ![Screenshot 1](https://dnp4pehkvoo6n.cloudfront.net/07583008e4da885801657e8781777844/as/Python%20editing.png) -Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin: - -![Screenshot 2](https://dnp4pehkvoo6n.cloudfront.net/1d49a88f9bd5d013c025bb1e1272a7d8/as/MRU%20plugin.png) - [NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window: ![Screenshot 3](https://dnp4pehkvoo6n.cloudfront.net/ae719203166585d64728f28398f4b1b7/as/Terminal%20usage.png) @@ -94,7 +90,6 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): * [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim * [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim -* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` * [pathogen.vim](https://github.com/tpope/vim-pathogen): Manage your vim runtimepath * [snipmate.vim](https://github.com/garbas/vim-snipmate): snipmate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim @@ -278,13 +273,16 @@ Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) to see and ma map o :BufExplorer -Open [MRU.vim](https://github.com/vim-scripts/mru.vim) to see the recently open files (`f`): +Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): + " Quickly find and open a file in the CWD + let g:ctrlp_map = '' + + " Quickly find and open a recently opened file map f :MRU -Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): - - let g:ctrlp_map = '' + " Quickly find and open a buffer + map b :CtrlPBuffer [NERD Tree](https://github.com/scrooloose/nerdtree) mappings: diff --git a/sources_non_forked/mru.vim/README b/sources_non_forked/mru.vim/README deleted file mode 100644 index 04c3a748..00000000 --- a/sources_non_forked/mru.vim/README +++ /dev/null @@ -1,192 +0,0 @@ -This is a mirror of http://www.vim.org/scripts/script.php?script_id=521 - -Overview - -The Most Recently Used (MRU) plugin provides an easy access to a list of -recently opened/edited files in Vim. This plugin automatically stores the -file names as you open/edit them in Vim. - -This plugin will work on all the platforms where Vim is supported. This -plugin will work in both console and GUI Vim. This version of the MRU -plugin needs Vim 7.0 and above. If you are using an earlier version of -Vim, then you should use an older version of the MRU plugin. - -The recently used filenames are stored in a file specified by the Vim -MRU_File variable. - -The Github repository for the MRU plugin is available at: - - http://github.com/yegappan/mru - -Usage - -To list and edit files from the MRU list, you can use the ":MRU" command. -The ":MRU" command displays the MRU file list in a temporary Vim window. If -the MRU window is already opened, then the MRU list displayed in the window -is refreshed. - -If you are using GUI Vim, then the names of the recently edited files are -added to the "File->Recent Files" menu. You can select the name of a file -from this sub-menu to edit the file. - -You can use the normal Vim commands to move around in the MRU window. You -cannot make changes in the MRU window. - -You can select a file name to edit by pressing the key or by double -clicking the left mouse button on a file name. The selected file will be -opened. If the file is already opened in a window, the cursor will be moved -to that window. Otherwise, the file is opened in the previous window. If the -previous window has a modified buffer or is the preview window or is used by -some other plugin, then the file is opened in a new window. - -You can press the 'o' key to open the file name under the cursor in the -MRU window in a new window. You can also press instead of 'o' -to open the file in a new window. - -To open a file from the MRU window in read-only mode (view), press the 'v' -key. - -To open a file from the MRU window in a new tab, press the 't' key. If the -file is already opened in a window in the current or in another tab, then -the cursor is moved to that tab. Otherwise, a new tab is opened. - -You can open multiple files from the MRU window by specifying a count before -pressing '' or 'v' or 'o' or 't'. You can also visually (using -linewise visual mode) select multiple filenames and invoke the commands to -open the files. Each selected file will be opened in a separate window or -tab. - -You can press the 'u' key in the MRU window to update the file list. This is -useful if you keep the MRU window open always. - -You can close the MRU window by pressing the 'q' key or the key or -using one of the Vim window commands. - -To display only files matching a pattern from the MRU list in the MRU -window, you can specify a pattern to the ":MRU" command. For example, to -display only file names matching "vim" in them, you can use the following -command ":MRU vim". When you specify a partial file name and only one -matching filename is found, then the ":MRU" command will edit that file. - -The ":MRU" command supports command-line completion of file names from -the MRU list. You can enter a partial file name and then press -or to complete or list all the matching file names. Note that -after typing the ":MRU" command, you have to enter a space before completing -the file names with . - -When a file supplied to the ":MRU" command is not present in the MRU list, -but it is a readable file, then the file will be opened (even though it is -not present in the MRU list). This is useful if you want to open a file -present in the same directory as a file in the MRU list. You can use the -command-line completion of the ":MRU" command to complete the full path of a -file and then modify the path to open another file present in the same path. - -Whenever the MRU list changes, the MRU file is updated with the latest MRU -list. When you have multiple instances of Vim running at the same time, the -latest MRU list will show up in all the instances of Vim. - -The MRUFilename syntax group is used to highlight the file names in the MRU -window. By default, this syntax group is linked to the Identifier highlight -group. You can change the highlight group by adding the following line in -your .vimrc: - - highlight link MRUFileName LineNr - -The MRU buffer uses the 'mru file type. You can use this file type to add -custom auto commands, syntax highlighting, etc. - -Configuration - -By changing the following variables you can configure the behavior of this -plugin. Set the following variables in your .vimrc file using the 'let' -command. - -The list of recently edited file names is stored in the file specified by the -MRU_File variable. The default setting for this variable is -$HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files -for MS-Windows systems. You can change this variable to point to a file by -adding the following line to the .vimrc file: - - let MRU_File = 'd:\myhome\_vim_mru_files' - -By default, the plugin will remember the names of the last 100 used files. -As you edit more files, old file names will be removed from the MRU list. -You can set the 'MRU_Max_Entries' variable to remember more file names. For -example, to remember 1000 most recently used file names, you can use - - let MRU_Max_Entries = 1000 - -By default, all the edited file names will be added to the MRU list. If you -want to exclude file names matching a list of patterns, you can set the -MRU_Exclude_Files variable to a list of Vim regular expressions. By default, -this variable is set to an empty string. For example, to not include files -in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the -MRU_Exclude_Files variable to - - let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix - let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows - -The specified pattern should be a Vim regular expression pattern. - -If you want to add only file names matching a set of patterns to the MRU -list, then you can set the MRU_Include_Files variable. This variable should -be set to a Vim regular expression pattern. For example, to add only .c and -.h files to the MRU list, you can set this variable as below: - - let MRU_Include_Files = '\.c$\|\.h$' - -By default, MRU_Include_Files is set to an empty string and all the edited -filenames are added to the MRU list. - -The default height of the MRU window is 8. You can set the MRU_Window_Height -variable to change the window height. - - let MRU_Window_Height = 15 - -By default, when the :MRU command is invoked, the MRU list will be displayed -in a new window. Instead, if you want the MRU plugin to reuse the current -window, then you can set the 'MRU_Use_Current_Window' variable to one. - - let MRU_Use_Current_Window = 1 - -The MRU plugin will reuse the current window. When a file name is selected, -the file is also opened in the current window. - -When you select a file from the MRU window, the MRU window will be -automatically closed and the selected file will be opened in the previous -window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU -window open. - - let MRU_Auto_Close = 0 - -If you don't use the "File->Recent Files" menu and want to disable it, -then you can set the 'MRU_Add_Menu' variable to zero. By default, the -menu is enabled. - - let MRU_Add_Menu = 0 - -If too many file names are present in the MRU list, then updating the MRU -menu to list all the file names makes Vim slow. To avoid this, the -MRU_Max_Menu_Entries variable controls the number of file names to show in -the MRU menu. By default, this is set to 10. You can change this to show -more entries in the menu. - - let MRU_Max_Menu_Entries = 20 - -If many file names are present in the MRU list, then the MRU menu is split -into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names. -The default setting for this is 10. You can change this to increase the -number of file names displayed in a single sub-menu: - - let MRU_Max_Submenu_Entries = 15 - -In the MRU window, the filenames are displayed in two parts. The first part -contains the file name without the path and the second part contains the -full path to the file in parenthesis. This format is controlled by the -MRU_Filename_Format variable. If you prefer to change this to some other -format, then you can modify the MRU_Filename_Format variable. For example, -to display the full path without splitting it, you can set this variable -as shown below: - - let MRU_Filename_Format={'formatter':'v:val', 'parser':'.*'} - diff --git a/sources_non_forked/mru.vim/plugin/mru.vim b/sources_non_forked/mru.vim/plugin/mru.vim deleted file mode 100644 index 5cf7015d..00000000 --- a/sources_non_forked/mru.vim/plugin/mru.vim +++ /dev/null @@ -1,1039 +0,0 @@ -" File: mru.vim -" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -" Version: 3.9 -" Last Modified: Feb 3, 2015 -" Copyright: Copyright (C) 2003-2015 Yegappan Lakshmanan -" License: Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" mru.vim is provided *as is* and comes with no warranty of any -" kind, either expressed or implied. In no event will the copyright -" holder be liable for any damages resulting from the use of this -" software. -" -" Overview -" -------- -" The Most Recently Used (MRU) plugin provides an easy access to a list of -" recently opened/edited files in Vim. This plugin automatically stores the -" file names as you open/edit them in Vim. -" -" This plugin will work on all the platforms where Vim is supported. This -" plugin will work in both console and GUI Vim. This version of the MRU -" plugin needs Vim 7.0 and above. If you are using an earlier version of -" Vim, then you should use an older version of the MRU plugin. -" -" The recently used filenames are stored in a file specified by the Vim -" MRU_File variable. -" -" The Github repository for the MRU plugin is available at: -" -" http://github.com/yegappan/mru -" -" Installation -" ------------ -" 1. Copy the mru.vim file to one of the following directories: -" $HOME/.vim/plugin - Unix like systems -" $HOME/vimfiles/plugin - MS-Windows -" $VIM:vimfiles:plugin - Macintosh -" $VIM/vimfiles/plugin - All -" 2. Restart Vim. -" 3. You can use the ":MRU" command to list and edit the recently used files. -" In GUI Vim, you can use the 'File->Recent Files' menu to access the -" recently used files. -" -" To uninstall this plugin, remove this file (mru.vim) from the -" $HOME/.vim/plugin or $HOME/vimfiles/plugin or the $VIM/vimfile/plugin -" directory. -" -" Usage -" ----- -" To list and edit files from the MRU list, you can use the ":MRU" command. -" The ":MRU" command displays the MRU file list in a temporary Vim window. If -" the MRU window is already opened, then the MRU list displayed in the window -" is refreshed. -" -" If you are using GUI Vim, then the names of the recently edited files are -" added to the "File->Recent Files" menu. You can select the name of a file -" from this sub-menu to edit the file. -" -" You can use the normal Vim commands to move around in the MRU window. You -" cannot make changes in the MRU window. -" -" You can select a file name to edit by pressing the key or by double -" clicking the left mouse button on a file name. The selected file will be -" opened. If the file is already opened in a window, the cursor will be moved -" to that window. Otherwise, the file is opened in the previous window. If the -" previous window has a modified buffer or is the preview window or is used by -" some other plugin, then the file is opened in a new window. -" -" You can press the 'o' key to open the file name under the cursor in the -" MRU window in a new window. You can also press instead of 'o' -" to open the file in a new window. -" -" To open a file from the MRU window in read-only mode (view), press the 'v' -" key. -" -" To open a file from the MRU window in a new tab, press the 't' key. If the -" file is already opened in a window in the current or in another tab, then -" the cursor is moved to that tab. Otherwise, a new tab is opened. -" -" You can open multiple files from the MRU window by specifying a count before -" pressing '' or 'v' or 'o' or 't'. You can also visually (using -" linewise visual mode) select multiple filenames and invoke the commands to -" open the files. Each selected file will be opened in a separate window or -" tab. -" -" You can press the 'u' key in the MRU window to update the file list. This is -" useful if you keep the MRU window open always. -" -" You can close the MRU window by pressing the 'q' key or the key or -" using one of the Vim window commands. -" -" To display only files matching a pattern from the MRU list in the MRU -" window, you can specify a pattern to the ":MRU" command. For example, to -" display only file names matching "vim" in them, you can use the following -" command ":MRU vim". When you specify a partial file name and only one -" matching filename is found, then the ":MRU" command will edit that file. -" -" The ":MRU" command supports command-line completion of file names from -" the MRU list. You can enter a partial file name and then press -" or to complete or list all the matching file names. Note that -" after typing the ":MRU" command, you have to enter a space before completing -" the file names with . -" -" When a file supplied to the ":MRU" command is not present in the MRU list, -" but it is a readable file, then the file will be opened (even though it is -" not present in the MRU list). This is useful if you want to open a file -" present in the same directory as a file in the MRU list. You can use the -" command-line completion of the ":MRU" command to complete the full path of a -" file and then modify the path to open another file present in the same path. -" -" Whenever the MRU list changes, the MRU file is updated with the latest MRU -" list. When you have multiple instances of Vim running at the same time, the -" latest MRU list will show up in all the instances of Vim. -" -" The MRUFilename syntax group is used to highlight the file names in the MRU -" window. By default, this syntax group is linked to the Identifier highlight -" group. You can change the highlight group by adding the following line in -" your .vimrc: -" -" highlight link MRUFileName LineNr -" -" The MRU buffer uses the 'mru file type. You can use this file type to add -" custom auto commands, syntax highlighting, etc. -" -" Configuration -" ------------- -" By changing the following variables you can configure the behavior of this -" plugin. Set the following variables in your .vimrc file using the 'let' -" command. -" -" The list of recently edited file names is stored in the file specified by the -" MRU_File variable. The default setting for this variable is -" $HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files -" for MS-Windows systems. You can change this variable to point to a file by -" adding the following line to the .vimrc file: -" -" let MRU_File = 'd:\myhome\_vim_mru_files' -" -" By default, the plugin will remember the names of the last 100 used files. -" As you edit more files, old file names will be removed from the MRU list. -" You can set the 'MRU_Max_Entries' variable to remember more file names. For -" example, to remember 1000 most recently used file names, you can use -" -" let MRU_Max_Entries = 1000 -" -" By default, all the edited file names will be added to the MRU list. If you -" want to exclude file names matching a list of patterns, you can set the -" MRU_Exclude_Files variable to a list of Vim regular expressions. By default, -" this variable is set to an empty string. For example, to not include files -" in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the -" MRU_Exclude_Files variable to -" -" let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix -" let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows -" -" The specified pattern should be a Vim regular expression pattern. -" -" If you want to add only file names matching a set of patterns to the MRU -" list, then you can set the MRU_Include_Files variable. This variable should -" be set to a Vim regular expression pattern. For example, to add only .c and -" .h files to the MRU list, you can set this variable as below: -" -" let MRU_Include_Files = '\.c$\|\.h$' -" -" By default, MRU_Include_Files is set to an empty string and all the edited -" filenames are added to the MRU list. -" -" The default height of the MRU window is 8. You can set the MRU_Window_Height -" variable to change the window height. -" -" let MRU_Window_Height = 15 -" -" By default, when the :MRU command is invoked, the MRU list will be displayed -" in a new window. Instead, if you want the MRU plugin to reuse the current -" window, then you can set the 'MRU_Use_Current_Window' variable to one. -" -" let MRU_Use_Current_Window = 1 -" -" The MRU plugin will reuse the current window. When a file name is selected, -" the file is also opened in the current window. -" -" When you select a file from the MRU window, the MRU window will be -" automatically closed and the selected file will be opened in the previous -" window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU -" window open. -" -" let MRU_Auto_Close = 0 -" -" If you don't use the "File->Recent Files" menu and want to disable it, -" then you can set the 'MRU_Add_Menu' variable to zero. By default, the -" menu is enabled. -" -" let MRU_Add_Menu = 0 -" -" If too many file names are present in the MRU list, then updating the MRU -" menu to list all the file names makes Vim slow. To avoid this, the -" MRU_Max_Menu_Entries variable controls the number of file names to show in -" the MRU menu. By default, this is set to 10. You can change this to show -" more entries in the menu. -" -" let MRU_Max_Menu_Entries = 20 -" -" If many file names are present in the MRU list, then the MRU menu is split -" into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names. -" The default setting for this is 10. You can change this to increase the -" number of file names displayed in a single sub-menu: -" -" let MRU_Max_Submenu_Entries = 15 -" -" In the MRU window, the filenames are displayed in two parts. The first part -" contains the file name without the path and the second part contains the -" full path to the file in parenthesis. This format is controlled by the -" MRU_Filename_Format variable. If you prefer to change this to some other -" format, then you can modify the MRU_Filename_Format variable. For example, -" to display the full path without splitting it, you can set this variable -" as shown below: -" -" let MRU_Filename_Format = -" \ {'formatter':'v:val', 'parser':'.*', 'syntax': '[^/\\]\+$'} -" -" ****************** Do not modify after this line ************************ -if exists('loaded_mru') - finish -endif -let loaded_mru=1 - -if v:version < 700 - finish -endif - -" Line continuation used here -let s:cpo_save = &cpo -set cpo&vim - -" MRU configuration variables {{{1 -" Maximum number of entries allowed in the MRU list -if !exists('MRU_Max_Entries') - let MRU_Max_Entries = 100 -endif - -" Files to exclude from the MRU list -if !exists('MRU_Exclude_Files') - let MRU_Exclude_Files = '' -endif - -" Files to include in the MRU list -if !exists('MRU_Include_Files') - let MRU_Include_Files = '' -endif - -" Height of the MRU window -" Default height is 8 -if !exists('MRU_Window_Height') - let MRU_Window_Height = 8 -endif - -if !exists('MRU_Use_Current_Window') - let MRU_Use_Current_Window = 0 -endif - -if !exists('MRU_Auto_Close') - let MRU_Auto_Close = 1 -endif - -if !exists('MRU_File') - if has('unix') || has('macunix') - let MRU_File = $HOME . '/.vim_mru_files' - else - let MRU_File = $VIM . '/_vim_mru_files' - if has('win32') - " MS-Windows - if $USERPROFILE != '' - let MRU_File = $USERPROFILE . '\_vim_mru_files' - endif - endif - endif -endif - -" Option for enabling or disabling the MRU menu -if !exists('MRU_Add_Menu') - let MRU_Add_Menu = 1 -endif - -" Maximum number of file names to show in the MRU menu. If too many files are -" listed in the menu, then Vim becomes slow when updating the menu. So set -" this to a low value. -if !exists('MRU_Max_Menu_Entries') - let MRU_Max_Menu_Entries = 10 -endif - -" Maximum number of file names to show in a MRU sub-menu. If the MRU list -" contains more file names than this setting, then the MRU menu is split into -" one or more sub-menus. -if !exists('MRU_Max_Submenu_Entries') - let MRU_Max_Submenu_Entries = 10 -endif - -" When only a single matching filename is found in the MRU list, the following -" option controls whether the file name is displayed in the MRU window or the -" file is directly opened. When this variable is set to 0 and a single -" matching file name is found, then the file is directly opened. -if !exists('MRU_Window_Open_Always') - let MRU_Window_Open_Always = 0 -endif - -" When opening a file from the MRU list, the file is opened in the current -" tab. If the selected file has to be opened in a tab always, then set the -" following variable to 1. If the file is already opened in a tab, then the -" cursor will be moved to that tab. -if !exists('MRU_Open_File_Use_Tabs') - let MRU_Open_File_Use_Tabs = 0 -endif - -" Format of the file names displayed in the MRU window. -" The default is to display the filename followed by the complete path to the -" file in parenthesis. This variable controls the expressions used to format -" and parse the path. This can be changed to display the filenames in a -" different format. The 'formatter' specifies how to split/format the filename -" and 'parser' specifies how to read the filename back; 'syntax' matches the -" part to be highlighted. -if !exists('MRU_Filename_Format') - let MRU_Filename_Format = { - \ 'formatter': 'fnamemodify(v:val, ":t") . " (" . v:val . ")"', - \ 'parser': '(\zs.*\ze)', - \ 'syntax': '^.\{-}\ze(' - \} -endif - -" Control to temporarily lock the MRU list. Used to prevent files from -" getting added to the MRU list when the ':vimgrep' command is executed. -let s:mru_list_locked = 0 - -" MRU_LoadList {{{1 -" Loads the latest list of file names from the MRU file -function! s:MRU_LoadList() - " If the MRU file is present, then load the list of filenames. Otherwise - " start with an empty list. - if filereadable(g:MRU_File) - let s:MRU_files = readfile(g:MRU_File) - if s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim' - " Generated by the previous version of the MRU plugin. - " Discard the list. - let s:MRU_files = [] - elseif s:MRU_files[0] =~# '^#' - " Remove the comment line - call remove(s:MRU_files, 0) - else - " Unsupported format - let s:MRU_files = [] - endif - else - let s:MRU_files = [] - endif - - " Refresh the MRU menu with the latest list of filenames - call s:MRU_Refresh_Menu() -endfunction - -" MRU_SaveList {{{1 -" Saves the MRU file names to the MRU file -function! s:MRU_SaveList() - let l = [] - call add(l, '# Most recently edited files in Vim (version 3.0)') - call extend(l, s:MRU_files) - call writefile(l, g:MRU_File) -endfunction - -" MRU_AddFile {{{1 -" Adds a file to the MRU file list -" acmd_bufnr - Buffer number of the file to add -function! s:MRU_AddFile(acmd_bufnr) - if s:mru_list_locked - " MRU list is currently locked - return - endif - - " Get the full path to the filename - let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') - if fname == '' - return - endif - - " Skip temporary buffers with buftype set. The buftype is set for buffers - " used by plugins. - if &buftype != '' - return - endif - - if g:MRU_Include_Files != '' - " If MRU_Include_Files is set, include only files matching the - " specified pattern - if fname !~# g:MRU_Include_Files - return - endif - endif - - if g:MRU_Exclude_Files != '' - " Do not add files matching the pattern specified in the - " MRU_Exclude_Files to the MRU list - if fname =~# g:MRU_Exclude_Files - return - endif - endif - - " If the filename is not already present in the MRU list and is not - " readable then ignore it - let idx = index(s:MRU_files, fname) - if idx == -1 - if !filereadable(fname) - " File is not readable and is not in the MRU list - return - endif - endif - - " Load the latest MRU file list - call s:MRU_LoadList() - - " Remove the new file name from the existing MRU list (if already present) - call filter(s:MRU_files, 'v:val !=# fname') - - " Add the new file list to the beginning of the updated old file list - call insert(s:MRU_files, fname, 0) - - " Trim the list - if len(s:MRU_files) > g:MRU_Max_Entries - call remove(s:MRU_files, g:MRU_Max_Entries, -1) - endif - - " Save the updated MRU list - call s:MRU_SaveList() - - " Refresh the MRU menu - call s:MRU_Refresh_Menu() - - " If the MRU window is open, update the displayed MRU list - let bname = '__MRU_Files__' - let winnum = bufwinnr(bname) - if winnum != -1 - let cur_winnr = winnr() - call s:MRU_Open_Window() - if winnr() != cur_winnr - exe cur_winnr . 'wincmd w' - endif - endif -endfunction - -" MRU_escape_filename {{{1 -" Escape special characters in a filename. Special characters in file names -" that should be escaped (for security reasons) -let s:esc_filename_chars = ' *?[{`$%#"|!<>();&' . "'\t\n" -function! s:MRU_escape_filename(fname) - if exists("*fnameescape") - return fnameescape(a:fname) - else - return escape(a:fname, s:esc_filename_chars) - endif -endfunction - -" MRU_Edit_File {{{1 -" Edit the specified file -" filename - Name of the file to edit -" sanitized - Specifies whether the filename is already escaped for special -" characters or not. -function! s:MRU_Edit_File(filename, sanitized) - if !a:sanitized - let esc_fname = s:MRU_escape_filename(a:filename) - else - let esc_fname = a:filename - endif - - " If the user wants to always open the file in a tab, then open the file - " in a tab. If it is already opened in a tab, then the cursor will be - " moved to that tab. - if g:MRU_Open_File_Use_Tabs - call s:MRU_Open_File_In_Tab(a:filename, esc_fname) - return - endif - - " If the file is already open in one of the windows, jump to it - let winnum = bufwinnr('^' . a:filename . '$') - if winnum != -1 - if winnum != winnr() - exe winnum . 'wincmd w' - endif - else - if !&hidden && (&modified || &buftype != '' || &previewwindow) - " Current buffer has unsaved changes or is a special buffer or is - " the preview window. The 'hidden' option is also not set. - " So open the file in a new window. - exe 'split ' . esc_fname - else - " The current file can be replaced with the selected file. - exe 'edit ' . esc_fname - endif - endif -endfunction - -" MRU_Open_File_In_Tab -" Open a file in a tab. If the file is already opened in a tab, jump to the -" tab. Otherwise, create a new tab and open the file. -" fname : Name of the file to open -" esc_fname : File name with special characters escaped -function! s:MRU_Open_File_In_Tab(fname, esc_fname) - " If the selected file is already open in the current tab or in - " another tab, jump to it. Otherwise open it in a new tab - if bufwinnr('^' . a:fname . '$') == -1 - let tabnum = -1 - let i = 1 - let bnum = bufnr('^' . a:fname . '$') - while i <= tabpagenr('$') - if index(tabpagebuflist(i), bnum) != -1 - let tabnum = i - break - endif - let i += 1 - endwhile - - if tabnum != -1 - " Goto the tab containing the file - exe 'tabnext ' . i - else - " Open a new tab as the last tab page - exe '$tabnew ' . a:esc_fname - endif - endif - - " Jump to the window containing the file - let winnum = bufwinnr('^' . a:fname . '$') - if winnum != winnr() - exe winnum . 'wincmd w' - endif -endfunction - -" MRU_Window_Edit_File {{{1 -" fname : Name of the file to edit. May specify single or multiple -" files. -" edit_type : Specifies how to edit the file. Can be one of 'edit' or 'view'. -" 'view' - Open the file as a read-only file -" 'edit' - Edit the file as a regular file -" multi : Specifies whether a single file or multiple files need to be -" opened. -" open_type : Specifies where to open the file. -" useopen - If the file is already present in a window, then -" jump to that window. Otherwise, open the file in -" the previous window. -" newwin_horiz - Open the file in a new horizontal window. -" newwin_vert - Open the file in a new vertical window. -" newtab - Open the file in a new tab. If the file is already -" opened in a tab, then jump to that tab. -" preview - Open the file in the preview window -function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type) - let esc_fname = s:MRU_escape_filename(a:fname) - - if a:open_type ==# 'newwin_horiz' - " Edit the file in a new horizontally split window above the previous - " window - wincmd p - exe 'belowright new ' . esc_fname - elseif a:open_type ==# 'newwin_vert' - " Edit the file in a new vertically split window above the previous - " window - wincmd p - exe 'belowright vnew ' . esc_fname - elseif a:open_type ==# 'newtab' || g:MRU_Open_File_Use_Tabs - call s:MRU_Open_File_In_Tab(a:fname, esc_fname) - elseif a:open_type ==# 'preview' - " Edit the file in the preview window - exe 'topleft pedit ' . esc_fname - else - " If the selected file is already open in one of the windows, - " jump to it - let winnum = bufwinnr('^' . a:fname . '$') - if winnum != -1 - exe winnum . 'wincmd w' - else - if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0 - " Jump to the window from which the MRU window was opened - if exists('s:MRU_last_buffer') - let last_winnr = bufwinnr(s:MRU_last_buffer) - if last_winnr != -1 && last_winnr != winnr() - exe last_winnr . 'wincmd w' - endif - endif - else - if g:MRU_Use_Current_Window == 0 - " Goto the previous window - " If MRU_Use_Current_Window is set to one, then the - " current window is used to open the file - wincmd p - endif - endif - - let split_window = 0 - - if (!&hidden && (&modified || &previewwindow)) || a:multi - " Current buffer has unsaved changes or is the preview window - " or the user is opening multiple files - " So open the file in a new window - let split_window = 1 - endif - - if &buftype != '' - " Current buffer is a special buffer (maybe used by a plugin) - if g:MRU_Use_Current_Window == 0 || - \ bufnr('%') != bufnr('__MRU_Files__') - let split_window = 1 - endif - endif - - " Edit the file - if split_window - " Current buffer has unsaved changes or is a special buffer or - " is the preview window. So open the file in a new window - if a:edit_type ==# 'edit' - exe 'split ' . esc_fname - else - exe 'sview ' . esc_fname - endif - else - if a:edit_type ==# 'edit' - exe 'edit ' . esc_fname - else - exe 'view ' . esc_fname - endif - endif - endif - endif -endfunction - -" MRU_Select_File_Cmd {{{1 -" Open a file selected from the MRU window -" -" 'opt' has two values separated by comma. The first value specifies how to -" edit the file and can be either 'edit' or 'view'. The second value -" specifies where to open the file. It can take one of the following values: -" 'useopen' to open file in the previous window -" 'newwin_horiz' to open the file in a new horizontal split window -" 'newwin_vert' to open the file in a new vertical split window. -" 'newtab' to open the file in a new tab. -" If multiple file names are selected using visual mode, then open multiple -" files (either in split windows or tabs) -function! s:MRU_Select_File_Cmd(opt) range - let [edit_type, open_type] = split(a:opt, ',') - - let fnames = getline(a:firstline, a:lastline) - - if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0 - " Automatically close the window if the file window is - " not used to display the MRU list. - silent! close - endif - - let multi = 0 - - for f in fnames - if f == '' - continue - endif - - " The text in the MRU window contains the filename in parenthesis - let file = matchstr(f, g:MRU_Filename_Format.parser) - - call s:MRU_Window_Edit_File(file, multi, edit_type, open_type) - - if a:firstline != a:lastline - " Opening multiple files - let multi = 1 - endif - endfor -endfunction - -" MRU_Warn_Msg {{{1 -" Display a warning message -function! s:MRU_Warn_Msg(msg) - echohl WarningMsg - echo a:msg - echohl None -endfunction - -" MRU_Open_Window {{{1 -" Display the Most Recently Used file list in a temporary window. -" If the optional argument is supplied, then it specifies the pattern of files -" to selectively display in the MRU window. -function! s:MRU_Open_Window(...) - - " Load the latest MRU file list - call s:MRU_LoadList() - - " Check for empty MRU list - if empty(s:MRU_files) - call s:MRU_Warn_Msg('MRU file list is empty') - return - endif - - " Save the current buffer number. This is used later to open a file when a - " entry is selected from the MRU window. The window number is not saved, - " as the window number will change when new windows are opened. - let s:MRU_last_buffer = bufnr('%') - - let bname = '__MRU_Files__' - - " If the window is already open, jump to it - let winnum = bufwinnr(bname) - if winnum != -1 - if winnr() != winnum - " If not already in the window, jump to it - exe winnum . 'wincmd w' - endif - - setlocal modifiable - - " Delete the contents of the buffer to the black-hole register - silent! %delete _ - else - if g:MRU_Use_Current_Window - " Reuse the current window - " - " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open - " a new buffer - let bufnum = bufnr(bname) - if bufnum == -1 - let cmd = 'edit ' . bname - else - let cmd = 'buffer ' . bufnum - endif - - exe cmd - - if bufnr('%') != bufnr(bname) - " Failed to edit the MRU buffer - return - endif - else - " Open a new window at the bottom - - " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open - " a new buffer - let bufnum = bufnr(bname) - if bufnum == -1 - let wcmd = bname - else - let wcmd = '+buffer' . bufnum - endif - - exe 'silent! botright ' . g:MRU_Window_Height . 'split ' . wcmd - endif - endif - - setlocal modifiable - - " Mark the buffer as scratch - setlocal buftype=nofile - setlocal bufhidden=delete - setlocal noswapfile - setlocal nowrap - setlocal nobuflisted - " Set the 'filetype' to 'mru'. This allows the user to apply custom - " syntax highlighting or other changes to the MRU bufer. - setlocal filetype=mru - " Use fixed height for the MRU window - setlocal winfixheight - - " Setup the cpoptions properly for the maps to work - let old_cpoptions = &cpoptions - set cpoptions&vim - - " Create mappings to select and edit a file from the MRU list - nnoremap - \ :call MRU_Select_File_Cmd('edit,useopen') - vnoremap - \ :call MRU_Select_File_Cmd('edit,useopen') - nnoremap o - \ :call MRU_Select_File_Cmd('edit,newwin_horiz') - vnoremap o - \ :call MRU_Select_File_Cmd('edit,newwin_horiz') - nnoremap - \ :call MRU_Select_File_Cmd('edit,newwin_horiz') - vnoremap - \ :call MRU_Select_File_Cmd('edit,newwin_horiz') - nnoremap O - \ :call MRU_Select_File_Cmd('edit,newwin_vert') - vnoremap O - \ :call MRU_Select_File_Cmd('edit,newwin_vert') - nnoremap t - \ :call MRU_Select_File_Cmd('edit,newtab') - vnoremap t - \ :call MRU_Select_File_Cmd('edit,newtab') - nnoremap v - \ :call MRU_Select_File_Cmd('view,useopen') - nnoremap p - \ :call MRU_Select_File_Cmd('view,preview') - vnoremap p - \ :if line("'<") == line("'>") - \ call MRU_Select_File_Cmd('open,preview') - \ else - \ echoerr "Only a single file can be previewed" - \ endif - nnoremap u :MRU - nnoremap <2-LeftMouse> - \ :call MRU_Select_File_Cmd('edit,useopen') - nnoremap q :close - - " Restore the previous cpoptions settings - let &cpoptions = old_cpoptions - - " Display the MRU list - if a:0 == 0 - " No search pattern specified. Display the complete list - let m = copy(s:MRU_files) - else - " Display only the entries matching the specified pattern - " First try using it as a literal pattern - let m = filter(copy(s:MRU_files), 'stridx(v:val, a:1) != -1') - if len(m) == 0 - " No match. Try using it as a regular expression - let m = filter(copy(s:MRU_files), 'v:val =~# a:1') - endif - endif - - " Get the tail part of the file name (without the directory) and display - " it along with the full path in parenthesis. - let output = map(m, g:MRU_Filename_Format.formatter) - silent! 0put =output - - " Delete the empty line at the end of the buffer - silent! $delete _ - - " Move the cursor to the beginning of the file - normal! gg - - " Add syntax highlighting for the file names - if has_key(g:MRU_Filename_Format, 'syntax') - exe "syntax match MRUFileName '" . g:MRU_Filename_Format.syntax . "'" - highlight default link MRUFileName Identifier - endif - - setlocal nomodifiable -endfunction - -" MRU_Complete {{{1 -" Command-line completion function used by :MRU command -function! s:MRU_Complete(ArgLead, CmdLine, CursorPos) - if a:ArgLead == '' - " Return the complete list of MRU files - return s:MRU_files - else - " Return only the files matching the specified pattern - return filter(copy(s:MRU_files), 'v:val =~? a:ArgLead') - endif -endfunction - -" MRU_Cmd {{{1 -" Function to handle the MRU command -" pat - File name pattern passed to the MRU command -function! s:MRU_Cmd(pat) - if a:pat == '' - " No arguments specified. Open the MRU window - call s:MRU_Open_Window() - return - endif - - " Load the latest MRU file - call s:MRU_LoadList() - - " Empty MRU list - if empty(s:MRU_files) - call s:MRU_Warn_Msg('MRU file list is empty') - return - endif - - " First use the specified string as a literal string and search for - " filenames containing the string. If only one filename is found, - " then edit it (unless the user wants to open the MRU window always) - let m = filter(copy(s:MRU_files), 'stridx(v:val, a:pat) != -1') - if len(m) > 0 - if len(m) == 1 && !g:MRU_Window_Open_Always - call s:MRU_Edit_File(m[0], 0) - return - endif - - " More than one file matches. Try find an accurate match - let new_m = filter(m, 'v:val ==# a:pat') - if len(new_m) == 1 && !g:MRU_Window_Open_Always - call s:MRU_Edit_File(new_m[0], 0) - return - endif - - " Couldn't find an exact match, open the MRU window with all the - " files matching the pattern. - call s:MRU_Open_Window(a:pat) - return - endif - - " Use the specified string as a regular expression pattern and search - " for filenames matching the pattern - let m = filter(copy(s:MRU_files), 'v:val =~? a:pat') - - if len(m) == 0 - " If an existing file (not present in the MRU list) is specified, - " then open the file. - if filereadable(a:pat) - call s:MRU_Edit_File(a:pat, 0) - return - endif - - " No filenames matching the specified pattern are found - call s:MRU_Warn_Msg("MRU file list doesn't contain " . - \ "files matching " . a:pat) - return - endif - - if len(m) == 1 && !g:MRU_Window_Open_Always - call s:MRU_Edit_File(m[0], 0) - return - endif - - call s:MRU_Open_Window(a:pat) -endfunction - -" MRU_add_files_to_menu {{{1 -" Adds a list of files to the "Recent Files" sub menu under the "File" menu. -" prefix - Prefix to use for each of the menu entries -" file_list - List of file names to add to the menu -function! s:MRU_add_files_to_menu(prefix, file_list) - for fname in a:file_list - " Escape special characters in the filename - let esc_fname = escape(fnamemodify(fname, ':t'), ".\\" . - \ s:esc_filename_chars) - let esc_fname = substitute(esc_fname, '&', '&&', 'g') - - " Truncate the directory name if it is long - let dir_name = fnamemodify(fname, ':h') - let len = strlen(dir_name) - " Shorten long file names by adding only few characters from - " the beginning and end. - if len > 30 - let dir_name = strpart(dir_name, 0, 10) . - \ '...' . - \ strpart(dir_name, len - 20) - endif - let esc_dir_name = escape(dir_name, ".\\" . s:esc_filename_chars) - let esc_dir_name = substitute(esc_dir_name, '&', '&&', 'g') - - let menu_path = '&File.&Recent\ Files.' . a:prefix . esc_fname . - \ '\ (' . esc_dir_name . ')' - let esc_mfname = s:MRU_escape_filename(fname) - exe 'anoremenu ' . menu_path . - \ " :call MRU_Edit_File('" . esc_mfname . "', 1)" - exe 'tmenu ' . menu_path . ' Edit file ' . esc_mfname - endfor -endfunction - -" MRU_Refresh_Menu {{{1 -" Refresh the MRU menu -function! s:MRU_Refresh_Menu() - if !has('menu') || !g:MRU_Add_Menu - " No support for menus - return - endif - - " Setup the cpoptions properly for the maps to work - let old_cpoptions = &cpoptions - set cpoptions&vim - - " Remove the MRU menu - " To retain the teared-off MRU menu, we need to add a dummy entry - silent! unmenu &File.&Recent\ Files - " The menu priority of the File menu is 10. If the MRU plugin runs - " first before menu.vim, the File menu order may not be correct. - " So specify the priority of the File menu here. - 10noremenu &File.&Recent\ Files.Dummy - silent! unmenu! &File.&Recent\ Files - - anoremenu &File.&Recent\ Files.Refresh\ list - \ :call MRU_LoadList() - exe 'tmenu File.&Recent\ Files.Refresh\ list Reload the MRU file list from ' - \ . s:MRU_escape_filename(g:MRU_File) - anoremenu File.&Recent\ Files.-SEP1- : - - " Add the filenames in the MRU list to the menu - let entry_cnt = len(s:MRU_files) - if entry_cnt > g:MRU_Max_Menu_Entries - " Show only MRU_Max_Menu_Entries file names in the menu - let mru_list = s:MRU_files[0 : g:MRU_Max_Menu_Entries - 1] - let entry_cnt = g:MRU_Max_Menu_Entries - else - let mru_list = s:MRU_files - endif - if entry_cnt > g:MRU_Max_Submenu_Entries - " Split the MRU menu into sub-menus - for start_idx in range(0, entry_cnt, g:MRU_Max_Submenu_Entries) - let last_idx = start_idx + g:MRU_Max_Submenu_Entries - 1 - if last_idx >= entry_cnt - let last_idx = entry_cnt - 1 - endif - let prefix = 'Files\ (' . (start_idx + 1) . '\.\.\.' . - \ (last_idx + 1) . ').' - call s:MRU_add_files_to_menu(prefix, - \ mru_list[start_idx : last_idx]) - endfor - else - call s:MRU_add_files_to_menu('', mru_list) - endif - - " Remove the dummy menu entry - unmenu &File.&Recent\ Files.Dummy - - " Restore the previous cpoptions settings - let &cpoptions = old_cpoptions -endfunction - -" Load the MRU list on plugin startup -call s:MRU_LoadList() - -" MRU autocommands {{{1 -" Autocommands to detect the most recently used files -autocmd BufRead * call s:MRU_AddFile(expand('')) -autocmd BufNewFile * call s:MRU_AddFile(expand('')) -autocmd BufWritePost * call s:MRU_AddFile(expand('')) - -" The ':vimgrep' command adds all the files searched to the buffer list. -" This also modifies the MRU list, even though the user didn't edit the -" files. Use the following autocmds to prevent this. -autocmd QuickFixCmdPre *vimgrep* let s:mru_list_locked = 1 -autocmd QuickFixCmdPost *vimgrep* let s:mru_list_locked = 0 - -" Command to open the MRU window -command! -nargs=? -complete=customlist,s:MRU_Complete MRU - \ call s:MRU_Cmd() -command! -nargs=? -complete=customlist,s:MRU_Complete Mru - \ call s:MRU_Cmd() - -" }}} - -" restore 'cpo' -let &cpo = s:cpo_save -unlet s:cpo_save - -" vim:set foldenable foldmethod=marker: diff --git a/update_plugins.py b/update_plugins.py index 634df7ae..606fba04 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -50,7 +50,6 @@ vim-pug https://github.com/digitaltoad/vim-pug lightline.vim https://github.com/itchyny/lightline.vim lightline-ale https://github.com/maximbaz/lightline-ale vim-abolish https://github.com/tpope/tpope-vim-abolish -mru.vim https://github.com/vim-scripts/mru.vim rust.vim https://github.com/rust-lang/rust.vim vim-markdown https://github.com/plasticboy/vim-markdown vim-gist https://github.com/mattn/vim-gist diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index e997747a..2dd58855 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -46,9 +46,15 @@ nmap yankstack_substitute_newer_paste """""""""""""""""""""""""""""" let g:ctrlp_working_path_mode = 0 +" Quickly find and open a file in the current working directory let g:ctrlp_map = '' map j :CtrlP -map :CtrlPBuffer + +" Quickly find and open a buffer +map b :CtrlPBuffer + +" Quickly find and open a recently opened file +map f :CtrlPMRU let g:ctrlp_max_height = 20 let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' From e83f5ea2e775498fdd8307e6eb4c3436452699eb Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 21 Jun 2020 11:50:44 -0400 Subject: [PATCH 52/91] Updated plugins --- .../dockerfile/dockerfile_lint.vim | 19 ++++- .../ale/ale_linters/go/revive.vim | 21 +++++ .../ale/ale_linters/java/eclipselsp.vim | 19 +++++ .../ale/ale_linters/java/javac.vim | 35 +++++++- sources_non_forked/ale/autoload/ale.vim | 2 +- .../ale/doc/ale-cloudformation.txt | 36 ++++++++- sources_non_forked/ale/doc/ale-go.txt | 19 +++++ sources_non_forked/ale/doc/ale-java.txt | 37 ++++++++- .../doc/ale-supported-languages-and-tools.txt | 1 + sources_non_forked/ale/doc/ale.txt | 1 + sources_non_forked/ale/supported-tools.md | 1 + .../ctrlp.vim/autoload/ctrlp.vim | 22 ++++- sources_non_forked/goyo.vim/autoload/goyo.vim | 2 +- .../lightline.vim/.github/workflows/ci.yaml | 1 + .../lightline.vim/autoload/lightline.vim | 40 +++++----- .../lightline/colorscheme/jellybeans.vim | 2 +- .../lightline/colorscheme/seoul256.vim | 2 +- .../lightline/colorscheme/srcery_drk.vim | 2 +- .../autoload/lightline/colorscheme/wombat.vim | 4 +- .../autoload/lightline/colortable.vim | 12 ++- .../lightline.vim/test/autocmd.vim | 23 ++++++ sources_non_forked/nerdtree/CHANGELOG.md | 7 ++ .../nerdtree/autoload/nerdtree.vim | 2 +- .../nerdtree/lib/nerdtree/creator.vim | 6 +- .../nerdtree/lib/nerdtree/opener.vim | 2 +- .../nerdtree/lib/nerdtree/path.vim | 40 ++++++---- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 1 + .../nerdtree/nerdtree_plugin/fs_menu.vim | 15 ++++ .../nerdtree/syntax/nerdtree.vim | 2 +- sources_non_forked/nginx.vim/syntax/nginx.vim | 3 + sources_non_forked/rust.vim/syntax/rust.vim | 29 ++++++- .../vim-fugitive/autoload/fugitive.vim | 80 ++++++++++++------- .../vim-fugitive/syntax/fugitive.vim | 10 ++- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 33 +++++--- sources_non_forked/vim-gitgutter/unplace.vim | 27 ------- .../vim-javascript/ftdetect/javascript.vim | 2 +- .../vim-markdown/syntax/markdown.vim | 4 +- .../vim-markdown/test/syntax.vader | 3 +- .../vim-multiple-cursors/.travis.yml | 9 ++- .../vim-multiple-cursors/Gemfile.lock | 2 +- .../vim-multiple-cursors/README.md | 2 +- .../autoload/multiple_cursors.vim | 2 +- .../vim-snippets/UltiSnips/markdown.snippets | 2 +- .../vim-snippets/UltiSnips/rust.snippets | 10 ++- .../vim-snippets/snippets/html.snippets | 2 +- .../vim-snippets/snippets/rust.snippets | 26 ++++-- 46 files changed, 470 insertions(+), 152 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/go/revive.vim create mode 100644 sources_non_forked/lightline.vim/test/autocmd.vim delete mode 100644 sources_non_forked/vim-gitgutter/unplace.vim diff --git a/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim b/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim index 95768b12..0c0ad533 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim @@ -32,14 +32,29 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort let l:line = get(l:object, 'line', -1) let l:message = l:object['message'] - if get(l:object, 'description', 'None') isnot# 'None' - let l:message = l:message . '. ' . l:object['description'] + let l:link = get(l:object, 'reference_url', '') + + if type(l:link) == v:t_list + " Somehow, reference_url is returned as two-part list. + " Anchor markers in that list are sometimes duplicated. + " See https://github.com/projectatomic/dockerfile_lint/issues/134 + let l:link = join(l:link, '') + let l:link = substitute(l:link, '##', '#', '') endif + let l:detail = l:message + + if get(l:object, 'description', 'None') isnot# 'None' + let l:detail .= "\n\n" . l:object['description'] + endif + + let l:detail .= "\n\n" . l:link + call add(l:messages, { \ 'lnum': l:line, \ 'text': l:message, \ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type), + \ 'detail': l:detail, \}) endfor endfor diff --git a/sources_non_forked/ale/ale_linters/go/revive.vim b/sources_non_forked/ale/ale_linters/go/revive.vim new file mode 100644 index 00000000..b14b5ab9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/revive.vim @@ -0,0 +1,21 @@ +" Author: Penghui Liao +" Description: Adds support for revive + +call ale#Set('go_revive_executable', 'revive') +call ale#Set('go_revive_options', '') + +function! ale_linters#go#revive#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'go_revive_options') + + return ale#go#EnvString(a:buffer) . '%e' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'revive', +\ 'output_stream': 'both', +\ 'executable': {b -> ale#Var(b, 'go_revive_executable')}, +\ 'command': function('ale_linters#go#revive#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim index 2648893b..2bfec043 100644 --- a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -7,6 +7,7 @@ call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls' call ale#Set('java_eclipselsp_config_path', '') call ale#Set('java_eclipselsp_workspace_path', '') call ale#Set('java_eclipselsp_executable', 'java') +call ale#Set('java_eclipselsp_javaagent', '') function! ale_linters#java#eclipselsp#Executable(buffer) abort return ale#Var(a:buffer, 'java_eclipselsp_executable') @@ -100,12 +101,30 @@ function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer)) endfunction +function! ale_linters#java#eclipselsp#Javaagent(buffer) abort + let l:rets = [] + let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent') + + if empty(l:raw) + return '' + endif + + let l:jars = split(l:raw) + + for l:jar in l:jars + call add(l:rets, ale#Escape('-javaagent:' . l:jar)) + endfor + + return join(l:rets, ' ') +endfunction + function! ale_linters#java#eclipselsp#Command(buffer, version) abort let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) let l:cmd = [ ale#Escape(l:executable), + \ ale_linters#java#eclipselsp#Javaagent(a:buffer), \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', \ '-Dosgi.bundles.defaultStartLevel=4', \ '-Declipse.product=org.eclipse.jdt.ls.core.product', diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 8bb52c0b..f866eb09 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -6,6 +6,7 @@ let s:classpath_sep = has('unix') ? ':' : ';' call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') +call ale#Set('java_javac_sourcepath', '') function! ale_linters#java#javac#RunWithImportPaths(buffer) abort let l:command = '' @@ -40,10 +41,15 @@ endfunction function! s:BuildClassPathOption(buffer, import_paths) abort " Filter out lines like [INFO], etc. let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') - call extend( - \ l:class_paths, - \ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep), - \) + let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath') + + if !empty(l:cls_path) && type(l:cls_path) is v:t_string + call extend(l:class_paths, split(l:cls_path, s:classpath_sep)) + endif + + if !empty(l:cls_path) && type(l:cls_path) is v:t_list + call extend(l:class_paths, l:cls_path) + endif return !empty(l:class_paths) \ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) @@ -79,6 +85,27 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort endif endif + let l:source_paths = [] + let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath') + + if !empty(l:source_path) && type(l:source_path) is v:t_string + let l:source_paths = split(l:source_path, s:classpath_sep) + endif + + if !empty(l:source_path) && type(l:source_path) is v:t_list + let l:source_paths = l:source_path + endif + + if !empty(l:source_paths) + for l:path in l:source_paths + let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path) + + if !empty(l:sp_path) + call add(l:sp_dirs, l:sp_path) + endif + endfor + endif + if !empty(l:sp_dirs) let l:sp_option = '-sourcepath ' \ . ale#Escape(join(l:sp_dirs, s:classpath_sep)) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 01e17b15..6251b47b 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -163,7 +163,7 @@ function! ale#Queue(delay, ...) abort endif endfunction -let s:current_ale_version = [2, 6, 0] +let s:current_ale_version = [2, 7, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort diff --git a/sources_non_forked/ale/doc/ale-cloudformation.txt b/sources_non_forked/ale/doc/ale-cloudformation.txt index 59c6af06..9724403b 100644 --- a/sources_non_forked/ale/doc/ale-cloudformation.txt +++ b/sources_non_forked/ale/doc/ale-cloudformation.txt @@ -7,8 +7,40 @@ cfn-python-lint *ale-cloudformation-cfn-python-lint* cfn-python-lint is a linter for AWS CloudFormation template file. -https://github.com/awslabs/cfn-python-lint +Website: https://github.com/awslabs/cfn-python-lint +Installation +------------------------------------------------------------------------------- + + +Install cfn-python-lint using either pip or brew: > + +`pip install cfn-lint`. If pip is not available, run +`python setup.py clean --all` then `python setup.py install`. + + Homebrew (macOS): + +`brew install cfn-lint` + +< +Configuration +------------------------------------------------------------------------------- + +To get cloudformation linter to work on only CloudFormation files we must set +the buffer |filetype| to yaml.cloudformation. +This causes ALE to lint the file with linters configured for cloudformation and +yaml files. + +Just put: + +> + + au BufRead,BufNewFile *.template.yaml set filetype=yaml.cloudformation + +< + +on `ftdetect/cloudformation.vim` + +This will get both cloudformation and yaml linters to work on any file with `.template.yaml` ext. =============================================================================== 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 be53783e..5c0791bc 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -219,6 +219,25 @@ g:ale_go_govet_options *g:ale_go_govet_options* This variable can be set to pass additional options to the go vet linter. +=============================================================================== +revive *ale-go-revive* + +g:ale_go_revive_executable *g:ale_go_revive_executable* + *b:ale_go_revive_executable* + Type: |String| + Default: `'revive'` + + This variable can be set to change the revive executable path. + + +g:ale_go_revive_options *g:ale_go_revive_options* + *b:ale_go_revive_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the revive + + =============================================================================== staticcheck *ale-go-staticcheck* diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index 32f0e6eb..d2001ca7 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -46,7 +46,7 @@ javac *ale-java-javac* g:ale_java_javac_classpath *g:ale_java_javac_classpath* *b:ale_java_javac_classpath* - Type: |String| + Type: |String| or |List| Default: `''` This variable can be set to change the global classpath for Java. @@ -67,6 +67,30 @@ g:ale_java_javac_options *g:ale_java_javac_options* This variable can be set to pass additional options to javac. +g:ale_java_javac_sourcepath *g:ale_java_javac_sourcepath* + *b:ale_java_javac_sourcepath* + Type: |String| or |List| + Default: `''` + +This variable can set multiple source code paths, the source code path is a +relative path (relative to the project root directory). + +Example: + +String type: +Note that the unix system separator is a colon(`:`) window system +is a semicolon(`;`). +> + let g:ale_java_javac_sourcepath = 'build/gen/source/xx/main:build/gen/source' +< +List type: +> + let g:ale_java_javac_sourcepath = [ + \ 'build/generated/source/querydsl/main', + \ 'target/generated-sources/source/querydsl/main' + \ ] +< + =============================================================================== google-java-format *ale-java-google-java-format* @@ -222,6 +246,17 @@ g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path* absolute path of the Eclipse workspace. If not set this value will be set to the parent folder of the project root. +g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent* + *b:ale_java_eclipselsp_javaagent* + + Type: |String| + Default: `''` + + A variable to add java agent for annotation processing such as Lombok. + If you have multiple java agent files, use space to separate them. For example: +> + let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar' +< =============================================================================== uncrustify *ale-java-uncrustify* diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index bd2d5b4a..45252294 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -164,6 +164,7 @@ Notes: * `gosimple`!! * `gotype`!! * `go vet`!! + * `revive`!! * `staticcheck`!! * GraphQL * `eslint` diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 8d5b8820..724da57e 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -2379,6 +2379,7 @@ documented in additional help files. gometalinter..........................|ale-go-gometalinter| gopls.................................|ale-go-gopls| govet.................................|ale-go-govet| + revive................................|ale-go-revive| staticcheck...........................|ale-go-staticcheck| graphql.................................|ale-graphql-options| eslint................................|ale-graphql-eslint| diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index f6b26458..7d2f5287 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -173,6 +173,7 @@ formatting. * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [go vet](https://golang.org/cmd/vet/) :floppy_disk: + * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: * [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) :warning: :floppy_disk: * GraphQL * [eslint](http://eslint.org/) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index d1e23696..828a8c8d 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -790,6 +790,9 @@ fu! s:BuildPrompt(upd) if empty(prt[1]) && s:focus exe 'echoh' hibase '| echon "_" | echoh None' en + if a:upd + cal s:NotifySearch() + en endf " - SetDefTxt() {{{1 fu! s:SetDefTxt() @@ -2609,6 +2612,10 @@ fu! ctrlp#clearmarkedlist() let s:marked = {} endf +fu! ctrlp#input() + retu s:getinput() +endf + fu! ctrlp#exit() cal s:PrtExit() endf @@ -2735,8 +2742,21 @@ fu! ctrlp#init(type, ...) en cal s:BuildPrompt(1) if s:keyloop | cal s:KeyLoop() | en - return 1 + retu 1 endf + +" - Events {{{1 +fu! s:NotifySearch() + let l:cb = s:getextvar('search') + if l:cb != -1 + cal eval(l:cb) + en +endf + +fu! ctrlp#update() + cal s:ForceUpdate() +endf + " - Autocmds {{{1 if has('autocmd') aug CtrlPAug diff --git a/sources_non_forked/goyo.vim/autoload/goyo.vim b/sources_non_forked/goyo.vim/autoload/goyo.vim index 6667620e..0593f78c 100644 --- a/sources_non_forked/goyo.vim/autoload/goyo.vim +++ b/sources_non_forked/goyo.vim/autoload/goyo.vim @@ -203,7 +203,7 @@ function! s:goyo_on(dim) endif " vim-signify - let t:goyo_disabled_signify = exists('b:sy') && b:sy.active + let t:goyo_disabled_signify = !empty(getbufvar(bufnr(''), 'sy')) if t:goyo_disabled_signify SignifyToggle endif diff --git a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml index 967fbb2e..b5db7cef 100644 --- a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml +++ b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml @@ -13,6 +13,7 @@ jobs: strategy: matrix: vim: + - v8.2.1000 - v8.2.0000 - v8.1.0000 - v8.0.0000 diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 0e5d401a..e85e5891 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2020/03/16 19:10:15. +" Last Change: 2020/06/19 11:08:46. " ============================================================================= let s:save_cpo = &cpo @@ -11,27 +11,35 @@ set cpo&vim let s:_ = 1 " 1: uninitialized, 2: disabled function! lightline#update() abort - if &buftype ==# 'popup' | return | endif + if s:skip() | return | endif if s:_ if s:_ == 2 | return | endif call lightline#init() call lightline#colorscheme() endif - if !s:lightline.enable.statusline - return + if s:lightline.enable.statusline + let w = winnr() + let s = winnr('$') == 1 && w > 0 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)] + for n in range(1, winnr('$')) + call setwinvar(n, '&statusline', s[n!=w]) + endfor endif - let w = winnr() - let s = winnr('$') == 1 && w > 0 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)] - for n in range(1, winnr('$')) - call setwinvar(n, '&statusline', s[n!=w]) - endfor endfunction +if exists('*win_gettype') + function! s:skip() abort " Vim 8.2.0257 (00f3b4e007), 8.2.0991 (0fe937fd86), 8.2.0996 (40a019f157) + return win_gettype() ==# 'popup' || win_gettype() ==# 'autocmd' + endfunction +else + function! s:skip() abort + return &buftype ==# 'popup' + endfunction +endif + function! lightline#update_disable() abort - if !s:lightline.enable.statusline - return + if s:lightline.enable.statusline + call setwinvar(0, '&statusline', '') endif - call setwinvar(0, '&statusline', '') endfunction function! lightline#enable() abort @@ -190,13 +198,7 @@ function! lightline#colorscheme() abort let s:lightline.palette = g:lightline#colorscheme#{s:lightline.colorscheme}#palette finally if has('win32') && !has('gui_running') && &t_Co < 256 - for u in values(s:lightline.palette) - for v in values(u) - for _ in v - let [_[2], _[3]] = [lightline#colortable#gui2cui(_[0], _[2]), lightline#colortable#gui2cui(_[1], _[3])] - endfor - endfor - endfor + call lightline#colortable#gui2cui_palette(s:lightline.palette) endif let s:highlight = {} call lightline#highlight('normal') diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim index 15b2b35b..262442a6 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim @@ -5,7 +5,7 @@ " Last Change: 2013/09/07 12:21:04. " ============================================================================= let s:base03 = [ '#151513', 233 ] -let s:base02 = [ '#30302c ', 236 ] +let s:base02 = [ '#30302c', 236 ] let s:base01 = [ '#4e4e43', 239 ] let s:base00 = [ '#666656', 242 ] let s:base0 = [ '#808070', 244 ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/seoul256.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/seoul256.vim index ca2d5a09..8bc3e5dd 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/seoul256.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/seoul256.vim @@ -5,7 +5,7 @@ " Last Change: 2015/11/02 08:23:27. " ============================================================================= let s:base03 = [ '#151513', 233 ] -let s:base02 = [ '#30302c ', 236 ] +let s:base02 = [ '#30302c', 236 ] let s:base01 = [ '#4e4e43', 239 ] let s:base00 = [ '#666656', 242 ] let s:base0 = [ '#808070', 244 ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim index f1c7e1dd..5aa3a8a9 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/srcery_drk.vim @@ -5,7 +5,7 @@ " Last Change: 2018/05/19 " ============================================================================= let s:base03 = [ '#151513', 233 ] -let s:base02 = [ '#30302c ', 236 ] +let s:base02 = [ '#30302c', 236 ] let s:base01 = [ '#4e4e43', 239 ] let s:base00 = [ '#666656', 242 ] let s:base0 = [ '#808070', 244 ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/wombat.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/wombat.vim index 96192476..9fee12e5 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/wombat.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/wombat.vim @@ -5,8 +5,8 @@ " Last Change: 2015/11/30 08:37:43. " ============================================================================= let s:base03 = [ '#242424', 235 ] -let s:base023 = [ '#353535 ', 236 ] -let s:base02 = [ '#444444 ', 238 ] +let s:base023 = [ '#353535', 236 ] +let s:base02 = [ '#444444', 238 ] let s:base01 = [ '#585858', 240 ] let s:base00 = [ '#666666', 242 ] let s:base0 = [ '#808080', 244 ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colortable.vim b/sources_non_forked/lightline.vim/autoload/lightline/colortable.vim index 82617b20..6cdddd8d 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colortable.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colortable.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline/colortable.vim " Author: itchyny " License: MIT License -" Last Change: 2015/03/29 06:21:39. +" Last Change: 2020/06/19 11:07:13. " ============================================================================= let s:save_cpo = &cpo @@ -38,5 +38,15 @@ function! lightline#colortable#gui2cui(rgb, fallback) abort return rgb[0] + rgb[1] + rgb[2] endfunction +function! lightline#colortable#gui2cui_palette(palette) abort + for u in values(a:palette) + for v in values(u) + for w in v + let [w[2], w[3]] = [lightline#colortable#gui2cui(w[0], w[2]), lightline#colortable#gui2cui(w[1], w[3])] + endfor + endfor + endfor +endfunction + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/lightline.vim/test/autocmd.vim b/sources_non_forked/lightline.vim/test/autocmd.vim new file mode 100644 index 00000000..934509b8 --- /dev/null +++ b/sources_non_forked/lightline.vim/test/autocmd.vim @@ -0,0 +1,23 @@ +if !has("patch-8.2.0996") + finish +endif + +let s:suite = themis#suite('autocmd') +let s:assert = themis#helper('assert') + +function! s:suite.before_each() + let g:lightline = {} + call lightline#init() + tabnew + tabonly +endfunction + +function! s:suite.doautoall() + tabnew + tabnew + tabprevious + doautoall WinEnter + let statusline = getwinvar(1, '&statusline') + call s:assert.match(statusline, 'lightline') + call s:assert.match(statusline, '_active_') +endfunction diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index 0bcf4d74..0f1f1f5e 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -4,7 +4,14 @@ version in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.8 +- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138) #### 6.7 +- **.15**: Add curly braces to the list of characters to be escaped. (PhilRunninger) [#1128](https://github.com/preservim/nerdtree/pull/1128) +- **.14**: Use backward-compatible `nerdtree#and()` in one place that was missed. (PhilRunninger) [#1134](https://github.com/preservim/nerdtree/pull/1134) +- **.13**: `cmd.exe /c start "" ` for windows default viewer support. (J. Altayó) [#1130](https://github.com/preservim/nerdtree/pull/1130) +- **.12**: Fixed a bug that caused the file-tree construction to slow down significantly. (Eugenij-W) [#1126](https://github.com/preservim/nerdtree/pull/1126) +- **.11**: Fix exception in NERDTreeFind (on windows OS and If the file is located in the root directory of the disk) (Eugenij-W) [#1122](https://github.com/preservim/nerdtree/pull/1122) - **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120) - **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118) - **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 156b2602..d0785a4c 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -45,7 +45,7 @@ function! nerdtree#slash() abort endfunction "FUNCTION: nerdtree#and(x,y) {{{2 -" Implements and() function for Vim <= 7.2 +" Implements and() function for Vim <= 7.4 function! nerdtree#and(x,y) abort if exists('*and') return and(a:x, a:y) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index abaa8dbe..f845361d 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -249,7 +249,11 @@ function! s:Creator._pathForString(str) if dir =~# '^\.' let dir = getcwd() . g:NERDTreePath.Slash() . dir endif - let dir = g:NERDTreePath.Resolve(dir) + + "hack to prevent removing slash if dir is the root of the file system. + if dir !=# '/' + let dir = g:NERDTreePath.Resolve(dir) + endif try let path = g:NERDTreePath.New(dir) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index 0d9f9ba8..6cdd9dfc 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -219,7 +219,7 @@ endfunction " FUNCTION: Opener._openFile() {{{1 function! s:Opener._openFile() - if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed + if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed call b:NERDTree.ui.toggleZoom() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 2ac8c71c..d30dd511 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -332,7 +332,7 @@ function! s:Path._escChars() return " `\|\"#%&,?()\*^<>$" endif - return " \\`\|\"#%&,?()\*^<>[]$" + return " \\`\|\"#%&,?()\*^<>[]{}$" endfunction " FUNCTION: Path.getDir() {{{1 @@ -546,26 +546,36 @@ endfunction " return 1 if this path is somewhere above the given path in the filesystem. " " a:path should be a dir -function! s:Path.isAncestor(path) - if !self.isDirectory - return 0 - endif - - let this = self.str() - let that = a:path.str() - return stridx(that, this) ==# 0 +function! s:Path.isAncestor(child) + return a:child.isUnder(self) endfunction " FUNCTION: Path.isUnder(path) {{{1 " return 1 if this path is somewhere under the given path in the filesystem. -function! s:Path.isUnder(path) - if a:path.isDirectory ==# 0 +function! s:Path.isUnder(parent) + if a:parent.isDirectory ==# 0 return 0 endif - - let this = self.str() - let that = a:path.str() - return stridx(this, that . s:Path.Slash()) ==# 0 + if nerdtree#runningWindows() && a:parent.drive !=# self.drive + return 0 + endif + let l:this_count = len(self.pathSegments) + if l:this_count ==# 0 + return 0 + endif + let l:that_count = len(a:parent.pathSegments) + if l:that_count ==# 0 + return 1 + endif + if l:that_count >= l:this_count + return 0 + endif + for i in range(0, l:that_count-1) + if self.pathSegments[i] !=# a:parent.pathSegments[i] + return 0 + endif + endfor + return 1 endfunction " FUNCTION: Path.JoinPathStrings(...) {{{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 14d29964..d2ad1cd7 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -431,6 +431,7 @@ function! s:TreeDirNode._initChildren(silent) endtry endfor + let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder call self.sortChildren() call nerdtree#echo('') diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 9750976f..30734147 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -34,6 +34,10 @@ if executable('xdg-open') call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'}) endif +if nerdtree#runningWindows() + call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'}) +endif + if g:NERDTreePath.CopyingSupported() call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) endif @@ -451,4 +455,15 @@ function! NERDTreeExecuteFileLinux() call system('xdg-open ' . shellescape(l:node.path.str())) endfunction +" FUNCTION: NERDTreeExecuteFileWindows() {{{1 +function! NERDTreeExecuteFileWindows() + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return + endif + + call system('cmd.exe /c start "" ' . shellescape(l:node.path.str())) +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index df0c8046..fc7269ea 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -22,7 +22,7 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir "highlighting to conceal the delimiter around the file/dir name if has('conceal') exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL' - setlocal conceallevel=3 concealcursor=nvic + setlocal conceallevel=2 concealcursor=nvic else exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL' hi! link NERDTreeNodeDelimiters Ignore diff --git a/sources_non_forked/nginx.vim/syntax/nginx.vim b/sources_non_forked/nginx.vim/syntax/nginx.vim index 9e3b16b8..9d3b92e2 100644 --- a/sources_non_forked/nginx.vim/syntax/nginx.vim +++ b/sources_non_forked/nginx.vim/syntax/nginx.vim @@ -298,12 +298,15 @@ syn keyword ngxDirective large_client_header_buffers syn keyword ngxDirective least_conn syn keyword ngxDirective least_time syn keyword ngxDirective limit_conn +syn keyword ngxDirective limit_conn_dry_run syn keyword ngxDirective limit_conn_log_level syn keyword ngxDirective limit_conn_status syn keyword ngxDirective limit_conn_zone +syn keyword ngxDirective limit_except syn keyword ngxDirective limit_rate syn keyword ngxDirective limit_rate_after syn keyword ngxDirective limit_req +syn keyword ngxDirective limit_req_dry_run syn keyword ngxDirective limit_req_log_level syn keyword ngxDirective limit_req_status syn keyword ngxDirective limit_req_zone diff --git a/sources_non_forked/rust.vim/syntax/rust.vim b/sources_non_forked/rust.vim/syntax/rust.vim index 423e8fba..4677e211 100644 --- a/sources_non_forked/rust.vim/syntax/rust.vim +++ b/sources_non_forked/rust.vim/syntax/rust.vim @@ -67,8 +67,7 @@ syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipw syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained -syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount -syn match rustMacroRepeatCount ".\?[*+]" contained +syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end="),\=[*+]" contains=TOP syn match rustMacroVariable "$\w\+" " Reserved (but not yet used) keywords {{{2 @@ -231,6 +230,27 @@ syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError star syn keyword rustTodo contained TODO FIXME XXX NB NOTE +" asm! macro {{{2 +syn region rustAsmMacro matchgroup=rustMacro start="\', '-tab', 'g') 'keepalt split' s:fnameescape(file) + set bufhidden=wipe + let s:edit_jobs[bufnr('')] = [a:state, a:job] + return 1 + endif +endfunction + function! s:RunReceive(state, job, data, ...) abort call add(a:state.log, a:data) let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data @@ -2283,16 +2306,21 @@ function! s:RunReceive(state, job, data, ...) abort let data = remove(a:state, 'buffer') . data endif let escape = "\033]51;[^\007]*" - let a:state.buffer = matchstr(data, escape . "$\\|[\r\n]\\+$") - if len(a:state.buffer) - let data = strpart(data, 0, len(data) - len(a:state.buffer)) + let a:state.escape_buffer = matchstr(data, escape . '$') + if len(a:state.escape_buffer) + let data = strpart(data, 0, len(data) - len(a:state.escape_buffer)) endif let cmd = matchstr(data, escape . "\007")[5:-2] let data = substitute(data, escape . "\007", '', 'g') - echon substitute(data, "\r\\ze\n", '', 'g') if cmd =~# '^fugitive:' let a:state.request = strpart(cmd, 9) endif + let data = a:state.echo_buffer . data + let a:state.echo_buffer = matchstr(data, "[\r\n]\\+$") + if len(a:state.echo_buffer) + let data = strpart(data, 0, len(data) - len(a:state.echo_buffer)) + endif + echon substitute(data, "\r\\ze\n", '', 'g') endfunction function! s:RunSend(job, str) abort @@ -2314,7 +2342,7 @@ endif function! s:RunWait(state, job) abort let finished = 0 try - while get(a:state, 'request', '') !=# 'edit' && (type(a:job) == type(0) ? jobwait([a:job], 1)[0] == -1 : ch_status(a:job) !=# 'closed') + while get(a:state, 'request', '') !=# 'edit' && (type(a:job) == type(0) ? jobwait([a:job], 1)[0] == -1 : ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run') if !exists('*jobwait') sleep 1m endif @@ -2341,13 +2369,7 @@ function! s:RunWait(state, job) abort endwhile sleep 1m echo - if get(a:state, 'request', '') == 'edit' - call remove(a:state, 'request') - let file = readfile(a:state.temp . '.edit')[0] - exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) - set bufhidden=wipe - let s:edit_jobs[bufnr('')] = [a:state, a:job] - endif + call s:RunEdit(a:state, a:job) let finished = 1 finally if !finished @@ -2538,7 +2560,14 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort endif endif if s:RunJobs() - let state = {'dir': dir, 'mods': s:Mods(a:mods), 'temp': tempname(), 'log': []} + let state = { + \ 'dir': dir, + \ 'mods': s:Mods(a:mods), + \ 'title': ':Git ' . a:arg, + \ 'echo_buffer': '', + \ 'escape_buffer': '', + \ 'log': [], + \ 'temp': tempname()} let state.pty = get(g:, 'fugitive_pty', has('unix') && (has('patch-8.0.0744') || has('nvim'))) if !state.pty let args = s:AskPassArgs(dir) + args @@ -3598,6 +3627,10 @@ function! s:DoToggleHeadHeader(value) abort call search('\C^index$', 'wc') endfunction +function! s:DoToggleHelpHeader(value) abort + exe 'help fugitive-map' +endfunction + function! s:DoStagePushHeader(value) abort let remote = matchstr(a:value, '\zs[^/]\+\ze/') if empty(remote) @@ -4157,14 +4190,13 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort let args = args[1:-1] endif let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') - let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args if listnr > 0 exe listnr 'wincmd w' else call s:BlurStatus() endif redraw - call s:QuickfixCreate(listnr, {'title': (listnr < 0 ? ':Ggrep ' : ':Glgrep ') . s:fnameescape(args)}) + call s:QuickfixCreate(listnr, {'title': (listnr < 0 ? ':Git grep ' : ':0Git grep ') . s:fnameescape(args)}) let tempfile = tempname() let event = listnr < 0 ? 'grep-fugitive' : 'lgrep-fugitive' silent exe s:DoAutocmd('QuickFixCmdPre ' . event) @@ -4742,18 +4774,6 @@ function! fugitive#FetchComplete(A, L, P, ...) abort return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'), a:000) endfunction -function! s:AskPassArgs(dir) abort - if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && fugitive#GitVersion(1, 8) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir)) - if s:executable(s:ExecPath() . '/git-gui--askpass') - return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] - elseif s:executable('ssh-askpass') - return ['-c', 'core.askPass=ssh-askpass'] - endif - endif - return [] -endfunction - function! s:Dispatch(bang, options) abort let dir = a:options.dir exe s:DirCheck(dir) @@ -4797,11 +4817,11 @@ endfunction augroup fugitive_diff autocmd! - autocmd BufWinLeave * + autocmd BufWinLeave * nested \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 2 | \ call s:diffoff_all(s:Dir(+expand(''))) | \ endif - autocmd BufWinEnter * + autocmd BufWinEnter * nested \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 1 | \ call s:diffoff() | \ endif @@ -6026,7 +6046,7 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'czP', ':Git stash pop --quiet stash@{=v:count}') call s:Map('n', 'czv', ':exe "Gedit" fugitive#RevParse("stash@{" . v:count . "}")', '') call s:Map('n', 'czw', ':Git stash --keep-index=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""') - call s:Map('n', 'czz', ':Git stash =v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""') + call s:Map('n', 'czz', ':Git stash =v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""') call s:Map('n', 'cz?', ':help fugitive_cz', '') call s:Map('n', 'co', ':Git checkout') diff --git a/sources_non_forked/vim-fugitive/syntax/fugitive.vim b/sources_non_forked/vim-fugitive/syntax/fugitive.vim index afc0c0bc..e84eba4e 100644 --- a/sources_non_forked/vim-fugitive/syntax/fugitive.vim +++ b/sources_non_forked/vim-fugitive/syntax/fugitive.vim @@ -8,6 +8,9 @@ syn spell notoplevel syn include @fugitiveDiff syntax/diff.vim syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite +syn match fugitiveBareHeader /^Bare:/ +syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite +syn match fugitiveHelpTag /\S\+/ contained syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$/ syn cluster fugitiveSection contains=fugitiveSection @@ -20,8 +23,8 @@ syn match fugitiveDone /^done\>/ contained containedin=@fugitiveSection nextgrou syn match fugitiveStop /^stop\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite syn match fugitiveModifier /^[MADRCU?]\{1,2} / contained containedin=@fugitiveSection syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@/ contained containedin=@fugitiveSection -syn match fugitiveHash /\<\x\{4,\}\>/ contained +syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection +syn match fugitiveHash /\S\@ ]*>" end=">" diff --git a/sources_non_forked/vim-markdown/test/syntax.vader b/sources_non_forked/vim-markdown/test/syntax.vader index 5ce94fc2..d6f5487e 100644 --- a/sources_non_forked/vim-markdown/test/syntax.vader +++ b/sources_non_forked/vim-markdown/test/syntax.vader @@ -634,7 +634,8 @@ Given markdown; Execute (link with url title): AssertEqual SyntaxOf('https://domain.tld'), 'mkdInlineURL' - AssertEqual SyntaxOf('https://domain.com'), 'mkdInlineURL' + AssertNotEqual SyntaxOf(']'), 'mkdInlineURL' + AssertEqual SyntaxOf('https://domain.com'), 'mkdURL' AssertNotEqual SyntaxOf('not_a_link'), 'mkdInlineURL' # Code Blocks diff --git a/sources_non_forked/vim-multiple-cursors/.travis.yml b/sources_non_forked/vim-multiple-cursors/.travis.yml index cfb198ab..98d432c2 100644 --- a/sources_non_forked/vim-multiple-cursors/.travis.yml +++ b/sources_non_forked/vim-multiple-cursors/.travis.yml @@ -1,11 +1,12 @@ -sudo: false +os: linux +dist: bionic language: ruby addons: apt: packages: - vim-gtk + - xvfb -before_script: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" +script: + - xvfb-run bundle exec rake diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index 5e909c4a..e833b243 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (12.3.3) + rake (10.4.2) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 43dcfee8..7abe3f30 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -1,5 +1,5 @@ # vim-multiple-cursors -[![Build Status](https://travis-ci.org/terryma/vim-multiple-cursors.svg)](https://travis-ci.org/terryma/vim-multiple-cursors) +[![Build Status](https://travis-ci.org/terryma/vim-multiple-cursors.svg?branch=master)](https://travis-ci.org/github/terryma/vim-multiple-cursors) ## Contents - [About](#about) diff --git a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim index cdc8d978..32a9aec3 100644 --- a/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim +++ b/sources_non_forked/vim-multiple-cursors/autoload/multiple_cursors.vim @@ -1285,7 +1285,7 @@ function! s:wait_for_user_input(mode) call s:start_latency_measure() " Clears any echoes we might've added - normal! : + normal! : " add chars to s:char if it start like a special/quit key let is_special_key = 0 diff --git a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index b9962a10..72b9f8f7 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -136,7 +136,7 @@ endsnippet snippet detail "Disclosure" - ${1:summary>${2}}$0 + ${1:${2}}$0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index 0e3db68e..b284f0a2 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -17,13 +17,13 @@ pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { endsnippet snippet afn "async fn name(?) -> ? {}" -fn ${1:function_name}($2)${3/..*/ -> /}$3 { +async fn ${1:function_name}($2)${3/..*/ -> /}$3 { ${VISUAL}$0 } endsnippet snippet pafn "pub async fn name(?) -> ? {}" -pub fn ${1:function_name}($2)${3/..*/ -> /}$3 { +pub async fn ${1:function_name}($2)${3/..*/ -> /}$3 { ${VISUAL}$0 } endsnippet @@ -44,4 +44,10 @@ snippet .it ".iter()" i .iter()$0 endsnippet +snippet impl "Struct/Trait implementation" b +impl ${1:Type/Trait}${2: for ${3:Type}} { + $0 +} +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index 0410d223..bc42f944 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -175,7 +175,7 @@ snippet aside# ${0} snippet audio - snippet b ${0} snippet base diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 98088b0f..66b3d3e4 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -122,6 +122,10 @@ snippet ife "if / else" } else { ${0} } +snippet ifl "if let (...)" + if let ${1:Some(${2})} = $3 { + ${0:${VISUAL}} + } snippet el "else" else { ${0:${VISUAL}} @@ -146,6 +150,10 @@ snippet wh "while loop" while ${1:condition} { ${0:${VISUAL}} } +snippet whl "while let (...)" + while let ${1:Some(${2})} = $3 { + ${0:${VISUAL}} + } snippet for "for ... in ... loop" for ${1:i} in ${2} { ${0} @@ -157,21 +165,21 @@ snippet fixme "FIXME comment" // FIXME: $0 # Struct snippet st "Struct definition" - struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} { ${0} } snippet impl "Struct/Trait implementation" - impl ${1:Type/Trait}${2: for ${3:Type}} { + impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} { ${0} } snippet stn "Struct with new constructor" - pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} { ${0} } - impl $1 { - pub fn new(${2}) -> Self { - $1 { ${3} } + impl$2 $1$2 { + pub fn new(${4}) -> Self { + $1 { ${5} } } } snippet ty "Type alias" @@ -190,7 +198,7 @@ snippet trait "Trait definition" ${0} } snippet drop "Drop trait implementation (destructor)" - impl Drop for ${1:Name} { + impl$2 Drop for ${1:Name}${2:<${3:T}>} { fn drop(&mut self) { ${0} } @@ -238,9 +246,11 @@ snippet macro "macro_rules!" b $3 ) } -snippet box "Box::new()" +snippet boxp "Box::new()" Box::new(${0:${VISUAL}}) snippet rc "Rc::new()" Rc::new(${0:${VISUAL}}) snippet unim "unimplemented!()" unimplemented!() +snippet use "use ...;" b + use ${1:std::${2:io}}; From 5ac8ad718b81b29b18755dd49c5ce4d0a906c81c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2020 23:24:04 -0400 Subject: [PATCH 53/91] Bump rake in /sources_non_forked/vim-multiple-cursors (#586) Bumps [rake](https://github.com/ruby/rake) from 10.4.2 to 12.3.3. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v10.4.2...v12.3.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sources_non_forked/vim-multiple-cursors/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index e833b243..5e909c4a 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (10.4.2) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From 04988ed839875643a007d0a47a0893833988de4a Mon Sep 17 00:00:00 2001 From: Quentin Meeus Date: Sat, 11 Jul 2020 05:26:23 +0200 Subject: [PATCH 54/91] fix typo when installing for specific users (#578) line 34 had `~/$user` which evaluates to `/home/user1/user1`. Now changed into `~$user` as above --- install_awesome_parameterized.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_awesome_parameterized.sh b/install_awesome_parameterized.sh index 1e0bde1d..ee4be411 100755 --- a/install_awesome_parameterized.sh +++ b/install_awesome_parameterized.sh @@ -31,7 +31,7 @@ else SELECTED_USERS=${@:2} echo "Selected users: $SELECTED_USERS" for user in $SELECTED_USERS; do - homepath=$(eval echo "~/$user") + homepath=$(eval echo "~$user") IFS='' echo $VIMRC > ${homepath}/.vimrc unset IFS From e351960bbbb56054d87cf16131f62ebb2a37d543 Mon Sep 17 00:00:00 2001 From: UtkarshChemE Date: Fri, 10 Jul 2020 20:28:47 -0700 Subject: [PATCH 55/91] Replaced a Visual remap to a more useful one (#581) --- vimrcs/extended.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 5df62308..459b085a 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -85,7 +85,7 @@ vnoremap $2 `>a]` vnoremap $3 `>a}` vnoremap $$ `>a"` vnoremap $q `>a'` -vnoremap $e `>a"` +vnoremap $e `>a`` " Map auto complete of (, ", ', [ inoremap $1 ()i From ffcb49efb69420542d349bf4ef0e79600c08eaf5 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 10 Jul 2020 23:29:44 -0400 Subject: [PATCH 56/91] Update README.md $e in the visual mode now wraps in ` instead of " (as $$ wraps with ") --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bcc4bf47..bf5812c7 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ Surround the visual selection in parenthesis/brackets/etc.: vnoremap $3 `>a}` vnoremap $$ `>a"` vnoremap $q `>a'` - vnoremap $e `>a"` + vnoremap $e `>a`` ### Insert mode mappings From 92dab794c6f7b28ead528ec01cfe57cc35ed5a79 Mon Sep 17 00:00:00 2001 From: Amir Salihefendic Date: Fri, 10 Jul 2020 23:39:05 -0400 Subject: [PATCH 57/91] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf5812c7..95a7a35d 100644 --- a/README.md +++ b/README.md @@ -370,8 +370,8 @@ Just do following: * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` -## Doist +## Looking for a remote-first job? -Maintaining this Vim configuration isn't my day job. Daily I am the founder of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏). +Maintaining this Vim configuration isn't my day job. Daily I am the founder/CEO of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏). PS: Using Vim isn't a requirement 😄 From a06964dd3b8cdf55ec2c90da03df39bc6b90b502 Mon Sep 17 00:00:00 2001 From: Amir Date: Fri, 4 Dec 2020 22:15:32 +0100 Subject: [PATCH 58/91] Updated plugins --- sources_non_forked/ale/LICENSE | 2 +- .../ale/ale_linters/ada/gcc.vim | 2 +- .../ale/ale_linters/asciidoc/languagetool.vim | 5 + .../ale/ale_linters/asm/gcc.vim | 2 +- .../ale/ale_linters/bib/bibclean.vim | 7 +- sources_non_forked/ale/ale_linters/c/cc.vim | 53 ++ sources_non_forked/ale/ale_linters/c/ccls.vim | 3 +- .../ale/ale_linters/c/clang.vim | 24 - .../ale/ale_linters/c/cppcheck.vim | 2 + sources_non_forked/ale/ale_linters/c/gcc.vim | 28 - sources_non_forked/ale/ale_linters/cpp/cc.vim | 53 ++ .../ale/ale_linters/cpp/ccls.vim | 3 +- .../ale/ale_linters/cpp/clang.vim | 24 - .../ale/ale_linters/cpp/clangtidy.vim | 5 + .../ale/ale_linters/cpp/cppcheck.vim | 2 + .../ale/ale_linters/cpp/gcc.vim | 29 - .../ale/ale_linters/cuda/nvcc.vim | 3 - .../ale/ale_linters/elixir/credo.vim | 2 +- .../ale/ale_linters/erlang/elvis.vim | 39 ++ .../ale/ale_linters/eruby/ruumba.vim | 2 +- .../ale/ale_linters/go/gofmt.vim | 1 - .../handlebars/embertemplatelint.vim | 31 +- .../ale/ale_linters/java/checkstyle.vim | 2 +- .../ale/ale_linters/java/eclipselsp.vim | 31 +- .../ale/ale_linters/java/javac.vim | 8 +- .../ale/ale_linters/kotlin/ktlint.vim | 2 +- .../ale/ale_linters/markdown/markdownlint.vim | 13 +- .../ale/ale_linters/nasm/nasm.vim | 3 +- .../ale/ale_linters/objc/ccls.vim | 3 +- .../ale/ale_linters/objc/clang.vim | 2 +- .../ale/ale_linters/objcpp/clang.vim | 2 +- .../ale/ale_linters/ocaml/ols.vim | 2 +- .../ale/ale_linters/php/intelephense.vim | 32 + .../ale/ale_linters/php/phpcs.vim | 2 +- .../ale/ale_linters/php/psalm.vim | 10 +- .../ale/ale_linters/php/tlint.vim | 80 +++ .../ale/ale_linters/puppet/puppet.vim | 8 +- .../ale/ale_linters/pyrex/cython.vim | 4 +- .../ale/ale_linters/python/flake8.vim | 28 +- .../ale/ale_linters/python/jedils.vim | 34 ++ .../ale/ale_linters/python/pydocstyle.vim | 8 +- .../ale/ale_linters/python/pylint.vim | 38 +- .../ale/ale_linters/python/pyright.vim | 43 ++ .../ale/ale_linters/r/languageserver.vim | 26 + .../ale/ale_linters/reason/ols.vim | 2 +- .../ale/ale_linters/ruby/rubocop.vim | 2 +- .../ale/ale_linters/ruby/standardrb.vim | 2 +- .../ale/ale_linters/rust/cargo.vim | 5 + .../ale/ale_linters/sh/bashate.vim | 43 ++ .../ale/ale_linters/sh/shell.vim | 2 +- .../ale/ale_linters/sql/sqllint.vim | 33 + .../ale/ale_linters/swift/swiftformat.vim | 62 ++ .../ale/ale_linters/typescript/tsserver.vim | 1 + .../ale/ale_linters/verilog/hdl_checker.vim | 5 + .../ale/ale_linters/verilog/vlog.vim | 14 +- .../ale/ale_linters/vhdl/hdl_checker.vim | 5 + .../ale/ale_linters/vim/vint.vim | 9 +- .../ale/ale_linters/zig/zls.vim | 20 + sources_non_forked/ale/autoload/ale.vim | 32 +- .../ale/autoload/ale/assert.vim | 2 +- .../ale/autoload/ale/balloon.vim | 32 +- sources_non_forked/ale/autoload/ale/c.vim | 268 ++++++-- .../ale/autoload/ale/code_action.vim | 283 +++++++-- .../ale/autoload/ale/codefix.vim | 484 +++++++++++++++ .../ale/autoload/ale/command.vim | 42 +- .../ale/autoload/ale/completion.vim | 330 +++++++--- .../ale/autoload/ale/cursor.vim | 2 + .../ale/autoload/ale/debugging.vim | 13 + .../ale/autoload/ale/definition.vim | 8 - .../ale/autoload/ale/engine.vim | 277 ++++----- .../ale/autoload/ale/events.vim | 10 +- .../ale/autoload/ale/filename_mapping.vim | 22 + sources_non_forked/ale/autoload/ale/fix.vim | 123 ++-- .../ale/autoload/ale/fix/registry.vim | 35 ++ .../ale/autoload/ale/fixers/astyle.vim | 59 ++ .../ale/autoload/ale/fixers/autoimport.vim | 25 + .../ale/autoload/ale/fixers/dhall.vim | 23 + .../ale/autoload/ale/fixers/eslint.vim | 9 +- .../ale/autoload/ale/fixers/gofmt.vim | 3 - .../ale/autoload/ale/fixers/ktlint.vim | 3 +- .../ale/autoload/ale/fixers/latexindent.vim | 4 +- .../ale/autoload/ale/fixers/luafmt.vim | 13 + .../ale/autoload/ale/fixers/ocamlformat.vim | 3 +- .../ale/autoload/ale/fixers/ormolu.vim | 12 + .../ale/autoload/ale/fixers/phpcbf.vim | 3 +- .../ale/autoload/ale/fixers/prettier.vim | 17 +- .../autoload/ale/fixers/prettier_standard.vim | 4 +- .../ale/autoload/ale/fixers/remark_lint.vim | 24 + .../ale/autoload/ale/fixers/rubocop.vim | 24 +- .../ale/autoload/ale/fixers/standard.vim | 2 +- .../ale/autoload/ale/fixers/tslint.vim | 2 +- .../ale/autoload/ale/fixers/yamlfix.vim | 25 + .../ale/autoload/ale/handlers/ccls.vim | 7 + .../ale/autoload/ale/handlers/cppcheck.vim | 15 +- .../ale/autoload/ale/handlers/eslint.vim | 48 +- .../ale/autoload/ale/handlers/gcc.vim | 19 +- .../ale/autoload/ale/handlers/go.vim | 5 +- .../ale/autoload/ale/handlers/hdl_checker.vim | 71 +++ .../ale/autoload/ale/handlers/ktlint.vim | 2 +- .../autoload/ale/handlers/markdownlint.vim | 13 +- .../ale/autoload/ale/handlers/sh.vim | 39 +- .../ale/autoload/ale/handlers/shellcheck.vim | 35 +- sources_non_forked/ale/autoload/ale/hover.vim | 212 ++++++- .../ale/autoload/ale/linter.vim | 210 ++----- sources_non_forked/ale/autoload/ale/lsp.vim | 38 ++ .../ale/autoload/ale/lsp/message.vim | 22 + .../ale/autoload/ale/lsp/response.vim | 1 + .../ale/autoload/ale/lsp/tsserver_message.vim | 36 ++ .../ale/autoload/ale/lsp_linter.vim | 23 +- sources_non_forked/ale/autoload/ale/maven.vim | 51 ++ sources_non_forked/ale/autoload/ale/node.vim | 14 +- .../ale/autoload/ale/organize_imports.vim | 11 +- sources_non_forked/ale/autoload/ale/path.vim | 20 +- .../ale/autoload/ale/preview.vim | 33 +- .../ale/autoload/ale/rename.vim | 87 ++- sources_non_forked/ale/autoload/ale/test.vim | 4 +- sources_non_forked/ale/autoload/ale/uri.vim | 15 +- sources_non_forked/ale/autoload/ale/util.vim | 29 +- sources_non_forked/ale/doc/ale-c.txt | 175 +++--- sources_non_forked/ale/doc/ale-cpp.txt | 168 +++--- .../ale/doc/ale-development.txt | 82 +++ sources_non_forked/ale/doc/ale-elixir.txt | 2 +- sources_non_forked/ale/doc/ale-erlang.txt | 12 + sources_non_forked/ale/doc/ale-handlebars.txt | 6 +- sources_non_forked/ale/doc/ale-haskell.txt | 20 + sources_non_forked/ale/doc/ale-java.txt | 26 +- sources_non_forked/ale/doc/ale-javascript.txt | 2 +- sources_non_forked/ale/doc/ale-lua.txt | 16 + sources_non_forked/ale/doc/ale-markdown.txt | 11 + sources_non_forked/ale/doc/ale-php.txt | 122 +++- sources_non_forked/ale/doc/ale-powershell.txt | 7 - sources_non_forked/ale/doc/ale-python.txt | 99 ++- sources_non_forked/ale/doc/ale-r.txt | 29 +- sources_non_forked/ale/doc/ale-ruby.txt | 12 +- sources_non_forked/ale/doc/ale-rust.txt | 35 +- sources_non_forked/ale/doc/ale-sh.txt | 23 + sources_non_forked/ale/doc/ale-sql.txt | 2 +- .../doc/ale-supported-languages-and-tools.txt | 28 +- sources_non_forked/ale/doc/ale-verilog.txt | 18 +- sources_non_forked/ale/doc/ale-vhdl.txt | 75 ++- sources_non_forked/ale/doc/ale-yaml.txt | 38 +- sources_non_forked/ale/doc/ale-zig.txt | 33 + sources_non_forked/ale/doc/ale.txt | 571 +++++++++++++++--- sources_non_forked/ale/plugin/ale.vim | 55 +- .../rplugin/python3/deoplete/sources/ale.py | 5 +- sources_non_forked/ale/supported-tools.md | 22 +- .../ctrlp.vim/autoload/ctrlp.vim | 249 +++++--- .../ctrlp.vim/autoload/ctrlp/utils.vim | 31 +- sources_non_forked/ctrlp.vim/doc/ctrlp.cnx | 12 +- sources_non_forked/ctrlp.vim/doc/ctrlp.txt | 10 +- sources_non_forked/goyo.vim/doc/goyo.txt | 2 - sources_non_forked/gruvbox/README.md | 2 +- .../lightline.vim/.github/workflows/ci.yaml | 4 +- sources_non_forked/lightline.vim/README.md | 3 +- .../lightline.vim/autoload/lightline.vim | 95 ++- .../lightline/colorscheme/16color.vim | 74 +-- .../lightline/colorscheme/jellybeans.vim | 8 +- .../lightline/colorscheme/selenized_black.vim | 2 +- .../lightline/colorscheme/selenized_dark.vim | 2 +- .../lightline/colorscheme/selenized_light.vim | 2 +- .../lightline/colorscheme/selenized_white.vim | 2 +- .../lightline.vim/colorscheme.md | 8 +- .../lightline.vim/doc/lightline.txt | 352 +++-------- .../lightline.vim/plugin/lightline.vim | 4 +- .../lightline.vim/test/.themisrc | 2 + .../lightline.vim/test/link.vim | 14 + .../lightline.vim/test/tabs.vim | 2 +- .../lightline.vim/test/toggle.vim | 6 + .../nerdtree/.github/PULL_REQUEST_TEMPLATE.md | 10 +- sources_non_forked/nerdtree/CHANGELOG.md | 12 + sources_non_forked/nerdtree/README.markdown | 2 +- .../nerdtree/autoload/nerdtree.vim | 18 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 42 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 13 +- .../nerdtree/lib/nerdtree/creator.vim | 7 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 4 +- .../nerdtree/lib/nerdtree/opener.vim | 3 +- .../nerdtree/lib/nerdtree/path.vim | 73 +-- .../nerdtree/lib/nerdtree/tree_dir_node.vim | 8 +- .../nerdtree/lib/nerdtree/ui.vim | 9 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 8 +- .../nerdtree/plugin/NERD_tree.vim | 197 +++--- .../nerdtree/syntax/nerdtree.vim | 4 +- sources_non_forked/nginx.vim/README.md | 13 +- sources_non_forked/rust.vim/README.md | 78 ++- .../rust.vim/autoload/cargo/quickfix.vim | 3 +- .../rust.vim/autoload/rustfmt.vim | 8 +- sources_non_forked/rust.vim/syntax/rust.vim | 5 +- .../typescript-vim/syntax/typescript.vim | 12 +- .../vim-abolish/plugin/abolish.vim | 6 +- .../vim-fugitive/autoload/fugitive.vim | 97 +-- .../vim-fugitive/doc/fugitive.txt | 3 + .../vim-fugitive/plugin/fugitive.vim | 4 +- sources_non_forked/vim-gist/autoload/gist.vim | 360 +++++------ sources_non_forked/vim-gitgutter/README.mkd | 18 +- .../vim-gitgutter/autoload/gitgutter.vim | 12 +- .../autoload/gitgutter/async.vim | 12 +- .../autoload/gitgutter/debug.vim | 14 +- .../vim-gitgutter/autoload/gitgutter/diff.vim | 22 +- .../autoload/gitgutter/highlight.vim | 2 +- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 75 ++- .../vim-gitgutter/doc/gitgutter.txt | 41 +- .../vim-gitgutter/plugin/gitgutter.vim | 98 +-- sources_non_forked/vim-markdown/README.md | 6 + .../vim-markdown/ftdetect/markdown.vim | 4 +- .../vim-markdown/ftplugin/markdown.vim | 228 ++++--- .../vim-markdown/syntax/markdown.vim | 4 +- .../vim-markdown/test/folding-toc.vader | 16 +- .../vim-markdown/test/insert-toc.vader | 147 +++++ .../vim-markdown/test/syntax.vader | 29 +- .../vim-multiple-cursors/README.md | 2 + sources_non_forked/vim-ruby/INSTALL.markdown | 3 + sources_non_forked/vim-ruby/README | 73 --- sources_non_forked/vim-ruby/README.markdown | 63 ++ .../vim-ruby/doc/ft-ruby-indent.txt | 41 +- .../vim-ruby/doc/ft-ruby-omni.txt | 1 + .../vim-ruby/doc/ft-ruby-plugin.txt | 2 + .../vim-ruby/doc/ft-ruby-syntax.txt | 1 + .../vim-ruby/ftplugin/eruby.vim | 2 +- sources_non_forked/vim-ruby/indent/ruby.vim | 17 +- .../vim-ruby/spec/indent/blocks_spec.rb | 5 +- .../spec/indent/continuations_spec.rb | 5 +- .../spec/indent/hanging_elements_spec.rb | 78 +++ .../indent/indent_access_modifier_spec.rb | 4 - .../vim-ruby/spec/indent/nesting_spec.rb | 3 + .../vim-ruby/spec/indent/splat_spec.rb | 1 + .../vim-ruby/spec/spec_helper.rb | 10 + sources_non_forked/vim-ruby/syntax/ruby.vim | 4 +- .../vim-snipmate/Contributors.md | 1 + .../vim-snipmate/autoload/snipMate.vim | 2 +- .../vim-snippets/UltiSnips/c.snippets | 41 +- .../vim-snippets/UltiSnips/cpp.snippets | 69 +++ .../vim-snippets/UltiSnips/django.snippets | 1 - .../vim-snippets/UltiSnips/haskell.snippets | 12 +- .../vim-snippets/UltiSnips/html.snippets | 2 +- .../UltiSnips/javascript_react.snippets | 2 +- .../vim-snippets/UltiSnips/markdown.snippets | 4 +- .../vim-snippets/UltiSnips/rust.snippets | 4 +- .../vim-snippets/UltiSnips/tex.snippets | 28 +- .../vim-snippets/pythonx/vimsnippets.py | 9 +- .../vim-snippets/snippets/clojure.snippets | 22 +- .../vim-snippets/snippets/elixir.snippets | 43 +- .../vim-snippets/snippets/eruby.snippets | 7 +- .../vim-snippets/snippets/gitcommit.snippets | 2 + .../vim-snippets/snippets/go.snippets | 2 +- .../vim-snippets/snippets/html.snippets | 2 +- .../vim-snippets/snippets/java.snippets | 4 +- .../snippets/javascript-es6-react.snippets | 82 --- .../javascript-jasmine.snippets | 0 .../javascript/javascript-react.snippets | 236 +++++--- .../snippets/javascript/javascript.snippets | 14 + .../vim-snippets/snippets/markdown.snippets | 8 +- .../vim-snippets/snippets/ocaml.snippets | 6 +- .../vim-snippets/snippets/ps1.snippets | 5 +- .../vim-snippets/snippets/rust.snippets | 20 +- .../vim-snippets/snippets/tex.snippets | 56 ++ .../vim-snippets/snippets/twig.snippets | 205 ++++++- .../vim-snippets/snippets/typescript.snippets | 26 +- .../vim-snippets/snippets/verilog.snippets | 2 +- .../vim-snippets/snippets/vhdl.snippets | 2 +- .../vim-snippets/snippets/vim.snippets | 1 - 261 files changed, 6955 insertions(+), 2773 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim create mode 100644 sources_non_forked/ale/ale_linters/c/cc.vim delete mode 100644 sources_non_forked/ale/ale_linters/c/clang.vim delete mode 100644 sources_non_forked/ale/ale_linters/c/gcc.vim create mode 100644 sources_non_forked/ale/ale_linters/cpp/cc.vim delete mode 100644 sources_non_forked/ale/ale_linters/cpp/clang.vim delete mode 100644 sources_non_forked/ale/ale_linters/cpp/gcc.vim create mode 100644 sources_non_forked/ale/ale_linters/erlang/elvis.vim create mode 100644 sources_non_forked/ale/ale_linters/php/intelephense.vim create mode 100644 sources_non_forked/ale/ale_linters/php/tlint.vim create mode 100644 sources_non_forked/ale/ale_linters/python/jedils.vim create mode 100644 sources_non_forked/ale/ale_linters/python/pyright.vim create mode 100644 sources_non_forked/ale/ale_linters/r/languageserver.vim create mode 100644 sources_non_forked/ale/ale_linters/sh/bashate.vim create mode 100644 sources_non_forked/ale/ale_linters/sql/sqllint.vim create mode 100644 sources_non_forked/ale/ale_linters/swift/swiftformat.vim create mode 100644 sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim create mode 100644 sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim create mode 100644 sources_non_forked/ale/ale_linters/zig/zls.vim create mode 100644 sources_non_forked/ale/autoload/ale/codefix.vim create mode 100644 sources_non_forked/ale/autoload/ale/filename_mapping.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/astyle.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/autoimport.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dhall.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/luafmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/ormolu.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim create mode 100644 sources_non_forked/ale/autoload/ale/maven.vim create mode 100644 sources_non_forked/ale/doc/ale-zig.txt create mode 100644 sources_non_forked/vim-markdown/test/insert-toc.vader delete mode 100644 sources_non_forked/vim-ruby/README create mode 100644 sources_non_forked/vim-ruby/README.markdown create mode 100644 sources_non_forked/vim-ruby/spec/indent/hanging_elements_spec.rb create mode 100644 sources_non_forked/vim-snippets/snippets/gitcommit.snippets delete mode 100644 sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets rename sources_non_forked/vim-snippets/snippets/{javascript => }/javascript-jasmine.snippets (100%) diff --git a/sources_non_forked/ale/LICENSE b/sources_non_forked/ale/LICENSE index f8f3524d..471776e4 100644 --- a/sources_non_forked/ale/LICENSE +++ b/sources_non_forked/ale/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2019, w0rp +Copyright (c) 2016-2020, w0rp All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sources_non_forked/ale/ale_linters/ada/gcc.vim b/sources_non_forked/ale/ale_linters/ada/gcc.vim index 87496b81..5afc9ae3 100644 --- a/sources_non_forked/ale/ale_linters/ada/gcc.vim +++ b/sources_non_forked/ale/ale_linters/ada/gcc.vim @@ -18,7 +18,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort " -gnatc: Check syntax and semantics only (no code generation attempted) return '%e -x ada -c -gnatc' \ . ' -o ' . ale#Escape(l:out_file) - \ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' -I %s:h' \ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options')) \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim b/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim new file mode 100644 index 00000000..8e8de7f3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim @@ -0,0 +1,5 @@ +" Author: Horacio Sanson (hsanson [ät] gmail.com) +" Description: languagetool for asciidoc files, copied from markdown. + + +call ale#handlers#languagetool#DefineLinter('asciidoc') diff --git a/sources_non_forked/ale/ale_linters/asm/gcc.vim b/sources_non_forked/ale/ale_linters/asm/gcc.vim index eecab6ef..cda38923 100644 --- a/sources_non_forked/ale/ale_linters/asm/gcc.vim +++ b/sources_non_forked/ale/ale_linters/asm/gcc.vim @@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort " -fsyntax-only doesn't catch everything. return '%e -x assembler' \ . ' -o ' . g:ale#util#nul_file - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/bib/bibclean.vim b/sources_non_forked/ale/ale_linters/bib/bibclean.vim index 9056a9c3..f1610e00 100644 --- a/sources_non_forked/ale/ale_linters/bib/bibclean.vim +++ b/sources_non_forked/ale/ale_linters/bib/bibclean.vim @@ -18,7 +18,12 @@ function! ale_linters#bib#bibclean#get_type(str) abort endfunction function! ale_linters#bib#bibclean#match_msg(line) abort - return matchlist(a:line, '^\(.*\) "stdin", line \(.*\): \(.*\)$') + " Legacy message pattern works for bibclean <= v2.11.4. If empty, try + " the new message pattern for bibtex > v2.11.4 + let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$') + + return ! empty(l:matches_legacy) ? l:matches_legacy + \ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$') endfunction function! ale_linters#bib#bibclean#match_entry(line) abort diff --git a/sources_non_forked/ale/ale_linters/c/cc.vim b/sources_non_forked/ale/ale_linters/c/cc.vim new file mode 100644 index 00000000..5655fbf7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/cc.vim @@ -0,0 +1,53 @@ +" Author: w0rp +" Description: A C compiler linter for C files with gcc/clang, etc. + +call ale#Set('c_cc_executable', '') +call ale#Set('c_cc_options', '-std=c11 -Wall') + +function! ale_linters#c#cc#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'c_cc_executable') + + " Default to either clang or gcc. + if l:executable is# '' + if ale#engine#IsExecutable(a:buffer, 'clang') + let l:executable = 'clang' + else + let l:executable = 'gcc' + endif + endif + + return l:executable +endfunction + +function! ale_linters#c#cc#GetCommand(buffer, output) abort + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:ale_flags = ale#Var(a:buffer, 'c_cc_options') + + if l:cflags =~# '-std=' + let l:ale_flags = substitute( + \ l:ale_flags, + \ '-std=\(c\|gnu\)[0-9]\{2\}', + \ '', + \ 'g') + endif + + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c' + \ . ' -o ' . g:ale#util#nul_file + \ . ' -iquote %s:h' + \ . ale#Pad(l:cflags) + \ . ale#Pad(l:ale_flags) . ' -' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'cc', +\ 'aliases': ['gcc', 'clang'], +\ 'output_stream': 'stderr', +\ 'executable': function('ale_linters#c#cc#GetExecutable'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))}, +\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/ccls.vim b/sources_non_forked/ale/ale_linters/c/ccls.vim index 9e3dafe9..9f105712 100644 --- a/sources_non_forked/ale/ale_linters/c/ccls.vim +++ b/sources_non_forked/ale/ale_linters/c/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('c_ccls_executable', 'ccls') call ale#Set('c_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('c', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('c', { \ 'executable': {b -> ale#Var(b, 'c_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'c_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/c/clang.vim b/sources_non_forked/ale/ale_linters/c/clang.vim deleted file mode 100644 index 681101fc..00000000 --- a/sources_non_forked/ale/ale_linters/c/clang.vim +++ /dev/null @@ -1,24 +0,0 @@ -" Author: Masahiro H https://github.com/mshr-h -" Description: clang linter for c files - -call ale#Set('c_clang_executable', 'clang') -call ale#Set('c_clang_options', '-std=c11 -Wall') - -function! ale_linters#c#clang#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -' -endfunction - -call ale#linter#Define('c', { -\ 'name': 'clang', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'c_clang_executable')}, -\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clang#GetCommand'))}, -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/c/cppcheck.vim b/sources_non_forked/ale/ale_linters/c/cppcheck.vim index 309b2851..b671fc8b 100644 --- a/sources_non_forked/ale/ale_linters/c/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/c/cppcheck.vim @@ -10,9 +10,11 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' + let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}''' return l:cd_command \ . '%e -q --language=c' + \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) \ . l:buffer_path_include diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim deleted file mode 100644 index 1df1018e..00000000 --- a/sources_non_forked/ale/ale_linters/c/gcc.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Author: w0rp -" Description: gcc linter for c files - -call ale#Set('c_gcc_executable', 'gcc') -call ale#Set('c_gcc_options', '-std=c11 -Wall') - -function! ale_linters#c#gcc#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - " - " `-o /dev/null` or `-o null` is needed to catch all errors, - " -fsyntax-only doesn't catch everything. - return '%e -S -x c' - \ . ' -o ' . g:ale#util#nul_file - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -' -endfunction - -call ale#linter#Define('c', { -\ 'name': 'gcc', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'c_gcc_executable')}, -\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#gcc#GetCommand'))}, -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cc.vim b/sources_non_forked/ale/ale_linters/cpp/cc.vim new file mode 100644 index 00000000..ffb8f068 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/cc.vim @@ -0,0 +1,53 @@ +" Author: w0rp +" Description: A C++ compiler linter for C++ files with gcc/clang, etc. + +call ale#Set('cpp_cc_executable', '') +call ale#Set('cpp_cc_options', '-std=c++14 -Wall') + +function! ale_linters#cpp#cc#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'cpp_cc_executable') + + " Default to either clang++ or gcc. + if l:executable is# '' + if ale#engine#IsExecutable(a:buffer, 'clang++') + let l:executable = 'clang++' + else + let l:executable = 'gcc' + endif + endif + + return l:executable +endfunction + +function! ale_linters#cpp#cc#GetCommand(buffer, output) abort + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options') + + if l:cflags =~# '-std=' + let l:ale_flags = substitute( + \ l:ale_flags, + \ '-std=\(c\|gnu\)++[0-9]\{2\}', + \ '', + \ 'g') + endif + + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c++' + \ . ' -o ' . g:ale#util#nul_file + \ . ' -iquote %s:h' + \ . ale#Pad(l:cflags) + \ . ale#Pad(l:ale_flags) . ' -' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'cc', +\ 'aliases': ['gcc', 'clang', 'g++', 'clang++'], +\ 'output_stream': 'stderr', +\ 'executable': function('ale_linters#cpp#cc#GetExecutable'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))}, +\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/ccls.vim b/sources_non_forked/ale/ale_linters/cpp/ccls.vim index b265ff70..38f8df9c 100644 --- a/sources_non_forked/ale/ale_linters/cpp/ccls.vim +++ b/sources_non_forked/ale/ale_linters/cpp/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('cpp_ccls_executable', 'ccls') call ale#Set('cpp_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('cpp', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('cpp', { \ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'cpp_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clang.vim b/sources_non_forked/ale/ale_linters/cpp/clang.vim deleted file mode 100644 index e48291eb..00000000 --- a/sources_non_forked/ale/ale_linters/cpp/clang.vim +++ /dev/null @@ -1,24 +0,0 @@ -" Author: Tomota Nakamura -" Description: clang linter for cpp files - -call ale#Set('cpp_clang_executable', 'clang++') -call ale#Set('cpp_clang_options', '-std=c++14 -Wall') - -function! ale_linters#cpp#clang#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c++ -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -' -endfunction - -call ale#linter#Define('cpp', { -\ 'name': 'clang', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')}, -\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clang#GetCommand'))}, -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim index 191b7b07..5e062d86 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim @@ -25,6 +25,11 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags endif + " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file. + if expand('#' . a:buffer) =~# '\.h$' + let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' + endif + " Get the options to pass directly to clang-tidy let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options') diff --git a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim index 7cd80dbc..2c832246 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim @@ -10,9 +10,11 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' + let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}''' return l:cd_command \ . '%e -q --language=c++' + \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) \ . l:buffer_path_include diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim deleted file mode 100644 index 108d6d70..00000000 --- a/sources_non_forked/ale/ale_linters/cpp/gcc.vim +++ /dev/null @@ -1,29 +0,0 @@ -" Author: geam -" Description: gcc linter for cpp files -" -call ale#Set('cpp_gcc_executable', 'gcc') -call ale#Set('cpp_gcc_options', '-std=c++14 -Wall') - -function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - " - " `-o /dev/null` or `-o null` is needed to catch all errors, - " -fsyntax-only doesn't catch everything. - return '%e -S -x c++' - \ . ' -o ' . g:ale#util#nul_file - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -' -endfunction - -call ale#linter#Define('cpp', { -\ 'name': 'gcc', -\ 'aliases': ['g++'], -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')}, -\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#gcc#GetCommand'))}, -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim index f3af07b6..2734f6ec 100644 --- a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim +++ b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim @@ -5,9 +5,6 @@ call ale#Set('cuda_nvcc_executable', 'nvcc') call ale#Set('cuda_nvcc_options', '-std=c++11') function! ale_linters#cuda#nvcc#GetCommand(buffer) abort - " Unused: use ale#util#nul_file - " let l:output_file = ale#util#Tempname() . '.ii' - " call ale#command#ManageFile(a:buffer, l:output_file) return '%e -cuda' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) diff --git a/sources_non_forked/ale/ale_linters/elixir/credo.vim b/sources_non_forked/ale/ale_linters/elixir/credo.vim index 317ecab3..7c298502 100644 --- a/sources_non_forked/ale/ale_linters/elixir/credo.vim +++ b/sources_non_forked/ale/ale_linters/elixir/credo.vim @@ -46,7 +46,7 @@ function! ale_linters#elixir#credo#GetMode() abort endfunction function! ale_linters#elixir#credo#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) + let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer) let l:mode = ale_linters#elixir#credo#GetMode() return ale#path#CdString(l:project_root) diff --git a/sources_non_forked/ale/ale_linters/erlang/elvis.vim b/sources_non_forked/ale/ale_linters/erlang/elvis.vim new file mode 100644 index 00000000..31dea3dd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/elvis.vim @@ -0,0 +1,39 @@ +" Author: Dmitri Vereshchagin +" Description: Elvis linter for Erlang files + +call ale#Set('erlang_elvis_executable', 'elvis') + +function! ale_linters#erlang#elvis#Handle(buffer, lines) abort + let l:pattern = '\v:(\d+):[^:]+:(.+)' + let l:loclist = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:loclist, { + \ 'lnum': str2nr(l:match[1]), + \ 'text': s:AbbreviateMessage(l:match[2]), + \ 'type': 'W', + \}) + endfor + + return l:loclist +endfunction + +function! s:AbbreviateMessage(text) abort + let l:pattern = '\v\c^(line \d+ is too long):.*$' + + return substitute(a:text, l:pattern, '\1.', '') +endfunction + +function! s:GetCommand(buffer) abort + let l:file = ale#Escape(expand('#' . a:buffer . ':.')) + + return '%e rock --output-format=parsable ' . l:file +endfunction + +call ale#linter#Define('erlang', { +\ 'name': 'elvis', +\ 'callback': 'ale_linters#erlang#elvis#Handle', +\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')}, +\ 'command': function('s:GetCommand'), +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/eruby/ruumba.vim b/sources_non_forked/ale/ale_linters/eruby/ruumba.vim index 2e84acf7..f415f1ab 100644 --- a/sources_non_forked/ale/ale_linters/eruby/ruumba.vim +++ b/sources_non_forked/ale/ale_linters/eruby/ruumba.vim @@ -11,7 +11,7 @@ function! ale_linters#eruby#ruumba#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'ruumba') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'eruby_ruumba_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/go/gofmt.vim b/sources_non_forked/ale/ale_linters/go/gofmt.vim index a233b422..b313f9ca 100644 --- a/sources_non_forked/ale/ale_linters/go/gofmt.vim +++ b/sources_non_forked/ale/ale_linters/go/gofmt.vim @@ -6,7 +6,6 @@ function! ale_linters#go#gofmt#GetCommand(buffer) abort \ . '%e -e %t' endfunction - call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim index 74bd6a99..bd4d1d31 100644 --- a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -4,6 +4,28 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) +function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ + \ 'node_modules/.bin/ember-template-lint', + \]) +endfunction + +function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort + " Reading from stdin was introduced in ember-template-lint@1.6.0 + return ale#semver#GTE(a:version, [1, 6, 0]) + \ ? '%e --json --filename %s' + \ : '%e --json %t' +endfunction + +function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale_linters#handlebars#embertemplatelint#GetCommand'), + \) +endfunction + function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) @@ -30,10 +52,9 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort endfunction call ale#linter#Define('handlebars', { -\ 'name': 'ember-template-lint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'handlebars_embertemplatelint', [ -\ 'node_modules/.bin/ember-template-lint', -\ ])}, -\ 'command': '%e --json %t', +\ 'name': 'embertemplatelint', +\ 'aliases': ['ember-template-lint'], +\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'), +\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'), \ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index 7901ff7e..ec7339d1 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -52,7 +52,7 @@ endfunction function! ale_linters#java#checkstyle#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'java_checkstyle_options') let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config') - let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option) + let l:config = l:options !~# '\v(^| )-c ' && !empty(l:config_option) \ ? s:GetConfig(a:buffer, l:config_option) \ : '' diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim index 2bfec043..8bc09039 100644 --- a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -20,25 +20,39 @@ endfunction function! ale_linters#java#eclipselsp#JarPath(buffer) abort let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) - " Search jar file within repository path when manually built using mvn - let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository' - let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + if has('win32') + let l:platform = 'win32' + elseif has('macunix') + let l:platform = 'macosx' + else + let l:platform = 'linux' + endif - if len(l:files) == 1 + " Search jar file within repository path when manually built using mvn + let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) >= 1 return l:files[0] endif " Search jar file within VSCode extensions folder. - let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) - if len(l:files) == 1 + if len(l:files) >= 1 + return l:files[0] + endif + + " Search jar file within unzipped tar.gz file + let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + + if len(l:files) >= 1 return l:files[0] endif " Search jar file within system package path let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) - if len(l:files) == 1 + if len(l:files) >= 1 return l:files[0] endif @@ -166,7 +180,8 @@ function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort return ale#command#Run( \ a:buffer, \ l:command, - \ function('ale_linters#java#eclipselsp#CommandWithVersion') + \ function('ale_linters#java#eclipselsp#CommandWithVersion'), + \ { 'output_stream': 'both' } \) endfunction diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index f866eb09..a5e57e6c 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -9,13 +9,7 @@ call ale#Set('java_javac_classpath', '') call ale#Set('java_javac_sourcepath', '') function! ale_linters#java#javac#RunWithImportPaths(buffer) abort - let l:command = '' - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') - - if !empty(l:pom_path) && executable('mvn') - let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' - endif + let l:command = ale#maven#BuildClasspathCommand(a:buffer) " Try to use Gradle if Maven isn't available. if empty(l:command) diff --git a/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim index f0384005..0bb64b19 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim @@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', { \ 'executable': 'ktlint', \ 'command': function('ale#handlers#ktlint#GetCommand'), \ 'callback': 'ale#handlers#ktlint#Handle', -\ 'lint_file': 1 +\ 'output_stream': 'stderr' \}) diff --git a/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim index e935cbfe..7a293938 100644 --- a/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim +++ b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim @@ -1,11 +1,22 @@ " Author: Ty-Lucas Kelley " Description: Adds support for markdownlint +call ale#Set('markdown_markdownlint_options', '') + +function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort + let l:executable = 'markdownlint' + + let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s' +endfunction + call ale#linter#Define('markdown', { \ 'name': 'markdownlint', \ 'executable': 'markdownlint', \ 'lint_file': 1, \ 'output_stream': 'both', -\ 'command': 'markdownlint %s', +\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'), \ 'callback': 'ale#handlers#markdownlint#Handle' \}) diff --git a/sources_non_forked/ale/ale_linters/nasm/nasm.vim b/sources_non_forked/ale/ale_linters/nasm/nasm.vim index 347abc1b..c4f53629 100644 --- a/sources_non_forked/ale/ale_linters/nasm/nasm.vim +++ b/sources_non_forked/ale/ale_linters/nasm/nasm.vim @@ -7,10 +7,9 @@ call ale#Set('nasm_nasm_options', '') function! ale_linters#nasm#nasm#GetCommand(buffer) abort " Note that NASM requires a trailing slash for the -I option. let l:separator = has('win32') ? '\' : '/' - let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator let l:output_null = has('win32') ? 'NUL' : '/dev/null' - return '%e -X gnu -I ' . ale#Escape(l:path) + return '%e -X gnu -I %s:h' . l:separator \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ' %s' \ . ' -o ' . l:output_null diff --git a/sources_non_forked/ale/ale_linters/objc/ccls.vim b/sources_non_forked/ale/ale_linters/objc/ccls.vim index 51ecf056..7aef5325 100644 --- a/sources_non_forked/ale/ale_linters/objc/ccls.vim +++ b/sources_non_forked/ale/ale_linters/objc/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('objc_ccls_executable', 'ccls') call ale#Set('objc_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('objc', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('objc', { \ 'executable': {b -> ale#Var(b, 'objc_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'objc_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'objc_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/objc/clang.vim b/sources_non_forked/ale/ale_linters/objc/clang.vim index 7873dccd..cafb97db 100644 --- a/sources_non_forked/ale/ale_linters/objc/clang.vim +++ b/sources_non_forked/ale/ale_linters/objc/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objc#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang -S -x objective-c -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/objcpp/clang.vim b/sources_non_forked/ale/ale_linters/objcpp/clang.vim index 4dbe55b3..35a40c6f 100644 --- a/sources_non_forked/ale/ale_linters/objcpp/clang.vim +++ b/sources_non_forked/ale/ale_linters/objcpp/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objcpp#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang++ -S -x objective-c++ -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/ocaml/ols.vim b/sources_non_forked/ale/ale_linters/ocaml/ols.vim index d8208c52..ec71bdb4 100644 --- a/sources_non_forked/ale/ale_linters/ocaml/ols.vim +++ b/sources_non_forked/ale/ale_linters/ocaml/ols.vim @@ -9,6 +9,6 @@ call ale#linter#Define('ocaml', { \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), -\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/php/intelephense.vim b/sources_non_forked/ale/ale_linters/php/intelephense.vim new file mode 100644 index 00000000..e9e07d1f --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/intelephense.vim @@ -0,0 +1,32 @@ +" Author: Eric Stern , +" Arnold Chand +" Description: Intelephense language server integration for ALE + +call ale#Set('php_intelephense_executable', 'intelephense') +call ale#Set('php_intelephense_use_global', 1) +call ale#Set('php_intelephense_config', {}) + +function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if (!empty(l:composer_path)) + return fnamemodify(l:composer_path, ':h') + endif + + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +function! ale_linters#php#intelephense#GetInitializationOptions() abort + return ale#Get('php_intelephense_config') +endfunction + +call ale#linter#Define('php', { +\ 'name': 'intelephense', +\ 'lsp': 'stdio', +\ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), +\ 'executable': {b -> ale#node#FindExecutable(b, 'php_intelephense', [])}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/php/phpcs.vim b/sources_non_forked/ale/ale_linters/php/phpcs.vim index 11b81e84..c5a3faa9 100644 --- a/sources_non_forked/ale/ale_linters/php/phpcs.vim +++ b/sources_non_forked/ale/ale_linters/php/phpcs.vim @@ -23,7 +23,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort " Matches against lines like the following: " " /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) - let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$' + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\)).*$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) diff --git a/sources_non_forked/ale/ale_linters/php/psalm.vim b/sources_non_forked/ale/ale_linters/php/psalm.vim index ab4dbbc9..286c8a96 100644 --- a/sources_non_forked/ale/ale_linters/php/psalm.vim +++ b/sources_non_forked/ale/ale_linters/php/psalm.vim @@ -1,9 +1,9 @@ " Author: Matt Brown " Description: plugin for Psalm, static analyzer for PHP -call ale#Set('psalm_langserver_executable', 'psalm') -call ale#Set('psalm_langserver_options', '') -call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('php_psalm_executable', 'psalm') +call ale#Set('php_psalm_options', '') +call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#psalm#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') @@ -12,13 +12,13 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort endfunction function! ale_linters#php#psalm#GetCommand(buffer) abort - return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'psalm_langserver_options')) + return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'php_psalm_options')) endfunction call ale#linter#Define('php', { \ 'name': 'psalm', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [ +\ 'executable': {b -> ale#node#FindExecutable(b, 'php_psalm', [ \ 'vendor/bin/psalm', \ ])}, \ 'command': function('ale_linters#php#psalm#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/php/tlint.vim b/sources_non_forked/ale/ale_linters/php/tlint.vim new file mode 100644 index 00000000..6bba8def --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/tlint.vim @@ -0,0 +1,80 @@ +" Author: Jose Soto +" +" Description: Tighten Opinionated PHP Linting +" Website: https://github.com/tightenco/tlint + +call ale#Set('php_tlint_executable', 'tlint') +call ale#Set('php_tlint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('php_tlint_options', '') + +function! ale_linters#php#tlint#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if !empty(l:composer_path) + return fnamemodify(l:composer_path, ':h') + endif + + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +function! ale_linters#php#tlint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'php_tlint', [ + \ 'vendor/bin/tlint', + \ 'tlint', + \]) +endfunction + +function! ale_linters#php#tlint#GetCommand(buffer) abort + let l:executable = ale_linters#php#tlint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'php_tlint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' lint %s' +endfunction + +function! ale_linters#php#tlint#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " ! There should be 1 space around `.` concatenations, and additional lines should always start with a `.` + " 22 : ` $something = 'a'.'name';` + " + let l:loop_count = 0 + let l:messages_pattern = '^\! \(.*\)' + let l:output = [] + let l:pattern = '^\(\d\+\) \:' + let l:temp_messages = [] + + for l:message in ale#util#GetMatches(a:lines, l:messages_pattern) + call add(l:temp_messages, l:message) + endfor + + let l:loop_count = 0 + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:num = l:match[1] + let l:text = l:temp_messages[l:loop_count] + + call add(l:output, { + \ 'lnum': l:num, + \ 'col': 0, + \ 'text': l:text, + \ 'type': 'W', + \ 'sub_type': 'style', + \}) + + let l:loop_count += 1 + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'tlint', +\ 'executable': function('ale_linters#php#tlint#GetExecutable'), +\ 'command': function('ale_linters#php#tlint#GetCommand'), +\ 'callback': 'ale_linters#php#tlint#Handle', +\ 'project_root': function('ale_linters#php#tlint#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/puppet/puppet.vim b/sources_non_forked/ale/ale_linters/puppet/puppet.vim index ae648615..59228dc8 100644 --- a/sources_non_forked/ale/ale_linters/puppet/puppet.vim +++ b/sources_non_forked/ale/ale_linters/puppet/puppet.vim @@ -8,13 +8,15 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" " Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5) - let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)' + " Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11) + " Error: Could not parse for environment production: Syntax error at end of input (file: /tmp/modules/bob/manifests/init.pp) + let l:pattern = '^Error:\%(.*:\)\? \(.\+\) \((file:\|at\) .\+\.pp\(\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)\|)$\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'lnum': l:match[4] + 0, - \ 'col': l:match[6] + 0, + \ 'lnum': l:match[5] + 0, + \ 'col': l:match[7] + 0, \ 'text': l:match[1], \}) endfor diff --git a/sources_non_forked/ale/ale_linters/pyrex/cython.vim b/sources_non_forked/ale/ale_linters/pyrex/cython.vim index 84382ba1..247c3060 100644 --- a/sources_non_forked/ale/ale_linters/pyrex/cython.vim +++ b/sources_non_forked/ale/ale_linters/pyrex/cython.vim @@ -6,9 +6,7 @@ call ale#Set('pyrex_cython_executable', 'cython') call ale#Set('pyrex_cython_options', '--warning-extra') function! ale_linters#pyrex#cython#GetCommand(buffer) abort - let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - - return '%e --working ' . l:local_dir . ' --include-dir ' . l:local_dir + return '%e --working %s:h --include-dir %s:h' \ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options')) \ . ' --output-file ' . g:ale#util#nul_file . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index e2e7b743..fc4ab692 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -4,7 +4,7 @@ call ale#Set('python_flake8_executable', 'flake8') call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('python_flake8_change_directory', 1) +call ale#Set('python_flake8_change_directory', 'project') call ale#Set('python_flake8_auto_pipenv', 0) function! s:UsingModule(buffer) abort @@ -38,10 +38,30 @@ function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort \) endfunction +function! ale_linters#python#flake8#GetCdString(buffer) abort + let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory') + let l:cd_string = '' + + if l:change_directory is# 'project' + let l:project_root = ale#python#FindProjectRootIni(a:buffer) + + if !empty(l:project_root) + let l:cd_string = ale#path#CdString(l:project_root) + endif + endif + + if (l:change_directory is# 'project' && empty(l:cd_string)) + \|| l:change_directory is# 1 + \|| l:change_directory is# 'file' + let l:cd_string = ale#path#BufferCdString(a:buffer) + endif + + return l:cd_string +endfunction + function! ale_linters#python#flake8#GetCommand(buffer, version) abort - let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' + let l:cd_string = ale_linters#python#flake8#GetCdString(a:buffer) + let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv$' diff --git a/sources_non_forked/ale/ale_linters/python/jedils.vim b/sources_non_forked/ale/ale_linters/python/jedils.vim new file mode 100644 index 00000000..eae5fb07 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/jedils.vim @@ -0,0 +1,34 @@ +" Author: Dalius Dobravolskas +" Description: https://github.com/pappasam/jedi-language-server + +call ale#Set('python_jedils_executable', 'jedi-language-server') +call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_jedils_auto_pipenv', 0) + +function! ale_linters#python#jedils#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server']) +endfunction + +function! ale_linters#python#jedils#GetCommand(buffer) abort + let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer) + + let l:exec_args = l:executable =~? 'pipenv$' + \ ? ' run jedi-language-server' + \ : '' + + return ale#Escape(l:executable) . l:exec_args +endfunction + +call ale#linter#Define('python', { +\ 'name': 'jedils', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#python#jedils#GetExecutable'), +\ 'command': function('ale_linters#python#jedils#GetCommand'), +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim index 3901db4d..69ae3807 100644 --- a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim @@ -16,17 +16,15 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort endfunction function! ale_linters#python#pydocstyle#GetCommand(buffer) abort - let l:dir = fnamemodify(bufname(a:buffer), ':p:h') let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run pydocstyle' \ : '' - return ale#path#CdString(l:dir) + return ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) . l:exec_args - \ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options') - \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t')) + \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) + \ . ' %s:t' endfunction function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index b16d5355..44eea246 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -17,7 +17,7 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction -function! ale_linters#python#pylint#GetCommand(buffer) abort +function! ale_linters#python#pylint#GetCommand(buffer, version) abort let l:cd_string = '' if ale#Var(a:buffer, 'python_pylint_change_directory') @@ -38,17 +38,23 @@ function! ale_linters#python#pylint#GetCommand(buffer) abort return l:cd_string \ . ale#Escape(l:executable) . l:exec_args - \ . ' ' . ale#Var(a:buffer, 'python_pylint_options') + \ . ale#Pad(ale#Var(a:buffer, 'python_pylint_options')) \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' + \ . (ale#semver#GTE(a:version, [2, 4, 0]) ? ' --from-stdin' : '') \ . ' %s' endfunction function! ale_linters#python#pylint#Handle(buffer, lines) abort + let l:output = ale#python#HandleTraceback(a:lines, 10) + + if !empty(l:output) + return l:output + endif + " Matches patterns like the following: " " test.py:4:4: W0101 (unreachable) Unreachable code let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$' - let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) "let l:failed = append(0, l:match) @@ -71,13 +77,19 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort let l:code_out = l:match[4] endif - call add(l:output, { + let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 1, \ 'text': l:match[5], \ 'code': l:code_out, - \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', - \}) + \ 'type': 'W', + \} + + if l:code[:0] is# 'E' + let l:item.type = 'E' + endif + + call add(l:output, l:item) endfor return l:output @@ -86,7 +98,17 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pylint', \ 'executable': function('ale_linters#python#pylint#GetExecutable'), -\ 'command': function('ale_linters#python#pylint#GetCommand'), +\ 'lint_file': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'python_pylint_executable'), +\ '%e --version', +\ {buffer, version -> !ale#semver#GTE(version, [2, 4, 0])}, +\ )}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'python_pylint_executable'), +\ '%e --version', +\ function('ale_linters#python#pylint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#python#pylint#Handle', -\ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/python/pyright.vim b/sources_non_forked/ale/ale_linters/python/pyright.vim new file mode 100644 index 00000000..422ecd61 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pyright.vim @@ -0,0 +1,43 @@ +call ale#Set('python_pyright_executable', 'pyright-langserver') +call ale#Set('python_pyright_config', {}) + +function! ale_linters#python#pyright#GetConfig(buffer) abort + let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config')) + + if !has_key(l:config, 'python') + let l:config.python = {} + endif + + if type(l:config.python) is v:t_dict + " Automatically detect the virtualenv path and use it. + if !has_key(l:config.python, 'venvPath') + let l:venv = ale#python#FindVirtualenv(a:buffer) + + if !empty(l:venv) + let l:config.python.venvPath = l:venv + endif + endif + + " Automatically use the version of Python in virtualenv. + if type(get(l:config.python, 'venvPath')) is v:t_string + \&& !empty(l:config.python.venvPath) + \&& !has_key(l:config.python, 'pythonPath') + let l:config.python.pythonPath = ale#path#Simplify( + \ l:config.python.venvPath + \ . (has('win32') ? '/Scripts/python' : '/bin/python') + \) + endif + endif + + return l:config +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pyright', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\ 'lsp_config': function('ale_linters#python#pyright#GetConfig'), +\}) diff --git a/sources_non_forked/ale/ale_linters/r/languageserver.vim b/sources_non_forked/ale/ale_linters/r/languageserver.vim new file mode 100644 index 00000000..febe66bd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/r/languageserver.vim @@ -0,0 +1,26 @@ +" Author: Eric Zhao <21zhaoe@protonmail.com> +" Description: Implementation of the Language Server Protocol for R. + +call ale#Set('r_languageserver_cmd', 'languageserver::run()') +call ale#Set('r_languageserver_config', {}) + +function! ale_linters#r#languageserver#GetCommand(buffer) abort + let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') + + return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) +endfunction + +function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, '.Rprofile') + + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h') +endfunction + +call ale#linter#Define('r', { +\ 'name': 'languageserver', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')}, +\ 'executable': 'Rscript', +\ 'command': function('ale_linters#r#languageserver#GetCommand'), +\ 'project_root': function('ale_linters#r#languageserver#GetProjectRoot') +\}) diff --git a/sources_non_forked/ale/ale_linters/reason/ols.vim b/sources_non_forked/ale/ale_linters/reason/ols.vim index 66137e1b..9fbd9b4f 100644 --- a/sources_non_forked/ale/ale_linters/reason/ols.vim +++ b/sources_non_forked/ale/ale_linters/reason/ols.vim @@ -9,6 +9,6 @@ call ale#linter#Define('reason', { \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), -\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim index 410ed0ea..483806a6 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim @@ -10,7 +10,7 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#ruby#rubocop#GetType(severity) abort diff --git a/sources_non_forked/ale/ale_linters/ruby/standardrb.vim b/sources_non_forked/ale/ale_linters/ruby/standardrb.vim index f751e803..6ccfd2d6 100644 --- a/sources_non_forked/ale/ale_linters/ruby/standardrb.vim +++ b/sources_non_forked/ale/ale_linters/ruby/standardrb.vim @@ -11,7 +11,7 @@ function! ale_linters#ruby#standardrb#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_standardrb_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction " standardrb is based on RuboCop so the callback is the same diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index 99178585..3407abed 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -11,6 +11,7 @@ call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') call ale#Set('rust_cargo_use_clippy', 0) call ale#Set('rust_cargo_clippy_options', '') +call ale#Set('rust_cargo_target_dir', '') function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' @@ -31,6 +32,9 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests') \ && ale#semver#GTE(a:version, [0, 22, 0]) + let l:target_dir = ale#Var(a:buffer, 'rust_cargo_target_dir') + let l:use_target_dir = !empty(l:target_dir) + \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -82,6 +86,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') \ . (l:use_tests ? ' --tests' : '') + \ . (l:use_target_dir ? (' --target-dir ' . ale#Escape(l:target_dir)) : '') \ . ' --frozen --message-format=json -q' \ . l:default_feature \ . l:include_features diff --git a/sources_non_forked/ale/ale_linters/sh/bashate.vim b/sources_non_forked/ale/ale_linters/sh/bashate.vim new file mode 100644 index 00000000..3cd84245 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sh/bashate.vim @@ -0,0 +1,43 @@ +" Author: hsanson +" Description: Lints sh files using bashate +" URL: https://github.com/openstack/bashate + +call ale#Set('sh_bashate_executable', 'bashate') +call ale#Set('sh_bashate_options', '') + +function! ale_linters#sh#bashate#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'sh_bashate_executable') +endfunction + +function! ale_linters#sh#bashate#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'sh_bashate_options') + let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t' +endfunction + +function! ale_linters#sh#bashate#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " /path/to/script/file:694:1: E003 Indent not multiple of 4 + let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sh', { +\ 'name': 'bashate', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#sh#bashate#GetExecutable'), +\ 'command': function('ale_linters#sh#bashate#GetCommand'), +\ 'callback': 'ale_linters#sh#bashate#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/sh/shell.vim b/sources_non_forked/ale/ale_linters/sh/shell.vim index 171fe64e..73ab3608 100644 --- a/sources_non_forked/ale/ale_linters/sh/shell.vim +++ b/sources_non_forked/ale/ale_linters/sh/shell.vim @@ -1,5 +1,5 @@ " Author: w0rp -" Description: Lints sh files using bash -n +" Description: Lints shell files by invoking the shell with -n " Backwards compatibility if exists('g:ale_linters_sh_shell_default_shell') diff --git a/sources_non_forked/ale/ale_linters/sql/sqllint.vim b/sources_non_forked/ale/ale_linters/sql/sqllint.vim new file mode 100644 index 00000000..78396fe9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sql/sqllint.vim @@ -0,0 +1,33 @@ +" ale_linters/sql/sqllint.vim +" Author: Joe Reynolds +" Description: sql-lint for SQL files. +" sql-lint can be found at +" https://www.npmjs.com/package/sql-lint +" https://github.com/joereynolds/sql-lint + +function! ale_linters#sql#sqllint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " stdin:1 [ER_NO_DB_ERROR] No database selected + let l:pattern = '\v^[^:]+:(\d+) (.*)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3][0], + \ 'text': l:match[0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sql', { +\ 'name': 'sqllint', +\ 'aliases': ['sql-lint'], +\ 'executable': 'sql-lint', +\ 'command': 'sql-lint', +\ 'callback': 'ale_linters#sql#sqllint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/swiftformat.vim b/sources_non_forked/ale/ale_linters/swift/swiftformat.vim new file mode 100644 index 00000000..2504511a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/swiftformat.vim @@ -0,0 +1,62 @@ +" Author: Klaas Pieter Annema +" Description: Support for swift-format https://github.com/apple/swift-format + +let s:default_executable = 'swift-format' +call ale#Set('swift_swiftformat_executable', s:default_executable) + +function! ale_linters#swift#swiftformat#UseSwift(buffer) abort + let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') + let l:executable = ale#Var(a:buffer, 'swift_swiftformat_executable') + + return !empty(l:swift_config) && l:executable is# s:default_executable +endfunction + +function! ale_linters#swift#swiftformat#GetExecutable(buffer) abort + if ale_linters#swift#swiftformat#UseSwift(a:buffer) + return 'swift' + endif + + return ale#Var(a:buffer, 'swift_swiftformat_executable') +endfunction + +function! ale_linters#swift#swiftformat#GetCommand(buffer) abort + let l:executable = ale_linters#swift#swiftformat#GetExecutable(a:buffer) + let l:args = '--mode lint %t' + + if ale_linters#swift#swiftformat#UseSwift(a:buffer) + let l:args = 'run swift-format' . ' ' . l:args + endif + + return ale#Escape(l:executable) . ' ' . l:args +endfunction + +function! ale_linters#swift#swiftformat#Handle(buffer, lines) abort + " Matches lines of the following pattern: + " + " Sources/main.swift:4:21: warning: [DoNotUseSemicolons]: remove ';' and move the next statement to the new line + " Sources/main.swift:3:12: warning: [Spacing]: remove 1 space + let l:pattern = '\v^.*:(\d+):(\d+): (\S+) \[(\S+)\]: (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'code': l:match[4], + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + + +call ale#linter#Define('swift', { +\ 'name': 'swift-format', +\ 'executable': function('ale_linters#swift#swiftformat#GetExecutable'), +\ 'command': function('ale_linters#swift#swiftformat#GetCommand'), +\ 'output_stream': 'stderr', +\ 'language': 'swift', +\ 'callback': 'ale_linters#swift#swiftformat#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim index 840889f3..4726e40d 100644 --- a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim +++ b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim @@ -9,6 +9,7 @@ call ale#linter#Define('typescript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', \ 'executable': {b -> ale#node#FindExecutable(b, 'typescript_tsserver', [ +\ '.yarn/sdks/typescript/bin/tsserver', \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim b/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim new file mode 100644 index 00000000..b05d8565 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim @@ -0,0 +1,5 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#handlers#hdl_checker#DefineLinter('verilog') diff --git a/sources_non_forked/ale/ale_linters/verilog/vlog.vim b/sources_non_forked/ale/ale_linters/verilog/vlog.vim index 951e2037..45e1977c 100644 --- a/sources_non_forked/ale/ale_linters/verilog/vlog.vim +++ b/sources_non_forked/ale/ale_linters/verilog/vlog.vim @@ -13,14 +13,15 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort "Matches patterns like the following: "** Warning: add.v(7): (vlog-2623) Undefined variable: C. "** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C. - let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' + let l:pattern = '^**\s\(\w*\): \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'lnum': l:match[2] + 0, + \ 'lnum': l:match[3] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', - \ 'text': l:match[3], + \ 'text': l:match[4], + \ 'filename': l:match[2], \}) endfor @@ -28,13 +29,14 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort "** Warning: (vlog-2623) add.v(7): Undefined variable: C. "** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C. " let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' - let l:pattern = '^**\s\(\w*\):\s\([^)]*)\)[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' + let l:pattern = '^**\s\(\w*\):\s\([^)]*)\) \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'lnum': l:match[3] + 0, + \ 'lnum': l:match[4] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', - \ 'text': l:match[2] . ' ' . l:match[4], + \ 'text': l:match[2] . ' ' . l:match[5], + \ 'filename': l:match[3], \}) endfor diff --git a/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim b/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim new file mode 100644 index 00000000..c9d306b3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim @@ -0,0 +1,5 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#handlers#hdl_checker#DefineLinter('vhdl') diff --git a/sources_non_forked/ale/ale_linters/vim/vint.vim b/sources_non_forked/ale/ale_linters/vim/vint.vim index 65e19126..f7054ffb 100644 --- a/sources_non_forked/ale/ale_linters/vim/vint.vim +++ b/sources_non_forked/ale/ale_linters/vim/vint.vim @@ -5,7 +5,7 @@ call ale#Set('vim_vint_show_style_issues', 1) call ale#Set('vim_vint_executable', 'vint') let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' -let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' +let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"' function! ale_linters#vim#vint#GetCommand(buffer, version) abort let l:can_use_no_color_flag = empty(a:version) @@ -13,12 +13,17 @@ function! ale_linters#vim#vint#GetCommand(buffer, version) abort let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' + " Use the --stdin-display-name argument if supported, temp file otherwise. + let l:stdin_or_temp = ale#semver#GTE(a:version, [0, 4, 0]) + \ ? ' --stdin-display-name %s -' + \ : ' %t' + return '%e' \ . ' ' . l:warning_flag \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim \ . ' ' . s:format - \ . ' %t' + \ . l:stdin_or_temp endfunction let s:word_regex_list = [ diff --git a/sources_non_forked/ale/ale_linters/zig/zls.vim b/sources_non_forked/ale/ale_linters/zig/zls.vim new file mode 100644 index 00000000..1390f6b1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/zig/zls.vim @@ -0,0 +1,20 @@ +" Author: CherryMan +" Description: A language server for Zig + +call ale#Set('zig_zls_executable', 'zls') +call ale#Set('zig_zls_config', {}) + +function! ale_linters#zig#zls#GetProjectRoot(buffer) abort + let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig') + + return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : '' +endfunction + +call ale#linter#Define('zig', { +\ 'name': 'zls', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')}, +\ 'executable': {b -> ale#Var(b, 'zig_zls_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 6251b47b..3f59a6a4 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -100,13 +100,7 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Use the filetype from the buffer let l:filetype = getbufvar(a:buffer, '&filetype') let l:linters = ale#linter#Get(l:filetype) - - " Apply ignore lists for linters only if needed. - let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') - let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') - let l:linters = !empty(l:ignore_config) || l:disable_lsp - \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp) - \ : l:linters + let l:linters = ale#linter#RemoveIgnored(a:buffer, l:filetype, l:linters) " Tell other sources that they can start checking the buffer now. let g:ale_want_results_buffer = a:buffer @@ -163,7 +157,7 @@ function! ale#Queue(delay, ...) abort endif endfunction -let s:current_ale_version = [2, 7, 0] +let s:current_ale_version = [3, 0, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort @@ -263,6 +257,28 @@ function! ale#GetLocItemMessage(item, format_string) abort let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g') " Replace %s with the text. let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g') + " Windows may insert carriage return line endings (^M), strip these characters. + let l:msg = substitute(l:msg, '\r', '', 'g') return l:msg endfunction + +" Given a buffer and a linter or fixer name, return an Array of two-item +" Arrays describing how to map filenames to and from the local to foreign file +" systems. +function! ale#GetFilenameMappings(buffer, name) abort + let l:linter_mappings = ale#Var(a:buffer, 'filename_mappings') + + if type(l:linter_mappings) is v:t_list + return l:linter_mappings + endif + + let l:name = a:name + + if !has_key(l:linter_mappings, l:name) + " Use * as a default setting for all tools. + let l:name = '*' + endif + + return get(l:linter_mappings, l:name, []) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 291edcee..934fcaa8 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -130,7 +130,7 @@ endfunction function! ale#assert#LSPLanguage(expected_language) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() - let l:language = ale#util#GetFunction(l:linter.language_callback)(l:buffer) + let l:language = ale#linter#GetLanguage(l:buffer, l:linter) AssertEqual a:expected_language, l:language endfunction diff --git a/sources_non_forked/ale/autoload/ale/balloon.vim b/sources_non_forked/ale/autoload/ale/balloon.vim index 72f6b91c..8678376f 100644 --- a/sources_non_forked/ale/autoload/ale/balloon.vim +++ b/sources_non_forked/ale/autoload/ale/balloon.vim @@ -2,23 +2,39 @@ " Description: balloonexpr support for ALE. function! ale#balloon#MessageForPos(bufnr, lnum, col) abort + let l:set_balloons = ale#Var(a:bufnr, 'set_balloons') + let l:show_problems = 0 + let l:show_hover = 0 + + if l:set_balloons is 1 + let l:show_problems = 1 + let l:show_hover = 1 + elseif l:set_balloons is# 'hover' + let l:show_hover = 1 + endif + " Don't show balloons if they are disabled, or linting is disabled. - if !ale#Var(a:bufnr, 'set_balloons') + if !(l:show_problems || l:show_hover) \|| !g:ale_enabled \|| !getbufvar(a:bufnr, 'ale_enabled', 1) return '' endif - let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist - let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) + if l:show_problems + let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist + let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) + endif " Show the diagnostics message if found, 'Hover' output otherwise - if l:index >= 0 + if l:show_problems && l:index >= 0 return l:loclist[l:index].text - elseif exists('*balloon_show') || getbufvar( - \ a:bufnr, - \ 'ale_set_balloons_legacy_echo', - \ get(g:, 'ale_set_balloons_legacy_echo', 0) + elseif l:show_hover && ( + \ exists('*balloon_show') + \ || getbufvar( + \ a:bufnr, + \ 'ale_set_balloons_legacy_echo', + \ get(g:, 'ale_set_balloons_legacy_echo', 0) + \ ) \) " Request LSP/tsserver hover information, but only if this version of " Vim supports the balloon_show function, or if we turned a legacy diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index 9b428700..cff53125 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -2,20 +2,28 @@ " Description: Functions for integrating with C-family linters. call ale#Set('c_parse_makefile', 0) -call ale#Set('c_parse_compile_commands', 0) +call ale#Set('c_always_make', has('unix') && !has('macunix')) +call ale#Set('c_parse_compile_commands', 1) + let s:sep = has('win32') ? '\' : '/' " Set just so tests can override it. let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt'] -function! ale#c#GetBuildDirectory(buffer) abort - " Don't include build directory for header files, as compile_commands.json - " files don't consider headers to be translation units, and provide no - " commands for compiling header files. - if expand('#' . a:buffer) =~# '\v\.(h|hpp)$' - return '' - endif +let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ +\ 'build', +\ 'bin', +\]) +function! s:CanParseMakefile(buffer) abort + " Something somewhere seems to delete this setting in tests, so ensure we + " always have a default value. + call ale#Set('c_parse_makefile', 0) + + return ale#Var(a:buffer, 'c_parse_makefile') +endfunction + +function! ale#c#GetBuildDirectory(buffer) abort let l:build_dir = ale#Var(a:buffer, 'c_build_dir') " c_build_dir has the priority if defined @@ -68,14 +76,73 @@ function! ale#c#ShellSplit(line) abort return l:args endfunction -function! ale#c#ParseCFlags(path_prefix, cflag_line) abort - let l:cflags_list = [] +" Takes the path prefix and a list of cflags and expands @file arguments to +" the contents of the file. +" +" @file arguments are command line arguments recognised by gcc and clang. For +" instance, if @./path/to/file was given to gcc, it would load .path/to/file +" and use the contents of that file as arguments. +function! ale#c#ExpandAtArgs(path_prefix, raw_split_lines) abort + let l:out_lines = [] - let l:split_lines = ale#c#ShellSplit(a:cflag_line) + for l:option in a:raw_split_lines + if stridx(l:option, '@') == 0 + " This is an argument specifying a location of a file containing other arguments + let l:path = join(split(l:option, '\zs')[1:], '') + + " Make path absolute + if !ale#path#IsAbsolute(l:path) + let l:rel_path = substitute(l:path, '"', '', 'g') + let l:rel_path = substitute(l:rel_path, '''', '', 'g') + let l:path = ale#path#GetAbsPath(a:path_prefix, l:rel_path) + endif + + " Read the file and add all the arguments + try + let l:additional_args = readfile(l:path) + catch + continue " All we can really do is skip this argument + endtry + + let l:file_lines = [] + + for l:line in l:additional_args + let l:file_lines += ale#c#ShellSplit(l:line) + endfor + + " @file arguments can include other @file arguments, so we must + " recurse. + let l:out_lines += ale#c#ExpandAtArgs(a:path_prefix, l:file_lines) + else + " This is not an @file argument, so don't touch it. + let l:out_lines += [l:option] + endif + endfor + + return l:out_lines +endfunction + +" Quote C/C++ a compiler argument, if needed. +" +" Quoting arguments might cause issues with some systems/compilers, so we only +" quote them if we need to. +function! ale#c#QuoteArg(arg) abort + if a:arg !~# '\v[#$&*()\\|[\]{};''"<>/?! ^%]' + return a:arg + endif + + return ale#Escape(a:arg) +endfunction + +function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort + " Expand @file arguments now before parsing + let l:arguments = ale#c#ExpandAtArgs(a:path_prefix, a:raw_arguments) + " A list of [already_quoted, argument] + let l:items = [] let l:option_index = 0 - while l:option_index < len(l:split_lines) - let l:option = l:split_lines[l:option_index] + while l:option_index < len(l:arguments) + let l:option = l:arguments[l:option_index] let l:option_index = l:option_index + 1 " Include options, that may need relative path fix @@ -83,56 +150,67 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort \ || stridx(l:option, '-iquote') == 0 \ || stridx(l:option, '-isystem') == 0 \ || stridx(l:option, '-idirafter') == 0 + \ || stridx(l:option, '-iframework') == 0 + \ || stridx(l:option, '-include') == 0 if stridx(l:option, '-I') == 0 && l:option isnot# '-I' let l:arg = join(split(l:option, '\zs')[2:], '') let l:option = '-I' else - let l:arg = l:split_lines[l:option_index] + let l:arg = l:arguments[l:option_index] let l:option_index = l:option_index + 1 endif " Fix relative paths if needed - if stridx(l:arg, s:sep) != 0 && stridx(l:arg, '/') != 0 + if !ale#path#IsAbsolute(l:arg) let l:rel_path = substitute(l:arg, '"', '', 'g') let l:rel_path = substitute(l:rel_path, '''', '', 'g') - let l:arg = ale#Escape(a:path_prefix . s:sep . l:rel_path) + let l:arg = ale#path#GetAbsPath(a:path_prefix, l:rel_path) endif - call add(l:cflags_list, l:option) - call add(l:cflags_list, l:arg) + call add(l:items, [1, l:option]) + call add(l:items, [1, ale#Escape(l:arg)]) " Options with arg that can be grouped with the option or separate elseif stridx(l:option, '-D') == 0 || stridx(l:option, '-B') == 0 - call add(l:cflags_list, l:option) - if l:option is# '-D' || l:option is# '-B' - call add(l:cflags_list, l:split_lines[l:option_index]) + call add(l:items, [1, l:option]) + call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 + else + call add(l:items, [0, l:option]) endif " Options that have an argument (always separate) elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 \ || l:option is# '-isysroot' || l:option is# '-imultilib' - call add(l:cflags_list, l:option) - call add(l:cflags_list, l:split_lines[l:option_index]) + call add(l:items, [0, l:option]) + call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 " Options without argument elseif (stridx(l:option, '-W') == 0 && stridx(l:option, '-Wa,') != 0 && stridx(l:option, '-Wl,') != 0 && stridx(l:option, '-Wp,') != 0) \ || l:option is# '-w' || stridx(l:option, '-pedantic') == 0 \ || l:option is# '-ansi' || stridx(l:option, '-std=') == 0 - \ || (stridx(l:option, '-f') == 0 && stridx(l:option, '-fdump') != 0 && stridx(l:option, '-fdiagnostics') != 0 && stridx(l:option, '-fno-show-column') != 0) + \ || stridx(l:option, '-f') == 0 && l:option !~# '\v^-f(dump|diagnostics|no-show-column|stack-usage)' \ || stridx(l:option, '-O') == 0 \ || l:option is# '-C' || l:option is# '-CC' || l:option is# '-trigraphs' \ || stridx(l:option, '-nostdinc') == 0 || stridx(l:option, '-iplugindir=') == 0 \ || stridx(l:option, '--sysroot=') == 0 || l:option is# '--no-sysroot-suffix' \ || stridx(l:option, '-m') == 0 - call add(l:cflags_list, l:option) + call add(l:items, [0, l:option]) endif endwhile - return join(l:cflags_list, ' ') + if a:should_quote + " Quote C arguments that haven't already been quoted above. + " If and only if we've been asked to quote them. + call map(l:items, 'v:val[0] ? v:val[1] : ale#c#QuoteArg(v:val[1])') + else + call map(l:items, 'v:val[1]') + endif + + return join(l:items, ' ') endfunction function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort - if !g:ale_c_parse_makefile + if !s:CanParseMakefile(a:buffer) return v:null endif @@ -150,7 +228,7 @@ function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') let l:makefile_dir = fnamemodify(l:makefile_path, ':p:h') - return ale#c#ParseCFlags(l:makefile_dir, l:cflag_line) + return ale#c#ParseCFlags(l:makefile_dir, 0, ale#c#ShellSplit(l:cflag_line)) endfunction " Given a buffer number, find the project directory containing @@ -218,6 +296,10 @@ if !exists('s:compile_commands_cache') let s:compile_commands_cache = {} endif +function! ale#c#ResetCompileCommandsCache() abort + let s:compile_commands_cache = {} +endfunction + function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:empty = [{}, {}] @@ -248,9 +330,20 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:dir_lookup = {} for l:entry in (type(l:raw_data) is v:t_list ? l:raw_data : []) + let l:filename = ale#path#GetAbsPath(l:entry.directory, l:entry.file) + + " Store a key for lookups by the absolute path to the filename. + let l:file_lookup[l:filename] = get(l:file_lookup, l:filename, []) + [l:entry] + + " Store a key for fuzzy lookups by the absolute path to the directory. + let l:dirname = fnamemodify(l:filename, ':h') + let l:dir_lookup[l:dirname] = get(l:dir_lookup, l:dirname, []) + [l:entry] + + " Store a key for fuzzy lookups by just the basename of the file. let l:basename = tolower(fnamemodify(l:entry.file, ':t')) let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry] + " Store a key for fuzzy lookups by just the basename of the directory. let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t')) let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:dirbasename, []) + [l:entry] endfor @@ -265,28 +358,80 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort return l:empty endfunction -function! ale#c#GetCompileCommand(json_item) abort - if has_key(a:json_item, 'command') - return a:json_item.command - elseif has_key(a:json_item, 'arguments') - return join(a:json_item.arguments, ' ') +" Get [should_quote, arguments] from either 'command' or 'arguments' +" 'arguments' should be quoted later, the split 'command' strings should not. +function! s:GetArguments(json_item) abort + if has_key(a:json_item, 'arguments') + return [1, a:json_item.arguments] + elseif has_key(a:json_item, 'command') + return [0, ale#c#ShellSplit(a:json_item.command)] endif - return '' + return [0, []] endfunction function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort + let l:buffer_filename = ale#path#Simplify(expand('#' . a:buffer . ':p')) + let l:basename = tolower(fnamemodify(l:buffer_filename, ':t')) + " Look for any file in the same directory if we can't find an exact match. + let l:dir = fnamemodify(l:buffer_filename, ':h') + " Search for an exact file match first. - let l:basename = tolower(expand('#' . a:buffer . ':t')) - let l:file_list = get(a:file_lookup, l:basename, []) + let l:file_list = get(a:file_lookup, l:buffer_filename, []) + + " We may have to look for /foo/bar instead of C:\foo\bar + if empty(l:file_list) && has('win32') + let l:file_list = get( + \ a:file_lookup, + \ ale#path#RemoveDriveLetter(l:buffer_filename), + \ [] + \) + endif + + " Try the absolute path to the directory second. + let l:dir_list = get(a:dir_lookup, l:dir, []) + + if empty(l:dir_list) && has('win32') + let l:dir_list = get( + \ a:dir_lookup, + \ ale#path#RemoveDriveLetter(l:dir), + \ [] + \) + endif + + if empty(l:file_list) && empty(l:dir_list) + " If we can't find matches with the path to the file, try a + " case-insensitive match for any similarly-named file. + let l:file_list = get(a:file_lookup, l:basename, []) + + " If we can't find matches with the path to the directory, try a + " case-insensitive match for anything in similarly-named directory. + let l:dir_list = get(a:dir_lookup, tolower(fnamemodify(l:dir, ':t')), []) + endif + " A source file matching the header filename. let l:source_file = '' if empty(l:file_list) && l:basename =~? '\.h$\|\.hpp$' for l:suffix in ['.c', '.cpp'] - let l:key = fnamemodify(l:basename, ':r') . l:suffix + " Try to find a source file by an absolute path first. + let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix let l:file_list = get(a:file_lookup, l:key, []) + if empty(l:file_list) && has('win32') + let l:file_list = get( + \ a:file_lookup, + \ ale#path#RemoveDriveLetter(l:key), + \ [] + \) + endif + + if empty(l:file_list) + " Look fuzzy matches on the basename second. + let l:key = fnamemodify(l:basename, ':r') . l:suffix + let l:file_list = get(a:file_lookup, l:key, []) + endif + if !empty(l:file_list) let l:source_file = l:key break @@ -295,28 +440,31 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort endif for l:item in l:file_list + let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) + " Load the flags for this file, or for a source file matching the " header file. if ( - \ bufnr(l:item.file) is a:buffer + \ bufnr(l:filename) is a:buffer \ || ( \ !empty(l:source_file) - \ && l:item.file[-len(l:source_file):] is? l:source_file + \ && l:filename[-len(l:source_file):] is? l:source_file \ ) \) - return ale#c#ParseCFlags(l:item.directory, ale#c#GetCompileCommand(l:item)) + let [l:should_quote, l:args] = s:GetArguments(l:item) + + return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor - " Look for any file in the same directory if we can't find an exact match. - let l:dir = ale#path#Simplify(expand('#' . a:buffer . ':p:h')) - - let l:dirbasename = tolower(expand('#' . a:buffer . ':p:h:t')) - let l:dir_list = get(a:dir_lookup, l:dirbasename, []) - for l:item in l:dir_list - if ale#path#Simplify(fnamemodify(l:item.file, ':h')) is? l:dir - return ale#c#ParseCFlags(l:item.directory, ale#c#GetCompileCommand(l:item)) + let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) + + if ale#path#RemoveDriveLetter(fnamemodify(l:filename, ':h')) + \ is? ale#path#RemoveDriveLetter(l:dir) + let [l:should_quote, l:args] = s:GetArguments(l:item) + + return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor @@ -334,10 +482,6 @@ endfunction function! ale#c#GetCFlags(buffer, output) abort let l:cflags = v:null - if ale#Var(a:buffer, 'c_parse_makefile') && !empty(a:output) - let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) - endif - if ale#Var(a:buffer, 'c_parse_compile_commands') let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) @@ -346,6 +490,10 @@ function! ale#c#GetCFlags(buffer, output) abort endif endif + if s:CanParseMakefile(a:buffer) && !empty(a:output) && !empty(l:cflags) + let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) + endif + if l:cflags is v:null let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) endif @@ -354,11 +502,14 @@ function! ale#c#GetCFlags(buffer, output) abort endfunction function! ale#c#GetMakeCommand(buffer) abort - if ale#Var(a:buffer, 'c_parse_makefile') - let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') + if s:CanParseMakefile(a:buffer) + let l:path = ale#path#FindNearestFile(a:buffer, 'Makefile') - if !empty(l:makefile_path) - return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n' + if !empty(l:path) + let l:always_make = ale#Var(a:buffer, 'c_always_make') + + return ale#path#CdString(fnamemodify(l:path, ':h')) + \ . 'make -n' . (l:always_make ? ' --always-make' : '') endif endif @@ -427,8 +578,3 @@ function! ale#c#IncludeOptions(include_paths) abort return join(l:option_list) endfunction - -let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ -\ 'build', -\ 'bin', -\]) diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim index 60c3bbef..69d40933 100644 --- a/sources_non_forked/ale/autoload/ale/code_action.vim +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -1,29 +1,68 @@ " Author: Jerko Steiner " Description: Code action support for LSP / tsserver -function! ale#code_action#HandleCodeAction(code_action, should_save) abort +function! ale#code_action#ReloadBuffer() abort + let l:buffer = bufnr('') + + execute 'augroup ALECodeActionReloadGroup' . l:buffer + autocmd! + augroup END + + silent! execute 'augroup! ALECodeActionReloadGroup' . l:buffer + + call ale#util#Execute(':e!') +endfunction + +function! ale#code_action#HandleCodeAction(code_action, options) abort let l:current_buffer = bufnr('') let l:changes = a:code_action.changes - - for l:file_code_edit in l:changes - let l:buf = bufnr(l:file_code_edit.fileName) - - if l:buf != -1 && l:buf != l:current_buffer && getbufvar(l:buf, '&mod') - call ale#util#Execute('echom ''Aborting action, file is unsaved''') - - return - endif - endfor + let l:should_save = get(a:options, 'should_save') for l:file_code_edit in l:changes call ale#code_action#ApplyChanges( - \ l:file_code_edit.fileName, - \ l:file_code_edit.textChanges, - \ a:should_save, - \ ) + \ l:file_code_edit.fileName, + \ l:file_code_edit.textChanges, + \ l:should_save, + \) endfor endfunction +function! s:ChangeCmp(left, right) abort + if a:left.start.line < a:right.start.line + return -1 + endif + + if a:left.start.line > a:right.start.line + return 1 + endif + + if a:left.start.offset < a:right.start.offset + return -1 + endif + + if a:left.start.offset > a:right.start.offset + return 1 + endif + + if a:left.end.line < a:right.end.line + return -1 + endif + + if a:left.end.line > a:right.end.line + return 1 + endif + + if a:left.end.offset < a:right.end.offset + return -1 + endif + + if a:left.end.offset > a:right.end.offset + return 1 + endif + + return 0 +endfunction + function! ale#code_action#ApplyChanges(filename, changes, should_save) abort let l:current_buffer = bufnr('') " The buffer is used to determine the fileformat, if available. @@ -42,28 +81,14 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort let l:pos = [1, 1] endif - " We have to keep track of how many lines we have added, and offset - " changes accordingly. - let l:line_offset = 0 - let l:column_offset = 0 - let l:last_end_line = 0 - - for l:code_edit in a:changes - if l:code_edit.start.line isnot l:last_end_line - let l:column_offset = 0 - endif - - let l:line = l:code_edit.start.line + l:line_offset - let l:column = l:code_edit.start.offset + l:column_offset - let l:end_line = l:code_edit.end.line + l:line_offset - let l:end_column = l:code_edit.end.offset + l:column_offset + " Changes have to be sorted so we apply them from bottom-to-top + for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp'))) + let l:line = l:code_edit.start.line + let l:column = l:code_edit.start.offset + let l:end_line = l:code_edit.end.line + let l:end_column = l:code_edit.end.offset let l:text = l:code_edit.newText - let l:cur_line = l:pos[0] - let l:cur_column = l:pos[1] - - let l:last_end_line = l:end_line - " Adjust the ends according to previous edits. if l:end_line > len(l:lines) let l:end_line_len = 0 @@ -81,6 +106,12 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort let l:start = l:lines[: l:line - 2] endif + " Special case when text must be added after new line + if l:column > len(l:lines[l:line - 1]) + call extend(l:start, [l:lines[l:line - 1]]) + let l:column = 1 + endif + if l:column is 1 " We need to handle column 1 specially, because we can't slice an " empty string ending on index 0. @@ -90,13 +121,17 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort endif call extend(l:middle, l:insertions[1:]) - let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] + + if l:end_line <= len(l:lines) + " Only extend the last line if end_line is within the range of + " lines. + let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] + endif let l:lines_before_change = len(l:lines) let l:lines = l:start + l:middle + l:lines[l:end_line :] let l:current_line_offset = len(l:lines) - l:lines_before_change - let l:line_offset += l:current_line_offset let l:column_offset = len(l:middle[-1]) - l:end_line_len let l:pos = s:UpdateCursor(l:pos, @@ -122,6 +157,20 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort call setpos('.', [0, l:pos[0], l:pos[1], 0]) endif + + if a:should_save && l:buffer > 0 && !l:is_current_buffer + " Set up a one-time use event that will delete itself to reload the + " buffer next time it's entered to view the changes made to it. + execute 'augroup ALECodeActionReloadGroup' . l:buffer + autocmd! + + execute printf( + \ 'autocmd BufEnter ' + \ . ' call ale#code_action#ReloadBuffer()', + \ l:buffer + \) + augroup END + endif endfunction function! s:UpdateCursor(cursor, start, end, offset) abort @@ -171,3 +220,163 @@ function! s:UpdateCursor(cursor, start, end, offset) abort return [l:cur_line, l:cur_column] endfunction + +function! ale#code_action#GetChanges(workspace_edit) abort + let l:changes = {} + + if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes) + return a:workspace_edit.changes + elseif has_key(a:workspace_edit, 'documentChanges') + let l:document_changes = [] + + if type(a:workspace_edit.documentChanges) is v:t_dict + \ && has_key(a:workspace_edit.documentChanges, 'edits') + call add(l:document_changes, a:workspace_edit.documentChanges) + elseif type(a:workspace_edit.documentChanges) is v:t_list + let l:document_changes = a:workspace_edit.documentChanges + endif + + for l:text_document_edit in l:document_changes + let l:filename = l:text_document_edit.textDocument.uri + let l:edits = l:text_document_edit.edits + let l:changes[l:filename] = l:edits + endfor + endif + + return l:changes +endfunction + +function! ale#code_action#BuildChangesList(changes_map) abort + let l:changes = [] + + for l:file_name in keys(a:changes_map) + let l:text_edits = a:changes_map[l:file_name] + let l:text_changes = [] + + for l:edit in l:text_edits + let l:range = l:edit.range + let l:new_text = l:edit.newText + + call add(l:text_changes, { + \ 'start': { + \ 'line': l:range.start.line + 1, + \ 'offset': l:range.start.character + 1, + \ }, + \ 'end': { + \ 'line': l:range.end.line + 1, + \ 'offset': l:range.end.character + 1, + \ }, + \ 'newText': l:new_text, + \}) + endfor + + call add(l:changes, { + \ 'fileName': ale#path#FromURI(l:file_name), + \ 'textChanges': l:text_changes, + \}) + endfor + + return l:changes +endfunction + +function! s:EscapeMenuName(text) abort + return substitute(a:text, '\\\| \|\.\|&', '\\\0', 'g') +endfunction + +function! s:UpdateMenu(data, menu_items) abort + silent! aunmenu PopUp.Refactor\.\.\. + + if empty(a:data) + return + endif + + for [l:type, l:item] in a:menu_items + let l:name = l:type is# 'tsserver' ? l:item.name : l:item.title + let l:func_name = l:type is# 'tsserver' + \ ? 'ale#codefix#ApplyTSServerCodeAction' + \ : 'ale#codefix#ApplyLSPCodeAction' + + execute printf( + \ 'anoremenu PopUp.&Refactor\.\.\..%s' + \ . ' :call %s(%s, %s)', + \ s:EscapeMenuName(l:name), + \ l:func_name, + \ string(a:data), + \ string(l:item), + \) + endfor + + if empty(a:menu_items) + silent! anoremenu PopUp.Refactor\.\.\..(None) :silent + endif +endfunction + +function! s:GetCodeActions(linter, options) abort + let l:buffer = bufnr('') + let [l:line, l:column] = getpos('.')[1:2] + let l:column = min([l:column, len(getline(l:line))]) + + let l:location = { + \ 'buffer': l:buffer, + \ 'line': l:line, + \ 'column': l:column, + \ 'end_line': l:line, + \ 'end_column': l:column, + \} + let l:Callback = function('s:OnReady', [l:location, a:options]) + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#code_action#GetCodeActions(options) abort + silent! aunmenu PopUp.Rename + silent! aunmenu PopUp.Refactor\.\.\. + + " Only display the menu items if there's an LSP server. + let l:has_lsp = 0 + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + let l:has_lsp = 1 + + break + endif + endfor + + if l:has_lsp + if !empty(expand('')) + silent! anoremenu PopUp.Rename :ALERename + endif + + silent! anoremenu PopUp.Refactor\.\.\..(None) :silent + + call ale#codefix#Execute( + \ mode() is# 'v' || mode() is# "\", + \ function('s:UpdateMenu') + \) + endif +endfunction + +function! s:Setup(enabled) abort + augroup ALECodeActionsGroup + autocmd! + + if a:enabled + autocmd MenuPopup * :call ale#code_action#GetCodeActions({}) + endif + augroup END + + if !a:enabled + silent! augroup! ALECodeActionsGroup + + silent! aunmenu PopUp.Rename + silent! aunmenu PopUp.Refactor\.\.\. + endif +endfunction + +function! ale#code_action#EnablePopUpMenu() abort + call s:Setup(1) +endfunction + +function! ale#code_action#DisablePopUpMenu() abort + call s:Setup(0) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/codefix.vim b/sources_non_forked/ale/autoload/ale/codefix.vim new file mode 100644 index 00000000..69bf36fa --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/codefix.vim @@ -0,0 +1,484 @@ +" Author: Dalius Dobravolskas +" Description: Code Fix support for tsserver and LSP servers + +let s:codefix_map = {} + +" Used to get the codefix map in tests. +function! ale#codefix#GetMap() abort + return deepcopy(s:codefix_map) +endfunction + +" Used to set the codefix map in tests. +function! ale#codefix#SetMap(map) abort + let s:codefix_map = a:map +endfunction + +function! ale#codefix#ClearLSPData() abort + let s:codefix_map = {} +endfunction + +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +function! ale#codefix#ApplyTSServerCodeAction(data, item) abort + if has_key(a:item, 'changes') + let l:changes = a:item.changes + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'codefix', + \ 'changes': l:changes, + \ }, + \ {}, + \) + else + let l:message = ale#lsp#tsserver_message#GetEditsForRefactor( + \ a:data.buffer, + \ a:data.line, + \ a:data.column, + \ a:data.end_line, + \ a:data.end_column, + \ a:item.id[0], + \ a:item.id[1], + \) + + let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) + + let s:codefix_map[l:request_id] = a:data + endif +endfunction + +function! ale#codefix#HandleTSServerResponse(conn_id, response) abort + if !has_key(a:response, 'request_seq') + \ || !has_key(s:codefix_map, a:response.request_seq) + return + endif + + let l:data = remove(s:codefix_map, a:response.request_seq) + let l:MenuCallback = get(l:data, 'menu_callback', v:null) + + if get(a:response, 'command', '') is# 'getCodeFixes' + if get(a:response, 'success', v:false) is v:false + \&& l:MenuCallback is v:null + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting code fixes. Reason: ' . l:message) + + return + endif + + let l:result = get(a:response, 'body', []) + call filter(l:result, 'has_key(v:val, ''changes'')') + + if l:MenuCallback isnot v:null + call l:MenuCallback( + \ l:data, + \ map(copy(l:result), '[''tsserver'', v:val]') + \) + + return + endif + + if len(l:result) == 0 + call s:message('No code fixes available.') + + return + endif + + let l:code_fix_to_apply = 0 + + if len(l:result) == 1 + let l:code_fix_to_apply = 1 + else + let l:codefix_no = 1 + let l:codefixstring = "Code Fixes:\n" + + for l:codefix in l:result + let l:codefixstring .= l:codefix_no . ') ' + \ . l:codefix.description . "\n" + let l:codefix_no += 1 + endfor + + let l:codefixstring .= 'Type number and (empty cancels): ' + + let l:code_fix_to_apply = ale#util#Input(l:codefixstring, '') + let l:code_fix_to_apply = str2nr(l:code_fix_to_apply) + + if l:code_fix_to_apply == 0 + return + endif + endif + + call ale#codefix#ApplyTSServerCodeAction( + \ l:data, + \ l:result[l:code_fix_to_apply - 1], + \) + elseif get(a:response, 'command', '') is# 'getApplicableRefactors' + if get(a:response, 'success', v:false) is v:false + \&& l:MenuCallback is v:null + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting applicable refactors. Reason: ' . l:message) + + return + endif + + let l:result = get(a:response, 'body', []) + + if len(l:result) == 0 + call s:message('No applicable refactors available.') + + return + endif + + let l:refactors = [] + + for l:item in l:result + for l:action in l:item.actions + call add(l:refactors, { + \ 'name': l:action.description, + \ 'id': [l:item.name, l:action.name], + \}) + endfor + endfor + + if l:MenuCallback isnot v:null + call l:MenuCallback( + \ l:data, + \ map(copy(l:refactors), '[''tsserver'', v:val]') + \) + + return + endif + + let l:refactor_no = 1 + let l:refactorstring = "Applicable refactors:\n" + + for l:refactor in l:refactors + let l:refactorstring .= l:refactor_no . ') ' + \ . l:refactor.name . "\n" + let l:refactor_no += 1 + endfor + + let l:refactorstring .= 'Type number and (empty cancels): ' + + let l:refactor_to_apply = ale#util#Input(l:refactorstring, '') + let l:refactor_to_apply = str2nr(l:refactor_to_apply) + + if l:refactor_to_apply == 0 + return + endif + + let l:id = l:refactors[l:refactor_to_apply - 1].id + + call ale#codefix#ApplyTSServerCodeAction( + \ l:data, + \ l:refactors[l:refactor_to_apply - 1], + \) + elseif get(a:response, 'command', '') is# 'getEditsForRefactor' + if get(a:response, 'success', v:false) is v:false + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting edits for refactor. Reason: ' . l:message) + + return + endif + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'editsForRefactor', + \ 'changes': a:response.body.edits, + \ }, + \ {}, + \) + endif +endfunction + +function! ale#codefix#ApplyLSPCodeAction(data, item) abort + if has_key(a:item, 'command') + \&& type(a:item.command) == v:t_dict + let l:command = a:item.command + let l:message = ale#lsp#message#ExecuteCommand( + \ l:command.command, + \ l:command.arguments, + \) + + let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) + elseif has_key(a:item, 'edit') || has_key(a:item, 'arguments') + if has_key(a:item, 'edit') + let l:topass = a:item.edit + else + let l:topass = a:item.arguments[0] + endif + + let l:changes_map = ale#code_action#GetChanges(l:topass) + + if empty(l:changes_map) + return + endif + + let l:changes = ale#code_action#BuildChangesList(l:changes_map) + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'codeaction', + \ 'changes': l:changes, + \ }, + \ {}, + \) + endif +endfunction + +function! ale#codefix#HandleLSPResponse(conn_id, response) abort + if has_key(a:response, 'method') + \ && a:response.method is# 'workspace/applyEdit' + \ && has_key(a:response, 'params') + let l:params = a:response.params + + let l:changes_map = ale#code_action#GetChanges(l:params.edit) + + if empty(l:changes_map) + return + endif + + let l:changes = ale#code_action#BuildChangesList(l:changes_map) + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'applyEdit', + \ 'changes': l:changes, + \ }, + \ {} + \) + elseif has_key(a:response, 'id') + \&& has_key(s:codefix_map, a:response.id) + let l:data = remove(s:codefix_map, a:response.id) + let l:MenuCallback = get(l:data, 'menu_callback', v:null) + + let l:result = get(a:response, 'result') + + if type(l:result) != v:t_list + let l:result = [] + endif + + " Send the results to the menu callback, if set. + if l:MenuCallback isnot v:null + call l:MenuCallback(map(copy(l:result), '[''lsp'', v:val]')) + + return + endif + + if len(l:result) == 0 + call s:message('No code actions received from server') + + return + endif + + let l:codeaction_no = 1 + let l:codeactionstring = "Code Fixes:\n" + + for l:codeaction in l:result + let l:codeactionstring .= l:codeaction_no . ') ' + \ . l:codeaction.title . "\n" + let l:codeaction_no += 1 + endfor + + let l:codeactionstring .= 'Type number and (empty cancels): ' + + let l:codeaction_to_apply = ale#util#Input(l:codeactionstring, '') + let l:codeaction_to_apply = str2nr(l:codeaction_to_apply) + + if l:codeaction_to_apply == 0 + return + endif + + let l:item = l:result[l:codeaction_to_apply - 1] + + call ale#codefix#ApplyLSPCodeAction(l:data, l:item) + endif +endfunction + +function! s:FindError(buffer, line, column, end_line, end_column) abort + let l:nearest_error = v:null + + if a:line == a:end_line + \&& a:column == a:end_column + \&& has_key(g:ale_buffer_info, a:buffer) + let l:nearest_error_diff = -1 + + for l:error in get(g:ale_buffer_info[a:buffer], 'loclist', []) + if has_key(l:error, 'code') && l:error.lnum == a:line + let l:diff = abs(l:error.col - a:column) + + if l:nearest_error_diff == -1 || l:diff < l:nearest_error_diff + let l:nearest_error_diff = l:diff + let l:nearest_error = l:error + endif + endif + endfor + endif + + return l:nearest_error +endfunction + +function! s:OnReady( +\ line, +\ column, +\ end_line, +\ end_column, +\ MenuCallback, +\ linter, +\ lsp_details, +\) abort + let l:id = a:lsp_details.connection_id + + if !ale#lsp#HasCapability(l:id, 'code_actions') + return + endif + + let l:buffer = a:lsp_details.buffer + + if a:linter.lsp is# 'tsserver' + let l:nearest_error = + \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column) + + if l:nearest_error isnot v:null + let l:message = ale#lsp#tsserver_message#GetCodeFixes( + \ l:buffer, + \ a:line, + \ a:column, + \ a:line, + \ a:column, + \ [l:nearest_error.code], + \) + else + let l:message = ale#lsp#tsserver_message#GetApplicableRefactors( + \ l:buffer, + \ a:line, + \ a:column, + \ a:end_line, + \ a:end_column, + \) + endif + else + " Send a message saying the buffer has changed first, otherwise + " completions won't know what text is nearby. + call ale#lsp#NotifyForChanges(l:id, l:buffer) + + let l:diagnostics = [] + let l:nearest_error = + \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column) + + if l:nearest_error isnot v:null + let l:diagnostics = [ + \ { + \ 'code': l:nearest_error.code, + \ 'message': l:nearest_error.text, + \ 'range': { + \ 'start': { + \ 'line': l:nearest_error.lnum - 1, + \ 'character': l:nearest_error.col - 1, + \ }, + \ 'end': { + \ 'line': l:nearest_error.end_lnum - 1, + \ 'character': l:nearest_error.end_col, + \ }, + \ }, + \ }, + \] + endif + + let l:message = ale#lsp#message#CodeAction( + \ l:buffer, + \ a:line, + \ a:column, + \ a:end_line, + \ a:end_column, + \ l:diagnostics, + \) + endif + + let l:Callback = a:linter.lsp is# 'tsserver' + \ ? function('ale#codefix#HandleTSServerResponse') + \ : function('ale#codefix#HandleLSPResponse') + + call ale#lsp#RegisterCallback(l:id, l:Callback) + + let l:request_id = ale#lsp#Send(l:id, l:message) + + let s:codefix_map[l:request_id] = { + \ 'connection_id': l:id, + \ 'buffer': l:buffer, + \ 'line': a:line, + \ 'column': a:column, + \ 'end_line': a:end_line, + \ 'end_column': a:end_column, + \ 'menu_callback': a:MenuCallback, + \} +endfunction + +function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort + let l:buffer = bufnr('') + + if a:range == 0 + let [l:line, l:column] = getpos('.')[1:2] + let l:end_line = l:line + let l:end_column = l:column + + " Expand the range to cover the current word, if there is one. + let l:cword = expand('') + + if !empty(l:cword) + let l:search_pos = searchpos('\V' . l:cword, 'bn', l:line) + + if l:search_pos != [0, 0] + let l:column = l:search_pos[1] + let l:end_column = l:column + len(l:cword) - 1 + endif + endif + elseif mode() is# 'v' || mode() is# "\" + " You need to get the start and end in a different way when you're in + " visual mode. + let [l:line, l:column] = getpos('v')[1:2] + let [l:end_line, l:end_column] = getpos('.')[1:2] + else + let [l:line, l:column] = getpos("'<")[1:2] + let [l:end_line, l:end_column] = getpos("'>")[1:2] + endif + + let l:column = min([l:column, len(getline(l:line))]) + let l:end_column = min([l:end_column, len(getline(l:end_line))]) + + let l:Callback = function( + \ 's:OnReady', [l:line, l:column, l:end_line, l:end_column, a:MenuCallback] + \) + + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#codefix#Execute(range, ...) abort + if a:0 > 1 + throw 'Too many arguments' + endif + + let l:MenuCallback = get(a:000, 0, v:null) + let l:lsp_linters = [] + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call add(l:lsp_linters, l:linter) + endif + endfor + + if empty(l:lsp_linters) + if l:MenuCallback is v:null + call s:message('No active LSPs') + else + call l:MenuCallback({}, []) + endif + + return + endif + + for l:lsp_linter in l:lsp_linters + call s:ExecuteGetCodeFix(l:lsp_linter, a:range, l:MenuCallback) + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim index 1bbc4f4c..8f497169 100644 --- a/sources_non_forked/ale/autoload/ale/command.vim +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -133,11 +133,36 @@ function! ale#command#EscapeCommandPart(command_part) abort return substitute(a:command_part, '%', '%%', 'g') endfunction +" Format a filename, converting it with filename mappings, if non-empty, +" and escaping it for putting into a command string. +" +" The filename can be modified. +function! s:FormatFilename(filename, mappings, modifiers) abort + let l:filename = a:filename + + if !empty(a:mappings) + let l:filename = ale#filename_mapping#Map(l:filename, a:mappings) + endif + + if !empty(a:modifiers) + let l:filename = fnamemodify(l:filename, a:modifiers) + endif + + return ale#Escape(l:filename) +endfunction + " Given a command string, replace every... " %s -> with the current filename " %t -> with the name of an unused file in a temporary directory " %% -> with a literal % -function! ale#command#FormatCommand(buffer, executable, command, pipe_file_if_needed, input) abort +function! ale#command#FormatCommand( +\ buffer, +\ executable, +\ command, +\ pipe_file_if_needed, +\ input, +\ mappings, +\) abort let l:temporary_file = '' let l:command = a:command @@ -154,14 +179,24 @@ function! ale#command#FormatCommand(buffer, executable, command, pipe_file_if_ne " file. if l:command =~# '%s' let l:filename = fnamemodify(bufname(a:buffer), ':p') - let l:command = substitute(l:command, '%s', '\=ale#Escape(l:filename)', 'g') + let l:command = substitute( + \ l:command, + \ '\v\%s(%(:h|:t|:r|:e)*)', + \ '\=s:FormatFilename(l:filename, a:mappings, submatch(1))', + \ 'g' + \) endif if a:input isnot v:false && l:command =~# '%t' " Create a temporary filename, / " The file itself will not be created by this function. let l:temporary_file = s:TemporaryFilename(a:buffer) - let l:command = substitute(l:command, '%t', '\=ale#Escape(l:temporary_file)', 'g') + let l:command = substitute( + \ l:command, + \ '\v\%t(%(:h|:t|:r|:e)*)', + \ '\=s:FormatFilename(l:temporary_file, a:mappings, submatch(1))', + \ 'g' + \) endif " Finish formatting so %% becomes %. @@ -265,6 +300,7 @@ function! ale#command#Run(buffer, command, Callback, ...) abort \ a:command, \ get(l:options, 'read_buffer', 0), \ get(l:options, 'input', v:null), + \ get(l:options, 'filename_mappings', []), \) let l:command = ale#job#PrepareCommand(a:buffer, l:command) let l:job_options = { diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 2b5756e4..39bfc094 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -5,7 +5,7 @@ scriptencoding utf-8 " The omnicompletion menu is shown through a special Plug mapping which is " only valid in Insert mode. This way, feedkeys() won't send these keys if you " quit Insert mode quickly enough. -inoremap (ale_show_completion_menu) +inoremap (ale_show_completion_menu) " If we hit the key sequence in normal mode, then we won't show the menu, so " we should restore the old settings right away. nnoremap (ale_show_completion_menu) :call ale#completion#RestoreCompletionOptions() @@ -16,7 +16,8 @@ onoremap (ale_show_completion_menu) let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100) let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', []) let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50) -let g:ale_completion_tsserver_autoimport = get(g:, 'ale_completion_tsserver_autoimport', 0) +let g:ale_completion_autoimport = get(g:, 'ale_completion_autoimport', 0) +let g:ale_completion_tsserver_remove_warnings = get(g:, 'ale_completion_tsserver_remove_warnings', 0) let s:timer_id = -1 let s:last_done_pos = [] @@ -187,7 +188,13 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort return '' endfunction -function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort +function! ale#completion#Filter( +\ buffer, +\ filetype, +\ suggestions, +\ prefix, +\ exact_prefix_match, +\) abort let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words') if empty(a:prefix) @@ -214,10 +221,17 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort " Dictionaries is accepted here. let l:word = type(l:item) is v:t_string ? l:item : l:item.word - " Add suggestions if the suggestion starts with a - " case-insensitive match for the prefix. - if l:word[: len(a:prefix) - 1] is? a:prefix - call add(l:filtered_suggestions, l:item) + if a:exact_prefix_match + " Add suggestions if the word is an exact match. + if l:word is# a:prefix + call add(l:filtered_suggestions, l:item) + endif + else + " Add suggestions if the suggestion starts with a + " case-insensitive match for the prefix. + if l:word[: len(a:prefix) - 1] is? a:prefix + call add(l:filtered_suggestions, l:item) + endif endif endfor endif @@ -240,21 +254,17 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort return l:filtered_suggestions endfunction -function! s:ReplaceCompletionOptions() abort - let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') - - if l:source is# 'ale-automatic' || l:source is# 'ale-manual' - " Remember the old omnifunc value, if there is one. - " If we don't store an old one, we'll just never reset the option. - " This will stop some random exceptions from appearing. - if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) - let b:ale_old_omnifunc = &l:omnifunc - endif - - let &l:omnifunc = 'ale#completion#AutomaticOmniFunc' +function! s:ReplaceCompletionOptions(source) abort + " Remember the old omnifunc value, if there is one. + " If we don't store an old one, we'll just never reset the option. + " This will stop some random exceptions from appearing. + if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) + let b:ale_old_omnifunc = &l:omnifunc endif - if l:source is# 'ale-automatic' + let &l:omnifunc = 'ale#completion#AutomaticOmniFunc' + + if a:source is# 'ale-automatic' if !exists('b:ale_old_completeopt') let b:ale_old_completeopt = &l:completeopt endif @@ -317,41 +327,70 @@ function! ale#completion#AutomaticOmniFunc(findstart, base) abort else let l:result = ale#completion#GetCompletionResult() - call s:ReplaceCompletionOptions() + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + call s:ReplaceCompletionOptions(l:source) + endif return l:result isnot v:null ? l:result : [] endif endfunction +function! s:OpenCompletionMenu(...) abort + if !&l:paste + call ale#util#FeedKeys("\(ale_show_completion_menu)") + endif +endfunction + function! ale#completion#Show(result) abort - if ale#util#Mode() isnot# 'i' + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if ale#util#Mode() isnot# 'i' && l:source isnot# 'ale-import' return endif - " Set the list in the buffer, temporarily replace omnifunc with our - " function, and then start omni-completion. + " Set the list in the buffer. let b:ale_completion_result = a:result " Don't try to open the completion menu if there's nothing to show. if empty(b:ale_completion_result) + if l:source is# 'ale-import' + " If we ran completion from :ALEImport, + " tell the user that nothing is going to happen. + call s:message('No possible imports found.') + endif + return endif " Replace completion options shortly before opening the menu. - call s:ReplaceCompletionOptions() - - let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') - if l:source is# 'ale-automatic' || l:source is# 'ale-manual' - call timer_start( - \ 0, - \ {-> ale#util#FeedKeys("\(ale_show_completion_menu)")} - \) + call s:ReplaceCompletionOptions(l:source) + + call timer_start(0, function('s:OpenCompletionMenu')) endif if l:source is# 'ale-callback' call b:CompleteCallback(b:ale_completion_result) endif + + if l:source is# 'ale-import' + call ale#completion#HandleUserData(b:ale_completion_result[0]) + + let l:text_changed = '' . g:ale_lint_on_text_changed + + " Check the buffer again right away, if linting is enabled. + if g:ale_enabled + \&& ( + \ l:text_changed is# '1' + \ || l:text_changed is# 'always' + \ || l:text_changed is# 'normal' + \ || l:text_changed is# 'insert' + \) + call ale#Queue(0, '') + endif + endif endfunction function! ale#completion#GetAllTriggers() abort @@ -382,14 +421,18 @@ endfunction function! s:CompletionStillValid(request_id) abort let [l:line, l:column] = getpos('.')[1:2] - return ale#util#Mode() is# 'i' - \&& has_key(b:, 'ale_completion_info') + return has_key(b:, 'ale_completion_info') + \&& ( + \ ale#util#Mode() is# 'i' + \ || b:ale_completion_info.source is# 'ale-import' + \) \&& b:ale_completion_info.request_id == a:request_id \&& b:ale_completion_info.line == l:line \&& ( \ b:ale_completion_info.column == l:column \ || b:ale_completion_info.source is# 'ale-omnifunc' \ || b:ale_completion_info.source is# 'ale-callback' + \ || b:ale_completion_info.source is# 'ale-import' \) endfunction @@ -397,10 +440,14 @@ function! ale#completion#ParseTSServerCompletions(response) abort let l:names = [] for l:suggestion in a:response.body - call add(l:names, { - \ 'word': l:suggestion.name, - \ 'source': get(l:suggestion, 'source', ''), - \}) + let l:kind = get(l:suggestion, 'kind', '') + + if g:ale_completion_tsserver_remove_warnings == 0 || l:kind isnot# 'warning' + call add(l:names, { + \ 'word': l:suggestion.name, + \ 'source': get(l:suggestion, 'source', ''), + \}) + endif endfor return l:names @@ -410,15 +457,26 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort let l:buffer = bufnr('') let l:results = [] let l:names_with_details = [] + let l:info = get(b:, 'ale_completion_info', {}) for l:suggestion in a:response.body let l:displayParts = [] + let l:local_name = v:null for l:action in get(l:suggestion, 'codeActions', []) call add(l:displayParts, l:action.description . ' ') endfor for l:part in l:suggestion.displayParts + " Stop on stop on line breaks for the menu. + if get(l:part, 'kind') is# 'lineBreak' + break + endif + + if get(l:part, 'kind') is# 'localName' + let l:local_name = l:part.text + endif + call add(l:displayParts, l:part.text) endfor @@ -431,21 +489,35 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort " See :help complete-items let l:result = { - \ 'word': l:suggestion.name, + \ 'word': ( + \ l:suggestion.name is# 'default' + \ && l:suggestion.kind is# 'alias' + \ && !empty(l:local_name) + \ ? l:local_name + \ : l:suggestion.name + \ ), \ 'kind': ale#completion#GetCompletionSymbols(l:suggestion.kind), \ 'icase': 1, \ 'menu': join(l:displayParts, ''), - \ 'dup': g:ale_completion_tsserver_autoimport, + \ 'dup': get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \ 'info': join(l:documentationParts, ''), \} + " This flag is used to tell if this completion came from ALE or not. + let l:user_data = {'_ale_completion_item': 1} if has_key(l:suggestion, 'codeActions') - let l:result.user_data = json_encode({ - \ 'codeActions': l:suggestion.codeActions, - \ }) + let l:user_data.code_actions = l:suggestion.codeActions endif - call add(l:results, l:result) + let l:result.user_data = json_encode(l:user_data) + + " Include this item if we'll accept any items, + " or if we only want items with additional edits, and this has them. + if !get(l:info, 'additional_edits_only', 0) + \|| has_key(l:user_data, 'code_actions') + call add(l:results, l:result) + endif endfor let l:names = getbufvar(l:buffer, 'ale_tsserver_completion_names', []) @@ -464,6 +536,7 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort \ 'icase': 1, \ 'menu': '', \ 'info': '', + \ 'user_data': json_encode({'_ale_completion_item': 1}), \}) endfor endif @@ -517,23 +590,84 @@ function! ale#completion#ParseLSPCompletions(response) abort continue endif + " Don't use LSP items with additional text edits when autoimport for + " completions is turned off. + if !empty(get(l:item, 'additionalTextEdits')) + \&& !( + \ get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport + \) + continue + endif + let l:doc = get(l:item, 'documentation', '') if type(l:doc) is v:t_dict && has_key(l:doc, 'value') let l:doc = l:doc.value endif - call add(l:results, { + " Collapse whitespaces and line breaks into a single space. + let l:detail = substitute(get(l:item, 'detail', ''), '\_s\+', ' ', 'g') + + let l:result = { \ 'word': l:word, \ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')), \ 'icase': 1, - \ 'menu': get(l:item, 'detail', ''), + \ 'menu': l:detail, \ 'info': (type(l:doc) is v:t_string ? l:doc : ''), - \}) + \} + " This flag is used to tell if this completion came from ALE or not. + let l:user_data = {'_ale_completion_item': 1} + + if has_key(l:item, 'additionalTextEdits') + \ && l:item.additionalTextEdits isnot v:null + let l:text_changes = [] + + for l:edit in l:item.additionalTextEdits + call add(l:text_changes, { + \ 'start': { + \ 'line': l:edit.range.start.line + 1, + \ 'offset': l:edit.range.start.character + 1, + \ }, + \ 'end': { + \ 'line': l:edit.range.end.line + 1, + \ 'offset': l:edit.range.end.character + 1, + \ }, + \ 'newText': l:edit.newText, + \}) + endfor + + if !empty(l:text_changes) + let l:user_data.code_actions = [{ + \ 'description': 'completion', + \ 'changes': [ + \ { + \ 'fileName': expand('#' . l:buffer . ':p'), + \ 'textChanges': l:text_changes, + \ }, + \ ], + \}] + endif + endif + + let l:result.user_data = json_encode(l:user_data) + + " Include this item if we'll accept any items, + " or if we only want items with additional edits, and this has them. + if !get(l:info, 'additional_edits_only', 0) + \|| has_key(l:user_data, 'code_actions') + call add(l:results, l:result) + endif endfor if has_key(l:info, 'prefix') - let l:results = ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix) + let l:results = ale#completion#Filter( + \ l:buffer, + \ &filetype, + \ l:results, + \ l:info.prefix, + \ get(l:info, 'additional_edits_only', 0), + \) endif return l:results[: g:ale_completion_max_suggestions - 1] @@ -557,13 +691,18 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort \ &filetype, \ ale#completion#ParseTSServerCompletions(a:response), \ b:ale_completion_info.prefix, + \ get(b:ale_completion_info, 'additional_edits_only', 0), \)[: g:ale_completion_max_suggestions - 1] " We need to remember some names for tsserver, as it doesn't send " details back for everything we send. call setbufvar(l:buffer, 'ale_tsserver_completion_names', l:names) - if !empty(l:names) + if empty(l:names) + " Response with no results now and skip making a redundant request + " for nothing. + call ale#completion#Show([]) + else let l:identifiers = [] for l:name in l:names @@ -628,12 +767,17 @@ function! s:OnReady(linter, lsp_details) abort call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' + if get(g:, 'ale_completion_tsserver_autoimport') is 1 + execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.''' + endif + let l:message = ale#lsp#tsserver_message#Completions( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, \ b:ale_completion_info.prefix, - \ g:ale_completion_tsserver_autoimport, + \ get(b:ale_completion_info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \) else " Send a message saying the buffer has changed first, otherwise @@ -692,9 +836,19 @@ function! ale#completion#GetCompletions(...) abort let b:CompleteCallback = l:CompleteCallback endif - let [l:line, l:column] = getpos('.')[1:2] + if has_key(l:options, 'line') && has_key(l:options, 'column') + " Use a provided line and column, if given. + let l:line = l:options.line + let l:column = l:options.column + else + let [l:line, l:column] = getpos('.')[1:2] + endif - let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) + if has_key(l:options, 'prefix') + let l:prefix = l:options.prefix + else + let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) + endif if l:source is# 'ale-automatic' && empty(l:prefix) return 0 @@ -713,6 +867,11 @@ function! ale#completion#GetCompletions(...) abort \} unlet! b:ale_completion_result + if has_key(l:options, 'additional_edits_only') + let b:ale_completion_info.additional_edits_only = + \ l:options.additional_edits_only + endif + let l:buffer = bufnr('') let l:Callback = function('s:OnReady') @@ -729,6 +888,37 @@ function! ale#completion#GetCompletions(...) abort return l:started endfunction +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +" This function implements the :ALEImport command. +function! ale#completion#Import() abort + let l:word = expand('') + + if empty(l:word) + call s:message('Nothing to complete at cursor!') + + return + endif + + let [l:line, l:column] = getpos('.')[1:2] + let l:column = searchpos('\V' . escape(l:word, '/\'), 'bn', l:line)[1] + + if l:column isnot 0 + let l:started = ale#completion#GetCompletions('ale-import', { + \ 'line': l:line, + \ 'column': l:column, + \ 'prefix': l:word, + \ 'additional_edits_only': 1, + \}) + + if !l:started + call s:message('No completion providers are available.') + endif + endif +endfunction + function! ale#completion#OmniFunc(findstart, base) abort if a:findstart let l:started = ale#completion#GetCompletions('ale-omnifunc') @@ -802,29 +992,29 @@ function! ale#completion#Queue() abort endfunction function! ale#completion#HandleUserData(completed_item) abort - let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') - - if l:source isnot# 'ale-automatic' - \&& l:source isnot# 'ale-manual' - \&& l:source isnot# 'ale-callback' - return - endif - let l:user_data_json = get(a:completed_item, 'user_data', '') - - if empty(l:user_data_json) - return - endif - - let l:user_data = json_decode(l:user_data_json) + let l:user_data = !empty(l:user_data_json) + \ ? json_decode(l:user_data_json) + \ : v:null if type(l:user_data) isnot v:t_dict + \|| get(l:user_data, '_ale_completion_item', 0) isnot 1 return endif - for l:code_action in get(l:user_data, 'codeActions', []) - call ale#code_action#HandleCodeAction(l:code_action, v:false) - endfor + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' + \|| l:source is# 'ale-manual' + \|| l:source is# 'ale-callback' + \|| l:source is# 'ale-import' + \|| l:source is# 'ale-omnifunc' + for l:code_action in get(l:user_data, 'code_actions', []) + call ale#code_action#HandleCodeAction(l:code_action, {}) + endfor + endif + + silent doautocmd User ALECompletePost endfunction function! ale#completion#Done() abort @@ -836,6 +1026,8 @@ function! ale#completion#Done() abort endfunction augroup ALECompletionActions + autocmd! + autocmd CompleteDone * call ale#completion#HandleUserData(v:completed_item) augroup END diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index 8c331c5c..9ca6fb15 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -39,6 +39,8 @@ function! ale#cursor#TruncatedEcho(original_message) abort endif exec 'echomsg l:message' + catch /E481/ + " Do nothing if running from a visual selection. endtry " Reset the cursor position if we moved off the end of the line. diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index 4e134f8c..5e6d5906 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -8,6 +8,7 @@ let s:global_variable_list = [ \ 'ale_completion_delay', \ 'ale_completion_enabled', \ 'ale_completion_max_suggestions', +\ 'ale_disable_lsp', \ 'ale_echo_cursor', \ 'ale_echo_msg_error_str', \ 'ale_echo_msg_format', @@ -28,6 +29,7 @@ let s:global_variable_list = [ \ 'ale_linter_aliases', \ 'ale_linters', \ 'ale_linters_explicit', +\ 'ale_linters_ignore', \ 'ale_list_vertical', \ 'ale_list_window_size', \ 'ale_loclist_msg_format', @@ -196,6 +198,7 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort endfunction function! ale#debugging#Info() abort + let l:buffer = bufnr('') let l:filetype = &filetype " We get the list of enabled linters for free by the above function. @@ -222,10 +225,20 @@ function! ale#debugging#Info() abort let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1])) let l:fixers_string = join(map(copy(l:fixers), '"\n " . v:val'), '') + let l:non_ignored_names = map( + \ copy(ale#linter#RemoveIgnored(l:buffer, l:filetype, l:enabled_linters)), + \ 'v:val[''name'']', + \) + let l:ignored_names = filter( + \ copy(l:enabled_names), + \ 'index(l:non_ignored_names, v:val) < 0' + \) + call s:Echo(' Current Filetype: ' . l:filetype) call s:Echo('Available Linters: ' . string(l:all_names)) call s:EchoLinterAliases(l:all_linters) call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) + call s:Echo(' Ignored Linters: ' . string(l:ignored_names)) call s:Echo(' Suggested Fixers: ' . l:fixers_string) call s:Echo(' Linter Variables:') call s:Echo('') diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index ffcd9d10..0c1fb7cf 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -135,10 +135,6 @@ function! s:GoToLSPDefinition(linter, options, capability) abort endfunction function! ale#definition#GoTo(options) abort - if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command') - execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.''' - endif - for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) call s:GoToLSPDefinition(l:linter, a:options, 'definition') @@ -147,10 +143,6 @@ function! ale#definition#GoTo(options) abort endfunction function! ale#definition#GoToType(options) abort - if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command') - execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.''' - endif - for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) " TODO: handle typeDefinition for tsserver if supported by the diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 491d3c2e..3cafa25c 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -4,6 +4,7 @@ " Remapping of linter problems. let g:ale_type_map = get(g:, 'ale_type_map', {}) +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) if !has_key(s:, 'executable_cache_map') let s:executable_cache_map = {} @@ -104,42 +105,6 @@ function! ale#engine#IsCheckingBuffer(buffer) abort \ || !empty(get(l:info, 'active_other_sources_list', [])) endfunction -" Register a temporary file to be managed with the ALE engine for -" a current job run. -function! ale#engine#ManageFile(buffer, filename) abort - if !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom ''ale#engine#ManageFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - call ale#command#ManageFile(a:buffer, a:filename) -endfunction - -" Same as the above, but manage an entire directory. -function! ale#engine#ManageDirectory(buffer, directory) abort - if !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom ''ale#engine#ManageDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - call ale#command#ManageDirectory(a:buffer, a:directory) -endfunction - -function! ale#engine#CreateFile(buffer) abort - if !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom ''ale#engine#CreateFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - return ale#command#CreateFile(a:buffer) -endfunction - -" Create a new temporary directory and manage it in one go. -function! ale#engine#CreateDirectory(buffer) abort - if !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom ''ale#engine#CreateDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - return ale#command#CreateDirectory(a:buffer) -endfunction - function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) @@ -192,7 +157,6 @@ function! s:HandleExit(job_info, buffer, output, data) abort let l:linter = a:job_info.linter let l:executable = a:job_info.executable - let l:next_chain_index = a:job_info.next_chain_index " Remove this job from the list. call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name) @@ -207,20 +171,6 @@ function! s:HandleExit(job_info, buffer, output, data) abort call remove(a:output, -1) endif - if l:next_chain_index < len(get(l:linter, 'command_chain', [])) - let [l:command, l:options] = ale#engine#ProcessChain( - \ a:buffer, - \ l:executable, - \ l:linter, - \ l:next_chain_index, - \ a:output, - \) - - call s:RunJob(l:command, l:options) - - return - endif - try let l:loclist = ale#util#GetFunction(l:linter.callback)(a:buffer, a:output) " Handle the function being unknown, or being deleted. @@ -307,6 +257,13 @@ function! s:RemapItemTypes(type_map, loclist) abort endfunction function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) abort + let l:mappings = ale#GetFilenameMappings(a:buffer, a:linter_name) + + if !empty(l:mappings) + " We need to apply reverse filename mapping here. + let l:mappings = ale#filename_mapping#Invert(l:mappings) + endif + let l:bufnr_map = {} let l:new_loclist = [] @@ -347,13 +304,19 @@ function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) let l:item.code = l:old_item.code endif - if has_key(l:old_item, 'filename') - \&& !ale#path#IsTempName(l:old_item.filename) + let l:old_name = get(l:old_item, 'filename', '') + + " Map parsed from output to local filesystem files. + if !empty(l:old_name) && !empty(l:mappings) + let l:old_name = ale#filename_mapping#Map(l:old_name, l:mappings) + endif + + if !empty(l:old_name) && !ale#path#IsTempName(l:old_name) " Use the filename given. " Temporary files are assumed to be for this buffer, " and the filename is not included then, because it looks bad " in the loclist window. - let l:filename = l:old_item.filename + let l:filename = l:old_name let l:item.filename = l:filename if has_key(l:old_item, 'bufnr') @@ -454,20 +417,19 @@ function! s:RunJob(command, options) abort let l:buffer = a:options.buffer let l:linter = a:options.linter let l:output_stream = a:options.output_stream - let l:next_chain_index = a:options.next_chain_index - let l:read_buffer = a:options.read_buffer + let l:read_buffer = a:options.read_buffer && !a:options.lint_file let l:info = g:ale_buffer_info[l:buffer] let l:Callback = function('s:HandleExit', [{ \ 'linter': l:linter, \ 'executable': l:executable, - \ 'next_chain_index': l:next_chain_index, \}]) let l:result = ale#command#Run(l:buffer, l:command, l:Callback, { \ 'output_stream': l:output_stream, \ 'executable': l:executable, \ 'read_buffer': l:read_buffer, - \ 'log_output': l:next_chain_index >= len(get(l:linter, 'command_chain', [])), + \ 'log_output': 1, + \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:linter.name), \}) " Only proceed if the job is being run. @@ -482,69 +444,7 @@ function! s:RunJob(command, options) abort return 1 endfunction -" Determine which commands to run for a link in a command chain, or -" just a regular command. -function! ale#engine#ProcessChain(buffer, executable, linter, chain_index, input) abort - let l:output_stream = get(a:linter, 'output_stream', 'stdout') - let l:read_buffer = a:linter.read_buffer - let l:chain_index = a:chain_index - let l:input = a:input - - while l:chain_index < len(a:linter.command_chain) - " Run a chain of commands, one asynchronous command after the other, - " so that many programs can be run in a sequence. - let l:chain_item = a:linter.command_chain[l:chain_index] - - if l:chain_index == 0 - " The first callback in the chain takes only a buffer number. - let l:command = ale#util#GetFunction(l:chain_item.callback)( - \ a:buffer - \) - else - " The second callback in the chain takes some input too. - let l:command = ale#util#GetFunction(l:chain_item.callback)( - \ a:buffer, - \ l:input - \) - endif - - " If we have a command to run, execute that. - if !empty(l:command) - " The chain item can override the output_stream option. - if has_key(l:chain_item, 'output_stream') - let l:output_stream = l:chain_item.output_stream - endif - - " The chain item can override the read_buffer option. - if has_key(l:chain_item, 'read_buffer') - let l:read_buffer = l:chain_item.read_buffer - elseif l:chain_index != len(a:linter.command_chain) - 1 - " Don't read the buffer for commands besides the last one - " in the chain by default. - let l:read_buffer = 0 - endif - - break - endif - - " Command chain items can return an empty string to indicate that - " a command should be skipped, so we should try the next item - " with no input. - let l:input = [] - let l:chain_index += 1 - endwhile - - return [l:command, { - \ 'executable': a:executable, - \ 'buffer': a:buffer, - \ 'linter': a:linter, - \ 'output_stream': l:output_stream, - \ 'next_chain_index': l:chain_index + 1, - \ 'read_buffer': l:read_buffer, - \}] -endfunction - -function! s:StopCurrentJobs(buffer, clear_lint_file_jobs) abort +function! s:StopCurrentJobs(buffer, clear_lint_file_jobs, linter_slots) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) call ale#command#StopJobs(a:buffer, 'linter') @@ -553,11 +453,25 @@ function! s:StopCurrentJobs(buffer, clear_lint_file_jobs) abort call ale#command#StopJobs(a:buffer, 'file_linter') let l:info.active_linter_list = [] else + let l:lint_file_map = {} + + " Use a previously computed map of `lint_file` values to find + " linters that are used for linting files. + for [l:lint_file, l:linter] in a:linter_slots + if l:lint_file is 1 + let l:lint_file_map[l:linter.name] = 1 + endif + endfor + " Keep jobs for linting files when we're only linting buffers. - call filter(l:info.active_linter_list, 'get(v:val, ''lint_file'')') + call filter(l:info.active_linter_list, 'get(l:lint_file_map, v:val.name)') endif endfunction +function! ale#engine#Stop(buffer) abort + call s:StopCurrentJobs(a:buffer, 1, []) +endfunction + function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort " Figure out which linters are still enabled, and remove " problems for linters which are no longer enabled. @@ -608,10 +522,15 @@ function! s:AddProblemsFromOtherBuffers(buffer, linters) abort endif endfunction -function! s:RunIfExecutable(buffer, linter, executable) abort +function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort if ale#command#IsDeferred(a:executable) let a:executable.result_callback = { - \ executable -> s:RunIfExecutable(a:buffer, a:linter, executable) + \ executable -> s:RunIfExecutable( + \ a:buffer, + \ a:linter, + \ a:lint_file, + \ executable + \ ) \} return 1 @@ -619,29 +538,17 @@ function! s:RunIfExecutable(buffer, linter, executable) abort if ale#engine#IsExecutable(a:buffer, a:executable) " Use different job types for file or linter jobs. - let l:job_type = a:linter.lint_file ? 'file_linter' : 'linter' + let l:job_type = a:lint_file ? 'file_linter' : 'linter' call setbufvar(a:buffer, 'ale_job_type', l:job_type) - if has_key(a:linter, 'command_chain') - let [l:command, l:options] = ale#engine#ProcessChain( - \ a:buffer, - \ a:executable, - \ a:linter, - \ 0, - \ [] - \) - - return s:RunJob(l:command, l:options) - endif - let l:command = ale#linter#GetCommand(a:buffer, a:linter) let l:options = { \ 'executable': a:executable, \ 'buffer': a:buffer, \ 'linter': a:linter, \ 'output_stream': get(a:linter, 'output_stream', 'stdout'), - \ 'next_chain_index': 1, \ 'read_buffer': a:linter.read_buffer, + \ 'lint_file': a:lint_file, \} return s:RunJob(l:command, l:options) @@ -653,22 +560,73 @@ endfunction " Run a linter for a buffer. " " Returns 1 if the linter was successfully run. -function! s:RunLinter(buffer, linter) abort +function! s:RunLinter(buffer, linter, lint_file) abort if !empty(a:linter.lsp) return ale#lsp_linter#CheckWithLSP(a:buffer, a:linter) else let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) - return s:RunIfExecutable(a:buffer, a:linter, l:executable) + return s:RunIfExecutable(a:buffer, a:linter, a:lint_file, l:executable) endif return 0 endfunction -function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort - " Initialise the buffer information if needed. - let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) - call s:StopCurrentJobs(a:buffer, a:should_lint_file) +function! s:GetLintFileSlots(buffer, linters) abort + let l:linter_slots = [] + + for l:linter in a:linters + let l:LintFile = l:linter.lint_file + + if type(l:LintFile) is v:t_func + let l:LintFile = l:LintFile(a:buffer) + endif + + call add(l:linter_slots, [l:LintFile, l:linter]) + endfor + + return l:linter_slots +endfunction + +function! s:GetLintFileValues(slots, Callback) abort + let l:deferred_list = [] + let l:new_slots = [] + + for [l:lint_file, l:linter] in a:slots + while ale#command#IsDeferred(l:lint_file) && has_key(l:lint_file, 'value') + " If we've already computed the return value, use it. + let l:lint_file = l:lint_file.value + endwhile + + if ale#command#IsDeferred(l:lint_file) + " If we are going to return the result later, wait for it. + call add(l:deferred_list, l:lint_file) + else + " If we have the value now, coerce it to 0 or 1. + let l:lint_file = l:lint_file is 1 + endif + + call add(l:new_slots, [l:lint_file, l:linter]) + endfor + + if !empty(l:deferred_list) + for l:deferred in l:deferred_list + let l:deferred.result_callback = + \ {-> s:GetLintFileValues(l:new_slots, a:Callback)} + endfor + else + call a:Callback(l:new_slots) + endif +endfunction + +function! s:RunLinters( +\ buffer, +\ linters, +\ slots, +\ should_lint_file, +\ new_buffer, +\) abort + call s:StopCurrentJobs(a:buffer, a:should_lint_file, a:slots) call s:RemoveProblemsForDisabledLinters(a:buffer, a:linters) " We can only clear the results if we aren't checking the buffer. @@ -676,10 +634,10 @@ function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort silent doautocmd User ALELintPre - for l:linter in a:linters + for [l:lint_file, l:linter] in a:slots " Only run lint_file linters if we should. - if !l:linter.lint_file || a:should_lint_file - if s:RunLinter(a:buffer, l:linter) + if !l:lint_file || a:should_lint_file + if s:RunLinter(a:buffer, l:linter, l:lint_file) " If a single linter ran, we shouldn't clear everything. let l:can_clear_results = 0 endif @@ -694,11 +652,32 @@ function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort " disabled, or ALE itself is disabled. if l:can_clear_results call ale#engine#SetResults(a:buffer, []) - elseif l:new_buffer - call s:AddProblemsFromOtherBuffers(a:buffer, a:linters) + elseif a:new_buffer + call s:AddProblemsFromOtherBuffers( + \ a:buffer, + \ map(copy(a:slots), 'v:val[1]') + \) endif endfunction +function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort + " Initialise the buffer information if needed. + let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) + + call s:GetLintFileValues( + \ s:GetLintFileSlots(a:buffer, a:linters), + \ { + \ slots -> s:RunLinters( + \ a:buffer, + \ a:linters, + \ slots, + \ a:should_lint_file, + \ l:new_buffer, + \ ) + \ } + \) +endfunction + " Clean up a buffer. " " This function will stop all current jobs for the buffer, diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index da554ef9..3568c117 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -105,11 +105,11 @@ function! ale#events#Init() abort if g:ale_enabled if l:text_changed is? 'always' || l:text_changed is# '1' - autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay) + autocmd TextChanged,TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'normal' - autocmd TextChanged * call ale#Queue(g:ale_lint_delay) + autocmd TextChanged * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'insert' - autocmd TextChangedI * call ale#Queue(g:ale_lint_delay) + autocmd TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) endif if g:ale_lint_on_enter @@ -147,6 +147,10 @@ function! ale#events#Init() abort autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarning() | endif endif + if g:ale_hover_cursor + autocmd CursorHold * if exists('*ale#lsp#Send') | call ale#hover#ShowTruncatedMessageAtCursor() | endif + endif + if g:ale_close_preview_on_insert autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif endif diff --git a/sources_non_forked/ale/autoload/ale/filename_mapping.vim b/sources_non_forked/ale/autoload/ale/filename_mapping.vim new file mode 100644 index 00000000..76d47acc --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/filename_mapping.vim @@ -0,0 +1,22 @@ +" Author: w0rp +" Description: Logic for handling mappings between files + +" Invert filesystem mappings so they can be mapped in reverse. +function! ale#filename_mapping#Invert(filename_mappings) abort + return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]') +endfunction + +" Given a filename and some filename_mappings, map a filename. +function! ale#filename_mapping#Map(filename, filename_mappings) abort + let l:simplified_filename = ale#path#Simplify(a:filename) + + for [l:mapping_from, l:mapping_to] in a:filename_mappings + let l:mapping_from = ale#path#Simplify(l:mapping_from) + + if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from + return l:mapping_to . l:simplified_filename[len(l:mapping_from):] + endif + endfor + + return a:filename +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index 69817b36..c3338fc5 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -1,4 +1,8 @@ -call ale#Set('fix_on_save_ignore', {}) +" Author: w0rp +" Description: Functions for fixing code with programs, or other means. + +let g:ale_fix_on_save_ignore = get(g:, 'ale_fix_on_save_ignore', {}) +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. @@ -11,22 +15,29 @@ function! ale#fix#ApplyQueuedFixes(buffer) abort call remove(g:ale_fix_buffer_data, a:buffer) - if l:data.changes_made - let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output) + try + if l:data.changes_made + let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output) - if l:data.should_save - if a:buffer is bufnr('') - if empty(&buftype) - noautocmd :w! + if l:data.should_save + if a:buffer is bufnr('') + if empty(&buftype) + noautocmd :w! + else + set nomodified + endif else - set nomodified + call writefile(l:new_lines, expand('#' . a:buffer . ':p')) " no-custom-checks + call setbufvar(a:buffer, '&modified', 0) endif - else - call writefile(l:new_lines, expand('#' . a:buffer . ':p')) " no-custom-checks - call setbufvar(a:buffer, '&modified', 0) endif endif - endif + catch /E21/ + " If we cannot modify the buffer now, try again later. + let g:ale_fix_buffer_data[a:buffer] = l:data + + return + endtry if l:data.should_save let l:should_lint = ale#Var(a:buffer, 'fix_on_save') @@ -64,7 +75,10 @@ function! ale#fix#ApplyFixes(buffer, output) abort if l:data.lines_before != l:lines call remove(g:ale_fix_buffer_data, a:buffer) - execute 'echoerr ''The file was changed before fixing finished''' + + if !l:data.ignore_file_changed_errors + execute 'echoerr ''The file was changed before fixing finished''' + endif return endif @@ -90,7 +104,6 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort let l:output = a:job_output endif - let l:ChainCallback = get(a:job_info, 'chain_with', v:null) let l:ProcessWith = get(a:job_info, 'process_with', v:null) " Post-process the output with a function if we have one. @@ -102,27 +115,17 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort " otherwise skip this job and use the input from before. " " We'll use the input from before for chained commands. - if l:ChainCallback is v:null && !empty(split(join(l:output))) + if !empty(split(join(l:output))) let l:input = l:output else let l:input = a:job_info.input endif - if l:ChainCallback isnot v:null && !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom ''chain_with is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - let l:next_index = l:ChainCallback is v:null - \ ? a:job_info.callback_index + 1 - \ : a:job_info.callback_index - call s:RunFixer({ \ 'buffer': a:buffer, \ 'input': l:input, - \ 'output': l:output, \ 'callback_list': a:job_info.callback_list, - \ 'callback_index': l:next_index, - \ 'chain_callback': l:ChainCallback, + \ 'callback_index': a:job_info.callback_index + 1, \}) endfunction @@ -135,6 +138,7 @@ function! s:RunJob(result, options) abort let l:buffer = a:options.buffer let l:input = a:options.input + let l:fixer_name = a:options.fixer_name if a:result is 0 || type(a:result) is v:t_list if type(a:result) is v:t_list @@ -152,26 +156,21 @@ function! s:RunJob(result, options) abort endif let l:command = get(a:result, 'command', '') - let l:ChainWith = get(a:result, 'chain_with', v:null) if empty(l:command) - " If the command is empty, skip to the next item, or call the - " chain_with function. + " If the command is empty, skip to the next item. call s:RunFixer({ \ 'buffer': l:buffer, \ 'input': l:input, - \ 'callback_index': a:options.callback_index + (l:ChainWith is v:null), + \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, - \ 'chain_callback': l:ChainWith, - \ 'output': [], \}) return endif let l:read_temporary_file = get(a:result, 'read_temporary_file', 0) - " Default to piping the buffer for the last fixer in the chain. - let l:read_buffer = get(a:result, 'read_buffer', l:ChainWith is v:null) + let l:read_buffer = get(a:result, 'read_buffer', 1) let l:output_stream = get(a:result, 'output_stream', 'stdout') if l:read_temporary_file @@ -180,7 +179,6 @@ function! s:RunJob(result, options) abort let l:Callback = function('s:HandleExit', [{ \ 'input': l:input, - \ 'chain_with': l:ChainWith, \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, \ 'process_with': get(a:result, 'process_with', v:null), @@ -192,6 +190,7 @@ function! s:RunJob(result, options) abort \ 'read_buffer': l:read_buffer, \ 'input': l:input, \ 'log_output': 0, + \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:fixer_name), \}) if empty(l:run_result) @@ -215,32 +214,22 @@ function! s:RunFixer(options) abort return endif - let l:ChainCallback = get(a:options, 'chain_callback', v:null) - - let l:Function = l:ChainCallback isnot v:null - \ ? ale#util#GetFunction(l:ChainCallback) - \ : a:options.callback_list[l:index] + let [l:fixer_name, l:Function] = a:options.callback_list[l:index] " Record new jobs started as fixer jobs. call setbufvar(l:buffer, 'ale_job_type', 'fixer') - if l:ChainCallback isnot v:null - " Chained commands accept (buffer, output, [input]) - let l:result = ale#util#FunctionArgCount(l:Function) == 2 - \ ? call(l:Function, [l:buffer, a:options.output]) - \ : call(l:Function, [l:buffer, a:options.output, copy(l:input)]) - else - " Regular fixer commands accept (buffer, [input]) - let l:result = ale#util#FunctionArgCount(l:Function) == 1 - \ ? call(l:Function, [l:buffer]) - \ : call(l:Function, [l:buffer, copy(l:input)]) - endif + " Regular fixer commands accept (buffer, [input]) + let l:result = ale#util#FunctionArgCount(l:Function) == 1 + \ ? call(l:Function, [l:buffer]) + \ : call(l:Function, [l:buffer, copy(l:input)]) call s:RunJob(l:result, { \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_list': a:options.callback_list, \ 'callback_index': l:index, + \ 'fixer_name': l:fixer_name, \}) endfunction @@ -308,16 +297,24 @@ function! s:GetCallbacks(buffer, fixing_flag, fixers) abort " Variables with capital characters are needed, or Vim will complain about " funcref variables. for l:Item in l:callback_list + " Try to capture the names of registered fixer names, so we can use + " them for filename mapping or other purposes later. + let l:fixer_name = v:null + if type(l:Item) is v:t_string let l:Func = ale#fix#registry#GetFunc(l:Item) if !empty(l:Func) + let l:fixer_name = l:Item let l:Item = l:Func endif endif try - call add(l:corrected_list, ale#util#GetFunction(l:Item)) + call add(l:corrected_list, [ + \ l:fixer_name, + \ ale#util#GetFunction(l:Item) + \]) catch /E475/ " Rethrow exceptions for failing to get a function so we can print " a friendly message about it. @@ -335,6 +332,7 @@ function! ale#fix#InitBufferData(buffer, fixing_flag) abort \ 'lines_before': getbufline(a:buffer, 1, '$'), \ 'done': 0, \ 'should_save': a:fixing_flag is# 'save_file', + \ 'ignore_file_changed_errors': a:fixing_flag is# '!', \ 'temporary_directory_list': [], \} endfunction @@ -343,19 +341,23 @@ endfunction " " Returns 0 if no fixes can be applied, and 1 if fixing can be done. function! ale#fix#Fix(buffer, fixing_flag, ...) abort - if a:fixing_flag isnot# '' && a:fixing_flag isnot# 'save_file' - throw "fixing_flag must be either '' or 'save_file'" + if a:fixing_flag isnot# '' + \&& a:fixing_flag isnot# '!' + \&& a:fixing_flag isnot# 'save_file' + throw "fixing_flag must be '', '!', or 'save_file'" endif try let l:callback_list = s:GetCallbacks(a:buffer, a:fixing_flag, a:000) catch /E700\|BADNAME/ - let l:function_name = join(split(split(v:exception, ':')[3])) - let l:echo_message = printf( - \ 'There is no fixer named `%s`. Check :ALEFixSuggest', - \ l:function_name, - \) - execute 'echom l:echo_message' + if a:fixing_flag isnot# '!' + let l:function_name = join(split(split(v:exception, ':')[3])) + let l:echo_message = printf( + \ 'There is no fixer named `%s`. Check :ALEFixSuggest', + \ l:function_name, + \) + execute 'echom l:echo_message' + endif return 0 endtry @@ -389,3 +391,4 @@ endfunction augroup ALEBufferFixGroup autocmd! autocmd BufEnter * call ale#fix#ApplyQueuedFixes(str2nr(expand(''))) +augroup END diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 1b3ca1a8..0f146faa 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -12,6 +12,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['help'], \ 'description': 'Align help tags to the right margin', \ }, +\ 'autoimport': { +\ 'function': 'ale#fixers#autoimport#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix import issues with autoimport.', +\ }, \ 'autopep8': { \ 'function': 'ale#fixers#autopep8#Fix', \ 'suggested_filetypes': ['python'], @@ -105,6 +110,11 @@ let s:default_registry = { \ 'suggested_filetypes': [], \ 'description': 'Remove all trailing whitespace characters at the end of every line.', \ }, +\ 'yamlfix': { +\ 'function': 'ale#fixers#yamlfix#Fix', +\ 'suggested_filetypes': ['yaml'], +\ 'description': 'Fix yaml files with yamlfix.', +\ }, \ 'yapf': { \ 'function': 'ale#fixers#yapf#Fix', \ 'suggested_filetypes': ['python'], @@ -160,6 +170,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with php-cs-fixer.', \ }, +\ 'astyle': { +\ 'function': 'ale#fixers#astyle#Fix', +\ 'suggested_filetypes': ['c', 'cpp'], +\ 'description': 'Fix C/C++ with astyle.', +\ }, \ 'clangtidy': { \ 'function': 'ale#fixers#clangtidy#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'objc'], @@ -360,11 +375,31 @@ let s:default_registry = { \ 'suggested_filetypes': ['nix'], \ 'description': 'A formatter for Nix code', \ }, +\ 'remark-lint': { +\ 'function': 'ale#fixers#remark_lint#Fix', +\ 'suggested_filetypes': ['markdown'], +\ 'description': 'Fix markdown files with remark-lint', +\ }, \ 'html-beautify': { \ 'function': 'ale#fixers#html_beautify#Fix', \ 'suggested_filetypes': ['html', 'htmldjango'], \ 'description': 'Fix HTML files with html-beautify.', \ }, +\ 'luafmt': { +\ 'function': 'ale#fixers#luafmt#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with luafmt.', +\ }, +\ 'dhall': { +\ 'function': 'ale#fixers#dhall#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Fix Dhall files with dhall-format.', +\ }, +\ 'ormolu': { +\ 'function': 'ale#fixers#ormolu#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'A formatter for Haskell source code.', +\ }, \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/astyle.vim b/sources_non_forked/ale/autoload/ale/fixers/astyle.vim new file mode 100644 index 00000000..3a5a70a1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/astyle.vim @@ -0,0 +1,59 @@ +" Author: James Kim +" Description: Fix C/C++ files with astyle. + +function! s:set_variables() abort + for l:ft in ['c', 'cpp'] + call ale#Set(l:ft . '_astyle_executable', 'astyle') + call ale#Set(l:ft . '_astyle_project_options', '') + endfor +endfunction + +call s:set_variables() + + +function! ale#fixers#astyle#Var(buffer, name) abort + let l:ft = getbufvar(str2nr(a:buffer), '&filetype') + let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' + + return ale#Var(a:buffer, l:ft . '_astyle_' . a:name) +endfunction + +" Try to find a project options file. +function! ale#fixers#astyle#FindProjectOptions(buffer) abort + let l:proj_options = ale#fixers#astyle#Var(a:buffer, 'project_options') + + " If user has set project options variable then use it and skip any searching. + " This would allow users to use project files named differently than .astylerc. + if !empty(l:proj_options) + return l:proj_options + endif + + " Try to find nearest .astylerc file. + let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '.astylerc'), ':t') + + if !empty(l:proj_options) + return l:proj_options + endif + + " Try to find nearest _astylerc file. + let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '_astylerc'), ':t') + + if !empty(l:proj_options) + return l:proj_options + endif + + " If no project options file is found return an empty string. + return '' +endfunction + +function! ale#fixers#astyle#Fix(buffer) abort + let l:executable = ale#fixers#astyle#Var(a:buffer, 'executable') + let l:proj_options = ale#fixers#astyle#FindProjectOptions(a:buffer) + let l:command = ' --stdin=' . ale#Escape(expand('#' . a:buffer)) + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:proj_options) ? '' : ' --project=' . l:proj_options) + \ . l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim new file mode 100644 index 00000000..37a52db8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim @@ -0,0 +1,25 @@ +" Author: lyz-code +" Description: Fixing Python imports with autoimport. + +call ale#Set('python_autoimport_executable', 'autoimport') +call ale#Set('python_autoimport_options', '') +call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#autoimport#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'python_autoimport_options') + + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_autoimport', + \ ['autoimport'], + \) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall.vim new file mode 100644 index 00000000..18f6006c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall.vim @@ -0,0 +1,23 @@ +" Author: Pat Brisbin +" Description: Integration of dhall-format with ALE. + +call ale#Set('dhall_format_executable', 'dhall') + +function! ale#fixers#dhall#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'dhall_format_executable') + + " Dhall is written in Haskell and commonly installed with Stack + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') +endfunction + +function! ale#fixers#dhall#Fix(buffer) abort + let l:executable = ale#fixers#dhall#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' format' + \ . ' --inplace' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index 62e692b1..f725875c 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -53,7 +53,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort " Use --fix-to-stdout with eslint_d if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { - \ 'command': ale#node#Executable(a:buffer, l:executable) + \ 'command': ale#handlers#eslint#GetCdString(a:buffer) + \ . ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-to-stdout', \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', @@ -63,7 +64,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort " 4.9.0 is the first version with --fix-dry-run if ale#semver#GTE(a:version, [4, 9, 0]) return { - \ 'command': ale#node#Executable(a:buffer, l:executable) + \ 'command': ale#handlers#eslint#GetCdString(a:buffer) + \ . ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', @@ -71,7 +73,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort endif return { - \ 'command': ale#node#Executable(a:buffer, l:executable) + \ 'command': ale#handlers#eslint#GetCdString(a:buffer) + \ . ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' --fix %t', diff --git a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim index d5a539b9..b9cfbb58 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim @@ -11,9 +11,6 @@ function! ale#fixers#gofmt#Fix(buffer) abort return { \ 'command': l:env . ale#Escape(l:executable) - \ . ' -l -w' \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim b/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim index cb975d6c..64d1340d 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim @@ -3,7 +3,6 @@ function! ale#fixers#ktlint#Fix(buffer) abort return { - \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format', - \ 'read_temporary_file': 1, + \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim index b0a0884a..54f1231e 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim @@ -10,9 +10,7 @@ function! ale#fixers#latexindent#Fix(buffer) abort return { \ 'command': ale#Escape(l:executable) - \ . ' -l -w' + \ . ' -l' \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim b/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim new file mode 100644 index 00000000..6cb9ef4a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim @@ -0,0 +1,13 @@ +call ale#Set('lua_luafmt_executable', 'luafmt') +call ale#Set('lua_luafmt_options', '') + +function! ale#fixers#luafmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_luafmt_executable') + let l:options = ale#Var(a:buffer, 'lua_luafmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --stdin', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim index 9b7c3e12..b12d2eb9 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim @@ -5,14 +5,13 @@ 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) - \ . ' --name=' . ale#Escape(l:filename) + \ . ' --name=%s' \ . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim b/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim new file mode 100644 index 00000000..69b55c1f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim @@ -0,0 +1,12 @@ +call ale#Set('haskell_ormolu_executable', 'ormolu') +call ale#Set('haskell_ormolu_options', '') + +function! ale#fixers#ormolu#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_ormolu_executable') + let l:options = ale#Var(a:buffer, 'haskell_ormolu_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim index f14b8406..0a61c657 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim @@ -2,6 +2,7 @@ " Description: Fixing files with phpcbf. call ale#Set('php_phpcbf_standard', '') +call ale#Set('php_phpcbf_options', '') call ale#Set('php_phpcbf_executable', 'phpcbf') call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0)) @@ -20,6 +21,6 @@ function! ale#fixers#phpcbf#Fix(buffer) abort \ : '' return { - \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -' + \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ale#Pad(ale#Var(a:buffer, 'php_phpcbf_options')) . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index 23120777..e0f4972e 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -34,6 +34,21 @@ function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort return a:output endfunction +function! ale#fixers#prettier#GetProjectRoot(buffer) abort + let l:config = ale#path#FindNearestFile(a:buffer, '.prettierignore') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + " Fall back to the directory of the buffer + return fnamemodify(bufname(a:buffer), ':p:h') +endfunction + +function! ale#fixers#prettier#CdProjectRoot(buffer) abort + return ale#path#CdString(ale#fixers#prettier#GetProjectRoot(a:buffer)) +endfunction + function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_prettier_options') @@ -97,7 +112,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort " 1.4.0 is the first version with --stdin-filepath if ale#semver#GTE(a:version, [1, 4, 0]) return { - \ 'command': ale#path#BufferCdString(a:buffer) + \ 'command': ale#fixers#prettier#CdProjectRoot(a:buffer) \ . ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim index b6e0a6f9..9d982ff6 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim @@ -17,8 +17,8 @@ function! ale#fixers#prettier_standard#Fix(buffer) abort return { \ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer)) - \ . ' %t' + \ . ' --stdin' + \ . ' --stdin-filepath=%s' \ . ' ' . l:options, - \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim new file mode 100644 index 00000000..3ce442f3 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim @@ -0,0 +1,24 @@ +" Author: blyoa +" Description: Fixing files with remark-lint. + +call ale#Set('markdown_remark_lint_executable', 'remark') +call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('markdown_remark_lint_options', '') + +function! ale#fixers#remark_lint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [ + \ 'node_modules/remark-cli/cli.js', + \ 'node_modules/.bin/remark', + \]) +endfunction + +function! ale#fixers#remark_lint#Fix(buffer) abort + let l:executable = ale#fixers#remark_lint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : ''), + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim index 0c7441e4..cdfb014a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim @@ -1,20 +1,40 @@ call ale#Set('ruby_rubocop_options', '') +call ale#Set('ruby_rubocop_auto_correct_all', 0) call ale#Set('ruby_rubocop_executable', 'rubocop') +" Rubocop fixer outputs diagnostics first and then the fixed +" output. These are delimited by a "=======" string that we +" look for to remove everything before it. +function! ale#fixers#rubocop#PostProcess(buffer, output) abort + let l:line = 0 + + for l:output in a:output + let l:line = l:line + 1 + + if l:output =~# "^=\\+$" + break + endif + endfor + + return a:output[l:line :] +endfunction + function! ale#fixers#rubocop#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') + let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all') return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --auto-correct --force-exclusion %t' + \ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct') + \ . ' --force-exclusion --stdin %s' endfunction function! ale#fixers#rubocop#Fix(buffer) abort return { \ 'command': ale#fixers#rubocop#GetCommand(a:buffer), - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/standard.vim b/sources_non_forked/ale/autoload/ale/fixers/standard.vim index cffa9f9d..46decebf 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/standard.vim @@ -27,7 +27,7 @@ function! ale#fixers#standard#Fix(buffer) abort return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix %t', + \ . ' --fix --stdin < %s > %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/tslint.vim b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim index b352af3a..15768fd5 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/tslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim @@ -16,7 +16,7 @@ function! ale#fixers#tslint#Fix(buffer) abort return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . l:tslint_config_option - \ . ' --fix %t', + \ . ' --outputAbsolutePaths --fix %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim new file mode 100644 index 00000000..966556c9 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim @@ -0,0 +1,25 @@ +" Author: lyz-code +" Description: Fixing yaml files with yamlfix. + +call ale#Set('yaml_yamlfix_executable', 'yamlfix') +call ale#Set('yaml_yamlfix_options', '') +call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#yamlfix#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options') + + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'yaml_yamlfix', + \ ['yamlfix'], + \) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim index 1e2aa318..290f5852 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim @@ -17,3 +17,10 @@ function! ale#handlers#ccls#GetProjectRoot(buffer) abort " Fall back on default project root detection. return ale#c#FindProjectRoot(a:buffer) endfunction + +function! ale#handlers#ccls#GetInitOpts(buffer, init_options_var) abort + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:init_options = empty(l:build_dir) ? {} : {'compilationDatabaseDirectory': l:build_dir} + + return extend(l:init_options, ale#Var(a:buffer, a:init_options_var)) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim index 6d8fa15d..7f68ba67 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -44,16 +44,21 @@ endfunction function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort " Look for lines like the following. " - " [test.cpp:5]: (error) Array 'a[10]' accessed at index 10, which is out of bounds - let l:pattern = '\v^\[(.+):(\d+)\]: \(([a-z]+)\) (.+)$' + "test.cpp:974:6: error: Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ + " n[3]=3; + " ^ + let l:pattern = '\v^(\f+):(\d+):(\d+): (\w+): (.*) \[(\w+)\]\' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { - \ 'lnum': str2nr(l:match[2]), - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \ 'text': l:match[4], + \ 'lnum': str2nr(l:match[2]), + \ 'col': str2nr(l:match[3]), + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'sub_type': l:match[4] is# 'style' ? 'style' : '', + \ 'text': l:match[5], + \ 'code': l:match[6] \}) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index 156b939f..b8610612 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -1,6 +1,12 @@ " Author: w0rp " Description: Functions for working with eslint, for checking or fixing files. +let s:executables = [ +\ 'node_modules/.bin/eslint_d', +\ 'node_modules/eslint/bin/eslint.js', +\ 'node_modules/.bin/eslint', +\ '.yarn/sdks/eslint/bin/eslint', +\] let s:sep = has('win32') ? '\' : '/' call ale#Set('javascript_eslint_options', '') @@ -30,11 +36,31 @@ function! ale#handlers#eslint#FindConfig(buffer) abort endfunction function! ale#handlers#eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [ - \ 'node_modules/.bin/eslint_d', - \ 'node_modules/eslint/bin/eslint.js', - \ 'node_modules/.bin/eslint', - \]) + return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables) +endfunction + +" Given a buffer, return a command prefix string which changes directory +" as necessary for running ESLint. +function! ale#handlers#eslint#GetCdString(buffer) abort + " ESLint 6 loads plugins/configs/parsers from the project root + " By default, the project root is simply the CWD of the running process. + " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md + " https://github.com/dense-analysis/ale/issues/2787 + " + " If eslint is installed in a directory which contains the buffer, assume + " it is the ESLint project root. Otherwise, use nearest node_modules. + " Note: If node_modules not present yet, can't load local deps anyway. + let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + + if !empty(l:executable) + let l:nmi = strridx(l:executable, 'node_modules') + let l:project_dir = l:executable[0:l:nmi - 2] + else + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') + let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + endif + + return !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : '' endfunction function! ale#handlers#eslint#GetCommand(buffer) abort @@ -42,17 +68,7 @@ function! ale#handlers#eslint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'javascript_eslint_options') - " ESLint 6 loads plugins/configs/parsers from the project root - " By default, the project root is simply the CWD of the running process. - " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md - " https://github.com/dense-analysis/ale/issues/2787 - " Identify project root from presence of node_modules dir. - " Note: If node_modules not present yet, can't load local deps anyway. - let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') - let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' - let l:cd_command = !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : '' - - return l:cd_command + return ale#handlers#eslint#GetCdString(a:buffer) \ . ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f json --stdin --stdin-filename %s' diff --git a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim index ec16b977..0b37c98a 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim @@ -10,7 +10,7 @@ let s:pragma_error = '#pragma once in main file' " :8:5: warning: conversion lacks type at end of format [-Wformat=] " :10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] -let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' +let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$' let s:inline_pattern = '\v inlined from .* at \:(\d+):(\d+):$' function! s:IsHeaderFile(filename) abort @@ -117,6 +117,23 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort if !empty(l:output) if !has_key(l:output[-1], 'detail') let l:output[-1].detail = l:output[-1].text + + " handle macro expansion errors/notes + if l:match[5] =~? '^in expansion of macro ‘\w*\w’$' + " if the macro expansion is in the file we're in, add + " the lnum and col keys to the previous error + if l:match[1] is# '' + \ && !has_key(l:output[-1], 'col') + let l:output[-1].lnum = str2nr(l:match[2]) + let l:output[-1].col = str2nr(l:match[3]) + else + " the error is not in the current file, and since + " macro expansion errors don't show the full path to + " the error from the current file, we have to just + " give out a generic error message + let l:output[-1].text = 'Error found in macro expansion. See :ALEDetail' + endif + endif endif let l:output[-1].detail = l:output[-1].detail . "\n" diff --git a/sources_non_forked/ale/autoload/ale/handlers/go.vim b/sources_non_forked/ale/autoload/ale/handlers/go.vim index f17cd862..c969669d 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/go.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/go.vim @@ -6,9 +6,12 @@ " " Author: Ben Paxton " Description: moved to generic Golang file from govet +" +" Author: mostfunkyduck +" Description: updated to work with go 1.14 function! ale#handlers#go#Handler(buffer, lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' + let l:pattern = '\v^%(vet: )?([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') diff --git a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim new file mode 100644 index 00000000..36dbd259 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim @@ -0,0 +1,71 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#Set('hdl_checker_executable', 'hdl_checker') +call ale#Set('hdl_checker_config_file', has('unix') ? '.hdl_checker.config' : '_hdl_checker.config') +call ale#Set('hdl_checker_options', '') + +" Use this as a function so we can mock it on testing. Need to do this because +" test files are inside /testplugin (which refers to the ale repo), which will +" always have a .git folder +function! ale#handlers#hdl_checker#IsDotGit(path) abort + return ! empty(a:path) && isdirectory(a:path) +endfunction + +" Sould return (in order of preference) +" 1. Nearest config file +" 2. Nearest .git directory +" 3. The current path +function! ale#handlers#hdl_checker#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile( + \ a:buffer, + \ ale#Var(a:buffer, 'hdl_checker_config_file')) + + if !empty(l:project_root) + return fnamemodify(l:project_root, ':h') + endif + + " Search for .git to use as root + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + + if ale#handlers#hdl_checker#IsDotGit(l:project_root) + return fnamemodify(l:project_root, ':h:h') + endif +endfunction + +function! ale#handlers#hdl_checker#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'hdl_checker_executable') +endfunction + +function! ale#handlers#hdl_checker#GetCommand(buffer) abort + let l:command = ale#Escape(ale#handlers#hdl_checker#GetExecutable(a:buffer)) . ' --lsp' + + " Add extra parameters only if config has been set + let l:options = ale#Var(a:buffer, 'hdl_checker_options') + + if ! empty(l:options) + let l:command = l:command . ' ' . l:options + endif + + return l:command +endfunction + +" To allow testing +function! ale#handlers#hdl_checker#GetInitOptions(buffer) abort + return {'project_file': ale#Var(a:buffer, 'hdl_checker_config_file')} +endfunction + +" Define the hdl_checker linter for a given filetype. +function! ale#handlers#hdl_checker#DefineLinter(filetype) abort + call ale#linter#Define(a:filetype, { + \ 'name': 'hdl-checker', + \ 'lsp': 'stdio', + \ 'language': a:filetype, + \ 'executable': function('ale#handlers#hdl_checker#GetExecutable'), + \ 'command': function('ale#handlers#hdl_checker#GetCommand'), + \ 'project_root': function('ale#handlers#hdl_checker#GetProjectRoot'), + \ 'initialization_options': function('ale#handlers#hdl_checker#GetInitOptions'), + \ }) +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim b/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim index ad999485..77e7ab66 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim @@ -13,7 +13,7 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort return ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . (empty(l:rulesets) ? '' : ' ' . l:rulesets) - \ . ' %t' + \ . ' --stdin' endfunction function! ale#handlers#ktlint#GetRulesets(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim index daaa1d66..6c273bd0 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim @@ -2,15 +2,22 @@ " Description: Adds support for markdownlint function! ale#handlers#markdownlint#Handle(buffer, lines) abort - let l:pattern=': \(\d*\): \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-]\+\)\(.*\)$' + let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$' let l:output=[] for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { + let l:result = ({ \ 'lnum': l:match[1] + 0, - \ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5], + \ 'code': l:match[4], + \ 'text': l:match[5], \ 'type': 'W', \}) + + if len(l:match[3]) > 0 + let l:result.col = (l:match[3] + 0) + endif + + call add(l:output, l:result) endfor return l:output diff --git a/sources_non_forked/ale/autoload/ale/handlers/sh.vim b/sources_non_forked/ale/autoload/ale/handlers/sh.vim index 75eaf71f..6ed9fea3 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/sh.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/sh.vim @@ -1,20 +1,37 @@ " Author: w0rp -" Get the shell type for a buffer, based on the hashbang line. function! ale#handlers#sh#GetShellType(buffer) abort - let l:bang_line = get(getbufline(a:buffer, 1), 0, '') + let l:shebang = get(getbufline(a:buffer, 1), 0, '') - " Take the shell executable from the hashbang, if we can. - if l:bang_line[:1] is# '#!' + let l:command = '' + + " Take the shell executable from the shebang, if we can. + if l:shebang[:1] is# '#!' " Remove options like -e, etc. - let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g') - - for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] - if l:command =~# l:possible_shell . '\s*$' - return l:possible_shell - endif - endfor + let l:command = substitute(l:shebang, ' --\?[a-zA-Z0-9]\+', '', 'g') endif + " With no shebang line, attempt to use Vim's buffer-local variables. + if l:command is# '' + if getbufvar(a:buffer, 'is_bash', 0) + let l:command = 'bash' + elseif getbufvar(a:buffer, 'is_sh', 0) + let l:command = 'sh' + elseif getbufvar(a:buffer, 'is_kornshell', 0) + let l:command = 'ksh' + endif + endif + + " If we couldn't find a shebang, try the filetype + if l:command is# '' + let l:command = &filetype + endif + + for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] + if l:command =~# l:possible_shell . '\s*$' + return l:possible_shell + endif + endfor + return '' endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim index b16280f0..701c43b2 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim @@ -1,8 +1,32 @@ " Author: w0rp " Description: This file adds support for using the shellcheck linter +" Shellcheck supports shell directives to define the shell dialect for scripts +" that do not have a shebang for some reason. +" https://github.com/koalaman/shellcheck/wiki/Directive#shell +function! ale#handlers#shellcheck#GetShellcheckDialectDirective(buffer) abort + let l:linenr = 0 + let l:pattern = '\s\{-}#\s\{-}shellcheck\s\{-}shell=\(.*\)' + let l:possible_shell = ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] + + while l:linenr < min([50, line('$')]) + let l:linenr += 1 + let l:match = matchlist(getline(l:linenr), l:pattern) + + if len(l:match) > 1 && index(l:possible_shell, l:match[1]) >= 0 + return l:match[1] + endif + endwhile + + return '' +endfunction + function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort - let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + let l:shell_type = ale#handlers#shellcheck#GetShellcheckDialectDirective(a:buffer) + + if empty(l:shell_type) + let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + endif if !empty(l:shell_type) " Use the dash dialect for /bin/ash, etc. @@ -13,15 +37,6 @@ function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort return l:shell_type endif - " If there's no hashbang, try using Vim's buffer variables. - if getbufvar(a:buffer, 'is_bash', 0) - return 'bash' - elseif getbufvar(a:buffer, 'is_sh', 0) - return 'sh' - elseif getbufvar(a:buffer, 'is_kornshell', 0) - return 'ksh' - endif - return '' endfunction diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 8fdd288c..1d38f3b9 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -24,6 +24,8 @@ 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 + let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') + " 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) @@ -40,8 +42,10 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort endif elseif get(l:options, 'hover_from_balloonexpr', 0) \&& exists('*balloon_show') - \&& ale#Var(l:options.buffer, 'set_balloons') + \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') call balloon_show(a:response.body.displayString) + elseif get(l:options, 'truncated_echo', 0) + call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0]) elseif g:ale_hover_to_preview call ale#preview#Show(split(a:response.body.displayString, "\n"), { \ 'filetype': 'ale-preview.message', @@ -54,6 +58,137 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort endif endfunction +" Convert a language name to another one. +" The language name could be an empty string or v:null +function! s:ConvertLanguageName(language) abort + return a:language +endfunction + +function! ale#hover#ParseLSPResult(contents) abort + let l:includes = {} + let l:highlights = [] + let l:lines = [] + let l:list = type(a:contents) is v:t_list ? a:contents : [a:contents] + let l:region_index = 0 + + for l:item in l:list + if !empty(l:lines) + call add(l:lines, '') + endif + + if type(l:item) is v:t_dict && has_key(l:item, 'kind') + if l:item.kind is# 'markdown' + " Handle markdown values as we handle strings below. + let l:item = get(l:item, 'value', '') + elseif l:item.kind is# 'plaintext' + " We shouldn't try to parse plaintext as markdown. + " Pass the lines on and skip parsing them. + call extend(l:lines, split(get(l:item, 'value', ''), "\n")) + + continue + endif + endif + + let l:marked_list = [] + + " If the item is a string, then we should parse it as Markdown text. + if type(l:item) is v:t_string + let l:fence_language = v:null + let l:fence_lines = [] + + for l:line in split(l:item, "\n") + if l:fence_language is v:null + " Look for the start of a code fence. (```python, etc.) + let l:match = matchlist(l:line, '^```\(.*\)$') + + if !empty(l:match) + let l:fence_language = l:match[1] + + if !empty(l:marked_list) + call add(l:fence_lines, '') + endif + else + if !empty(l:marked_list) + \&& l:marked_list[-1][0] isnot v:null + call add(l:marked_list, [v:null, ['']]) + endif + + call add(l:marked_list, [v:null, [l:line]]) + endif + elseif l:line =~# '^```$' + " When we hit the end of a code fence, pass the fenced + " lines on to the next steps below. + call add(l:marked_list, [l:fence_language, l:fence_lines]) + let l:fence_language = v:null + let l:fence_lines = [] + else + " Gather lines inside of a code fence. + call add(l:fence_lines, l:line) + endif + endfor + " If the result from the LSP server is a {language: ..., value: ...} + " Dictionary, then that should be interpreted as if it was: + " + " ```${language} + " ${value} + " ``` + elseif type(l:item) is v:t_dict + \&& has_key(l:item, 'language') + \&& type(l:item.language) is v:t_string + \&& has_key(l:item, 'value') + \&& type(l:item.value) is v:t_string + call add( + \ l:marked_list, + \ [l:item.language, split(l:item.value, "\n")], + \) + endif + + for [l:language, l:marked_lines] in l:marked_list + if l:language is v:null + " NOTE: We could handle other Markdown formatting here. + call map( + \ l:marked_lines, + \ 'substitute(v:val, ''\\_'', ''_'', ''g'')', + \) + else + let l:language = s:ConvertLanguageName(l:language) + + if !empty(l:language) + let l:includes[l:language] = printf( + \ 'syntax/%s.vim', + \ l:language, + \) + + let l:start = len(l:lines) + 1 + let l:end = l:start + len(l:marked_lines) + let l:region_index += 1 + + call add(l:highlights, 'syntax region' + \ . ' ALE_hover_' . l:region_index + \ . ' start=/\%' . l:start . 'l/' + \ . ' end=/\%' . l:end . 'l/' + \ . ' contains=@ALE_hover_' . l:language + \) + endif + endif + + call extend(l:lines, l:marked_lines) + endfor + endfor + + let l:include_commands = [] + + for [l:language, l:lang_path] in sort(items(l:includes)) + call add(l:include_commands, 'unlet! b:current_syntax') + call add( + \ l:include_commands, + \ printf('syntax include @ALE_hover_%s %s', l:language, l:lang_path), + \) + endfor + + return [l:include_commands + l:highlights, l:lines] +endfunction + function! ale#hover#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:hover_map, a:response.id) @@ -80,37 +215,27 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort return endif - let l:result = l:result.contents + let [l:commands, l:lines] = ale#hover#ParseLSPResult(l:result.contents) - if type(l:result) is v:t_string - " The result can be just a string. - let l:result = [l:result] - endif + if !empty(l:lines) + let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') - if type(l:result) is v:t_dict - " If the result is an object, then it's markup content. - let l:result = [l:result.value] - endif - - if type(l:result) is v:t_list - " Replace objects with text values. - call map(l:result, 'type(v:val) is v:t_string ? v:val : v:val.value') - let l:str = join(l:result, "\n") - let l:str = substitute(l:str, '^\s*\(.\{-}\)\s*$', '\1', '') - - if !empty(l:str) - if get(l:options, 'hover_from_balloonexpr', 0) - \&& exists('*balloon_show') - \&& ale#Var(l:options.buffer, 'set_balloons') - call balloon_show(l:str) - elseif g:ale_hover_to_preview - call ale#preview#Show(split(l:str, "\n"), { - \ 'filetype': 'ale-preview.message', - \ 'stay_here': 1, - \}) - else - call ale#util#ShowMessage(l:str) - endif + if get(l:options, 'hover_from_balloonexpr', 0) + \&& exists('*balloon_show') + \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') + call balloon_show(join(l:lines, "\n")) + elseif get(l:options, 'truncated_echo', 0) + call ale#cursor#TruncatedEcho(l:lines[0]) + elseif g:ale_hover_to_preview + call ale#preview#Show(l:lines, { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \ 'commands': l:commands, + \}) + else + call ale#util#ShowMessage(join(l:lines, "\n"), { + \ 'commands': l:commands, + \}) endif endif endif @@ -143,7 +268,10 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort " hover position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) - let l:column = min([a:column, len(getbufline(l:buffer, a:line)[0])]) + let l:column = max([ + \ min([a:column, len(getbufline(l:buffer, a:line)[0])]), + \ 1, + \]) let l:message = ale#lsp#message#Hover(l:buffer, a:line, l:column) endif @@ -156,6 +284,7 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort \ 'column': l:column, \ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0), \ 'show_documentation': get(a:opt, 'show_documentation', 0), + \ 'truncated_echo': get(a:opt, 'truncated_echo', 0), \} endfunction @@ -181,6 +310,8 @@ function! ale#hover#Show(buffer, line, col, opt) abort endfor endfunction +let s:last_pos = [0, 0, 0] + " This function implements the :ALEHover command. function! ale#hover#ShowAtCursor() abort let l:buffer = bufnr('') @@ -189,6 +320,25 @@ function! ale#hover#ShowAtCursor() abort call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {}) endfunction +function! ale#hover#ShowTruncatedMessageAtCursor() abort + let l:buffer = bufnr('') + let l:pos = getpos('.')[0:2] + + if l:pos != s:last_pos + let s:last_pos = l:pos + let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) + + if empty(l:loc) + call ale#hover#Show( + \ l:buffer, + \ l:pos[1], + \ l:pos[2], + \ {'truncated_echo': 1}, + \) + endif + endif +endfunction + " This function implements the :ALEDocumentation command. function! ale#hover#ShowDocumentationAtCursor() abort let l:buffer = bufnr('') diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index a85f06e2..645c25f9 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -14,6 +14,7 @@ let s:default_ale_linter_aliases = { \ 'csh': 'sh', \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', +\ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', \ 'systemverilog': 'verilog', @@ -31,7 +32,7 @@ let s:default_ale_linter_aliases = { " " No linters are used for plaintext files by default. " -" Only cargo is enabled for Rust by default. +" Only cargo and rls are enabled for Rust by default. " rpmlint is disabled by default because it can result in code execution. " hhast is disabled by default because it executes code in the project root. " @@ -44,8 +45,8 @@ let s:default_ale_linters = { \ 'help': [], \ 'perl': ['perlcritic'], \ 'perl6': [], -\ 'python': ['flake8', 'mypy', 'pylint'], -\ 'rust': ['cargo'], +\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], +\ 'rust': ['cargo', 'rls'], \ 'spec': [], \ 'text': [], \ 'vue': ['eslint', 'vls'], @@ -76,10 +77,6 @@ function! s:IsBoolean(value) abort return type(a:value) is v:t_number && (a:value == 0 || a:value == 1) endfunction -function! s:LanguageGetter(buffer) dict abort - return l:self.language -endfunction - function! ale#linter#PreProcess(filetype, linter) abort if type(a:linter) isnot v:t_dict throw 'The linter object must be a Dictionary' @@ -113,14 +110,7 @@ function! ale#linter#PreProcess(filetype, linter) abort if !l:needs_executable if has_key(a:linter, 'executable') - \|| has_key(a:linter, 'executable_callback') - throw '`executable` and `executable_callback` cannot be used when lsp == ''socket''' - endif - elseif has_key(a:linter, 'executable_callback') - let l:obj.executable_callback = a:linter.executable_callback - - if !s:IsCallback(l:obj.executable_callback) - throw '`executable_callback` must be a callback if defined' + throw '`executable` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'executable') let l:obj.executable = a:linter.executable @@ -130,54 +120,12 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`executable` must be a String or Function if defined' endif else - throw 'Either `executable` or `executable_callback` must be defined' + throw '`executable` must be defined' endif if !l:needs_command if has_key(a:linter, 'command') - \|| has_key(a:linter, 'command_callback') - \|| has_key(a:linter, 'command_chain') - throw '`command` and `command_callback` and `command_chain` cannot be used when lsp == ''socket''' - endif - elseif has_key(a:linter, 'command_chain') - let l:obj.command_chain = a:linter.command_chain - - if type(l:obj.command_chain) isnot v:t_list - throw '`command_chain` must be a List' - endif - - if empty(l:obj.command_chain) - throw '`command_chain` must contain at least one item' - endif - - let l:link_index = 0 - - for l:link in l:obj.command_chain - let l:err_prefix = 'The `command_chain` item ' . l:link_index . ' ' - - if !s:IsCallback(get(l:link, 'callback')) - throw l:err_prefix . 'must define a `callback` function' - endif - - if has_key(l:link, 'output_stream') - if type(l:link.output_stream) isnot v:t_string - \|| index(['stdout', 'stderr', 'both'], l:link.output_stream) < 0 - throw l:err_prefix . '`output_stream` flag must be ' - \ . "'stdout', 'stderr', or 'both'" - endif - endif - - if has_key(l:link, 'read_buffer') && !s:IsBoolean(l:link.read_buffer) - throw l:err_prefix . 'value for `read_buffer` must be `0` or `1`' - endif - - let l:link_index += 1 - endfor - elseif has_key(a:linter, 'command_callback') - let l:obj.command_callback = a:linter.command_callback - - if !s:IsCallback(l:obj.command_callback) - throw '`command_callback` must be a callback if defined' + throw '`command` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'command') let l:obj.command = a:linter.command @@ -187,22 +135,12 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`command` must be a String or Function if defined' endif else - throw 'Either `command`, `executable_callback`, `command_chain` ' - \ . 'must be defined' - endif - - if ( - \ has_key(a:linter, 'command') - \ + has_key(a:linter, 'command_chain') - \ + has_key(a:linter, 'command_callback') - \) > 1 - throw 'Only one of `command`, `command_callback`, or `command_chain` ' - \ . 'should be set' + throw '`command` must be defined' endif if !l:needs_address - if has_key(a:linter, 'address') || has_key(a:linter, 'address_callback') - throw '`address` or `address_callback` cannot be used when lsp != ''socket''' + if has_key(a:linter, 'address') + throw '`address` cannot be used when lsp != ''socket''' endif elseif has_key(a:linter, 'address') if type(a:linter.address) isnot v:t_string @@ -211,41 +149,17 @@ function! ale#linter#PreProcess(filetype, linter) abort endif let l:obj.address = a:linter.address - elseif has_key(a:linter, 'address_callback') - let l:obj.address_callback = a:linter.address_callback - - if !s:IsCallback(l:obj.address_callback) - throw '`address_callback` must be a callback if defined' - endif else - throw '`address` or `address_callback` must be defined for getting the LSP address' + throw '`address` must be defined for getting the LSP address' endif if l:needs_lsp_details - if has_key(a:linter, 'language_callback') - if has_key(a:linter, 'language') - throw 'Only one of `language` or `language_callback` ' - \ . 'should be set' - endif + " Default to using the filetype as the language. + let l:obj.language = get(a:linter, 'language', a:filetype) - let l:obj.language_callback = get(a:linter, 'language_callback') - - if !s:IsCallback(l:obj.language_callback) - throw '`language_callback` must be a callback for LSP linters' - endif - else - " Default to using the filetype as the language. - let l:Language = get(a:linter, 'language', a:filetype) - - if type(l:Language) is v:t_string - " Make 'language_callback' return the 'language' value. - let l:obj.language = l:Language - let l:obj.language_callback = function('s:LanguageGetter') - elseif type(l:Language) is v:t_func - let l:obj.language_callback = l:Language - else - throw '`language` must be a String or Funcref' - endif + if type(l:obj.language) isnot v:t_string + \&& type(l:obj.language) isnot v:t_func + throw '`language` must be a String or Funcref if defined' endif if has_key(a:linter, 'project_root') @@ -253,16 +167,10 @@ function! ale#linter#PreProcess(filetype, linter) abort if type(l:obj.project_root) isnot v:t_string \&& type(l:obj.project_root) isnot v:t_func - throw '`project_root` must be a String or Function if defined' - endif - elseif has_key(a:linter, 'project_root_callback') - let l:obj.project_root_callback = a:linter.project_root_callback - - if !s:IsCallback(l:obj.project_root_callback) - throw '`project_root_callback` must be a callback if defined' + throw '`project_root` must be a String or Function' endif else - throw '`project_root` or `project_root_callback` must be defined for LSP linters' + throw '`project_root` must be defined for LSP linters' endif if has_key(a:linter, 'completion_filter') @@ -273,37 +181,16 @@ function! ale#linter#PreProcess(filetype, linter) abort endif endif - if has_key(a:linter, 'initialization_options_callback') - if has_key(a:linter, 'initialization_options') - throw 'Only one of `initialization_options` or ' - \ . '`initialization_options_callback` should be set' - endif - - let l:obj.initialization_options_callback = a:linter.initialization_options_callback - - if !s:IsCallback(l:obj.initialization_options_callback) - throw '`initialization_options_callback` must be a callback if defined' - endif - elseif has_key(a:linter, 'initialization_options') + if has_key(a:linter, 'initialization_options') let l:obj.initialization_options = a:linter.initialization_options if type(l:obj.initialization_options) isnot v:t_dict \&& type(l:obj.initialization_options) isnot v:t_func - throw '`initialization_options` must be a String or Function if defined' + throw '`initialization_options` must be a Dictionary or Function if defined' endif endif - if has_key(a:linter, 'lsp_config_callback') - if has_key(a:linter, 'lsp_config') - throw 'Only one of `lsp_config` or `lsp_config_callback` should be set' - endif - - let l:obj.lsp_config_callback = a:linter.lsp_config_callback - - if !s:IsCallback(l:obj.lsp_config_callback) - throw '`lsp_config_callback` must be a callback if defined' - endif - elseif has_key(a:linter, 'lsp_config') + if has_key(a:linter, 'lsp_config') if type(a:linter.lsp_config) isnot v:t_dict \&& type(a:linter.lsp_config) isnot v:t_func throw '`lsp_config` must be a Dictionary or Function if defined' @@ -324,21 +211,17 @@ function! ale#linter#PreProcess(filetype, linter) abort " file on disk. let l:obj.lint_file = get(a:linter, 'lint_file', 0) - if !s:IsBoolean(l:obj.lint_file) - throw '`lint_file` must be `0` or `1`' + if !s:IsBoolean(l:obj.lint_file) && type(l:obj.lint_file) isnot v:t_func + throw '`lint_file` must be `0`, `1`, or a Function' endif " An option indicating that the buffer should be read. - let l:obj.read_buffer = get(a:linter, 'read_buffer', !l:obj.lint_file) + let l:obj.read_buffer = get(a:linter, 'read_buffer', 1) if !s:IsBoolean(l:obj.read_buffer) throw '`read_buffer` must be `0` or `1`' endif - if l:obj.lint_file && l:obj.read_buffer - throw 'Only one of `lint_file` or `read_buffer` can be `1`' - endif - let l:obj.aliases = get(a:linter, 'aliases', []) if type(l:obj.aliases) isnot v:t_list @@ -346,14 +229,6 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`aliases` must be a List of String values' endif - for l:key in filter(keys(a:linter), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''') - if !get(g:, 'ale_ignore_2_4_warnings') - execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.''' - endif - - break - endfor - return l:obj endfunction @@ -519,11 +394,19 @@ function! ale#linter#Get(original_filetypes) abort return reverse(l:combined_linters) endfunction +function! ale#linter#RemoveIgnored(buffer, filetype, linters) abort + " Apply ignore lists for linters only if needed. + let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + return !empty(l:ignore_config) || l:disable_lsp + \ ? ale#engine#ignore#Exclude(a:filetype, a:linters, l:ignore_config, l:disable_lsp) + \ : a:linters +endfunction + " Given a buffer and linter, get the executable String for the linter. function! ale#linter#GetExecutable(buffer, linter) abort - let l:Executable = has_key(a:linter, 'executable_callback') - \ ? function(a:linter.executable_callback) - \ : a:linter.executable + let l:Executable = a:linter.executable return type(l:Executable) is v:t_func \ ? l:Executable(a:buffer) @@ -531,24 +414,21 @@ function! ale#linter#GetExecutable(buffer, linter) abort endfunction " Given a buffer and linter, get the command String for the linter. -" The command_chain key is not supported. function! ale#linter#GetCommand(buffer, linter) abort - let l:Command = has_key(a:linter, 'command_callback') - \ ? function(a:linter.command_callback) - \ : a:linter.command + let l:Command = a:linter.command - return type(l:Command) is v:t_func - \ ? l:Command(a:buffer) - \ : l:Command + return type(l:Command) is v:t_func ? l:Command(a:buffer) : l:Command endfunction " Given a buffer and linter, get the address for connecting to the server. function! ale#linter#GetAddress(buffer, linter) abort - let l:Address = has_key(a:linter, 'address_callback') - \ ? function(a:linter.address_callback) - \ : a:linter.address + let l:Address = a:linter.address - return type(l:Address) is v:t_func - \ ? l:Address(a:buffer) - \ : l:Address + return type(l:Address) is v:t_func ? l:Address(a:buffer) : l:Address +endfunction + +function! ale#linter#GetLanguage(buffer, linter) abort + let l:Language = a:linter.language + + return type(l:Language) is v:t_func ? l:Language(a:buffer) : l:Language endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index 2509174e..cb0573aa 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -44,6 +44,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort \ 'definition': 0, \ 'typeDefinition': 0, \ 'symbol_search': 0, + \ 'code_actions': 0, \ }, \} endif @@ -64,6 +65,9 @@ endfunction " Used only in tests. function! ale#lsp#GetConnections() abort + " This command will throw from the sandbox. + let &l:equalprg=&l:equalprg + return s:connections endfunction @@ -196,14 +200,34 @@ function! s:UpdateCapabilities(conn, capabilities) abort let a:conn.capabilities.hover = 1 endif + if type(get(a:capabilities, 'hoverProvider')) is v:t_dict + let a:conn.capabilities.hover = 1 + endif + if get(a:capabilities, 'referencesProvider') is v:true let a:conn.capabilities.references = 1 endif + if type(get(a:capabilities, 'referencesProvider')) is v:t_dict + let a:conn.capabilities.references = 1 + endif + if get(a:capabilities, 'renameProvider') is v:true let a:conn.capabilities.rename = 1 endif + if type(get(a:capabilities, 'renameProvider')) is v:t_dict + let a:conn.capabilities.rename = 1 + endif + + if get(a:capabilities, 'codeActionProvider') is v:true + let a:conn.capabilities.code_actions = 1 + endif + + if type(get(a:capabilities, 'codeActionProvider')) is v:t_dict + let a:conn.capabilities.code_actions = 1 + endif + if !empty(get(a:capabilities, 'completionProvider')) let a:conn.capabilities.completion = 1 endif @@ -220,13 +244,25 @@ function! s:UpdateCapabilities(conn, capabilities) abort let a:conn.capabilities.definition = 1 endif + if type(get(a:capabilities, 'definitionProvider')) is v:t_dict + let a:conn.capabilities.definition = 1 + endif + if get(a:capabilities, 'typeDefinitionProvider') is v:true let a:conn.capabilities.typeDefinition = 1 endif + if type(get(a:capabilities, 'typeDefinitionProvider')) is v:t_dict + let a:conn.capabilities.typeDefinition = 1 + endif + if get(a:capabilities, 'workspaceSymbolProvider') is v:true let a:conn.capabilities.symbol_search = 1 endif + + if type(get(a:capabilities, 'workspaceSymbolProvider')) is v:t_dict + let a:conn.capabilities.symbol_search = 1 + endif endfunction " Update a connection's configuration dictionary and notify LSP servers @@ -323,6 +359,7 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort let l:conn.capabilities.definition = 1 let l:conn.capabilities.symbol_search = 1 let l:conn.capabilities.rename = 1 + let l:conn.capabilities.code_actions = 1 endfunction function! s:SendInitMessage(conn) abort @@ -425,6 +462,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort endif if l:started && !l:conn.is_tsserver + let l:conn.initialized = 0 call s:SendInitMessage(l:conn) endif diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index 5b0cb8b7..38be4da6 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -172,3 +172,25 @@ function! ale#lsp#message#Rename(buffer, line, column, new_name) abort \ 'newName': a:new_name, \}] endfunction + +function! ale#lsp#message#CodeAction(buffer, line, column, end_line, end_column, diagnostics) abort + return [0, 'textDocument/codeAction', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'range': { + \ 'start': {'line': a:line - 1, 'character': a:column - 1}, + \ 'end': {'line': a:end_line - 1, 'character': a:end_column}, + \ }, + \ 'context': { + \ 'diagnostics': a:diagnostics + \ }, + \}] +endfunction + +function! ale#lsp#message#ExecuteCommand(command, arguments) abort + return [0, 'workspace/executeCommand', { + \ 'command': a:command, + \ 'arguments': a:arguments, + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index 30da77e1..a4f80980 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -56,6 +56,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort endif if has_key(l:diagnostic, 'relatedInformation') + \ && l:diagnostic.relatedInformation isnot v:null let l:related = deepcopy(l:diagnostic.relatedInformation) call map(l:related, {key, val -> \ ale#path#FromURI(val.location.uri) . diff --git a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim index b9fafaa0..3c1b47ed 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim @@ -103,3 +103,39 @@ function! ale#lsp#tsserver_message#OrganizeImports(buffer) abort \ }, \}] endfunction + +function! ale#lsp#tsserver_message#GetCodeFixes(buffer, line, column, end_line, end_column, error_codes) abort + " The lines and columns are 1-based. + " The errors codes must be a list of tsserver error codes to fix. + return [0, 'ts@getCodeFixes', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'errorCodes': a:error_codes, + \}] +endfunction + +function! ale#lsp#tsserver_message#GetApplicableRefactors(buffer, line, column, end_line, end_column) abort + " The arguments for this request can also be just 'line' and 'offset' + return [0, 'ts@getApplicableRefactors', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction + +function! ale#lsp#tsserver_message#GetEditsForRefactor(buffer, line, column, end_line, end_column, refactor, action) abort + return [0, 'ts@getEditsForRefactor', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'refactor': a:refactor, + \ 'action': a:action, + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index e4148ceb..dcd76e8f 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -34,7 +34,11 @@ endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] let l:filename = ale#path#FromURI(a:response.params.uri) - let l:buffer = bufnr('^' . l:filename . '$') + let l:escaped_name = escape( + \ fnameescape(l:filename), + \ has('win32') ? '^' : '^,}]' + \) + let l:buffer = bufnr('^' . l:escaped_name . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) @@ -52,7 +56,11 @@ endfunction function! s:HandleTSServerDiagnostics(response, error_type) abort let l:linter_name = 'tsserver' - let l:buffer = bufnr('^' . a:response.body.file . '$') + let l:escaped_name = escape( + \ fnameescape(a:response.body.file), + \ has('win32') ? '^' : '^,}]' + \) + let l:buffer = bufnr('^' . l:escaped_name . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) @@ -227,7 +235,7 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort let l:command = a:details.command let l:config = ale#lsp_linter#GetConfig(l:buffer, a:linter) - let l:language_id = ale#util#GetFunction(a:linter.language_callback)(l:buffer) + let l:language_id = ale#linter#GetLanguage(l:buffer, a:linter) call ale#lsp#UpdateConfig(l:conn_id, l:buffer, l:config) @@ -265,7 +273,14 @@ function! s:StartLSP(options, address, executable, command) abort call ale#lsp#MarkConnectionAsTsserver(l:conn_id) endif - let l:command = ale#command#FormatCommand(l:buffer, a:executable, a:command, 0, v:false)[1] + let l:command = ale#command#FormatCommand( + \ l:buffer, + \ a:executable, + \ a:command, + \ 0, + \ v:false, + \ [], + \)[1] let l:command = ale#job#PrepareCommand(l:buffer, l:command) let l:ready = ale#lsp#StartProgram(l:conn_id, a:executable, l:command) endif diff --git a/sources_non_forked/ale/autoload/ale/maven.vim b/sources_non_forked/ale/autoload/ale/maven.vim new file mode 100644 index 00000000..745f8c93 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/maven.vim @@ -0,0 +1,51 @@ +" Description: Functions for working with Maven projects. +" +" Given a buffer number, find a Maven project root. +function! ale#maven#FindProjectRoot(buffer) abort + let l:wrapper_path = ale#path#FindNearestFile(a:buffer, 'mvnw') + + if !empty(l:wrapper_path) + return fnamemodify(l:wrapper_path, ':h') + endif + + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:pom_path) + return fnamemodify(l:pom_path, ':h') + endif + + return '' +endfunction + + +" Given a buffer number, find the path to the executable. +" First search on the path for 'mvnw' (mvnw.cmd on Windows), if nothing is found, +" try the global command. Returns an empty string if cannot find the executable. +function! ale#maven#FindExecutable(buffer) abort + let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd' + let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd) + + if executable(l:wrapper_path) + return l:wrapper_path + endif + + if executable('mvn') + return 'mvn' + endif + + return '' +endfunction + +" Given a buffer number, build a command to print the classpath of the root +" project. Returns an empty string if cannot build the command. +function! ale#maven#BuildClasspathCommand(buffer) abort + let l:executable = ale#maven#FindExecutable(a:buffer) + let l:project_root = ale#maven#FindProjectRoot(a:buffer) + + if !empty(l:executable) && !empty(l:project_root) + return ale#path#CdString(l:project_root) + \ . l:executable . ' dependency:build-classpath' + endif + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim index 69060122..9b9b335a 100644 --- a/sources_non_forked/ale/autoload/ale/node.vim +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -12,6 +12,18 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort return ale#Var(a:buffer, a:base_var_name . '_executable') endif + let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list) + + if !empty(l:nearest) + return l:nearest + endif + + return ale#Var(a:buffer, a:base_var_name . '_executable') +endfunction + +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a Node program. +function! ale#node#FindNearestExecutable(buffer, path_list) abort for l:path in a:path_list let l:executable = ale#path#FindNearestFile(a:buffer, l:path) @@ -20,7 +32,7 @@ function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort endif endfor - return ale#Var(a:buffer, a:base_var_name . '_executable') + return '' endfunction " Create a executable string which executes a Node.js script command with a diff --git a/sources_non_forked/ale/autoload/ale/organize_imports.vim b/sources_non_forked/ale/autoload/ale/organize_imports.vim index e89c832c..e2b1c0d2 100644 --- a/sources_non_forked/ale/autoload/ale/organize_imports.vim +++ b/sources_non_forked/ale/autoload/ale/organize_imports.vim @@ -12,10 +12,13 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort let l:file_code_edits = a:response.body - call ale#code_action#HandleCodeAction({ - \ 'description': 'Organize Imports', - \ 'changes': l:file_code_edits, - \}, v:false) + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'Organize Imports', + \ 'changes': l:file_code_edits, + \ }, + \ {} + \) endfunction function! s:OnReady(linter, lsp_details) abort diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index 30550503..fed95ccd 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -24,6 +24,14 @@ function! ale#path#Simplify(path) abort return substitute(simplify(l:win_path), '^\\\+', '\', 'g') " no-custom-checks endfunction +" Simplify a path without a Windows drive letter. +" This function can be used for checking if paths are equal. +function! ale#path#RemoveDriveLetter(path) abort + return has('win32') && a:path[1:2] is# ':\' + \ ? ale#path#Simplify(a:path[2:]) + \ : ale#path#Simplify(a:path) +endfunction + " Given a buffer and a filename, find the nearest file by searching upwards " through the paths relative to the given buffer. function! ale#path#FindNearestFile(buffer, filename) abort @@ -74,15 +82,19 @@ endfunction function! ale#path#CdString(directory) abort if has('win32') return 'cd /d ' . ale#Escape(a:directory) . ' && ' - else - return 'cd ' . ale#Escape(a:directory) . ' && ' endif + + return 'cd ' . ale#Escape(a:directory) . ' && ' endfunction " Output 'cd && ' " This function can be used changing the directory for a linter command. function! ale#path#BufferCdString(buffer) abort - return ale#path#CdString(fnamemodify(bufname(a:buffer), ':p:h')) + if has('win32') + return 'cd /d %s:h && ' + endif + + return 'cd %s:h && ' endfunction " Return 1 if a path is an absolute path. @@ -95,7 +107,7 @@ function! ale#path#IsAbsolute(filename) abort return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' endfunction -let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h')) +let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) " Given a filename, return 1 if the file represents some temporary file " created by Vim. diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index 7902ec63..8b94aa7a 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -1,14 +1,22 @@ " Author: w0rp " Description: Preview windows for showing whatever information in. -if !has_key(s:, 'last_selection_list') - let s:last_selection_list = [] +if !has_key(s:, 'last__list') + let s:last_list = [] endif -if !has_key(s:, 'last_selection_open_in') - let s:last_selection_open_in = 'current-buffer' +if !has_key(s:, 'last_options') + let s:last_options = {} endif +function! ale#preview#SetLastSelection(item_list, options) abort + let s:last_list = a:item_list + let s:last_options = { + \ 'open_in': get(a:options, 'open_in', 'current-buffer'), + \ 'use_relative_paths': get(a:options, 'use_relative_paths', 0), + \} +endfunction + " Open a preview window and show some lines in it. " A second argument can be passed as a Dictionary with options. They are... " @@ -31,6 +39,10 @@ function! ale#preview#Show(lines, ...) abort setlocal readonly let &l:filetype = get(l:options, 'filetype', 'ale-preview') + for l:command in get(l:options, 'commands', []) + call execute(l:command) + endfor + if get(l:options, 'stay_here') wincmd p endif @@ -77,19 +89,14 @@ function! ale#preview#ShowSelection(item_list, ...) abort let b:ale_preview_item_list = a:item_list let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') - " Remove the last preview - let s:last_selection_list = b:ale_preview_item_list - let s:last_selection_open_in = b:ale_preview_item_open_in + " Remember preview state, so we can repeat it later. + call ale#preview#SetLastSelection(a:item_list, l:options) endfunction function! ale#preview#RepeatSelection() abort - if empty(s:last_selection_list) - return + if !empty(s:last_list) + call ale#preview#ShowSelection(s:last_list, s:last_options) endif - - call ale#preview#ShowSelection(s:last_selection_list, { - \ 'open_in': s:last_selection_open_in, - \}) endfunction function! s:Open(open_in) abort diff --git a/sources_non_forked/ale/autoload/ale/rename.vim b/sources_non_forked/ale/autoload/ale/rename.vim index fbd6c2ad..9030618e 100644 --- a/sources_non_forked/ale/autoload/ale/rename.vim +++ b/sources_non_forked/ale/autoload/ale/rename.vim @@ -33,9 +33,10 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort return endif - let l:old_name = s:rename_map[a:response.request_seq].old_name - let l:new_name = s:rename_map[a:response.request_seq].new_name - call remove(s:rename_map, a:response.request_seq) + let l:options = remove(s:rename_map, a:response.request_seq) + + let l:old_name = l:options.old_name + let l:new_name = l:options.new_name if get(a:response, 'success', v:false) is v:false let l:message = get(a:response, 'message', 'unknown') @@ -77,16 +78,21 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort return endif - call ale#code_action#HandleCodeAction({ - \ 'description': 'rename', - \ 'changes': l:changes, - \}, v:true) + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'rename', + \ 'changes': l:changes, + \ }, + \ { + \ 'should_save': 1, + \ }, + \) endfunction function! ale#rename#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:rename_map, a:response.id) - call remove(s:rename_map, a:response.id) + let l:options = remove(s:rename_map, a:response.id) if !has_key(a:response, 'result') call s:message('No rename result received from server') @@ -94,51 +100,29 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort return endif - let l:workspace_edit = a:response.result + let l:changes_map = ale#code_action#GetChanges(a:response.result) - if !has_key(l:workspace_edit, 'changes') || empty(l:workspace_edit.changes) + if empty(l:changes_map) call s:message('No changes received from server') return endif - let l:changes = [] + let l:changes = ale#code_action#BuildChangesList(l:changes_map) - for l:file_name in keys(l:workspace_edit.changes) - let l:text_edits = l:workspace_edit.changes[l:file_name] - let l:text_changes = [] - - for l:edit in l:text_edits - let l:range = l:edit.range - let l:new_text = l:edit.newText - - call add(l:text_changes, { - \ 'start': { - \ 'line': l:range.start.line + 1, - \ 'offset': l:range.start.character + 1, - \ }, - \ 'end': { - \ 'line': l:range.end.line + 1, - \ 'offset': l:range.end.character + 1, - \ }, - \ 'newText': l:new_text, - \}) - endfor - - call add(l:changes, { - \ 'fileName': ale#path#FromURI(l:file_name), - \ 'textChanges': l:text_changes, - \}) - endfor - - call ale#code_action#HandleCodeAction({ - \ 'description': 'rename', - \ 'changes': l:changes, - \}, v:true) + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'rename', + \ 'changes': l:changes, + \ }, + \ { + \ 'should_save': 1, + \ }, + \) endif endfunction -function! s:OnReady(line, column, old_name, new_name, linter, lsp_details) abort +function! s:OnReady(line, column, options, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'rename') @@ -170,19 +154,16 @@ function! s:OnReady(line, column, old_name, new_name, linter, lsp_details) abort \ l:buffer, \ a:line, \ a:column, - \ a:new_name + \ a:options.new_name \) endif let l:request_id = ale#lsp#Send(l:id, l:message) - let s:rename_map[l:request_id] = { - \ 'new_name': a:new_name, - \ 'old_name': a:old_name, - \} + let s:rename_map[l:request_id] = a:options endfunction -function! s:ExecuteRename(linter, old_name, new_name) abort +function! s:ExecuteRename(linter, options) abort let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] @@ -190,8 +171,7 @@ function! s:ExecuteRename(linter, old_name, new_name) abort let l:column = min([l:column, len(getline(l:line))]) endif - let l:Callback = function( - \ 's:OnReady', [l:line, l:column, a:old_name, a:new_name]) + let l:Callback = function('s:OnReady', [l:line, l:column, a:options]) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction @@ -220,6 +200,9 @@ function! ale#rename#Execute() abort endif for l:lsp_linter in l:lsp_linters - call s:ExecuteRename(l:lsp_linter, l:old_name, l:new_name) + call s:ExecuteRename(l:lsp_linter, { + \ 'old_name': l:old_name, + \ 'new_name': l:new_name, + \}) endfor endfunction diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim index 082d91ff..6fcbf35e 100644 --- a/sources_non_forked/ale/autoload/ale/test.vim +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -145,8 +145,8 @@ function! ale#test#WaitForJobs(deadline) abort " end, but before handlers are run. sleep 10ms - " We must check the buffer data again to see if new jobs started - " for command_chain linters. + " We must check the buffer data again to see if new jobs started for + " linters with chained commands. let l:has_new_jobs = 0 " Check again to see if any jobs are running. diff --git a/sources_non_forked/ale/autoload/ale/uri.vim b/sources_non_forked/ale/autoload/ale/uri.vim index 934637d9..e71c6340 100644 --- a/sources_non_forked/ale/autoload/ale/uri.vim +++ b/sources_non_forked/ale/autoload/ale/uri.vim @@ -1,9 +1,18 @@ -" This probably doesn't handle Unicode characters well. +function! s:EncodeChar(char) abort + let l:result = '' + + for l:index in range(strlen(a:char)) + let l:result .= printf('%%%02x', char2nr(a:char[l:index])) + endfor + + return l:result +endfunction + function! ale#uri#Encode(value) abort return substitute( \ a:value, \ '\([^a-zA-Z0-9\\/$\-_.!*''(),]\)', - \ '\=printf(''%%%02x'', char2nr(submatch(1)))', + \ '\=s:EncodeChar(submatch(1))', \ 'g' \) endfunction @@ -12,7 +21,7 @@ function! ale#uri#Decode(value) abort return substitute( \ a:value, \ '%\(\x\x\)', - \ '\=nr2char(''0x'' . submatch(1))', + \ '\=printf("%c", str2nr(submatch(1), 16))', \ 'g' \) endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index ee62af28..fcc03eb7 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -16,7 +16,9 @@ endfunction " Vim 8 does not support echoing long messages from asynchronous callbacks, " but NeoVim does. Small messages can be echoed in Vim 8, and larger messages " have to be shown in preview windows. -function! ale#util#ShowMessage(string) abort +function! ale#util#ShowMessage(string, ...) abort + let l:options = get(a:000, 0, {}) + if !has('nvim') call ale#preview#CloseIfTypeMatches('ale-preview.message') endif @@ -25,10 +27,13 @@ function! ale#util#ShowMessage(string) abort if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns) execute 'echo a:string' else - call ale#preview#Show(split(a:string, "\n"), { - \ 'filetype': 'ale-preview.message', - \ 'stay_here': 1, - \}) + call ale#preview#Show(split(a:string, "\n"), extend( + \ { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \ }, + \ l:options, + \)) endif endfunction @@ -418,7 +423,10 @@ function! ale#util#Writefile(buffer, lines, filename) abort \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines - call writefile(l:corrected_lines, a:filename, 'S') " no-custom-checks + " Set binary flag if buffer doesn't have eol and nofixeol to avoid appending newline + let l:flags = !getbufvar(a:buffer, '&eol') && exists('+fixeol') && !&fixeol ? 'bS' : 'S' + + call writefile(l:corrected_lines, a:filename, l:flags) " no-custom-checks endfunction if !exists('s:patial_timers') @@ -478,7 +486,7 @@ function! ale#util#Input(message, value) abort endfunction function! ale#util#HasBuflineApi() abort - return exists('*deletebufline') && exists('*setbufline') + return exists('*deletebufline') && exists('*appendbufline') && exists('*getpos') && exists('*setpos') endfunction " Sets buffer contents to lines @@ -499,8 +507,11 @@ function! ale#util#SetBufferContents(buffer, lines) abort " Use a Vim API for setting lines in other buffers, if available. if l:has_bufline_api - call setbufline(a:buffer, 1, l:new_lines) - call deletebufline(a:buffer, l:first_line_to_remove, '$') + let l:save_cursor = getpos('.') + call deletebufline(a:buffer, 1, '$') + call appendbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, 1, 1) + call setpos('.', l:save_cursor) " Fall back on setting lines the old way, for the current buffer. else let l:old_line_length = line('$') diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index c9eb79db..b0d94b8e 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -1,22 +1,36 @@ =============================================================================== ALE C Integration *ale-c-options* +For basic checking of problems with C files, ALE offers the `cc` linter, which +runs either `clang`, or `gcc`. See |ale-c-cc|. + =============================================================================== Global Options +g:ale_c_always_make *g:ale_c_always_make* + *b:ale_c_always_make* + Type: |Number| + Default: `has('unix') && !has('macunix')` + + If set to `1`, use `--always-make` for `make`, which means that output will + always be parsed from `make` dry runs with GNU make. BSD `make` does not + support this option, so you probably want to turn this option off when using + a BSD variant. + + g:ale_c_build_dir_names *g:ale_c_build_dir_names* *b:ale_c_build_dir_names* Type: |List| Default: `['build', 'bin']` - A list of directory names to be used when searching upwards from cpp - files to discover compilation databases with. For directory named `'foo'`, - ALE will search for `'foo/compile_commands.json'` in all directories on and above - the directory containing the cpp file to find path to compilation database. - This feature is useful for the clang tools wrapped around LibTooling (namely - here, clang-tidy) + A list of directory names to be used when searching upwards from cpp files + to discover compilation databases with. For directory named `'foo'`, ALE + will search for `'foo/compile_commands.json'` in all directories on and + above the directory containing the cpp file to find path to compilation + database. This feature is useful for the clang tools wrapped around + LibTooling (namely here, clang-tidy) g:ale_c_build_dir *g:ale_c_build_dir* @@ -37,7 +51,7 @@ g:ale_c_build_dir *g:ale_c_build_dir* g:ale_c_parse_compile_commands *g:ale_c_parse_compile_commands* *b:ale_c_parse_compile_commands* Type: |Number| - Default: `0` + Default: `1` If set to `1`, ALE will parse `compile_commands.json` files to automatically determine flags for C or C++ compilers. ALE will first search for the @@ -45,9 +59,6 @@ g:ale_c_parse_compile_commands *g:ale_c_parse_compile_commands* `compile_commands.json` files in the directories for |g:ale_c_build_dir_names|. - If |g:ale_c_parse_makefile| or |b:ale_c_parse_makefile| is set to `1`, the - output of `make -n` will be preferred over `compile_commands.json` files. - g:ale_c_parse_makefile *g:ale_c_parse_makefile* *b:ale_c_parse_makefile* @@ -58,24 +69,102 @@ g:ale_c_parse_makefile *g:ale_c_parse_makefile* set for C or C++ compilers. This can make it easier to determine the correct build flags to use for different files. + NOTE: When using this option on BSD, you may need to set + |g:ale_c_always_make| to `0`, and `make -n` will not provide consistent + results if binaries have already been built, so use `make clean` when + editing your files. + + WARNING: Running `make -n` automatically can execute arbitrary code, even + though it's supposed to be a dry run, so enable this option with care. You + might prefer to use the buffer-local version of the option instead with + |g:ale_pattern_options|, or you own code for checking which project you're + in. + + You might want to disable this option if `make -n` takes too long to run for + projects you work on. + + If |g:ale_c_parse_compile_commands| or |b:ale_c_parse_compile_commands| is + set to `1`, flags taken from `compile_commands.json` will be preferred over + `make -n` output. + =============================================================================== -clang *ale-c-clang* +astyle *ale-c-astyle* -g:ale_c_clang_executable *g:ale_c_clang_executable* - *b:ale_c_clang_executable* +g:ale_c_astyle_executable *g:ale_c_astyle_executable* + *b:ale_c_astyle_executable* Type: |String| - Default: `'clang'` + Default: `'astyle'` - This variable can be changed to use a different executable for clang. + This variable can be changed to use a different executable for astyle. -g:ale_c_clang_options *g:ale_c_clang_options* - *b:ale_c_clang_options* +g:ale_c_astyle_project_options *g:ale_c_astyle_project_options* + *b:ale_c_astyle_project_options* + Type: |String| + Default: `''` + + This variable can be changed to use an option file for project level + configurations. Provide only the filename of the option file that should be + present at the project's root directory. + + For example, if .astylrc is specified, the file is searched in the parent + directories of the source file's directory. + + +=============================================================================== +cc *ale-c-cc* + *ale-c-gcc* + *ale-c-clang* + +g:ale_c_cc_executable *g:ale_c_cc_executable* + *b:ale_c_cc_executable* + Type: |String| + Default: `''` + + This variable can be changed to use a different executable for a C compiler. + + ALE will try to use `clang` if Clang is available, otherwise ALE will + default to checking C code with `gcc`. + + +g:ale_c_cc_options *g:ale_c_cc_options* + *b:ale_c_cc_options* Type: |String| Default: `'-std=c11 -Wall'` - This variable can be changed to modify flags given to clang. + This variable can be change to modify flags given to the C compiler. + + +=============================================================================== +ccls *ale-c-ccls* + +g:ale_c_ccls_executable *g:ale_c_ccls_executable* + *b:ale_c_ccls_executable* + Type: |String| + Default: `'ccls'` + + This variable can be changed to use a different executable for ccls. + + +g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* + *b:ale_c_ccls_init_options* + Type: |Dictionary| + Default: `{}` + + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -260,25 +349,6 @@ g:ale_c_flawfinder_error_severity *g:ale_c_flawfinder_error_severity* error. This setting also applies to flawfinder for c++. -=============================================================================== -gcc *ale-c-gcc* - -g:ale_c_gcc_executable *g:ale_c_gcc_executable* - *b:ale_c_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_c_gcc_options *g:ale_c_gcc_options* - *b:ale_c_gcc_options* - Type: |String| - Default: `'-std=c11 -Wall'` - - This variable can be change to modify flags given to gcc. - - =============================================================================== uncrustify *ale-c-uncrustify* @@ -298,36 +368,5 @@ g:ale_c_uncrustify_options *g:ale_c_uncrustify_options* This variable can be change to modify flags given to uncrustify. -=============================================================================== -ccls *ale-c-ccls* - -g:ale_c_ccls_executable *g:ale_c_ccls_executable* - *b:ale_c_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* - *b:ale_c_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt index ead3be28..17894e6e 100644 --- a/sources_non_forked/ale/doc/ale-cpp.txt +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -1,12 +1,16 @@ =============================================================================== ALE C++ Integration *ale-cpp-options* +For basic checking of problems with C++ files, ALE offers the `cc` linter, +which runs either `clang++`, or `gcc`. See |ale-cpp-cc|. + =============================================================================== Global Options The following C options also apply to some C++ linters too. +* |g:ale_c_always_make| * |g:ale_c_build_dir_names| * |g:ale_c_build_dir| * |g:ale_c_parse_makefile| @@ -14,41 +18,82 @@ The following C options also apply to some C++ linters too. =============================================================================== -clang *ale-cpp-clang* +astyle *ale-cpp-astyle* -g:ale_cpp_clang_executable *g:ale_cpp_clang_executable* - *b:ale_cpp_clang_executable* +g:ale_cpp_astyle_executable *g:ale_cpp_astyle_executable* + *b:ale_cpp_astyle_executable* Type: |String| - Default: `'clang++'` + Default: `'astyle'` - This variable can be changed to use a different executable for clang. + This variable can be changed to use a different executable for astyle. -g:ale_cpp_clang_options *g:ale_cpp_clang_options* - *b:ale_cpp_clang_options* - Type: |String| - Default: `'-std=c++14 -Wall'` - - This variable can be changed to modify flags given to clang. - - -=============================================================================== -clangd *ale-cpp-clangd* - -g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* - *b:ale_cpp_clangd_executable* - Type: |String| - Default: `'clangd'` - - This variable can be changed to use a different executable for clangd. - - -g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* - *b:ale_cpp_clangd_options* +g:ale_cpp_astyle_project_options *g:ale_cpp_astyle_project_options* + *b:ale_cpp_astyle_project_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clangd. + This variable can be changed to use an option file for project level + configurations. Provide only the filename of the option file that should be + present at the project's root directory. + + For example, if .astylrc is specified, the file is searched in the parent + directories of the source file's directory. + + +=============================================================================== +cc *ale-cpp-cc* + *ale-cpp-gcc* + *ale-cpp-clang* + +g:ale_cpp_cc_executable *g:ale_cpp_cc_executable* + *b:ale_cpp_cc_executable* + Type: |String| + Default: `''` + + This variable can be changed to use a different executable for a C++ compiler. + + ALE will try to use `clang++` if Clang is available, otherwise ALE will + default to checking C++ code with `gcc`. + + +g:ale_cpp_cc_options *g:ale_cpp_cc_options* + *b:ale_cpp_cc_options* + Type: |String| + Default: `'-std=c++14 -Wall'` + + This variable can be change to modify flags given to the C++ compiler. + + +=============================================================================== +ccls *ale-cpp-ccls* + +g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* + *b:ale_cpp_ccls_executable* + Type: |String| + Default: `'ccls'` + + This variable can be changed to use a different executable for ccls. + + +g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* + *b:ale_cpp_ccls_init_options* + Type: |Dictionary| + Default: `{}` + + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -82,6 +127,25 @@ g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* option. +=============================================================================== +clangd *ale-cpp-clangd* + +g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* + *b:ale_cpp_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* + *b:ale_cpp_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + =============================================================================== clang-format *ale-cpp-clangformat* @@ -271,61 +335,11 @@ g:ale_cpp_flawfinder_options *g:ale-cpp-flawfinder* This variable can be used to pass extra options into the flawfinder command. -=============================================================================== -gcc *ale-cpp-gcc* - -g:ale_cpp_gcc_executable *g:ale_cpp_gcc_executable* - *b:ale_cpp_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* - *b:ale_cpp_gcc_options* - Type: |String| - Default: `'-std=c++14 -Wall'` - - This variable can be changed to modify flags given to gcc. - - =============================================================================== uncrustify *ale-cpp-uncrustify* See |ale-c-uncrustify| for information about the available options. -=============================================================================== -ccls *ale-cpp-ccls* - -g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* - *b:ale_cpp_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* - *b:ale_cpp_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index faa570c1..afd9798f 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -13,6 +13,7 @@ CONTENTS *ale-development-contents* 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| + 4.3. Running Tests in a Windows VM....|ale-development-windows-tests| =============================================================================== 1. Introduction *ale-development-introduction* @@ -170,6 +171,11 @@ will run all of the tests in Vader, Vint checks, and several Bash scripts for finding extra issues. Run `./run-tests --help` to see all of the options the script supports. Note that the script supports selecting particular test files. +Once you get used to dealing with Vim and NeoVim compatibility issues, you +probably want to use `./run-tests --fast -q` for running tests with only the +fastest available Vim version, and with success messages from tests +suppressed. + Generally write tests for any changes you make. The following types of tests are recommended for the following types of code. @@ -353,5 +359,81 @@ given the above setup are as follows. `AssertFixerNotExecuted` - Check that fixers will not be executed. +=============================================================================== +4.3 Running Tests in a Windows VM *ale-development-windows-tests* + +Tests are run for ALE in a build of Vim 8 for Windows via AppVeyor. These +tests can frequently break due to minor differences in paths and how escaping +is done for commands on Windows. If you are a Linux or Mac user, running these +tests locally can be difficult. Here is a process that will make that easier. + +First, you want to install a Windows image with VirtualBox. Install VirtualBox +and grab a VirtualBox image for Windows such as from here: +https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ + +NOTE: If you need to enter a password for the virtual machine at any point, +the password is "Passw0rd!" without the double quotes. + +NOTE: If your trial period for Windows runs out, run the commands like the +wallpaper tells you to. + +Your virtual machine will need to have PowerShell installed. Before you go any +further, confirm that PowerShell is installed in your Windows virtual machine. + +Consult the VirtualBox documentation on how to install "Guest Additions." +You probably want to install "Guest Additions" for most things to work +properly. + +After you've loaded your virtual machine image, go into "Settings" for your +virtual machine, and "Shared Folders." Add a shared folder with the name +"ale", and set the "Folder Path" to the path to your ALE repository, for +example: "/home/w0rp/ale" + +Find out which drive letter "ale" has been mounted as in Windows. We'll use +"E:" as the drive letter, for example. Open the command prompt as an +administrator by typing in `cmd` in the start menu, right clicking on the +command prompt application, and clicking "Run as administrator." Click "Yes" +when prompted to ask if you're sure you want to run the command prompt. You +should type in the following command to mount the "ale" directory for testing, +where "E:" is replaced with your drive letter. > + + mklink /D C:\testplugin E: +< +Close the administrator Command Prompt, and try running the command +`type C:\testplugin\LICENSE` in a new Command Prompt which you are NOT running +as administrator. You should see the license for ALE in your terminal. After +you have confirmed that you have mounted ALE on your machine, search in the +Start Menu for "power shell," run PowerShell as an administrator, and issue +the following commands to install the correct Vim and Vader versions for +running tests. > + + Add-Type -A System.IO.Compression.FileSystem + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip -OutFile C:\vim.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim') + rm C:\vim.zip + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip -OutFile C:\rt.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim') + rm C:\rt.zip + + Invoke-WebRequest https://github.com/junegunn/vader.vim/archive/c6243dd81c98350df4dec608fa972df98fa2a3af.zip -OutFile C:\vader.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vader.zip', 'C:\') + mv C:\vader.vim-c6243dd81c98350df4dec608fa972df98fa2a3af C:\vader + rm C:\vader.zip +< +After you have finished installing everything, you can run all of the tests +in Windows by opening a Command Prompt NOT as an administrator by navigating +to the directory where you've mounted the ALE code, which must be named +`C:\testplugin`, and by running the `run-tests.bat` batch file. > + + cd C:\testplugin + run-tests +< +It will probably take several minutes for all of the tests to run. Be patient. +You can run a specific test by passing the filename as an argument to the +batch file, for example: `run-tests test/test_c_flag_parsing.vader` . This will +give you results much more quickly. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index 5864f728..de9daacf 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -6,7 +6,7 @@ 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. +The `mix` linter is disabled by default, as it can be too expensive to run. See `:help g:ale_linters` diff --git a/sources_non_forked/ale/doc/ale-erlang.txt b/sources_non_forked/ale/doc/ale-erlang.txt index 59993a99..38762f08 100644 --- a/sources_non_forked/ale/doc/ale-erlang.txt +++ b/sources_non_forked/ale/doc/ale-erlang.txt @@ -31,6 +31,18 @@ g:ale_erlang_dialyzer_rebar3_profile *g:ale_erlang_dialyzer_rebar3_profile* This variable can be changed to specify the profile that is used to run dialyzer with rebar3. + +------------------------------------------------------------------------------- +elvis *ale-erlang-elvis* + +g:ale_erlang_elvis_executable *g:ale_erlang_elvis_executable* + *b:ale_erlang_elvis_executable* + Type: |String| + Default: `'elvis'` + + This variable can be changed to specify the elvis executable. + + ------------------------------------------------------------------------------- erlc *ale-erlang-erlc* diff --git a/sources_non_forked/ale/doc/ale-handlebars.txt b/sources_non_forked/ale/doc/ale-handlebars.txt index 5daec5b3..4a5a3870 100644 --- a/sources_non_forked/ale/doc/ale-handlebars.txt +++ b/sources_non_forked/ale/doc/ale-handlebars.txt @@ -14,7 +14,8 @@ ember-template-lint *ale-handlebars-embertemplatelint* g:ale_handlebars_embertemplatelint_executable *g:ale_handlebars_embertemplatelint_executable* - Type: |String| *b:ale_handlebars_embertemplatelint_executable* + *b:ale_handlebars_embertemplatelint_executable* + Type: |String| Default: `'ember-template-lint'` See |ale-integrations-local-executables| @@ -22,7 +23,8 @@ g:ale_handlebars_embertemplatelint_executable g:ale_handlebars_embertemplatelint_use_global *g:ale_handlebars_embertemplatelint_use_global* - Type: |Number| *b:ale_handlebars_embertemplatelint_use_global* + *b:ale_handlebars_embertemplatelint_use_global* + Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index 5dd3ec15..fde439fe 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -172,5 +172,25 @@ g:ale_haskell_hie_executable *g:ale_haskell_hie_executable* ide engine. i.e. `'hie-wrapper'` +=============================================================================== +ormolu *ale-haskell-ormolu* + +g:ale_haskell_ormolu_executable *g:ale_haskell_ormolu_executable* + *b:ale_haskell_ormolu_executable* + Type: |String| + Default: `'ormolu'` + + This variable can be changed to use a different executable for ormolu. + + +g:ale_haskell_ormolu_options *g:ale_haskell_ormolu_options* + *b:ale_haskell_ormolu_options* + Type: String + Default: '' + + This variable can be used to pass extra options to the underlying ormolu + executable. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index d2001ca7..0debc1af 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -131,18 +131,26 @@ javalsp *ale-java-javalsp* To enable Java LSP linter you need to download and build the vscode-javac language server from https://github.com/georgewfraser/java-language-server. -Simply download the source code and then build a distribution: - scripts/link_mac.sh +Before building the language server you need to install pre-requisites: npm, +maven, and protobuf. You also need to have Java 13 and JAVA_HOME properly +set. -or +After downloading the source code and installing all pre-requisites you can +build the language server with the included build.sh script: - scripts/link_windows.sh + scripts/build.sh -This generates a dist/mac or dist/windows directory that contains the -language server. To let ALE use this language server you need to set the +This will create launch scripts for Linux, Mac, and Windows in the dist folder +within the repo: + + - lang_server_linux.sh + - lang_server_mac.sh + - lang_server_windows.sh + +To let ALE use this language server you need to set the g:ale_java_javalsp_executable variable to the absolute path of the launcher -executable in this directory. +executable for your platform. g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* *b:ale_java_javalsp_executable* @@ -152,7 +160,7 @@ g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* This variable must be set to the absolute path of the language server launcher executable. For example: > - let g:ale_java_javalsp_executable=/java-language-server/dist/mac/bin/launcher + let g:ale_java_javalsp_executable=/java-language-server/dist/lang_server_linux.sh < g:ale_java_javalsp_config *g:ale_java_javalsp_config* @@ -164,7 +172,7 @@ The javalsp linter automatically detects external depenencies for Maven and Gradle projects. In case the javalsp fails to detect some of them, you can specify them setting a dictionary to |g:ale_java_javalsp_config| variable. > - let g:ale_java_javalsp_executable = + let g:ale_java_javalsp_config = \ { \ 'java': { \ 'externalDependencies': [ diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt index ea0a7089..13059eaa 100644 --- a/sources_non_forked/ale/doc/ale-javascript.txt +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -138,7 +138,7 @@ g:ale_javascript_flow_use_respect_pragma By default, ALE will use the `--respect-pragma` option for `flow`, so only files with the `@flow` pragma are checked by ALE. This option can be set to - `0` to disable that behaviour, so all files can be checked by `flow`. + `0` to disable that behavior, so all files can be checked by `flow`. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index f1286f89..408f0c3c 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -30,5 +30,21 @@ g:ale_lua_luacheck_options *g:ale_lua_luacheck_options* This variable can be set to pass additional options to luacheck. +=============================================================================== +luafmt *ale-lua-luafmt* + +g:ale_lua_luafmt_executable *g:ale_lua_luafmt_executable* + *b:ale_lua_luafmt_executable* + Type: |String| + Default: `'luafmt'` + + This variable can be set to use a different executable for luafmt. + +g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* + *b:ale_lua_luafmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the luafmt fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt index 4e27eb91..99848878 100644 --- a/sources_non_forked/ale/doc/ale-markdown.txt +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -2,6 +2,17 @@ ALE Markdown Integration *ale-markdown-options* +=============================================================================== +markdownlint *ale-markdown-markdownlint* + +g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options* + *b:ale_markdown_markdownlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to markdownlint. + + =============================================================================== mdl *ale-markdown-mdl* diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 645decd7..4ee016fb 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -85,6 +85,14 @@ g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* See |ale-integrations-local-executables| +g:ale_php_phpcbf_options *g:ale_php_phpcbf_options* + *b:ale_php_phpcbf_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to php-cbf + + =============================================================================== phpcs *ale-php-phpcs* @@ -189,46 +197,124 @@ g:ale_php_psalm_executable *g:ale_php_psalm_executable* This variable sets the executable used for psalm. -g:ale_psalm_langserver_options *g:ale_psalm_langserver_options* - *b:ale_psalm_langserver_options* + +g:ale_php_psalm_options *g:ale_php_psalm_options* + *b:ale_php_psalm_options* Type: |String| Default: `''` This variable can be set to pass additional options to psalm. -=============================================================================== -php-cs-fixer *ale-php-php-cs-fixer* -g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* - *b:ale_php_cs_fixer_executable* +g:ale_php_psalm_use_global *g:ale_php_psalm_use_global* + *b:ale_php_psalm_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +php-cs-fixer *ale-php-php-cs-fixer* + +g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* + *b:ale_php_cs_fixer_executable* Type: |String| Default: `'php-cs-fixer'` This variable sets executable used for php-cs-fixer. -g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* - *b:ale_php_cs_fixer_use_global* - Type: |Boolean| - Default: `get(g:, 'ale_use_global_executables', 0)` - This variable force globally installed fixer. - -g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* - *b:ale_php_cs_fixer_options* +g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* + *b:ale_php_cs_fixer_options* Type: |String| Default: `''` 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* +g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* + *b:ale_php_cs_fixer_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +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. + +=============================================================================== +tlint *ale-php-tlint* + +g:ale_php_tlint_executable *g:ale_php_tlint_executable* + *b:ale_php_tlint_executable* + Type: |String| + Default: `'tlint'` + + See |ale-integrations-local-executables| + + +g:ale_php_tlint_use_global *g:ale_php_tlint_use_global* + *b:ale_php_tlint_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +g:ale_php_tlint_options *g:ale_php_tlint_options* + *b:ale_php_tlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to tlint + + +=============================================================================== +intelephense *ale-php-intelephense* + +g:ale_php_intelephense_executable *g:ale_php_intelephense_executable* + *b:ale_php_intelephense_executable* + Type: |String| + Default: `'intelephense'` + + The variable can be set to configure the executable that will be used for + running the intelephense language server. `node_modules` directory + executable will be preferred instead of this setting if + |g:ale_php_intelephense_use_global| is `0`. + + See: |ale-integrations-local-executables| + + +g:ale_php_intelephense_use_global *g:ale_php_intelephense_use_global* + *b:ale_php_intelephense_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + This variable can be set to `1` to force the language server to be run with + the executable set for |g:ale_php_intelephense_executable|. + + See: |ale-integrations-local-executables| + + +g:ale_php_intelephense_config *g:ale_php_intelephense_config* + *b:ale_php_intelephense_config* + Type: |Dictionary| + Default: `{}` + + The initialization options config specified by Intelephense. Refer to the + installation docs provided by intelephense (github.com/bmewburn/intelephense + -docs). + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-powershell.txt b/sources_non_forked/ale/doc/ale-powershell.txt index c28ef9ea..485c9bd0 100644 --- a/sources_non_forked/ale/doc/ale-powershell.txt +++ b/sources_non_forked/ale/doc/ale-powershell.txt @@ -25,13 +25,6 @@ Installation Install PSScriptAnalyzer by any means, so long as it can be automatically imported in PowerShell. -Some PowerShell plugins set the filetype of files to `ps1`. To continue using -these plugins, use the ale_linter_aliases global to alias `ps1` to `powershell` - -> - " Allow ps1 filetype to work with powershell linters - let g:ale_linter_aliases = {'ps1': 'powershell'} -< g:ale_powershell_psscriptanalyzer_executable *g:ale_powershell_psscriptanalyzer_executable* diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index 93f1d668..f0c8bfb8 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -41,6 +41,32 @@ ALE will look for configuration files with the following filenames. > The first directory containing any of the files named above will be used. +=============================================================================== +autoimport *ale-python-autoimport* + +g:ale_python_autoimport_executable *g:ale_python_autoimport_executable* + *b:ale_python_autoimport_executable* + Type: |String| + Default: `'autoimport'` + + See |ale-integrations-local-executables| + + +g:ale_python_autoimport_options *g:ale_python_autoimport_options* + *b:ale_python_autoimport_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to autoimport. + + +g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global* + *b:ale_python_autoimport_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + =============================================================================== autopep8 *ale-python-autopep8* @@ -169,13 +195,14 @@ flake8 *ale-python-flake8* g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory* *b:ale_python_flake8_change_directory* - Type: |Number| - Default: `1` + Type: |String| + Default: `project` - If set to `1`, ALE will switch to the directory the Python file being - checked with `flake8` is in before checking it. This helps `flake8` find - configuration files more easily. This option can be turned off if you want - to control the directory Python is executed from yourself. + If set to `project`, ALE will switch to the project root before checking file. + If set to `file`, ALE will switch to directory the Python file being + checked with `flake8` is in before checking it. + You can turn it off with `off` option if you want to control the directory + Python is executed from yourself. g:ale_python_flake8_executable *g:ale_python_flake8_executable* @@ -598,6 +625,7 @@ g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* Use message for output (e.g. I0011) instead of symbolic name of the message (e.g. locally-disabled). + =============================================================================== pyls *ale-python-pyls* @@ -682,6 +710,65 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* if true. This is overridden by a manually-set executable. +=============================================================================== +pyright *ale-python-pyright* + +The `pyright` linter requires a recent version of `pyright` which includes +the `pyright-langserver` executable. You can install `pyright` on your system +through `npm` with `sudo npm install -g pyright` or similar. + +Refer to their README for installation instructions: +https://github.com/Microsoft/pyright + +`pyright` needs to know the path to your Python executable and probably a +virtualenv to run. ALE will try to detect these automatically. +See |g:ale_python_pyright_config|. + + +g:ale_python_pyright_executable *g:ale_python_pyright_executable* + *b:ale_python_pyright_executable* + Type: |String| + Default: `'pyright-langserver'` + + The executable for running `pyright`, which is typically installed globally. + + +g:ale_python_pyright_config *g:ale_python_pyright_config* + *b:ale_python_pyright_config* + Type: |Dictionary| + Default: `{}` + + Settings for configuring the `pyright` language server. + + See pyright's documentation for a full list of options: + https://github.com/microsoft/pyright/blob/master/docs/settings.md + + ALE will automatically try to set defaults for `venvPath` and `pythonPath` + so your project can automatically be checked with the right libraries. + You can override these settings with whatever you want in your ftplugin + file like so: > + + let b:ale_python_pyright_config = { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ 'venvPath': '/other/dir', + \ }, + \} +< + If `venvPath` is set, but `pythonPath` is not, + ALE will use `venvPath . '/bin/python'` or similar as `pythonPath`. + + A commonly used setting for `pyright` is disabling language services + apart from type checking and "hover" (|ale-hover|), you can set this + setting like so, or use whatever other settings you want: > + + let b:ale_python_pyright_config = { + \ 'pyright': { + \ 'disableLanguageServices': v:true, + \ }, + \} +< + =============================================================================== reorder-python-imports *ale-python-reorder_python_imports* diff --git a/sources_non_forked/ale/doc/ale-r.txt b/sources_non_forked/ale/doc/ale-r.txt index b5ccebe5..3fabf702 100644 --- a/sources_non_forked/ale/doc/ale-r.txt +++ b/sources_non_forked/ale/doc/ale-r.txt @@ -2,6 +2,29 @@ ALE R Integration *ale-r-options* +=============================================================================== +languageserver *ale-r-languageserver* + +g:ale_r_languageserver_cmd *g:ale_r_languageserver_cmd* + *b:ale_r_languageserver_cmd* + Type: |String| + Default: `'languageserver::run()'` + + This option can be configured to change the execution command for + languageserver. + + See the languageserver documentation for more options. + + +g:ale_r_languageserver_config *g:ale_r_languageserver_config* + *b:ale_r_languageserver_config* + Type: |Dictionary| + Default: `{}` + + This option can be configured to change settings for languageserver. See the + languageserver documentation for more information. + + =============================================================================== lintr *ale-r-lintr* @@ -22,7 +45,7 @@ g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* Default: `0` When set to `1`, the file will be checked with `lintr::lint_package` instead - of `lintr::lint`. This prevents erroneous namespace warnings when linting + of `lintr::lint`. This prevents erroneous namespace warnings when linting package files. @@ -36,8 +59,8 @@ g:ale_r_styler_options *g:ale_r_styler_options* This option can be configured to change the options for styler. - The value of this option will be used as the `style` argument for the - `styler::style_file` options. Consult the styler documentation + The value of this option will be used as the `style` argument for the + `styler::style_file` options. Consult the styler documentation for more information. diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index a27a20b2..8815404a 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -114,6 +114,14 @@ g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* This variable can be changed to modify flags given to rubocop. +g:ale_ruby_rubocop_auto_correct_all *g:ale_ruby_rubocop_auto_correct_all* + *b:ale_ruby_rubocop_auto_correct_all* + Type: Number + Default: `0` + + This variable can be changed to make rubocop to correct all offenses (unsafe). + + =============================================================================== ruby *ale-ruby-ruby* @@ -172,8 +180,8 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* =============================================================================== standardrb *ale-ruby-standardrb* -g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* - *b:ale_ruby_standardrb_executable* +g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* + *b:ale_ruby_standardrb_executable* Type: String Default: `'standardrb'` diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 46d4714b..3aa63673 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -22,20 +22,20 @@ Integration Information 3. rls -- If you have `rls` installed, you might prefer using this linter over cargo. rls implements the Language Server Protocol for incremental compilation of Rust code, and can check Rust files while you type. `rls` - requires Rust files to contained in Cargo projects. + requires Rust files to be contained in Cargo projects. 4. analyzer -- If you have rust-analyzer installed, you might prefer using this linter over cargo and rls. rust-analyzer also implements the Language Server Protocol for incremental compilation of Rust code, and is the next iteration of rls. rust-analyzer, like rls, requires Rust files - to contained in Cargo projects. + to be contained in Cargo projects. 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. - Only cargo is enabled by default. To switch to using rustc instead of cargo, - configure |g:ale_linters| appropriately: > + Only cargo and rls are enabled by default. To switch to using rustc instead + of cargo, configure |g:ale_linters| appropriately: > " See the help text for the option for more information. - let g:ale_linters = {'rust': ['rustc']} + let g:ale_linters = {'rust': ['rustc', 'rls']} < Also note that rustc 1.12. or later is needed. @@ -60,6 +60,7 @@ g:ale_rust_analyzer_config *g:ale_rust_analyzer_config* Dictionary with configuration settings for rust-analyzer. + =============================================================================== cargo *ale-rust-cargo* @@ -174,6 +175,18 @@ g:ale_rust_cargo_clippy_options only `cargo clippy` supports (e.g. `--deny`). +g:ale_rust_cargo_target_dir + *g:ale_rust_cargo_target_dir* + *b:ale_rust_cargo_target_dir* + + Type: |String| + Default: `''` + + Use a custom target directory when running the commands for ALE. This can + help to avoid "waiting for file lock on build directory" messages when + running `cargo` commands manually while ALE is performing its checks. + + =============================================================================== rls *ale-rust-rls* @@ -240,23 +253,25 @@ g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* > let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] + g:ale_rust_ignore_secondary_spans *g:ale_rust_ignore_secondary_spans* *b:ale_rust_ignore_secondary_spans* Type: Number Default: 0 - When set to 1, instructs the Rust error repporting to ignore secondary - spans. The problem with secondary spans is that they sometimes appear in - error messages before the main cause of the error, for example: > + When set to 1, instructs the Rust error reporting to ignore secondary spans. + The problem with secondary spans is that they sometimes appear in error + messages before the main cause of the error, for example: > 1 src/main.rs|98 col 5 error| this function takes 4 parameters but 5 - parameters were supplied: defined here + parameters were supplied: defined here 2 src/main.rs|430 col 32 error| this function takes 4 parameters but 5 - parameters were supplied: expected 4 parameters + parameters were supplied: expected 4 parameters < This is due to the sorting by line numbers. With this option set to 1, the 'defined here' span will not be presented. + =============================================================================== rustfmt *ale-rust-rustfmt* diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt index 3eac9038..c06f737a 100644 --- a/sources_non_forked/ale/doc/ale-sh.txt +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -2,6 +2,29 @@ ALE Shell Integration *ale-sh-options* +=============================================================================== +bashate *ale-sh-bashate* + +g:ale_sh_bashate_executable *g:ale_sh_bashate_executable* + *b:ale_sh_bashate_executable* + Type: |String| + Default: `'bashate'` + + This variable sets executable used for bashate. + + +g:ale_sh_bashate_options *g:ale_sh_bashate_options* + *b:ale_sh_bashate_options* + Type: |String| + Default: `''` + + With this variable we are able to pass extra arguments for bashate. For + example to ignore the indentation rule: + +> + let g:ale_sh_bashate_options = '-i E003' +< + =============================================================================== sh-language-server *ale-sh-language-server* diff --git a/sources_non_forked/ale/doc/ale-sql.txt b/sources_non_forked/ale/doc/ale-sql.txt index 2807271b..398e24d3 100644 --- a/sources_non_forked/ale/doc/ale-sql.txt +++ b/sources_non_forked/ale/doc/ale-sql.txt @@ -3,7 +3,7 @@ ALE SQL Integration *ale-sql-options* =============================================================================== -pgformatter *ale-sql-pgformatter* +pgformatter *ale-sql-pgformatter* g:ale_sql_pgformatter_executable *g:ale_sql_pgformatter_executable* *b:ale_sql_pgformatter_executable* diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 45252294..36e27932 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -21,6 +21,7 @@ Notes: * `drafter` * AsciiDoc * `alex`!! + * `languagetool`!! * `proselint` * `redpen` * `textlint` @@ -31,6 +32,7 @@ Notes: * Awk * `gawk` * Bash + * `bashate` * `language-server` * `shell` (-n flag) * `shellcheck` @@ -44,8 +46,9 @@ Notes: * `shellcheck` * `shfmt` * C + * `astyle` * `ccls` - * `clang` + * `clang` (`cc`) * `clangd` * `clang-format` * `clangtidy`!! @@ -53,7 +56,7 @@ Notes: * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * C# * `csc`!! @@ -61,8 +64,9 @@ Notes: * `mcsc`!! * `uncrustify` * C++ (filetype cpp) + * `astyle` * `ccls` - * `clang` + * `clang` (`cc`) * `clangcheck`!! * `clangd` * `clang-format` @@ -72,7 +76,7 @@ Notes: * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * Chef * `cookstyle` @@ -115,6 +119,8 @@ Notes: * `dartanalyzer`!! * `dartfmt`!! * `language_server` +* Dhall + * `dhall-format` * Dockerfile * `dockerfile_lint` * `hadolint` @@ -134,6 +140,7 @@ Notes: * `erubis` * `ruumba` * Erlang + * `elvis`!! * `erlc` * `SyntaxErl` * Fish @@ -189,6 +196,7 @@ Notes: * `hie` * `hindent` * `hlint` + * `ormolu` * `stack-build`!! * `stack-ghc` * `stylish-haskell` @@ -259,6 +267,7 @@ Notes: * Lua * `luac` * `luacheck` + * `luafmt` * Mail * `alex`!! * `languagetool`!! @@ -318,6 +327,7 @@ Notes: * Perl6 * `perl6 -c` * PHP + * `intelephense` * `langserver` * `phan` * `phpcbf` @@ -327,6 +337,7 @@ Notes: * `phpmd` * `phpstan` * `psalm`!! + * `tlint` * PO * `alex`!! * `msgfmt` @@ -355,6 +366,7 @@ Notes: * `purescript-language-server` * `purty` * Python + * `autoimport` * `autopep8` * `bandit` * `black` @@ -369,6 +381,7 @@ Notes: * `pylint`!! * `pyls` * `pyre` + * `pyright` * `reorder-python-imports` * `vulture`!! * `yapf` @@ -376,6 +389,7 @@ Notes: * `qmlfmt` * `qmllint` * R + * `languageserver` * `lintr` * `styler` * Racket @@ -442,11 +456,13 @@ Notes: * `sqlfmt` * `sqlformat` * `sqlint` + * `sql-lint` * Stylus * `stylelint` * SugarSS * `stylelint` * Swift + * Apple `swift-format` * `sourcekit-lsp` * `swiftformat` * `swiftlint` @@ -480,6 +496,7 @@ Notes: * VALA * `uncrustify` * Verilog + * `hdl-checker` * `iverilog` * `verilator` * `vlog` @@ -507,6 +524,9 @@ Notes: * YAML * `prettier` * `swaglint` + * `yamlfix` * `yamllint` * YANG * `yang-lsp` +* Zig + * `zls` diff --git a/sources_non_forked/ale/doc/ale-verilog.txt b/sources_non_forked/ale/doc/ale-verilog.txt index 94b820b8..01af63c2 100644 --- a/sources_non_forked/ale/doc/ale-verilog.txt +++ b/sources_non_forked/ale/doc/ale-verilog.txt @@ -3,7 +3,10 @@ ALE Verilog/SystemVerilog Integration *ale-verilog-options* =============================================================================== -ALE can use four different linters for Verilog HDL: +ALE can use five different linters for Verilog HDL: + + HDL Checker + Using `hdl_checker --lsp` iverilog: Using `iverilog -t null -Wall` @@ -26,6 +29,9 @@ defining 'g:ale_linters' variable: \ let g:ale_linters = {'systemverilog' : ['verilator'],} < +=============================================================================== +General notes + Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as part of their respective option strings listed below. This is useful for @@ -40,6 +46,16 @@ changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. +HDL Checker is an alternative for some of the issues described above. It wraps +around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can +handle mixed language (VHDL, Verilog, SystemVerilog) designs. + +=============================================================================== +hdl-checker *ale-verilog-hdl-checker* + +See |ale-vhdl-hdl-checker| + + =============================================================================== iverilog *ale-verilog-iverilog* diff --git a/sources_non_forked/ale/doc/ale-vhdl.txt b/sources_non_forked/ale/doc/ale-vhdl.txt index 3fea947d..c2870240 100644 --- a/sources_non_forked/ale/doc/ale-vhdl.txt +++ b/sources_non_forked/ale/doc/ale-vhdl.txt @@ -3,10 +3,10 @@ ALE VHDL Integration *ale-vhdl-options* =============================================================================== -ALE can use three different linters for VHDL: +ALE can use four different linters for VHDL: - iverilog: - Using `iverilog -t null -Wall` + ghdl: + Using `ghdl --std=08` ModelSim/Questa Using `vcom -2008 -quiet -lint` @@ -14,8 +14,15 @@ ALE can use three different linters for VHDL: Vivado Using `xvhdl --2008` -Note all linters default to VHDL-2008 support. This, and other options, can be -changed with each linter's respective option variable. + HDL Checker + Using `hdl_checker --lsp` + +=============================================================================== +General notes + +ghdl, ModelSim/Questa and Vivado linters default to VHDL-2008 support. This, +and other options, can be changed with each linter's respective option +variable. Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as @@ -31,6 +38,10 @@ changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. +HDL Checker is an alternative for some of the issues described above. It wraps +around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can +handle mixed language (VHDL, Verilog, SystemVerilog) designs. + =============================================================================== ghdl *ale-vhdl-ghdl* @@ -50,6 +61,60 @@ g:ale_vhdl_ghdl_options *g:ale_vhdl_ghdl_options* This variable can be changed to modify the flags/options passed to 'ghdl'. +=============================================================================== +hdl-checker *ale-vhdl-hdl-checker* + +HDL Checker is a wrapper for VHDL/Verilg/SystemVerilog tools that aims to +reduce the boilerplate code needed to set things up. It can automatically +infer libraries for VHDL sources, determine the compilation order and provide +some static checks. + +You can install it using pip: +> + $ pip install hdl-checker + +`hdl-checker` will be run from a detected project root, determined by the +following methods, in order: + +1. Find the first directory containing a configuration file (see + |g:ale_hdl_checker_config_file|) +2. If no configuration file can be found, find the first directory containing + a folder named `'.git' +3. If no such folder is found, use the directory of the current buffer + + +g:ale_hdl_checker_executable + *g:ale_hdl_checker_executable* + *b:ale_hdl_checker_executable* + Type: |String| + Default: `'hdl_checker'` + + This variable can be changed to the path to the 'hdl_checker' executable. + + +g:ale_hdl_checker_options *g:ale_hdl_checker_options* + *b:ale_hdl_checker_options* + Type: |String| + Default: `''` + + This variable can be changed to modify the flags/options passed to the + 'hdl_checker' server startup command. + + +g:ale_hdl_checker_config_file *g:ale_hdl_checker_config_file* + *b:ale_hdl_checker_config_file* + Type: |String| + Default: `'.hdl_checker.config'` (Unix), + `'_hdl_checker.config'` (Windows) + + This variable can be changed to modify the config file HDL Checker will try + to look for. It will also affect how the project's root directory is + determined (see |ale-vhdl-hdl-checker|). + + More info on the configuration file format can be found at: + https://github.com/suoto/hdl_checker/wiki/Setting-up-a-project + + =============================================================================== vcom *ale-vhdl-vcom* diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt index c9a12ea1..61bfc139 100644 --- a/sources_non_forked/ale/doc/ale-yaml.txt +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -15,7 +15,6 @@ Install prettier either globally or locally: > npm install prettier -g # global npm install prettier # local < - =============================================================================== swaglint *ale-yaml-swaglint* @@ -49,6 +48,43 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* See |ale-integrations-local-executables| +=============================================================================== +yamlfix *ale-yaml-yamlfix* + +Website: https://lyz-code.github.io/yamlfix + + +Installation +------------------------------------------------------------------------------- + +Install yamlfix: > + + pip install yamlfix +< + +Options +------------------------------------------------------------------------------- +g:ale_yaml_yamlfix_executable *g:ale_yaml_yamlfix_executable* + *b:ale_yaml_yamlfix_executable* + Type: |String| + Default: `'yamlfix'` + + See |ale-integrations-local-executables| + + +g:ale_yaml_yamlfix_options *g:ale_yaml_yamlfix_options* + *b:ale_yaml_yamlfix_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to yamlfix. + +g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global* + *b:ale_yaml_yamlfix_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| =============================================================================== yamllint *ale-yaml-yamllint* diff --git a/sources_non_forked/ale/doc/ale-zig.txt b/sources_non_forked/ale/doc/ale-zig.txt new file mode 100644 index 00000000..70a53bbb --- /dev/null +++ b/sources_non_forked/ale/doc/ale-zig.txt @@ -0,0 +1,33 @@ +=============================================================================== +ALE Zig Integration *ale-zig-options* + *ale-integration-zig* + +=============================================================================== +Integration Information + + Currently, the only supported linter for zig is zls. + +=============================================================================== +zls *ale-zig-zls* + +g:ale_zig_zls_executable *g:ale_zig_zls_executable* + *b:ale_zig_zls_executable* + Type: |String| + Default: `'zls'` + + This variable can be modified to change the executable path for `zls`. + + +g:ale_zig_zls_config *g:ale_zig_zls_config* + *b:ale_zig_zls_config* + Type: |Dictionary| + Default: `{}` + + WARNING: As of writing, zls does not support receiving configuration + from the client. This variable is a PLACEHOLDER until it does. + + Dictionary with configuration settings for zls. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 724da57e..f9f40d12 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -9,8 +9,9 @@ CONTENTS *ale-contents* 1. Introduction.........................|ale-introduction| 2. Supported Languages & Tools..........|ale-support| 3. Linting..............................|ale-lint| - 3.1 Adding Language Servers...........|ale-lint-language-servers| - 3.2 Other Sources.....................|ale-lint-other-sources| + 3.1 Linting On Other Machines.........|ale-lint-other-machines| + 3.2 Adding Language Servers...........|ale-lint-language-servers| + 3.3 Other Sources.....................|ale-lint-other-sources| 4. Fixing Problems......................|ale-fix| 5. Language Server Protocol Support.....|ale-lsp| 5.1 Completion........................|ale-completion| @@ -19,6 +20,7 @@ CONTENTS *ale-contents* 5.4 Find References...................|ale-find-references| 5.5 Hovering..........................|ale-hover| 5.6 Symbol Search.....................|ale-symbol-search| + 5.7 Refactoring: Rename, Actions......|ale-refactor| 6. Global Options.......................|ale-options| 6.1 Highlights........................|ale-highlights| 7. Linter/Fixer Options.................|ale-integration-options| @@ -127,7 +129,7 @@ their relevant options. * By showing balloons for your mouse cursor - |g:ale_set_balloons| Please consult the documentation for each option, which can reveal some other -ways of tweaking the behaviour of each way of displaying problems. You can +ways of tweaking the behavior of each way of displaying problems. You can disable or enable whichever options you prefer. Most settings can be configured for each buffer. (|b:| instead of |g:|), @@ -146,9 +148,68 @@ ALE offers several options for controlling which linters are run. * Disabling only a subset of linters. - |g:ale_linters_ignore| * Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| +You can stop ALE any currently running linters with the |ALELintStop| command. +Any existing problems will be kept. ------------------------------------------------------------------------------- -3.1 Adding Language Servers *ale-lint-language-servers* +3.1 Linting On Other Machines *ale-lint-other-machines* + +ALE offers support for running linters or fixers on files you are editing +locally on other machines, so long as the other machine has access to the file +you are editing. This could be a linter or fixer run inside of a Docker image, +running in a virtual machine, running on a remote server, etc. + +In order to run tools on other machines, you will need to configure your tools +to run via scripts that execute commands on those machines, such as by setting +the ALE `_executable` options for those tools to a path for a script to run, +or by using |g:ale_command_wrapper| to specify a script to wrap all commands +that are run by ALE, before they are executed. For tools that ALE runs where +ALE looks for locally installed executables first, you may need to set the +`_use_global` options for those tools to `1`, or you can set +|g:ale_use_global_executables| to `1` before ALE is loaded to only use global +executables for all tools. + +In order for ALE to properly lint or fix files which are running on another +file system, you must provide ALE with |List|s of strings for mapping paths to +and from your local file system and the remote file system, such as the file +system of your Docker container. See |g:ale_filename_mappings| for all of the +different ways these filename mappings can be configured. + +For example, you might configure `pylint` to run via Docker by creating a +script like so. > + + #!/usr/bin/env bash + + exec docker run -i --rm -v "$(pwd):/data" cytopia/pylint "$@" +< + +You will run to run Docker commands with `-i` in order to read from stdin. + +With the above script in mind, you might configure ALE to lint your Python +project with `pylint` by providing the path to the script to execute, and +mappings which describe how to between the two file systems in your +`python.vim` |ftplugin| file, like so: > + + if expand('%:p') =~# '^/home/w0rp/git/test-pylint/' + let b:ale_linters = ['pylint'] + let b:ale_python_pylint_use_global = 1 + " This is the path to the script above. + let b:ale_python_pylint_executable = '/home/w0rp/git/test-pylint/pylint.sh' + " /data matches the path in Docker. + let b:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/w0rp/git/test-pylint', '/data'], + \ ], + \} + endif +< + +You might consider using a Vim plugin for loading Vim configuration files +specific to each project, if you have a lot of projects to manage. + + +------------------------------------------------------------------------------- +3.2 Adding Language Servers *ale-lint-language-servers* ALE comes with many default configurations for language servers, so they can be detected and run automatically. ALE can connect to other language servers @@ -189,7 +250,7 @@ address to connect to instead. > ------------------------------------------------------------------------------- -3.2 Other Sources *ale-lint-other-sources* +3.3 Other Sources *ale-lint-other-sources* Problems for a buffer can be taken from other sources and rendered by ALE. This allows ALE to be used in combination with other plugins which also want @@ -246,7 +307,7 @@ A plugin might integrate its own checks with ALE like so: > function! WorkDone(buffer, results) abort " Send results to ALE after they have been collected. - call ale#other_source#ShowResults(buffer, 'some-name', a:results) + call ale#other_source#ShowResults(a:buffer, 'some-name', a:results) endfunction < @@ -287,6 +348,8 @@ are supported for running the commands. file will be created, containing the lines from the file after previous adjustment have been done. + See |ale-command-format-strings| for formatting options. + `read_temporary_file` When set to `1`, ALE will read the contents of the temporary file created for `%t`. This option can be used for commands which need to modify some file on disk in @@ -356,6 +419,10 @@ by default. Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will still be run when you manually run |ALEFix|. +Fixers can be run on another machines, just like linters, such as fixers run +from a Docker container, running in a virtual machine, running a remote +server, etc. See |ale-lint-other-machines|. + =============================================================================== 5. Language Server Protocol Support *ale-lsp* @@ -402,12 +469,56 @@ is loaded. The delay for completion can be configured with |g:ale_completion_delay|. This setting should not be enabled if you wish to use ALE as a completion source for other plugins. +ALE automatic completion will not work when 'paste' is active. Only set +'paste' when you are copy and pasting text into your buffers. + +ALE automatic completion will interfere with default insert completion with +`CTRL-N` and so on (|compl-vim|). You can write your own keybinds and a +function in your |vimrc| file to force insert completion instead, like so: > + + function! SmartInsertCompletion() abort + " Use the default CTRL-N in completion menus + if pumvisible() + return "\" + endif + + " Exit and re-enter insert mode, and use insert completion + return "\a\" + endfunction + + inoremap =SmartInsertCompletion() +< ALE provides an 'omnifunc' function |ale#completion#OmniFunc| for triggering completion manually with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| > " Use ALE's function for omnicompletion. set omnifunc=ale#completion#OmniFunc < + *ale-completion-fallback* + +You can write your own completion function and fallback on other methods of +completion by checking if there are no results that ALE can determine. For +example, for Python code, you could fall back on the `python3complete` +function. > + + function! TestCompletionFunc(findstart, base) abort + let l:result = ale#completion#OmniFunc(a:findstart, a:base) + + " Check if ALE couldn't find anything. + if (a:findstart && l:result is -3) + \|| (!a:findstart && empty(l:result)) + " Defer to another omnifunc if ALE couldn't find anything. + return python3complete#Complete(a:findstart, a:base) + endif + + return l:result + endfunction + + set omnifunc=TestCompletionFunc +< +See |complete-functions| for documentation on how to write completion +functions. + ALE will only suggest so many possible matches for completion. The maximum number of items can be controlled with |g:ale_completion_max_suggestions|. @@ -418,9 +529,21 @@ The |ALEComplete| command can be used to show completion suggestions manually, even when |g:ale_completion_enabled| is set to `0`. For manually requesting completion information with Deoplete, consult Deoplete's documentation. -When working with TypeScript files, ALE by can support automatic imports -from external modules. This behavior can be enabled by setting the -|g:ale_completion_tsserver_autoimport| variable to `1`. +ALE by can support automatic imports from external modules. This behavior can +be enabled by setting the |g:ale_completion_autoimport| variable to `1`. + +You can manually request imports for symbols at the cursor with the +|ALEImport| command. The word at the cursor must be an exact match for some +potential completion result which includes additional text to insert into the +current buffer, which ALE will assume is code for an import line. This command +can be useful when your code already contains something you need to import. + +You can execute other commands whenever ALE inserts some completion text with +the |ALECompletePost| event. + +When working with TypeScript files, ALE can remove warnings from your +completions by setting the |g:ale_completion_tsserver_remove_warnings| +variable to 1. *ale-completion-completeopt-bug* @@ -498,15 +621,9 @@ displayed. ------------------------------------------------------------------------------- 5.4 Find References *ale-find-references* -ALE supports finding references for symbols though any enabled LSP linters. -ALE will display a preview window showing the places where a symbol is -referenced in a codebase when a command is run. The following commands are -supported: - -|ALEFindReferences| - Find references for the word under the cursor. - -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports finding references for symbols though any enabled LSP linters +with the |ALEFindReferences| command. See the documentation for the command +for a full list of options. ------------------------------------------------------------------------------- 5.5 Hovering *ale-hover* @@ -516,6 +633,10 @@ at the cursor taken from LSP linters. The following commands are supported: |ALEHover| - Print information about the symbol at the cursor. +Truncated information will be displayed when the cursor rests on a symbol by +default, as long as there are no problems on the same line. You can disable +this behavior by setting |g:ale_hover_cursor| to `0`. + If |g:ale_set_balloons| is set to `1` and your version of Vim supports the |balloon_show()| function, then "hover" information also show up when you move the mouse over a symbol in a buffer. Diagnostic information will take priority @@ -545,14 +666,38 @@ Documentation for symbols at the cursor can be retrieved using the ------------------------------------------------------------------------------- 5.6 Symbol Search *ale-symbol-search* -ALE supports searching for workspace symbols via LSP linters. The following -commands are supported: +ALE supports searching for workspace symbols via LSP linters with the +|ALESymbolSearch| command. See the documentation for the command +for a full list of options. -|ALESymbolSearch| - Search for symbols in the workspace. +------------------------------------------------------------------------------- +5.7 Refactoring: Rename, Actions *ale-refactor* -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports renaming symbols in code such as variables or class names with +the |ALERename| command. +|ALECodeAction| will execute actions on the cursor or applied to a visual +range selection, such as automatically fixing errors. + +Actions will appear in the right click mouse menu by default for GUI versions +of Vim, unless disabled by setting |g:ale_popup_menu_enabled| to `0`. + +Make sure to set your Vim to move the cursor position whenever you right +click, and enable the mouse menu: > + + set mouse=a + set mousemodel=popup_setpos +< +You may wish to remove some other menu items you don't want to see: > + + silent! aunmenu PopUp.Select\ Word + silent! aunmenu PopUp.Select\ Sentence + silent! aunmenu PopUp.Select\ Paragraph + silent! aunmenu PopUp.Select\ Line + silent! aunmenu PopUp.Select\ Block + silent! aunmenu PopUp.Select\ Blockwise + silent! aunmenu PopUp.Select\ All +< =============================================================================== 6. Global Options *ale-options* @@ -671,6 +816,9 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting should not be enabled if you wish to use ALE as a completion source for other completion plugins. + ALE automatic completion will not work when 'paste' is active. Only set + 'paste' when you are copy and pasting text into your buffers. + A buffer-local version of this setting `b:ale_completion_enabled` can be set to `0` to disable ALE's automatic completion support for a single buffer. ALE's completion support must be enabled globally to be enabled locally. @@ -678,7 +826,18 @@ g:ale_completion_enabled *g:ale_completion_enabled* See |ale-completion| -g:ale_completion_tsserver_autoimport *g:ale_completion_tsserver_autoimport* + *g:ale_completion_tsserver_remove_warnings* +g:ale_completion_tsserver_remove_warnings + + Type: Number + Default: `0` + + When this option is set to `0`, ALE will return all completion items, + including those that are a warning. Warnings can be excluded from completed + items by setting it to `1`. + + +g:ale_completion_autoimport *g:ale_completion_autoimport* Type: Number Default: `0` @@ -792,7 +951,7 @@ g:ale_default_navigation *g:ale_default_navigation* Default: `'buffer'` The default method for navigating away from the current buffer to another - buffer, such as for |ALEFindReferences:|, or |ALEGoToDefinition|. + buffer, such as for |ALEFindReferences|, or |ALEGoToDefinition|. g:ale_disable_lsp *g:ale_disable_lsp* @@ -1048,9 +1207,27 @@ g:ale_history_log_output *g:ale_history_log_output* if you want to save on some memory usage. +g:ale_hover_cursor *g:ale_hover_cursor* + + Type: |Number| + Default: `1` + + If set to `1`, ALE will show truncated information in the echo line about + the symbol at the cursor automatically when the |CursorHold| event is fired. + The delay before requesting hover information is based on 'updatetime', as + with all |CursorHold| events. + + If there's a problem on the line where the cursor is resting, ALE will not + show any hover information. + + See |ale-hover| for more information on hover information. + + This setting must be set to `1` before ALE is loaded for this behavior + to be enabled. See |ale-lint-settings-on-startup|. + + g:ale_hover_to_preview *g:ale_hover_to_preview* *b:ale_hover_to_preview* - Type: |Number| Default: `0` @@ -1085,7 +1262,7 @@ g:ale_list_window_size *g:ale_list_window_size* g:ale_lint_delay *g:ale_lint_delay* - + *b:ale_lint_delay* Type: |Number| Default: `200` @@ -1093,6 +1270,9 @@ g:ale_lint_delay *g:ale_lint_delay* be run after text is changed. This option is only meaningful with the |g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`. + A buffer-local option, `b:ale_lint_delay`, can be set to change the delay + for different buffers, such as in |ftplugin| files. + g:ale_lint_on_enter *g:ale_lint_on_enter* @@ -1205,6 +1385,7 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'csh': 'sh', \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', + \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', \ 'systemverilog': 'verilog', @@ -1249,6 +1430,90 @@ g:ale_linter_aliases *g:ale_linter_aliases* < No linters will be loaded when the buffer's filetype is empty. + +g:ale_filename_mappings *g:ale_filename_mappings* + *b:ale_filename_mappings* + + Type: |Dictionary| or |List| + Default: `{}` + + Either a |Dictionary| mapping a linter or fixer name, as displayed in + |:ALEInfo|, to a |List| of two-item |List|s for filename mappings, or just a + |List| of two-item |List|s. When given some paths to files, the value of + this setting will be used to convert filenames on a local file system to + filenames on some remote file system, such as paths in a Docker image, + virtual machine, or network drive. + + For example: > + + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \} +< + With the above configuration, a filename such as `/home/john/proj/foo.py` + will be provided to the linter/fixer as `/data/foo.py`, and paths parsed + from linter results such as `/data/foo.py` will be converted back to + `/home/john/proj/foo.py`. + + You can use `*` as to apply a |List| of filename mappings to all other + linters or fixers not otherwise matched. > + + " Use one List of paths for pylint. + " Use another List of paths for everything else. + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \ '*': [ + \ ['/home/john/proj', '/other-data'], + \ ], + \} +< + If you just want every single linter or fixer to use the same filename + mapping, you can just use a |List|. > + + " Same as above, but for ALL linters and fixers. + let g:ale_filename_mappings = [ + \ ['/home/john/proj', '/data'], + \] +< + You can provide many such filename paths for multiple projects. Paths are + matched by checking if the start of a file path matches the given strings, + in a case-sensitive manner. Earlier entries in the |List| will be tried + before later entries when mapping to a given file system. + + Buffer-local options can be set to the same values to override the global + options, such as in |ftplugin| files. + + NOTE: Only fixers registered with a short name can support filename mapping + by their fixer names. See |ale-fix|. Filename mappings set for all tools by + using only a |List| for the setting will also be applied to fixers not in + the registry. + + NOTE: In order for this filename mapping to work correctly, linters and + fixers must exclusively determine paths to files to lint or fix via ALE + command formatting as per |ale-command-format-strings|, and paths parsed + from linter files must be provided in `filename` keys if a linter returns + results for more than one file at a time, as per |ale-loclist-format|. If + you discover a linter or fixer which does not behave properly, please report + it as an issue. + + If you are running a linter or fixer through Docker or another remote file + system, you may have to mount your temporary directory, which you can + discover with the following command: > + + :echo fnamemodify(tempname(), ':h:h') +< + You should provide a mapping from this temporary directory to whatever you + mount this directory to in Docker, or whatever remote file system you are + working with. + + You can inspect the filename mappings ALE will use with the + |ale#GetFilenameMappings()| function. + + g:ale_linters *g:ale_linters* *b:ale_linters* Type: |Dictionary| @@ -1268,8 +1533,8 @@ g:ale_linters *g:ale_linters* \ 'help': [], \ 'perl': ['perlcritic'], \ 'perl6': [], - \ 'python': ['flake8', 'mypy', 'pylint'], - \ 'rust': ['cargo'], + \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], + \ 'rust': ['cargo', 'rls'], \ 'spec': [], \ 'text': [], \ 'vue': ['eslint', 'vls'], @@ -1429,6 +1694,7 @@ g:ale_lsp_root *g:ale_lsp_root* If neither variable yields a result, a linter-specific function is invoked to detect a project root. If this, too, yields no result, the linter is disabled. + g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* Type: |Number| @@ -1537,6 +1803,19 @@ g:ale_pattern_options_enabled *g:ale_pattern_options_enabled* will not set buffer variables per |g:ale_pattern_options|. +g:ale_popup_menu_enabled *g:ale_popup_menu_enabled* + + Type: |Number| + Default: `has('gui_running')` + + When this option is set to `1`, ALE will show code actions and rename + capabilities in the right click mouse menu when there's a LSP server or + tsserver available. See |ale-refactor|. + + This setting must be set to `1` before ALE is loaded for this behavior + to be enabled. See |ale-lint-settings-on-startup|. + + g:ale_rename_tsserver_find_in_comments *g:ale_rename_tsserver_find_in_comments* Type: |Number| @@ -1561,7 +1840,7 @@ g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* g:ale_set_balloons *g:ale_set_balloons* *b:ale_set_balloons* - Type: |Number| + Type: |Number| or |String| Default: `has('balloon_eval') && has('gui_running')` When this option is set to `1`, balloon messages will be displayed for @@ -1572,6 +1851,13 @@ g:ale_set_balloons *g:ale_set_balloons* supporting "Hover" information, per |ale-hover|, then brief information about the symbol under the cursor will be displayed in a balloon. + This option can be set to `'hover'` to only enable balloons for hover + message, so diagnostics are never shown in balloons. You may wish to + configure use this setting only in GUI Vim like so: > + + let g:ale_set_balloons = has('gui_running') ? 'hover' : 0 +< + Balloons can be enabled for terminal versions of Vim that support balloons, but some versions of Vim will produce strange mouse behavior when balloons are enabled. To configure balloons for your terminal, you should first @@ -2284,16 +2570,16 @@ documented in additional help files. bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| c.......................................|ale-c-options| - clang.................................|ale-c-clang| + astyle................................|ale-c-astyle| + cc....................................|ale-c-cc| + ccls..................................|ale-c-ccls| clangd................................|ale-c-clangd| clang-format..........................|ale-c-clangformat| clangtidy.............................|ale-c-clangtidy| cppcheck..............................|ale-c-cppcheck| cquery................................|ale-c-cquery| flawfinder............................|ale-c-flawfinder| - gcc...................................|ale-c-gcc| uncrustify............................|ale-c-uncrustify| - ccls..................................|ale-c-ccls| chef....................................|ale-chef-options| cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| @@ -2306,9 +2592,11 @@ documented in additional help files. cmakelint.............................|ale-cmake-cmakelint| cmake-format..........................|ale-cmake-cmakeformat| cpp.....................................|ale-cpp-options| - clang.................................|ale-cpp-clang| - clangd................................|ale-cpp-clangd| + astyle................................|ale-cpp-astyle| + cc....................................|ale-cpp-cc| + ccls..................................|ale-cpp-ccls| clangcheck............................|ale-cpp-clangcheck| + clangd................................|ale-cpp-clangd| clang-format..........................|ale-cpp-clangformat| clangtidy.............................|ale-cpp-clangtidy| clazy.................................|ale-cpp-clazy| @@ -2316,9 +2604,7 @@ documented in additional help files. cpplint...............................|ale-cpp-cpplint| cquery................................|ale-cpp-cquery| flawfinder............................|ale-cpp-flawfinder| - gcc...................................|ale-cpp-gcc| uncrustify............................|ale-cpp-uncrustify| - ccls..................................|ale-cpp-ccls| c#......................................|ale-cs-options| csc...................................|ale-cs-csc| mcs...................................|ale-cs-mcs| @@ -2353,6 +2639,7 @@ documented in additional help files. elm-make..............................|ale-elm-elm-make| erlang..................................|ale-erlang-options| dialyzer..............................|ale-erlang-dialyzer| + elvis.................................|ale-erlang-elvis| erlc..................................|ale-erlang-erlc| syntaxerl.............................|ale-erlang-syntaxerl| eruby...................................|ale-eruby-options| @@ -2406,6 +2693,7 @@ documented in additional help files. stack-ghc.............................|ale-haskell-stack-ghc| stylish-haskell.......................|ale-haskell-stylish-haskell| hie...................................|ale-haskell-hie| + ormolu................................|ale-haskell-ormolu| hcl.....................................|ale-hcl-options| terraform-fmt.........................|ale-hcl-terraform-fmt| html....................................|ale-html-options| @@ -2465,7 +2753,9 @@ documented in additional help files. lua.....................................|ale-lua-options| luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| + luafmt................................|ale-lua-luafmt| markdown................................|ale-markdown-options| + markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| prettier..............................|ale-markdown-prettier| remark-lint...........................|ale-markdown-remark-lint| @@ -2515,6 +2805,8 @@ documented in additional help files. psalm.................................|ale-php-psalm| php-cs-fixer..........................|ale-php-php-cs-fixer| php...................................|ale-php-php| + tlint.................................|ale-php-tlint| + intelephense..........................|ale-php-intelephense| po......................................|ale-po-options| write-good............................|ale-po-write-good| pod.....................................|ale-pod-options| @@ -2540,6 +2832,7 @@ documented in additional help files. pyrex (cython)..........................|ale-pyrex-options| cython................................|ale-pyrex-cython| python..................................|ale-python-options| + autoimport............................|ale-python-autoimport| autopep8..............................|ale-python-autopep8| bandit................................|ale-python-bandit| black.................................|ale-python-black| @@ -2554,12 +2847,14 @@ documented in additional help files. pylint................................|ale-python-pylint| pyls..................................|ale-python-pyls| pyre..................................|ale-python-pyre| + pyright...............................|ale-python-pyright| reorder-python-imports................|ale-python-reorder_python_imports| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| qml.....................................|ale-qml-options| qmlfmt................................|ale-qml-qmlfmt| r.......................................|ale-r-options| + languageserver........................|ale-r-languageserver| lintr.................................|ale-r-lintr| styler................................|ale-r-styler| reasonml................................|ale-reasonml-options| @@ -2600,6 +2895,7 @@ documented in additional help files. sasslint..............................|ale-scss-sasslint| stylelint.............................|ale-scss-stylelint| sh......................................|ale-sh-options| + bashate...............................|ale-sh-bashate| sh-language-server....................|ale-sh-language-server| shell.................................|ale-sh-shell| shellcheck............................|ale-sh-shellcheck| @@ -2650,12 +2946,14 @@ documented in additional help files. vala....................................|ale-vala-options| uncrustify............................|ale-vala-uncrustify| verilog/systemverilog...................|ale-verilog-options| + hdl-checker...........................|ale-verilog-hdl-checker| iverilog..............................|ale-verilog-iverilog| verilator.............................|ale-verilog-verilator| vlog..................................|ale-verilog-vlog| xvlog.................................|ale-verilog-xvlog| vhdl....................................|ale-vhdl-options| ghdl..................................|ale-vhdl-ghdl| + hdl-checker...........................|ale-vhdl-hdl-checker| vcom..................................|ale-vhdl-vcom| xvhdl.................................|ale-vhdl-xvhdl| vim.....................................|ale-vim-options| @@ -2673,9 +2971,12 @@ documented in additional help files. yaml....................................|ale-yaml-options| prettier..............................|ale-yaml-prettier| swaglint..............................|ale-yaml-swaglint| + yamlfix...............................|ale-yaml-yamlfix| yamllint..............................|ale-yaml-yamllint| yang....................................|ale-yang-options| yang-lsp..............................|ale-yang-lsp| + zig.....................................|ale-zig-options| + zls...................................|ale-zig-zls| =============================================================================== @@ -2722,18 +3023,29 @@ ALEFindReferences *ALEFindReferences* The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + The selection can be opened again with the |ALERepeatSelection| command. You can jump back to the position you were at before going to a reference of something with jump motions like CTRL-O. See |jump-motions|. A plug mapping `(ale_find_references)` is defined for this command. + You can define additional plug mapping with any additional options you want + like so: > + nnoremap (my_mapping) :ALEFindReferences -relative +< ALEFix *ALEFix* Fix problems with the current buffer. See |ale-fix| for more information. + If the command is run with a bang (`:ALEFix!`), all warnings will be + suppressed, including warnings about no fixers being defined, and warnings + about not being able to apply fixes to a file because it has been changed. + A plug mapping `(ale_fix)` is defined for this command. @@ -2766,7 +3078,13 @@ ALEGoToDefinition `` *ALEGoToDefinition* command. Otherwise, Vim will refuse to leave the buffer you're jumping from unless you have saved your edits. - A plug mapping `(ale_go_to_definition)` is defined for this command. + The following Plug mappings are defined for this command, which correspond + to the following commands. + + `(ale_go_to_definition)` - `:ALEGoToDefinition` + `(ale_go_to_definition_in_tab)` - `:ALEGoToDefinition -tab` + `(ale_go_to_definition_in_split)` - `:ALEGoToDefinition -split` + `(ale_go_to_definition_in_vsplit)` - `:ALEGoToDefinition -vsplit` ALEGoToTypeDefinition *ALEGoToTypeDefinition* @@ -2788,8 +3106,13 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. - A plug mapping `(ale_go_to_type_definition)` is defined for this - command. + The following Plug mappings are defined for this command, which correspond + to the following commands. + + `(ale_go_to_type_definition)` - `:ALEGoToTypeDefinition` + `(ale_go_to_type_definition_in_tab)` - `:ALEGoToTypeDefinition -tab` + `(ale_go_to_type_definition_in_split)` - `:ALEGoToTypeDefinition -split` + `(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit` ALEHover *ALEHover* @@ -2805,6 +3128,23 @@ ALEHover *ALEHover* A plug mapping `(ale_hover)` is defined for this command. +ALEImport *ALEImport* + + Try to import a symbol using `tsserver` or a Language Server. + + ALE will look for completions for the word at the cursor which contain + additional text edits that possible insert lines to import the symbol. The + first match with additional text edits will be used, and may add other code + to the current buffer other than import lines. + + If linting is enabled, and |g:ale_lint_on_text_changed| is set to ever check + buffers when text is changed, the buffer will be checked again after changes + are made. + + A Plug mapping `(ale_import)` is defined for this command. This + mapping should only be bound for normal mode. + + ALEOrganizeImports *ALEOrganizeImports* Organize imports using tsserver. Currently not implemented for LSPs. @@ -2812,9 +3152,22 @@ ALEOrganizeImports *ALEOrganizeImports* ALERename *ALERename* - Rename a symbol using TypeScript server or Language Server. + Rename a symbol using `tsserver` or a Language Server. - The user will be prompted for a new name. + The symbol where the cursor is resting will be the symbol renamed, and a + prompt will open to request a new name. + + +ALECodeAction *ALECodeAction* + + Apply a code action via LSP servers or `tsserver`. + + If there is an error present on a line that can be fixed, ALE will + automatically fix a line, unless there are multiple possible code fixes to + apply. + + This command can be run in visual mode apply actions, such as applicable + refactors. A menu will be shown to select code action to apply. ALERepeatSelection *ALERepeatSelection* @@ -2829,18 +3182,28 @@ ALESymbolSearch `` *ALESymbolSearch* The arguments provided to this command will be used as a search query for finding symbols in the workspace, such as functions, types, etc. + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + *:ALELint* ALELint *ALELint* Run ALE once for the current buffer. This command can be used to run ALE manually, instead of automatically, if desired. - This command will also run linters where `lint_file` is set to `1`, or in - other words linters which check the file instead of the Vim buffer. + This command will also run linters where `lint_file` is evaluates to `1`, + meaning linters which check the file instead of the Vim buffer. A plug mapping `(ale_lint)` is defined for this command. +ALELintStop *ALELintStop* + + Stop any currently running jobs for checking the current buffer. + + Any problems from previous linter results will continue to be shown. + + ALEPrevious *ALEPrevious* ALEPreviousWrap *ALEPreviousWrap* ALENext *ALENext* @@ -2858,7 +3221,7 @@ ALELast *ALELast* the last or first warning or error in the file, respectively. `ALEPrevious` and `ALENext` take optional flags arguments to custom their - behaviour : + behavior : `-wrap` enable wrapping around the file `-error`, `-warning` and `-info` enable jumping to errors, warnings or infos respectively, ignoring anything else. They are mutually exclusive and if @@ -3018,6 +3381,15 @@ ale#Env(variable_name, value) *ale#Env()* 'set VAR="some value" && command' # On Windows +ale#GetFilenameMappings(buffer, name) *ale#GetFilenameMappings()* + + Given a `buffer` and the `name` of either a linter for fixer, return a + |List| of two-item |List|s that describe mapping to and from the local and + foreign file systems for running a particular linter or fixer. + + See |g:ale_filename_mappings| for details on filename mapping. + + ale#Has(feature) *ale#Has()* Return `1` if ALE supports a given feature, like |has()| for Vim features. @@ -3040,9 +3412,9 @@ ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()* The linters will always be run in the background. Calling this function again from the same buffer - An optional `linting_flag` argument can be given. If `linting_flag` - is `'lint_file'`, then linters where the `lint_file` option is set to `1` will be - run. Linters with `lint_file` set to `1` are not run by default. + An optional `linting_flag` argument can be given. If `linting_flag` is + `'lint_file'`, then linters where the `lint_file` option evaluates to `1` + will be run. Otherwise, those linters will not be run. An optional `buffer_number` argument can be given for specifying the buffer to check. The active buffer (`bufnr('')`) will be checked by default. @@ -3132,23 +3504,36 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* < The following `options` can be provided. - `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for - selecting which output streams to read lines from. + `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or + `'none`' for selecting which output streams to read + lines from. - The default is `'stdout'` + The default is `'stdout'` - `executable` - An executable for formatting into `%e` in the command. - If this option is not provided, formatting commands with - `%e` will not work. + `executable` - An executable for formatting into `%e` in the + command. If this option is not provided, formatting + commands with `%e` will not work. - `read_buffer` - If set to `1`, the buffer will be piped into the - command. + `read_buffer` - If set to `1`, the buffer will be piped into the + command. - The default is `0`. + The default is `0`. + + `input` - When creating temporary files with `%t` or piping + text into a command `input` can be set to a |List| of + text to use instead of the buffer's text. + + `filename_mappings` - A |List| of two-item |List|s describing filename + mappings to apply for formatted filenames in the + command string, as per |g:ale_filename_mappings|. + + If the call to this function is being used for a + linter or fixer, the mappings should be provided with + this option, and can be retrieved easily with + |ale#GetFilenameMappings()|. + + The default is `[]`. - `input` - When creating temporary files with `%t` or piping text - into a command `input` can be set to a |List| of text to - use instead of the buffer's text. ale#command#EscapeCommandPart(command_part) *ale#command#EscapeCommandPart()* @@ -3363,24 +3748,30 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* if a command manually reads from a temporary file instead, etc. + This option behaves as if it was set to `0` when the + `lint_file` option evaluates to `1`. + *ale-lint-file* - `lint_file` A |Number| (`0` or `1`) indicating whether a command - should read the file instead of the Vim buffer. This - option can be used for linters which must check the - file on disk, and which cannot check a Vim buffer - instead. + `lint_file` A |Number| (`0` or `1`), or a |Funcref| for a function + accepting a buffer number for computing either `0` or + `1`, indicating whether a command should read the file + instead of the Vim buffer. This option can be used + for linters which must check the file on disk, and + which cannot check a Vim buffer instead. - Linters set with this option will not be run as a - user types, per |g:ale_lint_on_text_changed|. Linters - will instead be run only when events occur against - the file on disk, including |g:ale_lint_on_enter| - and |g:ale_lint_on_save|. Linters with this option - set to `1` will also be run when linters are run - manually, per |ALELintPost-autocmd|. + The result can be computed with |ale#command#Run()|. - When this option is set to `1`, `read_buffer` will - be set automatically to `0`. The two options cannot - be used together. + Linters where the eventual value of this option + evaluates to `1` will not be run as a user types, per + |g:ale_lint_on_text_changed|. Linters will instead be + run only when events occur against the file on disk, + including |g:ale_lint_on_enter| and + |g:ale_lint_on_save|. Linters where this option + evaluates to `1` will also be run when the |ALELint| + command is run. + + When this option is evaluates to `1`, ALE will behave + as if `read_buffer` was set to `0`. *ale-lsp-linters* `lsp` A |String| for defining LSP (Language Server Protocol) @@ -3500,7 +3891,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* contents of the buffer being checked. All occurrences of `%t` in command strings will reference the one temporary file. The temporary file will be created inside a temporary directory, and the entire temporary directory - will be automatically deleted, following the behaviour of + will be automatically deleted, following the behavior of |ale#command#ManageDirectory|. This option can be used for some linters which do not support reading from stdin. @@ -3519,13 +3910,22 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* command, so literal character sequences `%s` and `%t` can be escaped by using `%%s` and `%%t` instead, etc. + Some |filename-modifiers| can be applied to `%s` and `%t`. Only `:h`, `:t`, + `:r`, and `:e` may be applied, other modifiers will be ignored. Filename + modifiers can be applied to the format markers by placing them after them. + + For example: > + 'command': '%s:h %s:e %s:h:t', +< + Given a path `/foo/baz/bar.txt`, the above command string will generate + something akin to `'/foo/baz' 'txt' 'baz'` + If a callback for a command generates part of a command string which might possibly contain `%%`, `%s`, `%t`, or `%e`, where the special formatting behavior is not desired, the |ale#command#EscapeCommandPart()| function can be used to replace those characters to avoid formatting issues. *ale-linter-loading-behavior* - *ale-linter-loading-behaviour* Linters for ALE will be loaded by searching |runtimepath| in the following format: > @@ -3669,6 +4069,23 @@ g:ale_want_results_buffer *g:ale_want_results_buffer* figure out which buffer other sources should lint. +ALECompletePost *ALECompletePost-autocmd* + *ALECompletePost* + + This |User| autocmd is triggered after ALE inserts an item on + |CompleteDone|. This event can be used to run commands after a buffer + is changed by ALE as the result of completion. For example, |ALEFix| can + be configured to run automatically when completion is done: > + + augroup FixAfterComplete + autocmd! + " Run ALEFix when completion items are added. + autocmd User ALECompletePost ALEFix! + " If ALE starts fixing a file, stop linters running for now. + autocmd User ALEFixPre ALELintStop + augroup END +< + ALELintPre *ALELintPre-autocmd* *ALELintPre* ALELintPost *ALELintPost-autocmd* diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index e1ddf7b7..5b7be116 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -97,6 +97,10 @@ let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) " should be used instead. let g:ale_enabled = get(g:, 'ale_enabled', 1) +" A Dictionary mapping linter or fixer names to Arrays of two-item Arrays +" mapping filename paths from one system to another. +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) + " These flags dictates if ale uses the quickfix or the loclist (loclist is the " default, quickfix overrides loclist). let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1) @@ -121,6 +125,9 @@ 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 enable LSP hover messages at the cursor. +let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1) + " 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) @@ -151,7 +158,10 @@ let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) " This variable can be overridden to set the GO111MODULE environment variable. let g:ale_go_go111module = get(g:, 'ale_go_go111module', '') -if g:ale_set_balloons +" If 1, enable a popup menu for commands. +let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running')) + +if g:ale_set_balloons is 1 || g:ale_set_balloons is# 'hover' call ale#balloon#Enable() endif @@ -159,6 +169,10 @@ if g:ale_completion_enabled call ale#completion#Enable() endif +if g:ale_popup_menu_enabled + call ale#code_action#EnablePopUpMenu() +endif + " Define commands for moving through warnings and errors. command! -bar -nargs=* ALEPrevious \ :call ale#loclist_jumping#WrapJump('before', ) @@ -188,6 +202,8 @@ command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs() " A command for linting manually. command! -bar ALELint :call ale#Queue(0, 'lint_file') +" Stop current jobs when linting. +command! -bar ALELintStop :call ale#engine#Stop(bufnr('')) " Define a command to get information about current filetype. command! -bar ALEInfo :call ale#debugging#Info() @@ -197,26 +213,16 @@ command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard() command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile() " Fix problems in files. -command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', ) +command! -bar -bang -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', ) " Suggest registered functions to use for fixing problems. command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype) " Go to definition for tsserver and LSP command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', ) -" Deprecated commands we have to keep for now. -command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab', 'deprecated_command': 'ALEGoToDefinitionInTab'}) -command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'split', 'deprecated_command': 'ALEGoToDefinitionInSplit'}) -command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToDefinitionInVSplit'}) - " Go to type definition for tsserver and LSP command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', ) -" Deprecated commands we have to keep for now. -command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab', 'deprecated_command': 'ALEGoToTypeDefinitionInTab'}) -command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'split', 'deprecated_command': 'ALEGoToTypeDefinitionInSplit'}) -command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToTypeDefinitionInVSplit'}) - " Repeat a previous selection in the preview window command! -bar ALERepeatSelection :call ale#preview#RepeatSelection() @@ -232,10 +238,17 @@ 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() +" Complete text with tsserver and LSP command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual') +" Try to find completions for the current symbol that add additional text. +command! -bar ALEImport :call ale#completion#Import() + " Rename symbols using tsserver and LSP -command! -bar ALERename :call ale#rename#Execute() +command! -bar -bang ALERename :call ale#rename#Execute() + +" Apply code actions to a range. +command! -bar -range ALECodeAction :call ale#codefix#Execute() " Organize import statements using tsserver command! -bar ALEOrganizeImports :call ale#organize_imports#Execute() @@ -267,22 +280,22 @@ nnoremap (ale_lint) :ALELint nnoremap (ale_detail) :ALEDetail nnoremap (ale_fix) :ALEFix nnoremap (ale_go_to_definition) :ALEGoToDefinition +nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinition -tab +nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinition -split +nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinition -vsplit nnoremap (ale_go_to_type_definition) :ALEGoToTypeDefinition +nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab +nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split +nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionIn -vsplit nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete +nnoremap (ale_import) :ALEImport nnoremap (ale_rename) :ALERename +nnoremap (ale_code_action) :ALECodeAction nnoremap (ale_repeat_selection) :ALERepeatSelection -" Deprecated mappings -nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab -nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit -nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit -nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab -nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit -nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit - " Set up autocmd groups now. call ale#events#Init() diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py index ae1f4039..82d9bbf2 100644 --- a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -49,12 +49,13 @@ class Source(Base): if event == 'Async': result = self.vim.call('ale#completion#GetCompletionResult') + return result or [] if context.get('is_refresh'): self.vim.command( - "call ale#completion#GetCompletions('ale-callback', " + \ - "{'callback': {completions -> deoplete#auto_complete() }})" + "call ale#completion#GetCompletions('ale-callback', " + + "{'callback': {completions -> deoplete#auto_complete() }})" ) return [] diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 7d2f5287..96ef273b 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -16,7 +16,7 @@ formatting. | Key | Definition | | ------------- | -------------------------------- | -| :floppy_disk: | Only checked when saved to disk | +| :floppy_disk: | May only run on files on disk | | :warning: | Disabled by default | --- @@ -30,6 +30,7 @@ formatting. * [drafter](https://github.com/apiaryio/drafter) * AsciiDoc * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [textlint](https://textlint.github.io/) @@ -40,6 +41,7 @@ formatting. * Awk * [gawk](https://www.gnu.org/software/gawk/) * Bash + * [bashate](https://github.com/openstack/bashate) * [language-server](https://github.com/mads-hartmann/bash-language-server) * shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) * [shellcheck](https://www.shellcheck.net/) @@ -53,6 +55,7 @@ formatting. * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) * C + * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clangd](https://clang.llvm.org/extra/clangd.html) @@ -70,6 +73,7 @@ formatting. * [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration * [uncrustify](https://github.com/uncrustify/uncrustify) * C++ (filetype cpp) + * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: @@ -124,6 +128,8 @@ formatting. * [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [language_server](https://github.com/natebosch/dart_language_server) +* Dhall + * [dhall-format](https://github.com/dhall-lang/dhall-lang) * Dockerfile * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [hadolint](https://github.com/hadolint/hadolint) @@ -143,6 +149,7 @@ formatting. * [erubis](https://github.com/kwatch/erubis) * [ruumba](https://github.com/ericqweinstein/ruumba) * Erlang + * [elvis](https://github.com/inaka/elvis) :floppy_disk: * [erlc](http://erlang.org/doc/man/erlc.html) * [SyntaxErl](https://github.com/ten0s/syntaxerl) * Fish @@ -198,6 +205,7 @@ formatting. * [hie](https://github.com/haskell/haskell-ide-engine) * [hindent](https://hackage.haskell.org/package/hindent) * [hlint](https://hackage.haskell.org/package/hlint) + * [ormolu](https://github.com/tweag/ormolu) * [stack-build](https://haskellstack.org/) :floppy_disk: * [stack-ghc](https://haskellstack.org/) * [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) @@ -268,6 +276,7 @@ formatting. * Lua * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) + * [luafmt](https://github.com/trixnz/lua-fmt) * Mail * [alex](https://github.com/wooorm/alex) :floppy_disk: * [languagetool](https://languagetool.org/) :floppy_disk: @@ -327,6 +336,7 @@ formatting. * Perl6 * [perl6 -c](https://perl6.org) :warning: * PHP + * [intelephense](https://github.com/bmewburn/intelephense-docs) * [langserver](https://github.com/felixfbecker/php-language-server) * [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions * [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) @@ -336,6 +346,7 @@ formatting. * [phpmd](https://phpmd.org) * [phpstan](https://github.com/phpstan/phpstan) * [psalm](https://getpsalm.org) :floppy_disk: + * [tlint](https://github.com/tightenco/tlint) * PO * [alex](https://github.com/wooorm/alex) :floppy_disk: * [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html) @@ -364,6 +375,7 @@ formatting. * [purescript-language-server](https://github.com/nwolverson/purescript-language-server) * [purty](https://gitlab.com/joneshf/purty) * Python + * [autoimport](https://lyz-code.github.io/autoimport/) * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: * [black](https://github.com/ambv/black) @@ -378,6 +390,7 @@ formatting. * [pylint](https://www.pylint.org/) :floppy_disk: * [pyls](https://github.com/palantir/python-language-server) :warning: * [pyre](https://github.com/facebook/pyre-check) :warning: + * [pyright](https://github.com/microsoft/pyright) * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) @@ -385,6 +398,7 @@ formatting. * [qmlfmt](https://github.com/jesperhh/qmlfmt) * [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) * R + * [languageserver](https://github.com/REditorSupport/languageserver) * [lintr](https://github.com/jimhester/lintr) * [styler](https://github.com/r-lib/styler) * Racket @@ -451,11 +465,13 @@ formatting. * [sqlfmt](https://github.com/jackc/sqlfmt) * [sqlformat](https://github.com/andialbrecht/sqlparse) * [sqlint](https://github.com/purcell/sqlint) + * [sql-lint](https://github.com/joereynolds/sql-lint) * Stylus * [stylelint](https://github.com/stylelint/stylelint) * SugarSS * [stylelint](https://github.com/stylelint/stylelint) * Swift + * [Apple swift-format](https://github.com/apple/swift-format) * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) @@ -489,6 +505,7 @@ formatting. * VALA * [uncrustify](https://github.com/uncrustify/uncrustify) * Verilog + * [hdl-checker](https://pypi.org/project/hdl-checker) * [iverilog](https://github.com/steveicarus/iverilog) * [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) * [vlog](https://www.mentor.com/products/fv/questa/) @@ -516,6 +533,9 @@ formatting. * YAML * [prettier](https://github.com/prettier/prettier) * [swaglint](https://github.com/byCedric/swaglint) + * [yamlfix](https://lyz-code.github.io/yamlfix) * [yamllint](https://yamllint.readthedocs.io/) * YANG * [yang-lsp](https://github.com/theia-ide/yang-lsp) +* Zig + * [zls](https://github.com/zigtools/zls) diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 828a8c8d..c8f5e1bc 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -414,26 +414,44 @@ fu! ctrlp#files() endf fu! s:InitCustomFuncs() - if s:igntype == 4 && has_key(s:usrign, 'func-init') && s:usrign['func-init'] != '' + if s:igntype == 4 && get(s:usrign, 'func-init', '') != '' exe call(s:usrign['func-init'], []) en endf fu! s:CloseCustomFuncs() - if s:igntype == 4 && has_key(s:usrign, 'func-close') && s:usrign['func-close'] != '' + if s:igntype == 4 && get(s:usrign, 'func-close', '') != '' exe call(s:usrign['func-close'], []) en endf -fu! s:GlobPath(dirs, depth) - let entries = split(globpath(a:dirs, s:glob), "\n") - let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] - cal extend(g:ctrlp_allfiles, dnf[1]) - if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth - sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) - cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) - en -endf +if has('patch-8.2-0995') + fu! s:GlobPath(dirs, depth) + let entries = [] + for e in split(a:dirs, ',') + sil let files = readdir(e, '1', {'sort': 'none'}) + if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en + let entries += map(files, 'e.s:lash.v:val') + endfo + let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] + if &wig != '' | cal filter(dnf[1], 'glob(v:val) != ""') | en + let g:ctrlp_allfiles += dnf[1] + if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth + sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) + cal s:GlobPath(join(dnf[0], ','), depth) + en + endf +el + fu! s:GlobPath(dirs, depth) + let entries = split(globpath(a:dirs, s:glob), "\n") + let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] + let g:ctrlp_allfiles += dnf[1] + if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth + sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) + cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) + en + endf +en fu! s:async_glob_update_progress(timer) let s:must_wait = 0 @@ -442,26 +460,26 @@ fu! s:async_glob_update_progress(timer) en if exists('s:timer') sil! cal ctrlp#statusline() - endif + en if !exists('s:job') call s:stop_timer_if_exists() - endif + en endf fu! s:async_glob_on_stdout(job, data, ...) if type(a:data) ==# type([]) - call extend(g:ctrlp_allfiles, filter(a:data, 'v:val !=# ""')) - else - call add(g:ctrlp_allfiles, a:data) - endif + let g:ctrlp_allfiles += filter(a:data, 'v:val !=# ""') + el + let g:ctrlp_allfiles += [a:data] + en endf fu! s:async_glob_on_exit(...) let s:must_wait = 0 if exists('s:job') - unlet s:job - endif + unl s:job + en cal s:stop_timer_if_exists() if exists('s:focus') && get(s:, 'setlines_post_ended', 0) sil! cal ctrlp#statusline() @@ -477,8 +495,8 @@ endf fu! s:stop_timer_if_exists() if exists('s:timer') - call timer_stop(s:timer) - unlet s:timer + cal timer_stop(s:timer) + unl s:timer en endf @@ -486,10 +504,10 @@ fu! s:stop_job_if_exists() if exists('s:job') if !has('nvim') cal job_stop(s:job) - else + el cal jobstop(s:job) - endif - unlet s:job + en + unl s:job en endf @@ -504,7 +522,7 @@ endf fu! s:UserCmd(lscmd) let [path, lscmd] = [s:dyncwd, a:lscmd] let do_ign = - \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] + \ type(s:usrcmd) == 4 && get(s:usrcmd, 'ignore', 0) if do_ign && ctrlp#igncwd(s:cwd) | retu | en if exists('+ssl') && &ssl && &shell !~ 'sh' let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] @@ -526,12 +544,12 @@ fu! s:UserCmd(lscmd) \ 'out_cb': function('s:async_glob_on_stdout'), \ 'exit_cb': function('s:async_glob_on_exit') \ }) - else + el let s:job = jobstart(argv, { \ 'on_stdout': function('s:async_glob_on_stdout'), \ 'on_exit': function('s:async_glob_on_exit') \ }) - endif + en let s:timer = timer_start(250, function('s:async_glob_update_progress'), {'repeat': -1}) while s:must_wait sleep 50m @@ -570,7 +588,7 @@ fu! s:lsCmd() retu cmd[1] elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') ) let fndroot = [] - if has_key(cmd, 'types') && cmd['types'] != {} + if get(cmd, 'types', {}) != {} let [markrs, cmdtypes] = [[], values(cmd['types'])] for pair in cmdtypes cal add(markrs, pair[0]) @@ -578,7 +596,7 @@ fu! s:lsCmd() let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) en if fndroot == [] - retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' + retu get(cmd, 'fallback', '') en for pair in cmdtypes if pair[0] == fndroot[0] | brea | en @@ -633,7 +651,7 @@ fu! s:MatchIt(items, pat, limit, exc) try if (s:matchcrfile || !( s:ispath && item ==# a:exc )) && \call(s:mfunc, [item, pat]) >= 0 - cal add(lines, item) + let lines += [item] en cat | brea | endt if a:limit > 0 && len(lines) >= a:limit | brea | en @@ -647,12 +665,12 @@ fu! s:MatchedItems(items, pat, limit) let items = s:narrowable() ? s:matched + s:mdata[3] : a:items let matcher = s:getextvar('matcher') if empty(matcher) || type(matcher) != 4 || !has_key(matcher, 'match') - unlet matcher + unl matcher let matcher = s:matcher en if matcher != {} let argms = - \ has_key(matcher, 'arg_type') && matcher['arg_type'] == 'dict' ? [{ + \ get(matcher, 'arg_type', '') == 'dict' ? [{ \ 'items': items, \ 'str': a:pat, \ 'limit': a:limit, @@ -723,12 +741,20 @@ fu! s:Render(lines, pat) " Sorting if !s:nosort() let s:compat = s:martcs.pat - cal sort(lines, 's:mixedsort') + if has('patch-8.1-0') + cal sort(lines, function('s:mixedsort2', [s:curtype()])) + el + cal sort(lines, 's:mixedsort') + en unl s:compat en if s:mw_order == 'btt' | cal reverse(lines) | en let s:lines = copy(lines) - cal map(lines, s:flfunc) + if has('patch-8.1-0') && s:flfunc ==# 's:formatline(v:val)' + cal map(lines, function('s:formatline2', [s:curtype()])) + el + cal map(lines, s:flfunc) + en cal setline(1, s:offset(lines, height)) cal s:unmarksigns() cal s:remarksigns() @@ -755,7 +781,7 @@ fu! s:Update(str) \ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res) if empty(str) | cal clearmatches() | en cal s:Render(lines, pat) - return lines + retu lines endf fu! s:ForceUpdate() @@ -1162,10 +1188,10 @@ fu! s:SetWD(args) \ && exists('s:dyncwd') cal ctrlp#setdir(s:dyncwd) | retu en - if has_key(a:args, 'dir') && a:args['dir'] != '' + if get(a:args, 'dir', '') != '' cal ctrlp#setdir(a:args['dir']) | retu en - let pmodes = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode + let pmodes = get(a:args, 'mode', s:pathmode) let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] if (!type(pmodes)) let pmodes = @@ -1184,7 +1210,7 @@ fu! ctrlp#acceptfile(...) let useb = 0 if a:0 == 1 && type(a:1) == 4 let [md, line] = [a:1['action'], a:1['line']] - let atl = has_key(a:1, 'tail') ? a:1['tail'] : '' + let atl = get(a:1, 'tail', '') el let [md, line] = [a:1, a:2] let atl = a:0 > 2 ? a:3 : '' @@ -1276,7 +1302,7 @@ fu! s:AcceptSelection(action) " Do something with it if s:openfunc != {} && has_key(s:openfunc, s:ctype) let actfunc = s:openfunc[s:ctype] - let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list' + let type = get(s:openfunc, 'arg_type', 'list') el if s:itemtype < len(s:coretypes) let [actfunc, type] = ['ctrlp#acceptfile', 'dict'] @@ -1351,7 +1377,7 @@ fu! s:MarkToOpen() if exists('s:marked') let vac = s:vacantdict(s:marked) let key = empty(vac) ? len(s:marked) + 1 : vac[0] - let s:marked = extend(s:marked, { key : filpath }) + cal extend(s:marked, { key : filpath }) el let [key, s:marked] = [1, { 1 : filpath }] en @@ -1460,13 +1486,13 @@ fu! s:OpenNoMarks(md, line) if a:md == 'a' let [s:marked, key] = [{}, 1] for line in s:lines - let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') }) + cal extend(s:marked, { key : fnamemodify(line, ':p') }) let key += 1 endfo cal s:remarksigns() cal s:BuildPrompt(0) elsei a:md == 'x' - let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'dict' + let type = get(s:openfunc, 'arg_type', 'dict') let argms = type == 'dict' ? [{ 'action': a:md, 'line': a:line }] \ : [a:md, a:line] cal call(s:openfunc[s:ctype], argms, s:openfunc) @@ -1505,15 +1531,15 @@ fu! s:compmreb(...) " By last entered time (bufnr) let [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)] if id1 == id2 - return 0 - endif + retu 0 + en if id1 < 0 - return 1 - endif + retu 1 + en if id2 < 0 - return -1 - endif - return id1 > id2 ? 1 : -1 + retu -1 + en + retu id1 > id2 ? 1 : -1 endf fu! s:compmref(...) @@ -1549,7 +1575,7 @@ fu! s:matchlens(str, pat, ...) if nr > 20 | retu {} | en if match(a:str, a:pat, st) >= 0 let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)] - let lens = extend(lens, { nr : [strlen(mst), mst] }) + cal extend(lens, { nr : [strlen(mst), mst] }) let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) en retu lens @@ -1559,6 +1585,32 @@ fu! s:shortest(lens) retu min(map(values(a:lens), 'v:val[0]')) endf +fu! s:mixedsort2(ct, ...) + if a:ct == 'buf' + let pat = '[\/]\?\[\d\+\*No Name\]$' + if a:1 =~# pat && a:2 =~# pat | retu 0 + elsei a:1 =~# pat | retu 1 + elsei a:2 =~# pat | retu -1 | en + en + let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] + if s:ispath + let ms = [] + if s:res_count < 21 + let ms += [s:compfnlen(a:1, a:2)] + if a:ct !~ '^\(buf\|mru\)$' | let ms += [s:comptime(a:1, a:2)] | en + if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en + en + if a:ct =~ '^\(buf\|mru\)$' + let ms += [s:compmref(a:1, a:2)] + let cln = cml ? cln : 0 + en + let ms += [cml, 0, 0, 0] + let mp = call('s:multipliers', ms[:3]) + retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3] + en + retu cln + cml * 2 +endf + fu! s:mixedsort(...) let ct = s:curtype() if ct == 'buf' @@ -1617,7 +1669,7 @@ fu! ctrlp#statusline() \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' if s:status != {} let argms = - \ has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ + \ get(s:status, 'arg_type', '') == 'dict' ? [{ \ 'focus': focus, \ 'byfname': byfname, \ 'regex': s:regexp, @@ -1650,7 +1702,7 @@ fu! ctrlp#progress(enum, ...) if has('macunix') || has('mac') | sl 1m | en let txt = a:0 ? '(press ctrl-c to abort)' : '' if s:status != {} - let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' + let argms = get(s:status, 'arg_type', '') == 'dict' \ ? [{ 'str': a:enum }] : [a:enum] let &l:stl = call(s:status['prog'], argms, s:status) el @@ -1687,6 +1739,33 @@ fu! s:formatline(str) retu s:lineprefix.( cond ? s:pathshorten(str) : str ) endf +fu! s:formatline2(ct, key, str) + let str = a:str + if a:ct == 'buf' + let bufnr = s:bufnrfilpath(str)[0] + let parts = s:bufparts(bufnr) + let str = printf('%'.s:bufnr_width.'s', bufnr) + if s:has_conceal && has('syntax_items') + let str .= printf(' %-13s %s%-36s', + \ ''.parts[0].'', + \ ''.parts[1], '{'.parts[2].'}') + if (!empty(s:bufpath_mod)) + let str .= printf(' %s', ''.parts[3].'') + en + el + let str .= printf(' %-5s %-30s', + \ parts[0], + \ parts[2]) + if (!empty(s:bufpath_mod)) + let str .= printf(' %s', parts[3]) + en + en + en + let cond = a:ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str) + retu s:lineprefix.( cond ? s:pathshorten(str) : str ) +endf + + fu! s:pathshorten(str) retu matchstr(a:str, '^.\{9}').'...' \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') @@ -1753,19 +1832,19 @@ fu! ctrlp#dirnfile(entries) if s:igntype >= 0 && s:usrign(each, etype) | con | en if etype == 'dir' if s:showhidden | if each !~ '[\/]\.\{1,2}$' - cal add(items[0], each) + let items[0] += [each] en | el - cal add(items[0], each) + let items[0] += [each] en elsei etype == 'link' if s:folsym let isfile = !isdirectory(each) if s:folsym == 2 || !s:samerootsyml(each, isfile, cwd) - cal add(items[isfile], each) + let items[isfile] += [each] en en elsei etype == 'file' - cal add(items[1], each) + let items[1] += [each] en endfo retu items @@ -1773,17 +1852,12 @@ endf fu! s:usrign(item, type) if s:igntype == 1 | retu a:item =~ s:usrign | en - if s:igntype == 2 - if call(s:usrign, [a:item, a:type]) - retu 1 - en - elsei s:igntype == 4 - if has_key(s:usrign, a:type) && s:usrign[a:type] != '' - \ && a:item =~ s:usrign[a:type] - retu 1 - elsei has_key(s:usrign, 'func') && s:usrign['func'] != '' - \ && call(s:usrign['func'], [a:item, a:type]) - retu 1 + if s:igntype == 2 | retu call(s:usrign, [a:item, a:type]) | en + if s:igntype == 4 + if get(s:usrign, a:type, '') != '' + retu a:item =~ s:usrign[a:type] + elsei get(s:usrign, 'func', '') != '' + retu call(s:usrign['func'], [a:item, a:type]) en en retu 0 @@ -2024,7 +2098,7 @@ fu! s:ifilter(list, str) for each in a:list try if eval(estr) - cal add(rlist, each) + let rlist += [each] en cat | con | endt endfo @@ -2049,7 +2123,7 @@ endf fu! s:sublist7071(l, s, e) let [newlist, id, ae] = [[], a:s, a:e == -1 ? len(a:l) - 1 : a:e] wh id <= ae - cal add(newlist, get(a:l, id)) + let newlist += [get(a:l, id)] let id += 1 endw retu newlist @@ -2078,9 +2152,9 @@ endf fu! s:isabs(path) if (has('win32') || has('win64')) - return a:path =~ '^\([a-zA-Z]:\)\{-}[/\\]' + retu a:path =~ '^\([a-zA-Z]:\)\{-}[/\\]' el - return a:path =~ '^[/\\]' + retu a:path =~ '^[/\\]' en endf @@ -2292,14 +2366,14 @@ endf fu! s:getinput(...) let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )] if s:abbrev != {} - let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : '' + let gmd = get(s:abbrev, 'gmode', '') let str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '') if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k' retu join(prt, '') en let [pf, rz] = [( s:byfname() ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )] for dict in s:abbrev['abbrevs'] - let dmd = has_key(dict, 'mode') ? dict['mode'] : '' + let dmd = get(dict, 'mode', '') let pat = escape(dict['pattern'], '~') if ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 ) \ || dmd =~ '['.spi.']' ) && str =~ pat @@ -2315,9 +2389,15 @@ fu! s:getinput(...) retu spi == 'c' ? prt[0] : join(prt, '') endf -fu! s:strwidth(str) - retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str) -endf +if exists('*strdisplaywidth') + fu! s:strwidth(str) + retu strdisplaywidth(a:str) + endf +el + fu! s:strwidth(str) + retu strlen(a:str) + endf +en fu! ctrlp#j2l(nr) exe 'norm!' a:nr.'G' @@ -2510,7 +2590,7 @@ fu! s:buildpat(lst) endf fu! s:curtype() - return s:CurTypeName()[1] + retu s:CurTypeName()[1] endf fu! s:mfunc() @@ -2672,9 +2752,9 @@ endf " Returns [lname, sname] fu! s:CurTypeName() if s:itemtype < len(s:coretypes) - return filter(copy(s:coretypes), 'v:val[1]==g:ctrlp_types[s:itemtype]')[0] + retu filter(copy(s:coretypes), 'v:val[1]==g:ctrlp_types[s:itemtype]')[0] el - return [s:getextvar("lname"), s:getextvar('sname')] + retu [s:getextvar("lname"), s:getextvar('sname')] en endfu @@ -2682,15 +2762,15 @@ fu! s:ExitIfSingleCandidate() if len(s:Update(s:prompt[0])) == 1 call s:AcceptSelection('e') call ctrlp#exit() - return 1 + retu 1 en - return 0 + retu 0 endfu fu! s:IsBuiltin() let builtins = ['tag', 'dir', 'bft', 'rts', 'bkd', 'lns', 'chs', 'mix', 'udo', 'qfx'] let curtype = s:getextvar('sname') - return s:itemtype < len(s:coretypes) || index(builtins, curtype) > -1 + retu s:itemtype < len(s:coretypes) || index(builtins, curtype) > -1 endfu fu! s:DetectFileType(type, ft) @@ -2738,7 +2818,7 @@ fu! ctrlp#init(type, ...) let curName = s:CurTypeName() let shouldExitSingle = index(s:opensingle, curName[0])>=0 || index(s:opensingle, curName[1])>=0 if shouldExitSingle && s:ExitIfSingleCandidate() - return 0 + retu 0 en cal s:BuildPrompt(1) if s:keyloop | cal s:KeyLoop() | en @@ -2753,8 +2833,9 @@ fu! s:NotifySearch() en endf -fu! ctrlp#update() +fu! ctrlp#update(...) cal s:ForceUpdate() + if a:0 | cal s:BuildPrompt(a:1) | en endf " - Autocmds {{{1 diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim index 91b9f24e..cfc9e6c8 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/utils.vim @@ -75,9 +75,9 @@ fu! ctrlp#utils#globpath(...) retu call('globpath', s:wig_cond ? a:000 : a:000[:1]) endf -fu! ctrlp#utils#fnesc(path, type, ...) - if exists('*fnameescape') - if exists('+ssl') +if exists('*fnameescape') + if exists('+ssl') + fu! ctrlp#utils#fnesc(path, type, ...) if a:type == 'c' let path = escape(a:path, '%#') elsei a:type == 'f' @@ -86,11 +86,17 @@ fu! ctrlp#utils#fnesc(path, type, ...) let path = escape(a:path, '?*') en let path = substitute(path, '[', '[[]', 'g') - el - let path = fnameescape(a:path) - en + retu a:0 ? escape(path, a:1) : path + endf el - if exists('+ssl') + fu! ctrlp#utils#fnesc(path, type, ...) + let path = fnameescape(a:path) + retu a:0 ? escape(path, a:1) : path + endf + en +el + if exists('+ssl') + fu! ctrlp#utils#fnesc(path, type, ...) if a:type == 'c' let path = escape(a:path, '%#') elsei a:type == 'f' @@ -99,12 +105,15 @@ fu! ctrlp#utils#fnesc(path, type, ...) let path = escape(a:path, '?*') en let path = substitute(path, '[', '[[]', 'g') - el + retu a:0 ? escape(path, a:1) : path + endf + el + fu! ctrlp#utils#fnesc(path, type, ...) let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<") - en + retu a:0 ? escape(path, a:1) : path + endf en - retu a:0 ? escape(path, a:1) : path -endf +en "}}} " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx index 32da378f..3cd91399 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx @@ -203,7 +203,7 @@ OPTIONS *ctrlp-options* w - 用来修饰r:使用当前工作目录而不是当前文件所在目录进行查找 0 或者 - 禁用这项功能。 -注意 #1: 如果 "a" 或者 "c" 和 "r"一起被包含,当无法找到根目录时使用 "a" 或者 +注意 #1: 如果 "a" 或者 "c" 和 "r"一起被包含,当无法找到根目录时使用 "a" 或者 "c" 的行为(作为备选)。 注意 #2: 你可以在每个缓冲区内使用 |b:var| 来设置该选项。 @@ -425,10 +425,12 @@ OPTIONS *ctrlp-options* 注意: 当命令使用 |g:ctrlp_user_command| 定义时该选项无效。 *'g:ctrlp_lazy_update'* -设置为1将开启延迟更新特性:只在输入停止一个确定的时间后才更新匹配窗口: > +设置为1将或更大可开启延迟更新特性:只在输入停止一个确定的时间后才更新匹配窗口: +> let g:ctrlp_lazy_update = 0 < -如果设置为1,在250毫秒后更新。如果大于1,数字会被作为延迟时间使用。 +如果设置为1,在250毫秒后更新該值作為默認值。如果大于1,数字会被作为延迟时间使 +用。 *'g:ctrlp_default_input'* 设置为1将为提示符面板提供当前文件的相对路径作为种子: > @@ -1045,7 +1047,7 @@ b) 在正则表达式模式,输入字符串被按照Vim的正则表达式模 例如: 'abc\d*efg' 会被解读为 'abc\d*efg'。 - 如何启用正则表达式模式参见 |ctrlp-fullregexp| (按键绑定)和 + 如何启用正则表达式模式参见 |ctrlp-fullregexp| (按键绑定)和 |g:ctrlp_regexp_search| (选项)。 c) 字符串末尾使用一个冒号':'跟随一个Vim命令来在打开那个文件后执行该命令。如果 @@ -1255,7 +1257,7 @@ h) 使用?打开帮助文件。 这样只会忽略包含 "build" 的目录和包含 "foo.txt" 的文件。不会忽略带 有 "build" 的文件或者反过来。 - 注意: 如果为了忽略名为 "build" 的目录,而不是『任何』包含 "build" + 注意: 如果为了忽略名为 "build" 的目录,而不是『任何』包含 "build" 的目录,你可以使用下面的正则: ^build$ - 常见问题: diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index 56e3e5d8..82eecfcb 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -437,12 +437,12 @@ Note: does not apply when a command defined with |g:ctrlp_user_command| is being used. *'g:ctrlp_lazy_update'* -Set this to 1 to enable the lazy-update feature: only update the match window -after typing's been stopped for a certain amount of time: > +Set this to 1 or bigger to enable the lazy-update feature: only update the +match window after typing's been stopped for a certain amount of time: > let g:ctrlp_lazy_update = 0 < -If is 1, update after 250ms. If bigger than 1, the number will be used as the -delay time in milliseconds. +If is 1, update after 250ms that value as default tuned. If bigger than 1, the +number will be used as the delay time in milliseconds. *'g:ctrlp_default_input'* Set this to 1 to enable seeding the prompt with the current file's relative @@ -462,7 +462,7 @@ Includes the current file in the match entries: > By default, the current file is excluded from the list. -Note: does not apply when |g:ctrlp_match_func| is used. +Note: does not apply when |g:ctrlp_match_func| is used. *'g:ctrlp_types'* Set this to list of names to customize core types: > diff --git a/sources_non_forked/goyo.vim/doc/goyo.txt b/sources_non_forked/goyo.vim/doc/goyo.txt index b8050226..0dc57b2a 100644 --- a/sources_non_forked/goyo.vim/doc/goyo.txt +++ b/sources_non_forked/goyo.vim/doc/goyo.txt @@ -32,8 +32,6 @@ INSTALLATION *goyo-installation* Use your favorite plugin manager. - *:PlugInstall* - - {vim-plug}{3} 1. Add `Plug 'junegunn/goyo.vim'` to .vimrc 2. Run `:PlugInstall` diff --git a/sources_non_forked/gruvbox/README.md b/sources_non_forked/gruvbox/README.md index cd07e486..eca249c0 100644 --- a/sources_non_forked/gruvbox/README.md +++ b/sources_non_forked/gruvbox/README.md @@ -1,4 +1,4 @@ -

+ gruvbox is heavily inspired by [badwolf][], [jellybeans][] and [solarized][]. diff --git a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml index b5db7cef..7d2a185b 100644 --- a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml +++ b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml @@ -21,9 +21,9 @@ jobs: - v7.3 steps: - name: Checkout code - uses: actions/checkout@master + uses: actions/checkout@main - name: Checkout vim-themis - uses: actions/checkout@master + uses: actions/checkout@main with: repository: thinca/vim-themis path: vim-themis diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index 583f02ea..41f98022 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -63,7 +63,8 @@ For screenshots of all available colorshemes, see [this file](colorscheme.md). + Orthogonality. The plugin does not rely on the implementation of other plugins. Such plugin crossing settings should be configured by users. ## Installation -### [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528) +### [Vim packages](https://vimhelp.org/repeat.txt.html#packages) (since Vim 7.4.1528) +1. Clone the plugin with the following command. git clone https://github.com/itchyny/lightline.vim ~/.vim/pack/plugins/start/lightline diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index e85e5891..5862557f 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2020/06/19 11:08:46. +" Last Change: 2020/11/21 14:03:29. " ============================================================================= let s:save_cpo = &cpo @@ -110,7 +110,7 @@ let s:_lightline = { \ 'paste': '%{&paste?"PASTE":""}', 'readonly': '%R', 'charvalue': '%b', 'charvaluehex': '%B', \ 'spell': '%{&spell?&spelllang:""}', 'fileencoding': '%{&fenc!=#""?&fenc:&enc}', 'fileformat': '%{&ff}', \ 'filetype': '%{&ft!=#""?&ft:"no ft"}', 'percent': '%3p%%', 'percentwin': '%P', - \ 'lineinfo': '%3l:%-2v', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}' + \ 'lineinfo': '%3l:%-2c', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}' \ }, \ 'component_visible_condition': { \ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell' @@ -145,7 +145,6 @@ let s:_lightline = { \ }, \ 'mode_fallback': { 'replace': 'insert', 'terminal': 'insert', 'select': 'visual' }, \ 'palette': {}, - \ 'winwidth': winwidth(0), \ } function! lightline#init() abort let s:lightline = deepcopy(get(g:, 'lightline', {})) @@ -291,6 +290,7 @@ function! lightline#highlight(...) abort endfor exec printf('hi LightlineMiddle_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', mode, ms[0], ms[1], ms[2], ms[3], s:term(ms)) endfor + if !a:0 | let s:mode = '' | endif endfunction function! s:subseparator(components, subseparator, expanded) abort @@ -336,45 +336,24 @@ function! s:evaluate_expand(component) abort endfunction function! s:convert(name, index) abort - if has_key(s:lightline.component_expand, a:name) + if !has_key(s:lightline.component_expand, a:name) + return [[[a:name], 0, a:index, a:index]] + else let type = get(s:lightline.component_type, a:name, a:index) let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw' - return filter(s:map(s:evaluate_expand(s:lightline.component_expand[a:name]), + return filter(map(s:evaluate_expand(s:lightline.component_expand[a:name]), \ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []') - else - return [[[a:name], 0, a:index, a:index]] endif endfunction -function! s:flatten_twice(xss) abort - let ys = [] - for xs in a:xss - for x in xs - let ys += x - endfor - endfor - return ys -endfunction - -if v:version > 702 || v:version == 702 && has('patch295') - let s:map = function('map') -else - function! s:map(xs, f) abort - let ys = [] - for i in range(len(a:xs)) - call extend(ys, map(a:xs[(i):(i)], substitute(a:f, 'v:key', i, 'g'))) - endfor - return ys - endfunction -endif - function! s:expand(components) abort let components = [] let expanded = [] let indices = [] let prevtype = '' let previndex = -1 - let xs = s:flatten_twice(s:map(deepcopy(a:components), 'map(v:val, "s:convert(v:val, ''" . v:key . "'')")')) + let xs = [] + call map(deepcopy(a:components), 'map(v:val, "extend(xs, s:convert(v:val, ''" . v:key . "''))")') for [component, expand, type, index] in xs if prevtype !=# type for i in range(previndex + 1, max([previndex, index - 1])) @@ -400,6 +379,10 @@ function! s:expand(components) abort return [components, expanded, indices] endfunction +function! s:func(name) abort + return exists('*' . a:name) ? '%{' . a:name . '()}' : '%{exists("*' . a:name . '")?' . a:name . '():""}' +endfunction + function! s:line(tabline, inactive) abort let _ = a:tabline ? '' : '%{lightline#link()}' if s:lightline.palette == {} @@ -409,32 +392,32 @@ function! s:line(tabline, inactive) abort let [p, s] = a:tabline ? [s:lightline.tabline_separator, s:lightline.tabline_subseparator] : [s:lightline.separator, s:lightline.subseparator] let [c, f, t, w] = [s:lightline.component, s:lightline.component_function, s:lightline.component_type, s:lightline.component_raw] let mode = a:tabline ? 'tabline' : a:inactive ? 'inactive' : 'active' - let l_ = has_key(s:lightline, mode) ? s:lightline[mode].left : s:lightline.active.left - let [lt, lc, ll] = s:expand(copy(l_)) - let r_ = has_key(s:lightline, mode) ? s:lightline[mode].right : s:lightline.active.right - let [rt, rc, rl] = s:expand(copy(r_)) - for i in range(len(lt)) - let _ .= '%#LightlineLeft_' . mode . '_' . ll[i] . '#' - for j in range(len(lt[i])) - let x = lc[i][j] ? lt[i][j] : has_key(f, lt[i][j]) ? (exists('*' . f[lt[i][j]]) ? '%{' . f[lt[i][j]] . '()}' : '%{exists("*' . f[lt[i][j]] . '")?' . f[lt[i][j]] . '():""}') : get(c, lt[i][j], '') - let _ .= has_key(t, lt[i][j]) && t[lt[i][j]] ==# 'raw' || get(w, lt[i][j]) || lc[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)' - if j < len(lt[i]) - 1 && s.left !=# '' - let _ .= s:subseparator(lt[i][(j):], s.left, lc[i][(j):]) + let ls = has_key(s:lightline, mode) ? s:lightline[mode].left : s:lightline.active.left + let [lc, le, li] = s:expand(ls) + let rs = has_key(s:lightline, mode) ? s:lightline[mode].right : s:lightline.active.right + let [rc, re, ri] = s:expand(rs) + for i in range(len(lc)) + let _ .= '%#LightlineLeft_' . mode . '_' . li[i] . '#' + for j in range(len(lc[i])) + let x = le[i][j] ? lc[i][j] : has_key(f, lc[i][j]) ? s:func(f[lc[i][j]]) : get(c, lc[i][j], '') + let _ .= has_key(t, lc[i][j]) && t[lc[i][j]] ==# 'raw' || get(w, lc[i][j]) || le[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)' + if j < len(lc[i]) - 1 && s.left !=# '' + let _ .= s:subseparator(lc[i][(j):], s.left, le[i][(j):]) endif endfor - let _ .= '%#LightlineLeft_' . mode . '_' . ll[i] . '_' . ll[i + 1] . '#' - let _ .= i < l + len(lt) - len(l_) && ll[i] < l || ll[i] != ll[i + 1] ? p.left : len(lt[i]) ? s.left : '' + let _ .= '%#LightlineLeft_' . mode . '_' . li[i] . '_' . li[i + 1] . '#' + let _ .= i < l + len(lc) - len(ls) && li[i] < l || li[i] != li[i + 1] ? p.left : len(lc[i]) ? s.left : '' endfor let _ .= '%#LightlineMiddle_' . mode . '#%=' - for i in range(len(rt) - 1, 0, -1) - let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#' - let _ .= i < r + len(rt) - len(r_) && rl[i] < r || rl[i] != rl[i + 1] ? p.right : len(rt[i]) ? s.right : '' - let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '#' - for j in range(len(rt[i])) - let x = rc[i][j] ? rt[i][j] : has_key(f, rt[i][j]) ? (exists('*' . f[rt[i][j]]) ? '%{' . f[rt[i][j]] . '()}' : '%{exists("*' . f[rt[i][j]] . '")?' . f[rt[i][j]] . '():""}') : get(c, rt[i][j], '') - let _ .= has_key(t, rt[i][j]) && t[rt[i][j]] ==# 'raw' || get(w, rt[i][j]) || rc[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)' - if j < len(rt[i]) - 1 && s.right !=# '' - let _ .= s:subseparator(rt[i][(j):], s.right, rc[i][(j):]) + for i in range(len(rc) - 1, 0, -1) + let _ .= '%#LightlineRight_' . mode . '_' . ri[i] . '_' . ri[i + 1] . '#' + let _ .= i < r + len(rc) - len(rs) && ri[i] < r || ri[i] != ri[i + 1] ? p.right : len(rc[i]) ? s.right : '' + let _ .= '%#LightlineRight_' . mode . '_' . ri[i] . '#' + for j in range(len(rc[i])) + let x = re[i][j] ? rc[i][j] : has_key(f, rc[i][j]) ? s:func(f[rc[i][j]]) : get(c, rc[i][j], '') + let _ .= has_key(t, rc[i][j]) && t[rc[i][j]] ==# 'raw' || get(w, rc[i][j]) || re[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)' + if j < len(rc[i]) - 1 && s.right !=# '' + let _ .= s:subseparator(rc[i][(j):], s.right, re[i][(j):]) endif endfor endfor @@ -443,14 +426,16 @@ endfunction let s:tabnr = -1 let s:tabcnt = -1 +let s:columns = -1 let s:tabline = '' function! lightline#tabline() abort if !has_key(s:highlight, 'tabline') call lightline#highlight('tabline') endif - if s:lightline.tabline_configured || s:tabnr != tabpagenr() || s:tabcnt != tabpagenr('$') + if s:lightline.tabline_configured || s:tabnr != tabpagenr() || s:tabcnt != tabpagenr('$') || s:columns != &columns let s:tabnr = tabpagenr() let s:tabcnt = tabpagenr('$') + let s:columns = &columns let s:tabline = s:line(1, 0) endif return s:tabline @@ -461,10 +446,10 @@ function! lightline#tabs() abort let nr = tabpagenr() let cnt = tabpagenr('$') for i in range(1, cnt) - call add(i < nr ? x : i == nr ? y : z, (i > nr + 3 ? '%<' : '') . '%'. i . 'T%{lightline#onetab(' . i . ',' . (i == nr) . ')}' . (i == cnt ? '%T' : '')) + call add(i < nr ? x : i == nr ? y : z, (i > nr + 3 ? '%<' : '') . '%' . i . 'T%{lightline#onetab(' . i . ',' . (i == nr) . ')}' . (i == cnt ? '%T' : '')) endfor let abbr = '...' - let n = min([max([s:lightline.winwidth / 40, 2]), 8]) + let n = min([max([&columns / 40, 2]), 8]) if len(x) > n && len(z) > n let x = extend(add(x[:n/2-1], abbr), x[-(n+1)/2:]) let z = extend(add(z[:(n+1)/2-1], abbr), z[-n/2:]) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/16color.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/16color.vim index 41e64970..19591024 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/16color.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/16color.vim @@ -1,49 +1,53 @@ " ============================================================================= " Filename: autoload/lightline/colorscheme/16color.vim -" Author: itchyny +" Author: itchyny, jackno " License: MIT License -" Last Change: 2017/11/25 11:14:04. " ============================================================================= -let s:base03 = [ '#808080', 8 ] -let s:base02 = [ '#000000', 0 ] -let s:base01 = [ '#00ff00', 10 ] -let s:base00 = [ '#ffff00', 11 ] -let s:base0 = [ '#0000ff', 12 ] -let s:base1 = [ '#00ffff', 14 ] -let s:base2 = [ '#c0c0c0', 7 ] -let s:base3 = [ '#ffffff', 15 ] -let s:yellow = [ '#808000', 3 ] -let s:orange = [ '#ff0000', 9 ] -let s:red = [ '#800000', 1 ] -let s:magenta = [ '#800080', 5 ] -let s:violet = [ '#ff00ff', 13 ] -let s:blue = [ '#000080', 4 ] -let s:cyan = [ '#008080', 6 ] +let s:black = [ '#000000', 0 ] +let s:maroon = [ '#800000', 1 ] let s:green = [ '#008000', 2 ] +let s:olive = [ '#808000', 3 ] +let s:navy = [ '#000080', 4 ] +let s:purple = [ '#800080', 5 ] +let s:teal = [ '#008080', 6 ] +let s:silver = [ '#c0c0c0', 7 ] +let s:gray = [ '#808080', 8] +let s:red = [ '#ff0000', 9 ] +let s:lime = [ '#00ff00', 10 ] +let s:yellow = [ '#ffff00', 11 ] +let s:blue = [ '#0000ff', 12 ] +let s:fuchsia = [ '#ff00ff', 13 ] +let s:aqua = [ '#00ffff', 14 ] +let s:white = [ '#ffffff', 15 ] if lightline#colorscheme#background() ==# 'light' - let [s:base03, s:base3] = [s:base3, s:base03] - let [s:base02, s:base2] = [s:base2, s:base02] - let [s:base01, s:base1] = [s:base1, s:base01] - let [s:base00, s:base0] = [s:base0, s:base00] + let [s:black, s:white] = [s:white, s:black] + let [s:silver, s:gray] = [s:gray, s:silver] + let [s:blue, s:aqua] = [s:aqua, s:blue] + let [s:purple, s:fuchsia] = [s:fuchsia, s:purple] + let [s:green, s:lime] = [s:lime, s:green] + let [s:red, s:yellow] = [s:yellow, s:red] endif let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ] -let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ] -let s:p.inactive.right = [ [ s:base02, s:base01 ], [ s:base00, s:base02 ] ] -let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ] -let s:p.insert.left = [ [ s:base3, s:green ], [ s:base3, s:base01 ] ] -let s:p.replace.left = [ [ s:base3, s:red ], [ s:base3, s:base01 ] ] -let s:p.visual.left = [ [ s:base3, s:magenta ], [ s:base3, s:base01 ] ] -let s:p.normal.middle = [ [ s:base1, s:base02 ] ] -let s:p.inactive.middle = [ [ s:base0, s:base02 ] ] -let s:p.tabline.left = [ [ s:base2, s:base01 ] ] -let s:p.tabline.tabsel = [ [ s:base2, s:base02 ] ] -let s:p.tabline.middle = [ [ s:base01, s:base2 ] ] +let s:p.normal.left = [ [ s:white, s:blue ], [ s:white, s:gray ] ] +let s:p.normal.middle = [ [ s:silver, s:black ] ] +let s:p.normal.right = [ [ s:white, s:blue ], [ s:white, s:gray ] ] +let s:p.normal.error = [ [ s:black, s:red ] ] +let s:p.normal.warning = [ [ s:black, s:yellow ] ] +let s:p.inactive.left = [ [ s:silver, s:gray ], [ s:gray, s:black ] ] +let s:p.inactive.middle = [ [ s:silver, s:black ] ] +let s:p.inactive.right = [ [ s:silver, s:gray ], [ s:gray, s:black ] ] +let s:p.insert.left = [ [ s:white, s:green ], [ s:white, s:gray ] ] +let s:p.insert.right = copy(s:p.insert.left) +let s:p.replace.left = [ [ s:white, s:red ], [ s:white, s:gray ] ] +let s:p.replace.right = copy(s:p.replace.left) +let s:p.visual.left = [ [ s:white, s:purple ], [ s:white, s:gray ] ] +let s:p.visual.right = copy(s:p.visual.left) +let s:p.tabline.left = [ [ s:silver, s:black ] ] +let s:p.tabline.tabsel = copy(s:p.normal.right) +let s:p.tabline.middle = [ [ s:silver, s:black ] ] let s:p.tabline.right = copy(s:p.normal.right) -let s:p.normal.error = [ [ s:base2, s:red ] ] -let s:p.normal.warning = [ [ s:base02, s:yellow ] ] let g:lightline#colorscheme#16color#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim index 262442a6..ba93f8ae 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/jellybeans.vim @@ -30,10 +30,10 @@ let s:p.replace.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ] let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ] let s:p.normal.middle = [ [ s:base0, s:base02 ] ] let s:p.inactive.middle = [ [ s:base00, s:base02 ] ] -let s:p.tabline.left = [ [ s:base3, s:base00 ] ] -let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ] -let s:p.tabline.middle = [ [ s:base01, s:base1 ] ] -let s:p.tabline.right = copy(s:p.normal.right) +let s:p.tabline.left = copy(s:p.normal.middle) +let s:p.tabline.tabsel = [ [ s:base3, s:base00 ] ] +let s:p.tabline.middle = copy(s:p.normal.middle) +let s:p.tabline.right = copy(s:p.tabline.middle) let s:p.normal.error = [ [ s:red, s:base02 ] ] let s:p.normal.warning = [ [ s:yellow, s:base01 ] ] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim index 4b497938..dc95139b 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_black.vim @@ -26,7 +26,7 @@ let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] -let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.middle = [[ s:dim_0, s:bg_1 ]] let s:p.normal.error = [[ s:bg_1, s:red ]] let s:p.normal.warning = [[ s:bg_1, s:yellow ]] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim index 619ee8c9..c3238384 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_dark.vim @@ -26,7 +26,7 @@ let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] -let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.middle = [[ s:dim_0, s:bg_1 ]] let s:p.normal.error = [[ s:bg_1, s:red ]] let s:p.normal.warning = [[ s:bg_1, s:yellow ]] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim index 1b3f2110..979149d2 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_light.vim @@ -26,7 +26,7 @@ let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] -let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.middle = [[ s:dim_0, s:bg_1 ]] let s:p.normal.error = [[ s:bg_1, s:red ]] let s:p.normal.warning = [[ s:bg_1, s:yellow ]] diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim index 402818e4..9da3a4e3 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/selenized_white.vim @@ -26,7 +26,7 @@ let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': let s:p.normal.right = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ], [ s:dim_0, s:bg_1 ]] let s:p.normal.left = [[ s:bg_1, s:blue ], [ s:cyan, s:bg_2 ]] -let s:p.normal.middle = [[ s:bg_1, s:bg_1 ]] +let s:p.normal.middle = [[ s:dim_0, s:bg_1 ]] let s:p.normal.error = [[ s:bg_1, s:red ]] let s:p.normal.warning = [[ s:bg_1, s:yellow ]] diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index 6d431830..fefe85fe 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -132,6 +132,10 @@ ![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png) -### 16color +### 16color dark -![lightline.vim - 16color](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color.png) +![lightline.vim - 16color dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_dark.png) + +### 16color light + +![lightline.vim - 16color light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_light.png) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 1b308e99..bebc1e04 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -1,23 +1,19 @@ *lightline.txt* A light and configurable statusline/tabline for Vim -Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2020/05/02 17:05:15. +Last Change: 2020/10/20 21:35:06. CONTENTS *lightline-contents* Introduction |lightline-introduction| Spirit |lightline-spirit| Option |lightline-option| -Font |lightline-font| Function |lightline-function| Component Expansion |lightline-component-expansion| Colorscheme |lightline-colorscheme| Examples |lightline-examples| -Nice Examples |lightline-nice-examples| -Powerful Example |lightline-powerful-example| Troubleshooting |lightline-troubleshooting| ============================================================================== @@ -107,7 +103,7 @@ OPTIONS *lightline-option* \ 'percent': '%3p%%', \ 'percentwin': '%P', \ 'spell': '%{&spell?&spelllang:""}', - \ 'lineinfo': '%3l:%-2v', + \ 'lineinfo': '%3l:%-2c', \ 'line': '%l', \ 'column': '%c', \ 'close': '%999X X ', @@ -152,6 +148,10 @@ OPTIONS *lightline-option* \ }, \ } < + If you simply want to display the branch name instead of + installing a plugin for full git integration, you can use + vim-gitbranch (https://github.com/itchyny/vim-gitbranch). + g:lightline.component_function_visible_condition *g:lightline.component_function_visible_condition* A dictionary to store the visible conditions of the function @@ -291,78 +291,6 @@ OPTIONS *lightline-option* \ } < ============================================================================== -FONT *lightline-font* -You can use the patched font you used for |vim-powerline| and |powerline|. - -The patched fonts for |powerline| are available at -https://github.com/Lokaltog/powerline-fonts - -A tutorial to create a patched font for |vim-powerline| is available at -https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher - -If you have installed the patched font for |powerline|, following settings look -nice. -> - let g:lightline = { - \ 'component': { - \ 'lineinfo': ' %3l:%-2v', - \ }, - \ 'component_function': { - \ 'readonly': 'LightlineReadonly', - \ 'fugitive': 'LightlineFugitive' - \ }, - \ 'separator': { 'left': '', 'right': '' }, - \ 'subseparator': { 'left': '', 'right': '' } - \ } - function! LightlineReadonly() - return &readonly ? '' : '' - endfunction - function! LightlineFugitive() - if exists('*FugitiveHead') - let branch = FugitiveHead() - return branch !=# '' ? ''.branch : '' - endif - return '' - endfunction -< -If you have installed the patched font for |vim-powerline|, following settings -look nice. -> - let g:lightline = { - \ 'component': { - \ 'lineinfo': '⭡ %3l:%-2v', - \ }, - \ 'component_function': { - \ 'readonly': 'LightlineReadonly', - \ 'fugitive': 'LightlineFugitive' - \ }, - \ 'separator': { 'left': '⮀', 'right': '⮂' }, - \ 'subseparator': { 'left': '⮁', 'right': '⮃' } - \ } - function! LightlineReadonly() - return &readonly ? '⭤' : '' - endfunction - function! LightlineFugitive() - if exists('*FugitiveHead') - let branch = FugitiveHead() - return branch !=# '' ? '⭠ '.branch : '' - endif - return '' - endfunction -< -If the statusline does not correctly show the special characters, use the -unicode numbers. For |powerline| font users: -> - \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, - \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" } -< -For |vim-powerline| font users: -> - \ 'separator': { 'left': "\u2b80", 'right': "\u2b82" }, - \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" } -< -See |lightline-problem-9| for more detail. -============================================================================== FUNCTION *lightline-function* Exposed functions for lightline.vim. @@ -662,34 +590,27 @@ In order to change the colorscheme: \ 'colorscheme': 'wombat', \ } < - In order to define your own component: > let g:lightline = { - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ] - \ }, \ 'component_function': { - \ 'myfilename': 'LightlineFilename', - \ 'myreadonly': 'LightlineReadonly', - \ 'mymodified': 'LightlineModified', + \ 'filename': 'LightlineFilename', + \ 'readonly': 'LightlineReadonly', + \ 'modified': 'LightlineModified', \ } \ } function! LightlineFilename() - return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . - \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + return &ft ==# 'vimfiler' ? vimfiler#get_status_string() : \ &ft ==# 'unite' ? unite#get_status_string() : - \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . - \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]' endfunction function! LightlineReadonly() - return &ft !~? 'help' && &readonly ? 'RO' : '' + return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : '' endfunction function! LightlineModified() return &modifiable && &modified ? '+' : '' endfunction < - Separators settings: > let g:lightline = { @@ -697,30 +618,9 @@ Separators settings: \ 'subseparator': { 'left': '|', 'right': '|' } \ } < - -For |powerline| font users: +An example for fugitive, vimfiler and unite users. > let g:lightline = { - \ 'separator': { 'left': '', 'right': '' }, - \ 'subseparator': { 'left': '', 'right': '' } - \ } -< - -For |vim-powerline| font users: -> - let g:lightline = { - \ 'separator': { 'left': '⮀', 'right': '⮂' }, - \ 'subseparator': { 'left': '⮁', 'right': '⮃' } - \ } -< - ------------------------------------------------------------------------------- -NICE EXAMPLES *lightline-nice-examples* - -A nice example for non-patched font users. -> - let g:lightline = { - \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ] \ }, @@ -739,61 +639,19 @@ A nice example for non-patched font users. return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : \ &ft ==# 'unite' ? unite#get_status_string() : - \ &ft ==# 'vimshell' ? vimshell#get_status_string() : \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*FugitiveHead') + if exists('*FugitiveHead') return FugitiveHead() endif return '' endfunction < -A nice example for |vim-powerline| font users: +For users of lots of plugins: > let g:lightline = { - \ 'colorscheme': 'wombat', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ] - \ }, - \ 'component_function': { - \ 'fugitive': 'LightlineFugitive', - \ 'filename': 'LightlineFilename' - \ }, - \ 'separator': { 'left': '⮀', 'right': '⮂' }, - \ 'subseparator': { 'left': '⮁', 'right': '⮃' } - \ } - function! LightlineModified() - return &ft =~# 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' - endfunction - function! LightlineReadonly() - return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : '' - endfunction - function! LightlineFilename() - return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . - \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : - \ &ft ==# 'unite' ? unite#get_status_string() : - \ &ft ==# 'vimshell' ? vimshell#get_status_string() : - \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . - \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') - endfunction - function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*FugitiveHead') - let branch = FugitiveHead() - return branch !=# '' ? '⭠ '.branch : '' - endif - return '' - endfunction -< - ------------------------------------------------------------------------------- -POWERFUL EXAMPLE *lightline-powerful-example* - -For users who uses lots of plugins: -> - let g:lightline = { - \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ], \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] @@ -935,17 +793,7 @@ Problem 5: |lightline-problem-5| The statusline does not seem to be correctly colored. Problem 6: |lightline-problem-6| - How to install a patched font. - -Problem 7: |lightline-problem-7| - Right triangles do not stick to the right components with the - patched font. - -Problem 8: |lightline-problem-8| - Triangles do not appear. Triangles look weird. - -Problem 9: |lightline-problem-9| - Where can I find the list of all the cool characters for patched fonts? + How to use a powerline font and the triangles for separators. Problem 10: |lightline-problem-10| Cool statusline disappears in |unite|, |vimfiler| and |vimshell| @@ -984,20 +832,17 @@ Problem 17: |lightline-problem-17| Problem 1: *lightline-problem-1* How to install this plugin. - If you are to install this plugin manually: - - 1. Put all the files under $VIM. - - If you are to install this plugin using |vim-pathogen|: - - 1. Install this plugin with the following command. + If you install this plugin using Vim packages: +> + git clone https://github.com/itchyny/lightline.vim \ + ~/.vim/pack/plugins/start/lightline +< + If you install this plugin using |vim-pathogen|: > git clone https://github.com/itchyny/lightline.vim \ ~/.vim/bundle/lightline.vim < - 2. Generate help tags with |:Helptags|. - - If you are to install this plugin using |Vundle|: + If you install this plugin using |Vundle|: 1. Add the following configuration to your .vimrc(_vimrc). @@ -1006,7 +851,7 @@ Problem 1: *lightline-problem-1* < 2. Install with |:PluginInstall|. - If you are to install this plugin using |NeoBundle|: + If you install this plugin using |NeoBundle|: 1. Add the following configuration to your .vimrc(_vimrc). @@ -1015,7 +860,7 @@ Problem 1: *lightline-problem-1* < 2. Install with |:NeoBundleInstall|. - If you are to install this plugin using |vim-plug|: + If you install this plugin using |vim-plug|: 1. Add the following configuration to your .vimrc(_vimrc). @@ -1024,51 +869,76 @@ Problem 1: *lightline-problem-1* < 2. Install with |:PlugInstall|. + If you install this plugin using |dein|: + + 1. Add the following configuration to your + .vimrc(_vimrc). +> + call dein#add('itchyny/lightline.vim') +< + 2. Install with :call |dein#install()|. + Problem 2: *lightline-problem-2* How to update this plugin. - If you have installed this plugin manually: + If you installed this plugin using Vim packages: +> + git -C ~/.vim/pack/plugins/start/lightline pull +< + If you installed this plugin using |vim-pathogen|: +> + git -C ~/.vim/bundle/lightline.vim pull +< + If you installed this plugin using |Vundle|: - 1. Access https://github.com/itchyny/lightline.vim . - 2. Download the latest scripts. - 3. Place the scripts as written in Problem 1. + Execute |:PluginUpdate|. - If you have installed this plugin using Vundle: + If you installed this plugin using |NeoBundle|: - 1. Execute |:PluginUpdate|. + Execute |:NeoBundleUpdate|. - If you have installed this plugin using NeoBundle: + If you installed this plugin using |vim-plug|: - 1. Execute |:NeoBundleUpdate|. + Execute |:PlugUpdate|. - If you have installed this plugin using vim-plug: + If you installed this plugin using |dein|: - 1. Execute |:PlugUpdate|. + Execute :call |dein#update()|. Problem 3: *lightline-problem-3* How to uninstall this plugin. - If you have installed this plugin manually: + If you installed this plugin using Vim packages: +> + rm -rf ~/.vim/pack/plugins/start/lightline +< + If you installed this plugin using |vim-pathogen|: +> + rm -rf ~/.vim/bundle/lightline.vim +< + If you have installed this plugin using |Vundle|: - 1. Remove all the lightline.*s under $VIM. + 1. Remove `Plugin 'itchyny/lightline.vim'` + from your .vimrc(_vimrc). + 2. Execute |:PluginClean|. - If you have installed this plugin using Vundle: + If you installed this plugin using |NeoBundle|: - 1. Remove the :Plugin 'itchyny/lightline.vim' - configuration from your .vimrc(_vimrc). - 2. Update with |:PluginClean|. + 1. Remove `NeoBundle 'itchyny/lightline.vim'` + from your .vimrc(_vimrc). + 2. Remove the plugin directory. - If you have installed this plugin using NeoBundle: + If you installed this plugin using |vim-plug|: - 1. Remove the :NeoBundle 'itchyny/lightline.vim' - configuration from your .vimrc(_vimrc). - 2. Update with |:NeoBundleClean|. + 1. Remove `Plug 'itchyny/lightline.vim'` + from your .vimrc(_vimrc). + 2. Execute |:PlugClean|. - If you have installed this plugin using vim-plug: + If you installed this plugin using |dein|: - 1. Remove the :Plug 'itchyny/lightline.vim' - configuration from your .vimrc(_vimrc). - 2. Update with |:PlugClean|. + 1. Remove `call dein#add('itchyny/lightline.vim')` + from your .vimrc(_vimrc). + 2. Remove the plugin directory. Problem 4: *lightline-problem-4* Cool statuslines appear only on |:vsp|. @@ -1093,74 +963,22 @@ Problem 5: *lightline-problem-5* to your .vimrc(_vimrc). Problem 6: *lightline-problem-6* - How to install a patched font. + How to use a powerline font and the triangles for separators. - There are two kinds of patched fonts: + Using a patched font is not recommended due to less + portability. Also the powerline fonts project is not actively + maintained (https://github.com/powerline/fonts). - + The patched fonts for |vim-powerline| - (https://github.com/Lokaltog/vim-powerline): - follow the guide https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher - + The patched fonts for |powerline| - (https://github.com/Lokaltog/powerline): - download from https://github.com/Lokaltog/powerline-fonts - -Problem 7: *lightline-problem-7* - Right triangles do not stick to the right components with patched - font. - - Remove the following setting from your .vimrc(_vimrc). -> - set ambiwidth=double -< - If you want to keep this setting, try the patched font for - |vim-powerline|. - -Problem 8: *lightline-problem-8* - Triangles do not appear. Triangles look weird. - - If the triangles do not appear (but you get some spaces or - weird characters like or ¿), firstly try adding -> - scriptencoding utf-8 - set encoding=utf-8 -< - to the head of your .vimrc(_vimrc). Still you have weird - characters, use the unicode numbers. For |powerline| font - users: + If you still want to use a patched font, you can configure > \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, - \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" } + \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, < - For |vim-powerline| font users: + or > \ 'separator': { 'left': "\u2b80", 'right': "\u2b82" }, - \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" } + \ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" }, < - The full list of unicode numbers for fancy characters is shown - in |lightline-problem-9|. - - If the triangles are shown in appropriate characters but the - colors do not look correctly, see the following. - If you are using iTerm2, change the following settings. - - + set Profiles>Colors>Minimum contrast to the Lowest. - + set Profiles>Window>Transparency to the Opaquest. - - For other terminals, this weird-triangle problem will be - resolved by disabling transparency or contrast adjustment. - -Problem 9: *lightline-problem-9* - Where can I find the list of all the cool characters for patched fonts? - - Default powerline vim-powerline - separator.left '' '' (\ue0b0) '⮀' (\u2b80) - separator.right '' '' (\ue0b2) '⮂' (\u2b82) - subseparator.left '|' '' (\ue0b1) '⮁' (\u2b81) - subseparator.right '|' '' (\ue0b3) '⮃' (\u2b83) - branch symbol -- '' (\ue0a0) '⭠' (\u2b60) - readonly symbol -- '' (\ue0a2) '⭤' (\u2b64) - linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b61) - Problem 10: *lightline-problem-10* Cool statusline disappears on |unite|, |vimfiler| and |vimshell| buffers. @@ -1192,7 +1010,7 @@ Problem 11: *lightline-problem-11* return lightline#statusline(0) endfunction < - See |lightline-powerful-example| for more cool settings for + See |lightline-example| for more cool settings for these plugins. Problem 12: *lightline-problem-12* @@ -1287,8 +1105,8 @@ Problem 15: *lightline-problem-15* If you don't like the separators in the tabline, use: > let g:lightline = { - \ 'tabline_separator': { 'left': "", 'right': "" }, - \ 'tabline_subseparator': { 'left': "", 'right': "" }, + \ 'tabline_separator': { 'left': '', 'right': '' }, + \ 'tabline_subseparator': { 'left': '', 'right': '' }, \ } < Problem 16: *lightline-problem-16* diff --git a/sources_non_forked/lightline.vim/plugin/lightline.vim b/sources_non_forked/lightline.vim/plugin/lightline.vim index a11d6622..e1254b7b 100644 --- a/sources_non_forked/lightline.vim/plugin/lightline.vim +++ b/sources_non_forked/lightline.vim/plugin/lightline.vim @@ -2,10 +2,10 @@ " Filename: plugin/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2020/03/16 19:08:41. +" Last Change: 2020/11/05 20:05:40. " ============================================================================= -if exists('g:loaded_lightline') || v:version < 700 +if exists('g:loaded_lightline') || v:version < 703 finish endif let g:loaded_lightline = 1 diff --git a/sources_non_forked/lightline.vim/test/.themisrc b/sources_non_forked/lightline.vim/test/.themisrc index 6e0121ce..5c7018a1 100644 --- a/sources_non_forked/lightline.vim/test/.themisrc +++ b/sources_non_forked/lightline.vim/test/.themisrc @@ -20,3 +20,5 @@ function! SID(name) abort endfunction filetype plugin on + +call lightline#init() diff --git a/sources_non_forked/lightline.vim/test/link.vim b/sources_non_forked/lightline.vim/test/link.vim index 98e409e6..3da8ea1d 100644 --- a/sources_non_forked/lightline.vim/test/link.vim +++ b/sources_non_forked/lightline.vim/test/link.vim @@ -141,3 +141,17 @@ function! s:suite.component_type() endfor endfor endfunction + +function! s:suite.hi_clear() + call lightline#link() + colorscheme default + call lightline#link() + call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0') + call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0') + call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1') + call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal') +endfunction diff --git a/sources_non_forked/lightline.vim/test/tabs.vim b/sources_non_forked/lightline.vim/test/tabs.vim index 7851e705..863dd7fa 100644 --- a/sources_non_forked/lightline.vim/test/tabs.vim +++ b/sources_non_forked/lightline.vim/test/tabs.vim @@ -2,7 +2,7 @@ let s:suite = themis#suite('tabs') let s:assert = themis#helper('assert') function! s:suite.before_each() - let g:lightline = { 'winwidth': 180 } + set columns=180 call lightline#init() tabnew tabonly diff --git a/sources_non_forked/lightline.vim/test/toggle.vim b/sources_non_forked/lightline.vim/test/toggle.vim index 7df270f8..6f7eb5bd 100644 --- a/sources_non_forked/lightline.vim/test/toggle.vim +++ b/sources_non_forked/lightline.vim/test/toggle.vim @@ -29,6 +29,12 @@ function! s:suite.disable_enable() call s:assert.equals(exists('#lightline-disable'), 0) call s:assert.not_equals(&statusline, '') call s:assert.not_equals(&tabline, '') + call lightline#disable() + call lightline#disable() + call lightline#enable() + call lightline#enable() + call s:assert.equals(exists('#lightline'), 1) + call s:assert.equals(exists('#lightline-disable'), 0) endfunction function! s:suite.toggle() diff --git a/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md index 24dba3f5..d2e3b7d4 100644 --- a/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md +++ b/sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ ### Description of Changes -Closes # +Closes # --- @@ -13,4 +13,10 @@ Closes # - [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern. #### Collaborator's Instructions - [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary. -- [ ] After merge, tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags` +- [ ] After merging, tag the commit using these (Mac-compatible) bash commands: + ```bash + git checkout master + git pull + sed -n "$(grep -n -m2 '####' CHANGELOG.md | cut -f1 -d: | sed 'N;s/\n/,/')p" CHANGELOG.md | sed '$d' + git tag -a $(read -p "Tag Name: " tag;echo $tag) -m"$(git show --quiet --pretty=%s)";git push origin --tags + ``` diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index 0f1f1f5e..e558036b 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -4,6 +4,18 @@ version in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.9 +- **.10**: Open a mirrored NERDTree with correct width (PhilRunninger) [#1177](https://github.com/preservim/nerdtree/pull/1177) +- **.9**: Updated Readme, removed typo (H3RSKO) [#1167](https://github.com/preservim/nerdtree/pull/1167) +- **.8**: Refactor sort comparison functions, removing redundancy (PhilRunninger) [#1166](https://github.com/preservim/nerdtree/pull/1166) +- **.7**: Fix argument of `exists()` function calls checking for autocommands. (PhilRunninger) [#1165](https://github.com/preservim/nerdtree/pull/1165) +- **.6**: Don't use silent when raising User events (PhilRunninger) [#1164](https://github.com/preservim/nerdtree/pull/1164) +- **.5**: Fix highlight for file node. (pirey) [#1157](https://github.com/preservim/nerdtree/pull/1157) +- **.4**: Make sure symbolic links' flags are highlighted correctly. (PhilRunninger) [#1156](https://github.com/preservim/nerdtree/pull/1156) +- **.3**: Fix new NERDTrees' width when previous one was in the only window. (PhilRunninger) [#1153](https://github.com/preservim/nerdtree/pull/1153) +- **.2**: Fix the scope of several key mappings (lifecrisis, PhilRunninger) [#1151](https://github.com/preservim/nerdtree/pull/1151) +- **.1**: Respect user's `&shellslash` setting in CopyNode and RemoveNode functions (PhilRunninger) [#1150](https://github.com/preservim/nerdtree/pull/1150) +- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144) #### 6.8 - **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138) #### 6.7 diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 09173a65..018923cf 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -28,7 +28,7 @@ git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/ner vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q ``` -Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you nee d to take. +Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you need to take. #### [pathogen.vim](https://github.com/tpope/vim-pathogen) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index d0785a4c..983bb621 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -30,9 +30,11 @@ endfunction " SECTION: General Functions {{{1 "============================================================ -"FUNCTION: nerdtree#slash() {{{2 +" FUNCTION: nerdtree#slash() {{{2 +" Return the path separator used by the underlying file system. Special +" consideration is taken for the use of the 'shellslash' option on Windows +" systems. function! nerdtree#slash() abort - if nerdtree#runningWindows() if exists('+shellslash') && &shellslash return '/' @@ -108,15 +110,15 @@ function! nerdtree#completeBookmarks(A,L,P) abort return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') endfunction -"FUNCTION: nerdtree#compareNodes(dir) {{{2 +"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2 function! nerdtree#compareNodes(n1, n2) abort - return a:n1.path.compareTo(a:n2.path) + return nerdtree#compareNodePaths(a:n1.path, a:n2.path) endfunction -"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2 -function! nerdtree#compareNodesBySortKey(n1, n2) abort - let sortKey1 = a:n1.path.getSortKey() - let sortKey2 = a:n2.path.getSortKey() +"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2 +function! nerdtree#compareNodePaths(p1, p2) abort + let sortKey1 = a:p1.getSortKey() + let sortKey2 = a:p2.getSortKey() let i = 0 while i < min([len(sortKey1), len(sortKey2)]) " Compare chunks upto common length. diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index aef1b046..78b3fa1f 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -25,12 +25,16 @@ function! nerdtree#ui_glue#createDefaultBindings() abort call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' }) @@ -511,6 +515,28 @@ function! s:openVSplit(target) abort call a:target.activate({'where': 'v'}) endfunction +"FUNCTION: s:openHSplitBookmark(bookmark) {{{1 +"handle the user activating a bookmark +function! s:openHSplitBookmark(bm) abort + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {}) +endfunction + +"FUNCTION: s:openVSplitBookmark(bookmark) {{{1 +"handle the user activating a bookmark +function! s:openVSplitBookmark(bm) abort + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {}) +endfunction + +" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1 +function! s:previewNodeHSplitBookmark(bookmark) abort + call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {}) +endfunction + +" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1 +function! s:previewNodeVSplitBookmark(bookmark) abort + call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {}) +endfunction + " FUNCTION: s:openExplorer(node) {{{1 function! s:openExplorer(node) abort call a:node.openExplorer() @@ -538,11 +564,7 @@ endfunction " FUNCTION: s:previewBookmark(bookmark) {{{1 function! s:previewBookmark(bookmark) abort - if a:bookmark.path.isDirectory - execute 'NERDTreeFind '.a:bookmark.path.str() - else - call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1}) - endif + call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {}) endfunction "FUNCTION: s:previewNodeCurrent(node) {{{1 diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 6c11a94d..2989718c 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -318,9 +318,8 @@ Applies to: files. If a file node or a bookmark that links to a file is selected, it is opened in the previous window, but the cursor does not move. -If a bookmark that links to a directory is selected, that directory is found -in the current NERDTree. If the directory couldn't be found, a new NERDTree is -created. +If a bookmark that links to a directory is selected then that directory +becomes the new root. The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see |NERDTree-o|). @@ -350,7 +349,7 @@ The same as |NERDTree-t| except that the focus is kept in the current tab. *NERDTree-i* Default key: i Map setting: *NERDTreeMapOpenSplit* -Applies to: files. +Applies to: files, and bookmarks pointing to files. Opens the selected file in a new split window and puts the cursor in the new window. @@ -359,7 +358,7 @@ window. *NERDTree-gi* Default key: gi Map setting: *NERDTreeMapPreviewSplit* -Applies to: files. +Applies to: files, and bookmarks pointing to files. The same as |NERDTree-i| except that the cursor is not moved. @@ -370,7 +369,7 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see *NERDTree-s* Default key: s Map setting: *NERDTreeMapOpenVSplit* -Applies to: files. +Applies to: files, and bookmarks pointing to files. Opens the selected file in a new vertically split window and puts the cursor in the new window. @@ -379,7 +378,7 @@ in the new window. *NERDTree-gs* Default key: gs Map setting: *NERDTreeMapPreviewVSplit* -Applies to: files. +Applies to: files, and bookmarks pointing to files. The same as |NERDTree-s| except that the cursor is not moved. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index f845361d..b9d45dc9 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -28,7 +28,9 @@ endfunction " FUNCTION: s:Creator._broadcastInitEvent() {{{1 function! s:Creator._broadcastInitEvent() - silent doautocmd User NERDTreeInit + if exists('#User#NERDTreeInit') + doautocmd User NERDTreeInit + endif endfunction " FUNCTION: s:Creator.BufNamePrefix() {{{1 @@ -170,6 +172,7 @@ function! s:Creator.createMirror() let t:NERDTreeBufName = bufferName call self._createTreeWin() exec 'buffer ' . bufferName + call b:NERDTree.ui.restoreScreenState() if !&hidden call b:NERDTree.render() endif @@ -247,7 +250,7 @@ function! s:Creator._pathForString(str) "hack to get an absolute path if a relative path is given if dir =~# '^\.' - let dir = getcwd() . g:NERDTreePath.Slash() . dir + let dir = getcwd() . nerdtree#slash() . dir endif "hack to prevent removing slash if dir is the root of the file system. diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index 982db16c..db9e2b55 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -27,7 +27,9 @@ function! s:NERDTree.changeRoot(node) call self.render() call self.root.putCursorHere(0, 0) - silent doautocmd User NERDTreeNewRoot + if exists('#User#NERDTreeNewRoot') + doautocmd User NERDTreeNewRoot + endif endfunction "FUNCTION: s:NERDTree.Close() {{{1 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index 6cdd9dfc..9c62b723 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -174,9 +174,8 @@ function! s:Opener._newSplit() "resize the tree window if no other window was open before if onlyOneWin - let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize call nerdtree#exec('wincmd p', 1) - call nerdtree#exec('silent '. splitMode .' resize '. size, 1) + call nerdtree#exec('silent '. splitMode .' resize '. g:NERDTreeWinSize, 1) call nerdtree#exec('wincmd p', 0) endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index d30dd511..786ccd90 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -25,10 +25,10 @@ function! s:Path.AbsolutePathFor(pathStr) if l:prependWorkingDir let l:result = getcwd() - if l:result[-1:] ==# s:Path.Slash() + if l:result[-1:] == nerdtree#slash() let l:result = l:result . a:pathStr else - let l:result = l:result . s:Path.Slash() . a:pathStr + let l:result = l:result . nerdtree#slash() . a:pathStr endif endif @@ -99,50 +99,6 @@ function! s:Path.changeToDir() endtry endfunction -" FUNCTION: Path.compareTo() {{{1 -" -" Compares this Path to the given path and returns 0 if they are equal, -1 if -" this Path is 'less than' the given path, or 1 if it is 'greater'. -" -" Args: -" path: the path object to compare this to -" -" Return: -" 1, -1 or 0 -function! s:Path.compareTo(path) - let thisPath = self.getLastPathComponent(1) - let thatPath = a:path.getLastPathComponent(1) - - "if the paths are the same then clearly we return 0 - if thisPath ==# thatPath - return 0 - endif - - let thisSS = self.getSortOrderIndex() - let thatSS = a:path.getSortOrderIndex() - - "compare the sort sequences, if they are different then the return - "value is easy - if thisSS < thatSS - return -1 - elseif thisSS > thatSS - return 1 - else - if !g:NERDTreeSortHiddenFirst - let thisPath = substitute(thisPath, '^[._]', '', '') - let thatPath = substitute(thatPath, '^[._]', '', '') - endif - "if the sort sequences are the same then compare the paths - "alphabetically - let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath ') -call s:initVariable('g:NERDTreeMapActivateNode', 'o') -call s:initVariable('g:NERDTreeMapChangeRoot', 'C') -call s:initVariable('g:NERDTreeMapChdir', 'cd') -call s:initVariable('g:NERDTreeMapCloseChildren', 'X') -call s:initVariable('g:NERDTreeMapCloseDir', 'x') -call s:initVariable('g:NERDTreeMapDeleteBookmark', 'D') -call s:initVariable('g:NERDTreeMapMenu', 'm') -call s:initVariable('g:NERDTreeMapHelp', '?') -call s:initVariable('g:NERDTreeMapJumpFirstChild', 'K') -call s:initVariable('g:NERDTreeMapJumpLastChild', 'J') -call s:initVariable('g:NERDTreeMapJumpNextSibling', '') -call s:initVariable('g:NERDTreeMapJumpParent', 'p') -call s:initVariable('g:NERDTreeMapJumpPrevSibling', '') -call s:initVariable('g:NERDTreeMapJumpRoot', 'P') -call s:initVariable('g:NERDTreeMapOpenExpl', 'e') -call s:initVariable('g:NERDTreeMapOpenInTab', 't') -call s:initVariable('g:NERDTreeMapOpenInTabSilent', 'T') -call s:initVariable('g:NERDTreeMapOpenRecursively', 'O') -call s:initVariable('g:NERDTreeMapOpenSplit', 'i') -call s:initVariable('g:NERDTreeMapOpenVSplit', 's') -call s:initVariable('g:NERDTreeMapPreview', 'g' . NERDTreeMapActivateNode) -call s:initVariable('g:NERDTreeMapPreviewSplit', 'g' . NERDTreeMapOpenSplit) -call s:initVariable('g:NERDTreeMapPreviewVSplit', 'g' . NERDTreeMapOpenVSplit) -call s:initVariable('g:NERDTreeMapQuit', 'q') -call s:initVariable('g:NERDTreeMapRefresh', 'r') -call s:initVariable('g:NERDTreeMapRefreshRoot', 'R') -call s:initVariable('g:NERDTreeMapToggleBookmarks', 'B') -call s:initVariable('g:NERDTreeMapToggleFiles', 'F') -call s:initVariable('g:NERDTreeMapToggleFilters', 'f') -call s:initVariable('g:NERDTreeMapToggleHidden', 'I') -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') +let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '') +let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o') +let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C') +let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd') +let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X') +let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x') +let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D') +let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm') +let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?') +let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K') +let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J') +let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '') +let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p') +let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '') +let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P') +let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e') +let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't') +let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T') +let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O') +let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i') +let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's') +let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode) +let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit) +let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit) +let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q') +let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r') +let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R') +let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B') +let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F') +let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f') +let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I') +let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A') +let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u') +let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U') +let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD') +let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j') +let g:NERDTreeMenuUp = get(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 fc7269ea..bf523d15 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -47,7 +47,7 @@ endif "highlighting for readonly files exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile' -exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir' +exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir' syn match NERDTreeCWD #^[" display syn match typescriptNumber "-\=\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>" display syn match typescriptNumber "-\=\<0[bB][01][01_]*\>" display syn match typescriptNumber "-\=\<0[oO]\o[0-7_]*\>" display -syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline +syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimsuy]\{0,2\}\s*$+ end=+/[gimsuy]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline " syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\." " syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc " syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc -" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline +" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gimsuy]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline " syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/ " syntax match typescriptLabel /\(?\s*\)\@\|>=\|<=\|++\|+=\|--\|-=" syn match typescriptEndColons "[;,]" syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)" +syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-=" " typescriptFold Function {{{ @@ -288,6 +289,7 @@ if version >= 508 || !exists("did_typescript_syn_inits") HiLink typescriptSpecial Special HiLink typescriptSource Special HiLink typescriptGlobalObjects Special + HiLink typescriptGlobalNodeObjects Special HiLink typescriptExceptions Special HiLink typescriptDomErrNo Constant diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim index 3b71f944..6fd332d0 100644 --- a/sources_non_forked/vim-abolish/plugin/abolish.vim +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -588,6 +588,7 @@ function! s:coerce(type) abort let regbody = getreg('"') let regtype = getregtype('"') let c = v:count1 + let begin = getcurpos() while c > 0 let c -= 1 if a:type ==# 'line' @@ -600,9 +601,6 @@ function! s:coerce(type) abort silent exe 'normal!' move.'y' let word = @@ let @@ = s:send(g:Abolish.Coercions,s:transformation,word) - if !exists('begin') - let begin = getpos("'[") - endif if word !=# @@ let changed = 1 exe 'normal!' move.'p' @@ -618,7 +616,7 @@ function! s:coerce(type) abort endfunction nnoremap (abolish-coerce) coerce(nr2char(getchar())) -nnoremap (abolish-coerce) coerce(nr2char(getchar())) +vnoremap (abolish-coerce) coerce(nr2char(getchar())) nnoremap (abolish-coerce-word) coerce(nr2char(getchar())).'iw' " }}}1 diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 1106aea2..4a5b1083 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -146,11 +146,13 @@ endif function! s:TempScript(...) abort let body = join(a:000, "\n") if !has_key(s:temp_scripts, body) - let temp = tempname() . '.sh' - call writefile(['#!/bin/sh'] + a:000, temp) - let s:temp_scripts[body] = temp + let s:temp_scripts[body] = tempname() . '.sh' endif - return FugitiveGitPath(s:temp_scripts[body]) + let temp = s:temp_scripts[body] + if !filereadable(temp) + call writefile(['#!/bin/sh'] + a:000, temp) + endif + return FugitiveGitPath(temp) endfunction function! s:DoAutocmd(cmd) abort @@ -551,9 +553,9 @@ function! fugitive#Config(...) abort let dir = a:1 endif let name = substitute(name, '^[^.]\+\|[^.]\+$', '\L&', 'g') - let key = len(dir) ? dir : '_' - if has_key(s:config, key) && s:config[key][0] ==# s:ConfigTimestamps(dir, s:config[key][1]) - let dict = s:config[key][1] + let dir_key = len(dir) ? dir : '_' + if has_key(s:config, dir_key) && s:config[dir_key][0] ==# s:ConfigTimestamps(dir, s:config[dir_key][1]) + let dict = s:config[dir_key][1] else let dict = {} let [lines, message, exec_error] = s:NullError([dir, 'config', '--list', '-z']) @@ -571,7 +573,7 @@ function! fugitive#Config(...) abort call add(dict[key], strpart(line, len(key) + 1)) endif endfor - let s:config[dir] = [s:ConfigTimestamps(dir, dict), dict] + let s:config[dir_key] = [s:ConfigTimestamps(dir, dict), dict] lockvar! dict endif return len(name) ? get(get(dict, name, []), 0, '') : dict @@ -1622,7 +1624,7 @@ endfunction function! s:CompleteRemote(A, L, P, ...) abort let dir = a:0 ? a:1 : s:Dir() - let remote = matchstr(a:L, '\u\w*[! ] *\zs\S\+\ze ') + let remote = matchstr(a:L, '\u\w*[! ] *.\{-\}\s\@<=\zs[^-[:space:]]\S*\ze ') if !empty(remote) let matches = s:LinesError([dir, 'ls-remote', remote])[0] call filter(matches, 'v:val =~# "\t" && v:val !~# "{"') @@ -1641,6 +1643,7 @@ function! s:ReplaceCmd(cmd) abort if exec_error call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) endif + setlocal noswapfile silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp) if &foldenable && foldlevel('$') > 0 set nofoldenable @@ -1938,6 +1941,10 @@ function! fugitive#BufReadStatus() abort if empty(s:Tree()) call s:AddHeader('Bare', 'yes') endif + if get(FugitiveConfigGetAll('advice.statusHints', config), 0, 'true') !~# '^\%(false\|no|off\|0\|\)$' + call s:AddHeader('Help', 'g?') + endif + call s:AddSection('Rebasing ' . rebasing_head, rebasing) call s:AddSection('Untracked', untracked) call s:AddSection('Unstaged', unstaged) @@ -2156,13 +2163,13 @@ function! fugitive#BufReadCmd(...) abort keepjumps 1 keepjumps call search('^parent ') if getline('.') ==# 'parent ' - silent keepjumps delete_ + silent lockmarks keepjumps delete_ else silent exe (exists(':keeppatterns') ? 'keeppatterns' : '') 'keepjumps s/\m\C\%(^parent\)\@\)\=$','W',line('.')+3) if lnum - silent keepjumps delete_ + silent lockmarks keepjumps delete_ end silent exe (exists(':keeppatterns') ? 'keeppatterns' : '') 'keepjumps 1,/^diff --git\|\%$/s/\r$//e' keepjumps 1 @@ -2639,14 +2646,15 @@ endfunction let s:aliases = {} function! s:Aliases(dir) abort - if !has_key(s:aliases, a:dir) - let s:aliases[a:dir] = {} + let dir_key = len(a:dir) ? a:dir : '_' + if !has_key(s:aliases, dir_key) + let s:aliases[dir_key] = {} let lines = s:NullError([a:dir, 'config', '-z', '--get-regexp', '^alias[.]'])[0] for line in lines - let s:aliases[a:dir][matchstr(line, '\.\zs.\{-}\ze\n')] = matchstr(line, '\n\zs.*') + let s:aliases[dir_key][matchstr(line, '\.\zs.\{-}\ze\n')] = matchstr(line, '\n\zs.*') endfor endif - return s:aliases[a:dir] + return s:aliases[dir_key] endfunction function! fugitive#Complete(lead, ...) abort @@ -3521,7 +3529,12 @@ function! s:StageApply(info, reverse, extra) abort let i = b:fugitive_expanded[info.section][info.filename][0] let head = [] while get(b:fugitive_diff[info.section], i, '@') !~# '^@' - call add(head, b:fugitive_diff[info.section][i]) + let line = b:fugitive_diff[info.section][i] + if line ==# '--- /dev/null' + call add(head, '--- ' . get(b:fugitive_diff[info.section], i + 1, '')[4:-1]) + elseif line !~# '^new file ' + call add(head, line) + endif let i += 1 endwhile call extend(lines, head, 'keep') @@ -3731,7 +3744,7 @@ function! s:DoUnstageStaged(record) abort endfunction function! s:DoToggleUnstaged(record) abort - if a:record.patch && a:record.status !=# 'A' + if a:record.patch return s:StageApply(a:record, 0, ['--cached']) else call s:TreeChomp(['add', '-A', '--'] + a:record.paths) @@ -4484,7 +4497,7 @@ function! s:OpenParse(args, wants_cmd) abort return [url, pre] endfunction -function! s:DiffClose() abort +function! fugitive#DiffClose() abort let mywinnr = winnr() for winnr in [winnr('#')] + range(winnr('$'),1,-1) if winnr != mywinnr && getwinvar(winnr,'&diff') @@ -4507,7 +4520,7 @@ function! s:BlurStatus() abort belowright new endif if &diff - call s:DiffClose() + call fugitive#DiffClose() endif endif endfunction @@ -4621,10 +4634,8 @@ endfunction " Section: :Gwrite, :Gwq function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abort - if exists('b:fugitive_commit_arguments') - return 'write|bdelete' - elseif expand('%:t') == 'COMMIT_EDITMSG' && $GIT_INDEX_FILE != '' - return 'wq' + if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) + return (empty($GIT_INDEX_FILE) ? 'write|bdelete' : 'wq') . (a:bang ? '!' : '') elseif get(b:, 'fugitive_type', '') ==# 'index' return 'Git commit' elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} ' @@ -4753,7 +4764,7 @@ endfunction function! fugitive#WqCommand(...) abort let bang = a:4 ? '!' : '' - if exists('b:fugitive_commit_arguments') + if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) return 'wq'.bang endif let result = call('fugitive#WriteCommand', a:000) @@ -4880,25 +4891,30 @@ function! s:diffthis() abort endfunction function! s:diffoff() abort - if exists('w:fugitive_diff_restore') + if exists('w:fugitive_diff_restore') && v:version < 704 execute w:fugitive_diff_restore - unlet w:fugitive_diff_restore - else - diffoff endif + unlet! w:fugitive_diff_restore + diffoff endfunction function! s:diffoff_all(dir) abort let curwin = winnr() for nr in range(1,winnr('$')) if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore')) - if nr != winnr() - execute nr.'wincmd w' + if v:version < 704 + if nr != winnr() + execute nr.'wincmd w' + endif + execute w:fugitive_diff_restore endif - call s:diffoff() + call setwinvar(nr, 'fugitive_diff_restore', '') endif endfor - execute curwin.'wincmd w' + if curwin != winnr() + execute curwin.'wincmd w' + endif + diffoff! endfunction function! s:CompareAge(mine, theirs) abort @@ -5180,7 +5196,7 @@ endfunction function! s:BlameCommitFileLnum(...) abort let line = a:0 ? a:1 : getline('.') let state = a:0 ? a:2 : s:TempState() - let commit = matchstr(line, '^\^\=\zs\x\+') + let commit = matchstr(line, '^\^\=[?*]*\zs\x\+') if commit =~# '^0\+$' let commit = '' elseif has_key(state, 'blame_reverse_end') @@ -5548,6 +5564,7 @@ let s:hash_colors = {} function! fugitive#BlameSyntax() abort let conceal = has('conceal') ? ' conceal' : '' let flags = get(s:TempState(), 'blame_flags', []) + syn spell notoplevel syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite syn match FugitiveblameHash "\%(^\^\=[?*]*\)\@<=\<\x\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite @@ -5558,7 +5575,7 @@ function! fugitive#BlameSyntax() abort endif syn match FugitiveblameScoreDebug " *\d\+\s\+\d\+\s\@=" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile contained skipwhite syn region FugitiveblameAnnotation matchgroup=FugitiveblameDelimiter start="(" end="\%(\s\d\+\)\@<=)" contained keepend oneline - syn match FugitiveblameTime "[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%(\s\+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation + syn match FugitiveblameTime "\<[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%(\s\+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation exec 'syn match FugitiveblameLineNumber "\s*\d\+)\@=" contained containedin=FugitiveblameAnnotation' conceal exec 'syn match FugitiveblameOriginalFile "\s\%(\f\+\D\@<=\|\D\@=\f\+\)\%(\%(\s\+\d\+\)\=\s\%((\|\s*\d\+)\)\)\@=" contained nextgroup=FugitiveblameOriginalLineNumber,FugitiveblameAnnotation skipwhite' (s:HasOpt(flags, '--show-name', '-f') ? '' : conceal) exec 'syn match FugitiveblameOriginalLineNumber "\s*\d\+\%(\s(\)\@=" contained nextgroup=FugitiveblameAnnotation skipwhite' (s:HasOpt(flags, '--show-number', '-n') ? '' : conceal) @@ -5955,11 +5972,11 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'gO', ':0,4' . blame_map, '') call s:Map('n', 'O', ':0,5' . blame_map, '') - call s:Map('n', 'D', ":call DiffClose()Gdiffsplit!redrawechohl WarningMsg echo ':Gstatus D is deprecated in favor of dd'echohl NONE", '') - call s:Map('n', 'dd', ":call DiffClose()Gdiffsplit!", '') - call s:Map('n', 'dh', ":call DiffClose()Ghdiffsplit!", '') - call s:Map('n', 'ds', ":call DiffClose()Ghdiffsplit!", '') - call s:Map('n', 'dv', ":call DiffClose()Gvdiffsplit!", '') + call s:Map('n', 'D', ":call fugitive#DiffClose()Gdiffsplit!redrawechohl WarningMsg echo ':Gstatus D is deprecated in favor of dd'echohl NONE", '') + call s:Map('n', 'dd', ":call fugitive#DiffClose()Gdiffsplit!", '') + call s:Map('n', 'dh', ":call fugitive#DiffClose()Ghdiffsplit!", '') + call s:Map('n', 'ds', ":call fugitive#DiffClose()Ghdiffsplit!", '') + call s:Map('n', 'dv', ":call fugitive#DiffClose()Gvdiffsplit!", '') call s:Map('n', 'd?', ":help fugitive_d", '') else @@ -5996,7 +6013,7 @@ function! fugitive#MapJumps(...) abort call s:Map('nxo', '#', 'PatchSearchExpr(1)', '') endif call s:Map('n', 'S', ':echoerr "Use gO"', '') - call s:Map('n', 'dq', ":call DiffClose()", '') + call s:Map('n', 'dq', ":call fugitive#DiffClose()", '') call s:Map('n', '-', ":exe 'Gedit ' . fnameescape(NavigateUp(v:count1)) if getline(1) =~# '^tree \x\{40,\}$' && empty(getline(2))call search('^'.escape(expand('#:t'),'.*[]~\').'/\=$','wc')endif", '') call s:Map('n', 'P', ":exe 'Gedit ' . fnameescape(ContainingCommit().'^'.v:count1.Relative(':'))", '') call s:Map('n', '~', ":exe 'Gedit ' . fnameescape(ContainingCommit().'~'.v:count1.Relative(':'))", '') diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index e950a310..3448c672 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -100,6 +100,9 @@ that are part of Git repositories). |quickfix| list. Jumps to the first commit unless [!] is given. + The quickfix list can be slow and awkward for many use + cases. Consider using |:Git| log instead. + :{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given range of the current file into the |quickfix| list. The cursor is positioned on the first line of the diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 2b9e4d90..edb81e5e 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -420,7 +420,9 @@ let s:addr_other = has('patch-8.1.560') ? '-addr=other' : '' let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : '' let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : '' -command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", ) +if exists(':G') != 2 + command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", ) +endif command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", ) if exists(':Gstatus') !=# 2 diff --git a/sources_non_forked/vim-gist/autoload/gist.vim b/sources_non_forked/vim-gist/autoload/gist.vim index 7f803c6c..bfe84a0c 100644 --- a/sources_non_forked/vim-gist/autoload/gist.vim +++ b/sources_non_forked/vim-gist/autoload/gist.vim @@ -134,7 +134,7 @@ function! s:truncate(str, num) let str = substitute(str, mx_first, '\2', '') endwhile while width + 1 <= a:num - let ret .= " " + let ret .= ' ' let width = width + 1 endwhile return ret @@ -160,7 +160,7 @@ function! s:format_gist(gist) abort let desc = substitute(desc, ' ', ' ', 'g') " Display a nice formatted (and truncated if needed) table of gists on screen " Calculate field lengths for gist-listing formatting on screen - redir =>a |exe "sil sign place buffer=".bufnr('')|redir end + redir =>a |exe 'sil sign place buffer='.bufnr('')|redir end let signlist = split(a, '\n') let width = winwidth(0) - ((&number||&relativenumber) ? &numberwidth : 0) - &foldcolumn - (len(signlist) > 2 ? 2 : 0) let idlen = 33 @@ -214,7 +214,7 @@ function! s:GistList(gistls, page) abort echohl ErrorMsg | echomsg v:errmsg | echohl None return endif - let res = webapi#http#get(url, '', { "Authorization": auth }) + let res = webapi#http#get(url, '', { 'Authorization': auth }) if v:shell_error != 0 bw! redraw @@ -330,7 +330,7 @@ function! gist#list(user, ...) abort if len(auth) == 0 return [] endif - let res = webapi#http#get(url, '', { "Authorization": auth }) + let res = webapi#http#get(url, '', { 'Authorization': auth }) return webapi#json#decode(res.content) endfunction @@ -339,7 +339,7 @@ function! s:GistGetFileName(gistid) abort if len(auth) == 0 return '' endif - let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { 'Authorization': auth }) let gist = webapi#json#decode(res.content) if has_key(gist, 'files') return sort(keys(gist.files))[0] @@ -352,7 +352,7 @@ function! s:GistDetectFiletype(gistid) abort if len(auth) == 0 return '' endif - let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { 'Authorization': auth }) let gist = webapi#json#decode(res.content) let filename = sort(keys(gist.files))[0] let ext = fnamemodify(filename, ':e') @@ -380,7 +380,7 @@ endfunction function! s:GistGet(gistid, clipboard) abort redraw | echon 'Getting gist... ' - let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": s:GistGetAuthHeader() }) + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { 'Authorization': s:GistGetAuthHeader() }) if res.status =~# '^2' try let gist = webapi#json#decode(res.content) @@ -459,10 +459,10 @@ function! s:GistGet(gistid, clipboard) abort let content = gist.files[filename].content call setline(1, split(content, "\n")) let b:gist = { - \ "filename": filename, - \ "id": gist.id, - \ "description": gist.description, - \ "private": gist.public =~ 'true', + \ 'filename': filename, + \ 'id': gist.id, + \ 'description': gist.description, + \ 'private': gist.public =~# 'true', \} catch let &undolevels = old_undolevels @@ -533,10 +533,10 @@ function! s:GistListAction(mode) abort endfunction function! s:GistUpdate(content, gistid, gistnm, desc) abort - let gist = { "id": a:gistid, "files" : {}, "description": "","public": function('webapi#json#true') } + let gist = { 'id': a:gistid, 'files' : {}, 'description': '','public': function('webapi#json#true') } if exists('b:gist') if has_key(b:gist, 'filename') && len(a:gistnm) > 0 - let gist.files[b:gist.filename] = { "content": '', "filename": b:gist.filename } + let gist.files[b:gist.filename] = { 'content': '', 'filename': b:gist.filename } let b:gist.filename = a:gistnm endif if has_key(b:gist, 'private') && b:gist.private | let gist['public'] = function('webapi#json#false') | endif @@ -560,25 +560,25 @@ function! s:GistUpdate(content, gistid, gistnm, desc) abort if a:desc !=# ' ' let gist['description'] = a:desc else - let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { "Authorization": auth }) + let res = webapi#http#get(g:gist_api_url.'gists/'.a:gistid, '', { 'Authorization': auth }) if res.status =~# '^2' let old_gist = webapi#json#decode(res.content) let gist['description'] = old_gist.description endif endif - let gist.files[filename] = { "content": a:content, "filename": filename } + let gist.files[filename] = { 'content': a:content, 'filename': filename } redraw | echon 'Updating gist... ' let res = webapi#http#post(g:gist_api_url.'gists/' . a:gistid, \ webapi#json#encode(gist), { - \ "Authorization": auth, - \ "Content-Type": "application/json", + \ 'Authorization': auth, + \ 'Content-Type': 'application/json', \}) if res.status =~# '^2' let obj = webapi#json#decode(res.content) let loc = obj['html_url'] - let b:gist = {"id": a:gistid, "filename": filename} + let b:gist = {'id': a:gistid, 'filename': filename} setlocal nomodified redraw | echomsg 'Done: '.loc else @@ -598,8 +598,8 @@ function! s:GistDelete(gistid) abort redraw | echon 'Deleting gist... ' let res = webapi#http#post(g:gist_api_url.'gists/'.a:gistid, '', { - \ "Authorization": auth, - \ "Content-Type": "application/json", + \ 'Authorization': auth, + \ 'Content-Type': 'application/json', \}, 'DELETE') if res.status =~# '^2' if exists('b:gist') @@ -651,13 +651,13 @@ endfunction " GistID: 123123 " function! s:GistPost(content, private, desc, anonymous) abort - let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + let gist = { 'files' : {}, 'description': '','public': function('webapi#json#true') } if a:desc !=# ' ' | let gist['description'] = a:desc | endif if a:private | let gist['public'] = function('webapi#json#false') | endif let filename = s:get_current_filename(1) - let gist.files[filename] = { "content": a:content, "filename": filename } + let gist.files[filename] = { 'content': a:content, 'filename': filename } - let header = {"Content-Type": "application/json"} + let header = {'Content-Type': 'application/json'} if !a:anonymous let auth = s:GistGetAuthHeader() if len(auth) == 0 @@ -674,10 +674,10 @@ function! s:GistPost(content, private, desc, anonymous) abort let obj = webapi#json#decode(res.content) let loc = obj['html_url'] let b:gist = { - \ "filename": filename, - \ "id": matchstr(loc, '[^/]\+$'), - \ "description": gist['description'], - \ "private": a:private, + \ 'filename': filename, + \ 'id': matchstr(loc, '[^/]\+$'), + \ 'description': gist['description'], + \ 'private': a:private, \} if s:update_GistID(b:gist['id']) Gist -e @@ -695,7 +695,7 @@ function! s:GistPostBuffers(private, desc, anonymous) abort let bn = bufnr('%') let query = [] - let gist = { "files" : {}, "description": "","public": function('webapi#json#true') } + let gist = { 'files' : {}, 'description': '','public': function('webapi#json#true') } if a:desc !=# ' ' | let gist['description'] = a:desc | endif if a:private | let gist['public'] = function('webapi#json#false') | endif @@ -708,12 +708,12 @@ function! s:GistPostBuffers(private, desc, anonymous) abort silent! exec 'buffer!' bufnr let content = join(getline(1, line('$')), "\n") let filename = s:get_current_filename(index) - let gist.files[filename] = { "content": content, "filename": filename } + let gist.files[filename] = { 'content': content, 'filename': filename } let index = index + 1 endfor silent! exec 'buffer!' bn - let header = {"Content-Type": "application/json"} + let header = {'Content-Type': 'application/json'} if !a:anonymous let auth = s:GistGetAuthHeader() if len(auth) == 0 @@ -730,10 +730,10 @@ function! s:GistPostBuffers(private, desc, anonymous) abort let obj = webapi#json#decode(res.content) let loc = obj['html_url'] let b:gist = { - \ "filename": filename, - \ "id": matchstr(loc, '[^/]\+$'), - \ "description": gist['description'], - \ "private": a:private, + \ 'filename': filename, + \ 'id': matchstr(loc, '[^/]\+$'), + \ 'description': gist['description'], + \ 'private': a:private, \} if s:update_GistID(b:gist['id']) Gist -e @@ -828,7 +828,7 @@ function! gist#Gist(count, bang, line1, line2, ...) abort echohl ErrorMsg | echomsg v:errmsg | echohl None else let gistid = gistidbuf - let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'PUT') + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { 'Authorization': auth }, 'PUT') if res.status =~# '^2' echomsg 'Starred' gistid else @@ -842,7 +842,7 @@ function! gist#Gist(count, bang, line1, line2, ...) abort echohl ErrorMsg | echomsg v:errmsg | echohl None else let gistid = gistidbuf - let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { "Authorization": auth }, 'DELETE') + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/star', '', { 'Authorization': auth }, 'DELETE') if res.status =~# '^2' echomsg 'Unstarred' gistid else @@ -857,7 +857,7 @@ function! gist#Gist(count, bang, line1, line2, ...) abort return else let gistid = gistidbuf - let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/fork', '', { "Authorization": auth }) + let res = webapi#http#post(g:gist_api_url.'gists/'.gistid.'/fork', '', { 'Authorization': auth }) if res.status =~# '^2' let obj = webapi#json#decode(res.content) let gistid = obj['id'] @@ -986,12 +986,12 @@ function! s:GistGetAuthHeader() abort let note_url = 'http://www.vim.org/scripts/script.php?script_id=2423' let insecureSecret = printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password)) let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ - \ "scopes" : ["gist"], - \ "note" : note, - \ "note_url" : note_url, + \ 'scopes' : ['gist'], + \ 'note' : note, + \ 'note_url' : note_url, \}), { - \ "Content-Type" : "application/json", - \ "Authorization" : insecureSecret, + \ 'Content-Type' : 'application/json', + \ 'Authorization' : insecureSecret, \}) let h = filter(res.header, 'stridx(v:val, "X-GitHub-OTP:") == 0') if len(h) @@ -1001,13 +1001,13 @@ function! s:GistGetAuthHeader() abort return '' endif let res = webapi#http#post(g:gist_api_url.'authorizations', webapi#json#encode({ - \ "scopes" : ["gist"], - \ "note" : note, - \ "note_url" : note_url, + \ 'scopes' : ['gist'], + \ 'note' : note, + \ 'note_url' : note_url, \}), { - \ "Content-Type" : "application/json", - \ "Authorization" : insecureSecret, - \ "X-GitHub-OTP" : otp, + \ 'Content-Type' : 'application/json', + \ 'Authorization' : insecureSecret, + \ 'X-GitHub-OTP' : otp, \}) endif let authorization = webapi#json#decode(res.content) @@ -1025,138 +1025,138 @@ function! s:GistGetAuthHeader() abort endfunction let s:extmap = extend({ -\".adb": "ada", -\".ahk": "ahk", -\".arc": "arc", -\".as": "actionscript", -\".asm": "asm", -\".asp": "asp", -\".aw": "php", -\".b": "b", -\".bat": "bat", -\".befunge": "befunge", -\".bmx": "bmx", -\".boo": "boo", -\".c-objdump": "c-objdump", -\".c": "c", -\".cfg": "cfg", -\".cfm": "cfm", -\".ck": "ck", -\".cl": "cl", -\".clj": "clj", -\".cmake": "cmake", -\".coffee": "coffee", -\".cpp": "cpp", -\".cppobjdump": "cppobjdump", -\".cs": "csharp", -\".css": "css", -\".cw": "cw", -\".d-objdump": "d-objdump", -\".d": "d", -\".darcspatch": "darcspatch", -\".diff": "diff", -\".duby": "duby", -\".dylan": "dylan", -\".e": "e", -\".ebuild": "ebuild", -\".eclass": "eclass", -\".el": "lisp", -\".erb": "erb", -\".erl": "erlang", -\".f90": "f90", -\".factor": "factor", -\".feature": "feature", -\".fs": "fs", -\".fy": "fy", -\".go": "go", -\".groovy": "groovy", -\".gs": "gs", -\".gsp": "gsp", -\".haml": "haml", -\".hs": "haskell", -\".html": "html", -\".hx": "hx", -\".ik": "ik", -\".ino": "ino", -\".io": "io", -\".j": "j", -\".java": "java", -\".js": "javascript", -\".json": "json", -\".jsp": "jsp", -\".kid": "kid", -\".lhs": "lhs", -\".lisp": "lisp", -\".ll": "ll", -\".lua": "lua", -\".ly": "ly", -\".m": "objc", -\".mak": "mak", -\".man": "man", -\".mao": "mao", -\".matlab": "matlab", -\".md": "markdown", -\".minid": "minid", -\".ml": "ml", -\".moo": "moo", -\".mu": "mu", -\".mustache": "mustache", -\".mxt": "mxt", -\".myt": "myt", -\".n": "n", -\".nim": "nim", -\".nu": "nu", -\".numpy": "numpy", -\".objdump": "objdump", -\".ooc": "ooc", -\".parrot": "parrot", -\".pas": "pas", -\".pasm": "pasm", -\".pd": "pd", -\".phtml": "phtml", -\".pir": "pir", -\".pl": "perl", -\".po": "po", -\".py": "python", -\".pytb": "pytb", -\".pyx": "pyx", -\".r": "r", -\".raw": "raw", -\".rb": "ruby", -\".rhtml": "rhtml", -\".rkt": "rkt", -\".rs": "rs", -\".rst": "rst", -\".s": "s", -\".sass": "sass", -\".sc": "sc", -\".scala": "scala", -\".scm": "scheme", -\".scpt": "scpt", -\".scss": "scss", -\".self": "self", -\".sh": "sh", -\".sml": "sml", -\".sql": "sql", -\".st": "smalltalk", -\".swift": "swift", -\".tcl": "tcl", -\".tcsh": "tcsh", -\".tex": "tex", -\".textile": "textile", -\".tpl": "smarty", -\".twig": "twig", -\".txt" : "text", -\".v": "verilog", -\".vala": "vala", -\".vb": "vbnet", -\".vhd": "vhdl", -\".vim": "vim", -\".weechatlog": "weechatlog", -\".xml": "xml", -\".xq": "xquery", -\".xs": "xs", -\".yml": "yaml", +\'.adb': 'ada', +\'.ahk': 'ahk', +\'.arc': 'arc', +\'.as': 'actionscript', +\'.asm': 'asm', +\'.asp': 'asp', +\'.aw': 'php', +\'.b': 'b', +\'.bat': 'bat', +\'.befunge': 'befunge', +\'.bmx': 'bmx', +\'.boo': 'boo', +\'.c-objdump': 'c-objdump', +\'.c': 'c', +\'.cfg': 'cfg', +\'.cfm': 'cfm', +\'.ck': 'ck', +\'.cl': 'cl', +\'.clj': 'clj', +\'.cmake': 'cmake', +\'.coffee': 'coffee', +\'.cpp': 'cpp', +\'.cppobjdump': 'cppobjdump', +\'.cs': 'csharp', +\'.css': 'css', +\'.cw': 'cw', +\'.d-objdump': 'd-objdump', +\'.d': 'd', +\'.darcspatch': 'darcspatch', +\'.diff': 'diff', +\'.duby': 'duby', +\'.dylan': 'dylan', +\'.e': 'e', +\'.ebuild': 'ebuild', +\'.eclass': 'eclass', +\'.el': 'lisp', +\'.erb': 'erb', +\'.erl': 'erlang', +\'.f90': 'f90', +\'.factor': 'factor', +\'.feature': 'feature', +\'.fs': 'fs', +\'.fy': 'fy', +\'.go': 'go', +\'.groovy': 'groovy', +\'.gs': 'gs', +\'.gsp': 'gsp', +\'.haml': 'haml', +\'.hs': 'haskell', +\'.html': 'html', +\'.hx': 'hx', +\'.ik': 'ik', +\'.ino': 'ino', +\'.io': 'io', +\'.j': 'j', +\'.java': 'java', +\'.js': 'javascript', +\'.json': 'json', +\'.jsp': 'jsp', +\'.kid': 'kid', +\'.lhs': 'lhs', +\'.lisp': 'lisp', +\'.ll': 'll', +\'.lua': 'lua', +\'.ly': 'ly', +\'.m': 'objc', +\'.mak': 'mak', +\'.man': 'man', +\'.mao': 'mao', +\'.matlab': 'matlab', +\'.md': 'markdown', +\'.minid': 'minid', +\'.ml': 'ml', +\'.moo': 'moo', +\'.mu': 'mu', +\'.mustache': 'mustache', +\'.mxt': 'mxt', +\'.myt': 'myt', +\'.n': 'n', +\'.nim': 'nim', +\'.nu': 'nu', +\'.numpy': 'numpy', +\'.objdump': 'objdump', +\'.ooc': 'ooc', +\'.parrot': 'parrot', +\'.pas': 'pas', +\'.pasm': 'pasm', +\'.pd': 'pd', +\'.phtml': 'phtml', +\'.pir': 'pir', +\'.pl': 'perl', +\'.po': 'po', +\'.py': 'python', +\'.pytb': 'pytb', +\'.pyx': 'pyx', +\'.r': 'r', +\'.raw': 'raw', +\'.rb': 'ruby', +\'.rhtml': 'rhtml', +\'.rkt': 'rkt', +\'.rs': 'rs', +\'.rst': 'rst', +\'.s': 's', +\'.sass': 'sass', +\'.sc': 'sc', +\'.scala': 'scala', +\'.scm': 'scheme', +\'.scpt': 'scpt', +\'.scss': 'scss', +\'.self': 'self', +\'.sh': 'sh', +\'.sml': 'sml', +\'.sql': 'sql', +\'.st': 'smalltalk', +\'.swift': 'swift', +\'.tcl': 'tcl', +\'.tcsh': 'tcsh', +\'.tex': 'tex', +\'.textile': 'textile', +\'.tpl': 'smarty', +\'.twig': 'twig', +\'.txt' : 'text', +\'.v': 'verilog', +\'.vala': 'vala', +\'.vb': 'vbnet', +\'.vhd': 'vhdl', +\'.vim': 'vim', +\'.weechatlog': 'weechatlog', +\'.xml': 'xml', +\'.xq': 'xquery', +\'.xs': 'xs', +\'.yml': 'yaml', \}, get(g:, 'gist_extmap', {})) let &cpo = s:save_cpo diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 350cebe6..2a1c9fb9 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -162,7 +162,17 @@ nmap ]h (GitGutterNextHunk) nmap [h (GitGutterPrevHunk) ``` -You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. If the option `g:gitgutter_use_location_list` is set, this command will load hunks into the current window's location list instead. +When you jump between hunks, a message like `Hunk 4 of 11` is shown on the command line. If you want to turn the message off, you can use: + +```viml +let g:gitgutter_show_msg_on_hunk_jumping = 0 +``` + +You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. If the option `g:gitgutter_use_location_list` is set, this command will load hunks into the current window's location list instead. Use `:copen` (or `:lopen`) to open the quickfix / location list or add a custom command like this: + +```viml +command! Gqf GitGutterQuickFix | copen +``` You can stage or undo an individual hunk when your cursor is in it: @@ -339,6 +349,7 @@ let g:gitgutter_sign_added = 'xx' let g:gitgutter_sign_modified = 'yy' let g:gitgutter_sign_removed = 'zz' let g:gitgutter_sign_removed_first_line = '^^' +let g:gitgutter_sign_removed_above_and_below = '{' let g:gitgutter_sign_modified_removed = 'ww' ``` @@ -648,7 +659,10 @@ Here are some things you can check: * Verify `:echo system("git --version")` succeeds. * Verify your git config is compatible with the version of git returned by the command above. * Verify your Vim supports signs (`:echo has('signs')` should give `1`). -* Verify your file is being tracked by git and has unstaged changes. +* Verify your file is being tracked by git and has unstaged changes. Check whether the plugin thinks git knows about your file: `:echo b:gitgutter.path` should show the path to the file in the repo. +* Execute `:sign place group=gitgutter`; you should see a list of signs. + - If the signs are listed: this is a colorscheme / highlight problem. Compare `:highlight GitGutterAdd` with `:highlight SignColumn`. + - If no signs are listed: the call to git-diff is probably failing. Add `let g:gitgutter_log=1` to your vimrc, restart, reproduce the problem, and look at the `gitgutter.log` file in the plugin's directory. #### When the whole file is marked as added diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim index d56a8d9b..c8f9e21e 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter.vim @@ -180,9 +180,17 @@ endfunction " - it ignores unsaved changes in buffers " - it does not change to the repo root function! gitgutter#quickfix() + let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' rev-parse --show-cdup' + let path_to_repo = get(systemlist(cmd), 0, '') + if !empty(path_to_repo) && path_to_repo[-1:] != '/' + let path_to_repo .= '/' + endif + let locations = [] - let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager '.g:gitgutter_git_args. - \ ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args. ' '. g:gitgutter_diff_base + let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager'. + \ ' diff --no-ext-diff --no-color -U0'. + \ ' --src-prefix=a/'.path_to_repo.' --dst-prefix=b/'.path_to_repo.' '. + \ g:gitgutter_diff_args. ' '. g:gitgutter_diff_base let diff = systemlist(cmd) let lnum = 0 for line in diff diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim index 1cc2b167..d4767482 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/async.vim @@ -6,6 +6,8 @@ let s:available = has('nvim') || ( \ ) \ ) +let s:jobs = {} + function! gitgutter#async#available() return s:available endfunction @@ -28,11 +30,12 @@ function! gitgutter#async#execute(cmd, bufnr, handler) abort \ 'on_exit': function('s:on_exit_nvim') \ })) else - call job_start(command, { + let job = job_start(command, { \ 'out_cb': function('s:on_stdout_vim', options), \ 'err_cb': function('s:on_stderr_vim', options), \ 'close_cb': function('s:on_exit_vim', options) \ }) + let s:jobs[s:job_id(job)] = 1 endif endfunction @@ -83,6 +86,8 @@ endfunction function! s:on_exit_vim(channel) dict abort let job = ch_getjob(a:channel) + let jobid = s:job_id(job) + if has_key(s:jobs, jobid) | unlet s:jobs[jobid] | endif while 1 if job_status(job) == 'dead' let exit_code = job_info(job).exitval @@ -95,3 +100,8 @@ function! s:on_exit_vim(channel) dict abort call self.handler.out(self.buffer, join(self.stdoutbuffer, "\n")) endif endfunction + +function! s:job_id(job) + " Vim + return job_info(a:job).process +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim index 79d197ec..def5b806 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/debug.vim @@ -22,16 +22,6 @@ function! gitgutter#debug#debug() call s:separator() call s:option('updatetime') - call s:option('shell') - call s:option('shellcmdflag') - call s:option('shellpipe') - call s:option('shellquote') - call s:option('shellredir') - call s:option('shellslash') - call s:option('shelltemp') - call s:option('shelltype') - call s:option('shellxescape') - call s:option('shellxquote') endfunction @@ -52,10 +42,10 @@ function! s:git_version() endfunction function! s:grep_version() - let v = system('grep --version') + let v = system(g:gitgutter_grep.' --version') call s:output( substitute(v, '\n$', '', '') ) - let v = system('grep --help') + let v = system(g:gitgutter_grep.' --help') call s:output( substitute(v, '\%x00', '', 'g') ) endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 55670092..d88f8f0d 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -12,6 +12,8 @@ endfunction let s:c_flag = s:git_supports_command_line_config_override() +let s:temp_from = tempname() +let s:temp_buffer = tempname() let s:counter = 0 " Returns a diff of the buffer against the index or the working tree. @@ -75,9 +77,6 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort throw 'gitgutter not tracked' endif - let temp_from = tempname() - let temp_buffer = tempname() - " Wrap compound commands in parentheses to make Windows happy. " bash doesn't mind the parentheses. let cmd = '(' @@ -90,7 +89,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " second gitgutter#process_buffer() writing the file (synchronously, below) " and the first gitgutter#process_buffer()'s async job reading it (with " git-diff). - let buff_file = temp_buffer.'.'.a:bufnr + 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. @@ -110,7 +109,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort " Without the buffer number, from_file would have a race in the shell " between the second process writing it (with git-show) and the first " reading it (with git-diff). - let from_file = temp_from.'.'.a:bufnr + 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 @@ -128,7 +127,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort endif " Call git-diff. - let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager '.g:gitgutter_git_args + let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager' if s:c_flag let cmd .= ' -c "diff.autorefreshindex=0"' let cmd .= ' -c "diff.noprefix=false"' @@ -400,7 +399,16 @@ function! s:write_buffer(bufnr, file) let bufcontents[0]=''.bufcontents[0] endif - call writefile(bufcontents, a:file, 'b') + " The file we are writing to is a temporary file. Sometimes the parent + " directory is deleted outside Vim but, because Vim caches the directory + " name at startup and does not check for its existence subsequently, Vim + " does not realise. This causes E482 errors. + try + call writefile(bufcontents, a:file, 'b') + catch /E482/ + call mkdir(fnamemodify(a:file, ':h'), '', '0700') + call writefile(bufcontents, a:file, 'b') + endtry endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim index 1439b721..68234238 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/highlight.vim @@ -77,7 +77,7 @@ function! gitgutter#highlight#define_highlights() abort " When they are visible. for type in ["Add", "Change", "Delete"] - if hlexists("GitGutter".type) + if hlexists("GitGutter".type) && s:get_foreground_colors("GitGutter".type) != ['NONE', 'NONE'] if g:gitgutter_set_sign_backgrounds execute "highlight GitGutter".type." guibg=".guibg." ctermbg=".ctermbg endif diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim index f80e93a5..9d18d928 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -46,39 +46,57 @@ endfunction function! gitgutter#hunk#next_hunk(count) abort let bufnr = bufnr('') - if gitgutter#utility#is_active(bufnr) - let current_line = line('.') - let hunk_count = 0 - for hunk in gitgutter#hunk#hunks(bufnr) - if hunk[2] > current_line - let hunk_count += 1 - if hunk_count == a:count - execute 'normal!' hunk[2] . 'Gzv' - return - endif - endif - endfor - call gitgutter#utility#warn('No more hunks') + if !gitgutter#utility#is_active(bufnr) | return | endif + + let hunks = gitgutter#hunk#hunks(bufnr) + if empty(hunks) + call gitgutter#utility#warn('No hunks in file') + return endif + + let current_line = line('.') + let hunk_count = 0 + for hunk in hunks + if hunk[2] > current_line + let hunk_count += 1 + if hunk_count == a:count + execute 'normal!' hunk[2] . 'Gzv' + if g:gitgutter_show_msg_on_hunk_jumping + redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) + endif + return + endif + endif + endfor + call gitgutter#utility#warn('No more hunks') endfunction function! gitgutter#hunk#prev_hunk(count) abort let bufnr = bufnr('') - if gitgutter#utility#is_active(bufnr) - let current_line = line('.') - let hunk_count = 0 - for hunk in reverse(copy(gitgutter#hunk#hunks(bufnr))) - if hunk[2] < current_line - let hunk_count += 1 - if hunk_count == a:count - let target = hunk[2] == 0 ? 1 : hunk[2] - execute 'normal!' target . 'Gzv' - return - endif - endif - endfor - call gitgutter#utility#warn('No previous hunks') + if !gitgutter#utility#is_active(bufnr) | return | endif + + let hunks = gitgutter#hunk#hunks(bufnr) + if empty(hunks) + call gitgutter#utility#warn('No hunks in file') + return endif + + let current_line = line('.') + let hunk_count = 0 + for hunk in reverse(copy(hunks)) + if hunk[2] < current_line + let hunk_count += 1 + if hunk_count == a:count + let target = hunk[2] == 0 ? 1 : hunk[2] + execute 'normal!' target . 'Gzv' + if g:gitgutter_show_msg_on_hunk_jumping + redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) + endif + return + endif + endif + endfor + call gitgutter#utility#warn('No previous hunks') endfunction " Returns the hunk the cursor is currently in or an empty list if the cursor @@ -455,6 +473,9 @@ function! s:open_hunk_preview_window() setlocal filetype=diff buftype=acwrite bufhidden=delete " Reset some defaults in case someone else has changed them. setlocal noreadonly modifiable noswapfile + if g:gitgutter_close_preview_on_escape + nnoremap :pclose + endif endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 2d744a8e..06b0be91 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -146,7 +146,13 @@ Commands for jumping between hunks:~ :GitGutterQuickFix Load all hunks into the |quickfix| list. Note this ignores any unsaved changes in your buffers. The |g:gitgutter_use_location_list| option can be set to - populate the location list of the current window instead + populate the location list of the current window + instead. Use |:copen| (or |:lopen|) to open a buffer + containing the search results in linked form; or add a + custom command like this: +> + command! Gqf GitGutterQuickFix | copen +< Commands for operating on a hunk:~ @@ -308,9 +314,14 @@ Signs:~ |g:gitgutter_sign_modified_removed| |g:gitgutter_set_sign_backgrounds| +Hunk jumping:~ + + |g:gitgutter_show_msg_on_hunk_jumping| + Hunk previews:~ |g:gitgutter_preview_win_floating| + |g:gitgutter_close_preview_on_escape| Terminal:~ @@ -438,6 +449,7 @@ will not preserve non-gitgutter signs. *g:gitgutter_sign_modified* *g:gitgutter_sign_removed* *g:gitgutter_sign_removed_first_line* + *g:gitgutter_sign_removed_above_and_below* *g:gitgutter_sign_modified_removed* Defaults: > @@ -445,6 +457,7 @@ Defaults: let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '_' let g:gitgutter_sign_removed_first_line = '‾' + let g:gitgutter_sign_removed_above_and_below = '_¯' let g:gitgutter_sign_modified_removed = '~_' < You can use unicode characters but not images. Signs must not take up more than @@ -468,6 +481,11 @@ Whether to use floating/popup windows for hunk previews. Note that if you use popup windows on Vim you will not be able to stage partial hunks via the preview window. + *g:gitgutter_close_preview_on_escape* +Default: 0 + +Whether pressing in a non-floating preview window closes it. + *g:gitgutter_terminal_reports_focus* Default: 1 @@ -516,6 +534,11 @@ Default: 0 When switched on, the :GitGutterQuickFix command populates the location list of the current window instead of the global quickfix list. + *g:gitgutter_show_msg_on_hunk_jumping* +Default: 1 + +When switched on, a message like "Hunk 4 of 11" is shown on hunk jumping. + =============================================================================== HIGHLIGHTS *gitgutter-highlights* @@ -631,6 +654,22 @@ When no signs are showing at all:~ < If the result is -2, the plugin thinks your file is not tracked by git. +6. Check whether the signs have been placed: +> + :sign place group=gitgutter +< + If you see a list of signs, this is a colorscheme / highlight problem. + Compare these two highlight values: +> + :highlight GitGutterAdd + :highlight SignColumn +< + If no signs are listed, the call to git-diff is probably failing. Turn on + logging by adding the following to your vimrc, restart, reproduce the problem, + and examing the gitgutter.log file in the plugin's directory. +> + let g:gitgutter_log = 1 +< When the whole file is marked as added:~ diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index 1b624037..5214adf8 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -12,15 +12,7 @@ if v:version < 703 || (v:version == 703 && !has("patch105")) finish endif -function! s:set(var, default) abort - if !exists(a:var) - if type(a:default) - execute 'let' a:var '=' string(a:default) - else - execute 'let' a:var '=' a:default - endif - endif -endfunction +let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '' : '' function! s:obsolete(var) if exists(a:var) @@ -29,52 +21,54 @@ function! s:obsolete(var) endfunction -call s:set('g:gitgutter_preview_win_location', 'bo') +let g:gitgutter_preview_win_location = get(g:, 'gitgutter_preview_win_location', 'bo') if exists('*nvim_open_win') - call s:set('g:gitgutter_preview_win_floating', 1) + let g:gitgutter_preview_win_floating = get(g:, 'gitgutter_preview_win_floating', 1) else - call s:set('g:gitgutter_preview_win_floating', 0) + let g:gitgutter_preview_win_floating = get(g:, 'gitgutter_preview_win_floating', 0) endif -call s:set('g:gitgutter_enabled', 1) +let g:gitgutter_enabled = get(g:, 'gitgutter_enabled', 1) if exists('*sign_unplace') - call s:set('g:gitgutter_max_signs', -1) + let g:gitgutter_max_signs = get(g:, 'gitgutter_max_signs', -1) else - call s:set('g:gitgutter_max_signs', 500) + let g:gitgutter_max_signs = get(g:, 'gitgutter_max_signs', 500) endif -call s:set('g:gitgutter_signs', 1) -call s:set('g:gitgutter_highlight_lines', 0) -call s:set('g:gitgutter_highlight_linenrs', 0) -call s:set('g:gitgutter_sign_priority', 10) +let g:gitgutter_signs = get(g:, 'gitgutter_signs', 1) +let g:gitgutter_highlight_lines = get(g:, 'gitgutter_highlight_lines', 0) +let g:gitgutter_highlight_linenrs = get(g:, 'gitgutter_highlight_linenrs', 0) +let g:gitgutter_sign_priority = get(g:, 'gitgutter_sign_priority', 10) " Nvim 0.4.0 has an expanding sign column " The sign_place() function supports sign priority. if (has('nvim-0.4.0') || exists('*sign_place')) && !exists('g:gitgutter_sign_allow_clobber') let g:gitgutter_sign_allow_clobber = 1 endif -call s:set('g:gitgutter_sign_allow_clobber', 0) -call s:set('g:gitgutter_set_sign_backgrounds', 0) -call s:set('g:gitgutter_sign_added', '+') -call s:set('g:gitgutter_sign_modified', '~') -call s:set('g:gitgutter_sign_removed', '_') +let g:gitgutter_sign_allow_clobber = get(g:, 'gitgutter_sign_allow_clobber', 0) +let g:gitgutter_set_sign_backgrounds = get(g:, 'gitgutter_set_sign_backgrounds', 0) +let g:gitgutter_sign_added = get(g:, 'gitgutter_sign_added', '+') +let g:gitgutter_sign_modified = get(g:, 'gitgutter_sign_modified', '~') +let g:gitgutter_sign_removed = get(g:, 'gitgutter_sign_removed', '_') if gitgutter#utility#supports_overscore_sign() - call s:set('g:gitgutter_sign_removed_first_line', '‾') + let g:gitgutter_sign_removed_first_line = get(g:, 'gitgutter_sign_removed_first_line', '‾') else - call s:set('g:gitgutter_sign_removed_first_line', '_^') + let g:gitgutter_sign_removed_first_line = get(g:, 'gitgutter_sign_removed_first_line', '_^') endif -call s:set('g:gitgutter_sign_removed_above_and_below', '[') -call s:set('g:gitgutter_sign_modified_removed', '~_') -call s:set('g:gitgutter_git_args', '') -call s:set('g:gitgutter_diff_relative_to', 'index') -call s:set('g:gitgutter_diff_args', '') -call s:set('g:gitgutter_diff_base', '') -call s:set('g:gitgutter_map_keys', 1) -call s:set('g:gitgutter_terminal_reports_focus', 1) -call s:set('g:gitgutter_async', 1) -call s:set('g:gitgutter_log', 0) -call s:set('g:gitgutter_use_location_list', 0) +let g:gitgutter_sign_removed_above_and_below = get(g:, 'gitgutter_sign_removed_above_and_below', '_¯') +let g:gitgutter_sign_modified_removed = get(g:, 'gitgutter_sign_modified_removed', '~_') +let g:gitgutter_git_args = get(g:, 'gitgutter_git_args', '') +let g:gitgutter_diff_relative_to = get(g:, 'gitgutter_diff_relative_to', 'index') +let g:gitgutter_diff_args = get(g:, 'gitgutter_diff_args', '') +let g:gitgutter_diff_base = get(g:, 'gitgutter_diff_base', '') +let g:gitgutter_map_keys = get(g:, 'gitgutter_map_keys', 1) +let g:gitgutter_terminal_reports_focus = get(g:, 'gitgutter_terminal_reports_focus', 1) +let g:gitgutter_async = get(g:, 'gitgutter_async', 1) +let g:gitgutter_log = get(g:, 'gitgutter_log', 0) +let g:gitgutter_use_location_list = get(g:, 'gitgutter_use_location_list', 0) +let g:gitgutter_close_preview_on_escape = get(g:, 'gitgutter_close_preview_on_escape', 0) +let g:gitgutter_show_msg_on_hunk_jumping = get(g:, 'gitgutter_show_msg_on_hunk_jumping', 1) -call s:set('g:gitgutter_git_executable', 'git') +let g:gitgutter_git_executable = get(g:, 'gitgutter_git_executable', 'git') if !executable(g:gitgutter_git_executable) if g:gitgutter_enabled call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.') @@ -83,7 +77,7 @@ if !executable(g:gitgutter_git_executable) endif let default_grep = 'grep' -call s:set('g:gitgutter_grep', default_grep) +let g:gitgutter_grep = get(g:, 'gitgutter_grep', default_grep) if !empty(g:gitgutter_grep) if executable(split(g:gitgutter_grep)[0]) if $GREP_OPTIONS =~# '--color=always' @@ -225,6 +219,21 @@ nnoremap GitGutterPreviewHunk :call gitgutter#utility#warn('ple function! s:on_bufenter() call gitgutter#setup_maps() + " To keep vim's start-up fast, do not process the buffer when vim is starting. + " Instead process it a short time later. Normally we would rely on our + " CursorHold autocommand to handle this but it turns out CursorHold is not + " guaranteed to fire if the user has not typed anything yet; so set up a + " timer instead. The disadvantage is that if CursorHold does fire, the + " plugin will do a round of unnecessary work; but since there will not have + " been any changes to the buffer since the first round, the second round + " will be cheap. + if has('vim_starting') && !$VIM_GITGUTTER_TEST + if exists('*timer_start') + call timer_start(&updatetime, 'GitGutterCursorHold') + endif + return + endif + if exists('t:gitgutter_didtabenter') && t:gitgutter_didtabenter let t:gitgutter_didtabenter = 0 call gitgutter#all(!g:gitgutter_terminal_reports_focus) @@ -233,6 +242,10 @@ function! s:on_bufenter() endif endfunction +function! GitGutterCursorHold(timer) + execute 'doautocmd' s:nomodeline 'gitgutter CursorHold' +endfunction + " Autocommands {{{ augroup gitgutter @@ -242,6 +255,11 @@ augroup gitgutter autocmd BufEnter * call s:on_bufenter() + " Ensure Vim is always checking for CursorMoved to avoid CursorMoved + " being fired at the wrong time in floating preview window on Neovim. + " See vim/vim#2053. + autocmd CursorMoved * execute '' + autocmd CursorHold,CursorHoldI * call gitgutter#process_buffer(bufnr(''), 0) if exists('*timer_start') && has('lambda') autocmd FileChangedShellPost * call timer_start(1, {-> gitgutter#process_buffer(bufnr(''), 1)}) @@ -266,7 +284,7 @@ augroup gitgutter " FocusGained gets triggered on startup with Neovim at least already. " Therefore this tracks also if it was lost before. let s:focus_was_lost = 0 - autocmd FocusGained * if s:focus_was_lost | let focus_was_lost = 0 | call gitgutter#all(1) | endif + autocmd FocusGained * if s:focus_was_lost | let s:focus_was_lost = 0 | call gitgutter#all(1) | endif autocmd FocusLost * let s:focus_was_lost = 1 if exists('##VimResume') diff --git a/sources_non_forked/vim-markdown/README.md b/sources_non_forked/vim-markdown/README.md index fd3be687..a3197253 100644 --- a/sources_non_forked/vim-markdown/README.md +++ b/sources_non_forked/vim-markdown/README.md @@ -433,6 +433,12 @@ The following requires `:filetype plugin on`. - `:Tocv`: Same as `:Toc` for symmetry with `:Toch` and `:Tocv`. +- `:InsertToc`: Insert table of contents at the current line. + + An optional argument can be used to specify how many levels of headers to display in the table of content, e.g., to display up to and including `h3`, use `:InsertToc 3`. + +- `:InsertNToc`: Same as `:InsertToc`, but the format of `h2` headers in the table of contents is a numbered list, rather than a bulleted list. + ## Credits The main contributors of vim-markdown are: diff --git a/sources_non_forked/vim-markdown/ftdetect/markdown.vim b/sources_non_forked/vim-markdown/ftdetect/markdown.vim index 07682da4..d7ca0cfc 100644 --- a/sources_non_forked/vim-markdown/ftdetect/markdown.vim +++ b/sources_non_forked/vim-markdown/ftdetect/markdown.vim @@ -4,5 +4,5 @@ if !has('patch-7.4.480') endif " markdown filetype file -au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown -au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown +au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown +au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown diff --git a/sources_non_forked/vim-markdown/ftplugin/markdown.vim b/sources_non_forked/vim-markdown/ftplugin/markdown.vim index 200293e8..d6e51c21 100644 --- a/sources_non_forked/vim-markdown/ftplugin/markdown.vim +++ b/sources_non_forked/vim-markdown/ftplugin/markdown.vim @@ -154,6 +154,58 @@ function! s:GetHeaderLevel(...) endif endfunction +" Return list of headers and their levels. +" +function! s:GetHeaderList() + let l:bufnr = bufnr('%') + let l:fenced_block = 0 + let l:front_matter = 0 + let l:header_list = [] + let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0) + for i in range(1, line('$')) + let l:lineraw = getline(i) + let l:l1 = getline(i+1) + let l:line = substitute(l:lineraw, "#", "\\\#", "g") + " exclude lines in fenced code blocks + if l:line =~ '````*' || l:line =~ '\~\~\~\~*' + if l:fenced_block == 0 + let l:fenced_block = 1 + elseif l:fenced_block == 1 + let l:fenced_block = 0 + endif + " exclude lines in frontmatters + elseif l:vim_markdown_frontmatter == 1 + if l:front_matter == 1 + if l:line == '---' + let l:front_matter = 0 + endif + elseif i == 1 + if l:line == '---' + let l:front_matter = 1 + endif + endif + endif + " match line against header regex + if join(getline(i, i + 1), "\n") =~ s:headersRegexp && l:line =~ '^\S' + let l:is_header = 1 + else + let l:is_header = 0 + endif + if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0 + " remove hashes from atx headers + if match(l:line, "^#") > -1 + let l:line = substitute(l:line, '\v^#*[ ]*', '', '') + let l:line = substitute(l:line, '\v[ ]*#*$', '', '') + endif + " append line to list + let l:level = s:GetHeaderLevel(i) + let l:item = {'level': l:level, 'text': l:line, 'lnum': i, 'bufnr': bufnr} + let l:header_list = l:header_list + [l:item] + endif + endfor + return l:header_list +endfunction + " Returns the level of the header at the given line. " " If there is no header at the given line, returns `0`. @@ -175,6 +227,7 @@ endfunction function! s:MoveToParentHeader() let l:linenum = s:GetParentHeaderLineNumber() if l:linenum != 0 + call setpos("''", getpos('.')) call cursor(l:linenum, 1) else echo 'no parent header' @@ -303,65 +356,38 @@ function! s:Toc(...) endif - let l:bufnr = bufnr('%') let l:cursor_line = line('.') let l:cursor_header = 0 - let l:fenced_block = 0 - let l:front_matter = 0 - let l:header_list = [] - let l:header_max_len = 0 - let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0) - let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0) - for i in range(1, line('$')) - let l:lineraw = getline(i) - let l:l1 = getline(i+1) - let l:line = substitute(l:lineraw, "#", "\\\#", "g") - if l:line =~ '````*' || l:line =~ '\~\~\~\~*' - if l:fenced_block == 0 - let l:fenced_block = 1 - elseif l:fenced_block == 1 - let l:fenced_block = 0 - endif - elseif l:vim_markdown_frontmatter == 1 - if l:front_matter == 1 - if l:line == '---' - let l:front_matter = 0 - endif - elseif i == 1 - if l:line == '---' - let l:front_matter = 1 - endif - endif - endif - if l:line =~ '^#\+' || (l:l1 =~ '^=\+\s*$' || l:l1 =~ '^-\+\s*$') && l:line =~ '^\S' - let l:is_header = 1 - else - let l:is_header = 0 - endif - if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0 - " append line to location list - let l:item = {'lnum': i, 'text': l:line, 'valid': 1, 'bufnr': l:bufnr, 'col': 1} - let l:header_list = l:header_list + [l:item] - " set header number of the cursor position - if l:cursor_header == 0 - if i == l:cursor_line - let l:cursor_header = len(l:header_list) - elseif i > l:cursor_line - let l:cursor_header = len(l:header_list) - 1 - endif - endif - " keep track of the longest header size (heading level + title) - let l:total_len = stridx(l:line, ' ') + strdisplaywidth(l:line) - if l:total_len > l:header_max_len - let l:header_max_len = l:total_len - endif - endif - endfor - call setloclist(0, l:header_list) + let l:header_list = s:GetHeaderList() + let l:indented_header_list = [] if len(l:header_list) == 0 echom "Toc: No headers." return endif + let l:header_max_len = 0 + let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0) + for h in l:header_list + " set header number of the cursor position + if l:cursor_header == 0 + let l:header_line = h.lnum + if l:header_line == l:cursor_line + let l:cursor_header = index(l:header_list, h) + 1 + elseif l:header_line > l:cursor_line + let l:cursor_header = index(l:header_list, h) + endif + endif + " indent header based on level + let l:text = repeat(' ', h.level-1) . h.text + " keep track of the longest header size (heading level + title) + let l:total_len = strdisplaywidth(l:text) + if l:total_len > l:header_max_len + let l:header_max_len = l:total_len + endif + " append indented line to list + let l:item = {'lnum': h.lnum, 'text': l:text, 'valid': 1, 'bufnr': h.bufnr, 'col': 1} + let l:indented_header_list = l:indented_header_list + [l:item] + endfor + call setloclist(0, l:indented_header_list) if l:window_type ==# 'horizontal' lopen @@ -369,7 +395,8 @@ function! s:Toc(...) vertical lopen " auto-fit toc window when possible to shrink it if (&columns/2) > l:header_max_len && l:vim_markdown_toc_autofit == 1 - execute 'vertical resize ' . (l:header_max_len + 1) + " header_max_len + 1 space for first header + 3 spaces for line numbers + execute 'vertical resize ' . (l:header_max_len + 1 + 3) else execute 'vertical resize ' . (&columns/2) endif @@ -382,27 +409,84 @@ function! s:Toc(...) for i in range(1, line('$')) " this is the location-list data for the current item let d = getloclist(0)[i-1] - " atx headers - if match(d.text, "^#") > -1 - let l:level = len(matchstr(d.text, '#*', 'g'))-1 - let d.text = substitute(d.text, '\v^#*[ ]*', '', '') - let d.text = substitute(d.text, '\v[ ]*#*$', '', '') - " setex headers - else - let l:next_line = getbufline(d.bufnr, d.lnum+1) - if match(l:next_line, "=") > -1 - let l:level = 0 - elseif match(l:next_line, "-") > -1 - let l:level = 1 - endif - endif - call setline(i, repeat(' ', l:level). d.text) + call setline(i, d.text) endfor setlocal nomodified setlocal nomodifiable execute 'normal! ' . l:cursor_header . 'G' endfunction +function! s:InsertToc(format, ...) + if a:0 > 0 + if type(a:1) != type(0) + echohl WarningMsg + echomsg '[vim-markdown] Invalid argument, must be an integer >= 2.' + echohl None + return + endif + let l:max_level = a:1 + if l:max_level < 2 + echohl WarningMsg + echomsg '[vim-markdown] Maximum level cannot be smaller than 2.' + echohl None + return + endif + else + let l:max_level = 0 + endif + + let l:toc = [] + let l:header_list = s:GetHeaderList() + if len(l:header_list) == 0 + echom "InsertToc: No headers." + return + endif + + if a:format ==# 'numbers' + let l:h2_count = 0 + for header in l:header_list + if header.level == 2 + let l:h2_count += 1 + endif + endfor + let l:max_h2_number_len = strlen(string(l:h2_count)) + else + let l:max_h2_number_len = 0 + endif + + let l:h2_count = 0 + for header in l:header_list + let l:level = header.level + if l:level == 1 + " skip level-1 headers + continue + elseif l:max_level != 0 && l:level > l:max_level + " skip unwanted levels + continue + elseif l:level == 2 + " list of level-2 headers can be bullets or numbers + if a:format ==# 'bullets' + let l:indent = '' + let l:marker = '* ' + else + let l:h2_count += 1 + let l:number_len = strlen(string(l:h2_count)) + let l:indent = repeat(' ', l:max_h2_number_len - l:number_len) + let l:marker = l:h2_count . '. ' + endif + else + let l:indent = repeat(' ', l:max_h2_number_len + 2 * (l:level - 2)) + let l:marker = '* ' + endif + let l:text = '[' . header.text . ']' + let l:link = '(#' . substitute(tolower(header.text), '\v[ ]+', '-', 'g') . ')' + let l:line = l:indent . l:marker . l:text . l:link + let l:toc = l:toc + [l:line] + endfor + + call append(line('.'), l:toc) +endfunction + " Convert Setex headers in range `line1 .. line2` to Atx. " " Return the number of conversions. @@ -679,6 +763,8 @@ command! -buffer Toc call s:Toc() command! -buffer Toch call s:Toc('horizontal') command! -buffer Tocv call s:Toc('vertical') command! -buffer Toct call s:Toc('tab') +command! -buffer -nargs=? InsertToc call s:InsertToc('bullets', ) +command! -buffer -nargs=? InsertNToc call s:InsertToc('numbers', ) " Heavily based on vim-notes - http://peterodding.com/code/vim/notes/ if exists('g:vim_markdown_fenced_languages') @@ -702,7 +788,7 @@ function! s:MarkdownHighlightSources(force) " Look for code blocks in the current file let filetypes = {} for line in getline(1, '$') - let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*') + let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*\ze.*') if !empty(ft) && ft !~ '^\d*$' | let filetypes[ft] = 1 | endif endfor if !exists('b:mkd_known_filetypes') @@ -733,7 +819,7 @@ function! s:MarkdownHighlightSources(force) else let include = '@' . toupper(filetype) endif - let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s' + let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="\s*```$" keepend contains=%s%s' execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '') execute printf('syntax cluster mkdNonListItem add=%s', group) diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 39997648..0a028507 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -103,8 +103,8 @@ execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\ execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealcode execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@]*\\\@" end=""' . s:concealcode -execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\\\@" end=""' . s:concealcode +execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\)\\\@" end=""' . s:concealcode +execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="]*\)\\\@" end=""' . s:concealcode syn region mkdFootnote start="\[^" end="\]" syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/ syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ diff --git a/sources_non_forked/vim-markdown/test/folding-toc.vader b/sources_non_forked/vim-markdown/test/folding-toc.vader index 79c54001..26590043 100644 --- a/sources_non_forked/vim-markdown/test/folding-toc.vader +++ b/sources_non_forked/vim-markdown/test/folding-toc.vader @@ -120,28 +120,28 @@ Execute (check TOC): let res = getloclist(0) let elem = res[0] AssertEqual elem.lnum, 1 - AssertEqual elem.text, '# chap 1' + AssertEqual elem.text, 'chap 1' let elem = res[1] AssertEqual elem.lnum, 15 - AssertEqual elem.text, '## chap 1.1' + AssertEqual elem.text, ' chap 1.1' let elem = res[2] AssertEqual elem.lnum, 25 - AssertEqual elem.text, '### chap 1.1.1' + AssertEqual elem.text, ' chap 1.1.1' let elem = res[3] AssertEqual elem.lnum, 30 - AssertEqual elem.text, '# chap 2' + AssertEqual elem.text, 'chap 2' let elem = res[4] AssertEqual elem.lnum, 34 - AssertEqual elem.text, '## chap 2.1' + AssertEqual elem.text, ' chap 2.1' let elem = res[5] AssertEqual elem.lnum, 41 - AssertEqual elem.text, '# chap 3' + AssertEqual elem.text, 'chap 3' let elem = res[6] AssertEqual elem.lnum, 45 AssertEqual elem.text, 'chap 4' let elem = res[7] AssertEqual elem.lnum, 50 - AssertEqual elem.text, 'chap 4.1' + AssertEqual elem.text, ' chap 4.1' Given markdown; --- @@ -174,5 +174,5 @@ Execute (check Toc of yaml front matter): AssertEqual len(res), 1 let elem = res[0] AssertEqual elem.lnum, 8 - AssertEqual elem.text, 'heading' + AssertEqual elem.text, ' heading' unlet g:vim_markdown_frontmatter diff --git a/sources_non_forked/vim-markdown/test/insert-toc.vader b/sources_non_forked/vim-markdown/test/insert-toc.vader new file mode 100644 index 00000000..b8d669bc --- /dev/null +++ b/sources_non_forked/vim-markdown/test/insert-toc.vader @@ -0,0 +1,147 @@ +Given markdown; +# a + +## Foo Level 2 + +### Foo Level 3 + +#### Foo Level 4 + +Bar Level 2 +----------- + +### Bar Level 3 + +Execute (InsertToc format): + :2 + :call append('.', '') + :InsertToc + +Expect (format): + # a + + * [Foo Level 2](#foo-level-2) + * [Foo Level 3](#foo-level-3) + * [Foo Level 4](#foo-level-4) + * [Bar Level 2](#bar-level-2) + * [Bar Level 3](#bar-level-3) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + +Given markdown; +# a + +## Foo Level 2 + +### Foo Level 3 + +#### Foo Level 4 + +Bar Level 2 +----------- + +### Bar Level 3 + +Execute (InsertToc only h2 headers): + :2 + :call append('.', '') + :InsertToc 2 + +Expect (only h2 headers): + # a + + * [Foo Level 2](#foo-level-2) + * [Bar Level 2](#bar-level-2) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ### Bar Level 3 + +Given markdown; +# a + +## Foo Level 2 + +### Foo Level 3 + +#### Foo Level 4 + +Bar Level 2 +----------- + +## Baz Level 2 + +## Foobar Level 2 + +## Foobaz Level 2 + +## Barfoo Level 2 + +## Barbaz Level 2 + +## Bazfoo Level 2 + +## Bazbar Level 2 + +## Foobarbaz Level 2 + +Execute (InsertNToc format, and up to h3 headers): + :2 + :call append('.', '') + :InsertNToc 3 + +Expect (format, and up to h3 headers): + # a + + 1. [Foo Level 2](#foo-level-2) + * [Foo Level 3](#foo-level-3) + 2. [Bar Level 2](#bar-level-2) + 3. [Baz Level 2](#baz-level-2) + 4. [Foobar Level 2](#foobar-level-2) + 5. [Foobaz Level 2](#foobaz-level-2) + 6. [Barfoo Level 2](#barfoo-level-2) + 7. [Barbaz Level 2](#barbaz-level-2) + 8. [Bazfoo Level 2](#bazfoo-level-2) + 9. [Bazbar Level 2](#bazbar-level-2) + 10. [Foobarbaz Level 2](#foobarbaz-level-2) + + ## Foo Level 2 + + ### Foo Level 3 + + #### Foo Level 4 + + Bar Level 2 + ----------- + + ## Baz Level 2 + + ## Foobar Level 2 + + ## Foobaz Level 2 + + ## Barfoo Level 2 + + ## Barbaz Level 2 + + ## Bazfoo Level 2 + + ## Bazbar Level 2 + + ## Foobarbaz Level 2 diff --git a/sources_non_forked/vim-markdown/test/syntax.vader b/sources_non_forked/vim-markdown/test/syntax.vader index d6f5487e..03496ced 100644 --- a/sources_non_forked/vim-markdown/test/syntax.vader +++ b/sources_non_forked/vim-markdown/test/syntax.vader @@ -739,12 +739,18 @@ def a end ``` +```ruby {linenos=table,hl_lines=[8,"15-17"],linenostart=199} +class b +end +``` + Execute (fenced code block syntax with a language specifier): let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax') call b:func(0) AssertEqual SyntaxOf('include'), 'cInclude' AssertEqual SyntaxOf('code'), 'mkdSnippetCPP' AssertEqual SyntaxOf('def'), 'rubyDefine' + AssertEqual SyntaxOf('class'), 'rubyClass' Given markdown; ``` c++ @@ -958,12 +964,12 @@ $$ \frac{a}{b} $$ Execute (math tex highlighting): let g:vim_markdown_math=0 syn off | syn on - AssertNotEqual SyntaxOf('sqrt'), 'texStatement' - AssertNotEqual SyntaxOf('frac'), 'texStatement' + AssertNotEqual SyntaxOf('sqrt')[0:2], 'tex' + AssertNotEqual SyntaxOf('frac')[0:2], 'tex' let g:vim_markdown_math=1 syn off | syn on - AssertEqual SyntaxOf('sqrt'), 'texStatement' - AssertEqual SyntaxOf('frac'), 'texStatement' + AssertEqual SyntaxOf('sqrt')[0:2], 'tex' + AssertEqual SyntaxOf('frac')[0:2], 'tex' Given markdown; $a b[$ c @@ -986,7 +992,7 @@ Execute (math ends with $$): AssertNotEqual SyntaxOf('c')[0:2], 'tex' Given markdown; -$(0 \le 1)$ +$(0 \leq 1)$ Execute (math conceal in $): if has('conceal') @@ -997,20 +1003,21 @@ Execute (math conceal in $): AssertEqual synconcealed(1, 2)[0], 0 AssertEqual synconcealed(1, 3)[0], 0 AssertEqual synconcealed(1, 4)[0], 0 - AssertEqual synconcealed(1, 5)[0], 1, '\le' + AssertEqual synconcealed(1, 5)[0], 1, '\leq' AssertEqual synconcealed(1, 6)[0], 1 AssertEqual synconcealed(1, 7)[0], 1 - AssertEqual synconcealed(1, 8)[0], 0 + AssertEqual synconcealed(1, 8)[0], 1 AssertEqual synconcealed(1, 9)[0], 0 AssertEqual synconcealed(1, 10)[0], 0 - AssertEqual synconcealed(1, 11)[0], 1, '$' + AssertEqual synconcealed(1, 11)[0], 0 + AssertEqual synconcealed(1, 12)[0], 1, '$' setlocal conceallevel=0 endif Given markdown; $$ \omega -0 \le 1 +0 \leq 1 $$ Execute (math conceal in $$): @@ -1021,8 +1028,8 @@ Execute (math conceal in $$): AssertEqual synconcealed(1, 1)[0], 1, '$$' AssertEqual synconcealed(2, 1)[0], 1, '\omega' AssertEqual synconcealed(3, 1)[0], 0, '0' - AssertEqual synconcealed(3, 3)[0], 1, '\le' - AssertEqual synconcealed(3, 7)[0], 0, '1' + AssertEqual synconcealed(3, 3)[0], 1, '\leq' + AssertEqual synconcealed(3, 8)[0], 0, '1' AssertEqual synconcealed(4, 1)[0], 1, '$$' setlocal conceallevel=0 endif diff --git a/sources_non_forked/vim-multiple-cursors/README.md b/sources_non_forked/vim-multiple-cursors/README.md index 7abe3f30..fd473b0f 100644 --- a/sources_non_forked/vim-multiple-cursors/README.md +++ b/sources_non_forked/vim-multiple-cursors/README.md @@ -1,3 +1,5 @@ +# **❗ This plugin is deprecated, use [vim-visual-multi](https://github.com/mg979/vim-visual-multi) instead ❗** + # vim-multiple-cursors [![Build Status](https://travis-ci.org/terryma/vim-multiple-cursors.svg?branch=master)](https://travis-ci.org/github/terryma/vim-multiple-cursors) diff --git a/sources_non_forked/vim-ruby/INSTALL.markdown b/sources_non_forked/vim-ruby/INSTALL.markdown index b767bb58..09e7b649 100644 --- a/sources_non_forked/vim-ruby/INSTALL.markdown +++ b/sources_non_forked/vim-ruby/INSTALL.markdown @@ -28,6 +28,9 @@ choosing another installation method. The version you download will supersede the version that ships with Vim, so you will now be responsible for keeping it up-to-date.) +If you're looking for stable releases from a particular version, you can find +them in [github](https://github.com/vim-ruby/vim-ruby/releases). + Manually -------- diff --git a/sources_non_forked/vim-ruby/README b/sources_non_forked/vim-ruby/README deleted file mode 100644 index 39d9d91f..00000000 --- a/sources_non_forked/vim-ruby/README +++ /dev/null @@ -1,73 +0,0 @@ - +---------------------------------+ - | vim-ruby github project README | - +---------------------------------+ - -Summary: - This project contains Vim configuration files for editing and compiling Ruby - within Vim. See the project homepage for more details. - -Web links: - Homepage: https://github.com/vim-ruby - Explanation: https://github.com/vim-ruby/vim-ruby/wiki - -For regular users: - - The project page should have two tarballs for download: - - vim-ruby-YYYY.MM.DD.tar.gz (the current stable release) - - vim-ruby-devel-YYYY.MM.DD.tar.gz (cutting-edge features we'd like you - to test) - - Please give feedback through the bug tracking and feature request features - of GitHub. - - Feel free to join discussions on the vim-ruby-devel mailing list: - http://rubyforge.org/mail/?group_id=16 - -For would-be contributors: - - Please get the latest from Git. - - Please join the mailing list and discuss changes, submit patches, etc. - - Thank you very much for taking an interest. - -Contents of the project: - - The autoload, compiler, ftdetect, ftplugin, indent and syntax directories - contain the ruby*.vim files that are to be copied to a location somewhere - in the Vim 'runtimepath'. - -How you get these files into Vim: - - By downloading the project via a snapshot or Git, you can keep up with - the latest, make changes, and install the files to a Vim directory. - - By downloading one of the tarballs, you can easily install the latest - stable or development version wherever you like on your machine. No - README etc. just Vim files. You would typically install these into either - $VIM/vimfiles, for system-wide use, or $HOME/.vim ($HOME/vimfiles on - Windows) for personal use. - - Remember that when you install Vim in the first place, all of these files - are present. The purpose of downloading and installing them from - GitHub is to get the latest version of them. - -Git topics: - - Project was migrated from CVS in August, 2008. - - Files are tagged according to which version of Vim they are released in. - - The project was initiated in July 2003, when the current version of Vim - was 6.2. Thus every file began its life tagged as vim6.2. - - Modifications to the files are made in the expectation that they need to - be tested by interested users. They therefore (probably) don't have a - tag, and are available via "git pull --rebase", or a development snapshot. - - When a modification is considered stable, it is given a tag. - Everything that is stable gets released in vim-ruby-YYY.MM.DD.tar.gz files. - - When a new version of Vim is about to be released, the stable tarball is - contributed to it. After it has been released, the files are tagged - accordingly. - - MORAL OF THE STORY: modifications are committed to the head of the tree; - when they are ready for release into userland, they are tagged "stable". - -Any questions or suggestions? - - If there's something about the project or its concepts that you don't - understand, send an email to the release coordinator, Doug Kearns - (dougkearns at gmail.com). - - To ask about the contents of the configuration files, open a GitHub issue - or ask on the mailing list, as different people maintain the different - files. - -Project gossip: - - While the individual effort to maintain these files has a long history, - this actual project began in late July 2003. - - --= End of Document =-- diff --git a/sources_non_forked/vim-ruby/README.markdown b/sources_non_forked/vim-ruby/README.markdown new file mode 100644 index 00000000..3a402271 --- /dev/null +++ b/sources_non_forked/vim-ruby/README.markdown @@ -0,0 +1,63 @@ +## Vim-ruby + +This project contains Vim's runtime files for ruby support. This includes syntax +highlighting, indentation, omnicompletion, and various useful tools and mappings. + +## Installation + +See the file [INSTALL.markdown](./INSTALL.markdown) for instructions. + +You might also find useful setup tips in the github wiki: +https://github.com/vim-ruby/vim-ruby/wiki/VimRubySupport + +## Usage + +Ideally, vim-ruby should work "correctly" for you out of the box. However, ruby +developers have varying preferences, so there are settings that control some of +the details. You can get more information on these by using the native `:help` +command: + +- [`:help vim-ruby-plugin`](./doc/ft-ruby-plugin.txt): Filetype settings and custom mappings +- [`:help vim-ruby-indent`](./doc/ft-ruby-indent.txt): Indentation settings +- [`:help vim-ruby-syntax`](./doc/ft-ruby-syntax.txt): Syntax-related tweaks +- [`:help vim-ruby-omni`](./doc/ft-ruby-omni.txt): Information and settings for omni completion + +## Issues + +If you have an issue or a feature request, it's recommended to use the github +issue tracker: https://github.com/vim-ruby/vim-ruby/issues. Try the search box +to look for an existing issue -- it might have already been reported. + +If you don't have a github account or would rather contact us in a different +way, you can find emails for individual maintainers in the +[CONTRIBUTORS](./CONTRIBUTORS) file. They're also in the comment headers of the +project's Vimscript files (`syntax/ruby.vim`, `indent/ruby.vim`, etc) under the +label "Maintainer". + +If you're not sure who the most relevant person to contact is for your +particular issue, you can send an email to the release coordinator, Doug Kearns +(dougkearns at gmail.com). + +## Contributing + +Vim-ruby is a mature project, which is one way of saying it moves slowly and it +can be a bit difficult to modify. It's far from impossible, but be warned that +issues and PRs may take time to be handled. Partly, it's because we don't want +to risk breaking Vim's core ruby support, partly because it takes a lot of time +and energy to debug and fix things. + +Contributing a fix for an issue would be very appreciated, even if it's a +proof-of-concept to start a conversation. Be warned that we're definitely going +to be conservative when considering changes to vim-ruby. + +The code is tested using [RSpec](https://rspec.info/) and +[Vimrunner](https://github.com/AndrewRadev/vimrunner). The tests are not +exhaustive, but they should cover a wide variety of cases. + +## Project history + +This project began in July 2003, when the current version of Vim was 6.2. It +was migrated from CVS in August, 2008. + +If you're curious about individual pre-git changes, you can read some of them +in the (unmaintained) [NEWS](./NEWS) and/or [ChangeLog](./ChangeLog) files. diff --git a/sources_non_forked/vim-ruby/doc/ft-ruby-indent.txt b/sources_non_forked/vim-ruby/doc/ft-ruby-indent.txt index 02f613e4..f59d7b32 100644 --- a/sources_non_forked/vim-ruby/doc/ft-ruby-indent.txt +++ b/sources_non_forked/vim-ruby/doc/ft-ruby-indent.txt @@ -1,8 +1,10 @@ RUBY *ft-ruby-indent* + *vim-ruby-indent* Ruby: Access modifier indentation |ruby-access-modifier-indentation| Ruby: Block style indentation |ruby-block-style-indentation| Ruby: Assignment style indentation |ruby-assignment-style-indentation| + Ruby: Hanging element indentation |ruby-hanging-element-indentation| *ruby-access-modifier-indentation* *g:ruby_indent_access_modifier_style* @@ -64,7 +66,7 @@ Different block indentation styles can be used by setting: > :let g:ruby_indent_block_style = 'expression' :let g:ruby_indent_block_style = 'do' < -By default, the "expression" block indent style is used. +By default, the "do" block indent style is used. Block indent style "expression": > @@ -105,5 +107,42 @@ Assignment indent style "variable": end < + *ruby-hanging-element-indentation* + *g:ruby_indent_hanging_elements* + Ruby: Hanging element indentation ~ + +Elements of multiline collections -- such as arrays, hashes, and method +argument lists -- can have hanging indentation enabled or disabled with the +following setting. +> + :let g:ruby_indent_hanging_elements = 1 + :let g:ruby_indent_hanging_elements = 0 +< +By default, this setting is "1" (true) meaning that hanging indentation is +enabled in some cases. + +Here is an example method call when the setting is true (non-zero): +> + render('product/show', + product: product, + on_sale: true, + ) +< +And the same method call when the setting is false (zero): +> + render('product/show', + product: product, + on_sale: true, + ) +< +Note that, even if the setting is turned on, you can still get non-hanging +indentation by putting each argument on a separate line: +> + render( + 'product/show', + product: product, + on_sale: true, + ) +< vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-ruby/doc/ft-ruby-omni.txt b/sources_non_forked/vim-ruby/doc/ft-ruby-omni.txt index f6780899..2abe97fd 100644 --- a/sources_non_forked/vim-ruby/doc/ft-ruby-omni.txt +++ b/sources_non_forked/vim-ruby/doc/ft-ruby-omni.txt @@ -1,4 +1,5 @@ RUBY *ft-ruby-omni* + *vim-ruby-omni* Completion of Ruby code requires that Vim be built with |+ruby|. diff --git a/sources_non_forked/vim-ruby/doc/ft-ruby-plugin.txt b/sources_non_forked/vim-ruby/doc/ft-ruby-plugin.txt index 527a8b66..80b451d8 100644 --- a/sources_non_forked/vim-ruby/doc/ft-ruby-plugin.txt +++ b/sources_non_forked/vim-ruby/doc/ft-ruby-plugin.txt @@ -1,4 +1,6 @@ RUBY *ft-ruby-plugin* + *vim-ruby-plugin* + Ruby: Recommended settings |ruby-recommended| Ruby: Motion commands |ruby-motion| diff --git a/sources_non_forked/vim-ruby/doc/ft-ruby-syntax.txt b/sources_non_forked/vim-ruby/doc/ft-ruby-syntax.txt index 72c826a9..2979f20c 100644 --- a/sources_non_forked/vim-ruby/doc/ft-ruby-syntax.txt +++ b/sources_non_forked/vim-ruby/doc/ft-ruby-syntax.txt @@ -1,4 +1,5 @@ RUBY *ruby.vim* *ft-ruby-syntax* + *vim-ruby-syntax* Ruby: Operator highlighting |ruby_operators| Ruby: Whitespace errors |ruby_space_errors| diff --git a/sources_non_forked/vim-ruby/ftplugin/eruby.vim b/sources_non_forked/vim-ruby/ftplugin/eruby.vim index 6d6e6167..f16715ab 100644 --- a/sources_non_forked/vim-ruby/ftplugin/eruby.vim +++ b/sources_non_forked/vim-ruby/ftplugin/eruby.vim @@ -117,7 +117,7 @@ endif " TODO: comments= setlocal commentstring=<%#%s%> -let b:undo_ftplugin = "setl cms< " +let b:undo_ftplugin = "setl cms< " . \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin let &cpo = s:save_cpo diff --git a/sources_non_forked/vim-ruby/indent/ruby.vim b/sources_non_forked/vim-ruby/indent/ruby.vim index bfc32e5a..fb3768da 100644 --- a/sources_non_forked/vim-ruby/indent/ruby.vim +++ b/sources_non_forked/vim-ruby/indent/ruby.vim @@ -26,7 +26,12 @@ endif if !exists('g:ruby_indent_block_style') " Possible values: "expression", "do" - let g:ruby_indent_block_style = 'expression' + let g:ruby_indent_block_style = 'do' +endif + +if !exists('g:ruby_indent_hanging_elements') + " Non-zero means hanging indents are enabled, zero means disabled + let g:ruby_indent_hanging_elements = 1 endif setlocal nosmartindent @@ -321,7 +326,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0 if closing_bracket == ')' && col('.') != col('$') - 1 - let ind = virtcol('.') - 1 + if g:ruby_indent_hanging_elements + let ind = virtcol('.') - 1 + else + let ind = indent(line('.')) + end elseif g:ruby_indent_block_style == 'do' let ind = indent(line('.')) else " g:ruby_indent_block_style == 'expression' @@ -546,7 +555,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort let [opening, closing] = s:ExtraBrackets(info.plnum) if opening.pos != -1 - if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + if !g:ruby_indent_hanging_elements + return indent(info.plnum) + info.sw + elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') return indent(info.plnum) + info.sw else diff --git a/sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb b/sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb index eb43b046..c936e614 100644 --- a/sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/blocks_spec.rb @@ -1,10 +1,6 @@ require 'spec_helper' describe "Indenting" do - after :each do - vim.command 'let g:ruby_indent_block_style = "expression"' - end - specify "indented blocks with expression style" do vim.command 'let g:ruby_indent_block_style = "expression"' @@ -103,6 +99,7 @@ describe "Indenting" do end specify "blocks with multiline parameters" do + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF def foo opts.on('--coordinator host=HOST[,port=PORT]', diff --git a/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb b/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb index 727da7d3..1d64a867 100644 --- a/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/continuations_spec.rb @@ -57,6 +57,7 @@ describe "Indenting" do end specify "continuations after round braces" do + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF opts.on('--coordinator host=HOST[,port=PORT]', 'Specify the HOST and the PORT of the coordinator') do |str| @@ -67,10 +68,6 @@ describe "Indenting" do end describe "assignments" do - after :each do - vim.command 'let g:ruby_indent_assignment_style = "hanging"' - end - specify "continuations after assignment" do assert_correct_indenting <<~EOF variable = diff --git a/sources_non_forked/vim-ruby/spec/indent/hanging_elements_spec.rb b/sources_non_forked/vim-ruby/spec/indent/hanging_elements_spec.rb new file mode 100644 index 00000000..1d6a15c9 --- /dev/null +++ b/sources_non_forked/vim-ruby/spec/indent/hanging_elements_spec.rb @@ -0,0 +1,78 @@ +require 'spec_helper' + +describe 'Indenting' do + + specify 'method args' do + assert_correct_indenting <<~EOF + render('product/show', + product: product, + on_sale: true, + ) + EOF + + vim.command 'let g:ruby_indent_hanging_elements = 0' + + assert_correct_indenting <<~EOF + render('product/show', + product: product, + on_sale: true, + ) + EOF + end + + specify 'method args with block' do + assert_correct_indenting <<~EOF + opts.on('--coordinator host=HOST[,port=PORT]', + 'Specify the HOST and the PORT of the coordinator') do |str| + h = sub_opts_to_hash(str) + puts h + end + EOF + + vim.command 'let g:ruby_indent_hanging_elements = 0' + + assert_correct_indenting <<~EOF + opts.on('--coordinator host=HOST[,port=PORT]', + 'Specify the HOST and the PORT of the coordinator') do |str| + h = sub_opts_to_hash(str) + puts h + end + EOF + end + + specify 'arrays' do + assert_correct_indenting <<~EOF + x = [1, + 2, + 3, + ] + EOF + + vim.command 'let g:ruby_indent_hanging_elements = 0' + + assert_correct_indenting <<~EOF + x = [1, + 2, + 3, + ] + EOF + end + + specify 'hashes' do + assert_correct_indenting <<~EOF + x = { a: 1, + b: 2, + c: 3, + } + EOF + + vim.command 'let g:ruby_indent_hanging_elements = 0' + + assert_correct_indenting <<~EOF + x = { a: 1, + b: 2, + c: 3, + } + EOF + end +end diff --git a/sources_non_forked/vim-ruby/spec/indent/indent_access_modifier_spec.rb b/sources_non_forked/vim-ruby/spec/indent/indent_access_modifier_spec.rb index c2781e90..8d157544 100644 --- a/sources_non_forked/vim-ruby/spec/indent/indent_access_modifier_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/indent_access_modifier_spec.rb @@ -1,10 +1,6 @@ require 'spec_helper' describe "Indenting" do - after :each do - vim.command 'let g:ruby_indent_access_modifier_style = "normal"' - end - specify "default indented access modifiers" do assert_correct_indenting <<~EOF class OuterClass diff --git a/sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb b/sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb index 461aed2c..b402224c 100644 --- a/sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/nesting_spec.rb @@ -20,6 +20,7 @@ describe "Indenting" do } EOF + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF var. func1(:param => 'value') { @@ -40,6 +41,7 @@ describe "Indenting" do } EOF + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF foo, bar = { @@ -53,6 +55,7 @@ describe "Indenting" do end specify "nested blocks with a continuation and function call inbetween" do + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF var. func1(:param => 'value') { diff --git a/sources_non_forked/vim-ruby/spec/indent/splat_spec.rb b/sources_non_forked/vim-ruby/spec/indent/splat_spec.rb index 1aa46844..dc89c008 100644 --- a/sources_non_forked/vim-ruby/spec/indent/splat_spec.rb +++ b/sources_non_forked/vim-ruby/spec/indent/splat_spec.rb @@ -20,6 +20,7 @@ describe "Indenting" do end specify "splats with blocks in assignment" do + vim.command 'let g:ruby_indent_block_style = "expression"' assert_correct_indenting <<~EOF x = * array.map do diff --git a/sources_non_forked/vim-ruby/spec/spec_helper.rb b/sources_non_forked/vim-ruby/spec/spec_helper.rb index db518e21..3cb20643 100644 --- a/sources_non_forked/vim-ruby/spec/spec_helper.rb +++ b/sources_non_forked/vim-ruby/spec/spec_helper.rb @@ -1,6 +1,16 @@ require 'vimrunner' require 'vimrunner/rspec' +RSpec.configure do |config| + # reset globals to default values before each test + config.before(:each) do + vim.command 'let g:ruby_indent_access_modifier_style = "normal"' + vim.command 'let g:ruby_indent_block_style = "do"' + vim.command 'let g:ruby_indent_assignment_style = "hanging"' + vim.command 'let g:ruby_indent_hanging_elements = 1' + end +end + Vimrunner::RSpec.configure do |config| config.reuse_server = true diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index 8f7a51c2..d797e46b 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -65,7 +65,7 @@ endfunction com! -nargs=* SynFold call s:run_syntax_fold() " Not-Top Cluster {{{1 -syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses +syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -331,7 +331,7 @@ SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1 0: + snip.rv = t[1].split('=')[0].split()[-1] +`++) { + + $0 +} /* for ($1; $2; `!p if len(t[1]) > 0: snip.rv = t[1].split('=')[0].split()[-1]`++) */ +endsnippet + snippet once "Include header once only guard" #ifndef ${1:`!p if not snip.c: @@ -75,8 +111,9 @@ else if (${1:/* condition */}) { } endsnippet -snippet printf "printf .. (printf)" -printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} +post_jump "printf_expand_args(snip)" +snippet "printf" "printf with auto-expand args" wr +printf("$1\n"$2); endsnippet snippet st "struct" diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index 1abd5096..80120dae 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -30,6 +30,12 @@ endglobal ########################################################################### # TextMate Snippets # ########################################################################### +snippet forc "general for loop (for)" +for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) { + ${VISUAL}$0 +} +endsnippet + snippet beginend "$1.begin(), $1.end() (beginend)" ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end() endsnippet @@ -106,5 +112,68 @@ ${1:ReturnType} ${2:FunctionName}(${3:param}) { ${0:FunctionBody} } +endsnippet + +snippet boost_test "Boost test module" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +BOOST_AUTO_TEST_CASE(${2:TestCaseName}) +{ + ${0:TestDefinition} +} + +endsnippet + +snippet boost_suite "Boost test suite module" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +BOOST_AUTO_TEST_SUITE(${2:SuiteName}) + +BOOST_AUTO_TEST_CASE(${3:TestCaseName}) +{ + ${0:TestDefinition} +} + +BOOST_AUTO_TEST_SUITE_END() + +endsnippet +snippet boost_test_fixture "Boost test module with fixture" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +struct ${2:FixtureName} { + $2() {} + virtual ~$2() {} + /* define members here */ +}; + +BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2) +{ + ${0:TestDefinition} +} + +endsnippet + +snippet boost_suite_fixture "Boost test suite with fixture" b +#define BOOST_TEST_MODULE ${1:TestModuleName} +#include + +struct ${2:FixtureName} { + $2() {} + virtual ~$2() {} + /* define members here */ +}; + +BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2) + +BOOST_AUTO_TEST_CASE(${4:TestCaseName}) +{ + ${0:TestDefinition} +} + +BOOST_AUTO_TEST_SUITE_END() + endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/django.snippets b/sources_non_forked/vim-snippets/UltiSnips/django.snippets index d6e2d434..a03cf1e3 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/django.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/django.snippets @@ -148,7 +148,6 @@ class ${1:MODELNAME}(models.Model): def save(self): return super($1, self).save() - @models.permalink def get_absolute_url(self): return ('') diff --git a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets index 11d82c81..ed832715 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets @@ -1,5 +1,13 @@ priority -50 -snippet impq "Qualified import" -import qualified ${1:Data.Text} as ${0:`!p snip.rv = t[1].split(".")[-1]`} +snippet imp "Simple import" +import ${1:${2:Data}.${0:Text}} +endsnippet + +snippet imp2 "Selective import" b +import ${1:${2:Data}.${3:Text}} (${4})${0} +endsnippet + +snippet impq "Qualified import" +import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index a81b1d88..75eff902 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -276,7 +276,7 @@ snippet htmll "HTML basic structure with the lang attribute" b - + ${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`} diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets index e80ec86f..666c80e3 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets @@ -30,7 +30,7 @@ endsnippet snippet useCB "useCallback(fn, inputs)" b const ${1:callback} = useCallback((${2})) => ${3:{ ${4} -}}, [${5}] +}}, [${5}]) endsnippet snippet useM "useMemo(fn, inputs)" b const ${1:memorized} = useMemo(() => ${2:{ diff --git a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index 72b9f8f7..1017c801 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -104,7 +104,7 @@ endsnippet # Common stuff # ################ snippet link "Link to something" -[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0 +[${1:${VISUAL:Text}}](${3:https://${2:www.url.com}})$0 endsnippet snippet img "Image" @@ -125,7 +125,7 @@ endsnippet snippet refl "Reference Link" [${1:${VISUAL:Text}}][${2:id}]$0 -[$2]:${4:http://${3:www.url.com}} "${5:$4}" +[$2]:${4:https://${3:www.url.com}} "${5:$4}" endsnippet snippet fnt "Footnote" diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets index b284f0a2..6fc07e93 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -45,8 +45,8 @@ snippet .it ".iter()" i endsnippet snippet impl "Struct/Trait implementation" b -impl ${1:Type/Trait}${2: for ${3:Type}} { - $0 +impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} { + ${0} } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 0243b468..5c5721f3 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -9,15 +9,15 @@ def create_table(snip): cols = snip.buffer[snip.line].split('x')[1] int_val = lambda string: int(''.join(s for s in string if s.isdigit())) - + rows = int_val(rows) cols = int_val(cols) offset = cols + 1 old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1] - + snip.buffer[snip.line] = '' - + final_str = old_spacing + "\\begin{tabular}{|" + "|".join(['$' + str(i + 1) for i in range(cols)]) + "|}\n" for i in range(rows): @@ -35,7 +35,7 @@ def add_row(snip): old_spacing = snip.buffer[snip.line][:snip.buffer[snip.line].rfind('\t') + 1] snip.buffer[snip.line] = '' - + final_str = old_spacing final_str += " & ".join(['$' + str(j + 1) for j in range(row_len)]) final_str += " \\\\\\" @@ -63,7 +63,7 @@ $0${2/(?<=.)(c|l|r)|./(?1: & )/g} endsnippet pre_expand "create_table(snip)" -snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r +snippet "gentbl(\d+)x(\d+)" "Generate table of *width* by *height*" r endsnippet pre_expand "add_row(snip)" @@ -193,8 +193,6 @@ snippet acl "Acroynm expanded" b $0 endsnippet - - snippet ni "Non-indented paragraph" b \noindent $0 @@ -241,4 +239,20 @@ snippet glnl "New long glossary item" b ${0:description} } endsnippet + +# Bold text +snippet bf "Bold" +\textbf{$1} $0 +endsnippet + +# Italic text +snippet ita "Italics" +\textit{$1} $0 +endsnippet + +# Underlined text +snippet und "Underline" +\underline{$1} $0 +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/pythonx/vimsnippets.py b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py index 3c638a17..eceb83c5 100644 --- a/sources_non_forked/vim-snippets/pythonx/vimsnippets.py +++ b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py @@ -1,3 +1,5 @@ +# vim:set et fileencoding=utf8 sts=0 sw=4 ts=4: + """Helper methods used in UltiSnips snippets.""" import string, vim, re @@ -82,12 +84,13 @@ def get_comment_format(): def make_box(twidth, bwidth=None): b, m, e, i = (s.strip() for s in get_comment_format()) + m0 = m[0] if m else '' bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2 - sline = b + m + bwidth_inner * m[0] + 2 * m[0] + sline = b + m + bwidth_inner * m0 + 2 * m0 nspaces = (bwidth_inner - twidth) // 2 mlines = i + m + " " + " " * nspaces mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m - eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e + eline = i + m + bwidth_inner * m0 + 2 * m0 + e return sline, mlines, mlinee, eline def foldmarker(): @@ -114,5 +117,3 @@ def has_cjk(s): cjk_re = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE) return cjk_re.search(s) is not None - -# vim:set et sts=0 sw=4 ts=4: diff --git a/sources_non_forked/vim-snippets/snippets/clojure.snippets b/sources_non_forked/vim-snippets/snippets/clojure.snippets index 152f896e..048ce9fe 100644 --- a/sources_non_forked/vim-snippets/snippets/clojure.snippets +++ b/sources_non_forked/vim-snippets/snippets/clojure.snippets @@ -8,21 +8,21 @@ snippet def (def ${0}) snippet defm (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}] - ${0}) + ${0:code}) snippet defmm (defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defma (defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn}) snippet defn (defn ${1:name} "${2:doc-string}" [${3:arg-list}] - ${0}) + ${0:code}) snippet defp (defprotocol ${1:name} - ${0}) + ${0:code}) snippet defr (defrecord ${1:name} [${2:fields}] ${3:protocol} - ${0}) + ${0:code}) snippet deft (deftest ${1:name} (is (= ${0:assertion}))) @@ -31,12 +31,12 @@ snippet is snippet defty (deftype ${1:Name} [${2:fields}] ${3:Protocol} - ${0}) + ${0:code}) snippet doseq (doseq [${1:elem} ${2:coll}] - ${0}) + ${0:code}) snippet fn - (fn [${1:arg-list}] ${0}) + (fn [${1:arg-list}] ${0:code}) snippet if (if ${1:test-expr} ${2:then-expr} @@ -50,24 +50,24 @@ snippet imp & {:keys [${1:keys}] :or {${0:defaults}}} snippet let (let [${1:name} ${2:expr}] - ${0}) + ${0:code}) snippet letfn (letfn [(${1:name}) [${2:args}] - ${0})]) + ${0:code})]) snippet map (map ${1:func} ${0:coll}) snippet mapl (map #(${1:lambda}) ${0:coll}) snippet met (${1:name} [${2:this} ${3:args}] - ${0}) + ${0:code}) snippet ns (ns ${0:name}) snippet dotimes (dotimes [_ 10] (time (dotimes [_ ${1:times}] - ${0}))) + ${0:code}))) snippet pmethod (${1:name} [${2:this} ${0:args}]) snippet refer diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 468575d0..ee093eb9 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -81,6 +81,8 @@ snippet cb @callback ${1:name}(${2:args}) :: ${3:returns} snippet df def ${1:name}, do: ${2} +snippet dfw + def ${1:name}(${2:args}) when ${3:guard}, do: snippet def def ${1:name} do ${0} @@ -92,12 +94,21 @@ snippet defd def ${2:name} do ${0} end +snippet defs + @spec ${1:name}(${2:arg types}) :: ${3:no_return} + def $1(${4:args}) do + ${0} + end snippet defsd @doc """ ${1:doc string} """ - @spec ${2:name} :: ${3:no_return} - def ${2} do + @spec ${2:name}(${3:arg types}) :: ${4:no_return} + def $2(${5:args}) do + ${0} + end +snippet defw + def ${1:name}(${2:args}) when ${3:guard} do ${0} end snippet defim @@ -112,12 +123,24 @@ snippet defmo defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do ${0} end +snippet %M + %__MODULE__{ + ${1:key_name}: ${2:value} + } +snippet enfk + @enforce_keys [:${1:key_name}] snippet dfp defp ${1:name}, do: ${2} +snippet dfpw + defp ${1:name}(${2:args}) when ${3:guard}, do: ${4} snippet defp defp ${1:name} do ${0} end +snippet defpw + defp ${1:name}(${2:args}) when ${3:guard} do + ${0} + end snippet defpr defprotocol ${1:name}, [${0:function}] snippet defr @@ -173,12 +196,28 @@ snippet des describe "${1:test group subject}" do ${0} end +snippet destag + @describetag :${1:describe tag} +snippet mtag + @moduletag :${1:module tag} +snippet dt + doctest ${1:filename} +snippet tp + @tag :pending snippet exunit defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do use ExUnit.Case, async: true ${0} end +snippet setup + setup do + ${1} + end +snippet setupa + setup_all do + ${1} + end snippet try try .. rescue .. end try do ${1:${VISUAL}} diff --git a/sources_non_forked/vim-snippets/snippets/eruby.snippets b/sources_non_forked/vim-snippets/snippets/eruby.snippets index b8879c5c..3d639160 100644 --- a/sources_non_forked/vim-snippets/snippets/eruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/eruby.snippets @@ -46,8 +46,9 @@ snippet conf <% content_for :${1:head} do %> ${0} <% end %> -snippet cs - <%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %> + +snippet cs + <%= collection_select(:${1:object}, :${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %> snippet ct <%= content_tag '${1:DIV}', ${2:content}${0:,options} %> snippet ff @@ -80,6 +81,8 @@ snippet ffta <%= ${1:f}.text_area :${0:attribute} %> snippet fftf <%= ${1:f}.text_field :${0:attribute} %> +snippet fcs + <%= ${1:f}.collection_select(:${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %> snippet fields <%= fields_for :${1:model}, @$1 do |${2:f}| %> ${0} diff --git a/sources_non_forked/vim-snippets/snippets/gitcommit.snippets b/sources_non_forked/vim-snippets/snippets/gitcommit.snippets new file mode 100644 index 00000000..93b2c5d0 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/gitcommit.snippets @@ -0,0 +1,2 @@ +snippet co + Co-authored-by: ${1} <${2}> diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index b8d3e6f8..202b7e80 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -129,7 +129,7 @@ snippet fum "method" } ${0} -snippet fumh "http handler function on reciever" +snippet fumh "http handler function on receiver" func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) { ${0:${VISUAL}} } diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index bc42f944..640a26fa 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -709,7 +709,7 @@ snippet samp ${0} snippet script - snippet scripts diff --git a/sources_non_forked/vim-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets index 66821c16..739f20b7 100644 --- a/sources_non_forked/vim-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -175,9 +175,9 @@ snippet tryf ## ## Find Methods snippet findall - List<${1:listName}> ${2:items} = ${1}.findAll(); + List<${1:listName}> ${2:items} = $1.findAll(); snippet findbyid - ${1:var} ${2:item} = ${1}.findById(${3}); + ${1:var} ${2:item} = $1.findById(${3}); ## ## Javadocs snippet /** diff --git a/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets b/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets deleted file mode 100644 index c9138752..00000000 --- a/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets +++ /dev/null @@ -1,82 +0,0 @@ -# Import only React -snippet ri1 - import React from 'react' - -# Import both React and Component -snippet ri2 - import React, { Component } from 'react' - import PropTypes from 'prop-types' - -# React class -snippet rcla - class ${1:MyComponent} extends Component { - render() { - return ( - ${0:
} - ) - } - } - -# React constructor -snippet rcon - constructor(props) { - super(props) - - this.state = { - ${1}: ${0}, - } - } - -# Proptypes for React Class -snippet rcpt - static propTypes = { - ${1}: PropTypes.${0}, - } - -# Default props for React Class -snippet rcdp - static defaultProps = { - ${1}: ${0}, - } - -# Presentational component -snippet rcom - props => { - return ( - ${0:
} - ) - } - -# Proptypes for Presentational component -snippet rpt - ${1}.propTypes = { - ${2}: PropTypes.${0}, - } - -# Default props for Presentational component -snippet rdp - ${1}.defaultProps = { - ${2}: ${0}, - } - -# Lifecycle Methods -snippet rcdm - componentDidMount() { - ${0:${VISUAL}} - } - -# State -snippet rsst - this.setState({ - ${1}: ${0}, - }) - -snippet rtst - this.state.${0} - -# Props -snippet rp - props.${0} - -snippet rtp - this.props.${0} diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript-jasmine.snippets b/sources_non_forked/vim-snippets/snippets/javascript-jasmine.snippets similarity index 100% rename from sources_non_forked/vim-snippets/snippets/javascript/javascript-jasmine.snippets rename to sources_non_forked/vim-snippets/snippets/javascript-jasmine.snippets diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets index 0e8d3602..65cb4e1d 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets @@ -1,98 +1,190 @@ -snippet ir +# Import +snippet ir import React import React from 'react'; -snippet irc + +snippet irc import React and Component import React, { Component } from 'react'; -snippet ird + +snippet irh import React hooks + import { use$1 } from 'react'; + +snippet ird import ReactDOM import ReactDOM from 'react-dom'; -snippet cdm + +snippet irp import PropTypes + import PropTypes from 'prop-types'; + +# Lifecycle Methods +snippet cdm componentDidMount componentDidMount() { ${1} - } -snippet cdup + }; + +snippet cdup componentDidUpdate componentDidUpdate(prevProps, prevState) { ${1} - } -snippet cwm + }; + +snippet cwm componentWillMount componentWillMount() { ${1} - } -snippet cwr + }; + +snippet cwr componentWillReceiveProps componentWillReceiveProps(nextProps) { ${1} - } -snippet cwun + }; + +snippet cwun componentWillUnmount componentWillUnmount() { ${1} - } -snippet cwu + }; + +snippet cwu componentWillUpdate componentWillUpdate(nextProps, nextState) { ${1} + }; + +snippet scu shouldComponentUpdate + shouldComponentUpdate(nextProps, nextState) { + ${1} } -snippet fup - forceUpdate(${1:callback}); -snippet dp + +# Props +snippet spt static propTypes + static propTypes = { + ${1}: PropTypes.${2} + }; + +snippet pt propTypes + ${1}.propTypes = { + ${2}: PropTypes.${2} + }; + +snippet sdp static defaultProps static defaultProps = { - ${1}: ${2}, - } + ${1}: ${2} + }; + +snippet dp defaultProps + ${1}.defaultProps = { + ${2}: ${3} + }; + +snippet pp props + props.${1}; + +snippet tp this props + this.props.${1}; + +# State snippet st state = { ${1}: ${2}, - } -snippet pt - static propTypes = { - ${1}: React.PropTypes.${2:type}, - } -snippet rfc - const ${1:ComponentName} = (${2:props}) => { - return ( -
- $1 -
- ); - } -snippet rcc - class ${1:ClassName} extends React.Component { - state = { + }; - } - render() { - return ( -
- $1 -
- ); - } - } -snippet rdr - ReactDOM.render(${1}, ${2}) -snippet ercc - export default class ${1:ClassName} extends React.Component { - render() { - return ( - ${0:
} - ); - } - } -snippet ctor - constructor() { - super(); - ${1} - } -snippet ren - render() { - return ( - ${1:
} - ); - } snippet sst this.setState({ ${1}: ${2} }); -snippet scu - shouldComponentUpdate(nextProps, nextState) { - ${1} + +snippet tst + this.state.${1}; + +# Component +snippet raf + const ${1:ComponentName} = (${2:props}) => { + ${3:state} + + return ( + <> + ${4} + + ); + }; + +snippet rcla + class ${1:ClassName} extends Component { + render() { + return ( + <> + ${2} + + ); + } } -snippet prp i - this.props.${1} -snippet ste i - this.state.${1} + +snippet ercla + export default class ${1:ClassName} extends Component { + render() { + return ( + <> + ${2} + + ); + }; + }; + +snippet ctor + constructor() { + super(); + + ${1:state} + } + +snippet ren + render() { + return ( + <> + ${2} + + ); + } + +snippet fup + forceUpdate(${1:callback}); + +# Hooks +snippet uses useState + const [${1:state}, set${2}] = useState(${3:initialState}); + +snippet usee useEffect + useEffect(() => { + ${1} + }); + +snippet userd useReducer + const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer}); + +snippet userf useRef + const ${1:refContainer} = useRef(${2:initialValue}); + +snippet usect useContext + const ${1:value} = useContext(${2:MyContext}); + +snippet usecb useCallback + const ${1:memoizedCallback} = useCallback( + () => { + ${2}(${3}) + }, + [$3] + ); + +snippet usem useMemo + const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]); + +snippet usei useImperativeHandle + useImperativeHandle(${1:ref}, ${2:createHandle}); + +snippet used useDebugValue + useDebugValue(${1:value}); + +# ReactDOM methods +snippet rdr ReactDOM.render + ReactDOM.render(${1}, ${2}); + +snippet rdh ReactDOM.hydrate + ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]); + +snippet rdcp ReactDOM.createPortal + ReactDOM.createPortal(${1:child}, ${2:container}); diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index c3d5a8b8..26562068 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -311,6 +311,10 @@ snippet foro "for (const prop of object}) { ... }" for (const ${1:prop} of ${2:object}) { ${0:$1} } +snippet forl "for (let prop of object}) { ... }" + for (let ${1:prop} of ${2:object}) { + ${0:$1} + } snippet fun* function* ${1:function_name}(${2}) { ${0:${VISUAL}} @@ -319,10 +323,18 @@ snippet c=> const ${1:function_name} = (${2}) => { ${0:${VISUAL}} } +snippet ca=> + const ${1:function_name} = async (${2}) => { + ${0:${VISUAL}} + } snippet caf const ${1:function_name} = (${2}) => { ${0:${VISUAL}} } +snippet casf + const ${1:function_name} = async (${2}) => { + ${0:${VISUAL}} + } snippet => (${1}) => { ${0:${VISUAL}} @@ -339,5 +351,7 @@ snippet ed export default ${0} snippet ${ ${${1}}${0} +snippet as "async" + async ${0} snippet aw "await" await ${0:${VISUAL}} diff --git a/sources_non_forked/vim-snippets/snippets/markdown.snippets b/sources_non_forked/vim-snippets/snippets/markdown.snippets index b1aa3e14..364066cf 100644 --- a/sources_non_forked/vim-snippets/snippets/markdown.snippets +++ b/sources_non_forked/vim-snippets/snippets/markdown.snippets @@ -5,19 +5,19 @@ # The suffix `c` stands for "Clipboard". snippet [ - [${1:text}](http://${2:address}) + [${1:text}](https://${2:address}) snippet [* [${1:link}](${2:`@*`}) snippet [c [${1:link}](${2:`@+`}) snippet [" - [${1:text}](http://${2:address} "${3:title}") + [${1:text}](https://${2:address} "${3:title}") snippet ["* [${1:link}](${2:`@*`} "${3:title}") snippet ["c [${1:link}](${2:`@+`} "${3:title}") snippet [: - [${1:id}]: http://${2:url} + [${1:id}]: https://${2:url} snippet [:* [${1:id}]: ${2:`@*`} @@ -26,7 +26,7 @@ snippet [:c [${1:id}]: ${2:`@+`} snippet [:" - [${1:id}]: http://${2:url} "${3:title}" + [${1:id}]: https://${2:url} "${3:title}" snippet [:"* [${1:id}]: ${2:`@*`} "${3:title}" diff --git a/sources_non_forked/vim-snippets/snippets/ocaml.snippets b/sources_non_forked/vim-snippets/snippets/ocaml.snippets index eb5a799c..aec43bed 100644 --- a/sources_non_forked/vim-snippets/snippets/ocaml.snippets +++ b/sources_non_forked/vim-snippets/snippets/ocaml.snippets @@ -1,7 +1,7 @@ snippet doc - (* - ${0} - *) + (** ${0} *) +snippet comment + (* ${0} *) snippet let let ${1} = ${2} in ${0} diff --git a/sources_non_forked/vim-snippets/snippets/ps1.snippets b/sources_non_forked/vim-snippets/snippets/ps1.snippets index 41099d9d..08de1efd 100644 --- a/sources_non_forked/vim-snippets/snippets/ps1.snippets +++ b/sources_non_forked/vim-snippets/snippets/ps1.snippets @@ -29,8 +29,8 @@ snippet function # PowerShell Splatting snippet splatting $Params = @{ - ${1:Param1} = '{2:Value1}' - ${3:Param2} = '{4:Value2}' + ${1:Param1} = '${2:Value1}' + ${3:Param2} = '${4:Value2}' } ${5:CommandName} @Params @@ -99,4 +99,3 @@ snippet switch ${2:condition1} { ${3:action} } ${4:condition2} { ${5:action} } default { ${6:action} } - diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 66b3d3e4..71fe5909 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -110,7 +110,7 @@ snippet crate "Define create meta attributes" snippet opt "Option" Option<${1:i32}> snippet res "Result" - Result<${1:~str}, ${2:()}> + Result<${1:&str}, ${2:()}> # Control structures snippet if if ${1} { @@ -123,7 +123,7 @@ snippet ife "if / else" ${0} } snippet ifl "if let (...)" - if let ${1:Some(${2})} = $3 { + if let ${1:Some($2)} = $3 { ${0:${VISUAL}} } snippet el "else" @@ -151,7 +151,7 @@ snippet wh "while loop" ${0:${VISUAL}} } snippet whl "while let (...)" - while let ${1:Some(${2})} = $3 { + while let ${1:Some($2)} = $3 { ${0:${VISUAL}} } snippet for "for ... in ... loop" @@ -165,15 +165,15 @@ snippet fixme "FIXME comment" // FIXME: $0 # Struct snippet st "Struct definition" - struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} { + struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { ${0} } snippet impl "Struct/Trait implementation" - impl$4 ${1:Type/Trait}${2: for ${3:Type}}${4:<${5:T}>} { + impl ${1:Type/Trait}${2: for $3} { ${0} } snippet stn "Struct with new constructor" - pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}${2:<${3:T}>} { + pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { ${0} } @@ -198,7 +198,7 @@ snippet trait "Trait definition" ${0} } snippet drop "Drop trait implementation (destructor)" - impl$2 Drop for ${1:Name}${2:<${3:T}>} { + impl Drop for $1 { fn drop(&mut self) { ${0} } @@ -209,10 +209,6 @@ snippet ss "static string declaration" snippet stat "static item declaration" static ${1}: ${2:usize} = ${0}; # Concurrency -snippet scoped "spawn a scoped thread" - thread::scoped(${1:move }|| { - ${0} - }); snippet spawn "spawn a thread" thread::spawn(${1:move }|| { ${0} @@ -253,4 +249,4 @@ snippet rc "Rc::new()" snippet unim "unimplemented!()" unimplemented!() snippet use "use ...;" b - use ${1:std::${2:io}}; + use ${1:std::$2}; diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index c02d3401..e13508a4 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -358,3 +358,59 @@ snippet hrefc # enquote from package csquotes snippet enq enquote \\enquote{${1:${VISUAL:text}}} ${0} + +# Time derivative +snippet ddt time derivative + \\frac{d}{dt} {$1} {$0} + +# Limit +snippet lim limit + \\lim_{{$1}} {{$2}} {$0} + +# Partial derivative +snippet pdv partial derivation + \\frac{\\partial {$1}}{\partial {$2}} {$0} + +# Second order partial derivative +snippet ppdv second partial derivation + \\frac{\partial^2 {$1}}{\partial {$2} \partial {$3}} {$0} + +# Ordinary derivative +snippet dv derivative + \\frac{d {$1}}{d {$2}} {$0} + +# Summation +snippet summ summation + \\sum_{{$1}} {$0} + +# Shorthand for time derivative +snippet dot dot + \\dot{{$1}} {$0} + +# Shorthand for second order time derivative +snippet ddot ddot + \\ddot{{$1}} {$0} + +# Vector +snippet vec vector + \\vec{{$1}} {$0} + +# Cross product +snippet \x cross product + \\times {$0} + +# Dot product +snippet . dot product + \\cdot {$0} + +# Integral +snippet int integral + \\int_{{$1}}^{{$2}} {$3} \: d{$4} {$5} + +# Right arrow +snippet ra rightarrow + \\rightarrow {$0} + +# Long right arrow +snippet lra longrightarrow + \\longrightarrow {$0} diff --git a/sources_non_forked/vim-snippets/snippets/twig.snippets b/sources_non_forked/vim-snippets/snippets/twig.snippets index d0d7e1c9..8102984d 100644 --- a/sources_non_forked/vim-snippets/snippets/twig.snippets +++ b/sources_non_forked/vim-snippets/snippets/twig.snippets @@ -1,34 +1,177 @@ -snippet bl "{% block xyz %} .. {% endblock xyz %}" +# Tags +snippet apply "twig apply" + {% apply ${1} %} + ${0} + {% endapply %} +snippet autoescape "twig autoescape" + {% autoescape %} + ${0} + {% endautoescape %} +snippet endautoescape "twig endautoescape" + {% endautoescape %}${0} +snippet bl "twig block" {% block ${1} %} - ${2:${VISUAL}} - {% endblock $1 %} -snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}" - {% javascripts '${1}' %} - - {% endjavascripts %} -snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}" - {% stylesheets '${1}' %} - - {% endstylesheets %} -snippet if "{% if %} .. {% endif %}" - {% if ${1} %} - ${2:${VISUAL}} - {% endif %} -snippet ife "{% if %} .. {% else %} .. {% endif %}" - {% if ${1} %} - ${2:${VISUAL}} - {% else %} - ${0} - {% endif %} -snippet el "{% else %}" - {% else %} - ${0:${VISUAL}} -snippet eif "{% elseif %}" - {% elseif ${1} %} - ${0} -snippet for "{% for x in y %} .. {% endfor %}" + ${0} + {% endblock %} +snippet block "twig block" + {% block ${1} %} + ${0} + {% endblock %} +snippet endblock "twig endblock" + {% endblock %}${0} +snippet cache "twig cache" + {% cache %} + ${0} + {% endcache %} +snippet endcache "twig endcache" + {% endcache %}${0} +snippet css "twig css" + {% css %} + ${0} + {% endcss %} +snippet endcss "twig endcss" + {% endcss %}${0} +snippet dd "twig dd" + {% dd ${1} %}${0} +snippet do "twig do" + {% do ${1} %}${0} +snippet embed "twig embed" + {% embed "${1}" %} + ${0} + {% endembed %} +snippet endembed "twig endembed" + {% endembed %}${0} +snippet exit "twig exit" + {% exit ${1} %} +snippet extends "twig extends" + {% extends "${1}" %}${0} +snippet ext "twig extends" + {% extends "${1}" %}${0} +snippet for "twig for" {% for ${1} in ${2} %} - ${3} + ${0} {% endfor %} -snippet ext "{% extends xyz %}" - {% extends ${1} %} +snippet fore "twig for else" + {% for ${1} in ${2} %} + ${3} + {% else %} + ${0} + {% endfor %} +snippet endfor "twig endfor" + {% endfor %}${0} +snippet from "twig from" + {% from "${1}" import ${2} %}${0} +snippet header "twig header" + {% header "${1}" %}${0} +snippet hook "twig hook" + {% hook "${1}" %}${0} +snippet html "twig html" + {% html %} + ${0} + {% endhtml %} +snippet endhtml "twig endhtml" + {% endhtml %}${0} +snippet if "twig if" + {% if ${1} %} + ${0} + {% endif %} +snippet ife "twig if else" + {% if ${1} %} + ${2} + {% else %} + ${0} + {% endif %} +snippet el "twig else" + {% else %} +snippet eif "twig elseif" + {% elseif ${1} %} + ${0} +snippet endif "twig endif" + {% endif %}${0} +snippet import "twig import" + {% import "${1}" as ${2} %}${0} +snippet include "twig include" + {% include "${1}" %}${0} +snippet includewith "twig include with parameters" + {% include "${1}" with ${2} %}${0} +snippet js "twig js" + {% js %} + ${0} + {% endjs %} +snippet endjs "twig endjs" + {% endjs %}${0} +snippet macro "twig macro" + {% macro ${1}(${2}) %} + ${0} + {% endmacro %} +snippet endmacro "twig endmacro" + {% endmacro %}${0} +snippet namespace "twig namespace" + {% namespace "${1}" %} + ${0} + {% endnamespace %} +snippet endnamespace "twig endnamespace" + {% endnamespace %}${0} +snippet nav "twig nav" + {% nav ${1} in ${2} %} + ${0} + {% endnav %} +snippet endnav "twig endnav" + {% endnav %}${0} +snippet paginate "twig paginate" + {% paginate ${1} as ${2} %}${0} +snippet redirect "twig redirect" + {% redirect "${1}" %}${0} +snippet requireguest "twig requireguest" + {% requireGuest %}${0} +snippet requirelogin "twig requirelogin" + {% requireLogin %}${0} +snippet requirepermission "twig requirepermission" + {% requirePermission "${1}" %}${0} +snippet set "twig set" + {% set ${1} = ${2} %}${0} +snippet setb "twig set block" + {% set ${1} %} + ${0} + {% endset %} +snippet endset "twig endset" + {% endset %}${0} +snippet switch "twig switch" + {% switch ${1} %} + {% case "${2}" %} + ${0} + {% default %} + + {% endswitch %} +snippet case "twig switch case" + {% case "${1}" %} + ${0} +snippet default "twig switch default" + {% default %} + ${0} +snippet endswitch "twig endswitch" + {% endswitch %}${0} +snippet use "twig use" + {% use "${1}" %}${0} +snippet verbatim "twig verbatim" + {% verbatim %} + ${0} + {% endverbatim %} +snippet endverbatim "twig endverbatim" + {% endverbatim %}${0} +snippet with "twig with" + {% with %} + ${0} + {% endwith %} +snippet endwith "twig endwith" + {% endwith %}${0} + +# Functions +snippet dump "twig dump" +
+		{{ dump(${1}) }}
+	
+ +# Filters +snippet translate "twig translate" + {{ "${1}"|t }}${0} diff --git a/sources_non_forked/vim-snippets/snippets/typescript.snippets b/sources_non_forked/vim-snippets/snippets/typescript.snippets index fddbeb1c..a784c5ef 100644 --- a/sources_non_forked/vim-snippets/snippets/typescript.snippets +++ b/sources_non_forked/vim-snippets/snippets/typescript.snippets @@ -9,8 +9,16 @@ snippet tlet "ts let" snippet tvar "ts var" var ${1}: ${2:any} = ${3}; ${0} -snippet + "var: type" +snippet + "ts create field" ${1}: ${0:any} +snippet #+ "ts create private field using #" + #${1}: ${0:any} +snippet tpfi "ts create public field" + public ${1}: ${0:any} +snippet tprfi "ts create private field" + private ${1}: ${0:any} +snippet tprofi "ts create protected field" + protected ${1}: ${0:any} snippet int "interface" interface ${1} { ${2}: ${3:any}; @@ -25,6 +33,22 @@ snippet tfun "ts function" function ${1}(${2}): ${3:any} { ${0} } +snippet tpmet "ts public method" + public ${1}(${2}): ${3:any} { + ${0} + } +snippet tpsmet "ts public static method" + public static ${1}(${2}): ${3:any} { + ${0} + } +snippet tprmet "ts private method" + private ${1}(${2}): ${3:any} { + ${0} + } +snippet tpromet "ts protected method" + protected ${1}(${2}): ${3:any} { + ${0} + } snippet tcla "ts class" class ${1} { ${2} diff --git a/sources_non_forked/vim-snippets/snippets/verilog.snippets b/sources_non_forked/vim-snippets/snippets/verilog.snippets index df5eeb81..e4a6b052 100644 --- a/sources_non_forked/vim-snippets/snippets/verilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/verilog.snippets @@ -9,7 +9,7 @@ snippet ife ${2} end else begin - ${1} + ${3} end # Else if statement snippet eif diff --git a/sources_non_forked/vim-snippets/snippets/vhdl.snippets b/sources_non_forked/vim-snippets/snippets/vhdl.snippets index 7a991344..0683a218 100644 --- a/sources_non_forked/vim-snippets/snippets/vhdl.snippets +++ b/sources_non_forked/vim-snippets/snippets/vhdl.snippets @@ -3,7 +3,7 @@ snippet lib library ${1} - use ${1}.${2} + use $1.${2} # Standard Libraries snippet libs diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index ad35df73..f19b3a46 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -43,7 +43,6 @@ snippet ife if ... else statement endif snippet au augroup ... autocmd block augroup ${1:AU_NAME} - " this one is which you're most likely to use? autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} augroup end snippet bun Vundle.vim Plugin definition From 8e54cbc92ea47767c223bf351a2128539de74359 Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 5 May 2021 10:24:20 +0200 Subject: [PATCH 59/91] Use MRU.vim plugin for accessing most recently used files --- update_plugins.py | 1 + vimrcs/plugins_config.vim | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/update_plugins.py b/update_plugins.py index 606fba04..37abdc99 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -57,6 +57,7 @@ vim-ruby https://github.com/vim-ruby/vim-ruby typescript-vim https://github.com/leafgarland/typescript-vim vim-javascript https://github.com/pangloss/vim-javascript vim-python-pep8-indent https://github.com/Vimjas/vim-python-pep8-indent +mru.vim https://github.com/vim-scripts/mru.vim """.strip() GITHUB_ZIP = "%s/archive/master.zip" diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 2dd58855..de2c1f0d 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -53,9 +53,6 @@ map j :CtrlP " Quickly find and open a buffer map b :CtrlPBuffer -" Quickly find and open a recently opened file -map f :CtrlPMRU - let g:ctrlp_max_height = 20 let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' From a7a471a20714f661894fb22033b512933d2ce478 Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 5 May 2021 10:25:00 +0200 Subject: [PATCH 60/91] Updated plugins --- .../ale/ale_linters/ada/adals.vim | 26 + .../ale/ale_linters/ansible/ansible_lint.vim | 97 +- .../ale_linters/apkbuild/apkbuild_lint.vim | 12 + .../ale_linters/apkbuild/secfixes_check.vim | 12 + .../ale/ale_linters/c/cppcheck.vim | 7 +- .../cloudformation/cfn_python_lint.vim | 1 + .../ale/ale_linters/cpp/clangtidy.vim | 10 +- .../ale/ale_linters/cpp/cppcheck.vim | 7 +- sources_non_forked/ale/ale_linters/cs/csc.vim | 17 +- .../ale/ale_linters/cs/mcsc.vim | 16 +- .../ale/ale_linters/cuda/clangd.vim | 23 + sources_non_forked/ale/ale_linters/d/dmd.vim | 92 +- .../ale/ale_linters/dafny/dafny.vim | 19 +- .../ale/ale_linters/dart/analysis_server.vim | 29 + .../desktop/desktop_file_validate.vim | 31 + .../ale/ale_linters/dockerfile/hadolint.vim | 25 +- .../ale/ale_linters/elixir/credo.vim | 18 +- .../ale/ale_linters/elixir/dialyxir.vim | 11 +- .../ale/ale_linters/elixir/dogma.vim | 10 +- .../ale/ale_linters/elixir/mix.vim | 11 +- .../ale/ale_linters/elm/make.vim | 18 +- .../ale/ale_linters/erlang/dialyzer.vim | 12 +- .../ale/ale_linters/erlang/erlc.vim | 16 +- .../ale/ale_linters/go/gobuild.vim | 4 +- .../ale/ale_linters/go/golangci_lint.vim | 7 +- .../ale/ale_linters/go/gometalinter.vim | 7 +- .../ale/ale_linters/go/gopls.vim | 2 + .../ale/ale_linters/go/gosimple.vim | 8 +- .../ale/ale_linters/go/gotype.vim | 12 +- .../ale/ale_linters/go/govet.vim | 4 +- .../ale/ale_linters/go/staticcheck.vim | 12 +- .../ale/ale_linters/graphql/eslint.vim | 1 + .../ale/ale_linters/graphql/gqlint.vim | 9 +- .../ale/ale_linters/haskell/cabal_ghc.vim | 4 +- .../ale/ale_linters/haskell/hls.vim | 63 + .../ale/ale_linters/haskell/stack_ghc.vim | 4 +- .../ale/ale_linters/html/angular.vim | 52 + .../ale/ale_linters/inko/inko.vim | 33 + .../ale/ale_linters/java/checkstyle.vim | 2 +- .../ale/ale_linters/java/eclipselsp.vim | 8 +- .../ale/ale_linters/java/javac.vim | 13 +- .../ale/ale_linters/javascript/eslint.vim | 1 + .../ale/ale_linters/javascript/xo.vim | 23 +- .../ale/ale_linters/json/jq.vim | 24 + .../ale/ale_linters/json/spectral.vim | 14 + .../ale/ale_linters/julia/languageserver.vim | 4 +- .../ale/ale_linters/kotlin/kotlinc.vim | 14 +- .../ale/ale_linters/markdown/vale.vim | 19 +- .../ale/ale_linters/mercury/mmc.vim | 8 +- .../ale/ale_linters/nix/nix.vim | 57 +- .../ale/ale_linters/nix/rnix_lsp.vim | 16 + .../ale/ale_linters/ocaml/ocamllsp.vim | 13 + .../ale/ale_linters/openapi/ibm_validator.vim | 58 + .../ale/ale_linters/openapi/yamllint.vim | 9 + .../ale/ale_linters/perl6/perl6.vim | 2 +- .../ale/ale_linters/php/intelephense.vim | 4 +- .../ale/ale_linters/php/phan.vim | 8 +- .../ale/ale_linters/php/phpcs.vim | 4 +- .../ale/ale_linters/prolog/swipl.vim | 16 +- .../ale/ale_linters/proto/protolint.vim | 24 + .../ale/ale_linters/python/flake8.vim | 18 +- .../ale/ale_linters/python/mypy.vim | 16 +- .../ale/ale_linters/python/pydocstyle.vim | 4 +- .../ale/ale_linters/python/pylama.vim | 17 +- .../ale/ale_linters/python/pylint.vim | 18 +- .../ale/ale_linters/python/pyls.vim | 3 +- .../ale/ale_linters/python/vulture.vim | 19 +- .../ale/ale_linters/r/lintr.vim | 5 +- .../ale/ale_linters/rst/rstcheck.vim | 11 +- .../ale/ale_linters/ruby/sorbet.vim | 5 +- .../ale/ale_linters/rust/analyzer.vim | 2 +- .../ale/ale_linters/rust/cargo.vim | 28 +- .../ale/ale_linters/salt/salt_lint.vim | 33 + .../ale/ale_linters/solidity/solhint.vim | 31 +- .../ale/ale_linters/svelte/svelteserver.vim | 21 + .../ale_linters/swift/appleswiftformat.vim | 43 + .../ale/ale_linters/swift/swiftformat.vim | 62 - .../ale_linters/systemd/systemd_analyze.vim | 18 + .../ale/ale_linters/terraform/terraform.vim | 46 +- .../ale_linters/terraform/terraform_ls.vim | 38 + .../ale/ale_linters/tex/texlab.vim | 5 +- .../ale/ale_linters/typescript/deno.vim | 25 + .../ale/ale_linters/typescript/eslint.vim | 1 + .../ale/ale_linters/typescript/tslint.vim | 4 +- .../ale/ale_linters/typescript/xo.vim | 23 +- sources_non_forked/ale/ale_linters/v/v.vim | 82 + .../ale/ale_linters/vala/vala_lint.vim | 66 + .../ale/ale_linters/verilog/verilator.vim | 20 +- .../vim/ale_custom_linting_rules.vim | 11 +- .../ale/ale_linters/yaml/spectral.vim | 14 + .../ale/ale_linters/yaml/yamllint.vim | 43 +- sources_non_forked/ale/autoload/ale.vim | 2 +- sources_non_forked/ale/autoload/ale/ant.vim | 24 +- .../ale/autoload/ale/assert.vim | 149 +- sources_non_forked/ale/autoload/ale/c.vim | 18 +- .../ale/autoload/ale/code_action.vim | 99 +- .../ale/autoload/ale/codefix.vim | 5 +- .../ale/autoload/ale/command.vim | 66 +- .../ale/autoload/ale/completion.vim | 2 + .../ale/autoload/ale/cursor.vim | 22 +- .../ale/autoload/ale/debugging.vim | 2 +- .../ale/autoload/ale/definition.vim | 40 +- sources_non_forked/ale/autoload/ale/dhall.vim | 24 + .../ale/autoload/ale/engine.vim | 16 + sources_non_forked/ale/autoload/ale/fix.vim | 2 + .../ale/autoload/ale/fix/registry.vim | 72 +- .../autoload/ale/fixers/appleswiftformat.vim | 16 + .../ale/autoload/ale/fixers/autoimport.vim | 6 +- .../ale/autoload/ale/fixers/black.vim | 16 +- .../ale/autoload/ale/fixers/buildifier.vim | 26 + .../ale/autoload/ale/fixers/clangformat.vim | 20 + .../ale/autoload/ale/fixers/deno.vim | 17 + .../ale/autoload/ale/fixers/dhall.vim | 23 - .../ale/autoload/ale/fixers/dhall_format.vim | 14 + .../ale/autoload/ale/fixers/dhall_freeze.vim | 18 + .../ale/autoload/ale/fixers/dhall_lint.vim | 14 + .../ale/autoload/ale/fixers/erlfmt.vim | 21 + .../ale/autoload/ale/fixers/eslint.vim | 12 +- .../ale/autoload/ale/fixers/fish_indent.vim | 19 + .../ale/autoload/ale/fixers/isort.vim | 29 +- .../ale/autoload/ale/fixers/nixfmt.vim | 15 + .../ale/autoload/ale/fixers/prettier.vim | 23 +- .../autoload/ale/fixers/prettier_eslint.vim | 4 +- .../ale/autoload/ale/fixers/protolint.vim | 26 + .../ale/autoload/ale/fixers/ptop.vim | 17 + .../ale/autoload/ale/fixers/standardrb.vim | 4 +- .../ale/autoload/ale/fixers/stylelint.vim | 9 +- .../ale/autoload/ale/fixers/vfmt.vim | 13 + .../ale/autoload/ale/fixers/xo.vim | 37 +- .../ale/autoload/ale/fixers/yamlfix.vim | 6 +- .../ale/autoload/ale/floating_preview.vim | 134 ++ .../ale/autoload/ale/gradle.vim | 25 +- .../ale/autoload/ale/handlers/atools.vim | 41 + .../ale/autoload/ale/handlers/cppcheck.vim | 5 +- .../ale/autoload/ale/handlers/deno.vim | 52 + .../ale/autoload/ale/handlers/eslint.vim | 10 +- .../ale/autoload/ale/handlers/hdl_checker.vim | 2 + .../ale/autoload/ale/handlers/inko.vim | 37 + .../ale/autoload/ale/handlers/ocamllsp.vim | 23 + .../ale/autoload/ale/handlers/shellcheck.vim | 11 +- .../ale/autoload/ale/handlers/solhint.vim | 98 ++ .../ale/autoload/ale/handlers/spectral.vim | 31 + .../ale/autoload/ale/handlers/xo.vim | 44 + .../ale/autoload/ale/handlers/yamllint.vim | 39 + sources_non_forked/ale/autoload/ale/hover.vim | 9 + .../ale/autoload/ale/linter.vim | 24 +- sources_non_forked/ale/autoload/ale/list.vim | 16 +- sources_non_forked/ale/autoload/ale/lsp.vim | 1 + .../ale/autoload/ale/lsp/tsserver_message.vim | 8 + .../ale/autoload/ale/lsp_linter.vim | 33 +- sources_non_forked/ale/autoload/ale/maven.vim | 24 +- sources_non_forked/ale/autoload/ale/path.vim | 22 +- .../ale/autoload/ale/python.vim | 2 + sources_non_forked/ale/autoload/ale/sign.vim | 3 + .../ale/autoload/ale/socket.vim | 5 +- sources_non_forked/ale/autoload/ale/swift.vim | 57 + sources_non_forked/ale/autoload/ale/test.vim | 17 +- sources_non_forked/ale/autoload/ale/util.vim | 21 +- sources_non_forked/ale/doc/ale-ada.txt | 30 + sources_non_forked/ale/doc/ale-apkbuild.txt | 30 + sources_non_forked/ale/doc/ale-bazel.txt | 28 + sources_non_forked/ale/doc/ale-c.txt | 40 +- sources_non_forked/ale/doc/ale-cuda.txt | 18 + sources_non_forked/ale/doc/ale-dafny.txt | 16 + sources_non_forked/ale/doc/ale-dart.txt | 25 + sources_non_forked/ale/doc/ale-desktop.txt | 21 + .../ale/doc/ale-development.txt | 28 +- sources_non_forked/ale/doc/ale-dhall.txt | 52 + sources_non_forked/ale/doc/ale-elixir.txt | 7 + sources_non_forked/ale/doc/ale-erlang.txt | 36 + sources_non_forked/ale/doc/ale-fish.txt | 17 + sources_non_forked/ale/doc/ale-go.txt | 21 + sources_non_forked/ale/doc/ale-haskell.txt | 12 + sources_non_forked/ale/doc/ale-html.txt | 99 +- sources_non_forked/ale/doc/ale-inko.txt | 22 + sources_non_forked/ale/doc/ale-json.txt | 32 + sources_non_forked/ale/doc/ale-nix.txt | 18 + sources_non_forked/ale/doc/ale-ocaml.txt | 15 + sources_non_forked/ale/doc/ale-openapi.txt | 74 + sources_non_forked/ale/doc/ale-pascal.txt | 24 + sources_non_forked/ale/doc/ale-proto.txt | 37 +- sources_non_forked/ale/doc/ale-python.txt | 30 + sources_non_forked/ale/doc/ale-ruby.txt | 15 + sources_non_forked/ale/doc/ale-salt.tmt | 43 + .../doc/ale-supported-languages-and-tools.txt | 78 +- sources_non_forked/ale/doc/ale-svelte.txt | 31 + sources_non_forked/ale/doc/ale-swift.txt | 39 + sources_non_forked/ale/doc/ale-systemd.txt | 14 + sources_non_forked/ale/doc/ale-terraform.txt | 22 + sources_non_forked/ale/doc/ale-typescript.txt | 60 + sources_non_forked/ale/doc/ale-v.txt | 45 + sources_non_forked/ale/doc/ale-vala.txt | 21 + sources_non_forked/ale/doc/ale-yaml.txt | 32 + sources_non_forked/ale/doc/ale.txt | 189 +- sources_non_forked/ale/plugin/ale.vim | 21 +- sources_non_forked/ale/supported-tools.md | 75 +- sources_non_forked/bufexplorer/README.md | 2 +- sources_non_forked/ctrlp.vim/readme.md | 2 +- sources_non_forked/lightline-ale/LICENSE | 30 +- sources_non_forked/lightline-ale/README.md | 35 +- .../lightline.vim/.github/workflows/ci.yaml | 4 +- .../lightline/colorscheme/apprentice.vim | 46 + .../lightline.vim/colorscheme.md | 4 + .../lightline.vim/doc/lightline.txt | 4 +- sources_non_forked/mru.vim/README | 192 +++ sources_non_forked/mru.vim/plugin/mru.vim | 1039 +++++++++++ sources_non_forked/nerdtree/CHANGELOG.md | 13 + sources_non_forked/nerdtree/README.markdown | 244 +-- .../nerdtree/autoload/nerdtree.vim | 32 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 44 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 71 +- .../nerdtree/lib/nerdtree/bookmark.vim | 2 +- .../nerdtree/lib/nerdtree/key_map.vim | 8 +- .../nerdtree/lib/nerdtree/nerdtree.vim | 8 - .../nerdtree/lib/nerdtree/notifier.vim | 4 +- .../nerdtree/lib/nerdtree/opener.vim | 7 +- .../nerdtree/lib/nerdtree/path.vim | 15 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 21 + sources_non_forked/nginx.vim/syntax/nginx.vim | 1 - sources_non_forked/rust.vim/ftplugin/rust.vim | 2 +- sources_non_forked/typescript-vim/README.md | 2 +- .../compiler/typescriptreact.vim | 1 + .../ftplugin/typescriptreact.vim | 1 + .../typescript-vim/indent/typescriptreact.vim | 1 + .../typescript-vim/syntax/typescriptreact.vim | 1 + .../vim-abolish/plugin/abolish.vim | 4 +- .../vim-coffee-script/ftdetect/coffee.vim | 1 + .../vim-commentary/plugin/commentary.vim | 4 +- .../vim-flake8/autoload/flake8.vim | 5 +- .../vim-fugitive/autoload/fugitive.vim | 1534 +++++++++++------ .../vim-fugitive/doc/fugitive.txt | 50 +- .../vim-fugitive/ftplugin/fugitiveblame.vim | 6 + .../vim-fugitive/plugin/fugitive.vim | 296 ++-- sources_non_forked/vim-gitgutter/README.mkd | 2 - .../vim-gitgutter/autoload/gitgutter/diff.vim | 2 +- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 63 +- .../autoload/gitgutter/utility.vim | 15 +- .../vim-gitgutter/doc/gitgutter.txt | 6 +- .../vim-gitgutter/plugin/gitgutter.vim | 21 +- .../vim-javascript/syntax/javascript.vim | 4 +- .../vim-multiple-cursors/Gemfile.lock | 2 +- .../vim-repeat/autoload/repeat.vim | 11 +- sources_non_forked/vim-ruby/indent/ruby.vim | 3 +- .../vim-snipmate/Contributors.md | 1 + .../vim-snipmate/autoload/snipMate.vim | 17 +- .../vim-snipmate/doc/snipMate.txt | 29 +- .../vim-snipmate/plugin/snipMate.vim | 4 + .../vim-snippets/UltiSnips/cpp.snippets | 7 + .../vim-snippets/UltiSnips/gitcommit.snippets | 61 + .../UltiSnips/javascript_react.snippets | 10 +- .../vim-snippets/UltiSnips/lua.snippets | 9 + .../vim-snippets/UltiSnips/puppet.snippets | 36 +- .../vim-snippets/UltiSnips/python.snippets | 2 +- .../vim-snippets/snippets/c.snippets | 7 + .../vim-snippets/snippets/cuda.snippets | 58 + .../vim-snippets/snippets/eelixir.snippets | 11 + .../vim-snippets/snippets/fsharp.snippets | 80 + .../vim-snippets/snippets/html.snippets | 2 +- .../snippets/javascript/javascript.snippets | 8 +- .../vim-snippets/snippets/liquid.snippets | 211 ++- .../vim-snippets/snippets/lpc.snippets | 190 ++ .../vim-snippets/snippets/ruby.snippets | 34 +- .../vim-snippets/snippets/tex.snippets | 11 + .../vim-snippets/snippets/verilog.snippets | 18 +- .../vim-snippets/snippets/vim.snippets | 8 +- 265 files changed, 7773 insertions(+), 1880 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/ada/adals.vim create mode 100644 sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim create mode 100644 sources_non_forked/ale/ale_linters/cuda/clangd.vim create mode 100644 sources_non_forked/ale/ale_linters/dart/analysis_server.vim create mode 100644 sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim create mode 100644 sources_non_forked/ale/ale_linters/haskell/hls.vim create mode 100644 sources_non_forked/ale/ale_linters/html/angular.vim create mode 100644 sources_non_forked/ale/ale_linters/inko/inko.vim create mode 100644 sources_non_forked/ale/ale_linters/json/jq.vim create mode 100644 sources_non_forked/ale/ale_linters/json/spectral.vim create mode 100644 sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim create mode 100644 sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim create mode 100644 sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim create mode 100644 sources_non_forked/ale/ale_linters/openapi/yamllint.vim create mode 100644 sources_non_forked/ale/ale_linters/proto/protolint.vim create mode 100644 sources_non_forked/ale/ale_linters/salt/salt_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/svelte/svelteserver.vim create mode 100644 sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim delete mode 100644 sources_non_forked/ale/ale_linters/swift/swiftformat.vim create mode 100644 sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim create mode 100644 sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim create mode 100644 sources_non_forked/ale/ale_linters/typescript/deno.vim create mode 100644 sources_non_forked/ale/ale_linters/v/v.vim create mode 100644 sources_non_forked/ale/ale_linters/vala/vala_lint.vim create mode 100644 sources_non_forked/ale/ale_linters/yaml/spectral.vim create mode 100644 sources_non_forked/ale/autoload/ale/dhall.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/buildifier.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/deno.vim delete mode 100644 sources_non_forked/ale/autoload/ale/fixers/dhall.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/protolint.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/ptop.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/vfmt.vim create mode 100644 sources_non_forked/ale/autoload/ale/floating_preview.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/atools.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/deno.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/inko.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/solhint.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/spectral.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/xo.vim create mode 100644 sources_non_forked/ale/autoload/ale/handlers/yamllint.vim create mode 100644 sources_non_forked/ale/doc/ale-apkbuild.txt create mode 100644 sources_non_forked/ale/doc/ale-bazel.txt create mode 100644 sources_non_forked/ale/doc/ale-dafny.txt create mode 100644 sources_non_forked/ale/doc/ale-desktop.txt create mode 100644 sources_non_forked/ale/doc/ale-dhall.txt create mode 100644 sources_non_forked/ale/doc/ale-inko.txt create mode 100644 sources_non_forked/ale/doc/ale-openapi.txt create mode 100644 sources_non_forked/ale/doc/ale-pascal.txt create mode 100644 sources_non_forked/ale/doc/ale-salt.tmt create mode 100644 sources_non_forked/ale/doc/ale-svelte.txt create mode 100644 sources_non_forked/ale/doc/ale-systemd.txt create mode 100644 sources_non_forked/ale/doc/ale-v.txt create mode 100644 sources_non_forked/lightline.vim/autoload/lightline/colorscheme/apprentice.vim create mode 100644 sources_non_forked/mru.vim/README create mode 100644 sources_non_forked/mru.vim/plugin/mru.vim create mode 100644 sources_non_forked/typescript-vim/compiler/typescriptreact.vim create mode 100644 sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim create mode 100644 sources_non_forked/typescript-vim/indent/typescriptreact.vim create mode 100644 sources_non_forked/typescript-vim/syntax/typescriptreact.vim create mode 100644 sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/gitcommit.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/fsharp.snippets create mode 100644 sources_non_forked/vim-snippets/snippets/lpc.snippets diff --git a/sources_non_forked/ale/ale_linters/ada/adals.vim b/sources_non_forked/ale/ale_linters/ada/adals.vim new file mode 100644 index 00000000..9a41e1df --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ada/adals.vim @@ -0,0 +1,26 @@ +" Author: Bartek Jasicki http://github.com/thindil +" Description: Support for Ada Language Server + +call ale#Set('ada_adals_executable', 'ada_language_server') +call ale#Set('ada_adals_project', 'default.gpr') +call ale#Set('ada_adals_encoding', 'utf-8') + +function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort + return { + \ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'), + \ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding') + \} +endfunction + +function! ale_linters#ada#adals#GetRootDirectory(buffer) abort + return fnamemodify(bufname(a:buffer), ':p:h') +endfunction + +call ale#linter#Define('ada', { +\ 'name': 'adals', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'), +\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig') +\}) diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim index c4affa31..f83de01a 100644 --- a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim +++ b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim @@ -1,4 +1,4 @@ -" Author: Bjorn Neergaard +" Authors: Bjorn Neergaard , Vytautas Macionis " Description: ansible-lint for ansible-yaml files call ale#Set('ansible_ansible_lint_executable', 'ansible-lint') @@ -7,7 +7,7 @@ function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'ansible_ansible_lint_executable') endfunction -function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort +function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort for l:line in a:lines[:10] if match(l:line, '^Traceback') >= 0 return [{ @@ -18,39 +18,86 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort endif endfor - " Matches patterns line the following: - " - " test.yml:35: [EANSIBLE0002] Trailing whitespace - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$' + let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:code = l:match[4] + if '>=5.0.0' is# l:version_group + " Matches patterns line the following: + " test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play + " roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest + " D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest + let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$' + let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' } - if l:code is# 'EANSIBLE0002' - \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - " Skip warnings for trailing whitespace if the option is off. - continue - endif + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if ale#path#IsBufferPath(a:buffer, l:match[1]) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[6], + \ 'code': l:match[4], + \ 'type': l:error_codes[l:match[5]], + \}) + endif + endfor + endif - if ale#path#IsBufferPath(a:buffer, l:match[1]) - call add(l:output, { - \ 'lnum': l:match[2] + 0, - \ 'col': l:match[3] + 0, - \ 'text': l:match[5], - \ 'code': l:code, - \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', - \}) - endif - endfor + if '<5.0.0' is# l:version_group + " Matches patterns line the following: + " test.yml:35: [EANSIBLE0002] Trailing whitespace + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:code = l:match[4] + + if l:code is# 'EANSIBLE0002' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if ale#path#IsBufferPath(a:buffer, l:match[1]) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[5], + \ 'code': l:code, + \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', + \}) + endif + endfor + endif return l:output endfunction +function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort + let l:commands = { + \ '>=5.0.0': '%e --parseable-severity -x yaml', + \ '<5.0.0': '%e -p %t' + \} + let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0'] + + return l:command +endfunction + call ale#linter#Define('ansible', { \ 'name': 'ansible_lint', \ 'aliases': ['ansible', 'ansible-lint'], \ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'), -\ 'command': '%e -p %t', -\ 'callback': 'ale_linters#ansible#ansible_lint#Handle', +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#ansible#ansible_lint#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#ansible#ansible_lint#GetCommand'), +\ )}, +\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#ansible#ansible_lint#GetExecutable(buffer), +\ '%e --version', +\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle( +\ buffer, +\ l:version, +\ lines)}, +\ )}, \}) diff --git a/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim b/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim new file mode 100644 index 00000000..285f5534 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim @@ -0,0 +1,12 @@ +" Author: Leo +" Description: apkbuild-lint from atools linter for APKBUILDs + +call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint') + +call ale#linter#Define('apkbuild', { +\ 'name': 'apkbuild_lint', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')}, +\ 'command': '%e %t', +\ 'callback': 'ale#handlers#atools#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim b/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim new file mode 100644 index 00000000..c65267fd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim @@ -0,0 +1,12 @@ +" Author: Leo +" Description: secfixes-check from atools linter for APKBUILDs + +call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check') + +call ale#linter#Define('apkbuild', { +\ 'name': 'secfixes_check', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')}, +\ 'command': '%e %t', +\ 'callback': 'ale#handlers#atools#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/cppcheck.vim b/sources_non_forked/ale/ale_linters/c/cppcheck.vim index b671fc8b..28c2861f 100644 --- a/sources_non_forked/ale/ale_linters/c/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/c/cppcheck.vim @@ -5,15 +5,13 @@ call ale#Set('c_cppcheck_executable', 'cppcheck') call ale#Set('c_cppcheck_options', '--enable=style') function! ale_linters#c#cppcheck#GetCommand(buffer) abort - let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer) let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' - let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}''' + let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') - return l:cd_command - \ . '%e -q --language=c' + return '%e -q --language=c' \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) @@ -25,6 +23,7 @@ call ale#linter#Define('c', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')}, +\ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#c#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim b/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim index d0ac7b28..16841431 100644 --- a/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim +++ b/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim @@ -29,6 +29,7 @@ endfunction call ale#linter#Define('cloudformation', { \ 'name': 'cloudformation', +\ 'aliases': ['cfn-lint'], \ 'executable': 'cfn-lint', \ 'command': 'cfn-lint --template %t --format parseable', \ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle', diff --git a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim index 5e062d86..d6944aae 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim @@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options') let l:cflags = ale#c#GetCFlags(a:buffer, a:output) let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags - endif - " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file. - if expand('#' . a:buffer) =~# '\.h$' - let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' + " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file + " only when compile-commands.json file is not there. Adding these + " flags makes clang-tidy completely ignore compile commmands. + if expand('#' . a:buffer) =~# '\.h$' + let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' + endif endif " Get the options to pass directly to clang-tidy diff --git a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim index 2c832246..eb86adf4 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim @@ -5,15 +5,13 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck') call ale#Set('cpp_cppcheck_options', '--enable=style') function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort - let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer) let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' - let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}''' + let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') - return l:cd_command - \ . '%e -q --language=c++' + return '%e -q --language=c++' \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) @@ -25,6 +23,7 @@ call ale#linter#Define('cpp', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')}, +\ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#cpp#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/cs/csc.vim b/sources_non_forked/ale/ale_linters/cs/csc.vim index 308abc77..5ee3de29 100644 --- a/sources_non_forked/ale/ale_linters/cs/csc.vim +++ b/sources_non_forked/ale/ale_linters/cs/csc.vim @@ -3,14 +3,10 @@ call ale#Set('cs_csc_source', '') call ale#Set('cs_csc_assembly_path', []) call ale#Set('cs_csc_assemblies', []) -function! s:GetWorkingDirectory(buffer) abort - let l:working_directory = ale#Var(a:buffer, 'cs_csc_source') +function! ale_linters#cs#csc#GetCwd(buffer) abort + let l:cwd = ale#Var(a:buffer, 'cs_csc_source') - if !empty(l:working_directory) - return l:working_directory - endif - - return expand('#' . a:buffer . ':p:h') + return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#cs#csc#GetCommand(buffer) abort @@ -34,8 +30,7 @@ function! ale_linters#cs#csc#GetCommand(buffer) abort " The code is compiled as a module and the output is redirected to a " temporary file. - return ale#path#CdString(s:GetWorkingDirectory(a:buffer)) - \ . 'csc /unsafe' + return 'csc /unsafe' \ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options')) \ . ale#Pad(l:lib_option) \ . ale#Pad(l:r_option) @@ -57,8 +52,7 @@ function! ale_linters#cs#csc#Handle(buffer, lines) abort \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', \] let l:output = [] - - let l:dir = s:GetWorkingDirectory(a:buffer) + let l:dir = ale_linters#cs#csc#GetCwd(a:buffer) for l:match in ale#util#GetMatches(a:lines, l:patterns) if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' @@ -89,6 +83,7 @@ call ale#linter#Define('cs',{ \ 'name': 'csc', \ 'output_stream': 'stdout', \ 'executable': 'csc', +\ 'cwd': function('ale_linters#cs#csc#GetCwd'), \ 'command': function('ale_linters#cs#csc#GetCommand'), \ 'callback': 'ale_linters#cs#csc#Handle', \ 'lint_file': 1 diff --git a/sources_non_forked/ale/ale_linters/cs/mcsc.vim b/sources_non_forked/ale/ale_linters/cs/mcsc.vim index 0e4e5667..2dd46661 100644 --- a/sources_non_forked/ale/ale_linters/cs/mcsc.vim +++ b/sources_non_forked/ale/ale_linters/cs/mcsc.vim @@ -3,14 +3,10 @@ call ale#Set('cs_mcsc_source', '') call ale#Set('cs_mcsc_assembly_path', []) call ale#Set('cs_mcsc_assemblies', []) -function! s:GetWorkingDirectory(buffer) abort - let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source') +function! ale_linters#cs#mcsc#GetCwd(buffer) abort + let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source') - if !empty(l:working_directory) - return l:working_directory - endif - - return expand('#' . a:buffer . ':p:h') + return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#cs#mcsc#GetCommand(buffer) abort @@ -34,8 +30,7 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort " The code is compiled as a module and the output is redirected to a " temporary file. - return ale#path#CdString(s:GetWorkingDirectory(a:buffer)) - \ . 'mcs -unsafe' + return 'mcs -unsafe' \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options')) \ . ale#Pad(l:lib_option) \ . ale#Pad(l:r_option) @@ -58,7 +53,7 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort \] let l:output = [] - let l:dir = s:GetWorkingDirectory(a:buffer) + let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer) for l:match in ale#util#GetMatches(a:lines, l:patterns) if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' @@ -89,6 +84,7 @@ call ale#linter#Define('cs',{ \ 'name': 'mcsc', \ 'output_stream': 'stderr', \ 'executable': 'mcs', +\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'), \ 'command': function('ale_linters#cs#mcsc#GetCommand'), \ 'callback': 'ale_linters#cs#mcsc#Handle', \ 'lint_file': 1 diff --git a/sources_non_forked/ale/ale_linters/cuda/clangd.vim b/sources_non_forked/ale/ale_linters/cuda/clangd.vim new file mode 100644 index 00000000..bfda821b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cuda/clangd.vim @@ -0,0 +1,23 @@ +" Author: Tommy Chiang +" Description: Clangd language server for CUDA (modified from Andrey +" Melentyev's implementation for C++) + +call ale#Set('cuda_clangd_executable', 'clangd') +call ale#Set('cuda_clangd_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#cuda#clangd#GetCommand(buffer) abort + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options')) + \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') +endfunction + +call ale#linter#Define('cuda', { +\ 'name': 'clangd', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')}, +\ 'command': function('ale_linters#cuda#clangd#GetCommand'), +\ 'project_root': function('ale#c#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/d/dmd.vim b/sources_non_forked/ale/ale_linters/d/dmd.vim index 14461ae6..f38e812c 100644 --- a/sources_non_forked/ale/ale_linters/d/dmd.vim +++ b/sources_non_forked/ale/ale_linters/d/dmd.vim @@ -1,64 +1,106 @@ " Author: w0rp " Description: "dmd for D files" -function! ale_linters#d#dmd#GetDUBCommand(buffer) abort +function! s:GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. - if !executable('dub') + if executable('dub') " Returning an empty string skips to the DMD command. - return '' + let l:config = ale#d#FindDUBConfig(a:buffer) + + " To support older dub versions, we just change the directory to the + " directory where we found the dub config, and then run `dub describe` + " from that directory. + if !empty(l:config) + return [fnamemodify(l:config, ':h'), 'dub describe --data-list + \ --data=import-paths + \ --data=string-import-paths + \ --data=versions + \ --data=debug-versions + \'] + endif endif - let l:dub_file = ale#d#FindDUBConfig(a:buffer) - - if empty(l:dub_file) - return '' - endif - - " To support older dub versions, we just change the directory to - " the directory where we found the dub config, and then run `dub describe` - " from that directory. - return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h')) - \ . ' && dub describe --import-paths' + return ['', ''] endfunction function! ale_linters#d#dmd#RunDUBCommand(buffer) abort - let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer) + let [l:cwd, l:command] = s:GetDUBCommand(a:buffer) if empty(l:command) " If we can't run DUB, just run DMD. return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) endif - return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand')) + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#d#dmd#DMDCommand'), + \ {'cwd': l:cwd}, + \) endfunction function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort let l:import_list = [] + let l:str_import_list = [] + let l:versions_list = [] + let l:deb_versions_list = [] + let l:list_ind = 1 + let l:seen_line = 0 - " Build a list of import paths generated from DUB, if available. + " Build a list of options generated from DUB, if available. + " DUB output each path or version on a single line. + " Each list is separated by a blank line. + " Empty list are represented by a blank line (followed and/or + " preceded by a separation blank line) for l:line in a:dub_output + " line still has end of line char on windows + let l:line = substitute(l:line, '[\r\n]*$', '', '') + if !empty(l:line) - " The arguments must be '-Ifilename', not '-I filename' - call add(l:import_list, '-I' . ale#Escape(l:line)) + if l:list_ind == 1 + call add(l:import_list, '-I' . ale#Escape(l:line)) + elseif l:list_ind == 2 + call add(l:str_import_list, '-J' . ale#Escape(l:line)) + elseif l:list_ind == 3 + call add(l:versions_list, '-version=' . ale#Escape(l:line)) + elseif l:list_ind == 4 + call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line)) + endif + + let l:seen_line = 1 + elseif !l:seen_line + " if list is empty must skip one empty line + let l:seen_line = 1 + else + let l:seen_line = 0 + let l:list_ind += 1 endif endfor - return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t' + return 'dmd ' . join(l:import_list) . ' ' . + \ join(l:str_import_list) . ' ' . + \ join(l:versions_list) . ' ' . + \ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t' endfunction function! ale_linters#d#dmd#Handle(buffer, lines) abort " Matches patterns lines like the following: " /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this') " /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read - let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)' + let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$' let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') for l:match in ale#util#GetMatches(a:lines, l:pattern) + " If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute. + " As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already + let l:fname = ale#path#GetAbsPath(l:dir, l:match[1]) call add(l:output, { - \ 'lnum': l:match[1], - \ 'col': l:match[2], - \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E', - \ 'text': l:match[4], + \ 'filename': l:fname, + \ 'lnum': l:match[2], + \ 'col': l:match[4], + \ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E', + \ 'text': l:match[6], \}) endfor diff --git a/sources_non_forked/ale/ale_linters/dafny/dafny.vim b/sources_non_forked/ale/ale_linters/dafny/dafny.vim index b5b90675..2a9f761a 100644 --- a/sources_non_forked/ale/ale_linters/dafny/dafny.vim +++ b/sources_non_forked/ale/ale_linters/dafny/dafny.vim @@ -6,7 +6,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'bufnr': a:buffer, + \ 'filename': l:match[1], \ 'col': l:match[3] + 0, \ 'lnum': l:match[2] + 0, \ 'text': l:match[5], @@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort \ }) endfor + for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)') + call add(l:output, { + \ 'filename': l:match[1], + \ 'col': l:match[3] + 0, + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': 'E', + \ }) + endfor + return l:output endfunction +function! ale_linters#dafny#dafny#GetCommand(buffer) abort + return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit')) +endfunction + +call ale#Set('dafny_dafny_timelimit', 10) call ale#linter#Define('dafny', { \ 'name': 'dafny', \ 'executable': 'dafny', -\ 'command': 'dafny %s /compile:0', +\ 'command': function('ale_linters#dafny#dafny#GetCommand'), \ 'callback': 'ale_linters#dafny#dafny#Handle', \ 'lint_file': 1, \ }) diff --git a/sources_non_forked/ale/ale_linters/dart/analysis_server.vim b/sources_non_forked/ale/ale_linters/dart/analysis_server.vim new file mode 100644 index 00000000..a6870da9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/analysis_server.vim @@ -0,0 +1,29 @@ +" Author: Nelson Yeung +" Description: Check Dart files with dart analysis server LSP + +call ale#Set('dart_analysis_server_executable', 'dart') + +function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort + " Note: pub only looks for pubspec.yaml, there's no point in adding + " support for pubspec.yml + let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml') + + return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.' +endfunction + +function! ale_linters#dart#analysis_server#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable') + let l:dart = resolve(exepath(l:executable)) + + return '%e ' + \ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot' + \ . ' --lsp' +endfunction + +call ale#linter#Define('dart', { +\ 'name': 'analysis_server', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')}, +\ 'command': function('ale_linters#dart#analysis_server#GetCommand'), +\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim b/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim new file mode 100644 index 00000000..5a97d315 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim @@ -0,0 +1,31 @@ +call ale#Set('desktop_desktop_file_validate_options', '') + +" Example matches for pattern: +" +" foo.desktop: warning: key "TerminalOptions" in group ... +" foo.desktop: error: action "new-private-window" is defined, ... +let s:pattern = '\v^(.+): ([a-z]+): (.+)$' + +function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort + " The error format doesn't specify lines, so we can just put all of the + " errors on line 1. + return ale#util#MapMatches(a:lines, s:pattern, {match -> { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': match[2] is? 'error' ? 'E' : 'W', + \ 'text': match[3], + \}}) +endfunction + +call ale#linter#Define('desktop', { +\ 'name': 'desktop_file_validate', +\ 'aliases': ['desktop-file-validate'], +\ 'executable': 'desktop-file-validate', +\ 'command': {b -> +\ '%e' +\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options')) +\ . ' %t' +\ }, +\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle', +\ 'output_stream': 'both', +\}) diff --git a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim index e57cd76d..e83cfdfd 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim @@ -9,7 +9,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort " " /dev/stdin:19 DL3001 Pipe chain should start with a raw value. " /dev/stdin:19:3 unexpected thing - let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$' + let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -24,9 +24,19 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort let l:colnum = l:match[2] + 0 endif - let l:type = 'W' - let l:text = l:match[6] - let l:detail = l:match[6] + " Shellcheck knows a 'style' severity - pin it to info level as well. + if l:match[7] is# 'style' + let l:type = 'I' + elseif l:match[7] is# 'info' + let l:type = 'I' + elseif l:match[7] is# 'warning' + let l:type = 'W' + else + let l:type = 'E' + endif + + let l:text = l:match[8] + let l:detail = l:match[8] let l:domain = 'https://github.com/hadolint/hadolint/wiki/' if l:match[4] is# 'SC' @@ -82,12 +92,15 @@ endfunction function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer) + let l:opts = '--no-color -' if l:command is# 'docker' - return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image') + return printf('docker run --rm -i %s hadolint %s', + \ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'), + \ l:opts) endif - return 'hadolint -' + return 'hadolint ' . l:opts endfunction diff --git a/sources_non_forked/ale/ale_linters/elixir/credo.vim b/sources_non_forked/ale/ale_linters/elixir/credo.vim index 7c298502..d6a861f4 100644 --- a/sources_non_forked/ale/ale_linters/elixir/credo.vim +++ b/sources_non_forked/ale/ale_linters/elixir/credo.vim @@ -45,19 +45,27 @@ function! ale_linters#elixir#credo#GetMode() abort endif endfunction -function! ale_linters#elixir#credo#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer) - let l:mode = ale_linters#elixir#credo#GetMode() +function! ale_linters#elixir#credo#GetConfigFile() abort + let l:config_file = get(g:, 'ale_elixir_credo_config_file', '') - return ale#path#CdString(l:project_root) - \ . 'mix help credo && ' + if empty(l:config_file) + return '' + endif + + return ' --config-file ' . l:config_file +endfunction + +function! ale_linters#elixir#credo#GetCommand(buffer) abort + return 'mix help credo && ' \ . 'mix credo ' . ale_linters#elixir#credo#GetMode() + \ . ale_linters#elixir#credo#GetConfigFile() \ . ' --format=flycheck --read-from-stdin %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'credo', \ 'executable': 'mix', +\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'), \ 'command': function('ale_linters#elixir#credo#GetCommand'), \ 'callback': 'ale_linters#elixir#credo#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim index c7da7757..9b8a5cda 100644 --- a/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim +++ b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim @@ -25,17 +25,10 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - - return ale#path#CdString(l:project_root) - \ . ' mix help dialyzer && mix dialyzer' -endfunction - call ale#linter#Define('elixir', { \ 'name': 'dialyxir', \ 'executable': 'mix', -\ 'command': function('ale_linters#elixir#dialyxir#GetCommand'), +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), +\ 'command': 'mix help dialyzer && mix dialyzer', \ 'callback': 'ale_linters#elixir#dialyxir#Handle', \}) - diff --git a/sources_non_forked/ale/ale_linters/elixir/dogma.vim b/sources_non_forked/ale/ale_linters/elixir/dogma.vim index 1c721158..28e7f420 100644 --- a/sources_non_forked/ale/ale_linters/elixir/dogma.vim +++ b/sources_non_forked/ale/ale_linters/elixir/dogma.vim @@ -29,17 +29,11 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#dogma#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - - return ale#path#CdString(l:project_root) - \ . ' mix help dogma && mix dogma %s --format=flycheck' -endfunction - call ale#linter#Define('elixir', { \ 'name': 'dogma', \ 'executable': 'mix', -\ 'command': function('ale_linters#elixir#dogma#GetCommand'), +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), +\ 'command': 'mix help dogma && mix dogma %s --format=flycheck', \ 'lint_file': 1, \ 'callback': 'ale_linters#elixir#dogma#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/elixir/mix.vim b/sources_non_forked/ale/ale_linters/elixir/mix.vim index abf5d0aa..948c6d36 100644 --- a/sources_non_forked/ale/ale_linters/elixir/mix.vim +++ b/sources_non_forked/ale/ale_linters/elixir/mix.vim @@ -30,22 +30,15 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort endfunction function! ale_linters#elixir#mix#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - let l:temp_dir = ale#command#CreateDirectory(a:buffer) - let l:mix_build_path = has('win32') - \ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&' - \ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) - - return ale#path#CdString(l:project_root) - \ . l:mix_build_path - \ . ' mix compile %s' + return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'mix', \ 'executable': 'mix', +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': function('ale_linters#elixir#mix#GetCommand'), \ 'callback': 'ale_linters#elixir#mix#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/elm/make.vim b/sources_non_forked/ale/ale_linters/elm/make.vim index 6b93257f..48ed82f3 100644 --- a/sources_non_forked/ale/ale_linters/elm/make.vim +++ b/sources_non_forked/ale/ale_linters/elm/make.vim @@ -186,20 +186,19 @@ function! ale_linters#elm#make#IsTest(buffer) abort endif endfunction +function! ale_linters#elm#make#GetCwd(buffer) abort + let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) + + return !empty(l:root_dir) ? l:root_dir : '' +endfunction + " Return the command to execute the linter in the projects directory. " If it doesn't, then this will fail when imports are needed. function! ale_linters#elm#make#GetCommand(buffer) abort let l:executable = ale_linters#elm#make#GetExecutable(a:buffer) - let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) let l:is_using_elm_test = l:executable =~# 'elm-test$' - if empty(l:root_dir) - let l:dir_set_cmd = '' - else - let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && ' - endif - " elm-test needs to know the path of elm-make if elm isn't installed globally. " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler if l:is_v19 && l:is_using_elm_test @@ -213,7 +212,9 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " a sort of flag to tell the compiler not to generate an output file, " which is why this is hard coded here. " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253 - return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t' + return '%e make --report=json --output=/dev/null' + \ . l:elm_test_compiler_flag + \ . '%t' endfunction function! ale_linters#elm#make#GetExecutable(buffer) abort @@ -235,6 +236,7 @@ call ale#linter#Define('elm', { \ 'name': 'make', \ 'executable': function('ale_linters#elm#make#GetExecutable'), \ 'output_stream': 'both', +\ 'cwd': function('ale_linters#elm#make#GetCwd'), \ 'command': function('ale_linters#elm#make#GetCommand'), \ 'callback': 'ale_linters#elm#make#Handle' \}) diff --git a/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim index 395647a0..a97c9520 100644 --- a/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim +++ b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim @@ -3,6 +3,11 @@ let g:ale_erlang_dialyzer_executable = \ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer') +let g:ale_erlang_dialyzer_options = +\ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns' +\ . ' -Werror_handling' +\ . ' -Wrace_conditions' +\ . ' -Wunderspecs') let g:ale_erlang_dialyzer_plt_file = \ get(g:, 'ale_erlang_dialyzer_plt_file', '') let g:ale_erlang_dialyzer_rebar3_profile = @@ -47,13 +52,12 @@ function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort endfunction function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options') + let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer)) \ . ' -n' \ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer)) - \ . ' -Wunmatched_returns' - \ . ' -Werror_handling' - \ . ' -Wrace_conditions' - \ . ' -Wunderspecs' + \ . ' ' . l:options \ . ' %s' return l:command diff --git a/sources_non_forked/ale/ale_linters/erlang/erlc.vim b/sources_non_forked/ale/ale_linters/erlang/erlc.vim index a83bacc3..e78dc341 100644 --- a/sources_non_forked/ale/ale_linters/erlang/erlc.vim +++ b/sources_non_forked/ale/ale_linters/erlang/erlc.vim @@ -1,14 +1,22 @@ " Author: Magnus Ottenklinger - https://github.com/evnu +let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc') let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '') +function! ale_linters#erlang#erlc#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'erlang_erlc_executable') +endfunction + function! ale_linters#erlang#erlc#GetCommand(buffer) abort let l:output_file = ale#util#Tempname() call ale#command#ManageFile(a:buffer, l:output_file) - return 'erlc -o ' . ale#Escape(l:output_file) - \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') - \ . ' %t' + let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer)) + \ . ' -o ' . ale#Escape(l:output_file) + \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') + \ . ' %t' + + return l:command endfunction function! ale_linters#erlang#erlc#Handle(buffer, lines) abort @@ -90,7 +98,7 @@ endfunction call ale#linter#Define('erlang', { \ 'name': 'erlc', -\ 'executable': 'erlc', +\ 'executable': function('ale_linters#erlang#erlc#GetExecutable'), \ 'command': function('ale_linters#erlang#erlc#GetCommand'), \ 'callback': 'ale_linters#erlang#erlc#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim index 1dfb6daa..5210c5a8 100644 --- a/sources_non_forked/ale/ale_linters/go/gobuild.vim +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -10,8 +10,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_gobuild_options') " Run go test in local directory with relative path - return ale#path#BufferCdString(a:buffer) - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' @@ -50,6 +49,7 @@ call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gobuild#GetCommand'), \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', diff --git a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim index dd0e975a..2c4b1a4f 100644 --- a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim +++ b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim @@ -12,14 +12,12 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort if l:lint_package - return ale#path#BufferCdString(a:buffer) - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e run ' \ . l:options endif - return ale#path#BufferCdString(a:buffer) - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e run ' \ . ale#Escape(l:filename) \ . ' ' . l:options @@ -53,6 +51,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'golangci-lint', \ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#golangci_lint#GetCommand'), \ 'callback': 'ale_linters#go#golangci_lint#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/gometalinter.vim b/sources_non_forked/ale/ale_linters/go/gometalinter.vim index eed9550a..ac33a9f3 100644 --- a/sources_non_forked/ale/ale_linters/go/gometalinter.vim +++ b/sources_non_forked/ale/ale_linters/go/gometalinter.vim @@ -13,14 +13,12 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort " BufferCdString is used so that we can be sure the paths output from gometalinter can " be calculated to absolute paths in the Handler if l:lint_package - return ale#path#BufferCdString(a:buffer) - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif - return ale#path#BufferCdString(a:buffer) - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e' \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename)) \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' @@ -53,6 +51,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gometalinter', \ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gometalinter#GetCommand'), \ 'callback': 'ale_linters#go#gometalinter#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim index dcff5ec7..f3f1bd6b 100644 --- a/sources_non_forked/ale/ale_linters/go/gopls.vim +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -4,6 +4,7 @@ call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_options', '--mode stdio') +call ale#Set('go_gopls_init_options', {}) function! ale_linters#go#gopls#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) @@ -31,4 +32,5 @@ call ale#linter#Define('go', { \ 'executable': {b -> ale#Var(b, 'go_gopls_executable')}, \ 'command': function('ale_linters#go#gopls#GetCommand'), \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), +\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/go/gosimple.vim b/sources_non_forked/ale/ale_linters/go/gosimple.vim index ad52c621..490d15a9 100644 --- a/sources_non_forked/ale/ale_linters/go/gosimple.vim +++ b/sources_non_forked/ale/ale_linters/go/gosimple.vim @@ -1,15 +1,11 @@ " Author: Ben Reedy " Description: gosimple for Go files -function! ale_linters#go#gosimple#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) . ' ' - \ . ale#go#EnvString(a:buffer) . 'gosimple .' -endfunction - call ale#linter#Define('go', { \ 'name': 'gosimple', \ 'executable': 'gosimple', -\ 'command': function('ale_linters#go#gosimple#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'}, \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim index 6a5149ca..8fd6df27 100644 --- a/sources_non_forked/ale/ale_linters/go/gotype.vim +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -1,19 +1,23 @@ " Author: Jelte Fennema " Description: gotype for Go files -function! ale_linters#go#gotype#GetCommand(buffer) abort +function! ale_linters#go#gotype#GetExecutable(buffer) abort if expand('#' . a:buffer . ':p') =~# '_test\.go$' return '' endif - return ale#path#BufferCdString(a:buffer) . ' ' - \ . ale#go#EnvString(a:buffer) . 'gotype -e .' + return 'gotype' +endfunction + +function! ale_linters#go#gotype#GetCommand(buffer) abort + return ale#go#EnvString(a:buffer) . 'gotype -e .' endfunction call ale#linter#Define('go', { \ 'name': 'gotype', \ 'output_stream': 'stderr', -\ 'executable': 'gotype', +\ 'executable': function('ale_linters#go#gotype#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gotype#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim index dddafe17..5da8261c 100644 --- a/sources_non_forked/ale/ale_linters/go/govet.vim +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -10,8 +10,7 @@ call ale#Set('go_govet_options', '') function! ale_linters#go#govet#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_govet_options') - return ale#path#BufferCdString(a:buffer) . ' ' - \ . ale#go#EnvString(a:buffer) + return ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' .' @@ -22,6 +21,7 @@ call ale#linter#Define('go', { \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#govet#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index ed40c6c2..84e70d58 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -5,28 +5,24 @@ call ale#Set('go_staticcheck_options', '') call ale#Set('go_staticcheck_lint_package', 0) function! ale_linters#go#staticcheck#GetCommand(buffer) abort - let l:filename = expand('#' . a:buffer . ':t') let l:options = ale#Var(a:buffer, 'go_staticcheck_options') let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package') let l:env = ale#go#EnvString(a:buffer) - " BufferCdString is used so that we can be sure the paths output from - " staticcheck can be calculated to absolute paths in the Handler if l:lint_package - return ale#path#BufferCdString(a:buffer) - \ . l:env . 'staticcheck' + return l:env . 'staticcheck' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif - return ale#path#BufferCdString(a:buffer) - \ . l:env . 'staticcheck' + return l:env . 'staticcheck' \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' ' . ale#Escape(l:filename) + \ . ' %s:t' endfunction call ale#linter#Define('go', { \ 'name': 'staticcheck', \ 'executable': 'staticcheck', +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#staticcheck#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', diff --git a/sources_non_forked/ale/ale_linters/graphql/eslint.vim b/sources_non_forked/ale/ale_linters/graphql/eslint.vim index aed1a371..a98233e9 100644 --- a/sources_non_forked/ale/ale_linters/graphql/eslint.vim +++ b/sources_non_forked/ale/ale_linters/graphql/eslint.vim @@ -4,6 +4,7 @@ call ale#linter#Define('graphql', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/graphql/gqlint.vim b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim index d5029de1..6f1ca54a 100644 --- a/sources_non_forked/ale/ale_linters/graphql/gqlint.vim +++ b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim @@ -1,15 +1,10 @@ " Author: Michiel Westerbeek " Description: Linter for GraphQL Schemas -function! ale_linters#graphql#gqlint#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . 'gqlint' - \ . ' --reporter=simple %t' -endfunction - call ale#linter#Define('graphql', { \ 'name': 'gqlint', \ 'executable': 'gqlint', -\ 'command': function('ale_linters#graphql#gqlint#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': 'gqlint --reporter=simple %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) diff --git a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim index f3f248f5..1bb31ebb 100644 --- a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim @@ -4,8 +4,7 @@ call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . 'cabal exec -- ghc ' + return 'cabal exec -- ghc ' \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options') \ . ' %t' endfunction @@ -15,6 +14,7 @@ call ale#linter#Define('haskell', { \ 'aliases': ['cabal-ghc'], \ 'output_stream': 'stderr', \ 'executable': 'cabal', +\ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/haskell/hls.vim b/sources_non_forked/ale/ale_linters/haskell/hls.vim new file mode 100644 index 00000000..ae0556a4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/hls.vim @@ -0,0 +1,63 @@ +" Author: Yen3 +" Description: A language server for haskell +" The file is based on hie.vim (author: Luxed +" ). It search more project root files. +" +call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') + +function! ale_linters#haskell#hls#FindRootFile(buffer) abort + let l:serach_root_files = [ + \ 'stack.yaml', + \ 'cabal.project', + \ 'package.yaml', + \ 'hie.yaml' + \ ] + + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:root_file in l:serach_root_files + if filereadable(l:path . l:root_file) + return l:path + endif + endfor + endfor + + return '' +endfunction + +function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort + " Search for the project file first + let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer) + + " If it's empty, search for the cabal file + if empty(l:project_file) + " Search all of the paths except for the root filesystem path. + let l:paths = join( + \ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2], + \ ',' + \) + let l:project_file = globpath(l:paths, '*.cabal') + endif + + " If we still can't find one, use the current file. + if empty(l:project_file) + let l:project_file = expand('#' . a:buffer . ':p') + endif + + return fnamemodify(l:project_file, ':h') +endfunction + +function! ale_linters#haskell#hls#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hls_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, + \ 'haskell-language-server-wrapper') + \ . ' --lsp' +endfunction + +call ale#linter#Define('haskell', { +\ 'name': 'hls', +\ 'lsp': 'stdio', +\ 'command': function('ale_linters#haskell#hls#GetCommand'), +\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, +\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim index c345fe43..51ecc744 100644 --- a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim @@ -4,8 +4,7 @@ call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . ale#handlers#haskell#GetStackExecutable(a:buffer) + return ale#handlers#haskell#GetStackExecutable(a:buffer) \ . ' ghc -- ' \ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ' %t' @@ -16,6 +15,7 @@ call ale#linter#Define('haskell', { \ 'aliases': ['stack-ghc'], \ 'output_stream': 'stderr', \ 'executable': function('ale#handlers#haskell#GetStackExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/html/angular.vim b/sources_non_forked/ale/ale_linters/html/angular.vim new file mode 100644 index 00000000..f550d665 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/angular.vim @@ -0,0 +1,52 @@ +" Author: w0rp +" Description: tsserver integration for ALE + +call ale#Set('html_angular_executable', 'ngserver') +call ale#Set('html_angular_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#html#angular#GetProjectRoot(buffer) abort + return ale#path#Dirname( + \ ale#path#FindNearestDirectory(a:buffer, 'node_modules') + \) +endfunction + +function! ale_linters#html#angular#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'html_angular', [ + \ 'node_modules/@angular/language-server/bin/ngserver', + \ 'node_modules/@angular/language-server/index.js', + \]) +endfunction + +function! ale_linters#html#angular#GetCommand(buffer) abort + let l:language_service_dir = ale#path#Simplify( + \ ale#path#FindNearestDirectory( + \ a:buffer, + \ 'node_modules/@angular/language-service' + \ ) + \) + + if empty(l:language_service_dir) + return '' + endif + + let l:language_service_dir = fnamemodify(l:language_service_dir, ':h') + let l:typescript_dir = ale#path#Simplify( + \ fnamemodify(l:language_service_dir, ':h:h') + \ . '/typescript' + \) + let l:executable = ale_linters#html#angular#GetExecutable(a:buffer) + + return ale#node#Executable(a:buffer, l:executable) + \ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir) + \ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir) + \ . ' --stdio' +endfunction + +call ale#linter#Define('html', { +\ 'name': 'angular', +\ 'aliases': ['angular-language-server'], +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#html#angular#GetExecutable'), +\ 'command': function('ale_linters#html#angular#GetCommand'), +\ 'project_root': function('ale_linters#html#angular#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/inko/inko.vim b/sources_non_forked/ale/ale_linters/inko/inko.vim new file mode 100644 index 00000000..11558897 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/inko/inko.vim @@ -0,0 +1,33 @@ +" Author: Yorick Peterse +" Description: linting of Inko source code using the Inko compiler + +call ale#Set('inko_inko_executable', 'inko') + +function! ale_linters#inko#inko#GetCommand(buffer) abort + let l:include = '' + + " Include the tests source directory, but only for test files. + if expand('#' . a:buffer . ':p') =~? '\vtests[/\\]test[/\\]' + let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'tests') + + if isdirectory(l:test_dir) + let l:include = '--include ' . ale#Escape(l:test_dir) + endif + endif + + " We use %s instead of %t so the compiler determines the correct module + " names for the file being edited. Not doing so may lead to errors in + " certain cases. + return '%e build --check --format=json' + \ . ale#Pad(l:include) + \ . ' %s' +endfunction + +call ale#linter#Define('inko', { +\ 'name': 'inko', +\ 'executable': {b -> ale#Var(b, 'inko_inko_executable')}, +\ 'command': function('ale_linters#inko#inko#GetCommand'), +\ 'callback': 'ale#handlers#inko#Handle', +\ 'output_stream': 'stderr', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index ec7339d1..f00734e0 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -9,7 +9,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort let l:output = [] " modern checkstyle versions - let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$' + 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, { diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim index 8bc09039..adfd1b09 100644 --- a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -29,28 +29,28 @@ function! ale_linters#java#eclipselsp#JarPath(buffer) abort endif " Search jar file within repository path when manually built using mvn - let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within VSCode extensions folder. - let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within unzipped tar.gz file - let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within system package path - let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1) + let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index a5e57e6c..760f234c 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -9,16 +9,16 @@ call ale#Set('java_javac_classpath', '') call ale#Set('java_javac_sourcepath', '') function! ale_linters#java#javac#RunWithImportPaths(buffer) abort - let l:command = ale#maven#BuildClasspathCommand(a:buffer) + let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) " Try to use Gradle if Maven isn't available. if empty(l:command) - let l:command = ale#gradle#BuildClasspathCommand(a:buffer) + let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) endif " Try to use Ant if Gradle and Maven aren't available if empty(l:command) - let l:command = ale#ant#BuildClasspathCommand(a:buffer) + let [l:cwd, l:command] = ale#ant#BuildClasspathCommand(a:buffer) endif if empty(l:command) @@ -28,7 +28,8 @@ function! ale_linters#java#javac#RunWithImportPaths(buffer) abort return ale#command#Run( \ a:buffer, \ l:command, - \ function('ale_linters#java#javac#GetCommand') + \ function('ale_linters#java#javac#GetCommand'), + \ {'cwd': l:cwd}, \) endfunction @@ -110,8 +111,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort " Always run javac from the directory the file is in, so we can resolve " relative paths correctly. - return ale#path#BufferCdString(a:buffer) - \ . '%e -Xlint' + return '%e -Xlint' \ . ale#Pad(l:cp_option) \ . ale#Pad(l:sp_option) \ . ' -d ' . ale#Escape(l:class_file_directory) @@ -154,6 +154,7 @@ endfunction call ale#linter#Define('java', { \ 'name': 'javac', \ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#java#javac#RunWithImportPaths'), \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#java#javac#Handle', diff --git a/sources_non_forked/ale/ale_linters/javascript/eslint.vim b/sources_non_forked/ale/ale_linters/javascript/eslint.vim index 31fb413f..cf4de6ec 100644 --- a/sources_non_forked/ale/ale_linters/javascript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/javascript/eslint.vim @@ -5,6 +5,7 @@ call ale#linter#Define('javascript', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/xo.vim b/sources_non_forked/ale/ale_linters/javascript/xo.vim index e24f4a82..5e04ad5c 100644 --- a/sources_non_forked/ale/ale_linters/javascript/xo.vim +++ b/sources_non_forked/ale/ale_linters/javascript/xo.vim @@ -1,26 +1,9 @@ " Author: Daniel Lupu " Description: xo for JavaScript files -call ale#Set('javascript_xo_executable', 'xo') -call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('javascript_xo_options', '') - -function! ale_linters#javascript#xo#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ - \ 'node_modules/.bin/xo', - \]) -endfunction - -function! ale_linters#javascript#xo#GetCommand(buffer) abort - return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer)) - \ . ' ' . ale#Var(a:buffer, 'javascript_xo_options') - \ . ' --reporter json --stdin --stdin-filename %s' -endfunction - -" xo uses eslint and the output format is the same call ale#linter#Define('javascript', { \ 'name': 'xo', -\ 'executable': function('ale_linters#javascript#xo#GetExecutable'), -\ 'command': function('ale_linters#javascript#xo#GetCommand'), -\ 'callback': 'ale#handlers#eslint#HandleJSON', +\ 'executable': function('ale#handlers#xo#GetExecutable'), +\ 'command': function('ale#handlers#xo#GetLintCommand'), +\ 'callback': 'ale#handlers#xo#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/json/jq.vim b/sources_non_forked/ale/ale_linters/json/jq.vim new file mode 100644 index 00000000..2f36a29e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/jq.vim @@ -0,0 +1,24 @@ +" Author: jD91mZM2 +call ale#Set('json_jq_executable', 'jq') +call ale#Set('json_jq_options', '') +call ale#Set('json_jq_filters', '.') + +" Matches patterns like the following: +" parse error: Expected another key-value pair at line 4, column 3 +let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$' + +function! ale_linters#json#jq#Handle(buffer, lines) abort + return ale#util#MapMatches(a:lines, s:pattern, {match -> { + \ 'text': match[1], + \ 'lnum': match[2] + 0, + \ 'col': match[3] + 0, + \}}) +endfunction + +call ale#linter#Define('json', { +\ 'name': 'jq', +\ 'executable': {b -> ale#Var(b, 'json_jq_executable')}, +\ 'output_stream': 'stderr', +\ 'command': '%e', +\ 'callback': 'ale_linters#json#jq#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/json/spectral.vim b/sources_non_forked/ale/ale_linters/json/spectral.vim new file mode 100644 index 00000000..c7d56234 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/spectral.vim @@ -0,0 +1,14 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +call ale#Set('json_spectral_executable', 'spectral') +call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) + +call ale#linter#Define('json', { +\ 'name': 'spectral', +\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [ +\ 'node_modules/.bin/spectral', +\ ])}, +\ 'command': '%e lint --ignore-unknown-format -q -f text %t', +\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' +\}) diff --git a/sources_non_forked/ale/ale_linters/julia/languageserver.vim b/sources_non_forked/ale/ale_linters/julia/languageserver.vim index 564bec39..999ad815 100644 --- a/sources_non_forked/ale/ale_linters/julia/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/julia/languageserver.vim @@ -6,9 +6,9 @@ call ale#Set('julia_executable', 'julia') function! ale_linters#julia#languageserver#GetCommand(buffer) abort let l:julia_executable = ale#Var(a:buffer, 'julia_executable') - let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);' + let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);' - return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) + return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) endfunction call ale#linter#Define('julia', { diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 66c075be..e8bc924d 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -15,20 +15,15 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort let l:command = '' " exec maven/gradle only if classpath is not set - if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' + if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath')) return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') - - if !empty(l:pom_path) && executable('mvn') - let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' - endif + let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) " Try to use Gradle if Maven isn't available. if empty(l:command) - let l:command = ale#gradle#BuildClasspathCommand(a:buffer) + let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) endif if empty(l:command) @@ -38,7 +33,8 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort return ale#command#Run( \ a:buffer, \ l:command, - \ function('ale_linters#kotlin#kotlinc#GetCommand') + \ function('ale_linters#kotlin#kotlinc#GetCommand'), + \ {'cwd': l:cwd}, \) endfunction diff --git a/sources_non_forked/ale/ale_linters/markdown/vale.vim b/sources_non_forked/ale/ale_linters/markdown/vale.vim index 838c4db2..06a64416 100644 --- a/sources_non_forked/ale/ale_linters/markdown/vale.vim +++ b/sources_non_forked/ale/ale_linters/markdown/vale.vim @@ -1,9 +1,24 @@ " Author: chew-z https://github.com/chew-z " Description: vale for Markdown files +call ale#Set('markdown_vale_executable', 'vale') +call ale#Set('markdown_vale_input_file', '%t') +call ale#Set('markdown_vale_options', '') + +function! ale_linters#markdown#vale#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'markdown_vale_executable') + let l:input_file = ale#Var(a:buffer, 'markdown_vale_input_file') + + " Defaults to `vale --output=JSON %t` + return ale#Escape(l:executable) + \ . ' --output=JSON ' + \ . ale#Var(a:buffer, 'markdown_vale_options') + \ . ' ' . l:input_file +endfunction + call ale#linter#Define('markdown', { \ 'name': 'vale', -\ 'executable': 'vale', -\ 'command': 'vale --output=JSON %t', +\ 'executable': {b -> ale#Var(b, 'markdown_vale_executable')}, +\ 'command': function('ale_linters#markdown#vale#GetCommand'), \ 'callback': 'ale#handlers#vale#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/mercury/mmc.vim b/sources_non_forked/ale/ale_linters/mercury/mmc.vim index 8a9ccc0e..85969e10 100644 --- a/sources_non_forked/ale/ale_linters/mercury/mmc.vim +++ b/sources_non_forked/ale/ale_linters/mercury/mmc.vim @@ -5,12 +5,9 @@ call ale#Set('mercury_mmc_executable', 'mmc') call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100') function! ale_linters#mercury#mmc#GetCommand(buffer) abort - let l:module_name = expand('#' . a:buffer . ':t:r') - - return ale#path#BufferCdString(a:buffer) - \ . '%e --errorcheck-only ' + return '%e --errorcheck-only ' \ . ale#Var(a:buffer, 'mercury_mmc_options') - \ . ' ' . l:module_name + \ . ' %s:t:r' endfunction function! ale_linters#mercury#mmc#Handle(buffer, lines) abort @@ -34,6 +31,7 @@ call ale#linter#Define('mercury', { \ 'name': 'mmc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'mercury_mmc_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#mercury#mmc#GetCommand'), \ 'callback': 'ale_linters#mercury#mmc#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/nix/nix.vim b/sources_non_forked/ale/ale_linters/nix/nix.vim index 0a0c5c3e..3d91a9ec 100644 --- a/sources_non_forked/ale/ale_linters/nix/nix.vim +++ b/sources_non_forked/ale/ale_linters/nix/nix.vim @@ -1,18 +1,51 @@ " Author: Alistair Bill <@alibabzo> +" Author: Maximilian Bosch " Description: nix-instantiate linter for nix files +function! ale_linters#nix#nix#Command(buffer, output, meta) abort + let l:version = a:output[0][22:] + + if l:version =~# '^\(2.4\|3\).*' + return 'nix-instantiate --log-format internal-json --parse -' + else + return 'nix-instantiate --parse -' + endif +endfunction + function! ale_linters#nix#nix#Handle(buffer, lines) abort - let l:pattern = '^\(.\+\): \(.\+\), at .*:\(\d\+\):\(\d\+\)$' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'lnum': l:match[3] + 0, - \ 'col': l:match[4] + 0, - \ 'text': l:match[1] . ': ' . l:match[2], - \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', - \}) - endfor + if empty(a:lines) + return l:output + endif + + if a:lines[0] =~# '^@nix .*' + for l:line in a:lines + if l:line =~# '^@nix .*' + let l:result = json_decode(strpart(l:line, 4)) + + if has_key(l:result, 'column') + call add(l:output, { + \ 'type': 'E', + \ 'lnum': l:result.line, + \ 'col': l:result.column, + \ 'text': l:result.raw_msg + \}) + endif + endif + endfor + else + let l:pattern = '^\(.\+\): \(.\+\) at .*:\(\d\+\):\(\d\+\)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[3] + 0, + \ 'col': l:match[4] + 0, + \ 'text': l:match[1] . ': ' . substitute(l:match[2], ',$', '', ''), + \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', + \}) + endfor + endif return l:output endfunction @@ -21,6 +54,10 @@ call ale#linter#Define('nix', { \ 'name': 'nix', \ 'output_stream': 'stderr', \ 'executable': 'nix-instantiate', -\ 'command': 'nix-instantiate --parse -', +\ 'command': {buffer -> ale#command#Run( +\ buffer, +\ 'nix-instantiate --version', +\ function('ale_linters#nix#nix#Command') +\ )}, \ 'callback': 'ale_linters#nix#nix#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim new file mode 100644 index 00000000..949bed1c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim @@ -0,0 +1,16 @@ +" Author: jD91mZM2 +" Description: rnix-lsp language client + +function! ale_linters#nix#rnix_lsp#GetProjectRoot(buffer) abort + " rnix-lsp does not yet use the project root, so getting it right is not + " important + return fnamemodify(a:buffer, ':h') +endfunction + +call ale#linter#Define('nix', { +\ 'name': 'rnix_lsp', +\ 'lsp': 'stdio', +\ 'executable': 'rnix-lsp', +\ 'command': '%e', +\ 'project_root': function('ale_linters#nix#rnix_lsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim b/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim new file mode 100644 index 00000000..4ff7419c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim @@ -0,0 +1,13 @@ +" Author: Risto Stevcev +" Description: The official language server for OCaml + +call ale#Set('ocaml_ocamllsp_use_opam', 1) + +call ale#linter#Define('ocaml', { +\ 'name': 'ocamllsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), +\ 'command': function('ale#handlers#ocamllsp#GetCommand'), +\ 'language': function('ale#handlers#ocamllsp#GetLanguage'), +\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim b/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim new file mode 100644 index 00000000..446931a2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim @@ -0,0 +1,58 @@ +" Author: Horacio Sanson + +call ale#Set('openapi_ibm_validator_executable', 'lint-openapi') +call ale#Set('openapi_ibm_validator_options', '') + +function! ale_linters#openapi#ibm_validator#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'openapi_ibm_validator_options')) + \ . ' %t' +endfunction + +function! ale_linters#openapi#ibm_validator#Handle(buffer, lines) abort + let l:output = [] + let l:type = 'E' + let l:message = '' + let l:nr = -1 + + for l:line in a:lines + let l:match = matchlist(l:line, '^errors$') + + if !empty(l:match) + let l:type = 'E' + endif + + let l:match = matchlist(l:line, '^warnings$') + + if !empty(l:match) + let l:type = 'W' + endif + + let l:match = matchlist(l:line, '^ *Message : *\(.\+\)$') + + if !empty(l:match) + let l:message = l:match[1] + endif + + let l:match = matchlist(l:line, '^ *Line *: *\(\d\+\)$') + + if !empty(l:match) + let l:nr = l:match[1] + + call add(l:output, { + \ 'lnum': l:nr + 0, + \ 'col': 0, + \ 'text': l:message, + \ 'type': l:type, + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('openapi', { +\ 'name': 'ibm_validator', +\ 'executable': {b -> ale#Var(b, 'openapi_ibm_validator_executable')}, +\ 'command': function('ale_linters#openapi#ibm_validator#GetCommand'), +\ 'callback': 'ale_linters#openapi#ibm_validator#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/openapi/yamllint.vim b/sources_non_forked/ale/ale_linters/openapi/yamllint.vim new file mode 100644 index 00000000..2b8952cc --- /dev/null +++ b/sources_non_forked/ale/ale_linters/openapi/yamllint.vim @@ -0,0 +1,9 @@ +call ale#Set('yaml_yamllint_executable', 'yamllint') +call ale#Set('yaml_yamllint_options', '') + +call ale#linter#Define('openapi', { +\ 'name': 'yamllint', +\ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, +\ 'command': function('ale#handlers#yamllint#GetCommand'), +\ 'callback': 'ale#handlers#yamllint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/perl6/perl6.vim b/sources_non_forked/ale/ale_linters/perl6/perl6.vim index 68ef4769..444ae4d7 100644 --- a/sources_non_forked/ale/ale_linters/perl6/perl6.vim +++ b/sources_non_forked/ale/ale_linters/perl6/perl6.vim @@ -88,7 +88,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort try let l:json = json_decode(join(a:lines, '')) - catch /E474/ + catch /E474\|E491/ call add(l:output, { \ 'lnum': '1', \ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details', diff --git a/sources_non_forked/ale/ale_linters/php/intelephense.vim b/sources_non_forked/ale/ale_linters/php/intelephense.vim index e9e07d1f..aca619e3 100644 --- a/sources_non_forked/ale/ale_linters/php/intelephense.vim +++ b/sources_non_forked/ale/ale_linters/php/intelephense.vim @@ -18,8 +18,8 @@ function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction -function! ale_linters#php#intelephense#GetInitializationOptions() abort - return ale#Get('php_intelephense_config') +function! ale_linters#php#intelephense#GetInitializationOptions(buffer) abort + return ale#Var(a:buffer, 'php_intelephense_config') endfunction call ale#linter#Define('php', { diff --git a/sources_non_forked/ale/ale_linters/php/phan.vim b/sources_non_forked/ale/ale_linters/php/phan.vim index 53cb1ea9..50c6d6e6 100644 --- a/sources_non_forked/ale/ale_linters/php/phan.vim +++ b/sources_non_forked/ale/ale_linters/php/phan.vim @@ -39,7 +39,7 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$' else " /path/to/some-filename.php:18 ERRORTYPE message - let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$' + let l:pattern = '^\(.*\):\(\d\+\)\s\(\w\+\)\s\(.\+\)$' endif let l:output = [] @@ -49,13 +49,15 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort let l:dict = { \ 'lnum': l:match[4] + 0, \ 'text': l:match[2], + \ 'filename': l:match[3], \ 'type': 'W', \} else let l:dict = { - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[3], + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[4], \ 'type': 'W', + \ 'filename': l:match[1], \} endif diff --git a/sources_non_forked/ale/ale_linters/php/phpcs.vim b/sources_non_forked/ale/ale_linters/php/phpcs.vim index c5a3faa9..3d88ad5d 100644 --- a/sources_non_forked/ale/ale_linters/php/phpcs.vim +++ b/sources_non_forked/ale/ale_linters/php/phpcs.vim @@ -13,8 +13,7 @@ function! ale_linters#php#phpcs#GetCommand(buffer) abort \ ? '--standard=' . ale#Escape(l:standard) \ : '' - return ale#path#BufferCdString(a:buffer) - \ . '%e -s --report=emacs --stdin-path=%s' + return '%e -s --report=emacs --stdin-path=%s' \ . ale#Pad(l:standard_option) \ . ale#Pad(ale#Var(a:buffer, 'php_phpcs_options')) endfunction @@ -49,6 +48,7 @@ call ale#linter#Define('php', { \ 'vendor/bin/phpcs', \ 'phpcs' \ ])}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#php#phpcs#GetCommand'), \ 'callback': 'ale_linters#php#phpcs#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/prolog/swipl.vim b/sources_non_forked/ale/ale_linters/prolog/swipl.vim index 5c601c40..82859eb0 100644 --- a/sources_non_forked/ale/ale_linters/prolog/swipl.vim +++ b/sources_non_forked/ale/ale_linters/prolog/swipl.vim @@ -35,10 +35,11 @@ function! s:Subst(format, vars) abort endfunction function! ale_linters#prolog#swipl#Handle(buffer, lines) abort - let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$' let l:output = [] let l:i = 0 + let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$' + while l:i < len(a:lines) let l:match = matchlist(a:lines[l:i], l:pattern) @@ -72,8 +73,17 @@ function! s:GetErrMsg(i, lines, text) abort let l:i = a:i + 1 let l:text = [] - while l:i < len(a:lines) && a:lines[l:i] =~# '^\s' - call add(l:text, s:Trim(a:lines[l:i])) + let l:pattern = '\v^(ERROR|Warning)?:?(.*)$' + + while l:i < len(a:lines) + let l:match = matchlist(a:lines[l:i], l:pattern) + + if empty(l:match) || empty(l:match[2]) + let l:i += 1 + break + endif + + call add(l:text, s:Trim(l:match[2])) let l:i += 1 endwhile diff --git a/sources_non_forked/ale/ale_linters/proto/protolint.vim b/sources_non_forked/ale/ale_linters/proto/protolint.vim new file mode 100644 index 00000000..2754c7b6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/proto/protolint.vim @@ -0,0 +1,24 @@ +" Author: Yohei Yoshimuta +" Description: run the protolint for Protocol Buffer files + +call ale#Set('proto_protolint_executable', 'protolint') +call ale#Set('proto_protolint_config', '') + +function! ale_linters#proto#protolint#GetCommand(buffer) abort + let l:config = ale#Var(a:buffer, 'proto_protolint_config') + + return '%e lint' + \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') + \ . ' -reporter=unix' + \ . ' %s' +endfunction + +call ale#linter#Define('proto', { +\ 'name': 'protolint', +\ 'lint_file': 1, +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'proto_protolint_executable')}, +\ 'command': function('ale_linters#proto#protolint#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) + diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index fc4ab692..1d49d03f 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -38,30 +38,28 @@ function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort \) endfunction -function! ale_linters#python#flake8#GetCdString(buffer) abort +function! ale_linters#python#flake8#GetCwd(buffer) abort let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory') - let l:cd_string = '' + let l:cwd = '' if l:change_directory is# 'project' let l:project_root = ale#python#FindProjectRootIni(a:buffer) if !empty(l:project_root) - let l:cd_string = ale#path#CdString(l:project_root) + let l:cwd = l:project_root endif endif - if (l:change_directory is# 'project' && empty(l:cd_string)) + if (l:change_directory is# 'project' && empty(l:cwd)) \|| l:change_directory is# 1 \|| l:change_directory is# 'file' - let l:cd_string = ale#path#BufferCdString(a:buffer) + let l:cwd = '%s:h' endif - return l:cd_string + return l:cwd endfunction function! ale_linters#python#flake8#GetCommand(buffer, version) abort - let l:cd_string = ale_linters#python#flake8#GetCdString(a:buffer) - let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv$' @@ -76,8 +74,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version) abort let l:options = ale#Var(a:buffer, 'python_flake8_options') - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --format=default' \ . l:display_name_args . ' -' @@ -161,6 +158,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'flake8', \ 'executable': function('ale_linters#python#flake8#GetExecutable'), +\ 'cwd': function('ale_linters#python#flake8#GetCwd'), \ 'command': function('ale_linters#python#flake8#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flake8#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index 94dfae7d..48697421 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -18,7 +18,7 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort endfunction " The directory to change to before running mypy -function! s:GetDir(buffer) abort +function! ale_linters#python#mypy#GetCwd(buffer) abort " If we find a directory with "mypy.ini" in it use that, " else try and find the "python project" root, or failing " that, run from the same folder as the current file @@ -36,24 +36,19 @@ function! s:GetDir(buffer) abort endfunction function! ale_linters#python#mypy#GetCommand(buffer) abort - let l:dir = s:GetDir(a:buffer) let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run mypy' \ : '' - " We have to always switch to an explicit directory for a command so - " we can know with certainty the base path for the 'filename' keys below. - return ale#path#CdString(l:dir) - \ . ale#Escape(l:executable) . l:exec_args - \ . ' --show-column-numbers ' - \ . ale#Var(a:buffer, 'python_mypy_options') + return '%e' . l:exec_args + \ . ale#Pad(ale#Var(a:buffer, 'python_mypy_options')) + \ . ' --show-column-numbers' \ . ' --shadow-file %s %t %s' endfunction function! ale_linters#python#mypy#Handle(buffer, lines) abort - let l:dir = s:GetDir(a:buffer) + let l:dir = ale_linters#python#mypy#GetCwd(a:buffer) " Look for lines like the following: " " file.py:4: error: No library stub file for module 'django.db' @@ -95,6 +90,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'mypy', \ 'executable': function('ale_linters#python#mypy#GetExecutable'), +\ 'cwd': function('ale_linters#python#mypy#GetCwd'), \ 'command': function('ale_linters#python#mypy#GetCommand'), \ 'callback': 'ale_linters#python#mypy#Handle', \ 'output_stream': 'both' diff --git a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim index 69ae3807..abf95fa1 100644 --- a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim @@ -21,8 +21,7 @@ function! ale_linters#python#pydocstyle#GetCommand(buffer) abort \ ? ' run pydocstyle' \ : '' - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) \ . ' %s:t' endfunction @@ -66,6 +65,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pydocstyle', \ 'executable': function('ale_linters#python#pydocstyle#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#python#pydocstyle#GetCommand'), \ 'callback': 'ale_linters#python#pydocstyle#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/pylama.vim b/sources_non_forked/ale/ale_linters/python/pylama.vim index 38dd2836..bad69667 100644 --- a/sources_non_forked/ale/ale_linters/python/pylama.vim +++ b/sources_non_forked/ale/ale_linters/python/pylama.vim @@ -16,19 +16,20 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama']) endfunction -function! ale_linters#python#pylama#GetCommand(buffer) abort - let l:cd_string = '' - +function! ale_linters#python#pylama#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylama_change_directory') " Pylama loads its configuration from the current directory only, and " applies file masks using paths relative to the current directory. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) - let l:cd_string = l:project_root isnot# '' - \ ? ale#path#CdString(l:project_root) - \ : ale#path#BufferCdString(a:buffer) + + return !empty(l:project_root) ? l:project_root : '%s:h' endif + return '' +endfunction + +function! ale_linters#python#pylama#GetCommand(buffer) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run pylama' @@ -37,8 +38,7 @@ function! ale_linters#python#pylama#GetCommand(buffer) abort " Note: Using %t to lint changes would be preferable, but many pylama " checks use surrounding paths (e.g. C0103 module name, E0402 relative " import beyond top, etc.). Neither is ideal. - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options')) \ . ' %s' endfunction @@ -86,6 +86,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pylama', \ 'executable': function('ale_linters#python#pylama#GetExecutable'), +\ 'cwd': function('ale_linters#python#pylama#GetCwd'), \ 'command': function('ale_linters#python#pylama#GetCommand'), \ 'callback': 'ale_linters#python#pylama#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index 44eea246..f086a865 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -17,27 +17,26 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction -function! ale_linters#python#pylint#GetCommand(buffer, version) abort - let l:cd_string = '' - +function! ale_linters#python#pylint#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylint_change_directory') " pylint only checks for pylintrc in the packages above its current " directory before falling back to user and global pylintrc. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) - let l:cd_string = l:project_root isnot# '' - \ ? ale#path#CdString(l:project_root) - \ : ale#path#BufferCdString(a:buffer) + + return !empty(l:project_root) ? l:project_root : '%s:h' endif - let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) + return '' +endfunction +function! ale_linters#python#pylint#GetCommand(buffer, version) abort + let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run pylint' \ : '' - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylint_options')) \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' \ . (ale#semver#GTE(a:version, [2, 4, 0]) ? ' --from-stdin' : '') @@ -104,6 +103,7 @@ call ale#linter#Define('python', { \ '%e --version', \ {buffer, version -> !ale#semver#GTE(version, [2, 4, 0])}, \ )}, +\ 'cwd': function('ale_linters#python#pylint#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'python_pylint_executable'), diff --git a/sources_non_forked/ale/ale_linters/python/pyls.vim b/sources_non_forked/ale/ale_linters/python/pyls.vim index c7f91430..10304b2c 100644 --- a/sources_non_forked/ale/ale_linters/python/pyls.vim +++ b/sources_non_forked/ale/ale_linters/python/pyls.vim @@ -2,6 +2,7 @@ " Description: A language server for Python call ale#Set('python_pyls_executable', 'pyls') +call ale#Set('python_pyls_options', '') call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyls_auto_pipenv', 0) call ale#Set('python_pyls_config', {}) @@ -22,7 +23,7 @@ function! ale_linters#python#pyls#GetCommand(buffer) abort \ ? ' run pyls' \ : '' - return ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pyls_options')) endfunction call ale#linter#Define('python', { diff --git a/sources_non_forked/ale/ale_linters/python/vulture.vim b/sources_non_forked/ale/ale_linters/python/vulture.vim index d328d262..84ffd49a 100644 --- a/sources_non_forked/ale/ale_linters/python/vulture.vim +++ b/sources_non_forked/ale/ale_linters/python/vulture.vim @@ -6,7 +6,6 @@ call ale#Set('python_vulture_options', '') call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_vulture_change_directory', 1) - " The directory to change to before running vulture function! s:GetDir(buffer) abort let l:project_root = ale#python#FindProjectRoot(a:buffer) @@ -16,29 +15,28 @@ function! s:GetDir(buffer) abort \ : expand('#' . a:buffer . ':p:h') endfunction - function! ale_linters#python#vulture#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture']) endfunction +function! ale_linters#python#vulture#GetCwd(buffer) abort + if !ale#Var(a:buffer, 'python_vulture_change_directory') + return '' + endif + + return s:GetDir(a:buffer) +endfunction function! ale_linters#python#vulture#GetCommand(buffer) abort - let l:change_dir = ale#Var(a:buffer, 'python_vulture_change_directory') - \ ? ale#path#CdString(s:GetDir(a:buffer)) - \ : '' - let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run vulture' \ : '' - let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory') \ ? ' .' \ : ' %s' - return l:change_dir - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ' ' \ . ale#Var(a:buffer, 'python_vulture_options') \ . l:lint_dest @@ -74,6 +72,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'vulture', \ 'executable': function('ale_linters#python#vulture#GetExecutable'), +\ 'cwd': function('ale_linters#python#vulture#GetCwd'), \ 'command': function('ale_linters#python#vulture#GetCommand'), \ 'callback': 'ale_linters#python#vulture#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/r/lintr.vim b/sources_non_forked/ale/ale_linters/r/lintr.vim index 3164c06f..799458fb 100644 --- a/sources_non_forked/ale/ale_linters/r/lintr.vim +++ b/sources_non_forked/ale/ale_linters/r/lintr.vim @@ -21,14 +21,13 @@ function! ale_linters#r#lintr#GetCommand(buffer) abort let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' \ . l:lint_cmd - return ale#path#BufferCdString(a:buffer) - \ . 'Rscript --vanilla -e ' - \ . ale#Escape(l:cmd_string) . ' %t' + return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) . ' %t' endfunction call ale#linter#Define('r', { \ 'name': 'lintr', \ 'executable': 'Rscript', +\ 'cwd': '%s:h', \ 'command': function('ale_linters#r#lintr#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'output_stream': 'both', diff --git a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim index 39e11d6e..e0cf0798 100644 --- a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim +++ b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim @@ -1,6 +1,5 @@ " Author: John Nduli https://github.com/jnduli " Description: Rstcheck for reStructuredText files -" function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort " matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline @@ -22,17 +21,11 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#rst#rstcheck#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . 'rstcheck' - \ . ' %t' -endfunction - - call ale#linter#Define('rst', { \ 'name': 'rstcheck', \ 'executable': 'rstcheck', -\ 'command': function('ale_linters#rst#rstcheck#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': 'rstcheck %t', \ 'callback': 'ale_linters#rst#rstcheck#Handle', \ 'output_stream': 'both', \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/sorbet.vim b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim index cae0683c..c67e20cc 100644 --- a/sources_non_forked/ale/ale_linters/ruby/sorbet.vim +++ b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim @@ -1,14 +1,17 @@ call ale#Set('ruby_sorbet_executable', 'srb') call ale#Set('ruby_sorbet_options', '') +call ale#Set('ruby_sorbet_enable_watchman', 0) function! ale_linters#ruby#sorbet#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') + let l:enable_watchman = ale#Var(a:buffer, 'ruby_sorbet_enable_watchman') return ale#ruby#EscapeExecutable(l:executable, 'srb') \ . ' tc' \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --lsp --disable-watchman' + \ . ' --lsp' + \ . (l:enable_watchman ? '' : ' --disable-watchman') endfunction call ale#linter#Define('ruby', { diff --git a/sources_non_forked/ale/ale_linters/rust/analyzer.vim b/sources_non_forked/ale/ale_linters/rust/analyzer.vim index 3666ec03..77d946f7 100644 --- a/sources_non_forked/ale/ale_linters/rust/analyzer.vim +++ b/sources_non_forked/ale/ale_linters/rust/analyzer.vim @@ -17,7 +17,7 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'analyzer', \ 'lsp': 'stdio', -\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')}, +\ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')}, \ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, \ 'command': function('ale_linters#rust#analyzer#GetCommand'), \ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'), diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index 3407abed..37fd10a8 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -23,6 +23,19 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort endif endfunction +function! ale_linters#rust#cargo#GetCwd(buffer) abort + if ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace') + let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h') + + if l:nearest_cargo_dir isnot# '.' + return l:nearest_cargo_dir + endif + endif + + return '' +endfunction + function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') \ && ale#semver#GTE(a:version, [0, 17, 0]) @@ -42,18 +55,6 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:include_features = ' --features ' . ale#Escape(l:include_features) endif - let l:avoid_whole_workspace = ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace') - let l:nearest_cargo_prefix = '' - - if l:avoid_whole_workspace - let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') - let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h') - - if l:nearest_cargo_dir isnot# '.' - let l:nearest_cargo_prefix = 'cd '. ale#Escape(l:nearest_cargo_dir) .' && ' - endif - endif - let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior') if l:default_feature_behavior is# 'all' @@ -81,7 +82,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort endif endif - return l:nearest_cargo_prefix . 'cargo ' + return 'cargo ' \ . l:subcommand \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') @@ -96,6 +97,7 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'), +\ 'cwd': function('ale_linters#rust#cargo#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#rust#cargo#GetCargoExecutable(buffer), diff --git a/sources_non_forked/ale/ale_linters/salt/salt_lint.vim b/sources_non_forked/ale/ale_linters/salt/salt_lint.vim new file mode 100644 index 00000000..47f66d83 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/salt/salt_lint.vim @@ -0,0 +1,33 @@ +" Author: Benjamin BINIER +" Description: salt-lint, saltstack linter + +call ale#Set('salt_salt_lint_executable', 'salt-lint') +call ale#Set('salt_salt_lint_options', '') + +function! ale_linters#salt#salt_lint#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'salt_salt_lint_options')) + \ . ' --json' +endfunction + +function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + call add(l:output, { + \ 'lnum': l:error.linenumber + 0, + \ 'code': l:error.id + 0, + \ 'text': l:error.message, + \ 'type': l:error.severity is# 'HIGH' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('salt', { +\ 'name': 'salt_lint', +\ 'aliases': ['salt-lint'], +\ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')}, +\ 'command': function('ale_linters#salt#salt_lint#GetCommand'), +\ 'callback': 'ale_linters#salt#salt_lint#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/solidity/solhint.vim b/sources_non_forked/ale/ale_linters/solidity/solhint.vim index 8ea33e07..505bd5bb 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solhint.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solhint.vim @@ -1,29 +1,12 @@ -" Author: Franco Victorio - https://github.com/fvictorio +" Authors: Franco Victorio - https://github.com/fvictorio, Henrique Barcelos +" https://github.com/hbarcelos " Description: Report errors in Solidity code with solhint -function! ale_linters#solidity#solhint#Handle(buffer, lines) abort - " Matches patterns like the following: - " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) - let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'code': l:match[5], - \ 'type': l:isError ? 'E' : 'W', - \}) - endfor - - return l:output -endfunction - call ale#linter#Define('solidity', { \ 'name': 'solhint', -\ 'executable': 'solhint', -\ 'command': 'solhint --formatter compact %t', -\ 'callback': 'ale_linters#solidity#solhint#Handle', +\ 'output_stream': 'both', +\ 'executable': function('ale#handlers#solhint#GetExecutable'), +\ 'cwd': function('ale#handlers#solhint#GetCwd'), +\ 'command': function('ale#handlers#solhint#GetCommand'), +\ 'callback': 'ale#handlers#solhint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim new file mode 100644 index 00000000..bcd10be8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim @@ -0,0 +1,21 @@ +" Author: Joakim Repomaa +" Description: Svelte Language Server integration for ALE + +call ale#Set('svelte_svelteserver_executable', 'svelteserver') +call ale#Set('svelte_svelteserver_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#svelte#svelteserver#GetProjectRoot(buffer) abort + let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json') + + return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : '' +endfunction + +call ale#linter#Define('svelte', { +\ 'name': 'svelteserver', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#node#FindExecutable(b, 'svelte_svelteserver', [ +\ 'node_modules/.bin/svelteserver', +\ ])}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#svelte#svelteserver#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim b/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim new file mode 100644 index 00000000..4c61764d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim @@ -0,0 +1,43 @@ +" Authors: Klaas Pieter Annema , bosr +" Description: Support for swift-format https://github.com/apple/swift-format + +function! ale_linters#swift#appleswiftformat#GetLinterCommand(buffer) abort + let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' lint %t' + let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) + + if l:config_args isnot# '' + let l:command_args = l:command_args . ' ' . l:config_args + endif + + return l:command_args +endfunction + +function! ale_linters#swift#appleswiftformat#Handle(buffer, lines) abort + " Matches the typical output of swift-format, that is lines of the following pattern: + " + " Sources/main.swift:4:21: warning: [DoNotUseSemicolons] remove ';' and move the next statement to the new line + " Sources/main.swift:3:12: warning: [Spacing] remove 1 space + let l:pattern = '\v^.*:(\d+):(\d+): (\S+): \[(\S+)\] (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'code': l:match[4], + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('swift', { +\ 'name': 'apple-swift-format', +\ 'executable': function('ale#swift#GetAppleSwiftFormatExecutable'), +\ 'command': function('ale_linters#swift#appleswiftformat#GetLinterCommand'), +\ 'output_stream': 'stderr', +\ 'language': 'swift', +\ 'callback': 'ale_linters#swift#appleswiftformat#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/swiftformat.vim b/sources_non_forked/ale/ale_linters/swift/swiftformat.vim deleted file mode 100644 index 2504511a..00000000 --- a/sources_non_forked/ale/ale_linters/swift/swiftformat.vim +++ /dev/null @@ -1,62 +0,0 @@ -" Author: Klaas Pieter Annema -" Description: Support for swift-format https://github.com/apple/swift-format - -let s:default_executable = 'swift-format' -call ale#Set('swift_swiftformat_executable', s:default_executable) - -function! ale_linters#swift#swiftformat#UseSwift(buffer) abort - let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') - let l:executable = ale#Var(a:buffer, 'swift_swiftformat_executable') - - return !empty(l:swift_config) && l:executable is# s:default_executable -endfunction - -function! ale_linters#swift#swiftformat#GetExecutable(buffer) abort - if ale_linters#swift#swiftformat#UseSwift(a:buffer) - return 'swift' - endif - - return ale#Var(a:buffer, 'swift_swiftformat_executable') -endfunction - -function! ale_linters#swift#swiftformat#GetCommand(buffer) abort - let l:executable = ale_linters#swift#swiftformat#GetExecutable(a:buffer) - let l:args = '--mode lint %t' - - if ale_linters#swift#swiftformat#UseSwift(a:buffer) - let l:args = 'run swift-format' . ' ' . l:args - endif - - return ale#Escape(l:executable) . ' ' . l:args -endfunction - -function! ale_linters#swift#swiftformat#Handle(buffer, lines) abort - " Matches lines of the following pattern: - " - " Sources/main.swift:4:21: warning: [DoNotUseSemicolons]: remove ';' and move the next statement to the new line - " Sources/main.swift:3:12: warning: [Spacing]: remove 1 space - let l:pattern = '\v^.*:(\d+):(\d+): (\S+) \[(\S+)\]: (.*)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \ 'code': l:match[4], - \ 'text': l:match[5], - \}) - endfor - - return l:output -endfunction - - -call ale#linter#Define('swift', { -\ 'name': 'swift-format', -\ 'executable': function('ale_linters#swift#swiftformat#GetExecutable'), -\ 'command': function('ale_linters#swift#swiftformat#GetCommand'), -\ 'output_stream': 'stderr', -\ 'language': 'swift', -\ 'callback': 'ale_linters#swift#swiftformat#Handle' -\}) diff --git a/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim b/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim new file mode 100644 index 00000000..64eef8cf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim @@ -0,0 +1,18 @@ +function! ale_linters#systemd#systemd_analyze#Handle(buffer, lines) abort + return ale#util#MapMatches(a:lines, '\v(.+):([0-9]+): (.+)', {match -> { + \ 'lnum': str2nr(match[2]), + \ 'col': 1, + \ 'type': 'W', + \ 'text': match[3], + \}}) +endfunction + +call ale#linter#Define('systemd', { +\ 'name': 'systemd_analyze', +\ 'aliases': ['systemd-analyze'], +\ 'executable': 'systemd-analyze', +\ 'command': 'SYSTEMD_LOG_COLOR=0 %e --user verify %s', +\ 'callback': 'ale_linters#systemd#systemd_analyze#Handle', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform.vim b/sources_non_forked/ale/ale_linters/terraform/terraform.vim index 0429cb7a..cf134460 100644 --- a/sources_non_forked/ale/ale_linters/terraform/terraform.vim +++ b/sources_non_forked/ale/ale_linters/terraform/terraform.vim @@ -9,30 +9,44 @@ endfunction function! ale_linters#terraform#terraform#GetCommand(buffer) abort return ale#Escape(ale_linters#terraform#terraform#GetExecutable(a:buffer)) - \ . ' fmt -no-color --check=true -' + \ . ' validate -no-color -json ' +endfunction + +function! ale_linters#terraform#terraform#GetType(severity) abort + if a:severity is? 'warning' + return 'W' + endif + + return 'E' +endfunction + +function! ale_linters#terraform#terraform#GetDetail(error) abort + return get(a:error, 'detail', get(a:error, 'summary', '')) endfunction function! ale_linters#terraform#terraform#Handle(buffer, lines) abort - let l:head = '^Error running fmt: In : ' let l:output = [] - let l:patterns = [ - \ l:head.'At \(\d\+\):\(\d\+\): \(.*\)$', - \ l:head.'\(.*\)$' - \] - for l:match in ale#util#GetMatches(a:lines, l:patterns) - if len(l:match[2]) > 0 + let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'diagnostics': []}) + let l:dir = expand('#' . a:buffer . ':p:h') + let l:file = expand('#' . a:buffer . ':p') + + for l:error in l:errors['diagnostics'] + if has_key(l:error, 'range') call add(l:output, { - \ 'lnum': str2nr(l:match[1]), - \ 'col': str2nr(l:match[2]), - \ 'text': l:match[3], - \ 'type': 'E', + \ 'filename': ale#path#GetAbsPath(l:dir, l:error['range']['filename']), + \ 'lnum': l:error['range']['start']['line'], + \ 'col': l:error['range']['start']['column'], + \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), + \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), \}) else call add(l:output, { - \ 'lnum': line('$'), - \ 'text': l:match[1], - \ 'type': 'E', + \ 'filename': l:file, + \ 'lnum': 0, + \ 'col': 0, + \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), + \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), \}) endif endfor @@ -42,7 +56,7 @@ endfunction call ale#linter#Define('terraform', { \ 'name': 'terraform', -\ 'output_stream': 'stderr', +\ 'output_stream': 'stdout', \ 'executable': function('ale_linters#terraform#terraform#GetExecutable'), \ 'command': function('ale_linters#terraform#terraform#GetCommand'), \ 'callback': 'ale_linters#terraform#terraform#Handle', diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim new file mode 100644 index 00000000..ab35126e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim @@ -0,0 +1,38 @@ +" Author: Horacio Sanson +" Description: terraform-ls integration for ALE (cf. https://github.com/hashicorp/terraform-ls) + +call ale#Set('terraform_terraform_executable', 'terraform') +call ale#Set('terraform_ls_executable', 'terraform-ls') +call ale#Set('terraform_ls_options', '') + +function! ale_linters#terraform#terraform_ls#GetTerraformExecutable(buffer) abort + let l:terraform_executable = ale#Var(a:buffer, 'terraform_terraform_executable') + + if(ale#path#IsAbsolute(l:terraform_executable)) + return '-tf-exec ' . l:terraform_executable + endif + + return '' +endfunction + +function! ale_linters#terraform#terraform_ls#GetCommand(buffer) abort + return '%e' + \ . ale#Pad('serve') + \ . ale#Pad(ale_linters#terraform#terraform_ls#GetTerraformExecutable(a:buffer)) + \ . ale#Pad(ale#Var(a:buffer, 'terraform_ls_options')) +endfunction + +function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort + let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') + + return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'terraform_ls_executable')}, +\ 'command': function('ale_linters#terraform#terraform_ls#GetCommand'), +\ 'project_root': function('ale_linters#terraform#terraform_ls#GetProjectRoot'), +\ 'language': 'terraform', +\}) diff --git a/sources_non_forked/ale/ale_linters/tex/texlab.vim b/sources_non_forked/ale/ale_linters/tex/texlab.vim index 5ead74b4..dd26fa0a 100644 --- a/sources_non_forked/ale/ale_linters/tex/texlab.vim +++ b/sources_non_forked/ale/ale_linters/tex/texlab.vim @@ -1,11 +1,14 @@ " Author: Ricardo Liang +" Author: ourigen " Description: Texlab language server (Rust rewrite) call ale#Set('tex_texlab_executable', 'texlab') call ale#Set('tex_texlab_options', '') function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort - return '' + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction function! ale_linters#tex#texlab#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/typescript/deno.vim b/sources_non_forked/ale/ale_linters/typescript/deno.vim new file mode 100644 index 00000000..051cb208 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/deno.vim @@ -0,0 +1,25 @@ +" Author: Mohammed Chelouti - https://github.com/motato1 +" Description: Deno lsp linter for TypeScript files. + +call ale#linter#Define('typescript', { +\ 'name': 'deno', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#deno#GetExecutable'), +\ 'command': '%e lsp', +\ 'project_root': function('ale#handlers#deno#GetProjectRoot'), +\ 'initialization_options': function('ale_linters#typescript#deno#GetInitializationOptions'), +\}) + +function! ale_linters#typescript#deno#GetInitializationOptions(buffer) abort + let l:options = { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ } + + if ale#Var(a:buffer, 'deno_unstable') + let l:options.unstable = v:true + endif + + return l:options +endfunction diff --git a/sources_non_forked/ale/ale_linters/typescript/eslint.vim b/sources_non_forked/ale/ale_linters/typescript/eslint.vim index 33a21440..eaeac307 100644 --- a/sources_non_forked/ale/ale_linters/typescript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/typescript/eslint.vim @@ -4,6 +4,7 @@ call ale#linter#Define('typescript', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tslint.vim b/sources_non_forked/ale/ale_linters/typescript/tslint.vim index f70c2e45..886a3cd4 100644 --- a/sources_non_forked/ale/ale_linters/typescript/tslint.vim +++ b/sources_non_forked/ale/ale_linters/typescript/tslint.vim @@ -59,8 +59,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort \ ? ' -r ' . ale#Escape(l:tslint_rules_dir) \ : '' - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) + return ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) \ . ' --format json' \ . l:tslint_config_option \ . l:tslint_rules_option @@ -70,6 +69,7 @@ endfunction call ale#linter#Define('typescript', { \ 'name': 'tslint', \ 'executable': function('ale#handlers#tslint#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#typescript#tslint#GetCommand'), \ 'callback': 'ale_linters#typescript#tslint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/typescript/xo.vim b/sources_non_forked/ale/ale_linters/typescript/xo.vim index 0a3a717b..6f4ee50c 100644 --- a/sources_non_forked/ale/ale_linters/typescript/xo.vim +++ b/sources_non_forked/ale/ale_linters/typescript/xo.vim @@ -1,23 +1,6 @@ -call ale#Set('typescript_xo_executable', 'xo') -call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('typescript_xo_options', '') - -function! ale_linters#typescript#xo#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_xo', [ - \ 'node_modules/.bin/xo', - \]) -endfunction - -function! ale_linters#typescript#xo#GetCommand(buffer) abort - return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer)) - \ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options')) - \ . ' --reporter json --stdin --stdin-filename %s' -endfunction - -" xo uses eslint and the output format is the same call ale#linter#Define('typescript', { \ 'name': 'xo', -\ 'executable': function('ale_linters#typescript#xo#GetExecutable'), -\ 'command': function('ale_linters#typescript#xo#GetCommand'), -\ 'callback': 'ale#handlers#eslint#HandleJSON', +\ 'executable': function('ale#handlers#xo#GetExecutable'), +\ 'command': function('ale#handlers#xo#GetLintCommand'), +\ 'callback': 'ale#handlers#xo#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/v/v.vim b/sources_non_forked/ale/ale_linters/v/v.vim new file mode 100644 index 00000000..afa98c56 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/v/v.vim @@ -0,0 +1,82 @@ +" Author: fiatjaf +" Description: v build for V files + +call ale#Set('v_v_executable', 'v') +call ale#Set('v_v_options', '') + +function! ale_linters#v#v#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'v_v_options') + + " Run v in local directory with relative path + let l:command = ale#Var(a:buffer, 'v_v_executable') + \ . ale#Pad(l:options) + \ . ' .' . ' -o /tmp/vim-ale-v' + + return l:command +endfunction + +function! ale_linters#v#v#Handler(buffer, lines) abort + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + + " Matches patterns like the following: + " + " ./const.v:4:3: warning: const names cannot contain uppercase letters, use snake_case instead + " 2 | + " 3 | const ( + " 4 | BUTTON_TEXT = 'OK' + " | ~~~~~~~~~~~ + " 5 | ) + " ./main.v:4:8: warning: module 'os' is imported but never used + " 2 | + " 3 | import ui + " 4 | import os + " | ~~ + " 5 | + " 6 | const ( + " ./main.v:20:10: error: undefined ident: `win_widt` + " 18 | mut app := &App{} + " 19 | app.window = ui.window({ + " 20 | width: win_widt + " | ~~~~~~~~ + " 21 | height: win_height + " 22 | title: 'Counter' + let l:current = {} + + for l:line in a:lines + " matches basic error description + let l:match = matchlist(l:line, + \ '\([^:]\+\):\([^:]\+\):\([^:]\+\): \([^:]\+\): \(.*\)') + + if !empty(l:match) + let l:current = { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[5], + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \} + call add(l:output, l:current) + continue + endif + + " try to get information about the ending column + let l:tildematch = matchstr(l:line, '\~\+') + + if !empty(l:tildematch) + let l:current['end_col'] = l:current['col'] + len(l:tildematch) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('v', { +\ 'name': 'v', +\ 'aliases': [], +\ 'executable': {b -> ale#Var(b, 'v_v_executable')}, +\ 'command': function('ale_linters#v#v#GetCommand'), +\ 'output_stream': 'stderr', +\ 'callback': 'ale_linters#v#v#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/vala/vala_lint.vim b/sources_non_forked/ale/ale_linters/vala/vala_lint.vim new file mode 100644 index 00000000..7f8a566a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vala/vala_lint.vim @@ -0,0 +1,66 @@ +" Author: Atsuya Takagi +" Description: A linter for Vala using Vala-Lint. + +call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf') +call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint') + +function! ale_linters#vala#vala_lint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'vala_vala_lint_executable') +endfunction + +function! ale_linters#vala#vala_lint#GetCommand(buffer) abort + let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer) + + let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename') + let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename) + + if !empty(l:config_path) + let l:command .= ' -c ' . l:config_path + endif + + return l:command . ' %s' +endfunction + +function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort + let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(error\|warn\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)' + let l:output = [] + + for l:line in a:lines + " remove color escape sequences since vala-lint doesn't support + " output without colors + let l:cleaned_line = substitute(l:line, '\e\[[0-9;]\+[mK]', '', 'g') + let l:match = matchlist(l:cleaned_line, l:pattern) + + if len(l:match) == 0 + continue + endif + + let l:refined_type = l:match[3] is# 'warn' ? 'W' : 'E' + let l:cleaned_text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '') + + let l:lnum = l:match[1] + 0 + let l:column = l:match[2] + 0 + let l:type = l:refined_type + let l:text = l:cleaned_text + let l:code = l:match[5] + + call add(l:output, { + \ 'lnum': l:lnum, + \ 'col': l:column, + \ 'text': l:text, + \ 'type': l:type, + \ 'code': l:code, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('vala', { +\ 'name': 'vala_lint', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#vala#vala_lint#GetExecutable'), +\ 'command': function('ale_linters#vala#vala_lint#GetCommand'), +\ 'callback': 'ale_linters#vala#vala_lint#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/verilog/verilator.vim b/sources_non_forked/ale/ale_linters/verilog/verilator.vim index 029dd4c9..006e310d 100644 --- a/sources_non_forked/ale/ale_linters/verilog/verilator.vim +++ b/sources_non_forked/ale/ale_linters/verilog/verilator.vim @@ -7,16 +7,11 @@ if !exists('g:ale_verilog_verilator_options') endif function! ale_linters#verilog#verilator#GetCommand(buffer) abort - let l:filename = ale#util#Tempname() . '_verilator_linted.v' - - " Create a special filename, so we can detect it in the handler. - call ale#command#ManageFile(a:buffer, l:filename) - let l:lines = getbufline(a:buffer, 1, '$') - call ale#util#Writefile(a:buffer, l:lines, l:filename) - + " the path to the current file is systematically added to the search path return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' + \ . '-I%s:h ' \ . ale#Var(a:buffer, 'verilog_verilator_options') .' ' - \ . ale#Escape(l:filename) + \ . '%t' endfunction function! ale_linters#verilog#verilator#Handle(buffer, lines) abort @@ -34,7 +29,7 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " " to stay compatible with old versions of the tool, the column number is " optional in the researched pattern - let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$' + let l:pattern = '^%\(Warning\|Error\)[^:]*:\s*\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -42,17 +37,14 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort \ 'lnum': str2nr(l:match[3]), \ 'text': l:match[5], \ 'type': l:match[1] is# 'Error' ? 'E' : 'W', + \ 'filename': l:match[2], \} if !empty(l:match[4]) let l:item.col = str2nr(l:match[4]) endif - let l:file = l:match[2] - - if l:file =~# '_verilator_linted.v' - call add(l:output, l:item) - endif + call add(l:output, l:item) endfor return l:output diff --git a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim index 822eb30a..5ca2f149 100644 --- a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim +++ b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim @@ -22,16 +22,20 @@ function! s:GetALEProjectDir(buffer) abort return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) endfunction -function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort - let l:dir = s:GetALEProjectDir(a:buffer) +function! ale_linters#vim#ale_custom_linting_rules#GetCwd(buffer) abort + let l:executable = ale_linters#vim#ale_custom_linting_rules#GetExecutable(a:buffer) + return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) +endfunction + +function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort let l:temp_dir = ale#command#CreateDirectory(a:buffer) let l:temp_file = l:temp_dir . '/example.vim' let l:lines = getbufline(a:buffer, 1, '$') call ale#util#Writefile(a:buffer, l:lines, l:temp_file) - return ale#path#CdString(l:dir) . '%e ' . ale#Escape(l:temp_dir) + return '%e ' . ale#Escape(l:temp_dir) endfunction function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort @@ -59,6 +63,7 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'ale_custom_linting_rules', \ 'executable': function('ale_linters#vim#ale_custom_linting_rules#GetExecutable'), +\ 'cwd': function('ale_linters#vim#ale_custom_linting_rules#GetCwd'), \ 'command': function('ale_linters#vim#ale_custom_linting_rules#GetCommand'), \ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle', \ 'read_buffer': 0, diff --git a/sources_non_forked/ale/ale_linters/yaml/spectral.vim b/sources_non_forked/ale/ale_linters/yaml/spectral.vim new file mode 100644 index 00000000..bd4623a5 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/spectral.vim @@ -0,0 +1,14 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +call ale#Set('yaml_spectral_executable', 'spectral') +call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) + +call ale#linter#Define('yaml', { +\ 'name': 'spectral', +\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_spectral', [ +\ 'node_modules/.bin/spectral', +\ ])}, +\ 'command': '%e lint --ignore-unknown-format -q -f text %t', +\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' +\}) diff --git a/sources_non_forked/ale/ale_linters/yaml/yamllint.vim b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim index bedb7bf1..39011df1 100644 --- a/sources_non_forked/ale/ale_linters/yaml/yamllint.vim +++ b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim @@ -3,48 +3,9 @@ call ale#Set('yaml_yamllint_executable', 'yamllint') call ale#Set('yaml_yamllint_options', '') -function! ale_linters#yaml#yamllint#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options')) - \ . ' -f parsable %t' -endfunction - -function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort - " Matches patterns line the following: - " something.yaml:1:1: [warning] missing document start "---" (document-start) - " something.yml:2:1: [error] syntax error: expected the node content, but found '' - let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:item = { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \} - - let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$') - - if !empty(l:code_match) - if l:code_match[2] is# 'trailing-spaces' - \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - " Skip warnings for trailing whitespace if the option is off. - continue - endif - - let l:item.text = l:code_match[1] - let l:item.code = l:code_match[2] - endif - - call add(l:output, l:item) - endfor - - return l:output -endfunction - call ale#linter#Define('yaml', { \ 'name': 'yamllint', \ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, -\ 'command': function('ale_linters#yaml#yamllint#GetCommand'), -\ 'callback': 'ale_linters#yaml#yamllint#Handle', +\ 'command': function('ale#handlers#yamllint#GetCommand'), +\ 'callback': 'ale#handlers#yamllint#Handle', \}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 3f59a6a4..97483b45 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -157,7 +157,7 @@ function! ale#Queue(delay, ...) abort endif endfunction -let s:current_ale_version = [3, 0, 0] +let s:current_ale_version = [3, 1, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort diff --git a/sources_non_forked/ale/autoload/ale/ant.vim b/sources_non_forked/ale/autoload/ale/ant.vim index 7d02484e..b6d4217f 100644 --- a/sources_non_forked/ale/autoload/ale/ant.vim +++ b/sources_non_forked/ale/autoload/ale/ant.vim @@ -23,19 +23,23 @@ function! ale#ant#FindExecutable(buffer) abort return '' endfunction -" Given a buffer number, build a command to print the classpath of the root -" project. Returns an empty string if cannot build the command. +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Ant is not detected. function! ale#ant#BuildClasspathCommand(buffer) abort let l:executable = ale#ant#FindExecutable(a:buffer) - let l:project_root = ale#ant#FindProjectRoot(a:buffer) - if !empty(l:executable) && !empty(l:project_root) - return ale#path#CdString(l:project_root) - \ . ale#Escape(l:executable) - \ . ' classpath' - \ . ' -S' - \ . ' -q' + if !empty(l:executable) + let l:project_root = ale#ant#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) .' classpath -S -q' + \] + endif endif - return '' + return ['', ''] endfunction diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 934fcaa8..141cd0f2 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -52,6 +52,36 @@ function! s:ProcessDeferredCommands(initial_result) abort return l:command endfunction +function! s:ProcessDeferredCwds(initial_command, initial_cwd) abort + let l:result = a:initial_command + let l:last_cwd = v:null + let l:command_index = 0 + let l:cwd_list = [] + + while ale#command#IsDeferred(l:result) + call add(l:cwd_list, l:result.cwd) + + if get(g:, 'ale_run_synchronously_emulate_commands') + " Don't run commands, but simulate the results. + let l:Callback = g:ale_run_synchronously_callbacks[0] + let l:output = get(s:command_output, l:command_index, []) + call l:Callback(0, l:output) + unlet g:ale_run_synchronously_callbacks + + let l:command_index += 1 + else + " Run the commands in the shell, synchronously. + call ale#test#FlushJobs() + endif + + let l:result = l:result.value + endwhile + + call add(l:cwd_list, a:initial_cwd is v:null ? l:last_cwd : a:initial_cwd) + + return l:cwd_list +endfunction + " Load the currently loaded linter for a test case, and check that the command " matches the given string. function! ale#assert#Linter(expected_executable, expected_command) abort @@ -85,6 +115,38 @@ function! ale#assert#Linter(expected_executable, expected_command) abort \ [l:executable, l:command] endfunction +function! ale#assert#LinterCwd(expected_cwd) abort + let l:buffer = bufnr('') + let l:linter = s:GetLinter() + + let l:initial_cwd = ale#linter#GetCwd(l:buffer, l:linter) + call ale#command#SetCwd(l:buffer, l:initial_cwd) + + let l:cwd = s:ProcessDeferredCwds( + \ ale#linter#GetCommand(l:buffer, l:linter), + \ l:initial_cwd, + \) + + call ale#command#ResetCwd(l:buffer) + + if type(a:expected_cwd) isnot v:t_list + let l:cwd = l:cwd[-1] + endif + + AssertEqual a:expected_cwd, l:cwd +endfunction + +function! ale#assert#FixerCwd(expected_cwd) abort + let l:buffer = bufnr('') + let l:cwd = s:ProcessDeferredCwds(s:FixerFunction(l:buffer), v:null) + + if type(a:expected_cwd) isnot v:t_list + let l:cwd = l:cwd[-1] + endif + + AssertEqual a:expected_cwd, l:cwd +endfunction + function! ale#assert#Fixer(expected_result) abort let l:buffer = bufnr('') let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer)) @@ -107,8 +169,21 @@ function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:executable = ale#linter#GetExecutable(l:buffer, l:linter) + let l:executed = 1 - Assert empty(l:executable), "The linter will be executed when it shouldn't be" + if !empty(l:executable) + let l:command = ale#linter#GetCommand(l:buffer, l:linter) + + if type(l:command) is v:t_list + let l:command = l:command[-1] + endif + + let l:executed = !empty(l:command) + else + let l:executed = 0 + endif + + Assert !l:executed, "The linter will be executed when it shouldn't be" endfunction function! ale#assert#LSPOptions(expected_options) abort @@ -153,6 +228,7 @@ endfunction function! ale#assert#SetUpLinterTestCommands() abort command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertLinterCwd :call ale#assert#LinterCwd() command! -nargs=+ AssertLinter :call ale#assert#Linter() command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted() command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() @@ -164,10 +240,35 @@ endfunction function! ale#assert#SetUpFixerTestCommands() abort command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertFixerCwd :call ale#assert#FixerCwd() command! -nargs=+ AssertFixer :call ale#assert#Fixer() command! -nargs=0 AssertFixerNotExecuted :call ale#assert#FixerNotExecuted() endfunction +function! ale#assert#ResetVariables(filetype, name, ...) abort + " If the suffix of the option names format is different, an additional + " argument can be used for that instead. + if a:0 > 1 + throw 'Too many arguments' + endif + + let l:option_suffix = get(a:000, 0, a:name) + let l:prefix = 'ale_' . a:filetype . '_' + \ . substitute(l:option_suffix, '-', '_', 'g') + let l:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + + " Save and clear linter variables. + " We'll load the runtime file to reset them to defaults. + for l:key in filter(keys(g:), l:filter_expr) + execute 'Save g:' . l:key + unlet g:[l:key] + endfor + + for l:key in filter(keys(b:), l:filter_expr) + unlet b:[l:key] + endfor +endfunction + " A dummy function for making sure this module is loaded. function! ale#assert#SetUpLinterTest(filetype, name) abort " Set up a marker so ALE doesn't create real random temporary filenames. @@ -177,35 +278,22 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort call ale#linter#Reset() call ale#linter#PreventLoading(a:filetype) - let l:prefix = 'ale_' . a:filetype . '_' . a:name - let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + Save g:ale_root + let g:ale_root = {} - Save g:ale_lsp_root - let g:ale_lsp_root = {} + Save b:ale_root + unlet! b:ale_root - Save b:ale_lsp_root - unlet! b:ale_lsp_root + call ale#assert#ResetVariables(a:filetype, a:name) Save g:ale_c_build_dir unlet! g:ale_c_build_dir - - " Save and clear linter variables. - " We'll load the runtime file to reset them to defaults. - for l:key in filter(keys(g:), b:filter_expr) - execute 'Save g:' . l:key - unlet g:[l:key] - endfor - unlet! b:ale_c_build_dir - for l:key in filter(keys(b:), b:filter_expr) - unlet b:[l:key] - endfor - execute 'runtime ale_linters/' . a:filetype . '/' . a:name . '.vim' if !exists('g:dir') - call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#test#SetDirectory('/testplugin/test/linter') endif call ale#assert#SetUpLinterTestCommands() @@ -226,6 +314,10 @@ function! ale#assert#TearDownLinterTest() abort delcommand GivenCommandOutput endif + if exists(':AssertLinterCwd') + delcommand AssertLinterCwd + endif + if exists(':AssertLinter') delcommand AssertLinter endif @@ -281,18 +373,7 @@ function! ale#assert#SetUpFixerTest(filetype, name, ...) abort let s:FixerFunction = function(l:function_name) let l:option_suffix = get(a:000, 0, a:name) - let l:prefix = 'ale_' . a:filetype . '_' - \ . substitute(l:option_suffix, '-', '_', 'g') - let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' - - for l:key in filter(keys(g:), b:filter_expr) - execute 'Save g:' . l:key - unlet g:[l:key] - endfor - - for l:key in filter(keys(b:), b:filter_expr) - unlet b:[l:key] - endfor + call ale#assert#ResetVariables(a:filetype, a:name, l:option_suffix) execute 'runtime autoload/ale/fixers/' . substitute(a:name, '-', '_', 'g') . '.vim' @@ -329,6 +410,10 @@ function! ale#assert#TearDownFixerTest() abort delcommand GivenCommandOutput endif + if exists(':AssertFixerCwd') + delcommand AssertFixerCwd + endif + if exists(':AssertFixer') delcommand AssertFixer endif diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index cff53125..ec9d4482 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -152,6 +152,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort \ || stridx(l:option, '-idirafter') == 0 \ || stridx(l:option, '-iframework') == 0 \ || stridx(l:option, '-include') == 0 + \ || stridx(l:option, '-imacros') == 0 if stridx(l:option, '-I') == 0 && l:option isnot# '-I' let l:arg = join(split(l:option, '\zs')[2:], '') let l:option = '-I' @@ -490,7 +491,7 @@ function! ale#c#GetCFlags(buffer, output) abort endif endif - if s:CanParseMakefile(a:buffer) && !empty(a:output) && !empty(l:cflags) + if empty(l:cflags) && s:CanParseMakefile(a:buffer) && !empty(a:output) let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) endif @@ -505,19 +506,25 @@ function! ale#c#GetMakeCommand(buffer) abort if s:CanParseMakefile(a:buffer) let l:path = ale#path#FindNearestFile(a:buffer, 'Makefile') + if empty(l:path) + let l:path = ale#path#FindNearestFile(a:buffer, 'GNUmakefile') + endif + if !empty(l:path) let l:always_make = ale#Var(a:buffer, 'c_always_make') - return ale#path#CdString(fnamemodify(l:path, ':h')) - \ . 'make -n' . (l:always_make ? ' --always-make' : '') + return [ + \ fnamemodify(l:path, ':h'), + \ 'make -n' . (l:always_make ? ' --always-make' : ''), + \] endif endif - return '' + return ['', ''] endfunction function! ale#c#RunMakeCommand(buffer, Callback) abort - let l:command = ale#c#GetMakeCommand(a:buffer) + let [l:cwd, l:command] = ale#c#GetMakeCommand(a:buffer) if empty(l:command) return a:Callback(a:buffer, []) @@ -527,6 +534,7 @@ function! ale#c#RunMakeCommand(buffer, Callback) abort \ a:buffer, \ l:command, \ {b, output -> a:Callback(a:buffer, output)}, + \ {'cwd': l:cwd}, \) endfunction diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim index 69d40933..917190be 100644 --- a/sources_non_forked/ale/autoload/ale/code_action.vim +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -71,6 +71,11 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort if l:buffer > 0 let l:lines = getbufline(l:buffer, 1, '$') + + " Add empty line if there's trailing newline, like readfile() does. + if getbufvar(l:buffer, '&eol') + let l:lines += [''] + endif else let l:lines = readfile(a:filename, 'b') endif @@ -89,62 +94,82 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort let l:end_column = l:code_edit.end.offset let l:text = l:code_edit.newText - " Adjust the ends according to previous edits. - if l:end_line > len(l:lines) - let l:end_line_len = 0 - else - let l:end_line_len = len(l:lines[l:end_line - 1]) - endif - let l:insertions = split(l:text, '\n', 1) - if l:line is 1 - " Same logic as for column below. Vimscript's slice [:-1] will not - " be an empty list. - let l:start = [] - else - let l:start = l:lines[: l:line - 2] + " Fix invalid columns + let l:column = l:column > 0 ? l:column : 1 + let l:end_column = l:end_column > 0 ? l:end_column : 1 + + " Clamp start to BOF + if l:line < 1 + let [l:line, l:column] = [1, 1] endif - " Special case when text must be added after new line - if l:column > len(l:lines[l:line - 1]) - call extend(l:start, [l:lines[l:line - 1]]) - let l:column = 1 + " Clamp start to EOF + if l:line > len(l:lines) || l:line == len(l:lines) && l:column > len(l:lines[-1]) + 1 + let [l:line, l:column] = [len(l:lines), len(l:lines[-1]) + 1] + " Special case when start is after EOL + elseif l:line < len(l:lines) && l:column > len(l:lines[l:line - 1]) + 1 + let [l:line, l:column] = [l:line + 1, 1] endif - if l:column is 1 - " We need to handle column 1 specially, because we can't slice an - " empty string ending on index 0. - let l:middle = [l:insertions[0]] - else - let l:middle = [l:lines[l:line - 1][: l:column - 2] . l:insertions[0]] + " Adjust end: clamp if invalid and/or adjust if we moved start + if l:end_line < l:line || l:end_line == l:line && l:end_column < l:column + let [l:end_line, l:end_column] = [l:line, l:column] endif - call extend(l:middle, l:insertions[1:]) - - if l:end_line <= len(l:lines) - " Only extend the last line if end_line is within the range of - " lines. - let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] + " Clamp end to EOF + if l:end_line > len(l:lines) || l:end_line == len(l:lines) && l:end_column > len(l:lines[-1]) + 1 + let [l:end_line, l:end_column] = [len(l:lines), len(l:lines[-1]) + 1] + " Special case when end is after EOL + elseif l:end_line < len(l:lines) && l:end_column > len(l:lines[l:end_line - 1]) + 1 + let [l:end_line, l:end_column] = [l:end_line + 1, 1] endif + " Careful, [:-1] is not an empty list + let l:start = l:line is 1 ? [] : l:lines[: l:line - 2] + let l:middle = l:column is 1 ? [''] : [l:lines[l:line - 1][: l:column - 2]] + + let l:middle[-1] .= l:insertions[0] + let l:middle += l:insertions[1:] + let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] + + let l:end_line_len = len(l:lines[l:end_line - 1]) let l:lines_before_change = len(l:lines) let l:lines = l:start + l:middle + l:lines[l:end_line :] let l:current_line_offset = len(l:lines) - l:lines_before_change let l:column_offset = len(l:middle[-1]) - l:end_line_len - let l:pos = s:UpdateCursor(l:pos, - \ [l:line, l:column], - \ [l:end_line, l:end_column], - \ [l:current_line_offset, l:column_offset]) + " Keep cursor where it was (if outside of changes) or move it after + " the changed text (if inside), but don't touch it when the change + " spans the entire buffer, in which case we have no clue and it's + " better to not do anything. + if l:line isnot 1 || l:column isnot 1 + \|| l:end_line < l:lines_before_change + \|| l:end_line == l:lines_before_change && l:end_column <= l:end_line_len + let l:pos = s:UpdateCursor(l:pos, + \ [l:line, l:column], + \ [l:end_line, l:end_column], + \ [l:current_line_offset, l:column_offset]) + endif endfor - if l:lines[-1] is# '' + if l:buffer > 0 + " Make sure ale#util#{Writefile,SetBufferContents} add trailing + " newline if and only if it should be added. + if l:lines[-1] is# '' && getbufvar(l:buffer, '&eol') + call remove(l:lines, -1) + else + call setbufvar(l:buffer, '&eol', 0) + endif + elseif exists('+fixeol') && &fixeol && l:lines[-1] is# '' + " Not in buffer, ale#util#Writefile can't check &eol and always adds + " newline if &fixeol: remove to prevent double trailing newline. call remove(l:lines, -1) endif - if a:should_save + if a:should_save || l:buffer < 0 call ale#util#Writefile(l:buffer, l:lines, a:filename) else call ale#util#SetBufferContents(l:buffer, l:lines) @@ -222,6 +247,10 @@ function! s:UpdateCursor(cursor, start, end, offset) abort endfunction function! ale#code_action#GetChanges(workspace_edit) abort + if a:workspace_edit is v:null + return {} + endif + let l:changes = {} if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes) diff --git a/sources_non_forked/ale/autoload/ale/codefix.vim b/sources_non_forked/ale/autoload/ale/codefix.vim index 69bf36fa..4a78063b 100644 --- a/sources_non_forked/ale/autoload/ale/codefix.vim +++ b/sources_non_forked/ale/autoload/ale/codefix.vim @@ -261,7 +261,10 @@ function! ale#codefix#HandleLSPResponse(conn_id, response) abort " Send the results to the menu callback, if set. if l:MenuCallback isnot v:null - call l:MenuCallback(map(copy(l:result), '[''lsp'', v:val]')) + call l:MenuCallback( + \ l:data, + \ map(copy(l:result), '[''lsp'', v:val]') + \) return endif diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim index 8f497169..c9dc8d94 100644 --- a/sources_non_forked/ale/autoload/ale/command.vim +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -7,6 +7,9 @@ if !exists('s:buffer_data') let s:buffer_data = {} endif +" The regular expression used for formatting filenames with modifiers. +let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)' + " Used to get the data in tests. function! ale#command#GetData() abort return deepcopy(s:buffer_data) @@ -26,6 +29,19 @@ function! ale#command#InitData(buffer) abort endif endfunction +" Set the cwd for commands that are about to run. +" Used internally. +function! ale#command#SetCwd(buffer, cwd) abort + call ale#command#InitData(a:buffer) + let s:buffer_data[a:buffer].cwd = a:cwd +endfunction + +function! ale#command#ResetCwd(buffer) abort + if has_key(s:buffer_data, a:buffer) + let s:buffer_data[a:buffer].cwd = v:null + endif +endfunction + function! ale#command#ManageFile(buffer, file) abort call ale#command#InitData(a:buffer) call add(s:buffer_data[a:buffer].file_list, a:file) @@ -151,6 +167,24 @@ function! s:FormatFilename(filename, mappings, modifiers) abort return ale#Escape(l:filename) endfunction +" Produce a command prefix to check to a particular directory for a command. +" %s format markers with filename-modifiers can be used as the directory, and +" will be returned verbatim for formatting in paths relative to files. +function! ale#command#CdString(directory) abort + let l:match = matchstrpos(a:directory, s:path_format_regex) + " Do not escape the directory here if it's a valid format string. + " This allows us to use sequences like %s:h, %s:h:h, etc. + let l:directory = l:match[1:] == [0, len(a:directory)] + \ ? a:directory + \ : ale#Escape(a:directory) + + if has('win32') + return 'cd /d ' . l:directory . ' && ' + endif + + return 'cd ' . l:directory . ' && ' +endfunction + " Given a command string, replace every... " %s -> with the current filename " %t -> with the name of an unused file in a temporary directory @@ -161,11 +195,16 @@ function! ale#command#FormatCommand( \ command, \ pipe_file_if_needed, \ input, +\ cwd, \ mappings, \) abort let l:temporary_file = '' let l:command = a:command + if !empty(a:cwd) + let l:command = ale#command#CdString(a:cwd) . l:command + endif + " First replace all uses of %%, used for literal percent characters, " with an ugly string. let l:command = substitute(l:command, '%%', '<>', 'g') @@ -181,7 +220,7 @@ function! ale#command#FormatCommand( let l:filename = fnamemodify(bufname(a:buffer), ':p') let l:command = substitute( \ l:command, - \ '\v\%s(%(:h|:t|:r|:e)*)', + \ s:path_format_regex, \ '\=s:FormatFilename(l:filename, a:mappings, submatch(1))', \ 'g' \) @@ -279,9 +318,16 @@ function! s:ExitCallback(buffer, line_list, Callback, data) abort let l:result = a:data.result let l:result.value = l:value - if get(l:result, 'result_callback', v:null) isnot v:null - call call(l:result.result_callback, [l:value]) - endif + " Set the default cwd for this buffer in this call stack. + call ale#command#SetCwd(a:buffer, l:result.cwd) + + try + if get(l:result, 'result_callback', v:null) isnot v:null + call call(l:result.result_callback, [l:value]) + endif + finally + call ale#command#ResetCwd(a:buffer) + endtry endfunction function! ale#command#Run(buffer, command, Callback, ...) abort @@ -293,6 +339,13 @@ function! ale#command#Run(buffer, command, Callback, ...) abort let l:output_stream = get(l:options, 'output_stream', 'stdout') let l:line_list = [] + let l:cwd = get(l:options, 'cwd', v:null) + + if l:cwd is v:null + " Default the working directory to whatever it was for the last + " command run in the chain. + let l:cwd = get(get(s:buffer_data, a:buffer, {}), 'cwd', v:null) + endif let [l:temporary_file, l:command, l:file_created] = ale#command#FormatCommand( \ a:buffer, @@ -300,6 +353,7 @@ function! ale#command#Run(buffer, command, Callback, ...) abort \ a:command, \ get(l:options, 'read_buffer', 0), \ get(l:options, 'input', v:null), + \ l:cwd, \ get(l:options, 'filename_mappings', []), \) let l:command = ale#job#PrepareCommand(a:buffer, l:command) @@ -366,10 +420,14 @@ function! ale#command#Run(buffer, command, Callback, ...) abort " The `_deferred_job_id` is used for both checking the type of object, and " for checking the job ID and status. " + " The cwd is kept and used as the default value for the next command in + " the chain. + " " The original command here is used in tests. let l:result = { \ '_deferred_job_id': l:job_id, \ 'executable': get(l:options, 'executable', ''), + \ 'cwd': l:cwd, \ 'command': a:command, \} diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 39bfc094..332d0734 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -614,6 +614,8 @@ function! ale#completion#ParseLSPCompletions(response) abort \ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')), \ 'icase': 1, \ 'menu': l:detail, + \ 'dup': get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \ 'info': (type(l:doc) is v:t_string ? l:doc : ''), \} " This flag is used to tell if this completion came from ALE or not. diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index 9ca6fb15..e8478e93 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -9,7 +9,6 @@ let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10) let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s') let s:cursor_timer = -1 -let s:last_pos = [0, 0, 0] function! ale#cursor#TruncatedEcho(original_message) abort let l:message = a:original_message @@ -118,14 +117,18 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort let l:pos = getpos('.')[0:2] + if !exists('w:last_pos') + let w:last_pos = [0, 0, 0] + endif + " Check the current buffer, line, and column number against the last " recorded position. If the position has actually changed, *then* " we should echo something. Otherwise we can end up doing processing " the echo message far too frequently. - if l:pos != s:last_pos + if l:pos != w:last_pos let l:delay = ale#Var(l:buffer, 'echo_delay') - let s:last_pos = l:pos + let w:last_pos = l:pos let s:cursor_timer = timer_start( \ l:delay, \ function('ale#cursor#EchoCursorWarning') @@ -139,11 +142,16 @@ function! s:ShowCursorDetailForItem(loc, options) abort let s:last_detailed_line = line('.') let l:message = get(a:loc, 'detail', a:loc.text) let l:lines = split(l:message, "\n") - call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) - " Clear the echo message if we manually displayed details. - if !l:stay_here - execute 'echo' + if g:ale_floating_preview || g:ale_detail_to_floating_preview + call ale#floating_preview#Show(l:lines) + else + call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) + + " Clear the echo message if we manually displayed details. + if !l:stay_here + execute 'echo' + endif endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index 5e6d5906..1f7ea467 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -33,13 +33,13 @@ let s:global_variable_list = [ \ 'ale_list_vertical', \ 'ale_list_window_size', \ 'ale_loclist_msg_format', -\ 'ale_lsp_root', \ 'ale_max_buffer_history_size', \ 'ale_max_signs', \ 'ale_maximum_file_size', \ 'ale_open_list', \ 'ale_pattern_options', \ 'ale_pattern_options_enabled', +\ 'ale_root', \ 'ale_set_balloons', \ 'ale_set_highlights', \ 'ale_set_loclist', diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 0c1fb7cf..9574017b 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -36,7 +36,7 @@ function! ale#definition#UpdateTagStack() abort endfunction function! ale#definition#HandleTSServerResponse(conn_id, response) abort - if get(a:response, 'command', '') is# 'definition' + if has_key(a:response, 'request_seq') \&& has_key(s:go_to_definition_map, a:response.request_seq) let l:options = remove(s:go_to_definition_map, a:response.request_seq) @@ -66,9 +66,17 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort endif for l:item in l:result - let l:filename = ale#path#FromURI(l:item.uri) - let l:line = l:item.range.start.line + 1 - let l:column = l:item.range.start.character + 1 + if has_key(l:item, 'targetUri') + " LocationLink items use targetUri + let l:filename = ale#path#FromURI(l:item.targetUri) + let l:line = l:item.targetRange.start.line + 1 + let l:column = l:item.targetRange.start.character + 1 + else + " LocationLink items use uri + let l:filename = ale#path#FromURI(l:item.uri) + let l:line = l:item.range.start.line + 1 + let l:column = l:item.range.start.character + 1 + endif call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) @@ -92,11 +100,19 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' - let l:message = ale#lsp#tsserver_message#Definition( - \ l:buffer, - \ a:line, - \ a:column - \) + if a:capability is# 'definition' + let l:message = ale#lsp#tsserver_message#Definition( + \ l:buffer, + \ a:line, + \ a:column + \) + elseif a:capability is# 'typeDefinition' + let l:message = ale#lsp#tsserver_message#TypeDefinition( + \ l:buffer, + \ a:line, + \ a:column + \) + endif else " Send a message saying the buffer has changed first, or the " definition position probably won't make sense. @@ -145,12 +161,6 @@ endfunction function! ale#definition#GoToType(options) abort for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) - " TODO: handle typeDefinition for tsserver if supported by the - " protocol - if l:linter.lsp is# 'tsserver' - continue - endif - call s:GoToLSPDefinition(l:linter, a:options, 'typeDefinition') endif endfor diff --git a/sources_non_forked/ale/autoload/ale/dhall.vim b/sources_non_forked/ale/autoload/ale/dhall.vim new file mode 100644 index 00000000..cc54418f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/dhall.vim @@ -0,0 +1,24 @@ +" Author: Pat Brisbin , toastal +" Description: Functions for working with Dhall’s executable + +call ale#Set('dhall_executable', 'dhall') +call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('dhall_options', '') + +function! ale#dhall#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'dhall_executable') + + " Dhall is written in Haskell and commonly installed with Stack + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') +endfunction + +function! ale#dhall#GetExecutableWithOptions(buffer) abort + let l:executable = ale#dhall#GetExecutable(a:buffer) + + return l:executable + \ . ale#Pad(ale#Var(a:buffer, 'dhall_options')) +endfunction + +function! ale#dhall#GetCommand(buffer) abort + return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options')) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 3cafa25c..5b9b1fca 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -413,6 +413,7 @@ function! s:RunJob(command, options) abort return 0 endif + let l:cwd = a:options.cwd let l:executable = a:options.executable let l:buffer = a:options.buffer let l:linter = a:options.linter @@ -425,6 +426,7 @@ function! s:RunJob(command, options) abort \ 'executable': l:executable, \}]) let l:result = ale#command#Run(l:buffer, l:command, l:Callback, { + \ 'cwd': l:cwd, \ 'output_stream': l:output_stream, \ 'executable': l:executable, \ 'read_buffer': l:read_buffer, @@ -541,8 +543,22 @@ function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort let l:job_type = a:lint_file ? 'file_linter' : 'linter' call setbufvar(a:buffer, 'ale_job_type', l:job_type) + " Get the cwd for the linter and set it before we call GetCommand. + " This will ensure that ale#command#Run uses it by default. + let l:cwd = ale#linter#GetCwd(a:buffer, a:linter) + + if l:cwd isnot v:null + call ale#command#SetCwd(a:buffer, l:cwd) + endif + let l:command = ale#linter#GetCommand(a:buffer, a:linter) + + if l:cwd isnot v:null + call ale#command#ResetCwd(a:buffer) + endif + let l:options = { + \ 'cwd': l:cwd, \ 'executable': a:executable, \ 'buffer': a:buffer, \ 'linter': a:linter, diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index c3338fc5..8ebba9fe 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -172,6 +172,7 @@ function! s:RunJob(result, options) abort let l:read_temporary_file = get(a:result, 'read_temporary_file', 0) let l:read_buffer = get(a:result, 'read_buffer', 1) let l:output_stream = get(a:result, 'output_stream', 'stdout') + let l:cwd = get(a:result, 'cwd', v:null) if l:read_temporary_file let l:output_stream = 'none' @@ -190,6 +191,7 @@ function! s:RunJob(result, options) abort \ 'read_buffer': l:read_buffer, \ 'input': l:input, \ 'log_output': 0, + \ 'cwd': l:cwd, \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:fixer_name), \}) diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 0f146faa..efc9ebe0 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -32,11 +32,42 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'buildifier': { +\ 'function': 'ale#fixers#buildifier#Fix', +\ 'suggested_filetypes': ['bzl'], +\ 'description': 'Format BUILD and .bzl files with buildifier.', +\ }, +\ 'deno': { +\ 'function': 'ale#fixers#deno#Fix', +\ 'suggested_filetypes': ['typescript'], +\ 'description': 'Fix TypeScript using deno fmt.', +\ }, \ 'dfmt': { \ 'function': 'ale#fixers#dfmt#Fix', \ 'suggested_filetypes': ['d'], \ 'description': 'Fix D files with dfmt.', \ }, +\ 'dhall': { +\ 'function': 'ale#fixers#dhall#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Fix Dhall files with dhall-format.', +\ }, +\ 'dhall-format': { +\ 'function': 'ale#fixers#dhall_format#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Standard code formatter for the Dhall language', +\ 'aliases': ['dhall'], +\ }, +\ 'dhall-freeze': { +\ 'function': 'ale#fixers#dhall_freeze#Freeze', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language', +\ }, +\ 'dhall-lint': { +\ 'function': 'ale#fixers#dhall_lint#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Standard code formatter for the Dhall language and removing dead code', +\ }, \ 'fecs': { \ 'function': 'ale#fixers#fecs#Fix', \ 'suggested_filetypes': ['javascript', 'css', 'html'], @@ -81,7 +112,7 @@ let s:default_registry = { \ }, \ 'prettier': { \ 'function': 'ale#fixers#prettier#Fix', -\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'], +\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby'], \ 'description': 'Apply prettier to a file.', \ }, \ 'prettier_eslint': { @@ -132,7 +163,7 @@ let s:default_registry = { \ }, \ 'scalafmt': { \ 'function': 'ale#fixers#scalafmt#Fix', -\ 'suggested_filetypes': ['scala'], +\ 'suggested_filetypes': ['sbt', 'scala'], \ 'description': 'Fix Scala files using scalafmt', \ }, \ 'sorbet': { @@ -160,6 +191,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['swift'], \ 'description': 'Apply SwiftFormat to a file.', \ }, +\ 'apple-swift-format': { +\ 'function': 'ale#fixers#appleswiftformat#Fix', +\ 'suggested_filetypes': ['swift'], +\ 'description': 'Apply apple/swift-format to a file.', +\ }, \ 'phpcbf': { \ 'function': 'ale#fixers#phpcbf#Fix', \ 'suggested_filetypes': ['php'], @@ -190,6 +226,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['cmake'], \ 'description': 'Fix CMake files with cmake-format.', \ }, +\ 'fish_indent': { +\ 'function': 'ale#fixers#fish_indent#Fix', +\ 'suggested_filetypes': ['fish'], +\ 'description': 'Format fish scripts using fish_indent.', +\ }, \ 'gofmt': { \ 'function': 'ale#fixers#gofmt#Fix', \ 'suggested_filetypes': ['go'], @@ -305,6 +346,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['json'], \ 'description': 'Fix JSON files with jq.', \ }, +\ 'protolint': { +\ 'function': 'ale#fixers#protolint#Fix', +\ 'suggested_filetypes': ['proto'], +\ 'description': 'Fix Protocol Buffer files with protolint.', +\ }, \ 'perltidy': { \ 'function': 'ale#fixers#perltidy#Fix', \ 'suggested_filetypes': ['perl'], @@ -342,7 +388,7 @@ let s:default_registry = { \ }, \ 'ktlint': { \ 'function': 'ale#fixers#ktlint#Fix', -\ 'suggested_filetypes': ['kt'], +\ 'suggested_filetypes': ['kt', 'kotlin'], \ 'description': 'Fix Kotlin files with ktlint.', \ }, \ 'styler': { @@ -370,6 +416,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['ada'], \ 'description': 'Format Ada files with gnatpp.', \ }, +\ 'nixfmt': { +\ 'function': 'ale#fixers#nixfmt#Fix', +\ 'suggested_filetypes': ['nix'], +\ 'description': 'A nix formatter written in Haskell.', +\ }, \ 'nixpkgs-fmt': { \ 'function': 'ale#fixers#nixpkgsfmt#Fix', \ 'suggested_filetypes': ['nix'], @@ -390,16 +441,21 @@ let s:default_registry = { \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with luafmt.', \ }, -\ 'dhall': { -\ 'function': 'ale#fixers#dhall#Fix', -\ 'suggested_filetypes': ['dhall'], -\ 'description': 'Fix Dhall files with dhall-format.', -\ }, \ 'ormolu': { \ 'function': 'ale#fixers#ormolu#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'A formatter for Haskell source code.', \ }, +\ 'ptop': { +\ 'function': 'ale#fixers#ptop#Fix', +\ 'suggested_filetypes': ['pascal'], +\ 'description': 'Fix Pascal files with ptop.', +\ }, +\ 'vfmt': { +\ 'function': 'ale#fixers#vfmt#Fix', +\ 'suggested_filetypes': ['v'], +\ 'description': 'A formatter for V source code.', +\ } \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim b/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim new file mode 100644 index 00000000..ca27e82c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim @@ -0,0 +1,16 @@ +" Author: (bosr) +" Description: Integration of apple/swift-format formatter with ALE. + +function! ale#fixers#appleswiftformat#Fix(buffer) abort + let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' format --in-place %t' + let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) + + if l:config_args isnot# '' + let l:command_args = l:command_args . ' ' . l:config_args + endif + + return { + \ 'read_temporary_file': 1, + \ 'command': l:command_args, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim index 37a52db8..700d36b5 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim @@ -19,7 +19,9 @@ function! ale#fixers#autoimport#Fix(buffer) abort endif return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -', \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index fba6c3b4..17697652 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -17,25 +17,25 @@ function! ale#fixers#black#GetExecutable(buffer) abort endfunction function! ale#fixers#black#Fix(buffer) abort - let l:cd_string = ale#Var(a:buffer, 'python_black_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' - let l:executable = ale#fixers#black#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run black' \ : '' - let l:options = ale#Var(a:buffer, 'python_black_options') if expand('#' . a:buffer . ':e') is? 'pyi' let l:options .= '--pyi' endif - return { - \ 'command': l:cd_string . ale#Escape(l:executable) . l:exec_args + let l:result = { + \ 'command': ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -', \} + + if ale#Var(a:buffer, 'python_black_change_directory') + let l:result.cwd = '%s:h' + endif + + return l:result endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim new file mode 100644 index 00000000..b676068d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim @@ -0,0 +1,26 @@ +" Author: Jon Parise +" Description: Format Bazel BUILD and .bzl files with buildifier. +" +call ale#Set('bazel_buildifier_executable', 'buildifier') +call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('bazel_buildifier_options', '') + +function! ale#fixers#buildifier#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'bazel_buildifier', [ + \ 'buildifier', + \]) +endfunction + +function! ale#fixers#buildifier#Fix(buffer) abort + let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer)) + let l:options = ale#Var(a:buffer, 'bazel_buildifier_options') + let l:filename = ale#Escape(bufname(a:buffer)) + + let l:command = l:executable . ' -mode fix -lint fix -path ' . l:filename + + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return {'command': l:command . ' -'} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim index ea5743a5..ecff080a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim @@ -5,6 +5,8 @@ scriptencoding utf-8 call ale#Set('c_clangformat_executable', 'clang-format') call ale#Set('c_clangformat_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('c_clangformat_options', '') +call ale#Set('c_clangformat_style_option', '') +call ale#Set('c_clangformat_use_local_file', 0) function! ale#fixers#clangformat#GetExecutable(buffer) abort return ale#node#FindExecutable(a:buffer, 'c_clangformat', [ @@ -16,6 +18,24 @@ function! ale#fixers#clangformat#Fix(buffer) abort let l:executable = ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) let l:filename = ale#Escape(bufname(a:buffer)) let l:options = ale#Var(a:buffer, 'c_clangformat_options') + let l:style_option = ale#Var(a:buffer, 'c_clangformat_style_option') + let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file') + + if l:style_option isnot# '' + let l:style_option = '-style=' . "'" . l:style_option . "'" + endif + + if l:use_local_file + let l:config = ale#path#FindNearestFile(a:buffer, '.clang-format') + + if !empty(l:config) + let l:style_option = '-style=file' + endif + endif + + if l:style_option isnot# '' + let l:options .= ' ' . l:style_option + endif let l:command = l:executable . ' --assume-filename=' . l:filename diff --git a/sources_non_forked/ale/autoload/ale/fixers/deno.vim b/sources_non_forked/ale/autoload/ale/fixers/deno.vim new file mode 100644 index 00000000..7154c6ee --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/deno.vim @@ -0,0 +1,17 @@ +function! ale#fixers#deno#Fix(buffer) abort + let l:executable = ale#handlers#deno#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:options = ' fmt -' + + if ale#Var(a:buffer, 'deno_unstable') + let l:options = l:options . ' --unstable' + endif + + return { + \ 'command': ale#Escape(l:executable) . l:options + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall.vim deleted file mode 100644 index 18f6006c..00000000 --- a/sources_non_forked/ale/autoload/ale/fixers/dhall.vim +++ /dev/null @@ -1,23 +0,0 @@ -" Author: Pat Brisbin -" Description: Integration of dhall-format with ALE. - -call ale#Set('dhall_format_executable', 'dhall') - -function! ale#fixers#dhall#GetExecutable(buffer) abort - let l:executable = ale#Var(a:buffer, 'dhall_format_executable') - - " Dhall is written in Haskell and commonly installed with Stack - return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') -endfunction - -function! ale#fixers#dhall#Fix(buffer) abort - let l:executable = ale#fixers#dhall#GetExecutable(a:buffer) - - return { - \ 'command': l:executable - \ . ' format' - \ . ' --inplace' - \ . ' %t', - \ 'read_temporary_file': 1, - \} -endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim new file mode 100644 index 00000000..d4021983 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim @@ -0,0 +1,14 @@ +" Author: toastal +" Description: Dhall’s built-in formatter +" +function! ale#fixers#dhall_format#Fix(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + let l:command = l:executable + \ . ' format' + \ . ' --inplace %t' + + return { + \ 'command': l:command, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim new file mode 100644 index 00000000..74ae7530 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim @@ -0,0 +1,18 @@ +" Author: toastal +" Description: Dhall’s package freezing + +call ale#Set('dhall_freeze_options', '') + +function! ale#fixers#dhall_freeze#Freeze(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + let l:command = l:executable + \ . ' freeze' + \ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options')) + \ . ' --inplace %t' + + + return { + \ 'command': l:command, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim new file mode 100644 index 00000000..2abbe6f7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim @@ -0,0 +1,14 @@ +" Author: toastal +" Description: Dhall’s built-in linter/formatter + +function! ale#fixers#dhall_lint#Fix(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + let l:command = l:executable + \ . ' lint' + \ . ' --inplace %t' + + return { + \ 'command': l:command, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim new file mode 100644 index 00000000..e44046f1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim @@ -0,0 +1,21 @@ +" Author: AntoineGagne - https://github.com/AntoineGagne +" Description: Integration of erlfmt with ALE. + +call ale#Set('erlang_erlfmt_executable', 'erlfmt') +call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('erlang_erlfmt_options', '') + +function! ale#fixers#erlfmt#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) +endfunction + +function! ale#fixers#erlfmt#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'erlang_erlfmt_options') + let l:executable = ale#fixers#erlfmt#GetExecutable(a:buffer) + + let l:command = ale#Escape(l:executable) . (empty(l:options) ? '' : ' ' . l:options) . ' %s' + + return { + \ 'command': l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index f725875c..c9535cb0 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -53,8 +53,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort " Use --fix-to-stdout with eslint_d if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { - \ 'command': ale#handlers#eslint#GetCdString(a:buffer) - \ . ale#node#Executable(a:buffer, l:executable) + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), + \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-to-stdout', \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', @@ -64,8 +64,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort " 4.9.0 is the first version with --fix-dry-run if ale#semver#GTE(a:version, [4, 9, 0]) return { - \ 'command': ale#handlers#eslint#GetCdString(a:buffer) - \ . ale#node#Executable(a:buffer, l:executable) + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), + \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', @@ -73,8 +73,8 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort endif return { - \ 'command': ale#handlers#eslint#GetCdString(a:buffer) - \ . ale#node#Executable(a:buffer, l:executable) + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), + \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' --fix %t', diff --git a/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim b/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim new file mode 100644 index 00000000..ebf17c5a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim @@ -0,0 +1,19 @@ +" Author: Chen YuanYuan +" Description: Integration of fish_indent with ALE. + +call ale#Set('fish_fish_indent_executable', 'fish_indent') +call ale#Set('fish_fish_indent_options', '') + +function! ale#fixers#fish_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'fish_fish_indent_executable') + let l:options = ale#Var(a:buffer, 'fish_fish_indent_options') + let l:filename = ale#Escape(bufname(a:buffer)) + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w ' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/isort.vim b/sources_non_forked/ale/autoload/ale/fixers/isort.vim index 9070fb27..ba95bb10 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/isort.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/isort.vim @@ -2,24 +2,33 @@ " Description: Fixing Python imports with isort. call ale#Set('python_isort_executable', 'isort') -call ale#Set('python_isort_options', '') call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_isort_options', '') +call ale#Set('python_isort_auto_pipenv', 0) + +function! ale#fixers#isort#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort']) +endfunction function! ale#fixers#isort#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'python_isort_options') + let l:executable = ale#fixers#isort#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'pipenv$' + \ ? ' run isort' + \ : '' - let l:executable = ale#python#FindExecutable( - \ a:buffer, - \ 'python_isort', - \ ['isort'], - \) - - if !executable(l:executable) + if !executable(l:executable) && l:executable isnot# 'pipenv' return 0 endif return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) . l:exec_args + \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim new file mode 100644 index 00000000..4a548b23 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim @@ -0,0 +1,15 @@ +scriptencoding utf-8 +" Author: houstdav000 +" Description: Fix files with nixfmt + +call ale#Set('nix_nixfmt_executable', 'nixfmt') +call ale#Set('nix_nixfmt_options', '') + +function! ale#fixers#nixfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nix_nixfmt_executable') + let l:options = ale#Var(a:buffer, 'nix_nixfmt_options') + + return { + \ 'command': ale#Escape(l:executable) . ale#Pad(l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index e0f4972e..a080d880 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -34,19 +34,11 @@ function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#prettier#GetProjectRoot(buffer) abort +function! ale#fixers#prettier#GetCwd(buffer) abort let l:config = ale#path#FindNearestFile(a:buffer, '.prettierignore') - if !empty(l:config) - return fnamemodify(l:config, ':h') - endif - " Fall back to the directory of the buffer - return fnamemodify(bufname(a:buffer), ':p:h') -endfunction - -function! ale#fixers#prettier#CdProjectRoot(buffer) abort - return ale#path#CdString(ale#fixers#prettier#GetProjectRoot(a:buffer)) + return !empty(l:config) ? fnamemodify(l:config, ':h') : '%s:h' endfunction function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort @@ -82,8 +74,11 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort \ 'graphql': 'graphql', \ 'markdown': 'markdown', \ 'vue': 'vue', + \ 'svelte': 'svelte', \ 'yaml': 'yaml', + \ 'openapi': 'yaml', \ 'html': 'html', + \ 'ruby': 'ruby', \} for l:filetype in l:filetypes @@ -101,8 +96,8 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort " Special error handling needed for prettier_d if l:executable =~# 'prettier_d$' return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': '%s:h', + \ 'command':ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput', @@ -112,8 +107,8 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort " 1.4.0 is the first version with --stdin-filepath if ale#semver#GTE(a:version, [1, 4, 0]) return { - \ 'command': ale#fixers#prettier#CdProjectRoot(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': ale#fixers#prettier#GetCwd(a:buffer), + \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim index 1e66f49e..09fadd71 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -37,8 +37,8 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort " 4.4.0 is the first version with --stdin-filepath if ale#semver#GTE(a:version, [4, 4, 0]) return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) \ . l:eslint_config_option \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', diff --git a/sources_non_forked/ale/autoload/ale/fixers/protolint.vim b/sources_non_forked/ale/autoload/ale/fixers/protolint.vim new file mode 100644 index 00000000..9b8e72f1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/protolint.vim @@ -0,0 +1,26 @@ +" Author: Yohei Yoshimuta +" Description: Integration of protolint with ALE. + +call ale#Set('proto_protolint_executable', 'protolint') +call ale#Set('proto_protolint_config', '') + +function! ale#fixers#protolint#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'proto_protolint_executable') + + return ale#Escape(l:executable) +endfunction + +function! ale#fixers#protolint#Fix(buffer) abort + let l:executable = ale#fixers#protolint#GetExecutable(a:buffer) + let l:config = ale#Var(a:buffer, 'proto_protolint_config') + + return { + \ 'command': l:executable + \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') + \ . ' -fix' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + + diff --git a/sources_non_forked/ale/autoload/ale/fixers/ptop.vim b/sources_non_forked/ale/autoload/ale/fixers/ptop.vim new file mode 100644 index 00000000..98345226 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ptop.vim @@ -0,0 +1,17 @@ +" Author: BarrOff https://github.com/BarrOff +" Description: Integration of ptop with ALE. + +call ale#Set('pascal_ptop_executable', 'ptop') +call ale#Set('pascal_ptop_options', '') + +function! ale#fixers#ptop#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'pascal_ptop_executable') + let l:options = ale#Var(a:buffer, 'pascal_ptop_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %s %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim b/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim index 54330a37..acb310c6 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim @@ -12,12 +12,12 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix --force-exclusion %t' + \ . ' --fix --force-exclusion --stdin %s' endfunction function! ale#fixers#standardrb#Fix(buffer) abort return { \ 'command': ale#fixers#standardrb#GetCommand(a:buffer), - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim index 6f4cf177..da067198 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim @@ -17,11 +17,10 @@ function! ale#fixers#stylelint#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'stylelint_options') return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#node#Executable(a:buffer, l:executable) - \ . ' %t' + \ 'cwd': '%s:h', + \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) - \ . ' --fix', - \ 'read_temporary_file': 1, + \ . ' --fix --stdin --stdin-filename %s', + \ 'read_temporary_file': 0, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim new file mode 100644 index 00000000..2e780318 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim @@ -0,0 +1,13 @@ +" Author: fiatjaf +" Description: Integration of `v fmt` with ALE. + +call ale#Set('v_vfmt_options', '') + +function! ale#fixers#vfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'v_v_executable') + let l:options = ale#Var(a:buffer, 'v_vfmt_options') + + return { + \ 'command': ale#Escape(l:executable) . ' fmt' . ale#Pad(l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/xo.vim b/sources_non_forked/ale/autoload/ale/fixers/xo.vim index 882350be..dcf4c737 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/xo.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/xo.vim @@ -1,23 +1,36 @@ " Author: Albert Marquez - https://github.com/a-marquez " Description: Fixing files with XO. -call ale#Set('javascript_xo_executable', 'xo') -call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('javascript_xo_options', '') +function! ale#fixers#xo#Fix(buffer) abort + let l:executable = ale#handlers#xo#GetExecutable(a:buffer) + let l:options = ale#handlers#xo#GetOptions(a:buffer) -function! ale#fixers#xo#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ - \ 'node_modules/xo/cli.js', - \ 'node_modules/.bin/xo', - \]) + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ '%e --version', + \ {b, v -> ale#fixers#xo#ApplyFixForVersion(b, v, l:executable, l:options)} + \) endfunction -function! ale#fixers#xo#Fix(buffer) abort - let l:executable = ale#fixers#xo#GetExecutable(a:buffer) +function! ale#fixers#xo#ApplyFixForVersion(buffer, version, executable, options) abort + let l:executable = ale#node#Executable(a:buffer, a:executable) + let l:options = ale#Pad(a:options) + + " 0.30.0 is the first version with a working --stdin --fix + if ale#semver#GTE(a:version, [0, 30, 0]) + return { + \ 'command': l:executable + \ . ' --stdin --stdin-filename %s' + \ . ' --fix' + \ . l:options, + \} + endif return { - \ 'command': ale#node#Executable(a:buffer, l:executable) - \ . ' --fix %t', + \ 'command': l:executable + \ . ' --fix %t' + \ . l:options, \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim index 966556c9..6654a25c 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim @@ -7,7 +7,6 @@ call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0) function! ale#fixers#yamlfix#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options') - let l:executable = ale#python#FindExecutable( \ a:buffer, \ 'yaml_yamlfix', @@ -19,7 +18,8 @@ function! ale#fixers#yamlfix#Fix(buffer) abort endif return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/floating_preview.vim b/sources_non_forked/ale/autoload/ale/floating_preview.vim new file mode 100644 index 00000000..729e04b4 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/floating_preview.vim @@ -0,0 +1,134 @@ +" Author: Jan-Grimo Sobez +" Author: Kevin Clark +" Description: Floating preview window for showing whatever information in. + +" Precondition: exists('*nvim_open_win') + +function! ale#floating_preview#Show(lines, ...) abort + if !exists('*nvim_open_win') + execute 'echom ''Floating windows not supported in this vim instance.''' + + return + endif + + " Remove the close autocmd so it doesn't happen mid update + augroup ale_floating_preview_window + autocmd! + augroup END + + let l:options = get(a:000, 0, {}) + + " Only create a new window if we need it + if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1 + call s:Create(l:options) + else + call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true) + endif + + " Execute commands in window context + let l:parent_window = nvim_get_current_win() + + call nvim_set_current_win(w:preview['id']) + + for l:command in get(l:options, 'commands', []) + call execute(l:command) + endfor + + call nvim_set_current_win(l:parent_window) + + " Return to parent context on move + augroup ale_floating_preview_window + autocmd! + + if g:ale_close_preview_on_insert + autocmd CursorMoved,TabLeave,WinLeave,InsertEnter ++once call s:Close() + else + autocmd CursorMoved,TabLeave,WinLeave ++once call s:Close() + endif + augroup END + + let [l:lines, l:width, l:height] = s:PrepareWindowContent(a:lines) + + call nvim_win_set_width(w:preview['id'], l:width) + call nvim_win_set_height(w:preview['id'], l:height) + call nvim_buf_set_lines(w:preview['buffer'], 0, -1, v:false, l:lines) + call nvim_buf_set_option(w:preview['buffer'], 'modified', v:false) + call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false) +endfunction + +function! s:PrepareWindowContent(lines) abort + let l:max_height = 10 + + let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)')) + let l:height = min([len(a:lines), l:max_height]) + + if empty(g:ale_floating_window_border) + return [a:lines, l:width, l:height] + endif + + " Add the size of borders + let l:width += 2 + let l:height += 2 + + let l:hor = g:ale_floating_window_border[0] + let l:top = g:ale_floating_window_border[1] + let l:top_left = g:ale_floating_window_border[2] + let l:top_right = g:ale_floating_window_border[3] + let l:bottom_right = g:ale_floating_window_border[4] + let l:bottom_left = g:ale_floating_window_border[5] + + let l:lines = [l:top_left . repeat(l:top, l:width - 2) . l:top_right] + + for l:line in a:lines + let l:line_width = strchars(l:line) + let l:lines = add(l:lines, l:hor . l:line . repeat(' ', l:width - l:line_width - 2). l:hor) + endfor + + " Truncate the lines + if len(l:lines) > l:max_height + 1 + let l:lines = l:lines[0:l:max_height] + endif + + let l:lines = add(l:lines, l:bottom_left . repeat(l:top, l:width - 2) . l:bottom_right) + + return [l:lines, l:width, l:height] +endfunction + +function! s:Create(options) abort + let l:buffer = nvim_create_buf(v:false, v:false) + let l:winid = nvim_open_win(l:buffer, v:false, { + \ 'relative': 'cursor', + \ 'row': 1, + \ 'col': 0, + \ 'width': 42, + \ 'height': 4, + \ 'style': 'minimal' + \ }) + call nvim_buf_set_option(l:buffer, 'buftype', 'acwrite') + call nvim_buf_set_option(l:buffer, 'bufhidden', 'delete') + call nvim_buf_set_option(l:buffer, 'swapfile', v:false) + call nvim_buf_set_option(l:buffer, 'filetype', get(a:options, 'filetype', 'ale-preview')) + + let w:preview = {'id': l:winid, 'buffer': l:buffer} +endfunction + +function! s:Close() abort + let l:mode = mode() + let l:restore_visual = l:mode is# 'v' || l:mode is# 'V' || l:mode is# "\" + + if !exists('w:preview') + return + endif + + call setbufvar(w:preview['buffer'], '&modified', 0) + + if win_id2win(w:preview['id']) > 0 + execute win_id2win(w:preview['id']).'wincmd c' + endif + + unlet w:preview + + if l:restore_visual + normal! gv + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/gradle.vim b/sources_non_forked/ale/autoload/ale/gradle.vim index dc377fb9..ba1add4d 100644 --- a/sources_non_forked/ale/autoload/ale/gradle.vim +++ b/sources_non_forked/ale/autoload/ale/gradle.vim @@ -50,18 +50,25 @@ function! ale#gradle#FindExecutable(buffer) abort return '' endfunction -" Given a buffer number, build a command to print the classpath of the root -" project. Returns an empty string if cannot build the command. +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Gradle is not detected. function! ale#gradle#BuildClasspathCommand(buffer) abort let l:executable = ale#gradle#FindExecutable(a:buffer) - let l:project_root = ale#gradle#FindProjectRoot(a:buffer) - if !empty(l:executable) && !empty(l:project_root) - return ale#path#CdString(l:project_root) - \ . ale#Escape(l:executable) - \ . ' -I ' . ale#Escape(s:init_path) - \ . ' -q printClasspath' + if !empty(l:executable) + let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) + \ . ' -I ' . ale#Escape(s:init_path) + \ . ' -q printClasspath' + \] + endif endif - return '' + return ['', ''] endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/atools.vim b/sources_non_forked/ale/autoload/ale/handlers/atools.vim new file mode 100644 index 00000000..c273fc40 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/atools.vim @@ -0,0 +1,41 @@ +" Author: Leo +" Description: Handlers for output expected from atools + +function! ale#handlers#atools#Handle(buffer, lines) abort + " Format: SEVERITY:[TAG]:PATH:LINENUM:MSG + " Example: MC:[AL5]:./APKBUILD:12:variable set to empty string: install= + let l:pattern = '\([^:]\+\):\([^:]\+\):\([^:]\+\):\(\d\+\):\(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " We are expected to receive 2 characters, the first character + " can be 'S', 'I', 'M' 'T', which are respectively: + " Serious (Error) + " Important (Error) + " Minor (Warning) + " Style (Warning) + " + " The second character can be either 'C' or 'P', which are respectively: + " Certain (Error) + " Possible (Warning) + let l:severity = matchstr(l:match[1], '^.') + let l:certainty = matchstr(l:match[1], '.$') + + let l:type = 'E' + " If the tag returns 'Minor' or 'Style' or is 'Possible' + " then return a warning + + if l:severity is# 'M' || l:severity is# 'T' || l:certainty is# 'P' + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:match[4] + 0, + \ 'text': l:match[5], + \ 'type': l:type, + \ 'code': matchstr(l:match[2], 'AL[0-9]*'), + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim index 7f68ba67..b70ae1bf 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -1,10 +1,9 @@ " Description: Handle errors for cppcheck. -function! ale#handlers#cppcheck#GetCdCommand(buffer) abort +function! ale#handlers#cppcheck#GetCwd(buffer) abort let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) - let l:cd_command = !empty(l:dir) ? ale#path#CdString(l:dir) : '' - return l:cd_command + return !empty(l:dir) ? l:dir : '' endfunction function! ale#handlers#cppcheck#GetBufferPathIncludeOptions(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/deno.vim b/sources_non_forked/ale/autoload/ale/handlers/deno.vim new file mode 100644 index 00000000..4bf4546a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/deno.vim @@ -0,0 +1,52 @@ +" Author: Mohammed Chelouti - https://github.com/motato1 +" Description: Handler functions for Deno. + +call ale#Set('deno_executable', 'deno') +call ale#Set('deno_unstable', 0) +call ale#Set('deno_lsp_project_root', '') + +function! ale#handlers#deno#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'deno_executable') +endfunction + +" Find project root for Deno's language server. +" +" Deno projects do not require a project or configuration file at the project root. +" This means the root directory has to be guessed, +" unless it is explicitly specified by the user. +" +" The project root is determined by ... +" 1. using a user-specified value from deno_lsp_project_root +" 2. looking for common top-level files/dirs +" 3. using the buffer's directory +function! ale#handlers#deno#GetProjectRoot(buffer) abort + let l:project_root = ale#Var(a:buffer, 'deno_lsp_project_root') + + if !empty(l:project_root) + return l:project_root + endif + + let l:possible_project_roots = [ + \ 'tsconfig.json', + \ '.git', + \ bufname(a:buffer), + \] + + for l:possible_root in l:possible_project_roots + let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root) + + if empty(l:project_root) + let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root) + endif + + if !empty(l:project_root) + " dir:p expands to /full/path/to/dir/ whereas + " file:p expands to /full/path/to/file (no trailing slash) + " Appending '/' ensures that :h:h removes the path's last segment + " regardless of whether it is a directory or not. + return fnamemodify(l:project_root . '/', ':p:h:h') + endif + endfor + + return '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index b8610612..e953d40f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -39,9 +39,8 @@ function! ale#handlers#eslint#GetExecutable(buffer) abort return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables) endfunction -" Given a buffer, return a command prefix string which changes directory -" as necessary for running ESLint. -function! ale#handlers#eslint#GetCdString(buffer) abort +" Given a buffer, return an appropriate working directory for ESLint. +function! ale#handlers#eslint#GetCwd(buffer) abort " ESLint 6 loads plugins/configs/parsers from the project root " By default, the project root is simply the CWD of the running process. " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md @@ -60,7 +59,7 @@ function! ale#handlers#eslint#GetCdString(buffer) abort let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' endif - return !empty(l:project_dir) ? ale#path#CdString(l:project_dir) : '' + return !empty(l:project_dir) ? l:project_dir : '' endfunction function! ale#handlers#eslint#GetCommand(buffer) abort @@ -68,8 +67,7 @@ function! ale#handlers#eslint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'javascript_eslint_options') - return ale#handlers#eslint#GetCdString(a:buffer) - \ . ale#node#Executable(a:buffer, l:executable) + return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f json --stdin --stdin-filename %s' endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim index 36dbd259..e11c5377 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim @@ -32,6 +32,8 @@ function! ale#handlers#hdl_checker#GetProjectRoot(buffer) abort if ale#handlers#hdl_checker#IsDotGit(l:project_root) return fnamemodify(l:project_root, ':h:h') endif + + return '' endfunction function! ale#handlers#hdl_checker#GetExecutable(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/inko.vim b/sources_non_forked/ale/autoload/ale/handlers/inko.vim new file mode 100644 index 00000000..73f06871 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/inko.vim @@ -0,0 +1,37 @@ +" Author: Yorick Peterse +" Description: output handlers for the Inko JSON format + +function! ale#handlers#inko#GetType(severity) abort + if a:severity is? 'warning' + return 'W' + endif + + return 'E' +endfunction + +function! ale#handlers#inko#Handle(buffer, lines) abort + try + let l:errors = json_decode(join(a:lines, '')) + catch + return [] + endtry + + if empty(l:errors) + return [] + endif + + let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') + + for l:error in l:errors + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:error['file']), + \ 'lnum': l:error['line'], + \ 'col': l:error['column'], + \ 'text': l:error['message'], + \ 'type': ale#handlers#inko#GetType(l:error['level']), + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim new file mode 100644 index 00000000..07d9b0cf --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim @@ -0,0 +1,23 @@ +" Author: Risto Stevcev +" Description: Handlers for the official OCaml language server + +function! ale#handlers#ocamllsp#GetExecutable(buffer) abort + return 'ocamllsp' +endfunction + +function! ale#handlers#ocamllsp#GetCommand(buffer) abort + let l:executable = ale#handlers#ocamllsp#GetExecutable(a:buffer) + let l:ocaml_ocamllsp_use_opam = ale#Var(a:buffer, 'ocaml_ocamllsp_use_opam') + + return l:ocaml_ocamllsp_use_opam ? 'opam config exec -- ' . l:executable : l:executable +endfunction + +function! ale#handlers#ocamllsp#GetLanguage(buffer) abort + return getbufvar(a:buffer, '&filetype') +endfunction + +function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort + let l:dune_project_file = ale#path#FindNearestFile(a:buffer, 'dune-project') + + return !empty(l:dune_project_file) ? fnamemodify(l:dune_project_file, ':h') : '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim index 701c43b2..17de2912 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim @@ -40,21 +40,21 @@ function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort return '' endfunction +function! ale#handlers#shellcheck#GetCwd(buffer) abort + return ale#Var(a:buffer, 'sh_shellcheck_change_directory') ? '%s:h' : '' +endfunction + function! ale#handlers#shellcheck#GetCommand(buffer, version) abort let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' - let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' if l:dialect is# 'auto' let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer) endif - return l:cd_string - \ . '%e' + return '%e' \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') @@ -111,6 +111,7 @@ function! ale#handlers#shellcheck#DefineLinter(filetype) abort call ale#linter#Define(a:filetype, { \ 'name': 'shellcheck', \ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, + \ 'cwd': function('ale#handlers#shellcheck#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'sh_shellcheck_executable'), diff --git a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim new file mode 100644 index 00000000..61ab2a60 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim @@ -0,0 +1,98 @@ +" Author: Henrique Barcelos <@hbarcelos> +" Description: Functions for working with local solhint for checking *.sol files. + +let s:executables = [ +\ 'node_modules/.bin/solhint', +\ 'node_modules/solhint/solhint.js', +\ 'solhint', +\] + +let s:sep = has('win32') ? '\' : '/' + +call ale#Set('solidity_solhint_options', '') +call ale#Set('solidity_solhint_executable', 'solhint') +call ale#Set('solidity_solhint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#handlers#solhint#Handle(buffer, lines) abort + " Matches patterns like the following: + " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) + let l:output = [] + + let l:lint_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' + + for l:match in ale#util#GetMatches(a:lines, l:lint_pattern) + let l:isError = l:match[3] is? 'error' + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'code': l:match[5], + \ 'type': l:isError ? 'E' : 'W', + \}) + endfor + + let l:syntax_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (Parse error): (.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:syntax_pattern) + let l:isError = l:match[3] is? 'error' + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[5], + \ 'code': l:match[4], + \ 'type': l:isError ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +function! ale#handlers#solhint#FindConfig(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:basename in [ + \ '.solhintrc.js', + \ '.solhintrc.json', + \ '.solhintrc', + \] + let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep)) + + if filereadable(l:config) + return l:config + endif + endfor + endfor + + return ale#path#FindNearestFile(a:buffer, 'package.json') +endfunction + +function! ale#handlers#solhint#GetExecutable(buffer) abort + return ale#node#FindExecutable(a:buffer, 'solidity_solhint', s:executables) +endfunction + +" Given a buffer, return an appropriate working directory for solhint. +function! ale#handlers#solhint#GetCwd(buffer) abort + " If solhint is installed in a directory which contains the buffer, assume + " it is the solhint project root. Otherwise, use nearest node_modules. + " Note: If node_modules not present yet, can't load local deps anyway. + let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + + if !empty(l:executable) + let l:nmi = strridx(l:executable, 'node_modules') + let l:project_dir = l:executable[0:l:nmi - 2] + else + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') + let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + endif + + return !empty(l:project_dir) ? l:project_dir : '' +endfunction + +function! ale#handlers#solhint#GetCommand(buffer) abort + let l:executable = ale#handlers#solhint#GetExecutable(a:buffer) + + let l:options = ale#Var(a:buffer, 'solidity_solhint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --formatter compact %s' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/spectral.vim b/sources_non_forked/ale/autoload/ale/handlers/spectral.vim new file mode 100644 index 00000000..1eb4a5de --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/spectral.vim @@ -0,0 +1,31 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +function! ale#handlers#spectral#HandleSpectralOutput(buffer, lines) abort + " Matches patterns like the following: + " openapi.yml:1:1 error oas3-schema "Object should have required property `info`." + " openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array." + let l:pattern = '\v^.*:(\d+):(\d+) (error|warning) (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'text': l:match[4], + \} + + let l:code_match = matchlist(l:obj.text, '\v^(.+) "(.+)"$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[1] + let l:obj.text = l:code_match[2] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/xo.vim b/sources_non_forked/ale/autoload/ale/handlers/xo.vim new file mode 100644 index 00000000..c63278c0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/xo.vim @@ -0,0 +1,44 @@ +call ale#Set('javascript_xo_executable', 'xo') +call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_xo_options', '') + +call ale#Set('typescript_xo_executable', 'xo') +call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_xo_options', '') + +function! ale#handlers#xo#GetExecutable(buffer) abort + let l:type = ale#handlers#xo#GetType(a:buffer) + + return ale#node#FindExecutable(a:buffer, l:type . '_xo', [ + \ 'node_modules/xo/cli.js', + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale#handlers#xo#GetLintCommand(buffer) abort + return ale#Escape(ale#handlers#xo#GetExecutable(a:buffer)) + \ . ale#Pad(ale#handlers#xo#GetOptions(a:buffer)) + \ . ' --reporter json --stdin --stdin-filename %s' +endfunction + +function! ale#handlers#xo#GetOptions(buffer) abort + let l:type = ale#handlers#xo#GetType(a:buffer) + + return ale#Var(a:buffer, l:type . '_xo_options') +endfunction + +" xo uses eslint and the output format is the same +function! ale#handlers#xo#HandleJSON(buffer, lines) abort + return ale#handlers#eslint#HandleJSON(a:buffer, a:lines) +endfunction + +function! ale#handlers#xo#GetType(buffer) abort + let l:filetype = getbufvar(a:buffer, '&filetype') + let l:type = 'javascript' + + if l:filetype =~# 'typescript' + let l:type = 'typescript' + endif + + return l:type +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim b/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim new file mode 100644 index 00000000..5e04577d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim @@ -0,0 +1,39 @@ +function! ale#handlers#yamllint#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options')) + \ . ' -f parsable %t' +endfunction + +function! ale#handlers#yamllint#Handle(buffer, lines) abort + " Matches patterns line the following: + " something.yaml:1:1: [warning] missing document start "---" (document-start) + " something.yml:2:1: [error] syntax error: expected the node content, but found '' + let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \} + + let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$') + + if !empty(l:code_match) + if l:code_match[2] is# 'trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + let l:item.text = l:code_match[1] + let l:item.code = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 1d38f3b9..cb0379fd 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -46,6 +46,10 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort call balloon_show(a:response.body.displayString) elseif get(l:options, 'truncated_echo', 0) call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0]) + elseif g:ale_hover_to_floating_preview || g:ale_floating_preview + call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), { + \ 'filetype': 'ale-preview.message', + \}) elseif g:ale_hover_to_preview call ale#preview#Show(split(a:response.body.displayString, "\n"), { \ 'filetype': 'ale-preview.message', @@ -226,6 +230,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort call balloon_show(join(l:lines, "\n")) elseif get(l:options, 'truncated_echo', 0) call ale#cursor#TruncatedEcho(l:lines[0]) + elseif g:ale_hover_to_floating_preview || g:ale_floating_preview + call ale#floating_preview#Show(l:lines, { + \ 'filetype': 'ale-preview.message', + \ 'commands': l:commands, + \}) elseif g:ale_hover_to_preview call ale#preview#Show(l:lines, { \ 'filetype': 'ale-preview.message', diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 645c25f9..d26b9443 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -38,11 +38,13 @@ let s:default_ale_linter_aliases = { " " NOTE: Update the g:ale_linters documentation when modifying this. let s:default_ale_linters = { +\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], +\ 'inko': ['inko'], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], @@ -51,6 +53,7 @@ let s:default_ale_linters = { \ 'text': [], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], +\ 'v': ['v'], \} " Testing/debugging helper to unload all linters. @@ -149,17 +152,30 @@ function! ale#linter#PreProcess(filetype, linter) abort endif let l:obj.address = a:linter.address + + if has_key(a:linter, 'cwd') + throw '`cwd` makes no sense for socket LSP connections' + endif else throw '`address` must be defined for getting the LSP address' endif + if has_key(a:linter, 'cwd') + let l:obj.cwd = a:linter.cwd + + if type(l:obj.cwd) isnot v:t_string + \&& type(l:obj.cwd) isnot v:t_func + throw '`cwd` must be a String or Function if defined' + endif + endif + if l:needs_lsp_details " Default to using the filetype as the language. let l:obj.language = get(a:linter, 'language', a:filetype) if type(l:obj.language) isnot v:t_string \&& type(l:obj.language) isnot v:t_func - throw '`language` must be a String or Funcref if defined' + throw '`language` must be a String or Function if defined' endif if has_key(a:linter, 'project_root') @@ -413,6 +429,12 @@ function! ale#linter#GetExecutable(buffer, linter) abort \ : l:Executable endfunction +function! ale#linter#GetCwd(buffer, linter) abort + let l:Cwd = get(a:linter, 'cwd', v:null) + + return type(l:Cwd) is v:t_func ? l:Cwd(a:buffer) : l:Cwd +endfunction + " Given a buffer and linter, get the command String for the linter. function! ale#linter#GetCommand(buffer, linter) abort let l:Command = a:linter.command diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 4bfe2a7b..c2ae5cc5 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -20,11 +20,17 @@ endif " Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list function! ale#list#IsQuickfixOpen() abort - for l:buf in range(1, bufnr('$')) - if getbufvar(l:buf, '&buftype') is# 'quickfix' - return 1 - endif - endfor + let l:res = getqflist({ 'winid' : winnr() }) + + if has_key(l:res, 'winid') && l:res.winid > 0 + return 1 + endif + + let l:res = getloclist(0, { 'winid' : winnr() }) + + if has_key(l:res, 'winid') && l:res.winid > 0 + return 1 + endif return 0 endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index cb0573aa..1f854bc5 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -357,6 +357,7 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort let l:conn.capabilities.completion = 1 let l:conn.capabilities.completion_trigger_characters = ['.'] let l:conn.capabilities.definition = 1 + let l:conn.capabilities.typeDefinition = 1 let l:conn.capabilities.symbol_search = 1 let l:conn.capabilities.rename = 1 let l:conn.capabilities.code_actions = 1 diff --git a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim index 3c1b47ed..00213a75 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim @@ -64,6 +64,14 @@ function! ale#lsp#tsserver_message#Definition(buffer, line, column) abort \}] endfunction +function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort + return [0, 'ts@typeDefinition', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction + function! ale#lsp#tsserver_message#References(buffer, line, column) abort return [0, 'ts@references', { \ 'line': a:line, diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index dcd76e8f..b8885f31 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -85,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort endif let l:info.syntax_loclist = l:thislist - else + elseif a:error_type is# 'semantic' if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0 let l:no_changes = 1 endif let l:info.semantic_loclist = l:thislist + else + if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0 + let l:no_changes = 1 + endif + + let l:info.suggestion_loclist = l:thislist endif if l:no_changes @@ -98,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort endif let l:loclist = get(l:info, 'semantic_loclist', []) + \ + get(l:info, 'suggestion_loclist', []) \ + get(l:info, 'syntax_loclist', []) call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0) @@ -150,6 +157,10 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'syntaxDiag' call s:HandleTSServerDiagnostics(a:response, 'syntax') + elseif get(a:response, 'type', '') is# 'event' + \&& get(a:response, 'event', '') is# 'suggestionDiag' + \&& get(g:, 'ale_lsp_suggestions', '1') == 1 + call s:HandleTSServerDiagnostics(a:response, 'suggestion') endif endfunction @@ -190,7 +201,11 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort endfunction function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort - let l:buffer_ale_root = getbufvar(a:buffer, 'ale_lsp_root', {}) + let l:buffer_ale_root = getbufvar( + \ a:buffer, + \ 'ale_root', + \ getbufvar(a:buffer, 'ale_lsp_root', {}) + \) if type(l:buffer_ale_root) is v:t_string return l:buffer_ale_root @@ -207,9 +222,15 @@ function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort endif endif + let l:global_root = g:ale_root + + if empty(g:ale_root) && exists('g:ale_lsp_root') + let l:global_root = g:ale_lsp_root + endif + " Try to get a global setting for the root - if has_key(g:ale_lsp_root, a:linter.name) - let l:Root = g:ale_lsp_root[a:linter.name] + if has_key(l:global_root, a:linter.name) + let l:Root = l:global_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) @@ -273,13 +294,15 @@ function! s:StartLSP(options, address, executable, command) abort call ale#lsp#MarkConnectionAsTsserver(l:conn_id) endif + let l:cwd = ale#linter#GetCwd(l:buffer, l:linter) let l:command = ale#command#FormatCommand( \ l:buffer, \ a:executable, \ a:command, \ 0, \ v:false, - \ [], + \ l:cwd, + \ ale#GetFilenameMappings(l:buffer, l:linter.name), \)[1] let l:command = ale#job#PrepareCommand(l:buffer, l:command) let l:ready = ale#lsp#StartProgram(l:conn_id, a:executable, l:command) diff --git a/sources_non_forked/ale/autoload/ale/maven.vim b/sources_non_forked/ale/autoload/ale/maven.vim index 745f8c93..4f87ebb7 100644 --- a/sources_non_forked/ale/autoload/ale/maven.vim +++ b/sources_non_forked/ale/autoload/ale/maven.vim @@ -17,7 +17,6 @@ function! ale#maven#FindProjectRoot(buffer) abort return '' endfunction - " Given a buffer number, find the path to the executable. " First search on the path for 'mvnw' (mvnw.cmd on Windows), if nothing is found, " try the global command. Returns an empty string if cannot find the executable. @@ -25,7 +24,7 @@ function! ale#maven#FindExecutable(buffer) abort let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd' let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd) - if executable(l:wrapper_path) + if !empty(l:wrapper_path) && executable(l:wrapper_path) return l:wrapper_path endif @@ -36,16 +35,23 @@ function! ale#maven#FindExecutable(buffer) abort return '' endfunction -" Given a buffer number, build a command to print the classpath of the root -" project. Returns an empty string if cannot build the command. +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Maven is not detected. function! ale#maven#BuildClasspathCommand(buffer) abort let l:executable = ale#maven#FindExecutable(a:buffer) - let l:project_root = ale#maven#FindProjectRoot(a:buffer) - if !empty(l:executable) && !empty(l:project_root) - return ale#path#CdString(l:project_root) - \ . l:executable . ' dependency:build-classpath' + if !empty(l:executable) + let l:project_root = ale#maven#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) . ' dependency:build-classpath' + \] + endif endif - return '' + return ['', ''] endfunction diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index fed95ccd..00e31310 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -77,26 +77,6 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor return l:path endfunction -" Output 'cd && ' -" This function can be used changing the directory for a linter command. -function! ale#path#CdString(directory) abort - if has('win32') - return 'cd /d ' . ale#Escape(a:directory) . ' && ' - endif - - return 'cd ' . ale#Escape(a:directory) . ' && ' -endfunction - -" Output 'cd && ' -" This function can be used changing the directory for a linter command. -function! ale#path#BufferCdString(buffer) abort - if has('win32') - return 'cd /d %s:h && ' - endif - - return 'cd %s:h && ' -endfunction - " Return 1 if a path is an absolute path. function! ale#path#IsAbsolute(filename) abort if has('win32') && a:filename[:0] is# '\' @@ -136,7 +116,7 @@ function! ale#path#Dirname(path) abort endif " For /foo/bar/ we need :h:h to get /foo - if a:path[-1:] is# '/' + if a:path[-1:] is# '/' || (has('win32') && a:path[-1:] is# '\') return fnamemodify(a:path, ':h:h') endif diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 7ed22367..fc6c1130 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -32,6 +32,8 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/.pylintrc') \|| filereadable(l:path . '/Pipfile') \|| filereadable(l:path . '/Pipfile.lock') + \|| filereadable(l:path . '/poetry.lock') + \|| filereadable(l:path . '/pyproject.toml') return l:path endif endfor diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 8109c60e..2864f39b 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -50,9 +50,12 @@ if !hlexists('ALESignColumnWithErrors') endif function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort + let l:verbose = &verbose + set verbose=0 redir => l:output 0verbose silent highlight SignColumn redir end + let &verbose = l:verbose let l:highlight_syntax = join(split(l:output)[2:]) let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') diff --git a/sources_non_forked/ale/autoload/ale/socket.vim b/sources_non_forked/ale/autoload/ale/socket.vim index 7e069fb5..61f11e70 100644 --- a/sources_non_forked/ale/autoload/ale/socket.vim +++ b/sources_non_forked/ale/autoload/ale/socket.vim @@ -72,9 +72,8 @@ function! ale#socket#Open(address, options) abort elseif exists('*chansend') && exists('*sockconnect') " NeoVim 0.3+ try - let l:channel_id = sockconnect('tcp', a:address, { - \ 'on_data': function('s:NeoVimOutputCallback'), - \}) + let l:channel_id = sockconnect(stridx(a:address, ':') != -1 ? 'tcp' : 'pipe', + \ a:address, {'on_data': function('s:NeoVimOutputCallback')}) let l:channel_info.last_line = '' catch /connection failed/ let l:channel_id = -1 diff --git a/sources_non_forked/ale/autoload/ale/swift.vim b/sources_non_forked/ale/autoload/ale/swift.vim index b31b8dc5..3232d42a 100644 --- a/sources_non_forked/ale/autoload/ale/swift.vim +++ b/sources_non_forked/ale/autoload/ale/swift.vim @@ -11,3 +11,60 @@ function! ale#swift#FindProjectRoot(buffer) abort return '' endfunction + +" Support Apple Swift Format {{{1 + +call ale#Set('swift_appleswiftformat_executable', 'swift-format') +call ale#Set('swift_appleswiftformat_use_swiftpm', 0) + +" Return the executable depending on whether or not to use Swift Package Manager. +" +" If not asked to use Swift Package Manager (use_swiftpm = 0), the returned +" value is the global executable, else the returned value is 'swift' because +" the final command line will be `swift run swift-format ...`. +" +" Failure is expected if use_swiftpm is `1` but no Package.swift can be located. +function! ale#swift#GetAppleSwiftFormatExecutable(buffer) abort + if !ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') + return ale#Var(a:buffer, 'swift_appleswiftformat_executable') + endif + + if ale#path#FindNearestFile(a:buffer, 'Package.swift') is# '' + " If there is no Package.swift file, we don't use swift-format even if it exists, + " so we return '' to indicate failure. + return '' + endif + + return 'swift' +endfunction + +" Return the command depending on whether or not to use Swift Package Manager. +" +" If asked to use Swift Package Manager (use_swiftpm = 1), the command +" arguments are prefixed with 'swift run'. +" +" In either case, the configuration file is located and added to the command. +function! ale#swift#GetAppleSwiftFormatCommand(buffer) abort + let l:executable = ale#swift#GetAppleSwiftFormatExecutable(a:buffer) + let l:command_args = '' + + if ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') + let l:command_args = ' ' . 'run swift-format' + endif + + return ale#Escape(l:executable) . l:command_args +endfunction + +" Locate the nearest '.swift-format' configuration file, and return the +" arguments, else return an empty string. +function! ale#swift#GetAppleSwiftFormatConfigArgs(buffer) abort + let l:config_filepath = ale#path#FindNearestFile(a:buffer, '.swift-format') + + if l:config_filepath isnot# '' + return '--configuration' . ' ' . l:config_filepath + endif + + return '' +endfunction + +" }}} diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim index 6fcbf35e..4d75d515 100644 --- a/sources_non_forked/ale/autoload/ale/test.vim +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -34,12 +34,11 @@ function! ale#test#RestoreDirectory() abort unlet! g:dir endfunction -" Change the filename for the current buffer using a relative path to -" the script without running autocmd commands. +" Get a filename for the current buffer using a relative path to the script. " " If a g:dir variable is set, it will be used as the path to the directory " containing the test file. -function! ale#test#SetFilename(path) abort +function! ale#test#GetFilename(path) abort let l:dir = get(g:, 'dir', '') if empty(l:dir) @@ -50,7 +49,17 @@ function! ale#test#SetFilename(path) abort \ ? a:path \ : l:dir . '/' . a:path - silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path)) + return ale#path#Simplify(l:full_path) +endfunction + +" Change the filename for the current buffer using a relative path to +" the script without running autocmd commands. +" +" If a g:dir variable is set, it will be used as the path to the directory +" containing the test file. +function! ale#test#SetFilename(path) abort + let l:full_path = ale#test#GetFilename(a:path) + silent! noautocmd execute 'file ' . fnameescape(l:full_path) endfunction function! s:RemoveModule(results) abort diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index fcc03eb7..5b2bfcd7 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -340,6 +340,16 @@ function! ale#util#GetMatches(lines, patterns) abort return l:matches endfunction +" Given a single line, or a List of lines, and a single pattern, or a List of +" patterns, and a callback function for mapping the items matches, return the +" result of mapping all of the matches for the lines from the given patterns, +" using matchlist() +" +" Only the first pattern which matches a line will be returned. +function! ale#util#MapMatches(lines, patterns, Callback) abort + return map(ale#util#GetMatches(a:lines, a:patterns), 'a:Callback(v:val)') +endfunction + function! s:LoadArgCount(function) abort try let l:output = execute('function a:function') @@ -409,7 +419,7 @@ function! ale#util#FuzzyJSONDecode(data, default) abort endif return l:result - catch /E474/ + catch /E474\|E491/ return a:default endtry endfunction @@ -486,7 +496,7 @@ function! ale#util#Input(message, value) abort endfunction function! ale#util#HasBuflineApi() abort - return exists('*deletebufline') && exists('*appendbufline') && exists('*getpos') && exists('*setpos') + return exists('*deletebufline') && exists('*setbufline') endfunction " Sets buffer contents to lines @@ -507,11 +517,8 @@ function! ale#util#SetBufferContents(buffer, lines) abort " Use a Vim API for setting lines in other buffers, if available. if l:has_bufline_api - let l:save_cursor = getpos('.') - call deletebufline(a:buffer, 1, '$') - call appendbufline(a:buffer, 1, l:new_lines) - call deletebufline(a:buffer, 1, 1) - call setpos('.', l:save_cursor) + call setbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, l:first_line_to_remove, '$') " Fall back on setting lines the old way, for the current buffer. else let l:old_line_length = line('$') diff --git a/sources_non_forked/ale/doc/ale-ada.txt b/sources_non_forked/ale/doc/ale-ada.txt index 2ac30c0a..0fc55a9c 100644 --- a/sources_non_forked/ale/doc/ale-ada.txt +++ b/sources_non_forked/ale/doc/ale-ada.txt @@ -32,5 +32,35 @@ g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options* This variable can be set to pass extra options to the gnatpp fixer. +=============================================================================== +ada-language-server *ale-ada-language-server* + +g:ale_ada_adals_executable *g:ale_ada_adals_executable* + *b:ale_ada_adals_executable* + Type: |String| + Default: `'ada_language_server'` + + This variable can be changed to use a different executable for Ada Language + Server. + + +g:ale_ada_adals_project *g:ale_ada_adals_project* + *b:ale_ada_adals_project* + Type: |String| + Default: `'default.gpr'` + +This variable can be changed to use a different GPR file for +Ada Language Server. + + +g:ale_ada_adals_encoding *g:ale_ada_adals_encoding* + *b:ale_ada_adals_encoding* + Type: |String| + Default: `'utf-8'` + +This variable can be changed to use a different file encoding for +Ada Language Server. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-apkbuild.txt b/sources_non_forked/ale/doc/ale-apkbuild.txt new file mode 100644 index 00000000..05261400 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-apkbuild.txt @@ -0,0 +1,30 @@ +=============================================================================== +ALE APKBUILD Integration *ale-apkbuild-options* + + +=============================================================================== +apkbuild-lint *ale-apkbuild-apkbuild-lint* + +g:ale_apkbuild_apkbuild_lint_executable + *g:ale_apkbuild_apkbuild_lint_executable* + *b:ale_apkbuild_apkbuild_lint_executable* + + Type: |String| + Default: `'apkbuild-lint'` + + This variable can be set to change the path to apkbuild-lint + +=============================================================================== +secfixes-check *ale-apkbuild-secfixes-check* + +g:ale_apkbuild_secfixes_check_executable + *g:ale_apkbuild_secfixes_check_executable* + *b:ale_apkbuild_secfixes_check_executable* + + Type: |String| + Default: `'secfixes-check'` + + This variable can be set to change the path to secfixes-check + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-bazel.txt b/sources_non_forked/ale/doc/ale-bazel.txt new file mode 100644 index 00000000..e2922aaf --- /dev/null +++ b/sources_non_forked/ale/doc/ale-bazel.txt @@ -0,0 +1,28 @@ +=============================================================================== +ALE Bazel Integration *ale-bazel-options* + +=============================================================================== +buildifier *ale-bazel-buildifier* + +g:ale_bazel_buildifier_executable *g:ale_bazel_buildifier_executable* + *b:ale_bazel_buildifier_executable* + Type: |String| + Default: `'buildifier'` + + See |ale-integrations-local-executables| + + +g:ale_bazel_buildifier_options *g:ale_bazel_buildifier_options* + *b:ale_bazel_buildifier_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to buildifier. + + +g:ale_bazel_buildifier_use_global *g:ale_bazel_buildifier_use_global* + *b:ale_bazel_buildifier_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index b0d94b8e..3b9fbc44 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -202,7 +202,45 @@ g:ale_c_clangformat_options *g:ale_c_clangformat_options* Type: |String| Default: `''` - This variable can be change to modify flags given to clang-format. + This variable can be changed to modify flags given to clang-format. + + +g:ale_c_clangformat_style_option *g:ale_c_clangformat_style_option* + *b:ale_c_clangformat_style_option* + Type: |String| + Default: `''` + + This variable can be changed to modify only the style flag given to + clang-format. The contents of the variable are passed directly to the -style + flag of clang-format. + + Example: > + { + \ BasedOnStyle: Microsoft, + \ ColumnLimit: 80, + \ AllowShortBlocksOnASingleLine: Always, + \ AllowShortFunctionsOnASingleLine: Inline, + \ } +< + If you set this variable, ensure you don't modify -style in + |g:ale_c_clangformat_options|, as this will cause clang-format to error. + + +g:ale_c_clangformat_use_local_file *g:ale_c_clangformat_use_local_file* + *b:ale_c_clangformat_use_local_file* + Type: |Number| + Default: `0` + + This variable can be changed to modify whether to use a local .clang-format + file. If the file is found, the flag '-style=file' is passed to clang-format + and any options configured via |g:ale_c_clangformat_style_option| are not + passed. + + If this option is enabled but no .clang-format file is found, default back to + |g:ale_c_clangformat_style_option|, if it set. + + If you set this variable, ensure you don't modify -style in + |g:ale_c_clangformat_options|, as this will cause clang-format to error. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-cuda.txt b/sources_non_forked/ale/doc/ale-cuda.txt index 0e53f756..06aa48ce 100644 --- a/sources_non_forked/ale/doc/ale-cuda.txt +++ b/sources_non_forked/ale/doc/ale-cuda.txt @@ -21,6 +21,24 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options* This variable can be changed to modify flags given to nvcc. +=============================================================================== +clangd *ale-cuda-clangd* + +g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable* + *b:ale_cuda_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cuda_clangd_options *g:ale_cuda_clangd_options* + *b:ale_cuda_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + =============================================================================== clang-format *ale-cuda-clangformat* diff --git a/sources_non_forked/ale/doc/ale-dafny.txt b/sources_non_forked/ale/doc/ale-dafny.txt new file mode 100644 index 00000000..005170ad --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dafny.txt @@ -0,0 +1,16 @@ +=============================================================================== +ALE Dafny Integration *ale-dafny-options* + + +=============================================================================== +dafny *ale-dafny-dafny* + +g:ale_dafny_dafny_timelimit *g:ale_dafny_dafny_timelimit* + *b:ale_dafny_dafny_timelimit* + Type: |Number| + Default: `10` + + This variable sets the `/timeLimit` used for dafny. + + + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dart.txt b/sources_non_forked/ale/doc/ale-dart.txt index a6d88dd8..01089252 100644 --- a/sources_non_forked/ale/doc/ale-dart.txt +++ b/sources_non_forked/ale/doc/ale-dart.txt @@ -2,6 +2,31 @@ ALE Dart Integration *ale-dart-options* +=============================================================================== +analysis_server *ale-dart-analysis_server* + +Installation +------------------------------------------------------------------------------- + +Install Dart via whatever means. `analysis_server` will be included in the SDK. + +In case that `dart` is not in your path, try to set the executable option to +its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_analysis_server_executable = '/usr/local/bin/dart' +< + +Options +------------------------------------------------------------------------------- + +g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable* + *b:ale_dart_analysis_server_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to change the path of dart. + + =============================================================================== dartanalyzer *ale-dart-dartanalyzer* diff --git a/sources_non_forked/ale/doc/ale-desktop.txt b/sources_non_forked/ale/doc/ale-desktop.txt new file mode 100644 index 00000000..62269e9c --- /dev/null +++ b/sources_non_forked/ale/doc/ale-desktop.txt @@ -0,0 +1,21 @@ +=============================================================================== +ALE desktop Integration *ale-desktop-options* + + +=============================================================================== +desktop-file-validate *ale-desktop-desktop-file-validate* + +ALE supports checking .desktop files with `desktop-file-validate.` + + +g:ale_desktop_desktop_file_validate_options + *g:ale_desktop_desktop_file_validate_options* + *b:ale_desktop_desktop_file_validate_options* + Type: |String| + Default: `''` + + This variable can be changed to set options for `desktop-file-validate`, + such as `'--warn-kde'`. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index afd9798f..7f8ec28f 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -148,13 +148,14 @@ Apply the following rules when writing Bash scripts. =============================================================================== 4. Testing ALE *ale-development-tests* *ale-dev-tests* *ale-tests* -ALE is tested with a suite of tests executed in Travis CI and AppVeyor. ALE -runs tests with the following versions of Vim in the following environments. +ALE is tested with a suite of tests executed via GitHub Actions and AppVeyor. +ALE runs tests with the following versions of Vim in the following +environments. -1. Vim 8.0.0027 on Linux via Travis CI. -2. Vim 8.1.0519 on Linux via Travis CI. -3. NeoVim 0.2.0 on Linux via Travis CI. -4. NeoVim 0.3.5 on Linux via Travis CI. +1. Vim 8.0.0027 on Linux via GitHub Actions. +2. Vim 8.2.2401 on Linux via GitHub Actions. +3. NeoVim 0.2.0 on Linux via GitHub Actions. +4. NeoVim 0.4.4 on Linux via GitHub Actions. 5. Vim 8 (stable builds) on Windows via AppVeyor. If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs @@ -180,19 +181,24 @@ Generally write tests for any changes you make. The following types of tests are recommended for the following types of code. * New/edited error handler callbacks -> Write tests in `test/handler` -* New/edited command callbacks -> Write tests in `test/command_callback` +* New/edited linter definition -> Write tests in `test/linter` * New/edited fixer functions -> Write tests in `test/fixers` Look at existing tests in the codebase for examples of how to write tests. Refer to the Vader documentation for general information on how to write Vader tests: https://github.com/junegunn/vader.vim +If you need to add any supporting files for tests, such as empty files present +to test searching upwards through paths for configuration files, they can be +added to the `test/test-files` directory. + See |ale-development-linter-tests| for more information on how to write linter tests. When you add new linters or fixers, make sure to add them into the tables in supported-tools.md and |ale-supported-languages-and-tools.txt|. If you forget to -keep them both in sync, you should see an error like the following in Travis CI. +keep them both in sync, you should see an error like the following in the +builds run for GitHub Actions. > ======================================== diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables @@ -272,8 +278,8 @@ be written like so. > \ '1:Something went wrong', \ ] < -Tests for what ALE runs should go in the `test/command_callback` directory, -and should be written like so. > +Tests for what ALE runs should go in the `test/linter` directory, and should +be written like so. > Before: " Load the linter and set up a series of commands, reset linter variables, @@ -309,6 +315,7 @@ The full list of commands that will be temporarily defined for linter tests given the above setup are as follows. `GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertLinterCwd cwd` - Check the `cwd` for the linter. `AssertLinter executable, command` - Check the executable and command. `AssertLinterNotExecuted` - Check that linters will not be executed. `AssertLSPLanguage language` - Check the language given to an LSP server. @@ -355,6 +362,7 @@ The full list of commands that will be temporarily defined for fixer tests given the above setup are as follows. `GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertFixerCwd cwd` - Check the `cwd` for the fixer. `AssertFixer results` - Check the fixer results `AssertFixerNotExecuted` - Check that fixers will not be executed. diff --git a/sources_non_forked/ale/doc/ale-dhall.txt b/sources_non_forked/ale/doc/ale-dhall.txt new file mode 100644 index 00000000..44b0bf32 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dhall.txt @@ -0,0 +1,52 @@ +=============================================================================== +ALE Dhall Integration *ale-dhall-options* + +g:ale_dhall_executable *g:ale_dhall_executable* + *b:ale_dhall_executable* + Type: |String| + Default: `'dhall'` + +g:ale_dhall_options g:ale_dhall_options + b:ale_dhall_options + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the 'dhall` executable. + This is shared with `dhall-freeze` and `dhall-lint`. +> + let g:dhall_options = '--ascii' +< + +=============================================================================== +dhall-format *ale-dhall-format* + +Dhall + (https://dhall-lang.org/) + + +=============================================================================== +dhall-freeze *ale-dhall-freeze* + +Dhall + (https://dhall-lang.org/) + +g:ale_dhall_freeze_options g:ale_dhall_freeze_options + b:ale_dhall_freeze_options + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the 'dhall freeze` + executable. +> + let g:dhall_freeze_options = '--all' +< + +=============================================================================== +dhall-lint *ale-dhall-lint* + +Dhall + (https://dhall-lang.org/) + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index de9daacf..a4e5c2c6 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -85,5 +85,12 @@ g:ale_elixir_credo_strict *g:ale_elixir_credo_strict* Tells credo to run in strict mode or suggest mode. Set variable to 1 to enable --strict mode. +g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file + + Type: String + Default: '' + + Tells credo to use a custom configuration file. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-erlang.txt b/sources_non_forked/ale/doc/ale-erlang.txt index 38762f08..ede179d1 100644 --- a/sources_non_forked/ale/doc/ale-erlang.txt +++ b/sources_non_forked/ale/doc/ale-erlang.txt @@ -13,6 +13,14 @@ g:ale_erlang_dialyzer_executable *g:ale_erlang_dialyzer_executable* This variable can be changed to specify the dialyzer executable. +g:ale_erlang_dialyzer_options *g:ale_erlang_dialyzer_options* + *b:ale_erlang_dialyzer_options* + Type: |String| + Default: `'-Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspec'` + + This variable can be changed to specify the options to pass to the dialyzer + executable. + g:ale_erlang_dialyzer_plt_file *g:ale_erlang_dialyzer_plt_file* *b:ale_erlang_dialyzer_plt_file* Type: |String| @@ -46,6 +54,14 @@ g:ale_erlang_elvis_executable *g:ale_erlang_elvis_executable* ------------------------------------------------------------------------------- erlc *ale-erlang-erlc* +g:ale_erlang_erlc_executable *g:ale_erlang_erlc_executable* + *b:ale_erlang_erlc_executable* + Type: |String| + Default: `'erlc'` + + This variable can be changed to specify the erlc executable. + + g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* *b:ale_erlang_erlc_options* Type: |String| @@ -55,6 +71,26 @@ g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* or `-pa`. +------------------------------------------------------------------------------- +erlfmt *ale-erlang-erlfmt* + +g:ale_erlang_erlfmt_executable *g:ale_erlang_erlfmt_executable* + *b:ale_erlang_erlfmt_executable* + Type: |String| + Default: `'erlfmt'` + + This variable can be changed to specify the erlfmt executable. + + +g:ale_erlang_erlfmt_options *g:ale_erlang_erlfmt_options* + *b:ale_erlang_erlfmt_options* + Type: |String| + Default: `''` + + This variable controls additional parameters passed to `erlfmt`, such as + `--insert-pragma` or `--print-width`. + + ------------------------------------------------------------------------------- syntaxerl *ale-erlang-syntaxerl* diff --git a/sources_non_forked/ale/doc/ale-fish.txt b/sources_non_forked/ale/doc/ale-fish.txt index 8450b38a..7dbbc10c 100644 --- a/sources_non_forked/ale/doc/ale-fish.txt +++ b/sources_non_forked/ale/doc/ale-fish.txt @@ -10,5 +10,22 @@ displaying errors if an error message is not found. If ALE is not showing any errors but your file does not run as expected, run `fish -n ` from the command line. +=============================================================================== +fish_indent *ale-fish-fish_indent* + +g:ale_fish_fish_indent_executable *g:ale_fish_fish_indent_executable* + *b:ale_fish_fish_indent_executable* + Type: |String| + Default: `'fish_indent'` + + This variable can be changed to use a different executable for fish_indent. + +g:ale_fish_fish_indent_options *g:ale_fish_fish_indent_options* + *b:ale_fish_fish_indent_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to fish_indent. + =============================================================================== 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 5c0791bc..8364fd5b 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -207,6 +207,27 @@ g:ale_go_gopls_options *g:ale_go_gopls_options* Type: |String| Default: `''` + Command-line options passed to the gopls executable. See `gopls -h`. + + +g:ale_go_gopls_init_options *g:ale_go_gopls_init_options* + *b:ale_go_gopls_init_options* + Type: |Dictionary| + Default: `{}` + + LSP initialization options passed to gopls. This can be used to configure + the behaviour of gopls. + + Example: > + let g:ale_go_gopls_init_options = {'ui.diagnostic.analyses': { + \ 'composites': v:false, + \ 'unusedparams': v:true, + \ 'unusedresult': v:true, + \ }} +< + + For a full list of supported analyzers, see: + https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md =============================================================================== govet *ale-go-govet* diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index fde439fe..09894340 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -124,6 +124,18 @@ g:ale_haskell_hlint_options g:ale_haskell_hlint_options executable. +=============================================================================== +hls *ale-haskell-hls* + +g:ale_haskell_hls_executable *g:ale_haskell_hls_executable* + *b:ale_haskell_his_executable* + Type: |String| + Default: `'haskell-language-server-wrapper'` + + This variable can be changed to use a different executable for the haskell + language server. + + =============================================================================== stack-build *ale-haskell-stack-build* diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index c78dc4cd..2c048148 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -2,13 +2,41 @@ ALE HTML Integration *ale-html-options* +=============================================================================== +angular *ale-html-angular* + +ALE supports language server features for Angular. You can install it via `npm`: > + + $ npm install --save-dev @angular/language-server +< +Angular 11 and up are supported. + + +g:ale_html_angular_executable *g:ale_html_angular_executable* + *b:ale_html_angular_executable* + Type: |String| + Default: `'ngserver'` + + See |ale-integrations-local-executables| + + +g:ale_html_angular_use_global *g:ale_html_angular_use_global* + *b:ale_html_angular_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== fecs *ale-html-fecs* -`fecs` options for HTMl is the same as the options for JavaScript, -and both of them reads `./.fecsrc` as the default configuration file. +`fecs` options for HTML are the same as the options for JavaScript, and both +of them read `./.fecsrc` as the default configuration file. + See: |ale-javascript-fecs|. + =============================================================================== html-beautify *ale-html-beautify* @@ -47,6 +75,40 @@ g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_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* + +g:ale_html_stylelint_executable *g:ale_html_stylelint_executable* + *b:ale_html_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_html_stylelint_options *g:ale_html_stylelint_options* + *b:ale_html_stylelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to stylelint. + + +g:ale_html_stylelint_use_global *g:ale_html_stylelint_use_global* + *b:ale_html_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + =============================================================================== tidy *ale-html-tidy* @@ -97,39 +159,6 @@ 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* - -g:ale_html_stylelint_executable *g:ale_html_stylelint_executable* - *b:ale_html_stylelint_executable* - Type: |String| - Default: `'stylelint'` - - See |ale-integrations-local-executables| - - -g:ale_html_stylelint_options *g:ale_html_stylelint_options* - *b:ale_html_stylelint_options* - Type: |String| - Default: `''` - - This variable can be set to pass additional options to stylelint. - - -g:ale_html_stylelint_use_global *g:ale_html_stylelint_use_global* - *b:ale_html_stylelint_use_global* - Type: |String| - Default: `0` - - See |ale-integrations-local-executables| - - =============================================================================== write-good *ale-html-write-good* diff --git a/sources_non_forked/ale/doc/ale-inko.txt b/sources_non_forked/ale/doc/ale-inko.txt new file mode 100644 index 00000000..5ca14af6 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-inko.txt @@ -0,0 +1,22 @@ +=============================================================================== +ALE Inko Integration *ale-inko-options* + *ale-integration-inko* + +=============================================================================== +Integration Information + + Currently, the only supported linter for Inko is the Inko compiler itself. + +=============================================================================== +inko *ale-inko-inko* + +g:ale_inko_inko_executable *g:ale_inko_inko_executable* + *b:ale_inko_inko_executable* + Type: |String| + Default: `'inko'` + + This variable can be modified to change the executable path for `inko`. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-json.txt b/sources_non_forked/ale/doc/ale-json.txt index 96499a04..dc91e14c 100644 --- a/sources_non_forked/ale/doc/ale-json.txt +++ b/sources_non_forked/ale/doc/ale-json.txt @@ -101,5 +101,37 @@ prettier *ale-json-prettier* See |ale-javascript-prettier| for information about the available options. +=============================================================================== +spectral *ale-json-spectral* + +Website: https://github.com/stoplightio/spectral + +Installation +------------------------------------------------------------------------------- + +Install spectral either globally or locally: > + + npm install @stoplight/spectral -g # global + npm install @stoplight/spectral # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_json_spectral_executable *g:ale_json_spectral_executable* + *b:ale_json_spectral_executable* + Type: |String| + Default: `'spectral'` + + This variable can be set to change the path to spectral. + +g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* + *b:ale_json_spectral_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-nix.txt b/sources_non_forked/ale/doc/ale-nix.txt index 5b2bd6cb..c38b93db 100644 --- a/sources_non_forked/ale/doc/ale-nix.txt +++ b/sources_non_forked/ale/doc/ale-nix.txt @@ -2,6 +2,24 @@ ALE Nix Integration *ale-nix-options* +=============================================================================== +nixfmt *ale-nix-nixfmt* + +g:ale_nix_nixfmt_executable *g:ale_nix_nixfmt_executable* + *b:ale_nix_nixfmt_executable* + Type: String + Default: 'nixfmt' + + This variable sets the executable used for nixfmt. + +g:ale_nix_nixfmt_options *g:ale_nix_nixfmt_options* + *b:ale_nix_nixfmt_options* + Type: String + Default: '' + + This variable can be set to pass additional options to the nixfmt fixer. + + =============================================================================== nixpkgs-fmt *ale-nix-nixpkgs-fmt* diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt index 8b644c17..afbc2386 100644 --- a/sources_non_forked/ale/doc/ale-ocaml.txt +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -10,6 +10,21 @@ merlin *ale-ocaml-merlin* detailed instructions (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). +=============================================================================== +ocamllsp *ale-ocaml-ocamllsp* + + The `ocaml-lsp-server` is the official OCaml implementation of the Language + Server Protocol. See the installation instructions: + https://github.com/ocaml/ocaml-lsp#installation + +g:ale_ocaml_ocamllsp_use_opam *g:ale_ocaml_ocamllsp_use_opam* + *b:ale_ocaml_ocamllsp_use_opam* + Type: |Number| + Default: `get(g:, 'ale_ocaml_ocamllsp_use_opam', 1)` + + This variable can be set to change whether or not opam is used to execute + the language server. + =============================================================================== ols *ale-ocaml-ols* diff --git a/sources_non_forked/ale/doc/ale-openapi.txt b/sources_non_forked/ale/doc/ale-openapi.txt new file mode 100644 index 00000000..1fc41add --- /dev/null +++ b/sources_non_forked/ale/doc/ale-openapi.txt @@ -0,0 +1,74 @@ +=============================================================================== +ALE OpenApi Integration *ale-openapi-options* + +=============================================================================== +ibm_validator *ale-openapi-ibm-validator* + +Website: https://github.com/IBM/openapi-validator + + +Installation +------------------------------------------------------------------------------- + +Install ibm-openapi-validator either globally or locally: > + + npm install ibm-openapi-validator -g # global + npm install ibm-openapi-validator # local +< +Configuration +------------------------------------------------------------------------------- + +OpenAPI files can be written in YAML or JSON so in order for ALE plugins to +work with these files we must set the buffer |filetype| to either |openapi.yaml| +or |openapi.json| respectively. This causes ALE to lint the file with linters +configured for openapi and yaml files or openapi and json files respectively. + +For example setting filetype to |openapi.yaml| on a buffer and the following +|g:ale_linters| configuration will enable linting of openapi files using both +|ibm_validator| and |yamlint|: + +> + let g:ale_linters = { + \ 'yaml': ['yamllint'], + \ 'openapi': ['ibm_validator'] + \} +< + +The following plugin will detect openapi files automatically and set the +filetype to |openapi.yaml| or |openapi.json|: + + https://github.com/hsanson/vim-openapi + +Options +------------------------------------------------------------------------------- + +g:ale_openapi_ibm_validator_executable *g:ale_openapi_ibm_validator_executable* + *b:ale_openapi_ibm_validator_executable* + Type: |String| + Default: `'lint-openapi'` + + This variable can be set to change the path to lint-openapi. + + +g:ale_openapi_ibm_validator_options *g:ale_openapi_ibm_validator_options* + *b:ale_openapi_ibm_validator_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to lint-openapi. + + +=============================================================================== +prettier *ale-openapi-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +yamllint *ale-openapi-yamllint* + +See |ale-yaml-yamllint| for information about the available options. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pascal.txt b/sources_non_forked/ale/doc/ale-pascal.txt new file mode 100644 index 00000000..03d9a004 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pascal.txt @@ -0,0 +1,24 @@ +=============================================================================== +ALE Pascal Integration *ale-pascal-options* + +=============================================================================== +ptop *ale-pascal-ptop* + +g:ale_pascal_ptop_executable *g:ale_pascal_ptop_executable* + *b:ale_pascal_ptop_executable* + Type: |String| + Default: `'ptop'` + + This variable can be changed to specify the ptop executable. + + +g:ale_pascal_ptop_options *g:ale_pascal_ptop_options* + *b:ale_pascal_ptop_options* + Type: |String| + Default: `''` + +This variable can be set to pass additional options to the ptop fixer. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-proto.txt b/sources_non_forked/ale/doc/ale-proto.txt index 734e23d5..8ab56a14 100644 --- a/sources_non_forked/ale/doc/ale-proto.txt +++ b/sources_non_forked/ale/doc/ale-proto.txt @@ -5,14 +5,15 @@ ALE Proto Integration *ale-proto-options =============================================================================== Integration Information -Linting of `.proto` files requires that the `protoc` binary is installed in the -system path and that the `protoc-gen-lint` plugin for the `protoc` binary is also -installed. - To enable `.proto` file linting, update |g:ale_linters| as appropriate: > " Enable linter for .proto files - let g:ale_linters = {'proto': ['protoc-gen-lint']} + let g:ale_linters = {'proto': ['protoc-gen-lint', 'protolint']} + +To enable `.proto` file fixing, update |g:ale_fixers| as appropriate: +> + " Enable linter for .proto files + let b:ale_fixers = {'proto': ['protolint']} < =============================================================================== protoc-gen-lint *ale-proto-protoc-gen-lint* @@ -29,5 +30,31 @@ g:ale_proto_protoc_gen_lint_options *g:ale_proto_protoc_gen_lint_options* directory of the linted file is always passed as an include path with '-I' before any user-supplied options. +=============================================================================== +protolint *ale-proto-protolint* + + The linter is a pluggable tool that doesn't depend on the `protoc` binary. + This supports both linting and fixing. + Make sure the binary is available in the system path, or set + ale_proto_protolint_executable. + Note that the binary with v0.22.0 or above is supported. + +g:ale_proto_protolint_executable *g:ale_proto_protolint_executable* + + Type: |String| + Default: 'protolint' + + This variable can be changed to modify the executable used for protolint. + +g:ale_proto_protolint_config *g:ale_proto_protolint_config* + + Type: |String| + Default: `''` + + A path to a protolint configuration file. + + The path to the configuration file can be an absolute path or a relative + path. ALE will search for the relative path in parent directories. + =============================================================================== 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 f0c8bfb8..d38d3055 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -36,6 +36,8 @@ ALE will look for configuration files with the following filenames. > .pylintrc Pipfile Pipfile.lock + poetry.lock + pyproject.toml < The first directory containing any of the files named above will be used. @@ -280,6 +282,15 @@ g:ale_python_isort_use_global *g:ale_python_isort_use_global* See |ale-integrations-local-executables| +g:ale_python_isort_auto_pipenv *g:ale_python_isort_auto_pipenv* + *b:ale_python_isort_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. + + =============================================================================== mypy *ale-python-mypy* @@ -677,6 +688,25 @@ g:ale_python_pyls_config *g:ale_python_pyls_config* \ } < +g:ale_python_pyls_options *g:ale_python_pyls_options* + *b:ale_python_pyls_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the pyls + invocation. Note that this is not the same thing as ale_python_pyls_config, + which allows configuration of how pyls functions; this is intended to + provide flexibility in how the pyls command is invoked. + + For example, if you had installed `pyls` but your `pyls` executable was not + on your `PATH` for some reason, an alternative way to run the pyls server + would be: + let g:ale_python_pyls_executable = 'python3' + let g:ale_python_pyls_options = '-m pyls' + + An example stragety for installing `pyls`: + `python3 -m pip install --user pyls` + =============================================================================== pyre *ale-python-pyre* diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index 8815404a..69c643a9 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -41,6 +41,11 @@ g:ale_ruby_debride_options *g:ale_ruby_debride_options* This variable can be changed to modify flags given to debride. +=============================================================================== +prettier *ale-ruby-prettier* + +See |ale-javascript-prettier| for information about the available options. + =============================================================================== rails_best_practices *ale-ruby-rails_best_practices* @@ -177,6 +182,16 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* This variable can be changed to modify flags given to sorbet. +g:ale_ruby_sorbet_enable_watchman *g:ale_ruby_sorbet_enable_watchman* + *b:ale_ruby_sorbet_enable_watchman* + Type: |Number| + Default: `0` + + Whether or not to use watchman to let the LSP server to know about changes + to files from outside of vim. Defaults to disable watchman because it + requires watchman to be installed separately from sorbet. + + =============================================================================== standardrb *ale-ruby-standardrb* diff --git a/sources_non_forked/ale/doc/ale-salt.tmt b/sources_non_forked/ale/doc/ale-salt.tmt new file mode 100644 index 00000000..ac500d37 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-salt.tmt @@ -0,0 +1,43 @@ +=============================================================================== +ALE SALT Integration *ale-salt-options* + +=============================================================================== +salt-lint *ale-salt-salt-lint* + +Website: https://github.com/warpnet/salt-lint + + +Installation +------------------------------------------------------------------------------- + +Install salt-lint in your a virtualenv directory, locally, or globally: > + + pip install salt-lint # After activating virtualenv + pip install --user salt-lint # Install to ~/.local/bin + sudo pip install salt-lint # Install globally + +See |g:ale_virtualenv_dir_names| for configuring how ALE searches for +virtualenv directories. + + +Options +------------------------------------------------------------------------------- + +g:ale_salt_salt-lint_executable *g:ale_salt_salt_lint_executable* + *b:ale_salt_salt_lint_executable* + Type: |String| + Default: `'salt-lint'` + + This variable can be set to change the path to salt-lint. + + +g:ale_salt_salt-lint_options *g:ale_salt_salt-lint_options* + *b:ale_salt_salt-lint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to salt-lint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 36e27932..67dc971c 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -13,12 +13,16 @@ Notes: `!!` These linters check only files on disk. See |ale-lint-file-linters| * Ada + * `ada_language_server` * `gcc` * `gnatpp` * Ansible * `ansible-lint` * API Blueprint * `drafter` +* APKBUILD + * `apkbuild-lint` + * `secfixes-check` * AsciiDoc * `alex`!! * `languagetool`!! @@ -39,6 +43,8 @@ Notes: * `shfmt` * Bats * `shellcheck` +* Bazel + * `buildifier` * BibTeX * `bibclean` * Bourne Shell @@ -49,8 +55,8 @@ Notes: * `astyle` * `ccls` * `clang` (`cc`) - * `clangd` * `clang-format` + * `clangd` * `clangtidy`!! * `cppcheck` * `cpplint`!! @@ -67,9 +73,9 @@ Notes: * `astyle` * `ccls` * `clang` (`cc`) + * `clang-format` * `clangcheck`!! * `clangd` - * `clang-format` * `clangtidy`!! * `clazy`!! * `cppcheck` @@ -103,6 +109,7 @@ Notes: * Cucumber * `cucumber` * CUDA + * `clangd` * `nvcc`!! * Cypher * `cypher-lint` @@ -116,11 +123,16 @@ Notes: * Dafny * `dafny`!! * Dart + * `analysis_server` * `dartanalyzer`!! * `dartfmt`!! * `language_server` +* desktop + * `desktop-file-validate` * Dhall * `dhall-format` + * `dhall-freeze` + * `dhall-lint` * Dockerfile * `dockerfile_lint` * `hadolint` @@ -140,11 +152,14 @@ Notes: * `erubis` * `ruumba` * Erlang + * `SyntaxErl` + * `dialyzer` * `elvis`!! * `erlc` - * `SyntaxErl` + * `erlfmt` * Fish * `fish` (-n flag) + * `fish_indent` * Fortran * `gcc` * `language_server` @@ -155,22 +170,22 @@ Notes: * Git Commit Messages * `gitlint` * GLSL - * glslang + * `glslang` * `glslls` * Go * `bingo` * `go build`!! + * `go mod`!! + * `go vet`!! * `gofmt` * `goimports` * `golangci-lint`!! * `golangserver` * `golint` * `gometalinter`!! - * `go mod`!! * `gopls` * `gosimple`!! * `gotype`!! - * `go vet`!! * `revive`!! * `staticcheck`!! * GraphQL @@ -196,6 +211,7 @@ Notes: * `hie` * `hindent` * `hlint` + * `hls` * `ormolu` * `stack-build`!! * `stack-ghc` @@ -204,9 +220,10 @@ Notes: * `terraform-fmt` * HTML * `alex`!! + * `angular` * `fecs` * `html-beautify` - * `HTMLHint` + * `htmlhint` * `prettier` * `proselint` * `tidy` @@ -215,15 +232,17 @@ Notes: * `idris` * Ink * `ink-language-server` +* Inko + * `inko` !! * ISPC * `ispc`!! * Java + * `PMD` * `checkstyle` * `eclipselsp` * `google-java-format` * `javac` * `javalsp` - * `PMD` * `uncrustify` * JavaScript * `eslint` @@ -242,6 +261,7 @@ Notes: * `jq` * `jsonlint` * `prettier` + * `spectral` * Julia * `languageserver` * Kotlin @@ -299,7 +319,9 @@ Notes: * `nimpretty` * nix * `nix-instantiate` + * `nixfmt` * `nixpkgs-fmt` + * `rnix-lsp` * nroff * `alex`!! * `proselint` @@ -316,8 +338,15 @@ Notes: * OCaml * `merlin` (see |ale-ocaml-merlin|) * `ocamlformat` + * `ocamllsp` * `ocp-indent` * `ols` +* OpenApi + * `ibm_validator` + * `prettier` + * `yamllint` +* Pascal + * `ptop` * Pawn * `uncrustify` * Perl @@ -330,10 +359,10 @@ Notes: * `intelephense` * `langserver` * `phan` + * `php -l` + * `php-cs-fixer` * `phpcbf` * `phpcs` - * `php-cs-fixer` - * `php -l` * `phpmd` * `phpstan` * `psalm`!! @@ -356,6 +385,7 @@ Notes: * `swipl` * proto * `protoc-gen-lint` + * `protolint` * Pug * `pug-lint` * Puppet @@ -394,6 +424,8 @@ Notes: * `styler` * Racket * `raco` +* Re:VIEW + * `redpen` * ReasonML * `merlin` * `ols` @@ -407,13 +439,12 @@ Notes: * `textlint` * `vale` * `write-good` -* Re:VIEW - * `redpen` * RPM spec * `rpmlint` * Ruby * `brakeman` * `debride` + * `prettier` * `rails_best_practices`!! * `reek` * `rubocop` @@ -428,6 +459,8 @@ Notes: * `rust-analyzer` * `rustc` (see |ale-integration-rust|) * `rustfmt` +* Salt + * `salt-lint` * Sass * `sass-lint` * `stylelint` @@ -453,23 +486,31 @@ Notes: * `solium` * SQL * `pgformatter` + * `sql-lint` * `sqlfmt` * `sqlformat` * `sqlint` - * `sql-lint` * Stylus * `stylelint` * SugarSS * `stylelint` +* Svelte + * `prettier` + * `svelteserver` * Swift * Apple `swift-format` * `sourcekit-lsp` * `swiftformat` * `swiftlint` +* systemd + * `systemd-analyze`!! * Tcl * `nagelfar`!! * Terraform - * `fmt` + * `terraform` + * `terraform-fmt-fixer` + * `terraform-ls` + * `terraform-lsp` * `tflint` * Texinfo * `alex`!! @@ -486,6 +527,7 @@ Notes: * Thrift * `thrift` * TypeScript + * `deno` * `eslint` * `fecs` * `prettier` @@ -493,8 +535,12 @@ Notes: * `tslint` * `tsserver` * `typecheck` +* V + * `v` + * `vfmt` * VALA * `uncrustify` + * `vala_lint`!! * Verilog * `hdl-checker` * `iverilog` @@ -523,6 +569,7 @@ Notes: * `xmllint` * YAML * `prettier` + * `spectral` * `swaglint` * `yamlfix` * `yamllint` @@ -530,3 +577,6 @@ Notes: * `yang-lsp` * Zig * `zls` + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-svelte.txt b/sources_non_forked/ale/doc/ale-svelte.txt new file mode 100644 index 00000000..92f109f7 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-svelte.txt @@ -0,0 +1,31 @@ +=============================================================================== +ALE Svelte Integration *ale-svelte-options* + + +=============================================================================== +prettier *ale-svelte-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +svelteserver *ale-svelte-svelteserver* + +g:ale_svelte_svelteserver_executable *g:ale_svelte_svelteserver_executable* + *b:ale_svelte_svelteserver_executable* + Type: |String| + Default: `'svelteserver'` + + See |ale-integrations-local-executables| + + +g:ale_svelte_svelteserver_use_global *g:ale_svelte_svelteserver_use_global* + *b:ale_svelte_svelteserver_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-swift.txt b/sources_non_forked/ale/doc/ale-swift.txt index 8fa0c06c..6d53ca7c 100644 --- a/sources_non_forked/ale/doc/ale-swift.txt +++ b/sources_non_forked/ale/doc/ale-swift.txt @@ -2,6 +2,44 @@ ALE Swift Integration *ale-swift-options* +=============================================================================== +apple-swift-format *ale-swift-apple-swift-format* + +There are 3 options to enable linting and fixing with Apple's swift-format: + +1. Install the local executable in your path, as described here: + https://github.com/apple/swift-format +2. Install the executable via your OS package manager, for instance via + Homebrew with `brew install swift-format` +3. Your Swift project has a dependency on the swift-format package, so it can + be run with `swift run swift-format lint ...` In this case, you need to set + a variable, see |g:ale_swift_appleswiftformat_use_swiftpm|. + +Additionally, ALE tries to locate and use the nearest existing `.swift-format` +configuration file. + + +g:ale_swift_appleswiftformat_executable *g:ale_swift_appleswiftformat_executable* + *b:ale_swift_appleswiftformat_executable* + Type: |String| + Default: `'swift-format'` + + This variable can be modified to change the executable path for + `swift-format`. + + +g:ale_swift_appleswiftformat_use_swiftpm *g:ale_swift_appleswiftformat_use_swiftpm* + *b:ale_swift_appleswiftformat_use_swiftpm* + Type: |Number| + Default: `0` + + When set to `1`, this option will cause ALE to use + `swift run swift-format lint ...` instead of the global executable. Use this + option if your Swift project has a dependency on the swift-format package. + + See |ale-integrations-local-executables| + + =============================================================================== sourcekitlsp *ale-swift-sourcekitlsp* @@ -16,6 +54,7 @@ g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* See |ale-integrations-local-executables| + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-systemd.txt b/sources_non_forked/ale/doc/ale-systemd.txt new file mode 100644 index 00000000..13c7037f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-systemd.txt @@ -0,0 +1,14 @@ +=============================================================================== +ALE systemd Integration *ale-systemd-options* + + +=============================================================================== +systemd-analyze *ale-systemd-analyze* + +ALE supports checking user systemd units with `systemd-analyze --user verify` +Checks will only work with user unit files in their proper location. There +aren't any options, and checks can only run after saving the file. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt index f62db190..175bdf5c 100644 --- a/sources_non_forked/ale/doc/ale-terraform.txt +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -32,6 +32,28 @@ g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable* This variable can be changed to use a different executable for terraform. +=============================================================================== +terraform-ls *ale-terraform-terraform-ls* + +Official terraform language server. More stable than *terraform-lsp* but +currently has less features. + +g:ale_terraform_ls_executable *g:ale_terraform_ls_executable* + *b:ale_terraform_ls_executable* + Type: |String| + Default: `'terraform-ls'` + + This variable can be changed to use a different executable for terraform-ls. + + +g:ale_terraform_ls_options *g:ale_terraform_ls_options* + *b:ale_terraform_ls_options* + Type: |String| + Default: `''` + + This variable can be changed to pass custom CLI flags to terraform-ls. + + =============================================================================== terraform-lsp *ale-terraform-terraform-lsp* diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index 2c50d119..a2446c2c 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -2,6 +2,39 @@ ALE TypeScript Integration *ale-typescript-options* +=============================================================================== +deno *ale-typescript-deno* + +Starting from version 1.6.0, Deno comes with its own language server. Earlier +versions are not supported. + +g:ale_deno_executable *g:ale_deno_executable* + *b:ale_deno_executable* + Type: |String| + Default: `'deno'` + + +g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root* + *b:ale_deno_lsp_project_root* + Type: |String| + Default: `''` + + If this variable is left unset, ALE will try to find the project root by + executing the following steps in the given order: + + 1. Find an ancestor directory containing a tsconfig.json. + 2. Find an ancestory irectory containing a .git folder. + 3. Use the directory of the current buffer (if the buffer was opened from + a file). + +g:ale_deno_unstable *g:ale_deno_unstable* + *b:ale_deno_unstable* + Type: |Number| + Default: `0` + + Enable or disable unstable Deno features and APIs. + + =============================================================================== eslint *ale-typescript-eslint* @@ -138,5 +171,32 @@ g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global* tsserver in node_modules. +=============================================================================== +xo *ale-typescript-xo* + +g:ale_typescript_xo_executable *g:ale_typescript_xo_executable* + *b:ale_typescript_xo_executable* + Type: |String| + Default: `'xo'` + + See |ale-integrations-local-executables| + + +g:ale_typescript_xo_options *g:ale_typescript_xo_options* + *b:ale_typescript_xo_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to xo. + + +g:ale_typescript_xo_use_global *g:ale_typescript_xo_use_global* + *b:ale_typescript_xo_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-v.txt b/sources_non_forked/ale/doc/ale-v.txt new file mode 100644 index 00000000..8c641447 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-v.txt @@ -0,0 +1,45 @@ +=============================================================================== +ALE V Integration *ale-v-options* + + +=============================================================================== +Integration Information + +`v` is V's build tool. `vfmt` (called as `v fmt` from the same +executable that does the builds) is the autoformatter/fixer. + +g:ale_v_v_executable *g:ale_v_v_executable* + *b:ale_v_v_executable* + + Type: |String| + Default: `'v'` + + The executable that will be run for the `v` linter and the `vfmt` fixer. + + +=============================================================================== +v *ale-v-v* + +g:ale_v_v_options *g:ale_v_v_options* + *b:ale_v_v_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the v linter. + They are injected directly after "v .". + + +=============================================================================== +vfmt *ale-v-vfmt* + +g:ale_v_vfmt_options *g:ale_v_vfmt_options* + *b:ale_v_vfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the vfmt fixer. + They are injected directly after "v fmt". + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vala.txt b/sources_non_forked/ale/doc/ale-vala.txt index ca24bcf4..d48f68bb 100644 --- a/sources_non_forked/ale/doc/ale-vala.txt +++ b/sources_non_forked/ale/doc/ale-vala.txt @@ -8,5 +8,26 @@ uncrustify *ale-vala-uncrustify* See |ale-c-uncrustify| for information about the available options. +=============================================================================== +Vala-Lint *ale-vala-vala-lint* + +g:vala_vala_lint_executable *g:vala_vala_lint_executable* + *b:vala_vala_lint_executable* + Type: |String| + Default: `'io.elementary.vala-lint'` + + This variable can be set to specify a Vala-Lint executable file. + + +g:vala_vala_lint_config_filename *g:vala_vala_lint_config_filename* + *b:vala_vala_lint_config_filename* + Type: |String| + Default: `'vala-lint.conf'` + + This variable can be set to specify a Vala-Lint config filename. When a file + with the specified name was not found or this variable was set to empty, + Vala-Lint will be executed without specifying a config filename. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt index 61bfc139..04871403 100644 --- a/sources_non_forked/ale/doc/ale-yaml.txt +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -15,6 +15,38 @@ Install prettier either globally or locally: > npm install prettier -g # global npm install prettier # local < +=============================================================================== +spectral *ale-yaml-spectral* + +Website: https://github.com/stoplightio/spectral + +Installation +------------------------------------------------------------------------------- + +Install spectral either globally or locally: > + + npm install @stoplight/spectral -g # global + npm install @stoplight/spectral # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_spectral_executable *g:ale_yaml_spectral_executable* + *b:ale_yaml_spectral_executable* + Type: |String| + Default: `'spectral'` + + This variable can be set to change the path to spectral. + +g:ale_yaml_spectral_use_global *g:ale_yaml_spectral_use_global* + *b:ale_yaml_spectral_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== swaglint *ale-yaml-swaglint* diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index f9f40d12..96069d5a 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -228,8 +228,8 @@ A minimal configuration for a language server linter might look so. > \ 'project_root': '/path/to/root_of_project', \}) < -For language servers that use a TCP socket connection, you should define the -address to connect to instead. > +For language servers that use a TCP or named pipe socket connection, you +should define the address to connect to instead. > call ale#linter#Define('filetype_here', { \ 'name': 'any_name_you_want', @@ -342,6 +342,12 @@ the buffers being checked. When a |Dictionary| is returned for an |ALEFix| callback, the following keys are supported for running the commands. + `cwd` An optional |String| for setting the working directory + for the command. + + If not set, or `v:null`, the `cwd` of the last command + that spawn this one will be used. + `command` A |String| for the command to run. This key is required. When `%t` is included in a command string, a temporary @@ -646,6 +652,10 @@ problem will be displayed in a balloon instead of hover information. Hover information can be displayed in the preview window instead by setting |g:ale_hover_to_preview| to `1`. +When using Neovim, if |g:ale_hover_to_floating_preview| or |g:ale_floating_preview| +is set to 1, the hover information will show in a floating window. And +|g:ale_floating_window_border| for the border setting. + For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling |balloonexpr| commands in terminals can cause scrolling issues in terminals, so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to @@ -954,6 +964,15 @@ g:ale_default_navigation *g:ale_default_navigation* buffer, such as for |ALEFindReferences|, or |ALEGoToDefinition|. +g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview* + *b:ale_detail_to_floating_preview* + Type: |Number| + Default: `0` + + When this option is set to `1`, Neovim will use a floating window for + ALEDetail output. + + g:ale_disable_lsp *g:ale_disable_lsp* *b:ale_disable_lsp* @@ -1177,6 +1196,29 @@ g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* let g:ale_fix_on_save_ignore = [g:AddBar] < +g:ale_floating_preview *g:ale_floating_preview* + + Type: |Number| + Default: `0` + + When set to `1`, Neovim will use a floating window for ale's preview window. + This is equivalent to setting |g:ale_hover_to_floating_preview| and + |g:ale_detail_to_floating_preview| to `1`. + + +g:ale_floating_window_border *g:ale_floating_window_border* + + Type: |List| + Default: `['|', '-', '+', '+', '+', '+']` + + When set to `[]`, window borders are disabled. The elements in the list set + the horizontal, top, top-left, top-right, bottom-right and bottom-left + border characters, respectively. + + If the terminal supports Unicode, you might try setting the value to + ` ['│', '─', '╭', '╮', '╯', '╰']`, to make it look nicer. + + g:ale_history_enabled *g:ale_history_enabled* Type: |Number| @@ -1235,6 +1277,14 @@ g:ale_hover_to_preview *g:ale_hover_to_preview* instead of in balloons or the message line. +g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview* + *b:ale_hover_to_floating_preview* + Type: |Number| + Default: `0` + + If set to `1`, Neovim will use floating windows for hover messages. + + g:ale_keep_list_window_open *g:ale_keep_list_window_open* *b:ale_keep_list_window_open* Type: |Number| @@ -1388,6 +1438,7 @@ g:ale_linter_aliases *g:ale_linter_aliases* \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', + \ 'svelte': ['svelte', 'javascript'], \ 'systemverilog': 'verilog', \ 'typescriptreact': ['typescript', 'tsx'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], @@ -1526,19 +1577,23 @@ g:ale_linters *g:ale_linters* following values: > { + \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golint', 'go vet'], \ 'hack': ['hack'], \ 'help': [], + \ 'inko': ['inko'], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], \ 'rust': ['cargo', 'rls'], \ 'spec': [], + \ 'svelte': ['eslint', 'svelteserver'], \ 'text': [], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], + \ 'v': ['v'], \} < This option can be used to enable only a particular set of linters for a @@ -1677,22 +1732,13 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* `'disabled'` - Doesn't display any information at all. -g:ale_lsp_root *g:ale_lsp_root* - *b:ale_lsp_root* +g:ale_lsp_suggestions *g:ale_lsp_suggestions* - Type: |Dictionary| or |String| - Default: {} + Type: |Number| + Default: `0` - This option is used to determine the project root for the LSP linter. If the - value is a |Dictionary|, it maps a linter to either a string containing the - project root or a |Funcref| to call to look up the root. The funcref is - provided the buffer number as its argument. - - The buffer-specific variable may additionally be a string containing the - project root itself. - - If neither variable yields a result, a linter-specific function is invoked to - detect a project root. If this, too, yields no result, the linter is disabled. + If set to `1`, show hints/suggestions from LSP servers or tsserver, in + addition to warnings and errors. g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* @@ -1812,6 +1858,8 @@ g:ale_popup_menu_enabled *g:ale_popup_menu_enabled* capabilities in the right click mouse menu when there's a LSP server or tsserver available. See |ale-refactor|. + This feature is only supported in GUI versions of Vim. + This setting must be set to `1` before ALE is loaded for this behavior to be enabled. See |ale-lint-settings-on-startup|. @@ -1837,6 +1885,25 @@ g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* `1`. +g:ale_root *g:ale_root* + *b:ale_root* + + Type: |Dictionary| or |String| + Default: {} + + This option is used to determine the project root for a linter. If the value + is a |Dictionary|, it maps a linter to either a |String| containing the + project root or a |Funcref| to call to look up the root. The |Funcref| is + provided the buffer number as its argument. + + The buffer-specific variable may additionally be a string containing the + project root itself. + + If neither variable yields a result, a linter-specific function is invoked to + detect a project root. If this, too, yields no result, and the linter is an + LSP linter, it will not run. + + g:ale_set_balloons *g:ale_set_balloons* *b:ale_set_balloons* @@ -2556,8 +2623,12 @@ documented in additional help files. ada.....................................|ale-ada-options| gcc...................................|ale-ada-gcc| gnatpp................................|ale-ada-gnatpp| + ada-language-server...................|ale-ada-language-server| ansible.................................|ale-ansible-options| ansible-lint..........................|ale-ansible-ansible-lint| + apkbuild................................|ale-apkbuild-options| + apkbuild-lint.........................|ale-apkbuild-apkbuild-lint| + secfixes-check........................|ale-apkbuild-secfixes-check| asciidoc................................|ale-asciidoc-options| write-good............................|ale-asciidoc-write-good| textlint..............................|ale-asciidoc-textlint| @@ -2567,6 +2638,8 @@ documented in additional help files. gawk..................................|ale-awk-gawk| bats....................................|ale-bats-options| shellcheck............................|ale-bats-shellcheck| + bazel...................................|ale-bazel-options| + buildifier............................|ale-bazel-buildifier| bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| c.......................................|ale-c-options| @@ -2616,14 +2689,24 @@ documented in additional help files. stylelint.............................|ale-css-stylelint| cuda....................................|ale-cuda-options| nvcc..................................|ale-cuda-nvcc| + clangd................................|ale-cuda-clangd| clang-format..........................|ale-cuda-clangformat| d.......................................|ale-d-options| dfmt..................................|ale-d-dfmt| dls...................................|ale-d-dls| uncrustify............................|ale-d-uncrustify| + dafny...................................|ale-dafny-options| + dafny.................................|ale-dafny-dafny| dart....................................|ale-dart-options| + analysis_server.......................|ale-dart-analysis_server| dartanalyzer..........................|ale-dart-dartanalyzer| dartfmt...............................|ale-dart-dartfmt| + desktop.................................|ale-desktop-options| + desktop-file-validate.................|ale-desktop-desktop-file-validate| + dhall...................................|ale-dhall-options| + dhall-format..........................|ale-dhall-format| + dhall-freeze..........................|ale-dhall-freeze| + dhall-lint............................|ale-dhall-lint| dockerfile..............................|ale-dockerfile-options| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| hadolint..............................|ale-dockerfile-hadolint| @@ -2641,10 +2724,12 @@ documented in additional help files. dialyzer..............................|ale-erlang-dialyzer| elvis.................................|ale-erlang-elvis| erlc..................................|ale-erlang-erlc| + erlfmt................................|ale-erlang-erlfmt| syntaxerl.............................|ale-erlang-syntaxerl| eruby...................................|ale-eruby-options| ruumba................................|ale-eruby-ruumba| fish....................................|ale-fish-options| + fish_indent...........................|ale-fish-fish_indent| fortran.................................|ale-fortran-options| gcc...................................|ale-fortran-gcc| language_server.......................|ale-fortran-language-server| @@ -2689,6 +2774,7 @@ documented in additional help files. hfmt..................................|ale-haskell-hfmt| hindent...............................|ale-haskell-hindent| hlint.................................|ale-haskell-hlint| + hls...................................|ale-haskell-hls| stack-build...........................|ale-haskell-stack-build| stack-ghc.............................|ale-haskell-stack-ghc| stylish-haskell.......................|ale-haskell-stylish-haskell| @@ -2697,17 +2783,20 @@ documented in additional help files. hcl.....................................|ale-hcl-options| terraform-fmt.........................|ale-hcl-terraform-fmt| html....................................|ale-html-options| + angular...............................|ale-html-angular| fecs..................................|ale-html-fecs| html-beautify.........................|ale-html-beautify| htmlhint..............................|ale-html-htmlhint| - tidy..................................|ale-html-tidy| prettier..............................|ale-html-prettier| stylelint.............................|ale-html-stylelint| + tidy..................................|ale-html-tidy| write-good............................|ale-html-write-good| idris...................................|ale-idris-options| idris.................................|ale-idris-idris| ink.....................................|ale-ink-options| ink-language-server...................|ale-ink-language-server| + inko....................................|ale-inko-options| + inko..................................|ale-inko-inko| ispc....................................|ale-ispc-options| ispc..................................|ale-ispc-ispc| java....................................|ale-java-options| @@ -2735,6 +2824,7 @@ documented in additional help files. jsonlint..............................|ale-json-jsonlint| jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| + spectral..............................|ale-json-spectral| julia...................................|ale-julia-options| languageserver........................|ale-julia-languageserver| kotlin..................................|ale-kotlin-options| @@ -2770,6 +2860,7 @@ documented in additional help files. nimlsp................................|ale-nim-nimlsp| nimpretty.............................|ale-nim-nimpretty| nix.....................................|ale-nix-options| + nixfmt................................|ale-nix-nixfmt| nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt| nroff...................................|ale-nroff-options| write-good............................|ale-nroff-write-good| @@ -2784,9 +2875,16 @@ documented in additional help files. uncrustify............................|ale-objcpp-uncrustify| ocaml...................................|ale-ocaml-options| merlin................................|ale-ocaml-merlin| + ocamllsp..............................|ale-ocaml-ocamllsp| ols...................................|ale-ocaml-ols| ocamlformat...........................|ale-ocaml-ocamlformat| ocp-indent............................|ale-ocaml-ocp-indent| + openapi.................................|ale-openapi-options| + ibm_validator.........................|ale-openapi-ibm-validator| + prettier..............................|ale-openapi-prettier| + yamllint..............................|ale-openapi-yamllint| + pascal..................................|ale-pascal-options| + ptop..................................|ale-pascal-ptop| pawn....................................|ale-pawn-options| uncrustify............................|ale-pawn-uncrustify| perl....................................|ale-perl-options| @@ -2820,6 +2918,7 @@ documented in additional help files. swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| protoc-gen-lint.......................|ale-proto-protoc-gen-lint| + protolint.............................|ale-proto-protolint| pug.....................................|ale-pug-options| puglint...............................|ale-pug-puglint| puppet..................................|ale-puppet-options| @@ -2868,6 +2967,7 @@ documented in additional help files. ruby....................................|ale-ruby-options| brakeman..............................|ale-ruby-brakeman| debride...............................|ale-ruby-debride| + prettier..............................|ale-ruby-prettier| rails_best_practices..................|ale-ruby-rails_best_practices| reek..................................|ale-ruby-reek| rubocop...............................|ale-ruby-rubocop| @@ -2882,6 +2982,8 @@ documented in additional help files. rls...................................|ale-rust-rls| rustc.................................|ale-rust-rustc| rustfmt...............................|ale-rust-rustfmt| + salt....................................|ale-salt-options| + salt-lint.............................|ale-salt-salt-lint| sass....................................|ale-sass-options| sasslint..............................|ale-sass-sasslint| stylelint.............................|ale-sass-stylelint| @@ -2916,13 +3018,20 @@ documented in additional help files. stylelint.............................|ale-stylus-stylelint| sugarss.................................|ale-sugarss-options| stylelint.............................|ale-sugarss-stylelint| + svelte..................................|ale-svelte-options| + prettier..............................|ale-svelte-prettier| + svelteserver..........................|ale-svelte-svelteserver| swift...................................|ale-swift-options| + apple-swift-format....................|ale-swift-apple-swift-format| sourcekitlsp..........................|ale-swift-sourcekitlsp| + systemd.................................|ale-systemd-options| + systemd-analyze.......................|ale-systemd-analyze| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| terraform-fmt-fixer...................|ale-terraform-fmt-fixer| terraform.............................|ale-terraform-terraform| + terraform-ls..........................|ale-terraform-terraform-ls| terraform-lsp.........................|ale-terraform-terraform-lsp| tflint................................|ale-terraform-tflint| tex.....................................|ale-tex-options| @@ -2938,11 +3047,16 @@ documented in additional help files. thrift..................................|ale-thrift-options| thrift................................|ale-thrift-thrift| typescript..............................|ale-typescript-options| + deno..................................|ale-typescript-deno| eslint................................|ale-typescript-eslint| prettier..............................|ale-typescript-prettier| standard..............................|ale-typescript-standard| tslint................................|ale-typescript-tslint| tsserver..............................|ale-typescript-tsserver| + xo....................................|ale-typescript-xo| + v.......................................|ale-v-options| + v.....................................|ale-v-v| + vfmt..................................|ale-v-vfmt| vala....................................|ale-vala-options| uncrustify............................|ale-vala-uncrustify| verilog/systemverilog...................|ale-verilog-options| @@ -2956,11 +3070,11 @@ documented in additional help files. hdl-checker...........................|ale-vhdl-hdl-checker| vcom..................................|ale-vhdl-vcom| xvhdl.................................|ale-vhdl-xvhdl| + vim help................................|ale-vim-help-options| + write-good............................|ale-vim-help-write-good| vim.....................................|ale-vim-options| vimls.................................|ale-vim-vimls| vint..................................|ale-vim-vint| - vim help................................|ale-vim-help-options| - write-good............................|ale-vim-help-write-good| vue.....................................|ale-vue-options| prettier..............................|ale-vue-prettier| vls...................................|ale-vue-vls| @@ -2970,6 +3084,7 @@ documented in additional help files. xmllint...............................|ale-xml-xmllint| yaml....................................|ale-yaml-options| prettier..............................|ale-yaml-prettier| + spectral..............................|ale-yaml-spectral| swaglint..............................|ale-yaml-swaglint| yamlfix...............................|ale-yaml-yamlfix| yamllint..............................|ale-yaml-yamllint| @@ -3504,6 +3619,12 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* < The following `options` can be provided. + `cwd` - An optional |String| for setting the working directory + for the command, just as per |ale#linter#Define|. + + If not set, or `v:null`, the `cwd` of the last command + that spawned this one will be used. + `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for selecting which output streams to read lines from. @@ -3729,10 +3850,33 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* The result can be computed with |ale#command#Run()|. + The command string can be formatted with format + markers. See |ale-command-format-strings|. + This command will be fed the lines from the buffer to check, and will produce the lines of output given to the `callback`. + `cwd` An optional |String| for setting the working + directory for the command, or a |Funcref| for a + function to call for computing the command, accepting + a buffer number. The working directory can be + specified as a format string for determining the path + dynamically. See |ale-command-format-strings|. + + To set the working directory to the directory + containing the file you're checking, you should + probably use `'%s:h'` as the option value. + + If this option is absent or the string is empty, the + `command` will be run with no determined working + directory in particular. + + The directory specified with this option will be used + as the default working directory for all commands run + in a chain with |ale#command#Run()|, unless otherwise + specified. + `output_stream` A |String| for the output stream the lines of output should be read from for the command which is run. The accepted values are `'stdout'`, `'stderr'`, and @@ -3788,7 +3932,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* When this argument is set to `'socket'`, then the linter will be defined as an LSP linter via a TCP - socket connection. `address` must be set. + or named pipe socket connection. `address` must be set. ALE will not start a server automatically. @@ -3813,7 +3957,10 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* `address` A |String| representing an address to connect to, or a |Funcref| accepting a buffer number and - returning the |String|. + returning the |String|. If the value contains a + colon, it is interpreted as referring to a TCP + socket; otherwise it is interpreted as the path of a + named pipe. The result can be computed with |ale#command#Run()|. diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index 5b7be116..7c79f261 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -87,8 +87,8 @@ let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1) " This flag can be set to 1 to enable linting when the filetype is changed. let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1) -" This Dictionary configures the default LSP roots for various linters. -let g:ale_lsp_root = get(g:, 'ale_lsp_root', {}) +" If set to 1, hints and suggestion from LSP servers and tsserver will be shown. +let g:ale_lsp_suggestions = get(g:, 'ale_lsp_suggestions', 0) " This flag can be set to 1 to enable automatically fixing files on save. let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) @@ -101,6 +101,9 @@ let g:ale_enabled = get(g:, 'ale_enabled', 1) " mapping filename paths from one system to another. let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) +" This Dictionary configures the default project roots for various linters. +let g:ale_root = get(g:, 'ale_root', {}) + " These flags dictates if ale uses the quickfix or the loclist (loclist is the " default, quickfix overrides loclist). let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1) @@ -138,6 +141,20 @@ let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has( " Use preview window for hover messages. let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0) +" Float preview windows in Neovim +let g:ale_floating_preview = get(g:, 'ale_floating_preview', 0) + +" Hovers use floating windows in Neovim +let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0) + +" Detail uses floating windows in Neovim +let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 0) + +" Border setting for floating preview windows in Neovim +" The element in the list presents - horizontal, top, top-left, top-right, +" bottom-right and bottom-left +let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+']) + " This flag can be set to 0 to disable warnings for trailing whitespace let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1) " This flag can be set to 0 to disable warnings for trailing blank lines diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 96ef273b..ce408936 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -22,12 +22,16 @@ formatting. --- * Ada + * [ada_language_server](https://github.com/AdaCore/ada_language_server) * [gcc](https://gcc.gnu.org) * [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk: * Ansible * [ansible-lint](https://github.com/willthames/ansible-lint) * API Blueprint * [drafter](https://github.com/apiaryio/drafter) +* APKBUILD + * [apkbuild-lint](https://gitlab.alpinelinux.org/Leo/atools) + * [secfixes-check](https://gitlab.alpinelinux.org/Leo/atools) * AsciiDoc * [alex](https://github.com/wooorm/alex) :floppy_disk: * [languagetool](https://languagetool.org/) :floppy_disk: @@ -48,6 +52,8 @@ formatting. * [shfmt](https://github.com/mvdan/sh) * Bats * [shellcheck](https://www.shellcheck.net/) +* Bazel + * [buildifier](https://github.com/bazelbuild/buildtools) * BibTeX * [bibclean](http://ftp.math.utah.edu/pub/bibclean/) * Bourne Shell @@ -58,8 +64,8 @@ formatting. * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) - * [clangd](https://clang.llvm.org/extra/clangd.html) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) + * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) * [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) @@ -76,9 +82,9 @@ formatting. * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) + * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: * [clangd](https://clang.llvm.org/extra/clangd.html) - * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [clazy](https://github.com/KDE/clazy) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) @@ -112,6 +118,7 @@ formatting. * Cucumber * [cucumber](https://cucumber.io/) * CUDA + * [clangd](https://clang.llvm.org/extra/clangd.html) * [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) * Cypher * [cypher-lint](https://github.com/cleishm/libcypher-parser) @@ -125,11 +132,16 @@ formatting. * Dafny * [dafny](https://rise4fun.com/Dafny) :floppy_disk: * Dart + * [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) * [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [language_server](https://github.com/natebosch/dart_language_server) +* desktop + * [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/) * Dhall * [dhall-format](https://github.com/dhall-lang/dhall-lang) + * [dhall-freeze](https://github.com/dhall-lang/dhall-lang) + * [dhall-lint](https://github.com/dhall-lang/dhall-lang) * Dockerfile * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [hadolint](https://github.com/hadolint/hadolint) @@ -137,7 +149,7 @@ formatting. * [credo](https://github.com/rrrene/credo) * [dialyxir](https://github.com/jeremyjh/dialyxir) :floppy_disk: * [dogma](https://github.com/lpil/dogma) :floppy_disk: - * [elixir-ls](https://github.com/JakeBecker/elixir-ls) :warning: + * [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) @@ -149,11 +161,14 @@ formatting. * [erubis](https://github.com/kwatch/erubis) * [ruumba](https://github.com/ericqweinstein/ruumba) * Erlang + * [SyntaxErl](https://github.com/ten0s/syntaxerl) + * [dialyzer](http://erlang.org/doc/man/dialyzer.html) * [elvis](https://github.com/inaka/elvis) :floppy_disk: * [erlc](http://erlang.org/doc/man/erlc.html) - * [SyntaxErl](https://github.com/ten0s/syntaxerl) + * [erlfmt](https://github.com/WhatsApp/erlfmt) * Fish * fish [-n flag](https://linux.die.net/man/1/fish) + * [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html) * Fortran * [gcc](https://gcc.gnu.org/) * [language_server](https://github.com/hansec/fortran-language-server) @@ -169,17 +184,17 @@ formatting. * Go * [bingo](https://github.com/saibing/bingo) :warning: * [go build](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [go vet](https://golang.org/cmd/vet/) :floppy_disk: * [gofmt](https://golang.org/cmd/gofmt/) * [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) :warning: * [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk: * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: - * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: * [gopls](https://github.com/golang/go/wiki/gopls) :warning: * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: - * [go vet](https://golang.org/cmd/vet/) :floppy_disk: * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: * [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) :warning: :floppy_disk: * GraphQL @@ -205,6 +220,7 @@ formatting. * [hie](https://github.com/haskell/haskell-ide-engine) * [hindent](https://hackage.haskell.org/package/hindent) * [hlint](https://hackage.haskell.org/package/hlint) + * [hls](https://github.com/haskell/haskell-language-server) * [ormolu](https://github.com/tweag/ormolu) * [stack-build](https://haskellstack.org/) :floppy_disk: * [stack-ghc](https://haskellstack.org/) @@ -213,9 +229,10 @@ formatting. * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [angular](https://www.npmjs.com/package/@angular/language-server) * [fecs](http://fecs.baidu.com/) * [html-beautify](https://beautifier.io/) - * [HTMLHint](http://htmlhint.com/) + * [htmlhint](http://htmlhint.com/) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [tidy](http://www.html-tidy.org/) @@ -224,15 +241,17 @@ formatting. * [idris](http://www.idris-lang.org/) * Ink * [ink-language-server](https://github.com/ephread/ink-language-server) +* Inko + * [inko](https://inko-lang.org/) :floppy_disk: * ISPC * [ispc](https://ispc.github.io/) :floppy_disk: * Java + * [PMD](https://pmd.github.io/) * [checkstyle](http://checkstyle.sourceforge.net) * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) - * [PMD](https://pmd.github.io/) * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript * [eslint](http://eslint.org/) @@ -251,6 +270,7 @@ formatting. * [jq](https://stedolan.github.io/jq/) * [jsonlint](http://zaa.ch/jsonlint/) * [prettier](https://github.com/prettier/prettier) + * [spectral](https://github.com/stoplightio/spectral) * Julia * [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) * Kotlin @@ -308,7 +328,9 @@ formatting. * nimpretty * nix * [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) + * [nixfmt](https://github.com/serokell/nixfmt) * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) + * [rnix-lsp](https://github.com/nix-community/rnix-lsp) * nroff * [alex](https://github.com/wooorm/alex) :floppy_disk: * [proselint](http://proselint.com/) @@ -325,8 +347,15 @@ formatting. * OCaml * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions * [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) + * [ocamllsp](https://github.com/ocaml/ocaml-lsp) * [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ols](https://github.com/freebroccolo/ocaml-language-server) +* OpenApi + * [ibm_validator](https://github.com/IBM/openapi-validator) + * [prettier](https://github.com/prettier/prettier) + * [yamllint](https://yamllint.readthedocs.io/) +* Pascal + * [ptop](https://www.freepascal.org/tools/ptop.var) * Pawn * [uncrustify](https://github.com/uncrustify/uncrustify) * Perl @@ -339,10 +368,10 @@ formatting. * [intelephense](https://github.com/bmewburn/intelephense-docs) * [langserver](https://github.com/felixfbecker/php-language-server) * [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions + * [php -l](https://secure.php.net/) + * [php-cs-fixer](http://cs.sensiolabs.org/) * [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) * [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) - * [php-cs-fixer](http://cs.sensiolabs.org/) - * [php -l](https://secure.php.net/) * [phpmd](https://phpmd.org) * [phpstan](https://github.com/phpstan/phpstan) * [psalm](https://getpsalm.org) :floppy_disk: @@ -365,6 +394,7 @@ formatting. * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) + * [protolint](https://github.com/yoheimuta/protolint) * Pug * [pug-lint](https://github.com/pugjs/pug-lint) * Puppet @@ -403,6 +433,8 @@ formatting. * [styler](https://github.com/r-lib/styler) * Racket * [raco](https://docs.racket-lang.org/raco/) +* Re:VIEW + * [redpen](http://redpen.cc/) * ReasonML * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions * [ols](https://github.com/freebroccolo/ocaml-language-server) @@ -416,13 +448,12 @@ formatting. * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) -* Re:VIEW - * [redpen](http://redpen.cc/) * RPM spec * [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`) * Ruby * [brakeman](http://brakemanscanner.org/) :floppy_disk: * [debride](https://github.com/seattlerb/debride) :floppy_disk: + * [prettier](https://github.com/prettier/plugin-ruby) * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk: * [reek](https://github.com/troessner/reek) * [rubocop](https://github.com/bbatsov/rubocop) @@ -437,6 +468,8 @@ formatting. * [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning: * [rustc](https://www.rust-lang.org/) :warning: * [rustfmt](https://github.com/rust-lang-nursery/rustfmt) +* Salt + * [salt-lint](https://github.com/warpnet/salt-lint) * Sass * [sass-lint](https://www.npmjs.com/package/sass-lint) * [stylelint](https://github.com/stylelint/stylelint) @@ -462,23 +495,31 @@ formatting. * [solium](https://github.com/duaraghav8/Solium) * SQL * [pgformatter](https://github.com/darold/pgFormatter) + * [sql-lint](https://github.com/joereynolds/sql-lint) * [sqlfmt](https://github.com/jackc/sqlfmt) * [sqlformat](https://github.com/andialbrecht/sqlparse) * [sqlint](https://github.com/purcell/sqlint) - * [sql-lint](https://github.com/joereynolds/sql-lint) * Stylus * [stylelint](https://github.com/stylelint/stylelint) * SugarSS * [stylelint](https://github.com/stylelint/stylelint) +* Svelte + * [prettier](https://github.com/prettier/prettier) + * [svelteserver](https://github.com/sveltejs/language-tools/tree/master/packages/language-server) * Swift * [Apple swift-format](https://github.com/apple/swift-format) * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) +* systemd + * [systemd-analyze](https://www.freedesktop.org/software/systemd/man/systemd-analyze.html) :floppy_disk: * Tcl * [nagelfar](http://nagelfar.sourceforge.net) :floppy_disk: * Terraform - * [fmt](https://github.com/hashicorp/terraform) + * [terraform](https://github.com/hashicorp/terraform) + * [terraform-fmt-fixer](https://github.com/hashicorp/terraform) + * [terraform-ls](https://github.com/hashicorp/terraform-ls) + * [terraform-lsp](https://github.com/juliosueiras/terraform-lsp) * [tflint](https://github.com/wata727/tflint) * Texinfo * [alex](https://github.com/wooorm/alex) :floppy_disk: @@ -495,6 +536,7 @@ formatting. * Thrift * [thrift](http://thrift.apache.org/) * TypeScript + * [deno](https://deno.land/) * [eslint](http://eslint.org/) * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) @@ -502,8 +544,12 @@ formatting. * [tslint](https://github.com/palantir/tslint) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * typecheck +* V + * [v](https://github.com/vlang/v/) + * [vfmt](https://github.com/vlang/v/) * VALA * [uncrustify](https://github.com/uncrustify/uncrustify) + * [vala_lint](https://github.com/vala-lang/vala-lint) :floppy_disk: * Verilog * [hdl-checker](https://pypi.org/project/hdl-checker) * [iverilog](https://github.com/steveicarus/iverilog) @@ -532,6 +578,7 @@ formatting. * [xmllint](http://xmlsoft.org/xmllint.html) * YAML * [prettier](https://github.com/prettier/prettier) + * [spectral](https://github.com/stoplightio/spectral) * [swaglint](https://github.com/byCedric/swaglint) * [yamlfix](https://lyz-code.github.io/yamlfix) * [yamllint](https://yamllint.readthedocs.io/) diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md index 2987bdd9..6faed6bc 100644 --- a/sources_non_forked/bufexplorer/README.md +++ b/sources_non_forked/bufexplorer/README.md @@ -69,7 +69,7 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim ## License -Copyright (c) 2001-2020, Jeff Lanzarotta +Copyright (c) 2001-2021, Jeff Lanzarotta All rights reserved. diff --git a/sources_non_forked/ctrlp.vim/readme.md b/sources_non_forked/ctrlp.vim/readme.md index 2f4c6aed..6ab8b246 100644 --- a/sources_non_forked/ctrlp.vim/readme.md +++ b/sources_non_forked/ctrlp.vim/readme.md @@ -105,5 +105,5 @@ CtrlP is distributed under Vim's [license][4]. [1]: http://i.imgur.com/aOcwHwt.png [2]: https://github.com/ctrlpvim/ctrlp.vim/tree/extensions -[3]: http://ctrlpvim.github.com/ctrlp.vim#installation +[3]: http://ctrlpvim.github.io/ctrlp.vim#installation [4]: http://vimdoc.sourceforge.net/htmldoc/uganda.html diff --git a/sources_non_forked/lightline-ale/LICENSE b/sources_non_forked/lightline-ale/LICENSE index a69d8868..ef1d8a84 100644 --- a/sources_non_forked/lightline-ale/LICENSE +++ b/sources_non_forked/lightline-ale/LICENSE @@ -1,21 +1,15 @@ -MIT License +ISC License -Copyright (c) 2017 Maxim Baz +Copyright (c) 2017-2021, Maxim Baz -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/sources_non_forked/lightline-ale/README.md b/sources_non_forked/lightline-ale/README.md index ebfbc7e6..152a3c2e 100644 --- a/sources_non_forked/lightline-ale/README.md +++ b/sources_non_forked/lightline-ale/README.md @@ -6,10 +6,10 @@ This plugin provides [ALE](https://github.com/w0rp/ale) indicator for the [light ## Table Of Contents -* [Installation](#installation) -* [Integration](#integration) -* [Configuration](#configuration) -* [License](#license) +- [Installation](#installation) +- [Integration](#integration) +- [Configuration](#configuration) +- [License](#license) ## Installation @@ -55,6 +55,17 @@ let g:lightline.component_type = { let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ]] } ``` +3.1. Lineinfo, fileformat, etc. have to be added additionaly. Final example: + +```viml +let g:lightline.active = { + \ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ], + \ [ 'lineinfo' ], + \ [ 'percent' ], + \ [ 'fileformat', 'fileencoding', 'filetype'] ] } + +``` + ## Configuration ##### `g:lightline#ale#indicator_checking` @@ -83,18 +94,18 @@ If you would like to replace the default indicators with symbols like on the scr The following icons from the Font Awesome font are used in the screenshot: -* Checking: [f110](https://fontawesome.com/icons/spinner) -* Infos: [f129](https://fontawesome.com/icons/info) -* Warnings: [f071](https://fontawesome.com/icons/exclamation-triangle) -* Errors: [f05e](https://fontawesome.com/icons/ban) -* OK: [f00c](https://fontawesome.com/icons/check) (although I prefer to disable this component) +- Checking: [f110](https://fontawesome.com/icons/spinner) +- Infos: [f129](https://fontawesome.com/icons/info) +- Warnings: [f071](https://fontawesome.com/icons/exclamation-triangle) +- Errors: [f05e](https://fontawesome.com/icons/ban) +- OK: [f00c](https://fontawesome.com/icons/check) (although I prefer to disable this component) To specify icons in the configuration, use their unicode codes as `"\uXXXX"` (make sure to wrap them in double quotes). Alternatively copy the icons from a font website, or type \u\<4-digit-unicode\> or \U\<8-digit-unicode\> to insert the literal characters. See the code points here: -* Font Awesome: https://fontawesome.com/icons -* Nerd Fonts: https://github.com/ryanoasis/nerd-fonts#glyph-sets +- Font Awesome: https://fontawesome.com/icons +- Nerd Fonts: https://github.com/ryanoasis/nerd-fonts#glyph-sets Here's the configuration snippet used in the screenshot: @@ -108,4 +119,4 @@ let g:lightline#ale#indicator_ok = "\uf00c" ## License -Released under the [MIT License](LICENSE) +Released under the [ISC License](LICENSE) diff --git a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml index 7d2a185b..411c7023 100644 --- a/sources_non_forked/lightline.vim/.github/workflows/ci.yaml +++ b/sources_non_forked/lightline.vim/.github/workflows/ci.yaml @@ -21,9 +21,9 @@ jobs: - v7.3 steps: - name: Checkout code - uses: actions/checkout@main + uses: actions/checkout@v2 - name: Checkout vim-themis - uses: actions/checkout@main + uses: actions/checkout@v2 with: repository: thinca/vim-themis path: vim-themis diff --git a/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/apprentice.vim b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/apprentice.vim new file mode 100644 index 00000000..77d40bad --- /dev/null +++ b/sources_non_forked/lightline.vim/autoload/lightline/colorscheme/apprentice.vim @@ -0,0 +1,46 @@ +" ============================================================================= +" Filename: autoload/lightline/colorscheme/apprentice.vim +" Author: pt307 (based on work by romainl) +" License: MIT License +" Last Change: 2021/03/02 18:25:22. +" ============================================================================= + +" For the Apprentice colorscheme + +let s:almost_black = [ '#1c1c1c', 234 ] +let s:darker_grey = [ '#262626', 235 ] +let s:medium_grey = [ '#585858', 240 ] +let s:lighter_grey = [ '#bcbcbc', 250 ] +let s:green = [ '#5f875f', 65 ] +let s:red = [ '#af5f5f', 131 ] +let s:orange = [ '#ff8700', 208 ] +let s:ocre = [ '#87875f', 101 ] +let s:yellow = [ '#ffffaf', 229 ] + +let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} + +let s:p.normal.left = [ [ s:darker_grey, s:ocre ], [ s:darker_grey, s:medium_grey ] ] +let s:p.normal.middle = [ [ s:lighter_grey, s:darker_grey ] ] +let s:p.normal.right = [ [ s:darker_grey, s:ocre ], [ s:darker_grey, s:medium_grey ] ] +let s:p.normal.warning = [ [ s:almost_black, s:orange ] ] +let s:p.normal.error = [ [ s:almost_black, s:red ] ] + +let s:p.inactive.left = [ [ s:darker_grey, s:medium_grey ] ] +let s:p.inactive.middle = [ [ s:medium_grey, s:darker_grey ] ] +let s:p.inactive.right = [ [ s:darker_grey, s:medium_grey ] ] + +let s:p.insert.left = [ [ s:darker_grey, s:green ], [ s:darker_grey, s:medium_grey ] ] +let s:p.insert.right = [ [ s:darker_grey, s:green ], [ s:darker_grey, s:medium_grey ] ] + +let s:p.replace.left = [ [ s:darker_grey, s:red ], [ s:darker_grey, s:medium_grey ] ] +let s:p.replace.right = [ [ s:darker_grey, s:red ], [ s:darker_grey, s:medium_grey ] ] + +let s:p.visual.left = [ [ s:darker_grey, s:yellow ], [ s:darker_grey, s:medium_grey ] ] +let s:p.visual.right = [ [ s:darker_grey, s:yellow ], [ s:darker_grey, s:medium_grey ] ] + +let s:p.tabline.left = [ [ s:darker_grey, s:medium_grey ] ] +let s:p.tabline.middle = [ [ s:lighter_grey, s:darker_grey ] ] +let s:p.tabline.right = [ [ s:darker_grey, s:medium_grey ] ] +let s:p.tabline.tabsel = [ [ s:darker_grey, s:ocre ] ] + +let g:lightline#colorscheme#apprentice#palette = lightline#colorscheme#flatten(s:p) diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index fefe85fe..4858ad1d 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -128,6 +128,10 @@ ![lightline.vim - simpleblack](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/simpleblack.png) +### apprentice + +![lightline.vim - apprentice](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/apprentice.png) + ### landscape ![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index bebc1e04..e334c6bb 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -232,8 +232,8 @@ OPTIONS *lightline-option* Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor, landscape, one, materia, material, OldHope, nord, deus, - simpleblack, srcery_drk, ayu_mirage, ayu_light, ayu_dark and - 16color are available. + simpleblack, srcery_drk, ayu_mirage, ayu_light, ayu_dark, + apprentice and 16color are available. The default value is: > let g:lightline.colorscheme = 'default' diff --git a/sources_non_forked/mru.vim/README b/sources_non_forked/mru.vim/README new file mode 100644 index 00000000..04c3a748 --- /dev/null +++ b/sources_non_forked/mru.vim/README @@ -0,0 +1,192 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=521 + +Overview + +The Most Recently Used (MRU) plugin provides an easy access to a list of +recently opened/edited files in Vim. This plugin automatically stores the +file names as you open/edit them in Vim. + +This plugin will work on all the platforms where Vim is supported. This +plugin will work in both console and GUI Vim. This version of the MRU +plugin needs Vim 7.0 and above. If you are using an earlier version of +Vim, then you should use an older version of the MRU plugin. + +The recently used filenames are stored in a file specified by the Vim +MRU_File variable. + +The Github repository for the MRU plugin is available at: + + http://github.com/yegappan/mru + +Usage + +To list and edit files from the MRU list, you can use the ":MRU" command. +The ":MRU" command displays the MRU file list in a temporary Vim window. If +the MRU window is already opened, then the MRU list displayed in the window +is refreshed. + +If you are using GUI Vim, then the names of the recently edited files are +added to the "File->Recent Files" menu. You can select the name of a file +from this sub-menu to edit the file. + +You can use the normal Vim commands to move around in the MRU window. You +cannot make changes in the MRU window. + +You can select a file name to edit by pressing the key or by double +clicking the left mouse button on a file name. The selected file will be +opened. If the file is already opened in a window, the cursor will be moved +to that window. Otherwise, the file is opened in the previous window. If the +previous window has a modified buffer or is the preview window or is used by +some other plugin, then the file is opened in a new window. + +You can press the 'o' key to open the file name under the cursor in the +MRU window in a new window. You can also press instead of 'o' +to open the file in a new window. + +To open a file from the MRU window in read-only mode (view), press the 'v' +key. + +To open a file from the MRU window in a new tab, press the 't' key. If the +file is already opened in a window in the current or in another tab, then +the cursor is moved to that tab. Otherwise, a new tab is opened. + +You can open multiple files from the MRU window by specifying a count before +pressing '' or 'v' or 'o' or 't'. You can also visually (using +linewise visual mode) select multiple filenames and invoke the commands to +open the files. Each selected file will be opened in a separate window or +tab. + +You can press the 'u' key in the MRU window to update the file list. This is +useful if you keep the MRU window open always. + +You can close the MRU window by pressing the 'q' key or the key or +using one of the Vim window commands. + +To display only files matching a pattern from the MRU list in the MRU +window, you can specify a pattern to the ":MRU" command. For example, to +display only file names matching "vim" in them, you can use the following +command ":MRU vim". When you specify a partial file name and only one +matching filename is found, then the ":MRU" command will edit that file. + +The ":MRU" command supports command-line completion of file names from +the MRU list. You can enter a partial file name and then press +or to complete or list all the matching file names. Note that +after typing the ":MRU" command, you have to enter a space before completing +the file names with . + +When a file supplied to the ":MRU" command is not present in the MRU list, +but it is a readable file, then the file will be opened (even though it is +not present in the MRU list). This is useful if you want to open a file +present in the same directory as a file in the MRU list. You can use the +command-line completion of the ":MRU" command to complete the full path of a +file and then modify the path to open another file present in the same path. + +Whenever the MRU list changes, the MRU file is updated with the latest MRU +list. When you have multiple instances of Vim running at the same time, the +latest MRU list will show up in all the instances of Vim. + +The MRUFilename syntax group is used to highlight the file names in the MRU +window. By default, this syntax group is linked to the Identifier highlight +group. You can change the highlight group by adding the following line in +your .vimrc: + + highlight link MRUFileName LineNr + +The MRU buffer uses the 'mru file type. You can use this file type to add +custom auto commands, syntax highlighting, etc. + +Configuration + +By changing the following variables you can configure the behavior of this +plugin. Set the following variables in your .vimrc file using the 'let' +command. + +The list of recently edited file names is stored in the file specified by the +MRU_File variable. The default setting for this variable is +$HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files +for MS-Windows systems. You can change this variable to point to a file by +adding the following line to the .vimrc file: + + let MRU_File = 'd:\myhome\_vim_mru_files' + +By default, the plugin will remember the names of the last 100 used files. +As you edit more files, old file names will be removed from the MRU list. +You can set the 'MRU_Max_Entries' variable to remember more file names. For +example, to remember 1000 most recently used file names, you can use + + let MRU_Max_Entries = 1000 + +By default, all the edited file names will be added to the MRU list. If you +want to exclude file names matching a list of patterns, you can set the +MRU_Exclude_Files variable to a list of Vim regular expressions. By default, +this variable is set to an empty string. For example, to not include files +in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the +MRU_Exclude_Files variable to + + let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix + let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows + +The specified pattern should be a Vim regular expression pattern. + +If you want to add only file names matching a set of patterns to the MRU +list, then you can set the MRU_Include_Files variable. This variable should +be set to a Vim regular expression pattern. For example, to add only .c and +.h files to the MRU list, you can set this variable as below: + + let MRU_Include_Files = '\.c$\|\.h$' + +By default, MRU_Include_Files is set to an empty string and all the edited +filenames are added to the MRU list. + +The default height of the MRU window is 8. You can set the MRU_Window_Height +variable to change the window height. + + let MRU_Window_Height = 15 + +By default, when the :MRU command is invoked, the MRU list will be displayed +in a new window. Instead, if you want the MRU plugin to reuse the current +window, then you can set the 'MRU_Use_Current_Window' variable to one. + + let MRU_Use_Current_Window = 1 + +The MRU plugin will reuse the current window. When a file name is selected, +the file is also opened in the current window. + +When you select a file from the MRU window, the MRU window will be +automatically closed and the selected file will be opened in the previous +window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU +window open. + + let MRU_Auto_Close = 0 + +If you don't use the "File->Recent Files" menu and want to disable it, +then you can set the 'MRU_Add_Menu' variable to zero. By default, the +menu is enabled. + + let MRU_Add_Menu = 0 + +If too many file names are present in the MRU list, then updating the MRU +menu to list all the file names makes Vim slow. To avoid this, the +MRU_Max_Menu_Entries variable controls the number of file names to show in +the MRU menu. By default, this is set to 10. You can change this to show +more entries in the menu. + + let MRU_Max_Menu_Entries = 20 + +If many file names are present in the MRU list, then the MRU menu is split +into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names. +The default setting for this is 10. You can change this to increase the +number of file names displayed in a single sub-menu: + + let MRU_Max_Submenu_Entries = 15 + +In the MRU window, the filenames are displayed in two parts. The first part +contains the file name without the path and the second part contains the +full path to the file in parenthesis. This format is controlled by the +MRU_Filename_Format variable. If you prefer to change this to some other +format, then you can modify the MRU_Filename_Format variable. For example, +to display the full path without splitting it, you can set this variable +as shown below: + + let MRU_Filename_Format={'formatter':'v:val', 'parser':'.*'} + diff --git a/sources_non_forked/mru.vim/plugin/mru.vim b/sources_non_forked/mru.vim/plugin/mru.vim new file mode 100644 index 00000000..5cf7015d --- /dev/null +++ b/sources_non_forked/mru.vim/plugin/mru.vim @@ -0,0 +1,1039 @@ +" File: mru.vim +" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Version: 3.9 +" Last Modified: Feb 3, 2015 +" Copyright: Copyright (C) 2003-2015 Yegappan Lakshmanan +" License: Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" mru.vim is provided *as is* and comes with no warranty of any +" kind, either expressed or implied. In no event will the copyright +" holder be liable for any damages resulting from the use of this +" software. +" +" Overview +" -------- +" The Most Recently Used (MRU) plugin provides an easy access to a list of +" recently opened/edited files in Vim. This plugin automatically stores the +" file names as you open/edit them in Vim. +" +" This plugin will work on all the platforms where Vim is supported. This +" plugin will work in both console and GUI Vim. This version of the MRU +" plugin needs Vim 7.0 and above. If you are using an earlier version of +" Vim, then you should use an older version of the MRU plugin. +" +" The recently used filenames are stored in a file specified by the Vim +" MRU_File variable. +" +" The Github repository for the MRU plugin is available at: +" +" http://github.com/yegappan/mru +" +" Installation +" ------------ +" 1. Copy the mru.vim file to one of the following directories: +" $HOME/.vim/plugin - Unix like systems +" $HOME/vimfiles/plugin - MS-Windows +" $VIM:vimfiles:plugin - Macintosh +" $VIM/vimfiles/plugin - All +" 2. Restart Vim. +" 3. You can use the ":MRU" command to list and edit the recently used files. +" In GUI Vim, you can use the 'File->Recent Files' menu to access the +" recently used files. +" +" To uninstall this plugin, remove this file (mru.vim) from the +" $HOME/.vim/plugin or $HOME/vimfiles/plugin or the $VIM/vimfile/plugin +" directory. +" +" Usage +" ----- +" To list and edit files from the MRU list, you can use the ":MRU" command. +" The ":MRU" command displays the MRU file list in a temporary Vim window. If +" the MRU window is already opened, then the MRU list displayed in the window +" is refreshed. +" +" If you are using GUI Vim, then the names of the recently edited files are +" added to the "File->Recent Files" menu. You can select the name of a file +" from this sub-menu to edit the file. +" +" You can use the normal Vim commands to move around in the MRU window. You +" cannot make changes in the MRU window. +" +" You can select a file name to edit by pressing the key or by double +" clicking the left mouse button on a file name. The selected file will be +" opened. If the file is already opened in a window, the cursor will be moved +" to that window. Otherwise, the file is opened in the previous window. If the +" previous window has a modified buffer or is the preview window or is used by +" some other plugin, then the file is opened in a new window. +" +" You can press the 'o' key to open the file name under the cursor in the +" MRU window in a new window. You can also press instead of 'o' +" to open the file in a new window. +" +" To open a file from the MRU window in read-only mode (view), press the 'v' +" key. +" +" To open a file from the MRU window in a new tab, press the 't' key. If the +" file is already opened in a window in the current or in another tab, then +" the cursor is moved to that tab. Otherwise, a new tab is opened. +" +" You can open multiple files from the MRU window by specifying a count before +" pressing '' or 'v' or 'o' or 't'. You can also visually (using +" linewise visual mode) select multiple filenames and invoke the commands to +" open the files. Each selected file will be opened in a separate window or +" tab. +" +" You can press the 'u' key in the MRU window to update the file list. This is +" useful if you keep the MRU window open always. +" +" You can close the MRU window by pressing the 'q' key or the key or +" using one of the Vim window commands. +" +" To display only files matching a pattern from the MRU list in the MRU +" window, you can specify a pattern to the ":MRU" command. For example, to +" display only file names matching "vim" in them, you can use the following +" command ":MRU vim". When you specify a partial file name and only one +" matching filename is found, then the ":MRU" command will edit that file. +" +" The ":MRU" command supports command-line completion of file names from +" the MRU list. You can enter a partial file name and then press +" or to complete or list all the matching file names. Note that +" after typing the ":MRU" command, you have to enter a space before completing +" the file names with . +" +" When a file supplied to the ":MRU" command is not present in the MRU list, +" but it is a readable file, then the file will be opened (even though it is +" not present in the MRU list). This is useful if you want to open a file +" present in the same directory as a file in the MRU list. You can use the +" command-line completion of the ":MRU" command to complete the full path of a +" file and then modify the path to open another file present in the same path. +" +" Whenever the MRU list changes, the MRU file is updated with the latest MRU +" list. When you have multiple instances of Vim running at the same time, the +" latest MRU list will show up in all the instances of Vim. +" +" The MRUFilename syntax group is used to highlight the file names in the MRU +" window. By default, this syntax group is linked to the Identifier highlight +" group. You can change the highlight group by adding the following line in +" your .vimrc: +" +" highlight link MRUFileName LineNr +" +" The MRU buffer uses the 'mru file type. You can use this file type to add +" custom auto commands, syntax highlighting, etc. +" +" Configuration +" ------------- +" By changing the following variables you can configure the behavior of this +" plugin. Set the following variables in your .vimrc file using the 'let' +" command. +" +" The list of recently edited file names is stored in the file specified by the +" MRU_File variable. The default setting for this variable is +" $HOME/.vim_mru_files for Unix-like systems and $USERPROFILE/_vim_mru_files +" for MS-Windows systems. You can change this variable to point to a file by +" adding the following line to the .vimrc file: +" +" let MRU_File = 'd:\myhome\_vim_mru_files' +" +" By default, the plugin will remember the names of the last 100 used files. +" As you edit more files, old file names will be removed from the MRU list. +" You can set the 'MRU_Max_Entries' variable to remember more file names. For +" example, to remember 1000 most recently used file names, you can use +" +" let MRU_Max_Entries = 1000 +" +" By default, all the edited file names will be added to the MRU list. If you +" want to exclude file names matching a list of patterns, you can set the +" MRU_Exclude_Files variable to a list of Vim regular expressions. By default, +" this variable is set to an empty string. For example, to not include files +" in the temporary (/tmp, /var/tmp and d:\temp) directories, you can set the +" MRU_Exclude_Files variable to +" +" let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' " For Unix +" let MRU_Exclude_Files = '^c:\\temp\\.*' " For MS-Windows +" +" The specified pattern should be a Vim regular expression pattern. +" +" If you want to add only file names matching a set of patterns to the MRU +" list, then you can set the MRU_Include_Files variable. This variable should +" be set to a Vim regular expression pattern. For example, to add only .c and +" .h files to the MRU list, you can set this variable as below: +" +" let MRU_Include_Files = '\.c$\|\.h$' +" +" By default, MRU_Include_Files is set to an empty string and all the edited +" filenames are added to the MRU list. +" +" The default height of the MRU window is 8. You can set the MRU_Window_Height +" variable to change the window height. +" +" let MRU_Window_Height = 15 +" +" By default, when the :MRU command is invoked, the MRU list will be displayed +" in a new window. Instead, if you want the MRU plugin to reuse the current +" window, then you can set the 'MRU_Use_Current_Window' variable to one. +" +" let MRU_Use_Current_Window = 1 +" +" The MRU plugin will reuse the current window. When a file name is selected, +" the file is also opened in the current window. +" +" When you select a file from the MRU window, the MRU window will be +" automatically closed and the selected file will be opened in the previous +" window. You can set the 'MRU_Auto_Close' variable to zero to keep the MRU +" window open. +" +" let MRU_Auto_Close = 0 +" +" If you don't use the "File->Recent Files" menu and want to disable it, +" then you can set the 'MRU_Add_Menu' variable to zero. By default, the +" menu is enabled. +" +" let MRU_Add_Menu = 0 +" +" If too many file names are present in the MRU list, then updating the MRU +" menu to list all the file names makes Vim slow. To avoid this, the +" MRU_Max_Menu_Entries variable controls the number of file names to show in +" the MRU menu. By default, this is set to 10. You can change this to show +" more entries in the menu. +" +" let MRU_Max_Menu_Entries = 20 +" +" If many file names are present in the MRU list, then the MRU menu is split +" into sub-menus. Each sub-menu contains MRU_Max_Submenu_Entries file names. +" The default setting for this is 10. You can change this to increase the +" number of file names displayed in a single sub-menu: +" +" let MRU_Max_Submenu_Entries = 15 +" +" In the MRU window, the filenames are displayed in two parts. The first part +" contains the file name without the path and the second part contains the +" full path to the file in parenthesis. This format is controlled by the +" MRU_Filename_Format variable. If you prefer to change this to some other +" format, then you can modify the MRU_Filename_Format variable. For example, +" to display the full path without splitting it, you can set this variable +" as shown below: +" +" let MRU_Filename_Format = +" \ {'formatter':'v:val', 'parser':'.*', 'syntax': '[^/\\]\+$'} +" +" ****************** Do not modify after this line ************************ +if exists('loaded_mru') + finish +endif +let loaded_mru=1 + +if v:version < 700 + finish +endif + +" Line continuation used here +let s:cpo_save = &cpo +set cpo&vim + +" MRU configuration variables {{{1 +" Maximum number of entries allowed in the MRU list +if !exists('MRU_Max_Entries') + let MRU_Max_Entries = 100 +endif + +" Files to exclude from the MRU list +if !exists('MRU_Exclude_Files') + let MRU_Exclude_Files = '' +endif + +" Files to include in the MRU list +if !exists('MRU_Include_Files') + let MRU_Include_Files = '' +endif + +" Height of the MRU window +" Default height is 8 +if !exists('MRU_Window_Height') + let MRU_Window_Height = 8 +endif + +if !exists('MRU_Use_Current_Window') + let MRU_Use_Current_Window = 0 +endif + +if !exists('MRU_Auto_Close') + let MRU_Auto_Close = 1 +endif + +if !exists('MRU_File') + if has('unix') || has('macunix') + let MRU_File = $HOME . '/.vim_mru_files' + else + let MRU_File = $VIM . '/_vim_mru_files' + if has('win32') + " MS-Windows + if $USERPROFILE != '' + let MRU_File = $USERPROFILE . '\_vim_mru_files' + endif + endif + endif +endif + +" Option for enabling or disabling the MRU menu +if !exists('MRU_Add_Menu') + let MRU_Add_Menu = 1 +endif + +" Maximum number of file names to show in the MRU menu. If too many files are +" listed in the menu, then Vim becomes slow when updating the menu. So set +" this to a low value. +if !exists('MRU_Max_Menu_Entries') + let MRU_Max_Menu_Entries = 10 +endif + +" Maximum number of file names to show in a MRU sub-menu. If the MRU list +" contains more file names than this setting, then the MRU menu is split into +" one or more sub-menus. +if !exists('MRU_Max_Submenu_Entries') + let MRU_Max_Submenu_Entries = 10 +endif + +" When only a single matching filename is found in the MRU list, the following +" option controls whether the file name is displayed in the MRU window or the +" file is directly opened. When this variable is set to 0 and a single +" matching file name is found, then the file is directly opened. +if !exists('MRU_Window_Open_Always') + let MRU_Window_Open_Always = 0 +endif + +" When opening a file from the MRU list, the file is opened in the current +" tab. If the selected file has to be opened in a tab always, then set the +" following variable to 1. If the file is already opened in a tab, then the +" cursor will be moved to that tab. +if !exists('MRU_Open_File_Use_Tabs') + let MRU_Open_File_Use_Tabs = 0 +endif + +" Format of the file names displayed in the MRU window. +" The default is to display the filename followed by the complete path to the +" file in parenthesis. This variable controls the expressions used to format +" and parse the path. This can be changed to display the filenames in a +" different format. The 'formatter' specifies how to split/format the filename +" and 'parser' specifies how to read the filename back; 'syntax' matches the +" part to be highlighted. +if !exists('MRU_Filename_Format') + let MRU_Filename_Format = { + \ 'formatter': 'fnamemodify(v:val, ":t") . " (" . v:val . ")"', + \ 'parser': '(\zs.*\ze)', + \ 'syntax': '^.\{-}\ze(' + \} +endif + +" Control to temporarily lock the MRU list. Used to prevent files from +" getting added to the MRU list when the ':vimgrep' command is executed. +let s:mru_list_locked = 0 + +" MRU_LoadList {{{1 +" Loads the latest list of file names from the MRU file +function! s:MRU_LoadList() + " If the MRU file is present, then load the list of filenames. Otherwise + " start with an empty list. + if filereadable(g:MRU_File) + let s:MRU_files = readfile(g:MRU_File) + if s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim' + " Generated by the previous version of the MRU plugin. + " Discard the list. + let s:MRU_files = [] + elseif s:MRU_files[0] =~# '^#' + " Remove the comment line + call remove(s:MRU_files, 0) + else + " Unsupported format + let s:MRU_files = [] + endif + else + let s:MRU_files = [] + endif + + " Refresh the MRU menu with the latest list of filenames + call s:MRU_Refresh_Menu() +endfunction + +" MRU_SaveList {{{1 +" Saves the MRU file names to the MRU file +function! s:MRU_SaveList() + let l = [] + call add(l, '# Most recently edited files in Vim (version 3.0)') + call extend(l, s:MRU_files) + call writefile(l, g:MRU_File) +endfunction + +" MRU_AddFile {{{1 +" Adds a file to the MRU file list +" acmd_bufnr - Buffer number of the file to add +function! s:MRU_AddFile(acmd_bufnr) + if s:mru_list_locked + " MRU list is currently locked + return + endif + + " Get the full path to the filename + let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') + if fname == '' + return + endif + + " Skip temporary buffers with buftype set. The buftype is set for buffers + " used by plugins. + if &buftype != '' + return + endif + + if g:MRU_Include_Files != '' + " If MRU_Include_Files is set, include only files matching the + " specified pattern + if fname !~# g:MRU_Include_Files + return + endif + endif + + if g:MRU_Exclude_Files != '' + " Do not add files matching the pattern specified in the + " MRU_Exclude_Files to the MRU list + if fname =~# g:MRU_Exclude_Files + return + endif + endif + + " If the filename is not already present in the MRU list and is not + " readable then ignore it + let idx = index(s:MRU_files, fname) + if idx == -1 + if !filereadable(fname) + " File is not readable and is not in the MRU list + return + endif + endif + + " Load the latest MRU file list + call s:MRU_LoadList() + + " Remove the new file name from the existing MRU list (if already present) + call filter(s:MRU_files, 'v:val !=# fname') + + " Add the new file list to the beginning of the updated old file list + call insert(s:MRU_files, fname, 0) + + " Trim the list + if len(s:MRU_files) > g:MRU_Max_Entries + call remove(s:MRU_files, g:MRU_Max_Entries, -1) + endif + + " Save the updated MRU list + call s:MRU_SaveList() + + " Refresh the MRU menu + call s:MRU_Refresh_Menu() + + " If the MRU window is open, update the displayed MRU list + let bname = '__MRU_Files__' + let winnum = bufwinnr(bname) + if winnum != -1 + let cur_winnr = winnr() + call s:MRU_Open_Window() + if winnr() != cur_winnr + exe cur_winnr . 'wincmd w' + endif + endif +endfunction + +" MRU_escape_filename {{{1 +" Escape special characters in a filename. Special characters in file names +" that should be escaped (for security reasons) +let s:esc_filename_chars = ' *?[{`$%#"|!<>();&' . "'\t\n" +function! s:MRU_escape_filename(fname) + if exists("*fnameescape") + return fnameescape(a:fname) + else + return escape(a:fname, s:esc_filename_chars) + endif +endfunction + +" MRU_Edit_File {{{1 +" Edit the specified file +" filename - Name of the file to edit +" sanitized - Specifies whether the filename is already escaped for special +" characters or not. +function! s:MRU_Edit_File(filename, sanitized) + if !a:sanitized + let esc_fname = s:MRU_escape_filename(a:filename) + else + let esc_fname = a:filename + endif + + " If the user wants to always open the file in a tab, then open the file + " in a tab. If it is already opened in a tab, then the cursor will be + " moved to that tab. + if g:MRU_Open_File_Use_Tabs + call s:MRU_Open_File_In_Tab(a:filename, esc_fname) + return + endif + + " If the file is already open in one of the windows, jump to it + let winnum = bufwinnr('^' . a:filename . '$') + if winnum != -1 + if winnum != winnr() + exe winnum . 'wincmd w' + endif + else + if !&hidden && (&modified || &buftype != '' || &previewwindow) + " Current buffer has unsaved changes or is a special buffer or is + " the preview window. The 'hidden' option is also not set. + " So open the file in a new window. + exe 'split ' . esc_fname + else + " The current file can be replaced with the selected file. + exe 'edit ' . esc_fname + endif + endif +endfunction + +" MRU_Open_File_In_Tab +" Open a file in a tab. If the file is already opened in a tab, jump to the +" tab. Otherwise, create a new tab and open the file. +" fname : Name of the file to open +" esc_fname : File name with special characters escaped +function! s:MRU_Open_File_In_Tab(fname, esc_fname) + " If the selected file is already open in the current tab or in + " another tab, jump to it. Otherwise open it in a new tab + if bufwinnr('^' . a:fname . '$') == -1 + let tabnum = -1 + let i = 1 + let bnum = bufnr('^' . a:fname . '$') + while i <= tabpagenr('$') + if index(tabpagebuflist(i), bnum) != -1 + let tabnum = i + break + endif + let i += 1 + endwhile + + if tabnum != -1 + " Goto the tab containing the file + exe 'tabnext ' . i + else + " Open a new tab as the last tab page + exe '$tabnew ' . a:esc_fname + endif + endif + + " Jump to the window containing the file + let winnum = bufwinnr('^' . a:fname . '$') + if winnum != winnr() + exe winnum . 'wincmd w' + endif +endfunction + +" MRU_Window_Edit_File {{{1 +" fname : Name of the file to edit. May specify single or multiple +" files. +" edit_type : Specifies how to edit the file. Can be one of 'edit' or 'view'. +" 'view' - Open the file as a read-only file +" 'edit' - Edit the file as a regular file +" multi : Specifies whether a single file or multiple files need to be +" opened. +" open_type : Specifies where to open the file. +" useopen - If the file is already present in a window, then +" jump to that window. Otherwise, open the file in +" the previous window. +" newwin_horiz - Open the file in a new horizontal window. +" newwin_vert - Open the file in a new vertical window. +" newtab - Open the file in a new tab. If the file is already +" opened in a tab, then jump to that tab. +" preview - Open the file in the preview window +function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type) + let esc_fname = s:MRU_escape_filename(a:fname) + + if a:open_type ==# 'newwin_horiz' + " Edit the file in a new horizontally split window above the previous + " window + wincmd p + exe 'belowright new ' . esc_fname + elseif a:open_type ==# 'newwin_vert' + " Edit the file in a new vertically split window above the previous + " window + wincmd p + exe 'belowright vnew ' . esc_fname + elseif a:open_type ==# 'newtab' || g:MRU_Open_File_Use_Tabs + call s:MRU_Open_File_In_Tab(a:fname, esc_fname) + elseif a:open_type ==# 'preview' + " Edit the file in the preview window + exe 'topleft pedit ' . esc_fname + else + " If the selected file is already open in one of the windows, + " jump to it + let winnum = bufwinnr('^' . a:fname . '$') + if winnum != -1 + exe winnum . 'wincmd w' + else + if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0 + " Jump to the window from which the MRU window was opened + if exists('s:MRU_last_buffer') + let last_winnr = bufwinnr(s:MRU_last_buffer) + if last_winnr != -1 && last_winnr != winnr() + exe last_winnr . 'wincmd w' + endif + endif + else + if g:MRU_Use_Current_Window == 0 + " Goto the previous window + " If MRU_Use_Current_Window is set to one, then the + " current window is used to open the file + wincmd p + endif + endif + + let split_window = 0 + + if (!&hidden && (&modified || &previewwindow)) || a:multi + " Current buffer has unsaved changes or is the preview window + " or the user is opening multiple files + " So open the file in a new window + let split_window = 1 + endif + + if &buftype != '' + " Current buffer is a special buffer (maybe used by a plugin) + if g:MRU_Use_Current_Window == 0 || + \ bufnr('%') != bufnr('__MRU_Files__') + let split_window = 1 + endif + endif + + " Edit the file + if split_window + " Current buffer has unsaved changes or is a special buffer or + " is the preview window. So open the file in a new window + if a:edit_type ==# 'edit' + exe 'split ' . esc_fname + else + exe 'sview ' . esc_fname + endif + else + if a:edit_type ==# 'edit' + exe 'edit ' . esc_fname + else + exe 'view ' . esc_fname + endif + endif + endif + endif +endfunction + +" MRU_Select_File_Cmd {{{1 +" Open a file selected from the MRU window +" +" 'opt' has two values separated by comma. The first value specifies how to +" edit the file and can be either 'edit' or 'view'. The second value +" specifies where to open the file. It can take one of the following values: +" 'useopen' to open file in the previous window +" 'newwin_horiz' to open the file in a new horizontal split window +" 'newwin_vert' to open the file in a new vertical split window. +" 'newtab' to open the file in a new tab. +" If multiple file names are selected using visual mode, then open multiple +" files (either in split windows or tabs) +function! s:MRU_Select_File_Cmd(opt) range + let [edit_type, open_type] = split(a:opt, ',') + + let fnames = getline(a:firstline, a:lastline) + + if g:MRU_Auto_Close == 1 && g:MRU_Use_Current_Window == 0 + " Automatically close the window if the file window is + " not used to display the MRU list. + silent! close + endif + + let multi = 0 + + for f in fnames + if f == '' + continue + endif + + " The text in the MRU window contains the filename in parenthesis + let file = matchstr(f, g:MRU_Filename_Format.parser) + + call s:MRU_Window_Edit_File(file, multi, edit_type, open_type) + + if a:firstline != a:lastline + " Opening multiple files + let multi = 1 + endif + endfor +endfunction + +" MRU_Warn_Msg {{{1 +" Display a warning message +function! s:MRU_Warn_Msg(msg) + echohl WarningMsg + echo a:msg + echohl None +endfunction + +" MRU_Open_Window {{{1 +" Display the Most Recently Used file list in a temporary window. +" If the optional argument is supplied, then it specifies the pattern of files +" to selectively display in the MRU window. +function! s:MRU_Open_Window(...) + + " Load the latest MRU file list + call s:MRU_LoadList() + + " Check for empty MRU list + if empty(s:MRU_files) + call s:MRU_Warn_Msg('MRU file list is empty') + return + endif + + " Save the current buffer number. This is used later to open a file when a + " entry is selected from the MRU window. The window number is not saved, + " as the window number will change when new windows are opened. + let s:MRU_last_buffer = bufnr('%') + + let bname = '__MRU_Files__' + + " If the window is already open, jump to it + let winnum = bufwinnr(bname) + if winnum != -1 + if winnr() != winnum + " If not already in the window, jump to it + exe winnum . 'wincmd w' + endif + + setlocal modifiable + + " Delete the contents of the buffer to the black-hole register + silent! %delete _ + else + if g:MRU_Use_Current_Window + " Reuse the current window + " + " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open + " a new buffer + let bufnum = bufnr(bname) + if bufnum == -1 + let cmd = 'edit ' . bname + else + let cmd = 'buffer ' . bufnum + endif + + exe cmd + + if bufnr('%') != bufnr(bname) + " Failed to edit the MRU buffer + return + endif + else + " Open a new window at the bottom + + " If the __MRU_Files__ buffer exists, then reuse it. Otherwise open + " a new buffer + let bufnum = bufnr(bname) + if bufnum == -1 + let wcmd = bname + else + let wcmd = '+buffer' . bufnum + endif + + exe 'silent! botright ' . g:MRU_Window_Height . 'split ' . wcmd + endif + endif + + setlocal modifiable + + " Mark the buffer as scratch + setlocal buftype=nofile + setlocal bufhidden=delete + setlocal noswapfile + setlocal nowrap + setlocal nobuflisted + " Set the 'filetype' to 'mru'. This allows the user to apply custom + " syntax highlighting or other changes to the MRU bufer. + setlocal filetype=mru + " Use fixed height for the MRU window + setlocal winfixheight + + " Setup the cpoptions properly for the maps to work + let old_cpoptions = &cpoptions + set cpoptions&vim + + " Create mappings to select and edit a file from the MRU list + nnoremap + \ :call MRU_Select_File_Cmd('edit,useopen') + vnoremap + \ :call MRU_Select_File_Cmd('edit,useopen') + nnoremap o + \ :call MRU_Select_File_Cmd('edit,newwin_horiz') + vnoremap o + \ :call MRU_Select_File_Cmd('edit,newwin_horiz') + nnoremap + \ :call MRU_Select_File_Cmd('edit,newwin_horiz') + vnoremap + \ :call MRU_Select_File_Cmd('edit,newwin_horiz') + nnoremap O + \ :call MRU_Select_File_Cmd('edit,newwin_vert') + vnoremap O + \ :call MRU_Select_File_Cmd('edit,newwin_vert') + nnoremap t + \ :call MRU_Select_File_Cmd('edit,newtab') + vnoremap t + \ :call MRU_Select_File_Cmd('edit,newtab') + nnoremap v + \ :call MRU_Select_File_Cmd('view,useopen') + nnoremap p + \ :call MRU_Select_File_Cmd('view,preview') + vnoremap p + \ :if line("'<") == line("'>") + \ call MRU_Select_File_Cmd('open,preview') + \ else + \ echoerr "Only a single file can be previewed" + \ endif + nnoremap u :MRU + nnoremap <2-LeftMouse> + \ :call MRU_Select_File_Cmd('edit,useopen') + nnoremap q :close + + " Restore the previous cpoptions settings + let &cpoptions = old_cpoptions + + " Display the MRU list + if a:0 == 0 + " No search pattern specified. Display the complete list + let m = copy(s:MRU_files) + else + " Display only the entries matching the specified pattern + " First try using it as a literal pattern + let m = filter(copy(s:MRU_files), 'stridx(v:val, a:1) != -1') + if len(m) == 0 + " No match. Try using it as a regular expression + let m = filter(copy(s:MRU_files), 'v:val =~# a:1') + endif + endif + + " Get the tail part of the file name (without the directory) and display + " it along with the full path in parenthesis. + let output = map(m, g:MRU_Filename_Format.formatter) + silent! 0put =output + + " Delete the empty line at the end of the buffer + silent! $delete _ + + " Move the cursor to the beginning of the file + normal! gg + + " Add syntax highlighting for the file names + if has_key(g:MRU_Filename_Format, 'syntax') + exe "syntax match MRUFileName '" . g:MRU_Filename_Format.syntax . "'" + highlight default link MRUFileName Identifier + endif + + setlocal nomodifiable +endfunction + +" MRU_Complete {{{1 +" Command-line completion function used by :MRU command +function! s:MRU_Complete(ArgLead, CmdLine, CursorPos) + if a:ArgLead == '' + " Return the complete list of MRU files + return s:MRU_files + else + " Return only the files matching the specified pattern + return filter(copy(s:MRU_files), 'v:val =~? a:ArgLead') + endif +endfunction + +" MRU_Cmd {{{1 +" Function to handle the MRU command +" pat - File name pattern passed to the MRU command +function! s:MRU_Cmd(pat) + if a:pat == '' + " No arguments specified. Open the MRU window + call s:MRU_Open_Window() + return + endif + + " Load the latest MRU file + call s:MRU_LoadList() + + " Empty MRU list + if empty(s:MRU_files) + call s:MRU_Warn_Msg('MRU file list is empty') + return + endif + + " First use the specified string as a literal string and search for + " filenames containing the string. If only one filename is found, + " then edit it (unless the user wants to open the MRU window always) + let m = filter(copy(s:MRU_files), 'stridx(v:val, a:pat) != -1') + if len(m) > 0 + if len(m) == 1 && !g:MRU_Window_Open_Always + call s:MRU_Edit_File(m[0], 0) + return + endif + + " More than one file matches. Try find an accurate match + let new_m = filter(m, 'v:val ==# a:pat') + if len(new_m) == 1 && !g:MRU_Window_Open_Always + call s:MRU_Edit_File(new_m[0], 0) + return + endif + + " Couldn't find an exact match, open the MRU window with all the + " files matching the pattern. + call s:MRU_Open_Window(a:pat) + return + endif + + " Use the specified string as a regular expression pattern and search + " for filenames matching the pattern + let m = filter(copy(s:MRU_files), 'v:val =~? a:pat') + + if len(m) == 0 + " If an existing file (not present in the MRU list) is specified, + " then open the file. + if filereadable(a:pat) + call s:MRU_Edit_File(a:pat, 0) + return + endif + + " No filenames matching the specified pattern are found + call s:MRU_Warn_Msg("MRU file list doesn't contain " . + \ "files matching " . a:pat) + return + endif + + if len(m) == 1 && !g:MRU_Window_Open_Always + call s:MRU_Edit_File(m[0], 0) + return + endif + + call s:MRU_Open_Window(a:pat) +endfunction + +" MRU_add_files_to_menu {{{1 +" Adds a list of files to the "Recent Files" sub menu under the "File" menu. +" prefix - Prefix to use for each of the menu entries +" file_list - List of file names to add to the menu +function! s:MRU_add_files_to_menu(prefix, file_list) + for fname in a:file_list + " Escape special characters in the filename + let esc_fname = escape(fnamemodify(fname, ':t'), ".\\" . + \ s:esc_filename_chars) + let esc_fname = substitute(esc_fname, '&', '&&', 'g') + + " Truncate the directory name if it is long + let dir_name = fnamemodify(fname, ':h') + let len = strlen(dir_name) + " Shorten long file names by adding only few characters from + " the beginning and end. + if len > 30 + let dir_name = strpart(dir_name, 0, 10) . + \ '...' . + \ strpart(dir_name, len - 20) + endif + let esc_dir_name = escape(dir_name, ".\\" . s:esc_filename_chars) + let esc_dir_name = substitute(esc_dir_name, '&', '&&', 'g') + + let menu_path = '&File.&Recent\ Files.' . a:prefix . esc_fname . + \ '\ (' . esc_dir_name . ')' + let esc_mfname = s:MRU_escape_filename(fname) + exe 'anoremenu ' . menu_path . + \ " :call MRU_Edit_File('" . esc_mfname . "', 1)" + exe 'tmenu ' . menu_path . ' Edit file ' . esc_mfname + endfor +endfunction + +" MRU_Refresh_Menu {{{1 +" Refresh the MRU menu +function! s:MRU_Refresh_Menu() + if !has('menu') || !g:MRU_Add_Menu + " No support for menus + return + endif + + " Setup the cpoptions properly for the maps to work + let old_cpoptions = &cpoptions + set cpoptions&vim + + " Remove the MRU menu + " To retain the teared-off MRU menu, we need to add a dummy entry + silent! unmenu &File.&Recent\ Files + " The menu priority of the File menu is 10. If the MRU plugin runs + " first before menu.vim, the File menu order may not be correct. + " So specify the priority of the File menu here. + 10noremenu &File.&Recent\ Files.Dummy + silent! unmenu! &File.&Recent\ Files + + anoremenu &File.&Recent\ Files.Refresh\ list + \ :call MRU_LoadList() + exe 'tmenu File.&Recent\ Files.Refresh\ list Reload the MRU file list from ' + \ . s:MRU_escape_filename(g:MRU_File) + anoremenu File.&Recent\ Files.-SEP1- : + + " Add the filenames in the MRU list to the menu + let entry_cnt = len(s:MRU_files) + if entry_cnt > g:MRU_Max_Menu_Entries + " Show only MRU_Max_Menu_Entries file names in the menu + let mru_list = s:MRU_files[0 : g:MRU_Max_Menu_Entries - 1] + let entry_cnt = g:MRU_Max_Menu_Entries + else + let mru_list = s:MRU_files + endif + if entry_cnt > g:MRU_Max_Submenu_Entries + " Split the MRU menu into sub-menus + for start_idx in range(0, entry_cnt, g:MRU_Max_Submenu_Entries) + let last_idx = start_idx + g:MRU_Max_Submenu_Entries - 1 + if last_idx >= entry_cnt + let last_idx = entry_cnt - 1 + endif + let prefix = 'Files\ (' . (start_idx + 1) . '\.\.\.' . + \ (last_idx + 1) . ').' + call s:MRU_add_files_to_menu(prefix, + \ mru_list[start_idx : last_idx]) + endfor + else + call s:MRU_add_files_to_menu('', mru_list) + endif + + " Remove the dummy menu entry + unmenu &File.&Recent\ Files.Dummy + + " Restore the previous cpoptions settings + let &cpoptions = old_cpoptions +endfunction + +" Load the MRU list on plugin startup +call s:MRU_LoadList() + +" MRU autocommands {{{1 +" Autocommands to detect the most recently used files +autocmd BufRead * call s:MRU_AddFile(expand('')) +autocmd BufNewFile * call s:MRU_AddFile(expand('')) +autocmd BufWritePost * call s:MRU_AddFile(expand('')) + +" The ':vimgrep' command adds all the files searched to the buffer list. +" This also modifies the MRU list, even though the user didn't edit the +" files. Use the following autocmds to prevent this. +autocmd QuickFixCmdPre *vimgrep* let s:mru_list_locked = 1 +autocmd QuickFixCmdPost *vimgrep* let s:mru_list_locked = 0 + +" Command to open the MRU window +command! -nargs=? -complete=customlist,s:MRU_Complete MRU + \ call s:MRU_Cmd() +command! -nargs=? -complete=customlist,s:MRU_Complete Mru + \ call s:MRU_Cmd() + +" }}} + +" restore 'cpo' +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set foldenable foldmethod=marker: diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index e558036b..2681b67f 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -4,7 +4,20 @@ version in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.10 +- **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236) +- **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230) +- **.7**: Fix mouse-clicking a file to open it. (PhilRunninger) [#1225](https://github.com/preservim/nerdtree/pull/1225) +- **.6**: Restore the default behavior of the key. (PhilRunninger) [#1221](https://github.com/preservim/nerdtree/pull/1221) +- **.5**: Fix `{'keepopen':0}` in NERDTreeCustomOpenArgs (PhilRunninger) [#1217](https://github.com/preservim/nerdtree/pull/1217) +- **.4**: Removed directory separator from sort key (Daniel E) [#1219](https://github.com/preservim/nerdtree/pull/1219) +- **.3**: Add new FAQ and answer: How to prevent buffers replacing NERDTree. (PhilRunninger) [#1215](https://github.com/preservim/nerdtree/pull/1215) +- **.2**: New menu command: Run a system command in this directory. (PhilRunninger) [#1214](https://github.com/preservim/nerdtree/pull/1214) +- **.1**: Escape quotation marks so they can be used in key mappings. (PhilRunninger) [#1213](https://github.com/preservim/nerdtree/pull/1213) +- **.0**: Enable full path specifications for NERDTreeIgnore (PhilRunninger) [#1207](https://github.com/preservim/nerdtree/pull/1207) #### 6.9 +- **.12**: Respect NERDTreeCustomOpenArgs when opening bookmark (przepompownia) [#1200](https://github.com/preservim/nerdtree/pull/1200) +- **.11**: Revamp the README. (buncis, PhilRunninger) [#1192](https://github.com/preservim/nerdtree/pull/1192), [#1193](https://github.com/preservim/nerdtree/pull/1193) - **.10**: Open a mirrored NERDTree with correct width (PhilRunninger) [#1177](https://github.com/preservim/nerdtree/pull/1177) - **.9**: Updated Readme, removed typo (H3RSKO) [#1167](https://github.com/preservim/nerdtree/pull/1167) - **.8**: Refactor sort comparison functions, removing redundancy (PhilRunninger) [#1166](https://github.com/preservim/nerdtree/pull/1166) diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index 018923cf..135f41ad 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -1,157 +1,185 @@ -The NERDTree [![Vint](https://github.com/preservim/nerdtree/workflows/Vint/badge.svg)](https://github.com/preservim/nerdtree/actions?workflow=Vint) -============= +# The NERDTree [![Vint](https://github.com/preservim/nerdtree/workflows/Vint/badge.svg)](https://github.com/preservim/nerdtree/actions?workflow=Vint) -Introduction ------------- +## Introduction -The NERDTree is a file system explorer for the Vim editor. Using this plugin, -users can visually browse complex directory hierarchies, quickly open files for -reading or editing, and perform basic file system operations. - -This plugin can also be extended with custom mappings using a special API. The -details of this API and of other NERDTree features are described in the -included documentation. +The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations. ![NERDTree Screenshot](https://github.com/preservim/nerdtree/raw/master/screenshot.png) -Installation ------------- +## Installation -Below are just some of the methods for installing NERDTree. Do not follow all of these instructions; just pick your favorite one. Other plugin managers exist, and NERDTree should install just fine with any of them. +Use your favorite plugin manager to install this plugin. [tpope/vim-pathogen](https://github.com/tpope/vim-pathogen), [VundleVim/Vundle.vim](https://github.com/VundleVim/Vundle.vim), [junegunn/vim-plug](https://github.com/junegunn/vim-plug), and [Shougo/dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). Basic instructions are provided below, but please **be sure to read, understand, and follow all the safety rules that come with your ~~power tools~~ plugin manager.** -#### Vim 8+ packages +If you have no favorite, or want to manage your plugins without 3rd-party dependencies, consider using Vim 8+ packages, as described in Greg Hurrell's excellent Youtube video: [Vim screencast #75: Plugin managers](https://www.youtube.com/watch?v=X2_R3uxDN6g). -If you are using VIM version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal: +
+Pathogen +Pathogen is more of a runtime path manager than a plugin manager. You must clone the plugins' repositories yourself to a specific location, and Pathogen makes sure they are available in Vim. + + +1. In the terminal, + ```bash + git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree + ``` +1. In your `vimrc`, + ```vim + call pathogen#infect() + syntax on + filetype plugin indent on + ``` +1. Restart Vim, and run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`. +
+ +
+ Vundle + +1. Install Vundle, according to its instructions. +1. Add the following text to your `vimrc`. + ```vim + call vundle#begin() + Plugin 'preservim/nerdtree' + call vundle#end() + ``` +1. Restart Vim, and run the `:PluginInstall` statement to install your plugins. +
+ +
+ Vim-Plug + +1. Install Vim-Plug, according to its instructions. +1. Add the following text to your `vimrc`. +```vim +call plug#begin() + Plug 'preservim/nerdtree' +call plug#end() +``` +1. Restart Vim, and run the `:PlugInstall` statement to install your plugins. +
+ +
+ Dein + +1. Install Dein, according to its instructions. +1. Add the following text to your `vimrc`. + ```vim + call dein#begin() + call dein#add('preservim/nerdtree') + call dein#end() + ``` +1. Restart Vim, and run the `:call dein#install()` statement to install your plugins. +
+ +
+Vim 8+ packages + +If you are using Vim version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal: ```bash git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q ``` +
-Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you need to take. +## Getting Started +After installing NERDTree, the best way to learn it is to turn on the Quick Help. Open NERDTree with the `:NERDTree` command, and press `?` to turn on the Quick Help, which will show you all the mappings and commands available in the NERDTree. Of course, your most complete source of information is the documentation: `:help NERDTree`. -#### [pathogen.vim](https://github.com/tpope/vim-pathogen) +## NERDTree Plugins +NERDTree can be extended with custom mappings and functions using its built-in API. The details of this API and are described in the included documentation. Several plugins have been written, and are available on Github for installation like any other plugin. The plugins in this list are maintained (or not) by their respective owners, and certain combinations may be incompatible. -In the terminal, -```bash -git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree -``` -In your vimrc, +* [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin): Shows Git status flags for files and folders in NERDTree. +* [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons): Adds filetype-specific icons to NERDTree files and folders, +* [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight): Adds syntax highlighting to NERDTree based on filetype. +* [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin): Saves and restores the state of the NERDTree between sessions. +* [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops): 1) Highlights open files in a different color. 2) Closes a buffer directly from NERDTree. +* [PhilRunninger/nerdtree-visual-selection](https://github.com/PhilRunninger/nerdtree-visual-selection): Enables NERDTree to open, delete, move, or copy multiple Visually-selected files at once. + +If any others should be listed, mention them in an issue or pull request. + + +## Frequently Asked Questions + +In the answers to these questions, you will see code blocks that you can put in your `vimrc` file. + +### How can I map a specific key or shortcut to open NERDTree? + +NERDTree doesn't create any shortcuts outside of the NERDTree window, so as not to overwrite any of your other shortcuts. Use the `nnoremap` command in your `vimrc`. You, of course, have many keys and NERDTree commands to choose from. Here are but a few examples. ```vim -call pathogen#infect() -syntax on -filetype plugin indent on +nnoremap n :NERDTreeFocus +nnoremap :NERDTree +nnoremap :NERDTreeToggle +nnoremap :NERDTreeFind ``` -Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`. +### How do I open NERDTree automatically when Vim starts? +Each code block below is slightly different, as described in the `" Comment lines`. -#### [Vundle.vim](https://github.com/VundleVim/Vundle.vim) ```vim -call vundle#begin() -Plugin 'preservim/nerdtree' -call vundle#end() +" Start NERDTree and leave the cursor in it. +autocmd VimEnter * NERDTree ``` - -#### [vim-plug](https://github.com/junegunn/vim-plug) -```vim -call plug#begin() -Plug 'preservim/nerdtree' -call plug#end() -``` - -#### [dein.vim](https://github.com/Shougo/dein.vim) -```vim -call dein#begin() -call dein#add('preservim/nerdtree') -call dein#end() -``` - -#### [apt-vim](https://github.com/egalpin/apt-vim) -```bash -apt-vim install -y https://github.com/preservim/nerdtree.git -``` - -F.A.Q. (here, and in the [Wiki](https://github.com/preservim/nerdtree/wiki)) ------- - -#### Is there any support for `git` flags? - -Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin). - --- -#### Can I have the nerdtree on every tab automatically? - -Nope. If this is something you want then chances are you aren't using tabs and -buffers as they were intended to be used. Read this -http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers - -If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs) - ---- -#### How can I open a NERDTree automatically when vim starts up? - -Stick this in your vimrc: `autocmd vimenter * NERDTree` - ---- -#### How can I open a NERDTree automatically when vim starts up if no files were specified? - -Stick this in your vimrc: ```vim +" Start NERDTree and put the cursor back in the other window. +autocmd VimEnter * NERDTree | wincmd p +``` +--- +```vim +" Start NERDTree when Vim is started without file arguments. autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif +autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif ``` - -Note: Now start vim with plain `vim`, not `vim .` - --- -#### What if I'm also opening a saved session, for example `vim -S session_file.vim`? I don't want NERDTree to open in that scenario. ```vim +" Start NERDTree. If a file is specified, move the cursor to its window. autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") && v:this_session == "" | NERDTree | endif +autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif ``` - --- -#### How can I open NERDTree automatically when vim starts up on opening a directory? ```vim +" Start NERDTree, unless a file or session is specified, eg. vim -S session_file.vim. autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif +autocmd VimEnter * if argc() == 0 && !exists('s:std_in') && v:this_session == '' | NERDTree | endif ``` - -This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file. - -Note: Executing `vim ~/some-directory` will open NERDTree and a new edit window. `exe 'cd '.argv()[0]` sets the `pwd` of the new edit window to `~/some-directory` - --- -#### How can I map a specific key or shortcut to open NERDTree? - -Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): ```vim -map :NERDTreeToggle +" Start NERDTree when Vim starts with a directory argument. +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | + \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif ``` ---- -#### How can I close vim if the only window left open is a NERDTree? +### How can I close Vim automatically when NERDTree is the last window? -Stick this in your vimrc: ```vim -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +" Exit Vim if NERDTree is the only window left. +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | + \ quit | endif ``` ---- -#### Can I have different highlighting for different file extensions? +### How can I prevent other buffers replacing NERDTree in its window? -See here: https://github.com/preservim/nerdtree/issues/433#issuecomment-92590696 +```vim +" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. +autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | + \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif +``` ---- -#### How can I change default arrows? +### Can I have the same NERDTree on every tab automatically? + +```vim +" Open the existing NERDTree on each new tab. +autocmd BufWinEnter * silent NERDTreeMirror +``` +or change your NERDTree-launching shortcut key like so: +```vim +" Mirror the NERDTree before showing it. This makes it the same on all tabs. +nnoremap :NERDTreeMirror:NERDTreeFocus +``` + +### How can I change the default arrows? -Use these variables in your vimrc. Note that below are default arrow symbols ```vim let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowCollapsible = '▾' ``` -You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left. -```vim -let g:NERDTreeDirArrowExpandable = '' -let g:NERDTreeDirArrowCollapsible = '' -``` +The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details. diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 983bb621..e6f687a0 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -30,6 +30,16 @@ endfunction " SECTION: General Functions {{{1 "============================================================ +" FUNCTION: nerdtree#closeTreeOnOpen() {{{2 +function! nerdtree#closeTreeOnOpen() abort + return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3 +endfunction + +" FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2 +function! nerdtree#closeBookmarksOnOpen() abort + return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3 +endfunction + " FUNCTION: nerdtree#slash() {{{2 " Return the path separator used by the underlying file system. Special " consideration is taken for the use of the 'shellslash' option on Windows @@ -46,28 +56,6 @@ function! nerdtree#slash() abort return '/' endfunction -"FUNCTION: nerdtree#and(x,y) {{{2 -" Implements and() function for Vim <= 7.4 -function! nerdtree#and(x,y) abort - if exists('*and') - return and(a:x, a:y) - else - let l:x = a:x - let l:y = a:y - let l:n = 0 - let l:result = 0 - while l:x > 0 && l:y > 0 - if (l:x % 2) && (l:y % 2) - let l:result += float2nr(pow(2, l:n)) - endif - let l:x = float2nr(l:x / 2) - let l:y = float2nr(l:y / 2) - let l:n += 1 - endwhile - return l:result - endif -endfunction - "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "inits a window tree in the current buffer if appropriate function! nerdtree#checkForBrowse(dir) abort diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 78b3fa1f..fc22f216 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -108,10 +108,17 @@ function! s:customOpenBookmark(node) abort endfunction "FUNCTION: s:initCustomOpenArgs() {{{1 -" Make sure NERDTreeCustomOpenArgs has needed keys function! s:initCustomOpenArgs() abort - let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) - return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep') + let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}, 'dir': {}} + try + let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {}) + call extend(g:NERDTreeCustomOpenArgs, l:defaultOpenArgs, 'keep') + catch /^Vim(\a\+):E712:/ + call nerdtree#echoWarning('g:NERDTreeCustomOpenArgs is not set properly. Using default value.') + let g:NERDTreeCustomOpenArgs = l:defaultOpenArgs + finally + return g:NERDTreeCustomOpenArgs + endtry endfunction "FUNCTION: s:activateAll() {{{1 @@ -137,13 +144,13 @@ endfunction "FUNCTION: s:activateFileNode() {{{1 "handle the user activating a tree node function! s:activateFileNode(node) abort - call a:node.activate({'reuse': 'all', 'where': 'p'}) + call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()}) endfunction "FUNCTION: s:activateBookmark(bookmark) {{{1 "handle the user activating a bookmark function! s:activateBookmark(bm) abort - call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {}) + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) endfunction " FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 @@ -366,7 +373,7 @@ function! s:handleLeftClick() abort if currentNode.path.isDirectory call currentNode.activate() else - call currentNode.activate({'reuse': 'all', 'where': 'p'}) + call currentNode.activate({'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}) endif return endif @@ -500,31 +507,32 @@ function! nerdtree#ui_glue#openBookmark(name) abort endtry if l:bookmark.path.isDirectory call l:bookmark.open(b:NERDTree) - else - call l:bookmark.open(b:NERDTree, {'where': 'p'}) + return endif + + call l:bookmark.open(b:NERDTree, s:initCustomOpenArgs().file) endfunction " FUNCTION: s:openHSplit(target) {{{1 function! s:openHSplit(target) abort - call a:target.activate({'where': 'h'}) + call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()}) endfunction " FUNCTION: s:openVSplit(target) {{{1 function! s:openVSplit(target) abort - call a:target.activate({'where': 'v'}) + call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()}) endfunction "FUNCTION: s:openHSplitBookmark(bookmark) {{{1 "handle the user activating a bookmark function! s:openHSplitBookmark(bm) abort - call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {}) + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) endfunction "FUNCTION: s:openVSplitBookmark(bookmark) {{{1 "handle the user activating a bookmark function! s:openVSplitBookmark(bm) abort - call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {}) + call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) endfunction " FUNCTION: s:previewHSplitBookmark(bookmark) {{{1 @@ -544,13 +552,13 @@ endfunction " FUNCTION: s:openInNewTab(target) {{{1 function! s:openInNewTab(target) abort - let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'}) + let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen()}) call l:opener.open(a:target) endfunction " FUNCTION: s:openInNewTabSilent(target) {{{1 function! s:openInNewTabSilent(target) abort - let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1}) + let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen(), 'stay': 1}) call l:opener.open(a:target) endfunction @@ -564,7 +572,11 @@ endfunction " FUNCTION: s:previewBookmark(bookmark) {{{1 function! s:previewBookmark(bookmark) abort - call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {}) + if a:bookmark.path.isDirectory + execute 'NERDTreeFind '.a:bookmark.path.str() + else + call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1}) + endif endfunction "FUNCTION: s:previewNodeCurrent(node) {{{1 @@ -589,7 +601,7 @@ function! nerdtree#ui_glue#revealBookmark(name) abort let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree) call targetNode.putCursorHere(0, 1) catch /^NERDTree.BookmarkNotFoundError/ - call nerdtree#echo('Bookmark isnt cached under the current root') + call nerdtree#echo('Bookmark isn''t cached under the current root') endtry endfunction diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 2989718c..4e75ad13 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -116,7 +116,7 @@ The following features and functionality are provided by the NERDTree: :NERDTreeVCS (opens root of repository containing CWD) < :NERDTreeFromBookmark *:NERDTreeFromBookmark* - Opens a fresh NERDTree with the root initialized to the dir for + Opens a fresh NERDTree with the root initialized to the directory for . The only reason to use this command over :NERDTree is for the completion (which is for bookmarks rather than directories). @@ -126,7 +126,7 @@ The following features and functionality are provided by the NERDTree: is set to that path. If no NERDTree exists for this tab then this command acts the same as the |:NERDTree| command. -:NERDTreeToggleVCS [ | ] *:NERDTreeToggleVCS* +:NERDTreeToggleVCS [ | ] *:NERDTreeToggleVCS* Like |:NERDTreeToggle|, but searches up the directory tree to find the top of the version control system repository, and roots the NERDTree there. It works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A @@ -249,7 +249,7 @@ Key Description help-tag~ o........Open files, directories and bookmarks......................|NERDTree-o| go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go| - Open selected bookmark dir in current NERDTree + Find selected bookmark directory in current NERDTree 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| @@ -260,10 +260,10 @@ 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| +e........Edit the current directory.................................|NERDTree-e| double-click....same as |NERDTree-o|. -middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs. +middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for directories. D........Delete the current bookmark ...............................|NERDTree-D| @@ -274,13 +274,13 @@ 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| +C........Change the tree root to the selected directory.............|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 NERDTree menu..................................|NERDTree-m| -cd.......Change the CWD to the dir of the selected node............|NERDTree-cd| +cd.......Change the CWD to the directory of the selected node......|NERDTree-cd| CD.......Change tree root to the CWD...............................|NERDTree-CD| I........Toggle whether hidden files displayed......................|NERDTree-I| @@ -469,7 +469,7 @@ Jump to the first child of the current nodes parent. If the cursor is already on the first node then do the following: * loop back thru the siblings of the current nodes parent until we find an - open dir with children + open directory with children * go to the first child of that node ------------------------------------------------------------------------------ @@ -482,7 +482,7 @@ Jump to the last child of the current nodes parent. If the cursor is already on the last node then do the following: * loop forward thru the siblings of the current nodes parent until we find - an open dir with children + an open directory with children * go to the last child of that node ------------------------------------------------------------------------------ @@ -516,7 +516,7 @@ Default key: u Map setting: *NERDTreeMapUpdir* Applies to: no restrictions. -Move the tree root up a dir (like doing a "cd .."). +Move the tree root up a directory (like doing a "cd .."). ------------------------------------------------------------------------------ *NERDTree-U* @@ -532,8 +532,8 @@ Default key: r Map setting: *NERDTreeMapRefresh* Applies to: files and directories. -If a dir is selected, recursively refresh that dir, i.e. scan the filesystem -for changes and represent them in the tree. +If a directory is selected, recursively refresh that directory, i.e. scan the +filesystem for changes and represent them in the tree. If a file node is selected then the above is done on it's parent. @@ -634,8 +634,8 @@ file explorers have. The script comes with two default menu plugins: exec_menuitem.vim and fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for -creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a -menu item to execute executable files. +creating/deleting/moving/copying files and directories. exec_menuitem.vim +provides a menu item to execute executable files. Related tags: |NERDTree-m| |NERDTreeApi| @@ -921,7 +921,7 @@ Default: ['\~$']. This setting is used to specify which files the NERDTree should ignore. It must be a list of regular expressions. When the NERDTree is rendered, any -files/dirs that match any of the regex's in NERDTreeIgnore won't be +files/directories that match any of the regex's in NERDTreeIgnore won't be displayed. For example if you put the following line in your vimrc: > @@ -929,13 +929,18 @@ For example if you put the following line in your vimrc: > < then all files ending in .vim or ~ will be ignored. -There are 2 magic flags that can be appended to the end of each regular -expression to specify that the regex should match only files or only dirs. -These flags are "[[dir]]" and "[[file]]". Example: > - let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]'] +There are 3 magic flags that can be appended to the end of each regular +expression to specify that the regex should match only filenames, only lowest +level directories, or a full path. These flags are "[[dir]]", "[[file]]", and +"[[path]]". Example: > + let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]', 'tmp/cache$[[path]]'] < -This will cause all dirs ending in ".d" to be ignored and all files ending in -".o" to be ignored. +This will cause all directories ending in ".d" to be ignored, all files ending +in ".o" to be ignored, and the "cache" subdirectory of any "tmp" directory to +be ignored. All other "cache" directories will be displayed. + +When using the "[[path]]" tag on Windows, make sure you use escaped +backslashes for the separators in the regex, eg. 'Temp\\cache$[[path]]' Note: to tell the NERDTree not to ignore any files you must use the following line: > @@ -1099,8 +1104,8 @@ Examples: > < 1. Directories will appear last, everything else will appear above. 2. Everything will simply appear in alphabetical order. -3. Dirs will appear first, then ruby and php. Swap files, bak files and vim - backup files will appear last with everything else preceding them. +3. Directories will appear first, then ruby and php. Swap files, bak files + and vim backup files will appear last with everything else preceding them. 4. Everything is sorted by size, largest to smallest, with directories considered to have size 0 bytes. 5. Directories will appear first alphabetically, followed by files, sorted by @@ -1174,8 +1179,9 @@ Use one of the following lines for this setting: > Values: 0 or 1 Default: 1. -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: > +When displaying directory nodes, this setting tells NERDTree to collapse +directories that have only one child. Use one of the following lines for this +setting: > let NERDTreeCascadeSingleChildDir=0 let NERDTreeCascadeSingleChildDir=1 < @@ -1184,11 +1190,12 @@ have only one child. Use one of the following lines for this setting: > Values: 0 or 1 Default: 1. -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 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: > +When opening directory nodes, this setting tells NERDTree to recursively open +directories that have only one child which is also a directory. NERDTree will +stop when it finds a directory that contains anything but another single +directory. This setting also causes the |NERDTree-x| mapping to close +directories 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 < @@ -1362,8 +1369,8 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* < This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim. It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of - the current dir node. Note this mapping will only fire when the cursor is - on a directory node. + the current directory node. Note this mapping will only fire when the + cursor is on a directory node. ------------------------------------------------------------------------------ 4.2. Menu API *NERDTreeMenuAPI* diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index 248bb074..37be451c 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -256,7 +256,7 @@ endfunction function! s:Bookmark.open(nerdtree, ...) let opts = a:0 ? a:1 : {} - if nerdtree#and(g:NERDTreeQuitOnOpen,2) + if nerdtree#closeBookmarksOnOpen() call a:nerdtree.ui.toggleShowBookmarks() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim index f3268c26..ed791677 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim @@ -51,7 +51,7 @@ function! s:KeyMap.bind() else let keymapInvokeString = self.key endif - let keymapInvokeString = escape(keymapInvokeString, '\') + let keymapInvokeString = escape(keymapInvokeString, '\"') let premap = self.key ==# '' ? ' ' : ' ' @@ -66,11 +66,11 @@ endfunction "FUNCTION: KeyMap.invoke() {{{1 "Call the KeyMaps callback function function! s:KeyMap.invoke(...) - let Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback) + let l:Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback) if a:0 - call Callback(a:1) + call l:Callback(a:1) else - call Callback() + call l:Callback() endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim index db9e2b55..61a11a96 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -65,14 +65,6 @@ function! s:NERDTree.Close() endif endfunction -"FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1 -"Closes the NERD tree window if the close on open option is set -function! s:NERDTree.CloseIfQuitOnOpen() - if nerdtree#and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen() - call s:NERDTree.Close() - endif -endfunction - "FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1 "Places the cursor at the top of the bookmarks table function! s:NERDTree.CursorToBookmarkTable() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim index fc3155d7..ffa2853a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -15,8 +15,8 @@ function! s:Notifier.NotifyListeners(event, path, nerdtree, params) let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params) for Listener in s:Notifier.GetListenersForEvent(a:event) - let Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener) - call Callback(event) + let l:Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener) + call l:Callback(event) endfor endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index 9c62b723..27993ac7 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -33,8 +33,7 @@ function! s:Opener._bufInWindows(bnum) endfunction " FUNCTION: Opener._checkToCloseTree(newtab) {{{1 -" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see -" if the tree should be closed now. +" Check the class options to see if the tree should be closed now. " " Args: " a:newtab - boolean. If set, only close the tree now if we are opening the @@ -46,7 +45,7 @@ function! s:Opener._checkToCloseTree(newtab) endif if (a:newtab && self._where ==# 't') || !a:newtab - call g:NERDTree.CloseIfQuitOnOpen() + call g:NERDTree.Close() endif endfunction @@ -218,7 +217,7 @@ endfunction " FUNCTION: Opener._openFile() {{{1 function! s:Opener._openFile() - if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed + if !self._stay && self._keepopen && get(b:, 'NERDTreeZoomed', 0) call b:NERDTree.ui.toggleZoom() endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 786ccd90..997abf37 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -394,7 +394,7 @@ function! s:Path.getSortKey() let self._sortKey = [self.getSortOrderIndex()] + metadata endif - let path = self.getLastPathComponent(1) + let path = self.getLastPathComponent(0) if !g:NERDTreeSortHiddenFirst let path = substitute(path, '^[._]', '', '') endif @@ -459,10 +459,10 @@ function! s:Path.ignore(nerdtree) endif endfor - for Callback in g:NERDTree.PathFilters() - let Callback = type(Callback) ==# type(function('tr')) ? Callback : function(Callback) - if Callback({'path': self, 'nerdtree': a:nerdtree}) - return 1 + for l:Callback in g:NERDTree.PathFilters() + let l:Callback = type(l:Callback) ==# type(function('tr')) ? l:Callback : function(l:Callback) + if l:Callback({'path': self, 'nerdtree': a:nerdtree}) + return 1 endif endfor endif @@ -483,7 +483,10 @@ endfunction " returns true if this path matches the given ignore pattern function! s:Path._ignorePatternMatches(pattern) let pat = a:pattern - if strpart(pat,len(pat)-7) ==# '[[dir]]' + if strpart(pat,len(pat)-8) ==# '[[path]]' + let pat = strpart(pat,0, len(pat)-8) + return self.str() =~# pat + elseif strpart(pat,len(pat)-7) ==# '[[dir]]' if !self.isDirectory return 0 endif diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index b3ef42e7..09cb69b5 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -49,6 +49,10 @@ else call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'}) endif +if exists('*system') + call NERDTreeAddMenuItem({'text': 'Run (s)ystem command in this directory', 'shortcut':'s', 'callback': 'NERDTreeSystemCommand'}) +endif + "FUNCTION: s:inputPrompt(action){{{1 "returns the string that should be prompted to the user for the given action " @@ -460,4 +464,21 @@ function! NERDTreeExecuteFileWindows() call system('cmd.exe /c start "" ' . shellescape(l:node.path.str())) endfunction +" FUNCTION: NERDTreeSystemCommand() {{{1 +function! NERDTreeSystemCommand() + let l:node = g:NERDTreeFileNode.GetSelected() + + if empty(l:node) + return + endif + + let l:cwd = getcwd() + let l:directory = l:node.path.isDirectory ? l:node.path.str() : l:node.parent.path.str() + execute 'cd '.l:directory + + let l:nl = nr2char(10) + echo l:nl . system(input(l:directory . (nerdtree#runningWindows() ? '> ' : ' $ '))) + execute 'cd '.l:cwd +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nginx.vim/syntax/nginx.vim b/sources_non_forked/nginx.vim/syntax/nginx.vim index 9d3b92e2..18dd50cb 100644 --- a/sources_non_forked/nginx.vim/syntax/nginx.vim +++ b/sources_non_forked/nginx.vim/syntax/nginx.vim @@ -2276,7 +2276,6 @@ hi link ngxComment Comment hi link ngxVariable Identifier hi link ngxVariableBlock Identifier hi link ngxVariableString PreProc -hi link ngxBlock Normal hi link ngxString String hi link ngxIPaddr Delimiter hi link ngxBoolean Boolean diff --git a/sources_non_forked/rust.vim/ftplugin/rust.vim b/sources_non_forked/rust.vim/ftplugin/rust.vim index ce48116e..fb048cac 100644 --- a/sources_non_forked/rust.vim/ftplugin/rust.vim +++ b/sources_non_forked/rust.vim/ftplugin/rust.vim @@ -47,7 +47,7 @@ setlocal smartindent nocindent if get(g:, 'rust_recommended_style', 1) let b:rust_set_style = 1 - setlocal tabstop=8 shiftwidth=4 softtabstop=4 expandtab + setlocal shiftwidth=4 softtabstop=4 expandtab setlocal textwidth=99 endif diff --git a/sources_non_forked/typescript-vim/README.md b/sources_non_forked/typescript-vim/README.md index c4873812..a8809983 100644 --- a/sources_non_forked/typescript-vim/README.md +++ b/sources_non_forked/typescript-vim/README.md @@ -3,7 +3,7 @@ Typescript Syntax for Vim Syntax file and other settings for [TypeScript](http://typescriptlang.org). The syntax file is taken from this [blog -post](http://blogs.msdn.com/b/interoperability/archive/2012/10/01/sublime-text-vi-emacs-typescript-enabled.aspx). +post](https://docs.microsoft.com/en-us/archive/blogs/interoperability/sublime-text-vi-emacs-typescript-enabled). Checkout [Tsuquyomi](https://github.com/Quramy/tsuquyomi) for omni-completion and other features for TypeScript editing. diff --git a/sources_non_forked/typescript-vim/compiler/typescriptreact.vim b/sources_non_forked/typescript-vim/compiler/typescriptreact.vim new file mode 100644 index 00000000..0f734095 --- /dev/null +++ b/sources_non_forked/typescript-vim/compiler/typescriptreact.vim @@ -0,0 +1 @@ +runtime! compiler/typescript.vim diff --git a/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim b/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim new file mode 100644 index 00000000..c23ec132 --- /dev/null +++ b/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +runtime! ftplugin/typescript.vim diff --git a/sources_non_forked/typescript-vim/indent/typescriptreact.vim b/sources_non_forked/typescript-vim/indent/typescriptreact.vim new file mode 100644 index 00000000..36f89ae2 --- /dev/null +++ b/sources_non_forked/typescript-vim/indent/typescriptreact.vim @@ -0,0 +1 @@ +runtime! indent/typescript.vim diff --git a/sources_non_forked/typescript-vim/syntax/typescriptreact.vim b/sources_non_forked/typescript-vim/syntax/typescriptreact.vim new file mode 100644 index 00000000..8fc4480f --- /dev/null +++ b/sources_non_forked/typescript-vim/syntax/typescriptreact.vim @@ -0,0 +1 @@ +runtime! syntax/typescript.vim diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim index 6fd332d0..4be1122d 100644 --- a/sources_non_forked/vim-abolish/plugin/abolish.vim +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -284,7 +284,7 @@ function! s:parse_subvert(bang,line1,line2,count,args) else let args = a:args endif - let separator = matchstr(args,'^.') + let separator = '\v((\\)@' diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim index 17c285b7..7dfc96c4 100644 --- a/sources_non_forked/vim-commentary/plugin/commentary.vim +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -50,6 +50,7 @@ function! s:go(...) abort let indent = '^\s*' endif + let lines = [] for lnum in range(lnum1,lnum2) let line = getline(lnum) if strlen(r) > 2 && l.r !~# '\\' @@ -62,8 +63,9 @@ function! s:go(...) abort else let line = substitute(line,'^\%('.matchstr(getline(lnum1),indent).'\|\s*\)\zs.*\S\@<=','\=l.submatch(0).r','') endif - call setline(lnum,line) + call add(lines, line) endfor + call setline(lnum1, lines) let modelines = &modelines try set modelines=0 diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index 180bcadb..15d061ef 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -273,6 +273,10 @@ function! s:ShowErrorMessage() " {{{ if !exists('s:resultDict') return endif + if !exists('b:showing_message') + " ensure showing msg is always defined + let b:showing_message = ' ' + endif " if there is a message on the current line, " then echo it @@ -295,4 +299,3 @@ endfunction " }}} let &cpo = s:save_cpo unlet s:save_cpo - diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 4a5b1083..10d2f708 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -82,8 +82,23 @@ function! s:throw(string) abort throw 'fugitive: '.a:string endfunction +function! s:VersionCheck() abort + if v:version < 704 + return 'return ' . string('echoerr "fugitive: Vim 7.4 or newer required"') + elseif empty(fugitive#GitVersion()) + return 'return ' . string('echoerr "fugitive: cannot execute Git"') + elseif !fugitive#GitVersion(1, 8, 5) + return 'return ' . string('echoerr "fugitive: Git 1.8.5 or newer required"') + else + return '' + endif +endfunction + function! s:DirCheck(...) abort - if !empty(a:0 ? s:Dir(a:1) : s:Dir()) + let vcheck = s:VersionCheck() + if !empty(vcheck) + return vcheck + elseif !empty(a:0 ? s:Dir(a:1) : s:Dir()) return '' elseif empty(bufname('')) return 'return ' . string('echoerr "fugitive: working directory does not belong to a Git repository"') @@ -101,13 +116,15 @@ function! s:Mods(mods, ...) abort return substitute(mods, '\s\+', ' ', 'g') endfunction -function! s:Slash(path) abort - if exists('+shellslash') +if exists('+shellslash') + function! s:Slash(path) abort return tr(a:path, '\', '/') - else + endfunction +else + function! s:Slash(path) abort return a:path - endif -endfunction + endfunction +endif function! s:Resolve(path) abort let path = resolve(a:path) @@ -197,9 +214,34 @@ function! s:Map(mode, lhs, rhs, ...) abort endfor endfunction +function! fugitive#Autowrite() abort + if &autowrite || &autowriteall + try + if &confirm + let reconfirm = 1 + setglobal noconfirm + endif + silent! wall + finally + if exists('reconfirm') + setglobal confirm + endif + endtry + endif + return '' +endfunction + " Section: Git +function! s:UserCommandCwd(dir) abort + let tree = s:Tree(a:dir) + return len(tree) ? FugitiveVimPath(tree) : getcwd() +endfunction + function! s:UserCommandList(...) abort + if !fugitive#GitVersion(1, 8, 5) + throw 'fugitive: Git 1.8.5 or higher required' + endif let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+') let flags = [] if a:0 && type(a:1) == type({}) @@ -216,11 +258,7 @@ function! s:UserCommandList(...) abort if empty(tree) call add(git, '--git-dir=' . FugitiveGitPath(dir)) elseif len(tree) && s:cpath(tree) !=# s:cpath(getcwd()) - if fugitive#GitVersion(1, 8, 5) - call extend(git, ['-C', FugitiveGitPath(tree)]) - else - throw 'fugitive: Git 1.8.5 or higher required to change directory' - endif + call extend(git, ['-C', FugitiveGitPath(tree)]) endif endif return git + flags @@ -233,7 +271,7 @@ endfunction let s:git_versions = {} function! fugitive#GitVersion(...) abort if !has_key(s:git_versions, g:fugitive_git_executable) - let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), '\d[^[:space:]]\+') + let s:git_versions[g:fugitive_git_executable] = matchstr(s:SystemError(g:fugitive_git_executable.' --version')[0], '\d[^[:space:]]\+') endif if !a:0 return s:git_versions[g:fugitive_git_executable] @@ -299,8 +337,7 @@ function! s:HasOpt(args, ...) abort endfunction function! s:PreparePathArgs(cmd, dir, literal) abort - let literal_supported = fugitive#GitVersion(1, 9) - if a:literal && literal_supported + if a:literal call insert(a:cmd, '--literal-pathspecs') endif let split = index(a:cmd, '--') @@ -317,8 +354,6 @@ function! s:PreparePathArgs(cmd, dir, literal) abort let a:cmd[i] = fugitive#Path(bufname(a:cmd[i]), './', a:dir) elseif a:literal let a:cmd[i] = fugitive#Path(a:cmd[i], './', a:dir) - elseif !literal_supported - let a:cmd[i] = substitute(a:cmd[i], '^:\%(/\|([^)]*)\)\=:\=', './', '') endif endfor return a:cmd @@ -329,7 +364,11 @@ let s:prepare_env = { \ 'core.editor': 'GIT_EDITOR', \ 'core.askpass': 'GIT_ASKPASS', \ } -function! fugitive#PrepareDirEnvArgv(...) abort +function! fugitive#PrepareDirEnvGitArgv(...) abort + if !fugitive#GitVersion(1, 8, 5) + throw 'fugitive: Git 1.8.5 or higher required' + endif + let git = split(g:fugitive_git_executable) if a:0 && type(a:1) ==# type([]) let cmd = a:000[1:-1] + a:1 else @@ -338,7 +377,15 @@ function! fugitive#PrepareDirEnvArgv(...) abort let env = {} let i = 0 while i < len(cmd) - if cmd[i] =~# '^$\|[\/.]' && cmd[i] !~# '^-' + if type(cmd[i]) == type({}) + if has_key(cmd[i], 'dir') + let dir = cmd[i].dir + endif + if has_key(cmd[i], 'git') + let git = cmd[i].git + endif + call remove(cmd, i) + elseif cmd[i] =~# '^$\|[\/.]' && cmd[i] !~# '^-' let dir = remove(cmd, i) elseif cmd[i] =~# '^--git-dir=' let dir = remove(cmd, i)[10:-1] @@ -351,18 +398,14 @@ function! fugitive#PrepareDirEnvArgv(...) abort let val = matchstr(cmd[i+1], '=\zs.*') let env[var] = val endif - if fugitive#GitVersion(1, 8) && cmd[i+1] =~# '\.' + if cmd[i+1] =~# '\.' let i += 2 else call remove(cmd, i, i + 1) endif elseif cmd[i] =~# '^--.*pathspecs$' let explicit_pathspec_option = 1 - if fugitive#GitVersion(1, 9) - let i += 1 - else - call remove(cmd, i) - endif + let i += 1 elseif cmd[i] !~# '^-' break else @@ -373,7 +416,7 @@ function! fugitive#PrepareDirEnvArgv(...) abort let dir = s:Dir() endif call s:PreparePathArgs(cmd, dir, !exists('explicit_pathspec_option')) - return [dir, env, cmd] + return [dir, env, git, cmd] endfunction function! s:BuildEnvPrefix(env) abort @@ -393,7 +436,7 @@ endfunction function! s:JobOpts(cmd, env) abort if empty(a:env) return [a:cmd, {}] - elseif has('patch-8.2.0239') || has('patch-8.1.0902') && !has('nvim') && (!has('win32') || empty(filter(keys(a:env), 'exists("$" . v:val)'))) + elseif has('patch-8.2.0239') || has('nvim-0.5.1') || has('patch-8.1.0902') && !has('nvim') && (!has('win32') || empty(filter(keys(a:env), 'exists("$" . v:val)'))) return [a:cmd, {'env': a:env}] endif let envlist = map(items(a:env), 'join(v:val, "=")') @@ -409,23 +452,21 @@ function! s:JobOpts(cmd, env) abort endif endfunction -function! s:BuildShell(dir, env, args) abort +function! s:BuildShell(dir, env, git, args) abort let cmd = copy(a:args) let tree = s:Tree(a:dir) let pre = s:BuildEnvPrefix(a:env) if empty(tree) || index(cmd, '--') == len(cmd) - 1 call insert(cmd, '--git-dir=' . FugitiveGitPath(a:dir)) - elseif fugitive#GitVersion(1, 8, 5) - call extend(cmd, ['-C', FugitiveGitPath(tree)], 'keep') else - let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? '& ' : '; ') . pre + call extend(cmd, ['-C', FugitiveGitPath(tree)], 'keep') endif - return pre . g:fugitive_git_executable . ' ' . join(map(cmd, 's:shellesc(v:val)')) + return pre . join(map(a:git + cmd, 's:shellesc(v:val)')) endfunction function! fugitive#Prepare(...) abort - let [dir, env, argv] = call('fugitive#PrepareDirEnvArgv', a:000) - return s:BuildShell(dir, env, argv) + let [dir, env, git, argv] = call('fugitive#PrepareDirEnvGitArgv', a:000) + return s:BuildShell(dir, env, git, argv) endfunction function! s:SystemError(cmd, ...) abort @@ -438,6 +479,10 @@ function! s:SystemError(cmd, ...) abort set shellredir=>%s\ 2>&1 endif endif + if exists('+guioptions') && &guioptions =~# '!' + let guioptions = &guioptions + set guioptions-=! + endif let out = call('system', [type(a:cmd) ==# type([]) ? fugitive#Prepare(a:cmd) : a:cmd] + a:000) return [out, v:shell_error] catch /^Vim\%((\a\+)\)\=:E484:/ @@ -449,6 +494,9 @@ function! s:SystemError(cmd, ...) abort if exists('shellredir') let &shellredir = shellredir endif + if exists('guioptions') + let &guioptions = guioptions + endif endtry endfunction @@ -591,13 +639,67 @@ function! s:Remote(dir) abort return remote =~# '^\.\=$' ? 'origin' : remote endfunction +unlet! s:ssh_aliases +function! fugitive#SshHostAlias(...) abort + if !exists('s:ssh_aliases') + let s:ssh_aliases = {} + if filereadable(expand('~/.ssh/config')) + let hosts = [] + for line in readfile(expand('~/.ssh/config')) + let key = matchstr(line, '^\s*\zs\w\+\ze\s') + let value = matchstr(line, '^\s*\w\+\s\+\zs.*\S') + if key ==? 'host' + let hosts = split(value, '\s\+') + elseif key ==? 'hostname' + for host in hosts + if !has_key(s:ssh_aliases, host) + let s:ssh_aliases[host] = tolower(value) + endif + endfor + endif + endfor + endif + endif + if a:0 + return get(s:ssh_aliases, a:1, a:1) + else + return s:ssh_aliases + endif +endfunction + +let s:redirects = {} + +function! fugitive#ResolveRemote(remote) abort + if a:remote =~# '^https\=://' && s:executable('curl') + if !has_key(s:redirects, a:remote) + let s:redirects[a:remote] = matchstr(s:SystemError( + \ 'curl --disable --silent --max-time 5 -I ' . + \ s:shellesc(a:remote . '/info/refs?service=git-upload-pack'))[0], + \ 'Location: \zs\S\+\ze/info/refs?') + endif + if len(s:redirects[a:remote]) + return s:redirects[a:remote] + endif + endif + return substitute(a:remote, + \ '^ssh://\%([^@:/]\+@\)\=\zs[^/:]\+\|^\%([^@:/]\+@\)\=\zs[^/:]\+\ze:/\@!', + \ '\=fugitive#SshHostAlias(submatch(0))', '') +endfunction + function! fugitive#RemoteUrl(...) abort let dir = a:0 > 1 ? a:2 : s:Dir() - let remote = !a:0 || a:1 =~# '^\.\=$' ? s:Remote(dir) : a:1 - if !fugitive#GitVersion(2, 7) - return fugitive#Config('remote.' . remote . '.url') + let url = !a:0 || a:1 =~# '^\.\=$' ? s:Remote(dir) : a:1 + if url !~# ':\|^/\|^\.\.\=/' + if !fugitive#GitVersion(2, 7) + let url = FugitiveConfigGet('remote.' . url . '.url') + else + let url = s:ChompDefault('', [dir, 'remote', 'get-url', url, '--']) + endif endif - return s:ChompDefault('', [dir, 'remote', 'get-url', remote, '--']) + if !get(a:, 3, 0) + let url = fugitive#ResolveRemote(url) + endif + return url endfunction " Section: Quickfix @@ -626,7 +728,8 @@ function! s:QuickfixCreate(nr, opts) abort endif endfunction -function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort +function! s:QuickfixStream(nr, event, title, cmd, first, mods, callback, ...) abort + let mods = s:Mods(a:mods) let opts = {'title': a:title, 'context': {'items': []}} call s:QuickfixCreate(a:nr, opts) let event = (a:nr < 0 ? 'c' : 'l') . 'fugitive-' . a:event @@ -647,7 +750,9 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort call extend(opts.context.items, contexts) unlet contexts call s:QuickfixSet(a:nr, remove(buffer, 0, -1), 'a') - redraw + if mods !~# '\' + redraw + endif endif endfor call extend(buffer, call(a:callback, a:000 + [0])) @@ -658,20 +763,12 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort silent exe s:DoAutocmd('QuickFixCmdPost ' . event) if a:first && len(s:QuickfixGet(a:nr)) call s:BlurStatus() - return a:nr < 0 ? 'cfirst' : 'lfirst' + return mods . (a:nr < 0 ? 'cfirst' : 'lfirst') else return 'exe' endif endfunction -let s:common_efm = '' - \ . '%+Egit:%.%#,' - \ . '%+Eusage:%.%#,' - \ . '%+Eerror:%.%#,' - \ . '%+Efatal:%.%#,' - \ . '%-G%.%#%\e[K%.%#,' - \ . '%-G%.%#%\r%.%\+' - function! fugitive#Cwindow() abort if &buftype == 'quickfix' cwindow @@ -821,16 +918,16 @@ function! s:Owner(path, ...) abort if commit =~# '^\x\{40,\}$' return commit elseif commit ==# '2' - return 'HEAD^{}' + return '@' elseif commit ==# '0' return '' endif - let merge_head = s:MergeHead() + let merge_head = s:MergeHead(dir) if empty(merge_head) return '' endif if commit ==# '3' - return merge_head . '^{}' + return merge_head elseif commit ==# '1' return s:TreeChomp('merge-base', 'HEAD', merge_head, '--') endif @@ -890,8 +987,8 @@ function! fugitive#Path(url, ...) abort endif let url = a:url let temp_state = s:TempState(url) - if has_key(temp_state, 'bufnr') - let url = bufname(temp_state.bufnr) + if has_key(temp_state, 'origin_bufnr') + let url = bufname(temp_state.origin_bufnr) endif let url = s:Slash(fnamemodify(url, ':p')) if url =~# '/$' && s:Slash(a:url) !~# '/$' @@ -925,20 +1022,21 @@ function! fugitive#Find(object, ...) abort let prefix = matchstr(a:object, '^[~$]\i*') let owner = expand(prefix) return FugitiveVimPath((len(owner) ? owner : prefix) . strpart(a:object, len(prefix))) - elseif s:Slash(a:object) =~# '^$\|^/\|^\%(\a\a\+:\).*\%(//\|::\)' . (has('win32') ? '\|^\a:/' : '') + endif + let rev = s:Slash(a:object) + if rev =~# '^$\|^/\|^\%(\a\a\+:\).*\%(//\|::\)' . (has('win32') ? '\|^\a:/' : '') return FugitiveVimPath(a:object) - elseif s:Slash(a:object) =~# '^\.\.\=\%(/\|$\)' + elseif rev =~# '^\.\.\=\%(/\|$\)' return FugitiveVimPath(simplify(getcwd() . '/' . a:object)) endif let dir = a:0 ? a:1 : s:Dir() if empty(dir) - let file = matchstr(a:object, '^\%(:\d:\|[^:]*:\)\zs.*', '', '') + let file = matchstr(a:object, '^\%(:\d:\|[^:]*:\)\zs\%(\.\.\=$\|\.\.\=/.*\|/.*\|\w:/.*\)') let dir = FugitiveExtractGitDir(file) if empty(dir) - return fnamemodify(FugitiveVimPath(len(file) ? file : a:object), ':p') + return '' endif endif - let rev = s:Slash(a:object) let tree = s:Tree(dir) let base = len(tree) ? tree : 'fugitive://' . dir . '//0' if rev ==# '.git' @@ -959,7 +1057,7 @@ function! fugitive#Find(object, ...) abort let f = simplify(dir . f) endif elseif rev ==# ':/' - let f = base + let f = tree elseif rev =~# '^\.\%(/\|$\)' let f = base . rev[1:-1] elseif rev =~# '^::\%(/\|\a\+\:\)' @@ -997,7 +1095,7 @@ function! fugitive#Find(object, ...) abort let f = 'fugitive://' . dir . '//0/' . rev[1:-1] else if !exists('f') - let commit = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\|^:.*'), '^@\%($\|[~^]\|@{\)\@=', 'HEAD', '') + let commit = matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\|^:.*') let file = substitute(matchstr(rev, '^\%([^:.-]\|\.\.[^/:]\)[^:]*\zs:.*'), '^:', '/', '') if file =~# '^/\.\.\=\%(/\|$\)\|^//\|^/\a\+:' let file = file =~# '^/\.' ? simplify(getcwd() . file) : file[1:-1] @@ -1013,11 +1111,14 @@ function! fugitive#Find(object, ...) abort endif let commits = split(commit, '\.\.\.-\@!', 1) if len(commits) == 2 - call map(commits, 'empty(v:val) || v:val ==# "@" ? "HEAD" : v:val') + call map(commits, 'empty(v:val) ? "@" : v:val') let commit = matchstr(s:ChompDefault('', [dir, 'merge-base'] + commits + ['--']), '\<[0-9a-f]\{40,\}\>') endif - if commit !~# '^[0-9a-f]\{40,\}$' + if commit !~# '^[0-9a-f]\{40,\}$\|^$' let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit . (len(file) ? '^{}' : ''), '--']), '\<[0-9a-f]\{40,\}\>') + if empty(commit) && len(file) + let commit = repeat('0', 40) + endif endif if len(commit) let f = 'fugitive://' . dir . '//' . commit . file @@ -1029,8 +1130,16 @@ function! fugitive#Find(object, ...) abort return FugitiveVimPath(f) endfunction -function! s:Generate(rev, ...) abort - return fugitive#Find(a:rev, a:0 ? a:1 : s:Dir()) +function! s:Generate(object, ...) abort + let dir = a:0 ? a:1 : s:Dir() + let f = fugitive#Find(a:object, dir) + if !empty(f) + return f + elseif a:object ==# ':/' + return len(dir) ? FugitiveVimPath('fugitive://' . dir . '//0') : '.' + endif + let file = matchstr(a:object, '^\%(:\d:\|[^:]*:\)\zs.*') + return fnamemodify(FugitiveVimPath(len(file) ? file : a:object), ':p') endfunction function! s:DotRelative(path, ...) abort @@ -1049,7 +1158,7 @@ function! fugitive#Object(...) abort let rev = '' endif let tree = s:Tree(dir) - let full = a:0 ? a:1 : @% + let full = a:0 ? a:1 : s:BufName('%') let full = fnamemodify(full, ':p' . (s:Slash(full) =~# '/$' ? '' : ':s?/$??')) if empty(rev) && empty(tree) return FugitiveGitPath(full) @@ -1066,15 +1175,15 @@ function! fugitive#Object(...) abort endif endfunction -let s:var = '\%(%\|#<\=\d\+\|##\=\)' +let s:var = '\%(<\%(cword\|cWORD\|cexpr\|cfile\|sfile\|slnum\|afile\|abuf\|amatch' . (has('clientserver') ? '\|client' : '') . '\)>\|%\|#<\=\d\+\|##\=\)' let s:flag = '\%(:[p8~.htre]\|:g\=s\(.\).\{-\}\1.\{-\}\1\)' let s:expand = '\%(\(' . s:var . '\)\(' . s:flag . '*\)\(:S\)\=\)' function! s:BufName(var) abort if a:var ==# '%' - return bufname(get(s:TempState(), 'bufnr', '')) + return bufname(get(s:TempState(), 'origin_bufnr', '')) elseif a:var =~# '^#\d*$' - let nr = get(s:TempState(bufname(+a:var[1:-1])), 'bufnr', '') + let nr = get(s:TempState(bufname(+a:var[1:-1])), 'origin_bufnr', '') return bufname(nr ? nr : +a:var[1:-1]) else return expand(a:var) @@ -1101,19 +1210,44 @@ function! s:ExpandVar(other, var, flags, esc, ...) abort let buffer = s:BufName(len(a:other) > 1 ? '#'. a:other[1:-1] : '%') let owner = s:Owner(buffer) return len(owner) ? owner : '@' + elseif a:var ==# '' + let bufname = expand('') + if v:version >= 704 && get(maparg('', 'c', 0, 1), 'expr') + try + let bufname = eval(maparg('', 'c')) + if bufname ==# "\\" + let bufname = expand('') + endif + catch + endtry + endif + elseif a:var =~# '^<' + let bufname = s:BufName(a:var) + else + let bufname = fugitive#Real(s:BufName(a:var)) endif let flags = a:flags - let file = s:DotRelative(fugitive#Real(s:BufName(a:var)), cwd) + let file = s:DotRelative(bufname, cwd) while len(flags) let flag = matchstr(flags, s:flag) let flags = strpart(flags, len(flag)) if flag ==# ':.' - let file = s:DotRelative(file, cwd) + let file = s:DotRelative(fugitive#Real(file), cwd) else let file = fnamemodify(file, flag) endif endwhile let file = s:Slash(file) + if file =~# '^fugitive://' + let [dir, commit, file_candidate] = s:DirCommitFile(file) + let tree = s:Tree(dir) + if len(tree) && len(file_candidate) + let file = (commit =~# '^.$' ? ':' : '') . commit . ':' . + \ s:DotRelative(tree . file_candidate) + elseif empty(file_candidate) && commit !~# '^.$' + let file = commit + endif + endif return (len(a:esc) ? shellescape(file) : file) endfunction @@ -1140,17 +1274,16 @@ function! fugitive#Expand(object) abort \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5))', 'g') endfunction -function! s:ExpandSplit(string, ...) abort +function! s:SplitExpandChain(string, ...) abort let list = [] let string = a:string - let handle_bar = a:0 && a:1 - let dquote = handle_bar ? '"\%([^"]\|""\|\\"\)*"\|' : '' - let cwd = a:0 > 1 ? a:2 : getcwd() + let dquote = '"\%([^"]\|""\|\\"\)*"\|' + let cwd = a:0 ? a:1 : getcwd() while string =~# '\S' - if handle_bar && string =~# '^\s*|' + if string =~# '^\s*|' return [list, substitute(string, '^\s*', '', '')] endif - let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] ' . (handle_bar ? '|' : '') . ']\)\+') + let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+') let string = strpart(string, len(arg)) let arg = substitute(arg, '^\s\+', '', '') if !exists('seen_separator') @@ -1165,15 +1298,7 @@ function! s:ExpandSplit(string, ...) abort let seen_separator = 1 endif endwhile - return handle_bar ? [list, ''] : list -endfunction - -function! s:SplitExpand(string, ...) abort - return s:ExpandSplit(a:string, 0, a:0 ? a:1 : getcwd()) -endfunction - -function! s:SplitExpandChain(string, ...) abort - return s:ExpandSplit(a:string, 1, a:0 ? a:1 : getcwd()) + return [list, ''] endfunction let s:trees = {} @@ -1493,11 +1618,11 @@ function! s:FilterEscape(items, ...) abort return items endfunction -function! s:GlobComplete(lead, pattern) abort +function! s:GlobComplete(lead, pattern, ...) abort if a:lead ==# '/' return [] elseif v:version >= 704 - let results = glob(a:lead . a:pattern, 0, 1) + let results = glob(a:lead . a:pattern, a:0 ? a:1 : 0, 1) else let results = split(glob(a:lead . a:pattern), "\n") endif @@ -1597,8 +1722,7 @@ function! fugitive#CompleteObject(base, ...) abort let parent = matchstr(a:base, '.*[:/]') let entries = s:LinesError(['ls-tree', substitute(parent, ':\zs\./', '\=subdir', '')], dir)[0] call map(entries,'s:sub(v:val,"^04.*\\zs$","/")') - call map(entries,'tree.s:sub(v:val,".*\t","")') - + call map(entries,'parent.s:sub(v:val,".*\t","")') endif return s:FilterEscape(entries, a:base) endfunction @@ -1641,7 +1765,7 @@ function! s:ReplaceCmd(cmd) abort let temp = tempname() let [err, exec_error] = s:TempCmd(temp, a:cmd) if exec_error - call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) + call s:throw((len(err) ? err : 'unknown error running ' . a:cmd)) endif setlocal noswapfile silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp) @@ -1660,8 +1784,8 @@ endfunction function! s:QueryLog(refspec) abort let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] - call map(lines, 'split(v:val, "\t")') - call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') + call map(lines, 'split(v:val, "\t", 1)') + call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}') return lines endfunction @@ -1745,7 +1869,11 @@ function! fugitive#BufReadStatus() abort let [staged, unstaged, untracked] = [[], [], []] let props = {} - if fugitive#GitVersion(2, 11) + let pull = '' + if empty(s:Tree()) + let branch = FugitiveHead(0) + let head = FugitiveHead(11) + elseif fugitive#GitVersion(2, 11) let cmd += ['status', '--porcelain=v2', '-bz'] let [output, message, exec_error] = s:NullError(cmd) if exec_error @@ -1775,10 +1903,11 @@ function! fugitive#BufReadStatus() abort endif let sub = matchstr(line, '^[12u] .. \zs....') if line[2] !=# '.' - call add(staged, {'type': 'File', 'status': line[2], 'filename': files, 'sub': sub}) + call add(staged, {'type': 'File', 'status': line[2], 'filename': files, 'submodule': sub}) endif if line[3] !=# '.' - call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'sub': sub}) + let sub = matchstr(line, '^[12u] .. \zs....') + call add(unstaged, {'type': 'File', 'status': get({'C':'M','M':'?','U':'?'}, matchstr(sub, 'S\.*\zs[CMU]'), line[3]), 'filename': file, 'submodule': sub}) endif endif let i += 1 @@ -1803,7 +1932,6 @@ function! fugitive#BufReadStatus() abort call remove(output, 0) endwhile let head = matchstr(output[0], '^## \zs\S\+\ze\%($\| \[\)') - let pull = '' if head =~# '\.\.\.' let [head, pull] = split(head, '\.\.\.') let branch = head @@ -1828,20 +1956,16 @@ function! fugitive#BufReadStatus() abort let i += 1 endif if line[0] !~# '[ ?!#]' - call add(staged, {'type': 'File', 'status': line[0], 'filename': files, 'sub': ''}) + call add(staged, {'type': 'File', 'status': line[0], 'filename': files, 'submodule': ''}) endif if line[0:1] ==# '??' call add(untracked, {'type': 'File', 'status': line[1], 'filename': files}) elseif line[1] !~# '[ !#]' - call add(unstaged, {'type': 'File', 'status': line[1], 'filename': file, 'sub': ''}) + call add(unstaged, {'type': 'File', 'status': line[1], 'filename': file, 'submodule': ''}) endif endwhile endif - if empty(s:Tree()) - let [unstaged, untracked] = [[], []] - endif - for dict in staged let b:fugitive_files['Staged'][dict.filename] = dict endfor @@ -1971,7 +2095,7 @@ function! fugitive#BufReadStatus() abort if &bufhidden ==# '' setlocal bufhidden=delete endif - let b:dispatch = ':Git fetch --all' + let b:dispatch = '-dir=' . fnameescape(len(s:Tree()) ? s:Tree() : s:Dir()) . ' ' . g:fugitive_git_executable . ' fetch --all' call fugitive#MapJumps() call s:Map('n', '-', ":execute Do('Toggle',0)", '') call s:Map('x', '-', ":execute Do('Toggle',1)", '') @@ -1986,7 +2110,7 @@ function! fugitive#BufReadStatus() abort call s:MapMotion('gp', "exe StageJump(v:count, 'Unpushed')") call s:MapMotion('gP', "exe StageJump(v:count, 'Unpulled')") call s:MapMotion('gr', "exe StageJump(v:count, 'Rebasing')") - call s:Map('n', 'C', ":echoerr ':Gstatus C has been removed in favor of cc'", '') + call s:Map('n', 'C', ":echoerr 'fugitive: C has been removed in favor of cc'", '') call s:Map('n', 'a', ":execute Do('Toggle',0)", '') call s:Map('n', 'i', ":execute NextExpandedHunk(v:count1)", '') call s:Map('n', "=", ":execute StageInline('toggle',line('.'),v:count)", '') @@ -1995,7 +2119,7 @@ function! fugitive#BufReadStatus() abort call s:Map('x', "=", ":execute StageInline('toggle',line(\"'<\"),line(\"'>\")-line(\"'<\")+1)", '') call s:Map('x', "<", ":execute StageInline('hide', line(\"'<\"),line(\"'>\")-line(\"'<\")+1)", '') call s:Map('x', ">", ":execute StageInline('show', line(\"'<\"),line(\"'>\")-line(\"'<\")+1)", '') - call s:Map('n', 'D', ":execute StageDiff('Gdiffsplit')redrawechohl WarningMsg echo ':Gstatus D is deprecated in favor of dd'echohl NONE", '') + call s:Map('n', 'D', ":echoerr 'fugitive: D has been removed in favor of dd'", '') call s:Map('n', 'dd', ":execute StageDiff('Gdiffsplit')", '') call s:Map('n', 'dh', ":execute StageDiff('Ghdiffsplit')", '') call s:Map('n', 'ds', ":execute StageDiff('Ghdiffsplit')", '') @@ -2009,7 +2133,7 @@ function! fugitive#BufReadStatus() abort call s:Map('n', 'I', ":execute StagePatch(line('.'),line('.'))", '') call s:Map('x', 'I', ":execute StagePatch(line(\"'<\"),line(\"'>\"))", '') if empty(mapcheck('q', 'n')) - nnoremap q :if bufnr('$') == 1quitelsebdeleteendifechohl WarningMsgecho ':Gstatus q is deprecated in favor of gq or the built-in C-W>q'echohl NONE + nnoremap q :echoerr "fugitive: q removed in favor of gq (or :q)" endif call s:Map('n', 'gq', ":if bufnr('$') == 1quitelsebdeleteendif", '') call s:Map('n', 'R', ":echohl WarningMsgecho 'Reloading is automatic. Use :e to force'echohl NONE", '') @@ -2095,6 +2219,7 @@ function! fugitive#BufReadCmd(...) abort if empty(dir) return 'echo "Invalid Fugitive URL"' endif + let b:git_dir = dir if rev =~# '^:\d$' let b:fugitive_type = 'stage' else @@ -2136,6 +2261,9 @@ function! fugitive#BufReadCmd(...) abort setlocal endofline try + if &foldmethod ==# 'marker' && b:fugitive_type !=# 'blob' + setlocal foldmethod=manual + endif silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' let b:fugitive_display_format = b:fugitive_display_format % 2 @@ -2159,7 +2287,7 @@ function! fugitive#BufReadCmd(...) abort if b:fugitive_display_format call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) else - call s:ReplaceCmd([dir, 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) + call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) keepjumps 1 keepjumps call search('^parent ') if getline('.') ==# 'parent ' @@ -2189,7 +2317,7 @@ function! fugitive#BufReadCmd(...) abort endif let &l:modifiable = modifiable if b:fugitive_type !=# 'blob' - setlocal filetype=git foldmethod=syntax + setlocal filetype=git call s:Map('n', 'a', ":let b:fugitive_display_format += v:count1exe fugitive#BufReadCmd(@%)", '') call s:Map('n', 'i', ":let b:fugitive_display_format -= v:count1exe fugitive#BufReadCmd(@%)", '') endif @@ -2198,12 +2326,6 @@ function! fugitive#BufReadCmd(...) abort setlocal modifiable - let browsex = maparg('NetrwBrowseX', 'n') - let remote_check = '\Cnetrw#CheckIfRemote(\%(netrw#GX()\)\=)' - if browsex =~# remote_check - exe 'nnoremap NetrwBrowseX' substitute(browsex, remote_check, '0', 'g') - endif - return 'silent ' . s:DoAutocmd('BufReadPost') . \ (modifiable ? '' : '|setl nomodifiable') . '|silent ' . \ s:DoAutocmd('User Fugitive' . substitute(b:fugitive_type, '^\l', '\u&', '')) @@ -2239,15 +2361,33 @@ function! s:TempState(...) abort return get(s:temp_files, s:cpath(fnamemodify(a:0 ? a:1 : @%, ':p')), {}) endfunction +function! fugitive#Result(...) abort + if !a:0 && exists('g:fugitive_event') + return get(g:, 'fugitive_result', {}) + elseif !a:0 || type(a:1) == type('') && a:1 =~# '^-\=$' + return get(g:, '_fugitive_last_job', {}) + elseif type(a:1) == type(0) + return s:TempState(bufname(a:1)) + elseif type(a:1) == type('') + return s:TempState(a:1) + elseif type(a:1) == type({}) && has_key(a:1, 'file') + return s:TempState(a:1.file) + else + return {} + endif +endfunction + function! s:TempReadPre(file) abort if has_key(s:temp_files, s:cpath(a:file)) let dict = s:temp_files[s:cpath(a:file)] setlocal nomodeline - setlocal bufhidden=delete + if empty(&bufhidden) + setlocal bufhidden=delete + endif setlocal buftype=nowrite setlocal nomodifiable + let b:git_dir = dict.dir if len(dict.dir) - let b:git_dir = dict.dir call extend(b:, {'fugitive_type': 'temp'}, 'keep') endif endif @@ -2256,31 +2396,46 @@ endfunction function! s:TempReadPost(file) abort if has_key(s:temp_files, s:cpath(a:file)) let dict = s:temp_files[s:cpath(a:file)] - setlocal nobuflisted - if has_key(dict, 'filetype') && dict.filetype !=# &l:filetype + if !has_key(dict, 'job') + setlocal nobuflisted + endif + if get(dict, 'filetype', '') ==# 'git' + call fugitive#MapJumps() + endif + if has_key(dict, 'filetype') let &l:filetype = dict.filetype endif setlocal foldmarker=<<<<<<<,>>>>>>> - if empty(mapcheck('q', 'n')) - nnoremap q :bdeleteechohl WarningMsgecho "Temp file q is deprecated in favor of the built-in C-W>q"echohl NONE - endif if !&modifiable + if empty(mapcheck('q', 'n')) + nnoremap q :echoerr "fugitive: q is removed in favor of gq (or :q)" + endif call s:Map('n', 'gq', ":bdelete", ' ') endif endif return '' endfunction +function! s:TempDelete(file) abort + let key = s:cpath(a:file) + if has_key(s:temp_files, key) && !has_key(s:temp_files[key], 'job') && key !=# s:cpath(get(get(g:, '_fugitive_last_job', {}), 'file', '')) + call delete(a:file) + call remove(s:temp_files, key) + endif + return '' +endfunction + augroup fugitive_temp autocmd! autocmd BufReadPre * exe s:TempReadPre( expand(':p')) autocmd BufReadPost * exe s:TempReadPost(expand(':p')) + autocmd BufWipeout * exe s:TempDelete( expand(':p')) augroup END " Section: :Git function! s:AskPassArgs(dir) abort - if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && fugitive#GitVersion(1, 8) && + if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir)) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] @@ -2292,42 +2447,141 @@ function! s:AskPassArgs(dir) abort endfunction function! s:RunJobs() abort - return exists('*job_start') || exists('*jobstart') + return (exists('*job_start') || exists('*jobstart')) && exists('*bufwinid') endfunction -function! s:RunEdit(state, job) abort - if get(a:state, 'request', '') == 'edit' - call remove(a:state, 'request') - let file = readfile(a:state.temp . '.edit')[0] - exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) - set bufhidden=wipe - let s:edit_jobs[bufnr('')] = [a:state, a:job] - return 1 - endif +function! s:RunSave(state) abort + let s:temp_files[s:cpath(a:state.file)] = a:state endfunction -function! s:RunReceive(state, job, data, ...) abort - call add(a:state.log, a:data) - let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data - if has_key(a:state, 'buffer') - let data = remove(a:state, 'buffer') . data +function! s:RunFinished(state, ...) abort + if has_key(get(g:, '_fugitive_last_job', {}), 'file') && bufnr(g:_fugitive_last_job.file) < 0 + exe s:TempDelete(remove(g:, '_fugitive_last_job').file) endif - let escape = "\033]51;[^\007]*" - let a:state.escape_buffer = matchstr(data, escape . '$') - if len(a:state.escape_buffer) - let data = strpart(data, 0, len(data) - len(a:state.escape_buffer)) + let g:_fugitive_last_job = a:state + let first = join(readfile(a:state.file, '', 2), "\n") + if get(a:state, 'filetype', '') ==# 'git' && first =~# '\<\([[:upper:][:digit:]_-]\+(\d\+)\).*\1' + let a:state.filetype = 'man' endif - let cmd = matchstr(data, escape . "\007")[5:-2] - let data = substitute(data, escape . "\007", '', 'g') - if cmd =~# '^fugitive:' - let a:state.request = strpart(cmd, 9) + if !has_key(a:state, 'capture_bufnr') + return endif - let data = a:state.echo_buffer . data - let a:state.echo_buffer = matchstr(data, "[\r\n]\\+$") - if len(a:state.echo_buffer) - let data = strpart(data, 0, len(data) - len(a:state.echo_buffer)) + call fugitive#ReloadStatus(a:state, 1) +endfunction + +function! s:RunEdit(state, tmp, job) abort + if get(a:state, 'request', '') !=# 'edit' + return 0 endif - echon substitute(data, "\r\\ze\n", '', 'g') + call remove(a:state, 'request') + let sentinel = a:state.file . '.edit' + let file = FugitiveVimPath(readfile(sentinel, 1)[0]) + exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) + set bufhidden=wipe + let s:edit_jobs[bufnr('')] = [a:state, a:tmp, a:job, sentinel] + call fugitive#ReloadStatus(a:state.dir, 1) + return 1 +endfunction + +function! s:RunReceive(state, tmp, type, job, data, ...) abort + if a:type ==# 'err' || a:state.pty + let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data + let data = a:tmp.escape . data + let escape = "\033]51;[^\007]*" + let a:tmp.escape = matchstr(data, escape . '$') + if len(a:tmp.escape) + let data = strpart(data, 0, len(data) - len(a:tmp.escape)) + endif + let cmd = matchstr(data, escape . "\007")[5:-2] + let data = substitute(data, escape . "\007", '', 'g') + if cmd =~# '^fugitive:' + let a:state.request = strpart(cmd, 9) + endif + let lines = split(a:tmp.err . data, "\r\\=\n", 1) + let a:tmp.err = lines[-1] + let lines[-1] = '' + call map(lines, 'substitute(v:val, ".*\r", "", "")') + else + let lines = type(a:data) == type([]) ? a:data : split(a:data, "\n", 1) + if len(a:tmp.out) + let lines[0] = a:tmp.out . lines[0] + endif + let a:tmp.out = lines[-1] + let lines[-1] = '' + endif + call writefile(lines, a:state.file, 'ba') + if has_key(a:tmp, 'echo') + if !exists('l:data') + let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data + endif + let a:tmp.echo .= data + endif + let line_count = a:tmp.line_count + let a:tmp.line_count += len(lines) - 1 + if !has_key(a:state, 'capture_bufnr') || !bufloaded(a:state.capture_bufnr) + return + endif + call remove(lines, -1) + try + call setbufvar(a:state.capture_bufnr, '&modifiable', 1) + if !line_count && len(lines) > 1000 + let first = remove(lines, 0, 999) + call setbufline(a:state.capture_bufnr, 1, first) + redraw + call setbufline(a:state.capture_bufnr, 1001, lines) + else + call setbufline(a:state.capture_bufnr, line_count + 1, lines) + endif + call setbufvar(a:state.capture_bufnr, '&modifiable', 0) + if !getwinvar(bufwinid(a:state.capture_bufnr), '&previewwindow') + " no-op + elseif exists('*win_execute') + call win_execute(bufwinid(a:state.capture_bufnr), '$') + else + let winnr = bufwinnr(a:state.capture_bufnr) + if winnr > 0 + let old_winnr = winnr() + exe 'noautocmd' winnr.'wincmd w' + $ + exe 'noautocmd' old_winnr.'wincmd w' + endif + endif + catch + endtry +endfunction + +function! s:RunExit(state, tmp, job, exit_status) abort + let a:state.exit_status = a:exit_status + if has_key(a:state, 'job') + return + endif + call s:RunFinished(a:state) +endfunction + +function! s:RunClose(state, tmp, job, ...) abort + if a:0 + call s:RunExit(a:state, a:tmp, a:job, a:1) + endif + let noeol = substitute(substitute(a:tmp.err, "\r$", '', ''), ".*\r", '', '') . a:tmp.out + call writefile([noeol], a:state.file, 'ba') + call remove(a:state, 'job') + if has_key(a:state, 'capture_bufnr') && bufloaded(a:state.capture_bufnr) + if len(noeol) + call setbufvar(a:state.capture_bufnr, '&modifiable', 1) + call setbufline(a:state.capture_bufnr, a:tmp.line_count + 1, [noeol]) + call setbufvar(a:state.capture_bufnr, '&eol', 0) + call setbufvar(a:state.capture_bufnr, '&modifiable', 0) + endif + call setbufvar(a:state.capture_bufnr, '&modified', 0) + call setbufvar(a:state.capture_bufnr, '&buflisted', 0) + if a:state.filetype !=# getbufvar(a:state.capture_bufnr, '&filetype', '') + call setbufvar(a:state.capture_bufnr, '&filetype', a:state.filetype) + endif + endif + if !has_key(a:state, 'exit_status') + return + endif + call s:RunFinished(a:state) endfunction function! s:RunSend(job, str) abort @@ -2343,27 +2597,75 @@ function! s:RunSend(job, str) abort endtry endfunction +function! s:RunCloseIn(job) abort + try + if type(a:job) ==# type(0) + call chanclose(a:job, 'stdin') + else + call ch_close_in(a:job) + endif + return 1 + catch /^Vim\%((\a\+)\)\=:E90[06]:/ + return 0 + endtry +endfunction + +function! s:RunEcho(tmp) abort + if !has_key(a:tmp, 'echo') + return + endif + let data = a:tmp.echo + let a:tmp.echo = matchstr(data, "[\r\n]\\+$") + if len(a:tmp.echo) + let data = strpart(data, 0, len(data) - len(a:tmp.echo)) + endif + echon substitute(data, "\r\\ze\n", '', 'g') +endfunction + +function! s:RunTick(job) abort + if type(a:job) == v:t_number + return jobwait([a:job], 1)[0] == -1 + elseif type(a:job) == 8 + let running = ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run' + sleep 1m + return running + endif +endfunction + if !exists('s:edit_jobs') let s:edit_jobs = {} endif -function! s:RunWait(state, job) abort - let finished = 0 +function! s:RunWait(state, tmp, job, ...) abort + if a:0 && filereadable(a:1) + call delete(a:1) + endif try - while get(a:state, 'request', '') !=# 'edit' && (type(a:job) == type(0) ? jobwait([a:job], 1)[0] == -1 : ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run') - if !exists('*jobwait') - sleep 1m - endif - if !get(a:state, 'closed') + while get(a:state, 'request', '') !=# 'edit' && s:RunTick(a:job) + call s:RunEcho(a:tmp) + if !get(a:state, 'closed_in') let peek = getchar(1) if peek != 0 && !(has('win32') && peek == 128) let c = getchar() let c = type(c) == type(0) ? nr2char(c) : c - if c ==# "\" - let a:state.closed = 1 - if type(a:job) ==# type(0) - call chanclose(a:job, 'stdin') - else - call ch_close_in(a:job) + if c ==# "\" || c ==# "\" + let a:state.closed_in = 1 + let can_pedit = s:RunCloseIn(a:job) && exists('*setbufline') + for winnr in range(1, winnr('$')) + if getwinvar(winnr, '&previewwindow') && getbufvar(winbufnr(winnr), '&modified') + let can_pedit = 0 + endif + endfor + if can_pedit + if has_key(a:tmp, 'echo') + call remove(a:tmp, 'echo') + endif + call writefile(['fugitive: aborting edit due to background operation.'], a:state.file . '.exit') + exe (&splitbelow ? 'botright' : 'topleft') 'silent pedit ++ff=unix' fnameescape(a:state.file) + let a:state.capture_bufnr = bufnr(a:state.file) + call setbufvar(a:state.capture_bufnr, '&modified', 1) + let finished = 0 + redraw! + return '' endif else call s:RunSend(a:job, c) @@ -2374,14 +2676,19 @@ function! s:RunWait(state, job) abort endif endif endwhile - sleep 1m - echo - call s:RunEdit(a:state, a:job) - let finished = 1 + if !has_key(a:state, 'request') && has_key(a:state, 'job') && exists('*job_status') && job_status(a:job) ==# "dead" + throw 'fugitive: close callback did not fire; this should never happen' + endif + call s:RunEcho(a:tmp) + if has_key(a:tmp, 'echo') + let a:tmp.echo = substitute(a:tmp.echo, "^\r\\=\n", '', '') + echo + endif + let finished = !s:RunEdit(a:state, a:tmp, a:job) finally - if !finished + if !exists('finished') try - if a:state.pty + if a:state.pty && !get(a:state, 'closed_in') call s:RunSend(a:job, "\") elseif type(a:job) == type(0) call jobstop(a:job) @@ -2390,9 +2697,10 @@ function! s:RunWait(state, job) abort endif catch /.*/ endtry + elseif finished + call fugitive#ReloadStatus(a:state, 1) endif endtry - call fugitive#ReloadStatus(a:state.dir, 1) return '' endfunction @@ -2401,27 +2709,39 @@ if !exists('s:resume_queue') endif function! fugitive#Resume() abort while len(s:resume_queue) - let [state, job] = remove(s:resume_queue, 0) - if filereadable(state.temp . '.edit') - call delete(state.temp . '.edit') + if s:resume_queue[0][2] isnot# '' + try + call call('s:RunWait', remove(s:resume_queue, 0)) + endtry endif - call s:RunWait(state, job) endwhile endfunction function! s:RunBufDelete(bufnr) abort + let state = s:TempState(bufname(+a:bufnr)) + if has_key(state, 'job') + try + if type(state.job) == type(0) + call jobstop(state.job) + else + call job_stop(state.job) + endif + catch + endtry + endif if has_key(s:edit_jobs, a:bufnr) | call add(s:resume_queue, remove(s:edit_jobs, a:bufnr)) - call feedkeys(":redraw!|call fugitive#Resume()|silent checktime\r", 'n') + call feedkeys(":redraw!|call delete(" . string(s:resume_queue[-1][0].file . '.edit') . + \ ")|call fugitive#Resume()|silent checktime\r", 'n') endif endfunction augroup fugitive_job autocmd! - autocmd BufDelete * call s:RunBufDelete(expand('')) + autocmd BufDelete * call s:RunBufDelete(+expand('')) autocmd VimLeave * \ for s:jobbuf in keys(s:edit_jobs) | - \ call writefile([], s:edit_jobs[s:jobbuf][0].temp . '.exit') | + \ call writefile(['Aborting edit due to Vim exit.'], s:edit_jobs[s:jobbuf][0].file . '.exit') | \ redraw! | \ call call('s:RunWait', remove(s:edit_jobs, s:jobbuf)) | \ endfor @@ -2450,7 +2770,7 @@ function! fugitive#PagerFor(argv, ...) abort return 0 elseif type(value) == type('') return value - elseif args[0] =~# 'diff\%(tool\)\@!\|log\|^show$\|^config$\|^branch$\|^tag$' || + elseif args[0] =~# '^\%(branch\|config\|diff\|grep\|log\|range-diff\|reflog\|shortlog\|show\|tag\|whatchanged\)$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'am' && s:HasOpt(args, '--show-current-patch')) return 1 @@ -2465,6 +2785,7 @@ for s:colortype in ['advice', 'branch', 'diff', 'grep', 'interactive', 'pager', endfor unlet s:colortype function! fugitive#Command(line1, line2, range, bang, mods, arg) abort + exe s:VersionCheck() let dir = s:Dir() let config = copy(fugitive#Config(dir)) let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir)) @@ -2505,7 +2826,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let options = {'git': git, 'dir': dir, 'flags': flags} if pager is# -1 && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try - let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'command': args[0], 'args': args[1:-1]}, options)) + let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'subcommand': args[0], 'subcommand_args': args[1:-1]}, options)) if type(overrides) == type('') return 'exe ' . string(overrides) . after endif @@ -2546,45 +2867,54 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort return 'echoerr ' . string('fugitive: :Git! for temp buffer output has been replaced by :Git --paginate') endif endif - if pager is# 1 - if editcmd ==# 'read' - return s:ReadExec(a:line1, a:line2, a:range, a:mods, env, args, options) . after - else - return s:OpenExec(editcmd, a:mods, env, args, options) . after - endif - endif - if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || + if (s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || - \ type(pager) == type('') + \ type(pager) == type('')) && pager isnot# 1 let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() return mods . (a:line2 ? 'split' : 'edit') . ' term://' . s:fnameescape(s:UserCommand(options, args)) . assign . '|startinsert' . after elseif has('terminal') - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(options) + args, 's:fnameescape(v:val)'))) . assign . after endif endif - if s:RunJobs() - let state = { - \ 'dir': dir, - \ 'mods': s:Mods(a:mods), - \ 'title': ':Git ' . a:arg, - \ 'echo_buffer': '', - \ 'escape_buffer': '', - \ 'log': [], - \ 'temp': tempname()} - let state.pty = get(g:, 'fugitive_pty', has('unix') && (has('patch-8.0.0744') || has('nvim'))) + if pager is# 1 && editcmd ==# 'read' + return s:ReadExec(a:line1, a:line2, a:range, a:mods, env, args, options) . after + endif + let state = { + \ 'git': git, + \ 'flags': flags, + \ 'args': args, + \ 'dir': dir, + \ 'git_dir': dir, + \ 'cwd': s:UserCommandCwd(dir), + \ 'filetype': 'git', + \ 'mods': s:Mods(a:mods), + \ 'file': s:Resolve(tempname())} + if pager is# 1 + call extend(env, {'COLUMNS': '' . get(g:, 'fugitive_columns', 80)}, 'keep') + else + call extend(env, {'COLUMNS': '' . &columns - 1}, 'keep') + endif + if s:RunJobs() && pager isnot# 1 + let state.pty = get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim'))) if !state.pty let args = s:AskPassArgs(dir) + args endif - let env.FUGITIVE_TEMP = state.temp + let tmp = { + \ 'line_count': 0, + \ 'err': '', + \ 'out': '', + \ 'echo': '', + \ 'escape': ''} + let env.FUGITIVE = state.file let editor = 'sh ' . s:TempScript( - \ '[ -f "$FUGITIVE_TEMP.exit" ] && exit 1', - \ 'echo "$1" > "$FUGITIVE_TEMP.edit"', - \ 'printf "\033]51;fugitive:edit\007"', - \ 'while [ -f "$FUGITIVE_TEMP.edit" -a ! -f "$FUGITIVE_TEMP.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done', + \ '[ -f "$FUGITIVE.exit" ] && cat "$FUGITIVE.exit" >&2 && exit 1', + \ 'echo "$1" > "$FUGITIVE.edit"', + \ 'printf "\033]51;fugitive:edit\007" >&2', + \ 'while [ -f "$FUGITIVE.edit" -a ! -f "$FUGITIVE.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done', \ 'exit 0') call extend(env, { \ 'NO_COLOR': '1', @@ -2596,13 +2926,17 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let args = s:disable_colors + flags + ['-c', 'advice.waitingForEditor=false'] + args let argv = s:UserCommandList({'git': git, 'dir': dir}) + args let [argv, jobopts] = s:JobOpts(argv, env) - let state.cmd = argv - let g:_fugitive_last_job = state - if &autowrite || &autowriteall | silent! wall | endif + call fugitive#Autowrite() + call writefile([], state.file, 'b') + call s:RunSave(state) + echo "" if exists('*job_start') call extend(jobopts, { \ 'mode': 'raw', - \ 'callback': function('s:RunReceive', [state]), + \ 'out_cb': function('s:RunReceive', [state, tmp, 'out']), + \ 'err_cb': function('s:RunReceive', [state, tmp, 'err']), + \ 'close_cb': function('s:RunClose', [state, tmp]), + \ 'exit_cb': function('s:RunExit', [state, tmp]), \ }) if state.pty let jobopts.pty = 1 @@ -2612,13 +2946,27 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let job = jobstart(argv, extend(jobopts, { \ 'pty': state.pty, \ 'TERM': 'dumb', - \ 'on_stdout': function('s:RunReceive', [state]), - \ 'on_stderr': function('s:RunReceive', [state]), + \ 'on_stdout': function('s:RunReceive', [state, tmp, 'out']), + \ 'on_stderr': function('s:RunReceive', [state, tmp, 'err']), + \ 'on_exit': function('s:RunClose', [state, tmp]), \ })) endif let state.job = job - call s:RunWait(state, job) - return 'silent checktime' . after + call add(s:resume_queue, [state, tmp, job]) + return 'call fugitive#Resume()|silent checktime' . after + elseif pager is# 1 + let pre = s:BuildEnvPrefix(env) + silent! execute '!' . escape(pre . s:UserCommand({'git': git, 'dir': dir}, s:disable_colors + flags + ['--no-pager'] + args), '!#%') . + \ (&shell =~# 'csh' ? ' >& ' . s:shellesc(state.file) : ' > ' . s:shellesc(state.file) . ' 2>&1') + let state.exit_status = v:shell_error + redraw! + call s:RunSave(state) + call s:RunFinished(state) + if editcmd ==# 'edit' + call s:BlurStatus() + endif + return state.mods . editcmd . ' ' . s:fnameescape(state.file) . + \ '|call fugitive#ReloadStatus(fugitive#Result(' . string(state.file) . '), 1)' . after elseif has('win32') return 'echoerr ' . string('fugitive: Vim 8 with job support required to use :Git on Windows') elseif has('gui_running') @@ -2639,22 +2987,68 @@ function! s:ExecPath() abort return s:exec_paths[g:fugitive_git_executable] endfunction -function! s:Subcommands() abort - let exec_path = s:ExecPath() - return map(split(glob(exec_path.'/git-*'),"\n"),'s:sub(v:val[strlen(exec_path)+5 : -1],"\\.exe$","")') -endfunction - -let s:aliases = {} -function! s:Aliases(dir) abort - let dir_key = len(a:dir) ? a:dir : '_' - if !has_key(s:aliases, dir_key) - let s:aliases[dir_key] = {} - let lines = s:NullError([a:dir, 'config', '-z', '--get-regexp', '^alias[.]'])[0] - for line in lines - let s:aliases[dir_key][matchstr(line, '\.\zs.\{-}\ze\n')] = matchstr(line, '\n\zs.*') - endfor +let s:subcommands_before_2_5 = [ + \ 'add', 'am', 'apply', 'archive', 'bisect', 'blame', 'branch', 'bundle', + \ 'checkout', 'cherry', 'cherry-pick', 'citool', 'clean', 'clone', 'commit', 'config', + \ 'describe', 'diff', 'difftool', 'fetch', 'format-patch', 'fsck', + \ 'gc', 'grep', 'gui', 'help', 'init', 'instaweb', 'log', + \ 'merge', 'mergetool', 'mv', 'notes', 'pull', 'push', + \ 'rebase', 'reflog', 'remote', 'repack', 'replace', 'request-pull', 'reset', 'revert', 'rm', + \ 'send-email', 'shortlog', 'show', 'show-branch', 'stash', 'stage', 'status', 'submodule', + \ 'tag', 'whatchanged', + \ ] +let s:path_subcommands = {} +function! s:CompletableSubcommands(dir) abort + let c_exec_path = s:cpath(s:ExecPath()) + if !has_key(s:path_subcommands, c_exec_path) + if fugitive#GitVersion(2, 18) + let [lines, exec_error] = s:LinesError(a:dir, '--list-cmds=list-mainporcelain,nohelpers,list-complete') + call filter(lines, 'v:val =~# "^\\S\\+$"') + if !exec_error && len(lines) + let s:path_subcommands[c_exec_path] = lines + else + let s:path_subcommands[c_exec_path] = s:subcommands_before_2_5 + + \ ['maintenance', 'prune', 'range-diff', 'restore', 'sparse-checkout', 'switch', 'worktree'] + endif + else + let s:path_subcommands[c_exec_path] = s:subcommands_before_2_5 + + \ (fugitive#GitVersion(2, 5) ? ['worktree'] : []) + endif + endif + let commands = copy(s:path_subcommands[c_exec_path]) + for path in split($PATH, has('win32') ? ';' : ':') + if path !~# '^/\|^\a:[\\/]' + continue + endif + let cpath = s:cpath(path) + if !has_key(s:path_subcommands, cpath) + let s:path_subcommands[cpath] = filter(map(s:GlobComplete(path.'/git-', '*', 1),'substitute(v:val,"\\.exe$","","")'), 'v:val !~# "--\\|/"') + endif + call extend(commands, s:path_subcommands[cpath]) + endfor + call extend(commands, map(filter(keys(fugitive#Config(a:dir)), 'v:val =~# "^alias\\.[^.]*$"'), 'strpart(v:val, 6)')) + let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+') + let rejected = {} + for command in configured + if command =~# '^-.' + let rejected[strpart(command, 1)] = 1 + endif + endfor + call filter(configured, 'v:val !~# "^-"') + let results = filter(sort(commands + configured), '!has_key(rejected, v:val)') + if exists('*uniq') + return uniq(results) + else + let i = 1 + while i < len(results) + if results[i] ==# results[i-1] + call remove(results, i) + else + let i += 1 + endif + endwhile + return results endif - return s:aliases[dir_key] endfunction function! fugitive#Complete(lead, ...) abort @@ -2663,7 +3057,7 @@ function! fugitive#Complete(lead, ...) abort let pre = a:0 > 1 ? strpart(a:1, 0, a:2) : '' let subcmd = matchstr(pre, '\u\w*[! ] *\zs[[:alnum:]-]\+\ze ') if empty(subcmd) - let results = sort(s:Subcommands() + keys(s:Aliases(dir))) + let results = s:CompletableSubcommands(dir) elseif a:0 ==# 2 && subcmd =~# '^\%(commit\|revert\|push\|fetch\|pull\|merge\|rebase\)$' let cmdline = substitute(a:1, '\u\w*\([! ] *\)' . subcmd, 'G' . subcmd, '') let caps_subcmd = substitute(subcmd, '\%(^\|-\)\l', '\u&', 'g') @@ -2707,20 +3101,24 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args try let mods = s:Mods(a:mods, &splitbelow ? 'botright' : 'topleft') let file = fugitive#Find(':', dir) - let arg = ' +setl\ foldmethod=syntax\ foldlevel=1\|let\ w:fugitive_status=FugitiveGitDir() ' . + let arg = ' +let\ w:fugitive_status=FugitiveGitDir() ' . \ s:fnameescape(file) - for winnr in range(1, winnr('$')) - if s:cpath(file, fnamemodify(bufname(winbufnr(winnr)), ':p')) - if winnr == winnr() - call s:ReloadStatus() - else - call s:ExpireStatus(dir) - exe winnr . 'wincmd w' + for tabnr in [tabpagenr()] + (mods =~# '\' ? range(1, tabpagenr('$')) : []) + let bufs = tabpagebuflist(tabnr) + for winnr in range(1, tabpagewinnr(tabnr, '$')) + if s:cpath(file, fnamemodify(bufname(bufs[winnr-1]), ':p')) + if tabnr == tabpagenr() && winnr == winnr() + call s:ReloadStatus() + else + call s:ExpireStatus(dir) + exe tabnr . 'tabnext' + exe winnr . 'wincmd w' + endif + let w:fugitive_status = dir + 1 + return '' endif - let w:fugitive_status = dir - 1 - return '' - endif + endfor endfor if a:count ==# 0 return mods . 'edit' . (a:bang ? '!' : '') . arg @@ -2763,10 +3161,10 @@ endfunction function! s:StageSeek(info, fallback) abort let info = a:info - if empty(info.section) + if empty(info.heading) return a:fallback endif - let line = search('^' . info.section, 'wn') + let line = search('^' . escape(substitute(info.heading, '(\d\+)$', '', ''), '^$.*[]~\'), 'wn') if !line for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, []) let line = search('^' . section, 'wn') @@ -2827,9 +3225,12 @@ function! s:DoAutocmdChanged(dir) abort endif try let g:fugitive_event = dir + if type(a:dir) == type({}) && has_key(a:dir, 'args') + let g:fugitive_result = a:dir + endif exe s:DoAutocmd('User FugitiveChanged') finally - unlet! g:fugitive_event + unlet! g:fugitive_event g:fugitive_result " Force statusline reload with the buffer's Git dir let &ro = &ro endtry @@ -2843,8 +3244,7 @@ function! s:ReloadStatusBuffer(...) abort let original_lnum = a:0 ? a:1 : line('.') let info = s:StageInfo(original_lnum) call fugitive#BufReadStatus() - exe s:StageSeek(info, original_lnum) - normal! 0 + call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0]) return '' endfunction @@ -2861,7 +3261,7 @@ if !exists('s:last_times') endif function! s:ExpireStatus(bufnr) abort - if a:bufnr == -2 + if a:bufnr is# -2 let s:head_cache = {} let s:last_time = reltime() return '' @@ -2894,7 +3294,8 @@ endfunction function! s:ReloadTabStatus(...) abort let mytab = tabpagenr() let tab = a:0 ? a:1 : mytab - for winnr in range(1, tabpagewinnr(tab, '$')) + let winnr = 1 + while winnr <= tabpagewinnr(tab, '$') if getbufvar(tabpagebuflist(tab)[winnr-1], 'fugitive_type') ==# 'index' execute 'tabnext '.tab if winnr != winnr() @@ -2911,7 +3312,8 @@ function! s:ReloadTabStatus(...) abort execute 'tabnext '.mytab endtry endif - endfor + let winnr += 1 + endwhile unlet! t:fugitive_reload_status endfunction @@ -2924,10 +3326,11 @@ function! fugitive#ReloadStatus(...) abort call settabvar(tabnr, 'fugitive_reload_status', t) endfor call s:ReloadTabStatus() - exe s:DoAutocmdChanged(a:0 ? a:1 : -1) else call s:ReloadWinStatus() + return '' endif + exe s:DoAutocmdChanged(a:0 ? a:1 : -1) return '' endfunction @@ -3000,7 +3403,7 @@ function! s:StageInfo(...) abort \ 'paths': map(reverse(split(text, ' -> ')), 's:Tree() . "/" . v:val'), \ 'commit': matchstr(getline(lnum), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze '), \ 'status': matchstr(getline(lnum), '^[A-Z?]\ze \|^\%(\x\x\x\)\@!\l\+\ze [0-9a-f]'), - \ 'sub': get(get(get(b:fugitive_files, section, {}), text, {}), 'sub', ''), + \ 'submodule': get(get(get(b:fugitive_files, section, {}), text, {}), 'submodule', ''), \ 'index': index} endfunction @@ -3368,7 +3771,9 @@ function! s:StageInline(mode, ...) abort endif let lnum1 = a:0 ? a:1 : line('.') let lnum = lnum1 + 1 - if a:0 > 1 && a:2 == 0 + if a:0 > 1 && a:2 == 0 && lnum1 == 1 + let lnum = line('$') - 1 + elseif a:0 > 1 && a:2 == 0 let info = s:StageInfo(lnum - 1) if empty(info.paths) && len(info.section) while len(getline(lnum)) @@ -3435,6 +3840,9 @@ function! s:StageInline(mode, ...) abort silent call append(lnum, diff) let b:fugitive_expanded[info.section][info.filename] = [start, len(diff)] setlocal nomodifiable readonly nomodified + if foldclosed(lnum+1) > 0 + silent exe (lnum+1) . ',' . (lnum+len(diff)) . 'foldopen!' + endif endif endwhile return lnum @@ -3452,10 +3860,10 @@ function! s:StageDiff(diff) abort let lnum = line('.') let info = s:StageInfo(lnum) let prefix = info.offset > 0 ? '+' . info.offset : '' - if info.sub =~# '^S' + if info.submodule =~# '^S' if info.section ==# 'Staged' return 'Git --paginate diff --no-ext-diff --submodule=log --cached -- ' . info.paths[0] - elseif info.sub =~# '^SC' + elseif info.submodule =~# '^SC' return 'Git --paginate diff --no-ext-diff --submodule=log -- ' . info.paths[0] else return 'Git --paginate diff --no-ext-diff --submodule=diff -- ' . info.paths[0] @@ -3466,7 +3874,7 @@ function! s:StageDiff(diff) abort return 'Git --paginate diff --no-ext-diff' elseif len(info.paths) > 1 execute 'Gedit' . prefix s:fnameescape(':0:' . info.paths[0]) - return a:diff . '! HEAD:'.s:fnameescape(info.paths[1]) + return a:diff . '! @:'.s:fnameescape(info.paths[1]) elseif info.section ==# 'Staged' && info.sigil ==# '-' execute 'Gedit' prefix s:fnameescape(':0:'.info.paths[0]) return a:diff . '! :0:%' @@ -3497,7 +3905,7 @@ endfunction function! s:StageApply(info, reverse, extra) abort if a:info.status ==# 'R' - call s:throw('fugitive: patching renamed file not yet supported') + throw 'fugitive: patching renamed file not yet supported' endif let cmd = ['apply', '-p0', '--recount'] + a:extra let info = a:info @@ -3507,9 +3915,9 @@ function! s:StageApply(info, reverse, extra) abort if empty(filter(copy(lines), 'v:val =~# "^[+-]"')) return -1 endif - while getline(end) =~# '^[-+ ]' + while getline(end) =~# '^[-+\ ]' let end += 1 - if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . ' ]' + if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . '\ ]' call add(lines, ' ' . getline(end)[1:-1]) endif endwhile @@ -3553,28 +3961,22 @@ endfunction function! s:StageDelete(lnum1, lnum2, count) abort let restore = [] + let err = '' + let did_conflict_err = 0 try for info in s:Selection(a:lnum1, a:lnum2) if empty(info.paths) continue endif - let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'sub') - if sub =~# '^S' - if info.status ==# 'A' - continue - endif - if info.section ==# 'Staged' - call s:TreeChomp('reset', '--', info.paths[0]) - endif - if info.status =~# '[MD]' - call s:TreeChomp('submodule', 'update', '--', info.paths[0]) - call add(restore, ':Git -C ' . info.relative[0] . ' checkout -') - endif - continue - endif - if info.status ==# 'D' - let undo = 'Gremove' + let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'submodule') + if sub =~# '^S' && info.status ==# 'M' + let undo = 'Git checkout ' . fugitive#RevParse('HEAD', FugitiveExtractGitDir(info.paths[0]))[0:10] . ' --' + elseif sub =~# '^S' + let err .= '|echoerr ' . string('fugitive: will not touch submodule ' . string(info.relative[0])) + break + elseif info.status ==# 'D' + let undo = 'GRemove' elseif info.paths[0] =~# '/$' let err .= '|echoerr ' . string('fugitive: will not delete directory ' . string(info.relative[0])) break @@ -3583,25 +3985,48 @@ function! s:StageDelete(lnum1, lnum2, count) abort endif if info.patch call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : []) + elseif sub =~# '^S' + if info.section ==# 'Staged' + call s:TreeChomp('reset', '--', info.paths[0]) + endif + call s:TreeChomp('submodule', 'update', '--', info.paths[0]) elseif info.status ==# '?' call s:TreeChomp('clean', '-f', '--', info.paths[0]) elseif a:count == 2 - call s:TreeChomp('checkout', '--ours', '--', info.paths[0]) + if get(b:fugitive_files['Staged'], info.filename, {'status': ''}).status ==# 'D' + call delete(FugitiveVimPath(info.paths[0])) + else + call s:TreeChomp('checkout', '--ours', '--', info.paths[0]) + endif elseif a:count == 3 - call s:TreeChomp('checkout', '--theirs', '--', info.paths[0]) + if get(b:fugitive_files['Unstaged'], info.filename, {'status': ''}).status ==# 'D' + call delete(FugitiveVimPath(info.paths[0])) + else + call s:TreeChomp('checkout', '--theirs', '--', info.paths[0]) + endif elseif info.status =~# '[ADU]' && \ get(b:fugitive_files[info.section ==# 'Staged' ? 'Unstaged' : 'Staged'], info.filename, {'status': ''}).status =~# '[AU]' - call s:TreeChomp('checkout', info.section ==# 'Staged' ? '--ours' : '--theirs', '--', info.paths[0]) + if get(g:, 'fugitive_conflict_x', 0) + call s:TreeChomp('checkout', info.section ==# 'Unstaged' ? '--ours' : '--theirs', '--', info.paths[0]) + else + if !did_conflict_err + let err .= '|echoerr "Use 2X for --ours or 3X for --theirs"' + let did_conflict_err = 1 + endif + continue + endif elseif info.status ==# 'U' - call s:TreeChomp('rm', '--', info.paths[0]) + call delete(FugitiveVimPath(info.paths[0])) elseif info.status ==# 'A' call s:TreeChomp('rm', '-f', '--', info.paths[0]) elseif info.section ==# 'Unstaged' call s:TreeChomp('checkout', '--', info.paths[0]) else - call s:TreeChomp('checkout', 'HEAD^{}', '--', info.paths[0]) + call s:TreeChomp('checkout', '@', '--', info.paths[0]) + endif + if len(undo) + call add(restore, ':Gsplit ' . s:fnameescape(info.relative[0]) . '|' . undo) endif - call add(restore, ':Gsplit ' . s:fnameescape(info.relative[0]) . '|' . undo) endfor catch /^fugitive:/ let err .= '|echoerr ' . string(v:exception) @@ -3624,6 +4049,15 @@ function! s:StageIgnore(lnum1, lnum2, count) abort call extend(paths, info.relative) endfor call map(paths, '"/" . v:val') + if !a:0 + let dir = fugitive#Find('.git/info/') + if !isdirectory(dir) + try + call mkdir(dir) + catch + endtry + endif + endif exe 'Gsplit' (a:count ? '.gitignore' : '.git/info/exclude') let last = line('$') if last == 1 && empty(getline(1)) @@ -3663,7 +4097,7 @@ function! s:DoStageUnpushedHeading(heading) abort let remote = '.' endif let branch = matchstr(a:heading, 'to \%([^/]\+/\)\=\zs\S\+') - call feedkeys(':Git push ' . remote . ' ' . 'HEAD:' . 'refs/heads/' . branch) + call feedkeys(':Git push ' . remote . ' ' . '@:' . 'refs/heads/' . branch) endfunction function! s:DoToggleUnpushedHeading(heading) abort @@ -3828,7 +4262,7 @@ function! s:CommitInteractive(line1, line2, range, bang, mods, options, patch) a endfunction function! s:CommitSubcommand(line1, line2, range, bang, mods, options) abort - let argv = copy(a:options.args) + let argv = copy(a:options.subcommand_args) let i = 0 while get(argv, i, '--') !=# '--' if argv[i] =~# '^-[apzsneiovq].' @@ -3889,17 +4323,17 @@ endfunction function! s:MergeSubcommand(line1, line2, range, bang, mods, options) abort let dir = a:options.dir - if empty(a:options.args) && ( + if empty(a:options.subcommand_args) && ( \ filereadable(fugitive#Find('.git/MERGE_MSG', dir)) || \ isdirectory(fugitive#Find('.git/rebase-apply', dir)) || \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . s:fnameescape(a:options.flags + ['mergetool']) + return 'echoerr ":Git merge for loading conflicts hase been removed in favor of :Git mergetool"' endif return {} endfunction function! s:RebaseSubcommand(line1, line2, range, bang, mods, options) abort - let args = a:options.args + let args = a:options.subcommand_args if s:HasOpt(args, '--autosquash') && !s:HasOpt(args, '-i', '--interactive') return {'env': {'GIT_SEQUENCE_EDITOR': 'true'}, 'insert_args': ['--interactive']} endif @@ -4024,13 +4458,13 @@ function! s:ToolStream(line1, line2, range, bang, mods, options, args, state) ab let a:state.from = '' let a:state.to = '' let exec = s:UserCommandList({'git': a:options.git, 'dir': a:options.dir}) - if fugitive#GitVersion(1, 9) || (!s:HasOpt(argv, '--name-status') && !prompt) + if !s:HasOpt(argv, '--name-status') && !prompt let exec += ['-c', 'diff.context=0'] endif let exec += a:options.flags + ['--no-pager', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv if prompt - let title = ':Git ' . s:fnameescape(a:options.flags + [a:options.command] + a:options.args) - return s:QuickfixStream(a:line2, 'difftool', title, exec, !a:bang, s:function('s:ToolParse'), a:state) + let title = ':Git ' . s:fnameescape(a:options.flags + [a:options.subcommand] + a:options.subcommand_args) + return s:QuickfixStream(a:line2, 'difftool', title, exec, !a:bang, a:mods, s:function('s:ToolParse'), a:state) else let filename = '' let cmd = [] @@ -4060,14 +4494,14 @@ function! s:MergetoolSubcommand(line1, line2, range, bang, mods, options) abort let state = {'name_only': 0} let state.diff = [{'prefix': ':2:', 'module': ':2:'}, {'prefix': ':3:', 'module': ':3:'}, {'prefix': ':(top)'}] call map(state.diff, 'extend(v:val, {"filename": fugitive#Find(v:val.prefix, dir)})') - return s:ToolStream(a:line1, a:line2, a:range, a:bang, a:mods, a:options, ['--diff-filter=U'] + a:options.args, state) + return s:ToolStream(a:line1, a:line2, a:range, a:bang, a:mods, a:options, ['--diff-filter=U'] + a:options.subcommand_args, state) endfunction function! s:DifftoolSubcommand(line1, line2, range, bang, mods, options) abort let dir = a:options.dir exe s:DirCheck(dir) let i = 0 - let argv = copy(a:options.args) + let argv = copy(a:options.subcommand_args) let commits = [] let cached = 0 let reverse = 1 @@ -4198,7 +4632,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort let listnr = a:line1 == 0 ? a:line1 : a:line2 let cmd = ['--no-pager', 'grep', '-n', '--no-color', '--full-name'] let tree = s:Tree(dir) - let args = a:options.args + let args = a:options.subcommand_args if get(args, 0, '') =~# '^-O\|--open-files-in-pager$' let args = args[1:-1] endif @@ -4216,8 +4650,18 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, options) abort let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? \ 'fugitive://' . dir . '//0/' : \ s:cpath(getcwd(), tree) ? '' : tree . '/') - exe '!' . escape(s:UserCommand(a:options, cmd + args), '%#!') - \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) + try + if exists('+guioptions') && &guioptions =~# '!' + let guioptions = &guioptions + set guioptions-=! + endif + exe '!' . escape(s:UserCommand(a:options, cmd + args), '%#!') + \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) + finally + if exists('guioptions') + let &guioptions = guioptions + endif + endtry let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)') call s:QuickfixSet(listnr, list, 'a') silent exe s:DoAutocmd('QuickFixCmdPost ' . event) @@ -4337,7 +4781,8 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort let dir = s:Dir() exe s:DirCheck(dir) let listnr = a:type =~# '^l' ? 0 : -1 - let [args, after] = s:SplitExpandChain(a:args, s:Tree(dir)) + let [args, after] = s:SplitExpandChain('log ' . a:args, s:Tree(dir)) + call remove(args, 0) let split = index(args, '--') if split > 0 let paths = args[split : -1] @@ -4388,7 +4833,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort if len(path) && empty(filter(copy(args), 'v:val =~# "^[^-]"')) let owner = s:Owner(@%, dir) if len(owner) - call add(args, owner) + call add(args, owner . (owner =~# '^\x\{40,}' ? '' : '^{}')) endif endif if empty(extra_paths) @@ -4400,20 +4845,12 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort let format = "%h %P\t%H " . g:fugitive_summary_format endif let cmd = ['--no-pager'] - if fugitive#GitVersion(1, 9) - call extend(cmd, ['-c', 'diff.context=0', '-c', 'diff.noprefix=false', 'log']) - else - call extend(cmd, ['log', '-U0', '-s']) - endif - call extend(cmd, + call extend(cmd, ['-c', 'diff.context=0', '-c', 'diff.noprefix=false', 'log'] + \ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] + \ args + extra_args + paths + extra_paths) let state.target = path let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra_paths) && empty(a:type) && a:count < 0 && len(s:Relative('/')) - let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after - endif - return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after + return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, a:mods, s:function('s:LogParse'), state, dir) . after endfunction " Section: :Gedit, :Gpedit, :Gsplit, :Gvsplit, :Gtabedit, :Gread @@ -4422,13 +4859,25 @@ function! s:UsableWin(nr) abort return a:nr && !getwinvar(a:nr, '&previewwindow') && !getwinvar(a:nr, '&winfixwidth') && \ (empty(getwinvar(a:nr, 'fugitive_status')) || getbufvar(winbufnr(a:nr), 'fugitive_type') !=# 'index') && \ index(['gitrebase', 'gitcommit'], getbufvar(winbufnr(a:nr), '&filetype')) < 0 && - \ index(['nofile','help','quickfix'], getbufvar(winbufnr(a:nr), '&buftype')) < 0 + \ index(['nofile','help','quickfix', 'terminal'], getbufvar(winbufnr(a:nr), '&buftype')) < 0 endfunction -function! s:OpenParse(args, wants_cmd) abort +function! s:ArgSplit(string) abort + let string = a:string + let args = [] + while string =~# '\S' + let arg = matchstr(string, '^\s*\%(\\.\|[^[:space:]]\)\+') + let string = strpart(string, len(arg)) + let arg = substitute(arg, '^\s\+', '', '') + call add(args, substitute(arg, '\\\@' @@ -4449,7 +4906,7 @@ function! s:OpenParse(args, wants_cmd) abort endif let dir = s:Dir() let efile = s:Expand(file) - let url = fugitive#Find(efile, dir) + let url = s:Generate(efile, dir) if a:wants_cmd && file[0] ==# '>' && efile[0] !=# '>' && get(b:, 'fugitive_type', '') isnot# 'tree' && &filetype !=# 'netrw' let line = line('.') @@ -4525,43 +4982,21 @@ function! s:BlurStatus() abort endif endfunction -function! s:OpenExec(cmd, mods, env, args, ...) abort - let options = a:0 ? a:1 : {'dir': s:Dir()} - let temp = tempname() - let columns = get(g:, 'fugitive_columns', 80) - let env = s:BuildEnvPrefix(extend({'COLUMNS': columns}, a:env)) - silent! execute '!' . escape(env . s:UserCommand(options, ['--no-pager'] + a:args), '!#%') . - \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') - redraw! - let temp = s:Resolve(temp) - let first = join(readfile(temp, '', 2), "\n") - if first =~# '\<\([[:upper:][:digit:]_-]\+(\d\+)\).*\1' - let filetype = 'man' - else - let filetype = 'git' - endif - let s:temp_files[s:cpath(temp)] = { 'dir': options.dir, 'filetype': filetype } - if a:cmd ==# 'edit' - call s:BlurStatus() - endif - silent execute s:Mods(a:mods) . a:cmd temp - call fugitive#ReloadStatus(options.dir, 1) - return 'echo ' . string(':!' . s:UserCommand(options, a:args)) -endfunction - +let s:bang_edits = {'split': 'Git', 'vsplit': 'vert Git', 'tabedit': 'tab Git', 'pedit': 'Git!'} function! fugitive#Open(cmd, bang, mods, arg, args) abort + exe s:VersionCheck() if a:bang - return s:OpenExec(a:cmd, a:mods, {}, s:SplitExpand(a:arg, s:Tree())) + return 'echoerr ' . string(':G' . a:cmd . '! for temp buffer output has been replaced by :' . get(s:bang_edits, a:cmd, 'Git') . ' --paginate') endif let mods = s:Mods(a:mods) try - let [file, pre] = s:OpenParse(a:args, 1) + let [file, pre] = s:OpenParse(a:arg, 1) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry - if file !~# '^\a\a\+:' - let file = s:sub(file, '/$', '') + if file !~# '^\a\a\+:' && !(has('win32') && file =~# '^\a:/$') + let file = substitute(file, '.\zs' . (has('win32') ? '[\/]' : '/') . '$', '', '') endif if a:cmd ==# 'edit' call s:BlurStatus() @@ -4585,7 +5020,7 @@ function! s:ReadPrepare(line1, count, range, mods) abort else let pre = '' endif - return [pre . mods . after . 'read', delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '')] + return [pre . 'keepalt ' . mods . after . 'read', delete . 'diffupdate' . (a:count < 0 ? '|' . line('.') : '')] endfunction function! s:ReadExec(line1, count, range, mods, env, args, options) abort @@ -4598,19 +5033,18 @@ function! s:ReadExec(line1, count, range, mods, env, args, options) abort endfunction function! fugitive#ReadCommand(line1, count, range, bang, mods, arg, args) abort + exe s:VersionCheck() if a:bang - let dir = s:Dir() - let args = s:SplitExpand(a:arg, s:Tree(dir)) - return s:ReadExec(a:line1, a:count, a:range, a:mods, {}, args, {'dir': dir}) + return 'echoerr ' . string(':Gread! for temp buffer output has been replaced by :{range}Git! --paginate') endif let [read, post] = s:ReadPrepare(a:line1, a:count, a:range, a:mods) try - let [file, pre] = s:OpenParse(a:args, 0) + let [file, pre] = s:OpenParse(a:arg, 0) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry if file =~# '^fugitive:' && a:count is# 0 - return 'exe ' .string(s:Mods(a:mods) . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate' + return 'exe ' .string('keepalt ' . s:Mods(a:mods) . fugitive#FileReadCmd(file, 0, pre)) . '|diffupdate' endif return read . ' ' . pre . ' ' . s:fnameescape(file) . '|' . post endfunction @@ -4634,17 +5068,23 @@ endfunction " Section: :Gwrite, :Gwq function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abort - if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) + exe s:VersionCheck() + if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) && empty(a:arg) return (empty($GIT_INDEX_FILE) ? 'write|bdelete' : 'wq') . (a:bang ? '!' : '') - elseif get(b:, 'fugitive_type', '') ==# 'index' + elseif get(b:, 'fugitive_type', '') ==# 'index' && empty(a:arg) return 'Git commit' elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} ' return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit') endif let mytab = tabpagenr() let mybufnr = bufnr('') + let args = s:ArgSplit(a:arg) + let after = '' + if get(args, 0) =~# '^+' + let after = '|' . remove(args, 0)[1:-1] + endif try - let file = len(a:args) ? s:Generate(s:Expand(join(a:args, ' '))) : fugitive#Real(@%) + let file = len(args) ? s:Generate(s:Expand(join(args, ' '))) : fugitive#Real(@%) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -4717,9 +5157,9 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor setlocal nomodified endif - let one = s:Generate(':1:'.file) - let two = s:Generate(':2:'.file) - let three = s:Generate(':3:'.file) + let one = fugitive#Find(':1:'.file) + let two = fugitive#Find(':2:'.file) + let three = fugitive#Find(':3:'.file) for nr in range(1,bufnr('$')) let name = fnamemodify(bufname(nr), ':p') if bufloaded(nr) && !getbufvar(nr,'&modified') && (name ==# one || name ==# two || name ==# three) @@ -4728,7 +5168,7 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor endfor unlet! restorewinnr - let zero = s:Generate(':0:'.file) + let zero = fugitive#Find(':0:'.file) silent exe s:DoAutocmd('BufWritePost ' . s:fnameescape(zero)) for tab in range(1,tabpagenr('$')) for winnr in range(1,tabpagewinnr(tab,'$')) @@ -4759,7 +5199,7 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor endfor endfor call fugitive#ReloadStatus(-1, 1) - return 'checktime' + return 'silent checktime' . after endfunction function! fugitive#WqCommand(...) abort @@ -4785,45 +5225,6 @@ function! fugitive#FetchComplete(A, L, P, ...) abort return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'), a:000) endfunction -function! s:Dispatch(bang, options) abort - let dir = a:options.dir - exe s:DirCheck(dir) - let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] - try - let b:current_compiler = 'git' - let &l:errorformat = s:common_efm . - \ ',%\&git_dir=' . escape(substitute(dir, '%', '%%', 'g'), '\,') - let &l:makeprg = s:UserCommand({'git': a:options.git, 'dir': dir}, s:AskPassArgs(dir) + a:options.flags + [a:options.command] + a:options.args) - if exists(':Make') == 2 - Make - return '' - else - if !has('patch-8.1.0334') && has('terminal') && &autowrite - let autowrite_was_set = 1 - set noautowrite - silent! wall - endif - silent noautocmd make! - redraw! - return 'call fugitive#Cwindow()|silent ' . s:DoAutocmd('ShellCmdPost') - endif - finally - let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc] - if empty(cc) | unlet! b:current_compiler | endif - if exists('autowrite_was_set') - set autowrite - endif - endtry -endfunction - -function! s:PushSubcommand(line1, line2, range, bang, mods, options) abort - return s:Dispatch(a:bang ? '!' : '', a:options) -endfunction - -function! s:FetchSubcommand(line1, line2, range, bang, mods, options) abort - return s:Dispatch(a:bang ? '!' : '', a:options) -endfunction - " Section: :Gdiff augroup fugitive_diff @@ -4944,7 +5345,8 @@ function! s:IsConflicted() abort endfunction function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort - let args = copy(a:args) + exe s:VersionCheck() + let args = s:ArgSplit(a:arg) let post = '' if get(args, 0) =~# '^+' let post = remove(args, 0)[1:-1] @@ -4963,12 +5365,12 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort let back = exists('*win_getid') ? 'call win_gotoid(' . win_getid() . ')' : 'wincmd p' if (empty(args) || args[0] ==# ':') && a:keepfocus exe s:DirCheck() - if empty(commit) && s:IsConflicted() + if commit =~# '^1\=$' && s:IsConflicted() let parents = [s:Relative(':2:'), s:Relative(':3:')] elseif empty(commit) let parents = [s:Relative(':0:')] elseif commit =~# '^\d\=$' - let parents = [s:Relative('HEAD:')] + let parents = [s:Relative('@:')] elseif commit =~# '^\x\x\+$' let parents = s:LinesError(['rev-parse', commit . '^@'])[0] call map(parents, 's:Relative(v:val . ":")') @@ -4979,7 +5381,7 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort exe pre let mods = (a:autodir ? s:diff_modifier(len(parents) + 1) : '') . s:Mods(mods, 'leftabove') let nr = bufnr('') - execute mods 'split' s:fnameescape(s:Generate(parents[0])) + execute mods 'split' s:fnameescape(fugitive#Find(parents[0])) call s:Map('n', 'dp', ':diffput '.nr.'diffupdate', '') let nr2 = bufnr('') call s:diffthis() @@ -4987,7 +5389,7 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort call s:Map('n', 'd2o', ':diffget '.nr2.'diffupdate', '') let mods = substitute(mods, '\Cleftabove\|rightbelow\|aboveleft\|belowright', '\=submatch(0) =~# "f" ? "rightbelow" : "leftabove"', '') for i in range(len(parents)-1, 1, -1) - execute mods 'split' s:fnameescape(s:Generate(parents[i])) + execute mods 'split' s:fnameescape(fugitive#Find(parents[i])) call s:Map('n', 'dp', ':diffput '.nr.'diffupdate', '') let nrx = bufnr('') call s:diffthis() @@ -5069,7 +5471,7 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort endtry endfunction -" Section: :Gmove, :Gremove +" Section: :GMove, :GRemove function! s:Move(force, rename, destination) abort let dir = s:Dir() @@ -5187,7 +5589,7 @@ endfunction function! s:BlameBufnr(...) abort let state = s:TempState(bufname(a:0 ? a:1 : '')) if get(state, 'filetype', '') ==# 'fugitiveblame' - return get(state, 'bufnr', -1) + return get(state, 'origin_bufnr', -1) else return -1 endif @@ -5195,7 +5597,10 @@ endfunction function! s:BlameCommitFileLnum(...) abort let line = a:0 ? a:1 : getline('.') - let state = a:0 ? a:2 : s:TempState() + let state = a:0 > 1 ? a:2 : s:TempState() + if get(state, 'filetype', '') !=# 'fugitiveblame' + return ['', '', 0] + endif let commit = matchstr(line, '^\^\=[?*]*\zs\x\+') if commit =~# '^0\+$' let commit = '' @@ -5238,7 +5643,7 @@ endfunction function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort let dir = s:Dir() exe s:DirCheck(dir) - let flags = copy(a:options.args) + let flags = copy(a:options.subcommand_args) let i = 0 let raw = 0 let commits = [] @@ -5311,33 +5716,32 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort endif exe s:BlameLeave() try - let cmd = a:options.flags + ['--no-pager', '-c', 'blame.coloring=none', '-c', 'blame.blankBoundary=false', a:options.command, '--show-number'] + let cmd = a:options.flags + ['--no-pager', '-c', 'blame.coloring=none', '-c', 'blame.blankBoundary=false', a:options.subcommand, '--show-number'] call extend(cmd, filter(copy(flags), 'v:val !~# "\\v^%(-b|--%(no-)=color-.*|--progress)$"')) if a:count > 0 && empty(ranges) let cmd += ['-L', (a:line1 ? a:line1 : line('.')) . ',' . (a:line1 ? a:line1 : line('.'))] endif call extend(cmd, ranges) + let tempname = tempname() + let temp = tempname . (raw ? '' : '.fugitiveblame') if len(commits) let cmd += commits elseif empty(files) && len(matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$')) let cmd += [matchstr(s:DirCommitFile(@%)[1], '^\x\x\+$')] elseif empty(files) && !s:HasOpt(flags, '--reverse') - let cmd += ['--contents', '-'] + let cmd += ['--contents', tempname . '.in'] + silent execute 'noautocmd keepalt %write ' . s:fnameescape(tempname . '.in') + let delete_in = 1 endif - let basecmd = escape(s:UserCommand({'git': a:options.git, 'dir': dir}, cmd + ['--'] + (len(files) ? files : [file])), '!#%') - let tempname = tempname() - let error = tempname . '.err' - let temp = tempname . (raw ? '' : '.fugitiveblame') - if &shell =~# 'csh' - silent! execute '%write !('.basecmd.' > '.temp.') >& '.error - else - silent! execute '%write !'.basecmd.' > '.temp.' 2> '.error + let basecmd = [{'git': a:options.git, 'dir': dir}] + ['--literal-pathspecs'] + cmd + ['--'] + (len(files) ? files : [file]) + let [err, exec_error] = s:TempCmd(temp, basecmd) + if exists('delete_in') + call delete(tempname . '.in') endif - let l:shell_error = v:shell_error redraw try - if l:shell_error - let lines = readfile(error) + if exec_error + let lines = split(err, "\n") if empty(lines) let lines = readfile(temp) endif @@ -5356,7 +5760,17 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort endfor return '' endif - let temp_state = {'dir': dir, 'filetype': (raw ? '' : 'fugitiveblame'), 'options': a:options, 'blame_flags': flags, 'blame_file': file} + let temp_state = { + \ 'git': a:options.git, + \ 'flags': a:options.flags, + \ 'args': [a:options.subcommand] + a:options.subcommand_args, + \ 'dir': dir, + \ 'git_dir': dir, + \ 'cwd': s:UserCommandCwd(dir), + \ 'filetype': (raw ? 'git' : 'fugitiveblame'), + \ 'blame_options': a:options, + \ 'blame_flags': flags, + \ 'blame_file': file} if s:HasOpt(flags, '--reverse') let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*') endif @@ -5365,23 +5779,25 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort return s:BlameCommit(edit, get(readfile(temp), 0, ''), temp_state) else let temp = s:Resolve(temp) - let s:temp_files[s:cpath(temp)] = temp_state + let temp_state.file = temp + call s:RunSave(temp_state) if len(ranges + commits + files) || raw + let reload = '|call fugitive#ReloadStatus(fugitive#Result(' . string(temp_state.file) . '), 1)' let mods = s:Mods(a:mods) if a:count != 0 exe 'silent keepalt' mods 'split' s:fnameescape(temp) elseif !&modified || a:bang || &bufhidden ==# 'hide' || (empty(&bufhidden) && &hidden) exe 'silent' mods 'edit' . (a:bang ? '! ' : ' ') . s:fnameescape(temp) else - return mods . 'edit ' . s:fnameescape(temp) + return mods . 'edit ' . s:fnameescape(temp) . reload endif - return '' + return reload[1 : -1] endif if a:mods =~# '\' silent tabedit % endif let bufnr = bufnr('') - let temp_state.bufnr = bufnr + let temp_state.origin_bufnr = bufnr let restore = [] let mods = substitute(a:mods, '\', '', 'g') for winnr in range(winnr('$'),1,-1) @@ -5434,12 +5850,13 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort if exists('+signcolumn') setlocal signcolumn=no endif - execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) + execute "vertical resize ".(s:linechars('.\{-\}\s\+\d\+\ze)')+1) call s:Map('n', 'A', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)", '') call s:Map('n', 'C', ":exe 'vertical resize '.(linechars('^\\S\\+')+1+v:count)", '') call s:Map('n', 'D', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)", '') redraw syncbind + exe s:DoAutocmdChanged(temp_state) endif endtry return '' @@ -5510,7 +5927,7 @@ function! s:BlameJump(suffix, ...) abort return 'echoerr ' . string('fugitive: could not determine filename for blame') endif if commit =~# '^0*$' - let commit = 'HEAD' + let commit = '@' let suffix = '' endif let offset = line('.') - line('w0') @@ -5537,10 +5954,10 @@ function! s:BlameJump(suffix, ...) abort let my_bufnr = bufnr('') if blame_bufnr < 0 let blame_args = flags + [commit . suffix, '--', path] - let result = s:BlameSubcommand(0, 0, 0, 0, '', extend({'args': blame_args}, state.options, 'keep')) + let result = s:BlameSubcommand(0, 0, 0, 0, '', extend({'subcommand_args': blame_args}, state.blame_options, 'keep')) else let blame_args = flags - let result = s:BlameSubcommand(-1, -1, 0, 0, '', extend({'args': blame_args}, state.options, 'keep')) + let result = s:BlameSubcommand(-1, -1, 0, 0, '', extend({'subcommand_args': blame_args}, state.blame_options, 'keep')) endif if bufnr('') == my_bufnr return result @@ -5567,7 +5984,6 @@ function! fugitive#BlameSyntax() abort syn spell notoplevel syn match FugitiveblameBlank "^\s\+\s\@=" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalFile,FugitiveblameOriginalLineNumber skipwhite syn match FugitiveblameHash "\%(^\^\=[?*]*\)\@<=\<\x\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite - syn match FugitiveblameUncommitted "\%(^\^\=\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite if s:HasOpt(flags, '-b') || FugitiveConfigGet('blame.blankBoundary') =~# '^1$\|^true$' syn match FugitiveblameBoundaryIgnore "^\^[*?]*\x\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite else @@ -5576,7 +5992,7 @@ function! fugitive#BlameSyntax() abort syn match FugitiveblameScoreDebug " *\d\+\s\+\d\+\s\@=" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile contained skipwhite syn region FugitiveblameAnnotation matchgroup=FugitiveblameDelimiter start="(" end="\%(\s\d\+\)\@<=)" contained keepend oneline syn match FugitiveblameTime "\<[0-9:/+-][0-9:/+ -]*[0-9:/+-]\%(\s\+\d\+)\)\@=" contained containedin=FugitiveblameAnnotation - exec 'syn match FugitiveblameLineNumber "\s*\d\+)\@=" contained containedin=FugitiveblameAnnotation' conceal + exec 'syn match FugitiveblameLineNumber "\s[[:digit:][:space:]]\{0,' . (len(line('$'))-1). '\}\d)\@=" contained containedin=FugitiveblameAnnotation' conceal exec 'syn match FugitiveblameOriginalFile "\s\%(\f\+\D\@<=\|\D\@=\f\+\)\%(\%(\s\+\d\+\)\=\s\%((\|\s*\d\+)\)\)\@=" contained nextgroup=FugitiveblameOriginalLineNumber,FugitiveblameAnnotation skipwhite' (s:HasOpt(flags, '--show-name', '-f') ? '' : conceal) exec 'syn match FugitiveblameOriginalLineNumber "\s*\d\+\%(\s(\)\@=" contained nextgroup=FugitiveblameAnnotation skipwhite' (s:HasOpt(flags, '--show-number', '-n') ? '' : conceal) exec 'syn match FugitiveblameOriginalLineNumber "\s*\d\+\%(\s\+\d\+)\)\@=" contained nextgroup=FugitiveblameShort skipwhite' (s:HasOpt(flags, '--show-number', '-n') ? '' : conceal) @@ -5599,38 +6015,44 @@ function! fugitive#BlameSyntax() abort endif let seen = {} for lnum in range(1, line('$')) - let hash = matchstr(getline(lnum), '^\^\=\zs\x\{6\}') - if hash ==# '' || hash ==# '000000' || has_key(seen, hash) + let orig_hash = matchstr(getline(lnum), '^\^\=[*?]*\zs\x\{6\}') + let hash = orig_hash + let hash = substitute(hash, '\(\x\)\x', '\=submatch(1).printf("%x", 15-str2nr(submatch(1),16))', 'g') + let hash = substitute(hash, '\(\x\x\)', '\=printf("%02x", str2nr(submatch(1),16)*3/4+32)', 'g') + if hash ==# '' || orig_hash ==# '000000' || has_key(seen, hash) continue endif let seen[hash] = 1 - if &t_Co > 16 && get(g:, 'CSApprox_loaded') && !empty(findfile('autoload/csapprox/per_component.vim', escape(&rtp, ' '))) - \ && empty(get(s:hash_colors, hash)) - let [s, r, g, b; __] = map(matchlist(hash, '\(\x\x\)\(\x\x\)\(\x\x\)'), 'str2nr(v:val,16)') - let color = csapprox#per_component#Approximate(r, g, b) - if color == 16 && &background ==# 'dark' - let color = 8 + if &t_Co == 256 + let [s, r, g, b; __] = map(matchlist(orig_hash, '\(\x\)\x\(\x\)\x\(\x\)\x'), 'str2nr(v:val,16)') + let color = 16 + (r + 1) / 3 * 36 + (g + 1) / 3 * 6 + (b + 1) / 3 + if color == 16 + let color = 235 + elseif color == 231 + let color = 255 endif let s:hash_colors[hash] = ' ctermfg='.color else let s:hash_colors[hash] = '' endif - exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=\)\@<='.hash.'\x\{1,34\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite' + let pattern = substitute(orig_hash, '^\(\x\)\x\(\x\)\x\(\x\)\x$', '\1\\x\2\\x\3\\x', '') . '*\>' + exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=[*?]*\)\@<='.pattern.'" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite' endfor + syn match FugitiveblameUncommitted "\%(^\^\=[?*]*\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite call s:BlameRehighlight() endfunction function! s:BlameRehighlight() abort for [hash, cterm] in items(s:hash_colors) if !empty(cterm) || has('gui_running') || has('termguicolors') && &termguicolors - exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '') + exe 'hi FugitiveblameHash'.hash.' guifg=#' . hash . cterm else exe 'hi link FugitiveblameHash'.hash.' Identifier' endif endfor endfunction -function! s:BlameFileType() abort +function! fugitive#BlameFileType() abort setlocal nomodeline setlocal foldmethod=manual if len(s:Dir()) @@ -5647,56 +6069,110 @@ function! s:BlameFileType() abort call s:Map('n', '', ':help :Git_blame', '') call s:Map('n', 'g?', ':help :Git_blame', '') if mapcheck('q', 'n') =~# '^$\|bdelete' - call s:Map('n', 'q', ':exe BlameQuit()echohl WarningMsgecho ":Git blame q is deprecated in favor of gq"echohl NONE', '') + call s:Map('n', 'q', 'echoerr "fugitive: q removed in favor of gq (or :q)"', '') endif call s:Map('n', 'gq', ':exe BlameQuit()', '') call s:Map('n', '<2-LeftMouse>', ':exe BlameCommit("exe BlameLeave()edit")', '') call s:Map('n', '', ':exe BlameCommit("exe BlameLeave()edit")', '') call s:Map('n', '-', ':exe BlameJump("")', '') + call s:Map('n', 's', ':exe BlameJump("")', '') + call s:Map('n', 'u', ':exe BlameJump("")', '') call s:Map('n', 'P', ':exe BlameJump("^".v:count1)', '') call s:Map('n', '~', ':exe BlameJump("~".v:count1)', '') call s:Map('n', 'i', ':exe BlameCommit("exe BlameLeave()edit")', '') call s:Map('n', 'o', ':exe BlameCommit("split")', '') call s:Map('n', 'O', ':exe BlameCommit("tabedit")', '') call s:Map('n', 'p', ':exe BlameCommit("pedit")', '') + call s:Map('n', '.', ": =substitute(BlameCommitFileLnum()[0],'^$','@','')") endfunction augroup fugitive_blame autocmd! - autocmd FileType fugitiveblame call s:BlameFileType() autocmd ColorScheme,GUIEnter * call s:BlameRehighlight() autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') augroup END -" Section: :Gbrowse +" Section: :GBrowse -let s:redirects = {} +function! s:BrowserOpen(url, mods, echo_copy) abort + let url = substitute(a:url, '[ <>\|"]', '\="%".printf("%02X",char2nr(submatch(0)))', 'g') + let mods = s:Mods(a:mods) + if a:echo_copy + if has('clipboard') + let @+ = url + endif + return 'echo '.string(url) + elseif exists(':Browse') == 2 + return 'echo '.string(url).'|' . mods . 'Browse '.url + elseif exists(':OpenBrowser') == 2 + return 'echo '.string(url).'|' . mods . 'OpenBrowser '.url + else + if !exists('g:loaded_netrw') + runtime! autoload/netrw.vim + endif + if exists('*netrw#BrowseX') + return 'echo '.string(url).'|' . mods . 'call netrw#BrowseX('.string(url).', 0)' + elseif exists('*netrw#NetrwBrowseX') + return 'echo '.string(url).'|' . mods . 'call netrw#NetrwBrowseX('.string(url).', 0)' + else + return 'echoerr ' . string('Netrw not found. Define your own :Browse to use :GBrowse') + endif + endif +endfunction function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abort + exe s:VersionCheck() let dir = s:Dir() - exe s:DirCheck(dir) try + let arg = a:arg + if arg =~# '^++remote=' + let remote = matchstr(arg, '^++remote=\zs\S\+') + let arg = matchstr(arg, '\s\zs\S.*') + endif let validremote = '\.\|\.\=/.*\|[[:alnum:]_-]\+\%(://.\{-\}\)\=' - if a:args ==# ['-'] - if a:count >= 0 - return 'echoerr ' . string('fugitive: ''-'' no longer required to get persistent URL if range given') - else - return 'echoerr ' . string('fugitive: use :0Gbrowse instead of :Gbrowse -') - endif - elseif len(a:args) - let remote = matchstr(join(a:args, ' '),'@\zs\%('.validremote.'\)$') - let rev = substitute(join(a:args, ' '),'@\%('.validremote.'\)$','','') - else + if arg ==# '-' let remote = '' let rev = '' - endif - if rev ==# '' - let rev = s:DirRev(@%)[1] - endif - if rev =~# '^:\=$' - let expanded = s:Relative() + let result = fugitive#Result() + if filereadable(get(result, 'file', '')) + for line in readfile(result.file, 4096) + let rev = s:fnameescape(matchstr(line, '\]*[^[:space:]<>.,;:"''!?]')) + if len(rev) + break + endif + endfor + if empty(rev) + return 'echoerr ' . string('fugitive: no URL found in output of last :Git') + endif + endif + elseif !exists('l:remote') + let remote = matchstr(arg, '@\zs\%('.validremote.'\)$') + let rev = substitute(arg, '@\%('.validremote.'\)$','','') else - let expanded = s:Expand(rev) + let rev = arg + endif + if rev =~? '^\a\a\+:[\/][\/]' && rev !~? '^fugitive:' + let rev = substitute(rev, '\\\@ 0 && bufname !=# bufname('') + let blame = s:BlameCommitFileLnum(getline(a:count)) + if len(blame[0]) + let expanded = blame[0] + endif + endif endif let cdir = FugitiveVimPath(fugitive#CommonDir(dir)) for subdir in ['tags/', 'heads/', 'remotes/'] @@ -5704,23 +6180,22 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let expanded = '.git/refs/' . subdir . expanded endif endfor - let full = fugitive#Find(expanded, dir) + let full = s:Generate(expanded, dir) let commit = '' if full =~? '^fugitive:' - let [pathdir, commit, path] = s:DirCommitFile(full) + let [dir, commit, path] = s:DirCommitFile(full) if commit =~# '^:\=\d$' let commit = '' endif if commit =~ '..' - let type = s:TreeChomp('cat-file','-t',commit.s:sub(path,'^/',':')) + let type = s:TreeChomp(['cat-file','-t',commit.s:sub(path,'^/',':')], dir) let branch = matchstr(expanded, '^[^:]*') + elseif empty(path) || path ==# '/' + let type = 'tree' else let type = 'blob' endif let path = path[1:-1] - elseif full =~? '^\a\a\+:[\/][\/]' - let path = s:Slash(full) - let type = 'url' elseif empty(s:Tree(dir)) let path = '.git/' . full[strlen(dir)+1:-1] let type = '' @@ -5760,16 +6235,16 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo elseif path =~# '^\.git/refs/heads/.' let branch = path[16:-1] elseif !exists('branch') - let branch = FugitiveHead() + let branch = FugitiveHead(0, dir) endif if !empty(branch) - let r = fugitive#Config('branch.'.branch.'.remote') - let m = fugitive#Config('branch.'.branch.'.merge')[11:-1] + let r = FugitiveConfigGet('branch.'.branch.'.remote', dir) + let m = FugitiveConfigGet('branch.'.branch.'.merge', dir)[11:-1] if r ==# '.' && !empty(m) - let r2 = fugitive#Config('branch.'.m.'.remote') + let r2 = FugitiveConfigGet('branch.'.m.'.remote', dir) if r2 !~# '^\.\=$' let r = r2 - let m = fugitive#Config('branch.'.m.'.merge')[11:-1] + let m = FugitiveConfigGet('branch.'.m.'.merge', dir)[11:-1] endif endif if empty(remote) @@ -5783,25 +6258,25 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo endif endif - let line1 = a:count > 0 ? a:line1 : 0 - let line2 = a:count > 0 ? a:count : 0 + let line1 = a:count > 0 && type ==# 'blob' ? a:line1 : 0 + let line2 = a:count > 0 && type ==# 'blob' ? a:count : 0 if empty(commit) && path !~# '^\.git/' if a:count < 0 && !empty(merge) let commit = merge else let commit = '' if len(merge) - let owner = s:Owner(@%) - let [commit, exec_error] = s:ChompError(['merge-base', 'refs/remotes/' . remote . '/' . merge, empty(owner) ? 'HEAD' : owner, '--']) + let owner = s:Owner(@%, dir) + let [commit, exec_error] = s:ChompError(['merge-base', 'refs/remotes/' . remote . '/' . merge, empty(owner) ? '@' : owner, '--'], dir) if exec_error let commit = '' endif - if a:count > 0 && empty(a:args) && commit =~# '^\x\{40,\}$' + if line2 > 0 && empty(arg) && commit =~# '^\x\{40,\}$' let blame_list = tempname() call writefile([commit, ''], blame_list, 'b') let blame_in = tempname() silent exe '%write' blame_in - let [blame, exec_error] = s:LinesError(['-c', 'blame.coloring=none', 'blame', '--contents', blame_in, '-L', a:line1.','.a:count, '-S', blame_list, '-s', '--show-number', './' . path]) + let [blame, exec_error] = s:LinesError(['-c', 'blame.coloring=none', 'blame', '--contents', blame_in, '-L', line1.','.line2, '-S', blame_list, '-s', '--show-number', './' . path], dir) if !exec_error let blame_regex = '^\^\x\+\s\+\zs\d\+\ze\s' if get(blame, 0) =~# blame_regex && get(blame, -1) =~# blame_regex @@ -5832,23 +6307,13 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo if empty(remote) let remote = '.' endif - let raw = fugitive#RemoteUrl(remote) + let raw = fugitive#RemoteUrl(remote, dir) if empty(raw) let raw = remote endif - if raw =~# '^https\=://' && s:executable('curl') - if !has_key(s:redirects, raw) - let s:redirects[raw] = matchstr(system('curl -I ' . - \ s:shellesc(raw . '/info/refs?service=git-upload-pack')), - \ 'Location: \zs\S\+\ze/info/refs?') - endif - if len(s:redirects[raw]) - let raw = s:redirects[raw] - endif - endif - let opts = { + \ 'git_dir': dir, \ 'dir': dir, \ 'repo': fugitive#repo(dir), \ 'remote': raw, @@ -5859,40 +6324,19 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo \ 'line1': line1, \ 'line2': line2} - if type ==# 'url' - let url = path - else - let url = '' - for Handler in get(g:, 'fugitive_browse_handlers', []) - let url = call(Handler, [copy(opts)]) - if !empty(url) - break - endif - endfor - endif + let url = '' + for Handler in get(g:, 'fugitive_browse_handlers', []) + let url = call(Handler, [copy(opts)]) + if !empty(url) + break + endif + endfor if empty(url) - call s:throw("No Gbrowse handler installed for '".raw."'") + call s:throw("No GBrowse handler installed for '".raw."'") endif - let url = s:gsub(url, '[ <>]', '\="%".printf("%02X",char2nr(submatch(0)))') - if a:bang - if has('clipboard') - let @+ = url - endif - return 'echomsg '.string(url) - elseif exists(':Browse') == 2 - return 'echomsg '.string(url).'|Browse '.url - else - if !exists('g:loaded_netrw') - runtime! autoload/netrw.vim - endif - if exists('*netrw#BrowseX') - return 'echomsg '.string(url).'|call netrw#BrowseX('.string(url).', 0)' - else - return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' - endif - endif + return s:BrowserOpen(url, a:mods, a:bang) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -5917,7 +6361,7 @@ endfunction function! s:ContainingCommit() abort let commit = s:Owner(@%) - return empty(commit) ? 'HEAD' : commit + return empty(commit) ? '@' : commit endfunction function! s:SquashArgument(...) abort @@ -5944,7 +6388,7 @@ function! s:NavigateUp(count) abort elseif rev =~# '.:.' let rev = matchstr(rev, '^.[^:]*:') elseif rev =~# '^:' - let rev = 'HEAD^{}' + let rev = '@^{}' elseif rev =~# ':$' let rev = rev[0:-2] else @@ -5972,7 +6416,7 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'gO', ':0,4' . blame_map, '') call s:Map('n', 'O', ':0,5' . blame_map, '') - call s:Map('n', 'D', ":call fugitive#DiffClose()Gdiffsplit!redrawechohl WarningMsg echo ':Gstatus D is deprecated in favor of dd'echohl NONE", '') + call s:Map('n', 'D', ":echoerr 'fugitive: D has been removed in favor of dd'", '') call s:Map('n', 'dd', ":call fugitive#DiffClose()Gdiffsplit!", '') call s:Map('n', 'dh', ":call fugitive#DiffClose()Ghdiffsplit!", '') call s:Map('n', 'ds', ":call fugitive#DiffClose()Ghdiffsplit!", '') @@ -6068,7 +6512,7 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'co', ':Git checkout') call s:Map('n', 'co', ':Git checkout') - call s:Map('n', 'coo', ':Git checkout =SquashArgument() --') + call s:Map('n', 'coo', ':Git checkout =substitute(SquashArgument(),"^$",get(TempState(),"filetype","") ==# "git" ? expand("") : "","") --') call s:Map('n', 'co?', ':help fugitive_co', '') call s:Map('n', 'cb', ':Git branch') @@ -6097,10 +6541,31 @@ function! fugitive#MapJumps(...) abort call s:Map('n', 'g?', ":help fugitive-map", '') call s:Map('n', '', ":help fugitive-map", '') endif + + let old_browsex = maparg('NetrwBrowseX', 'n') + let new_browsex = substitute(old_browsex, '\Cnetrw#CheckIfRemote(\%(netrw#GX()\)\=)', '0', 'g') + let new_browsex = substitute(new_browsex, 'netrw#GX()\|expand((exists("g:netrw_gx")? g:netrw_gx : ''''))', 'fugitive#GX()', 'g') + if new_browsex !=# old_browsex + exe 'nnoremap NetrwBrowseX' new_browsex + endif +endfunction + +function! fugitive#GX() abort + try + let results = &filetype ==# 'fugitive' ? s:StatusCfile() : &filetype ==# 'git' ? s:cfile() : [] + if len(results) && len(results[0]) + return FugitiveReal(s:Generate(results[0])) + endif + catch /^fugitive:/ + endtry + return expand(get(g:, 'netrw_gx', expand(''))) endfunction function! s:StatusCfile(...) abort let tree = s:Tree() + if empty(tree) + return [''] + endif let lead = s:cpath(tree, getcwd()) ? './' : tree . '/' let info = s:StageInfo() let line = getline('.') @@ -6124,12 +6589,15 @@ function! s:StatusCfile(...) abort endfunction function! fugitive#StatusCfile() abort - let file = s:Generate(s:StatusCfile()[0]) + let file = fugitive#Find(s:StatusCfile()[0]) return empty(file) ? fugitive#Cfile() : s:fnameescape(file) endfunction function! s:MessageCfile(...) abort let tree = s:Tree() + if empty(tree) + return '' + endif let lead = s:cpath(tree, getcwd()) ? './' : tree . '/' if getline('.') =~# '^.\=\trenamed:.* -> ' return lead . matchstr(getline('.'),' -> \zs.*') @@ -6151,11 +6619,14 @@ function! s:MessageCfile(...) abort endfunction function! fugitive#MessageCfile() abort - let file = s:Generate(s:MessageCfile()) + let file = fugitive#Find(s:MessageCfile()) return empty(file) ? fugitive#Cfile() : s:fnameescape(file) endfunction function! s:cfile() abort + if empty(FugitiveGitDir()) + return [] + endif try let myhash = s:DirRev(@%)[1] if len(myhash) @@ -6165,8 +6636,15 @@ function! s:cfile() abort let myhash = '' endtry endif - if empty(myhash) && getline(1) =~# '^\%(commit\|tag\) \w' - let myhash = matchstr(getline(1),'^\w\+ \zs\S\+') + if empty(myhash) && get(s:TempState(), 'filetype', '') ==# 'git' + let lnum = line('.') + while lnum > 0 + if getline(lnum) =~# '^\%(commit\|tag\) \w' + let myhash = matchstr(getline(lnum),'^\w\+ \zs\S\+') + break + endif + let lnum -= 1 + endwhile endif let showtree = (getline(1) =~# '^tree ' && getline(2) == "") @@ -6288,9 +6766,9 @@ function! s:cfile() abort let prefixes.a = myhash.'^:' let prefixes.b = myhash.':' endif - let ref = substitute(ref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '') + let ref = substitute(ref, '^\(\w\)/', '\=get(prefixes, submatch(1), "@:")', '') if exists('dref') - let dref = substitute(dref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '') + let dref = substitute(dref, '^\(\w\)/', '\=get(prefixes, submatch(1), "@:")', '') endif if ref ==# '/dev/null' @@ -6402,9 +6880,11 @@ function! fugitive#Foldtext() abort if exists('binary') return 'Binary: '.filename else - return (add<10&&remove<100?' ':'') . add . '+ ' . (remove<10&&add<100?' ':'') . remove . '- ' . filename + return '+-' . v:folddashes . ' ' . (add<10&&remove<100?' ':'') . add . '+ ' . (remove<10&&add<100?' ':'') . remove . '- ' . filename endif - elseif line_foldstart =~# '^# .*:$' + elseif line_foldstart =~# '^@@\+ .* @@' + return '+-' . v:folddashes . ' ' . line_foldstart + elseif &filetype ==# 'gitcommit' && line_foldstart =~# '^# .*:$' let lines = getline(v:foldstart, v:foldend) call filter(lines, 'v:val =~# "^#\t"') cal map(lines, "s:sub(v:val, '^#\t%(modified: +|renamed: +)=', '')") diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index 3448c672..efa2d774 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -59,6 +59,12 @@ that are part of Git repositories). ~ reblame at [count]th first grandparent P reblame at [count]th parent (like HEAD^[count]) + *g:fugitive_dynamic_colors* + In the GUI or a 256 color terminal, commit hashes will + highlighted in different colors. To disable this: +> + let g:fugitive_dynamic_colors = 0 +< :[range]Git blame [...] If a range is given, just that part of the file will :Git blame [...] {file} be blamed, and a horizontal split without scrollbinding is used. You can also give an arbitrary @@ -78,15 +84,6 @@ that are part of Git repositories). *:Git_mergetool* :Git mergetool [args] Like |:Git_difftool|, but target merge conflicts. - *:Git_push* -:Git push [args] Invoke git-push, load the results into the |quickfix| - list, and invoke |:cwindow| to reveal any errors. - |:Dispatch| is used if available for asynchronous - invocation. - - *:Git_fetch* -:Git fetch [args] Like |:Git_push|, but for git-fetch. - *:Ggrep* *:Gcgrep* *:Git_grep* :Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'. :Git[!] grep [args] @@ -100,8 +97,9 @@ that are part of Git repositories). |quickfix| list. Jumps to the first commit unless [!] is given. - The quickfix list can be slow and awkward for many use - cases. Consider using |:Git| log instead. + The quickfix list can be awkward for many use cases + and exhibits extremely poor performance with larger + data sets. Consider using |:Git| log instead. :{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given range of the current file into the |quickfix| list. @@ -214,9 +212,6 @@ that are part of Git repositories). *:GBrowse* :GBrowse Open the current file, blob, tree, commit, or tag in your browser at the upstream hosting provider. - If a range is given, it is appropriately appended to - the URL as an anchor. - Upstream providers can be added by installing an appropriate Vim plugin. For example, GitHub can be supported by installing rhubarb.vim, available at @@ -224,16 +219,18 @@ that are part of Git repositories). :GBrowse {object} Like :GBrowse, but for a given |fugitive-object|. -:GBrowse [...]@{remote} Force using the given remote rather than the remote - for the current branch. The remote is used to - determine which upstream repository to link to. - :{range}GBrowse [args] Appends an anchor to the URL that emphasizes the selected lines. This also forces the URL to include a commit rather than a branch name so it remains valid if the file changes. You can give a range of "0" to force this behavior without including an anchor. +:GBrowse [...]@{remote} Force using the given remote rather than the remote + for the current branch. The remote is used to + determine which upstream repository to link to. + +:GBrowse {url} Open an arbitrary URL in your browser. + :[range]GBrowse! [args] Like :GBrowse, but put the URL on the clipboard rather than opening it. @@ -263,10 +260,9 @@ U Unstage everything. X Discard the change under the cursor. This uses `checkout` or `clean` under the hood. A command is echoed that shows how to undo the change. Consult - `:messages` to see it again. You can use this during - a merge conflict do discard "our" changes (--theirs) - in the "Unstaged" section or discard "their" changes - (--ours) in the "Staged" section. + `:messages` to see it again. During a merge conflict, + use 2X to call `checkout --ours` or 3X to call + `checkout --theirs` . *fugitive_=* = Toggle an inline diff of the file under the cursor. @@ -313,7 +309,7 @@ Navigation maps ~ *fugitive_* Open the file or |fugitive-object| under the cursor. - in a blob, this and similar maps jump to the patch + In a blob, this and similar maps jump to the patch from the diff where this was added, or where it was removed if a count was given. If the line is still in the work tree version, passing a count takes you to @@ -592,7 +588,9 @@ Makefile The file named Makefile in the work tree !:Makefile The file named Makefile in the commit owning the current file !3^2 The second parent of the commit owning buffer #3 .git/config The repo config file -: The |fugitive-summary| buffer. +: The |fugitive-summary| buffer +- A temp file containing the last |:Git| invocation's output + The file or commit under the cursor STATUSLINE *fugitive-statusline* @@ -632,8 +630,8 @@ just one space character longer than the legacy version. *:Gpull* Superseded by |:Git| pull. *:Grebase* Superseded by |:Git| rebase. *:Grevert* Superseded by |:Git| revert. -*:Gpush* Superseded by |:Git_push|. -*:Gfetch* Superseded by |:Git_fetch|. +*:Gpush* Superseded by |:Git| push. +*:Gfetch* Superseded by |:Git| fetch. *:Glog* Superseded by |:Gclog|. *:Gstatus* Superseded by |:Git| (with no arguments). *:Git!* Superseded by |:Git_--paginate|. diff --git a/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim b/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim new file mode 100644 index 00000000..6fe0a14d --- /dev/null +++ b/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim @@ -0,0 +1,6 @@ +if exists("b:did_ftplugin") || !exists('*fugitive#BlameFileType') + finish +endif +let b:did_ftplugin = 1 + +call fugitive#BlameFileType() diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index edb81e5e..e19ac7e2 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: 3.2 +" Version: 3.3 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') @@ -8,20 +8,33 @@ if exists('g:loaded_fugitive') endif let g:loaded_fugitive = 1 +let s:bad_git_dir = '/$\|^fugitive:' + function! FugitiveGitDir(...) abort - if !a:0 || type(a:1) == type(0) && a:1 < 0 + if v:version < 704 + return '' + elseif !a:0 || type(a:1) == type(0) && a:1 < 0 if exists('g:fugitive_event') return g:fugitive_event endif let dir = get(b:, 'git_dir', '') if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$') return FugitiveExtractGitDir(getcwd()) + elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype) + let b:git_dir = FugitiveExtractGitDir(expand('%:p')) + return b:git_dir endif - return dir + return dir =~# s:bad_git_dir ? '' : dir elseif type(a:1) == type(0) - return getbufvar(a:1, 'git_dir') + if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype) + let b:git_dir = FugitiveExtractGitDir(expand('%:p')) + endif + let dir = getbufvar(a:1, 'git_dir') + return dir =~# s:bad_git_dir ? '' : dir elseif type(a:1) == type('') return substitute(s:Slash(a:1), '/$', '', '') + elseif type(a:1) == type({}) + return get(a:1, 'git_dir', '') else return '' endif @@ -81,6 +94,22 @@ function! FugitiveParse(...) abort throw v:errmsg endfunction +" FugitiveResult() returns an object encapsulating the result of the most +" recend :Git command. Will be empty if no result is available. Pass in the +" name of a temp buffer to get the result object for that command instead. +" Contains the following keys: +" +" * "args": List of command arguments, starting with the subcommand. Will be +" empty for usages like :Git --help. +" * "dir": Git dir of the relevant repository. +" * "exit_status": The integer exit code of the process. +" * "flags": Flags passed directly to Git, like -c and --help. +" * "file": Path to file containing command output. Not guaranteed to exist, +" so verify with filereadable() before trying to access it. +function! FugitiveResult(...) abort + return call('fugitive#Result', a:000) +endfunction + " FugitivePrepare() constructs a Git command string which can be executed with " functions like system() and commands like :!. Integer arguments will be " treated as buffer numbers, and the appropriate relative path inserted in @@ -93,26 +122,32 @@ function! FugitivePrepare(...) abort return call('fugitive#Prepare', a:000) endfunction +" FugitiveConfig() get returns an opaque structure that can be passed to other +" FugitiveConfig functions in lieu of a Git directory. This can be faster +" when performing multiple config queries. Do not rely on the internal +" structure of the return value as it is not guaranteed. If you want a full +" dictionary of every config value, use FugitiveConfigGetRegexp('.*'). function! FugitiveConfig(...) abort - if a:0 == 2 && type(a:2) != type({}) + if a:0 == 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir')) return fugitive#Config(a:1, FugitiveGitDir(a:2)) - elseif a:0 == 1 && a:1 !~# '^[[:alnum:]-]\+\.' + elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.') return fugitive#Config(FugitiveGitDir(a:1)) else return call('fugitive#Config', a:000) endif endfunction -" Retrieve a Git configuration value. An optional second argument provides -" the Git dir as with FugitiveFind(). Pass a blank string to limit to the -" global config. +" FugitiveConfigGet() retrieves a Git configuration value. An optional second +" argument provides the Git dir as with FugitiveFind(). Pass a blank string +" to limit to the global config. function! FugitiveConfigGet(name, ...) abort return call('FugitiveConfig', [a:name] + a:000) endfunction -" Like FugitiveConfigGet(), but return a list of all values. +" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of +" all values. function! FugitiveConfigGetAll(name, ...) abort - if a:0 && type(a:1) ==# type({}) + if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir') let config = a:1 else let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) @@ -121,8 +156,32 @@ function! FugitiveConfigGetAll(name, ...) abort return copy(get(config, name, [])) endfunction +" FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values +" with a key matching the given pattern. Like git config --get-regexp, but +" using a Vim regexp. Second argument has same semantics as +" FugitiveConfigGet(). +function! FugitiveConfigGetRegexp(pattern, ...) abort + if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir') + let config = a:1 + else + let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) + endif + let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)') + if a:pattern !~# '\\\@ 1 ? a:2 : -1)) + return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1), a:0 > 2 ? a:3 : 0) endfunction function! FugitiveHead(...) abort @@ -134,7 +193,7 @@ function! FugitiveHead(...) abort endfunction function! FugitiveStatusline(...) abort - if !exists('b:git_dir') + if empty(get(b:, 'git_dir', '')) return '' endif return fugitive#Statusline() @@ -270,16 +329,16 @@ function! FugitiveExtractGitDir(path) abort endfunction function! FugitiveDetect(path) abort - if exists('b:git_dir') && b:git_dir =~# '^$\|/$\|^fugitive:' + if v:version < 704 + return '' + endif + if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir unlet b:git_dir endif if !exists('b:git_dir') - let dir = FugitiveExtractGitDir(a:path) - if dir !=# '' - let b:git_dir = dir - endif + let b:git_dir = FugitiveExtractGitDir(a:path) endif - if !exists('b:git_dir') || !exists('#User#Fugitive') + if empty(b:git_dir) || !exists('#User#Fugitive') return '' endif if v:version >= 704 || (v:version == 703 && has('patch442')) @@ -310,13 +369,15 @@ function! FugitiveGitPath(path) abort return s:Slash(a:path) endfunction -function! s:Slash(path) abort - if exists('+shellslash') +if exists('+shellslash') + function! s:Slash(path) abort return tr(a:path, '\', '/') - else + endfunction +else + function! s:Slash(path) abort return a:path - endif -endfunction + endfunction +endif function! s:ProjectionistDetect() abort let file = s:Slash(get(g:, 'projectionist_file', '')) @@ -336,9 +397,96 @@ function! s:ProjectionistDetect() abort endif endfunction -if v:version + has('patch061') < 703 - runtime! autoload/fugitive.vim +let s:addr_other = has('patch-8.1.560') ? '-addr=other' : '' +let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : '' +let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : '' + +if exists(':G') != 2 + command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", ) endif +command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", ) + +if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(, , +"", 0, "", )' + \ '|echohl WarningMSG|echo ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE' +endif + +for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame'] + if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd) + \ 'echohl WarningMSG|echo ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|' + \ 'exe fugitive#Command(, , +"", 0, "", "' . tolower(s:cmd) . ' " . )' + endif +endfor +unlet s:cmd + +exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(, 0)" +exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(, 1)" + +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(, , +"", 0, "", )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(, , +"", 0, "", )' +exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, > 0 ? : 0, +"", 0, "", )' + +if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(,,+"",0,"",, "")' + \ '|echohl WarningMSG|echo ":Glog is deprecated in favor of :Gclog"|echohl NONE' +endif +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(,,+"",0,"",, "c")' +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(,,+"",0,"",, "c")' +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(,,+"",0,"",, "l")' +exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(,,+"",0,"",, "l")' + +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit", 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit", 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", 0, "", , [])' +exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open(( > 0 ? : "").( ? "split" : "edit"), 0, "", , [])' +exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open(( > 0 ? : "").( ? "vsplit" : "edit!"), 0, "", , [])' +exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open(( >= 0 ? : "")."tabedit", 0, "", , [])' + +if exists(':Gr') != 2 + exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(, , +"", 0, "", , [])' +endif +exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(, , +"", 0, "", , [])' + +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, 0, "vert ", , [])' + +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( , , +"", 0, "", , [])' + +exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( , , +"", 0, "", , [])' +exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(, , +"", 0, "", , [])' +if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' + \ '|echohl WarningMSG|echo ":Gremove is deprecated in favor of :GRemove"|echohl NONE' +endif +if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' + \ '|echohl WarningMSG|echo ":Gdelete is deprecated in favor of :GDelete"|echohl NONE' +endif +if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( , , +"", 0, "", , [])' + \ '|echohl WarningMSG|echo ":Gmove is deprecated in favor of :GMove"|echohl NONE' +endif +if exists(':Grename') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(, , +"", 0, "", , [])' + \ '|echohl WarningMSG|echo ":Grename is deprecated in favor of :GRename"|echohl NONE' +endif + +exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' +if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1) + exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' + \ '|if 1|redraw!|endif|echohl WarningMSG|echo ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE' +endif + +if v:version < 704 + finish +endif + let g:io_fugitive = { \ 'simplify': function('fugitive#simplify'), \ 'resolve': function('fugitive#resolve'), @@ -363,27 +511,20 @@ augroup fugitive autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('')), ':p')) autocmd FileType git - \ if len(FugitiveGitDir()) | - \ call fugitive#MapJumps() | - \ call fugitive#MapCfile() | - \ endif + \ call fugitive#MapCfile() autocmd FileType gitcommit - \ if len(FugitiveGitDir()) | - \ call fugitive#MapCfile('fugitive#MessageCfile()') | - \ endif + \ call fugitive#MapCfile('fugitive#MessageCfile()') autocmd FileType git,gitcommit - \ if len(FugitiveGitDir()) && &foldtext ==# 'foldtext()' | + \ if &foldtext ==# 'foldtext()' | \ setlocal foldtext=fugitive#Foldtext() | \ endif autocmd FileType fugitive - \ if len(FugitiveGitDir()) | - \ call fugitive#MapCfile('fugitive#StatusCfile()') | - \ endif + \ call fugitive#MapCfile('fugitive#StatusCfile()') autocmd FileType gitrebase \ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' | - \ if len(FugitiveGitDir()) | - \ let &l:includeexpr = 'v:fname =~# ''^\x\{4,\}$'' ? FugitiveFind(v:fname) : ' . - \ (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') | + \ if &l:includeexpr !~# 'Fugitive' | + \ let &l:includeexpr = 'v:fname =~# ''^\x\{4,\}$'' && len(FugitiveGitDir()) ? FugitiveFind(v:fname) : ' . + \ (len(&l:includeexpr) ? &l:includeexpr : 'v:fname') | \ endif | \ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc=' @@ -416,81 +557,6 @@ augroup fugitive autocmd User ProjectionistDetect call s:ProjectionistDetect() augroup END -let s:addr_other = has('patch-8.1.560') ? '-addr=other' : '' -let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : '' -let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : '' - -if exists(':G') != 2 - command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(, , +"", 0, "", ) -endif -command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(, , +"", 0, "", ) - -if exists(':Gstatus') !=# 2 - exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(, , +"", 0, "", )' -endif - -for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame'] - if exists(':G' . tolower(s:cmd)) != 2 - exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd) 'exe fugitive#Command(, , +"", 0, "", "' . tolower(s:cmd) . ' " . )' - endif -endfor -unlet s:cmd - -exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(, 0)" -exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(, 1)" - -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(, , +"", 0, "", )' -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(, , +"", 0, "", )' -exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, > 0 ? : 0, +"", 0, "", )' - -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(,,+"",0,"",, "")' -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(,,+"",0,"",, "c")' -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(,,+"",0,"",, "c")' -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(,,+"",0,"",, "l")' -exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(,,+"",0,"",, "l")' - -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit", 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit", 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", 0, "", , [])' -exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open(( > 0 ? : "").( ? "split" : "edit"), 0, "", , [])' -exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open(( > 0 ? : "").( ? "vsplit" : "edit!"), 0, "", , [])' -exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open(( >= 0 ? : "")."tabedit", 0, "", , [])' - -if exists(':Gr') != 2 - exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(, , +"", 0, "", , [])' -endif -exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(, , +"", 0, "", , [])' - -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, 0, "vert ", , [])' - -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( , , +"", 0, "", , [])' - -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( , , +"", 0, "", , [])' -exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(, , +"", 0, "", , [])' -if exists(':Gremove') != 2 - exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(, , +"", 0, "", , [])' -endif -if exists(':Gdelete') != 2 - exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(, , +"", 0, "", , [])' -endif -if exists(':Gmove') != 2 - exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( , , +"", 0, "", , [])' -endif -if exists(':Grename') != 2 - exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(, , +"", 0, "", , [])' -endif - -exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' -if exists(':Gbrowse') != 2 - exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(, , +"", 0, "", , [])' -endif - if get(g:, 'fugitive_no_maps') finish endif diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 2a1c9fb9..27fc7116 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -685,8 +685,6 @@ If this plugin has helped you, or you'd like to learn more about Vim, why not ch This was one of PeepCode's all-time top three bestsellers and is now available at Pluralsight. -You can read reviews on my [website][airblade]. - ### Intellectual Property diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index d88f8f0d..0ed77ed8 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -70,7 +70,7 @@ let s:counter = 0 " grep is available. function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort if gitgutter#utility#repo_path(a:bufnr, 0) == -1 - throw 'gitgutter author fail' + throw 'gitgutter path not set' endif if gitgutter#utility#repo_path(a:bufnr, 0) == -2 diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim index 9d18d928..f530e3e4 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -64,6 +64,9 @@ function! gitgutter#hunk#next_hunk(count) abort if g:gitgutter_show_msg_on_hunk_jumping redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) endif + if s:is_preview_window_open() + call gitgutter#hunk#preview() + endif return endif endif @@ -92,6 +95,9 @@ function! gitgutter#hunk#prev_hunk(count) abort if g:gitgutter_show_msg_on_hunk_jumping redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) endif + if s:is_preview_window_open() + call gitgutter#hunk#preview() + endif return endif endif @@ -257,9 +263,10 @@ function! s:hunk_op(op, ...) let g:gitgutter_async = async call gitgutter#hunk#set_hunks(bufnr, gitgutter#diff#parse_diff(diff)) + call gitgutter#diff#process_hunks(bufnr, gitgutter#hunk#hunks(bufnr)) " so the hunk summary is updated if empty(s:current_hunk()) - call gitgutter#utility#warn('cursor is not in a hunk') + call gitgutter#utility#warn('Cursor is not in a hunk') elseif s:cursor_in_two_hunks() let choice = input('Choose hunk: upper or lower (u/l)? ') " Clear input @@ -269,7 +276,7 @@ function! s:hunk_op(op, ...) elseif choice =~ 'l' call a:op(gitgutter#diff#hunk_diff(bufnr, diff, 1)) else - call gitgutter#utility#warn('did not recognise your choice') + call gitgutter#utility#warn('Did not recognise your choice') endif else let hunk_diff = gitgutter#diff#hunk_diff(bufnr, diff) @@ -293,7 +300,7 @@ function! s:stage(hunk_diff) \ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' apply --cached --unidiff-zero - '), \ diff) if v:shell_error - call gitgutter#utility#warn('patch does not apply') + call gitgutter#utility#warn('Patch does not apply') else if exists('#User#GitGutterStage') execute 'doautocmd' s:nomodeline 'User GitGutterStage' @@ -440,16 +447,24 @@ function! s:open_hunk_preview_window() " Assumes cursor is in original window. autocmd CursorMoved ++once call s:close_hunk_preview_window() + if g:gitgutter_close_preview_on_escape + nnoremap :call close_hunk_preview_window() + endif return endif if exists('*popup_create') - let s:winid = popup_create('', { + let opts = { \ 'line': 'cursor+1', \ 'col': 'cursor', \ 'moved': 'any', - \ }) + \ } + if g:gitgutter_close_preview_on_escape + let opts.filter = function('s:close_popup_on_escape') + endif + + let s:winid = popup_create('', opts) call setbufvar(winbufnr(s:winid), '&filetype', 'diff') @@ -457,14 +472,12 @@ function! s:open_hunk_preview_window() endif endif + " Specifying where to open the preview window can lead to the cursor going + " to an unexpected window when the preview window is closed (#769). + silent! noautocmd execute g:gitgutter_preview_win_location 'pedit gitgutter://hunk-preview' silent! wincmd P - if &previewwindow - file gitgutter://hunk-preview - else - noautocmd execute g:gitgutter_preview_win_location &previewheight 'new gitgutter://hunk-preview' - doautocmd WinEnter - set previewwindow - endif + setlocal statusline=%{''} + doautocmd WinEnter if exists('*win_getid') let s:winid = win_getid() else @@ -474,11 +487,21 @@ function! s:open_hunk_preview_window() " Reset some defaults in case someone else has changed them. setlocal noreadonly modifiable noswapfile if g:gitgutter_close_preview_on_escape - nnoremap :pclose + " Ensure cursor goes to the expected window. + nnoremap :wincmd ppclose endif endfunction +function! s:close_popup_on_escape(winid, key) + if a:key == "\" + call popup_close(a:winid) + return 1 + endif + return 0 +endfunction + + " Floating window: does not care where cursor is. " Preview window: assumes cursor is in preview window. function! s:populate_hunk_preview_window(header, body) @@ -530,7 +553,8 @@ function! s:populate_hunk_preview_window(header, body) setlocal nomodified normal! G$ - let height = min([winline(), &previewheight]) + let hunk_height = max([body_length, winline()]) + let height = min([hunk_height, &previewheight]) execute 'resize' height 1 @@ -575,3 +599,14 @@ function! s:close_hunk_preview_window() let s:winid = 0 let s:preview_bufnr = 0 endfunction + + +" Only makes sense for traditional, non-floating preview window. +function s:is_preview_window_open() + for i in range(1, winnr('$')) + if getwinvar(i, '&previewwindow') + return 1 + endif + endfor + return 0 +endfunction diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim index 4a02c2fb..5486c3b8 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/utility.vim @@ -30,7 +30,7 @@ endfunction function! gitgutter#utility#warn(message) abort echohl WarningMsg - echo 'vim-gitgutter: ' . a:message + echo a:message echohl None let v:warningmsg = a:message endfunction @@ -39,7 +39,7 @@ function! gitgutter#utility#warn_once(bufnr, message, key) abort if empty(gitgutter#utility#getbufvar(a:bufnr, a:key)) call gitgutter#utility#setbufvar(a:bufnr, a:key, '1') echohl WarningMsg - redraw | echom 'vim-gitgutter: ' . a:message + redraw | echom a:message echohl None let v:warningmsg = a:message endif @@ -176,15 +176,20 @@ endfunction function! s:use_known_shell() abort if has('unix') && &shell !=# 'sh' - let [s:shell, s:shellcmdflag, s:shellredir] = [&shell, &shellcmdflag, &shellredir] + let [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote] = [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote] let &shell = 'sh' set shellcmdflag=-c shellredir=>%s\ 2>&1 endif + if has('win32') && (&shell =~# 'pwsh' || &shell =~# 'powershell') + let [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote] = [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote] + let &shell = 'cmd.exe' + set shellcmdflag=/s\ /c shellredir=>%s\ 2>&1 shellpipe=>%s\ 2>&1 shellquote= shellxquote=" + endif endfunction function! s:restore_shell() abort - if has('unix') && exists('s:shell') - let [&shell, &shellcmdflag, &shellredir] = [s:shell, s:shellcmdflag, s:shellredir] + if (has('unix') || has('win32')) && exists('s:shell') + let [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote] = [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote] endif endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 06b0be91..e5bb0584 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -173,7 +173,8 @@ Commands for operating on a hunk:~ *gitgutter-:GitGutterPreviewHunk* :GitGutterPreviewHunk Preview the hunk the cursor is in. Use |:pclose| or |CTRL-W_CTRL-Z| to close the preview - window. + window, or set |g:gitgutter_close_preview_on_escape| + and use . To stage part of the hunk, move to the preview window, delete any lines you do not want to stage, and @@ -484,7 +485,7 @@ preview window. *g:gitgutter_close_preview_on_escape* Default: 0 -Whether pressing in a non-floating preview window closes it. +Whether pressing in a preview window closes it. *g:gitgutter_terminal_reports_focus* Default: 1 @@ -695,3 +696,4 @@ Terminus (https://github.com/wincent/terminus) or set: let g:gitgutter_terminal_reports_focus = 0 < + vim:tw=78:et:ft=help:norl: diff --git a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim index 5214adf8..2c829550 100644 --- a/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim +++ b/sources_non_forked/vim-gitgutter/plugin/gitgutter.vim @@ -8,7 +8,7 @@ let g:loaded_gitgutter = 1 " Initialisation {{{ if v:version < 703 || (v:version == 703 && !has("patch105")) - call gitgutter#utility#warn('requires Vim 7.3.105') + call gitgutter#utility#warn('Requires Vim 7.3.105') finish endif @@ -25,7 +25,8 @@ let g:gitgutter_preview_win_location = get(g:, 'gitgutter_preview_win_location', if exists('*nvim_open_win') let g:gitgutter_preview_win_floating = get(g:, 'gitgutter_preview_win_floating', 1) else - let g:gitgutter_preview_win_floating = get(g:, 'gitgutter_preview_win_floating', 0) + let default = exists('&previewpopup') ? !empty(&previewpopup) : 0 + let g:gitgutter_preview_win_floating = get(g:, 'gitgutter_preview_win_floating', default) endif let g:gitgutter_enabled = get(g:, 'gitgutter_enabled', 1) if exists('*sign_unplace') @@ -71,7 +72,7 @@ let g:gitgutter_show_msg_on_hunk_jumping = get(g:, 'gitgutter_show_msg_on_hu let g:gitgutter_git_executable = get(g:, 'gitgutter_git_executable', 'git') if !executable(g:gitgutter_git_executable) if g:gitgutter_enabled - call gitgutter#utility#warn('cannot find git. Please set g:gitgutter_git_executable.') + call gitgutter#utility#warn('Cannot find git. Please set g:gitgutter_git_executable.') endif finish endif @@ -85,7 +86,7 @@ if !empty(g:gitgutter_grep) endif else if g:gitgutter_grep !=# default_grep - call gitgutter#utility#warn('cannot find '.g:gitgutter_grep.'. Please check g:gitgutter_grep.') + call gitgutter#utility#warn('Cannot find '.g:gitgutter_grep.'. Please check g:gitgutter_grep.') endif let g:gitgutter_grep = '' endif @@ -201,18 +202,18 @@ command! -bar GitGutterDebug call gitgutter#debug#debug() " Maps {{{ nnoremap (GitGutterNextHunk) &diff ? ']c' : ":\execute v:count1 . 'GitGutterNextHunk'\" -nnoremap GitGutterNextHunk &diff ? ']c' : ":\call gitgutter#utility#warn('please change your map \Plug>GitGutterNextHunk to \Plug>(GitGutterNextHunk)')\" +nnoremap GitGutterNextHunk &diff ? ']c' : ":\call gitgutter#utility#warn('Please change your map \Plug>GitGutterNextHunk to \Plug>(GitGutterNextHunk)')\" nnoremap (GitGutterPrevHunk) &diff ? '[c' : ":\execute v:count1 . 'GitGutterPrevHunk'\" -nnoremap GitGutterPrevHunk &diff ? '[c' : ":\call gitgutter#utility#warn('please change your map \Plug>GitGutterPrevHunk to \Plug>(GitGutterPrevHunk)')\" +nnoremap GitGutterPrevHunk &diff ? '[c' : ":\call gitgutter#utility#warn('Please change your map \Plug>GitGutterPrevHunk to \Plug>(GitGutterPrevHunk)')\" xnoremap (GitGutterStageHunk) :GitGutterStageHunk -xnoremap GitGutterStageHunk :call gitgutter#utility#warn('please change your map Plug>GitGutterStageHunk to Plug>(GitGutterStageHunk)') +xnoremap GitGutterStageHunk :call gitgutter#utility#warn('Please change your map Plug>GitGutterStageHunk to Plug>(GitGutterStageHunk)') nnoremap (GitGutterStageHunk) :GitGutterStageHunk -nnoremap GitGutterStageHunk :call gitgutter#utility#warn('please change your map Plug>GitGutterStageHunk to Plug>(GitGutterStageHunk)') +nnoremap GitGutterStageHunk :call gitgutter#utility#warn('Please change your map Plug>GitGutterStageHunk to Plug>(GitGutterStageHunk)') nnoremap (GitGutterUndoHunk) :GitGutterUndoHunk -nnoremap GitGutterUndoHunk :call gitgutter#utility#warn('please change your map Plug>GitGutterUndoHunk to Plug>(GitGutterUndoHunk)') +nnoremap GitGutterUndoHunk :call gitgutter#utility#warn('Please change your map Plug>GitGutterUndoHunk to Plug>(GitGutterUndoHunk)') nnoremap (GitGutterPreviewHunk) :GitGutterPreviewHunk -nnoremap GitGutterPreviewHunk :call gitgutter#utility#warn('please change your map Plug>GitGutterPreviewHunk to Plug>(GitGutterPreviewHunk)') +nnoremap GitGutterPreviewHunk :call gitgutter#utility#warn('Please change your map Plug>GitGutterPreviewHunk to Plug>(GitGutterPreviewHunk)') " }}} diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index 6a13434a..d1a72071 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -54,7 +54,7 @@ syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup= syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial extend syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial extend syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString -syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/ +syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\%(\x\|_\)\+\)\>/ syntax keyword jsNumber Infinity syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=\d\+\)\=\>/ @@ -104,7 +104,7 @@ syntax keyword jsDo do skipwhite skipempty next syntax region jsSwitchCase contained matchgroup=jsLabel start=/\<\%(case\|default\)\>/ end=/:\@=/ contains=@jsExpression,jsLabel skipwhite skipempty nextgroup=jsSwitchColon keepend syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsFinallyBlock -syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch +syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch,jsTryCatchBlock syntax keyword jsException throw syntax keyword jsAsyncKeyword async await syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index 5e909c4a..e833b243 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (12.3.3) + rake (10.4.2) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-repeat/autoload/repeat.vim b/sources_non_forked/vim-repeat/autoload/repeat.vim index 708c318c..97fea240 100644 --- a/sources_non_forked/vim-repeat/autoload/repeat.vim +++ b/sources_non_forked/vim-repeat/autoload/repeat.vim @@ -86,6 +86,7 @@ function! s:default_register() endfunction function! repeat#run(count) + let s:errmsg = '' try if g:repeat_tick == b:changedtick let r = '' @@ -124,9 +125,13 @@ function! repeat#run(count) endif endif catch /^Vim(normal):/ - return 'echoerr v:errmsg' + let s:errmsg = v:errmsg + return 0 endtry - return '' + return 1 +endfunction +function! repeat#errmsg() + return s:errmsg endfunction function! repeat#wrap(command,count) @@ -138,7 +143,7 @@ function! repeat#wrap(command,count) endif endfunction -nnoremap (RepeatDot) :exe repeat#run(v:count) +nnoremap (RepeatDot) :if !repeat#run(v:count)echoerr repeat#errmsg()endif nnoremap (RepeatUndo) :call repeat#wrap('u',v:count) nnoremap (RepeatUndoLine) :call repeat#wrap('U',v:count) nnoremap (RepeatRedo) :call repeat#wrap("\C-R>",v:count) diff --git a/sources_non_forked/vim-ruby/indent/ruby.vim b/sources_non_forked/vim-ruby/indent/ruby.vim index fb3768da..657aa763 100644 --- a/sources_non_forked/vim-ruby/indent/ruby.vim +++ b/sources_non_forked/vim-ruby/indent/ruby.vim @@ -642,8 +642,7 @@ function! s:PreviousNotMSL(msl_info) abort " TODO (2016-10-07) Wrong/unused? How could it be "1"? return indent(info.plnum) - 1 " If previous line is a continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. - elseif s:Match(info.plnum, s:non_bracket_continuation_regex) || s:IsInString(info.plnum, strlen(line)) + elseif s:Match(info.plnum, s:non_bracket_continuation_regex) return indent(info.plnum) endif endif diff --git a/sources_non_forked/vim-snipmate/Contributors.md b/sources_non_forked/vim-snipmate/Contributors.md index ccfccf96..82fbbd6b 100644 --- a/sources_non_forked/vim-snipmate/Contributors.md +++ b/sources_non_forked/vim-snipmate/Contributors.md @@ -34,6 +34,7 @@ additional contributions from: * [mikeastock](https://github.com/mikeastock) * [muffinresearch](https://github.com/muffinresearch) * [munyari](https://github.com/munyari) +* [nickelization](https://github.com/nickelization) * [pielgrzym](https://github.com/pielgrzym) * [pose](https://github.com/pose) * [r00k](https://github.com/r00k) diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index 366ba6f5..9affc1d4 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -583,7 +583,22 @@ function! snipMate#TriggerSnippet(...) abort call feedkeys(SuperTabKey) | return '' endif call feedkeys("\a", 'n') " Close completion menu - call feedkeys("\") | return '' + " Once we've dismissed the completion menu, we have to cause this + " function to be executed over again, so that we actually get the + " snippet triggered. (Simply continuing to execute fails because + " we have to finish this function before the results of feedkeys take + " effect and dismiss the completion menu. Recursing also fails for + " similar reasons.) + if a:0 == 0 + " Would be nice to have a more robust solution than manually + " branching on the arguments. I tried to do something like: + " call call(function('snipMate#TriggerSnippet'), a:000) + " But I couldn't quite get it working. Maybe somebody else with + " better vimscript skills can find a way to make it work, though? + call feedkeys("\snipMateNextOrTrigger") | return '' + else + call feedkeys("\snipMateTrigger") | return '' + endif endif if exists('b:snip_state') && a:0 == 0 " Jump only if no arguments diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index cb5f9ff2..52cc5b83 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -359,9 +359,13 @@ selected in |Select-mode|. For example, > $0
-Finally, placeholders can contain mirrors and evaluations (detailed below) and -even entire other tab stops. If the placeholder is edited, then these nested -tab stops are removed and skipped entirely. For example, > +Finally, placeholders can contain mirrors and evaluations (detailed below) +and, in version 1 of the snippet parser, even entire other tab stops. If the +placeholder is edited, then these nested tab stops are removed and skipped +entirely. +NOTE: Version 1 of the snippet parser must be used! See +|SnipMate-parser-versions|. +For example, > snippet div @@ -469,6 +473,8 @@ Which version is used is determined by version directives in snippet files (|SnipMate-options|). A complete list of current differences is as follows: +- Version 0 does not support nested placeholders such as ${1:"${2:foo}"} at + all. - Backslash escaping is guaranteed to work in version 1. In certain edge cases this may not work in version 0. - Certain syntactic errors, such as a missing closing brace for a tabstop, are @@ -478,7 +484,7 @@ A complete list of current differences is as follows: - Braces are not mandatory in version 1. SnipMate will determine which instance of a stop ID to use based on the presence of a placeholder, or whichever instance occurs first. Braces can therefore be used to - disambiguate between stop 12, $12, and stop 1 followed by a 2, ${1}2. In + disambiguate between stop 12, $12, and stop 1 followed by a 2: ${1}2. In other words, version 0 makes a distinction between a mirror and a stop while version 1 resolves the differences for you. - Placeholders are not mandatory to enable mirror support in version 1. @@ -489,6 +495,21 @@ A complete list of current differences is as follows: - Transformations similar to |:substitute| can be preformed on any mirror, including visual content. + *SnipMate-deprecate* +Deprecation~ + +The legacy parser, version 0, is deprecated. It is currently still the default +parser, but that will be changing. NOTE that switching which parser you use +could require changes to your snippets--see the previous section. + +To continue using the old parser, set g:snipMate.snippet_version (see +|SnipMate-options|) to 0 in your |vimrc|. + +Setting g:snipMate.snippet_version to either 0 or 1 will remove the start up +message. One way this can be done--to use the new parser--is as follows: +> + let g:snipMate = { 'snippet_version' : 1 } +< ============================================================================== SNIPPET SOURCES *SnipMate-snippet-sources* diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index 75e74aab..068791ed 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -57,6 +57,10 @@ endif let g:snipMate['no_match_completion_feedkeys_chars'] = \ get(g:snipMate, 'no_match_completion_feedkeys_chars', "\t") +if !exists('g:snipMate.snippet_version') + echom 'The legacy SnipMate parser is deprecated. Please see :h SnipMate-deprecate.' +endif + " Add default scope aliases, without overriding user settings let g:snipMate.scope_aliases = get(g:snipMate, 'scope_aliases', {}) if exists('g:snipMate_no_default_aliases') diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index 80120dae..d152aa76 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -30,6 +30,13 @@ endglobal ########################################################################### # TextMate Snippets # ########################################################################### +snippet main +int main() +{ + ${0} +} +endsnippet + snippet forc "general for loop (for)" for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) { ${VISUAL}$0 diff --git a/sources_non_forked/vim-snippets/UltiSnips/gitcommit.snippets b/sources_non_forked/vim-snippets/UltiSnips/gitcommit.snippets new file mode 100644 index 00000000..938071c2 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/gitcommit.snippets @@ -0,0 +1,61 @@ +# https://www.conventionalcommits.org/en/v1.0.0-beta.2/#specification + +snippet fix "fix conventional commit" +fix(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet feat "feat conventional commit" +feat(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet chore "chore conventional commit" +chore(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet docs "docs conventional commit" +docs(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet improvement "improvement conventional commit" +improvement(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet perf "perf conventional commit" +perf(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet refactor "refactor conventional commit" +refactor(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet test "test conventional commit" +test(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet ci "ci conventional commit" +ci(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet + +snippet build "build conventional commit" +build(${1:scope}): ${2:title} + +${0:${VISUAL}} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets index 666c80e3..ee70ff0f 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets @@ -1,3 +1,11 @@ +global !p +# Capitalize the first letter without affecting the rest of the letters +def capitalize_first(word): + if(word): + word = word[0].upper() + word[1:] + return word +endglobal + # Functional components snippet rfc "react functional component" b import React, {useState} from "react" @@ -14,7 +22,7 @@ export default $4`!p snip.rv = snip.basename` endsnippet # React Hooks snippet useS "useState Hook" b -const [${1}, set`!p snip.rv=t[1].title()`] = useState(${3:"${4}"}) +const [${1}, set`!p snip.rv=capitalize_first(t[1])`] = useState(${3:"${4}"}) endsnippet snippet useE "useEffect Hook" b useEffect(() => { diff --git a/sources_non_forked/vim-snippets/UltiSnips/lua.snippets b/sources_non_forked/vim-snippets/UltiSnips/lua.snippets index 0fd5eefc..ac604a09 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/lua.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/lua.snippets @@ -8,6 +8,15 @@ snippet #! "#!/usr/bin/env lua" b $0 endsnippet +snippet assert "Assertion" b +assert(${1:condition}`!p +if t[2]: + snip.rv = ", " +else: + snip.rv = "" +`${2:msg}) +endsnippet + snippet !fun(ction)?! "New function" br function ${1:new_function}(${2:args}) $0 diff --git a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets index eacc8fc8..6d23c92c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets @@ -8,11 +8,13 @@ global !p import vim import os.path def get_module_namespace_and_basename(): - """This function will try to guess the current class or define name you are - trying to create. Note that for this to work you should be using the module - structure as per the style guide. Examples inputs and it's output + """This function will try to guess the current class, define or type + name you are trying to create. Note that for this to work you should be + using the module structure as per the style guide. Examples inputs and + it's output * /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd - * /home/nikolavp/puppet/modules/collectd/manfistes/mysql.pp -> collectd::mysql + * /home/nikolavp/puppet/modules/collectd/manifests/mysql.pp -> collectd::mysql + * /home/nikolavp/puppet/modules/collectd/types/dbname.pp -> Collectd::Dbname """ first_time = True current_file_path_without_ext = vim.eval('expand("%:p:r")') or "" @@ -25,8 +27,12 @@ def get_module_namespace_and_basename(): first_time = False parts = os.path.split(parts[0]) continue - if parts[1] == 'manifests': - return os.path.split(parts[0])[1] + ('::' + namespace).rstrip(':') + if parts[1] in ['manifests', 'types']: + parsed_name = os.path.split( + parts[0])[1] + ('::' + namespace).rstrip(':') + if parts[1] == 'types': + parsed_name = parsed_name.title() + return parsed_name else: namespace = parts[1] + '::' + namespace parts = os.path.split(parts[0]) @@ -51,6 +57,16 @@ define ${1:`!p snip.rv = get_module_namespace_and_basename()`} { } endsnippet +snippet type "Data type alias" b +type ${1:`!p snip.rv = get_module_namespace_and_basename()`} = ${2:Type} +endsnippet + +snippet lambda "Lambda function chain-called on a variable" +$${1:varname}.${2:each} |${3:Type} $${4:param}| { + $0 +} +endsnippet + ################################################################# # Puppet Types # # See http://docs.puppetlabs.com/references/latest/type.html # @@ -197,6 +213,14 @@ snippet hiera_include "Hiera Include Function" b hiera_include("${1:Lookup}")$0 endsnippet +snippet lookup "Lookup data from hiera" +$${1:varname} = lookup('${2:hiera::key}')$0 +endsnippet + +snippet trocla "Lookup or generate sensitive information" +trocla('${1:lookup_key}', '${2:plain}', ${3:'length: 32'})$0 +endsnippet + snippet include "Include Function" b include ${1:classname}$0 endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets index 6e775041..4923af5c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -138,7 +138,7 @@ def format_arg(arg, style): elif style == NORMAL: return ":%s: TODO" % arg elif style == GOOGLE: - return "%s (TODO): TODO" % arg + return "%s (%s): TODO" % (arg, arg.type or "TODO") elif style == JEDI: return ":type %s: TODO" % arg elif style == NUMPY: diff --git a/sources_non_forked/vim-snippets/snippets/c.snippets b/sources_non_forked/vim-snippets/snippets/c.snippets index 5c084154..e70d057c 100644 --- a/sources_non_forked/vim-snippets/snippets/c.snippets +++ b/sources_non_forked/vim-snippets/snippets/c.snippets @@ -344,3 +344,10 @@ snippet todo # This is kind of convenient snippet . [${1}] + +snippet asm + __asm__ __volatile__( + "${0}\n\t" + : + : + ); diff --git a/sources_non_forked/vim-snippets/snippets/cuda.snippets b/sources_non_forked/vim-snippets/snippets/cuda.snippets index 425ca67f..2fc19218 100644 --- a/sources_non_forked/vim-snippets/snippets/cuda.snippets +++ b/sources_non_forked/vim-snippets/snippets/cuda.snippets @@ -1 +1,59 @@ extends cpp + +snippet kern "Kernel definition" + __global__ void ${1:kernel}(${2:void}) { + ${0:// TODO: Implement} + } + +snippet dev "Device function definition" + __device__ ${1:int} ${2:foo}(${3:void}) { + ${0:// TODO: Implement} + return 0; + } + +snippet call "Kernel call" + ${1:kernel}<<<${2:args}>>>(${3});${0} + +snippet sync "Synchonize threads" + __syncthreads(); + +snippet tid "Thread Index" + threadIdx.${0} + +snippet bid "Block Index" + blockIdx.${0} + +snippet bdim "Block Dimension" + blockDim.${0} + +snippet ii "Get current index (1D)" + int ${1:index} = threadIdx.${2:x} + blockIdx.$2 * blockDim.$2; + +snippet ix "Get current X index (1D)" + int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; + +snippet iy "Get current Y index (1D)" + int ${1:y} = threadIdx.y + blockIdx.y * blockDim.y; + +snippet iz "Get current Z index (1D)" + int ${1:z} = threadIdx.z + blockIdx.z * blockDim.z; + +snippet ixy "Get current X,Y index (2D)" + int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; + int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; + +snippet ixz "Get current X,Z index (2D)" + int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; + int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; + +snippet iyz "Get current Y,Z index (2D)" + int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; + int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; + +snippet ixyz "Get current X,Y,Z index (3D)" + int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x; + int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y; + int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z; + +snippet share "Shared memory declaration" + __shared__ ${1:int} ${2:memo}[${3:SIZE}];${0} diff --git a/sources_non_forked/vim-snippets/snippets/eelixir.snippets b/sources_non_forked/vim-snippets/snippets/eelixir.snippets index 456bed51..c15d86ec 100644 --- a/sources_non_forked/vim-snippets/snippets/eelixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/eelixir.snippets @@ -38,6 +38,17 @@ snippet ft form_tag <%= form_tag(${1:"/users"}, method: ${2::post}) %> ${0} + +snippet sl select + <%= select ${1:f}, :${2:field}, ${3:[{"key", "value"}]}, prompt: ${4:"Prompt"} %> + +snippet sb submit + <%= submit ${1:"Submit"} %> + +snippet rb radio_button + <%= radio_button ${1:f}, :${2:field}, ${3:"value"} %> + + snippet et error_tag <%= error_tag ${1:f}, :${2:field} %> snippet ti text_input diff --git a/sources_non_forked/vim-snippets/snippets/fsharp.snippets b/sources_non_forked/vim-snippets/snippets/fsharp.snippets new file mode 100644 index 00000000..81587d65 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/fsharp.snippets @@ -0,0 +1,80 @@ +snippet doc + /// ${0} +snippet comment + // ${0} +snippet let + let ${1} = ${0} +snippet lit + [] + let ${1} = ${0} +snippet rec + type ${1} = { ${0} } +snippet arec + {| ${0} |} +snippet fn + let ${1} = + ${0} +snippet fnr + let rec ${1} = + ${0} +snippet lam + (fun ${1} -> ${0}) +snippet mod + module ${1} = + ${0} +snippet for + for ${1} in ${2} do + ${0} +snippet if + if ${1} then + ${2} +snippet ife + if ${1} then + ${2} + else + ${0} +snippet ifee + if ${1} then + ${2} + elif ${3} then + ${4} + else + ${0} +snippet eif + elif ${1} then + ${0} +snippet el + else + ${0} +snippet try + try + ${1} + with ${0} +snippet match + match ${1} with + | ${2} -> ${0} +snippet | + | ${1} -> ${0} +snippet p + |> ${0} +snippet pr + printfn "${1}" ${0} +snippet pri + printfn \$"${0}" +snippet amap + |> Array.map (fun ${1} -> ${0}) +snippet lmap + |> List.map (fun ${1} -> ${0}) +snippet smap + |> Seq.map (fun ${1} -> ${0}) +snippet atap + |> Array.map (fun x -> printfn "%A" x; x) // tap +snippet ltap + |> List.map (fun x -> printfn "%A" x; x) // tap +snippet stap + |> Seq.map (fun x -> printfn "%A" x; x) // tap +snippet main + [] + let main argv = + ${0} + 0 diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index 640a26fa..bc4599e3 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -449,7 +449,7 @@ snippet html5 snippet html5l - + diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 26562068..9649bdce 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -99,11 +99,11 @@ snippet terr snippet ret return ${0:result}; snippet for "for (...) {...}" - for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { + for (let ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { ${0:${VISUAL}} } snippet forr "reversed for (...) {...}" - for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { + for (let ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { ${0:${VISUAL}} } snippet wh "(condition) { ... }" @@ -116,7 +116,7 @@ snippet do "do { ... } while (condition)" } while (${1:/* condition */}); # For in loop snippet fori - for (var ${1:prop} in ${2:object}) { + for (let ${1:prop} in ${2:object}) { ${0:$2[$1]} } # Objects @@ -275,6 +275,8 @@ snippet cprof "console.profile" console.profileEnd(); snippet ctable "console.table" console.table(${1:"${2:value}"}); +snippet clstr "console.log stringified" + console.log(JSON.stringify(${0}, null, 2)); # Misc snippet us 'use strict'; diff --git a/sources_non_forked/vim-snippets/snippets/liquid.snippets b/sources_non_forked/vim-snippets/snippets/liquid.snippets index a39a0876..72a78d0e 100644 --- a/sources_non_forked/vim-snippets/snippets/liquid.snippets +++ b/sources_non_forked/vim-snippets/snippets/liquid.snippets @@ -28,7 +28,7 @@ snippet case {% endcase %} snippet when {% when ${1:condition} %} - ${0} + ${0:${VISUAL}} snippet cycle {% cycle '${1:odd}', '${2:even}' %} snippet cyclegroup @@ -100,7 +100,7 @@ snippet javascript ${0} {% endjavascript %} snippet comment- - {%- comment -%}${0}{%- endcomment -%} + {%- comment -%}${0:${VISUAL}}{%- endcomment -%} snippet if- {%- if ${1:condition} -%} ${0:${VISUAL}} @@ -128,7 +128,7 @@ snippet case- {%- endcase -%} snippet when- {%- when ${1:condition} -%} - ${0} + ${0:${VISUAL}} snippet cycle- {%- cycle '${1:odd}', '${2:even}' -%} snippet cyclegroup- @@ -151,6 +151,22 @@ snippet include- {%- include '${0:snippet}' -%} snippet includewith- {%- include '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet render- + {%- render '${0:snippet}' -%} +snippet renderwith- + {%- render '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet section- + {%- section '${1:snippet}' -%} +snippet layout- + {%- layout '${1:layout}' -%} +snippet layoutnone- + {%- layout none -%} +snippet paginate- + {%- paginate ${1:collection.products} by ${2:12} -%} + {%- for ${3:product} in $1 -%} + ${0} + {%- endfor -%} + {%- endpaginate -%} snippet join | join: '${1:, }' snippet first @@ -265,3 +281,192 @@ snippet asset_img_url | asset_img_url: '${1:medium}' snippet img_url | img_url: '${1:medium}' +snippet _schema + {% schema %} + { + "name": "${1}", + "class": "${2}", + "settings": [ + ${0} + ] + } + {% endschema %} +snippet _blocks + "blocks": [ + { + "type": "${1}", + "name": "${2}", + "settings": [ + ${0} + ] + } + ] +snippet _text + { + "type": "text", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${4}", + "placeholder": "${0}" + } +snippet _textarea + { + "type": "textarea", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${4}", + "placeholder": "${0}" + } +snippet _image_picker + { + "type": "image_picker", + "id": "${1}", + "label": "${0}" + } +snippet _radio + { + "type": "radio", + "id": "${1}", + "label": "${2}", + "options": [ + { "value": "${5}", "label": "${0}" } + ], + "default": "${3}", + "info": "${4}" + } +snippet _select + { + "type": "select", + "id": "${1}", + "label": "${2}", + "options": [ + { + "group": "${5}", + "value": "${6}", + "label": "${0}" + } + ], + "default": "${3}", + "info": "${4}" + } +snippet _checkbox + { + "type": "checkbox", + "id": "${1}", + "label": "${2}", + "default": ${3:true}, + "info": "${0}" + } +snippet _range + { + "type": "range", + "id": "${1}", + "min": ${2}, + "max": ${3}, + "step": ${4}, + "unit": "${5}", + "label": "${6}", + "default": ${0} + } +snippet _color + { + "type": "color", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${0}" + } +snippet _font + { + "type": "font_picker", + "id": "${1}", + "label": "${2}", + "info": "${3}", + "default": "${0:helvetica_n4}" + } +snippet _collection + { + "type": "collection", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _product + { + "type": "product", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _blog + { + "type": "blog", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _page + { + "type": "page", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _link_list + { + "type": "link_list", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _url + { + "type": "url", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _video + { + "type": "video_url", + "id": "${1}", + "label": "${2}", + "accept": ["youtube", "vimeo"${0}], + "default": "${3}", + "info": "${4}", + "placeholder": "${5}" + } +snippet _richtext + { + "type": "richtext", + "id": "${1}", + "label": "${2}", + "default": "

${0}

" + } +snippet _html + { + "type": "html", + "id": "${1}", + "label": "${2}", + "default": "
${0}
" + } +snippet _article + { + "type": "article", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _header + { + "type": "header", + "content": "${1}", + "info": "${0}" + } +snippet _paragraph + { + "type": "paragraph", + "content": "${0}" + } diff --git a/sources_non_forked/vim-snippets/snippets/lpc.snippets b/sources_non_forked/vim-snippets/snippets/lpc.snippets new file mode 100644 index 00000000..2a849efa --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/lpc.snippets @@ -0,0 +1,190 @@ +## +## Preprocessor +# #include <...> +snippet inc + #include <${1:stdio}.h> +# #include "..." +snippet Inc + #include "${1:`vim_snippets#Filename("$1.h")`}" +# ifndef...define...endif +snippet ndef + #ifndef $1 + #define ${1:SYMBOL} ${2:value} + #endif /* ifndef $1 */ +# define +snippet def + #define +# ifdef...endif +snippet ifdef + #ifdef ${1:FOO} + ${2:#define } + #endif +# if +snippet #if + #if ${1:FOO} + ${0:${VISUAL}} + #endif +# header include guard +snippet once + #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} + + #define $1 + + ${0} + + #endif /* end of include guard: $1 */ +## +## Control Statements +# if +snippet if + if(${1:true}) + { + ${0:${VISUAL}} + } +snippet ife + if(${1:true}) + { + ${2:${VISUAL}} + } + else + { + ${0} + } +# else +snippet el + else + { + ${0:${VISUAL}} + } +# else if +snippet elif + else if(${1:true}) + { + ${0:${VISUAL}} + } +# ifi +snippet ifi + if(${1:true}) ${0}; +# ternary +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch(${1:/* variable */}) + { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + default: + ${6} + } +# switch without default +snippet switchndef + switch(${1:/* variable */}) + { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + } +# case +snippet case + case ${1:/* variable case */}: + ${2} + ${3:break;} +snippet ret + return ${0}; +## +## Loops +#foreach +snippet fore + foreach(${1:mixed} ${2:ele} in ${3:arr}) + { + ${4} + } +# for +snippet for + for(int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) + { + ${4} + } +# for (custom) +snippet forr + for(int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) + { + ${5} + } +# while +snippet wh + while(${1:/* condition */}) + { + ${0:${VISUAL}} + } +# do... while +snippet do + do{ + ${0:${VISUAL}} + }while (${1:/* condition */}); +## +## Functions +# function definition +snippet fnc + ${1:void} ${2:function_name}(${3}) + { + ${4} + } +# function definition with zero parameters +snippet defun0 + ${1:void} ${2:function_name}() + { + ${3} + } +# function definition with one parameter +snippet defun1 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) + { + ${5} + } +# function definition with two parameters +snippet defun2 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) + { + ${7} + } +# function definition with three parameters +snippet defun3 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) + { + ${9} + } +# function declaration +snippet fund + ${1:void} ${2:function_name}(${3}); +## +## Input/Output +# printf +snippet pr + printf("${1:%s}\n"${2}); +# fprintf (again, this isn't as nice as TextMate's version, but it works) +snippet fpr + fprintf(${1:stderr}, "${2:%s}\n"${3}); +snippet prd + printf("${1:} = %d\n", $1); +snippet prf + printf("${1:} = %f\n", $1); +snippet prx + printf("${1:} = %${2}\n", $1); +## +# TODO section +snippet todo + /*! TODO: ${1:Todo description here} */ + +## Miscellaneous +# This is kind of convenient +snippet . + [${1}] + + +## +## MHXY +snippet head + // code for ${1} by `$USER` create at `strftime("%Y-%m-%d %H:%M:%S")` diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index ff5fede1..3c9eec52 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -24,7 +24,7 @@ snippet rb snippet beg begin ${0} - rescue ${1:Exception} => ${2:e} + rescue ${1:StandardError} => ${2:e} end snippet req require require '${1}' @@ -485,22 +485,22 @@ snippet asnm snippet aso assert_operator ${1:left}, :${2:operator}, ${3:right} snippet asr - assert_raise ${1:Exception} { ${0} } + assert_raises(${1:StandardError}) { ${0} } snippet asrd - assert_raise ${1:Exception} do + assert_raises ${1:StandardError} do ${0} end snippet asnr - assert_nothing_raised ${1:Exception} { ${0} } + assert_nothing_raised(${1:StandardError}) { ${0} } snippet asnrd - assert_nothing_raised ${1:Exception} do + assert_nothing_raised ${1:StandardError} do ${0} end snippet asrt assert_respond_to ${1:object}, :${2:method} snippet ass assert_same(..) assert_same ${1:expected}, ${2:actual} -snippet ass assert_send(..) +snippet asss assert_send(..) assert_send [${1:object}, :${2:message}, ${3:args}] snippet asns assert_not_same ${1:unexpected}, ${2:actual} @@ -518,6 +518,24 @@ snippet asntd end snippet fl flunk '${1:Failure message.}' +snippet rf + refute ${1:test}, '${2:Failure message.}' +snippet rfe + refute_equal ${1:unexpected}, ${2:actual} +snippet rfko + refute_kind_of ${1:UnexpectedKind}, ${2:actual_instance} +snippet rfn + refute_nil ${1:instance} +snippet rfo + refute_operator ${1:left}, :${2:operator}, ${3:right} +snippet rfi + refute_includes ${1:collection}, ${2:object} +snippet rfid + refute_in_delta ${1:unexpected_float}, ${2:actual_float}, ${3:2**-20} +snippet rfio + refute_instance_of ${1:UnexpectedClass}, ${2:actual_instance} +snippet rfs + refute_same ${1:unexpected}, ${2:actual} # Benchmark.bmbm do .. end snippet bm- TESTS = ${1:10_000} @@ -568,7 +586,7 @@ snippet b snippet begin begin fail 'A test exception.' - rescue Exception => e + rescue StandardError => e puts e.message puts e.backtrace.inspect else @@ -640,7 +658,7 @@ snippet wm snippet mout -> { ${1} }.must_output '${0}' snippet mra - -> { ${1} }.must_raise ${0:Exception} + -> { ${1} }.must_raise ${0:StandardError} snippet mrt must_respond_to :${0:method} snippet wrt diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index e13508a4..c1aca341 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -1,5 +1,11 @@ #version 1 #PREAMBLE +#documentclass without options +snippet dcl \documentclass{} + \\documentclass{${1:class}} ${0} +#documentclass with options +snippet dclo \documentclass[]{} + \\documentclass[${1:options}]{${2:class}} ${0} #newcommand snippet nc \newcommand \\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} @@ -19,6 +25,11 @@ snippet begin \begin{} ... \end{} block \\begin{${1:env}} ${0:${VISUAL}} \\end{$1} + +# Maketitle +snippet mkt maketitle + \\maketitle + # Tabular snippet tab tabular (or arbitrary) environment \\begin{${1:tabular}}{${2:c}} diff --git a/sources_non_forked/vim-snippets/snippets/verilog.snippets b/sources_non_forked/vim-snippets/snippets/verilog.snippets index e4a6b052..16bacc2a 100644 --- a/sources_non_forked/vim-snippets/snippets/verilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/verilog.snippets @@ -58,7 +58,7 @@ snippet al end # Module block snippet mod - module ${1:module_name} (${2}); + module ${1:`vim_snippets#Filename('$1', 'name')`} (${2}); ${0} endmodule # For @@ -81,3 +81,19 @@ snippet task task ${1:name}(${2}); ${0} endtask: $1 +# Initial +snippet ini + initial begin + ${0} + end +# typedef struct packed +snippet tdsp + typedef struct packed { + int ${2:data}; + } ${1:`vim_snippets#Filename('$1_t', 'name')`}; +# typedef eum +snippet tde + typedef enum ${2:logic[15:0]} + { + ${3:REG = 16'h0000} + } ${1:my_dest_t}; diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index f19b3a46..85cf2922 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -43,8 +43,14 @@ snippet ife if ... else statement endif snippet au augroup ... autocmd block augroup ${1:AU_NAME} + autocmd! autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} - augroup end + augroup END +snippet auv augroupvisual ... autocmd block with visual placeholder + augroup ${1:AU_NAME} + autocmd! + ${0:${VISUAL}} + augroup END snippet bun Vundle.vim Plugin definition Plugin '${0}' snippet plug vim-plug Plugin definition From ec9bf1385759c1f4f7cf3be4ca7de358fb443015 Mon Sep 17 00:00:00 2001 From: Federico Date: Mon, 31 May 2021 22:26:57 +0200 Subject: [PATCH 61/91] [snipMate] set to default version 1 (#621) --- vimrcs/plugins_config.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index de2c1f0d..24c18338 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -69,6 +69,7 @@ let g:user_zen_mode='a' """""""""""""""""""""""""""""" ino =snipMate#TriggerSnippet() snor i=snipMate#TriggerSnippet() +let g:snipMate = { 'snippet_version' : 1 } """""""""""""""""""""""""""""" From 2dccccb5843eb069475f66823229728c43a6968a Mon Sep 17 00:00:00 2001 From: Amir Date: Mon, 31 May 2021 22:28:44 +0200 Subject: [PATCH 62/91] Updated normal maps for JavaScript, TypeScript Now, TypeScript uses the JavaScript maps. Also, changed the maps for following (to make it more standard): * `` => `console.log()` * `` => `alert()` --- vimrcs/filetypes.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 522bafd6..19c6a4e3 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -26,11 +26,11 @@ au FileType javascript call JavaScriptFold() au FileType javascript setl fen au FileType javascript setl nocindent -au FileType javascript imap $log();hi -au FileType javascript imap alert();hi +au FileType javascript,typescript imap console.log();hi +au FileType javascript,typescript imap alert();hi -au FileType javascript inoremap $r return -au FileType javascript inoremap $f // --- PHFP2xi +au FileType javascript,typescript inoremap $r return +au FileType javascript,typescript inoremap $f // --- PHFP2xi function! JavaScriptFold() setl foldmethod=syntax From 2dc46c9a65c984bc506b1c5352fc0d857d75bf5f Mon Sep 17 00:00:00 2001 From: Amir Date: Mon, 31 May 2021 22:30:26 +0200 Subject: [PATCH 63/91] Updated plugins --- .../ale/ale_linters/css/stylelint.vim | 2 +- .../ale/ale_linters/elm/elm_ls.vim | 2 +- .../ale/ale_linters/elm/make.vim | 6 +- .../ale/ale_linters/go/gopls.vim | 5 +- .../ale/ale_linters/go/staticcheck.vim | 10 +- .../handlebars/embertemplatelint.vim | 2 +- .../ale/ale_linters/html/angular.vim | 2 +- .../ale/ale_linters/html/htmlhint.vim | 2 +- .../ale/ale_linters/html/stylelint.vim | 2 +- sources_non_forked/ale/ale_linters/ink/ls.vim | 2 +- .../ale/ale_linters/javascript/flow.vim | 2 +- .../ale/ale_linters/javascript/flow_ls.vim | 2 +- .../ale/ale_linters/javascript/jscs.vim | 2 +- .../ale/ale_linters/javascript/jshint.vim | 2 +- .../ale/ale_linters/javascript/standard.vim | 2 +- .../ale/ale_linters/javascript/tsserver.vim | 2 +- .../ale/ale_linters/json/jsonlint.vim | 2 +- .../ale/ale_linters/json/spectral.vim | 2 +- .../ale/ale_linters/less/lessc.vim | 2 +- .../ale/ale_linters/less/stylelint.vim | 2 +- .../ale/ale_linters/markdown/remark_lint.vim | 2 +- .../ale/ale_linters/ocamlinterface/merlin.vim | 17 +++ .../ale_linters/ocamlinterface/ocamllsp.vim | 13 ++ .../ale/ale_linters/php/intelephense.vim | 2 +- .../ale/ale_linters/php/langserver.vim | 2 +- .../ale/ale_linters/php/phpcs.vim | 2 +- .../ale/ale_linters/php/psalm.vim | 2 +- .../ale/ale_linters/php/tlint.vim | 2 +- .../ale/ale_linters/pug/puglint.vim | 2 +- .../ale/ale_linters/purescript/ls.vim | 2 +- .../ale/ale_linters/r/lintr.vim | 5 +- .../ale/ale_linters/sass/sasslint.vim | 2 +- .../ale/ale_linters/sass/stylelint.vim | 2 +- .../ale/ale_linters/scss/sasslint.vim | 2 +- .../ale/ale_linters/scss/stylelint.vim | 2 +- .../ale/ale_linters/sh/language_server.vim | 2 +- .../ale/ale_linters/stylus/stylelint.vim | 2 +- .../ale/ale_linters/sugarss/stylelint.vim | 2 +- .../ale/ale_linters/svelte/svelteserver.vim | 2 +- .../ale/ale_linters/swift/swiftlint.vim | 2 +- .../ale/ale_linters/terraform/tflint.vim | 3 +- .../ale/ale_linters/tex/texlab.vim | 2 +- .../ale/ale_linters/typescript/standard.vim | 2 +- .../ale/ale_linters/typescript/tsserver.vim | 2 +- .../ale/ale_linters/vim/vimls.vim | 2 +- .../ale/ale_linters/vue/vls.vim | 2 +- .../ale/ale_linters/yaml/spectral.vim | 2 +- .../ale/ale_linters/yaml/swaglint.vim | 2 +- .../ale/autoload/ale/fix/registry.vim | 4 +- .../ale/autoload/ale/fixers/buildifier.vim | 2 +- .../ale/autoload/ale/fixers/clangformat.vim | 2 +- .../ale/autoload/ale/fixers/cmakeformat.vim | 4 +- .../ale/autoload/ale/fixers/elm_format.vim | 2 +- .../ale/autoload/ale/fixers/erlfmt.vim | 2 +- .../ale/autoload/ale/fixers/fixjson.vim | 2 +- .../ale/autoload/ale/fixers/php_cs_fixer.vim | 2 +- .../ale/autoload/ale/fixers/phpcbf.vim | 2 +- .../ale/autoload/ale/fixers/prettier.vim | 2 +- .../autoload/ale/fixers/prettier_eslint.vim | 2 +- .../autoload/ale/fixers/prettier_standard.vim | 2 +- .../ale/autoload/ale/fixers/remark_lint.vim | 2 +- .../ale/autoload/ale/fixers/standard.vim | 2 +- .../ale/autoload/ale/fixers/stylelint.vim | 2 +- .../ale/autoload/ale/fixers/swiftformat.vim | 2 +- .../ale/autoload/ale/fixers/tidy.vim | 2 +- sources_non_forked/ale/autoload/ale/go.vim | 14 ++ .../ale/autoload/ale/handlers/alex.vim | 2 +- .../ale/autoload/ale/handlers/eslint.vim | 4 +- .../ale/autoload/ale/handlers/fecs.vim | 2 +- .../ale/autoload/ale/handlers/ocamllsp.vim | 9 +- .../ale/autoload/ale/handlers/ols.vim | 2 +- .../ale/autoload/ale/handlers/solhint.vim | 4 +- .../ale/autoload/ale/handlers/textlint.vim | 2 +- .../ale/autoload/ale/handlers/tslint.vim | 2 +- .../ale/autoload/ale/handlers/writegood.vim | 2 +- .../ale/autoload/ale/handlers/xo.vim | 2 +- .../ale/autoload/ale/linter.vim | 2 +- sources_non_forked/ale/autoload/ale/node.vim | 32 ---- sources_non_forked/ale/autoload/ale/path.vim | 36 +++++ sources_non_forked/ale/autoload/ale/sign.vim | 29 +++- sources_non_forked/ale/doc/ale-go.txt | 53 ++++++- sources_non_forked/ale/doc/ale.txt | 2 +- sources_non_forked/ale/supported-tools.md | 2 +- sources_non_forked/lightline.vim/LICENSE | 2 +- sources_non_forked/lightline.vim/README.md | 39 ++--- .../lightline.vim/colorscheme.md | 70 ++++----- .../lightline.vim/doc/lightline.txt | 3 - .../vim-fugitive/autoload/fugitive.vim | 137 ++++++++++++------ .../vim-fugitive/plugin/fugitive.vim | 4 +- .../vim-fugitive/syntax/fugitive.vim | 2 +- .../vim-gitgutter/doc/gitgutter.txt | 16 +- .../vim-javascript/syntax/javascript.vim | 4 +- 92 files changed, 412 insertions(+), 245 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim create mode 100644 sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim diff --git a/sources_non_forked/ale/ale_linters/css/stylelint.vim b/sources_non_forked/ale/ale_linters/css/stylelint.vim index 38cb0e0b..e508f392 100644 --- a/sources_non_forked/ale/ale_linters/css/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/css/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('css', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#css#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim index 2fa71adb..a02dbf42 100644 --- a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim +++ b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim @@ -28,7 +28,7 @@ endfunction call ale#linter#Define('elm', { \ 'name': 'elm_ls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ \ 'node_modules/.bin/elm-language-server', \ 'node_modules/.bin/elm-lsp', \ 'elm-lsp' diff --git a/sources_non_forked/ale/ale_linters/elm/make.vim b/sources_non_forked/ale/ale_linters/elm/make.vim index 48ed82f3..a7f9ea7b 100644 --- a/sources_non_forked/ale/ale_linters/elm/make.vim +++ b/sources_non_forked/ale/ale_linters/elm/make.vim @@ -202,7 +202,7 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " elm-test needs to know the path of elm-make if elm isn't installed globally. " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler if l:is_v19 && l:is_using_elm_test - let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' ' else let l:elm_test_compiler_flag = ' ' @@ -222,13 +222,13 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) if l:is_test && l:is_v19 - return ale#node#FindExecutable( + return ale#path#FindExecutable( \ a:buffer, \ 'elm_make', \ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm'] \) else - return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) endif endfunction diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim index f3f1bd6b..80909830 100644 --- a/sources_non_forked/ale/ale_linters/go/gopls.vim +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -5,6 +5,7 @@ call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_options', '--mode stdio') call ale#Set('go_gopls_init_options', {}) +call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#gopls#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) @@ -29,7 +30,9 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gopls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')}, +\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [ +\ ale#go#GetGoPathExecutable('bin/gopls'), +\ ])}, \ 'command': function('ale_linters#go#gopls#GetCommand'), \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), \ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index 84e70d58..5dc88f1a 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -1,8 +1,10 @@ " Author: Ben Reedy " Description: staticcheck for Go files +call ale#Set('go_staticcheck_executable', 'staticcheck') call ale#Set('go_staticcheck_options', '') call ale#Set('go_staticcheck_lint_package', 0) +call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#staticcheck#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_staticcheck_options') @@ -10,18 +12,20 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort let l:env = ale#go#EnvString(a:buffer) if l:lint_package - return l:env . 'staticcheck' + return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif - return l:env . 'staticcheck' + return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %s:t' endfunction call ale#linter#Define('go', { \ 'name': 'staticcheck', -\ 'executable': 'staticcheck', +\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [ +\ ale#go#GetGoPathExecutable('bin/staticcheck'), +\ ])}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#go#staticcheck#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim index bd4d1d31..8362bb1c 100644 --- a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -5,7 +5,7 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ + return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ \ 'node_modules/.bin/ember-template-lint', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/html/angular.vim b/sources_non_forked/ale/ale_linters/html/angular.vim index f550d665..17c0a751 100644 --- a/sources_non_forked/ale/ale_linters/html/angular.vim +++ b/sources_non_forked/ale/ale_linters/html/angular.vim @@ -11,7 +11,7 @@ function! ale_linters#html#angular#GetProjectRoot(buffer) abort endfunction function! ale_linters#html#angular#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'html_angular', [ + return ale#path#FindExecutable(a:buffer, 'html_angular', [ \ 'node_modules/@angular/language-server/bin/ngserver', \ 'node_modules/@angular/language-server/index.js', \]) diff --git a/sources_non_forked/ale/ale_linters/html/htmlhint.vim b/sources_non_forked/ale/ale_linters/html/htmlhint.vim index 3e01f51a..25bf5137 100644 --- a/sources_non_forked/ale/ale_linters/html/htmlhint.vim +++ b/sources_non_forked/ale/ale_linters/html/htmlhint.vim @@ -24,7 +24,7 @@ endfunction call ale#linter#Define('html', { \ 'name': 'htmlhint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ \ 'node_modules/.bin/htmlhint', \ ])}, \ 'command': function('ale_linters#html#htmlhint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/html/stylelint.vim b/sources_non_forked/ale/ale_linters/html/stylelint.vim index ae8955f3..6b7aba40 100644 --- a/sources_non_forked/ale/ale_linters/html/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/html/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('html_stylelint_options', '') call ale#Set('html_stylelint_use_global', 0) function! ale_linters#html#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'html_stylelint', [ + return ale#path#FindExecutable(a:buffer, 'html_stylelint', [ \ 'node_modules/.bin/stylelint', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/ink/ls.vim b/sources_non_forked/ale/ale_linters/ink/ls.vim index 1cc93583..00b2f323 100644 --- a/sources_non_forked/ale/ale_linters/ink/ls.vim +++ b/sources_non_forked/ale/ale_linters/ink/ls.vim @@ -6,7 +6,7 @@ call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('ink_ls_initialization_options', {}) function! ale_linters#ink#ls#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'ink_ls', [ + return ale#path#FindExecutable(a:buffer, 'ink_ls', [ \ 'ink-language-server', \ 'node_modules/.bin/ink-language-server', \]) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim index 3135e2e9..601bac33 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -22,7 +22,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort return '' endif - return ale#node#FindExecutable(a:buffer, 'javascript_flow', [ + return ale#path#FindExecutable(a:buffer, 'javascript_flow', [ \ 'node_modules/.bin/flow', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim index accaaa73..fec34011 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow-language-server', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_flow_ls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'node_modules/.bin/flow', \ ])}, \ 'command': '%e lsp --from ale-lsp', diff --git a/sources_non_forked/ale/ale_linters/javascript/jscs.vim b/sources_non_forked/ale/ale_linters/javascript/jscs.vim index 8905b3a1..ae3be68c 100644 --- a/sources_non_forked/ale/ale_linters/javascript/jscs.vim +++ b/sources_non_forked/ale/ale_linters/javascript/jscs.vim @@ -53,7 +53,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jscs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jscs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [ \ 'node_modules/.bin/jscs', \ ])}, \ 'command': function('ale_linters#javascript#jscs#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/javascript/jshint.vim b/sources_non_forked/ale/ale_linters/javascript/jshint.vim index d80a2250..26d4fda2 100644 --- a/sources_non_forked/ale/ale_linters/javascript/jshint.vim +++ b/sources_non_forked/ale/ale_linters/javascript/jshint.vim @@ -25,7 +25,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jshint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jshint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [ \ 'node_modules/.bin/jshint', \ ])}, \ 'command': function('ale_linters#javascript#jshint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/javascript/standard.vim b/sources_non_forked/ale/ale_linters/javascript/standard.vim index 1990adce..addf41dd 100644 --- a/sources_non_forked/ale/ale_linters/javascript/standard.vim +++ b/sources_non_forked/ale/ale_linters/javascript/standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale_linters#javascript#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/semistandard/bin/cmd.js', diff --git a/sources_non_forked/ale/ale_linters/javascript/tsserver.vim b/sources_non_forked/ale/ale_linters/javascript/tsserver.vim index 68c252c5..caf6972b 100644 --- a/sources_non_forked/ale/ale_linters/javascript/tsserver.vim +++ b/sources_non_forked/ale/ale_linters/javascript/tsserver.vim @@ -8,7 +8,7 @@ call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('javascript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [ \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/json/jsonlint.vim b/sources_non_forked/ale/ale_linters/json/jsonlint.vim index f677b488..812540af 100644 --- a/sources_non_forked/ale/ale_linters/json/jsonlint.vim +++ b/sources_non_forked/ale/ale_linters/json/jsonlint.vim @@ -4,7 +4,7 @@ call ale#Set('json_jsonlint_executable', 'jsonlint') call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#json#jsonlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [ + return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [ \ 'node_modules/.bin/jsonlint', \ 'node_modules/jsonlint/lib/cli.js', \]) diff --git a/sources_non_forked/ale/ale_linters/json/spectral.vim b/sources_non_forked/ale/ale_linters/json/spectral.vim index c7d56234..14129c56 100644 --- a/sources_non_forked/ale/ale_linters/json/spectral.vim +++ b/sources_non_forked/ale/ale_linters/json/spectral.vim @@ -6,7 +6,7 @@ call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0 call ale#linter#Define('json', { \ 'name': 'spectral', -\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', diff --git a/sources_non_forked/ale/ale_linters/less/lessc.vim b/sources_non_forked/ale/ale_linters/less/lessc.vim index 4ec8b00e..8e21f5b4 100644 --- a/sources_non_forked/ale/ale_linters/less/lessc.vim +++ b/sources_non_forked/ale/ale_linters/less/lessc.vim @@ -38,7 +38,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'lessc', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_lessc', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [ \ 'node_modules/.bin/lessc', \ ])}, \ 'command': function('ale_linters#less#lessc#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/less/stylelint.vim b/sources_non_forked/ale/ale_linters/less/stylelint.vim index efb036c2..83f784c4 100644 --- a/sources_non_forked/ale/ale_linters/less/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/less/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#less#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim index ed87d1ad..6085e7ef 100644 --- a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim +++ b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim @@ -39,7 +39,7 @@ endfunction call ale#linter#Define('markdown', { \ 'name': 'remark_lint', \ 'aliases': ['remark-lint'], -\ 'executable': {b -> ale#node#FindExecutable(b, 'markdown_remark_lint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'markdown_remark_lint', [ \ 'node_modules/.bin/remark', \ ])}, \ 'command': function('ale_linters#markdown#remark_lint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim b/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim new file mode 100644 index 00000000..799490f7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim @@ -0,0 +1,17 @@ +" Author: Andrey Popp -- @andreypopp +" Description: Report errors in OCaml code with Merlin + +if !exists('g:merlin') + finish +endif + +function! ale_linters#ocamlinterface#merlin#Handle(buffer, lines) abort + return merlin#ErrorLocList() +endfunction + +call ale#linter#Define('ocamlinterface', { +\ 'name': 'merlin', +\ 'executable': 'ocamlmerlin', +\ 'command': 'true', +\ 'callback': 'ale_linters#ocamlinterface#merlin#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim b/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim new file mode 100644 index 00000000..cd4bea80 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim @@ -0,0 +1,13 @@ +" Author: Risto Stevcev +" Description: The official language server for OCaml + +call ale#Set('ocaml_ocamllsp_use_opam', 1) + +call ale#linter#Define('ocamlinterface', { +\ 'name': 'ocamllsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), +\ 'command': function('ale#handlers#ocamllsp#GetCommand'), +\ 'language': function('ale#handlers#ocamllsp#GetLanguage'), +\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/php/intelephense.vim b/sources_non_forked/ale/ale_linters/php/intelephense.vim index aca619e3..0fdcc93e 100644 --- a/sources_non_forked/ale/ale_linters/php/intelephense.vim +++ b/sources_non_forked/ale/ale_linters/php/intelephense.vim @@ -26,7 +26,7 @@ call ale#linter#Define('php', { \ 'name': 'intelephense', \ 'lsp': 'stdio', \ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_intelephense', [])}, +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_intelephense', [])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/php/langserver.vim b/sources_non_forked/ale/ale_linters/php/langserver.vim index fdd1bf2b..c3d89a00 100644 --- a/sources_non_forked/ale/ale_linters/php/langserver.vim +++ b/sources_non_forked/ale/ale_linters/php/langserver.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'langserver', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_langserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_langserver', [ \ 'vendor/bin/php-language-server.php', \ ])}, \ 'command': 'php %e', diff --git a/sources_non_forked/ale/ale_linters/php/phpcs.vim b/sources_non_forked/ale/ale_linters/php/phpcs.vim index 3d88ad5d..ce47a13b 100644 --- a/sources_non_forked/ale/ale_linters/php/phpcs.vim +++ b/sources_non_forked/ale/ale_linters/php/phpcs.vim @@ -44,7 +44,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpcs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_phpcs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_phpcs', [ \ 'vendor/bin/phpcs', \ 'phpcs' \ ])}, diff --git a/sources_non_forked/ale/ale_linters/php/psalm.vim b/sources_non_forked/ale/ale_linters/php/psalm.vim index 286c8a96..dbbe9453 100644 --- a/sources_non_forked/ale/ale_linters/php/psalm.vim +++ b/sources_non_forked/ale/ale_linters/php/psalm.vim @@ -18,7 +18,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'psalm', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_psalm', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_psalm', [ \ 'vendor/bin/psalm', \ ])}, \ 'command': function('ale_linters#php#psalm#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/php/tlint.vim b/sources_non_forked/ale/ale_linters/php/tlint.vim index 6bba8def..80bdd1f6 100644 --- a/sources_non_forked/ale/ale_linters/php/tlint.vim +++ b/sources_non_forked/ale/ale_linters/php/tlint.vim @@ -20,7 +20,7 @@ function! ale_linters#php#tlint#GetProjectRoot(buffer) abort endfunction function! ale_linters#php#tlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_tlint', [ + return ale#path#FindExecutable(a:buffer, 'php_tlint', [ \ 'vendor/bin/tlint', \ 'tlint', \]) diff --git a/sources_non_forked/ale/ale_linters/pug/puglint.vim b/sources_non_forked/ale/ale_linters/pug/puglint.vim index c819cc45..b552cc06 100644 --- a/sources_non_forked/ale/ale_linters/pug/puglint.vim +++ b/sources_non_forked/ale/ale_linters/pug/puglint.vim @@ -47,7 +47,7 @@ endfunction call ale#linter#Define('pug', { \ 'name': 'puglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'pug_puglint', [ \ 'node_modules/.bin/pug-lint', \ ])}, \ 'output_stream': 'stderr', diff --git a/sources_non_forked/ale/ale_linters/purescript/ls.vim b/sources_non_forked/ale/ale_linters/purescript/ls.vim index 1c5f937f..a20fae47 100644 --- a/sources_non_forked/ale/ale_linters/purescript/ls.vim +++ b/sources_non_forked/ale/ale_linters/purescript/ls.vim @@ -6,7 +6,7 @@ call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0 call ale#Set('purescript_ls_config', {}) function! ale_linters#purescript#ls#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'purescript_ls', [ + return ale#path#FindExecutable(a:buffer, 'purescript_ls', [ \ 'node_modules/.bin/purescript-language-server', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/r/lintr.vim b/sources_non_forked/ale/ale_linters/r/lintr.vim index 799458fb..339ad2b0 100644 --- a/sources_non_forked/ale/ale_linters/r/lintr.vim +++ b/sources_non_forked/ale/ale_linters/r/lintr.vim @@ -1,5 +1,6 @@ " Author: Michel Lang , w0rp , -" Fenner Macrae +" Fenner Macrae , +" ourigen " Description: This file adds support for checking R code with lintr. let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()') @@ -21,7 +22,7 @@ function! ale_linters#r#lintr#GetCommand(buffer) abort let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' \ . l:lint_cmd - return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) . ' %t' + return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) . ' %t' endfunction call ale#linter#Define('r', { diff --git a/sources_non_forked/ale/ale_linters/sass/sasslint.vim b/sources_non_forked/ale/ale_linters/sass/sasslint.vim index 17cd3667..ff396e68 100644 --- a/sources_non_forked/ale/ale_linters/sass/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/sass/sasslint.vim @@ -5,7 +5,7 @@ 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', [ + return ale#path#FindExecutable(a:buffer, 'sass_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/sources_non_forked/ale/ale_linters/sass/stylelint.vim b/sources_non_forked/ale/ale_linters/sass/stylelint.vim index 7b14c6b4..22abef9b 100644 --- a/sources_non_forked/ale/ale_linters/sass/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/sass/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', call ale#linter#Define('sass', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sass_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': '%e --stdin-filename %s', diff --git a/sources_non_forked/ale/ale_linters/scss/sasslint.vim b/sources_non_forked/ale/ale_linters/scss/sasslint.vim index cf13546e..99027051 100644 --- a/sources_non_forked/ale/ale_linters/scss/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/scss/sasslint.vim @@ -5,7 +5,7 @@ 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', [ + return ale#path#FindExecutable(a:buffer, 'scss_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/sources_non_forked/ale/ale_linters/scss/stylelint.vim b/sources_non_forked/ale/ale_linters/scss/stylelint.vim index b5b21536..fea4ea8f 100644 --- a/sources_non_forked/ale/ale_linters/scss/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/scss/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('scss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'scss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#scss#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/sh/language_server.vim b/sources_non_forked/ale/ale_linters/sh/language_server.vim index 5a3b0e9a..c6781584 100644 --- a/sources_non_forked/ale/ale_linters/sh/language_server.vim +++ b/sources_non_forked/ale/ale_linters/sh/language_server.vim @@ -6,7 +6,7 @@ call ale#Set('sh_language_server_executable', 'bash-language-server') call ale#Set('sh_language_server_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sh#language_server#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'sh_language_server', [ + return ale#path#FindExecutable(a:buffer, 'sh_language_server', [ \ 'node_modules/.bin/bash-language-server', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/stylus/stylelint.vim b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim index ce6f9426..b60e38ed 100644 --- a/sources_non_forked/ale/ale_linters/stylus/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('stylus', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'stylus_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#stylus#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim b/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim index 6c705e46..879ff0ca 100644 --- a/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('sugarss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sugarss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#sugarss#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim index bcd10be8..2200b582 100644 --- a/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim +++ b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('svelte', { \ 'name': 'svelteserver', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'svelte_svelteserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'svelte_svelteserver', [ \ 'node_modules/.bin/svelteserver', \ ])}, \ 'command': '%e --stdio', diff --git a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim index 237c45d3..d08c68f6 100644 --- a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim +++ b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim @@ -5,7 +5,7 @@ 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', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftlint', [ \ 'Pods/SwiftLint/swiftlint', \ 'ios/Pods/SwiftLint/swiftlint', \ 'swiftlint', diff --git a/sources_non_forked/ale/ale_linters/terraform/tflint.vim b/sources_non_forked/ale/ale_linters/terraform/tflint.vim index f57ee6b6..86b5b74a 100644 --- a/sources_non_forked/ale/ale_linters/terraform/tflint.vim +++ b/sources_non_forked/ale/ale_linters/terraform/tflint.vim @@ -91,7 +91,7 @@ function! ale_linters#terraform#tflint#GetCommand(buffer) abort let l:cmd .= ' ' . l:opts endif - let l:cmd .= ' -f json %t' + let l:cmd .= ' -f json' return l:cmd endfunction @@ -99,6 +99,7 @@ endfunction call ale#linter#Define('terraform', { \ 'name': 'tflint', \ 'executable': {b -> ale#Var(b, 'terraform_tflint_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#terraform#tflint#GetCommand'), \ 'callback': 'ale_linters#terraform#tflint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/tex/texlab.vim b/sources_non_forked/ale/ale_linters/tex/texlab.vim index dd26fa0a..0794bf51 100644 --- a/sources_non_forked/ale/ale_linters/tex/texlab.vim +++ b/sources_non_forked/ale/ale_linters/tex/texlab.vim @@ -1,5 +1,5 @@ " Author: Ricardo Liang -" Author: ourigen +" Author: ourigen " Description: Texlab language server (Rust rewrite) call ale#Set('tex_texlab_executable', 'texlab') diff --git a/sources_non_forked/ale/ale_linters/typescript/standard.vim b/sources_non_forked/ale/ale_linters/typescript/standard.vim index da8f14eb..1d524a10 100644 --- a/sources_non_forked/ale/ale_linters/typescript/standard.vim +++ b/sources_non_forked/ale/ale_linters/typescript/standard.vim @@ -6,7 +6,7 @@ call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('typescript_standard_options', '') function! ale_linters#typescript#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_standard', [ + return ale#path#FindExecutable(a:buffer, 'typescript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', diff --git a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim index 4726e40d..d97becca 100644 --- a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim +++ b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim @@ -8,7 +8,7 @@ call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('typescript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'typescript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'typescript_tsserver', [ \ '.yarn/sdks/typescript/bin/tsserver', \ 'node_modules/.bin/tsserver', \ ])}, diff --git a/sources_non_forked/ale/ale_linters/vim/vimls.vim b/sources_non_forked/ale/ale_linters/vim/vimls.vim index 26014d66..7003eb04 100644 --- a/sources_non_forked/ale/ale_linters/vim/vimls.vim +++ b/sources_non_forked/ale/ale_linters/vim/vimls.vim @@ -52,7 +52,7 @@ call ale#linter#Define('vim', { \ 'name': 'vimls', \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')}, -\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'vim_vimls', [ \ 'node_modules/.bin/vim-language-server', \ ])}, \ 'command': '%e --stdio', diff --git a/sources_non_forked/ale/ale_linters/vue/vls.vim b/sources_non_forked/ale/ale_linters/vue/vls.vim index ac451f3c..4bd75286 100644 --- a/sources_non_forked/ale/ale_linters/vue/vls.vim +++ b/sources_non_forked/ale/ale_linters/vue/vls.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('vue', { \ 'name': 'vls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'vue_vls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [ \ 'node_modules/.bin/vls', \ ])}, \ 'command': '%e --stdio', diff --git a/sources_non_forked/ale/ale_linters/yaml/spectral.vim b/sources_non_forked/ale/ale_linters/yaml/spectral.vim index bd4623a5..13654f06 100644 --- a/sources_non_forked/ale/ale_linters/yaml/spectral.vim +++ b/sources_non_forked/ale/ale_linters/yaml/spectral.vim @@ -6,7 +6,7 @@ call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0 call ale#linter#Define('yaml', { \ 'name': 'spectral', -\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_spectral', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', diff --git a/sources_non_forked/ale/ale_linters/yaml/swaglint.vim b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim index 1f140e37..7fc2b430 100644 --- a/sources_non_forked/ale/ale_linters/yaml/swaglint.vim +++ b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim @@ -32,7 +32,7 @@ endfunction call ale#linter#Define('yaml', { \ 'name': 'swaglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_swaglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_swaglint', [ \ 'node_modules/.bin/swaglint', \ ])}, \ 'command': '%e -r compact --stdin', diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index efc9ebe0..1cd5b6ef 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -303,12 +303,12 @@ let s:default_registry = { \ }, \ 'ocamlformat': { \ 'function': 'ale#fixers#ocamlformat#Fix', -\ 'suggested_filetypes': ['ocaml'], +\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], \ 'description': 'Fix OCaml files with ocamlformat.', \ }, \ 'ocp-indent': { \ 'function': 'ale#fixers#ocp_indent#Fix', -\ 'suggested_filetypes': ['ocaml'], +\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], \ 'description': 'Fix OCaml files with ocp-indent.', \ }, \ 'refmt': { diff --git a/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim index b676068d..48103b2e 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim @@ -6,7 +6,7 @@ call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables' call ale#Set('bazel_buildifier_options', '') function! ale#fixers#buildifier#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'bazel_buildifier', [ + return ale#path#FindExecutable(a:buffer, 'bazel_buildifier', [ \ 'buildifier', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim index ecff080a..81498ebd 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim @@ -9,7 +9,7 @@ call ale#Set('c_clangformat_style_option', '') call ale#Set('c_clangformat_use_local_file', 0) function! ale#fixers#clangformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'c_clangformat', [ + return ale#path#FindExecutable(a:buffer, 'c_clangformat', [ \ 'clang-format', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim b/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim index f40ed6ed..dcc29cf3 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim @@ -10,9 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort return { \ 'command': ale#Escape(l:executable) - \ . ' -i ' \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, + \ . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim index cd2be2c3..a4740db4 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim @@ -6,7 +6,7 @@ call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('elm_format_options', '--yes') function! ale#fixers#elm_format#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'elm_format', [ + return ale#path#FindExecutable(a:buffer, 'elm_format', [ \ 'node_modules/.bin/elm-format', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim index e44046f1..f9951e9d 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim @@ -6,7 +6,7 @@ call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0 call ale#Set('erlang_erlfmt_options', '') function! ale#fixers#erlfmt#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) + return ale#path#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) endfunction function! ale#fixers#erlfmt#Fix(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim index 33ce0af3..4bad8f9b 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim @@ -6,7 +6,7 @@ call ale#Set('json_fixjson_options', '') call ale#Set('json_fixjson_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#fixjson#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_fixjson', [ + return ale#path#FindExecutable(a:buffer, 'json_fixjson', [ \ 'node_modules/.bin/fixjson', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim index 5c59e262..c8f9c7b0 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim @@ -6,7 +6,7 @@ call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0) call ale#Set('php_cs_fixer_options', '') function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [ + return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [ \ 'vendor/bin/php-cs-fixer', \ 'php-cs-fixer' \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim index 0a61c657..494bf346 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim @@ -7,7 +7,7 @@ call ale#Set('php_phpcbf_executable', 'phpcbf') call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#phpcbf#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [ + return ale#path#FindExecutable(a:buffer, 'php_phpcbf', [ \ 'vendor/bin/phpcbf', \ 'phpcbf' \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index a080d880..8a67e2ff 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_prettier_options', '') function! ale#fixers#prettier#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [ \ 'node_modules/.bin/prettier_d', \ 'node_modules/prettier-cli/index.js', \ 'node_modules/.bin/prettier', diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim index 09fadd71..0b9c88b7 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_ex call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ \ 'node_modules/prettier-eslint-cli/dist/index.js', \ 'node_modules/.bin/prettier-eslint', \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim index 9d982ff6..c8c09e31 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_prettier_standard_use_global', get(g:, 'ale_use_global_ call ale#Set('javascript_prettier_standard_options', '') function! ale#fixers#prettier_standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_standard', [ \ 'node_modules/prettier-standard/lib/index.js', \ 'node_modules/.bin/prettier-standard', \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim index 3ce442f3..85593b44 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim @@ -6,7 +6,7 @@ call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executab call ale#Set('markdown_remark_lint_options', '') function! ale#fixers#remark_lint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [ + return ale#path#FindExecutable(a:buffer, 'markdown_remark_lint', [ \ 'node_modules/remark-cli/cli.js', \ 'node_modules/.bin/remark', \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/standard.vim b/sources_non_forked/ale/autoload/ale/fixers/standard.vim index 46decebf..b9d60ebb 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale#fixers#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim index da067198..650b9c4a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim @@ -6,7 +6,7 @@ call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('stylelint_options', '') function! ale#fixers#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'stylelint', [ + return ale#path#FindExecutable(a:buffer, 'stylelint', [ \ 'node_modules/stylelint/bin/stylelint.js', \ 'node_modules/.bin/stylelint', \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim index 304182b2..cc553b7d 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim @@ -6,7 +6,7 @@ call ale#Set('swift_swiftformat_use_global', get(g:, 'ale_use_global_executables call ale#Set('swift_swiftformat_options', '') function! ale#fixers#swiftformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftformat', [ \ 'Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'swiftformat', diff --git a/sources_non_forked/ale/autoload/ale/fixers/tidy.vim b/sources_non_forked/ale/autoload/ale/fixers/tidy.vim index 1af4120b..2c79e73a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/tidy.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/tidy.vim @@ -5,7 +5,7 @@ call ale#Set('html_tidy_executable', 'tidy') call ale#Set('html_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#tidy#Fix(buffer) abort - let l:executable = ale#node#FindExecutable( + let l:executable = ale#path#FindExecutable( \ a:buffer, \ 'html_tidy', \ ['tidy'], diff --git a/sources_non_forked/ale/autoload/ale/go.vim b/sources_non_forked/ale/autoload/ale/go.vim index 4a21e596..bce85a87 100644 --- a/sources_non_forked/ale/autoload/ale/go.vim +++ b/sources_non_forked/ale/autoload/ale/go.vim @@ -42,3 +42,17 @@ function! ale#go#EnvString(buffer) abort return l:env endfunction + +function! ale#go#GetGoPathExecutable(suffix) abort + let l:prefix = $GOPATH + + if !empty($GOPATH) + let l:prefix = $GOPATH + elseif has('win32') + let l:prefix = $USERPROFILE . '/go' + else + let l:prefix = $HOME . '/go' + endif + + return ale#path#Simplify(l:prefix . '/' . a:suffix) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/alex.vim b/sources_non_forked/ale/autoload/ale/handlers/alex.vim index 190a7f86..6ef4867f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/alex.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/alex.vim @@ -3,7 +3,7 @@ scriptencoding utf-8 " Description: Error handling for errors in alex output format function! ale#handlers#alex#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'alex', [ + return ale#path#FindExecutable(a:buffer, 'alex', [ \ 'node_modules/.bin/alex', \ 'node_modules/alex/cli.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index e953d40f..7c492968 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -36,7 +36,7 @@ function! ale#handlers#eslint#FindConfig(buffer) abort endfunction function! ale#handlers#eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables) + return ale#path#FindExecutable(a:buffer, 'javascript_eslint', s:executables) endfunction " Given a buffer, return an appropriate working directory for ESLint. @@ -49,7 +49,7 @@ function! ale#handlers#eslint#GetCwd(buffer) abort " If eslint is installed in a directory which contains the buffer, assume " it is the ESLint project root. Otherwise, use nearest node_modules. " Note: If node_modules not present yet, can't load local deps anyway. - let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) if !empty(l:executable) let l:nmi = strridx(l:executable, 'node_modules') diff --git a/sources_non_forked/ale/autoload/ale/handlers/fecs.vim b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim index 5362edb9..064b927e 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/fecs.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim @@ -9,7 +9,7 @@ function! ale#handlers#fecs#GetCommand(buffer) abort endfunction function! ale#handlers#fecs#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_fecs', [ + return ale#path#FindExecutable(a:buffer, 'javascript_fecs', [ \ 'node_modules/.bin/fecs', \ 'node_modules/fecs/bin/fecs', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim index 07d9b0cf..2738ea2b 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim @@ -1,6 +1,13 @@ " Author: Risto Stevcev " Description: Handlers for the official OCaml language server +let s:language_id_of_filetype = { +\ 'menhir': 'ocaml.menhir', +\ 'ocaml': 'ocaml', +\ 'ocamlinterface': 'ocaml.interface', +\ 'ocamllex': 'ocaml.lex' +\} + function! ale#handlers#ocamllsp#GetExecutable(buffer) abort return 'ocamllsp' endfunction @@ -13,7 +20,7 @@ function! ale#handlers#ocamllsp#GetCommand(buffer) abort endfunction function! ale#handlers#ocamllsp#GetLanguage(buffer) abort - return getbufvar(a:buffer, '&filetype') + return s:language_id_of_filetype[getbufvar(a:buffer, '&filetype')] endfunction function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/ols.vim b/sources_non_forked/ale/autoload/ale/handlers/ols.vim index 74130a26..c292c6d9 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ols.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ols.vim @@ -4,7 +4,7 @@ function! ale#handlers#ols#GetExecutable(buffer) abort let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' - return ale#node#FindExecutable(a:buffer, l:ols_setting, [ + return ale#path#FindExecutable(a:buffer, l:ols_setting, [ \ 'node_modules/.bin/ocaml-language-server', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim index 61ab2a60..611aa7bd 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim @@ -66,7 +66,7 @@ function! ale#handlers#solhint#FindConfig(buffer) abort endfunction function! ale#handlers#solhint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'solidity_solhint', s:executables) + return ale#path#FindExecutable(a:buffer, 'solidity_solhint', s:executables) endfunction " Given a buffer, return an appropriate working directory for solhint. @@ -74,7 +74,7 @@ function! ale#handlers#solhint#GetCwd(buffer) abort " If solhint is installed in a directory which contains the buffer, assume " it is the solhint project root. Otherwise, use nearest node_modules. " Note: If node_modules not present yet, can't load local deps anyway. - let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables) + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) if !empty(l:executable) let l:nmi = strridx(l:executable, 'node_modules') diff --git a/sources_non_forked/ale/autoload/ale/handlers/textlint.vim b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim index 6d495b0d..7a648617 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/textlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim @@ -6,7 +6,7 @@ call ale#Set('textlint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('textlint_options', '') function! ale#handlers#textlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'textlint', [ + return ale#path#FindExecutable(a:buffer, 'textlint', [ \ 'node_modules/.bin/textlint', \ 'node_modules/textlint/bin/textlint.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/tslint.vim b/sources_non_forked/ale/autoload/ale/handlers/tslint.vim index 90579344..ee091d24 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/tslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/tslint.vim @@ -7,7 +7,7 @@ function! ale#handlers#tslint#InitVariables() abort endfunction function! ale#handlers#tslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [ + return ale#path#FindExecutable(a:buffer, 'typescript_tslint', [ \ 'node_modules/.bin/tslint', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/writegood.vim b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim index 8ae61a38..b5b91b3f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/writegood.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim @@ -11,7 +11,7 @@ endfunction call ale#handlers#writegood#ResetOptions() function! ale#handlers#writegood#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'writegood', [ + return ale#path#FindExecutable(a:buffer, 'writegood', [ \ 'node_modules/.bin/write-good', \ 'node_modules/write-good/bin/write-good.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/xo.vim b/sources_non_forked/ale/autoload/ale/handlers/xo.vim index c63278c0..a87c6d8f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/xo.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/xo.vim @@ -9,7 +9,7 @@ call ale#Set('typescript_xo_options', '') function! ale#handlers#xo#GetExecutable(buffer) abort let l:type = ale#handlers#xo#GetType(a:buffer) - return ale#node#FindExecutable(a:buffer, l:type . '_xo', [ + return ale#path#FindExecutable(a:buffer, l:type . '_xo', [ \ 'node_modules/xo/cli.js', \ 'node_modules/.bin/xo', \]) diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index d26b9443..cbc79064 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -41,7 +41,7 @@ let s:default_ale_linters = { \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], -\ 'go': ['gofmt', 'golint', 'go vet'], +\ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim index 9b9b335a..9e11ca7e 100644 --- a/sources_non_forked/ale/autoload/ale/node.vim +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -3,38 +3,6 @@ call ale#Set('windows_node_executable_path', 'node.exe') -" Given a buffer number, a base variable name, and a list of paths to search -" for in ancestor directories, detect the executable path for a Node program. -" -" The use_global and executable options for the relevant program will be used. -function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort - if ale#Var(a:buffer, a:base_var_name . '_use_global') - return ale#Var(a:buffer, a:base_var_name . '_executable') - endif - - let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list) - - if !empty(l:nearest) - return l:nearest - endif - - return ale#Var(a:buffer, a:base_var_name . '_executable') -endfunction - -" Given a buffer number, a base variable name, and a list of paths to search -" for in ancestor directories, detect the executable path for a Node program. -function! ale#node#FindNearestExecutable(buffer, path_list) abort - for l:path in a:path_list - let l:executable = ale#path#FindNearestFile(a:buffer, l:path) - - if !empty(l:executable) - return l:executable - endif - endfor - - return '' -endfunction - " Create a executable string which executes a Node.js script command with a " Node.js executable if needed. " diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index 00e31310..c7bfd47e 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -77,6 +77,42 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor return l:path endfunction +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +function! ale#path#FindNearestExecutable(buffer, path_list) abort + for l:path in a:path_list + if ale#path#IsAbsolute(l:path) + let l:executable = filereadable(l:path) ? l:path : '' + else + let l:executable = ale#path#FindNearestFile(a:buffer, l:path) + endif + + if !empty(l:executable) + return l:executable + endif + endfor + + return '' +endfunction + +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +" +" The use_global and executable options for the relevant program will be used. +function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort + if ale#Var(a:buffer, a:base_var_name . '_use_global') + return ale#Var(a:buffer, a:base_var_name . '_executable') + endif + + let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list) + + if !empty(l:nearest) + return l:nearest + endif + + return ale#Var(a:buffer, a:base_var_name . '_executable') +endfunction + " Return 1 if a path is an absolute path. function! ale#path#IsAbsolute(filename) abort if has('win32') && a:filename[:0] is# '\' diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 2864f39b..e796f0f0 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -203,6 +203,27 @@ function! ale#sign#ParsePattern() abort return l:pattern endfunction +" Given a buffer number, return a List of placed signs [line, id, group] +function! ale#sign#ParseSignsWithGetPlaced(buffer) abort + let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale' : '' })[0].signs + let l:result = [] + let l:is_dummy_sign_set = 0 + + for l:sign in l:signs + if l:sign['name'] is# 'ALEDummySign' + let l:is_dummy_sign_set = 1 + else + call add(l:result, [ + \ str2nr(l:sign['lnum']), + \ str2nr(l:sign['id']), + \ l:sign['name'], + \]) + endif + endfor + + return [l:is_dummy_sign_set, l:result] +endfunction + " Given a list of lines for sign output, return a List of [line, id, group] function! ale#sign#ParseSigns(line_list) abort let l:pattern =ale#sign#ParsePattern() @@ -229,9 +250,13 @@ function! ale#sign#ParseSigns(line_list) abort endfunction function! ale#sign#FindCurrentSigns(buffer) abort - let l:line_list = ale#sign#ReadSigns(a:buffer) + if exists('*sign_getplaced') + return ale#sign#ParseSignsWithGetPlaced(a:buffer) + else + let l:line_list = ale#sign#ReadSigns(a:buffer) - return ale#sign#ParseSigns(l:line_list) + return ale#sign#ParseSigns(l:line_list) + endif endfunction " Given a loclist, group the List into with one List per line. diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 8364fd5b..7813c7b3 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -20,8 +20,8 @@ the benefit of running a number of linters, more than ALE would by default, while ensuring it doesn't run any linters known to be slow or resource intensive. -g:ale_go_go_executable *g:ale_go_go_options* - *b:ale_go_go_options* +g:ale_go_go_executable *g:ale_go_go_executable* + *b:ale_go_go_executable* Type: |String| Default: `'go'` @@ -194,12 +194,30 @@ g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package* =============================================================================== gopls *ale-go-gopls* +gopls is the official Go language server, and is enabled for use with ALE by +default. + +To install the latest stable version of `gopls` to your `$GOPATH`, try the +following command: > + + GO111MODULE=on go get golang.org/x/tools/gopls@latest +< +If `$GOPATH` is readable by ALE, it should probably work without you having to +do anything else. See the `gopls` README file for more information: + +https://github.com/golang/tools/blob/master/gopls/README.md + + g:ale_go_gopls_executable *g:ale_go_gopls_executable* *b:ale_go_gopls_executable* Type: |String| Default: `'gopls'` - Location of the gopls binary file. + See |ale-integrations-local-executables| + + ALE will search for `gopls` in locally installed directories first by + default, and fall back on a globally installed `gopls` if it can't be found + otherwise. g:ale_go_gopls_options *g:ale_go_gopls_options* @@ -229,6 +247,15 @@ g:ale_go_gopls_init_options *g:ale_go_gopls_init_options* For a full list of supported analyzers, see: https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md + +g:ale_go_gopls_use_global *g:ale_go_gopls_use_global* + *b:ale_go_gopls_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== govet *ale-go-govet* @@ -262,6 +289,18 @@ g:ale_go_revive_options *g:ale_go_revive_options* =============================================================================== staticcheck *ale-go-staticcheck* +g:ale_go_staticcheck_executable *g:ale_go_staticcheck_executable* + *b:ale_go_staticcheck_executable* + Type: |String| + Default: `'staticcheck'` + + See |ale-integrations-local-executables| + + ALE will search for `staticcheck` in locally installed directories first by + default, and fall back on a globally installed `staticcheck` if it can't be + found otherwise. + + g:ale_go_staticcheck_options *g:ale_go_staticcheck_options* *b:ale_go_staticcheck_options* Type: |String| @@ -280,5 +319,13 @@ g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* current file. +g:ale_go_staticcheck_use_global *g:ale_go_staticcheck_use_global* + *b:ale_go_staticcheck_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index 96069d5a..b7059af9 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -1580,7 +1580,7 @@ g:ale_linters *g:ale_linters* \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], - \ 'go': ['gofmt', 'golint', 'go vet'], + \ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index ce408936..0f33006b 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -192,7 +192,7 @@ formatting. * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: - * [gopls](https://github.com/golang/go/wiki/gopls) :warning: + * [gopls](https://github.com/golang/go/wiki/gopls) * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: diff --git a/sources_non_forked/lightline.vim/LICENSE b/sources_non_forked/lightline.vim/LICENSE index ee9e0c80..3aab9e6a 100644 --- a/sources_non_forked/lightline.vim/LICENSE +++ b/sources_non_forked/lightline.vim/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2020 itchyny +Copyright (c) 2013-2021 itchyny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index 41f98022..c2975e05 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -11,44 +11,29 @@ https://github.com/itchyny/lightline.vim ![lightline.vim - wombat](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/wombat.png) -### jellybeans +### solarized (`background=dark`) -![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans.png) +![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) -### solarized dark +### solarized (`background=light`) -![lightline.vim - solarized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) +![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) -### solarized light +### PaperColor (`background=dark`) -![lightline.vim - solarized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) +![lightline.vim - PaperColor_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_dark.png) -### PaperColor dark +### PaperColor (`background=light`) -![lightline.vim - PaperColor dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_dark.png) +![lightline.vim - PaperColor_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) -### PaperColor light +### one (`background=dark`) -![lightline.vim - PaperColor light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) +![lightline.vim - one_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) -### seoul256 - -![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png) - -### one dark - -![lightline.vim - one dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) - -### one light - -![lightline.vim - one light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) - -### landscape - -![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png) - -landscape is my colorscheme, which is a high-contrast cterm-supported colorscheme, available at https://github.com/itchyny/landscape.vim +### one (`background=light`) +![lightline.vim - one_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) For screenshots of all available colorshemes, see [this file](colorscheme.md). diff --git a/sources_non_forked/lightline.vim/colorscheme.md b/sources_non_forked/lightline.vim/colorscheme.md index 4858ad1d..e9dd87f6 100644 --- a/sources_non_forked/lightline.vim/colorscheme.md +++ b/sources_non_forked/lightline.vim/colorscheme.md @@ -16,45 +16,45 @@ ![lightline.vim - OldHope](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/OldHope.png) -### PaperColor dark +### PaperColor (`background=dark`) -![lightline.vim - PaperColor dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_dark.png) +![lightline.vim - PaperColor_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_dark.png) -### PaperColor light +### PaperColor (`background=light`) -![lightline.vim - PaperColor light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) +![lightline.vim - PaperColor_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor_light.png) ### Tomorrow ![lightline.vim - Tomorrow](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow.png) -### Tomorrow Night +### Tomorrow_Night -![lightline.vim - Tomorrow Night](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night.png) +![lightline.vim - Tomorrow_Night](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night.png) -### Tomorrow Night Blue +### Tomorrow_Night_Blue -![lightline.vim - Tomorrow Night Blue](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Blue.png) +![lightline.vim_- Tomorrow_Night_Blue](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Blue.png) -### Tomorrow Night Bright +### Tomorrow_Night_Bright -![lightline.vim - Tomorrow Night Bright](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Bright.png) +![lightline.vim - Tomorrow_Night_Bright](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Bright.png) -### Tomorrow Night Eighties +### Tomorrow_Night_Eighties -![lightline.vim - Tomorrow Night Eighties](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Eighties.png) +![lightline.vim - Tomorrow_Night_Eighties](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Tomorrow_Night_Eighties.png) ### ayu_mirage -![lightline.vim - ayu mirage](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_mirage.png) +![lightline.vim - ayu_mirage](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_mirage.png) ### ayu_light -![lightline.vim - ayu light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_light.png) +![lightline.vim - ayu_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_light.png) ### ayu_dark -![lightline.vim - ayu dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_dark.png) +![lightline.vim - ayu_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_dark.png) ### darcula @@ -68,29 +68,29 @@ ![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans.png) -### selenized dark +### selenized_dark -![lightline.vim - selenized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_dark.png) +![lightline.vim - selenized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_dark.png) -### selenized black +### selenized_black -![lightline.vim - selenized black](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_black.png) +![lightline.vim - selenized_black](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_black.png) -### selenized light +### selenized_light -![lightline.vim - selenized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_light.png) +![lightline.vim - selenized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_light.png) -### selenized white +### selenized_white -![lightline.vim - selenized white](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_white.png) +![lightline.vim - selenized_white](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/selenized_white.png) -### solarized dark +### solarized (`background=dark`) -![lightline.vim - solarized dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) +![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png) -### solarized light +### solarized (`background=light`) -![lightline.vim - solarized light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) +![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png) ### materia @@ -112,13 +112,13 @@ ![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png) -### one dark +### one (`background=dark`) -![lightline.vim - one dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) +![lightline.vim - one_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_dark.png) -### one light +### one (`background=light`) -![lightline.vim - one light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) +![lightline.vim - one_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one_light.png) ### srcery_drk @@ -136,10 +136,10 @@ ![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png) -### 16color dark +### 16color (`background=dark`) -![lightline.vim - 16color dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_dark.png) +![lightline.vim - 16color_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_dark.png) -### 16color light +### 16color (`background=light`) -![lightline.vim - 16color light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_light.png) +![lightline.vim - 16color_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/16color_light.png) diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index e334c6bb..767c0075 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -306,9 +306,6 @@ Exposed functions for lightline.vim. lightline#update() *lightline#update()* Updates all the statuslines of existing windows. - lightline#update_once() *lightline#update_once()* - Updates the statuslines only once. - lightline#enable() *lightline#enable()* Enables |lightline|. diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 10d2f708..26f1637c 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -6,12 +6,6 @@ if exists('g:autoloaded_fugitive') endif let g:autoloaded_fugitive = 1 -if !exists('g:fugitive_git_executable') - let g:fugitive_git_executable = 'git' -elseif g:fugitive_git_executable =~# '^\w\+=' - let g:fugitive_git_executable = 'env ' . g:fugitive_git_executable -endif - " Section: Utility function! s:function(name) abort @@ -233,6 +227,41 @@ endfunction " Section: Git +function! s:GitCmd() abort + if !exists('g:fugitive_git_executable') + return ['git'] + elseif type(g:fugitive_git_executable) == type([]) + return g:fugitive_git_executable + else + let dquote = '"\%([^"]\|""\|\\"\)*"\|' + let string = g:fugitive_git_executable + let list = [] + if string =~# '^\w\+=' + call add(list, 'env') + endif + while string =~# '\S' + let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+') + let string = strpart(string, len(arg)) + let arg = substitute(arg, '^\s\+', '', '') + let arg = substitute(arg, + \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, + \ '\=submatch(0)[0] ==# "\\" ? submatch(0)[1] : submatch(0)[1:-2]', 'g') + call add(list, arg) + endwhile + return list + endif +endfunction + +function! s:GitShellCmd() abort + if !exists('g:fugitive_git_executable') + return 'git' + elseif type(g:fugitive_git_executable) == type([]) + return s:shellesc(g:fugitive_git_executable) + else + return g:fugitive_git_executable + endif +endfunction + function! s:UserCommandCwd(dir) abort let tree = s:Tree(a:dir) return len(tree) ? FugitiveVimPath(tree) : getcwd() @@ -242,7 +271,13 @@ function! s:UserCommandList(...) abort if !fugitive#GitVersion(1, 8, 5) throw 'fugitive: Git 1.8.5 or higher required' endif - let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+') + if !exists('g:fugitive_git_command') + let git = s:GitCmd() + elseif type(g:fugitive_git_command) == type([]) + let git = g:fugitive_git_command + else + let git = split(g:fugitive_git_command, '\s\+') + endif let flags = [] if a:0 && type(a:1) == type({}) let git = copy(get(a:1, 'git', git)) @@ -270,13 +305,14 @@ endfunction let s:git_versions = {} function! fugitive#GitVersion(...) abort - if !has_key(s:git_versions, g:fugitive_git_executable) - let s:git_versions[g:fugitive_git_executable] = matchstr(s:SystemError(g:fugitive_git_executable.' --version')[0], '\d[^[:space:]]\+') + let git = s:GitShellCmd() + if !has_key(s:git_versions, git) + let s:git_versions[git] = matchstr(s:SystemError(git.' --version')[0], '\d[^[:space:]]\+') endif if !a:0 - return s:git_versions[g:fugitive_git_executable] + return s:git_versions[git] endif - let components = split(s:git_versions[g:fugitive_git_executable], '\D\+') + let components = split(s:git_versions[git], '\D\+') if empty(components) return -1 endif @@ -368,7 +404,7 @@ function! fugitive#PrepareDirEnvGitArgv(...) abort if !fugitive#GitVersion(1, 8, 5) throw 'fugitive: Git 1.8.5 or higher required' endif - let git = split(g:fugitive_git_executable) + let git = s:GitCmd() if a:0 && type(a:1) ==# type([]) let cmd = a:000[1:-1] + a:1 else @@ -587,9 +623,10 @@ let s:config = {} function! fugitive#Config(...) abort let dir = s:Dir() let name = '' + let default = get(a:, 3, '') if a:0 >= 2 && type(a:2) == type({}) let name = substitute(a:1, '^[^.]\+\|[^.]\+$', '\L&', 'g') - return len(a:1) ? get(get(a:2, name, []), 0, '') : a:2 + return len(a:1) ? get(get(a:2, name, []), 0, default) : a:2 elseif a:0 >= 2 let dir = a:2 let name = a:1 @@ -624,16 +661,16 @@ function! fugitive#Config(...) abort let s:config[dir_key] = [s:ConfigTimestamps(dir, dict), dict] lockvar! dict endif - return len(name) ? get(get(dict, name, []), 0, '') : dict + return len(name) ? get(get(dict, name, []), 0, default) : dict endfunction function! s:Remote(dir) abort let head = FugitiveHead(0, a:dir) - let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : '' + let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', a:dir) : '' let i = 10 while remote ==# '.' && i > 0 - let head = matchstr(fugitive#Config('branch.' . head . '.merge'), 'refs/heads/\zs.*') - let remote = len(head) ? fugitive#Config('branch.' . head . '.remote') : '' + let head = matchstr(FugitiveConfigGet('branch.' . head . '.merge', a:dir), 'refs/heads/\zs.*') + let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', a:dir) : '' let i -= 1 endwhile return remote =~# '^\.\=$' ? 'origin' : remote @@ -845,7 +882,7 @@ function! s:repo_prepare(...) dict abort endfunction function! s:repo_git_command(...) dict abort - let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) + let git = s:GitShellCmd() . ' --git-dir='.s:shellesc(self.git_dir) return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') endfunction @@ -870,7 +907,7 @@ endfunction call s:add_methods('repo',['superglob']) function! s:repo_config(name) dict abort - return fugitive#Config(a:name, self.git_dir) + return FugitiveConfigGet(a:name, self.git_dir) endfunction function! s:repo_user() dict abort @@ -1975,9 +2012,9 @@ function! fugitive#BufReadStatus() abort let pull_type = 'Pull' if len(pull) - let rebase = fugitive#Config('branch.' . branch . '.rebase', config) + let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config) if empty(rebase) - let rebase = fugitive#Config('pull.rebase', config) + let rebase = FugitiveConfigGet('pull.rebase', config) endif if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$' let pull_type = 'Rebase' @@ -1986,11 +2023,11 @@ function! fugitive#BufReadStatus() abort endif endif - let push_remote = fugitive#Config('branch.' . branch . '.pushRemote', config) + let push_remote = FugitiveConfigGet('branch.' . branch . '.pushRemote', config) if empty(push_remote) - let push_remote = fugitive#Config('remote.pushDefault', config) + let push_remote = FugitiveConfigGet('remote.pushDefault', config) endif - let fetch_remote = fugitive#Config('branch.' . branch . '.remote', config) + let fetch_remote = FugitiveConfigGet('branch.' . branch . '.remote', config) if empty(fetch_remote) let fetch_remote = 'origin' endif @@ -1998,7 +2035,7 @@ function! fugitive#BufReadStatus() abort let push_remote = fetch_remote endif - let push_default = fugitive#Config('push.default') + let push_default = FugitiveConfigGet('push.default', config) if empty(push_default) let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching' endif @@ -2095,7 +2132,7 @@ function! fugitive#BufReadStatus() abort if &bufhidden ==# '' setlocal bufhidden=delete endif - let b:dispatch = '-dir=' . fnameescape(len(s:Tree()) ? s:Tree() : s:Dir()) . ' ' . g:fugitive_git_executable . ' fetch --all' + let b:dispatch = '-dir=' . fnameescape(len(s:Tree()) ? s:Tree() : s:Dir()) . ' ' . s:GitShellCmd() . ' fetch --all' call fugitive#MapJumps() call s:Map('n', '-', ":execute Do('Toggle',0)", '') call s:Map('x', '-', ":execute Do('Toggle',1)", '') @@ -2261,8 +2298,8 @@ function! fugitive#BufReadCmd(...) abort setlocal endofline try - if &foldmethod ==# 'marker' && b:fugitive_type !=# 'blob' - setlocal foldmethod=manual + if b:fugitive_type !=# 'blob' + setlocal foldmarker=<<<<<<<<,>>>>>>>> endif silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' @@ -2405,7 +2442,7 @@ function! s:TempReadPost(file) abort if has_key(dict, 'filetype') let &l:filetype = dict.filetype endif - setlocal foldmarker=<<<<<<<,>>>>>>> + setlocal foldmarker=<<<<<<<<,>>>>>>>> if !&modifiable if empty(mapcheck('q', 'n')) nnoremap q :echoerr "fugitive: q is removed in favor of gq (or :q)" @@ -2626,7 +2663,7 @@ function! s:RunTick(job) abort if type(a:job) == v:t_number return jobwait([a:job], 1)[0] == -1 elseif type(a:job) == 8 - let running = ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run' + let running = ch_status(a:job) !~# '^closed$\|^failed$' || job_status(a:job) ==# 'run' sleep 1m return running endif @@ -2815,14 +2852,14 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let cmd = s:StatusCommand(a:line1, a:line2, a:range, a:line2, a:bang, a:mods, '', '', []) return (empty(cmd) ? 'exe' : cmd) . after endif - let alias = fugitive#Config('alias.' . get(args, 0, ''), config) + let alias = FugitiveConfigGet('alias.' . get(args, 0, ''), config) if get(args, 1, '') !=# '--help' && alias !~# '^$\|^!\|[\"'']' && !filereadable(s:ExecPath() . '/git-' . args[0]) \ && !(has('win32') && filereadable(s:ExecPath() . '/git-' . args[0] . '.exe')) call remove(args, 0) call extend(args, split(alias, '\s\+'), 'keep') endif let name = substitute(get(args, 0, ''), '\%(^\|-\)\(\l\)', '\u\1', 'g') - let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+') + let git = s:UserCommandList() let options = {'git': git, 'dir': dir, 'flags': flags} if pager is# -1 && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try @@ -2981,10 +3018,11 @@ endfunction let s:exec_paths = {} function! s:ExecPath() abort - if !has_key(s:exec_paths, g:fugitive_git_executable) - let s:exec_paths[g:fugitive_git_executable] = s:sub(system(g:fugitive_git_executable.' --exec-path'),'\n$','') + let git = s:GitShellCmd() + if !has_key(s:exec_paths, git) + let s:exec_paths[git] = s:sub(system(git.' --exec-path'),'\n$','') endif - return s:exec_paths[g:fugitive_git_executable] + return s:exec_paths[git] endfunction let s:subcommands_before_2_5 = [ @@ -3026,7 +3064,7 @@ function! s:CompletableSubcommands(dir) abort endif call extend(commands, s:path_subcommands[cpath]) endfor - call extend(commands, map(filter(keys(fugitive#Config(a:dir)), 'v:val =~# "^alias\\.[^.]*$"'), 'strpart(v:val, 6)')) + call extend(commands, keys(FugitiveConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir))) let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+') let rejected = {} for command in configured @@ -3101,7 +3139,7 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args try let mods = s:Mods(a:mods, &splitbelow ? 'botright' : 'topleft') let file = fugitive#Find(':', dir) - let arg = ' +let\ w:fugitive_status=FugitiveGitDir() ' . + let arg = ' +setl\ foldmarker=<<<<<<<<,>>>>>>>>\|let\ w:fugitive_status=FugitiveGitDir() ' . \ s:fnameescape(file) for tabnr in [tabpagenr()] + (mods =~# '\' ? range(1, tabpagenr('$')) : []) let bufs = tabpagebuflist(tabnr) @@ -4457,10 +4495,7 @@ function! s:ToolStream(line1, line2, range, bang, mods, options, args, state) ab let a:state.mode = 'init' let a:state.from = '' let a:state.to = '' - let exec = s:UserCommandList({'git': a:options.git, 'dir': a:options.dir}) - if !s:HasOpt(argv, '--name-status') && !prompt - let exec += ['-c', 'diff.context=0'] - endif + let exec = s:UserCommandList({'git': a:options.git, 'dir': a:options.dir}) + ['-c', 'diff.context=0'] let exec += a:options.flags + ['--no-pager', 'diff', '--no-ext-diff', '--no-color', '--no-prefix'] + argv if prompt let title = ':Git ' . s:fnameescape(a:options.flags + [a:options.subcommand] + a:options.subcommand_args) @@ -5570,9 +5605,9 @@ endfunction function! s:Keywordprg() abort let args = ' --git-dir='.escape(s:Dir(),"\\\"' ") if has('gui_running') && !has('win32') - return g:fugitive_git_executable . ' --no-pager' . args . ' log -1' + return s:GitShellCmd() . ' --no-pager' . args . ' log -1' else - return g:fugitive_git_executable . args . ' show' + return s:GitShellCmd() . args . ' show' endif endfunction @@ -6069,7 +6104,7 @@ function! fugitive#BlameFileType() abort call s:Map('n', '', ':help :Git_blame', '') call s:Map('n', 'g?', ':help :Git_blame', '') if mapcheck('q', 'n') =~# '^$\|bdelete' - call s:Map('n', 'q', 'echoerr "fugitive: q removed in favor of gq (or :q)"', '') + call s:Map('n', 'q', ':echoerr "fugitive: q removed in favor of gq (or :q)"', '') endif call s:Map('n', 'gq', ':exe BlameQuit()', '') call s:Map('n', '<2-LeftMouse>', ':exe BlameCommit("exe BlameLeave()edit")', '') @@ -6251,9 +6286,15 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, args) abo let remote = r endif if r ==# '.' || r ==# remote - let merge = m - if path =~# '^\.git/refs/heads/.' - let path = '.git/refs/heads/'.merge + let remote_ref = 'refs/remotes/' . remote . '/' . branch + if FugitiveConfigGet('push.default', dir) ==# 'upstream' || + \ !filereadable(FugitiveFind('.git/' . remote_ref, dir)) && s:ChompError(['rev-parse', '--verify', remote_ref, '--'], dir)[1] + let merge = m + if path =~# '^\.git/refs/heads/.' + let path = '.git/refs/heads/'.merge + endif + else + let merge = branch endif endif endif @@ -6368,7 +6409,7 @@ function! s:SquashArgument(...) abort if &filetype == 'fugitive' let commit = matchstr(getline('.'), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze \|^' . s:ref_header . ': \zs\S\+') elseif has_key(s:temp_files, s:cpath(expand('%:p'))) - let commit = matchstr(getline('.'), '\<\x\{4,\}\>') + let commit = matchstr(getline('.'), '\S\@') else let commit = s:Owner(@%) endif diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index e19ac7e2..19f5ba2b 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -128,8 +128,8 @@ endfunction " structure of the return value as it is not guaranteed. If you want a full " dictionary of every config value, use FugitiveConfigGetRegexp('.*'). function! FugitiveConfig(...) abort - if a:0 == 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir')) - return fugitive#Config(a:1, FugitiveGitDir(a:2)) + if a:0 >= 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir')) + return call('fugitive#Config', [a:1, FugitiveGitDir(a:2)] + a:000[2:-1]) elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.') return fugitive#Config(FugitiveGitDir(a:1)) else diff --git a/sources_non_forked/vim-fugitive/syntax/fugitive.vim b/sources_non_forked/vim-fugitive/syntax/fugitive.vim index e84eba4e..aab99c45 100644 --- a/sources_non_forked/vim-fugitive/syntax/fugitive.vim +++ b/sources_non_forked/vim-fugitive/syntax/fugitive.vim @@ -26,7 +26,7 @@ syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@ syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection syn match fugitiveHash /\S\@. To stage part of the hunk, move to the preview window, delete any lines you do not want to stage, and |GitGutterStageHunk|. + To close a non-floating preview window use |:pclose| + or |CTRL-W_z| or |CTRL-W_CTRL-Z|; or normal window- + closing (|:quit| or |:close| or |CTRL-W_c|) if your cursor + is in the preview window. + + To close a floating window when the cursor is in the + original buffer, move the cursor. + + To close a floating window when the cursor is in the + floating window use normal window-closing, or move to + the original window with |CTRL-W_p|. Alternatively set + |g:gitgutter_close_preview_on_escape| and use . + Commands for folds:~ *gitgutter-:GitGutterFold* diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index d1a72071..76c575ee 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -54,7 +54,7 @@ syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup= syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial extend syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial extend syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString -syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\%(\x\|_\)\+\)\>/ +syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\%(\x\|_\)\+\)n\=\>/ syntax keyword jsNumber Infinity syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=\d\+\)\=\>/ @@ -110,7 +110,7 @@ syntax keyword jsAsyncKeyword async await syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock " Keywords -syntax keyword jsGlobalObjects ArrayBuffer Array BigInt64Array BigUint64Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Boolean Buffer Collator DataView Date DateTimeFormat Function Intl Iterator JSON Map Set WeakMap WeakSet Math Number NumberFormat Object ParallelArray Promise Proxy Reflect RegExp String Symbol Uint8ClampedArray WebAssembly console document fetch window +syntax keyword jsGlobalObjects ArrayBuffer Array BigInt BigInt64Array BigUint64Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Boolean Buffer Collator DataView Date DateTimeFormat Function Intl Iterator JSON Map Set WeakMap WeakRef WeakSet Math Number NumberFormat Object ParallelArray Promise Proxy Reflect RegExp String Symbol Uint8ClampedArray WebAssembly console document fetch window syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename syntax match jsGlobalNodeObjects /\/ containedin=jsFuncCall syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError From 8cba9bb7a8083743bead046df862cf487bc447c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 22:30:45 +0200 Subject: [PATCH 64/91] Bump rake in /sources_non_forked/vim-multiple-cursors (#633) --- sources_non_forked/vim-multiple-cursors/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index e833b243..5e909c4a 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (10.4.2) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From da40fe1222402f2dd3c44407343b48422dbc231a Mon Sep 17 00:00:00 2001 From: luc Date: Sun, 6 Jun 2021 15:51:23 +0800 Subject: [PATCH 65/91] feat: include editorconfig-vim plugin Signed-off-by: luc --- .../editorconfig-vim/.appveyor.yml | 107 ++++ .../editorconfig-vim/.editorconfig | 27 + .../editorconfig-vim/.gitignore | 8 + .../editorconfig-vim/.gitmodules | 6 + .../editorconfig-vim/.travis.yml | 30 + .../editorconfig-vim/CONTRIBUTORS | 6 + sources_non_forked/editorconfig-vim/LICENSE | 26 + .../editorconfig-vim/LICENSE.PSF | 53 ++ sources_non_forked/editorconfig-vim/README.md | 148 +++++ .../autoload/editorconfig.vim | 60 ++ .../autoload/editorconfig_core.vim | 147 +++++ .../autoload/editorconfig_core/fnmatch.vim | 465 ++++++++++++++++ .../autoload/editorconfig_core/handler.vim | 183 ++++++ .../autoload/editorconfig_core/ini.vim | 273 +++++++++ .../autoload/editorconfig_core/util.vim | 84 +++ .../editorconfig-vim/doc/editorconfig.txt | 203 +++++++ sources_non_forked/editorconfig-vim/mkzip.sh | 3 + .../editorconfig-vim/plugin/editorconfig.vim | 525 ++++++++++++++++++ .../tests/core/CMakeLists.txt | 53 ++ .../tests/core/CTestCustom.cmake | 34 ++ .../editorconfig-vim/tests/core/ecvbslib.vbs | 171 ++++++ .../editorconfig-vim/tests/core/ecvimlib.ps1 | 140 +++++ .../editorconfig-vim/tests/core/editorconfig | 219 ++++++++ .../tests/core/editorconfig.bat | 11 + .../tests/core/editorconfig1.vbs | 39 ++ .../tests/core/editorconfig2.ps1 | 218 ++++++++ .../editorconfig-vim/tests/fetch-vim.bat | 12 + .../editorconfig-vim/tests/fetch-vim.sh | 41 ++ .../editorconfig-vim/tests/plugin/.gitignore | 2 + .../editorconfig-vim/tests/plugin/Gemfile | 5 + .../tests/plugin/Gemfile.lock | 27 + .../editorconfig-vim/tests/plugin/Rakefile | 8 + .../tests/plugin/spec/.editorconfig | 4 + .../tests/plugin/spec/editorconfig_spec.rb | 161 ++++++ .../editorconfig-vim/tests/travis-test.sh | 45 ++ update_plugins.py | 1 + vimrcs/plugins_config.vim | 6 + 37 files changed, 3551 insertions(+) create mode 100644 sources_non_forked/editorconfig-vim/.appveyor.yml create mode 100644 sources_non_forked/editorconfig-vim/.editorconfig create mode 100644 sources_non_forked/editorconfig-vim/.gitignore create mode 100644 sources_non_forked/editorconfig-vim/.gitmodules create mode 100644 sources_non_forked/editorconfig-vim/.travis.yml create mode 100644 sources_non_forked/editorconfig-vim/CONTRIBUTORS create mode 100644 sources_non_forked/editorconfig-vim/LICENSE create mode 100644 sources_non_forked/editorconfig-vim/LICENSE.PSF create mode 100644 sources_non_forked/editorconfig-vim/README.md create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig.vim create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig_core.vim create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig_core/fnmatch.vim create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig_core/handler.vim create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim create mode 100644 sources_non_forked/editorconfig-vim/autoload/editorconfig_core/util.vim create mode 100644 sources_non_forked/editorconfig-vim/doc/editorconfig.txt create mode 100644 sources_non_forked/editorconfig-vim/mkzip.sh create mode 100644 sources_non_forked/editorconfig-vim/plugin/editorconfig.vim create mode 100644 sources_non_forked/editorconfig-vim/tests/core/CMakeLists.txt create mode 100644 sources_non_forked/editorconfig-vim/tests/core/CTestCustom.cmake create mode 100644 sources_non_forked/editorconfig-vim/tests/core/ecvbslib.vbs create mode 100644 sources_non_forked/editorconfig-vim/tests/core/ecvimlib.ps1 create mode 100644 sources_non_forked/editorconfig-vim/tests/core/editorconfig create mode 100644 sources_non_forked/editorconfig-vim/tests/core/editorconfig.bat create mode 100644 sources_non_forked/editorconfig-vim/tests/core/editorconfig1.vbs create mode 100644 sources_non_forked/editorconfig-vim/tests/core/editorconfig2.ps1 create mode 100644 sources_non_forked/editorconfig-vim/tests/fetch-vim.bat create mode 100644 sources_non_forked/editorconfig-vim/tests/fetch-vim.sh create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/.gitignore create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/Gemfile create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/Gemfile.lock create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/Rakefile create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/spec/.editorconfig create mode 100644 sources_non_forked/editorconfig-vim/tests/plugin/spec/editorconfig_spec.rb create mode 100644 sources_non_forked/editorconfig-vim/tests/travis-test.sh diff --git a/sources_non_forked/editorconfig-vim/.appveyor.yml b/sources_non_forked/editorconfig-vim/.appveyor.yml new file mode 100644 index 00000000..630fc2f4 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/.appveyor.yml @@ -0,0 +1,107 @@ +# appveyor.yml for editorconfig-vim. Currently only tests the core. +# Modified from https://github.com/ppalaga/ec4j/commit/1c849658fb189cd95bc41af95acd43b4f0d75a48 +# +# Copyright (c) 2017--2019 Angelo Zerr and other contributors as +# indicated by the @author tags. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @author Chris White (cxw42) - Adapted to editorconfig-vim + +# === When to build === +# See https://www.appveyor.com/docs/how-to/filtering-commits/ + +skip_commits: + message: /\[minor\]/ + files: + - '**/*.md' + +# === Build matrix === + +# Win is default; Ubuntu is override. See +# https://www.appveyor.com/blog/2018/04/25/specialized-build-matrix-configuration-in-appveyor/ +image: + - Visual Studio 2013 + - Ubuntu1604 + +# === How to build === + +cache: + - C:\vim -> .appveyor.yml, tests\fetch-vim.bat + +environment: + VIM_EXE: C:\vim\vim\vim80\vim.exe + +for: + # Don't run the Windows build if the commit message includes "[ci-linux]" + - + matrix: + only: + - image: Visual Studio 2013 + skip_commits: + message: /\[ci-linux\]/ + + # Platform-specific configuration for Ubuntu + - + matrix: + only: + - image: Ubuntu1604 + # $APPVEYOR_BUILD_FOLDER isn't expanded in the environment section + # here, so I can't set $VIM_EXE the way I want to. Instead, + # I set $VIM_EXE in the sh-specific install steps below. + environment: + VIM_EXE: UNDEFINED + cache: + - $APPVEYOR_BUILD_FOLDER/vim -> .appveyor.yml, tests/fetch-vim.sh + + # Plus, don't run Ubuntu if the commit message includes [ci-win] + skip_commits: + message: /\[ci-win\]/ + +install: + # Ubuntu-specific setup. These carry forward to the build_script. + - sh: export VIM_EXE="$APPVEYOR_BUILD_FOLDER/vim/bin/vim" + - sh: export PATH="$PATH":$APPVEYOR_BUILD_FOLDER/vim/bin + - sh: echo "$VIM_EXE , $PATH" + + # Cross-platform - test the core + - cmake --version + - git submodule update --init --recursive + - cmd: tests\fetch-vim + - sh: tests/fetch-vim.sh + +build_script: + # Build the core tests + - cd tests + - cd core + - mkdir build + - cd build + - cmake .. + +# Note on multicore testing: +# Two cores are available per https://help.appveyor.com/discussions/questions/11179-how-many-cores-and-threads-can-be-used-in-free-appveyor-build . +# However, using -j2 seems to make each job take much longer. + +test_script: + # Run the core tests + - ctest . --output-on-failure -C Debug + + # CTestCustom specifies skipping UTF-8 tests on Windows. + - cmd: echo "Reminder - did not try UTF-8" + - sh: echo "Reminder - tried UTF-8" + +on_failure: + - echo "failed" + - cmd: type tests\core\build\Testing\Temporary\LastTest.log + - sh: cat tests/core/build/Testing/Temporary/LastTest.log + diff --git a/sources_non_forked/editorconfig-vim/.editorconfig b/sources_non_forked/editorconfig-vim/.editorconfig new file mode 100644 index 00000000..7eed9e11 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/.editorconfig @@ -0,0 +1,27 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +max_line_length = 80 + +[*.{vim,sh}] +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 80 + +[*.rb] +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 120 + +[*.yml] +indent_style = space +indent_size = 2 + +[*.{bat,vbs,ps1}] +end_of_line = CRLF diff --git a/sources_non_forked/editorconfig-vim/.gitignore b/sources_non_forked/editorconfig-vim/.gitignore new file mode 100644 index 00000000..1d86f15e --- /dev/null +++ b/sources_non_forked/editorconfig-vim/.gitignore @@ -0,0 +1,8 @@ +tags +tests/**/build +tests/**/.bundle + +# Editor backup files +*.swp +*~ +~* diff --git a/sources_non_forked/editorconfig-vim/.gitmodules b/sources_non_forked/editorconfig-vim/.gitmodules new file mode 100644 index 00000000..8cf01bc4 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/.gitmodules @@ -0,0 +1,6 @@ +[submodule "plugin_tests"] + path = tests/plugin/spec/plugin_tests + url = https://github.com/editorconfig/editorconfig-plugin-tests.git +[submodule "core_tests"] + path = tests/core/tests + url = https://github.com/editorconfig/editorconfig-core-test.git diff --git a/sources_non_forked/editorconfig-vim/.travis.yml b/sources_non_forked/editorconfig-vim/.travis.yml new file mode 100644 index 00000000..1eaad3b3 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/.travis.yml @@ -0,0 +1,30 @@ +# Make sure xvfb works - https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-xvfb-directly +dist: trusty + +matrix: + include: + - name: "plugin" + env: TEST_WHICH=plugin + language: ruby + rvm: + - 2.2.4 + gemfile: tests/plugin/Gemfile + - name: "core" + env: TEST_WHICH=core + +addons: + apt: + packages: + - vim-gtk + +before_script: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + +script: + ./tests/travis-test.sh + +notifications: + email: + on_success: change + on_failure: always diff --git a/sources_non_forked/editorconfig-vim/CONTRIBUTORS b/sources_non_forked/editorconfig-vim/CONTRIBUTORS new file mode 100644 index 00000000..b799668c --- /dev/null +++ b/sources_non_forked/editorconfig-vim/CONTRIBUTORS @@ -0,0 +1,6 @@ +Contributors to the EditorConfig Vim Plugin: + +Hong Xu +Trey Hunner +Kent Frazier +Chris White diff --git a/sources_non_forked/editorconfig-vim/LICENSE b/sources_non_forked/editorconfig-vim/LICENSE new file mode 100644 index 00000000..ed9286e0 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/LICENSE @@ -0,0 +1,26 @@ +Unless otherwise stated, all files are distributed under the Simplified BSD +license included below. + +Copyright (c) 2011-2019 EditorConfig Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/sources_non_forked/editorconfig-vim/LICENSE.PSF b/sources_non_forked/editorconfig-vim/LICENSE.PSF new file mode 100644 index 00000000..36eb8e0d --- /dev/null +++ b/sources_non_forked/editorconfig-vim/LICENSE.PSF @@ -0,0 +1,53 @@ +Some code in editorconfig-vim is derived from code licensed under the +PSF license. The following is the text of that license, retrieved 2019-05-05 +from https://docs.python.org/2.6/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python + +PSF LICENSE AGREEMENT FOR PYTHON 2.6.9 + +1. This LICENSE AGREEMENT is between the Python Software Foundation +(``PSF''), and the Individual or Organization (``Licensee'') accessing and +otherwise using Python 2.6.9 software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 2.6.9 +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., ``Copyright (c) +2001-2010 Python Software Foundation; All Rights Reserved'' are +retained in Python 2.6.9 alone or in any derivative version prepared +by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 2.6.9 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 2.6.9. + +4. PSF is making Python 2.6.9 available to Licensee on an ``AS IS'' +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. +BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY +REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY +PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.6.9 WILL NOT INFRINGE +ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +2.6.9 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.6.9, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python 2.6.9, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + +# vi: set ft=: diff --git a/sources_non_forked/editorconfig-vim/README.md b/sources_non_forked/editorconfig-vim/README.md new file mode 100644 index 00000000..248d315e --- /dev/null +++ b/sources_non_forked/editorconfig-vim/README.md @@ -0,0 +1,148 @@ +# EditorConfig Vim Plugin + +[![Travis Build Status](https://img.shields.io/travis/cxw42/editorconfig-vim.svg?logo=travis)](https://travis-ci.org/editorconfig/editorconfig-vim) +[![Appveyor Build Status](https://img.shields.io/appveyor/ci/cxw42/editorconfig-vim.svg?logo=appveyor)](https://ci.appveyor.com/project/cxw42/editorconfig-vim) + +This is an [EditorConfig][] plugin for Vim. This plugin can be found on both +[GitHub][] and [Vim online][]. + +## Installation + +To install this plugin, you can use one of the following ways: + +### Install with the archive + +Download the [archive][] and extract it into your Vim runtime directory +(`~/.vim` on UNIX/Linux and `$VIM_INSTALLATION_FOLDER\vimfiles` on windows). +You should have 3 sub-directories in this runtime directory now: "autoload", +"doc" and "plugin". + +### Install as Vim8 plugin + +Install as a Vim 8 plugin. Note `local` can be any name, but some path +element must be present. On Windows, instead of `~/.vim` use +`$VIM_INSTALLATION_FOLDER\vimfiles`. +```shell +mkdir -p ~/.vim/pack/local/start +cd ~/.vim/pack/local/start +git clone https://github.com/editorconfig/editorconfig-vim.git +``` + +### Install with [pathogen][] + +Use pathogen (the git repository of this plugin is +https://github.com/editorconfig/editorconfig-vim.git) + +### Install with [Vundle][] + +Use Vundle by adding to your `.vimrc` Vundle plugins section: + +```viml +Plugin 'editorconfig/editorconfig-vim' +``` + +Then call `:PluginInstall`. + +### Install with [vim-plug][] + +Use vim-plug by adding to your `.vimrc` in your plugin section: + +```viml +Plug 'editorconfig/editorconfig-vim' +``` + +Source your `.vimrc` by calling `:source $MYVIMRC`. + +Then call `:PlugInstall`. + +### No external editorconfig core library is required + +Previous versions of this plugin also required a Python "core". +The core included the code to parse `.editorconfig` files. +This plugin **includes** the core, so you don't need to download the +core separately. + +## Supported properties + +The EditorConfig Vim plugin supports the following EditorConfig [properties][]: + +* `indent_style` +* `indent_size` +* `tab_width` +* `end_of_line` +* `charset` +* `insert_final_newline` (Feature `+fixendofline`, available on Vim 7.4.785+, + or [PreserveNoEOL][] is required for this property) +* `trim_trailing_whitespace` +* `max_line_length` +* `root` (only used by EditorConfig core) + +## Selected Options + +The supported options are documented in [editorconfig.txt][] +and can be viewed by executing the following: `:help editorconfig`. You may +need to execute `:helptags ALL` so that Vim is aware of editorconfig.txt. + +### Excluded patterns + +To ensure that this plugin works well with [Tim Pope's fugitive][], use the +following patterns array: + +```viml +let g:EditorConfig_exclude_patterns = ['fugitive://.*'] +``` + +If you wanted to avoid loading EditorConfig for any remote files over ssh: + +```viml +let g:EditorConfig_exclude_patterns = ['scp://.*'] +``` + +Of course these two items could be combined into the following: + +```viml +let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] +``` + +### Disable for a specific filetype + +You can disable this plugin for a specific buffer by setting +`b:EditorConfig_disable`. Therefore, you can disable the +plugin for all buffers of a specific filetype. For example, to disable +EditorConfig for all git commit messages (filetype `gitcommit`): + +```viml +au FileType gitcommit let b:EditorConfig_disable = 1 +``` + +### Disable rules + +In very rare cases, +you might need to override some project-specific EditorConfig rules in global +or local vimrc in some cases, e.g., to resolve conflicts of trailing whitespace +trimming and buffer autosaving. This is not recommended, but you can: + +```viml +let g:EditorConfig_disable_rules = ['trim_trailing_whitespace'] +``` + +You are able to disable any supported EditorConfig properties. + +## Bugs and Feature Requests + +Feel free to submit bugs, feature requests, and other issues to the +[issue tracker][]. Be sure you have read the [contribution guidelines][]! + +[EditorConfig]: http://editorconfig.org +[GitHub]: https://github.com/editorconfig/editorconfig-vim +[PreserveNoEOL]: http://www.vim.org/scripts/script.php?script_id=4550 +[Tim Pope's fugitive]: https://github.com/tpope/vim-fugitive +[Vim online]: http://www.vim.org/scripts/script.php?script_id=3934 +[Vundle]: https://github.com/gmarik/Vundle.vim +[archive]: https://github.com/editorconfig/editorconfig-vim/archive/master.zip +[contribution guidelines]: https://github.com/editorconfig/editorconfig/blob/master/CONTRIBUTING.md#submitting-an-issue +[issue tracker]: https://github.com/editorconfig/editorconfig-vim/issues +[pathogen]: https://github.com/tpope/vim-pathogen +[properties]: http://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties +[editorconfig.txt]: https://github.com/editorconfig/editorconfig-vim/blob/master/doc/editorconfig.txt +[vim-plug]: https://github.com/junegunn/vim-plug diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig.vim new file mode 100644 index 00000000..1f61a330 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig.vim @@ -0,0 +1,60 @@ +" autoload/editorconfig.vim: EditorConfig native Vimscript plugin +" Copyright (c) 2011-2019 EditorConfig Team +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. +" + +if v:version < 700 + finish +endif + +let s:saved_cpo = &cpo +set cpo&vim + +" {{{1 variables +let s:hook_list = [] + +function! editorconfig#AddNewHook(func) " {{{1 + " Add a new hook + + call add(s:hook_list, a:func) +endfunction + +function! editorconfig#ApplyHooks(config) abort " {{{1 + " apply hooks + + for Hook in s:hook_list + let l:hook_ret = Hook(a:config) + + if type(l:hook_ret) != type(0) && l:hook_ret != 0 + " TODO print some debug info here + endif + endfor +endfunction + +" }}} + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vim: fdm=marker fdc=3 diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core.vim new file mode 100644 index 00000000..6885e17c --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core.vim @@ -0,0 +1,147 @@ +" autoload/editorconfig_core.vim: top-level functions for +" editorconfig-core-vimscript and editorconfig-vim. + +" Copyright (c) 2018-2020 EditorConfig Team, including Chris White {{{1 +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. }}}1 + +let s:saved_cpo = &cpo +set cpo&vim + +" Variables {{{1 + +" Note: we create this variable in every script that accesses it. Normally, I +" would put this in plugin/editorconfig.vim. However, in some of my tests, +" the command-line testing environment did not load plugin/* in the normal +" way. Therefore, I do the check everywhere so I don't have to special-case +" the command line. + +if !exists('g:editorconfig_core_vimscript_debug') + let g:editorconfig_core_vimscript_debug = 0 +endif +" }}}1 + +" The latest version of the specification that we support. +" See discussion at https://github.com/editorconfig/editorconfig/issues/395 +function! editorconfig_core#version() + return [0,13,0] +endfunction + +" === CLI =============================================================== {{{1 + +" For use from the command line. Output settings for in_name to +" the buffer named out_name. If an optional argument is provided, it is the +" name of the config file to use (default '.editorconfig'). +" TODO support multiple files +" +" filename (if any) +" @param names {Dictionary} The names of the files to use for this run +" - output [required] Where the editorconfig settings should be written +" - target [required] A string or list of strings to process. Each +" must be a full path. +" - dump [optional] If present, write debug info to this file +" @param job {Dictionary} What to do - same format as the input of +" editorconfig_core#handler#get_configurations(), +" except without the target member. + +function! editorconfig_core#currbuf_cli(names, job) " out_name, in_name, ... + let l:output = [] + + " Preprocess the job + let l:job = deepcopy(a:job) + + if has_key(l:job, 'version') " string to list + let l:ver = split(editorconfig_core#util#strip(l:job.version), '\v\.') + for l:idx in range(len(l:ver)) + let l:ver[l:idx] = str2nr(l:ver[l:idx]) + endfor + + let l:job.version = l:ver + endif + + " TODO provide version output from here instead of the shell script +" if string(a:names) ==? 'version' +" return +" endif +" + if type(a:names) != type({}) || type(a:job) != type({}) + throw 'Need two Dictionary arguments' + endif + + if has_key(a:names, 'dump') + execute 'redir! > ' . fnameescape(a:names.dump) + echom 'Names: ' . string(a:names) + echom 'Job: ' . string(l:job) + let g:editorconfig_core_vimscript_debug = 1 + endif + + if type(a:names['target']) == type([]) + let l:targets = a:names.target + else + let l:targets = [a:names.target] + endif + + for l:target in l:targets + + " Pre-process quoting weirdness so we are more flexible in the face + " of CMake+CTest+BAT+Powershell quoting. + + " Permit wrapping in double-quotes + let l:target = substitute(l:target, '\v^"(.*)"$', '\1', '') + + " Permit empty ('') entries in l:targets + if strlen(l:target)<1 + continue + endif + + if has_key(a:names, 'dump') + echom 'Trying: ' . string(l:target) + endif + + let l:job.target = l:target + let l:options = editorconfig_core#handler#get_configurations(l:job) + + if has_key(a:names, 'dump') + echom 'editorconfig_core#currbuf_cli result: ' . string(l:options) + endif + + if len(l:targets) > 1 + let l:output += [ '[' . l:target . ']' ] + endif + + for [ l:key, l:value ] in items(l:options) + let l:output += [ l:key . '=' . l:value ] + endfor + + endfor "foreach target + + " Write the output file + call writefile(l:output, a:names.output) +endfunction "editorconfig_core#currbuf_cli + +" }}}1 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vi: set fdm=marker fo-=ro: diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/fnmatch.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/fnmatch.vim new file mode 100644 index 00000000..6f60db5d --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/fnmatch.vim @@ -0,0 +1,465 @@ +" autoload/editorconfig_core/fnmatch.vim: Globbing for +" editorconfig-vim. Ported from the Python core's fnmatch.py. + +" Copyright (c) 2012-2019 EditorConfig Team {{{1 +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. }}}1 + +"Filename matching with shell patterns. +" +"fnmatch(FILENAME, PATH, PATTERN) matches according to the local convention. +"fnmatchcase(FILENAME, PATH, PATTERN) always takes case in account. +" +"The functions operate by translating the pattern into a regular +"expression. They cache the compiled regular expressions for speed. +" +"The function translate(PATTERN) returns a regular expression +"corresponding to PATTERN. (It does not compile it.) + +let s:saved_cpo = &cpo +set cpo&vim + +" variables {{{1 +if !exists('g:editorconfig_core_vimscript_debug') + let g:editorconfig_core_vimscript_debug = 0 +endif +" }}}1 +" === Regexes =========================================================== {{{1 +let s:LEFT_BRACE = '\v%(^|[^\\])\{' +"LEFT_BRACE = re.compile( +" r""" +" +" (?: ^ | [^\\] ) # Beginning of string or a character besides "\" +" +" \{ # "{" +" +" """, re.VERBOSE +") + +let s:RIGHT_BRACE = '\v%(^|[^\\])\}' +"RIGHT_BRACE = re.compile( +" r""" +" +" (?: ^ | [^\\] ) # Beginning of string or a character besides "\" +" +" \} # "}" +" +" """, re.VERBOSE +") + +let s:NUMERIC_RANGE = '\v([+-]?\d+)' . '\.\.' . '([+-]?\d+)' +"NUMERIC_RANGE = re.compile( +" r""" +" ( # Capture a number +" [+-] ? # Zero or one "+" or "-" characters +" \d + # One or more digits +" ) +" +" \.\. # ".." +" +" ( # Capture a number +" [+-] ? # Zero or one "+" or "-" characters +" \d + # One or more digits +" ) +" """, re.VERBOSE +") + +" }}}1 +" === Internal functions ================================================ {{{1 + +" Dump the bytes of a:text. For debugging use. +function! s:dump_bytes(text) + let l:idx=0 + while l:idx < strlen(a:text) + let l:byte_val = char2nr(a:text[l:idx]) + echom printf('%10s%-5d%02x %s', '', l:idx, l:byte_val, + \ a:text[l:idx]) + let l:idx+=1 + endwhile +endfunction "s:dump_bytes + +" Dump the characters of a:text and their codepoints. For debugging use. +function! s:dump_chars(text) + let l:chars = split(a:text, '\zs') + let l:idx = 0 + let l:out1 = '' + let l:out2 = '' + while l:idx < len(l:chars) + let l:char = l:chars[l:idx] + let l:out1 .= printf('%5s', l:char) + let l:out2 .= printf('%5x', char2nr(l:char)) + let l:idx+=1 + endwhile + + echom l:out1 + echom l:out2 +endfunction "s:dump_chars + +" }}}1 +" === Translating globs to patterns ===================================== {{{1 + +" Used by s:re_escape: backslash-escape any character below U+0080; +" replace all others with a %U escape. +" See https://vi.stackexchange.com/a/19617/1430 by yours truly +" (https://vi.stackexchange.com/users/1430/cxw). +unlockvar s:replacement_expr +let s:replacement_expr = + \ '\=' . + \ '((char2nr(submatch(1)) >= 128) ? ' . + \ 'printf("%%U%08x", char2nr(submatch(1))) : ' . + \ '("\\" . submatch(1))' . + \ ')' +lockvar s:replacement_expr + +" Escaper for very-magic regexes +function! s:re_escape(text) + return substitute(a:text, '\v([^0-9a-zA-Z_])', s:replacement_expr, 'g') +endfunction + +"def translate(pat, nested=0): +" Translate a shell PATTERN to a regular expression. +" There is no way to quote meta-characters. +function! editorconfig_core#fnmatch#translate(pat, ...) + let l:nested = 0 + if a:0 + let l:nested = a:1 + endif + + if g:editorconfig_core_vimscript_debug + echom '- fnmatch#translate: pattern ' . a:pat + echom printf( + \ '- %d chars', strlen(substitute(a:pat, ".", "x", "g"))) + call s:dump_chars(a:pat) + endif + + let l:pat = a:pat " TODO remove if we wind up not needing this + + " Note: the Python sets MULTILINE and DOTALL, but Vim has \_. + " instead of DOTALL, and \_^ / \_$ instead of MULTILINE. + + let l:is_escaped = 0 + + " Find out whether the pattern has balanced braces. + let l:left_braces=[] + let l:right_braces=[] + call substitute(l:pat, s:LEFT_BRACE, '\=add(l:left_braces, 1)', 'g') + call substitute(l:pat, s:RIGHT_BRACE, '\=add(l:right_braces, 1)', 'g') + " Thanks to http://jeromebelleman.gitlab.io/posts/productivity/vimsub/ + let l:matching_braces = (len(l:left_braces) == len(l:right_braces)) + + " Unicode support (#2). Indexing l:pat[l:index] returns bytes, per + " https://github.com/neovim/neovim/issues/68#issue-28114985 . + " Instead, use split() per vimdoc to break the input string into an + " array of *characters*, and process that. + let l:characters = split(l:pat, '\zs') + + let l:index = 0 " character index + let l:length = len(l:characters) + let l:brace_level = 0 + let l:in_brackets = 0 + + let l:result = '' + let l:numeric_groups = [] + while l:index < l:length + let l:current_char = l:characters[l:index] + let l:index += 1 + +" if g:editorconfig_core_vimscript_debug +" echom ' - fnmatch#translate: ' . l:current_char . '@' . +" \ (l:index-1) . '; result ' . l:result +" endif + + if l:current_char ==# '*' + let l:pos = l:index + if l:pos < l:length && l:characters[l:pos] ==# '*' + let l:result .= '\_.*' + let l:index += 1 " skip the second star + else + let l:result .= '[^/]*' + endif + + elseif l:current_char ==# '?' + let l:result .= '\_[^/]' + + elseif l:current_char ==# '[' + if l:in_brackets + let l:result .= '\[' + else + let l:pos = l:index + let l:has_slash = 0 + while l:pos < l:length && l:characters[l:pos] != ']' + if l:characters[l:pos] ==# '/' && l:characters[l:pos-1] !=# '\' + let has_slash = 1 + break + endif + let l:pos += 1 + endwhile + if l:has_slash + " POSIX IEEE 1003.1-2017 sec. 2.13.3: '/' cannot occur + " in a bracket expression, so [/] matches a literal + " three-character string '[' . '/' . ']'. + let l:result .= '\[' + \ . s:re_escape(join(l:characters[l:index : l:pos-1], '')) + \ . '\/' + " escape the slash + let l:index = l:pos + 1 + " resume after the slash + else + if l:index < l:length && l:characters[l:index] =~# '\v%(\^|\!)' + let l:index += 1 + let l:result .= '[^' + else + let l:result .= '[' + endif + let l:in_brackets = 1 + endif + endif + + elseif l:current_char ==# '-' + if l:in_brackets + let l:result .= l:current_char + else + let l:result .= '\' . l:current_char + endif + + elseif l:current_char ==# ']' + if l:in_brackets && !l:is_escaped + let l:result .= ']' + let l:in_brackets = 0 + elseif l:is_escaped + let l:result .= '\]' + let l:is_escaped = 0 + else + let l:result .= '\]' + endif + + elseif l:current_char ==# '{' + let l:pos = l:index + let l:has_comma = 0 + while l:pos < l:length && (l:characters[l:pos] !=# '}' || l:is_escaped) + if l:characters[l:pos] ==# ',' && ! l:is_escaped + let l:has_comma = 1 + break + endif + let l:is_escaped = l:characters[l:pos] ==# '\' && ! l:is_escaped + let l:pos += 1 + endwhile + if ! l:has_comma && l:pos < l:length + let l:num_range = + \ matchlist(join(l:characters[l:index : l:pos-1], ''), + \ s:NUMERIC_RANGE) + if len(l:num_range) > 0 " Remember the ranges + call add(l:numeric_groups, [ 0+l:num_range[1], 0+l:num_range[2] ]) + let l:result .= '([+-]?\d+)' + else + let l:inner_xlat = editorconfig_core#fnmatch#translate( + \ join(l:characters[l:index : l:pos-1], ''), 1) + let l:inner_result = l:inner_xlat[0] + let l:inner_groups = l:inner_xlat[1] + let l:result .= '\{' . l:inner_result . '\}' + let l:numeric_groups += l:inner_groups + endif + let l:index = l:pos + 1 + elseif l:matching_braces + let l:result .= '%(' + let l:brace_level += 1 + else + let l:result .= '\{' + endif + + elseif l:current_char ==# ',' + if l:brace_level > 0 && ! l:is_escaped + let l:result .= '|' + else + let l:result .= '\,' + endif + + elseif l:current_char ==# '}' + if l:brace_level > 0 && ! l:is_escaped + let l:result .= ')' + let l:brace_level -= 1 + else + let l:result .= '\}' + endif + + elseif l:current_char ==# '/' + if join(l:characters[l:index : (l:index + 2)], '') ==# '**/' + let l:result .= '%(/|/\_.*/)' + let l:index += 3 + else + let l:result .= '\/' + endif + + elseif l:current_char != '\' + let l:result .= s:re_escape(l:current_char) + endif + + if l:current_char ==# '\' + if l:is_escaped + let l:result .= s:re_escape(l:current_char) + endif + let l:is_escaped = ! l:is_escaped + else + let l:is_escaped = 0 + endif + + endwhile + + if ! l:nested + let l:result .= '\_$' + endif + + return [l:result, l:numeric_groups] +endfunction " #editorconfig_core#fnmatch#translate + +let s:_cache = {} +function! s:cached_translate(pat) + if ! has_key(s:_cache, a:pat) + "regex = re.compile(res) + let s:_cache[a:pat] = + \ editorconfig_core#fnmatch#translate(a:pat) + " we don't compile the regex + endif + return s:_cache[a:pat] +endfunction " cached_translate + +" }}}1 +" === Matching functions ================================================ {{{1 + +function! editorconfig_core#fnmatch#fnmatch(name, path, pattern) +"def fnmatch(name, pat): +" """Test whether FILENAME matches PATH/PATTERN. +" +" Patterns are Unix shell style: +" +" - ``*`` matches everything except path separator +" - ``**`` matches everything +" - ``?`` matches any single character +" - ``[seq]`` matches any character in seq +" - ``[!seq]`` matches any char not in seq +" - ``{s1,s2,s3}`` matches any of the strings given (separated by commas) +" +" An initial period in FILENAME is not special. +" Both FILENAME and PATTERN are first case-normalized +" if the operating system requires it. +" If you don't want this, use fnmatchcase(FILENAME, PATTERN). +" """ +" + " Note: This throws away the backslash in '\.txt' on Cygwin, but that + " makes sense since it's Windows under the hood. + " We don't care about shellslash since we're going to change backslashes + " to slashes in just a moment anyway. + let l:localname = fnamemodify(a:name, ':p') + + if editorconfig_core#util#is_win() " normalize + let l:localname = substitute(tolower(l:localname), '\v\\', '/', 'g') + let l:path = substitute(tolower(a:path), '\v\\', '/', 'g') + let l:pattern = tolower(a:pattern) + else + let l:localname = l:localname + let l:path = a:path + let l:pattern = a:pattern + endif + + if g:editorconfig_core_vimscript_debug + echom '- fnmatch#fnmatch testing <' . l:localname . '> against <' . + \ l:pattern . '> wrt <' . l:path . '>' + endif + + return editorconfig_core#fnmatch#fnmatchcase(l:localname, l:path, l:pattern) +endfunction " fnmatch + +function! editorconfig_core#fnmatch#fnmatchcase(name, path, pattern) +"def fnmatchcase(name, pat): +" """Test whether FILENAME matches PATH/PATTERN, including case. +" +" This is a version of fnmatch() which doesn't case-normalize +" its arguments. +" """ +" + let [regex, num_groups] = s:cached_translate(a:pattern) + + let l:escaped_path = s:re_escape(a:path) + let l:regex = '\v' . l:escaped_path . l:regex + + if g:editorconfig_core_vimscript_debug + echom '- fnmatch#fnmatchcase: regex ' . l:regex + call s:dump_chars(l:regex) + echom '- fnmatch#fnmatchcase: checking ' . a:name + call s:dump_chars(a:name) + endif + + let l:match_groups = matchlist(a:name, l:regex)[1:] " [0] = full match + + if g:editorconfig_core_vimscript_debug + echom printf(' Got %d matches', len(l:match_groups)) + endif + + if len(l:match_groups) == 0 + return 0 + endif + + " Check numeric ranges + let pattern_matched = 1 + for l:idx in range(0,len(l:match_groups)) + let l:num = l:match_groups[l:idx] + if l:num ==# '' + break + endif + + let [min_num, max_num] = num_groups[l:idx] + if (min_num > (0+l:num)) || ((0+l:num) > max_num) + let pattern_matched = 0 + break + endif + + " Reject leading zeros without sign. This is very odd --- + " see editorconfig/editorconfig#371. + if match(l:num, '\v^0') != -1 + let pattern_matched = 0 + break + endif + endfor + + if g:editorconfig_core_vimscript_debug + echom '- fnmatch#fnmatchcase: ' . (pattern_matched ? 'matched' : 'did not match') + endif + + return pattern_matched +endfunction " fnmatchcase + +" }}}1 +" === Copyright notices ================================================= {{{1 +" Based on code from fnmatch.py file distributed with Python 2.6. +" Portions Copyright (c) 2001-2010 Python Software Foundation; +" All Rights Reserved. Licensed under PSF License (see LICENSE.PSF file). +" +" Changes to original fnmatch: +" +" - translate function supports ``*`` and ``**`` similarly to fnmatch C library +" }}}1 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vi: set fdm=marker: diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/handler.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/handler.vim new file mode 100644 index 00000000..c9a66e16 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/handler.vim @@ -0,0 +1,183 @@ +" autoload/editorconfig_core/handler.vim: Main worker for +" editorconfig-core-vimscript and editorconfig-vim. +" Modified from the Python core's handler.py. + +" Copyright (c) 2012-2019 EditorConfig Team {{{1 +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. }}}1 + +let s:saved_cpo = &cpo +set cpo&vim + +" Return full filepath for filename in each directory in and above path. {{{1 +" Input path must be an absolute path. +" TODO shellslash/shellescape? +function! s:get_filenames(path, config_filename) + let l:path = a:path + let l:path_list = [] + while 1 + call add(l:path_list, editorconfig_core#util#path_join(l:path, a:config_filename)) + let l:newpath = fnamemodify(l:path, ':h') + if l:path ==? l:newpath || !strlen(l:path) + break + endif + let l:path = l:newpath + endwhile + return l:path_list +endfunction " get_filenames + +" }}}1 +" === Main ============================================================== {{{1 + +" Find EditorConfig files and return all options matching target_filename. +" Throws on failure. +" @param job {Dictionary} required 'target'; optional 'config' and 'version' +function! editorconfig_core#handler#get_configurations(job) + " TODO? support VERSION checks? + +" Special exceptions that may be raised by this function include: +" - ``VersionError``: self.version is invalid EditorConfig version +" - ``PathError``: self.filepath is not a valid absolute filepath +" - ``ParsingError``: improperly formatted EditorConfig file found + + let l:job = deepcopy(a:job) + if has_key(l:job, 'config') + let l:config_filename = l:job.config + else + let l:config_filename = '.editorconfig' + let l:job.config = l:config_filename + endif + + if has_key(l:job, 'version') + let l:version = l:job.version + else + let l:version = editorconfig_core#version() + let l:job.version = l:version + endif + + let l:target_filename = l:job.target + + "echom 'Beginning job ' . string(l:job) + if !s:check_assertions(l:job) + throw "Assertions failed" + endif + + let l:fullpath = fnamemodify(l:target_filename,':p') + let l:path = fnamemodify(l:fullpath, ':h') + let l:conf_files = s:get_filenames(l:path, l:config_filename) + + " echom 'fullpath ' . l:fullpath + " echom 'path ' . l:path + + let l:retval = {} + + " Attempt to find and parse every EditorConfig file in filetree + for l:conf_fn in l:conf_files + "echom 'Trying ' . l:conf_fn + let l:parsed = editorconfig_core#ini#read_ini_file(l:conf_fn, l:target_filename) + if !has_key(l:parsed, 'options') + continue + endif + " echom ' Has options' + + " Merge new EditorConfig file's options into current options + let l:old_options = l:retval + let l:retval = l:parsed.options + " echom 'Old options ' . string(l:old_options) + " echom 'New options ' . string(l:retval) + call extend(l:retval, l:old_options, 'force') + + " Stop parsing if parsed file has a ``root = true`` option + if l:parsed.root + break + endif + endfor + + call s:preprocess_values(l:job, l:retval) + return l:retval +endfunction " get_configurations + +function! s:check_assertions(job) +" TODO +" """Raise error if filepath or version have invalid values""" + +" # Raise ``PathError`` if filepath isn't an absolute path +" if not os.path.isabs(self.filepath): +" raise PathError("Input file must be a full path name.") + + " Throw if version specified is greater than current + let l:v = a:job.version + let l:us = editorconfig_core#version() + " echom 'Comparing requested version ' . string(l:v) . + " \ ' to our version ' . string(l:us) + if l:v[0] > l:us[0] || l:v[1] > l:us[1] || l:v[2] > l:us[2] + throw 'Required version ' . string(l:v) . + \ ' is greater than the current version ' . string(l:us) + endif + + return 1 " All OK if we got here +endfunction " check_assertions + +" }}}1 + +" Preprocess option values for consumption by plugins. {{{1 +" Modifies its argument in place. +function! s:preprocess_values(job, opts) + + " Lowercase option value for certain options + for l:name in ['end_of_line', 'indent_style', 'indent_size', + \ 'insert_final_newline', 'trim_trailing_whitespace', + \ 'charset'] + if has_key(a:opts, l:name) + let a:opts[l:name] = tolower(a:opts[l:name]) + endif + endfor + + " Set indent_size to "tab" if indent_size is unspecified and + " indent_style is set to "tab", provided we are at least v0.10.0. + if get(a:opts, 'indent_style', '') ==? "tab" && + \ !has_key(a:opts, 'indent_size') && + \ ( a:job.version[0]>0 || a:job.version[1] >=10 ) + let a:opts['indent_size'] = 'tab' + endif + + " Set tab_width to indent_size if indent_size is specified and + " tab_width is unspecified + if has_key(a:opts, 'indent_size') && !has_key(a:opts, 'tab_width') && + \ get(a:opts, 'indent_size', '') !=? "tab" + let a:opts['tab_width'] = a:opts['indent_size'] + endif + + " Set indent_size to tab_width if indent_size is "tab" + if has_key(a:opts, 'indent_size') && has_key(a:opts, 'tab_width') && + \ get(a:opts, 'indent_size', '') ==? "tab" + let a:opts['indent_size'] = a:opts['tab_width'] + endif +endfunction " preprocess_values + +" }}}1 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vi: set fdm=marker fdl=1: diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim new file mode 100644 index 00000000..279b381d --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/ini.vim @@ -0,0 +1,273 @@ +" autoload/editorconfig_core/ini.vim: Config-file parser for +" editorconfig-core-vimscript and editorconfig-vim. +" Modifed from the Python core's ini.py. + +" Copyright (c) 2012-2019 EditorConfig Team {{{2 +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. }}}2 + +let s:saved_cpo = &cpo +set cpo&vim + +" variables {{{2 +if !exists('g:editorconfig_core_vimscript_debug') + let g:editorconfig_core_vimscript_debug = 0 +endif +" }}}2 +" === Constants, including regexes ====================================== {{{2 +" Regular expressions for parsing section headers and options. +" Allow ``]`` and escaped ``;`` and ``#`` characters in section headers. +" In fact, allow \ to escape any single character - it needs to cover at +" least \ * ? [ ! ] { }. +unlockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE +let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]' + +" Regular expression for parsing option name/values. +" Allow any amount of whitespaces, followed by separator +" (either ``:`` or ``=``), followed by any amount of whitespace and then +" any characters to eol +let s:OPTCRE = '\v\s*([^:=[:space:]][^:=]*)\s*([:=])\s*(.*)$' + +let s:MAX_SECTION_NAME = 4096 +let s:MAX_PROPERTY_NAME = 50 +let s:MAX_PROPERTY_VALUE = 255 + +lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE + +" }}}2 +" === Main ============================================================== {{{1 + +" Read \p config_filename and return the options applicable to +" \p target_filename. This is the main entry point in this file. +function! editorconfig_core#ini#read_ini_file(config_filename, target_filename) + let l:oldenc = &encoding + + if !filereadable(a:config_filename) + return {} + endif + + try " so &encoding will always be reset + let &encoding = 'utf-8' " so readfile() will strip BOM + let l:lines = readfile(a:config_filename) + let result = s:parse(a:config_filename, a:target_filename, l:lines) + catch + let &encoding = l:oldenc + " rethrow, but with a prefix since throw 'Vim...' fails. + throw 'Could not read editorconfig file at ' . v:throwpoint . ': ' . string(v:exception) + endtry + + let &encoding = l:oldenc + return result +endfunction + +function! s:parse(config_filename, target_filename, lines) +" Parse a sectioned setup file. +" The sections in setup file contains a title line at the top, +" indicated by a name in square brackets (`[]'), plus key/value +" options lines, indicated by `name: value' format lines. +" Continuations are represented by an embedded newline then +" leading whitespace. Blank lines, lines beginning with a '#', +" and just about everything else are ignored. + + let l:in_section = 0 + let l:matching_section = 0 + let l:optname = '' + let l:lineno = 0 + let l:e = [] " Errors, if any + + let l:options = {} " Options applicable to this file + let l:is_root = 0 " Whether a:config_filename declares root=true + + while 1 + if l:lineno == len(a:lines) + break + endif + + let l:line = a:lines[l:lineno] + let l:lineno = l:lineno + 1 + + " comment or blank line? + if editorconfig_core#util#strip(l:line) ==# '' + continue + endif + if l:line =~# '\v^[#;]' + continue + endif + + " is it a section header? + if g:editorconfig_core_vimscript_debug + echom "Header? <" . l:line . ">" + endif + + let l:mo = matchlist(l:line, s:SECTCRE) + if len(l:mo) + let l:sectname = l:mo[1] + let l:in_section = 1 + if strlen(l:sectname) > s:MAX_SECTION_NAME + " Section name too long => ignore the section + let l:matching_section = 0 + else + let l:matching_section = s:matches_filename( + \ a:config_filename, a:target_filename, l:sectname) + endif + + if g:editorconfig_core_vimscript_debug + echom 'In section ' . l:sectname . ', which ' . + \ (l:matching_section ? 'matches' : 'does not match') + \ ' file ' . a:target_filename . ' (config ' . + \ a:config_filename . ')' + endif + + " So sections can't start with a continuation line + let l:optname = '' + + " Is it an option line? + else + let l:mo = matchlist(l:line, s:OPTCRE) + if len(l:mo) + let l:optname = mo[1] + let l:optval = mo[3] + + if g:editorconfig_core_vimscript_debug + echom printf('Saw raw opt <%s>=<%s>', l:optname, l:optval) + endif + + if l:optval =~# '\v[;#]' + " ';' and '#' are comment delimiters only if + " preceded by a spacing character + let l:m = matchlist(l:optval, '\v(.{-})\s[;#]') + if len(l:m) + let l:optval = l:m[1] + endif + + " ; and # can be escaped with backslash. + let l:optval = substitute(l:optval, '\v\\([;#])', '\1', 'g') + + endif + let l:optval = editorconfig_core#util#strip(l:optval) + " allow empty values + if l:optval ==? '""' + let l:optval = '' + endif + let l:optname = s:optionxform(l:optname) + if !l:in_section && optname ==? 'root' + let l:is_root = (optval ==? 'true') + endif + if g:editorconfig_core_vimscript_debug + echom printf('Saw opt <%s>=<%s>', l:optname, l:optval) + endif + + if l:matching_section && + \ strlen(l:optname) <= s:MAX_PROPERTY_NAME && + \ strlen(l:optval) <= s:MAX_PROPERTY_VALUE + let l:options[l:optname] = l:optval + endif + else + " a non-fatal parsing error occurred. set up the + " exception but keep going. the exception will be + " raised at the end of the file and will contain a + " list of all bogus lines + call add(e, "Parse error in '" . a:config_filename . "' at line " . + \ l:lineno . ": '" . l:line . "'") + endif + endif + endwhile + + " if any parsing errors occurred, raise an exception + if len(l:e) + throw string(l:e) + endif + + return {'root': l:is_root, 'options': l:options} +endfunction! + +" }}}1 +" === Helpers =========================================================== {{{1 + +" Preprocess option names +function! s:optionxform(optionstr) + let l:result = substitute(a:optionstr, '\v\s+$', '', 'g') " rstrip + return tolower(l:result) +endfunction + +" Return true if \p glob matches \p target_filename +function! s:matches_filename(config_filename, target_filename, glob) +" config_dirname = normpath(dirname(config_filename)).replace(sep, '/') + let l:config_dirname = fnamemodify(a:config_filename, ':p:h') . '/' + + if editorconfig_core#util#is_win() + " Regardless of whether shellslash is set, make everything slashes + let l:config_dirname = + \ tolower(substitute(l:config_dirname, '\v\\', '/', 'g')) + endif + + let l:glob = substitute(a:glob, '\v\\([#;])', '\1', 'g') + + " Take account of the path to the editorconfig file. + " editorconfig-core-c/src/lib/editorconfig.c says: + " "Pattern would be: /dir/of/editorconfig/file[double_star]/[section] if + " section does not contain '/', or /dir/of/editorconfig/file[section] + " if section starts with a '/', or /dir/of/editorconfig/file/[section] if + " section contains '/' but does not start with '/'." + + if stridx(l:glob, '/') != -1 " contains a slash + if l:glob[0] ==# '/' + let l:glob = l:glob[1:] " trim leading slash + endif +" This will be done by fnmatch +" let l:glob = l:config_dirname . l:glob + else " does not contain a slash + let l:config_dirname = l:config_dirname[:-2] + " Trim trailing slash + let l:glob = '**/' . l:glob + endif + + if g:editorconfig_core_vimscript_debug + echom '- ini#matches_filename: checking <' . a:target_filename . + \ '> against <' . l:glob . '> with respect to config file <' . + \ a:config_filename . '>' + echom '- ini#matches_filename: config_dirname is ' . l:config_dirname + endif + + return editorconfig_core#fnmatch#fnmatch(a:target_filename, + \ l:config_dirname, l:glob) +endfunction " matches_filename + +" }}}1 +" === Copyright notices ================================================= {{{2 +" Based on code from ConfigParser.py file distributed with Python 2.6. +" Portions Copyright (c) 2001-2010 Python Software Foundation; +" All Rights Reserved. Licensed under PSF License (see LICENSE.PSF file). +" +" Changes to original ConfigParser: +" +" - Special characters can be used in section names +" - Octothorpe can be used for comments (not just at beginning of line) +" - Only track INI options in sections that match target filename +" - Stop parsing files with when ``root = true`` is found +" }}}2 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vi: set fdm=marker fdl=1: diff --git a/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/util.vim b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/util.vim new file mode 100644 index 00000000..c4df04af --- /dev/null +++ b/sources_non_forked/editorconfig-vim/autoload/editorconfig_core/util.vim @@ -0,0 +1,84 @@ +" util.vim: part of editorconfig-core-vimscript and editorconfig-vim. +" Copyright (c) 2018-2019 EditorConfig Team, including Chris White {{{1 +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. }}}1 + +let s:saved_cpo = &cpo +set cpo&vim + +" A verbatim copy of ingo#fs#path#Separator() {{{1 +" from https://github.com/vim-scripts/ingo-library/blob/558132e2221db3af26dc2f2c6756d092d48a459f/autoload/ingo/fs/path.vim +" distributed under the Vim license. +function! editorconfig_core#util#Separator() + return (exists('+shellslash') && ! &shellslash ? '\' : '/') +endfunction " }}}1 + +" path_join(): ('a','b')->'a/b'; ('a/','b')->'a/b'. {{{1 +function! editorconfig_core#util#path_join(a, b) + " TODO shellescape/shellslash? + "echom 'Joining <' . a:a . '> and <' . a:b . '>' + "echom 'Length is ' . strlen(a:a) + "echom 'Last char is ' . char2nr(a:a[-1]) + if a:a !~# '\v%(\/|\\)$' + return a:a . editorconfig_core#util#Separator() . a:b + else + return a:a . a:b + endif +endfunction " }}}1 + +" is_win() by xolox {{{1 +" The following function is modified from +" https://github.com/xolox/vim-misc/blob/master/autoload/xolox/misc/os.vim +" Copyright (c) 2015 Peter Odding +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in all +" copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +" SOFTWARE. +function! editorconfig_core#util#is_win() + " Returns 1 (true) when on Microsoft Windows, 0 (false) otherwise. + return has('win16') || has('win32') || has('win64') +endfunction " }}}1 + +" strip() {{{1 +function! editorconfig_core#util#strip(s) + return substitute(a:s, '\v^\s+|\s+$','','g') +endfunction " }}}1 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vi: set fdm=marker: diff --git a/sources_non_forked/editorconfig-vim/doc/editorconfig.txt b/sources_non_forked/editorconfig-vim/doc/editorconfig.txt new file mode 100644 index 00000000..66e9e5bf --- /dev/null +++ b/sources_non_forked/editorconfig-vim/doc/editorconfig.txt @@ -0,0 +1,203 @@ +*editorconfig.txt* + +File: editorconfig.txt +Version: 1.1.1 +Maintainer: EditorConfig Team +Description: EditorConfig vim plugin + +License: + Copyright (c) 2011-2019 EditorConfig Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + +CONTENTS~ + *editorconfig-contents* +---------------------------------------------------------------------------- +1. Overview |editorconfig-overview| +2. Installation |editorconfig-installation| +3. Commands |editorconfig-commands| +4. Settings |editorconfig-settings| +5. Advanced |editorconfig-advanced| + + +OVERVIEW~ + *editorconfig-overview* +---------------------------------------------------------------------------- +This is the EditorConfig plugin for vim. + + +INSTALLATION~ + *editorconfig-installation* +---------------------------------------------------------------------------- +Follow the instructions in the README.md file to install this plugin. + +COMMANDS~ + *editorconfig-commands* +---------------------------------------------------------------------------- + + *:EditorConfigReload* +Command: + :EditorConfigReload + +Reload the EditorConfig conf files. When `.editorconfig` files are modified, +this command could prevent you to reload the current edited file to load the +new configuration. + +SETTINGS~ + *editorconfig-settings* +---------------------------------------------------------------------------- + *g:EditorConfig_core_mode* +Specify the mode of EditorConfig core. Generally it is OK to leave this option +empty. Currently, the supported modes are "vim_core" (default) and +"external_command". + + vim_core: Use the included VimScript EditorConfig Core. + external_command: Run external EditorConfig Core. + +If "g:EditorConfig_core_mode" is not specified, this plugin will automatically +choose "vim_core". + +If you choose "external_command" mode, you must also set +|g:EditorConfig_exec_path|. + +Changes to "g:EditorConfig_core_mode" will not take effect until Vim +is restarted. + + *b:EditorConfig_disable* +This is a buffer-local variable that disables the EditorConfig plugin for a +single buffer. + +Example: Disable EditorConfig for the current buffer: +> + let b:EditorConfig_disable = 1 +< +Example: Disable EditorConfig for all git commit messages: +> + au FileType gitcommit let b:EditorConfig_disable = 1 +< + + *g:EditorConfig_exclude_patterns* +This is a list contains file path patterns which will be ignored by +EditorConfig plugin. When the path of the opened buffer (i.e. +"expand('%:p')") matches any of the patterns in the list, EditorConfig will +not load for this file. The default is an empty list. + +Example: Avoid loading EditorConfig for any remote files over ssh +> + let g:EditorConfig_exclude_patterns = ['scp://.*'] +< + + *g:EditorConfig_exec_path* +The file path to the EditorConfig core executable. You can set this value in +your |vimrc| like this: +> + let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable' +< +The default value is empty. + +If "g:EditorConfig_exec_path" is not set, the plugin will use the "vim_core" +mode regardless of the setting of |g:EditorConfig_core_mode|. + +Changes to "g:EditorConfig_exec_path" will not take effect until Vim +is restarted. + + *g:EditorConfig_max_line_indicator* +The way to show the line where the maximal length is reached. Accepted values +are "line", "fill", otherwise there will be no max line indicator. + + "line": the right column of the max line length column will be + highlighted, made possible by setting 'colorcolumn' to + "max_line_length + 1". + + "fill": all the columns to the right of the max line length column + will be highlighted, made possible by setting 'colorcolumn' + to a list of numbers starting from "max_line_length + 1" to + the number of columns on the screen. + + "exceeding": the right column of the max line length column will be + highlighted on lines that exceed the max line length, made + possible by adding a match for the ColorColumn group. + + "none": no max line length indicator will be shown. This is the + recommended value when you do not want any indicator to be + shown, but values other than "line" or "fill" would also work + as "none". + +To set this option, add any of the following lines to your |vimrc| file: +> + let g:EditorConfig_max_line_indicator = "line" + let g:EditorConfig_max_line_indicator = "fill" + let g:EditorConfig_max_line_indicator = "exceeding" + let g:EditorConfig_max_line_indicator = "none" +< +The default value is "line". + + *g:EditorConfig_preserve_formatoptions* +Set this to 1 if you don't want your formatoptions modified when +max_line_length is set: +> + let g:EditorConfig_preserve_formatoptions = 1 +< +This option defaults to 0. + + *g:EditorConfig_verbose* +Set this to 1 if you want debug info printed: +> + let g:EditorConfig_verbose = 1 +< + +ADVANCED~ + *editorconfig-advanced* +---------------------------------------------------------------------------- + *editorconfig-hook* + *EditorConfig#AddNewHook()* +While this plugin offers several builtin supported properties (as mentioned +here: https://github.com/editorconfig/editorconfig-vim#supported-properties), +we are also able to add our own hooks to support additional EditorConfig +properties, including those not in the EditorConfig standard. For example, we +are working on an Objective-C project, and all our "*.m" files should be +Objective-C source files. However, vim sometimes detect "*.m" files as MATLAB +source files, which causes incorrect syntax highlighting, code indentation, +etc. To solve the case, we could write the following code into the |vimrc| +file: +> + function! FiletypeHook(config) + if has_key(a:config, 'vim_filetype') + let &filetype = a:config['vim_filetype'] + endif + + return 0 " Return 0 to show no error happened + endfunction + + call editorconfig#AddNewHook(function('FiletypeHook')) +< +And add the following code to your .editorconfig file: +> + [*.m] + vim_filetype = objc +< +Then try to open an Objective-C file, you will find the |filetype| is set to +"objc". + +vim:ft=help:tw=78 diff --git a/sources_non_forked/editorconfig-vim/mkzip.sh b/sources_non_forked/editorconfig-vim/mkzip.sh new file mode 100644 index 00000000..811724ca --- /dev/null +++ b/sources_non_forked/editorconfig-vim/mkzip.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +zip -r editorconfig-vim-$*.zip plugin/* autoload/* doc/* diff --git a/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim new file mode 100644 index 00000000..2daaa0b1 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/plugin/editorconfig.vim @@ -0,0 +1,525 @@ +" plugin/editorconfig.vim: EditorConfig native Vimscript plugin file +" Copyright (c) 2011-2019 EditorConfig Team +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are met: +" +" 1. Redistributions of source code must retain the above copyright notice, +" this list of conditions and the following disclaimer. +" 2. Redistributions in binary form must reproduce the above copyright notice, +" this list of conditions and the following disclaimer in the documentation +" and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +" POSSIBILITY OF SUCH DAMAGE. +" + +if v:version < 700 + finish +endif + +" check whether this script is already loaded +if exists("g:loaded_EditorConfig") + finish +endif +let g:loaded_EditorConfig = 1 + +let s:saved_cpo = &cpo +set cpo&vim + +" variables {{{1 + +" Make sure the globals all exist +if !exists('g:EditorConfig_exec_path') + let g:EditorConfig_exec_path = '' +endif + +if !exists('g:EditorConfig_verbose') + let g:EditorConfig_verbose = 0 +endif + +if !exists('g:EditorConfig_preserve_formatoptions') + let g:EditorConfig_preserve_formatoptions = 0 +endif + +if !exists('g:EditorConfig_max_line_indicator') + let g:EditorConfig_max_line_indicator = 'line' +endif + +if !exists('g:EditorConfig_exclude_patterns') + let g:EditorConfig_exclude_patterns = [] +endif + +if !exists('g:EditorConfig_disable_rules') + let g:EditorConfig_disable_rules = [] +endif + +" Copy some of the globals into script variables --- changes to these +" globals won't affect the plugin until the plugin is reloaded. +if exists('g:EditorConfig_core_mode') && !empty(g:EditorConfig_core_mode) + let s:editorconfig_core_mode = g:EditorConfig_core_mode +else + let s:editorconfig_core_mode = '' +endif + +if exists('g:EditorConfig_exec_path') && !empty(g:EditorConfig_exec_path) + let s:editorconfig_exec_path = g:EditorConfig_exec_path +else + let s:editorconfig_exec_path = '' +endif + +let s:initialized = 0 + +" }}}1 + +" shellslash handling {{{1 +function! s:DisableShellSlash() " {{{2 + " disable shellslash for proper escaping of Windows paths + + " In Windows, 'shellslash' also changes the behavior of 'shellescape'. + " It makes 'shellescape' behave like in UNIX environment. So ':setl + " noshellslash' before evaluating 'shellescape' and restore the + " settings afterwards when 'shell' does not contain 'sh' somewhere. + if has('win32') && empty(matchstr(&shell, 'sh')) + let s:old_shellslash = &l:shellslash + setlocal noshellslash + endif +endfunction " }}}2 + +function! s:ResetShellSlash() " {{{2 + " reset shellslash to the user-set value, if any + if exists('s:old_shellslash') + let &l:shellslash = s:old_shellslash + unlet! s:old_shellslash + endif +endfunction " }}}2 +" }}}1 + +" Mode initialization functions {{{1 + +function! s:InitializeVimCore() +" Initialize vim core. Returns 1 on failure; 0 on success +" At the moment, all we need to do is to check that it is installed. + try + let l:vim_core_ver = editorconfig_core#version() + catch + return 1 + endtry + return 0 +endfunction + +function! s:InitializeExternalCommand() +" Initialize external_command mode + + if empty(s:editorconfig_exec_path) + echo 'Please specify a g:EditorConfig_exec_path' + return 1 + endif + + if g:EditorConfig_verbose + echo 'Checking for external command ' . s:editorconfig_exec_path . ' ...' + endif + + if !executable(s:editorconfig_exec_path) + echo 'File ' . s:editorconfig_exec_path . ' is not executable.' + return 1 + endif + + return 0 +endfunction +" }}}1 + +function! s:Initialize() " Initialize the plugin. {{{1 + " Returns truthy on error, falsy on success. + + if empty(s:editorconfig_core_mode) + let s:editorconfig_core_mode = 'vim_core' " Default core choice + endif + + if s:editorconfig_core_mode ==? 'external_command' + if s:InitializeExternalCommand() + echohl WarningMsg + echo 'EditorConfig: Failed to initialize external_command mode. ' . + \ 'Falling back to vim_core mode.' + echohl None + let s:editorconfig_core_mode = 'vim_core' + endif + endif + + if s:editorconfig_core_mode ==? 'vim_core' + if s:InitializeVimCore() + echohl ErrorMsg + echo 'EditorConfig: Failed to initialize vim_core mode. ' . + \ 'The plugin will not function.' + echohl None + return 1 + endif + + elseif s:editorconfig_core_mode ==? 'external_command' + " Nothing to do here, but this elseif is required to avoid + " external_command falling into the else clause. + + else " neither external_command nor vim_core + echohl ErrorMsg + echo "EditorConfig: I don't know how to use mode " . s:editorconfig_core_mode + echohl None + return 1 + endif + + let s:initialized = 1 + return 0 +endfunction " }}}1 + +function! s:GetFilenames(path, filename) " {{{1 +" Yield full filepath for filename in each directory in and above path + + let l:path_list = [] + let l:path = a:path + while 1 + let l:path_list += [l:path . '/' . a:filename] + let l:newpath = fnamemodify(l:path, ':h') + if l:path == l:newpath + break + endif + let l:path = l:newpath + endwhile + return l:path_list +endfunction " }}}1 + +function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1 + let b:editorconfig_tried = 1 + let l:buffer_name = expand('%:p') + " ignore buffers without a name + if empty(l:buffer_name) + return + endif + + if exists("b:EditorConfig_disable") && b:EditorConfig_disable + if g:EditorConfig_verbose + echo 'Skipping EditorConfig for buffer "' . l:buffer_name . '"' + endif + return + endif + + " Check if any .editorconfig does exist + let l:conf_files = s:GetFilenames(expand('%:p:h'), '.editorconfig') + let l:conf_found = 0 + for conf_file in conf_files + if filereadable(conf_file) + let l:conf_found = 1 + break + endif + endfor + if !l:conf_found + return + endif + + if !s:initialized + if s:Initialize() + return + endif + endif + + if g:EditorConfig_verbose + echo 'Applying EditorConfig ' . s:editorconfig_core_mode . + \ ' on file "' . l:buffer_name . '"' + endif + + " Ignore specific patterns + for pattern in g:EditorConfig_exclude_patterns + if l:buffer_name =~ pattern + return + endif + endfor + + if s:editorconfig_core_mode ==? 'vim_core' + if s:UseConfigFiles_VimCore() == 0 + let b:editorconfig_applied = 1 + endif + elseif s:editorconfig_core_mode ==? 'external_command' + call s:UseConfigFiles_ExternalCommand() + let b:editorconfig_applied = 1 + else + echohl Error | + \ echo "Unknown EditorConfig Core: " . + \ s:editorconfig_core_mode | + \ echohl None + endif +endfunction " }}}1 + +" Custom commands, and autoloading {{{1 + +" Autocommands, and function to enable/disable the plugin {{{2 +function! s:EditorConfigEnable(should_enable) + augroup editorconfig + autocmd! + if a:should_enable + autocmd BufNewFile,BufReadPost,BufFilePost * call s:UseConfigFiles() + endif + augroup END +endfunction + +" }}}2 + +" Commands {{{2 +command! EditorConfigEnable call s:EditorConfigEnable(1) +command! EditorConfigDisable call s:EditorConfigEnable(0) + +command! EditorConfigReload call s:UseConfigFiles() " Reload EditorConfig files +" }}}2 + +" On startup, enable the autocommands +call s:EditorConfigEnable(1) + +" Always set the filetype for .editorconfig files +augroup editorconfig_dosini + autocmd! + autocmd BufNewFile,BufRead .editorconfig set filetype=dosini +augroup END + +" }}}1 + +" UseConfigFiles function for different modes {{{1 + +function! s:UseConfigFiles_VimCore() +" Use the vimscript EditorConfig core + try + let l:config = editorconfig_core#handler#get_configurations( + \ { 'target': expand('%:p') } ) + call s:ApplyConfig(l:config) + return 0 " success + catch + return 1 " failure + endtry +endfunction + +function! s:UseConfigFiles_ExternalCommand() +" Use external EditorConfig core (e.g., the C core) + + call s:DisableShellSlash() + let l:exec_path = shellescape(s:editorconfig_exec_path) + call s:ResetShellSlash() + + call s:SpawnExternalParser(l:exec_path) +endfunction + +function! s:SpawnExternalParser(cmd) " {{{2 +" Spawn external EditorConfig. Used by s:UseConfigFiles_ExternalCommand() + + let l:cmd = a:cmd + + if empty(l:cmd) + throw 'No cmd provided' + endif + + let l:config = {} + + call s:DisableShellSlash() + let l:cmd = l:cmd . ' ' . shellescape(expand('%:p')) + call s:ResetShellSlash() + + let l:parsing_result = split(system(l:cmd), '\v[\r\n]+') + + " if editorconfig core's exit code is not zero, give out an error + " message + if v:shell_error != 0 + echohl ErrorMsg + echo 'Failed to execute "' . l:cmd . '". Exit code: ' . + \ v:shell_error + echo '' + echo 'Message:' + echo l:parsing_result + echohl None + return + endif + + if g:EditorConfig_verbose + echo 'Output from EditorConfig core executable:' + echo l:parsing_result + endif + + for one_line in l:parsing_result + let l:eq_pos = stridx(one_line, '=') + + if l:eq_pos == -1 " = is not found. Skip this line + continue + endif + + let l:eq_left = strpart(one_line, 0, l:eq_pos) + if l:eq_pos + 1 < strlen(one_line) + let l:eq_right = strpart(one_line, l:eq_pos + 1) + else + let l:eq_right = '' + endif + + let l:config[l:eq_left] = l:eq_right + endfor + + call s:ApplyConfig(l:config) +endfunction " }}}2 + +" }}}1 + +function! s:ApplyConfig(config) abort " Set the buffer options {{{1 + " Only process normal buffers (do not treat help files as '.txt' files) + if !empty(&buftype) + return + endif + + if g:EditorConfig_verbose + echo 'Options: ' . string(a:config) + endif + + if s:IsRuleActive('indent_style', a:config) + if a:config["indent_style"] == "tab" + setl noexpandtab + elseif a:config["indent_style"] == "space" + setl expandtab + endif + endif + + if s:IsRuleActive('tab_width', a:config) + let &l:tabstop = str2nr(a:config["tab_width"]) + endif + + if s:IsRuleActive('indent_size', a:config) + " if indent_size is 'tab', set shiftwidth to tabstop; + " if indent_size is a positive integer, set shiftwidth to the integer + " value + if a:config["indent_size"] == "tab" + let &l:shiftwidth = &l:tabstop + let &l:softtabstop = &l:shiftwidth + else + let l:indent_size = str2nr(a:config["indent_size"]) + if l:indent_size > 0 + let &l:shiftwidth = l:indent_size + let &l:softtabstop = &l:shiftwidth + endif + endif + + endif + + if s:IsRuleActive('end_of_line', a:config) && + \ &l:modifiable + if a:config["end_of_line"] == "lf" + setl fileformat=unix + elseif a:config["end_of_line"] == "crlf" + setl fileformat=dos + elseif a:config["end_of_line"] == "cr" + setl fileformat=mac + endif + endif + + if s:IsRuleActive('charset', a:config) && + \ &l:modifiable + if a:config["charset"] == "utf-8" + setl fileencoding=utf-8 + setl nobomb + elseif a:config["charset"] == "utf-8-bom" + setl fileencoding=utf-8 + setl bomb + elseif a:config["charset"] == "latin1" + setl fileencoding=latin1 + setl nobomb + elseif a:config["charset"] == "utf-16be" + setl fileencoding=utf-16be + setl bomb + elseif a:config["charset"] == "utf-16le" + setl fileencoding=utf-16le + setl bomb + endif + endif + + augroup editorconfig_trim_trailing_whitespace + autocmd! BufWritePre + if s:IsRuleActive('trim_trailing_whitespace', a:config) && + \ get(a:config, 'trim_trailing_whitespace', 'false') ==# 'true' + autocmd BufWritePre call s:TrimTrailingWhitespace() + endif + augroup END + + if s:IsRuleActive('insert_final_newline', a:config) + if exists('+fixendofline') + if a:config["insert_final_newline"] == "false" + setl nofixendofline + else + setl fixendofline + endif + elseif exists(':SetNoEOL') == 2 + if a:config["insert_final_newline"] == "false" + silent! SetNoEOL " Use the PreserveNoEOL plugin to accomplish it + endif + endif + endif + + " highlight the columns following max_line_length + if s:IsRuleActive('max_line_length', a:config) && + \ a:config['max_line_length'] != 'off' + let l:max_line_length = str2nr(a:config['max_line_length']) + + if l:max_line_length >= 0 + let &l:textwidth = l:max_line_length + if g:EditorConfig_preserve_formatoptions == 0 + setlocal formatoptions+=tc + endif + endif + + if exists('+colorcolumn') + if l:max_line_length > 0 + if g:EditorConfig_max_line_indicator == 'line' + let &l:colorcolumn = l:max_line_length + 1 + elseif g:EditorConfig_max_line_indicator == 'fill' && + \ l:max_line_length < &l:columns + " Fill only if the columns of screen is large enough + let &l:colorcolumn = join( + \ range(l:max_line_length+1,&l:columns),',') + elseif g:EditorConfig_max_line_indicator == 'exceeding' + let &l:colorcolumn = '' + for l:match in getmatches() + if get(l:match, 'group', '') == 'ColorColumn' + call matchdelete(get(l:match, 'id')) + endif + endfor + call matchadd('ColorColumn', + \ '\%' . (l:max_line_length + 1) . 'v.', 100) + endif + endif + endif + endif + + call editorconfig#ApplyHooks(a:config) +endfunction + +" }}}1 + +function! s:TrimTrailingWhitespace() " {{{1 + if &l:modifiable + " don't lose user position when trimming trailing whitespace + let s:view = winsaveview() + try + silent! keeppatterns %s/\s\+$//e + finally + call winrestview(s:view) + endtry + endif +endfunction " }}}1 + +function! s:IsRuleActive(name, config) " {{{1 + return index(g:EditorConfig_disable_rules, a:name) < 0 && + \ has_key(a:config, a:name) +endfunction "}}}1 + +let &cpo = s:saved_cpo +unlet! s:saved_cpo + +" vim: fdm=marker fdc=3 diff --git a/sources_non_forked/editorconfig-vim/tests/core/CMakeLists.txt b/sources_non_forked/editorconfig-vim/tests/core/CMakeLists.txt new file mode 100644 index 00000000..2c124403 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/CMakeLists.txt @@ -0,0 +1,53 @@ +# CMakeLists.txt for core testing in +# editorconfig-core-vimscript and editorconfig-vim. + +# Copyright (c) 2011-2019 EditorConfig Team +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# To perform the test, from the root of the project tree, run +# mkdir build +# cd build +# cmake .. +# ctest . + +cmake_minimum_required(VERSION 3.5) +#set(CMAKE_LEGACY_CYGWIN_WIN32 0) + +# Do not check any compiler +project(editorconfig-core-vimscript NONE) + +enable_testing() + +# The test executable to use +if(NOT WIN32) + set(EDITORCONFIG_CMD "${CMAKE_SOURCE_DIR}/editorconfig") +else() + set(EDITORCONFIG_CMD "${CMAKE_SOURCE_DIR}/editorconfig.bat") +endif() +set(EDITORCONFIG_CMD_IS_TARGET FALSE) + +add_subdirectory(tests) + +# CTestCustom.cmake contains platform-specific test configuration. +configure_file(CTestCustom.cmake ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) diff --git a/sources_non_forked/editorconfig-vim/tests/core/CTestCustom.cmake b/sources_non_forked/editorconfig-vim/tests/core/CTestCustom.cmake new file mode 100644 index 00000000..5452f751 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/CTestCustom.cmake @@ -0,0 +1,34 @@ +# CTestCustom.cmake: Skip UTF-8 tests +# Part of editorconfig-vim + +# Copyright (c) 2011-2019 EditorConfig Team +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# Skip UTF8 tests on Windows for now per +# https://github.com/editorconfig/editorconfig-core-c/pull/31#issue-154810185 +if(WIN32 AND (NOT "$ENV{RUN_UTF8}")) + message(WARNING "Skipping UTF-8 tests on this platform") + set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} g_utf_8_char) + set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} utf_8_char) +endif() diff --git a/sources_non_forked/editorconfig-vim/tests/core/ecvbslib.vbs b/sources_non_forked/editorconfig-vim/tests/core/ecvbslib.vbs new file mode 100644 index 00000000..a1e05d24 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/ecvbslib.vbs @@ -0,0 +1,171 @@ +' ecvbslib.vbs: VBScript routines for use in +' editorconfig-core-vimscript and editorconfig-vim. +' Copyright (c) 2018--2019 Chris White. All rights reserved. +' Licensed CC-BY-SA, version 3.0 or any later version, at your option. + +' Remove CR and LF in a string +function nocrlf(strin) + nocrlf = Replace(Replace(strin, vbCr, ""), vbLf, "") +end function + +' === Base64 ================================================================ +' from https://stackoverflow.com/a/40118072/2877364 by +' https://stackoverflow.com/users/45375/mklement0 + +' Base64-encodes the specified string. +' Parameter fAsUtf16LE determines how the input text is encoded at the +' byte level before Base64 encoding is applied. +' * Pass False to use UTF-8 encoding. +' * Pass True to use UTF-16 LE encoding. +Function Base64Encode(ByVal sText, ByVal fAsUtf16LE) + + ' Use an aux. XML document with a Base64-encoded element. + ' Assigning the byte stream (array) returned by StrToBytes() to .NodeTypedValue + ' automatically performs Base64-encoding, whose result can then be accessed + ' as the element's text. + With CreateObject("Msxml2.DOMDocument").CreateElement("aux") + .DataType = "bin.base64" + if fAsUtf16LE then + .NodeTypedValue = StrToBytes(sText, "utf-16le", 2) + else + .NodeTypedValue = StrToBytes(sText, "utf-8", 3) + end if + Base64Encode = nocrlf(.Text) ' No line breaks; MSXML adds them. + End With + +End Function + +' Decodes the specified Base64-encoded string. +' If the decoded string's original encoding was: +' * UTF-8, pass False for fIsUtf16LE. +' * UTF-16 LE, pass True for fIsUtf16LE. +Function Base64Decode(ByVal sBase64EncodedText, ByVal fIsUtf16LE) + + Dim sTextEncoding + if fIsUtf16LE Then sTextEncoding = "utf-16le" Else sTextEncoding = "utf-8" + + ' Use an aux. XML document with a Base64-encoded element. + ' Assigning the encoded text to .Text makes the decoded byte array + ' available via .nodeTypedValue, which we can pass to BytesToStr() + With CreateObject("Msxml2.DOMDocument").CreateElement("aux") + .DataType = "bin.base64" + .Text = sBase64EncodedText + Base64Decode = BytesToStr(.NodeTypedValue, sTextEncoding) + End With + +End Function + +' Returns a binary representation (byte array) of the specified string in +' the specified text encoding, such as "utf-8" or "utf-16le". +' Pass the number of bytes that the encoding's BOM uses as iBomByteCount; +' pass 0 to include the BOM in the output. +function StrToBytes(ByVal sText, ByVal sTextEncoding, ByVal iBomByteCount) + + ' Create a text string with the specified encoding and then + ' get its binary (byte array) representation. + With CreateObject("ADODB.Stream") + ' Create a stream with the specified text encoding... + .Type = 2 ' adTypeText + .Charset = sTextEncoding + .Open + .WriteText sText + ' ... and convert it to a binary stream to get a byte-array + ' representation. + .Position = 0 + .Type = 1 ' adTypeBinary + .Position = iBomByteCount ' skip the BOM + StrToBytes = .Read + .Close + End With + +end function + +' Returns a string that corresponds to the specified byte array, interpreted +' with the specified text encoding, such as "utf-8" or "utf-16le". +function BytesToStr(ByVal byteArray, ByVal sTextEncoding) + + If LCase(sTextEncoding) = "utf-16le" then + ' UTF-16 LE happens to be VBScript's internal encoding, so we can + ' take a shortcut and use CStr() to directly convert the byte array + ' to a string. + BytesToStr = CStr(byteArray) + Else ' Convert the specified text encoding to a VBScript string. + ' Create a binary stream and copy the input byte array to it. + With CreateObject("ADODB.Stream") + .Type = 1 ' adTypeBinary + .Open + .Write byteArray + ' Now change the type to text, set the encoding, and output the + ' result as text. + .Position = 0 + .Type = 2 ' adTypeText + .CharSet = sTextEncoding + BytesToStr = .ReadText + .Close + End With + End If + +end function + +' === Runner ================================================================ + +' Run a command, copy its stdout/stderr to ours, and return its exit +' status. +' Modified from https://stackoverflow.com/a/32493083/2877364 by +' https://stackoverflow.com/users/3191599/nate-barbettini . +' See also https://www.vbsedit.com/html/4c5b06ac-dc45-4ec2-aca1-f168bab75483.asp +function RunCommandAndEcho(strCommand) + Const WshRunning = 0 + Const WshFinished = 1 + Const WshFailed = 2 + + Set WshShell = CreateObject("WScript.Shell") + 'WScript.Echo "Running >>" & strCommand & "<<..." + Set WshShellExec = WshShell.Exec(strCommand) + + Do While WshShellExec.Status = WshRunning + 'WScript.Echo "Waiting..." + WScript.Sleep 100 + Loop + + if not WshShellExec.StdOut.AtEndOfStream then + WScript.StdOut.Write(WshShellExec.StdOut.ReadAll()) + end if + + if not WshShellExec.StdErr.AtEndOfStream then + WScript.StdErr.Write(WshShellExec.StdErr.ReadAll()) + end if + + RunCommandAndEcho = WshShellExec.ExitCode +end function + +' === Argument processing =================================================== + +function MakeY64Args(args) + + dim b64args(100) ' 100 = arbitrary max + + ' Make Y64-flavored base64 versions of each arg so we don't have to + ' worry about quoting issues while executing PowerShell. + + idx=0 + For Each arg In args + b64args(idx) = Base64Encode(nocrlf(arg), False) + ' Y64 flavor of Base64 + b64args(idx) = replace( _ + replace( _ + replace(b64args(idx), "+", "."), _ + "/", "_" ), _ + "=", "-") + 'Wscript.Echo cstr(idx) & ": >" & arg & "< = >" & b64args(idx) & "<" + 'Wscript.Echo b64args(idx) + idx = idx+1 + Next + + MakeY64Args = b64args +end function + +Function QuoteForShell(strIn) + QuoteForShell = """" & _ + replace(strIn, """", """""") & """" +End Function diff --git a/sources_non_forked/editorconfig-vim/tests/core/ecvimlib.ps1 b/sources_non_forked/editorconfig-vim/tests/core/ecvimlib.ps1 new file mode 100644 index 00000000..45387d5a --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/ecvimlib.ps1 @@ -0,0 +1,140 @@ +# ecvimlib.ps1: Editorconfig Vimscript core CLI, PowerShell version, +# library routines. +# Copyright (c) 2018--2019 Chris White. All rights reserved. +# Licensed CC-BY-SA, version 3.0 or any later version, at your option. +# +# N.B.: debug output uses Warning only because those are displayed by default. + +#Requires -Version 3 + +# Get the directory of this script. From +# https://stackoverflow.com/a/5466355/2877364 by +# https://stackoverflow.com/users/23283/jaredpar + +$global:DIR = $PSScriptRoot + +### Set up debugging output ============================================ + +$global:debug=$env:EDITORCONFIG_DEBUG # Debug filename + +if($global:debug -and ($global:debug -notmatch '^/')) { + # Relative to this script unless it starts with a slash. This is because + # cwd is usually not $DIR when testing. + $global:debug="${DIR}/${global:debug}" +} + +### Process args ======================================================= + +function de64_args($argv) { + $argv | % { + $b64 = $_ -replace '-','=' -replace '_','/' -replace '\.','+' + [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($b64)) + } +} + +### Helpers ============================================================ + +# Append a string to $debug in UTF-8 rather than the default UTF-16 +filter global:D($file = $debug) { + if($debug) { + echo $_ | Out-File -FilePath $file -Encoding utf8 -Append + } +} + +# Escape a string for Vim +function global:vesc($str) { + return "'" + ($str -replace "'","''") + "'" +} + +# Escape a string for a command-line argument. +# See https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.arguments?view=netframework-4.7.2 +function global:argesc($arg) { + return '"' + ($arg -replace '"','"""') + '"' +} + +### Find the Vim EXE =================================================== + +function global:Find-Vim +{ + if($env:VIM_EXE) { + if($debug) { echo "Using env Vim $($env:VIM_EXE)" | D } + return $env:VIM_EXE + } + + $vims = @(get-childitem 'c:\program files*\vim\**\vim.exe' | ` + sort LastWriteTime -Descending) # @() => always array + + # write-host ($vims | format-table | out-string) # DEBUG + # write-host ($vims | get-member | out-string) + if($vims.count -gt 0) { + if($debug) { echo "Using found Vim $($vims[0].FullName)" | D } + return $vims[0].FullName + } + + throw "Could not find vim.exe. Please set VIM_EXE to the path to your Vim." +} #Find-Vim + +### Runner ============================================================= + +# Run a process with the given arguments. +function global:run_process +{ + param( + [Parameter(Mandatory=$true, Position=0)][string]$run, + [string]$extrapath, + [string]$stdout, # Redirect stdout to this file + [string]$stderr, # Redirect stderr to this file + [string[]]$argv # Arguments to $run + ) + $si = new-object Diagnostics.ProcessStartInfo + if($extrapath) { + $si.EnvironmentVariables['path']+=";${extrapath}" + } + $si.FileName=$run + + # Stringify the arguments (blech) + $argstr = $argv | % { (argesc $_) + ' ' } + $si.Arguments = $argstr; + + if($debug) { echo "Running process $run with arguments >>$argstr<<" | D } + + $si.UseShellExecute=$false + # DEBUG $si.RedirectStandardInput=$true + if($stdout) { + if($debug) { echo "Saving stdout to ${stdout}" | D } + $si.RedirectStandardOutput=$true; + } + if($stderr) { + if($debug) { echo "Saving stderr to ${stderr}" | D } + $si.RedirectStandardError=$true; + } + + $p = [Diagnostics.Process]::Start($si) + # DEBUG $p.StandardInput.Close() # < /dev/null + + $p.WaitForExit() + $retval = $p.ExitCode + + if($stdout) { + echo "Standard output:" | D $stdout + $p.StandardOutput.ReadToEnd() | ` + Out-File -FilePath $stdout -Encoding utf8 -Append + } + + if($stderr) { + echo "Standard error:" | D $stderr + $p.StandardError.ReadToEnd() | ` + Out-File -FilePath $stderr -Encoding utf8 -Append + } + + $p.Close() + + return $retval +} + +if($debug) { + echo "======================================================" | D + Get-Date -format F | D +} + +$global:VIM = Find-Vim diff --git a/sources_non_forked/editorconfig-vim/tests/core/editorconfig b/sources_non_forked/editorconfig-vim/tests/core/editorconfig new file mode 100644 index 00000000..bdb5971d --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/editorconfig @@ -0,0 +1,219 @@ +#!/bin/bash +# editorconfig: Editorconfig Vimscript core CLI +# Copyright (c) 2018--2019 Chris White. All rights reserved. +# Licensed CC-BY-SA, version 3.0 or any later version, at your option. + +# Documentation {{{1 +helpstr=$(cat<<'EOF' +editorconfig: command-line invoker for the Vimscript editorconfig core + +Normal usage: + editorconfig [-f ] [-b ] + [-x ] + +The default is ".editorconfig". +If -b is given, behave as . +If -x is given, the is included in the debug-output file. + +Other options: + editorconfig -h, --help Show this help + editorconfig -v, --version Show version information + +Environment variables: + VIM_EXE File/path of vim (default "vim") + EDITORCONFIG_DEBUG File/path to which to append debug output + +EOF +) + +# }}}1 + +# Get the directory of this script into $this_script_dir. {{{1 +# From https://stackoverflow.com/a/246128/2877364 by +# https://stackoverflow.com/users/407731 et al. + +this_script_dir= +function get_dir() +{ + local script_source_path="${BASH_SOURCE[0]}" + while [ -h "$script_source_path" ]; do + # resolve $script_source_path until the file is no longer a symlink + this_script_dir="$( cd -P "$( dirname "$script_source_path" )" >/dev/null && pwd )" + script_source_path="$(readlink "$script_source_path")" + [[ $script_source_path != /* ]] && script_source_path="$this_script_dir/$script_source_path" + # if $script_source_path was a relative symlink, we need to resolve + # it relative to the path where the symlink file was located + done + this_script_dir="$( cd -P "$( dirname "$script_source_path" )" >/dev/null && pwd )" +} #get_dir() + +get_dir + +# }}}1 + +# Setup debug output, if $EDITORCONFIG_DEBUG is given {{{1 +debug="${EDITORCONFIG_DEBUG}" # Debug filename +if [[ $debug && $debug != /* ]]; then # Relative to this script unless it + debug="${this_script_dir}/${debug}" # starts with a slash. This is because +fi # cwd is usually not $this_script_dir when testing. +if [[ $debug ]] && ! touch "$debug"; then + echo "Could not write file '$debug' - aborting" 1>&2 + exit 1 +fi + +[[ $debug ]] && echo "$(date) ==================================" >> "$debug" + +# }}}1 + +# Option processing {{{1 + +# Use a manually-specified Vim, if any +if [[ $VIM_EXE ]]; then + vim_pgm="$VIM_EXE" +else + vim_pgm="vim" +fi + +# Command-line options +confname= +ver= +print_ver= +extra_info= + +while getopts 'hvf:b:-:x:' opt ; do + case "$opt" in + (v) print_ver=1 + ;; + + (f) confname="$OPTARG" + ;; + + (b) ver="$OPTARG" + ;; + + (-) case "$OPTARG" in # hacky long-option processing + version) print_ver=1 + ;; + dummy) # A dummy option so that I can test + # list-valued EDITORCONFIG_CMD + ;; + help) echo "$helpstr" + exit 0 + ;; + esac + ;; + + (h) echo "$helpstr" + exit 0 + ;; + + # A way to put the test name into the log + (x) extra_info="$OPTARG" + ;; + + esac +done + +shift $(( $OPTIND - 1 )) + +if [[ $print_ver ]]; then + echo "EditorConfig VimScript Core Version 0.12.2" + exit 0 +fi + +if (( "$#" < 1 )); then + exit 1 +fi + +if [[ $1 = '-' ]]; then + echo "Reading filenames from stdin not yet supported" 1>&2 # TODO + exit 1 +fi + +# }}}1 + +# Build the Vim command line {{{1 + +fn="$(mktemp)" # Vim will write the settings into here. ~stdout. +script_output_fn="${debug:+$(mktemp)}" # Vim's :messages. ~stderr. + +cmd="call editorconfig_core#currbuf_cli({" + +# Names +cmd+="'output':'${fn//\'/\'\'}', " + # filename to put the settings in +[[ $debug ]] && cmd+=" 'dump':'${script_output_fn//\'/\'\'}', " + # where to put debug info + +# Filenames to get the settings for +cmd+="'target':[" +for f in "$@" ; do + cmd+="'${f//\'/\'\'}', " +done +cmd+="]," + # filename to get the settings for + +# Job +cmd+="}, {" +[[ $confname ]] && cmd+="'config':'${confname//\'/\'\'}', " + # config name (e.g., .editorconfig) +[[ $ver ]] && cmd+="'version':'${ver//\'/\'\'}', " + # version number we should behave as +cmd+="})" + +vim_args=( + -c "set runtimepath+=$this_script_dir/../.." + -c "$cmd" +) + +# }}}1 + +# Run the editorconfig core through Vim {{{1 +# Thanks for options to +# http://vim.wikia.com/wiki/Vim_as_a_system_interpreter_for_vimscript . +# Add -V1 to the below for debugging output. +# Do not output anything to stdout or stderr, +# since it messes up ctest's interpretation +# of the results. + +"$vim_pgm" -nNes -i NONE -u NONE -U NONE \ + "${vim_args[@]}" \ + > "${debug:-/dev/null}" +vimstatus="$?" +if [[ $vimstatus -eq 0 ]]; then + cat "$fn" +fi + +# }}}1 + +# Produce debug output {{{1 +# Debug output cannot be included on stdout or stderr, because +# ctest's regex check looks both of those places. Therefore, dump to a +# separate debugging file. +if [[ $debug ]] +then + [[ $extra_info ]] && echo "--- $extra_info ---" >> "$debug" + echo "Vim in $vim_pgm" >> "$debug" + echo "Current directory: $(pwd)" >> "$debug" + echo "Script directory: $this_script_dir" >> "$debug" + echo Vim args: "${vim_args[@]}" >> "$debug" + #od -c <<<"${vim_args[@]}" >> "$debug" + echo "Vim returned $vimstatus" >> "$debug" + echo "Vim messages were: " >> "$debug" + cat "$script_output_fn" >> "$debug" + echo "Output was:" >> "$debug" + od -c "$fn" >> "$debug" + + rm -f "$script_output_fn" +fi + +# }}}1 + +# Cleanup {{{1 + +rm -f "$fn" + +# }}}1 + +exit "$vimstatus" # forward the Vim exit status to the caller +# vi: set ft=sh fdm=marker: diff --git a/sources_non_forked/editorconfig-vim/tests/core/editorconfig.bat b/sources_non_forked/editorconfig-vim/tests/core/editorconfig.bat new file mode 100644 index 00000000..77b54470 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/editorconfig.bat @@ -0,0 +1,11 @@ +@echo off +:: editorconfig.bat: First-level invoker for editorconfig-core-vimscript +:: and editorconfig-vim. +:: Just passes the full command line to editorconfig1.vbs, since VBScript +:: applies very simple quoting rules when it parses a command line. +:: Copyright (c) 2018--2019 Chris White. All rights reserved. +:: Licensed CC-BY-SA, version 3.0 or any later version, at your option. +set here=%~dp0 + +cscript //Nologo "%here%editorconfig1.vbs" %* +:: %* has the whole command line diff --git a/sources_non_forked/editorconfig-vim/tests/core/editorconfig1.vbs b/sources_non_forked/editorconfig-vim/tests/core/editorconfig1.vbs new file mode 100644 index 00000000..488411fc --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/editorconfig1.vbs @@ -0,0 +1,39 @@ +' editorconfig1.vbs: run by editorconfig.bat +' runs editorconfig2.ps1 +' Part of editorconfig-core-vimscript and editorconfig-vim. +' +' Copyright (c) 2018--2019 Chris White. All rights reserved. +' Licensed CC-BY-SA, version 3.0 or any later version, at your option. +' +' Modified from +' https://stackoverflow.com/a/2470557/2877364 by +' https://stackoverflow.com/users/2441/aphoria + +' Thanks to https://www.geekshangout.com/vbs-script-to-get-the-location-of-the-current-script/ +currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "") + +' Load our common library. Thanks to https://stackoverflow.com/a/316169/2877364 +With CreateObject("Scripting.FileSystemObject") + executeGlobal .openTextFile(currentScriptPath & "ecvbslib.vbs").readAll() +End With + +' === MAIN ================================================================== + +' Encode all the arguments as modified base64 so there will be no quoting +' issues when we invoke powershell. +b64args = MakeY64Args(Wscript.Arguments) + +' Quote script name just in case +ps1name = QuoteForShell(currentScriptPath & "editorconfig2.ps1") +'Wscript.Echo "Script is in " & ps1name + +if True then + retval = RunCommandAndEcho( "powershell.exe" & _ + " -executionpolicy bypass -file " & ps1name & " " & join(b64args) _ + ) + ' add -noexit to leave window open so you can see error messages + + WScript.Quit retval +end if + +' vi: set ts=4 sts=4 sw=4 et ai: diff --git a/sources_non_forked/editorconfig-vim/tests/core/editorconfig2.ps1 b/sources_non_forked/editorconfig-vim/tests/core/editorconfig2.ps1 new file mode 100644 index 00000000..0bc3602a --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/core/editorconfig2.ps1 @@ -0,0 +1,218 @@ +# editorconfig2.ps1: Editorconfig Vimscript core CLI, PowerShell version +# Copyright (c) 2018--2019 Chris White. All rights reserved. +# Licensed CC-BY-SA, version 3.0 or any later version, at your option. +# Thanks to https://cecs.wright.edu/~pmateti/Courses/233/Labs/Scripting/bashVsPowerShellTable.html +# by Gallagher and Mateti. + +#Requires -Version 3 + +. "$PSScriptRoot\ecvimlib.ps1" + +# Argument parsing =================================================== {{{1 + +$argv = @(de64_args($args)) + +# Defaults +$report_version = $false +$set_version = '' +$config_name = '.editorconfig' +$extra_info = '' +$files=@() + +# Hand-parse - pretend we're sort of like getopt. +$idx = 0 +while($idx -lt $argv.count) { + $a = $argv[$idx] + + switch -CaseSensitive -Regex ($a) { + '^(-v|--version)$' { $report_version = $true } + + '^--dummy$' { + # A dummy option so that I can test list-valued EDITORCONFIG_CMD + } + + '^-f$' { + if($idx -eq ($argv.count-1)) { + throw '-f : no filename provided' + } else { + ++$idx + $config_name = $argv[$idx] + } + } #-f + + '^-b$' { + if($idx -eq ($argv.count-1)) { + throw '-b : no version provided' + } else { + ++$idx + $set_version = $argv[$idx] + } + } #-b + + '^-x$' { + if($idx -eq ($argv.count-1)) { + throw '-x : no info provided' + } else { + ++$idx + $extra_info = $argv[$idx] + } + } #-x + + '^--$' { # End of options, so capture the rest as filenames + ++$idx; + while($idx -lt $argv.count) { + $files += $argv[$idx] + } + } + + default { $files += $a } + } + + ++$idx +} # end foreach argument + +# }}}1 +# Argument processing ================================================ {{{1 + +if($debug) { + if($extra_info -ne '') { + echo "--- $extra_info --- " | D + } + + echo "Running in $DIR" | D + echo "Vim executable: $VIM" | D + echo "report version? $report_version" | D + echo "set version to: $set_version" | D + echo "config filename: $config_name" | D + echo "Filenames: $files" | D + echo "Args: $args" | D + echo "Decoded args: $argv" | D +} + +if($report_version) { + echo "EditorConfig VimScript Core Version 0.12.2" + exit +} + +if($files.count -lt 1) { + exit +} + +if($files[0] -eq '-') { + echo "Reading filenames from stdin not yet supported" # TODO + exit 1 +} + +$fn=[System.IO.Path]::GetTempFileName(); + # Vim will write the settings into here. Sort of like stdout. +$script_output_fn = '' +if($debug) { + $script_output_fn = [System.IO.Path]::GetTempFileName() +} + +# Permit throwing in setup commands +$cmd = '' +if($env:EDITORCONFIG_EXTRA) { + $cmd += $env:EDITORCONFIG_EXTRA + ' | ' +} + +# }}}1 +# Build Vim command line ============================================= {{{1 +$cmd += 'call editorconfig_core#currbuf_cli({' + +# Names +$cmd += "'output':" + (vesc($fn)) + ", " + # filename to put the settings in +if($debug) { + $cmd += " 'dump':" + (vesc($script_output_fn)) + ", " + # where to put debug info +} + +# Filenames to get the settings for +$cmd += "'target':[" +ForEach ($item in $files) { + $cmd += (vesc($item)) + ", " +} +$cmd += "]," + +# Job +$cmd += "}, {" +if($config_name) { $cmd += "'config':" + (vesc($config_name)) + ", " } + # config name (e.g., .editorconfig) +if($set_version) { $cmd += "'version':" + (vesc($set_version)) + ", " } + # version number we should behave as +$cmd += "})" + +#$cmd =':q!' # DEBUG +if($debug) { echo "Using Vim command ${cmd}" | D } +$vim_args = @( + '-c', "set runtimepath+=${DIR}\..\..", + '-c', $cmd, + '-c', 'quit!' # TODO write a wrapper that will cquit on exception +) + +# Run editorconfig. Thanks for options to +# http://vim.wikia.com/wiki/Vim_as_a_system_interpreter_for_vimscript . +# Add -V1 to the below for debugging output. +# Do not output anything to stdout or stderr, +# since it messes up ctest's interpretation +# of the results. + +$basic_args = '-nNes','-i','NONE','-u','NONE','-U','NONE' #, '-V1' + +# }}}1 +# Run Vim ============================================================ {{{1 + +if($debug) { echo "Running vim ${VIM}" | D } +$vimstatus = run_process $VIM -stdout $debug -stderr $debug ` + -argv ($basic_args+$vim_args) +if($debug) { echo "Done running vim" | D } + +if($vimstatus -eq 0) { + cat $fn +} + +# }}}1 +# Produce debug output =============================================== {{{1 + +# Debug output cannot be included on stdout or stderr, because +# ctest's regex check looks both of those places. Therefore, dump to a +# separate debugging file. + +if($debug) { + echo "Current directory:" | D + (get-item -path '.').FullName | D + echo "Script directory: $DIR" | D +### echo Vim args: "${vim_args[@]}" >> "$debug" +### #od -c <<<"${vim_args[@]}" >> "$debug" + echo "Vim returned $vimstatus" | D + echo "Vim messages were: " | D + cat $script_output_fn | D + echo "Output was:" | D + + # Modified from https://www.itprotoday.com/powershell/get-hex-dumps-files-powershell + Get-Content $script_output_fn -Encoding Byte -ReadCount 16 | ` + ForEach-Object { + $output = "" + $chars = '' + foreach ( $byte in $_ ) { + $output += "{0:X2} " -f $byte + if( ($byte -ge 32) -and ($byte -le 127) ) { + $chars += [char]$byte + } else { + $chars += '.' + } + } + $output + ' ' + $chars + } | D + + del -Force $script_output_fn +} #endif $debug + +# }}}1 + +del -Force $fn + +exit $vimstatus + +# vi: set fdm=marker: diff --git a/sources_non_forked/editorconfig-vim/tests/fetch-vim.bat b/sources_non_forked/editorconfig-vim/tests/fetch-vim.bat new file mode 100644 index 00000000..c834fd74 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/fetch-vim.bat @@ -0,0 +1,12 @@ +:: fetch-vim.bat: Fetch vim if necessary +:: For use in the editorconfig-vim Appveyor build +:: Copyright (c) 2018--2019 Chris White. All rights reserved. +:: Licensed Apache 2.0, or any later version, at your option. + +:: If it's already been loaded from the cache, we're done +if exist C:\vim\vim\vim80\vim.exe exit + +:: Otherwise, download and unzip it. +appveyor DownloadFile https://github.com/cxw42/editorconfig-core-vimscript/releases/download/v0.1.0/vim.7z + +7z x vim.7z -oC:\vim diff --git a/sources_non_forked/editorconfig-vim/tests/fetch-vim.sh b/sources_non_forked/editorconfig-vim/tests/fetch-vim.sh new file mode 100644 index 00000000..22e7912a --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/fetch-vim.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# fetch-vim.bat: Fetch vim if necessary +# For use in the editorconfig-vim Appveyor build +# Copyright (c) 2018--2019 Chris White. All rights reserved. +# Licensed Apache 2.0, or any later version, at your option. + +# Debugging +set -x +set -o nounset +#set -o errexit + +# Basic system info +uname -a +pwd +ls -l + +echo "VIM_EXE: $VIM_EXE" +set + +# If it's already been loaded from the cache, we're done +if [[ -x "$VIM_EXE" ]]; then + echo Vim found in cache at "$VIM_EXE" + exit 0 +fi + +# Otherwise, clone and build it +WHITHER="$APPVEYOR_BUILD_FOLDER/vim" + +git clone https://github.com/vim/vim-appimage.git +cd vim-appimage +git submodule update --init --recursive + +cd vim/src +./configure --with-features=huge --prefix="$WHITHER" --enable-fail-if-missing +make -j2 # Free tier provides two cores +make install +./vim --version +cd $APPVEYOR_BUILD_FOLDER +find . -type f -name vim -exec ls -l {} + + +echo Done fetching and installing vim diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/.gitignore b/sources_non_forked/editorconfig-vim/tests/plugin/.gitignore new file mode 100644 index 00000000..cee07667 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/.gitignore @@ -0,0 +1,2 @@ +# Where bundler installs local Gemfile dependencies +/vendor/ diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile b/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile new file mode 100644 index 00000000..49270e49 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gem 'rake', '~> 12.3.3' +gem 'rspec', '~> 3.4.0' +gem 'vimrunner', '~> 0.3.1' diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile.lock b/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile.lock new file mode 100644 index 00000000..5d1c3f47 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/Gemfile.lock @@ -0,0 +1,27 @@ +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (1.2.5) + rake (12.3.3) + rspec (3.4.0) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-core (3.4.1) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + vimrunner (0.3.1) + +PLATFORMS + ruby + +DEPENDENCIES + rake (~> 12.3.3) + rspec (~> 3.4.0) + vimrunner (~> 0.3.1) diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/Rakefile b/sources_non_forked/editorconfig-vim/tests/plugin/Rakefile new file mode 100644 index 00000000..3119d82e --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/Rakefile @@ -0,0 +1,8 @@ +# +# run `rake` to run tests + +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task :default => :spec diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/spec/.editorconfig b/sources_non_forked/editorconfig-vim/tests/plugin/spec/.editorconfig new file mode 100644 index 00000000..834f0eb3 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/spec/.editorconfig @@ -0,0 +1,4 @@ +[*.rb] +indent_style = space +indent_size = 2 +end_of_line = lf diff --git a/sources_non_forked/editorconfig-vim/tests/plugin/spec/editorconfig_spec.rb b/sources_non_forked/editorconfig-vim/tests/plugin/spec/editorconfig_spec.rb new file mode 100644 index 00000000..0b3e654b --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/plugin/spec/editorconfig_spec.rb @@ -0,0 +1,161 @@ +require 'vimrunner' + +def create_vim(*initial_commands) + vim = Vimrunner.start + initial_commands.each do |cmd| + vim.command cmd + end + vim.add_plugin(File.expand_path('../../../..', __FILE__), 'plugin/editorconfig.vim') + return vim +end + +# The base path of the testing files +BASE_PATH = File.expand_path('../plugin_tests/test_files/', __FILE__) + +# file_name is the file name that should be open by Vim +# expected_values is a Hash that contains all the Vim options we need to test +def test_editorconfig(vim, file_name, expected_values) + vim.edit(File.join(BASE_PATH, file_name)) + + expected_values.each do |key, val| + expect(vim.echo("&l:#{key}")).to eq(val) + end + + vim.command 'bd!' +end + +def test_instance(vim) + describe 'plugin/editorconfig.vim' do + after(:all) do + vim.kill + end + + describe '#all' do + it '3_space.py' do + test_editorconfig vim, '3_space.txt', + expandtab: '1', + shiftwidth: '3', + tabstop: '3' + end + end + + it '4_space.py' do + test_editorconfig vim, '4_space.py', + expandtab: '1', + shiftwidth: '4', + tabstop: '8' + end + + it 'space.txt' do + test_editorconfig vim, 'space.txt', + expandtab: '1', + shiftwidth: vim.echo('&l:tabstop') + end + + it 'tab.txt' do + test_editorconfig vim, 'tab.txt', + expandtab: '0' + end + + it '4_tab.txt' do + test_editorconfig vim, '4_tab.txt', + expandtab: '0', + shiftwidth: '4', + tabstop: '4' + end + + it '4_tab_width_of_8' do + test_editorconfig vim, '4_tab_width_of_8.txt', + expandtab: '0', + shiftwidth: '4', + tabstop: '8' + end + + it 'lf.txt' do + test_editorconfig vim, 'lf.txt', + fileformat: 'unix' + end + + it 'crlf.txt' do + test_editorconfig vim, 'crlf.txt', + fileformat: 'dos' + end + + it 'cr.txt' do + test_editorconfig vim, 'cr.txt', + fileformat: 'mac' + end + + it 'utf-8.txt' do + test_editorconfig vim, 'utf-8.txt', + fileencoding: 'utf-8', + bomb: '0' + end + + it 'utf-8-bom.txt' do + test_editorconfig vim, 'utf-8-bom.txt', + fileencoding: 'utf-8', + bomb: '1' + end + + it 'utf-16be.txt' do + test_editorconfig vim, 'utf-16be.txt', + fileencoding: 'utf-16' + end + + it 'utf-16le.txt' do + test_editorconfig vim, 'utf-16le.txt', + fileencoding: 'utf-16le' + end + + it 'latin1.txt' do + test_editorconfig vim, 'latin1.txt', + fileencoding: 'latin1' + end + + # insert_final_newline by PreserveNoEOL tests are omitted, since they are not supported + if vim.echo("exists('+fixendofline')") == '1' + it 'with_newline.txt' do + test_editorconfig vim, 'with_newline.txt', + fixendofline: '1' + end + + it 'without_newline.txt' do + test_editorconfig vim, 'without_newline.txt', + fixendofline: '0' + end + end + end +end + +# Test the vim core +(lambda do + puts 'Testing default' + vim = create_vim + test_instance vim +end).call + +# Test the vim core with an express setting +(lambda do + puts 'Testing with express vim_core mode' + vim = create_vim("let g:EditorConfig_core_mode='vim_core'") + test_instance vim +end).call + +# Test with external-core mode, but no external core defined +(lambda do + puts 'Testing with fallback to vim_core mode' + vim = create_vim("let g:EditorConfig_core_mode='external_command'") + test_instance vim +end).call + +# Test with an external core, if desired +extcore = ENV['EDITORCONFIG_VIM_EXTERNAL_CORE'] +if extcore + puts "Testing with external_command #{extcore}" + vim = create_vim( + "let g:EditorConfig_core_mode='external_command'", + "let g:EditorConfig_exec_path='#{extcore}'", + ) + test_instance vim +end diff --git a/sources_non_forked/editorconfig-vim/tests/travis-test.sh b/sources_non_forked/editorconfig-vim/tests/travis-test.sh new file mode 100644 index 00000000..76022a03 --- /dev/null +++ b/sources_non_forked/editorconfig-vim/tests/travis-test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# travis-test.sh: Script for running editorconfig-vim tests under Travis CI. +# Copyright (c) 2019 Chris White. All rights reserved. +# Licensed Apache, version 2.0 or any later version, at your option. + +# Error exit; debug output +set -vxEeuo pipefail + +# Permit `travis-test.sh plugin` if TEST_WHICH is unset +if [[ ( ! "${TEST_WHICH:-}" ) && "${1:-}" ]]; then + export TEST_WHICH="$1" +fi + +if [[ "$TEST_WHICH" = 'plugin' ]]; then # test plugin + + # If not running from Travis, do what Travis would have + # done for us. + if [[ ! "${BUNDLE_GEMFILE:-}" ]]; then + here="$(cd "$(dirname "$0")" &>/dev/null ; pwd)" + export BUNDLE_GEMFILE="${here}/plugin/Gemfile" + # Install into tests/plugin/vendor. Don't clear it first, + # since you can clear it yourself if you're running from a + # dev environment. + bundle install --jobs=3 --retry=3 --deployment + fi + + # Use the standalone Vimscript EditorConfig core to test the plugin's + # external_command mode + export EDITORCONFIG_VIM_EXTERNAL_CORE=tests/core/editorconfig + + bundle exec rspec tests/plugin/spec/editorconfig_spec.rb + +elif [[ "$TEST_WHICH" = 'core' ]]; then # test core + cd tests/core + mkdir -p build # May already exist if running from a dev env + cd build + cmake .. + ctest . --output-on-failure -VV -C Debug + # -C Debug: for Visual Studio builds, you have to specify + # a configuration. + +else + echo 'Invalid TEST_WHICH value' 1>&2 + exit 1 +fi diff --git a/update_plugins.py b/update_plugins.py index 37abdc99..bed9053b 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -58,6 +58,7 @@ typescript-vim https://github.com/leafgarland/typescript-vim vim-javascript https://github.com/pangloss/vim-javascript vim-python-pep8-indent https://github.com/Vimjas/vim-python-pep8-indent mru.vim https://github.com/vim-scripts/mru.vim +editorconfig-vim https://github.com/editorconfig/editorconfig-vim """.strip() GITHUB_ZIP = "%s/archive/master.zip" diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index 24c18338..85671756 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -172,3 +172,9 @@ let g:ale_lint_on_enter = 0 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:gitgutter_enabled=0 nnoremap d :GitGutterToggle + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => EditorConfig (project-specific EditorConfig rule) +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:EditorConfig_exclude_patterns = ['fugitive://.*'] From fd420a05211b09067e0af457c7f2ca48546f59e0 Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 23 Jun 2021 11:57:12 +0200 Subject: [PATCH 66/91] Updated plugins --- .../ale/ale_linters/java/javac.vim | 4 +- .../ale/ale_linters/yaml/circleci.vim | 35 ++++++++++++++++++ .../ale/autoload/ale/completion.vim | 20 ++++++---- .../ale/autoload/ale/debugging.vim | 8 +--- .../ale/autoload/ale/filetypes.vim | 4 +- .../ale/autoload/ale/handlers/eslint.vim | 16 +++++--- sources_non_forked/ale/autoload/ale/sign.vim | 12 +++--- .../doc/ale-supported-languages-and-tools.txt | 1 + sources_non_forked/ale/doc/ale-yaml.txt | 26 +++++++++++++ sources_non_forked/ale/doc/ale.txt | 17 ++++++++- sources_non_forked/ale/supported-tools.md | 1 + sources_non_forked/lightline-ale/README.md | 2 +- .../vim-fugitive/autoload/fugitive.vim | 31 ++++++++++------ .../vim-fugitive/ftplugin/fugitiveblame.vim | 2 +- .../vim-fugitive/syntax/fugitiveblame.vim | 2 +- sources_non_forked/vim-gitgutter/README.mkd | 7 +++- .../vim-gitgutter/autoload/gitgutter/hunk.vim | 37 ++++++++++++------- .../vim-gitgutter/doc/gitgutter.txt | 21 ++++++++--- .../vim-ruby/spec/syntax/symbols_spec.rb | 8 ++++ .../vim-ruby/spec/vim/plugin/syntax_test.vim | 2 +- sources_non_forked/vim-ruby/syntax/ruby.vim | 8 ++-- .../vim-snipmate/doc/snipMate.txt | 2 +- .../vim-snippets/UltiSnips/julia.snippets | 9 +++++ .../vim-snippets/snippets/python.snippets | 2 +- .../vim-snippets/snippets/rust.snippets | 2 +- .../vim-snippets/snippets/vue.snippets | 2 +- 26 files changed, 208 insertions(+), 73 deletions(-) create mode 100644 sources_non_forked/ale/ale_linters/yaml/circleci.vim diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 760f234c..971e8de0 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -132,7 +132,9 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern]) if empty(l:match[2]) && empty(l:match[3]) - let l:output[-1].col = len(l:match[1]) + if !empty(l:match[1]) && !empty(l:output) + let l:output[-1].col = len(l:match[1]) + endif elseif empty(l:match[3]) " Add symbols to 'cannot find symbol' errors. if l:output[-1].text is# 'error: cannot find symbol' diff --git a/sources_non_forked/ale/ale_linters/yaml/circleci.vim b/sources_non_forked/ale/ale_linters/yaml/circleci.vim new file mode 100644 index 00000000..3df61459 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/circleci.vim @@ -0,0 +1,35 @@ +function! ale_linters#yaml#circleci#Handle(buffer, lines) abort + let l:match_index = -1 + let l:output = [] + + for l:index in range(len(a:lines)) + let l:line = a:lines[l:index] + + if l:line =~? 'Error: ERROR IN CONFIG FILE:' + let l:match_index = l:index + 1 + break + endif + endfor + + if l:match_index > 0 + return [{ + \ 'type': 'E', + \ 'lnum': 1, + \ 'text': a:lines[l:match_index], + \ 'detail': join(a:lines[l:match_index :], "\n"), + \}] + endif + + return [] +endfunction + +" The circleci validate requires network requests, so we'll only run it when +" files are saved to prevent the server from being hammered. +call ale#linter#Define('yaml', { +\ 'name': 'circleci', +\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''}, +\ 'command': 'circleci config validate - < %s', +\ 'callback': 'ale_linters#yaml#circleci#Handle', +\ 'output_stream': 'stderr', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 332d0734..4cf3a51a 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -269,13 +269,19 @@ function! s:ReplaceCompletionOptions(source) abort let b:ale_old_completeopt = &l:completeopt endif - if &l:completeopt =~# 'preview' - let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' - elseif &l:completeopt =~# 'popup' - let &l:completeopt = 'menu,menuone,popup,noselect,noinsert' - else - let &l:completeopt = 'menu,menuone,noselect,noinsert' - endif + let l:opt_list = split(&l:completeopt, ',') + " The menu and noinsert options must be set, or automatic completion + " will be annoying. + let l:new_opt_list = ['menu', 'menuone', 'noinsert'] + + " Permit some other completion options, provided users have set them. + for l:opt in ['preview', 'popup', 'noselect'] + if index(l:opt_list, l:opt) >= 0 + call add(l:new_opt_list, l:opt) + endif + endfor + + let &l:completeopt = join(l:new_opt_list, ',') endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index 1f7ea467..efd52776 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -259,9 +259,7 @@ function! ale#debugging#InfoToClipboard() abort return endif - redir => l:output - silent call ale#debugging#Info() - redir END + let l:output = execute('call ale#debugging#Info()') let @+ = l:output call s:Echo('ALEInfo copied to your clipboard') @@ -270,9 +268,7 @@ endfunction function! ale#debugging#InfoToFile(filename) abort let l:expanded_filename = expand(a:filename) - redir => l:output - silent call ale#debugging#Info() - redir END + let l:output = execute('call ale#debugging#Info()') call writefile(split(l:output, "\n"), l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename) diff --git a/sources_non_forked/ale/autoload/ale/filetypes.vim b/sources_non_forked/ale/autoload/ale/filetypes.vim index 6cdc9ece..340a9c4e 100644 --- a/sources_non_forked/ale/autoload/ale/filetypes.vim +++ b/sources_non_forked/ale/autoload/ale/filetypes.vim @@ -4,9 +4,7 @@ function! ale#filetypes#LoadExtensionMap() abort " Output includes: " '*.erl setf erlang' - redir => l:output - silent exec 'autocmd' - redir end + let l:output = execute('exec "autocmd"') let l:map = {} diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index 7c492968..374460bc 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -2,10 +2,10 @@ " Description: Functions for working with eslint, for checking or fixing files. let s:executables = [ +\ '.yarn/sdks/eslint/bin/eslint.js', \ 'node_modules/.bin/eslint_d', \ 'node_modules/eslint/bin/eslint.js', \ 'node_modules/.bin/eslint', -\ '.yarn/sdks/eslint/bin/eslint', \] let s:sep = has('win32') ? '\' : '/' @@ -52,14 +52,20 @@ function! ale#handlers#eslint#GetCwd(buffer) abort let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) if !empty(l:executable) - let l:nmi = strridx(l:executable, 'node_modules') - let l:project_dir = l:executable[0:l:nmi - 2] + let l:modules_index = strridx(l:executable, 'node_modules') + let l:modules_root = l:modules_index > -1 ? l:executable[0:l:modules_index - 2] : '' + + let l:sdks_index = strridx(l:executable, ale#path#Simplify('.yarn/sdks')) + let l:sdks_root = l:sdks_index > -1 ? l:executable[0:l:sdks_index - 2] : '' else let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') - let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + let l:modules_root = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + + let l:sdks_dir = ale#path#FindNearestDirectory(a:buffer, ale#path#Simplify('.yarn/sdks')) + let l:sdks_root = !empty(l:sdks_dir) ? fnamemodify(l:sdks_dir, ':h:h:h') : '' endif - return !empty(l:project_dir) ? l:project_dir : '' + return strlen(l:modules_root) > strlen(l:sdks_root) ? l:modules_root : l:sdks_root endfunction function! ale#handlers#eslint#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index e796f0f0..0607e17a 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -52,9 +52,7 @@ endif function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort let l:verbose = &verbose set verbose=0 - redir => l:output - 0verbose silent highlight SignColumn - redir end + let l:output = execute('highlight SignColumn', 'silent') let &verbose = l:verbose let l:highlight_syntax = join(split(l:output)[2:]) @@ -171,10 +169,10 @@ endfunction " Read sign data for a buffer to a list of lines. function! ale#sign#ReadSigns(buffer) abort - redir => l:output - silent execute 'sign place ' . s:GroupCmd() . s:PriorityCmd() - \ . ' buffer=' . a:buffer - redir end + let l:output = execute( + \ 'sign place ' . s:GroupCmd() . s:PriorityCmd() + \ . ' buffer=' . a:buffer + \ ) return split(l:output, "\n") endfunction diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 67dc971c..4a901488 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -568,6 +568,7 @@ Notes: * XML * `xmllint` * YAML + * `circleci`!! * `prettier` * `spectral` * `swaglint` diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt index 04871403..65e0d069 100644 --- a/sources_non_forked/ale/doc/ale-yaml.txt +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -1,6 +1,28 @@ =============================================================================== ALE YAML Integration *ale-yaml-options* + +=============================================================================== +circleci *ale-yaml-circleci* + +Website: https://circleci.com/docs/2.0/local-cli + + +Installation +------------------------------------------------------------------------------- + +Follow the instructions on the website, and make sure to test that you can +validate configuration files with: > + + circleci config validate - < .circleci/config.yml +< + +As long as the validator runs correctly, you should be able to see errors when +you save the configuration file. The validator doesn't run as you type because +it sends network requests, and running too often would overload the circleci +servers. + + =============================================================================== prettier *ale-yaml-prettier* @@ -15,11 +37,13 @@ Install prettier either globally or locally: > npm install prettier -g # global npm install prettier # local < + =============================================================================== spectral *ale-yaml-spectral* Website: https://github.com/stoplightio/spectral + Installation ------------------------------------------------------------------------------- @@ -80,6 +104,7 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* See |ale-integrations-local-executables| + =============================================================================== yamlfix *ale-yaml-yamlfix* @@ -118,6 +143,7 @@ g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global* See |ale-integrations-local-executables| + =============================================================================== yamllint *ale-yaml-yamllint* diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index b7059af9..a126f360 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -561,7 +561,6 @@ vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < - Or alternatively, if you want to show documentation in popups: > set completeopt=menu,menuone,popup,noselect,noinsert @@ -3083,6 +3082,7 @@ documented in additional help files. xml.....................................|ale-xml-options| xmllint...............................|ale-xml-xmllint| yaml....................................|ale-yaml-options| + circleci..............................|ale-yaml-circleci| prettier..............................|ale-yaml-prettier| spectral..............................|ale-yaml-spectral| swaglint..............................|ale-yaml-swaglint| @@ -3734,6 +3734,21 @@ ale#fix#registry#Add(name, func, filetypes, desc, [aliases]) ALE will search for fixers in the registry first by `name`, then by their `aliases`. + For example to register a custom fixer for `luafmt`: > + + function! FormatLua(buffer) abort + return { + \ 'command': 'luafmt --stdin' + \} + endfunction + + execute ale#fix#registry#Add('luafmt', 'FormatLua', ['lua'], 'luafmt for lua') + + " You can now use it in g:ale_fixers + let g:ale_fixers = { + \ 'lua': ['luafmt'] + } +< ale#linter#Define(filetype, linter) *ale#linter#Define()* diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 0f33006b..7848d111 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -577,6 +577,7 @@ formatting. * XML * [xmllint](http://xmlsoft.org/xmllint.html) * YAML + * [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: * [prettier](https://github.com/prettier/prettier) * [spectral](https://github.com/stoplightio/spectral) * [swaglint](https://github.com/byCedric/swaglint) diff --git a/sources_non_forked/lightline-ale/README.md b/sources_non_forked/lightline-ale/README.md index 152a3c2e..78a1e853 100644 --- a/sources_non_forked/lightline-ale/README.md +++ b/sources_non_forked/lightline-ale/README.md @@ -16,7 +16,7 @@ This plugin provides [ALE](https://github.com/w0rp/ale) indicator for the [light Install using a plugin manager of your choice, for example: ```viml -call dein#add('w0rp/ale') " Dependency: linter +call dein#add('dense-analysis/ale') " Dependency: linter call dein#add('itchyny/lightline.vim') " Dependency: status line call dein#add('maximbaz/lightline-ale') ``` diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 26f1637c..cb8a5147 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -41,7 +41,7 @@ endfunction function! s:WinShellEsc(arg) abort if type(a:arg) == type([]) - return join(map(copy(a:arg), 's:shellesc(v:val)')) + return join(map(copy(a:arg), 's:WinShellEsc(v:val)')) elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' return a:arg else @@ -1480,7 +1480,7 @@ function! fugitive#getfperm(url) abort return perm ==# '---------' ? '' : perm endfunction -function s:UpdateIndex(dir, info) abort +function! s:UpdateIndex(dir, info) abort let info = join(a:info[0:-2]) . "\t" . a:info[-1] . "\n" let [error, exec_error] = s:SystemError([a:dir, 'update-index', '--index-info'], info) return !exec_error ? '' : len(error) ? error : 'fugitive: unknown update-index error' @@ -2807,8 +2807,9 @@ function! fugitive#PagerFor(argv, ...) abort return 0 elseif type(value) == type('') return value - elseif args[0] =~# '^\%(branch\|config\|diff\|grep\|log\|range-diff\|reflog\|shortlog\|show\|tag\|whatchanged\)$' || + elseif args[0] =~# '^\%(branch\|config\|diff\|grep\|log\|range-diff\|shortlog\|show\|tag\|whatchanged\)$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || + \ (args[0] ==# 'reflog' && get(args, 1, '') !~# '^\%(expire\|delete\|exists\)$') || \ (args[0] ==# 'am' && s:HasOpt(args, '--show-current-patch')) return 1 else @@ -2861,7 +2862,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let name = substitute(get(args, 0, ''), '\%(^\|-\)\(\l\)', '\u\1', 'g') let git = s:UserCommandList() let options = {'git': git, 'dir': dir, 'flags': flags} - if pager is# -1 && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' + if pager is# -1 && name =~# '^\a\+$' && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'subcommand': args[0], 'subcommand_args': args[1:-1]}, options)) if type(overrides) == type('') @@ -2936,7 +2937,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort call extend(env, {'COLUMNS': '' . &columns - 1}, 'keep') endif if s:RunJobs() && pager isnot# 1 - let state.pty = get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim'))) + let state.pty = get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim')) && fugitive#GitVersion() !~# '\.windows\>') if !state.pty let args = s:AskPassArgs(dir) + args endif @@ -2993,9 +2994,19 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort return 'call fugitive#Resume()|silent checktime' . after elseif pager is# 1 let pre = s:BuildEnvPrefix(env) - silent! execute '!' . escape(pre . s:UserCommand({'git': git, 'dir': dir}, s:disable_colors + flags + ['--no-pager'] + args), '!#%') . - \ (&shell =~# 'csh' ? ' >& ' . s:shellesc(state.file) : ' > ' . s:shellesc(state.file) . ' 2>&1') - let state.exit_status = v:shell_error + try + if exists('+guioptions') && &guioptions =~# '!' + let guioptions = &guioptions + set guioptions-=! + endif + silent! execute '!' . escape(pre . s:UserCommand({'git': git, 'dir': dir}, s:disable_colors + flags + ['--no-pager'] + args), '!#%') . + \ (&shell =~# 'csh' ? ' >& ' . s:shellesc(state.file) : ' > ' . s:shellesc(state.file) . ' 2>&1') + let state.exit_status = v:shell_error + finally + if exists('guioptions') + let &guioptions = guioptions + endif + endtry redraw! call s:RunSave(state) call s:RunFinished(state) @@ -3968,7 +3979,7 @@ function! s:StageApply(info, reverse, extra) abort endif endwhile if start == 0 - throw 'fugitive: cold not find hunk' + throw 'fugitive: could not find hunk' elseif getline(start) !~# '^@@ ' throw 'fugitive: cannot apply conflict hunk' endif @@ -5487,8 +5498,6 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort set diffopt-=vertical endif execute mods 'diffsplit' s:fnameescape(spec) - let &l:readonly = &l:readonly - redraw let w:fugitive_diff_restore = restore let winnr = winnr() if getwinvar('#', '&diff') diff --git a/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim b/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim index 6fe0a14d..1037b093 100644 --- a/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim +++ b/sources_non_forked/vim-fugitive/ftplugin/fugitiveblame.vim @@ -1,4 +1,4 @@ -if exists("b:did_ftplugin") || !exists('*fugitive#BlameFileType') +if exists("b:did_ftplugin") || !exists("*FugitiveGitDir") finish endif let b:did_ftplugin = 1 diff --git a/sources_non_forked/vim-fugitive/syntax/fugitiveblame.vim b/sources_non_forked/vim-fugitive/syntax/fugitiveblame.vim index c06d19e0..70c1e745 100644 --- a/sources_non_forked/vim-fugitive/syntax/fugitiveblame.vim +++ b/sources_non_forked/vim-fugitive/syntax/fugitiveblame.vim @@ -1,4 +1,4 @@ -if exists("b:current_syntax") +if exists("b:current_syntax") || !exists("*FugitiveGitDir") finish endif diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 27fc7116..5bf9285e 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -77,13 +77,16 @@ nvim -u NONE -c "helptags vim-gitgutter/doc" -c q ### Windows -I recommend configuring vim-gitgutter with the full path to your git executable. For example: +There is a potential risk on Windows due to `cmd.exe` prioritising the current folder over folders in `PATH`. If you have a file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder, it will be executed instead of git whenever the plugin calls git. + +You can avoid this risk by configuring the full path to your git executable. For example: ```viml +" This path probably won't work let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe' ``` -This is to avoid a problem which occurs if you have file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder. `cmd.exe` prioritises the current folder over folders in `PATH` and will try to execute your file instead of the `git` binary. +Unfortunately I don't know the correct escaping for the path - if you do, please let me know! ### Getting started diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim index f530e3e4..28059c06 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/hunk.vim @@ -64,7 +64,7 @@ function! gitgutter#hunk#next_hunk(count) abort if g:gitgutter_show_msg_on_hunk_jumping redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) endif - if s:is_preview_window_open() + if gitgutter#hunk#is_preview_window_open() call gitgutter#hunk#preview() endif return @@ -95,7 +95,7 @@ function! gitgutter#hunk#prev_hunk(count) abort if g:gitgutter_show_msg_on_hunk_jumping redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) endif - if s:is_preview_window_open() + if gitgutter#hunk#is_preview_window_open() call gitgutter#hunk#preview() endif return @@ -249,7 +249,7 @@ function! s:hunk_op(op, ...) let hunk_diff = join(hunk_header + hunk_body, "\n")."\n" call s:goto_original_window() - call s:close_hunk_preview_window() + call gitgutter#hunk#close_hunk_preview_window() call s:stage(hunk_diff) endif @@ -427,7 +427,7 @@ endfunction function! s:open_hunk_preview_window() if g:gitgutter_preview_win_floating if exists('*nvim_open_win') - call s:close_hunk_preview_window() + call gitgutter#hunk#close_hunk_preview_window() let buf = nvim_create_buf(v:false, v:false) " Set default width and height for now. @@ -446,9 +446,15 @@ function! s:open_hunk_preview_window() call nvim_buf_set_name(buf, 'gitgutter://hunk-preview') " Assumes cursor is in original window. - autocmd CursorMoved ++once call s:close_hunk_preview_window() + autocmd CursorMoved ++once call gitgutter#hunk#close_hunk_preview_window() + if g:gitgutter_close_preview_on_escape - nnoremap :call close_hunk_preview_window() + " Map to close the floating preview. + nnoremap :call gitgutter#hunk#close_hunk_preview_window() + " Ensure that when the preview window is closed, the map is removed. + autocmd User GitGutterPreviewClosed silent! nunmap + autocmd CursorMoved ++once silent! nunmap + execute "autocmd WinClosed doautocmd" s:nomodeline "User GitGutterPreviewClosed" endif return @@ -584,7 +590,7 @@ function! s:goto_original_window() endfunction -function! s:close_hunk_preview_window() +function! gitgutter#hunk#close_hunk_preview_window() let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr call setbufvar(bufnr, '&modified', 0) @@ -601,12 +607,17 @@ function! s:close_hunk_preview_window() endfunction -" Only makes sense for traditional, non-floating preview window. -function s:is_preview_window_open() - for i in range(1, winnr('$')) - if getwinvar(i, '&previewwindow') - return 1 +function gitgutter#hunk#is_preview_window_open() + if g:gitgutter_preview_win_floating + if win_id2win(s:winid) > 0 + execute win_id2win(s:winid).'wincmd c' endif - endfor + else + for i in range(1, winnr('$')) + if getwinvar(i, '&previewwindow') + return 1 + endif + endfor + endif return 0 endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index 05bd2ce2..56a96336 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -63,15 +63,20 @@ Neovim:~ =============================================================================== WINDOWS *gitgutter-windows* -I recommend configuring vim-gitgutter with the full path to your git executable. +There is a potential risk on Windows due to `cmd.exe` prioritising the current +folder over folders in `PATH`. If you have a file named `git.*` (i.e. with +any extension in `PATHEXT`) in your current folder, it will be executed +instead of git whenever the plugin calls git. + +You can avoid this risk by configuring the full path to your git executable. For example: > + " This path probably won't work let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe' < -This is to avoid a problem which occurs if you have file named "git.*" (i.e. -with any extension in "PATHEXT") in your current folder. "cmd.exe" prioritises -the current folder over folders in 'PATH' and will try to execute your file -instead of the "git" binary. + +Unfortunately I don't know the correct escaping for the path - if you do, +please let me know! =============================================================================== @@ -190,6 +195,12 @@ Commands for operating on a hunk:~ the original window with |CTRL-W_p|. Alternatively set |g:gitgutter_close_preview_on_escape| and use . + Two functions are available for your own logic: +> + gitgutter#hunk#is_preview_window_open() + gitgutter#hunk#close_hunk_preview_window() +< + Commands for folds:~ *gitgutter-:GitGutterFold* diff --git a/sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb b/sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb index b0aad72e..92b314b7 100644 --- a/sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb +++ b/sources_non_forked/vim-ruby/spec/syntax/symbols_spec.rb @@ -42,4 +42,12 @@ describe "Syntax highlighting" do validates_inclusion_of :gender, in: %w(male female), if: :gender_required? EOF end + + specify "nested parentheses inside symbols" do + assert_correct_highlighting <<~EOF, 'bar\zs)', 'rubySymbol' + h = %i( + foo(bar)baz + ) + EOF + end end diff --git a/sources_non_forked/vim-ruby/spec/vim/plugin/syntax_test.vim b/sources_non_forked/vim-ruby/spec/vim/plugin/syntax_test.vim index db84204c..6b9bb74c 100644 --- a/sources_non_forked/vim-ruby/spec/vim/plugin/syntax_test.vim +++ b/sources_non_forked/vim-ruby/spec/vim/plugin/syntax_test.vim @@ -2,7 +2,7 @@ let s:debug = 0 function! s:CursorHasGroup(group) abort - return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ a:group + return synIDattr(synID(line('.'), col('.'), 1), 'name') =~ a:group endfunction function! TestSyntax(pattern, group) abort diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index d797e46b..149f13cf 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -133,10 +133,10 @@ syn match rubyCurlyBraceEscape "\\[{}]" contained display syn match rubyAngleBracketEscape "\\[<>]" contained display syn match rubySquareBracketEscape "\\[[\]]" contained display -syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained -syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained -syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained -syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained +syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" end=")" transparent contained +syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" end="}" transparent contained +syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" end=">" transparent contained +syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" end="\]" transparent contained syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape syn cluster rubyNestedBrackets contains=rubyNested.\+ diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index 52cc5b83..62265a00 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -532,7 +532,7 @@ sources such as creating snippets on the fly representing python function definitions found in the current file. Example 2:~ -Add to your ~/.vimrc: For each know snippet add a second version ending in _ +Add to your ~/.vimrc: For each new snippet add a second version ending in _ adding folding markers > let g:commentChar = { diff --git a/sources_non_forked/vim-snippets/UltiSnips/julia.snippets b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets index 259c5f4c..e0b4a9a8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/julia.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets @@ -32,3 +32,12 @@ endsnippet snippet fld "type field documentation" b #' @field ${1:name}::${2:Type} ${0:Description} endsnippet + +# Debugging +snippet deb "Debugger breakpoint" b +Main.@bp +endsnippet + +snippet inf "Infiltrator breakpoint" b +Main.@infiltrate +endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index cd1224df..891f905f 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -241,7 +241,7 @@ snippet addsp snippet addarg parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}") snippet addnarg - parser.add_argument("${0:arg}", nargs="${1:*}", default"${2:None}, help="${3:Help text}") + parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}") snippet addaarg parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}") snippet pargs diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 71fe5909..5e9eb2b1 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -101,7 +101,7 @@ snippet crate "Define create meta attributes" // Crate name #![crate_name = "${1:crate_name}"] // Additional metadata attributes - #![desc = "${2:Descrption.}"] + #![desc = "${2:Description.}"] #![license = "${3:BSD}"] #![comment = "${4:Comment.}"] // Specify the output type diff --git a/sources_non_forked/vim-snippets/snippets/vue.snippets b/sources_non_forked/vim-snippets/snippets/vue.snippets index 61c06af6..1385ecb7 100644 --- a/sources_non_forked/vim-snippets/snippets/vue.snippets +++ b/sources_non_forked/vim-snippets/snippets/vue.snippets @@ -118,7 +118,7 @@ snippet vfilter snippet vfor
{{ $1 }} -
snippet vgetters getters: { From e19ae5588af8e2b196c6b0accb7c998f93aa370e Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 4 Jul 2021 22:47:44 +0200 Subject: [PATCH 67/91] Updated plugins --- .../ale/ale_linters/go/staticcheck.vim | 2 +- .../ale/ale_linters/java/checkstyle.vim | 2 + .../ale/ale_linters/php/phpstan.vim | 3 +- .../ale/ale_linters/r/languageserver.vim | 3 +- .../ale/ale_linters/racket/raco.vim | 1 + .../ale/ale_linters/solidity/solc.vim | 42 +++++--- .../ale/ale_linters/spec/rpmlint.vim | 18 +++- sources_non_forked/ale/autoload/ale/c.vim | 3 +- .../ale/autoload/ale/fix/registry.vim | 10 ++ .../ale/autoload/ale/fixers/black.vim | 27 +++--- .../ale/autoload/ale/fixers/pandoc.vim | 16 ++++ .../ale/autoload/ale/fixers/stylua.vim | 14 +++ sources_non_forked/ale/autoload/ale/list.vim | 20 ++-- .../ale/autoload/ale/preview.vim | 15 ++- sources_non_forked/ale/doc/ale-lua.txt | 20 ++++ sources_non_forked/ale/doc/ale-markdown.txt | 19 ++++ sources_non_forked/ale/doc/ale-solidity.txt | 7 +- .../doc/ale-supported-languages-and-tools.txt | 2 + sources_non_forked/ale/doc/ale.txt | 2 + sources_non_forked/ale/supported-tools.md | 2 + .../vim-fugitive/autoload/fugitive.vim | 96 +++++++++++++------ .../vim-fugitive/plugin/fugitive.vim | 36 +------ .../vim-multiple-cursors/Gemfile.lock | 2 +- .../UltiSnips/javascript.snippets | 3 + .../UltiSnips/javascript_react.snippets | 6 ++ .../UltiSnips/typescript.snippets | 15 +++ .../UltiSnips/typescript_react.snippets | 12 +++ .../vim-snippets/snippets/php.snippets | 2 +- 28 files changed, 297 insertions(+), 103 deletions(-) create mode 100644 sources_non_forked/ale/autoload/ale/fixers/pandoc.vim create mode 100644 sources_non_forked/ale/autoload/ale/fixers/stylua.vim create mode 100644 sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index 5dc88f1a..36622440 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -3,7 +3,7 @@ call ale#Set('go_staticcheck_executable', 'staticcheck') call ale#Set('go_staticcheck_options', '') -call ale#Set('go_staticcheck_lint_package', 0) +call ale#Set('go_staticcheck_lint_package', 1) call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#staticcheck#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index f00734e0..1ccbc505 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], @@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[3] is? 'warning' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 78f7dd10..5e231a3b 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:level = ale#Var(a:buffer, 'php_phpstan_level') let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') + let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist') - if empty(l:level) && empty(l:config_file_exists) + if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists) " if no configuration file is found, then use 4 as a default level let l:level = '4' endif diff --git a/sources_non_forked/ale/ale_linters/r/languageserver.vim b/sources_non_forked/ale/ale_linters/r/languageserver.vim index febe66bd..bab869d1 100644 --- a/sources_non_forked/ale/ale_linters/r/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/r/languageserver.vim @@ -1,4 +1,5 @@ " Author: Eric Zhao <21zhaoe@protonmail.com> +" Author: ourigen " Description: Implementation of the Language Server Protocol for R. call ale#Set('r_languageserver_cmd', 'languageserver::run()') @@ -7,7 +8,7 @@ call ale#Set('r_languageserver_config', {}) function! ale_linters#r#languageserver#GetCommand(buffer) abort let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') - return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string) + return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) endfunction function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/racket/raco.vim b/sources_non_forked/ale/ale_linters/racket/raco.vim index e5ee4fb4..5b26065f 100644 --- a/sources_non_forked/ale/ale_linters/racket/raco.vim +++ b/sources_non_forked/ale/ale_linters/racket/raco.vim @@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { + \ 'filename': l:match[2], \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \ 'type': 'E', diff --git a/sources_non_forked/ale/ale_linters/solidity/solc.vim b/sources_non_forked/ale/ale_linters/solidity/solc.vim index e4f220ac..28977083 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solc.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solc.vim @@ -1,34 +1,52 @@ " Author: Karl Bartel - http://karl.berlin/ " Description: Report solc compiler errors in Solidity code +call ale#Set('solidity_solc_executable', 'solc') call ale#Set('solidity_solc_options', '') function! ale_linters#solidity#solc#Handle(buffer, lines) abort " Matches patterns like the following: - " /path/to/file/file.sol:1:10: Error: Identifier not found or not unique. - let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$' + " Error: Expected ';' but got '(' + " --> /path/to/file/file.sol:1:10:) + let l:pattern = '\v(Error|Warning): (.*)$' + let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'type': l:isError ? 'E' : 'W', - \}) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + let l:match = matchlist(l:line, l:line_and_column_pattern) + + if len(l:match) > 0 + let l:index = len(l:output) - 1 + let l:output[l:index]['lnum'] = l:match[1] + 0 + let l:output[l:index]['col'] = l:match[2] + 0 + endif + else + let l:isError = l:match[1] is? 'Error' + + call add(l:output, { + \ 'lnum': 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': l:isError ? 'E' : 'W', + \}) + endif endfor return l:output endfunction function! ale_linters#solidity#solc#GetCommand(buffer) abort - return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' + let l:executable = ale#Var(a:buffer, 'solidity_solc_executable') + + return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' endfunction call ale#linter#Define('solidity', { \ 'name': 'solc', -\ 'executable': 'solc', +\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')}, \ 'command': function('ale_linters#solidity#solc#GetCommand'), \ 'callback': 'ale_linters#solidity#solc#Handle', \ 'output_stream': 'stderr', diff --git a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim index 92ef4d63..5594e3b8 100644 --- a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim +++ b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim @@ -29,11 +29,18 @@ call ale#Set('spec_rpmlint_executable', 'rpmlint') call ale#Set('spec_rpmlint_options', '') -function! ale_linters#spec#rpmlint#GetCommand(buffer) abort +function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort + if ale#semver#GTE(a:version, [2, 0, 0]) + " The -o/--option flag was removed in version 2.0.0 + let l:version_dependent_args = '' + else + let l:version_dependent_args = ' -o "NetworkEnabled False"' + endif + return '%e' \ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options')) - \ . ' -o "NetworkEnabled False"' \ . ' -v' + \ . l:version_dependent_args \ . ' %t' endfunction @@ -73,6 +80,11 @@ endfunction call ale#linter#Define('spec', { \ 'name': 'rpmlint', \ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')}, -\ 'command': function('ale_linters#spec#rpmlint#GetCommand'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'spec_rpmlint_executable'), +\ '%e --version', +\ function('ale_linters#spec#rpmlint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#spec#rpmlint#Handle', \}) diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index ec9d4482..e729aec8 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -151,8 +151,6 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort \ || stridx(l:option, '-isystem') == 0 \ || stridx(l:option, '-idirafter') == 0 \ || stridx(l:option, '-iframework') == 0 - \ || stridx(l:option, '-include') == 0 - \ || stridx(l:option, '-imacros') == 0 if stridx(l:option, '-I') == 0 && l:option isnot# '-I' let l:arg = join(split(l:option, '\zs')[2:], '') let l:option = '-I' @@ -182,6 +180,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort " Options that have an argument (always separate) elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 \ || l:option is# '-isysroot' || l:option is# '-imultilib' + \ || l:option is# '-include' || l:option is# '-imacros' call add(l:items, [0, l:option]) call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 1cd5b6ef..0d110c79 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -316,6 +316,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['reason'], \ 'description': 'Fix ReasonML files with refmt.', \ }, +\ 'pandoc': { +\ 'function': 'ale#fixers#pandoc#Fix', +\ 'suggested_filetypes': ['markdown'], +\ 'description': 'Fix markdown files with pandoc.', +\ }, \ 'shfmt': { \ 'function': 'ale#fixers#shfmt#Fix', \ 'suggested_filetypes': ['sh'], @@ -441,6 +446,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with luafmt.', \ }, +\ 'stylua': { +\ 'function': 'ale#fixers#stylua#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with stylua.', +\ }, \ 'ormolu': { \ 'function': 'ale#fixers#ormolu#Fix', \ 'suggested_filetypes': ['haskell'], diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index 17697652..142cd983 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -18,20 +18,25 @@ endfunction function! ale#fixers#black#Fix(buffer) abort let l:executable = ale#fixers#black#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run black' - \ : '' - let l:options = ale#Var(a:buffer, 'python_black_options') + let l:cmd = [ale#Escape(l:executable)] - if expand('#' . a:buffer . ':e') is? 'pyi' - let l:options .= '--pyi' + if l:executable =~? 'pipenv$' + call extend(l:cmd, ['run', 'black']) endif - let l:result = { - \ 'command': ale#Escape(l:executable) . l:exec_args - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -', - \} + let l:options = ale#Var(a:buffer, 'python_black_options') + + if !empty(l:options) + call add(l:cmd, l:options) + endif + + if expand('#' . a:buffer . ':e') is? 'pyi' + call add(l:cmd, '--pyi') + endif + + call add(l:cmd, '-') + + let l:result = {'command': join(l:cmd, ' ')} if ale#Var(a:buffer, 'python_black_change_directory') let l:result.cwd = '%s:h' diff --git a/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim new file mode 100644 index 00000000..d704c8a2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 +" Author: Jesse Hathaway +" Description: Fix markdown files with pandoc. + +call ale#Set('markdown_pandoc_executable', 'pandoc') +call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -') + +function! ale#fixers#pandoc#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable') + let l:options = ale#Var(a:buffer, 'markdown_pandoc_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylua.vim b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim new file mode 100644 index 00000000..3521c935 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim @@ -0,0 +1,14 @@ +" Author: Robert Liebowitz +" Description: https://github.com/johnnymorganz/stylua + +call ale#Set('lua_stylua_executable', 'stylua') +call ale#Set('lua_stylua_options', '') + +function! ale#fixers#stylua#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_stylua_executable') + let l:options = ale#Var(a:buffer, 'lua_stylua_options') + + return { + \ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index c2ae5cc5..089aa2c0 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -44,6 +44,15 @@ function! s:ShouldOpen(buffer) abort return l:val is 1 || (l:val is# 'on_save' && l:saved) endfunction +function! s:Deduplicate(list) abort + let l:list = a:list + + call sort(l:list, function('ale#util#LocItemCompareWithText')) + call uniq(l:list, function('ale#util#LocItemCompareWithText')) + + return l:list +endfunction + function! ale#list#GetCombinedList() abort let l:list = [] @@ -51,10 +60,7 @@ function! ale#list#GetCombinedList() abort call extend(l:list, l:info.loclist) endfor - call sort(l:list, function('ale#util#LocItemCompareWithText')) - call uniq(l:list, function('ale#util#LocItemCompareWithText')) - - return l:list + return s:Deduplicate(l:list) endfunction function! s:FixList(buffer, list) abort @@ -99,11 +105,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort " but it's better than nothing. let l:ids = s:WinFindBuf(a:buffer) + let l:loclist = s:Deduplicate(a:loclist) + for l:id in l:ids if has('nvim') - call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) + call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title) else - call setloclist(l:id, s:FixList(a:buffer, a:loclist)) + call setloclist(l:id, s:FixList(a:buffer, l:loclist)) call setloclist(l:id, [], 'r', {'title': l:title}) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index 8b94aa7a..1aca03ea 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -1,7 +1,7 @@ " Author: w0rp " Description: Preview windows for showing whatever information in. -if !has_key(s:, 'last__list') +if !has_key(s:, 'last_list') let s:last_list = [] endif @@ -89,6 +89,13 @@ function! ale#preview#ShowSelection(item_list, ...) abort let b:ale_preview_item_list = a:item_list let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') + " Jump to an index for a previous selection, if set. + if has_key(l:options, 'jump_to_index') + let l:pos = getpos('.') + let l:pos[1] = l:options.jump_to_index + 1 + call setpos('.', l:pos) + endif + " Remember preview state, so we can repeat it later. call ale#preview#SetLastSelection(a:item_list, l:options) endfunction @@ -101,12 +108,16 @@ endfunction function! s:Open(open_in) abort let l:item_list = get(b:, 'ale_preview_item_list', []) - let l:item = get(l:item_list, getpos('.')[1] - 1, {}) + let l:index = getpos('.')[1] - 1 + let l:item = get(l:item_list, l:index, {}) if empty(l:item) return endif + " Remember an index to jump to when repeating a selection. + let s:last_options.jump_to_index = l:index + :q! call ale#util#Open( diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index 408f0c3c..db7c0924 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -46,5 +46,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* Default: `''` This variable can be set to pass additional options to the luafmt fixer. + + +=============================================================================== +stylua *ale-lua-stylua* + +g:ale_lua_stylua_executable *g:ale_lua_stylua_executable* + *b:ale_lua_stylua_executable* + Type: |String| + Default: `'stylua'` + + This variable can be set to use a different executable for stylua. + +g:ale_lua_stylua_options *g:ale_lua_stylua_options* + *b:ale_lua_stylua_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the stylua fixer. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt index 99848878..feb37fc9 100644 --- a/sources_non_forked/ale/doc/ale-markdown.txt +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -33,6 +33,25 @@ g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* This variable can be set to pass additional options to mdl. +=============================================================================== +pandoc *ale-markdown-pandoc* + +g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable* + *b:ale_markdown_pandoc_executable* + Type: |String| + Default: `'pandoc'` + + This variable can be set to specify where to find the pandoc executable + + +g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options* + *b:ale_markdown_pandoc_options* + Type: |String| + Default: `'-f gfm -t gfm -s -'` + + This variable can be set to change the default options passed to pandoc + + =============================================================================== prettier *ale-markdown-prettier* diff --git a/sources_non_forked/ale/doc/ale-solidity.txt b/sources_non_forked/ale/doc/ale-solidity.txt index b6e48675..c4d2f02f 100644 --- a/sources_non_forked/ale/doc/ale-solidity.txt +++ b/sources_non_forked/ale/doc/ale-solidity.txt @@ -5,6 +5,12 @@ ALE Solidity Integration *ale-solidity-options* =============================================================================== solc *ale-solidity-solc* +g:ale_solidity_solc_executable *g:ale_solidity_solc_executable* + *b:ale_solidity_solc_executable* + Type: |String| + Default: `'solc'` + + Override the invoked solc binary. For truffle/hardhat binaries. g:ale_solidity_solc_options *g:ale_solidity_solc_options* *b:ale_solidity_solc_options* @@ -33,4 +39,3 @@ solium *ale-solidity-solium* =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: - diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 4a901488..36399178 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -288,6 +288,7 @@ Notes: * `luac` * `luacheck` * `luafmt` + * `stylua` * Mail * `alex`!! * `languagetool`!! @@ -300,6 +301,7 @@ Notes: * `languagetool`!! * `markdownlint`!! * `mdl` + * `pandoc` * `prettier` * `proselint` * `redpen` diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index a126f360..5d2ff444 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -2843,9 +2843,11 @@ documented in additional help files. luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| luafmt................................|ale-lua-luafmt| + stylua................................|ale-lua-stylua| markdown................................|ale-markdown-options| markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| + pandoc................................|ale-markdown-pandoc| prettier..............................|ale-markdown-prettier| remark-lint...........................|ale-markdown-remark-lint| textlint..............................|ale-markdown-textlint| diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index 7848d111..b94a8084 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -297,6 +297,7 @@ formatting. * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) * [luafmt](https://github.com/trixnz/lua-fmt) + * [stylua](https://github.com/johnnymorganz/stylua) * Mail * [alex](https://github.com/wooorm/alex) :floppy_disk: * [languagetool](https://languagetool.org/) :floppy_disk: @@ -309,6 +310,7 @@ formatting. * [languagetool](https://languagetool.org/) :floppy_disk: * [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk: * [mdl](https://github.com/mivok/markdownlint) + * [pandoc](https://pandoc.org) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index cb8a5147..14a95d64 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -553,7 +553,13 @@ endfunction function! s:NullError(...) abort let [out, exec_error] = s:SystemError(call('fugitive#Prepare', a:000)) - return [exec_error ? [] : split(out, "\1"), exec_error ? substitute(out, "\n$", "", "") : '', exec_error] + if exec_error + return [[], substitute(out, "\n$", "", "") : '', exec_error] + else + let list = split(out, "\1", 1) + call remove(list, -1) + return [list, '', exec_error] + endif endfunction function! s:TreeChomp(...) abort @@ -621,21 +627,23 @@ endfunction let s:config = {} function! fugitive#Config(...) abort - let dir = s:Dir() let name = '' let default = get(a:, 3, '') - if a:0 >= 2 && type(a:2) == type({}) + if a:0 >= 2 && type(a:2) == type({}) && !has_key(a:2, 'git_dir') let name = substitute(a:1, '^[^.]\+\|[^.]\+$', '\L&', 'g') return len(a:1) ? get(get(a:2, name, []), 0, default) : a:2 elseif a:0 >= 2 - let dir = a:2 + let dir = s:Dir(a:2) let name = a:1 - elseif a:0 == 1 && type(a:1) == type({}) + elseif a:0 == 1 && type(a:1) == type({}) && !has_key(a:1, 'git_dir') return a:1 - elseif a:0 == 1 && a:1 =~# '^[[:alnum:]-]\+\.' + elseif a:0 == 1 && type(a:1) == type('') && a:1 =~# '^[[:alnum:]-]\+\.' + let dir = s:Dir() let name = a:1 elseif a:0 == 1 - let dir = a:1 + let dir = s:Dir(a:1) + else + let dir = s:Dir() endif let name = substitute(name, '^[^.]\+\|[^.]\+$', '\L&', 'g') let dir_key = len(dir) ? dir : '_' @@ -664,6 +672,28 @@ function! fugitive#Config(...) abort return len(name) ? get(get(dict, name, []), 0, default) : dict endfunction +function! fugitive#ConfigGetAll(name, ...) abort + let config = fugitive#Config(a:0 ? a:1 : s:Dir()) + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + +function! fugitive#ConfigGetRegexp(pattern, ...) abort + let config = fugitive#Config(a:0 ? a:1 : s:Dir()) + let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)') + if a:pattern !~# '\\\@ '.tmp let sha1 = readfile(tmp)[0] let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+') @@ -2245,6 +2279,9 @@ function! fugitive#FileWriteCmd(...) abort return 'echoerr '.string('fugitive: '.error) endif finally + if exists('guioptions') + let &guioptions = guioptions + endif call delete(tmp) endtry endfunction @@ -2473,7 +2510,7 @@ augroup END function! s:AskPassArgs(dir) abort if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) && - \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir)) + \ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(fugitive#ConfigGetAll('core.askpass', a:dir)) if s:executable(s:ExecPath() . '/git-gui--askpass') return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass'] elseif s:executable('ssh-askpass') @@ -2800,7 +2837,7 @@ function! fugitive#PagerFor(argv, ...) abort return 0 endif let config = a:0 ? a:1 : fugitive#Config() - let value = get(FugitiveConfigGetAll('pager.' . args[0], config), 0, -1) + let value = get(fugitive#ConfigGetAll('pager.' . args[0], config), 0, -1) if value =~# '^\%(true\|yes\|on\|1\)$' return 1 elseif value =~# '^\%(false\|no|off\|0\|\)$' @@ -3075,7 +3112,7 @@ function! s:CompletableSubcommands(dir) abort endif call extend(commands, s:path_subcommands[cpath]) endfor - call extend(commands, keys(FugitiveConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir))) + call extend(commands, keys(fugitive#ConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir))) let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+') let rejected = {} for command in configured @@ -3213,7 +3250,7 @@ function! s:StageSeek(info, fallback) abort if empty(info.heading) return a:fallback endif - let line = search('^' . escape(substitute(info.heading, '(\d\+)$', '', ''), '^$.*[]~\'), 'wn') + let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\+)$', 'wn') if !line for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, []) let line = search('^' . section, 'wn') @@ -3433,18 +3470,18 @@ function! s:StageInfo(...) abort endwhile endif let slnum = lnum + 1 - let section = '' + let heading = '' let index = 0 - while len(getline(slnum - 1)) && empty(section) + while len(getline(slnum - 1)) && empty(heading) let slnum -= 1 - let section = matchstr(getline(slnum), '^\u\l\+\ze.* (\d\+)$') - if empty(section) && getline(slnum) !~# '^[ @\+-]' + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') + if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif endwhile let text = matchstr(getline(lnum), '^[A-Z?] \zs.*') - return {'section': section, - \ 'heading': getline(slnum), + return {'section': matchstr(heading, '^\u\l\+'), + \ 'heading': heading, \ 'sigil': sigil, \ 'offset': offset, \ 'filename': text, @@ -3452,7 +3489,7 @@ function! s:StageInfo(...) abort \ 'paths': map(reverse(split(text, ' -> ')), 's:Tree() . "/" . v:val'), \ 'commit': matchstr(getline(lnum), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze '), \ 'status': matchstr(getline(lnum), '^[A-Z?]\ze \|^\%(\x\x\x\)\@!\l\+\ze [0-9a-f]'), - \ 'submodule': get(get(get(b:fugitive_files, section, {}), text, {}), 'submodule', ''), + \ 'submodule': get(get(get(b:fugitive_files, heading, {}), text, {}), 'submodule', ''), \ 'index': index} endfunction @@ -3486,11 +3523,11 @@ function! s:Selection(arg1, ...) abort let flnum -= 1 endwhile let slnum = flnum + 1 - let section = '' + let heading = '' let index = 0 - while len(getline(slnum - 1)) && empty(section) + while empty(heading) let slnum -= 1 - let heading = matchstr(getline(slnum), '^\u\l\+.* (\d\+)$') + let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$') if empty(heading) && getline(slnum) !~# '^[ @\+-]' let index += 1 endif @@ -3498,7 +3535,7 @@ function! s:Selection(arg1, ...) abort let results = [] let template = { \ 'heading': heading, - \ 'section': matchstr(heading, '^\u\l\+\ze.* (\d\+)$'), + \ 'section': matchstr(heading, '^\u\l\+'), \ 'filename': '', \ 'relative': [], \ 'paths': [], @@ -3510,9 +3547,10 @@ function! s:Selection(arg1, ...) abort let lnum = first - (arg1 == flnum ? 0 : 1) let root = s:Tree() . '/' while lnum <= last - if line =~# '^\u\l\+\ze.* (\d\+)$' - let template.heading = getline(lnum) - let template.section = matchstr(template.heading, '^\u\l\+\ze.* (\d\+)$') + let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\+)$') + if len(heading) + let template.heading = heading + let template.section = matchstr(heading, '^\u\l\+') let template.index = 0 elseif line =~# '^[ @\+-]' let template.index -= 1 @@ -5895,9 +5933,6 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort setlocal signcolumn=no endif execute "vertical resize ".(s:linechars('.\{-\}\s\+\d\+\ze)')+1) - call s:Map('n', 'A', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)", '') - call s:Map('n', 'C', ":exe 'vertical resize '.(linechars('^\\S\\+')+1+v:count)", '') - call s:Map('n', 'D', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)", '') redraw syncbind exe s:DoAutocmdChanged(temp_state) @@ -6128,6 +6163,9 @@ function! fugitive#BlameFileType() abort call s:Map('n', 'O', ':exe BlameCommit("tabedit")', '') call s:Map('n', 'p', ':exe BlameCommit("pedit")', '') call s:Map('n', '.', ": =substitute(BlameCommitFileLnum()[0],'^$','@','')") + call s:Map('n', 'A', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)", '') + call s:Map('n', 'C', ":exe 'vertical resize '.(linechars('^\\S\\+')+1+v:count)", '') + call s:Map('n', 'D', ":exe 'vertical resize '.(linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)", '') endfunction augroup fugitive_blame diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 19f5ba2b..0df5068b 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -128,32 +128,20 @@ endfunction " structure of the return value as it is not guaranteed. If you want a full " dictionary of every config value, use FugitiveConfigGetRegexp('.*'). function! FugitiveConfig(...) abort - if a:0 >= 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir')) - return call('fugitive#Config', [a:1, FugitiveGitDir(a:2)] + a:000[2:-1]) - elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.') - return fugitive#Config(FugitiveGitDir(a:1)) - else - return call('fugitive#Config', a:000) - endif + return call('fugitive#Config', a:000) endfunction " FugitiveConfigGet() retrieves a Git configuration value. An optional second " argument provides the Git dir as with FugitiveFind(). Pass a blank string " to limit to the global config. function! FugitiveConfigGet(name, ...) abort - return call('FugitiveConfig', [a:name] + a:000) + return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, '')) endfunction " FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of " all values. function! FugitiveConfigGetAll(name, ...) abort - if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir') - let config = a:1 - else - let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) - endif - let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') - return copy(get(config, name, [])) + return call('fugitive#ConfigGetAll', [a:name] + a:000) endfunction " FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values @@ -161,23 +149,7 @@ endfunction " using a Vim regexp. Second argument has same semantics as " FugitiveConfigGet(). function! FugitiveConfigGetRegexp(pattern, ...) abort - if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir') - let config = a:1 - else - let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) - endif - let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)') - if a:pattern !~# '\\\@ 3.4.0) rspec-expectations (~> 3.4.0) diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index bae39ae8..292a8ce9 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -154,4 +154,7 @@ snippet us 'use strict'`!p snip.rv = semi(snip)` endsnippet +snippet imp "import" +import ${2} from ${1} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets index ee70ff0f..fd443156 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_react.snippets @@ -48,3 +48,9 @@ endsnippet snippet useR "useRef(defaultValue)" b const ${1:ref} = useRef(${2:null}) endsnippet +snippet ir "import React" +import React from "react" +endsnippet +snippet irc "import React and Component" +import React, { Component } from "react" +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets b/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets index 11072ddd..aa4efb62 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/typescript.snippets @@ -1,3 +1,18 @@ priority -50 extends javascript + +snippet int "interface" +interface ${1} { +} +endsnippet +snippet nspc "namespace" +namespace ${1} { +} +endsnippet +priority -49 +snippet fun "function (named)" b +function ${1:function_name} (${2:argument}: ${3:argument_type}) { + ${VISUAL}$0 +} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets b/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets new file mode 100644 index 00000000..566a20b0 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/typescript_react.snippets @@ -0,0 +1,12 @@ +priority -50 +extends javascript_react +extends typescript + +priority -49 +snippet rfc "react functional component" +import React, { FC } from "react" + +interface ${1:function_name}Props {${4:props_types}} + +export const ${1:function_name}: FC<${1:function_name}Props> = (${2:props}) => ${3:function_body} +endsnippet diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 2828f2fb..c769baab 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -38,7 +38,7 @@ snippet i ${0:${VISUAL}} } snippet t. - $this-> + \$this-> snippet f function ${1}(${3}) { From 4a9f44d3dd9bcd5774fd232179616d67bac18c83 Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 4 Jul 2021 22:51:43 +0200 Subject: [PATCH 68/91] Added editorconfig-vim --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 95a7a35d..7f4ca0d5 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack): Maintains a history of previous yanks, changes and deletes * [vim-zenroom2](https://github.com/amix/vim-zenroom2) Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room * [gist-vim](https://github.com/mattn/gist-vim) Easily create gists from Vim using the `:Gist` command +* [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim) EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. ## Included color schemes From 6deb1580697efcfda69210019e1179ec7110001a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Jul 2021 22:52:30 +0200 Subject: [PATCH 69/91] Bump rake in /sources_non_forked/vim-multiple-cursors (#643) --- sources_non_forked/vim-multiple-cursors/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources_non_forked/vim-multiple-cursors/Gemfile.lock b/sources_non_forked/vim-multiple-cursors/Gemfile.lock index e833b243..5e909c4a 100644 --- a/sources_non_forked/vim-multiple-cursors/Gemfile.lock +++ b/sources_non_forked/vim-multiple-cursors/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) - rake (10.4.2) + rake (12.3.3) rspec (3.4.0) rspec-core (~> 3.4.0) rspec-expectations (~> 3.4.0) From d5b84d7ea4e4fd2676810adc6619050f1549d1eb Mon Sep 17 00:00:00 2001 From: Vitaly Sharov <55061979+xblurx@users.noreply.github.com> Date: Sun, 4 Jul 2021 23:53:29 +0300 Subject: [PATCH 70/91] add native plugin install to README (#632) --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7f4ca0d5..29cd825e 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,13 @@ You can also install your plugins, for instance, via pathogen you can install [v cd ~/.vim_runtime git clone git://github.com/tpope/vim-rails.git my_plugins/vim-rails +You can also install plugins without any plugin manager (vim 8+ required): + Add `packloadall` to your .vimrc file + Create pack plugin directory: + `mkdir -p ~/.vim/pack/plugins/start` + Clone the plugin that you want in that directory, for example: + `git clone --depth=1 git://github.com/maxmellon/vim-jsx-pretty ~/.vim/pack/plugins/vim-jsx-pretty` + ## Key Mappings From 326327277c26c4039c30cb40004114a9bd2db94d Mon Sep 17 00:00:00 2001 From: Paul Mulders Date: Sun, 4 Jul 2021 22:55:57 +0200 Subject: [PATCH 71/91] update README to be more accurate (#623) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29cd825e..b6a8a39f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Naturally, `/opt/vim_runtime` can be any directory, as long as all the users spe ## Fonts -I recommend using [IBM Plex Mono font](https://github.com/IBM/plex) (it's an open-source and awesome font that can make your code beautiful). The Awesome vimrc is already setup to try to use it. +I recommend using [IBM Plex Mono font](https://github.com/IBM/plex) (it's an open-source and awesome font that can make your code look beautiful). The Awesome vimrc is already setup to try to use it. Some other fonts that Awesome will try to use: From 1717536b95e9f5a8d4816a2bbdec6cef9a550f5f Mon Sep 17 00:00:00 2001 From: Fazle Arefin Date: Mon, 5 Jul 2021 06:57:32 +1000 Subject: [PATCH 72/91] Update instructions on updating vimrc (#614) --- README.md | 4 +++- install_awesome_parameterized.sh | 7 +++++-- install_awesome_vimrc.sh | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b6a8a39f..13ac0321 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,10 @@ If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: Just do a git rebase! cd ~/.vim_runtime + git reset --hard + git clean -d --force git pull --rebase - python update_plugins.py + python update_plugins.py # use python3 if python is unavailable ## Some screenshots diff --git a/install_awesome_parameterized.sh b/install_awesome_parameterized.sh index ee4be411..1ca2ba5f 100755 --- a/install_awesome_parameterized.sh +++ b/install_awesome_parameterized.sh @@ -4,7 +4,10 @@ set -e echo 'Installing Awesome Vim from '$1 cd $1 -VIMRC="set runtimepath+=$1 +VIMRC="\" DO NOT EDIT THIS FILE +\" Add your own customizations in $1/my_configs.vim + +set runtimepath+=$1 source $1/vimrcs/basic.vim source $1/vimrcs/filetypes.vim @@ -12,7 +15,7 @@ source $1/vimrcs/plugins_config.vim source $1/vimrcs/extended.vim try -source $1/my_configs.vim + source $1/my_configs.vim catch endtry" diff --git a/install_awesome_vimrc.sh b/install_awesome_vimrc.sh index 6b94e519..7f722d4f 100755 --- a/install_awesome_vimrc.sh +++ b/install_awesome_vimrc.sh @@ -3,7 +3,10 @@ set -e cd ~/.vim_runtime -echo 'set runtimepath+=~/.vim_runtime +echo '" DO NOT EDIT THIS FILE +" Add your own customizations in ~/.vim_runtime/my_configs.vim + +set runtimepath+=~/.vim_runtime source ~/.vim_runtime/vimrcs/basic.vim source ~/.vim_runtime/vimrcs/filetypes.vim @@ -11,7 +14,7 @@ source ~/.vim_runtime/vimrcs/plugins_config.vim source ~/.vim_runtime/vimrcs/extended.vim try -source ~/.vim_runtime/my_configs.vim + source ~/.vim_runtime/my_configs.vim catch endtry' > ~/.vimrc From ff31be3f45ad435bf2faf7020b1daa6cd501b8a2 Mon Sep 17 00:00:00 2001 From: Shamanaitor <73449449+shamanaitor@users.noreply.github.com> Date: Sun, 4 Jul 2021 18:01:36 -0300 Subject: [PATCH 73/91] Feature/vim indent guides (#608) --- README.md | 9 + .../vim-indent-guides/.gitignore | 1 + .../vim-indent-guides/README.markdown | 111 +++ .../autoload/color_helper.vim | 879 ++++++++++++++++++ .../autoload/indent_guides.vim | 286 ++++++ .../vim-indent-guides/doc/indent_guides.txt | 351 +++++++ .../plugin/indent_guides.vim | 92 ++ .../test-files/test-ts2sw0et.txt | 47 + .../test-files/test-ts2sw2et.txt | 47 + .../test-files/test-ts2sw2noet.txt | 47 + .../test-files/test-ts2sw4noet.txt | 24 + .../test-files/test-ts4sw4et.txt | 47 + .../test-files/test-ts4sw4noet.txt | 47 + .../test-files/test-ts8sw2noet.txt | 24 + .../test-files/test-ts8sw8et.txt | 47 + .../test-files/test-ts8sw8noet.txt | 47 + update_plugins.py | 1 + 17 files changed, 2107 insertions(+) create mode 100644 sources_non_forked/vim-indent-guides/.gitignore create mode 100644 sources_non_forked/vim-indent-guides/README.markdown create mode 100644 sources_non_forked/vim-indent-guides/autoload/color_helper.vim create mode 100644 sources_non_forked/vim-indent-guides/autoload/indent_guides.vim create mode 100644 sources_non_forked/vim-indent-guides/doc/indent_guides.txt create mode 100644 sources_non_forked/vim-indent-guides/plugin/indent_guides.vim create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts2sw0et.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts2sw2et.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts2sw2noet.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts2sw4noet.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts4sw4et.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts4sw4noet.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts8sw2noet.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts8sw8et.txt create mode 100644 sources_non_forked/vim-indent-guides/test-files/test-ts8sw8noet.txt diff --git a/README.md b/README.md index 13ac0321..da2cedba 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack): Maintains a history of previous yanks, changes and deletes * [vim-zenroom2](https://github.com/amix/vim-zenroom2) Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room * [gist-vim](https://github.com/mattn/gist-vim) Easily create gists from Vim using the `:Gist` command +* [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides) Is a plugin for visually displaying indent levels in Vim * [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim) EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. @@ -340,6 +341,13 @@ Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a fil nmap a (ale_next_wrap) +[vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides) the default mapping to toggle the plugin is (`ig`) + + You can also use the following commands inside Vim: + :IndentGuidesEnable + :IndentGuidesDisable + :IndentGuidesToggle + ### Spell checking Pressing `ss` will toggle spell checking: @@ -385,3 +393,4 @@ Just do following: Maintaining this Vim configuration isn't my day job. Daily I am the founder/CEO of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world 🌍🌎🌏). PS: Using Vim isn't a requirement 😄 + diff --git a/sources_non_forked/vim-indent-guides/.gitignore b/sources_non_forked/vim-indent-guides/.gitignore new file mode 100644 index 00000000..926ccaaf --- /dev/null +++ b/sources_non_forked/vim-indent-guides/.gitignore @@ -0,0 +1 @@ +doc/tags diff --git a/sources_non_forked/vim-indent-guides/README.markdown b/sources_non_forked/vim-indent-guides/README.markdown new file mode 100644 index 00000000..366d41c9 --- /dev/null +++ b/sources_non_forked/vim-indent-guides/README.markdown @@ -0,0 +1,111 @@ +# Indent Guides +Indent Guides is a plugin for visually displaying indent levels in Vim. + + + +## Features: +* Can detect both tab and space indent styles. +* Automatically inspects your colorscheme and picks appropriate colors (gVim only). +* Will highlight indent levels with alternating colors. +* Full support for gVim and basic support for Terminal Vim. +* Seems to work on Windows gVim 7.3 (haven't done any extensive tests though). +* Customizable size for indent guides, eg. skinny guides (soft-tabs only). +* Customizable start indent level. +* Highlight support for files with a mixture of tab and space indent styles. + +## Requirements +* Vim 7.2+ + +## Installation +To install the plugin copy `autoload`, `plugin`, `doc` directories into your `.vim` directory. + +### Pathogen +If you have [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) installed, clone this repo into a subdirectory of your `.vim/bundle` directory like so: + +```bash +cd ~/.vim/bundle +git clone git://github.com/nathanaelkane/vim-indent-guides.git +``` + +### Vundle +If you have [Vundle](https://github.com/VundleVim/Vundle.vim) installed, add the following line to your `~/.vimrc` in the appropriate spot (see the Vundle.vim README for help): + +```vim +Plugin 'nathanaelkane/vim-indent-guides' +``` + +and then run the following command from inside Vim: + +```vim +:PluginInstall +``` + +## Usage +The default mapping to toggle the plugin is `ig`. + +You can also use the following commands inside Vim: + +```vim +:IndentGuidesEnable +:IndentGuidesDisable +:IndentGuidesToggle +``` + +If you would like to have indent guides enabled by default, you can add the following to your `~/.vimrc`: + +```vim +let g:indent_guides_enable_on_vim_startup = 1 +``` + +### gVim +**This plugin should work with gVim out of the box, no configuration needed.** It will automatically inspect your colorscheme and pick appropriate colors. + +### Setting custom indent colors +Here's an example of how to define custom colors instead of using the ones the plugin automatically generates for you. Add this to your `.vimrc` file: + +```vim +let g:indent_guides_auto_colors = 0 +autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3 +autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4 +``` + +Alternatively you can add the following lines to your colorscheme file. + +```vim +hi IndentGuidesOdd guibg=red ctermbg=3 +hi IndentGuidesEven guibg=green ctermbg=4 +``` + +### Terminal Vim +At the moment Terminal Vim only has basic support. This means is that colors won't be automatically calculated based on your colorscheme. Instead, some preset colors are used depending on whether `background` is set to `dark` or `light`. + +When `set background=dark` is used, the following highlight colors will be defined: + +```vim +hi IndentGuidesOdd ctermbg=black +hi IndentGuidesEven ctermbg=darkgrey +``` + +Alternatively, when `set background=light` is used, the following highlight colors will be defined: + +```vim +hi IndentGuidesOdd ctermbg=white +hi IndentGuidesEven ctermbg=lightgrey +``` + +If for some reason it's incorrectly defining light highlight colors instead of dark ones or vice versa, the first thing you should check is that the `background` value is being set correctly for your colorscheme. Sometimes it's best to manually set the `background` value in your `.vimrc`, for example: + +```vim +colorscheme desert256 +set background=dark +``` + +Alternatively you can manually setup the highlight colors yourself, see `:help indent_guides_auto_colors` for an example. + +## Help +`:help indent-guides` + +## Screenshots + + + diff --git a/sources_non_forked/vim-indent-guides/autoload/color_helper.vim b/sources_non_forked/vim-indent-guides/autoload/color_helper.vim new file mode 100644 index 00000000..54d18c00 --- /dev/null +++ b/sources_non_forked/vim-indent-guides/autoload/color_helper.vim @@ -0,0 +1,879 @@ +" Author: Nate Kane +" Homepage: http://github.com/nathanaelkane/vim-indent-guides + +" +" Return hex string equivalent to given decimal string or number. +" +" Example: color_helper#dec_to_hex(255, 2) +" Returns: 'FF' +" +" Example: color_helper#dec_to_hex(255, 5) +" Returns: '000FF' +" +function! color_helper#dec_to_hex(arg, padding) + return toupper(printf('%0' . a:padding . 'x', a:arg + 0)) +endfunction + +" +" Return number equivalent to given hex string ('0x' is optional). +" +" Example: color_helper#hex_to_dec('FF') +" Returns: 255 +" +" Example: color_helper#hex_to_dec('88') +" Returns: 136 +" +" Example: color_helper#hex_to_dec('00') +" Returns: 0 +" +function! color_helper#hex_to_dec(arg) + return (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0 +endfunction + +" +" Converts a given hex color string into an rgb list (eg. [red, green, blue]). +" +" Example: color_helper#hex_color_to_rgb('#0088FF') +" Returns: [0, 136, 255] +" +function! color_helper#hex_color_to_rgb(hex_color) + let l:rgb = [] + + if a:hex_color =~ g:indent_guides_color_hex_pattern + let l:red = color_helper#hex_to_dec(strpart(a:hex_color, 1, 2)) + let l:green = color_helper#hex_to_dec(strpart(a:hex_color, 3, 2)) + let l:blue = color_helper#hex_to_dec(strpart(a:hex_color, 5, 2)) + let l:rgb = [l:red, l:green, l:blue] + end + + return l:rgb +endfunction + +" +" Converts a given rgb list (eg. [red, green, blue]) into a hex color string. +" +" Example: color_helper#rgb_color_to_hex([0, 136, 255]) +" Returns: '#0088FF' +" +function! color_helper#rgb_color_to_hex(rgb_color) + let l:hex_color = '#' + let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[0], 2) " red + let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[1], 2) " green + let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[2], 2) " blue + + return l:hex_color +endfunction + +" +" Returns a ligtened color using the given color and the percent to lighten it +" by. +" +" Example: color_helper#hex_color_lighten('#000000', 0.10) +" Returns: '#191919' +" +function! color_helper#hex_color_lighten(color, percent) + let l:rgb = color_helper#hex_color_to_rgb(a:color) + let l:rgb_lightened = [] + + for i in l:rgb + call add(l:rgb_lightened, float2nr(i + ((255 - i) * a:percent))) + endfor + + return color_helper#rgb_color_to_hex(l:rgb_lightened) +endfunction + +" +" Returns a darkened color using the given color and the percent to darken it +" by. +" +" Example: color_helper#hex_color_darken('#FFFFFF', 0.10) +" Returns: '#E5E5E5' +" +function! color_helper#hex_color_darken(color, percent) + let l:rgb = color_helper#hex_color_to_rgb(a:color) + let l:rgb_darkened = [] + + for i in l:rgb + call add(l:rgb_darkened, float2nr(i * (1 - a:percent))) + endfor + + return color_helper#rgb_color_to_hex(l:rgb_darkened) +endfunction + +" +" Returns a hex color code for the given color name. +" +" Example: color_helper#color_name_to_hex('darkslategray') +" Returns: '#2F4F4F' +" +function! color_helper#color_name_to_hex(color_name) + let l:hex_code = '' + let l:color_name = tolower(a:color_name) + + let l:color_list = { + \ 'alice blue' : '#F0F8FF', + \ 'aliceblue' : '#F0F8FF', + \ 'antique white' : '#FAEBD7', + \ 'antiquewhite' : '#FAEBD7', + \ 'antiquewhite1' : '#FFEFDB', + \ 'antiquewhite2' : '#EEDFCC', + \ 'antiquewhite3' : '#CDC0B0', + \ 'antiquewhite4' : '#8B8378', + \ 'aquamarine' : '#7FFFD4', + \ 'aquamarine1' : '#7FFFD4', + \ 'aquamarine2' : '#76EEC6', + \ 'aquamarine3' : '#66CDAA', + \ 'aquamarine4' : '#458B74', + \ 'azure' : '#F0FFFF', + \ 'azure1' : '#F0FFFF', + \ 'azure2' : '#E0EEEE', + \ 'azure3' : '#C1CDCD', + \ 'azure4' : '#838B8B', + \ 'beige' : '#F5F5DC', + \ 'bisque' : '#FFE4C4', + \ 'bisque1' : '#FFE4C4', + \ 'bisque2' : '#EED5B7', + \ 'bisque3' : '#CDB79E', + \ 'bisque4' : '#8B7D6B', + \ 'black' : '#000000', + \ 'blanched almond' : '#FFEBCD', + \ 'blanchedalmond' : '#FFEBCD', + \ 'blue violet' : '#8A2BE2', + \ 'blue' : '#0000FF', + \ 'blue1' : '#0000FF', + \ 'blue2' : '#0000EE', + \ 'blue3' : '#0000CD', + \ 'blue4' : '#00008B', + \ 'blueviolet' : '#8A2BE2', + \ 'brown' : '#A52A2A', + \ 'brown1' : '#FF4040', + \ 'brown2' : '#EE3B3B', + \ 'brown3' : '#CD3333', + \ 'brown4' : '#8B2323', + \ 'burlywood' : '#DEB887', + \ 'burlywood1' : '#FFD39B', + \ 'burlywood2' : '#EEC591', + \ 'burlywood3' : '#CDAA7D', + \ 'burlywood4' : '#8B7355', + \ 'cadet blue' : '#5F9EA0', + \ 'cadetblue' : '#5F9EA0', + \ 'cadetblue1' : '#98F5FF', + \ 'cadetblue2' : '#8EE5EE', + \ 'cadetblue3' : '#7AC5CD', + \ 'cadetblue4' : '#53868B', + \ 'chartreuse' : '#7FFF00', + \ 'chartreuse1' : '#7FFF00', + \ 'chartreuse2' : '#76EE00', + \ 'chartreuse3' : '#66CD00', + \ 'chartreuse4' : '#458B00', + \ 'chocolate' : '#D2691E', + \ 'chocolate1' : '#FF7F24', + \ 'chocolate2' : '#EE7621', + \ 'chocolate3' : '#CD661D', + \ 'chocolate4' : '#8B4513', + \ 'coral' : '#FF7F50', + \ 'coral1' : '#FF7256', + \ 'coral2' : '#EE6A50', + \ 'coral3' : '#CD5B45', + \ 'coral4' : '#8B3E2F', + \ 'cornflower blue' : '#6495ED', + \ 'cornflowerblue' : '#6495ED', + \ 'cornsilk' : '#FFF8DC', + \ 'cornsilk1' : '#FFF8DC', + \ 'cornsilk2' : '#EEE8CD', + \ 'cornsilk3' : '#CDC8B1', + \ 'cornsilk4' : '#8B8878', + \ 'cyan' : '#00FFFF', + \ 'cyan1' : '#00FFFF', + \ 'cyan2' : '#00EEEE', + \ 'cyan3' : '#00CDCD', + \ 'cyan4' : '#008B8B', + \ 'dark blue' : '#00008B', + \ 'dark cyan' : '#008B8B', + \ 'dark goldenrod' : '#B8860B', + \ 'dark gray' : '#A9A9A9', + \ 'dark green' : '#006400', + \ 'dark grey' : '#A9A9A9', + \ 'dark khaki' : '#BDB76B', + \ 'dark magenta' : '#8B008B', + \ 'dark olive green' : '#556B2F', + \ 'dark orange' : '#FF8C00', + \ 'dark orchid' : '#9932CC', + \ 'dark red' : '#8B0000', + \ 'dark salmon' : '#E9967A', + \ 'dark sea green' : '#8FBC8F', + \ 'dark slate blue' : '#483D8B', + \ 'dark slate gray' : '#2F4F4F', + \ 'dark slate grey' : '#2F4F4F', + \ 'dark turquoise' : '#00CED1', + \ 'dark violet' : '#9400D3', + \ 'dark yellow' : '#BBBB00', + \ 'darkblue' : '#00008B', + \ 'darkcyan' : '#008B8B', + \ 'darkgoldenrod' : '#B8860B', + \ 'darkgoldenrod1' : '#FFB90F', + \ 'darkgoldenrod2' : '#EEAD0E', + \ 'darkgoldenrod3' : '#CD950C', + \ 'darkgoldenrod4' : '#8B6508', + \ 'darkgray' : '#A9A9A9', + \ 'darkgreen' : '#006400', + \ 'darkgrey' : '#A9A9A9', + \ 'darkkhaki' : '#BDB76B', + \ 'darkmagenta' : '#8B008B', + \ 'darkolivegreen' : '#556B2F', + \ 'darkolivegreen1' : '#CAFF70', + \ 'darkolivegreen2' : '#BCEE68', + \ 'darkolivegreen3' : '#A2CD5A', + \ 'darkolivegreen4' : '#6E8B3D', + \ 'darkorange' : '#FF8C00', + \ 'darkorange1' : '#FF7F00', + \ 'darkorange2' : '#EE7600', + \ 'darkorange3' : '#CD6600', + \ 'darkorange4' : '#8B4500', + \ 'darkorchid' : '#9932CC', + \ 'darkorchid1' : '#BF3EFF', + \ 'darkorchid2' : '#B23AEE', + \ 'darkorchid3' : '#9A32CD', + \ 'darkorchid4' : '#68228B', + \ 'darkred' : '#8B0000', + \ 'darksalmon' : '#E9967A', + \ 'darkseagreen' : '#8FBC8F', + \ 'darkseagreen1' : '#C1FFC1', + \ 'darkseagreen2' : '#B4EEB4', + \ 'darkseagreen3' : '#9BCD9B', + \ 'darkseagreen4' : '#698B69', + \ 'darkslateblue' : '#483D8B', + \ 'darkslategray' : '#2F4F4F', + \ 'darkslategray1' : '#97FFFF', + \ 'darkslategray2' : '#8DEEEE', + \ 'darkslategray3' : '#79CDCD', + \ 'darkslategray4' : '#528B8B', + \ 'darkslategrey' : '#2F4F4F', + \ 'darkturquoise' : '#00CED1', + \ 'darkviolet' : '#9400D3', + \ 'darkyellow' : '#BBBB00', + \ 'deep pink' : '#FF1493', + \ 'deep sky blue' : '#00BFFF', + \ 'deeppink' : '#FF1493', + \ 'deeppink1' : '#FF1493', + \ 'deeppink2' : '#EE1289', + \ 'deeppink3' : '#CD1076', + \ 'deeppink4' : '#8B0A50', + \ 'deepskyblue' : '#00BFFF', + \ 'deepskyblue1' : '#00BFFF', + \ 'deepskyblue2' : '#00B2EE', + \ 'deepskyblue3' : '#009ACD', + \ 'deepskyblue4' : '#00688B', + \ 'dim gray' : '#696969', + \ 'dim grey' : '#696969', + \ 'dimgray' : '#696969', + \ 'dimgrey' : '#696969', + \ 'dodger blue' : '#1E90FF', + \ 'dodgerblue' : '#1E90FF', + \ 'dodgerblue1' : '#1E90FF', + \ 'dodgerblue2' : '#1C86EE', + \ 'dodgerblue3' : '#1874CD', + \ 'dodgerblue4' : '#104E8B', + \ 'firebrick' : '#B22222', + \ 'firebrick1' : '#FF3030', + \ 'firebrick2' : '#EE2C2C', + \ 'firebrick3' : '#CD2626', + \ 'firebrick4' : '#8B1A1A', + \ 'floral white' : '#FFFAF0', + \ 'floralwhite' : '#FFFAF0', + \ 'forest green' : '#228B22', + \ 'forestgreen' : '#228B22', + \ 'gainsboro' : '#DCDCDC', + \ 'ghost white' : '#F8F8FF', + \ 'ghostwhite' : '#F8F8FF', + \ 'gold' : '#FFD700', + \ 'gold1' : '#FFD700', + \ 'gold2' : '#EEC900', + \ 'gold3' : '#CDAD00', + \ 'gold4' : '#8B7500', + \ 'goldenrod' : '#DAA520', + \ 'goldenrod1' : '#FFC125', + \ 'goldenrod2' : '#EEB422', + \ 'goldenrod3' : '#CD9B1D', + \ 'goldenrod4' : '#8B6914', + \ 'gray' : '#BEBEBE', + \ 'gray0' : '#000000', + \ 'gray1' : '#030303', + \ 'gray10' : '#1A1A1A', + \ 'gray100' : '#FFFFFF', + \ 'gray11' : '#1C1C1C', + \ 'gray12' : '#1F1F1F', + \ 'gray13' : '#212121', + \ 'gray14' : '#242424', + \ 'gray15' : '#262626', + \ 'gray16' : '#292929', + \ 'gray17' : '#2B2B2B', + \ 'gray18' : '#2E2E2E', + \ 'gray19' : '#303030', + \ 'gray2' : '#050505', + \ 'gray20' : '#333333', + \ 'gray21' : '#363636', + \ 'gray22' : '#383838', + \ 'gray23' : '#3B3B3B', + \ 'gray24' : '#3D3D3D', + \ 'gray25' : '#404040', + \ 'gray26' : '#424242', + \ 'gray27' : '#454545', + \ 'gray28' : '#474747', + \ 'gray29' : '#4A4A4A', + \ 'gray3' : '#080808', + \ 'gray30' : '#4D4D4D', + \ 'gray31' : '#4F4F4F', + \ 'gray32' : '#525252', + \ 'gray33' : '#545454', + \ 'gray34' : '#575757', + \ 'gray35' : '#595959', + \ 'gray36' : '#5C5C5C', + \ 'gray37' : '#5E5E5E', + \ 'gray38' : '#616161', + \ 'gray39' : '#636363', + \ 'gray4' : '#0A0A0A', + \ 'gray40' : '#666666', + \ 'gray41' : '#696969', + \ 'gray42' : '#6B6B6B', + \ 'gray43' : '#6E6E6E', + \ 'gray44' : '#707070', + \ 'gray45' : '#737373', + \ 'gray46' : '#757575', + \ 'gray47' : '#787878', + \ 'gray48' : '#7A7A7A', + \ 'gray49' : '#7D7D7D', + \ 'gray5' : '#0D0D0D', + \ 'gray50' : '#7F7F7F', + \ 'gray51' : '#828282', + \ 'gray52' : '#858585', + \ 'gray53' : '#878787', + \ 'gray54' : '#8A8A8A', + \ 'gray55' : '#8C8C8C', + \ 'gray56' : '#8F8F8F', + \ 'gray57' : '#919191', + \ 'gray58' : '#949494', + \ 'gray59' : '#969696', + \ 'gray6' : '#0F0F0F', + \ 'gray60' : '#999999', + \ 'gray61' : '#9C9C9C', + \ 'gray62' : '#9E9E9E', + \ 'gray63' : '#A1A1A1', + \ 'gray64' : '#A3A3A3', + \ 'gray65' : '#A6A6A6', + \ 'gray66' : '#A8A8A8', + \ 'gray67' : '#ABABAB', + \ 'gray68' : '#ADADAD', + \ 'gray69' : '#B0B0B0', + \ 'gray7' : '#121212', + \ 'gray70' : '#B3B3B3', + \ 'gray71' : '#B5B5B5', + \ 'gray72' : '#B8B8B8', + \ 'gray73' : '#BABABA', + \ 'gray74' : '#BDBDBD', + \ 'gray75' : '#BFBFBF', + \ 'gray76' : '#C2C2C2', + \ 'gray77' : '#C4C4C4', + \ 'gray78' : '#C7C7C7', + \ 'gray79' : '#C9C9C9', + \ 'gray8' : '#141414', + \ 'gray80' : '#CCCCCC', + \ 'gray81' : '#CFCFCF', + \ 'gray82' : '#D1D1D1', + \ 'gray83' : '#D4D4D4', + \ 'gray84' : '#D6D6D6', + \ 'gray85' : '#D9D9D9', + \ 'gray86' : '#DBDBDB', + \ 'gray87' : '#DEDEDE', + \ 'gray88' : '#E0E0E0', + \ 'gray89' : '#E3E3E3', + \ 'gray9' : '#171717', + \ 'gray90' : '#E5E5E5', + \ 'gray91' : '#E8E8E8', + \ 'gray92' : '#EBEBEB', + \ 'gray93' : '#EDEDED', + \ 'gray94' : '#F0F0F0', + \ 'gray95' : '#F2F2F2', + \ 'gray96' : '#F5F5F5', + \ 'gray97' : '#F7F7F7', + \ 'gray98' : '#FAFAFA', + \ 'gray99' : '#FCFCFC', + \ 'green yellow' : '#ADFF2F', + \ 'green' : '#00FF00', + \ 'green1' : '#00FF00', + \ 'green2' : '#00EE00', + \ 'green3' : '#00CD00', + \ 'green4' : '#008B00', + \ 'greenyellow' : '#ADFF2F', + \ 'grey' : '#BEBEBE', + \ 'grey0' : '#000000', + \ 'grey1' : '#030303', + \ 'grey10' : '#1A1A1A', + \ 'grey100' : '#FFFFFF', + \ 'grey11' : '#1C1C1C', + \ 'grey12' : '#1F1F1F', + \ 'grey13' : '#212121', + \ 'grey14' : '#242424', + \ 'grey15' : '#262626', + \ 'grey16' : '#292929', + \ 'grey17' : '#2B2B2B', + \ 'grey18' : '#2E2E2E', + \ 'grey19' : '#303030', + \ 'grey2' : '#050505', + \ 'grey20' : '#333333', + \ 'grey21' : '#363636', + \ 'grey22' : '#383838', + \ 'grey23' : '#3B3B3B', + \ 'grey24' : '#3D3D3D', + \ 'grey25' : '#404040', + \ 'grey26' : '#424242', + \ 'grey27' : '#454545', + \ 'grey28' : '#474747', + \ 'grey29' : '#4A4A4A', + \ 'grey3' : '#080808', + \ 'grey30' : '#4D4D4D', + \ 'grey31' : '#4F4F4F', + \ 'grey32' : '#525252', + \ 'grey33' : '#545454', + \ 'grey34' : '#575757', + \ 'grey35' : '#595959', + \ 'grey36' : '#5C5C5C', + \ 'grey37' : '#5E5E5E', + \ 'grey38' : '#616161', + \ 'grey39' : '#636363', + \ 'grey4' : '#0A0A0A', + \ 'grey40' : '#666666', + \ 'grey41' : '#696969', + \ 'grey42' : '#6B6B6B', + \ 'grey43' : '#6E6E6E', + \ 'grey44' : '#707070', + \ 'grey45' : '#737373', + \ 'grey46' : '#757575', + \ 'grey47' : '#787878', + \ 'grey48' : '#7A7A7A', + \ 'grey49' : '#7D7D7D', + \ 'grey5' : '#0D0D0D', + \ 'grey50' : '#7F7F7F', + \ 'grey51' : '#828282', + \ 'grey52' : '#858585', + \ 'grey53' : '#878787', + \ 'grey54' : '#8A8A8A', + \ 'grey55' : '#8C8C8C', + \ 'grey56' : '#8F8F8F', + \ 'grey57' : '#919191', + \ 'grey58' : '#949494', + \ 'grey59' : '#969696', + \ 'grey6' : '#0F0F0F', + \ 'grey60' : '#999999', + \ 'grey61' : '#9C9C9C', + \ 'grey62' : '#9E9E9E', + \ 'grey63' : '#A1A1A1', + \ 'grey64' : '#A3A3A3', + \ 'grey65' : '#A6A6A6', + \ 'grey66' : '#A8A8A8', + \ 'grey67' : '#ABABAB', + \ 'grey68' : '#ADADAD', + \ 'grey69' : '#B0B0B0', + \ 'grey7' : '#121212', + \ 'grey70' : '#B3B3B3', + \ 'grey71' : '#B5B5B5', + \ 'grey72' : '#B8B8B8', + \ 'grey73' : '#BABABA', + \ 'grey74' : '#BDBDBD', + \ 'grey75' : '#BFBFBF', + \ 'grey76' : '#C2C2C2', + \ 'grey77' : '#C4C4C4', + \ 'grey78' : '#C7C7C7', + \ 'grey79' : '#C9C9C9', + \ 'grey8' : '#141414', + \ 'grey80' : '#CCCCCC', + \ 'grey81' : '#CFCFCF', + \ 'grey82' : '#D1D1D1', + \ 'grey83' : '#D4D4D4', + \ 'grey84' : '#D6D6D6', + \ 'grey85' : '#D9D9D9', + \ 'grey86' : '#DBDBDB', + \ 'grey87' : '#DEDEDE', + \ 'grey88' : '#E0E0E0', + \ 'grey89' : '#E3E3E3', + \ 'grey9' : '#171717', + \ 'grey90' : '#E5E5E5', + \ 'grey91' : '#E8E8E8', + \ 'grey92' : '#EBEBEB', + \ 'grey93' : '#EDEDED', + \ 'grey94' : '#F0F0F0', + \ 'grey95' : '#F2F2F2', + \ 'grey96' : '#F5F5F5', + \ 'grey97' : '#F7F7F7', + \ 'grey98' : '#FAFAFA', + \ 'grey99' : '#FCFCFC', + \ 'honeydew' : '#F0FFF0', + \ 'honeydew1' : '#F0FFF0', + \ 'honeydew2' : '#E0EEE0', + \ 'honeydew3' : '#C1CDC1', + \ 'honeydew4' : '#838B83', + \ 'hot pink' : '#FF69B4', + \ 'hotpink' : '#FF69B4', + \ 'hotpink1' : '#FF6EB4', + \ 'hotpink2' : '#EE6AA7', + \ 'hotpink3' : '#CD6090', + \ 'hotpink4' : '#8B3A62', + \ 'indian red' : '#CD5C5C', + \ 'indianred' : '#CD5C5C', + \ 'indianred1' : '#FF6A6A', + \ 'indianred2' : '#EE6363', + \ 'indianred3' : '#CD5555', + \ 'indianred4' : '#8B3A3A', + \ 'ivory' : '#FFFFF0', + \ 'ivory1' : '#FFFFF0', + \ 'ivory2' : '#EEEEE0', + \ 'ivory3' : '#CDCDC1', + \ 'ivory4' : '#8B8B83', + \ 'khaki' : '#F0E68C', + \ 'khaki1' : '#FFF68F', + \ 'khaki2' : '#EEE685', + \ 'khaki3' : '#CDC673', + \ 'khaki4' : '#8B864E', + \ 'lavender blush' : '#FFF0F5', + \ 'lavender' : '#E6E6FA', + \ 'lavenderblush' : '#FFF0F5', + \ 'lavenderblush1' : '#FFF0F5', + \ 'lavenderblush2' : '#EEE0E5', + \ 'lavenderblush3' : '#CDC1C5', + \ 'lavenderblush4' : '#8B8386', + \ 'lawn green' : '#7CFC00', + \ 'lawngreen' : '#7CFC00', + \ 'lemon chiffon' : '#FFFACD', + \ 'lemonchiffon' : '#FFFACD', + \ 'lemonchiffon1' : '#FFFACD', + \ 'lemonchiffon2' : '#EEE9BF', + \ 'lemonchiffon3' : '#CDC9A5', + \ 'lemonchiffon4' : '#8B8970', + \ 'light blue' : '#ADD8E6', + \ 'light coral' : '#F08080', + \ 'light cyan' : '#E0FFFF', + \ 'light goldenrod yellow' : '#FAFAD2', + \ 'light goldenrod' : '#EEDD82', + \ 'light gray' : '#D3D3D3', + \ 'light green' : '#90EE90', + \ 'light grey' : '#D3D3D3', + \ 'light magenta' : '#FFBBFF', + \ 'light pink' : '#FFB6C1', + \ 'light red' : '#FFBBBB', + \ 'light salmon' : '#FFA07A', + \ 'light sea green' : '#20B2AA', + \ 'light sky blue' : '#87CEFA', + \ 'light slate blue' : '#8470FF', + \ 'light slate gray' : '#778899', + \ 'light slate grey' : '#778899', + \ 'light steel blue' : '#B0C4DE', + \ 'light yellow' : '#FFFFE0', + \ 'lightblue' : '#ADD8E6', + \ 'lightblue1' : '#BFEFFF', + \ 'lightblue2' : '#B2DFEE', + \ 'lightblue3' : '#9AC0CD', + \ 'lightblue4' : '#68838B', + \ 'lightcoral' : '#F08080', + \ 'lightcyan' : '#E0FFFF', + \ 'lightcyan1' : '#E0FFFF', + \ 'lightcyan2' : '#D1EEEE', + \ 'lightcyan3' : '#B4CDCD', + \ 'lightcyan4' : '#7A8B8B', + \ 'lightgoldenrod' : '#EEDD82', + \ 'lightgoldenrod1' : '#FFEC8B', + \ 'lightgoldenrod2' : '#EEDC82', + \ 'lightgoldenrod3' : '#CDBE70', + \ 'lightgoldenrod4' : '#8B814C', + \ 'lightgoldenrodyellow' : '#FAFAD2', + \ 'lightgray' : '#D3D3D3', + \ 'lightgreen' : '#90EE90', + \ 'lightgrey' : '#D3D3D3', + \ 'lightmagenta' : '#FFBBFF', + \ 'lightpink' : '#FFB6C1', + \ 'lightpink1' : '#FFAEB9', + \ 'lightpink2' : '#EEA2AD', + \ 'lightpink3' : '#CD8C95', + \ 'lightpink4' : '#8B5F65', + \ 'lightred' : '#FFBBBB', + \ 'lightsalmon' : '#FFA07A', + \ 'lightsalmon1' : '#FFA07A', + \ 'lightsalmon2' : '#EE9572', + \ 'lightsalmon3' : '#CD8162', + \ 'lightsalmon4' : '#8B5742', + \ 'lightseagreen' : '#20B2AA', + \ 'lightskyblue' : '#87CEFA', + \ 'lightskyblue1' : '#B0E2FF', + \ 'lightskyblue2' : '#A4D3EE', + \ 'lightskyblue3' : '#8DB6CD', + \ 'lightskyblue4' : '#607B8B', + \ 'lightslateblue' : '#8470FF', + \ 'lightslategray' : '#778899', + \ 'lightslategrey' : '#778899', + \ 'lightsteelblue' : '#B0C4DE', + \ 'lightsteelblue1' : '#CAE1FF', + \ 'lightsteelblue2' : '#BCD2EE', + \ 'lightsteelblue3' : '#A2B5CD', + \ 'lightsteelblue4' : '#6E7B8B', + \ 'lightyellow' : '#FFFFE0', + \ 'lightyellow1' : '#FFFFE0', + \ 'lightyellow2' : '#EEEED1', + \ 'lightyellow3' : '#CDCDB4', + \ 'lightyellow4' : '#8B8B7A', + \ 'lime green' : '#32CD32', + \ 'limegreen' : '#32CD32', + \ 'linen' : '#FAF0E6', + \ 'magenta' : '#FF00FF', + \ 'magenta1' : '#FF00FF', + \ 'magenta2' : '#EE00EE', + \ 'magenta3' : '#CD00CD', + \ 'magenta4' : '#8B008B', + \ 'maroon' : '#B03060', + \ 'maroon1' : '#FF34B3', + \ 'maroon2' : '#EE30A7', + \ 'maroon3' : '#CD2990', + \ 'maroon4' : '#8B1C62', + \ 'medium aquamarine' : '#66CDAA', + \ 'medium blue' : '#0000CD', + \ 'medium orchid' : '#BA55D3', + \ 'medium purple' : '#9370DB', + \ 'medium sea green' : '#3CB371', + \ 'medium slate blue' : '#7B68EE', + \ 'medium spring green' : '#00FA9A', + \ 'medium turquoise' : '#48D1CC', + \ 'medium violet red' : '#C71585', + \ 'mediumaquamarine' : '#66CDAA', + \ 'mediumblue' : '#0000CD', + \ 'mediumorchid' : '#BA55D3', + \ 'mediumorchid1' : '#E066FF', + \ 'mediumorchid2' : '#D15FEE', + \ 'mediumorchid3' : '#B452CD', + \ 'mediumorchid4' : '#7A378B', + \ 'mediumpurple' : '#9370DB', + \ 'mediumpurple1' : '#AB82FF', + \ 'mediumpurple2' : '#9F79EE', + \ 'mediumpurple3' : '#8968CD', + \ 'mediumpurple4' : '#5D478B', + \ 'mediumseagreen' : '#3CB371', + \ 'mediumslateblue' : '#7B68EE', + \ 'mediumspringgreen' : '#00FA9A', + \ 'mediumturquoise' : '#48D1CC', + \ 'mediumvioletred' : '#C71585', + \ 'midnight blue' : '#191970', + \ 'midnightblue' : '#191970', + \ 'mint cream' : '#F5FFFA', + \ 'mintcream' : '#F5FFFA', + \ 'misty rose' : '#FFE4E1', + \ 'mistyrose' : '#FFE4E1', + \ 'mistyrose1' : '#FFE4E1', + \ 'mistyrose2' : '#EED5D2', + \ 'mistyrose3' : '#CDB7B5', + \ 'mistyrose4' : '#8B7D7B', + \ 'moccasin' : '#FFE4B5', + \ 'navajo white' : '#FFDEAD', + \ 'navajowhite' : '#FFDEAD', + \ 'navajowhite1' : '#FFDEAD', + \ 'navajowhite2' : '#EECFA1', + \ 'navajowhite3' : '#CDB38B', + \ 'navajowhite4' : '#8B795E', + \ 'navy blue' : '#000080', + \ 'navy' : '#000080', + \ 'navyblue' : '#000080', + \ 'old lace' : '#FDF5E6', + \ 'oldlace' : '#FDF5E6', + \ 'olive drab' : '#6B8E23', + \ 'olivedrab' : '#6B8E23', + \ 'olivedrab1' : '#C0FF3E', + \ 'olivedrab2' : '#B3EE3A', + \ 'olivedrab3' : '#9ACD32', + \ 'olivedrab4' : '#698B22', + \ 'orange red' : '#FF4500', + \ 'orange' : '#FFA500', + \ 'orange1' : '#FFA500', + \ 'orange2' : '#EE9A00', + \ 'orange3' : '#CD8500', + \ 'orange4' : '#8B5A00', + \ 'orangered' : '#FF4500', + \ 'orangered1' : '#FF4500', + \ 'orangered2' : '#EE4000', + \ 'orangered3' : '#CD3700', + \ 'orangered4' : '#8B2500', + \ 'orchid' : '#DA70D6', + \ 'orchid1' : '#FF83FA', + \ 'orchid2' : '#EE7AE9', + \ 'orchid3' : '#CD69C9', + \ 'orchid4' : '#8B4789', + \ 'pale goldenrod' : '#EEE8AA', + \ 'pale green' : '#98FB98', + \ 'pale turquoise' : '#AFEEEE', + \ 'pale violet red' : '#DB7093', + \ 'palegoldenrod' : '#EEE8AA', + \ 'palegreen' : '#98FB98', + \ 'palegreen1' : '#9AFF9A', + \ 'palegreen2' : '#90EE90', + \ 'palegreen3' : '#7CCD7C', + \ 'palegreen4' : '#548B54', + \ 'paleturquoise' : '#AFEEEE', + \ 'paleturquoise1' : '#BBFFFF', + \ 'paleturquoise2' : '#AEEEEE', + \ 'paleturquoise3' : '#96CDCD', + \ 'paleturquoise4' : '#668B8B', + \ 'palevioletred' : '#DB7093', + \ 'palevioletred1' : '#FF82AB', + \ 'palevioletred2' : '#EE799F', + \ 'palevioletred3' : '#CD6889', + \ 'palevioletred4' : '#8B475D', + \ 'papaya whip' : '#FFEFD5', + \ 'papayawhip' : '#FFEFD5', + \ 'peach puff' : '#FFDAB9', + \ 'peachpuff' : '#FFDAB9', + \ 'peachpuff1' : '#FFDAB9', + \ 'peachpuff2' : '#EECBAD', + \ 'peachpuff3' : '#CDAF95', + \ 'peachpuff4' : '#8B7765', + \ 'peru' : '#CD853F', + \ 'pink' : '#FFC0CB', + \ 'pink1' : '#FFB5C5', + \ 'pink2' : '#EEA9B8', + \ 'pink3' : '#CD919E', + \ 'pink4' : '#8B636C', + \ 'plum' : '#DDA0DD', + \ 'plum1' : '#FFBBFF', + \ 'plum2' : '#EEAEEE', + \ 'plum3' : '#CD96CD', + \ 'plum4' : '#8B668B', + \ 'powder blue' : '#B0E0E6', + \ 'powderblue' : '#B0E0E6', + \ 'purple' : '#A020F0', + \ 'purple1' : '#9B30FF', + \ 'purple2' : '#912CEE', + \ 'purple3' : '#7D26CD', + \ 'purple4' : '#551A8B', + \ 'red' : '#FF0000', + \ 'red1' : '#FF0000', + \ 'red2' : '#EE0000', + \ 'red3' : '#CD0000', + \ 'red4' : '#8B0000', + \ 'rosy brown' : '#BC8F8F', + \ 'rosybrown' : '#BC8F8F', + \ 'rosybrown1' : '#FFC1C1', + \ 'rosybrown2' : '#EEB4B4', + \ 'rosybrown3' : '#CD9B9B', + \ 'rosybrown4' : '#8B6969', + \ 'royal blue' : '#4169E1', + \ 'royalblue' : '#4169E1', + \ 'royalblue1' : '#4876FF', + \ 'royalblue2' : '#436EEE', + \ 'royalblue3' : '#3A5FCD', + \ 'royalblue4' : '#27408B', + \ 'saddle brown' : '#8B4513', + \ 'saddlebrown' : '#8B4513', + \ 'salmon' : '#FA8072', + \ 'salmon1' : '#FF8C69', + \ 'salmon2' : '#EE8262', + \ 'salmon3' : '#CD7054', + \ 'salmon4' : '#8B4C39', + \ 'sandy brown' : '#F4A460', + \ 'sandybrown' : '#F4A460', + \ 'sea green' : '#2E8B57', + \ 'seagreen' : '#2E8B57', + \ 'seagreen1' : '#54FF9F', + \ 'seagreen2' : '#4EEE94', + \ 'seagreen3' : '#43CD80', + \ 'seagreen4' : '#2E8B57', + \ 'seashell' : '#FFF5EE', + \ 'seashell1' : '#FFF5EE', + \ 'seashell2' : '#EEE5DE', + \ 'seashell3' : '#CDC5BF', + \ 'seashell4' : '#8B8682', + \ 'sienna' : '#A0522D', + \ 'sienna1' : '#FF8247', + \ 'sienna2' : '#EE7942', + \ 'sienna3' : '#CD6839', + \ 'sienna4' : '#8B4726', + \ 'sky blue' : '#87CEEB', + \ 'skyblue' : '#87CEEB', + \ 'skyblue1' : '#87CEFF', + \ 'skyblue2' : '#7EC0EE', + \ 'skyblue3' : '#6CA6CD', + \ 'skyblue4' : '#4A708B', + \ 'slate blue' : '#6A5ACD', + \ 'slate gray' : '#708090', + \ 'slate grey' : '#708090', + \ 'slateblue' : '#6A5ACD', + \ 'slateblue1' : '#836FFF', + \ 'slateblue2' : '#7A67EE', + \ 'slateblue3' : '#6959CD', + \ 'slateblue4' : '#473C8B', + \ 'slategray' : '#708090', + \ 'slategray1' : '#C6E2FF', + \ 'slategray2' : '#B9D3EE', + \ 'slategray3' : '#9FB6CD', + \ 'slategray4' : '#6C7B8B', + \ 'slategrey' : '#708090', + \ 'snow' : '#FFFAFA', + \ 'snow1' : '#FFFAFA', + \ 'snow2' : '#EEE9E9', + \ 'snow3' : '#CDC9C9', + \ 'snow4' : '#8B8989', + \ 'spring green' : '#00FF7F', + \ 'springgreen' : '#00FF7F', + \ 'springgreen1' : '#00FF7F', + \ 'springgreen2' : '#00EE76', + \ 'springgreen3' : '#00CD66', + \ 'springgreen4' : '#008B45', + \ 'steel blue' : '#4682B4', + \ 'steelblue' : '#4682B4', + \ 'steelblue1' : '#63B8FF', + \ 'steelblue2' : '#5CACEE', + \ 'steelblue3' : '#4F94CD', + \ 'steelblue4' : '#36648B', + \ 'tan' : '#D2B48C', + \ 'tan1' : '#FFA54F', + \ 'tan2' : '#EE9A49', + \ 'tan3' : '#CD853F', + \ 'tan4' : '#8B5A2B', + \ 'thistle' : '#D8BFD8', + \ 'thistle1' : '#FFE1FF', + \ 'thistle2' : '#EED2EE', + \ 'thistle3' : '#CDB5CD', + \ 'thistle4' : '#8B7B8B', + \ 'tomato' : '#FF6347', + \ 'tomato1' : '#FF6347', + \ 'tomato2' : '#EE5C42', + \ 'tomato3' : '#CD4F39', + \ 'tomato4' : '#8B3626', + \ 'turquoise' : '#40E0D0', + \ 'turquoise1' : '#00F5FF', + \ 'turquoise2' : '#00E5EE', + \ 'turquoise3' : '#00C5CD', + \ 'turquoise4' : '#00868B', + \ 'violet red' : '#D02090', + \ 'violet' : '#EE82EE', + \ 'violetred' : '#D02090', + \ 'violetred1' : '#FF3E96', + \ 'violetred2' : '#EE3A8C', + \ 'violetred3' : '#CD3278', + \ 'violetred4' : '#8B2252', + \ 'wheat' : '#F5DEB3', + \ 'wheat1' : '#FFE7BA', + \ 'wheat2' : '#EED8AE', + \ 'wheat3' : '#CDBA96', + \ 'wheat4' : '#8B7E66', + \ 'white smoke' : '#F5F5F5', + \ 'white' : '#FFFFFF', + \ 'whitesmoke' : '#F5F5F5', + \ 'yellow green' : '#9ACD32', + \ 'yellow' : '#FFFF00', + \ 'yellow1' : '#FFFF00', + \ 'yellow2' : '#EEEE00', + \ 'yellow3' : '#CDCD00', + \ 'yellow4' : '#8B8B00', + \ 'yellowgreen' : '#9ACD32', + \} + + if has_key(l:color_list, l:color_name) + let l:hex_code = l:color_list[l:color_name] + endif + + return l:hex_code +endfunction diff --git a/sources_non_forked/vim-indent-guides/autoload/indent_guides.vim b/sources_non_forked/vim-indent-guides/autoload/indent_guides.vim new file mode 100644 index 00000000..482d0adb --- /dev/null +++ b/sources_non_forked/vim-indent-guides/autoload/indent_guides.vim @@ -0,0 +1,286 @@ +" Author: Nate Kane +" Homepage: http://github.com/nathanaelkane/vim-indent-guides + +" +" Toggles the indent guides on and off. +" +function! indent_guides#toggle() + call indent_guides#init_matches() + + if empty(w:indent_guides_matches) + call indent_guides#enable() + else + call indent_guides#disable() + endif +endfunction + +" +" Called from autocmds, keeps indent guides enabled or disabled when entering +" other buffers and windows. +" +function! indent_guides#process_autocmds() + if g:indent_guides_autocmds_enabled + call indent_guides#enable() + else + call indent_guides#disable() + end +endfunction + +" +" Enables the indent guides for the current buffer and any other buffer upon +" entering it. +" +function! indent_guides#enable() + let g:indent_guides_autocmds_enabled = 1 + + if &diff || indent_guides#exclude_filetype() + call indent_guides#clear_matches() + return + end + + call indent_guides#init_script_vars() + call indent_guides#highlight_colors() + call indent_guides#clear_matches() + + " loop through each indent level and define a highlight pattern + " will automagically figure out whether to use tabs or spaces + for l:level in range(s:start_level, s:indent_levels) + let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd') + let l:column_start = (l:level - 1) * s:indent_size + 1 + + " define the higlight patterns and add to matches list + if g:indent_guides_space_guides + let l:soft_pattern = indent_guides#indent_highlight_pattern(g:indent_guides_soft_pattern, l:column_start, s:guide_size) + call add(w:indent_guides_matches, matchadd(l:group, l:soft_pattern)) + end + if g:indent_guides_tab_guides + let l:hard_pattern = indent_guides#indent_highlight_pattern('\t', l:column_start, s:indent_size) + call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern)) + end + endfor +endfunction + +" +" Disables the indent guides for the current buffer and any other buffer upon +" entering it. +" +function! indent_guides#disable() + let g:indent_guides_autocmds_enabled = 0 + call indent_guides#clear_matches() +endfunction + +" +" Clear all highlight matches for the current window. +" +function! indent_guides#clear_matches() + call indent_guides#init_matches() + if !empty(w:indent_guides_matches) + let l:index = 0 + for l:match_id in w:indent_guides_matches + try + call matchdelete(l:match_id) + catch /E803:/ + " Do nothing + endtry + call remove(w:indent_guides_matches, l:index) + let l:index += l:index + endfor + endif +endfunction + +" +" Automagically calculates and defines the indent highlight colors. +" +function! indent_guides#highlight_colors() + if s:auto_colors + if has('gui_running') || has('nvim') + call indent_guides#gui_highlight_colors() + else + call indent_guides#basic_highlight_colors() + endif + endif +endfunction + +" +" Defines some basic indent highlight colors that work for Terminal Vim and +" gVim when colors can't be automatically calculated. +" +function! indent_guides#basic_highlight_colors() + let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white'] + let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85'] + + exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' guifg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[0] . ' ctermfg=' . l:cterm_colors[1] + exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' guifg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[1] . ' ctermfg=' . l:cterm_colors[0] +endfunction + +" +" Automagically calculates and defines the indent highlight colors for gui +" vim. +" +function! indent_guides#gui_highlight_colors() + let l:hi_normal_guibg = '' + + " capture the backgroud color from the normal highlight + if s:hi_normal =~ s:color_hex_bg_pat + " hex color code is being used, eg. '#FFFFFF' + let l:hi_normal_guibg = matchstr(s:hi_normal, s:color_hex_bg_pat) + + elseif s:hi_normal =~ s:color_name_bg_pat + " color name is being used, eg. 'white' + let l:color_name = matchstr(s:hi_normal, s:color_name_bg_pat) + let l:hi_normal_guibg = color_helper#color_name_to_hex(l:color_name) + + else + " background color could not be detected, default to basic colors + call indent_guides#basic_highlight_colors() + endif + + if l:hi_normal_guibg =~ s:color_hex_pat + " calculate the highlight background colors + let l:hi_odd_bg = indent_guides#lighten_or_darken_color(l:hi_normal_guibg) + let l:hi_even_bg = indent_guides#lighten_or_darken_color(l:hi_odd_bg) + + " define the new highlights + exe 'hi IndentGuidesOdd guibg=' . l:hi_odd_bg . ' guifg=' . l:hi_even_bg + exe 'hi IndentGuidesEven guibg=' . l:hi_even_bg . ' guifg=' . l:hi_odd_bg + end +endfunction + +" +" Takes a color and darkens or lightens it depending on whether a dark or light +" colorscheme is being used. +" +function! indent_guides#lighten_or_darken_color(color) + let l:new_color = '' + + if (&g:background == 'dark') + let l:new_color = color_helper#hex_color_lighten(a:color, s:change_percent) + else + let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent) + endif + + return l:new_color +endfunction + +" +" Define default highlights. +" +function! indent_guides#define_default_highlights() + hi default clear IndentGuidesOdd + hi default clear IndentGuidesEven +endfunction + +" +" Init the w:indent_guides_matches variable. +" +function! indent_guides#init_matches() + let w:indent_guides_matches = exists('w:indent_guides_matches') ? w:indent_guides_matches : [] +endfunction + +" +" We need to initialize these vars every time a buffer is entered while the +" plugin is enabled. +" +function! indent_guides#init_script_vars() + if &l:shiftwidth > 0 && &l:expandtab + let s:indent_size = &l:shiftwidth + else + let s:indent_size = &l:tabstop + endif + let s:guide_size = indent_guides#calculate_guide_size() + let s:hi_normal = indent_guides#capture_highlight('Normal') + + " remove 'font=' from the s:hi_normal string (only seems to happen on Vim startup in Windows) + let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', "", "") + + " shortcuts to the global variables - this makes the code easier to read + let s:debug = g:indent_guides_debug + let s:indent_levels = g:indent_guides_indent_levels + let s:auto_colors = g:indent_guides_auto_colors + let s:color_hex_pat = g:indent_guides_color_hex_pattern + let s:color_hex_bg_pat = g:indent_guides_color_hex_guibg_pattern + let s:color_name_bg_pat = g:indent_guides_color_name_guibg_pattern + let s:start_level = g:indent_guides_start_level + + " str2float not available in vim versions <= 7.1 + if has('float') + let s:change_percent = g:indent_guides_color_change_percent / str2float('100.0') + else + let s:change_percent = g:indent_guides_color_change_percent / 100.0 + endif + + if s:debug + echo 's:indent_size = ' . s:indent_size + echo 's:guide_size = ' . s:guide_size + echo 's:hi_normal = ' . s:hi_normal + echo 's:indent_levels = ' . s:indent_levels + echo 's:auto_colors = ' . s:auto_colors + echo 's:change_percent = ' . string(s:change_percent) + echo 's:color_hex_pat = ' . s:color_hex_pat + echo 's:color_hex_bg_pat = ' . s:color_hex_bg_pat + echo 's:color_name_bg_pat = ' . s:color_name_bg_pat + echo 's:start_level = ' . s:start_level + endif +endfunction + +" +" Calculate the indent guide size. Ensures the guide size is less than or +" equal to the actual indent size, otherwise some weird things can occur. +" +" NOTE: Currently, this only works when soft-tabs are being used. +" +function! indent_guides#calculate_guide_size() + let l:guide_size = g:indent_guides_guide_size + + if l:guide_size == 0 || l:guide_size > s:indent_size + let l:guide_size = s:indent_size + endif + + return l:guide_size +endfunction + +" +" Captures and returns the output of highlight group definitions. +" +" Example: indent_guides#capture_highlight('normal') +" Returns: 'Normal xxx guifg=#323232 guibg=#ffffff' +" +function! indent_guides#capture_highlight(group_name) + redir => l:output + exe "silent hi " . a:group_name + redir END + + let l:output = substitute(l:output, "\n", "", "") + return l:output +endfunction + +" +" Returns a regex pattern for highlighting an indent level. +" +" Example: indent_guides#indent_highlight_pattern(' ', 1, 4) +" Returns: /^ *\%1v\zs *\%5v\ze/ +" +" Example: indent_guides#indent_highlight_pattern('\s', 5, 2) +" Returns: /^\s*\%5v\zs\s*\%7v\ze/ +" +" Example: indent_guides#indent_highlight_pattern('\t', 9, 2) +" Returns: /^\t*\%9v\zs\t*\%11v\ze/ +" +function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size) + let l:pattern = '^' . a:indent_pattern . '*\%' . a:column_start . 'v\zs' + let l:pattern .= a:indent_pattern . '*\%' . (a:column_start + a:indent_size) . 'v' + let l:pattern .= '\ze' + return l:pattern +endfunction + +" +" Detect if any of the buffer filetypes should be excluded. +" +function! indent_guides#exclude_filetype() + for ft in split(&ft, '\.') + if index(g:indent_guides_exclude_filetypes, ft) > -1 + return 1 + end + endfor + return 0 +endfunction diff --git a/sources_non_forked/vim-indent-guides/doc/indent_guides.txt b/sources_non_forked/vim-indent-guides/doc/indent_guides.txt new file mode 100644 index 00000000..d51a3940 --- /dev/null +++ b/sources_non_forked/vim-indent-guides/doc/indent_guides.txt @@ -0,0 +1,351 @@ +*indent_guides.txt* A plugin for visually displaying indent levels in Vim. + + *indent-guides* + ____ __ __ ______ _ __ + / _/____ ____/ /___ ____ / /_ / ____/__ __(_)____/ /___ _____ + / / / __ \/ __ // _ \/ __ \/ __/ / / __ / / / / // __ // _ \/ ___/ + _/ / / / / / /_/ // __/ / / / /_ / /_/ // /_/ / // /_/ // __(__ ) + /___//_/ /_/\__,_/ \___/_/ /_/\__/ \____/ \__,_/_/ \__,_/ \___/____/ + + +Author: Nate Kane +Version: 1.7 +Last Change: 07 Mar 2013 + +============================================================================== +CONTENTS *indent-guides-contents* + + 1. Introduction.......................... |indent-guides-introduction| + 2. Commands.............................. |indent-guides-commands| + 3. Options............................... |indent-guides-options| + 4. Mappings.............................. |indent-guides-mappings| + 5. Terminal Vim.......................... |indent-guides-terminal-vim| + 6. About................................. |indent-guides-about| + 7. Changelog............................. |indent-guides-changelog| + 8. License............................... |indent-guides-license| + +============================================================================== +1. INTRODUCTION *indent-guides-introduction* + +Indent Guides is a plugin for visually displaying indent levels in Vim. + +This plugin should work with gVim out of the box, no configuration needed. + +Features:~ + * Can detect both tab and space indent styles. + * Automatically inspects your colorscheme and picks appropriate colors (gVim + only). + * Will highlight indent levels with alternating colors. + * Full support for gVim and basic support for Terminal Vim. + * Seems to work on Windows gVim 7.3 (haven't done any extensive tests + though). + * Customizable size for indent guides, eg. skinny guides (soft-tabs only). + * Customizable start indent level. + * Highlight support for files with a mixture of tab and space indent styles. + +============================================================================== +2. COMMANDS *indent-guides-commands* + +------------------------------------------------------------------------------ +:IndentGuidesToggle *:IndentGuidesToggle* + Toggles the indent guides on and off. + +------------------------------------------------------------------------------ +:IndentGuidesEnable *:IndentGuidesEnable* + Enables the indent guides for the current buffer and any other buffer upon + entering it. + +------------------------------------------------------------------------------ +:IndentGuidesDisable *:IndentGuidesDisable* + Disables the indent guides for the current buffer and any other buffer upon + entering it. + +============================================================================== +3. OPTIONS *indent-guides-options* + +------------------------------------------------------------------------------ + *'indent_guides_indent_levels'* +Use this option to control how many indent levels to display guides for. + +Default: 30. Values: integer. +> + let g:indent_guides_indent_levels = 30 +< + +------------------------------------------------------------------------------ + *'indent_guides_auto_colors'* +Use this option to control whether or not the plugin automatically calculates +the highlight colors. Will use the current colorscheme's background color as a +base color. + +Default: 1. Values: 0 or 1. +> + let g:indent_guides_auto_colors = 1 +< + +If you set this option to 0, be sure to manually define some highlight colors +in an autocmd. +> + let g:indent_guides_auto_colors = 0 + autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3 + autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4 +< + +Alternatively you can add the following lines to your colorscheme file. +> + hi IndentGuidesOdd guibg=red ctermbg=3 + hi IndentGuidesEven guibg=green ctermbg=4 +< + +------------------------------------------------------------------------------ + *'indent_guides_color_change_percent'* +Use this option to control the percent at which the highlight colors will be +lightened or darkened. + +Default: 10 (10%). Values: between 0 and 100. +> + let g:indent_guides_color_change_percent = 10 +< + +------------------------------------------------------------------------------ + *'indent_guides_guide_size'* +Use this option to customize the size of the indent guide. By default the +value is set to 0, which will set the guide size to be the same as the +|shiftwidth|. Setting this value to be larger than the |shiftwidth| is essentially +the same as setting it to 0. + +A common use of this setting is to create skinny indent guides, which look +great with a |shiftwidth| of 4 or more. + +NOTE: This option only works for soft-tabs (spaces) and not hard-tabs. + +Default: 0. Values: between 0 and |shiftwidth|. +> + let g:indent_guides_guide_size = 1 +< + +------------------------------------------------------------------------------ + *'indent_guides_start_level'* +Use this option to control which indent level to start showing guides from. + +Default: 1. Values: between 1 and g:|indent_guides_indent_levels|. +> + let g:indent_guides_start_level = 2 +< + +------------------------------------------------------------------------------ + *'indent_guides_space_guides'* +Use this option to control whether the plugin considers spaces as indention. + +Default: 1. Values: 0 or 1. +> + let g:indent_guides_space_guides = 0 +< + +------------------------------------------------------------------------------ + *'indent_guides_tab_guides'* +Use this option to control whether the plugin considers tabs as indention. + +Default: 1. Values: 0 or 1. +> + let g:indent_guides_tab_guides = 0 +< + +------------------------------------------------------------------------------ + *'indent_guides_soft_pattern'* +Use this option to explicitly specify a pattern for soft indentation. For +example to match spaces only in the beginning of line use ' ' pattern. + +Default: '\s'. Values: Vim regexp. +> + let g:indent_guides_soft_pattern = ' ' +< + +------------------------------------------------------------------------------ + *'indent_guides_enable_on_vim_startup'* +Use this option to control whether the plugin is enabled on Vim startup. + +Default: 0. Values: 0 or 1. +> + let g:indent_guides_enable_on_vim_startup = 0 +< + +------------------------------------------------------------------------------ + *'indent_guides_exclude_filetypes'* +Use this option to specify a list of filetypes to disable the plugin for. + +Default: ['help']. Values: list of strings. +> + let g:indent_guides_exclude_filetypes = ['help', 'nerdtree'] +< + +------------------------------------------------------------------------------ + *'indent_guides_default_mapping'* +Use this option to control whether the default mapping (ig) gets set. + +Default: 1. Values: 0 or 1. +> + let g:indent_guides_default_mapping = 0 +< + +============================================================================== +4. MAPPINGS *indent-guides-mappings* + +The default mapping for toggling indent guides is ig. You can easily +map it to other keys. For example: +> + :nmap ig IndentGuidesToggle +< + +You can also map some other commands that are not mapped by default. For +example: +> + :nmap ie IndentGuidesEnable + :nmap id IndentGuidesDisable +< + +============================================================================== +5. TERMINAL VIM *indent-guides-terminal-vim* + +At the moment Terminal Vim only has basic support. This means is that colors +won't be automatically calculated based on your colorscheme. Instead, some +preset colors are used depending on whether `background` is set to `dark` or +`light`. + +When `set background=dark` is used, the following highlight colors will be +defined: +> + hi IndentGuidesOdd ctermbg=black + hi IndentGuidesEven ctermbg=darkgrey +< + +Alternatively, when `set background=light` is used, the following highlight +colors will be defined: +> + hi IndentGuidesOdd ctermbg=white + hi IndentGuidesEven ctermbg=lightgrey +< + +If for some reason it's incorrectly defining light highlight colors instead of +dark ones or vice versa, the first thing you should check is that the +`background` value is being set correctly for your colorscheme. Sometimes it's +best to manually set the `background` value in your `.vimrc`, for example: +> + colorscheme desert256 + set background=dark +< + +Alternatively you can manually setup the highlight colors yourself, see +|indent_guides_auto_colors| for an example. + +============================================================================== +6. ABOUT *indent-guides-about* + +Why did I build this plugin?~ + * I believe indent guides make nested code easier to read and understand. + * Other editors have them and it's high time Vim did. + * None of the existing indent guide plugins on the market suited my needs. + * I wanted to learn me some VimL. + +Links:~ + * Github: https://github.com/nathanaelkane/vim-indent-guides + * Bugs & Issues: https://github.com/nathanaelkane/vim-indent-guides/issues + +Credits:~ + * Matt Wozniski (godlygeek) for letting me use the list of color names and + hex codes from his CSApprox plugin. + +Contact:~ + * Twitter: @nathanaelkane + * Email: + +Bug reports, feedback, suggestions etc are welcomed. + +============================================================================== +7. CHANGELOG *indent-guides-changelog* + +1.8 (pending release)~ + * Added option g:|indent_guides_soft_pattern| to control the pattern for + soft indentation (thanks @sergey-vlasov). + * Added option g:|indent_guides_default_mapping| to control whether the + default mapping (ig) gets set (thanks @suy). + * Set size of indent guide to `tabstop` value when `shiftwidth=0` or + `noexpandtab` is used (thanks @darkfeline and @wilywampa). + * Don't load plugin in unsupported versions of Vim (thanks @dersaidin). + * Added option g:|indent_guides_tab_guides| to control whether tabs are + considered as indention (thanks @amerlyq). + +1.7~ + * Added way to override the default mapping (thanks @xuhdev). + * Added option g:|indent_guides_exclude_filetypes| to specify a list of + filetypes to disable the plugin for. + * Disable the plugin when in a diff. + * Various bug fixes. + +1.6~ + * Added option g:|indent_guides_space_guides| to control whether spaces are + considered as indention (thanks @scoz). + * Added 'doc/tags' to gitignore (thanks @lenniboy). + * Fixed E803 ID not found spam (thanks @mutewinter). + * Fixed str2float issue with Vim 7.1 (thanks @acx0). + +1.5~ + * Added highlight support for files with a mixture of tab and space indent + styles (thanks @graywh). + * Added -bar to all the :commands so they can chain with other :commands + (thanks @graywh). + * No longer overriding pre-defined custom highlight colors (thanks @graywh). + * Using str2float to work around a float bug in some versions of Vim 7.2 + (thanks @voidus). + +1.4~ + * Added the new plugin option g:|indent_guides_enable_on_vim_startup|. + * Improved Windows support. + +1.3~ + * Changed the default value of g:|indent_guides_color_change_percent| to 10. + * Added support for gVim themes that don't specify a `hi Normal guibg` + color. + +1.2~ + * Customizable size for indent guides, eg. skinny guides (soft-tabs only). + * Customizable start indent level. + * Refactored some internal logic. + +1.1~ + * Added basic support for Terminal Vim. See |indent-guides-terminal-vim| for + more information. + * Cut down on rgb to hex color conversions by adding a big dictionary of + color names and hex codes. + * Various bug fixes. + +1.0~ + * First public version. + +============================================================================== +8. LICENSE *indent-guides-license* + +The MIT Licence +http://www.opensource.org/licenses/mit-license.php + +Copyright (c) 2010-2013 Nate Kane + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +vim:tw=78:ts=2:ft=help:norl: diff --git a/sources_non_forked/vim-indent-guides/plugin/indent_guides.vim b/sources_non_forked/vim-indent-guides/plugin/indent_guides.vim new file mode 100644 index 00000000..c94079be --- /dev/null +++ b/sources_non_forked/vim-indent-guides/plugin/indent_guides.vim @@ -0,0 +1,92 @@ +" Author: Nate Kane +" Homepage: http://github.com/nathanaelkane/vim-indent-guides + +" Do not load if vim is too old +if (v:version == 701 && !exists('*matchadd')) || (v:version < 701) + finish +endif + +if exists('g:loaded_indent_guides') || &cp + finish +endif +let g:loaded_indent_guides = 1 +call indent_guides#define_default_highlights() + +function! s:IndentGuidesToggle() + call indent_guides#toggle() +endfunction + +function! s:IndentGuidesEnable() + call indent_guides#enable() +endfunction + +function! s:IndentGuidesDisable() + call indent_guides#disable() +endfunction + +" Commands +command! -bar IndentGuidesToggle call s:IndentGuidesToggle() +command! -bar IndentGuidesEnable call s:IndentGuidesEnable() +command! -bar IndentGuidesDisable call s:IndentGuidesDisable() + +" +" Initializes a given variable to a given value. The variable is only +" initialized if it does not exist prior. +" +function s:InitVariable(var, value) + if !exists(a:var) + if type(a:value) == type("") + exec 'let ' . a:var . ' = ' . "'" . a:value . "'" + else + exec 'let ' . a:var . ' = ' . a:value + endif + endif +endfunction + +" Fixed global variables +let g:indent_guides_autocmds_enabled = 0 +let g:indent_guides_color_hex_pattern = '#[0-9A-Fa-f]\{6\}' +let g:indent_guides_color_hex_guibg_pattern = 'guibg=\zs' . g:indent_guides_color_hex_pattern . '\ze' +let g:indent_guides_color_name_guibg_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?" + +" Configurable global variables +call s:InitVariable('g:indent_guides_indent_levels', 30) +call s:InitVariable('g:indent_guides_auto_colors', 1) +call s:InitVariable('g:indent_guides_color_change_percent', 10) " ie. 10% +call s:InitVariable('g:indent_guides_guide_size', 0) +call s:InitVariable('g:indent_guides_start_level', 1) +call s:InitVariable('g:indent_guides_enable_on_vim_startup', 0) +call s:InitVariable('g:indent_guides_debug', 0) +call s:InitVariable('g:indent_guides_space_guides', 1) +call s:InitVariable('g:indent_guides_tab_guides', 1) +call s:InitVariable('g:indent_guides_soft_pattern', '\s') +call s:InitVariable('g:indent_guides_default_mapping', 1) + +if !exists('g:indent_guides_exclude_filetypes') + let g:indent_guides_exclude_filetypes = ['help'] +endif + +" Default mapping +if !hasmapto('IndentGuidesToggle', 'n') && maparg('ig', 'n') == '' + \ && g:indent_guides_default_mapping != 0 + nmap ig IndentGuidesToggle +endif + +" Plug mappings +nnoremap