Updated plugins
This commit is contained in:
parent
06f872cb2f
commit
8240935caa
34 changed files with 497 additions and 279 deletions
|
@ -1,5 +1,5 @@
|
|||
" Author: Jon Parise <jon@indelible.org>
|
||||
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
||||
" Description: ElixirLS integration (https://github.com/elixir-lsp/elixir-ls)
|
||||
|
||||
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
||||
call ale#Set('elixir_elixir_ls_config', {})
|
||||
|
|
|
@ -17,13 +17,15 @@ function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
|||
" Matches patterns like the following:
|
||||
"
|
||||
" ERROR: 0:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
||||
" or when using options like -V or -G or --target-env
|
||||
" ERROR: filename:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(.\+\):\(\d\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'col' : 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
||||
\})
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
" Author: Ben Reedy <https://github.com/breed808>, Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: Adds support for the gometalinter suite for Go files
|
||||
|
||||
call ale#Set('go_gometalinter_options', '')
|
||||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||
call ale#Set('go_gometalinter_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
||||
|
||||
" 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#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?(warning|error):?\s\*?(.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
||||
" l:match[1] will already be an absolute path, output from gometalinter
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
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,
|
||||
\})
|
35
sources_non_forked/ale/ale_linters/markdown/marksman.vim
Normal file
35
sources_non_forked/ale/ale_linters/markdown/marksman.vim
Normal file
|
@ -0,0 +1,35 @@
|
|||
" Author: Peter Benjamin <petermbenjamin@gmail.com>
|
||||
" Description: Write Markdown with code assist and intelligence in the comfort of your favourite editor.
|
||||
|
||||
call ale#Set('markdown_marksman_executable', 'marksman')
|
||||
|
||||
function! ale_linters#markdown#marksman#GetCommand(buffer) abort
|
||||
return '%e server'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#marksman#GetProjectRoot(buffer) abort
|
||||
" Find nearest .marksman.toml
|
||||
let l:marksman_toml = ale#path#FindNearestFile(a:buffer, '.marksman.toml')
|
||||
|
||||
if !empty(l:marksman_toml)
|
||||
return fnamemodify(l:marksman_toml, ':h')
|
||||
endif
|
||||
|
||||
" Find nearest .git/ directory
|
||||
let l:project_root = finddir('.git/..', expand('#' . a:buffer . '...').';')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return l:project_root
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'marksman',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'markdown_marksman_executable')},
|
||||
\ 'command': function('ale_linters#markdown#marksman#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#markdown#marksman#GetProjectRoot'),
|
||||
\ 'initialization_options': {},
|
||||
\})
|
|
@ -3,50 +3,21 @@
|
|||
" nvim-lspconfig and volar/packages/shared/src/types.ts
|
||||
|
||||
call ale#Set('vue_volar_executable', 'vue-language-server')
|
||||
call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('vue_volar_use_global', 1)
|
||||
call ale#Set('vue_volar_init_options', {
|
||||
\ 'documentFeatures': {
|
||||
\ 'documentColor': v:false,
|
||||
\ 'documentFormatting': {
|
||||
\ 'defaultPrintWidth': 100,
|
||||
\ },
|
||||
\ 'documentSymbol': v:true,
|
||||
\ 'foldingRange': v:true,
|
||||
\ 'linkedEditingRange': v:true,
|
||||
\ 'selectionRange': v:true,
|
||||
\ },
|
||||
\ 'languageFeatures': {
|
||||
\ 'callHierarchy': v:true,
|
||||
\ 'codeAction': v:true,
|
||||
\ 'codeLens': v:true,
|
||||
\ 'completion': {
|
||||
\ 'defaultAttrNameCase': 'kebabCase',
|
||||
\ 'defaultTagNameCase': 'both',
|
||||
\ 'getDocumentNameCaseRequest': v:false,
|
||||
\ 'getDocumentSelectionRequest': v:false,
|
||||
\ },
|
||||
\ 'definition': v:true,
|
||||
\ 'diagnostics': v:true,
|
||||
\ 'documentHighlight': v:true,
|
||||
\ 'documentLink': v:true,
|
||||
\ 'hover': v:true,
|
||||
\ 'references': v:true,
|
||||
\ 'rename': v:true,
|
||||
\ 'renameFileRefactoring': v:true,
|
||||
\ 'schemaRequestService': v:true,
|
||||
\ 'semanticTokens': v:false,
|
||||
\ 'signatureHelp': v:true,
|
||||
\ 'typeDefinition': v:true,
|
||||
\ 'workspaceSymbol': v:false,
|
||||
\ },
|
||||
\ 'typescript': {
|
||||
\ 'serverPath': '',
|
||||
\ 'localizedPath': v:null,
|
||||
\ },
|
||||
\ 'typescript': { 'tsdk': '' },
|
||||
\})
|
||||
|
||||
function! ale_linters#vue#volar#GetProjectRoot(buffer) abort
|
||||
let l:project_roots = ['package.json', 'vite.config.js', '.git', bufname(a:buffer)]
|
||||
let l:project_roots = [
|
||||
\ 'package.json',
|
||||
\ 'vite.config.js',
|
||||
\ 'vite.config.mjs',
|
||||
\ 'vite.config.cjs',
|
||||
\ 'vite.config.ts',
|
||||
\ '.git',
|
||||
\ bufname(a:buffer)
|
||||
\]
|
||||
|
||||
for l:project_root in l:project_roots
|
||||
let l:nearest_filepath = ale#path#FindNearestFile(a:buffer, l:project_root)
|
||||
|
@ -60,11 +31,19 @@ function! ale_linters#vue#volar#GetProjectRoot(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#vue#volar#GetInitializationOptions(buffer) abort
|
||||
let l:tsserver_path = ale#path#FindNearestExecutable(a:buffer, [
|
||||
\ 'node_modules/typescript/lib/tsserverlibrary.js'
|
||||
\ ])
|
||||
let l:tsserver_path = ale#path#FindNearestDirectory(a:buffer, 'node_modules/typescript/lib')
|
||||
|
||||
if l:tsserver_path is# ''
|
||||
" no-custom-checks
|
||||
echohl WarningMsg
|
||||
" no-custom-checks
|
||||
echom '[volar] Must have typescript installed in project, please install via `npm install -D typescript`.'
|
||||
" no-custom-checks
|
||||
echohl None
|
||||
endif
|
||||
|
||||
let l:init_options = ale#Var(a:buffer, 'vue_volar_init_options')
|
||||
let l:init_options.typescript.serverPath = l:tsserver_path
|
||||
let l:init_options.typescript.tsdk = l:tsserver_path
|
||||
|
||||
return l:init_options
|
||||
endfunction
|
||||
|
|
|
@ -12,8 +12,10 @@ let s:cursor_timer = -1
|
|||
|
||||
" A wrapper for echon so we can test messages we echo in Vader tests.
|
||||
function! ale#cursor#Echom(message) abort
|
||||
if mode() is# 'n'
|
||||
" no-custom-checks
|
||||
exec "norm! :echom a:message\n"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
|
|
|
@ -179,7 +179,12 @@ let s:default_registry = {
|
|||
\ 'yamlfix': {
|
||||
\ 'function': 'ale#fixers#yamlfix#Fix',
|
||||
\ 'suggested_filetypes': ['yaml'],
|
||||
\ 'description': 'Fix yaml files with yamlfix.',
|
||||
\ 'description': 'Fix YAML files with yamlfix.',
|
||||
\ },
|
||||
\ 'yamlfmt': {
|
||||
\ 'function': 'ale#fixers#yamlfmt#Fix',
|
||||
\ 'suggested_filetypes': ['yaml'],
|
||||
\ 'description': 'Format YAML files with yamlfmt.',
|
||||
\ },
|
||||
\ 'yapf': {
|
||||
\ 'function': 'ale#fixers#yapf#Fix',
|
||||
|
@ -615,6 +620,11 @@ let s:default_registry = {
|
|||
\ 'function': 'ale#fixers#npmgroovylint#Fix',
|
||||
\ 'suggested_filetypes': ['groovy'],
|
||||
\ 'description': 'Fix Groovy files with npm-groovy-fix.',
|
||||
\ },
|
||||
\ 'erb-formatter': {
|
||||
\ 'function': 'ale#fixers#erbformatter#Fix',
|
||||
\ 'suggested_filetypes': ['eruby'],
|
||||
\ 'description': 'Apply erb-formatter -w to eruby/erb files.',
|
||||
\ }
|
||||
\}
|
||||
|
||||
|
|
13
sources_non_forked/ale/autoload/ale/fixers/erbformatter.vim
Normal file
13
sources_non_forked/ale/autoload/ale/fixers/erbformatter.vim
Normal file
|
@ -0,0 +1,13 @@
|
|||
" Author: Arash Mousavi <arash-m>
|
||||
" Description: Support for ERB::Formetter https://github.com/nebulab/erb-formatter
|
||||
|
||||
call ale#Set('eruby_erbformatter_executable', 'erb-formatter')
|
||||
|
||||
function! ale#fixers#erbformatter#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_erbformatter_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' -w %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
|
@ -1,4 +1,4 @@
|
|||
" Author: Cyril Roelandt <tipecaml@gmail.com>
|
||||
" Author: Cyril Roelandt <tipecaml@gmail.com>, jiz4oh <me@jiz4oh.com>
|
||||
" Description: Integration of xmllint with ALE.
|
||||
|
||||
call ale#Set('xml_xmllint_executable', 'xmllint')
|
||||
|
@ -7,7 +7,14 @@ call ale#Set('xml_xmllint_indentsize', 2)
|
|||
|
||||
function! ale#fixers#xmllint#Fix(buffer) abort
|
||||
let l:executable = ale#Escape(ale#Var(a:buffer, 'xml_xmllint_executable'))
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
let l:filename = bufname(a:buffer)
|
||||
|
||||
if empty(l:filename)
|
||||
let l:filename = '%t'
|
||||
else
|
||||
let l:filename = ale#Escape(l:filename)
|
||||
endif
|
||||
|
||||
let l:command = l:executable . ' --format ' . l:filename
|
||||
|
||||
let l:indent = ale#Var(a:buffer, 'xml_xmllint_indentsize')
|
||||
|
|
20
sources_non_forked/ale/autoload/ale/fixers/yamlfmt.vim
Normal file
20
sources_non_forked/ale/autoload/ale/fixers/yamlfmt.vim
Normal file
|
@ -0,0 +1,20 @@
|
|||
" Author: https://github.com/Spixmaster
|
||||
" Description: Format YAML files with yamlfmt.
|
||||
|
||||
call ale#Set('yaml_yamlfmt_executable', 'yamlfmt')
|
||||
call ale#Set('yaml_yamlfmt_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('yaml_yamlfmt_options', '')
|
||||
|
||||
function! ale#fixers#yamlfmt#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'yaml_yamlfmt',
|
||||
\ ['yamlfmt']
|
||||
\)
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'yaml_yamlfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -in',
|
||||
\}
|
||||
endfunction
|
|
@ -37,6 +37,11 @@ function! s:NvimShow(lines, options) abort
|
|||
endif
|
||||
|
||||
" Execute commands in window context
|
||||
if exists('*win_execute')
|
||||
for l:command in get(a:options, 'commands', [])
|
||||
call win_execute(w:preview['id'], l:command)
|
||||
endfor
|
||||
else
|
||||
let l:parent_window = nvim_get_current_win()
|
||||
|
||||
call nvim_set_current_win(w:preview['id'])
|
||||
|
@ -46,6 +51,7 @@ function! s:NvimShow(lines, options) abort
|
|||
endfor
|
||||
|
||||
call nvim_set_current_win(l:parent_window)
|
||||
endif
|
||||
|
||||
" Return to parent context on move
|
||||
augroup ale_floating_preview_window
|
||||
|
|
|
@ -24,14 +24,19 @@ endfunction
|
|||
function! ale#handlers#cspell#Handle(buffer, lines) abort
|
||||
" Look for lines like the following:
|
||||
"
|
||||
" /home/user/repos/ale/README.md:723:48 - Unknown word (stylelint)
|
||||
let l:pattern = '\v^.*:(\d+):(\d+) - (.*)$'
|
||||
" /home/user/repos/ale/README.md:3:128 - Unknown word (Neovim)
|
||||
" match1: 3
|
||||
" match2: 128
|
||||
" match3: Unknown word (Neovim)
|
||||
" match4: Neovim
|
||||
let l:pattern = '\v^.*:(\d+):(\d+) - ([^\(]+\(([^\)]+)\).*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'end_col': l:match[2] + len(l:match[4]) - 1,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
|
|
|
@ -70,6 +70,18 @@ function! s:ConvertLanguageName(language) abort
|
|||
return a:language
|
||||
endfunction
|
||||
|
||||
" Cache syntax file (non-)existence to avoid calling globpath repeatedly.
|
||||
let s:syntax_file_exists_cache = {}
|
||||
|
||||
function! s:SyntaxFileExists(syntax_file) abort
|
||||
if !has_key(s:syntax_file_exists_cache, a:syntax_file)
|
||||
let s:syntax_file_exists_cache[a:syntax_file] =
|
||||
\ !empty(globpath(&runtimepath, a:syntax_file))
|
||||
endif
|
||||
|
||||
return s:syntax_file_exists_cache[a:syntax_file]
|
||||
endfunction
|
||||
|
||||
function! ale#hover#ParseLSPResult(contents) abort
|
||||
let l:includes = {}
|
||||
let l:highlights = []
|
||||
|
@ -160,10 +172,11 @@ function! ale#hover#ParseLSPResult(contents) abort
|
|||
let l:language = s:ConvertLanguageName(l:language)
|
||||
|
||||
if !empty(l:language)
|
||||
let l:includes[l:language] = printf(
|
||||
\ 'syntax/%s.vim',
|
||||
\ l:language,
|
||||
\)
|
||||
let l:syntax_file = printf('syntax/%s.vim', l:language)
|
||||
|
||||
if s:SyntaxFileExists(l:syntax_file)
|
||||
let l:includes[l:language] = l:syntax_file
|
||||
endif
|
||||
|
||||
let l:start = len(l:lines) + 1
|
||||
let l:end = l:start + len(l:marked_lines)
|
||||
|
|
|
@ -42,7 +42,7 @@ let s:default_ale_linters = {
|
|||
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
|
||||
\ 'go': ['gofmt', 'gopls', 'govet'],
|
||||
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'],
|
||||
\ 'groovy': ['npm-groovy-lint'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
|
|
|
@ -424,7 +424,7 @@ function! s:SendInitMessage(conn) abort
|
|||
\ 'completionItem': {
|
||||
\ 'snippetSupport': v:false,
|
||||
\ 'commitCharactersSupport': v:false,
|
||||
\ 'documentationFormat': ['plaintext'],
|
||||
\ 'documentationFormat': ['plaintext', 'markdown'],
|
||||
\ 'deprecatedSupport': v:false,
|
||||
\ 'preselectSupport': v:false,
|
||||
\ },
|
||||
|
@ -432,7 +432,7 @@ function! s:SendInitMessage(conn) abort
|
|||
\ },
|
||||
\ 'hover': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
\ 'contentFormat': ['plaintext'],
|
||||
\ 'contentFormat': ['plaintext', 'markdown'],
|
||||
\ },
|
||||
\ 'references': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
|
|
|
@ -87,7 +87,7 @@ execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info)
|
|||
\ . ' texthl=ALEInfoSign linehl=ALEInfoLine'
|
||||
sign define ALEDummySign text=\ texthl=SignColumn
|
||||
|
||||
if g:ale_sign_highlight_linenrs && has('nvim-0.3.2')
|
||||
if g:ale_sign_highlight_linenrs && (has('nvim-0.3.2') || has('patch-8.2.3874'))
|
||||
if !hlexists('ALEErrorSignLineNr')
|
||||
highlight link ALEErrorSignLineNr CursorLineNr
|
||||
endif
|
||||
|
|
|
@ -14,6 +14,19 @@ default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails
|
|||
5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on
|
||||
the result. To selectively enable a subset, see |g:ale_linters|.
|
||||
|
||||
|
||||
===============================================================================
|
||||
erb-formatter *ale-eruby-erbformatter*
|
||||
|
||||
g:ale_eruby_erbformatter_executable *g:ale_eruby_erbformatter_executable*
|
||||
*b:ale_eruby_erbformatter_executable*
|
||||
Type: |String|
|
||||
Default: `'erb-formatter'`
|
||||
|
||||
Override the invoked erb-formatter binary. This is useful for running
|
||||
erb-formatter from binstubs or a bundle.
|
||||
|
||||
|
||||
===============================================================================
|
||||
erblint *ale-eruby-erblint*
|
||||
|
||||
|
@ -40,7 +53,7 @@ ruumba *ale-eruby-ruumba*
|
|||
g:ale_eruby_ruumba_executable *g:ale_eruby_ruumba_executable*
|
||||
*b:ale_eruby_ruumba_executable*
|
||||
Type: |String|
|
||||
Default: `'ruumba`
|
||||
Default: `'ruumba'`
|
||||
|
||||
Override the invoked ruumba binary. This is useful for running ruumba
|
||||
from binstubs or a bundle.
|
||||
|
|
|
@ -5,20 +5,15 @@ ALE Go Integration *ale-go-options*
|
|||
===============================================================================
|
||||
Integration Information
|
||||
|
||||
The `gometalinter` linter is disabled by default. ALE enables `gofmt`,
|
||||
`gopls`, and `go vet` by default. It also supports `staticcheck, `go
|
||||
build`, `gosimple`, `golangserver`, and `golangci-lint`.
|
||||
ALE enables `gofmt`, `gopls` and `go vet` by default. It also supports `staticcheck`,
|
||||
`go build, ``gosimple`, `golangserver`, and `golangci-lint.
|
||||
|
||||
To enable `gometalinter`, update |g:ale_linters| as appropriate:
|
||||
To enable `golangci-lint`, update |g:ale_linters| as appropriate.
|
||||
A possible configuration is to enable golangci-lint and `gofmt:
|
||||
>
|
||||
" Enable all of the linters you want for Go.
|
||||
let g:ale_linters = {'go': ['gometalinter', 'gofmt']}
|
||||
let g:ale_linters = {'go': ['golangci-lint', 'gofmt']}
|
||||
<
|
||||
A possible configuration is to enable `gometalinter` and `gofmt` but paired
|
||||
with the `--fast` option, set by |g:ale_go_gometalinter_options|. This gets you
|
||||
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_executable*
|
||||
*b:ale_go_go_executable*
|
||||
|
@ -175,44 +170,6 @@ g:ale_go_golines_options *g:ale_go_golines_options*
|
|||
--max-length=100 (lines above 100 characters will be wrapped)
|
||||
|
||||
|
||||
===============================================================================
|
||||
gometalinter *ale-go-gometalinter*
|
||||
|
||||
`gometalinter` is a `lint_file` linter, which only lints files that are
|
||||
written to disk. This differs from the default behavior of linting the buffer.
|
||||
See: |ale-lint-file|
|
||||
|
||||
g:ale_go_gometalinter_executable *g:ale_go_gometalinter_executable*
|
||||
*b:ale_go_gometalinter_executable*
|
||||
Type: |String|
|
||||
Default: `'gometalinter'`
|
||||
|
||||
The executable that will be run for gometalinter.
|
||||
|
||||
|
||||
g:ale_go_gometalinter_options *g:ale_go_gometalinter_options*
|
||||
*b:ale_go_gometalinter_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to alter the command-line arguments to the
|
||||
gometalinter invocation.
|
||||
|
||||
Since `gometalinter` runs a number of linters that can consume a lot of
|
||||
resources it's recommended to set this option to a value of `--fast` if you
|
||||
use `gometalinter` as one of the linters in |g:ale_linters|. This disables a
|
||||
number of linters known to be slow or consume a lot of resources.
|
||||
|
||||
|
||||
g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package*
|
||||
*b:ale_go_gometalinter_lint_package*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
When set to `1`, the whole Go package will be checked instead of only the
|
||||
current file.
|
||||
|
||||
|
||||
===============================================================================
|
||||
gopls *ale-go-gopls*
|
||||
|
||||
|
|
|
@ -34,6 +34,17 @@ g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*
|
|||
This variable can be set to pass additional options to markdownlint.
|
||||
|
||||
|
||||
===============================================================================
|
||||
marksman *ale-markdown-marksman*
|
||||
|
||||
g:ale_markdown_marksman_executable *g:ale_markdown_marksman_executable*
|
||||
*b:ale_markdown_marksman_executable*
|
||||
Type: |String|
|
||||
Default: `'marksman'`
|
||||
|
||||
Override the invoked `marksman` binary.
|
||||
|
||||
|
||||
===============================================================================
|
||||
mdl *ale-markdown-mdl*
|
||||
|
||||
|
|
|
@ -60,8 +60,20 @@ g:ale_rust_analyzer_config *g:ale_rust_analyzer_config*
|
|||
Type: |Dictionary|
|
||||
Default: `{}`
|
||||
|
||||
Dictionary with configuration settings for rust-analyzer.
|
||||
Dictionary with configuration settings for rust-analyzer. Keys of the
|
||||
dictionary are components of configuration keys. For example:
|
||||
>
|
||||
let g:ale_rust_analyzer_config = {
|
||||
\ 'server': {
|
||||
\ 'extraEnv': { 'RUSTUP_TOOLCHAIN': 'stable' },
|
||||
\ }
|
||||
\}
|
||||
<
|
||||
corresponds to `rust-analyzer.server.extraEnv = { 'RUSTUP_TOOLCHAIN': 'stable' }`
|
||||
|
||||
For available configuration parameters, see the `rust-analyzer` manual:
|
||||
|
||||
https://rust-analyzer.github.io/manual.html#configuration
|
||||
|
||||
===============================================================================
|
||||
cargo *ale-rust-cargo*
|
||||
|
|
|
@ -175,6 +175,7 @@ Notes:
|
|||
* `elm-make`
|
||||
* Erb
|
||||
* `erb`
|
||||
* `erb-formatter`
|
||||
* `erblint`
|
||||
* `erubi`
|
||||
* `erubis`
|
||||
|
@ -213,7 +214,6 @@ Notes:
|
|||
* `golangci-lint`!!
|
||||
* `golangserver`
|
||||
* `golines`
|
||||
* `gometalinter`!!
|
||||
* `gopls`
|
||||
* `gosimple`!!
|
||||
* `gotype`!!
|
||||
|
@ -364,6 +364,7 @@ Notes:
|
|||
* `cspell`
|
||||
* `languagetool`!!
|
||||
* `markdownlint`!!
|
||||
* `marksman`
|
||||
* `mdl`
|
||||
* `pandoc`
|
||||
* `prettier`
|
||||
|
@ -698,6 +699,7 @@ Notes:
|
|||
* `swaglint`
|
||||
* `yaml-language-server`
|
||||
* `yamlfix`
|
||||
* `yamlfmt`
|
||||
* `yamllint`
|
||||
* YANG
|
||||
* `yang-lsp`
|
||||
|
|
|
@ -50,7 +50,7 @@ g:ale_vue_volar_executable *g:ale_vue_volar_executable*
|
|||
g:ale_vue_volar_use_global *g:ale_vue_volar_use_global*
|
||||
*b:ale_vue_volar_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
Default: `1`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
@ -58,7 +58,7 @@ g:ale_vue_volar_use_global *g:ale_vue_volar_use_global*
|
|||
g:vue_volar_init_options *g:ale_vue_volar_init_options*
|
||||
*b:ale_vue_volar_init_options*
|
||||
Type: |Dictionary|
|
||||
Default: `{ ... }`
|
||||
Default: `{ 'typescript': 'tsdk': '' }`
|
||||
|
||||
Default is too long to show here, take a look at it over
|
||||
`ale_linters/vue/volar.vim`
|
||||
|
|
|
@ -47,6 +47,7 @@ g:ale_yaml_actionlint_options *g:ale_yaml_actionlint_options*
|
|||
<
|
||||
Please note that passing `-format` as option is not supported at the moment.
|
||||
|
||||
|
||||
===============================================================================
|
||||
circleci *ale-yaml-circleci*
|
||||
|
||||
|
@ -242,6 +243,44 @@ g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global*
|
|||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
yamlfmt *ale-yaml-yamlfmt*
|
||||
|
||||
Website: https://github.com/google/yamlfmt
|
||||
|
||||
|
||||
Installation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Install yamlfmt:
|
||||
|
||||
See the website.
|
||||
|
||||
Options
|
||||
-------------------------------------------------------------------------------
|
||||
g:ale_yaml_yamlfmt_executable *g:ale_yaml_yamlfmt_executable*
|
||||
*b:ale_yaml_yamlfmt_executable*
|
||||
Type: |String|
|
||||
Default: `'yamlfmt'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_yaml_yamlfmt_options *g:ale_yaml_yamlfmt_options*
|
||||
*b:ale_yaml_yamlfmt_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass extra options to yamlfmt.
|
||||
|
||||
g:ale_yaml_yamlfmt_use_global *g:ale_yaml_yamlfmt_use_global*
|
||||
*b:ale_yaml_yamlfmt_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
yamllint *ale-yaml-yamllint*
|
||||
|
||||
|
|
|
@ -1641,7 +1641,7 @@ g:ale_linters *g:ale_linters*
|
|||
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
|
||||
\ 'go': ['gofmt', 'gopls', 'govet'],
|
||||
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'],
|
||||
\ 'groovy': ['npm-groovy-lint'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
|
@ -2409,7 +2409,7 @@ g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
|
|||
Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']`
|
||||
|
||||
A list of directory names to be used when searching upwards from Python
|
||||
files to discover virtulenv directories with.
|
||||
files to discover virtualenv directories with.
|
||||
|
||||
For directory named `'foo'`, ALE will search for `'foo/bin/activate'`
|
||||
(`foo\Scripts\activate\` on Windows) in all directories on and above the
|
||||
|
@ -2963,6 +2963,7 @@ documented in additional help files.
|
|||
erlfmt................................|ale-erlang-erlfmt|
|
||||
syntaxerl.............................|ale-erlang-syntaxerl|
|
||||
eruby...................................|ale-eruby-options|
|
||||
erb-formatter.........................|ale-eruby-erbformatter|
|
||||
erblint...............................|ale-eruby-erblint|
|
||||
ruumba................................|ale-eruby-ruumba|
|
||||
fish....................................|ale-fish-options|
|
||||
|
@ -2987,7 +2988,6 @@ documented in additional help files.
|
|||
golangci-lint.........................|ale-go-golangci-lint|
|
||||
golangserver..........................|ale-go-golangserver|
|
||||
golines...............................|ale-go-golines|
|
||||
gometalinter..........................|ale-go-gometalinter|
|
||||
gopls.................................|ale-go-gopls|
|
||||
govet.................................|ale-go-govet|
|
||||
revive................................|ale-go-revive|
|
||||
|
@ -3123,6 +3123,7 @@ documented in additional help files.
|
|||
cspell................................|ale-markdown-cspell|
|
||||
dprint................................|ale-markdown-dprint|
|
||||
markdownlint..........................|ale-markdown-markdownlint|
|
||||
marksman..............................|ale-markdown-marksman|
|
||||
mdl...................................|ale-markdown-mdl|
|
||||
pandoc................................|ale-markdown-pandoc|
|
||||
prettier..............................|ale-markdown-prettier|
|
||||
|
@ -3426,6 +3427,7 @@ documented in additional help files.
|
|||
swaglint..............................|ale-yaml-swaglint|
|
||||
yaml-language-server..................|ale-yaml-language-server|
|
||||
yamlfix...............................|ale-yaml-yamlfix|
|
||||
yamlfmt...............................|ale-yaml-yamlfmt|
|
||||
yamllint..............................|ale-yaml-yamllint|
|
||||
gitlablint............................|ale-yaml-gitlablint|
|
||||
yang....................................|ale-yang-options|
|
||||
|
|
|
@ -184,6 +184,7 @@ formatting.
|
|||
* [elm-make](https://github.com/elm/compiler)
|
||||
* Erb
|
||||
* [erb](https://apidock.com/ruby/ERB)
|
||||
* [erb-formatter](https://github.com/nebulab/erb-formatter)
|
||||
* [erblint](https://github.com/Shopify/erb-lint)
|
||||
* [erubi](https://github.com/jeremyevans/erubi)
|
||||
* [erubis](https://github.com/kwatch/erubis)
|
||||
|
@ -222,7 +223,6 @@ formatting.
|
|||
* [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk:
|
||||
* [golangserver](https://github.com/sourcegraph/go-langserver) :warning:
|
||||
* [golines](https://github.com/segmentio/golines)
|
||||
* [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk:
|
||||
* [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:
|
||||
|
@ -373,6 +373,7 @@ formatting.
|
|||
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
|
||||
* [languagetool](https://languagetool.org/) :floppy_disk:
|
||||
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
|
||||
* [marksman](https://github.com/artempyanykh/marksman)
|
||||
* [mdl](https://github.com/mivok/markdownlint)
|
||||
* [pandoc](https://pandoc.org)
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
|
@ -707,6 +708,7 @@ formatting.
|
|||
* [swaglint](https://github.com/byCedric/swaglint) :warning:
|
||||
* [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)
|
||||
* [yamlfix](https://lyz-code.github.io/yamlfix)
|
||||
* [yamlfmt](https://github.com/google/yamlfmt)
|
||||
* [yamllint](https://yamllint.readthedocs.io/)
|
||||
* YANG
|
||||
* [yang-lsp](https://github.com/theia-ide/yang-lsp)
|
||||
|
|
|
@ -116,10 +116,14 @@ fu! ctrlp#tag#accept(mode, str)
|
|||
if cmd != ''
|
||||
exe cmd
|
||||
en
|
||||
if exists('&cst')
|
||||
let save_cst = &cst
|
||||
set cst&
|
||||
en
|
||||
cal feedkeys(":".( utg ? fdcnt[2] : "" )."ta ".tg."\r", 'nt')
|
||||
if exists('&cst')
|
||||
let &cst = save_cst
|
||||
en
|
||||
el
|
||||
let ext = ""
|
||||
if fdcnt[1] < 2 && fdcnt[2]
|
||||
|
|
|
@ -91,23 +91,24 @@ let s:initialized = 0
|
|||
" }}}1
|
||||
|
||||
" shellslash handling {{{1
|
||||
function! s:DisableShellSlash() " {{{2
|
||||
function! s:DisableShellSlash(bufnr) " {{{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
|
||||
let l:shell = getbufvar(a:bufnr, '&shell')
|
||||
if has('win32') && empty(matchstr(l:shell, 'sh'))
|
||||
let s:old_shellslash = getbufvar(a:bufnr, '&shellslash')
|
||||
setbufvar(a:bufnr, '&shellslash', 0)
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:ResetShellSlash() " {{{2
|
||||
function! s:ResetShellSlash(bufnr) " {{{2
|
||||
" reset shellslash to the user-set value, if any
|
||||
if exists('s:old_shellslash')
|
||||
let &l:shellslash = s:old_shellslash
|
||||
setbufvar(a:bufnr, '&shellslash', s:old_shellslash)
|
||||
unlet! s:old_shellslash
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
@ -204,9 +205,20 @@ function! s:GetFilenames(path, filename) " {{{1
|
|||
return l:path_list
|
||||
endfunction " }}}1
|
||||
|
||||
function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
|
||||
let b:editorconfig_tried = 1
|
||||
function! s:UseConfigFiles(from_autocmd) abort " Apply config to the current buffer {{{1
|
||||
" from_autocmd is truthy if called from an autocmd, falsy otherwise.
|
||||
|
||||
" Get the properties of the buffer we are working on
|
||||
if a:from_autocmd
|
||||
let l:bufnr = str2nr(expand('<abuf>'))
|
||||
let l:buffer_name = expand('<afile>:p')
|
||||
let l:buffer_path = expand('<afile>:p:h')
|
||||
else
|
||||
let l:bufnr = bufnr('%')
|
||||
let l:buffer_name = expand('%:p')
|
||||
let l:buffer_path = expand('%:p:h')
|
||||
endif
|
||||
call setbufvar(l:bufnr, 'editorconfig_tried', 1)
|
||||
|
||||
" Only process normal buffers (do not treat help files as '.txt' files)
|
||||
" When starting Vim with a directory, the buftype might not yet be set:
|
||||
|
@ -219,19 +231,33 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
|
|||
if g:EditorConfig_enable_for_new_buf
|
||||
let l:buffer_name = getcwd() . "/."
|
||||
else
|
||||
if g:EditorConfig_verbose
|
||||
echo 'Skipping EditorConfig for unnamed buffer'
|
||||
endif
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists("b:EditorConfig_disable") && b:EditorConfig_disable
|
||||
if getbufvar(l:bufnr, 'EditorConfig_disable', 0)
|
||||
if g:EditorConfig_verbose
|
||||
echo 'Skipping EditorConfig for buffer "' . l:buffer_name . '"'
|
||||
echo 'EditorConfig disabled --- skipping buffer "' . l:buffer_name . '"'
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
" Ignore specific patterns
|
||||
for pattern in g:EditorConfig_exclude_patterns
|
||||
if l:buffer_name =~ pattern
|
||||
if g:EditorConfig_verbose
|
||||
echo 'Skipping EditorConfig for buffer "' . l:buffer_name .
|
||||
\ '" based on pattern "' . pattern . '"'
|
||||
endif
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Check if any .editorconfig does exist
|
||||
let l:conf_files = s:GetFilenames(expand('%:p:h'), '.editorconfig')
|
||||
let l:conf_files = s:GetFilenames(l:buffer_path, '.editorconfig')
|
||||
let l:conf_found = 0
|
||||
for conf_file in conf_files
|
||||
if filereadable(conf_file)
|
||||
|
@ -254,20 +280,13 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
|
|||
\ ' 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(l:buffer_name) == 0
|
||||
let b:editorconfig_applied = 1
|
||||
if s:UseConfigFiles_VimCore(l:bufnr, l:buffer_name) == 0
|
||||
call setbufvar(l:bufnr, 'editorconfig_applied', 1)
|
||||
endif
|
||||
elseif s:editorconfig_core_mode ==? 'external_command'
|
||||
call s:UseConfigFiles_ExternalCommand(l:buffer_name)
|
||||
let b:editorconfig_applied = 1
|
||||
call s:UseConfigFiles_ExternalCommand(l:bufnr, l:buffer_name)
|
||||
call setbufvar(l:bufnr, 'editorconfig_applied', 1)
|
||||
else
|
||||
echohl Error |
|
||||
\ echo "Unknown EditorConfig Core: " .
|
||||
|
@ -283,8 +302,8 @@ function! s:EditorConfigEnable(should_enable)
|
|||
augroup editorconfig
|
||||
autocmd!
|
||||
if a:should_enable
|
||||
autocmd BufNewFile,BufReadPost,BufFilePost * call s:UseConfigFiles()
|
||||
autocmd VimEnter,BufNew * call s:UseConfigFiles()
|
||||
autocmd BufNewFile,BufReadPost,BufFilePost * call s:UseConfigFiles(1)
|
||||
autocmd VimEnter,BufNew * call s:UseConfigFiles(1)
|
||||
endif
|
||||
augroup END
|
||||
endfunction
|
||||
|
@ -295,7 +314,7 @@ endfunction
|
|||
command! EditorConfigEnable call s:EditorConfigEnable(1)
|
||||
command! EditorConfigDisable call s:EditorConfigEnable(0)
|
||||
|
||||
command! EditorConfigReload call s:UseConfigFiles() " Reload EditorConfig files
|
||||
command! EditorConfigReload call s:UseConfigFiles(0) " Reload EditorConfig files
|
||||
" }}}2
|
||||
|
||||
" On startup, enable the autocommands
|
||||
|
@ -305,29 +324,29 @@ call s:EditorConfigEnable(1)
|
|||
|
||||
" UseConfigFiles function for different modes {{{1
|
||||
|
||||
function! s:UseConfigFiles_VimCore(target)
|
||||
function! s:UseConfigFiles_VimCore(bufnr, target)
|
||||
" Use the vimscript EditorConfig core
|
||||
try
|
||||
let l:config = editorconfig_core#handler#get_configurations(
|
||||
\ { 'target': a:target } )
|
||||
call s:ApplyConfig(l:config)
|
||||
call s:ApplyConfig(a:bufnr, l:config)
|
||||
return 0 " success
|
||||
catch
|
||||
return 1 " failure
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:UseConfigFiles_ExternalCommand(target)
|
||||
function! s:UseConfigFiles_ExternalCommand(bufnr, target)
|
||||
" Use external EditorConfig core (e.g., the C core)
|
||||
|
||||
call s:DisableShellSlash()
|
||||
call s:DisableShellSlash(a:bufnr)
|
||||
let l:exec_path = shellescape(s:editorconfig_exec_path)
|
||||
call s:ResetShellSlash()
|
||||
call s:ResetShellSlash(a:bufnr)
|
||||
|
||||
call s:SpawnExternalParser(l:exec_path, a:target)
|
||||
call s:SpawnExternalParser(a:bufnr, l:exec_path, a:target)
|
||||
endfunction
|
||||
|
||||
function! s:SpawnExternalParser(cmd, target) " {{{2
|
||||
function! s:SpawnExternalParser(bufnr, cmd, target) " {{{2
|
||||
" Spawn external EditorConfig. Used by s:UseConfigFiles_ExternalCommand()
|
||||
|
||||
let l:cmd = a:cmd
|
||||
|
@ -338,9 +357,9 @@ function! s:SpawnExternalParser(cmd, target) " {{{2
|
|||
|
||||
let l:config = {}
|
||||
|
||||
call s:DisableShellSlash()
|
||||
call s:DisableShellSlash(a:bufnr)
|
||||
let l:cmd = l:cmd . ' ' . shellescape(a:target)
|
||||
call s:ResetShellSlash()
|
||||
call s:ResetShellSlash(a:bufnr)
|
||||
|
||||
let l:parsing_result = split(system(l:cmd), '\v[\r\n]+')
|
||||
|
||||
|
@ -379,26 +398,68 @@ function! s:SpawnExternalParser(cmd, target) " {{{2
|
|||
let l:config[l:eq_left] = l:eq_right
|
||||
endfor
|
||||
|
||||
call s:ApplyConfig(l:config)
|
||||
call s:ApplyConfig(a:bufnr, l:config)
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
||||
" Set the buffer options {{{1
|
||||
function! s:SetCharset(bufnr, charset) abort " apply config['charset']
|
||||
|
||||
" Remember the buffer's state so we can set `nomodifed` at the end
|
||||
" if appropriate.
|
||||
let l:orig_fenc = getbufvar(a:bufnr, "&fileencoding")
|
||||
let l:orig_enc = getbufvar(a:bufnr, "&encoding")
|
||||
let l:orig_modified = getbufvar(a:bufnr, "&modified")
|
||||
|
||||
if a:charset == "utf-8"
|
||||
call setbufvar(a:bufnr, '&fileencoding', 'utf-8')
|
||||
call setbufvar(a:bufnr, '&bomb', 0)
|
||||
elseif a:charset == "utf-8-bom"
|
||||
call setbufvar(a:bufnr, '&fileencoding', 'utf-8')
|
||||
call setbufvar(a:bufnr, '&bomb', 1)
|
||||
elseif a:charset == "latin1"
|
||||
call setbufvar(a:bufnr, '&fileencoding', 'latin1')
|
||||
call setbufvar(a:bufnr, '&bomb', 0)
|
||||
elseif a:charset == "utf-16be"
|
||||
call setbufvar(a:bufnr, '&fileencoding', 'utf-16be')
|
||||
call setbufvar(a:bufnr, '&bomb', 1)
|
||||
elseif a:charset == "utf-16le"
|
||||
call setbufvar(a:bufnr, '&fileencoding', 'utf-16le')
|
||||
call setbufvar(a:bufnr, '&bomb', 1)
|
||||
endif
|
||||
|
||||
let l:new_fenc = getbufvar(a:bufnr, "&fileencoding")
|
||||
|
||||
" If all we did was change the fileencoding from the default to a copy
|
||||
" of the default, we didn't actually modify the file.
|
||||
if !l:orig_modified && (l:orig_fenc ==# '') && (l:new_fenc ==# l:orig_enc)
|
||||
if g:EditorConfig_verbose
|
||||
echo 'Setting nomodified on buffer ' . a:bufnr
|
||||
endif
|
||||
call setbufvar(a:bufnr, '&modified', 0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:ApplyConfig(bufnr, config) abort
|
||||
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
|
||||
call setbufvar(a:bufnr, '&expandtab', 0)
|
||||
elseif a:config["indent_style"] == "space"
|
||||
setl expandtab
|
||||
call setbufvar(a:bufnr, '&expandtab', 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:IsRuleActive('tab_width', a:config)
|
||||
let &l:tabstop = str2nr(a:config["tab_width"])
|
||||
let l:tabstop = str2nr(a:config["tab_width"])
|
||||
call setbufvar(a:bufnr, '&tabstop', l:tabstop)
|
||||
else
|
||||
" Grab the current ts so we can use it below
|
||||
let l:tabstop = getbufvar(a:bufnr, '&tabstop')
|
||||
endif
|
||||
|
||||
if s:IsRuleActive('indent_size', a:config)
|
||||
|
@ -406,18 +467,20 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
|||
" if indent_size is a positive integer, set shiftwidth to the integer
|
||||
" value
|
||||
if a:config["indent_size"] == "tab"
|
||||
let &l:shiftwidth = &l:tabstop
|
||||
call setbufvar(a:bufnr, '&shiftwidth', l:tabstop)
|
||||
if type(g:EditorConfig_softtabstop_tab) != type([])
|
||||
let &l:softtabstop = g:EditorConfig_softtabstop_tab > 0 ?
|
||||
\ &l:shiftwidth : g:EditorConfig_softtabstop_tab
|
||||
call setbufvar(a:bufnr, '&softtabstop',
|
||||
\ g:EditorConfig_softtabstop_tab > 0 ?
|
||||
\ l:tabstop : g:EditorConfig_softtabstop_tab)
|
||||
endif
|
||||
else
|
||||
let l:indent_size = str2nr(a:config["indent_size"])
|
||||
if l:indent_size > 0
|
||||
let &l:shiftwidth = l:indent_size
|
||||
call setbufvar(a:bufnr, '&shiftwidth', l:indent_size)
|
||||
if type(g:EditorConfig_softtabstop_space) != type([])
|
||||
let &l:softtabstop = g:EditorConfig_softtabstop_space > 0 ?
|
||||
\ &l:shiftwidth : g:EditorConfig_softtabstop_space
|
||||
call setbufvar(a:bufnr, '&softtabstop',
|
||||
\ g:EditorConfig_softtabstop_space > 0 ?
|
||||
\ l:indent_size : g:EditorConfig_softtabstop_space)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -425,50 +488,35 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
|||
endif
|
||||
|
||||
if s:IsRuleActive('end_of_line', a:config) &&
|
||||
\ &l:modifiable
|
||||
\ getbufvar(a:bufnr, '&modifiable')
|
||||
if a:config["end_of_line"] == "lf"
|
||||
setl fileformat=unix
|
||||
call setbufvar(a:bufnr, '&fileformat', 'unix')
|
||||
elseif a:config["end_of_line"] == "crlf"
|
||||
setl fileformat=dos
|
||||
call setbufvar(a:bufnr, '&fileformat', 'dos')
|
||||
elseif a:config["end_of_line"] == "cr"
|
||||
setl fileformat=mac
|
||||
call setbufvar(a:bufnr, '&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
|
||||
\ getbufvar(a:bufnr, '&modifiable')
|
||||
call s:SetCharset(a:bufnr, a:config["charset"])
|
||||
endif
|
||||
|
||||
augroup editorconfig_trim_trailing_whitespace
|
||||
autocmd! BufWritePre <buffer>
|
||||
if s:IsRuleActive('trim_trailing_whitespace', a:config) &&
|
||||
\ get(a:config, 'trim_trailing_whitespace', 'false') ==# 'true'
|
||||
autocmd BufWritePre <buffer> call s:TrimTrailingWhitespace()
|
||||
execute 'autocmd BufWritePre <buffer=' . a:bufnr . '> 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
|
||||
call setbufvar(a:bufnr, '&fixendofline', 0)
|
||||
else
|
||||
setl fixendofline
|
||||
call setbufvar(a:bufnr, '&fixendofline', 1)
|
||||
endif
|
||||
elseif exists(':SetNoEOL') == 2
|
||||
if a:config["insert_final_newline"] == "false"
|
||||
|
@ -483,23 +531,39 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
|||
let l:max_line_length = str2nr(a:config['max_line_length'])
|
||||
|
||||
if l:max_line_length >= 0
|
||||
let &l:textwidth = l:max_line_length
|
||||
call setbufvar(a:bufnr, '&textwidth', l:max_line_length)
|
||||
if g:EditorConfig_preserve_formatoptions == 0
|
||||
setlocal formatoptions+=tc
|
||||
" setlocal formatoptions+=tc
|
||||
let l:fo = getbufvar(a:bufnr, '&formatoptions')
|
||||
if l:fo !~# 't'
|
||||
let l:fo .= 't'
|
||||
endif
|
||||
if l:fo !~# 'c'
|
||||
let l:fo .= 'c'
|
||||
endif
|
||||
call setbufvar(a:bufnr, '&formatoptions', l:fo)
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('+colorcolumn')
|
||||
if l:max_line_length > 0
|
||||
if g:EditorConfig_max_line_indicator == 'line'
|
||||
setlocal colorcolumn+=+1
|
||||
" setlocal colorcolumn+=+1
|
||||
let l:cocol = getbufvar(a:bufnr, '&colorcolumn')
|
||||
if !empty(l:cocol)
|
||||
let l:cocol .= ','
|
||||
endif
|
||||
let l:cocol .= '+1'
|
||||
call setbufvar(a:bufnr, '&colorcolumn', l:cocol)
|
||||
elseif g:EditorConfig_max_line_indicator == 'fill' &&
|
||||
\ l:max_line_length < &l:columns
|
||||
\ l:max_line_length < getbufvar(a:bufnr, '&columns')
|
||||
" Fill only if the columns of screen is large enough
|
||||
let &l:colorcolumn = join(
|
||||
\ range(l:max_line_length+1,&l:columns),',')
|
||||
call setbufvar(a:bufnr, '&colorcolumn',
|
||||
\ join(range(l:max_line_length+1,
|
||||
\ getbufvar(a:bufnr, '&columns')),
|
||||
\ ','))
|
||||
elseif g:EditorConfig_max_line_indicator == 'exceeding'
|
||||
let &l:colorcolumn = ''
|
||||
call setbufvar(a:bufnr, '&colorcolumn', '')
|
||||
for l:match in getmatches()
|
||||
if get(l:match, 'group', '') == 'ColorColumn'
|
||||
call matchdelete(get(l:match, 'id'))
|
||||
|
@ -527,7 +591,8 @@ endfunction
|
|||
" }}}1
|
||||
|
||||
function! s:TrimTrailingWhitespace() " {{{1
|
||||
if &l:modifiable
|
||||
" Called from within a buffer-specific autocmd, so we can use '%'
|
||||
if getbufvar('%', '&modifiable')
|
||||
" don't lose user position when trimming trailing whitespace
|
||||
let s:view = winsaveview()
|
||||
try
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!--p align="center"><img src="http://svgur.com/i/3Dp.svg"></p-->
|
||||
<p align="center"><img src="https://morhetz.com/gruvbox.svg"></p>
|
||||
|
||||
gruvbox is heavily inspired by [badwolf][], [jellybeans][] and [solarized][].
|
||||
|
||||
|
|
|
@ -2884,6 +2884,24 @@ function! fugitive#BufReadStatus(...) abort
|
|||
endfor
|
||||
endif
|
||||
|
||||
let sequencing = []
|
||||
if filereadable(fugitive#Find('.git/sequencer/todo'))
|
||||
for line in reverse(readfile(fugitive#Find('.git/sequencer/todo')))
|
||||
let match = matchlist(line, '^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)')
|
||||
if len(match) && match[1] !~# 'exec\|merge\|label'
|
||||
call add(sequencing, {'type': 'Rebase', 'status': get(s:rebase_abbrevs, match[1], match[1]), 'commit': match[2], 'subject': match[3]})
|
||||
endif
|
||||
endfor
|
||||
elseif filereadable(fugitive#Find('.git/MERGE_MSG'))
|
||||
if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD'))
|
||||
let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--']).stdout[0]
|
||||
call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG')), 0, '')})
|
||||
elseif filereadable(fugitive#Find('.git/REVERT_HEAD'))
|
||||
let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--']).stdout[0]
|
||||
call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG')), 0, '')})
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:fugitive_diff = diff
|
||||
if get(a:, 1, v:cmdbang)
|
||||
unlet! b:fugitive_expanded
|
||||
|
@ -2910,6 +2928,7 @@ function! fugitive#BufReadStatus(...) abort
|
|||
endif
|
||||
|
||||
call s:AddSection('Rebasing ' . rebasing_head, rebasing)
|
||||
call s:AddSection(get(get(sequencing, 0, {}), 'status', '') ==# 'revert' ? 'Reverting' : 'Cherry Picking', sequencing)
|
||||
call s:AddSection('Untracked', untracked)
|
||||
call s:AddSection('Unstaged', unstaged)
|
||||
let unstaged_end = len(unstaged) ? line('$') : 0
|
||||
|
|
|
@ -248,7 +248,9 @@ function! s:hunk_op(op, ...)
|
|||
|
||||
let hunk_diff = join(hunk_header + hunk_body, "\n")."\n"
|
||||
|
||||
if &previewwindow
|
||||
call s:goto_original_window()
|
||||
endif
|
||||
call gitgutter#hunk#close_hunk_preview_window()
|
||||
call s:stage(hunk_diff)
|
||||
endif
|
||||
|
@ -460,18 +462,16 @@ function! s:open_hunk_preview_window()
|
|||
call nvim_buf_set_option(buf, 'swapfile', v:false)
|
||||
call nvim_buf_set_name(buf, 'gitgutter://hunk-preview')
|
||||
|
||||
if g:gitgutter_close_preview_on_escape
|
||||
let winnr = nvim_win_get_number(s:winid)
|
||||
execute winnr.'wincmd w'
|
||||
nnoremap <buffer> <silent> <Esc> :<C-U>call gitgutter#hunk#close_hunk_preview_window()<CR>
|
||||
wincmd w
|
||||
endif
|
||||
|
||||
" Assumes cursor is in original window.
|
||||
autocmd CursorMoved,TabLeave <buffer> ++once call gitgutter#hunk#close_hunk_preview_window()
|
||||
|
||||
if g:gitgutter_close_preview_on_escape
|
||||
" Map <Esc> to close the floating preview.
|
||||
nnoremap <buffer> <silent> <Esc> :<C-U>call gitgutter#hunk#close_hunk_preview_window()<CR>
|
||||
" Ensure that when the preview window is closed, the map is removed.
|
||||
autocmd User GitGutterPreviewClosed silent! nunmap <buffer> <Esc>
|
||||
autocmd CursorMoved <buffer> ++once silent! nunmap <buffer> <Esc>
|
||||
execute "autocmd WinClosed <buffer=".winbufnr(s:winid)."> doautocmd" s:nomodeline "User GitGutterPreviewClosed"
|
||||
endif
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ function! gitgutter#utility#setbufvar(buffer, varname, val)
|
|||
endfunction
|
||||
|
||||
function! gitgutter#utility#getbufvar(buffer, varname, ...)
|
||||
let ggvars = getbufvar(a:buffer, 'gitgutter')
|
||||
let buffer = +a:buffer
|
||||
let ggvars = getbufvar(buffer, 'gitgutter')
|
||||
if type(ggvars) == type({}) && has_key(ggvars, a:varname)
|
||||
return ggvars[a:varname]
|
||||
endif
|
||||
|
|
|
@ -265,6 +265,35 @@ function! s:next_tick(cmd)
|
|||
call timer_start(1, {-> execute(a:cmd)})
|
||||
endfunction
|
||||
|
||||
function! s:on_buffilepre(bufnr)
|
||||
if !exists('s:renaming')
|
||||
let s:renaming = []
|
||||
let s:gitgutter_was_enabled = gitgutter#utility#getbufvar(a:bufnr, 'enabled')
|
||||
endif
|
||||
|
||||
let s:renaming += [a:bufnr]
|
||||
endfunction
|
||||
|
||||
function! s:on_buffilepost(bufnr)
|
||||
if len(s:renaming) > 1
|
||||
if s:renaming[0] != a:bufnr
|
||||
throw 'gitgutter rename error' s:renaming[0] a:bufnr
|
||||
endif
|
||||
unlet s:renaming[0]
|
||||
return
|
||||
endif
|
||||
|
||||
" reset cached values
|
||||
GitGutterBufferDisable
|
||||
|
||||
if s:gitgutter_was_enabled
|
||||
GitGutterBufferEnable
|
||||
endif
|
||||
|
||||
unlet s:renaming
|
||||
unlet s:gitgutter_was_enabled
|
||||
endfunction
|
||||
|
||||
" Autocommands {{{
|
||||
|
||||
augroup gitgutter
|
||||
|
@ -309,8 +338,8 @@ augroup gitgutter
|
|||
|
||||
autocmd ColorScheme * call gitgutter#highlight#define_highlights()
|
||||
|
||||
autocmd BufFilePre * let b:gitgutter_was_enabled = gitgutter#utility#getbufvar(expand('<abuf>'), 'enabled') | GitGutterBufferDisable
|
||||
autocmd BufFilePost * if b:gitgutter_was_enabled | GitGutterBufferEnable | endif | unlet b:gitgutter_was_enabled
|
||||
autocmd BufFilePre * call s:on_buffilepre(expand('<abuf>'))
|
||||
autocmd BufFilePost * call s:on_buffilepost(expand('<abuf>'))
|
||||
|
||||
autocmd QuickFixCmdPre *vimgrep* let b:gitgutter_was_enabled = gitgutter#utility#getbufvar(expand('<abuf>'), 'enabled') | GitGutterBufferDisable
|
||||
autocmd QuickFixCmdPost *vimgrep* if b:gitgutter_was_enabled | GitGutterBufferEnable | endif | unlet b:gitgutter_was_enabled
|
||||
|
|
|
@ -251,6 +251,35 @@ function Test_filename_umlaut()
|
|||
endfunction
|
||||
|
||||
|
||||
function Test_file_cmd()
|
||||
normal ggo*
|
||||
|
||||
file other.txt
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal(1, b:gitgutter.enabled)
|
||||
call assert_equal('', b:gitgutter.path)
|
||||
call s:assert_signs([], 'other.txt')
|
||||
|
||||
write
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal(-2, b:gitgutter.path)
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_saveas()
|
||||
normal ggo*
|
||||
|
||||
saveas other.txt
|
||||
|
||||
call s:trigger_gitgutter()
|
||||
call assert_equal(1, b:gitgutter.enabled)
|
||||
call assert_equal(-2, b:gitgutter.path)
|
||||
call s:assert_signs([], 'other.txt')
|
||||
endfunction
|
||||
|
||||
|
||||
" FIXME: this test fails when it is the first (or only) test to be run
|
||||
function Test_follow_symlink()
|
||||
let tmp = 'symlink'
|
||||
|
|
|
@ -63,7 +63,6 @@ vim-indent-guides https://github.com/nathanaelkane/vim-indent-guides
|
|||
mru.vim https://github.com/vim-scripts/mru.vim
|
||||
editorconfig-vim https://github.com/editorconfig/editorconfig-vim
|
||||
dracula https://github.com/dracula/vim
|
||||
co-pilot.vim https://github.com/github/copilot.vim
|
||||
""".strip()
|
||||
|
||||
GITHUB_ZIP = "%s/archive/master.zip"
|
||||
|
|
Loading…
Reference in a new issue