mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
Amir 2021-06-23 11:57:12 +02:00
parent 2dc46c9a65
commit fd420a0521
26 changed files with 208 additions and 73 deletions

View File

@ -132,7 +132,9 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern]) for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
if empty(l:match[2]) && empty(l:match[3]) if empty(l:match[2]) && empty(l:match[3])
let l:output[-1].col = len(l:match[1]) if !empty(l:match[1]) && !empty(l:output)
let l:output[-1].col = len(l:match[1])
endif
elseif empty(l:match[3]) elseif empty(l:match[3])
" Add symbols to 'cannot find symbol' errors. " Add symbols to 'cannot find symbol' errors.
if l:output[-1].text is# 'error: cannot find symbol' if l:output[-1].text is# 'error: cannot find symbol'

View File

@ -0,0 +1,35 @@
function! ale_linters#yaml#circleci#Handle(buffer, lines) abort
let l:match_index = -1
let l:output = []
for l:index in range(len(a:lines))
let l:line = a:lines[l:index]
if l:line =~? 'Error: ERROR IN CONFIG FILE:'
let l:match_index = l:index + 1
break
endif
endfor
if l:match_index > 0
return [{
\ 'type': 'E',
\ 'lnum': 1,
\ 'text': a:lines[l:match_index],
\ 'detail': join(a:lines[l:match_index :], "\n"),
\}]
endif
return []
endfunction
" The circleci validate requires network requests, so we'll only run it when
" files are saved to prevent the server from being hammered.
call ale#linter#Define('yaml', {
\ 'name': 'circleci',
\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''},
\ 'command': 'circleci config validate - < %s',
\ 'callback': 'ale_linters#yaml#circleci#Handle',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,
\})

View File

@ -269,13 +269,19 @@ function! s:ReplaceCompletionOptions(source) abort
let b:ale_old_completeopt = &l:completeopt let b:ale_old_completeopt = &l:completeopt
endif endif
if &l:completeopt =~# 'preview' let l:opt_list = split(&l:completeopt, ',')
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' " The menu and noinsert options must be set, or automatic completion
elseif &l:completeopt =~# 'popup' " will be annoying.
let &l:completeopt = 'menu,menuone,popup,noselect,noinsert' let l:new_opt_list = ['menu', 'menuone', 'noinsert']
else
let &l:completeopt = 'menu,menuone,noselect,noinsert' " Permit some other completion options, provided users have set them.
endif for l:opt in ['preview', 'popup', 'noselect']
if index(l:opt_list, l:opt) >= 0
call add(l:new_opt_list, l:opt)
endif
endfor
let &l:completeopt = join(l:new_opt_list, ',')
endif endif
endfunction endfunction

View File

@ -259,9 +259,7 @@ function! ale#debugging#InfoToClipboard() abort
return return
endif endif
redir => l:output let l:output = execute('call ale#debugging#Info()')
silent call ale#debugging#Info()
redir END
let @+ = l:output let @+ = l:output
call s:Echo('ALEInfo copied to your clipboard') call s:Echo('ALEInfo copied to your clipboard')
@ -270,9 +268,7 @@ endfunction
function! ale#debugging#InfoToFile(filename) abort function! ale#debugging#InfoToFile(filename) abort
let l:expanded_filename = expand(a:filename) let l:expanded_filename = expand(a:filename)
redir => l:output let l:output = execute('call ale#debugging#Info()')
silent call ale#debugging#Info()
redir END
call writefile(split(l:output, "\n"), l:expanded_filename) call writefile(split(l:output, "\n"), l:expanded_filename)
call s:Echo('ALEInfo written to ' . l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename)

View File

@ -4,9 +4,7 @@
function! ale#filetypes#LoadExtensionMap() abort function! ale#filetypes#LoadExtensionMap() abort
" Output includes: " Output includes:
" '*.erl setf erlang' " '*.erl setf erlang'
redir => l:output let l:output = execute('exec "autocmd"')
silent exec 'autocmd'
redir end
let l:map = {} let l:map = {}

View File

