Updated plugins
This commit is contained in:
parent
597b7acdc0
commit
e19ae5588a
28 changed files with 297 additions and 103 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
call ale#Set('go_staticcheck_executable', 'staticcheck')
|
||||
call ale#Set('go_staticcheck_options', '')
|
||||
call ale#Set('go_staticcheck_lint_package', 0)
|
||||
call ale#Set('go_staticcheck_lint_package', 1)
|
||||
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||
|
|
|
@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
|||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
|
@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
|||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
|
|
|
@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
|||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
|
||||
if empty(l:level) && empty(l:config_file_exists)
|
||||
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
|
||||
" if no configuration file is found, then use 4 as a default level
|
||||
let l:level = '4'
|
||||
endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
" Author: Eric Zhao <21zhaoe@protonmail.com>
|
||||
" Author: ourigen <https://github.com/ourigen>
|
||||
" Description: Implementation of the Language Server Protocol for R.
|
||||
|
||||
call ale#Set('r_languageserver_cmd', 'languageserver::run()')
|
||||
|
@ -7,7 +8,7 @@ call ale#Set('r_languageserver_config', {})
|
|||
function! ale_linters#r#languageserver#GetCommand(buffer) abort
|
||||
let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd')
|
||||
|
||||
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string)
|
||||
return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort
|
||||
|
|
|
@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort
|
|||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[2],
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:match[4] + 0,
|
||||
\ 'type': 'E',
|
||||
|
|
|
@ -1,34 +1,52 @@
|
|||
" Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
|
||||
" Description: Report solc compiler errors in Solidity code
|
||||
|
||||
call ale#Set('solidity_solc_executable', 'solc')
|
||||
call ale#Set('solidity_solc_options', '')
|
||||
|
||||
function! ale_linters#solidity#solc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" /path/to/file/file.sol:1:10: Error: Identifier not found or not unique.
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$'
|
||||
" Error: Expected ';' but got '('
|
||||
" --> /path/to/file/file.sol:1:10:)
|
||||
let l:pattern = '\v(Error|Warning): (.*)$'
|
||||
let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:isError = l:match[3] is? 'error'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
let l:match = matchlist(l:line, l:line_and_column_pattern)
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:index = len(l:output) - 1
|
||||
let l:output[l:index]['lnum'] = l:match[1] + 0
|
||||
let l:output[l:index]['col'] = l:match[2] + 0
|
||||
endif
|
||||
else
|
||||
let l:isError = l:match[1] is? 'Error'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#solidity#solc#GetCommand(buffer) abort
|
||||
return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
|
||||
let l:executable = ale#Var(a:buffer, 'solidity_solc_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solc',
|
||||
\ 'executable': 'solc',
|
||||
\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')},
|
||||
\ 'command': function('ale_linters#solidity#solc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#solidity#solc#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
|
|
|
@ -29,11 +29,18 @@
|
|||
call ale#Set('spec_rpmlint_executable', 'rpmlint')
|
||||
call ale#Set('spec_rpmlint_options', '')
|
||||
|
||||
function! ale_linters#spec#rpmlint#GetCommand(buffer) abort
|
||||
function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort
|
||||
if ale#semver#GTE(a:version, [2, 0, 0])
|
||||
" The -o/--option flag was removed in version 2.0.0
|
||||
let l:version_dependent_args = ''
|
||||
else
|
||||
let l:version_dependent_args = ' -o "NetworkEnabled False"'
|
||||
endif
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options'))
|
||||
\ . ' -o "NetworkEnabled False"'
|
||||
\ . ' -v'
|
||||
\ . l:version_dependent_args
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
@ -73,6 +80,11 @@ endfunction
|
|||
call ale#linter#Define('spec', {
|
||||
\ 'name': 'rpmlint',
|
||||
\ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')},
|
||||
\ 'command': function('ale_linters#spec#rpmlint#GetCommand'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale#Var(buffer, 'spec_rpmlint_executable'),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#spec#rpmlint#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#spec#rpmlint#Handle',
|
||||
\})
|
||||
|
|
|
@ -151,8 +151,6 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
|
|||
\ || stridx(l:option, '-isystem') == 0
|
||||
\ || stridx(l:option, '-idirafter') == 0
|
||||
\ || stridx(l:option, '-iframework') == 0
|
||||
\ || stridx(l:option, '-include') == 0
|
||||
\ || stridx(l:option, '-imacros') == 0
|
||||
if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
|
||||
let l:arg = join(split(l:option, '\zs')[2:], '')
|
||||
let l:option = '-I'
|
||||
|
@ -182,6 +180,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
|
|||
" Options that have an argument (always separate)
|
||||
elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0
|
||||
\ || l:option is# '-isysroot' || l:option is# '-imultilib'
|
||||
\ || l:option is# '-include' || l:option is# '-imacros'
|
||||
call add(l:items, [0, l:option])
|
||||
call add(l:items, [0, l:arguments[l:option_index]])
|
||||
let l:option_index = l:option_index + 1
|
||||
|
|
|
@ -316,6 +316,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['reason'],
|
||||
\ 'description': 'Fix ReasonML files with refmt.',
|
||||
\ },
|
||||
\ 'pandoc': {
|
||||
\ 'function': 'ale#fixers#pandoc#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with pandoc.',
|
||||
\ },
|
||||
\ 'shfmt': {
|
||||
\ 'function': 'ale#fixers#shfmt#Fix',
|
||||
\ 'suggested_filetypes': ['sh'],
|
||||
|
@ -441,6 +446,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with luafmt.',
|
||||
\ },
|
||||
\ 'stylua': {
|
||||
\ 'function': 'ale#fixers#stylua#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with stylua.',
|
||||
\ },
|
||||
\ 'ormolu': {
|
||||
\ 'function': 'ale#fixers#ormolu#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
|
|
|
@ -18,20 +18,25 @@ endfunction
|
|||
|
||||
function! ale#fixers#black#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
\ ? ' run black'
|
||||
\ : ''
|
||||
let l:options = ale#Var(a:buffer, 'python_black_options')
|
||||
let l:cmd = [ale#Escape(l:executable)]
|
||||
|
||||
if expand('#' . a:buffer . ':e') is? 'pyi'
|
||||
let l:options .= '--pyi'
|
||||
if l:executable =~? 'pipenv$'
|
||||
call extend(l:cmd, ['run', 'black'])
|
||||
endif
|
||||
|
||||
let l:result = {
|
||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -',
|
||||
\}
|
||||
let l:options = ale#Var(a:buffer, 'python_black_options')
|
||||
|
||||
if !empty(l:options)
|
||||
call add(l:cmd, l:options)
|
||||
endif
|
||||
|
||||
if expand('#' . a:buffer . ':e') is? 'pyi'
|
||||
call add(l:cmd, '--pyi')
|
||||
endif
|
||||
|
||||
call add(l:cmd, '-')
|
||||
|
||||
let l:result = {'command': join(l:cmd, ' ')}
|
||||
|
||||
if ale#Var(a:buffer, 'python_black_change_directory')
|
||||
let l:result.cwd = '%s:h'
|
||||
|
|
16
sources_non_forked/ale/autoload/ale/fixers/pandoc.vim
Normal file
16
sources_non_forked/ale/autoload/ale/fixers/pandoc.vim
Normal file
|
@ -0,0 +1,16 @@
|
|||
scriptencoding utf-8
|
||||
" Author: Jesse Hathaway <jesse@mbuki-mvuki.org>
|
||||
" Description: Fix markdown files with pandoc.
|
||||
|
||||
call ale#Set('markdown_pandoc_executable', 'pandoc')
|
||||
call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -')
|
||||
|
||||
function! ale#fixers#pandoc#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable')
|
||||
let l:options = ale#Var(a:buffer, 'markdown_pandoc_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . l:options,
|
||||
\}
|
||||
endfunction
|
14
sources_non_forked/ale/autoload/ale/fixers/stylua.vim
Normal file
14
sources_non_forked/ale/autoload/ale/fixers/stylua.vim
Normal file
|
@ -0,0 +1,14 @@
|
|||
" Author: Robert Liebowitz <rliebz@gmail.com>
|
||||
" Description: https://github.com/johnnymorganz/stylua
|
||||
|
||||
call ale#Set('lua_stylua_executable', 'stylua')
|
||||
call ale#Set('lua_stylua_options', '')
|
||||
|
||||
function! ale#fixers#stylua#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'lua_stylua_executable')
|
||||
let l:options = ale#Var(a:buffer, 'lua_stylua_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -',
|
||||
\}
|
||||
endfunction
|
|
@ -44,6 +44,15 @@ function! s:ShouldOpen(buffer) abort
|
|||
return l:val is 1 || (l:val is# 'on_save' && l:saved)
|
||||
endfunction
|
||||
|
||||
function! s:Deduplicate(list) abort
|
||||
let l:list = a:list
|
||||
|
||||
call sort(l:list, function('ale#util#LocItemCompareWithText'))
|
||||
call uniq(l:list, function('ale#util#LocItemCompareWithText'))
|
||||
|
||||
return l:list
|
||||
endfunction
|
||||
|
||||
function! ale#list#GetCombinedList() abort
|
||||
let l:list = []
|
||||
|
||||
|
@ -51,10 +60,7 @@ function! ale#list#GetCombinedList() abort
|
|||
call extend(l:list, l:info.loclist)
|
||||
endfor
|
||||
|
||||
call sort(l:list, function('ale#util#LocItemCompareWithText'))
|
||||
call uniq(l:list, function('ale#util#LocItemCompareWithText'))
|
||||
|
||||
return l:list
|
||||
return s:Deduplicate(l:list)
|
||||
endfunction
|
||||
|
||||
function! s:FixList(buffer, list) abort
|
||||
|
@ -99,11 +105,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
|
|||
" but it's better than nothing.
|
||||
let l:ids = s:WinFindBuf(a:buffer)
|
||||
|
||||
let l:loclist = s:Deduplicate(a:loclist)
|
||||
|
||||
for l:id in l:ids
|
||||
if has('nvim')
|
||||
call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title)
|
||||
call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title)
|
||||
else
|
||||
call setloclist(l:id, s:FixList(a:buffer, a:loclist))
|
||||
call setloclist(l:id, s:FixList(a:buffer, l:loclist))
|
||||
call setloclist(l:id, [], 'r', {'title': l:title})
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Preview windows for showing whatever information in.
|
||||
|
||||
if !has_key(s:, 'last__list')
|
||||
if !has_key(s:, 'last_list')
|
||||
let s:last_list = []
|
||||
endif
|
||||
|
||||
|
@ -89,6 +89,13 @@ function! ale#preview#ShowSelection(item_list, ...) abort
|
|||
let b:ale_preview_item_list = a:item_list
|
||||
let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer')
|
||||
|
||||
" Jump to an index for a previous selection, if set.
|
||||
if has_key(l:options, 'jump_to_index')
|
||||
let l:pos = getpos('.')
|
||||
let l:pos[1] = l:options.jump_to_index + 1
|
||||
call setpos('.', l:pos)
|
||||
endif
|
||||
|
||||
" Remember preview state, so we can repeat it later.
|
||||
call ale#preview#SetLastSelection(a:item_list, l:options)
|
||||
endfunction
|
||||
|
@ -101,12 +108,16 @@ endfunction
|
|||
|
||||
function! s:Open(open_in) abort
|
||||
let l:item_list = get(b:, 'ale_preview_item_list', [])
|
||||
let l:item = get(l:item_list, getpos('.')[1] - 1, {})
|
||||
let l:index = getpos('.')[1] - 1
|
||||
let l:item = get(l:item_list, l:index, {})
|
||||
|
||||
if empty(l:item)
|
||||
return
|
||||
endif
|
||||
|
||||
" Remember an index to jump to when repeating a selection.
|
||||
let s:last_options.jump_to_index = l:index
|
||||
|
||||
:q!
|
||||
|
||||
call ale#util#Open(
|
||||
|
|
|
@ -46,5 +46,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options*
|
|||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to the luafmt fixer.
|
||||
|
||||
|
||||
===============================================================================
|
||||
stylua *ale-lua-stylua*
|
||||
|
||||
g:ale_lua_stylua_executable *g:ale_lua_stylua_executable*
|
||||
*b:ale_lua_stylua_executable*
|
||||
Type: |String|
|
||||
Default: `'stylua'`
|
||||
|
||||
This variable can be set to use a different executable for stylua.
|
||||
|
||||
g:ale_lua_stylua_options *g:ale_lua_stylua_options*
|
||||
*b:ale_lua_stylua_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to the stylua fixer.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -33,6 +33,25 @@ g:ale_markdown_mdl_options *g:ale_markdown_mdl_options*
|
|||
This variable can be set to pass additional options to mdl.
|
||||
|
||||
|
||||
===============================================================================
|
||||
pandoc *ale-markdown-pandoc*
|
||||
|
||||
g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable*
|
||||
*b:ale_markdown_pandoc_executable*
|
||||
Type: |String|
|
||||
Default: `'pandoc'`
|
||||
|
||||
This variable can be set to specify where to find the pandoc executable
|
||||
|
||||
|
||||
g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options*
|
||||
*b:ale_markdown_pandoc_options*
|
||||
Type: |String|
|
||||
Default: `'-f gfm -t gfm -s -'`
|
||||
|
||||
This variable can be set to change the default options passed to pandoc
|
||||
|
||||
|
||||
===============================================================================
|
||||
prettier *ale-markdown-prettier*
|
||||
|
||||
|
|
|
@ -5,6 +5,12 @@ ALE Solidity Integration *ale-solidity-options*
|
|||
===============================================================================
|
||||
solc *ale-solidity-solc*
|
||||
|
||||
g:ale_solidity_solc_executable *g:ale_solidity_solc_executable*
|
||||
*b:ale_solidity_solc_executable*
|
||||
Type: |String|
|
||||
Default: `'solc'`
|
||||
|
||||
Override the invoked solc binary. For truffle/hardhat binaries.
|
||||
|
||||
g:ale_solidity_solc_options *g:ale_solidity_solc_options*
|
||||
*b:ale_solidity_solc_options*
|
||||
|
@ -33,4 +39,3 @@ solium *ale-solidity-solium*
|
|||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
|
|
|
@ -288,6 +288,7 @@ Notes:
|
|||
* `luac`
|
||||
* `luacheck`
|
||||
* `luafmt`
|
||||
* `stylua`
|
||||
* Mail
|
||||
* `alex`!!
|
||||
* `languagetool`!!
|
||||
|
@ -300,6 +301,7 @@ Notes:
|
|||
* `languagetool`!!
|
||||
* `markdownlint`!!
|
||||
* `mdl`
|
||||
* `pandoc`
|
||||
* `prettier`
|
||||
* `proselint`
|
||||
* `redpen`
|
||||
|
|
|
@ -2843,9 +2843,11 @@ documented in additional help files.
|
|||
luac..................................|ale-lua-luac|
|
||||
luacheck..............................|ale-lua-luacheck|
|
||||
luafmt................................|ale-lua-luafmt|
|
||||
stylua................................|ale-lua-stylua|
|
||||
markdown................................|ale-markdown-options|
|
||||
markdownlint..........................|ale-markdown-markdownlint|
|
||||
mdl...................................|ale-markdown-mdl|
|
||||
pandoc................................|ale-markdown-pandoc|
|
||||
prettier..............................|ale-markdown-prettier|
|
||||
remark-lint...........................|ale-markdown-remark-lint|
|
||||
textlint..............................|ale-markdown-textlint|
|
||||
|
|
|
@ -297,6 +297,7 @@ formatting.
|
|||
* [luac](https://www.lua.org/manual/5.1/luac.html)
|
||||
* [luacheck](https://github.com/mpeterv/luacheck)
|
||||
* [luafmt](https://github.com/trixnz/lua-fmt)
|
||||
* [stylua](https://github.com/johnnymorganz/stylua)
|
||||
* Mail
|
||||
* [alex](https://github.com/wooorm/alex) :floppy_disk:
|
||||
* [languagetool](https://languagetool.org/) :floppy_disk:
|
||||
|
@ -309,6 +310,7 @@ formatting.
|
|||
* [languagetool](https://languagetool.org/) :floppy_disk:
|
||||
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
|
||||
* [mdl](https://github.com/mivok/markdownlint)
|
||||
* [pandoc](https://pandoc.org)
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
* [proselint](http://proselint.com/)
|
||||
* [redpen](http://redpen.cc/)
|
||||
|
|
|
@ -553,7 +553,13 @@ endfunction
|
|||
|
||||
function! s:NullError(...) abort
|
||||
let [out, exec_error] = s:SystemError(call('fugitive#Prepare', a:000))
|
||||
return [exec_error ? [] : split(out, "\1"), exec_error ? substitute(out, "\n$", "", "") : '', exec_error]
|
||||
if exec_error
|
||||
return [[], substitute(out, "\n$", "", "") : '', exec_error]
|
||||
else
|
||||
let list = split(out, "\1", 1)
|
||||
call remove(list, -1)
|
||||
return [list, '', exec_error]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:TreeChomp(...) abort
|
||||
|
@ -621,21 +627,23 @@ endfunction
|
|||
|
||||
let s:config = {}
|
||||
function! fugitive#Config(...) abort
|
||||
let dir = s:Dir()
|
||||
let name = ''
|
||||
let default = get(a:, 3, '')
|
||||
if a:0 >= 2 && type(a:2) == type({})
|
||||
if a:0 >= 2 && type(a:2) == type({}) && !has_key(a:2, 'git_dir')
|
||||
let name = substitute(a:1, '^[^.]\+\|[^.]\+$', '\L&', 'g')
|
||||
return len(a:1) ? get(get(a:2, name, []), 0, default) : a:2
|
||||
elseif a:0 >= 2
|
||||
let dir = a:2
|
||||
let dir = s:Dir(a:2)
|
||||
let name = a:1
|
||||
elseif a:0 == 1 && type(a:1) == type({})
|
||||
elseif a:0 == 1 && type(a:1) == type({}) && !has_key(a:1, 'git_dir')
|
||||
return a:1
|
||||
elseif a:0 == 1 && a:1 =~# '^[[:alnum:]-]\+\.'
|
||||
elseif a:0 == 1 && type(a:1) == type('') && a:1 =~# '^[[:alnum:]-]\+\.'
|
||||
let dir = s:Dir()
|
||||
let name = a:1
|
||||
elseif a:0 == 1
|
||||
let dir = a:1
|
||||
let dir = s:Dir(a:1)
|
||||
else
|
||||
let dir = s:Dir()
|
||||
endif
|
||||
let name = substitute(name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
|
||||
let dir_key = len(dir) ? dir : '_'
|
||||
|
@ -664,6 +672,28 @@ function! fugitive#Config(...) abort
|
|||
return len(name) ? get(get(dict, name, []), 0, default) : dict
|
||||
endfunction
|
||||
|
||||
function! fugitive#ConfigGetAll(name, ...) abort
|
||||
let config = fugitive#Config(a:0 ? a:1 : s:Dir())
|
||||
let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
|
||||
return copy(get(config, name, []))
|
||||
endfunction
|
||||
|
||||
function! fugitive#ConfigGetRegexp(pattern, ...) abort
|
||||
let config = fugitive#Config(a:0 ? a:1 : s:Dir())
|
||||
let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)')
|
||||
if a:pattern !~# '\\\@<!\%(\\\\\)*\\z[se]'
|
||||
return filtered
|
||||
endif
|
||||
let transformed = {}
|
||||
for [k, v] in items(filtered)
|
||||
let k = matchstr(k, a:pattern)
|
||||
if len(k)
|
||||
let transformed[k] = v
|
||||
endif
|
||||
endfor
|
||||
return transformed
|
||||
endfunction
|
||||
|
||||
function! s:Remote(dir) abort
|
||||
let head = FugitiveHead(0, a:dir)
|
||||
let remote = len(head) ? FugitiveConfigGet('branch.' . head . '.remote', a:dir) : ''
|
||||
|
@ -2102,7 +2132,7 @@ function! fugitive#BufReadStatus() abort
|
|||
if empty(s:Tree())
|
||||
call s:AddHeader('Bare', 'yes')
|
||||
endif
|
||||
if get(FugitiveConfigGetAll('advice.statusHints', config), 0, 'true') !~# '^\%(false\|no|off\|0\|\)$'
|
||||
if get(fugitive#ConfigGetAll('advice.statusHints', config), 0, 'true') !~# '^\%(false\|no|off\|0\|\)$'
|
||||
call s:AddHeader('Help', 'g?')
|
||||
endif
|
||||
|
||||
|
@ -2228,6 +2258,10 @@ function! fugitive#FileWriteCmd(...) abort
|
|||
if commit !~# '^[0-3]$' || !v:cmdbang && (line("'[") != 1 || line("']") != line('$'))
|
||||
return "noautocmd '[,']write" . (v:cmdbang ? '!' : '') . ' ' . s:fnameescape(amatch)
|
||||
endif
|
||||
if exists('+guioptions') && &guioptions =~# '!'
|
||||
let guioptions = &guioptions
|
||||
set guioptions-=!
|
||||
endif
|
||||
silent execute "'[,']write !".fugitive#Prepare(dir, 'hash-object', '-w', '--stdin', '--').' > '.tmp
|
||||
let sha1 = readfile(tmp)[0]
|
||||
let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+')
|
||||
|
@ -2245,6 +2279,9 @@ function! fugitive#FileWriteCmd(...) abort
|
|||
return 'echoerr '.string('fugitive: '.error)
|
||||
endif
|
||||
finally
|
||||
if exists('guioptions')
|
||||
let &guioptions = guioptions
|
||||
endif
|
||||
call delete(tmp)
|
||||
endtry
|
||||
endfunction
|
||||
|
@ -2473,7 +2510,7 @@ augroup END
|
|||
|
||||
function! s:AskPassArgs(dir) abort
|
||||
if (len($DISPLAY) || len($TERM_PROGRAM) || has('gui_running')) &&
|
||||
\ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(FugitiveConfigGetAll('core.askpass', a:dir))
|
||||
\ empty($GIT_ASKPASS) && empty($SSH_ASKPASS) && empty(fugitive#ConfigGetAll('core.askpass', a:dir))
|
||||
if s:executable(s:ExecPath() . '/git-gui--askpass')
|
||||
return ['-c', 'core.askPass=' . s:ExecPath() . '/git-gui--askpass']
|
||||
elseif s:executable('ssh-askpass')
|
||||
|
@ -2800,7 +2837,7 @@ function! fugitive#PagerFor(argv, ...) abort
|
|||
return 0
|
||||
endif
|
||||
let config = a:0 ? a:1 : fugitive#Config()
|
||||
let value = get(FugitiveConfigGetAll('pager.' . args[0], config), 0, -1)
|
||||
let value = get(fugitive#ConfigGetAll('pager.' . args[0], config), 0, -1)
|
||||
if value =~# '^\%(true\|yes\|on\|1\)$'
|
||||
return 1
|
||||
elseif value =~# '^\%(false\|no|off\|0\|\)$'
|
||||
|
@ -3075,7 +3112,7 @@ function! s:CompletableSubcommands(dir) abort
|
|||
endif
|
||||
call extend(commands, s:path_subcommands[cpath])
|
||||
endfor
|
||||
call extend(commands, keys(FugitiveConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir)))
|
||||
call extend(commands, keys(fugitive#ConfigGetRegexp('^alias\.\zs[^.]\+$', a:dir)))
|
||||
let configured = split(FugitiveConfigGet('completion.commands', a:dir), '\s\+')
|
||||
let rejected = {}
|
||||
for command in configured
|
||||
|
@ -3213,7 +3250,7 @@ function! s:StageSeek(info, fallback) abort
|
|||
if empty(info.heading)
|
||||
return a:fallback
|
||||
endif
|
||||
let line = search('^' . escape(substitute(info.heading, '(\d\+)$', '', ''), '^$.*[]~\'), 'wn')
|
||||
let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\+)$', 'wn')
|
||||
if !line
|
||||
for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, [])
|
||||
let line = search('^' . section, 'wn')
|
||||
|
@ -3433,18 +3470,18 @@ function! s:StageInfo(...) abort
|
|||
endwhile
|
||||
endif
|
||||
let slnum = lnum + 1
|
||||
let section = ''
|
||||
let heading = ''
|
||||
let index = 0
|
||||
while len(getline(slnum - 1)) && empty(section)
|
||||
while len(getline(slnum - 1)) && empty(heading)
|
||||
let slnum -= 1
|
||||
let section = matchstr(getline(slnum), '^\u\l\+\ze.* (\d\+)$')
|
||||
if empty(section) && getline(slnum) !~# '^[ @\+-]'
|
||||
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$')
|
||||
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
||||
let index += 1
|
||||
endif
|
||||
endwhile
|
||||
let text = matchstr(getline(lnum), '^[A-Z?] \zs.*')
|
||||
return {'section': section,
|
||||
\ 'heading': getline(slnum),
|
||||
return {'section': matchstr(heading, '^\u\l\+'),
|
||||
\ 'heading': heading,
|
||||
\ 'sigil': sigil,
|
||||
\ 'offset': offset,
|
||||
\ 'filename': text,
|
||||
|
@ -3452,7 +3489,7 @@ function! s:StageInfo(...) abort
|
|||
\ 'paths': map(reverse(split(text, ' -> ')), 's:Tree() . "/" . v:val'),
|
||||
\ 'commit': matchstr(getline(lnum), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze '),
|
||||
\ 'status': matchstr(getline(lnum), '^[A-Z?]\ze \|^\%(\x\x\x\)\@!\l\+\ze [0-9a-f]'),
|
||||
\ 'submodule': get(get(get(b:fugitive_files, section, {}), text, {}), 'submodule', ''),
|
||||
\ 'submodule': get(get(get(b:fugitive_files, heading, {}), text, {}), 'submodule', ''),
|
||||
\ 'index': index}
|
||||
endfunction
|
||||
|
||||
|
@ -3486,11 +3523,11 @@ function! s:Selection(arg1, ...) abort
|
|||
let flnum -= 1
|
||||
endwhile
|
||||
let slnum = flnum + 1
|
||||
let section = ''
|
||||
let heading = ''
|
||||
let index = 0
|
||||
while len(getline(slnum - 1)) && empty(section)
|
||||
while empty(heading)
|
||||
let slnum -= 1
|
||||
let heading = matchstr(getline(slnum), '^\u\l\+.* (\d\+)$')
|
||||
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$')
|
||||
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
||||
let index += 1
|
||||
endif
|
||||
|
@ -3498,7 +3535,7 @@ function! s:Selection(arg1, ...) abort
|
|||
let results = []
|
||||
let template = {
|
||||
\ 'heading': heading,
|
||||
\ 'section': matchstr(heading, '^\u\l\+\ze.* (\d\+)$'),
|
||||
\ 'section': matchstr(heading, '^\u\l\+'),
|
||||
\ 'filename': '',
|
||||
\ 'relative': [],
|
||||
\ 'paths': [],
|
||||
|
@ -3510,9 +3547,10 @@ function! s:Selection(arg1, ...) abort
|
|||
let lnum = first - (arg1 == flnum ? 0 : 1)
|
||||
let root = s:Tree() . '/'
|
||||
while lnum <= last
|
||||
if line =~# '^\u\l\+\ze.* (\d\+)$'
|
||||
let template.heading = getline(lnum)
|
||||
let template.section = matchstr(template.heading, '^\u\l\+\ze.* (\d\+)$')
|
||||
let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\+)$')
|
||||
if len(heading)
|
||||
let template.heading = heading
|
||||
let template.section = matchstr(heading, '^\u\l\+')
|
||||
let template.index = 0
|
||||
elseif line =~# '^[ @\+-]'
|
||||
let template.index -= 1
|
||||
|
@ -5895,9 +5933,6 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort
|
|||
setlocal signcolumn=no
|
||||
endif
|
||||
execute "vertical resize ".(s:linechars('.\{-\}\s\+\d\+\ze)')+1)
|
||||
call s:Map('n', 'A', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)<CR>", '<silent>')
|
||||
call s:Map('n', 'C', ":<C-u>exe 'vertical resize '.(<SID>linechars('^\\S\\+')+1+v:count)<CR>", '<silent>')
|
||||
call s:Map('n', 'D', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)<CR>", '<silent>')
|
||||
redraw
|
||||
syncbind
|
||||
exe s:DoAutocmdChanged(temp_state)
|
||||
|
@ -6128,6 +6163,9 @@ function! fugitive#BlameFileType() abort
|
|||
call s:Map('n', 'O', ':<C-U>exe <SID>BlameCommit("tabedit")<CR>', '<silent>')
|
||||
call s:Map('n', 'p', ':<C-U>exe <SID>BlameCommit("pedit")<CR>', '<silent>')
|
||||
call s:Map('n', '.', ":<C-U> <C-R>=substitute(<SID>BlameCommitFileLnum()[0],'^$','@','')<CR><Home>")
|
||||
call s:Map('n', 'A', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)<CR>", '<silent>')
|
||||
call s:Map('n', 'C', ":<C-u>exe 'vertical resize '.(<SID>linechars('^\\S\\+')+1+v:count)<CR>", '<silent>')
|
||||
call s:Map('n', 'D', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)<CR>", '<silent>')
|
||||
endfunction
|
||||
|
||||
augroup fugitive_blame
|
||||
|
|
|
@ -128,32 +128,20 @@ endfunction
|
|||
" structure of the return value as it is not guaranteed. If you want a full
|
||||
" dictionary of every config value, use FugitiveConfigGetRegexp('.*').
|
||||
function! FugitiveConfig(...) abort
|
||||
if a:0 >= 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir'))
|
||||
return call('fugitive#Config', [a:1, FugitiveGitDir(a:2)] + a:000[2:-1])
|
||||
elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.')
|
||||
return fugitive#Config(FugitiveGitDir(a:1))
|
||||
else
|
||||
return call('fugitive#Config', a:000)
|
||||
endif
|
||||
return call('fugitive#Config', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveConfigGet() retrieves a Git configuration value. An optional second
|
||||
" argument provides the Git dir as with FugitiveFind(). Pass a blank string
|
||||
" to limit to the global config.
|
||||
function! FugitiveConfigGet(name, ...) abort
|
||||
return call('FugitiveConfig', [a:name] + a:000)
|
||||
return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, ''))
|
||||
endfunction
|
||||
|
||||
" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of
|
||||
" all values.
|
||||
function! FugitiveConfigGetAll(name, ...) abort
|
||||
if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir')
|
||||
let config = a:1
|
||||
else
|
||||
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
||||
endif
|
||||
let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
|
||||
return copy(get(config, name, []))
|
||||
return call('fugitive#ConfigGetAll', [a:name] + a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values
|
||||
|
@ -161,23 +149,7 @@ endfunction
|
|||
" using a Vim regexp. Second argument has same semantics as
|
||||
" FugitiveConfigGet().
|
||||
function! FugitiveConfigGetRegexp(pattern, ...) abort
|
||||
if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir')
|
||||
let config = a:1
|
||||
else
|
||||
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
||||
endif
|
||||
let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)')
|
||||
if a:pattern !~# '\\\@<!\%(\\\\\)*\\z[se]'
|
||||
return filtered
|
||||
endif
|
||||
let transformed = {}
|
||||
for [k, v] in items(filtered)
|
||||
let k = matchstr(k, a:pattern)
|
||||
if len(k)
|
||||
let transformed[k] = v
|
||||
endif
|
||||
endfor
|
||||
return transformed
|
||||
return call('fugitive#ConfigGetRegexp', [a:pattern] + a:000)
|
||||
endfunction
|
||||
|
||||
function! FugitiveRemoteUrl(...) abort
|
||||
|
|
|
@ -2,7 +2,7 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
diff-lcs (1.2.5)
|
||||
rake (12.3.3)
|
||||
rake (10.4.2)
|
||||
rspec (3.4.0)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
|
|
|
@ -154,4 +154,7 @@ snippet us
|
|||
'use strict'`!p snip.rv = semi(snip)`
|
||||
endsnippet
|
||||
|
||||
snippet imp "import"
|
||||
import ${2} from ${1}
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
||||
|
|
|
@ -48,3 +48,9 @@ endsnippet
|
|||
snippet useR "useRef(defaultValue)" b
|
||||
const ${1:ref} = useRef(${2:null})
|
||||
endsnippet
|
||||
snippet ir "import React"
|
||||
import React from "react"
|
||||
endsnippet
|
||||
snippet irc "import React and Component"
|
||||
import React, { Component } from "react"
|
||||
endsnippet
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
priority -50
|
||||
|
||||
extends javascript
|
||||
|
||||
snippet int "interface"
|
||||
interface ${1} {
|
||||
}
|
||||
endsnippet
|
||||
snippet nspc "namespace"
|
||||
namespace ${1} {
|
||||
}
|
||||
endsnippet
|
||||
priority -49
|
||||
snippet fun "function (named)" b
|
||||
function ${1:function_name} (${2:argument}: ${3:argument_type}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
priority -50
|
||||
extends javascript_react
|
||||
extends typescript
|
||||
|
||||
priority -49
|
||||
snippet rfc "react functional component"
|
||||
import React, { FC } from "react"
|
||||
|
||||
interface ${1:function_name}Props {${4:props_types}}
|
||||
|
||||
export const ${1:function_name}: FC<${1:function_name}Props> = (${2:props}) => ${3:function_body}
|
||||
endsnippet
|
|
@ -38,7 +38,7 @@ snippet i
|
|||
${0:${VISUAL}}
|
||||
}
|
||||
snippet t.
|
||||
$this->
|
||||
\$this->
|
||||
snippet f
|
||||
function ${1}(${3})
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue