mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
Amir 2021-10-28 21:48:21 +02:00
parent e13b2a10a7
commit b39d6ca807
27 changed files with 348 additions and 120 deletions

View File

@ -16,7 +16,7 @@ endfunction
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
" output format " output format
" <filename>:<line>:<column>: <issue type>: <message> " <filename>:<line>:<column>: <issue type>: <message>
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$' let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)

View File

@ -55,13 +55,19 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
let l:detail = 'hadolint could not parse the file because of a syntax error.' let l:detail = 'hadolint could not parse the file because of a syntax error.'
endif endif
call add(l:output, { let l:line_output = {
\ 'lnum': l:lnum, \ 'lnum': l:lnum,
\ 'col': l:colnum, \ 'col': l:colnum,
\ 'type': l:type, \ 'type': l:type,
\ 'text': l:text, \ 'text': l:text,
\ 'detail': l:detail \ 'detail': l:detail
\}) \}
if l:code isnot# ''
let l:line_output['code'] = l:code
endif
call add(l:output, l:line_output)
endfor endfor
return l:output return l:output

View File

@ -6,7 +6,7 @@ call ale#Set('ruby_ruby_executable', 'ruby')
call ale#linter#Define('ruby', { call ale#linter#Define('ruby', {
\ 'name': 'ruby', \ 'name': 'ruby',
\ 'executable': {b -> ale#Var(b, 'ruby_ruby_executable')}, \ 'executable': {b -> ale#Var(b, 'ruby_ruby_executable')},
\ 'command': '%e -w -c -T1 %t', \ 'command': '%e -w -c %t',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
\}) \})

View File

@ -0,0 +1,22 @@
" Author: Benjamin Bannier <bbannier@gmail.com>
" Description: Support for checking Zeek files.
"
call ale#Set('zeek_zeek_executable', 'zeek')
function! ale_linters#zeek#zeek#HandleErrors(buffer, lines) abort
let l:pattern = 'error in \v.*, line (\d+): (.*)$'
return map(ale#util#GetMatches(a:lines, l:pattern), "{
\ 'lnum': str2nr(v:val[1]),
\ 'text': v:val[2],
\}")
endfunction
call ale#linter#Define('zeek', {
\ 'name': 'zeek',
\ 'executable': {b -> ale#Var(b, 'zeek_zeek_executable')},
\ 'output_stream': 'stderr',
\ 'command': {-> '%e --parse-only %s'},
\ 'callback': 'ale_linters#zeek#zeek#HandleErrors',
\ 'lint_file': 1,
\})

View File

@ -100,6 +100,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['nim'], \ 'suggested_filetypes': ['nim'],
\ 'description': 'Apply nimpretty to a file.', \ 'description': 'Apply nimpretty to a file.',
\ }, \ },
\ 'erblint': {
\ 'function': 'ale#fixers#erblint#Fix',
\ 'suggested_filetypes': ['eruby'],
\ 'description': 'Apply erblint --autocorrect to a file.',
\ },
\ 'eslint': { \ 'eslint': {
\ 'function': 'ale#fixers#eslint#Fix', \ 'function': 'ale#fixers#eslint#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript'], \ 'suggested_filetypes': ['javascript', 'typescript'],

View File

@ -0,0 +1,40 @@
" Author: Roeland Moors - https://github.com/roelandmoors
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint
call ale#Set('eruby_erblint_executable', 'erblint')
call ale#Set('eruby_erblint_options', '')
" Erblint fixer outputs diagnostics first and then the fixed
" output. These are delimited by something like this:
" ================ /path/to/demo.html.erb ==================
" We only need the output after this
function! ale#fixers#erblint#PostProcess(buffer, output) abort
let l:line = 0
for l:output in a:output
let l:line = l:line + 1
if l:output =~# "^=\\+.*=\\+$"
break
endif
endfor
return a:output[l:line :]
endfunction
function! ale#fixers#erblint#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable')
let l:options = ale#Var(a:buffer, 'eruby_erblint_options')
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --autocorrect --stdin %s'
endfunction
function! ale#fixers#erblint#Fix(buffer) abort
return {
\ 'command': ale#fixers#erblint#GetCommand(a:buffer),
\ 'process_with': 'ale#fixers#erblint#PostProcess'
\}
endfunction

View File

@ -21,7 +21,7 @@ function! ale#fixers#isort#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort']) return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction endfunction
function! ale#fixers#isort#Fix(buffer) abort function! ale#fixers#isort#GetCmd(buffer) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
@ -29,7 +29,20 @@ function! ale#fixers#isort#Fix(buffer) abort
call extend(l:cmd, ['run', 'isort']) call extend(l:cmd, ['run', 'isort'])
endif endif
call add(l:cmd, '--filename %s') return join(l:cmd, ' ')
endfunction
function! ale#fixers#isort#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'isort'])
endif
if ale#semver#GTE(a:version, [5, 7, 0])
call add(l:cmd, '--filename %s')
endif
let l:options = ale#Var(a:buffer, 'python_isort_options') let l:options = ale#Var(a:buffer, 'python_isort_options')
@ -41,6 +54,18 @@ function! ale#fixers#isort#Fix(buffer) abort
return { return {
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
\ 'command': join(l:cmd, ' ') \ 'command': join(l:cmd, ' '),
\} \}
endfunction endfunction
function! ale#fixers#isort#Fix(buffer) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:command = ale#fixers#isort#GetCmd(a:buffer) . ale#Pad('--version')
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#isort#FixForVersion'),
\)
endfunction

