From 8e54cbc92ea47767c223bf351a2128539de74359 Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 5 May 2021 10:24:20 +0200 Subject: [PATCH 01/25] 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 02/25] 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 03/25] [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 04/25] 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 05/25] 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 06/25] 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 07/25] 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 08/25] 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 09/25] 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 10/25] 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 11/25] 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 12/25] 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 13/25] 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 14/25] 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 15/25] 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