1
0
Fork 0
mirror of synced 2024-12-22 06:51:06 -05:00

Updated plugins

This commit is contained in:
Amir 2020-04-25 21:56:16 -04:00
parent d98c510eee
commit fef069af24
114 changed files with 4018 additions and 988 deletions

View file

@ -29,6 +29,6 @@ call ale#linter#Define('clojure', {
\ 'name': 'clj-kondo',
\ 'output_stream': 'stdout',
\ 'executable': 'clj-kondo',
\ 'command': 'clj-kondo --lint %t',
\ 'command': 'clj-kondo --cache --lint %t',
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
\})

View file

@ -174,6 +174,7 @@ endfunction
call ale#linter#Define('kotlin', {
\ 'name': 'kotlinc',
\ 'executable': 'kotlinc',
\ 'output_stream': 'stderr',
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
\ 'lint_file': 1,

View file

@ -32,6 +32,8 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
\)
endif
endfor
return ''
endfunction
function! ale_linters#scala#metals#GetCommand(buffer) abort

View file

@ -0,0 +1,25 @@
" Author: OJFord <dev@ojford.com>
" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp)
call ale#Set('terraform_langserver_executable', 'terraform-lsp')
call ale#Set('terraform_langserver_options', '')
function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options'))
endfunction
function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
endfunction
call ale#linter#Define('terraform', {
\ 'name': 'terraform_lsp',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')},
\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'),
\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'),
\ 'language': 'terraform',
\})

View file

@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
" %Warning-UNUSED: test.v:4: Signal is not used: dout
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
" Since version 4.032 (04/2020) verilator linter messages also contain the column number,
" and look like:
" %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
"
" to stay compatible with old versions of the tool, the column number is
" optional in the researched pattern
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:line = l:match[3] + 0
let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
let l:text = l:match[4]
let l:item = {
\ 'lnum': str2nr(l:match[3]),
\ 'text': l:match[5],
\ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
\}
if !empty(l:match[4])
let l:item.col = str2nr(l:match[4])
endif
let l:file = l:match[2]
if l:file =~# '_verilator_linted.v'
call add(l:output, {
\ 'lnum': l:line,
\ 'text': l:text,
\ 'type': l:type,
\})
call add(l:output, l:item)
endif
endfor

View file

@ -0,0 +1,61 @@
" Author: Jeffrey Lau - https://github.com/zoonfafer
" Description: Vim Language Server integration for ALE
call ale#Set('vim_vimls_executable', 'vim-language-server')
call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('vim_vimls_config', {})
function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort
let l:trigger_file_candidates = [
\ '.vimrc',
\ 'init.vim',
\]
for l:candidate in l:trigger_file_candidates
let l:trigger_file = fnamemodify(bufname(a:buffer), ':t')
if l:trigger_file is# l:candidate
return fnamemodify(
\ bufname(a:buffer),
\ ':h',
\)
endif
endfor
let l:trigger_dir_candidates = [
\ 'autoload',
\ 'plugin',
\ '.git',
\]
let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h'))
for l:path in l:path_upwards
for l:candidate in l:trigger_dir_candidates
let l:trigger_dir = ale#path#Simplify(
\ l:path . '/' . l:candidate,
\)
if isdirectory(l:trigger_dir)
return fnamemodify(
\ l:trigger_dir,
\ ':p:h:h',
\)
endif
endfor
endfor
return ''
endfunction
call ale#linter#Define('vim', {
\ 'name': 'vimls',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')},
\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [
\ 'node_modules/.bin/vim-language-server',
\ ])},
\ 'command': '%e --stdio',
\ 'language': 'vim',
\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'),
\})

View file

@ -258,9 +258,9 @@ function! ale#GetLocItemMessage(item, format_string) abort
" Replace special markers with certain information.
" \=l:variable is used to avoid escaping issues.
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g')
let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g')
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
" Replace %s with the text.
let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g')

View file

@ -1,4 +1,4 @@
" Author: Andrew Lee <andrewl@mbda.fun>.
" Author: Andrew Lee <andrew.lambda@tuta.io>.
" Inspired by ale/gradle.vim by Michael Pardo <michael@michaelpardo.com>
" Description: Functions for working with Ant projects.

View file

@ -1,7 +1,7 @@
" Author: Jerko Steiner <jerko.steiner@gmail.com>
" Description: Code action support for LSP / tsserver
function! ale#code_action#HandleCodeAction(code_action) abort
function! ale#code_action#HandleCodeAction(code_action, should_save) abort
let l:current_buffer = bufnr('')
let l:changes = a:code_action.changes
@ -17,11 +17,14 @@ function! ale#code_action#HandleCodeAction(code_action) abort
for l:file_code_edit in l:changes
call ale#code_action#ApplyChanges(
\ l:file_code_edit.fileName, l:file_code_edit.textChanges)
\ l:file_code_edit.fileName,
\ l:file_code_edit.textChanges,
\ a:should_save,
\ )
endfor
endfunction
function! ale#code_action#ApplyChanges(filename, changes) abort
function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
let l:current_buffer = bufnr('')
" The buffer is used to determine the fileformat, if available.
let l:buffer = bufnr(a:filename)
@ -106,10 +109,17 @@ function! ale#code_action#ApplyChanges(filename, changes) abort
call remove(l:lines, -1)
endif
call ale#util#Writefile(l:buffer, l:lines, a:filename)
if a:should_save
call ale#util#Writefile(l:buffer, l:lines, a:filename)
else
call ale#util#SetBufferContents(l:buffer, l:lines)
endif
if l:is_current_buffer
call ale#util#Execute(':e!')
if a:should_save
call ale#util#Execute(':e!')
endif
call setpos('.', [0, l:pos[0], l:pos[1], 0])
endif
endfunction

View file

@ -823,7 +823,7 @@ function! ale#completion#HandleUserData(completed_item) abort
endif
for l:code_action in get(l:user_data, 'codeActions', [])
call ale#code_action#HandleCodeAction(l:code_action)
call ale#code_action#HandleCodeAction(l:code_action, v:false)
endfor
endfunction

View file

@ -5,6 +5,7 @@ let s:go_to_definition_map = {}
" Enable automatic updates of the tagstack
let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1)
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
" Used to get the definition map in tests.
function! ale#definition#GetMap() abort
@ -134,6 +135,10 @@ function! s:GoToLSPDefinition(linter, options, capability) abort
endfunction
function! ale#definition#GoTo(options) abort
if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command')
execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.'''
endif
for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp)
call s:GoToLSPDefinition(l:linter, a:options, 'definition')
@ -142,6 +147,10 @@ function! ale#definition#GoTo(options) abort
endfunction
function! ale#definition#GoToType(options) abort
if !get(g:, 'ale_ignore_2_7_warnings') && has_key(a:options, 'deprecated_command')
execute 'echom '':' . a:options.deprecated_command . ' is deprecated. Use `let g:ale_ignore_2_7_warnings = 1` to disable this message.'''
endif
for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp)
" TODO: handle typeDefinition for tsserver if supported by the
@ -154,3 +163,33 @@ function! ale#definition#GoToType(options) abort
endif
endfor
endfunction
function! ale#definition#GoToCommandHandler(command, ...) abort
let l:options = {}
if len(a:000) > 0
for l:option in a:000
if l:option is? '-tab'
let l:options.open_in = 'tab'
elseif l:option is? '-split'
let l:options.open_in = 'split'
elseif l:option is? '-vsplit'
let l:options.open_in = 'vsplit'
endif
endfor
endif
if !has_key(l:options, 'open_in')
let l:default_navigation = ale#Var(bufnr(''), 'default_navigation')
if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0
let l:options.open_in = l:default_navigation
endif
endif
if a:command is# 'type'
call ale#definition#GoToType(l:options)
else
call ale#definition#GoTo(l:options)
endif
endfunction

View file

@ -4,40 +4,15 @@ call ale#Set('fix_on_save_ignore', {})
" Vim doesn't let you modify hidden buffers.
function! ale#fix#ApplyQueuedFixes(buffer) abort
let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0})
let l:has_bufline_api = exists('*deletebufline') && exists('*setbufline')
if !l:data.done || (!l:has_bufline_api && a:buffer isnot bufnr(''))
if !l:data.done || (!ale#util#HasBuflineApi() && a:buffer isnot bufnr(''))
return
endif
call remove(g:ale_fix_buffer_data, a:buffer)
if l:data.changes_made
" If the file is in DOS mode, we have to remove carriage returns from
" the ends of lines before calling setline(), or we will see them
" twice.
let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
\ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')')
\ : l:data.output
let l:first_line_to_remove = len(l:new_lines) + 1
" Use a Vim API for setting lines in other buffers, if available.
if l:has_bufline_api
call setbufline(a:buffer, 1, l:new_lines)
call deletebufline(a:buffer, l:first_line_to_remove, '$')
" Fall back on setting lines the old way, for the current buffer.
else
let l:old_line_length = len(l:data.lines_before)
if l:old_line_length >= l:first_line_to_remove
let l:save = winsaveview()
silent execute
\ l:first_line_to_remove . ',' . l:old_line_length . 'd_'
call winrestview(l:save)
endif
call setline(1, l:new_lines)
endif
let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output)
if l:data.should_save
if a:buffer is bufnr('')

View file

@ -210,6 +210,12 @@ function! ale#highlight#SetHighlights(buffer, loclist) abort
" Set the list in the buffer variable.
call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list)
let l:exclude_list = ale#Var(a:buffer, 'exclude_highlights')
if !empty(l:exclude_list)
call filter(l:new_list, 'empty(ale#util#GetMatches(v:val.text, l:exclude_list))')
endif
" Update highlights for the current buffer, which may or may not
" be the buffer we just set highlights for.
call ale#highlight#UpdateHighlights()

View file

@ -15,7 +15,7 @@ function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort
call ale#code_action#HandleCodeAction({
\ 'description': 'Organize Imports',
\ 'changes': l:file_code_edits,
\})
\}, v:false)
endfunction
function! s:OnReady(linter, lsp_details) abort

View file

@ -1,6 +1,14 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Preview windows for showing whatever information in.
if !has_key(s:, 'last_selection_list')
let s:last_selection_list = []
endif
if !has_key(s:, 'last_selection_open_in')
let s:last_selection_open_in = 'current-buffer'
endif
" Open a preview window and show some lines in it.
" A second argument can be passed as a Dictionary with options. They are...
"
@ -67,9 +75,24 @@ function! ale#preview#ShowSelection(item_list, ...) abort
call ale#preview#Show(l:lines, {'filetype': 'ale-preview-selection'})
let b:ale_preview_item_list = a:item_list
let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer')
" Remove the last preview
let s:last_selection_list = b:ale_preview_item_list
let s:last_selection_open_in = b:ale_preview_item_open_in
endfunction
function! s:Open(open_in_tab) abort
function! ale#preview#RepeatSelection() abort
if empty(s:last_selection_list)
return
endif
call ale#preview#ShowSelection(s:last_selection_list, {
\ 'open_in': s:last_selection_open_in,
\})
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, {})
@ -77,22 +100,20 @@ function! s:Open(open_in_tab) abort
return
endif
if !a:open_in_tab
:q!
endif
:q!
call ale#util#Open(
\ l:item.filename,
\ l:item.line,
\ l:item.column,
\ {'open_in_tab': a:open_in_tab},
\ {'open_in': a:open_in},
\)
endfunction
function! ale#preview#OpenSelectionInBuffer() abort
call s:Open(0)
function! ale#preview#OpenSelection() abort
call s:Open(b:ale_preview_item_open_in)
endfunction
function! ale#preview#OpenSelectionInTab() abort
call s:Open(1)
call s:Open('tab')
endfunction

View file

@ -1,3 +1,5 @@
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
let s:references_map = {}
" Used to get the references map in tests.
@ -99,7 +101,8 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
let l:request_id = ale#lsp#Send(l:id, l:message)
let s:references_map[l:request_id] = {
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0,
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
\}
endfunction
@ -110,10 +113,24 @@ function! ale#references#Find(...) abort
for l:option in a:000
if l:option is? '-relative'
let l:options.use_relative_paths = 1
elseif l:option is? '-tab'
let l:options.open_in = 'tab'
elseif l:option is? '-split'
let l:options.open_in = 'split'
elseif l:option is? '-vsplit'
let l:options.open_in = 'vsplit'
endif
endfor
endif
if !has_key(l:options, 'open_in')
let l:default_navigation = ale#Var(bufnr(''), 'default_navigation')
if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0
let l:options.open_in = l:default_navigation
endif
endif
let l:buffer = bufnr('')
let [l:line, l:column] = getpos('.')[1:2]
let l:column = min([l:column, len(getline(l:line))])

View file

@ -80,7 +80,7 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort
call ale#code_action#HandleCodeAction({
\ 'description': 'rename',
\ 'changes': l:changes,
\})
\}, v:true)
endfunction
function! ale#rename#HandleLSPResponse(conn_id, response) abort
@ -134,7 +134,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
call ale#code_action#HandleCodeAction({
\ 'description': 'rename',
\ 'changes': l:changes,
\})
\}, v:true)
endif
endfunction

View file

@ -23,7 +23,7 @@ let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000)
let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0)
let g:ale_sign_highlight_linenrs = get(g:, 'ale_sign_highlight_linenrs', 0)
let s:supports_sign_groups = has('nvim-0.4.2') || (v:version >= 801 && has('patch614'))
let s:supports_sign_groups = has('nvim-0.4.2') || has('patch-8.1.614')
if !hlexists('ALEErrorSign')
highlight link ALEErrorSign error

View file