View File

@ -45,6 +45,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
\ 'typeDefinition': 0, \ 'typeDefinition': 0,
\ 'symbol_search': 0, \ 'symbol_search': 0,
\ 'code_actions': 0, \ 'code_actions': 0,
\ 'did_save': 0,
\ 'includeText': 0, \ 'includeText': 0,
\ }, \ },
\} \}
@ -265,15 +266,19 @@ function! s:UpdateCapabilities(conn, capabilities) abort
let a:conn.capabilities.symbol_search = 1 let a:conn.capabilities.symbol_search = 1
endif endif
if has_key(a:capabilities, 'textDocumentSync') if type(get(a:capabilities, 'textDocumentSync')) is v:t_dict
if type(a:capabilities.textDocumentSync) is v:t_dict let l:syncOptions = get(a:capabilities, 'textDocumentSync')
let l:save = get(a:capabilities.textDocumentSync, 'save', v:false)
if type(l:save) is v:true if get(l:syncOptions, 'save') is v:true
let a:conn.capabilities.includeText = 1 let a:conn.capabilities.did_save = 1
endif endif
if type(l:save) is v:t_dict && get(a:capabilities.textDocumentSync.save, 'includeText', v:false) is v:true if type(get(l:syncOptions, 'save')) is v:t_dict
let a:conn.capabilities.did_save = 1
let l:saveOptions = get(l:syncOptions, 'save')
if get(l:saveOptions, 'includeText') is v:true
let a:conn.capabilities.includeText = 1 let a:conn.capabilities.includeText = 1
endif endif
endif endif

View File

@ -466,6 +466,7 @@ function! s:CheckWithLSP(linter, details) abort
" If this was a file save event, also notify the server of that. " If this was a file save event, also notify the server of that.
if a:linter.lsp isnot# 'tsserver' if a:linter.lsp isnot# 'tsserver'
\&& getbufvar(l:buffer, 'ale_save_event_fired', 0) \&& getbufvar(l:buffer, 'ale_save_event_fired', 0)
\&& ale#lsp#HasCapability(l:buffer, 'did_save')
let l:include_text = ale#lsp#HasCapability(l:buffer, 'includeText') let l:include_text = ale#lsp#HasCapability(l:buffer, 'includeText')
let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text) let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text)
let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 let l:notified = ale#lsp#Send(l:id, l:save_message) != 0

View File