@ -2,10 +2,10 @@
" Description: Functions for working with eslint, for checking or fixing files. " Description: Functions for working with eslint, for checking or fixing files.
let s:executables = [ let s:executables = [
\ '.yarn/sdks/eslint/bin/eslint.js',
\ 'node_modules/.bin/eslint_d', \ 'node_modules/.bin/eslint_d',
\ 'node_modules/eslint/bin/eslint.js', \ 'node_modules/eslint/bin/eslint.js',
\ 'node_modules/.bin/eslint', \ 'node_modules/.bin/eslint',
\ '.yarn/sdks/eslint/bin/eslint',
\] \]
let s:sep = has('win32') ? '\' : '/' let s:sep = has('win32') ? '\' : '/'
@ -52,14 +52,20 @@ function! ale#handlers#eslint#GetCwd(buffer) abort
let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables)
if !empty(l:executable) if !empty(l:executable)
let l:nmi = strridx(l:executable, 'node_modules') let l:modules_index = strridx(l:executable, 'node_modules')
let l:project_dir = l:executable[0:l:nmi - 2] let l:modules_root = l:modules_index > -1 ? l:executable[0:l:modules_index - 2] : ''
let l:sdks_index = strridx(l:executable, ale#path#Simplify('.yarn/sdks'))
let l:sdks_root = l:sdks_index > -1 ? l:executable[0:l:sdks_index - 2] : ''
else else
let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules')
let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' let l:modules_root = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : ''
let l:sdks_dir = ale#path#FindNearestDirectory(a:buffer, ale#path#Simplify('.yarn/sdks'))
let l:sdks_root = !empty(l:sdks_dir) ? fnamemodify(l:sdks_dir, ':h:h:h') : ''
endif endif
return !empty(l:project_dir) ? l:project_dir : '' return strlen(l:modules_root) > strlen(l:sdks_root) ? l:modules_root : l:sdks_root
endfunction endfunction
function! ale#handlers#eslint#GetCommand(buffer) abort function! ale#handlers#eslint#GetCommand(buffer) abort

View File

@ -52,9 +52,7 @@ endif
function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort
let l:verbose = &verbose let l:verbose = &verbose
set verbose=0 set verbose=0
redir => l:output let l:output = execute('highlight SignColumn', 'silent')
0verbose silent highlight SignColumn
redir end
let &verbose = l:verbose let &verbose = l:verbose
let l:highlight_syntax = join(split(l:output)[2:]) let l:highlight_syntax = join(split(l:output)[2:])
@ -171,10 +169,10 @@ endfunction
" Read sign data for a buffer to a list of lines. " Read sign data for a buffer to a list of lines.
function! ale#sign#ReadSigns(buffer) abort function! ale#sign#ReadSigns(buffer) abort
redir => l:output let l:output = execute(
silent execute 'sign place ' . s:GroupCmd() . s:PriorityCmd() \ 'sign place ' . s:GroupCmd() . s:PriorityCmd()
\ . ' buffer=' . a:buffer \ . ' buffer=' . a:buffer
redir end \ )
return split(l:output, "\n") return split(l:output, "\n")
endfunction endfunction

View File

@ -568,6 +568,7 @@ Notes:
* XML * XML
* `xmllint` * `xmllint`
* YAML * YAML
* `circleci`!!
* `prettier` * `prettier`
* `spectral` * `spectral`
* `swaglint` * `swaglint`

View File

@ -1,6 +1,28 @@
=============================================================================== ===============================================================================
ALE YAML Integration *ale-yaml-options* ALE YAML Integration *ale-yaml-options*
===============================================================================
circleci *ale-yaml-circleci*
Website: https://circleci.com/docs/2.0/local-cli
Installation
-------------------------------------------------------------------------------
Follow the instructions on the website, and make sure to test that you can
validate configuration files with: >
circleci config validate - < .circleci/config.yml
<
As long as the validator runs correctly, you should be able to see errors when
you save the configuration file. The validator doesn't run as you type because
it sends network requests, and running too often would overload the circleci
servers.
=============================================================================== ===============================================================================
prettier *ale-yaml-prettier* prettier *ale-yaml-prettier*
@ -15,11 +37,13 @@ Install prettier either globally or locally: >
npm install prettier -g # global npm install prettier -g # global
npm install prettier # local npm install prettier # local
< <
=============================================================================== ===============================================================================
spectral *ale-yaml-spectral* spectral *ale-yaml-spectral*
Website: https://github.com/stoplightio/spectral Website: https://github.com/stoplightio/spectral
Installation Installation
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -80,6 +104,7 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global*
See |ale-integrations-local-executables| See |ale-integrations-local-executables|
=============================================================================== ===============================================================================
yamlfix *ale-yaml-yamlfix* yamlfix *ale-yaml-yamlfix*
@ -118,6 +143,7 @@ g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global*
See |ale-integrations-local-executables| See |ale-integrations-local-executables|
=============================================================================== ===============================================================================
yamllint *ale-yaml-yamllint* yamllint *ale-yaml-yamllint*

View File

@ -561,7 +561,6 @@ vimrc, and your issues should go away. >
set completeopt=menu,menuone,preview,noselect,noinsert set completeopt=menu,menuone,preview,noselect,noinsert
< <
Or alternatively, if you want to show documentation in popups: > Or alternatively, if you want to show documentation in popups: >
set completeopt=menu,menuone,popup,noselect,noinsert set completeopt=menu,menuone,popup,noselect,noinsert
@ -3083,6 +3082,7 @@ documented in additional help files.
xml.....................................|ale-xml-options| xml.....................................|ale-xml-options|
xmllint...............................|ale-xml-xmllint| xmllint...............................|ale-xml-xmllint|
yaml....................................|ale-yaml-options| yaml....................................|ale-yaml-options|
circleci..............................|ale-yaml-circleci|
prettier..............................|ale-yaml-prettier| prettier..............................|ale-yaml-prettier|
spectral..............................|ale-yaml-spectral| spectral..............................|ale-yaml-spectral|
swaglint..............................|ale-yaml-swaglint| swaglint..............................|ale-yaml-swaglint|
@ -3734,6 +3734,21 @@ ale#fix#registry#Add(name, func, filetypes, desc, [aliases])
ALE will search for fixers in the registry first by `name`, then by their ALE will search for fixers in the registry first by `name`, then by their
`aliases`. `aliases`.
For example to register a custom fixer for `luafmt`: >
function! FormatLua(buffer) abort
return {
\ 'command': 'luafmt --stdin'
\}
endfunction
execute ale#fix#registry#Add('luafmt', 'FormatLua', ['lua'], 'luafmt for lua')
" You can now use it in g:ale_fixers
let g:ale_fixers = {
\ 'lua': ['luafmt']
}
<
ale#linter#Define(filetype, linter) *ale#linter#Define()* ale#linter#Define(filetype, linter) *ale#linter#Define()*

View File

@ -577,6 +577,7 @@ formatting.
* XML * XML
* [xmllint](http://xmlsoft.org/xmllint.html) * [xmllint](http://xmlsoft.org/xmllint.html)
* YAML * YAML
* [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk:
* [prettier](https://github.com/prettier/prettier) * [prettier](https://github.com/prettier/prettier)
* [spectral](https://github.com/stoplightio/spectral) * [spectral](https://github.com/stoplightio/spectral)
* [swaglint](https://github.com/byCedric/swaglint) * [swaglint](https://github.com/byCedric/swaglint)

View File

@ -16,7 +16,7 @@ This plugin provides [ALE](https://github.com/w0rp/ale) indicator for the [light
Install using a plugin manager of your choice, for example: Install using a plugin manager of your choice, for example:
```viml ```viml
call dein#add('w0rp/ale') " Dependency: linter call dein#add('dense-analysis/ale') " Dependency: linter
call dein#add('itchyny/lightline.vim') " Dependency: status line call dein#add('itchyny/lightline.vim') " Dependency: status line
call dein#add('maximbaz/lightline-ale') call dein#add('maximbaz/lightline-ale')
``` ```

View File

@ -41,7 +41,7 @@ endfunction
function! s:WinShellEsc(arg) abort function! s:WinShellEsc(arg) abort
if type(a:arg) == type([]) if type(a:arg) == type([])
return join(map(copy(a:arg), 's:shellesc(v:val)')) return join(map(copy(a:arg), 's:WinShellEsc(v:val)'))
elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$'
return a:arg return a:arg
else else
@ -1480,7 +1480,7 @@ function! fugitive#getfperm(url) abort
return perm ==# '---------' ? '' : perm return perm ==# '---------' ? '' : perm
endfunction endfunction
function s:UpdateIndex(dir, info) abort function! s:UpdateIndex(dir, info) abort
let info = join(a:info[0:-2]) . "\t" . a:info[-1] . "\n" let info = join(a:info[0:-2]) . "\t" . a:info[-1] . "\n"
let [error, exec_error] = s:SystemError([a:dir, 'update-index', '--index-info'], info) let [error, exec_error] = s:SystemError([a:dir, 'update-index', '--index-info'], info)
return !exec_error ? '' : len(error) ? error : 'fugitive: unknown update-index error' return !exec_error ? '' : len(error) ? error : 'fugitive: unknown update-index error'
@ -2807,8 +2807,9 @@ function! fugitive#PagerFor(argv, ...) abort
return 0 return 0
elseif type(value) == type('') elseif type(value) == type('')
return value return value
elseif args[0] =~# '^\%(branch\|config\|diff\|grep\|log\|range-diff\|reflog\|shortlog\|show\|tag\|whatchanged\)$' || elseif args[0] =~# '^\%(branch\|config\|diff\|grep\|log\|range-diff\|shortlog\|show\|tag\|whatchanged\)$' ||
\ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') ||
\ (args[0] ==# 'reflog' && get(args, 1, '') !~# '^\%(expire\|delete\|exists\)$') ||
\ (args[0] ==# 'am' && s:HasOpt(args, '--show-current-patch')) \ (args[0] ==# 'am' && s:HasOpt(args, '--show-current-patch'))
return 1 return 1
else else
@ -2861,7 +2862,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
let name = substitute(get(args, 0, ''), '\%(^\|-\)\(\l\)', '\u\1', 'g') let name = substitute(get(args, 0, ''), '\%(^\|-\)\(\l\)', '\u\1', 'g')
let git = s:UserCommandList() let git = s:UserCommandList()
let options = {'git': git, 'dir': dir, 'flags': flags} let options = {'git': git, 'dir': dir, 'flags': flags}
if pager is# -1 && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' if pager is# -1 && name =~# '^\a\+$' && exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help'
try try
let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'subcommand': args[0], 'subcommand_args': args[1:-1]}, options)) let overrides = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, extend({'subcommand': args[0], 'subcommand_args': args[1:-1]}, options))
if type(overrides) == type('') if type(overrides) == type('')
@ -2936,7 +2937,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
call extend(env, {'COLUMNS': '' . &columns - 1}, 'keep') call extend(env, {'COLUMNS': '' . &columns - 1}, 'keep')
endif endif
if s:RunJobs() && pager isnot# 1 if s:RunJobs() && pager isnot# 1
let state.pty = get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim'))) let state.pty = get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim')) && fugitive#GitVersion() !~# '\.windows\>')
if !state.pty if !state.pty
let args = s:AskPassArgs(dir) + args let args = s:AskPassArgs(dir) + args
endif endif
@ -2993,9 +2994,19 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
return 'call fugitive#Resume()|silent checktime' . after return 'call fugitive#Resume()|silent checktime' . after
elseif pager is# 1 elseif pager is# 1
let pre = s:BuildEnvPrefix(env) let pre = s:BuildEnvPrefix(env)
silent! execute '!' . escape(pre . s:UserCommand({'git': git, 'dir': dir}, s:disable_colors + flags + ['--no-pager'] + args), '!#%') . try
\ (&shell =~# 'csh' ? ' >& ' . s:shellesc(state.file) : ' > ' . s:shellesc(state.file) . ' 2>&1') if exists('+guioptions') && &guioptions =~# '!'
let state.exit_status = v:shell_error let guioptions = &guioptions
set guioptions-=!
endif
silent! execute '!' . escape(pre . s:UserCommand({'git': git, 'dir': dir}, s:disable_colors + flags + ['--no-pager'] + args), '!#%') .
\ (&shell =~# 'csh' ? ' >& ' . s:shellesc(state.file) : ' > ' . s:shellesc(state.file) . ' 2>&1')
let state.exit_status = v:shell_error
finally
if exists('guioptions')
let &guioptions = guioptions
endif
endtry
redraw! redraw!
call s:RunSave(state) call s:RunSave(state)
call s:RunFinished(state) call s:RunFinished(state)
@ -3968,7 +3979,7 @@ function! s:StageApply(info, reverse, extra) abort
endif endif
endwhile endwhile
if start == 0 if start == 0
throw 'fugitive: cold not find hunk' throw 'fugitive: could not find hunk'
elseif getline(start) !~# '^@@ ' elseif getline(start) !~# '^@@ '
throw 'fugitive: cannot apply conflict hunk' throw 'fugitive: cannot apply conflict hunk'
endif endif
@ -5487,8 +5498,6 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
set diffopt-=vertical set diffopt-=vertical
endif endif
execute mods 'diffsplit' s:fnameescape(spec) execute mods 'diffsplit' s:fnameescape(spec)
let &l:readonly = &l:readonly
redraw
let w:fugitive_diff_restore = restore let w:fugitive_diff_restore = restore
let winnr = winnr() let winnr = winnr()
if getwinvar('#', '&diff') if getwinvar('#', '&diff')

View File

@ -1,4 +1,4 @@
if exists("b:did_ftplugin") || !exists('*fugitive#BlameFileType') if exists("b:did_ftplugin") || !exists("*FugitiveGitDir")
finish finish
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1

View File

@ -1,4 +1,4 @@
if exists("b:current_syntax") if exists("b:current_syntax") || !exists("*FugitiveGitDir")
finish finish
endif endif

View File

@ -77,13 +77,16 @@ nvim -u NONE -c "helptags vim-gitgutter/doc" -c q
### Windows ### Windows
I recommend configuring vim-gitgutter with the full path to your git executable. For example: There is a potential risk on Windows due to `cmd.exe` prioritising the current folder over folders in `PATH`. If you have a file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder, it will be executed instead of git whenever the plugin calls git.
You can avoid this risk by configuring the full path to your git executable. For example:
```viml ```viml
" This path probably won't work
let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe' let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'
``` ```
This is to avoid a problem which occurs if you have file named `git.*` (i.e. with any extension in `PATHEXT`) in your current folder. `cmd.exe` prioritises the current folder over folders in `PATH` and will try to execute your file instead of the `git` binary. Unfortunately I don't know the correct escaping for the path - if you do, please let me know!
### Getting started ### Getting started

View File

@ -64,7 +64,7 @@ function! gitgutter#hunk#next_hunk(count) abort
if g:gitgutter_show_msg_on_hunk_jumping if g:gitgutter_show_msg_on_hunk_jumping
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
endif endif
if s:is_preview_window_open() if gitgutter#hunk#is_preview_window_open()
call gitgutter#hunk#preview() call gitgutter#hunk#preview()
endif endif
return return
@ -95,7 +95,7 @@ function! gitgutter#hunk#prev_hunk(count) abort
if g:gitgutter_show_msg_on_hunk_jumping if g:gitgutter_show_msg_on_hunk_jumping
redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks)) redraw | echo printf('Hunk %d of %d', index(hunks, hunk) + 1, len(hunks))
endif endif
if s:is_preview_window_open() if gitgutter#hunk#is_preview_window_open()
call gitgutter#hunk#preview() call gitgutter#hunk#preview()
endif endif
return return
@ -249,7 +249,7 @@ function! s:hunk_op(op, ...)
let hunk_diff = join(hunk_header + hunk_body, "\n")."\n" let hunk_diff = join(hunk_header + hunk_body, "\n")."\n"
call s:goto_original_window() call s:goto_original_window()
call s:close_hunk_preview_window() call gitgutter#hunk#close_hunk_preview_window()
call s:stage(hunk_diff) call s:stage(hunk_diff)
endif endif
@ -427,7 +427,7 @@ endfunction
function! s:open_hunk_preview_window() function! s:open_hunk_preview_window()
if g:gitgutter_preview_win_floating if g:gitgutter_preview_win_floating
if exists('*nvim_open_win') if exists('*nvim_open_win')
call s:close_hunk_preview_window() call gitgutter#hunk#close_hunk_preview_window()
let buf = nvim_create_buf(v:false, v:false) let buf = nvim_create_buf(v:false, v:false)
" Set default width and height for now. " Set default width and height for now.
@ -446,9 +446,15 @@ function! s:open_hunk_preview_window()
call nvim_buf_set_name(buf, 'gitgutter://hunk-preview') call nvim_buf_set_name(buf, 'gitgutter://hunk-preview')
" Assumes cursor is in original window. " Assumes cursor is in original window.
autocmd CursorMoved <buffer> ++once call s:close_hunk_preview_window() autocmd CursorMoved <buffer> ++once call gitgutter#hunk#close_hunk_preview_window()
if g:gitgutter_close_preview_on_escape if g:gitgutter_close_preview_on_escape
nnoremap <buffer> <silent> <Esc> :call <SID>close_hunk_preview_window()<CR> " 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 endif
return return
@ -584,7 +590,7 @@ function! s:goto_original_window()
endfunction endfunction
function! s:close_hunk_preview_window() function! gitgutter#hunk#close_hunk_preview_window()
let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr
call setbufvar(bufnr, '&modified', 0) call setbufvar(bufnr, '&modified', 0)
@ -601,12 +607,17 @@ function! s:close_hunk_preview_window()
endfunction endfunction
" Only makes sense for traditional, non-floating preview window. function gitgutter#hunk#is_preview_window_open()
function s:is_preview_window_open() if g:gitgutter_preview_win_floating
for i in range(1, winnr('$')) if win_id2win(s:winid) > 0
if getwinvar(i, '&previewwindow') execute win_id2win(s:winid).'wincmd c'
return 1
endif endif
endfor else
for i in range(1, winnr('$'))
if getwinvar(i, '&previewwindow')
return 1
endif
endfor
endif
return 0 return 0
endfunction endfunction

View File

@ -63,15 +63,20 @@ Neovim:~
=============================================================================== ===============================================================================
WINDOWS *gitgutter-windows* WINDOWS *gitgutter-windows*
I recommend configuring vim-gitgutter with the full path to your git executable. There is a potential risk on Windows due to `cmd.exe` prioritising the current
folder over folders in `PATH`. If you have a file named `git.*` (i.e. with
any extension in `PATHEXT`) in your current folder, it will be executed
instead of git whenever the plugin calls git.
You can avoid this risk by configuring the full path to your git executable.
For example: For example:
> >
" This path probably won't work
let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe' let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'
< <
This is to avoid a problem which occurs if you have file named "git.*" (i.e.
with any extension in "PATHEXT") in your current folder. "cmd.exe" prioritises Unfortunately I don't know the correct escaping for the path - if you do,
the current folder over folders in 'PATH' and will try to execute your file please let me know!
instead of the "git" binary.
=============================================================================== ===============================================================================
@ -190,6 +195,12 @@ Commands for operating on a hunk:~
the original window with |CTRL-W_p|. Alternatively set the original window with |CTRL-W_p|. Alternatively set
|g:gitgutter_close_preview_on_escape| and use <Esc>. |g:gitgutter_close_preview_on_escape| and use <Esc>.
Two functions are available for your own logic:
>
gitgutter#hunk#is_preview_window_open()
gitgutter#hunk#close_hunk_preview_window()
<
Commands for folds:~ Commands for folds:~
*gitgutter-:GitGutterFold* *gitgutter-:GitGutterFold*

View File

@ -42,4 +42,12 @@ describe "Syntax highlighting" do
validates_inclusion_of :gender, in: %w(male female), if: :gender_required? validates_inclusion_of :gender, in: %w(male female), if: :gender_required?
EOF EOF
end end
specify "nested parentheses inside symbols" do
assert_correct_highlighting <<~EOF, 'bar\zs)', 'rubySymbol'
h = %i(
foo(bar)baz
)
EOF
end
end end

View File

@ -2,7 +2,7 @@
let s:debug = 0 let s:debug = 0
function! s:CursorHasGroup(group) abort function! s:CursorHasGroup(group) abort
return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ a:group return synIDattr(synID(line('.'), col('.'), 1), 'name') =~ a:group
endfunction endfunction
function! TestSyntax(pattern, group) abort function! TestSyntax(pattern, group) abort

View File

@ -133,10 +133,10 @@ syn match rubyCurlyBraceEscape "\\[{}]" contained display
syn match rubyAngleBracketEscape "\\[<>]" contained display syn match rubyAngleBracketEscape "\\[<>]" contained display
syn match rubySquareBracketEscape "\\[[\]]" contained display syn match rubySquareBracketEscape "\\[[\]]" contained display
syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" end=")" transparent contained
syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" end="}" transparent contained
syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" end=">" transparent contained
syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" end="\]" transparent contained
syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape syn cluster rubySingleCharEscape contains=rubyBackslashEscape,rubyQuoteEscape,rubySpaceEscape,rubyParenthesisEscape,rubyCurlyBraceEscape,rubyAngleBracketEscape,rubySquareBracketEscape
syn cluster rubyNestedBrackets contains=rubyNested.\+ syn cluster rubyNestedBrackets contains=rubyNested.\+

