mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
Amir 2021-05-31 22:30:26 +02:00
parent 9999d72176
commit 2dc46c9a65
92 changed files with 412 additions and 245 deletions

View File

@ -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'),

View File

@ -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'

View File

@ -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

View File

@ -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')},

View File

@ -1,8 +1,10 @@
" Author: Ben Reedy <https://github.com/breed808>
" 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',

View File

@ -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

View File

@ -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',
\])

View File

@ -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'),

View File

@ -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

View File

@ -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',
\])

View File

@ -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

View File

@ -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',

View File

@ -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'),

View File

@ -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'),

View File

@ -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',

View File

@ -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',

View File

@ -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',
\])

View File

@ -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',

View File

@ -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'),

View File

@ -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'),

View File

@ -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'),

View File

@ -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',
\})

View File

@ -0,0 +1,13 @@
" Author: Risto Stevcev <me@risto.codes>
" 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'),
\})

View File

@ -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'),
\})

View File

@ -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',

View File

@ -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'
\ ])},

View File

@ -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'),

View File

@ -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',
\])

View File

@ -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',

View File

@ -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

View File

@ -1,5 +1,6 @@
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>,
" Fenner Macrae <fmacrae.dev@gmail.com>
" Fenner Macrae <fmacrae.dev@gmail.com>,
" ourigen <https://github.com/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', {

View File

@ -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',
\])

View File

@ -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',

View File

@ -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',
\])

View File

@ -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'),

View File

@ -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

View File

@ -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'),

View File

@ -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'),

View File

@ -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',

View File

@ -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',

View File

@ -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',
\})

View File

@ -1,5 +1,5 @@
" Author: Ricardo Liang <ricardoliang@gmail.com>
" Author: ourigen <ourigen [at] pm.me>
" Author: ourigen <https://github.com/ourigen>
" Description: Texlab language server (Rust rewrite)
call ale#Set('tex_texlab_executable', 'texlab')

View File

@ -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',

View File

@ -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',
\ ])},

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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': {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'
\])

View File

@ -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'
\])

View File

@ -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',

View File

@ -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',
\])

View File

@ -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',
\])

View File

@ -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',
\])

View File

@ -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',

View File

@ -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',
\])

View File

@ -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',

View File

@ -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'],

View File

@ -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

View File

@ -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',
\])

View File

@ -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')

View File

@ -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',
\])

View File

@ -1,6 +1,13 @@
" Author: Risto Stevcev <me@risto.codes>
" 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

View File

@ -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

View File

@ -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')

View File

@ -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',
\])

View File

@ -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

View File

@ -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',
\])

View File

@ -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',
\])

View File

@ -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'],

View File

@ -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.
"

View File

@ -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# '\'

View File

@ -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.

View File

@ -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:

View File

@ -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'],

View File

@ -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:

View File

@ -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

View File

@ -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).

View File

@ -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)

View File

@ -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|.

View File

@ -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', '-', ":<C-U>execute <SID>Do('Toggle',0)<CR>", '<silent>')
call s:Map('x', '-', ":<C-U>execute <SID>Do('Toggle',1)<CR>", '<silent>')
@ -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 <buffer> <silent> q :<C-U>echoerr "fugitive: q is removed in favor of gq (or :q)"<CR>
@ -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 =~# '\<tab\>' ? 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', '<F1>', ':help :Git_blame<CR>', '<silent>')
call s:Map('n', 'g?', ':help :Git_blame<CR>', '<silent>')
if mapcheck('q', 'n') =~# '^$\|bdelete'
call s:Map('n', 'q', 'echoerr "fugitive: q removed in favor of gq (or :q)"<CR>', '<silent>')
call s:Map('n', 'q', ':echoerr "fugitive: q removed in favor of gq (or :q)"<CR>', '<silent>')
endif
call s:Map('n', 'gq', ':exe <SID>BlameQuit()<CR>', '<silent>')
call s:Map('n', '<2-LeftMouse>', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>')
@ -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\@<!\x\{4,\}\>')
else
let commit = s:Owner(@%)
endif

View File

@ -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

View File

@ -26,7 +26,7 @@ syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=@fugitiveSection fold
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
for s:section in ['Untracked', 'Unstaged', 'Staged']
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'

View File

@ -172,14 +172,24 @@ 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, or set |g:gitgutter_close_preview_on_escape|
and use <Esc>.
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 <Esc>.
Commands for folds:~
*gitgutter-:GitGutterFold*

View File

@ -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 /\<require\>/ containedin=jsFuncCall
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError