Updated plugins
This commit is contained in:
parent
751af44cbe
commit
aad95603ea
|
@ -204,6 +204,14 @@ let s:hlgrps = {
|
|||
\ }
|
||||
|
||||
" lname, sname of the basic(non-extension) modes
|
||||
let s:types = ['fil', 'buf', 'mru']
|
||||
if !exists('g:ctrlp_types')
|
||||
let g:ctrlp_types = s:types
|
||||
el
|
||||
call filter(g:ctrlp_types, "index(['fil', 'buf', 'mru'], v:val)!=-1")
|
||||
en
|
||||
let g:ctrlp_builtins = len(g:ctrlp_types)-1
|
||||
|
||||
let s:coretypes = filter([
|
||||
\ ['files', 'fil'],
|
||||
\ ['buffers', 'buf'],
|
||||
|
@ -912,10 +920,13 @@ fu! s:PrtDeleteMRU()
|
|||
endf
|
||||
|
||||
fu! s:PrtExit()
|
||||
let bw = bufwinnr('%')
|
||||
exe bufwinnr(s:bufnr).'winc w'
|
||||
if bufnr('%') == s:bufnr && bufname('%') == 'ControlP'
|
||||
noa cal s:Close(1)
|
||||
noa winc p
|
||||
els
|
||||
exe bw.'winc w'
|
||||
en
|
||||
endf
|
||||
|
||||
|
@ -1962,7 +1973,7 @@ fu! s:isabs(path)
|
|||
endf
|
||||
|
||||
fu! s:bufnrfilpath(line)
|
||||
if s:isabs(a:line) || a:line =~ '^\~[/\\]'
|
||||
if s:isabs(a:line) || a:line =~ '^\~[/\\]' || a:line =~ '^\w\+:\/\/'
|
||||
let filpath = a:line
|
||||
el
|
||||
let filpath = s:dyncwd.s:lash().a:line
|
||||
|
@ -2032,7 +2043,7 @@ fu! s:checkbuf()
|
|||
endf
|
||||
|
||||
fu! s:iscmdwin()
|
||||
let ermsg = v:errmsg
|
||||
let [ermsg, v:errmsg] = [v:errmsg, '']
|
||||
sil! noa winc p
|
||||
sil! noa winc p
|
||||
let [v:errmsg, ermsg] = [ermsg, v:errmsg]
|
||||
|
|
|
@ -255,8 +255,9 @@ plugins look for .git/, .hg/,... some other plugins look for external *.exe
|
|||
tools on Windows). So be a little mindful of what you put in your |wildignore|.
|
||||
|
||||
*'g:ctrlp_custom_ignore'*
|
||||
In addition to |'wildignore'|, use this for files and directories you want only
|
||||
CtrlP to not show. Use regexp to specify the patterns: >
|
||||
In addition to |'wildignore'| and |g:ctrlp_show_hidden|, use this for files
|
||||
and directories you want only CtrlP to not show. Use regexp to specify the
|
||||
patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
|
@ -860,7 +861,8 @@ COMMANDS *ctrlp-commands*
|
|||
Open CtrlP in find file mode.
|
||||
|
||||
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
|
||||
used to determine the starting directory.
|
||||
used to determine the starting directory. See |:CtrlPCurFile| and
|
||||
|:CtrlPCurWD| to temporarily override the setting.
|
||||
|
||||
You can use <tab> to auto-complete the [starting-directory] when typing it.
|
||||
|
||||
|
@ -868,6 +870,16 @@ COMMANDS *ctrlp-commands*
|
|||
:CtrlPBuffer
|
||||
Open CtrlP in find buffer mode.
|
||||
|
||||
*:CtrlPCurFile*
|
||||
:CtrlPCurFile
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = '' and ignores
|
||||
the variable's current value.
|
||||
|
||||
*:CtrlPCurWD*
|
||||
:CtrlPCurWD
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = '' and ignores
|
||||
the variable's current value.
|
||||
|
||||
*:CtrlPMRU*
|
||||
:CtrlPMRU
|
||||
Open CtrlP in find Most-Recently-Used file mode.
|
||||
|
@ -1329,7 +1341,8 @@ Available extensions:~
|
|||
Buffer Tag mode options:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
If ctags isn't in your $PATH, use this to set its location: >
|
||||
If ctags isn't in your $PATH, or a ctags binary exists in either
|
||||
/opt/local/bin or /usr/local/bin, us this to set its location: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
|
|
|
@ -10,15 +10,9 @@ if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
|||
en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let s:types = ['fil', 'buf', 'mru']
|
||||
if !exists('g:ctrlp_types')
|
||||
let g:ctrlp_types = s:types
|
||||
el
|
||||
call filter(g:ctrlp_types, "index(['fil', 'buf', 'mru'], v:val)!=-1")
|
||||
en
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], len(g:ctrlp_types)-1]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
|
|
|
@ -64,6 +64,10 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
|
|||
|
||||
If more than one mode is specified, they will be tried in order until a directory is located.
|
||||
|
||||
* If a file is already open, open it again in a new pane instead of switching to the existing pane
|
||||
|
||||
`let g:ctrlp_switch_buffer = 'et'`
|
||||
|
||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`. If a custom listing command is being used, exclusions are ignored:
|
||||
|
||||
```vim
|
||||
|
|
|
@ -272,7 +272,7 @@ set noshowmode
|
|||
```
|
||||
|
||||
|
||||
Now, let us get back to the tutorial (with the patched font for vim-powerline).
|
||||
Now, let's get back to the tutorial (with the patched font for vim-powerline).
|
||||
You look into a help file to find the marks annoying.
|
||||
|
||||

|
||||
|
@ -293,8 +293,8 @@ let g:lightline = {
|
|||

|
||||
|
||||
Huh? Weird!
|
||||
The components do not collapse even if they have no information!
|
||||
In order to avoid this situation, you set expressions to `g:lightline.component_visible_condition`, which should become 1 only when the corresponding components have information.
|
||||
The subseparators are visible even if the components are empty.
|
||||
In order to hide the subseparators, you can set expressions to `g:lightline.component_visible_condition`, which should be 1 only when the corresponding component is not empty.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
|
@ -313,8 +313,8 @@ let g:lightline = {
|
|||

|
||||
|
||||
Okay. It works nice.
|
||||
|
||||
|
||||
The configuration `component_visible_condition` is used to control the visibility of the subseparators.
|
||||
You cannot use this variable to control the visibility of the components themselves.
|
||||
|
||||
How does lightline decide the components to show in the statusline?
|
||||
It's very simple.
|
||||
|
@ -340,16 +340,9 @@ let g:lightline = {
|
|||
\ }
|
||||
```
|
||||
If the plugin arranges all the components (in a situation you `set paste` and the file `.vimrc` is read-only, try to modify):
|
||||
|
||||