@ -91,17 +91,17 @@ endfunction
" options['open_in'] can be:
" current-buffer (default)
" tab
" vertical-split
" horizontal-split
" split
" vsplit
function! ale#util#Open(filename, line, column, options) abort
let l:open_in = get(a:options, 'open_in', 'current-buffer')
let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename)
if l:open_in is# 'tab'
call ale#util#Execute('tabedit ' . l:args_to_open)
elseif l:open_in is# 'horizontal-split'
elseif l:open_in is# 'split'
call ale#util#Execute('split ' . l:args_to_open)
elseif l:open_in is# 'vertical-split'
elseif l:open_in is# 'vsplit'
call ale#util#Execute('vsplit ' . l:args_to_open)
elseif bufnr(a:filename) isnot bufnr('')
" Open another file only if we need to.
@ -336,15 +336,11 @@ function! ale#util#GetMatches(lines, patterns) abort
endfunction
function! s:LoadArgCount(function) abort
let l:Function = a:function
redir => l:output
silent! function Function
redir END
if !exists('l:output')
try
let l:output = execute('function a:function')
catch /E123/
return 0
endif
endtry
let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2]
let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''')
@ -480,3 +476,44 @@ endfunction
function! ale#util#Input(message, value) abort
return input(a:message, a:value)
endfunction
function! ale#util#HasBuflineApi() abort
return exists('*deletebufline') && exists('*setbufline')
endfunction
" Sets buffer contents to lines
function! ale#util#SetBufferContents(buffer, lines) abort
let l:has_bufline_api = ale#util#HasBuflineApi()
if !l:has_bufline_api && a:buffer isnot bufnr('')
return
endif
" If the file is in DOS mode, we have to remove carriage returns from
" the ends of lines before calling setline(), or we will see them
" twice.
let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos'
\ ? map(copy(a:lines), 'substitute(v:val, ''\r\+$'', '''', '''')')
\ : a:lines
let l:first_line_to_remove = len(l:new_lines) + 1
" Use a Vim API for setting lines in other buffers, if available.
if l:has_bufline_api
call setbufline(a:buffer, 1, l:new_lines)
call deletebufline(a:buffer, l:first_line_to_remove, '$')
" Fall back on setting lines the old way, for the current buffer.
else
let l:old_line_length = line('$')
if l:old_line_length >= l:first_line_to_remove
let l:save = winsaveview()
silent execute
\ l:first_line_to_remove . ',' . l:old_line_length . 'd_'
call winrestview(l:save)
endif
call setline(1, l:new_lines)
endif
return l:new_lines
endfunction

View file

@ -485,6 +485,7 @@ Notes:
* `vcom`
* `xvhdl`
* Vim
* `vimls`
* `vint`
* Vim help^
* `alex`!!

View file

@ -32,6 +32,25 @@ g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable*
This variable can be changed to use a different executable for terraform.
===============================================================================
terraform-lsp *ale-terraform-terraform-lsp*
g:ale_terraform_langserver_executable *g:ale_terraform_langserver_executable*
*b:ale_terraform_langserver_executable*
Type: |String|
Default: `'terraform-lsp'`
This variable can be changed to use a different executable for terraform-lsp.
g:ale_terraform_langserver_options *g:ale_terraform_langserver_options*
*b:ale_terraform_langserver_options*
Type: |String|
Default: `''`
This variable can be changed to pass custom CLI flags to terraform-lsp.
===============================================================================
tflint *ale-terraform-tflint*

View file

@ -2,6 +2,61 @@
ALE Vim Integration *ale-vim-options*
===============================================================================
vimls *ale-vim-vimls*
The `vim-language-server` is the engine that powers VimL editor support
using the Language Server Protocol. See the installation instructions:
https://github.com/iamcco/vim-language-server#install
g:ale_vim_vimls_executable *g:ale_vim_vimls_executable*
*b:ale_vim_vimls_executable*
Type: |String|
Default: `'vim-language-server'`
This option can be set to change the executable path for vimls.
g:ale_vim_vimls_config *g:ale_vim_vimls_config*
*b:ale_vim_vimls_config*
Type: |Dictionary|
Default: `{}`
Dictionary containing configuration settings that will be passed to the
language server. For example: >
{
\ 'vim': {
\ 'iskeyword': '@,48-57,_,192-255,-#',
\ 'vimruntime': '',
\ 'runtimepath': '',
\ 'diagnostic': {
\ 'enable': v:true
\ },
\ 'indexes': {
\ 'runtimepath': v:true,
\ 'gap': 100,
\ 'count': 3,
\ 'projectRootPatterns' : ['.git', 'autoload', 'plugin']
\ },
\ 'suggest': {
\ 'fromVimruntime': v:true,
\ 'fromRuntimepath': v:false
\ },
\ }
\}
<
Consult the vim-language-server documentation for more information about
settings.
g:ale_vim_vimls_use_global *g:ale_vim_vimls_use_global*
*b:ale_vim_vimls_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vint *ale-vim-vint*

View file

@ -478,12 +478,9 @@ would like to use. An example here shows the available options for symbols >
ALE supports jumping to the files and locations where symbols are defined
through any enabled LSP linters. The locations ALE will jump to depend on the
information returned by LSP servers. The following commands are supported:
|ALEGoToDefinition| - Open the definition of the symbol under the cursor.
|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab.
|ALEGoToDefinitionInSplit| - The same, but in a new split.
|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split.
information returned by LSP servers. The |ALEGoToDefinition| command will jump
to the definition of symbols under the cursor. See the documentation for the
command for configuring how the location will be displayed.
ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is
set to `0`.
@ -493,15 +490,10 @@ set to `0`.
ALE supports jumping to the files and locations where symbols' types are
defined through any enabled LSP linters. The locations ALE will jump to depend
on the information returned by LSP servers. The following commands are
supported:
|ALEGoToTypeDefinition| - Open the definition of the symbol's type under
the cursor.
|ALEGoToTypeDefinitionInTab| - The same, but for opening the file in a new tab.
|ALEGoToTypeDefinitionInSplit| - The same, but in a new split.
|ALEGoToTypeDefinitionInVSplit| - The same, but in a new vertical split.
on the information returned by LSP servers. The |ALEGoToTypeDefinition|
command will jump to the definition of symbols under the cursor. See the
documentation for the command for configuring how the location will be
displayed.
-------------------------------------------------------------------------------
5.4 Find References *ale-find-references*
@ -666,7 +658,7 @@ g:ale_completion_delay *g:ale_completion_delay*
g:ale_completion_enabled *g:ale_completion_enabled*
b:ale_completion_enabled *b:ale_completion_enabled*
*b:ale_completion_enabled*
Type: |Number|
Default: `0`
@ -793,6 +785,16 @@ g:ale_cursor_detail *g:ale_cursor_detail*
loaded for messages to be displayed. See |ale-lint-settings-on-startup|.
g:ale_default_navigation *g:ale_default_navigation*
*b:ale_default_navigation*
Type: |String|
Default: `'buffer'`
The default method for navigating away from the current buffer to another
buffer, such as for |ALEFindReferences:|, or |ALEGoToDefinition|.
g:ale_disable_lsp *g:ale_disable_lsp*
*b:ale_disable_lsp*
@ -845,7 +847,7 @@ g:ale_echo_msg_error_str *g:ale_echo_msg_error_str*
g:ale_echo_msg_format *g:ale_echo_msg_format*
b:ale_echo_msg_format *b:ale_echo_msg_format*
*b:ale_echo_msg_format*
Type: |String|
Default: `'%code: %%s'`
@ -923,6 +925,21 @@ g:ale_enabled *g:ale_enabled*
See |g:ale_pattern_options| for more information on that option.
g:ale_exclude_highlights *g:ale_exclude_highlights*
*b:ale_exclude_highlights*
Type: |List|
Default: `[]`
A list of regular expressions for matching against highlight messages to
remove. For example: >
" Do not highlight messages matching strings like these.
let b:ale_exclude_highlights = ['line too long', 'foo.*bar']
<
See also: |g:ale_set_highlights|
g:ale_fixers *g:ale_fixers*
*b:ale_fixers*
@ -946,7 +963,7 @@ g:ale_fixers *g:ale_fixers*
<
g:ale_fix_on_save *g:ale_fix_on_save*
b:ale_fix_on_save *b:ale_fix_on_save*
*b:ale_fix_on_save*
Type: |Number|
Default: `0`
@ -968,7 +985,7 @@ b:ale_fix_on_save *b:ale_fix_on_save*
g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore*
b:ale_fix_on_save_ignore *b:ale_fix_on_save_ignore*
*b:ale_fix_on_save_ignore*
Type: |Dictionary| or |List|
Default: `{}`
@ -1344,7 +1361,7 @@ g:ale_list_vertical *g:ale_list_vertical*
g:ale_loclist_msg_format *g:ale_loclist_msg_format*
b:ale_loclist_msg_format *b:ale_loclist_msg_format*
*b:ale_loclist_msg_format*
Type: |String|
Default: `g:ale_echo_msg_format`
@ -1396,7 +1413,7 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity*
g:ale_lsp_root *g:ale_lsp_root*
b:ale_lsp_root *b:ale_lsp_root*
*b:ale_lsp_root*
Type: |Dictionary| or |String|
Default: {}
@ -1609,6 +1626,8 @@ g:ale_set_highlights *g:ale_set_highlights*
match highlights, whereas the line highlights when signs are enabled will
run to the edge of the screen.
Highlights can be excluded with the |g:ale_exclude_highlights| option.
g:ale_set_loclist *g:ale_set_loclist*
@ -1875,7 +1894,8 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
g:ale_virtualtext_delay *g:ale_virtualtext_delay*
b:ale_virtualtext_delay *b:ale_virtualtext_delay*
*b:ale_virtualtext_delay*
Type: |Number|
Default: `10`
@ -1894,7 +1914,7 @@ g:ale_virtualtext_prefix *g:ale_virtualtext_prefix*
Prefix to be used with |g:ale_virtualtext_cursor|.
g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
*b:ale_virtualenv_dir_names*
Type: |List|
Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']`
@ -1908,7 +1928,7 @@ b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names*
g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines*
b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines*
*b:ale_warn_about_trailing_blank_lines*
Type: |Number|
Default: `1`
@ -1920,7 +1940,7 @@ b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines*
g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace*
b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace*
*b:ale_warn_about_trailing_whitespace*
Type: |Number|
Default: `1`
@ -2603,6 +2623,7 @@ documented in additional help files.
terraform...............................|ale-terraform-options|
terraform-fmt-fixer...................|ale-terraform-fmt-fixer|
terraform.............................|ale-terraform-terraform|
terraform-lsp.........................|ale-terraform-terraform-lsp|
tflint................................|ale-terraform-tflint|
tex.....................................|ale-tex-options|
chktex................................|ale-tex-chktex|
@ -2634,6 +2655,7 @@ documented in additional help files.
vcom..................................|ale-vhdl-vcom|
xvhdl.................................|ale-vhdl-xvhdl|
vim.....................................|ale-vim-options|
vimls.................................|ale-vim-vimls|
vint..................................|ale-vim-vint|
vim help................................|ale-vim-help-options|
write-good............................|ale-vim-help-write-good|
@ -2687,11 +2709,23 @@ ALEFindReferences *ALEFindReferences*
Enter key (`<CR>`) can be used to jump to a referencing location, or the `t`
key can be used to jump to the location in a new tab.
The locations opened in different ways using the following variations.
`:ALEFindReferences -tab` - Open the location in a new tab.
`:ALEFindReferences -split` - Open the location in a horizontal split.
`:ALEFindReferences -vsplit` - Open the location in a vertical split.
The default method used for navigating to a new location can be changed
by modifying |g:ale_default_navigation|.
The selection can be opened again with the |ALERepeatSelection| command.
You can jump back to the position you were at before going to a reference of
something with jump motions like CTRL-O. See |jump-motions|.
A plug mapping `<Plug>(ale_find_references)` is defined for this command.
ALEFix *ALEFix*
Fix problems with the current buffer. See |ale-fix| for more information.
@ -2706,42 +2740,31 @@ ALEFixSuggest *ALEFixSuggest*
See |ale-fix| for more information.
ALEGoToDefinition *ALEGoToDefinition*
ALEGoToDefinition `<options>` *ALEGoToDefinition*
Jump to the definition of a symbol under the cursor using the enabled LSP
linters for the buffer. ALE will jump to a definition if an LSP server
provides a location to jump to. Otherwise, ALE will do nothing.
The locations opened in different ways using the following variations.
`:ALEGoToDefinition -tab` - Open the location in a new tab.
`:ALEGoToDefinition -split` - Open the location in a horizontal split.
`:ALEGoToDefinition -vsplit` - Open the location in a vertical split.
The default method used for navigating to a new location can be changed
by modifying |g:ale_default_navigation|.
You can jump back to the position you were at before going to the definition
of something with jump motions like CTRL-O. See |jump-motions|.
You should consider using the 'hidden' option in combination with this
command. Otherwise, Vim will refuse to leave the buffer you're jumping from
unless you have saved your edits.
A plug mapping `<Plug>(ale_go_to_definition)` is defined for this command.
ALEGoToDefinitionInTab *ALEGoToDefinitionInTab*
The same as |ALEGoToDefinition|, but opens results in a new tab.
A plug mapping `<Plug>(ale_go_to_definition_in_tab)` is defined for this
command.
ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit*
The same as |ALEGoToDefinition|, but opens results in a new split.
A plug mapping `<Plug>(ale_go_to_definition_in_split)` is defined for this
command.
ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit*
The same as |ALEGoToDefinition|, but opens results in a new vertical split.
A plug mapping `<Plug>(ale_go_to_definition_in_vsplit)` is defined for this
command.
ALEGoToTypeDefinition *ALEGoToTypeDefinition*
This works similar to |ALEGoToDefinition| but instead jumps to the
@ -2749,6 +2772,15 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition*
definition if an LSP server provides a location to jump to. Otherwise, ALE
will do nothing.
The locations opened in different ways using the following variations.
`:ALEGoToTypeDefinition -tab` - Open the location in a new tab.
`:ALEGoToTypeDefinition -split` - Open the location in a horizontal split.
`:ALEGoToTypeDefinition -vsplit` - Open the location in a vertical split.
The default method used for navigating to a new location can be changed
by modifying |g:ale_default_navigation|.
You can jump back to the position you were at before going to the definition
of something with jump motions like CTRL-O. See |jump-motions|.
@ -2756,31 +2788,6 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition*
command.
ALEGoToTypeDefinitionInTab *ALEGoToTypeDefinitionInTab*
The same as |ALEGoToTypeDefinition|, but opens results in a new tab.
A plug mapping `<Plug>(ale_go_to_type_definition_in_tab)` is defined for
this command.
ALEGoToTypeDefinitionInSplit *ALEGoToTypeDefinitionInSplit*
The same as |ALEGoToTypeDefinition|, but opens results in a new split.
A plug mapping `<Plug>(ale_go_to_type_definition_in_split)` is defined for
this command.
ALEGoToTypeDefinitionInVSplit *ALEGoToTypeDefinitionInVSplit*
The same as |ALEGoToTypeDefinition|, but opens results in a new vertical
split.
A plug mapping `<Plug>(ale_go_to_type_definition_in_vsplit)` is defined for
this command.
ALEHover *ALEHover*
Print brief information about the symbol under the cursor, taken from any
@ -2806,6 +2813,11 @@ ALERename *ALERename*
The user will be prompted for a new name.
ALERepeatSelection *ALERepeatSelection*
Repeat the last selection displayed in the preview window.
ALESymbolSearch `<query>` *ALESymbolSearch*
Search for symbols in the workspace, taken from any available LSP linters.
@ -3114,7 +3126,6 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()*
'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))}
<
The following `options` can be provided.
`output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for

View file

@ -12,5 +12,5 @@ noremap <buffer> A <NOP>
noremap <buffer> o <NOP>
noremap <buffer> O <NOP>
" Keybinds for opening selection items.
noremap <buffer> <CR> :call ale#preview#OpenSelectionInBuffer()<CR>
noremap <buffer> <CR> :call ale#preview#OpenSelection()<CR>
noremap <buffer> t :call ale#preview#OpenSelectionInTab()<CR>

View file

@ -109,6 +109,9 @@ let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs'))
" This flag can be set to 0 to disable setting error highlights.
let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax'))
" This List can be configured to exclude particular highlights.
let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', [])
" This flag can be set to 0 to disable echoing when the cursor moves.
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
@ -199,16 +202,23 @@ command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEF
command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype)
" Go to definition for tsserver and LSP
command! -bar ALEGoToDefinition :call ale#definition#GoTo({})
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'})
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'})
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'})
command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', <f-args>)
" Deprecated commands we have to keep for now.
command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab', 'deprecated_command': 'ALEGoToDefinitionInTab'})
command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'split', 'deprecated_command': 'ALEGoToDefinitionInSplit'})
command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToDefinitionInVSplit'})
" Go to type definition for tsserver and LSP
command! -bar ALEGoToTypeDefinition :call ale#definition#GoToType({})
command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab'})
command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'horizontal-split'})
command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vertical-split'})
command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', <f-args>)
" Deprecated commands we have to keep for now.
command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab', 'deprecated_command': 'ALEGoToTypeDefinitionInTab'})
command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'split', 'deprecated_command': 'ALEGoToTypeDefinitionInSplit'})
command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vsplit', 'deprecated_command': 'ALEGoToTypeDefinitionInVSplit'})
" Repeat a previous selection in the preview window
command! -bar ALERepeatSelection :call ale#preview#RepeatSelection()
" Find references for tsserver and LSP
command! -bar -nargs=* ALEFindReferences :call ale#references#Find(<f-args>)
@ -257,18 +267,21 @@ nnoremap <silent> <Plug>(ale_lint) :ALELint<Return>
nnoremap <silent> <Plug>(ale_detail) :ALEDetail<Return>
nnoremap <silent> <Plug>(ale_fix) :ALEFix<Return>
nnoremap <silent> <Plug>(ale_go_to_definition) :ALEGoToDefinition<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition) :ALEGoToTypeDefinition<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit<Return>
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>
inoremap <silent> <Plug>(ale_complete) <C-\><C-O>:ALEComplete<Return>
nnoremap <silent> <Plug>(ale_rename) :ALERename<Return>
nnoremap <silent> <Plug>(ale_repeat_selection) :ALERepeatSelection<Return>
" Deprecated <Plug> mappings
nnoremap <silent> <Plug>(ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit<Return>
" Set up autocmd groups now.
call ale#events#Init()

View file

@ -494,6 +494,7 @@ formatting.
* [vcom](https://www.mentor.com/products/fv/questa/)
* [xvhdl](https://www.xilinx.com/products/design-tools/vivado.html)
* Vim
* [vimls](https://github.com/iamcco/vim-language-server)
* [vint](https://github.com/Kuniwak/vint)
* Vim help
* [alex](https://github.com/wooorm/alex) :warning: :floppy_disk:

View file

@ -5,10 +5,14 @@ BufExplorer Plugin for Vim
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces:
'\<Leader\>be' (normal open) or
'\<Leader\>bt' (toggle open / close) or
'\<Leader\>bs' (force horizontal split open) or
'\<Leader\>bv' (force vertical split open)
`\<Leader\>be` normal open
`\<Leader\>bt` toggle open / close
`\<Leader\>bs` force horizontal split open
`\<Leader\>bv` force vertical split open
Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help.

View file

@ -1107,13 +1107,13 @@ c) End the string with a colon ':' followed by a Vim command to execute that
See also: Vim's |++opt| and |+cmd|.
d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
d) Input two dots '..' and then hit the <Enter> key to go upward the directory tree by 1 level. To go up
multiple levels, use one extra dot for each extra level:
>
Raw input Interpreted as
.. ../
... ../../
.... ../../../
..<Cr> ../
...<Cr> ../../
....<Cr> ../../../
<
Note: if the parent directories are large and uncached, this can be slow.

View file

@ -13,7 +13,7 @@ Attention
1. [Read this first](https://github.com/morhetz/gruvbox/wiki/Terminal-specific)
2. Typeface from gallery is [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans)
3. Typeface from screenshots below is [Fira Mono](http://www.carrois.com/fira-4-1/)
3. Typeface from screenshots below is [Fira Mono](https://mozilla.github.io/Fira/)
Screenshots
-----------

View file

@ -454,6 +454,7 @@ call s:HL('GruvboxYellowSign', s:yellow, s:sign_column, s:invert_signs)
call s:HL('GruvboxBlueSign', s:blue, s:sign_column, s:invert_signs)
call s:HL('GruvboxPurpleSign', s:purple, s:sign_column, s:invert_signs)
call s:HL('GruvboxAquaSign', s:aqua, s:sign_column, s:invert_signs)
call s:HL('GruvboxOrangeSign', s:orange, s:sign_column, s:invert_signs)
" }}}
@ -888,6 +889,30 @@ hi! link NERDTreeToggleOff GruvboxRed
call s:HL('multiple_cursors_cursor', s:none, s:none, s:inverse)
call s:HL('multiple_cursors_visual', s:none, s:bg2)
" }}}
" coc.nvim: {{{
hi! link CocErrorSign GruvboxRedSign
hi! link CocWarningSign GruvboxOrangeSign
hi! link CocInfoSign GruvboxYellowSign
hi! link CocHintSign GruvboxBlueSign
hi! link CocErrorFloat GruvboxRed
hi! link CocWarningFloat GruvboxOrange
hi! link CocInfoFloat GruvboxYellow
hi! link CocHintFloat GruvboxBlue
hi! link CocDiagnosticsError GruvboxRed
hi! link CocDiagnosticsWarning GruvboxOrange
hi! link CocDiagnosticsInfo GruvboxYellow
hi! link CocDiagnosticsHint GruvboxBlue
hi! link CocSelectedText GruvboxRed
hi! link CocCodeLens GruvboxGray
call s:HL('CocErrorHighlight', s:none, s:none, s:undercurl, s:red)
call s:HL('CocWarningHighlight', s:none, s:none, s:undercurl, s:orange)
call s:HL('CocInfoHighlight', s:none, s:none, s:undercurl, s:yellow)
call s:HL('CocHintHighlight', s:none, s:none, s:undercurl, s:blue)
" }}}
" Filetype specific -----------------------------------------------------------

View file

@ -0,0 +1,33 @@
name: CI
on: [push, pull_request]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
vim:
- v8.2.0000
- v8.1.0000
- v8.0.0000
- v7.4
- v7.3
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Checkout vim-themis
uses: actions/checkout@master
with:
repository: thinca/vim-themis
path: vim-themis
- name: Setup Vim
uses: rhysd/action-setup-vim@v1
id: vim
with:
version: ${{ matrix.vim }}
- name: Test
env:
THEMIS_VIM: ${{ steps.vim.outputs.executable }}
run: ./vim-themis/bin/themis --reporter spec

View file

@ -1,28 +0,0 @@
language: generic
install:
- git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis
- (if ! test -d $HOME/vim-$VIM_VERSION/bin; then
git clone https://github.com/vim/vim $HOME/vim &&
cd $HOME/vim &&
git checkout v$VIM_VERSION &&
./configure --prefix=$HOME/vim-$VIM_VERSION &&
make &&
make install;
fi)
cache:
directories:
- $HOME/vim-$VIM_VERSION
env:
- VIM_VERSION=8.2.0000
- VIM_VERSION=8.1.0000
- VIM_VERSION=8.0.0000
- VIM_VERSION=7.4
- VIM_VERSION=7.3
script:
- export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH
- vim --version
- /tmp/themis/bin/themis --reporter spec

View file

@ -2,7 +2,7 @@
" Filename: autoload/lightline.vim
" Author: itchyny
" License: MIT License
" Last Change: 2020/01/27 19:41:58.
" Last Change: 2020/03/16 19:10:15.
" =============================================================================
let s:save_cpo = &cpo
@ -24,16 +24,9 @@ function! lightline#update() abort
let s = winnr('$') == 1 && w > 0 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)]
for n in range(1, winnr('$'))
call setwinvar(n, '&statusline', s[n!=w])
call setwinvar(n, 'lightline', n!=w)
endfor
endfunction
function! lightline#update_once() abort
if !exists('w:lightline') || w:lightline
call lightline#update()
endif
endfunction
function! lightline#update_disable() abort
if !s:lightline.enable.statusline
return
@ -46,14 +39,13 @@ function! lightline#enable() abort
call lightline#update()
augroup lightline
autocmd!
autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update()
autocmd WinEnter,BufEnter,BufDelete,SessionLoadPost,FileChangedShellPost * call lightline#update()
if !has('patch-8.1.1715')
autocmd FileType qf call lightline#update()
endif
autocmd SessionLoadPost * call lightline#highlight()
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
\ | call lightline#update() | call lightline#highlight() | endif
autocmd CursorMoved,BufUnload * call lightline#update_once()
augroup END
augroup lightline-disable
autocmd!
@ -224,7 +216,7 @@ endfunction
let s:mode = ''
function! lightline#link(...) abort
let mode = get(s:lightline._mode_, a:0 ? a:1 : mode(), 'normal')
if s:mode == mode
if s:mode ==# mode
return ''
endif
let s:mode = mode

View file

@ -0,0 +1,39 @@
" =============================================================================
" Filename: autoload/lightline/colorscheme/ayu_light.vim
" Author: christalib
" License: MIT License
" Last Change: 2020/02/15 18:45:57.
" =============================================================================
let s:base0 = [ '#5C6773', 244 ]
let s:base1 = [ '#5C6773', 247 ]
let s:base2 = [ '#828C99', 248 ]
let s:base3 = [ '#5C6773', 252 ]
let s:base00 = [ '#FFFFFF', 242 ]
let s:base01 = [ '#FFFFFF', 240 ]
let s:base02 = [ '#FAFAFA', 238 ]
let s:base023 = [ '#FAFAFA', 236 ]
let s:base03 = [ '#E6B673', 235 ]
let s:yellow = [ '#E6B673', 180 ]
let s:orange = [ '#FF7733', 173 ]
let s:red = [ '#f07178', 203 ]
let s:magenta = [ '#A37ACC', 216 ]
let s:blue = [ '#59c2ff', 117 ]
let s:cyan = s:blue
let s:green = [ '#86B300', 119 ]
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
let s:p.normal.middle = [ [ s:base2, s:base02 ] ]
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
let s:p.inactive.left = [ [ s:base1, s:base01 ], [ s:base3, s:base01 ] ]
let s:p.inactive.middle = [ [ s:base1, s:base023 ] ]
let s:p.inactive.right = [ [ s:base1, s:base01 ], [ s:base2, s:base02 ] ]
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ]
let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
let s:p.tabline.tabsel = [ [ s:base02, s:base03 ] ]
let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
let s:p.tabline.middle = [ [ s:base2, s:base02 ] ]
let s:p.tabline.right = [ [ s:base2, s:base00 ] ]
let s:p.normal.error = [ [ s:base03, s:red ] ]
let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
let g:lightline#colorscheme#ayu_light#palette = lightline#colorscheme#flatten(s:p)

View file

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme/deus.vim
" Author: nikersify
" License: MIT License
" Last Change: 2018/01/24 13:26:00
" Last Change: 2020/02/15 20:56:45.
" =============================================================================
let s:term_red = 204
@ -20,7 +20,6 @@ let s:p.normal.left = [ [ '#292c33', '#98c379', s:term_black, s:term_green, 'bol
let s:p.normal.right = [ [ '#292c33', '#98c379', s:term_black, s:term_green ], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ], [ '#98c379', '#292c33', s:term_green, s:term_black ] ]
let s:p.inactive.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue], [ '#abb2bf', '#3e4452', s:term_white, s:term_grey ] ]
let s:p.inactive.left = s:p.inactive.right[1:]
" her
let s:p.insert.left = [ [ '#292c33', '#61afef', s:term_black, s:term_blue, 'bold' ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ]
let s:p.insert.right = [ [ '#292c33', '#61afef', s:term_black, s:term_blue ], [ '#ABB2BF', '#3E4452', s:term_white, s:term_grey ], [ '#61afef', '#292c33', s:term_blue, s:term_black ] ]
let s:p.replace.left = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ]

View file

@ -2,9 +2,9 @@
" Filename: autoload/lightline/colorscheme/molokai.vim
" Author: challsted
" License: MIT License
" Last Change: 2016/11/17 00:27:58.
" Last Change: 2020/02/15 20:57:45.
" =============================================================================
"
let s:black = [ '#232526', 233 ]
let s:gray = [ '#808080', 244 ]
let s:white = [ '#f8f8f2', 234 ]

View file

@ -2,7 +2,7 @@
" Filename: autoload/lightline/colorscheme/solarized.vim
" Author: itchyny
" License: MIT License
" Last Change: 2017/11/25 11:13:46.
" Last Change: 2020/04/06 19:22:53.
" =============================================================================
let s:cuicolors = {
@ -73,7 +73,7 @@ let s:p.inactive.middle = [ [ s:base01, s:base02 ] ]
let s:p.tabline.left = [ [ s:base03, s:base00 ] ]
let s:p.tabline.tabsel = [ [ s:base03, s:base1 ] ]
let s:p.tabline.middle = [ [ s:base0, s:base02 ] ]
let s:p.tabline.right = copy(s:p.normal.right)
let s:p.tabline.right = copy(s:p.tabline.left)
let s:p.normal.error = [ [ s:base03, s:red ] ]
let s:p.normal.warning = [ [ s:base03, s:yellow ] ]

View file

@ -48,6 +48,10 @@
![lightline.vim - ayu mirage](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_mirage.png)
### ayu_light
![lightline.vim - ayu light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/ayu_light.png)
### darcula
![lightline.vim - darcula](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/darcula.png)

View file

@ -4,7 +4,7 @@ Version: 0.1
Author: itchyny (https://github.com/itchyny)
License: MIT License
Repository: https://github.com/itchyny/lightline.vim
Last Change: 2020/01/28 18:40:21.
Last Change: 2020/02/15 18:44:06.
CONTENTS *lightline-contents*
@ -231,7 +231,7 @@ OPTIONS *lightline-option*
Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue,
Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor,
landscape, one, materia, material, OldHope, nord, deus,
srcery_drk, ayu_mirage and 16color are available.
srcery_drk, ayu_mirage, ayu_light and 16color are available.
The default value is:
>
let g:lightline.colorscheme = 'default'

View file

@ -2,7 +2,7 @@
" Filename: plugin/lightline.vim
" Author: itchyny
" License: MIT License
" Last Change: 2019/07/30 12:00:00.
" Last Change: 2020/03/16 19:08:41.
" =============================================================================
if exists('g:loaded_lightline') || v:version < 700
@ -15,14 +15,13 @@ set cpo&vim
augroup lightline
autocmd!
autocmd WinEnter,BufEnter,SessionLoadPost * call lightline#update()
autocmd WinEnter,BufEnter,BufDelete,SessionLoadPost,FileChangedShellPost * call lightline#update()
if !has('patch-8.1.1715')
autocmd FileType qf call lightline#update()
endif
autocmd SessionLoadPost * call lightline#highlight()
autocmd ColorScheme * if !has('vim_starting') || expand('<amatch>') !=# 'macvim'
\ | call lightline#update() | call lightline#highlight() | endif
autocmd CursorMoved,BufUnload * call lightline#update_once()
augroup END
" This quickfix option was introduced at Vim 85850f3a5ef9, which is the commit

View file

@ -1,12 +1,21 @@
# NERDTree Change Log
<!--
Introduce a new MAJOR.MINOR version with a 4-hash header.
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR version
in an unordered list. The format is:
<!-- Introduce a new MAJOR or MINOR version with a 4-hash header.
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
version in an unordered list. The format is:
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.7
- **.7**: Put '%' argument in bufname() for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105)
- **.6**: If a file's already open in the window, don't edit it again. (PhilRunninger) [#1103](https://github.com/preservim/nerdtree/pull/1103)
- **.5**: Prevent unneeded tree creation in `:NERDTreeToggle[VCS] <path>` (PhilRunninger) [#1101](https://github.com/preservim/nerdtree/pull/1101)
- **.4**: Add missing calls to the `shellescape()` function (lifecrisis) [#1099](https://github.com/preservim/nerdtree/pull/1099)
- **.3**: Fix vsplit to not open empty buffers when opening previously closed file (AwkwardKore) [#1098](https://github.com/preservim/nerdtree/pull/1098)
- **.2**: Fix infinity loop (on winvim) in FindParentVCSRoot (Eugenij-W) [#1095](https://github.com/preservim/nerdtree/pull/1095)
- **.1**: File Move: Escape existing directory name when looking for open files. (PhilRunninger) [#1094](https://github.com/preservim/nerdtree/pull/1094)
- **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090)
#### 6.6
- **.1**: [add] How to install using dein.vim (kazukazuinaina) [#1087](https://github.com/preservim/nerdtree/pull/1087)
- **.0**: Add the ability to turn off directory arrows (PhilRunninger) [#1085](https://github.com/preservim/nerdtree/pull/1085)
#### 6.5
- **.0**: `NERDTreeToggle <start-directory>` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083)
#### 6.4

View file

@ -59,6 +59,13 @@ Plug 'preservim/nerdtree'
call plug#end()
```
#### [dein.vim](https://github.com/Shougo/dein.vim)
```vim
call dein#begin()
call dein#add('preservim/nerdtree')
call dein#end()
```
#### [apt-vim](https://github.com/egalpin/apt-vim)
```bash
apt-vim install -y https://github.com/preservim/nerdtree.git
@ -143,3 +150,8 @@ Use these variables in your vimrc. Note that below are default arrow symbols
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
```
You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left.
```vim
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
```

View file

@ -284,6 +284,7 @@ endfunction
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr) abort
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
let l:revealOpts = {}
if empty(l:pathStr)
call nerdtree#echoWarning('no file for the current buffer')
@ -292,6 +293,7 @@ function! s:findAndRevealPath(pathStr) abort
if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h')
let l:revealOpts['open'] = 1
endif
try
@ -327,7 +329,7 @@ function! s:findAndRevealPath(pathStr) abort
call b:NERDTree.ui.setShowHidden(1)
endif
let l:node = b:NERDTree.root.reveal(l:pathObj)
let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts)
call b:NERDTree.render()
call l:node.putCursorHere(1, 0)
endfunction

View file

@ -1223,13 +1223,19 @@ Values: Any single character.
Defaults: Windows: ~ and + Others: ▾ and ▸
These characters indicate whether a directory is collapsible or expandable.
They can be set to "\u00a0" to hide the arrows, but if you do this you may
need to change the node delimiter. See |NERDTreeNodeDelimiter|. You cannot use
the same character for both the arrows and the delimiter. Example: >
Example: >
let NERDTreeDirArrowExpandable=">"
let NERDTreeDirArrowCollapsible="v"
<
They can be set to "\u00a0" to replace the arrows with a non-breaking space.
If you do this you may need to change the node delimiter. See
|NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows
and the delimiter.
Alternatively, they can be set to '' (an empty string). This removes the
arrows and the single space that follows them, shifting the entire tree two
character positions to the left.
------------------------------------------------------------------------------
*NERDTreeNodeDelimiter*
Values: Any single character.

View file

@ -366,7 +366,7 @@ function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen()
call self._createTreeWin()
if !empty(a:dir)
if !empty(a:dir) && a:dir !=# b:NERDTree.root.path.str()
call self.createTabTree(a:dir)
elseif !&hidden
call b:NERDTree.render()

View file

@ -195,7 +195,7 @@ function! s:Opener._newVSplit()
endif
call nerdtree#exec('wincmd p', 1)
call nerdtree#exec('vnew', 1)
call nerdtree#exec('vsplit', 1)
let l:currentWindowNumber = winnr()

View file

@ -199,7 +199,7 @@ function! s:Path.copy(dest)
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
endif
let cmd = cmd_prefix . ' ' . escape(self.str(), self._escChars()) . ' ' . escape(a:dest, self._escChars())
let cmd = cmd_prefix . ' ' . shellescape(self.str()) . ' ' . shellescape(a:dest)
let success = system(cmd)
if v:shell_error !=# 0
throw "NERDTree.CopyError: Could not copy '". self.str() ."' to: '" . a:dest . "'"
@ -295,7 +295,10 @@ endfunction
" FUNCTION: Path.edit() {{{1
function! s:Path.edit()
exec 'edit ' . self.str({'format': 'Edit'})
let l:bufname = self.str({'format': 'Edit'})
if bufname('%') !=# l:bufname
exec 'edit ' . l:bufname
endif
endfunction
" FUNCTION: Path.extractDriveLetter(fullpath) {{{1

View file

@ -104,16 +104,11 @@ function! s:TreeDirNode.displayString()
endfor
" Select the appropriate open/closed status indicator symbol.
if l:cascade[-1].isOpen
let l:symbol = g:NERDTreeDirArrowCollapsible
else
let l:symbol = g:NERDTreeDirArrowExpandable
endif
let l:symbol = (l:cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable )
let l:symbol .= (g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
let l:flags = l:cascade[-1].path.flagSet.renderToString()
let l:result = l:symbol . ' ' . l:flags . l:label
return l:result
return l:symbol . l:flags . l:label
endfunction
" FUNCTION: TreeDirNode.findNode(path) {{{1

View file

@ -321,13 +321,9 @@ function! s:TreeFileNode._renderToString(depth, drawText)
if a:drawText ==# 1
let treeParts = repeat(' ', a:depth - 1)
if !self.path.isDirectory
let treeParts = treeParts . ' '
endif
let treeParts .= (self.path.isDirectory || g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
let line = treeParts . self.displayString()
let output = output . line . "\n"
endif

View file

@ -284,7 +284,11 @@ endfunction
function! s:UI._indentLevelFor(line)
" Replace multi-character DirArrows with a single space so the
" indentation calculation doesn't get messed up.
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
if g:NERDTreeDirArrowExpandable ==# ''
let l:line = ' '.a:line
else
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
endif
let leadChars = match(l:line, '\M\[^ ]')
return leadChars / s:UI.IndentWid()
endfunction

View file

@ -209,7 +209,8 @@ function! NERDTreeMoveNode()
try
if curNode.path.isDirectory
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"')
let l:curPath = escape(curNode.path.str(),'\') . (nerdtree#runningWindows()?'\\':'/') . '.*'
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# "'.escape(l:curPath,'\').'"')
else
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()')
endif
@ -387,44 +388,67 @@ endfunction
" FUNCTION: NERDTreeQuickLook() {{{1
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('qlmanage -p 2>/dev/null ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeRevealInFinder() {{{1
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("open -R '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('open -R ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeExecuteFile() {{{1
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("open '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('open ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeRevealFileLinux() {{{1
function! NERDTreeRevealFileLinux()
let treenode = g:NERDTreeFileNode.GetSelected()
let parentnode = treenode.parent
if parentnode !=# {}
call system("xdg-open '" . parentnode.path.str() . "' &")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
" Handle the edge case of "/", which has no parent.
if l:node.path.str() ==# '/'
call system('xdg-open /')
return
endif
if empty(l:node.parent)
return
endif
call system('xdg-open ' . shellescape(l:node.parent.path.str()))
endfunction
" FUNCTION: NERDTreeExecuteFileLinux() {{{1
function! NERDTreeExecuteFileLinux()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("xdg-open '" . treenode.path.str() . "' &")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('xdg-open ' . shellescape(l:node.path.str()))
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -34,7 +34,7 @@ endfunction
function! s:FindParentVCSRoot(path)
let l:path = a:path
while !empty(l:path) &&
\ l:path._str() !~# '^\(\a:\\\|\/\)$' &&
\ l:path._str() !~# '^\(\a:[\\\/]\|\/\)$' &&
\ !isdirectory(l:path._str() . '/.git') &&
\ !isdirectory(l:path._str() . '/.svn') &&
\ !isdirectory(l:path._str() . '/.hg') &&
@ -42,6 +42,6 @@ function! s:FindParentVCSRoot(path)
\ !isdirectory(l:path._str() . '/_darcs')
let l:path = l:path.getParent()
endwhile
return (empty(l:path) || l:path._str() =~# '^\(\a:\\\|\/\)$') ? a:path : l:path
return (empty(l:path) || l:path._str() =~# '^\(\a:[\\\/]\|\/\)$') ? a:path : l:path
endfunction

View file

@ -19,24 +19,7 @@ syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
syn match NERDTreeExecFile '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
"highlighting for readonly files
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
"highlighing to conceal the delimiter around the file/dir name
"highlighting to conceal the delimiter around the file/dir name
if has('conceal')
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
setlocal conceallevel=3 concealcursor=nvic
@ -45,6 +28,27 @@ else
hi! link NERDTreeNodeDelimiters Ignore
endif
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
if g:NERDTreeDirArrowExpandable !=# ''
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
else
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
endif
"highlighting for readonly files
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir'
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks

View file

@ -1,12 +1,14 @@
function! cargo#Load()
function! cargo#Load()
" Utility call to get this script loaded, for debugging
endfunction
function! cargo#cmd(args)
function! cargo#cmd(args) abort
" Trim trailing spaces. This is necessary since :terminal command parses
" trailing spaces as an empty argument.
let args = substitute(a:args, '\s\+$', '', '')
if has('terminal')
if exists('g:cargo_shell_command_runner')
let cmd = g:cargo_shell_command_runner
elseif has('terminal')
let cmd = 'terminal'
elseif has('nvim')
let cmd = 'noautocmd new | terminal'
@ -98,6 +100,22 @@ function! cargo#bench(args)
call cargo#cmd("bench " . a:args)
endfunction
function! cargo#update(args)
call cargo#cmd("update " . a:args)
endfunction
function! cargo#search(args)
call cargo#cmd("search " . a:args)
endfunction
function! cargo#publish(args)
call cargo#cmd("publish " . a:args)
endfunction
function! cargo#install(args)
call cargo#cmd("install " . a:args)
endfunction
function! cargo#runtarget(args)
let l:filename = expand('%:p')
let l:read_manifest = system('cargo read-manifest')

View file

@ -499,7 +499,15 @@ function! s:SearchTestFunctionNameUnderCursor() abort
" Search the end of test function (closing brace) to ensure that the
" cursor position is within function definition
normal! %
if maparg('<Plug>(MatchitNormalForward)') ==# ''
keepjumps normal! %
else
" Prefer matchit.vim official plugin to native % since the plugin
" provides better behavior than original % (#391)
" To load the plugin, run:
" :packadd matchit
execute 'keepjumps' 'normal' "\<Plug>(MatchitNormalForward)"
endif
if line('.') < cursor_line
return ''
endif
@ -541,21 +549,20 @@ function! rust#Test(mods, winsize, all, options) abort
let saved = getpos('.')
try
let func_name = s:SearchTestFunctionNameUnderCursor()
if func_name ==# ''
echohl ErrorMsg
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
echohl None
return
endif
if a:options ==# ''
execute cmd . 'cargo test --manifest-path' manifest func_name
else
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
endif
return
finally
call setpos('.', saved)
endtry
if func_name ==# ''
echohl ErrorMsg
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
echohl None
return
endif
if a:options ==# ''
execute cmd . 'cargo test --manifest-path' manifest func_name
else
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
endif
endfunction
" }}}1

View file

@ -24,7 +24,7 @@ else
if has('patch-7.4.191')
CompilerSet makeprg=rustc\ \%:S
else
CompilerSet makeprg=rustc\ \%
CompilerSet makeprg=rustc\ \"%\"
endif
endif

View file

@ -125,7 +125,7 @@ g:rustfmt_autosave~
<
There is also a buffer-local b:rustfmt_autosave that can be set for
the same purpose, and can override the global setting.
*g:rustfmt_autosave_if_config_present*
g:rustfmt_autosave_if_config_present~
Set this option to 1 to have *b:rustfmt_autosave* be set automatically
@ -187,6 +187,16 @@ g:cargo_makeprg_params~
let g:cargo_makeprg_params = 'build'
<
*g:cargo_shell_command_runner*
g:cargo_shell_command_runner~
Set this option to change how to run shell commands for cargo commands
|:Cargo|, |:Cbuild|, |:Crun|, ...
By default, |:terminal| is used to run shell command in terminal window
asynchronously. But if you prefer |:!| for running the commands, it can
be specified: >
let g:cargo_shell_command_runner = '!'
<
Integration with Syntastic *rust-syntastic*
--------------------------

View file

@ -121,7 +121,7 @@ command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>)
command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
" See |:RustFmt| for docs
command! -buffer RustFmt call rustfmt#Format()
command! -bar -buffer RustFmt call rustfmt#Format()
" See |:RustFmtRange| for docs
command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>)

View file

@ -0,0 +1 @@
[assign]

View file

@ -169,7 +169,7 @@ endfunction
function s:PrevCodeLine(lnum)
let l:n = prevnonblank(a:lnum)
while l:n
if getline(l:n) =~ '^\s*\/[/*]'
if getline(l:n) =~ '^\s*\/[/*]'
if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') &&
\ s:syn_at(l:n,1) =~? s:syng_str
return l:n
@ -293,8 +293,9 @@ function GetTypescriptIndent()
let l:line = ''
endif
" the containing paren, bracket, or curly. Many hacks for performance
let idx = index([']',')','}'],l:line[0])
" the containing paren, bracket, curly, or closing '>'.
" Many hacks for performance
let idx = index([']',')','}','>'],l:line[0])
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
call call('cursor',b:js_cache[1:])

View file

@ -223,10 +223,11 @@ syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparen
" }}}
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.7 and earlier: only when not done already by this script
" For version 5.8 and later: only when an item doesn't have highlighting yet
" For version 8.1.1486 and later: only when not done already by this script (need to override vim's new typescript support)
if version >= 508 || !exists("did_typescript_syn_inits")
if version < 508
if version < 508 || has('patch-8.1.1486')
let did_typescript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else

View file

@ -2,7 +2,8 @@
" TODO refactor: create glob function
" noremap \og :call<space>glob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"\\.git\\<bar>\\.hg\\<bar>node_modules\\<bar>\\.pyc" )<cr>
" noremap \og :call<space>glob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"default" )<cr>
function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern)
function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern, ...)
let opts = a:0 > 0 ? a:1 : {}
if a:exclude_pattern == "default"
let exclude_pattern = '\.git\|\.hg\|node_modules\|\.pyc'
else
@ -16,7 +17,7 @@ function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern)
let exclude = exclude_pattern == '' ? '' : ' | grep -v -e '.shellescape(exclude_pattern)
let cmd = 'find | grep -e '.shellescape(g).exclude
let cmd = get(opts, 'cmd_find', 'find'). ' . | grep -e '.shellescape(g).exclude
let files = split(system(cmd),"\n")
" for nom in a:excludes
" call filter(files,nom)

View file

@ -104,6 +104,12 @@ To customize the colors used for markers, define the highlight groups, `Flake8_E
highlight link Flake8_Naming WarningMsg
highlight link Flake8_PyFlake WarningMsg
To show the error message of the current line in the ruler, call `flake8#ShowError()`:
" add binding to call the function
nnoremap <C-K> :call flake8#Flake8ShowError()<cr>
Tips
----
A tip might be to run the Flake8 check every time you write a Python file, to

View file

@ -20,6 +20,10 @@ function! flake8#Flake8UnplaceMarkers()
call s:Warnings()
endfunction
function! flake8#Flake8ShowError()
call s:ShowErrorMessage()
endfunction
"" }}}
"" ** internal ** {{{
@ -101,6 +105,7 @@ function! s:Setup() " {{{
let s:markerdata['F'].marker = s:flake8_pyflake_marker
let s:markerdata['C'].marker = s:flake8_complexity_marker
let s:markerdata['N'].marker = s:flake8_naming_marker
endfunction " }}}
"" do flake8
@ -154,11 +159,20 @@ function! s:Flake8() " {{{
let &shellpipe=l:old_shellpipe
let &t_ti=l:old_t_ti
let &t_te=l:old_t_te
" store mapping of line number to error string
" process results
let s:resultDict = {}
let l:results=getqflist()
let l:has_results=results != []
if l:has_results
" save line number of each error message
for result in l:results
let linenum = result.lnum
let s:resultDict[linenum] = result.text
endfor
" markers
if !s:flake8_show_in_gutter == 0 || !s:flake8_show_in_file == 0
call s:PlaceMarkers(l:results)
@ -184,8 +198,9 @@ function! s:Flake8() " {{{
endif
endfunction " }}}
"" markers
"" markers
function! s:PlaceMarkers(results) " {{{
" in gutter?
if !s:flake8_show_in_gutter == 0
@ -253,6 +268,29 @@ function! s:UnplaceMarkers() " {{{
endfor
endfunction " }}}
function! s:ShowErrorMessage() " {{{
let l:cursorPos = getpos(".")
if !exists('s:resultDict')
return
endif
" if there is a message on the current line,
" then echo it
if has_key(s:resultDict, l:cursorPos[1])
let l:errorText = get(s:resultDict, l:cursorPos[1])
echo strpart(l:errorText, 0, &columns-1)
let b:showing_message = 1
endif
" if a message is already being shown,
" then clear it
if !b:showing_message == 0
echo
let b:showing_message = 0
endif
endfunction " }}}
"" }}}
let &cpo = s:save_cpo

File diff suppressed because it is too large Load diff

View file

@ -25,19 +25,22 @@ that are part of Git repositories).
resume running the command. A few Git subcommands
have different behavior; these are documented below.
:Git! {args} Run an arbitrary git command, capture output to a temp
:Git --paginate {args} file, and |:split| that temp file. Use :0Git to
:Git -p {args} |:edit| the temp file instead. A temp file is always
used for diff and log commands.
*:Git_--paginate* *:Git_-p*
:Git --paginate {args} Run an arbitrary git command, capture output to a temp
:Git -p {args} file, and |:split| that temp file. Use :0Git to
:G --paginate {args} |:edit| the temp file instead. A temp file is always
:G -p {args} used for commands like diff and log that typically
user a pager, and for any command that has the
pager.<cmd> Git configuration option set.
*:Gstatus*
:Git Bring up a summary window vaguely akin to git-status.
:G Press g? or see |fugitive-maps| for usage.
:Gstatus
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
:G akin to git-status. Press g? or see |fugitive-maps|
for usage.
*:Git-blame* *:Gblame*
*:Git_blame*
:Git blame [flags] Run git-blame [flags] on the current file and open the
:Gblame [flags] results in a scroll-bound vertical split. The
results in a scroll-bound vertical split. The
following maps, which work on the cursor line commit
where sensible, are provided:
@ -56,20 +59,12 @@ that are part of Git repositories).
~ reblame at [count]th first grandparent
P reblame at [count]th parent (like HEAD^[count])
:[range]Gblame [flags] If a range is given, just that part of the file will
:Gblame [flags] {file} be blamed, and a horizontal split without
:Git blame ... scrollbinding is used. You can also give an arbitrary
:[range]Git blame [...] If a range is given, just that part of the file will
:Git blame [...] {file} be blamed, and a horizontal split without
scrollbinding is used. You can also give an arbitrary
filename.
*:Ggrep* *:Gcgrep* *:Git-grep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
:Git[!] grep [args]
*:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
*:Git-difftool*
*:Git_difftool*
:Git[!] difftool [args] Invoke `git diff [args]` and load the changes into the
quickfix list. Each changed hunk gets a separate
quickfix entry unless you pass an option like
@ -77,42 +72,32 @@ that are part of Git repositories).
change unless [!] is given.
:Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a
new tab, and invoke `:Gdiffsplit!` against the
new tab, and invoke |:Gdiffsplit!| against the
appropriate commit.
*:Git-mergetool*
:Git mergetool [args] Like |:Git-difftool|, but target merge conflicts.
*:Git_mergetool*
:Git mergetool [args] Like |:Git_difftool|, but target merge conflicts.
*:Git-push* *:Gpush*
*:Git_push*
:Git push [args] Invoke git-push, load the results into the |quickfix|
:Gpush [args] list, and invoke |:cwindow| to reveal any errors.
list, and invoke |:cwindow| to reveal any errors.
|:Dispatch| is used if available for asynchronous
invocation.
*:Git-fetch* *:Gfetch*
:Git fetch [args] Like |:Gpush|, but for git-fetch.
:Gfetch [args]
*:Git_fetch*
:Git fetch [args] Like |:Git_push|, but for git-fetch.
*:Git-merge* *:Gmerge*
:Gmerge [args] Deprecated alias for |:Git| merge. Use |:Git-mergetool|
to get the old behavior of loading merge conflicts
into the quickfix list.
*:Ggrep* *:Gcgrep* *:Git_grep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
:Git[!] grep [args]
*:Git-pull* *:Gpull*
:Gpull [args] Deprecated alias for |:Git| pull.
*:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
*:Git-rebase* *:Grebase*
:Grebase [args] Deprecated alias for |:Git| rebase.
*:Git-commit* *:Gcommit*
:Gcommit [args] Deprecated alias for |:Git| commit.
*:Git-revert* *:Grevert*
:Grevert [args] Deprecated alias for |:Git| revert.
*:Gclog* *:Glog*
*:Gclog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
:Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!]
|quickfix| list. Jumps to the first commit unless [!]
is given.
:{range}Gclog[!] [args] Use git-log -L to load previous revisions of the given
@ -146,13 +131,6 @@ that are part of Git repositories).
*:Gpedit*
:Gpedit [object] |:pedit| a |fugitive-object|.
:Gsplit! [args] *:Gsplit!* *:Gvsplit!*
:Gvsplit! [args] *:Gtabedit!* *:Gpedit!*
:Gtabedit! [args] Capture the output of `git [args]` to a temp file and
:Gpedit! [args] open it in a split, tab, or preview window. Use
:0Gsplit! to suppress the split and open it in the
current window.
*:Gread* *fugitive-:Gr*
:Gread [object] Empty the buffer and |:read| a |fugitive-object|.
When the argument is omitted, this is similar to
@ -210,28 +188,28 @@ that are part of Git repositories).
*:Gvdiffsplit*
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*:Ghdiffsplit* *:Gsdiff*
*:Ghdiffsplit*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
*:Gmove*
:Gmove {destination} Wrapper around git-mv that renames the buffer
*:GMove*
:GMove {destination} Wrapper around git-mv that renames the buffer
afterward. Add a ! to pass -f.
*:Grename*
:Grename {destination} Like |:Gmove| but operates relative to the parent
*:GRename*
:GRename {destination} Like |:GMove| but operates relative to the parent
directory of the current file.
*:Gdelete*
:Gdelete Wrapper around git-rm that deletes the buffer
*:GDelete*
:GDelete Wrapper around git-rm that deletes the buffer
afterward. When invoked in an index file, --cached is
passed. Add a ! to pass -f and forcefully discard the
buffer.
*:Gremove*
:Gremove Like :Gdelete, but keep the (now empty) buffer around.
*:GRemove*
:GRemove Like |:GDelete|, but keep the (now empty) buffer around.
*:Gbrowse*
:Gbrowse Open the current file, blob, tree, commit, or tag
*:GBrowse*
:GBrowse Open the current file, blob, tree, commit, or tag
in your browser at the upstream hosting provider.
If a range is given, it is appropriately appended to
the URL as an anchor.
@ -241,27 +219,27 @@ that are part of Git repositories).
supported by installing rhubarb.vim, available at
<https://github.com/tpope/vim-rhubarb>.
:Gbrowse {object} Like :Gbrowse, but for a given |fugitive-object|.
:GBrowse {object} Like :GBrowse, but for a given |fugitive-object|.
:Gbrowse [...]@{remote} Force using the given remote rather than the remote
:GBrowse [...]@{remote} Force using the given remote rather than the remote
for the current branch. The remote is used to
determine which upstream repository to link to.
:{range}Gbrowse [args] Appends an anchor to the URL that emphasizes the
:{range}GBrowse [args] Appends an anchor to the URL that emphasizes the
selected lines. This also forces the URL to include a
commit rather than a branch name so it remains valid
if the file changes. You can give a range of "0" to
force this behavior without including an anchor.
:[range]Gbrowse! [args] Like :Gbrowse, but put the URL on the clipboard rather
:[range]GBrowse! [args] Like :GBrowse, but put the URL on the clipboard rather
than opening it.
MAPS *fugitive-maps*
These maps are available in both the |:Gstatus| buffer and Fugitive object
buffers, although not all maps make sense in all buffers. Mappings that
operate on the file or hunk under the cursor are generally available in visual
mode to operate on multiple files or partial hunks.
These maps are available in both the |fugitive-summary| buffer and Fugitive
object buffers, although not all maps make sense in all buffers. Mappings
that operate on the file or hunk under the cursor are generally available in
visual mode to operate on multiple files or partial hunks.
*fugitive-staging-maps*
Staging/unstaging maps ~
@ -407,7 +385,7 @@ i Jump to the next file or hunk, expanding inline diffs
][ Jump [count] section ends forward.
*fugitive_star*
* One the first column of a + or - diff line, search for
* On the first column of a + or - diff line, search for
the corresponding - or + line. Otherwise, defer to
built-in |star|.
@ -502,7 +480,7 @@ czz Push stash. Pass a [count] of 1 to add
`--include-untracked` or 2 to add `--all`.
czw Push stash of worktree. Like `czz` with
`--include-index`.
`--keep-index`.
czA Apply topmost stash, or stash@{count}.
@ -611,7 +589,7 @@ Makefile The file named Makefile in the work tree
!:Makefile The file named Makefile in the commit owning the current file
!3^2 The second parent of the commit owning buffer #3
.git/config The repo config file
: Same as |:Gstatus|
: The |fugitive-summary| buffer.
STATUSLINE *fugitive-statusline*
@ -628,6 +606,39 @@ HEAD is detached, FugitiveHead() will return the empty string, unless the
optional argument is given, in which case the hash of the current commit will
be truncated to the given number of characters.
DEPRECATIONS *fugitive-deprecated*
The following commands are softly deprecated in favor of replacements that
adhere to a new naming scheme. They will eventually be removed, but probably
not in the near future.
Remember that |:Git| can be shortened to |:G|, so replacements using it are
just one space character longer than the legacy version.
*:Gremove* Superseded by |:GRemove|.
*:Gdelete* Superseded by |:GDelete|.
*:Gmove* Superseded by |:GMove|.
*:Grename* Superseded by |:GRename|.
*:Gbrowse* Superseded by |:GBrowse|.
*:Gdiff* Superseded by |:Gdiffsplit|
*:Gsdiff* Superseded by |:Ghdiffsplit|
*:Gvdiff* Superseded by |:Gvdiffsplit| or |:vert| |:Gdiffsplit|.
*:Gblame* Superseded by |:Git_blame|.
*:Gcommit* Superseded by |:Git| commit.
*:Gmerge* Superseded by |:Git| merge and |:Git_mergetool|.
*:Gpull* Superseded by |:Git| pull.
*:Grebase* Superseded by |:Git| rebase.
*:Grevert* Superseded by |:Git| revert.
*:Gpush* Superseded by |:Git_push|.
*:Gfetch* Superseded by |:Git_fetch|.
*:Glog* Superseded by |:Gclog|.
*:Gstatus* Superseded by |:Git| (with no arguments).
*:Git!* Superseded by |:Git_--paginate|.
*:Gsplit!* Superseded by |:Git_--paginate|.
*:Gvsplit!* Superseded by :vert Git --paginate.
*:Gtabsplit!* Superseded by :tab Git --paginate.
*:Gpedit!* Superseded by :Git! --paginate.
ABOUT *fugitive-about*
Grab the latest version or report a bug on GitHub:

View file

@ -420,30 +420,32 @@ let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':Gstatus') !=# 2
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
endif
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#CommitComplete Gcommit exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "commit " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RevertComplete Grevert exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "revert " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#MergeComplete Gmerge exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "merge " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#RebaseComplete Grebase exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "rebase " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PullComplete Gpull exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "pull " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#PushComplete Gpush exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "push " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_other '-complete=customlist,fugitive#FetchComplete Gfetch exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "fetch " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#BlameComplete Gblame exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "blame " . <q-args>)'
for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame']
if exists(':G' . tolower(s:cmd)) != 2
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd) 'exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "' . tolower(s:cmd) . ' " . <q-args>)'
endif
endfor
unlet s:cmd
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(<q-args>, 0)"
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(<q-args>, 1)"
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#Command(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", "grep " . <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
@ -465,12 +467,27 @@ exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
if exists(':Gremove') != 2
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
if exists(':Gdelete') != 2
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
if exists(':Gmove') != 2
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
if exists(':Grename') != 2
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
if exists(':Gbrowse') != 2
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
endif
if get(g:, 'fugitive_no_maps')
finish

View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: mattn # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View file

@ -0,0 +1,281 @@
# Gist.vim
This is a vimscript for creating gists (http://gist.github.com).
For the latest version please see https://github.com/mattn/vim-gist.
## Usage:
- Post current buffer to gist, using default privacy option.
:Gist
- Post selected text to gist, using default privacy option.
This applies to all permutations listed below (except multi).
:'<,'>Gist
- Create a private gist.
:Gist -p
- Create a public gist.
(Only relevant if you've set gists to be private by default.)
:Gist -P
> This is only relevant if you've set gists to be private by default;
> if you get an empty gist list, try ":Gist --abandon".
- Create a gist anonymously.
:Gist -a
- Create a gist with all open buffers.
:Gist -m
- Edit the gist (you need to have opened the gist buffer first).
You can update the gist with the ":w" command within the gist buffer.
:Gist -e
- Edit the gist with name 'foo.js' (you need to have opened the gist buffer
first).
:Gist -e foo.js
- Post/Edit with the description " (you need to have opened the gist buffer
first). >
:Gist -s something
:Gist -e -s something
- Delete the gist (you need to have opened the gist buffer first).
Password authentication is needed.
:Gist -d
- Fork the gist (you need to have opened the gist buffer first).
Password authentication is needed.
:Gist -f
- Star the gist (you need to have opened the gist buffer first).
Password authentication is needed.
:Gist +1
- Unstar the gist (you need to have opened the gist buffer first).
Password authentication is needed.
:Gist -1
- Get gist XXXXX.
:Gist XXXXX
- Get gist XXXXX and add to clipboard.
:Gist -c XXXXX
- List your public gists.
:Gist -l
- List gists from user "mattn".
:Gist -l mattn
- List everyone's gists.
:Gist -la
- List gists from your starred gists.
:Gist -ls
- Open the gist on browser after you post or update it.
:Gist -b
## List Feature
- Useful mappings on the gist-listing buffer:
- Both `o` or `Enter` open the gist file in a new buffer, and close the
vim-gist listing one.
- `b` opens the gist file in a browser; this is necessary because
`Shift-Enter` (as was originally) only works for GUI vim.
- `y` copies the contents of the selected gist to the clipboard, and
closes the vim-gist buffer.
- `p` pastes the contents of the selected gist to the buffer from where
vim-gist was called, and closes the vim-gist buffer.
- Hitting `Escape` or `Tab` at the vim-gist buffer closes it.
- Gist listing has fixed-length columns now, more amenable to eye inspection.
Every line on the gist-listing buffer contains the gist id, name and
description, in that order. Columns are now padded and truncated to offer a
faster browsing, in the following way:
- The gist id string is fixed at 32 characters.
- The length (in characters) of the name of the gist is fixed and
can be set by the user using, for example:
`let g:gistvim_namelength = 20`
The default value for `gistvim_namelength` is 30. If the gist (file)name
exceeds that length, it is truncated to the specified length.
- Finally, the gist description is truncated in length to fit the remaining
of the line, avoiding wrapped lines that mess up the table layout.
- Note that the gist listing buffer now does not show the field 'code'
(not sure what that did in the first place).
## Tips:
If you set g:gist_clip_command, gist.vim will copy the gist code with option
'-c'.
- Mac:
let g:gist_clip_command = 'pbcopy'
- Linux:
let g:gist_clip_command = 'xclip -selection clipboard'
- Others (cygwin?):
let g:gist_clip_command = 'putclip'
If you want to detect filetype from the filename:
let g:gist_detect_filetype = 1
If you want to open browser after the post:
let g:gist_open_browser_after_post = 1
If you want to change the browser:
let g:gist_browser_command = 'w3m %URL%'
or:
let g:gist_browser_command = 'opera %URL% &'
On windows, this should work with your user settings.
If you want to show your private gists with ":Gist -l":
let g:gist_show_privates = 1
If you want your gist to be private by default:
let g:gist_post_private = 1
If you want your gist to be anonymous by default:
let g:gist_post_anonymous = 1
If you want to manipulate multiple files in a gist:
let g:gist_get_multiplefile = 1
If you want to use on GitHub Enterprise:
let g:gist_api_url = 'http://your-github-enterprise-domain/api/v3'
You need to either set global git config:
$ git config --global github.user Username
## License:
Copyright 2010 by Yasuhiro Matsumoto
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
## Install:
Copy it to your plugin directory.
gist.vim will create a curl cookie-jar file in your runtimepath.
- rtp:
- autoload/gist.vim
- plugin/gist.vim
If you want to uninstall gist.vim, remember to also remove `~/.gist-vim`.
You need to install webapi-vim also:
http://www.vim.org/scripts/script.php?script_id=4019
If you want to use latest one:
https://github.com/mattn/webapi-vim
### Install with [Vundle](https://github.com/gmarik/vundle)
Add the following lines to your `.vimrc`.
Bundle 'mattn/webapi-vim'
Bundle 'mattn/vim-gist'
Now restart Vim and run `:BundleInstall`.
### Install with [NeoBundle](https://github.com/Shougo/neobundle.vim)
Add the following line to your `.vimrc`.
NeoBundle 'mattn/vim-gist', {'depends': 'mattn/webapi-vim'}
## Requirements:
- curl command (http://curl.haxx.se/)
- webapi-vim (https://github.com/mattn/webapi-vim)
- and if you want to use your git profile, the git command-line client.
## Setup:
This plugin supports both basic and two-factor authentication using GitHub
API v3. The plugin stores its credentials in `~/.gist-vim`.
First, you need to set your GitHub username in git's global configuration:
$ git config --global github.user <username>
Then vim-gist will ask for your password in order to create an access
token. If you have two-factor authentication enabled, vim-gist will also
prompt you to enter the two-factor key you receive.
NOTE:
If you want you can set it directly to `g:github_user` and `g:gist_token`.
Whichever type of authentication you use, your GitHub password will not be
stored, only a OAuth access token produced specifically for vim-gist. The
token is stored in `~/.gist-vim`. If you stop using the plugin, you can
easily remove this file. To revoke the associated GitHub token, go to the
list of ["Authorized applications" on GitHub's "Account Settings"
page][uas].
[uas]: https://github.com/settings/applications
**Note:** the username is optional if you only send anonymous gists.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,358 @@
*Gist.vim* Vimscript for creating gists (http://gist.github.com)
Usage |vim-gist-usage|
Tips |vim-gist-tips|
License |vim-gist-license|
Install |vim-gist-install|
Requirements |vim-gist-requirements|
Setup |vim-gist-setup|
FAQ |vim-gist-faq|
This is a vimscript for creating gists (http://gist.github.com)
For the latest version please see https://github.com/mattn/vim-gist.
==============================================================================
USAGE *:Gist* *vim-gist-usage*
- Post current buffer to gist, using default privacy option. >
:Gist
<
- Post selected text to gist, using default privacy option.
This applies to all permutations listed below (except multi). >
:'<,'>Gist
<
- Create a private gist. >
:Gist -p
:Gist --private
<
- Create a public gist.
(Only relevant if you've set gists to be private by default.) >
:Gist -P
:Gist --public
<
- Post whole text to gist as public.
This is only relevant if you've set gists to be private by default.
>
:Gist -P
<
- Create a gist anonymously. >
:Gist -a
:Gist --anonymous
<
- Create a gist with all open buffers. >
:Gist -m
:Gist --multibuffer
<
- Edit the gist (you need to have opened the gist buffer first).
You can update the gist with the {:w} command within the gist buffer. >
:Gist -e
:Gist --edit
<
- Edit the gist with name "foo.js" (you need to have opened the gist buffer
first). >
:Gist -e foo.js
<
- Post/Edit with the description " (you need to have opened the gist buffer
first). >
:Gist -s something
:Gist --description something
:Gist -e -s something
<
- Delete the gist (you need to have opened the gist buffer first).
Password authentication is needed. >
:Gist -d
:Gist --delete
<
- Fork the gist (you need to have opened the gist buffer first).
Password authentication is needed. >
:Gist -f
:Gist --fork
<
- Star the gist (you need to have opened the gist buffer first).
Password authentication is needed.
>
:Gist +1
<
- Unstar the gist (you need to have opened the gist buffer first).
Password authentication is needed.
>
:Gist -1
<
- Get gist XXXXX. >
:Gist XXXXX
<
- Get gist XXXXX and add to clipboard. >
:Gist -c XXXXX
<
- List your public gists. >
:Gist -l
:Gist --list
<
- List gists from user "mattn". >
:Gist -l mattn
<
- List everyone's gists. >
:Gist -la
:Gist --listall
<
- List gists from your starred gists.
>
:Gist -ls
:Gist --liststar
- While the gist list is visible, the following mappings apply:
- 'o' or 'Enter' will open the selected gist file in a new buffer
and close the vim-gist listing split.
- 'b' will open the selected gist file in a browser. If you are in
GUI vim you can also achieve this by pressing 'Shift-Enter'.
- 'y' will copy the contents of the selected gist to the clipboard,
and close the vim-gist listing split.
- 'p' will (copy and) paste the contents of the selected gist to the
buffer from which vim-gist was called, and close the vim-gist
listing split.
- 'Esc' will close the vim-gist listing split without performing any
further action.
- Open the gist on browser after you post or update it.
>
:Gist -b
:Gist --browser
<
- Post as new gist after editing on the buffer.
>
:Gist!
<
==============================================================================
TIPS *vim-gist-tips*
If you set "g:gist_clip_command", gist.vim will copy the gist code with option
"-c".
- Mac: >
let g:gist_clip_command = 'pbcopy'
<
- Linux: >
let g:gist_clip_command = 'xclip -selection clipboard'
<
- Others (cygwin?): >
let g:gist_clip_command = 'putclip'
<
If you want to detect filetype from the filename: >
let g:gist_detect_filetype = 1
<
If you want to open the browser after the post: >
let g:gist_open_browser_after_post = 1
<
If you want to change the browser: >
let g:gist_browser_command = 'w3m %URL%'
<
or: >
let g:gist_browser_command = 'opera %URL% &'
<
On windows, this should work with your user settings.
If you want to show your private gists with ":Gist -l": >
let g:gist_show_privates = 1
<
If you want your gist to be private by default: >
let g:gist_post_private = 1
<
If you want your gist to be anonymous by default: >
let g:gist_post_anonymous = 1
<
If you want to edit all files for gists containing more than one: >
let g:gist_get_multiplefile = 1
<
If you want to use on GitHub Enterprise: >
let g:gist_api_url = 'http://your-github-enterprise-domain/api/v3'
<
If you want to open gist with current editing buffers: >
let g:gist_edit_with_buffers = 1
If you want to open gist list/buffer as vertical split: >
let g:gist_list_vsplit = 1
If you want to modify filetype for the file on github, or add mapping of
filetype/file-extension: >
let g:gist_extmap = { ".swift": "swift" }
<
key is file-extension, value is filetype.
If you want to update a gist, embed >
GistID: xxxxx
>
in your local file, then call >
:Gist
The vim-gist listing split lists gists ids, names (filenames) as well as
their description. This is done following a table layout, with fixed space
for each column. For offering quick browsing, vim-gist will truncate all
output exceeding the available horizontal space, assuring that every gist
listed only takes one line on the table. Although the gist id field width is
fixed internally, the user can define the length of the (file)name field on
the vim-gist listing. This can be done by the following declaration:
let g:gist_namelength = 20
Note that the default value for gist_namelength is 30. Again, if the gist
(file)name exceeds the specified number of characters, it will be truncated.
If you want to update a gist when only |:w!|: >
" :w and :w! update a gist.
let g:gist_update_on_write = 1
" Only :w! updates a gist.
let g:gist_update_on_write = 2
>
All other values are treated as 1.
This variable's value is 1 by default.
==============================================================================
LICENSE *vim-gist-license*
Copyright 2010 by Yasuhiro Matsumoto
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
==============================================================================
INSTALL *vim-gist-install*
Copy following files into your plugin directory.
rtp:
- autoload/gist.vim
- plugin/gist.vim
If you want to uninstall gist.vim, remember to also remove `~/.vim-gist`.
You need to install webapi-vim also:
http://www.vim.org/scripts/script.php?script_id=4019
If you want to use latest one:
https://github.com/mattn/webapi-vim
==============================================================================
REQUIREMENTS *vim-gist-requirements*
- curl command (http://curl.haxx.se/)
- webapi-vim (https://github.com/mattn/webapi-vim)
- and, if you want to use your git profile, the git command-line client.
==============================================================================
SETUP *vim-gist-setup*
This plugin uses GitHub API v3. The authentication value is stored in `~/.vim-gist`.
vim-gist provides two ways to authenticate against the GitHub APIs.
First, you need to set your GitHub username in global git config:
>
$ git config --global github.user Username
<
Then, gist.vim will ask for your password to create an authorization when you
first use it. The password is not stored and only the OAuth access token will
be kept for later use. You can revoke the token at any time from the list of
"Authorized applications" on GitHub's "Account Settings" page.
(https://github.com/settings/applications)
If you have two-factor authentication enabled on GitHub, you'll see the message
"Must specify two-factor authentication OTP code." In this case, you need to
create a "Personal Access Token" on GitHub's "Account Settings" page
(https://github.com/settings/applications) and place it in a file
named ~/.vim-gist like this:
>
token xxxxx
<
If you happen to have your password already written in ~/.gitconfig like
below:
>
[github]
password = xxxxx
<
Then, add following into your ~/.vimrc
>
let g:gist_use_password_in_gitconfig = 1
<
This is not secure at all, so strongly discouraged.
NOTE: the username is optional if you only send anonymous gists.
==============================================================================
FAQ *vim-gist-faq*
Q. :Gist returns a Forbidden error
A. Try deleting ~/.vim-gist and authenticating again.
==============================================================================
THANKS *vim-gist-thanks*
AD7six
Bruno Bigras
c9s
Daniel Bretoi
Jeremy Michael Cantrell
Kien N
kongo2002
MATSUU Takuto
Matthew Weier O'Phinney
ornicar
Roland Schilter
steve
tyru
Will Gray
netj
vim:tw=78:ts=8:ft=help:norl:

View file

@ -0,0 +1,23 @@
"=============================================================================
" File: gist.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" WebPage: http://github.com/mattn/vim-gist
" License: BSD
" GetLatestVimScripts: 2423 1 :AutoInstall: gist.vim
" script type: plugin
if &compatible || (exists('g:loaded_gist_vim') && g:loaded_gist_vim)
finish
endif
let g:loaded_gist_vim = 1
function! s:CompleteArgs(arg_lead,cmdline,cursor_pos)
return filter(copy(["-p", "-P", "-a", "-m", "-e", "-s", "-d", "+1", "-1", "-f", "-c", "-l", "-la", "-ls", "-b",
\ "--listall", "--liststar", "--list", "--multibuffer", "--private", "--public", "--anonymous", "--description", "--clipboard",
\ "--rawurl", "--delete", "--edit", "--star", "--unstar", "--fork", "--browser"
\ ]), 'stridx(v:val, a:arg_lead)==0')
endfunction
command! -nargs=? -range=% -bang -complete=customlist,s:CompleteArgs Gist :call gist#Gist(<count>, "<bang>", <line1>, <line2>, <f-args>)
" vim:set et:

View file

@ -1,9 +1,11 @@
## vim-gitgutter
A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object.
A Vim plugin which shows a git diff in the sign column. It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object.
The signs are always up to date and the plugin never saves your buffer.
The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this in 2013.
Features:
* Shows signs for added, modified, and removed lines.
@ -33,6 +35,10 @@ Constraints:
* Supports git only. If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify).
* Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, `set -g focus-events on` in your tmux.conf.
Compatibility:
Compatible back to Vim 7.4, and probably 7.3.
### Screenshot
@ -88,6 +94,10 @@ You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo
You cannot unstage a staged hunk.
After updating the signs, the plugin fires the `GitGutter` User autocommand.
After staging a hunk or part of a hunk, the plugin fires the `GitGutterStage` User autocommand.
#### Activation
@ -308,31 +318,20 @@ let g:gitgutter_sign_allow_clobber = 1
#### Signs' colours and symbols
By default vim-gitgutter uses your colourscheme's `Diff*` highlight groups' foreground colours for the signs' foreground colours. For example, your `DiffAdd` foreground colour will be used for the `+` sign's foreground colour.
If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use those for the signs' colours.
The signs' background colours will all be set to the sign column's background colour.
Otherwise it will use your colourscheme's `Diff*` highlight groups.
If you don't like the default colours, you can either fix your colourscheme's `Diff*` highlights or configure your own `GitGutter*` highlight groups. These groups are:
Either way the signs' background colours will be set to the sign column's background colour.
If you don't like the colours, specify the ones you want in your vimrc (see `:help highlight-guifg` and `:help highlight-ctermfg`). For example, to get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
```viml
GitGutterAdd " an added line (default: links to DiffAdd)
GitGutterChange " a changed line (default: links to DiffChange)
GitGutterDelete " at least one removed line (default: links to DiffDelete)
GitGutterChangeDelete " a changed line followed by at least one removed line (default: links to GitGutterChange)
highlight GitGutterAdd guifg=#009900 ctermfg=2
highlight GitGutterChange guifg=#bbbb00 ctermfg=3
highlight GitGutterDelete guifg=#ff2222 ctermfg=1
```
You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd MyDiffAdd`.
To get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
```viml
highlight GitGutterAdd guifg=#009900 guibg=<X> ctermfg=2 ctermbg=<Y>
highlight GitGutterChange guifg=#bbbb00 guibg=<X> ctermfg=3 ctermbg=<Y>
highlight GitGutterDelete guifg=#ff2222 guibg=<X> ctermfg=1 ctermbg=<Y>
```
where you would replace `<X>` and `<Y>` with the background colour of your `SignColumn` in the gui and the terminal respectively. For example, with the solarized colorscheme and a dark background, `guibg=#073642` and `ctermbg=0`.
To customise the symbols, add the following to your `~/.vimrc`:
```viml
@ -399,6 +398,8 @@ By default buffers are diffed against the index. However you can diff against a
let g:gitgutter_diff_base = '<commit SHA>'
```
If you are looking at a previous version of a file with Fugitive (e.g. via `:0Gclog`), gitgutter sets the diff base to the parent of the current revision.
This setting is ignored when the diffs are relative to the working tree.
@ -632,16 +633,6 @@ This plugin is for showing changes between the buffer and the index (and staging
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
> Why are the colours in the preview window weird?
Probably because your colourscheme doesn't configure the `diff{Added,Changed,Removed}` highlight groups. Try this in `after/syntax/diff.vim`:
```viml
highlight link diffAdded DiffAdd
highlight link diffChanged DiffChange
highlight link diffRemoved DiffDelete
```
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
You can configure whether GitGutter preserves or clobbers other signs using `g:gitgutter_sign_allow_clobber`. Set to `1` to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or `0` to preserve them.

View file

@ -1,5 +1,3 @@
let s:t_string = type('')
" Primary functions {{{
function! gitgutter#all(force) abort
@ -37,7 +35,7 @@ function! gitgutter#process_buffer(bufnr, force) abort
if a:force || s:has_fresh_changes(a:bufnr)
let diff = ''
let diff = 'NOT SET'
try
let diff = gitgutter#diff#run_diff(a:bufnr, g:gitgutter_diff_relative_to, 0)
catch /gitgutter not tracked/
@ -47,7 +45,7 @@ function! gitgutter#process_buffer(bufnr, force) abort
call gitgutter#hunk#reset(a:bufnr)
endtry
if diff != 'async'
if diff != 'async' && diff != 'NOT SET'
call gitgutter#diff#handler(a:bufnr, diff)
endif
@ -156,11 +154,7 @@ function! gitgutter#setup_maps()
endfunction
function! s:setup_path(bufnr, continuation)
let p = gitgutter#utility#repo_path(a:bufnr, 0)
if type(p) == s:t_string && !empty(p) " if path is known
return
endif
if gitgutter#utility#has_repo_path(a:bufnr) | return | endif
return gitgutter#utility#set_repo_path(a:bufnr, a:continuation)
endfunction
@ -188,7 +182,7 @@ endfunction
function! gitgutter#quickfix()
let locations = []
let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager '.g:gitgutter_git_args.
\ ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args
\ ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args. ' '. g:gitgutter_diff_base
let diff = systemlist(cmd)
let lnum = 0
for line in diff

View file

@ -1,3 +1,5 @@
scriptencoding utf8
let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '<nomodeline>' : ''
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
@ -10,9 +12,6 @@ endfunction
let s:c_flag = s:git_supports_command_line_config_override()
let s:temp_from = tempname()
let s:temp_buffer = tempname()
let s:counter = 0
" Returns a diff of the buffer against the index or the working tree.
@ -76,6 +75,9 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
throw 'gitgutter not tracked'
endif
let temp_from = tempname()
let temp_buffer = tempname()
" Wrap compound commands in parentheses to make Windows happy.
" bash doesn't mind the parentheses.
let cmd = '('
@ -88,7 +90,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
" second gitgutter#process_buffer() writing the file (synchronously, below)
" and the first gitgutter#process_buffer()'s async job reading it (with
" git-diff).
let buff_file = s:temp_buffer.'.'.a:bufnr
let buff_file = temp_buffer.'.'.a:bufnr
" Add a counter to avoid a similar race with two quick writes of the same buffer.
" Use a modulus greater than a maximum reasonable number of visible buffers.
@ -108,7 +110,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
" Without the buffer number, from_file would have a race in the shell
" between the second process writing it (with git-show) and the first
" reading it (with git-diff).
let from_file = s:temp_from.'.'.a:bufnr
let from_file = temp_from.'.'.a:bufnr
" Add a counter to avoid a similar race with two quick writes of the same buffer.
let from_file .= '.'.s:counter
@ -118,7 +120,7 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
endif
" Write file from index to temporary file.
let index_name = g:gitgutter_diff_base.':'.gitgutter#utility#repo_path(a:bufnr, 1)
let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1)
let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager show '.index_name.' > '.from_file.' && '
elseif a:from ==# 'working_tree'
@ -405,5 +407,3 @@ endfunction
function! s:save_last_seen_change(bufnr) abort
call gitgutter#utility#setbufvar(a:bufnr, 'tick', getbufvar(a:bufnr, 'changedtick'))
endfunction

View file

@ -84,6 +84,20 @@ function! gitgutter#highlight#define_highlights() abort
highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible
" When they are visible.
" If GitGutter* highlights are already defined, either by the user or the colourscheme,
" set their backgrounds to the sign column's.
for type in ["Add", "Change", "Delete"]
if hlexists("GitGutter".type)
" Were the highlight self-contained we could just declare the
" background attributes and they would be merged. But it might be a
" link, in which case it would be overwritten. So re-declare it in its
" entirety.
let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type)
execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg
endif
endfor
" By default use Diff* foreground colors with SignColumn's background.
for type in ['Add', 'Change', 'Delete']
let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type)
@ -107,6 +121,14 @@ function! gitgutter#highlight#define_highlights() abort
" Highlights used intra line.
highlight GitGutterAddIntraLine gui=reverse cterm=reverse
highlight GitGutterDeleteIntraLine gui=reverse cterm=reverse
" Set diff syntax colours (used in the preview window) - diffAdded,diffChanged,diffRemoved -
" to match the signs, if not set aleady.
for [dtype,type] in [['Added','Add'], ['Changed','Change'], ['Removed','Delete']]
if !hlexists('diff'.dtype)
let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type)
execute "highlight diff".dtype." guifg=".guifg." ctermfg=".ctermfg." guibg=NONE ctermbg=NONE"
endif
endfor
endfunction
function! gitgutter#highlight#define_signs() abort

View file

@ -1,4 +1,6 @@
let s:winid = 0
let s:preview_bufnr = 0
let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ? '<nomodeline>' : ''
function! gitgutter#hunk#set_hunks(bufnr, hunks) abort
call gitgutter#utility#setbufvar(a:bufnr, 'hunks', a:hunks)
@ -172,6 +174,8 @@ endfunction
function! gitgutter#hunk#stage(...) abort
if !s:in_hunk_preview_window() && !gitgutter#utility#has_repo_path(bufnr('')) | return | endif
if a:0 && (a:1 != 1 || a:2 != line('$'))
call s:hunk_op(function('s:stage'), a:1, a:2)
else
@ -181,11 +185,15 @@ function! gitgutter#hunk#stage(...) abort
endfunction
function! gitgutter#hunk#undo() abort
if !gitgutter#utility#has_repo_path(bufnr('')) | return | endif
call s:hunk_op(function('s:undo'))
silent! call repeat#set("\<Plug>(GitGutterUndoHunk)", -1)
endfunction
function! gitgutter#hunk#preview() abort
if !gitgutter#utility#has_repo_path(bufnr('')) | return | endif
call s:hunk_op(function('s:preview'))
silent! call repeat#set("\<Plug>(GitGutterPreviewHunk)", -1)
endfunction
@ -268,6 +276,10 @@ function! s:stage(hunk_diff)
\ diff)
if v:shell_error
call gitgutter#utility#warn('patch does not apply')
else
if exists('#User#GitGutterStage')
execute 'doautocmd' s:nomodeline 'User GitGutterStage'
endif
endif
" Refresh gitgutter's view of buffer.
@ -430,7 +442,12 @@ function! s:open_hunk_preview_window()
silent! wincmd P
if !&previewwindow
noautocmd execute g:gitgutter_preview_win_location &previewheight 'new gitgutter://hunk-preview'
let s:winid = win_getid()
doautocmd WinEnter
if exists('*win_getid')
let s:winid = win_getid()
else
let s:preview_bufnr = bufnr('')
endif
set previewwindow
setlocal filetype=diff buftype=acwrite bufhidden=delete
" Reset some defaults in case someone else has changed them.
@ -499,18 +516,21 @@ endfunction
function! s:enable_staging_from_hunk_preview_window()
augroup gitgutter_hunk_preview
autocmd!
execute 'autocmd BufWriteCmd <buffer='.winbufnr(s:winid).'> GitGutterStageHunk'
let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr
execute 'autocmd BufWriteCmd <buffer='.bufnr.'> GitGutterStageHunk'
augroup END
endfunction
function! s:goto_original_window()
noautocmd wincmd p
doautocmd WinEnter
endfunction
function! s:close_hunk_preview_window()
call setbufvar(winbufnr(s:winid), '&modified', 0)
let bufnr = s:winid != 0 ? winbufnr(s:winid) : s:preview_bufnr
call setbufvar(bufnr, '&modified', 0)
if g:gitgutter_preview_win_floating
if win_id2win(s:winid) > 0
@ -521,4 +541,5 @@ function! s:close_hunk_preview_window()
endif
let s:winid = 0
let s:preview_bufnr = 0
endfunction

View file

@ -9,25 +9,19 @@ endfunction
function! gitgutter#utility#setbufvar(buffer, varname, val)
let buffer = +a:buffer
" Default value for getbufvar() was introduced in Vim 7.3.831.
let bvars = getbufvar(buffer, '')
if empty(bvars)
let bvars = {}
endif
let dict = get(bvars, 'gitgutter', {})
let needs_setting = empty(dict)
let dict[a:varname] = a:val
if needs_setting
call setbufvar(buffer, 'gitgutter', dict)
let ggvars = getbufvar(buffer, 'gitgutter')
if type(ggvars) == type('')
unlet ggvars
let ggvars = {}
call setbufvar(buffer, 'gitgutter', ggvars)
endif
let ggvars[a:varname] = a:val
endfunction
function! gitgutter#utility#getbufvar(buffer, varname, ...)
let bvars = getbufvar(a:buffer, '')
if !empty(bvars)
let dict = get(bvars, 'gitgutter', {})
if has_key(dict, a:varname)
return dict[a:varname]
endif
let ggvars = getbufvar(a:buffer, 'gitgutter')
if type(ggvars) == type({}) && has_key(ggvars, a:varname)
return ggvars[a:varname]
endif
if a:0
return a:1
@ -105,6 +99,10 @@ function! gitgutter#utility#system(cmd, ...) abort
return output
endfunction
function! gitgutter#utility#has_repo_path(bufnr)
return index(['', -1, -2], gitgutter#utility#repo_path(a:bufnr, 0)) == -1
endfunction
" Path of file relative to repo root.
"
" * empty string - not set
@ -112,7 +110,7 @@ endfunction
" * -1 - pending
" * -2 - not tracked by git
function! gitgutter#utility#repo_path(bufnr, shellesc) abort
let p = gitgutter#utility#getbufvar(a:bufnr, 'path')
let p = gitgutter#utility#getbufvar(a:bufnr, 'path', '')
return a:shellesc ? gitgutter#utility#shellescape(p) : p
endfunction
@ -186,8 +184,21 @@ function! s:restore_shell() abort
endif
endfunction
function! gitgutter#utility#get_diff_base(bufnr)
let p = resolve(expand('#'.a:bufnr.':p'))
let ml = matchlist(p, '\v^fugitive:/.*/(\x{40,})/')
if !empty(ml) && !empty(ml[1])
return ml[1].'^'
endif
return g:gitgutter_diff_base
endfunction
function! s:abs_path(bufnr, shellesc)
let p = resolve(expand('#'.a:bufnr.':p'))
" Remove extra parts from fugitive's filepaths
let p = substitute(substitute(p, '^fugitive:', '', ''), '\v\.git/\x{40,}/', '', '')
return a:shellesc ? gitgutter#utility#shellescape(p) : p
endfunction

View file

@ -1,7 +1,7 @@
*gitgutter.txt* A Vim plugin which shows a git diff in the gutter.
Vim Git Gutter
Vim GitGutter
Author: Andy Stewart <https://airbladesoftware.com/>
@ -27,13 +27,16 @@ CONTENTS *gitgutter*
===============================================================================
INTRODUCTION *gitgutter-introduction*
GitGutter is a Vim plugin which shows a git diff in the 'gutter' (sign column).
GitGutter is a Vim plugin which shows a git diff in the sign column.
It shows which lines have been added, modified, or removed. You can also
preview, stage, and undo individual hunks. The plugin also provides a hunk
text object.
The signs are always up to date and the plugin never saves your buffer.
The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this
one in 2013.
===============================================================================
INSTALLATION *gitgutter-installation*
@ -177,7 +180,7 @@ Commands for folds:~
===============================================================================
AUTOCOMMAND *gitgutter-autocommand*
AUTOCOMMANDS *gitgutter-autocommands*
User GitGutter~
@ -189,6 +192,10 @@ event GitGutter. You can listen for this event, for example:
A dictionary `g:gitgutter_hook_context` is made available during its execution,
which contains an entry `bufnr` that contains the buffer number being updated.
User GitGutterStage~
After staging a hunk or part of a hunk vim-gitgutter fires a |User| |autocmd|
with the event GitGutterStage. Staging always happens in the current buffer.
===============================================================================
MAPPINGS *gitgutter-mappings*
@ -366,6 +373,9 @@ a revision instead. For example:
let g:gitgutter_diff_base = '<some commit SHA>'
<
If you are looking at a previous version of a file with Fugitive (e.g.
via :0Gclog), gitgutter sets the diff base to the parent of the current revision.
This setting is ignore when the diff is relative to the working tree
(|g:gitgutter_diff_relative_to|).
@ -519,20 +529,14 @@ of the current window instead of the global quickfix list.
===============================================================================
HIGHLIGHTS *gitgutter-highlights*
To change the signs' colours, set up the following highlight groups in your
colorscheme or |vimrc|:
To change the signs' colours, specify these highlight groups in your |vimrc|:
>
GitGutterAdd " an added line
GitGutterChange " a changed line
GitGutterDelete " at least one removed line
GitGutterChangeDelete " a changed line followed by at least one removed line
highlight GitGutterAdd guifg=#009900 ctermfg=2
highlight GitGutterChange guifg=#bbbb00 ctermfg=3
highlight GitGutterDelete guifg=#ff2222 ctermfg=1
<
You can either set these with `highlight GitGutterAdd {key}={arg}...` or link
them to existing highlight groups with, say:
>
highlight link GitGutterAdd MyDiffAdd
<
See |highlight-guifg| and |highlight-ctermfg| for the values you can use.
To change the line highlights, set up the following highlight groups in your
colorscheme or |vimrc|:

View file

@ -184,7 +184,7 @@ syntax match jsClassNoise contained /\./
syntax match jsClassFuncName contained /\<\K\k*\ze\s*[(<]/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowClassFunctionGroup
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsClassFuncName,jsClassProperty
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
syntax match jsClassProperty contained /\<\K\k*\ze\s*[=;]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs

View file

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

View file

@ -103,6 +103,9 @@ let g:multi_cursor_quit_key = '<Esc>'
## Settings
Currently there are four additional global settings one can tweak:
### ```g:multi_cursor_support_imap``` (Default: 1)
If set to 0, insert mappings won't be supported in _Insert_ mode anymore.
### ```g:multi_cursor_exit_from_visual_mode``` (Default: 0)
If set to 1, then pressing `g:multi_cursor_quit_key` in _Visual_ mode will quit and
delete all existing cursors, just skipping normal mode with multiple cursors.

View file

@ -1234,7 +1234,7 @@ function! s:wait_for_user_input(mode)
" imap jj JJ
" imap jjj JJJ
" will always trigger the 'jj' mapping
if s:from_mode ==# 'i' && mapcheck(s:char, "i") != ""
if s:from_mode ==# 'i' && mapcheck(s:char, "i") != "" && g:multi_cursor_support_imap
let map_dict = {}
let s_time = s:get_time_in_ms()
while 1

View file

@ -94,6 +94,10 @@ otherwise you'll have a tough time quitting from multicursor mode.
Currently there are four additional global settings one can tweak:
*g:multi_cursor_support_imap* (Default: 1)
If set to 0, insert mappings won't be supported in |insert-mode| anymore.
*g:multi_cursor_exit_from_visual_mode* (Default: 0)
If set to 0, then pressing |g:multi_cursor_quit_key| in |visual-mode| will quit

View file

@ -31,6 +31,7 @@ let s:settings = {
\ 'exit_from_insert_mode': 0,
\ 'use_default_mapping': 1,
\ 'debug_latency': 0,
\ 'support_imap': 1,
\ }
let s:settings_if_default = {

View file

@ -158,8 +158,8 @@ function! s:find_start_of_block(lnum, types, skip, multiple) abort
else
let re_skip = ''
endif
let lnum = a:lnum
let last_indent = indent(lnum) + 1
let last_indent = indent(a:lnum) + 1
let lnum = a:lnum - 1
while lnum > 0 && last_indent > 0
let indent = indent(lnum)
if indent < last_indent
@ -260,7 +260,7 @@ function! s:indent_like_block(lnum)
endif
let [blocks, skip] = blocks_ignore
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple)
let indents = s:find_start_of_block(a:lnum, blocks, skip, multiple)
if empty(indents)
return -1
endif

View file

@ -774,3 +774,23 @@ describe "elif after else" do
indent.should == 4
end
end
describe "elif after two ifs" do
before {
vim.feedkeys '\<ESC>ggdG'
}
it "keeps its indent to the outer if" do
vim.feedkeys 'iif 1:\<CR>if 2:\<CR>pass\<CR>elif 3:\<CR>pass\<CR>'
indent.should == 4
vim.feedkeys '\<Esc>'
indent.should == 0
proposed_indent.should == shiftwidth
vim.feedkeys 'ielif 4:'
indent.should == 0
proposed_indent.should == 0
vim.feedkeys '\<CR>'
indent.should == 4
proposed_indent.should == 4
end
end

View file

@ -500,13 +500,8 @@ class VimRubyCompletion
return if rails_base == nil
$:.push rails_base unless $:.index( rails_base )
rails_config = rails_base + "config/"
rails_lib = rails_base + "lib/"
$:.push rails_config unless $:.index( rails_config )
$:.push rails_lib unless $:.index( rails_lib )
bootfile = rails_config + "boot.rb"
envfile = rails_config + "environment.rb"
bootfile = rails_base + "config/boot.rb"
envfile = rails_base + "config/environment.rb"
if File.exists?( bootfile ) && File.exists?( envfile )
begin
require bootfile

View file

@ -111,7 +111,7 @@ else
if !exists('g:ruby_default_path')
if has("ruby") && has("win32")
ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
elseif executable('ruby')
elseif executable('ruby') && !empty($HOME)
let g:ruby_default_path = s:query_path($HOME)
else
let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val')

View file

@ -0,0 +1,12 @@
require 'spec_helper'
describe "Maxmempattern limit" do
specify "maxmempattern=1000 is enough even for long strings" do
str = <<~'EOF'
hash = {
"A-NOT-Managed-Strings" => "ABCDEfghe910dmckamks019292djdjOOOjjjd/cr3wdCA+1n/xHfHMgG+cC0EoUNngcBjgWvBMEF1CurBwTtDswJjQYa5wYRAQEBAQECCwGwAQEvI50CnwMNAwRrAQYBr9PPAoK7sQMBAQMCBAkICAQIAwEBAwYBAQQFFQEBAhQDAwMDCwEBAQUBAQHGAQEWBAEBDecBfS8CHQEKkAEMMxcMCQoUDwYHIjd3DQ4MFk0JWGYALSKLAQOLAYEBFBAjCBGDAQICAgMANjsZAg9fCxkCgLZKAwSEAQIBiwEZGAsrBCgFMmUEJShyFSfRBQEOSQY62AG0AVlCrQ",
}
EOF
assert_correct_highlighting str, %w[ABCDE], 'rubyString'
end
end

View file

@ -461,7 +461,7 @@ endif
syn match rubyDefinedOperator "\%#=1\<defined?" display
" 1.9-style Hash Keys and Keyword Parameters {{{1
syn match rubySymbol "\%([{(|,]\_s*\)\@<=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1
syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock
syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1

View file

@ -182,7 +182,7 @@ function! s:parser_text(till) dict abort
if var[0] is# 'VISUAL'
let lines = s:visual_placeholder(var, self.indent)
" Remove trailing newline. See #245
if lines[-1] == '' && self.next == "\n"
if lines[-1] =~ '^\s*$' && self.next == "\n"
call remove(lines, -1)
endif
elseif var[0] >= 0

View file

@ -308,16 +308,29 @@ endsnippet
# methods #
#############
snippet equals "Equals method" b
public override bool Equals(object obj)
snippet equals "Equality for a type" b
public override bool Equals(object obj) => Equals(obj as ${1:TYPE});
public bool Equals($1 other) // IEquatable<$1>
{
if (obj == null || GetType() != obj.GetType())
{
if (object.ReferenceEquals(other, null))
return false;
if (object.ReferenceEquals(this, other))
return true;
if (this.GetType() != other.GetType())
return false;
}
$0
return base.Equals(obj);
return base.Equals(other);
}
public override int GetHashCode() => base.GetHashCode();
public static bool operator ==($1 x, $1 y) =>
(object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null))
|| (!object.ReferenceEquals(x, null) && x.Equals(y));
public static bool operator !=($1 x, $1 y) => !(x == y);
endsnippet
snippet mth "Method" b

View file

@ -0,0 +1,10 @@
snippet for "ejs for loop" b
<% for (let ${1:i = 0}; ${2:i<arr.length}; ${3:i++}) { %>
${0:body}
<% } %>
endsnippet
snippet forE "ejs for Each loop" b
<% ${1:array}.forEach((${2:single var}) => { %>
${0:body}
<% }) %>
endsnippet

View file

@ -0,0 +1,42 @@
# Functional components
snippet rfc "react functional component" b
import React, {useState} from "react"
function ${1:`!p snip.rv = snip.basename`}(${2}){
return(
<div>
${3:<p>Body</p>}
</div>
)
}
export default $4`!p snip.rv = snip.basename`
endsnippet
# React Hooks
snippet useS "useState Hook" b
const [${1}, set$1`!p snip.rv=t[1].title()`] = useState(${3:"${4}"})
endsnippet
snippet useE "useEffect Hook" b
useEffect(() => {
${1:${0}}
}${2})
endsnippet
snippet useC "useContext Hook" b
const ${1:context} = useContext(${2})
endsnippet
snippet useRe "useReducer Hook" b
const [${3:state}, ${4:dispatch}] = useReducer(${5:reducer}, ${2:initial_value})
endsnippet
snippet useCB "useCallback(fn, inputs)" b
const ${1:callback} = useCallback((${2})) => ${3:{
${4}
}}, [${5}]
endsnippet
snippet useM "useMemo(fn, inputs)" b
const ${1:memorized} = useMemo(() => ${2:{
${3}
}}, [${4}])
endsnippet
snippet useR "useRef(defaultValue)" b
const ${1:ref} = useRef(${2:null})
endsnippet

View file

@ -96,6 +96,9 @@ snippet *** "bold italics"
***${1:${VISUAL}}***$0
endsnippet
snippet /* "Comment"
<!-- ${1:${VISUAL}} -->$0
endsnippet
################
# Common stuff #
@ -131,6 +134,12 @@ snippet fnt "Footnote"
[^$1]:${2:Text}
endsnippet
snippet detail "Disclosure"
<details${3: open=""}>
${1:summary>${2}</summary>}$0
</details>
endsnippet
post_jump "create_table(snip)"
snippet "tb([1-9][1-9])" "Fancy table" br
`!p snip.rv = match.group(1)`

View file

@ -4,7 +4,7 @@
priority -50
snippet fn "pub fn name(?) -> ? {}"
snippet fn "fn name(?) -> ? {}"
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
${VISUAL}$0
}

View file

@ -0,0 +1 @@
extends html, javascript, css

View file

@ -44,7 +44,7 @@ def add_row(snip):
endglobal
snippet "b(egin)?" "begin{} / end{}" br
snippet "\\?b(egin)?" "begin{} / end{}" br
\begin{${1:something}}
${0:${VISUAL}}
\end{$1}

View file

@ -1,88 +1,70 @@
# cannot use /usr/bin/env because it does not support parameters (as -f)
snippet #! #!/usr/bin/awk -f
#!/usr/bin/awk -f
# @include is a gawk extension
snippet inc @include
@include "${1}"${0}
# @load is a gawk extension
snippet loa @load
@load "${1}"${0}
snippet beg BEGIN { ... }
BEGIN {
${0}
}
# BEGINFILE is a gawk extension
snippet begf BEGINFILE { ... }
BEGINFILE {
${0}
}
snippet end END { ... }
END {
${0}
}
# ENDFILE is a gawk extension
snippet endf ENDFILE { ... }
ENDFILE {
${0}
}
snippet pri print
print ${1:"${2}"}${0}
snippet printf printf
printf("${1:%s}\n", ${2})${0}
snippet ign IGNORECASE
IGNORECASE = ${1:1}
snippet if if {...}
if (${1}) {
${0:${VISUAL}}
}
snippet ife if ... else ...
if (${1}) {
${2:${VISUAL}}
} else {
${0}
}
snippet eif else if ...
else if (${1}) {
${0}
}
snippet el else {...}
else {
${0}
}
snippet wh while
while (${1}) {
${2}
}
snippet do do ... while
do {
${0}
} while (${1})
snippet for for
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
${0}
}
snippet fore for each
for (${1:i} in ${2:array}) {
${0}
}
# the switch is a gawk extension
snippet sw switch
switch (${1}) {
@ -93,10 +75,8 @@ snippet sw switch
${0}
break
}
# the switch is a gawk extension
snippet case case
case ${1}:
${0}
break

Some files were not shown because too many files have changed in this diff Show more