@ -64,15 +64,16 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
let l:line = line('.') let l:line = line('.')
let l:buffer = bufnr('') let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ') let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
if has('nvim') if has('nvim')
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {}) call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
else else
let l:left_pad = col('$') let l:left_pad = col('$')
call prop_add(l:line, l:left_pad, { call prop_add(l:line, l:left_pad, {
\ 'type': 'ale', \ 'type': 'ale',
\}) \})
let s:last_popup = popup_create(l:prefix.a:message, { let s:last_popup = popup_create(l:msg, {
\ 'line': -1, \ 'line': -1,
\ 'padding': [0, 0, 0, 1], \ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]], \ 'mask': [[1, 1, 1, 1]],

View File

@ -601,6 +601,8 @@ Notes:
* `yamllint` * `yamllint`
* YANG * YANG
* `yang-lsp` * `yang-lsp`
* Zeek
* `zeek`!!
* Zig * Zig
* `zls` * `zls`

View File

@ -0,0 +1,23 @@
===============================================================================
ALE Zeek Integration *ale-zeek-options*
*ale-integration-zeek*
===============================================================================
Integration Information
Currently, the only supported linter for Zeek is zeek.
===============================================================================
zeek *ale-zeek-zeek*
g:ale_zeek_zeek_executable *g:ale_zeek_zeek_executable*
*b:ale_zeek_zeek_executable*
Type: |String|
Default: `'zeek'`
This variable can be modified to change the executable path for `zeek`.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -3114,6 +3114,8 @@ documented in additional help files.
yamllint..............................|ale-yaml-yamllint| yamllint..............................|ale-yaml-yamllint|
yang....................................|ale-yang-options| yang....................................|ale-yang-options|
yang-lsp..............................|ale-yang-lsp| yang-lsp..............................|ale-yang-lsp|
zeek....................................|ale-zeek-options|
zeek..................................|ale-zeek-zeek|
zig.....................................|ale-zig-options| zig.....................................|ale-zig-options|
zls...................................|ale-zig-zls| zls...................................|ale-zig-zls|

View File

@ -610,5 +610,7 @@ formatting.
* [yamllint](https://yamllint.readthedocs.io/) * [yamllint](https://yamllint.readthedocs.io/)
* YANG * YANG
* [yang-lsp](https://github.com/theia-ide/yang-lsp) * [yang-lsp](https://github.com/theia-ide/yang-lsp)
* Zeek
* [zeek](http://zeek.org) :floppy_disk:
* Zig * Zig
* [zls](https://github.com/zigtools/zls) * [zls](https://github.com/zigtools/zls)

View File

@ -1386,6 +1386,7 @@ fu! s:MarkToOpen()
en en
en en
sil! cal ctrlp#statusline() sil! cal ctrlp#statusline()
redr
endf endf
fu! s:OpenMulti(...) fu! s:OpenMulti(...)

View File

@ -11,6 +11,17 @@ Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
![ctrlp][1] ![ctrlp][1]
## Install
vim 8+ manages packages all on its own. Installing `ctrlp` is this simple:
```bash
mkdir -p ~/.vim/pack/plugins/start
git clone --depth=1 https://github.com/ctrlpvim/ctrlp.vim.git ~/.vim/pack/plugins/start/ctrlp
```
Of course you can use your favorite plugin manager or check the [quick installation guide][3] for a primitive installation method.
## Basic Usage ## Basic Usage
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode. * Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode. * Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
@ -97,13 +108,10 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
Check `:help ctrlp-options` for other options. Check `:help ctrlp-options` for other options.
## Installation
Use your favorite method or check the homepage for a [quick installation guide][3].
## License ## License
CtrlP is distributed under Vim's [license][4]. CtrlP is distributed under Vim's [license][4].
[1]: http://i.imgur.com/aOcwHwt.png [1]: https://i.imgur.com/aOcwHwt.png
[2]: https://github.com/ctrlpvim/ctrlp.vim/tree/extensions [2]: https://github.com/ctrlpvim/ctrlp.vim/tree/extensions
[3]: http://ctrlpvim.github.io/ctrlp.vim#installation [3]: https://ctrlpvim.github.io/ctrlp.vim#installation
[4]: http://vimdoc.sourceforge.net/htmldoc/uganda.html [4]: http://vimdoc.sourceforge.net/htmldoc/uganda.html

View File

@ -85,6 +85,10 @@ if !exists('g:dracula_undercurl')
let g:dracula_undercurl = g:dracula_underline let g:dracula_undercurl = g:dracula_underline
endif endif
if !exists('g:dracula_full_special_attrs_support')
let g:dracula_full_special_attrs_support = has('gui_running')
endif
if !exists('g:dracula_inverse') if !exists('g:dracula_inverse')
let g:dracula_inverse = 1 let g:dracula_inverse = 1
endif endif
@ -111,10 +115,15 @@ function! s:h(scope, fg, ...) " bg, attr_list, special
let l:attr_list = filter(get(a:, 2, ['NONE']), 'type(v:val) == 1') let l:attr_list = filter(get(a:, 2, ['NONE']), 'type(v:val) == 1')
let l:attrs = len(l:attr_list) > 0 ? join(l:attr_list, ',') : 'NONE' let l:attrs = len(l:attr_list) > 0 ? join(l:attr_list, ',') : 'NONE'
" Falls back to coloring foreground group on terminals because " If the UI does not have full support for special attributes (like underline and
" nearly all do not support undercurl " undercurl) and the highlight does not explicitly set the foreground color,
" make the foreground the same as the attribute color to ensure the user will
" get some highlight if the attribute is not supported. The default behavior
" is to assume that terminals do not have full support, but the user can set
" the global variable `g:dracula_full_special_attrs_support` explicitly if the
" default behavior is not desirable.
let l:special = get(a:, 3, ['NONE', 'NONE']) let l:special = get(a:, 3, ['NONE', 'NONE'])
if l:special[0] !=# 'NONE' && l:fg[0] ==# 'NONE' && !has('gui_running') if l:special[0] !=# 'NONE' && l:fg[0] ==# 'NONE' && !g:dracula_full_special_attrs_support
let l:fg[0] = l:special[0] let l:fg[0] = l:special[0]
let l:fg[1] = l:special[1] let l:fg[1] = l:special[1]
endif endif

View File

@ -1,4 +1,4 @@
*dracula.txt* For Vim version 8 Last change: 2018 May 08 *dracula.txt* For Vim version 8 Last change: 2021 Oct 22
*dracula* *vim-dracula* *dracula* *vim-dracula*
|\ ,, ~ |\ ,, ~
@ -86,6 +86,13 @@ Include underline attributes in highlighting >
Include undercurl attributes in highlighting (only if underline enabled) > Include undercurl attributes in highlighting (only if underline enabled) >
let g:dracula_undercurl = 1 let g:dracula_undercurl = 1
* *g:dracula_full_special_attrs_support*
Explicitly declare full support for special attributes. By default it is 1
for graphical applications and 0 for terminals and terminal emulators. On
terminal emulators, set to 1 to allow underline/undercurl highlights without
changing the foreground color. >
let g:dracula_full_special_attrs_support = 1
* *g:dracula_inverse* * *g:dracula_inverse*
Include inverse attributes in highlighting > Include inverse attributes in highlighting >
let g:dracula_inverse = 1 let g:dracula_inverse = 1

View File

@ -228,7 +228,7 @@ function! s:Map(mode, lhs, rhs, ...) abort
endwhile endwhile
if !skip && (flags !~# '<unique>' || empty(mapcheck(head.tail, mode))) if !skip && (flags !~# '<unique>' || empty(mapcheck(head.tail, mode)))
call add(maps, mode.'map <buffer>' . s:nowait . substitute(flags, '<unique>', '', '') . ' ' . head.tail . ' ' . a:rhs) call add(maps, mode.'map <buffer>' . s:nowait . substitute(flags, '<unique>', '', '') . ' ' . head.tail . ' ' . a:rhs)
if a:0 > 1 if a:0 > 1 && a:2
let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') .
\ '|sil! exe "' . mode . 'unmap <buffer> ' . head.tail . '"' \ '|sil! exe "' . mode . 'unmap <buffer> ' . head.tail . '"'
endif endif
@ -1253,30 +1253,34 @@ endfunction
function! s:UrlParse(url) abort function! s:UrlParse(url) abort
let scp_authority = matchstr(a:url, '^[^:/]\+\ze:\%(//\)\@!') let scp_authority = matchstr(a:url, '^[^:/]\+\ze:\%(//\)\@!')
if len(scp_authority) && !(has('win32') && scp_authority =~# '^\a:[\/]') if len(scp_authority) && !(has('win32') && scp_authority =~# '^\a:[\/]')
return {'scheme': 'ssh', 'authority': scp_authority, let url = {'scheme': 'ssh', 'authority': scp_authority,
\ 'path': strpart(a:url, len(scp_authority) + 1)} \ 'path': strpart(a:url, len(scp_authority) + 1)}
elseif empty(a:url)
let url = {'scheme': '', 'authority': '', 'path': ''}
else
let match = matchlist(a:url, '^\([[:alnum:].+-]\+\)://\([^/]*\)\(/.*\)\=\%(#\|$\)')
if empty(match)
let url = {'scheme': 'file', 'authority': '', 'path': a:url}
else
let url = {'scheme': match[1], 'authority': match[2]}
let url.path = empty(match[3]) ? '/' : match[3]
endif
endif endif
let match = matchlist(a:url, '^\([[:alnum:].+-]\+\)://\([^/]*\)\(/.*\)\=\%(#\|$\)') if (url.scheme ==# 'ssh' || url.scheme ==# 'git') && url.path[0:1] ==# '/~'
if empty(match) let url.path = strpart(url.path, 1)
return {'scheme': 'file', 'authority': '', 'path': a:url}
endif endif
let remote = {'scheme': match[1], 'authority': match[2]} return url
let remote.path = empty(match[3]) ? '/' : match[3]
if (remote.scheme ==# 'ssh' || remote.scheme ==# 'git') && remote.path[0:1] ==# '/~'
let remote.path = strpart(remote.path, 1)
endif
return remote
endfunction endfunction
function! s:ResolveRemote(url) abort function! s:RemoteResolve(url, flags) abort
let remote = s:UrlParse(a:url) let remote = s:UrlParse(a:url)
if remote.scheme =~# '^https\=$' if remote.scheme =~# '^https\=$' && index(a:flags, ':nohttp') < 0
let headers = fugitive#RemoteHttpHeaders(remote.scheme . '://' . remote.authority . remote.path) let headers = fugitive#RemoteHttpHeaders(remote.scheme . '://' . remote.authority . remote.path)
let loc = matchstr(get(headers, 'location', ''), '^https\=://.\{-\}\ze/info/refs?') let loc = matchstr(get(headers, 'location', ''), '^https\=://.\{-\}\ze/info/refs?')
if len(loc) if len(loc)
let remote = s:UrlParse(loc) let remote = s:UrlParse(loc)
else else
let remote.http_headers = headers let remote.headers = headers
endif endif
elseif remote.scheme ==# 'ssh' elseif remote.scheme ==# 'ssh'
let remote.authority = fugitive#SshHostAlias(remote.authority) let remote.authority = fugitive#SshHostAlias(remote.authority)
@ -1284,23 +1288,66 @@ function! s:ResolveRemote(url) abort
return remote return remote
endfunction endfunction
function! fugitive#ResolveRemote(url) abort function! s:ConfigLengthSort(i1, i2) abort
let remote = s:ResolveRemote(a:url) return len(a:i2[0]) - len(a:i1[0])
if remote.scheme ==# 'file' || remote.scheme ==# '' endfunction
return remote.path
elseif remote.path =~# '^/' function! s:RemoteCallback(config, into, flags, cb) abort
return remote.scheme . '://' . remote.authority . remote.path if a:into.remote_name =~# '^\.\=$'
elseif remote.path =~# '^\~' let a:into.remote_name = s:RemoteDefault(a:config)
return remote.scheme . '://' . remote.authority . '/' . remote.path endif
elseif remote.scheme ==# 'ssh' && remote.authority !~# ':' let url = a:into.remote_name
return remote.authority . ':' . remote.path
if url ==# '.git'
let url = s:GitDir(a:config)
elseif url !~# ':\|^/\|^\a:[\/]\|^\.\.\=/'
let url = FugitiveConfigGet('remote.' . url . '.url', a:config)
endif
let instead_of = []
for [k, vs] in items(fugitive#ConfigGetRegexp('^url\.\zs.\{-\}\ze\.insteadof$', a:config))
for v in vs
call add(instead_of, [v, k])
endfor
endfor
call sort(instead_of, 's:ConfigLengthSort')
for [orig, replacement] in instead_of
if strpart(url, 0, len(orig)) ==# orig
let url = replacement . strpart(url, len(orig))
break
endif
endfor
if index(a:flags, ':noresolve') < 0
call extend(a:into, s:RemoteResolve(url, a:flags))
else else
return a:url call extend(a:into, s:UrlParse(url))
endif
let a:into.user = matchstr(a:into.authority, '.\{-\}\ze@', '', '')
let a:into.host = substitute(a:into.authority, '.\{-\}@', '', '')
let a:into.hostname = substitute(a:into.host, ':\d\+$', '', '')
let a:into.port = matchstr(a:into.host, ':\zs\d\+$', '', '')
if a:into.path =~# '^/'
let a:into.url = a:into.scheme . '://' . a:into.authority . a:into.path
elseif a:into.path =~# '^\~'
let a:into.url = a:into.scheme . '://' . a:into.authority . '/' . a:into.path
elseif a:into.scheme ==# 'ssh' && a:into.authority !~# ':'
let a:into.url = a:into.authority . ':' . a:into.path
else
let a:into.url = url
endif
if len(a:cb)
call call(a:cb[0], [a:into] + a:cb[1:-1])
endif endif
endfunction endfunction
function! s:ConfigLengthSort(i1, i2) abort function! s:Remote(dir, remote, flags, cb) abort
return len(a:i2[0]) - len(a:i1[0]) let into = {'remote_name': a:remote, 'git_dir': s:GitDir(a:dir)}
let config = fugitive#Config(a:dir, function('s:RemoteCallback'), into, a:flags, a:cb)
if len(a:cb)
return config
else
call fugitive#Wait(config)
return into
endif
endfunction endfunction
function! s:RemoteParseArgs(args) abort function! s:RemoteParseArgs(args) abort
@ -1340,34 +1387,22 @@ function! s:RemoteParseArgs(args) abort
return [dir_or_config, remote, flags, cb] return [dir_or_config, remote, flags, cb]
endfunction endfunction
function! fugitive#Remote(...) abort
let [dir_or_config, remote, flags, cb] = s:RemoteParseArgs(a:000)
return s:Remote(dir_or_config, remote, flags, cb)
endfunction
function! s:RemoteUrlCallback(remote, callback) abort
return call(a:callback[0], [a:remote.url] + a:callback[1:-1])
endfunction
function! fugitive#RemoteUrl(...) abort function! fugitive#RemoteUrl(...) abort
let [dir_or_config, url, flags, cb] = s:RemoteParseArgs(a:000) let [dir_or_config, remote, flags, cb] = s:RemoteParseArgs(a:000)
let config = fugitive#Config(dir_or_config) if len(cb)
if url =~# '^\.\=$' let cb = [function('s:RemoteUrlCallback'), cb]
let url = s:RemoteDefault(config)
endif endif
if url ==# '.git' let remote = s:Remote(dir_or_config, remote, flags, cb)
let url = s:GitDir(config) return get(remote, 'url', remote)
elseif url !~# ':\|^/\|^\.\.\=/'
let url = FugitiveConfigGet('remote.' . url . '.url', config)
endif
let instead_of = []
for [k, vs] in items(fugitive#ConfigGetRegexp('^url\.\zs.\{-\}\ze\.insteadof$', config))
for v in vs
call add(instead_of, [v, k])
endfor
endfor
call sort(instead_of, 's:ConfigLengthSort')
for [orig, replacement] in instead_of
if strpart(url, 0, len(orig)) ==# orig
let url = replacement . strpart(url, len(orig))
break
endif
endfor
if index(flags, 1) < 0 && index(flags, get(v:, 'true', 1)) < 0 && index(flags, ':noresolve') < 0
let url = fugitive#ResolveRemote(url)
endif
return url
endfunction endfunction
" Section: Quickfix " Section: Quickfix
@ -2288,9 +2323,8 @@ function! s:FilterEscape(items, ...) abort
let items = copy(a:items) let items = copy(a:items)
call map(items, 's:fnameescape(v:val)') call map(items, 's:fnameescape(v:val)')
if a:0 && type(a:1) == type('') if a:0 && type(a:1) == type('')
let match = fnameescape(a:1)
let cmp = s:FileIgnoreCase(1) ? '==?' : '==#' let cmp = s:FileIgnoreCase(1) ? '==?' : '==#'
call filter(items, 'strpart(v:val, 0, strlen(match)) ' . cmp . ' match') call filter(items, 'strpart(v:val, 0, strlen(a:1)) ' . cmp . ' a:1')
endif endif
return items return items
endfunction endfunction
@ -2384,7 +2418,7 @@ function! fugitive#CompleteObject(base, ...) abort
let heads += ["stash"] let heads += ["stash"]
let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0]) let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0])
endif endif
let results += s:FilterEscape(heads, base) let results += s:FilterEscape(heads, fnameescape(base))
endif endif
let results += a:0 == 1 || a:0 >= 3 ? fugitive#CompletePath(base, 0, '', dir, a:0 >= 4 ? a:4 : tree) : fugitive#CompletePath(base) let results += a:0 == 1 || a:0 >= 3 ? fugitive#CompletePath(base, 0, '', dir, a:0 >= 4 ? a:4 : tree) : fugitive#CompletePath(base)
return results return results
@ -2406,7 +2440,7 @@ function! fugitive#CompleteObject(base, ...) abort
call map(entries,'s:sub(v:val,"^04.*\\zs$","/")') call map(entries,'s:sub(v:val,"^04.*\\zs$","/")')
call map(entries,'parent.s:sub(v:val,".*\t","")') call map(entries,'parent.s:sub(v:val,".*\t","")')
endif endif
return s:FilterEscape(entries, base) return s:FilterEscape(entries, fnameescape(base))
endfunction endfunction
function! s:CompleteSub(subcommand, A, L, P, ...) abort function! s:CompleteSub(subcommand, A, L, P, ...) abort
@ -2548,16 +2582,15 @@ let s:rebase_abbrevs = {
\ 'b': 'break', \ 'b': 'break',
\ } \ }
function! fugitive#BufReadStatus() abort function! fugitive#BufReadStatus(...) abort
let amatch = s:Slash(expand('%:p')) let amatch = s:Slash(expand('%:p'))
let b:fugitive_type = 'index' unlet! b:fugitive_reltime b:fugitive_type
unlet! b:fugitive_reltime
try try
silent doautocmd BufReadPre silent doautocmd BufReadPre
let config = fugitive#Config() let config = fugitive#Config()
let cmd = [fnamemodify(amatch, ':h')] let cmd = [fnamemodify(amatch, ':h')]
setlocal noro ma nomodeline buftype=nowrite setlocal noreadonly modifiable nomodeline buftype=nowrite
if s:cpath(fnamemodify($GIT_INDEX_FILE !=# '' ? FugitiveVimPath($GIT_INDEX_FILE) : fugitive#Find('.git/index'), ':p')) !=# s:cpath(amatch) if s:cpath(fnamemodify($GIT_INDEX_FILE !=# '' ? FugitiveVimPath($GIT_INDEX_FILE) : fugitive#Find('.git/index'), ':p')) !=# s:cpath(amatch)
let cmd += [{'env': {'GIT_INDEX_FILE': FugitiveGitPath(amatch)}}] let cmd += [{'env': {'GIT_INDEX_FILE': FugitiveGitPath(amatch)}}]
endif endif
@ -2757,7 +2790,7 @@ function! fugitive#BufReadStatus() abort
endif endif
let b:fugitive_diff = diff let b:fugitive_diff = diff
if v:cmdbang if get(a:, 1, v:cmdbang)
unlet! b:fugitive_expanded unlet! b:fugitive_expanded
endif endif
let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}}) let expanded = get(b:, 'fugitive_expanded', {'Staged': {}, 'Unstaged': {}})
@ -2875,6 +2908,8 @@ function! fugitive#BufReadStatus() abort
return s:DoAutocmd('User FugitiveIndex') return s:DoAutocmd('User FugitiveIndex')
catch /^fugitive:/ catch /^fugitive:/
return 'echoerr ' . string(v:exception) return 'echoerr ' . string(v:exception)
finally
let b:fugitive_type = 'index'
endtry endtry
endfunction endfunction
@ -3014,7 +3049,7 @@ function! fugitive#BufReadCmd(...) abort
if b:fugitive_display_format if b:fugitive_display_format
call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev])
else else
call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) call s:ReplaceCmd([dir, '-c', 'diff.noprefix=false', '-c', 'log.showRoot=false', 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev])
keepjumps 1 keepjumps 1
keepjumps call search('^parent ') keepjumps call search('^parent ')
if getline('.') ==# 'parent ' if getline('.') ==# 'parent '
@ -3159,6 +3194,9 @@ function! s:TempReadPost(file) abort
if dict.filetype ==# 'man' && has('nvim') if dict.filetype ==# 'man' && has('nvim')
let b:man_sect = matchstr(getline(1), '^\w\+(\zs\d\+\ze)') let b:man_sect = matchstr(getline(1), '^\w\+(\zs\d\+\ze)')
endif endif
if !get(g:, 'did_load_ftplugin') && dict.filetype ==# 'fugitiveblame'
call s:BlameMaps(0)
endif
let &l:filetype = dict.filetype let &l:filetype = dict.filetype
endif endif
setlocal foldmarker=<<<<<<<<,>>>>>>>> setlocal foldmarker=<<<<<<<<,>>>>>>>>
@ -4085,7 +4123,7 @@ function! s:DoAutocmdChanged(dir) abort
finally finally
unlet! g:fugitive_event g:fugitive_result unlet! g:fugitive_event g:fugitive_result
" Force statusline reload with the buffer's Git dir " Force statusline reload with the buffer's Git dir
let &ro = &ro let &l:ro = &l:ro
endtry endtry
return '' return ''
endfunction endfunction
@ -4096,7 +4134,7 @@ function! s:ReloadStatusBuffer(...) abort
endif endif
let original_lnum = a:0 ? a:1 : line('.') let original_lnum = a:0 ? a:1 : line('.')
let info = s:StageInfo(original_lnum) let info = s:StageInfo(original_lnum)
call fugitive#BufReadStatus() call fugitive#BufReadStatus(0)
call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0]) call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0])
return '' return ''
endfunction endfunction
@ -4536,8 +4574,8 @@ endfunction
function! s:PreviousItem(count) abort function! s:PreviousItem(count) abort
for i in range(a:count) for i in range(a:count)
if !search(s:item_pattern, 'Wbe') && getline('.') !~# s:item_pattern if !search(s:item_pattern, 'Wb') && getline('.') !~# s:item_pattern
call search('^commit ', 'Wbe') call search('^commit ', 'Wb')
endif endif
endfor endfor
call s:StageReveal() call s:StageReveal()
@ -7059,6 +7097,33 @@ function! s:BlameRehighlight() abort
endfor endfor
endfunction endfunction
function! s:BlameMaps(is_ftplugin) abort
let ft = a:is_ftplugin
call s:Map('n', '<F1>', ':help :Git_blame<CR>', '<silent>', ft)
call s:Map('n', 'g?', ':help :Git_blame<CR>', '<silent>', ft)
if empty(mapcheck('q', 'n'))
nnoremap <buffer> <silent> q :<C-U>echoerr "fugitive: q removed in favor of gq (or :q)"<CR>
endif
call s:Map('n', 'gq', ':exe <SID>BlameQuit()<CR>', '<silent>', ft)
call s:Map('n', '<2-LeftMouse>', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>', ft)
call s:Map('n', '<CR>', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>', ft)
call s:Map('n', '-', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>', ft)
call s:Map('n', 's', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>', ft)
call s:Map('n', 'u', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>', ft)
call s:Map('n', 'P', ':<C-U>exe <SID>BlameJump("^".v:count1)<CR>', '<silent>', ft)
call s:Map('n', '~', ':<C-U>exe <SID>BlameJump("~".v:count1)<CR>', '<silent>', ft)
call s:Map('n', 'i', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>', ft)
call s:Map('n', 'o', ':<C-U>exe <SID>BlameCommit("split")<CR>', '<silent>', ft)
call s:Map('n', 'O', ':<C-U>exe <SID>BlameCommit("tabedit")<CR>', '<silent>', ft)
call s:Map('n', 'p', ':<C-U>exe <SID>BlameCommit("pedit")<CR>', '<silent>', ft)
call s:Map('n', '.', ":<C-U> <C-R>=substitute(<SID>BlameCommitFileLnum()[0],'^$','@','')<CR><Home>", ft)
call s:Map('n', '(', "-", ft)
call s:Map('n', ')', "+", ft)
call s:Map('n', 'A', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze [0-9:/+-][0-9:/+ -]* \\d\\+)')+1+v:count)<CR>", '<silent>', ft)
call s:Map('n', 'C', ":<C-u>exe 'vertical resize '.(<SID>linechars('^\\S\\+')+1+v:count)<CR>", '<silent>', ft)
call s:Map('n', 'D', ":<C-u>exe 'vertical resize '.(<SID>linechars('.\\{-\\}\\ze\\d\\ze\\s\\+\\d\\+)')+1-v:count)<CR>", '<silent>', ft)
endfunction
function! fugitive#BlameFileType() abort function! fugitive#BlameFileType() abort
setlocal nomodeline setlocal nomodeline
setlocal foldmethod=manual setlocal foldmethod=manual
@ -7073,29 +7138,7 @@ function! fugitive#BlameFileType() abort
if &modifiable if &modifiable
return '' return ''
endif endif
call s:Map('n', '<F1>', ':help :Git_blame<CR>', '<silent>') call s:BlameMaps(1)
call s:Map('n', 'g?', ':help :Git_blame<CR>', '<silent>')
if empty(mapcheck('q', 'n'))
nnoremap <buffer> <silent> q :<C-U>echoerr "fugitive: q removed in favor of gq (or :q)"<CR>
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>')
call s:Map('n', '<CR>', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>')
call s:Map('n', '-', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>')
call s:Map('n', 's', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>')
call s:Map('n', 'u', ':<C-U>exe <SID>BlameJump("")<CR>', '<silent>')
call s:Map('n', 'P', ':<C-U>exe <SID>BlameJump("^".v:count1)<CR>', '<silent>')
call s:Map('n', '~', ':<C-U>exe <SID>BlameJump("~".v:count1)<CR>', '<silent>')
call s:Map('n', 'i', ':<C-U>exe <SID>BlameCommit("exe <SID>BlameLeave()<Bar>edit")<CR>', '<silent>')
call s:Map('n', 'o', ':<C-U>exe <SID>BlameCommit("split")<CR>', '<silent>')
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', '(', "-")
call s:Map('n', ')', "+")
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 endfunction
augroup fugitive_blame augroup fugitive_blame

View File

@ -318,6 +318,7 @@ dv Perform a |:Gvdiffsplit| on the file under the cursor.
*fugitive_ds* *fugitive_dh* *fugitive_ds* *fugitive_dh*
ds Perform a |:Ghdiffsplit| on the file under the cursor. ds Perform a |:Ghdiffsplit| on the file under the cursor.
dh dh
*fugitive_dq* *fugitive_dq*
dq Close all but one diff buffer, and |:diffoff|! the dq Close all but one diff buffer, and |:diffoff|! the
last one. last one.

View File

@ -628,7 +628,7 @@ augroup fugitive
autocmd BufReadCmd index{,.lock} autocmd BufReadCmd index{,.lock}
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) | \ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
\ let b:git_dir = s:Slash(expand('<amatch>:p:h')) | \ let b:git_dir = s:Slash(expand('<amatch>:p:h')) |
\ exe fugitive#BufReadStatus() | \ exe fugitive#BufReadStatus(v:cmdbang) |
\ elseif filereadable(expand('<amatch>')) | \ elseif filereadable(expand('<amatch>')) |
\ silent doautocmd BufReadPre | \ silent doautocmd BufReadPre |
\ keepalt read <amatch> | \ keepalt read <amatch> |

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Nathanael Kane
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,4 +1,4 @@
# Indent Guides # Indent Guides (unmaintained)
Indent Guides is a plugin for visually displaying indent levels in Vim. Indent Guides is a plugin for visually displaying indent levels in Vim.
<img src="http://i.imgur.com/ONgoj.png" width="448" height="448" alt="" /> <img src="http://i.imgur.com/ONgoj.png" width="448" height="448" alt="" />

View File

@ -216,6 +216,7 @@ snippet try
}catch(${1}) { }catch(${1}) {
} }
# auto function
snippet af auto function snippet af auto function
auto ${1:name}(${2}) -> ${3:void} auto ${1:name}(${2}) -> ${3:void}
{ {

View File

@ -974,6 +974,7 @@ snippet pi:e
snippet pi:c snippet pi:c
place-items: center; place-items: center;
snippet pi:st snippet pi:st
place-items: stretch;
snippet pos snippet pos
position: ${1};${0} position: ${1};${0}
snippet pos:a snippet pos:a

View File

@ -399,7 +399,7 @@ snippet h6#
<h6 id="${1}">${0}</h6> <h6 id="${1}">${0}</h6>
snippet head snippet head
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta charset="utf-8">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title> <title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${0} ${0}
@ -609,7 +609,9 @@ snippet meta:d
snippet meta:compat snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}"> <meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
snippet meta:refresh snippet meta:refresh
<meta http-equiv="refresh" content="text/html;charset=UTF-8"> <meta http-equiv="refresh" content="3;url=${0}">
snippet meta:utf5
<meta charset="utf-8">
snippet meta:utf snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8"> <meta http-equiv="content-type" content="text/html;charset=UTF-8">
snippet meter snippet meter

View File

@ -1,6 +1,6 @@
" surround.vim - Surroundings " surround.vim - Surroundings
" Author: Tim Pope <http://tpo.pe/> " Author: Tim Pope <http://tpo.pe/>
" Version: 2.1 " Version: 2.2
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
if exists("g:loaded_surround") || &cp || v:version < 700 if exists("g:loaded_surround") || &cp || v:version < 700