|
||||
|
||||
The mode component, the paste component, read-only component, filename component and modified component in a row.
|
||||
Normally, the paste component does not show up.
|
||||

|
||||
|
||||
If the file is not read-only (more common cases), the read-only component does not show up.
|
||||

|
||||
|
||||
|
||||
Again look into `g:lightline.active.left`.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
|
@ -357,8 +350,6 @@ let g:lightline = {
|
|||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'readonly', 'filename', 'modified' ] ] ...
|
||||
```
|
||||
And the screen shot of all the components.
|
||||

|
||||
|
||||
The mode and paste component are displayed in the same group.
|
||||
The read-only, filename and modified component are in the second group.
|
||||
|
@ -369,11 +360,11 @@ You can configure the components in the statusline by the following four variabl
|
|||
+ `g:lightline.inactive.left`
|
||||
+ `g:lightline.inactive.right`
|
||||
|
||||
Of course, your settings in `.vimrc` have priority over the default settings in lightline.
|
||||
Of course, your configurations in `.vimrc` have priority over the default settings in lightline.
|
||||
|
||||
|
||||
|
||||
GitHub branch is important for us.
|
||||
Git branch is important for us.
|
||||
And it is a default component in [powerline](https://github.com/Lokaltog/powerline) and [vim-powerline](https://github.com/Lokaltog/vim-powerline).
|
||||
However, lightline does not provide the branch feature by default.
|
||||
|
||||
|
@ -552,7 +543,7 @@ subseparator.left | '\|' | '' (\ue0b1) | '⮁' (\u2b81)
|
|||
subseparator.right | '\|' | '' (\ue0b3) | '⮃' (\u2b83)
|
||||
branch symbol | -- | '' (\ue0a0) | '⭠' (\u2b60)
|
||||
readonly symbol | -- | '' (\ue0a2) | '⭤' (\u2b64)
|
||||
linecolumn symbol | -- | '' (\ue0a1) | '⭡' (\u2b81)
|
||||
linecolumn symbol | -- | '' (\ue0a1) | '⭡' (\u2b61)
|
||||
|
||||
### My settings
|
||||
I show my settings. I use the patched font for vim-powerline.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/06/12 22:40:00.
|
||||
" Last Change: 2016/09/04 13:01:40.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
|
@ -111,6 +111,7 @@ let s:_lightline = {
|
|||
\ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
|
||||
\ },
|
||||
\ 'component_function': {},
|
||||
\ 'component_function_visible_condition': {},
|
||||
\ 'component_expand': {
|
||||
\ 'tabs': 'lightline#tabs'
|
||||
\ },
|
||||
|
@ -293,11 +294,11 @@ function! lightline#highlight(...) abort
|
|||
endfunction
|
||||
|
||||
function! s:subseparator(components, subseparator, expanded) abort
|
||||
let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ]
|
||||
let [a, c, f, v, u ] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_visible_condition ]
|
||||
let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
|
||||
\ has_key(f, a[v:val]) ? (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"" :
|
||||
\ has_key(v, a[v:val]) ? "(" . v[a[v:val]] . ")" : has_key(c, a[v:val]) ? "1" : "0"')
|
||||
return '%{' . (xs[0] ==# '1' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
||||
\ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[a[v:val]].")" : (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"") :
|
||||
\ has_key(v, a[v:val]) ? "(".v[a[v:val]].")" : has_key(c, a[v:val]) ? "1" : "0"')
|
||||
return '%{' . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
||||
endfunction
|
||||
|
||||
function! lightline#concatenate(xs, right) abort
|
||||
|
@ -324,7 +325,7 @@ endfunction
|
|||
|
||||
function! s:evaluate_expand(component) abort
|
||||
try
|
||||
let result = call(a:component, [])
|
||||
let result = eval(a:component . '()')
|
||||
if type(result) == 1 && result ==# ''
|
||||
return []
|
||||
endif
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
*lightline.txt* A light and configurable statusline/tabline for Vim
|
||||
|
||||
Version: 0.0
|
||||
Version: 0.1
|
||||
Author: itchyny (https://github.com/itchyny)
|
||||
License: MIT License
|
||||
Repository: https://github.com/itchyny/lightline.vim
|
||||
Last Change: 2016/08/09 06:22:39.
|
||||
Last Change: 2016/09/13 23:56:56.
|
||||
|
||||
CONTENTS *lightline-contents*
|
||||
|
||||
|
@ -19,7 +19,6 @@ Examples |lightline-examples|
|
|||
Nice Examples |lightline-nice-examples|
|
||||
Powerful Example |lightline-powerful-example|
|
||||
Troubleshooting |lightline-troubleshooting|
|
||||
Changelog |lightline-changelog|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *lightline-introduction*
|
||||
|
@ -115,10 +114,13 @@ OPTIONS *lightline-option*
|
|||
\ 'column': '%c'
|
||||
\ 'close': '%999X X ' }
|
||||
<
|
||||
g:lightline.component_visible_condition *g:lightline.component_visible_condition*
|
||||
Dictionary of boolean expressions for the components.
|
||||
g:lightline.component_visible_condition
|
||||
*g:lightline.component_visible_condition*
|
||||
Dictionary to store the visible condition of the components.
|
||||
Each expression should correspond to the condition each
|
||||
component have non-zero length.
|
||||
component is not empty. This configuration is used to control
|
||||
the visibility of the subseparators. You cannot use this
|
||||
configuration to control the visibility of the components.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_visible_condition = {
|
||||
|
@ -135,6 +137,11 @@ OPTIONS *lightline-option*
|
|||
because the user does not have to set both component and
|
||||
component_visible_condition. If a component set to both component and
|
||||
component_function, the setting of component_function has priority.
|
||||
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_function = {}
|
||||
<
|
||||
For example, if you want a component for read-only mark, which
|
||||
disappears in help windows:
|
||||
>
|
||||
|
@ -150,6 +157,19 @@ OPTIONS *lightline-option*
|
|||
function! LightLineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
<
|
||||
g:lightline.component_function_visible_condition
|
||||
*g:lightline.component_function_visible_condition*
|
||||
Dictionary to store the visible conditions of the function
|
||||
components. Each expression should correspond to the condition
|
||||
each component is not empty. This configuration is used to
|
||||
control the visibility of the subseparators. You can use this
|
||||
configuration to reduce the number of function calls for
|
||||
function components by setting the value 1 (to tell lightline
|
||||
that the component is always visible).
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_function_visible_condition = {}
|
||||
<
|
||||
g:lightline.component_expand *g:lightline.component_expand*
|
||||
Another dictionary for components. You can create a component
|
||||
|
@ -1126,7 +1146,7 @@ Problem 9: *lightline-problem-9*
|
|||
subseparator.right '|' '' (\ue0b3) '⮃' (\u2b83)
|
||||
branch symbol -- '' (\ue0a0) '⭠' (\u2b60)
|
||||
readonly symbol -- '' (\ue0a2) '⭤' (\u2b64)
|
||||
linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b81)
|
||||
linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b61)
|
||||
|
||||
Problem 10: *lightline-problem-10*
|
||||
Cool statusline disappears on |unite|, |vimfiler| and |vimshell|
|
||||
|
@ -1270,11 +1290,5 @@ Problem 17: *lightline-problem-17*
|
|||
Report/Request the issue/feature at
|
||||
https://github.com/itchyny/lightline.vim/issues.
|
||||
|
||||
==============================================================================
|
||||
CHANGELOG *lightline-changelog*
|
||||
|
||||
0.0 2013-08-21, ...
|
||||
- Initial commit and implementation
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:sw=4:ts=8:ft=help:norl:noet:
|
||||
|
|
|
@ -610,3 +610,15 @@ function! s:suite.duplicated_type_both_nil_right_most()
|
|||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.dictionary_function()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'g:lightline.Custom' } }
|
||||
function! g:lightline.Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
endfunction
|
||||
|
|
|
@ -177,6 +177,111 @@ function! s:suite.subseparator_component_function_7()
|
|||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_3()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_4()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_5()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_6()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_7()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
Next
|
||||
- Shorten delete confimration of empty directory to 'y' (mikeperri) #530
|
||||
- Fix API call to open directory tree in window (devm33) #533
|
||||
- Change default arrows on non-Windows platforms (gwilk) #546
|
||||
- Update to README - combine cd and git clone (zwhitchcox) #584
|
||||
- Update to README - Tip: start NERDTree when vim starts (therealplato) #593
|
||||
- Escape filename when moving an open buffer (zacharyvoase) #595
|
||||
- Fixed incorrect :helptags command in README (curran) #619
|
||||
- Fixed incomplete escaping of folder arrows (adityanatraj) #548
|
||||
- Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558
|
||||
- Replace strchars() with backward compatible workaround.
|
||||
- Add support for copy command in Windows (SkylerLipthay) #231
|
||||
- Fixed typo in README.markdown - :Helptags -> :helptags
|
||||
- Rename "primary" and "secondary" trees to "tab" and "window" trees.
|
||||
- Move a bunch of buffer level variables into the NERDTree and UI classes.
|
||||
- Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing)
|
||||
|
|
|
@ -57,10 +57,9 @@ Installation
|
|||
|
||||
####[pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/scrooloose/nerdtree.git
|
||||
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
||||
|
||||
Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`.
|
||||
Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, and check out `:help NERD_tree.txt`.
|
||||
|
||||
|
||||
####[apt-vim](https://github.com/egalpin/apt-vim)
|
||||
|
@ -101,6 +100,16 @@ Stick this in your vimrc:
|
|||
|
||||
Note: Now start vim with plain `vim`, not `vim .`
|
||||
|
||||
---
|
||||
> How can I open NERDTree on startup, and have my cursor start in the other window?
|
||||
|
||||
Stick this in your vimrc:
|
||||
|
||||
autocmd vimenter * NERDTree
|
||||
autocmd vimenter * wincmd p
|
||||
|
||||
*via [stackoverflow/Yohann](http://stackoverflow.com/questions/4277808/nerdtree-auto-focus-to-file-when-opened-in-new-tab/19330023#19330023)*
|
||||
|
||||
---
|
||||
> How can I map a specific key or shortcut to open NERDTree?
|
||||
|
||||
|
@ -125,5 +134,5 @@ See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-9259069
|
|||
|
||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
||||
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
let g:NERDTreeDirArrowExpandable = '►'
|
||||
let g:NERDTreeDirArrowCollapsible = '▼'
|
||||
|
|
|
@ -668,14 +668,18 @@ NERD tree. These options should be set in your vimrc.
|
|||
|'NERDTreeWinSize'| Sets the window size when the NERD tree is
|
||||
opened.
|
||||
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
'Press ? for help' text.
|
||||
|
||||
|'NERDTreeCascadeSingleChildDir'|
|
||||
Collapses on the same line directories that
|
||||
have only one child directory.
|
||||
|
||||
|'NERDTreeCascadeOpenSingleChildDir'|
|
||||
Cascade open while selected directory has only
|
||||
one child that also is a directory.
|
||||
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
a buffer when a file is being deleted or renamed
|
||||
via a context menu command.
|
||||
|
||||
|
@ -987,7 +991,18 @@ of the following lines to set this option: >
|
|||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
*'NERDTreeCascadeSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
When displaying dir nodes, this option tells NERDTree to collapse dirs that
|
||||
have only one child. Use one of the follow lines to set this option: >
|
||||
let NERDTreeCascadeSingleChildDir=0
|
||||
let NERDTreeCascadeSingleChildDir=1
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
|
@ -1001,7 +1016,7 @@ useful for Java projects. Use one of the follow lines to set this option: >
|
|||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
Values: 0 or 1
|
||||
Default: 0.
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ endfunction
|
|||
function! s:Opener._openDirectory(node)
|
||||
if self._nerdtree.isWinTree()
|
||||
call self._gotoTargetWin()
|
||||
call g:NERDTreeCreator.CreateWindow(a:node.path.str())
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
|
||||
else
|
||||
call self._gotoTargetWin()
|
||||
if empty(self._where)
|
||||
|
|
|
@ -174,11 +174,15 @@ function! s:Path.copy(dest)
|
|||
|
||||
call s:Path.createParentDirectories(a:dest)
|
||||
|
||||
let dest = s:Path.WinToUnixPath(a:dest)
|
||||
if exists('g:NERDTreeCopyCmd')
|
||||
let cmd_prefix = g:NERDTreeCopyCmd
|
||||
else
|
||||
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
|
||||
endif
|
||||
|
||||
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), self._escChars()) . " " . escape(dest, self._escChars())
|
||||
let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars())
|
||||
let success = system(cmd)
|
||||
if success != 0
|
||||
if v:shell_error != 0
|
||||
throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'"
|
||||
endif
|
||||
endfunction
|
||||
|
@ -187,7 +191,7 @@ endfunction
|
|||
"
|
||||
"returns 1 if copying is supported for this OS
|
||||
function! s:Path.CopyingSupported()
|
||||
return exists('g:NERDTreeCopyCmd')
|
||||
return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.copyingWillOverwrite(dest) {{{1
|
||||
|
@ -213,7 +217,7 @@ endfunction
|
|||
"FUNCTION: Path.createParentDirectories(path) {{{1
|
||||
"
|
||||
"create parent directories for this path if needed
|
||||
"without throwing any errors is those directories already exist
|
||||
"without throwing any errors if those directories already exist
|
||||
"
|
||||
"Args:
|
||||
"path: full path of the node whose parent directories may need to be created
|
||||
|
@ -226,8 +230,7 @@ endfunction
|
|||
|
||||
"FUNCTION: Path.delete() {{{1
|
||||
"
|
||||
"Deletes the file represented by this path.
|
||||
"Deletion of directories is not supported
|
||||
"Deletes the file or directory represented by this path.
|
||||
"
|
||||
"Throws NERDTree.Path.Deletion exceptions
|
||||
function! s:Path.delete()
|
||||
|
|
|
@ -117,28 +117,14 @@ endfunction
|
|||
"FUNCTION: TreeDirNode.getCascade() {{{1
|
||||
"Return an array of dir nodes (starting from self) that can be cascade opened.
|
||||
function! s:TreeDirNode.getCascade()
|
||||
if !self.isCascadable()
|
||||
return [self]
|
||||
endif
|
||||
|
||||
let rv = [self]
|
||||
let node = self
|
||||
let vc = self.getVisibleChildren()
|
||||
let visChild = vc[0]
|
||||
|
||||
while 1
|
||||
let vc = node.getVisibleChildren()
|
||||
if len(vc) != 1
|
||||
break
|
||||
endif
|
||||
|
||||
let visChild = vc[0]
|
||||
|
||||
"TODO: optimize
|
||||
if !visChild.path.isDirectory
|
||||
break
|
||||
endif
|
||||
|
||||
call add(rv, visChild)
|
||||
let node = visChild
|
||||
endwhile
|
||||
|
||||
return rv
|
||||
return [self] + visChild.getCascade()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getChildCount() {{{1
|
||||
|
@ -264,6 +250,10 @@ endfunction
|
|||
"FUNCTION: TreeDirNode.isCascadable() {{{1
|
||||
"true if this dir has only one visible child - which is also a dir
|
||||
function! s:TreeDirNode.isCascadable()
|
||||
if g:NERDTreeCascadeSingleChildDir == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let c = self.getVisibleChildren()
|
||||
return len(c) == 1 && c[0].path.isDirectory
|
||||
endfunction
|
||||
|
@ -466,7 +456,7 @@ function! s:TreeDirNode.refresh()
|
|||
|
||||
" Regular expression is too expensive. Use simply string comparison
|
||||
" instead
|
||||
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
|
||||
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
|
||||
\ i[len(i)-2:1] != "." && i[len(i)-1] != "."
|
||||
try
|
||||
"create a new path and see if it exists in this nodes children
|
||||
|
|
|
@ -282,7 +282,8 @@ endfunction
|
|||
function! s:UI._indentLevelFor(line)
|
||||
"have to do this work around because match() returns bytes, not chars
|
||||
let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
|
||||
let leadChars = strchars(a:line[0:numLeadBytes-1])
|
||||
" The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+
|
||||
let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs'))
|
||||
|
||||
return leadChars / s:UI.IndentWid()
|
||||
endfunction
|
||||
|
|
|
@ -74,7 +74,7 @@ endfunction
|
|||
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
|
||||
echo a:msg
|
||||
if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
|
||||
let quotedFileName = "'" . a:newFileName . "'"
|
||||
let quotedFileName = fnameescape(a:newFilename)
|
||||
" 1. ensure that a new buffer is loaded
|
||||
exec "badd " . quotedFileName
|
||||
" 2. ensure that all windows which display the just deleted filename
|
||||
|
@ -160,10 +160,10 @@ function! NERDTreeDeleteNode()
|
|||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let confirmed = 0
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
if currentNode.path.isDirectory && currentNode.getChildCount() > 0
|
||||
let choice =input("Delete the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||
\ "STOP! Directory is not empty! To delete, type 'yes'\n" .
|
||||
\ "" . currentNode.path.str() . ": ")
|
||||
let confirmed = choice ==# 'yes'
|
||||
else
|
||||
|
|
|
@ -68,13 +68,14 @@ call s:initVariable("g:NERDTreeShowLineNumbers", 0)
|
|||
call s:initVariable("g:NERDTreeSortDirs", 1)
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "►")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▼")
|
||||
else
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
|
||||
endif
|
||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
|
||||
call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
|
||||
|
||||
if !exists("g:NERDTreeSortOrder")
|
||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
|
@ -103,6 +104,8 @@ call s:initVariable("g:NERDTreeWinSize", 31)
|
|||
"Note: the space after the command is important
|
||||
if nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
|
||||
call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
|
||||
call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
|
||||
else
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
|
||||
call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
|
||||
|
|
|
@ -25,7 +25,7 @@ syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
|||
exec 'syn match NERDTreeClosable #'.escape(g:NERDTreeDirArrowCollapsible, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeOpenable #'.escape(g:NERDTreeDirArrowExpandable, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
|
||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~').escape(g:NERDTreeDirArrowExpandable, '~')
|
||||
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'
|
||||
|
|
|
@ -25,22 +25,21 @@
|
|||
3. [Recommended settings](#settings)
|
||||
4. [FAQ](#faq)
|
||||
4.1. [I installed syntastic but it isn't reporting any errors...](#faqinfo)
|
||||
4.2. [How can I check scripts written for different versions of Python?](#faqpython)
|
||||
4.3. [How can I check scripts written for different versions of Ruby?](#faqruby)
|
||||
4.4. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
|
||||
4.5. [The `perl` checker has stopped working...](#faqperl)
|
||||
4.6. [What happened to the `rustc` checker?](#faqrust)
|
||||
4.7. [What happened to the `tsc` checker?](#faqtsc)
|
||||
4.8. [What happened to the `xcrun` checker?](#faqxcrun)
|
||||
4.9. [I run a checker and the location list is not updated...](#faqloclist)
|
||||
4.9. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
|
||||
4.10. [How can I pass additional arguments to a checker?](#faqargs)
|
||||
4.11. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
|
||||
4.12. [What is the difference between syntax checkers and style checkers?](#faqstyle)
|
||||
4.13. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
|
||||
4.14. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
|
||||
4.15. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
|
||||
4.16. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
|
||||
4.2. [Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?](#faqcheckers)
|
||||
4.3. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
|
||||
4.4. [How can I pass additional arguments to a checker?](#faqargs)
|
||||
4.5. [I run a checker and the location list is not updated...](#faqloclist)
|
||||
4.5. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
|
||||
4.6. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
|
||||
4.7. [The error window is closed automatically when I `:quit` the current buffer but not when I `:bdelete` it?](#faqbdelete)
|
||||
4.8. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
|
||||
4.9. [What is the difference between syntax checkers and style checkers?](#faqstyle)
|
||||
4.10. [How can I check scripts written for different versions of Python?](#faqpython)
|
||||
4.11. [How can I check scripts written for different versions of Ruby?](#faqruby)
|
||||
4.12. [The `perl` checker has stopped working...](#faqperl)
|
||||
4.13. [What happened to the `rustc` checker?](#faqrust)
|
||||
4.14. [What happened to the `tsc` checker?](#faqtsc)
|
||||
4.15. [What happened to the `xcrun` checker?](#faqxcrun)
|
||||
5. [Resources](#otherresources)
|
||||
|
||||
- - -
|
||||
|
@ -106,9 +105,9 @@ version 7 or later with the "normal", "big", or "huge" feature sets should be
|
|||
fine.
|
||||
|
||||
Syntastic should work with any modern plugin managers for Vim, such as
|
||||
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or
|
||||
[Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are
|
||||
included below for completeness.
|
||||
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam],
|
||||
[Vim-Plug][plug], or [Vundle][vundle]. Instructions for installing syntastic
|
||||
with [Pathogen][pathogen] are included below for completeness.
|
||||
|
||||
Starting with Vim version 7.4.1486 you can also load syntastic using the
|
||||
standard mechanism of packages, without the help of third-party plugin managers
|
||||
|
@ -230,131 +229,12 @@ or the error output for a syntax checker may have changed. In this case, make
|
|||
sure you have the latest version of the syntax checker installed. If it still
|
||||
fails then post an [issue][bug_tracker] - or better yet, create a pull request.
|
||||
|
||||
<a name="faqpython"></a>
|
||||
|
||||
__4.2. Q. How can I check scripts written for different versions of Python?__
|
||||
|
||||
A. Install a Python version manager such as [virtualenv][virtualenv]
|
||||
or [pyenv][pyenv], activate the environment for the relevant version
|
||||
of Python, and install in it the checkers you want to use. Set
|
||||
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
|
||||
from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqruby"></a>
|
||||
|
||||
__4.3. Q. How can I check scripts written for different versions of Ruby?__
|
||||
|
||||
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
|
||||
activate the environment for the relevant version of Ruby, and install in it
|
||||
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
|
||||
your `vimrc`, and run [Vim][vim] from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqhtml5"></a>
|
||||
|
||||
__4.4. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
|
||||
|
||||
[HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop
|
||||
in replacement, and syntastic can use it without changes. Just install it
|
||||
somewhere and point `g:syntastic_html_tidy_exec` to its executable:
|
||||
```vim
|
||||
let g:syntastic_html_tidy_exec = 'tidy5'
|
||||
```
|
||||
Alternatively, you can install [vnu.jar][vnu_jar] from the [validator.nu][vnu]
|
||||
project and run it as a [HTTP server][vnu_server]:
|
||||
```sh
|
||||
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
|
||||
```
|
||||
Then you can configure syntastic to use it:
|
||||
```vim
|
||||
let g:syntastic_html_validator_api = 'http://localhost:8888/'
|
||||
```
|
||||
|
||||
<a name="faqperl"></a>
|
||||
|
||||
__4.5. Q. The `perl` checker has stopped working...__
|
||||
|
||||
A. The `perl` checker runs `perl -c` against your file, which in turn
|
||||
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
|
||||
statements in your file (cf. [perlrun][perlrun]). This is probably fine if you
|
||||
wrote the file yourself, but it's a security problem if you're checking
|
||||
third-party files. Since there is currently no way to disable this behaviour
|
||||
while still producing useful results, the checker is now disabled by default.
|
||||
To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes
|
||||
`perl`, and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
```
|
||||
|
||||
<a name="faqrust"></a>
|
||||
|
||||
__4.6. Q. What happened to the `rustc` checker?__
|
||||
|
||||
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
|
||||
checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqtsc"></a>
|
||||
|
||||
__4.7. Q. What happened to the `tsc` checker?__
|
||||
|
||||
A. It didn't meet people's expectations and it has been removed. Please
|
||||
consider using the external checker [tsuquyomi][tsuquyomi] instead. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqxcrun"></a>
|
||||
|
||||
__4.8. Q. What happened to the `xcrun` checker?__
|
||||
|
||||
A. The `xcrun` checker used to have a security problem and it has been removed.
|
||||
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__4.9. Q. I run a checker and the location list is not updated...__
|
||||
__4.9. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
|
||||
|
||||
A. By default the location list is changed only when you run the `:Errors`
|
||||
command, in order to minimise conflicts with other plugins. If you want the
|
||||
location list to always be updated when you run the checkers, add this line to
|
||||
your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
```
|
||||
|
||||
<a name="faqargs"></a>
|
||||
|
||||
__4.10. Q. How can I pass additional arguments to a checker?__
|
||||
|
||||
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
|
||||
that do can be configured using global variables. The general form of the
|
||||
global `args` variables is `syntastic_<filetype>_<checker>_args`.
|
||||
|
||||
So, If you wanted to pass `--my --args --here` to the ruby mri checker you
|
||||
would add this line to your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
```
|
||||
|
||||
See `:help syntastic-checker-options` for more information.
|
||||
|
||||
<a name="faqcheckers"></a>
|
||||
|
||||
__4.11. Q. Syntastic supports several checkers for my filetype - how do I tell it
|
||||
__4.2. Q. Syntastic supports several checkers for my filetype, how do I tell it
|
||||
which one(s) to use?__
|
||||
|
||||
A. Stick a line like this in your `vimrc`:
|
||||
A. Add a line like this to your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_<filetype>_checkers = ['<checker-name>']
|
||||
```
|
||||
|
@ -362,10 +242,9 @@ let g:syntastic_<filetype>_checkers = ['<checker-name>']
|
|||
To see the list of supported checkers for your filetype read the
|
||||
[manual][checkers] (`:help syntastic-checkers` in Vim).
|
||||
|
||||
e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
|
||||
`pylint` and a native `python` checker.
|
||||
|
||||
To tell syntastic to use `pylint`, you would use this setting:
|
||||
For example, Python has the following checkers, among others: `flake8`,
|
||||
`pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use
|
||||
`pylint`, you would use this setting:
|
||||
```vim
|
||||
let g:syntastic_python_checkers = ['pylint']
|
||||
```
|
||||
|
@ -379,8 +258,7 @@ This is telling syntastic to run the `php` checker first, and if no errors are
|
|||
found, run `phpcs`, and then `phpmd`.
|
||||
|
||||
You can also run checkers explicitly by calling `:SyntasticCheck <checker>`.
|
||||
|
||||
e.g. to run `phpcs` and `phpmd`:
|
||||
For example to run `phpcs` and `phpmd`:
|
||||
```vim
|
||||
:SyntasticCheck phpcs phpmd
|
||||
```
|
||||
|
@ -390,39 +268,9 @@ aren't listed in `g:syntastic_<filetype>_checkers`. You can't run checkers for
|
|||
"foreign" filetypes though (e.g. you can't run, say, a Python checker if the
|
||||
filetype of the current file is `php`).
|
||||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__4.12. Q. What is the difference between syntax checkers and style checkers?__
|
||||
|
||||
A. The errors and warnings they produce are highlighted differently and can
|
||||
be filtered by different rules, but otherwise the distinction is pretty much
|
||||
arbitrary. There is an ongoing effort to keep things consistent, so you can
|
||||
_generally_ expect messages produced by syntax checkers to be _mostly_ related
|
||||
to syntax, and messages produced by style checkers to be _mostly_ about style.
|
||||
But there can be no formal guarantee that, say, a style checker that runs into
|
||||
a syntax error wouldn't die with a fatal message, nor that a syntax checker
|
||||
wouldn't give you warnings against using some constructs as being bad practice.
|
||||
There is also no guarantee that messages marked as "style" are less severe than
|
||||
the ones marked as "syntax" (whatever that might mean). And there are even a
|
||||
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
|
||||
nature, produce both kinds of messages. Syntastic is not smart enough to be
|
||||
able to sort out these things by itself.
|
||||
|
||||
In fact it's more useful to look at this from the perspective of filtering
|
||||
unwanted messages, rather than as an indicator of severity levels. The
|
||||
distinction between syntax and style is orthogonal to the distinction between
|
||||
errors and warnings, and thus you can turn off messages based on level, on
|
||||
type, or both.
|
||||
|
||||
e.g. To disable all style messages:
|
||||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
|
||||
<a name="faqaggregate"></a>
|
||||
|
||||
__4.13. Q. I have enabled multiple checkers for the current filetype. How can I
|
||||
__4.3. Q. I have enabled multiple checkers for the current filetype. How can I
|
||||
display all errors from all checkers together?__
|
||||
|
||||
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
|
||||
|
@ -432,9 +280,46 @@ let g:syntastic_aggregate_errors = 1
|
|||
|
||||
See `:help syntastic-aggregating-errors` for more details.
|
||||
|
||||
<a name="faqargs"></a>
|
||||
|
||||
__4.4. Q. How can I pass additional arguments to a checker?__
|
||||
|
||||
A. In most cases a command line is constructed using an internal function
|
||||
named `makeprgBuild()`, which provides a number of options that allow you to
|
||||
customise every part of the command that gets run. You can set these options
|
||||
using global variables.
|
||||
|
||||
The general form of the global `args` variable is
|
||||
`syntastic_<filetype>_<checker>_args`. Thus if you wanted to pass
|
||||
`--my --args --here` to the Ruby `mri` checker you would add this line to your
|
||||
`vimrc`:
|
||||
```vim
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
```
|
||||
|
||||
See `:help syntastic-checker-options` for more information.
|
||||
|
||||
A number of checkers don't use the `makeprgBuild()` function mentioned above,
|
||||
or have additional options that can be configured. For these checkers the exact
|
||||
list of options should be included in the [manual][checkers]
|
||||
(`:help syntastic-checkers` in Vim).
|
||||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__4.5. Q. I run a checker and the location list is not updated...__
|
||||
__4.5. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
|
||||
|
||||
A. By default the location list is changed only when you run the `:Errors`
|
||||
command, in order to minimise conflicts with other plugins. If you want the
|
||||
location list to always be updated when you run the checkers, add this line to
|
||||
your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
```
|
||||
|
||||
<a name="faqlnext"></a>
|
||||
|
||||
__4.14. Q. How can I jump between the different errors without using the location
|
||||
__4.6. Q. How can I jump between the different errors without using the location
|
||||
list at the bottom of the window?__
|
||||
|
||||
A. Vim provides several built-in commands for this. See `:help :lnext` and
|
||||
|
@ -444,9 +329,21 @@ If you use these commands a lot then you may want to add shortcut mappings to
|
|||
your `vimrc`, or install something like [unimpaired][unimpaired], which provides such
|
||||
mappings (among other things).
|
||||
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__4.7. Q. The error window is closed automatically when I `:quit` the current buffer
|
||||
but not when I `:bdelete` it?__
|
||||
|
||||
A. There is no safe way to handle that situation automatically, but you can
|
||||
work around it:
|
||||
```vim
|
||||
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
|
||||
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
|
||||
```
|
||||
|
||||
<a name="faqconfig"></a>
|
||||
|
||||
__4.15. My favourite checker needs to load a configuration file from the
|
||||
__4.8. My favourite checker needs to load a configuration file from the
|
||||
project's root rather than the current directory...__
|
||||
|
||||
A. You can set up an `autocmd` to search for the configuration file in the
|
||||
|
@ -463,18 +360,106 @@ autocmd FileType javascript let b:syntastic_javascript_jscs_args =
|
|||
\ get(g:, 'syntastic_javascript_jscs_args', '') .
|
||||
\ FindConfig('-c', '.jscsrc', expand('<afile>:p:h', 1))
|
||||
```
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__4.16. Q. The error window is closed automatically when I :quit the current buffer
|
||||
but not when I :bdelete it?__
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
A. There is no safe way to handle that situation automatically, but you can
|
||||
work around it:
|
||||
__4.9. Q. What is the difference between syntax checkers and style checkers?__
|
||||
|
||||
A. The errors and warnings they produce are highlighted differently and can
|
||||
be filtered by different rules, but otherwise the distinction is pretty much
|
||||
arbitrary. There is an ongoing effort to keep things consistent, so you can
|
||||
_generally_ expect messages produced by syntax checkers to be _mostly_ related
|
||||
to syntax, and messages produced by style checkers to be _mostly_ about style.
|
||||
But there can be no formal guarantee that, say, a style checker that runs into
|
||||
a syntax error wouldn't die with a fatal message, nor that a syntax checker
|
||||
wouldn't give you warnings against using some constructs as being bad practice.
|
||||
There is also no guarantee that messages marked as `style` are less severe than
|
||||
the ones marked as `syntax` (whatever that might mean). And there are even a
|
||||
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
|
||||
nature, produce both kinds of messages. Syntastic is not smart enough to be
|
||||
able to sort out these things by itself.
|
||||
|
||||
Generally it's more useful to look at this from the perspective of filtering
|
||||
unwanted messages, rather than as an indicator of severity levels. The
|
||||
distinction between syntax and style is orthogonal to the distinction between
|
||||
errors and warnings, and thus you can turn off messages based on level, on
|
||||
type, or both.
|
||||
|
||||
e.g. To disable all style messages:
|
||||
```vim
|
||||
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
|
||||
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for more information.
|
||||
|
||||
<a name="faqpython"></a>
|
||||
|
||||
__4.10. Q. How can I check scripts written for different versions of Python?__
|
||||
|
||||
A. Install a Python version manager such as [virtualenv][virtualenv]
|
||||
or [pyenv][pyenv], activate the environment for the relevant version
|
||||
of Python, and install in it the checkers you want to use. Set
|
||||
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
|
||||
from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqruby"></a>
|
||||
|
||||
__4.11. Q. How can I check scripts written for different versions of Ruby?__
|
||||
|
||||
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
|
||||
activate the environment for the relevant version of Ruby, and install in it
|
||||
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
|
||||
your `vimrc`, and run [Vim][vim] from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqperl"></a>
|
||||
|
||||
__4.12. Q. The `perl` checker has stopped working...__
|
||||
|
||||
A. The `perl` checker runs `perl -c` against your file, which in turn
|
||||
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
|
||||
statements in your file (cf. [perlrun][perlrun]). This is probably fine if you
|
||||
wrote the file yourself, but it's a security problem if you're checking
|
||||
third-party files. Since there is currently no way to disable this behaviour
|
||||
while still producing useful results, the checker is now disabled by default.
|
||||
To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes
|
||||
`perl`, and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
```
|
||||
|
||||
<a name="faqrust"></a>
|
||||
|
||||
__4.13. Q. What happened to the `rustc` checker?__
|
||||
|
||||
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
|
||||
checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqtsc"></a>
|
||||
|
||||
__4.14. Q. What happened to the `tsc` checker?__
|
||||
|
||||
A. It didn't meet people's expectations and it has been removed. The plugin
|
||||
[tsuquyomi][tsuquyomi] comes packaged with a checker for TypeScript. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqxcrun"></a>
|
||||
|
||||
__4.15. Q. What happened to the `xcrun` checker?__
|
||||
|
||||
A. The `xcrun` checker used to have a security problem and it has been removed.
|
||||
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="otherresources"></a>
|
||||
|
||||
|
@ -517,8 +502,6 @@ a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [v
|
|||
[rvm]: https://rvm.io/
|
||||
[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic
|
||||
[swift]: https://github.com/kballard/vim-swift
|
||||
[tidy]: http://www.htacg.org/tidy-html5/
|
||||
[tidy_old]: http://tidy.sourceforge.net/
|
||||
[tsuquyomi]: https://github.com/Quramy/tsuquyomi/
|
||||
[unimpaired]: https://github.com/tpope/vim-unimpaired
|
||||
[vam]: https://github.com/MarcWeber/vim-addon-manager
|
||||
|
|
|
@ -271,6 +271,36 @@ function! syntastic#util#findGlobInParent(what, where) abort " {{{2
|
|||
return ''
|
||||
endfunction " }}}2
|
||||
|
||||
" Returns the buffer number of a filename
|
||||
" @vimlint(EVL104, 1, l:old_shellslash)
|
||||
function! syntastic#util#fname2buf(fname) abort " {{{2
|
||||
if exists('+shellslash')
|
||||
" bufnr() can't cope with backslashes
|
||||
let old_shellslash = &shellslash
|
||||
let &shellslash = 1
|
||||
endif
|
||||
|
||||
" this is a best-effort attempt to escape file patterns (cf. :h file-pattern)
|
||||
" XXX it fails for filenames containing something like \{2,3}
|
||||
for md in [':~:.', ':~', ':p']
|
||||
let buf = bufnr('^' . escape(fnamemodify(a:fname, md), '\*?,{}[') . '$')
|
||||
if buf != -1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if buf == -1
|
||||
" XXX definitely wrong, but hope is the last thing to die :)
|
||||
let buf = bufnr(fnamemodify(a:fname, ':p'))
|
||||
endif
|
||||
|
||||
if exists('+shellslash')
|
||||
let &shellslash = old_shellslash
|
||||
endif
|
||||
|
||||
return buf
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL104, 0, l:old_shellslash)
|
||||
|
||||
" Returns unique elements in a list
|
||||
function! syntastic#util#unique(list) abort " {{{2
|
||||
let seen = {}
|
||||
|
@ -342,10 +372,8 @@ function! syntastic#util#stamp() abort " {{{2
|
|||
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#setChangedtick() abort " {{{2
|
||||
unlockvar! b:syntastic_changedtick
|
||||
let b:syntastic_changedtick = b:changedtick
|
||||
lockvar! b:syntastic_changedtick
|
||||
function! syntastic#util#setLastTick(buf) abort " {{{2
|
||||
call setbufvar(a:buf, 'syntastic_lasttick', getbufvar(a:buf, 'changedtick'))
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
|
||||
|
|
|
@ -3147,13 +3147,13 @@ accepts the standard options described at |syntastic-config-makeprg|.
|
|||
|
||||
Notes~
|
||||
|
||||
Syntastic requires "Flow" version 0.6 or later.
|
||||
Syntastic requires "Flow" version 0.18.1 or later.
|
||||
|
||||
To use "Flow" with your projects, you must:
|
||||
|
||||
a. Install it:
|
||||
|
||||
https://github.com/sindresorhus/flow-bin
|
||||
https://github.com/flowtype/flow-bin
|
||||
|
||||
b. Configure your project:
|
||||
>
|
||||
|
@ -6183,7 +6183,7 @@ Maintainer: LCD 47 <lcd047@gmail.com>
|
|||
|
||||
"ESLint" is a tool for identifying and reporting on patterns found
|
||||
in ECMAScript/JavaScript code. With the "babel-eslint" plugin
|
||||
(https://github.com/babel/babel-eslint) "ESLint" can also can also be
|
||||
(https://github.com/babel/babel-eslint) "ESLint" can also be
|
||||
used to check TypeScript files. See the project's page for details:
|
||||
|
||||
https://github.com/nzakas/eslint
|
||||
|
|
|
@ -46,19 +46,21 @@ CONTENTS *syntastic-contents*
|
|||
6.4.Saving Vim sessions....................|syntastic-sessions|
|
||||
6.5.The location list callback.............|syntastic-loclist-callback|
|
||||
7.Compatibility with other software............|syntastic-compatibility|
|
||||
7.1.The csh and tcsh shells................|syntastic-csh|
|
||||
7.2.Eclim..................................|syntastic-eclim|
|
||||
7.3.The fish shell.........................|syntastic-fish|
|
||||
7.4.The fizsh shell........................|syntastic-fizsh|
|
||||
7.5.flagship...............................|syntastic-flagship|
|
||||
7.6.powerline..............................|syntastic-powerline|
|
||||
7.7.The PowerShell shell...................|syntastic-powershell|
|
||||
7.8.python-mode............................|syntastic-pymode|
|
||||
7.9.vim-auto-save..........................|syntastic-vim-auto-save|
|
||||
7.10.vim-go................................|syntastic-vim-go|
|
||||
7.11.vim-virtualenv........................|syntastic-vim-virtualenv|
|
||||
7.12.YouCompleteMe.........................|syntastic-ycm|
|
||||
7.13.The zsh shell and MacVim..............|syntastic-zsh|
|
||||
7.1.airline................................|syntastic-airline|
|
||||
7.2.The csh and tcsh shells................|syntastic-csh|
|
||||
7.3.Eclim..................................|syntastic-eclim|
|
||||
7.4.ferret.................................|syntastic-ferret|
|
||||
7.5.The fish shell.........................|syntastic-fish|
|
||||
7.6.The fizsh shell........................|syntastic-fizsh|
|
||||
7.7.flagship...............................|syntastic-flagship|
|
||||
7.8.powerline..............................|syntastic-powerline|
|
||||
7.9.The PowerShell shell...................|syntastic-powershell|
|
||||
7.10.python-mode...........................|syntastic-pymode|
|
||||
7.11.vim-auto-save.........................|syntastic-vim-auto-save|
|
||||
7.12.vim-go................................|syntastic-vim-go|
|
||||
7.13.vim-virtualenv........................|syntastic-vim-virtualenv|
|
||||
7.14.YouCompleteMe.........................|syntastic-ycm|
|
||||
7.15.The zsh shell and MacVim..............|syntastic-zsh|
|
||||
8.About........................................|syntastic-about|
|
||||
9.License......................................|syntastic-license|
|
||||
|
||||
|
@ -158,12 +160,17 @@ Something like this could be more useful: >
|
|||
set statusline+=%*
|
||||
<
|
||||
When syntax errors are detected a flag will be shown. The content of the flag
|
||||
is derived from the |syntastic_stl_format| option.
|
||||
is derived from the |'syntastic_stl_format'| option.
|
||||
|
||||
Please note that these settings might conflict with other Vim plugins that
|
||||
change the way statusline works. Refer to these plugins' documentation for
|
||||
possible solutions. See also |syntastic-powerline| below if you're using the
|
||||
"powerline" Vim plugin (https://github.com/powerline/powerline).
|
||||
change the way statusline works. Refer to the |syntastic-compatibility| notes
|
||||
below and to the respective plugins' documentation for possible solutions.
|
||||
|