View File

@ -532,7 +532,7 @@ sources such as creating snippets on the fly representing python function
definitions found in the current file. definitions found in the current file.
Example 2:~ Example 2:~
Add to your ~/.vimrc: For each know snippet add a second version ending in _ Add to your ~/.vimrc: For each new snippet add a second version ending in _
adding folding markers > adding folding markers >
let g:commentChar = { let g:commentChar = {

View File

@ -32,3 +32,12 @@ endsnippet
snippet fld "type field documentation" b snippet fld "type field documentation" b
#' @field ${1:name}::${2:Type} ${0:Description} #' @field ${1:name}::${2:Type} ${0:Description}
endsnippet endsnippet
# Debugging
snippet deb "Debugger breakpoint" b
Main.@bp
endsnippet
snippet inf "Infiltrator breakpoint" b
Main.@infiltrate
endsnippet

View File

@ -241,7 +241,7 @@ snippet addsp
snippet addarg snippet addarg
parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}") parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}")
snippet addnarg snippet addnarg
parser.add_argument("${0:arg}", nargs="${1:*}", default"${2:None}, help="${3:Help text}") parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}")
snippet addaarg snippet addaarg
parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}") parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}")
snippet pargs snippet pargs

View File

@ -101,7 +101,7 @@ snippet crate "Define create meta attributes"
// Crate name // Crate name
#![crate_name = "${1:crate_name}"] #![crate_name = "${1:crate_name}"]
// Additional metadata attributes // Additional metadata attributes
#![desc = "${2:Descrption.}"] #![desc = "${2:Description.}"]
#![license = "${3:BSD}"] #![license = "${3:BSD}"]
#![comment = "${4:Comment.}"] #![comment = "${4:Comment.}"]
// Specify the output type // Specify the output type

View File

@ -118,7 +118,7 @@ snippet vfilter
snippet vfor snippet vfor
<div v-for="${1:item} in ${2:items}" :key="$1.id"> <div v-for="${1:item} in ${2:items}" :key="$1.id">
{{ $1 }} {{ $1 }}
</div </div>
snippet vgetters snippet vgetters
getters: { getters: {