mirror of
1
0
Fork 0

Updated plugins and added vim-markdown

This commit is contained in:
Amir Salihefendic 2018-02-04 12:35:08 +01:00
parent 2514de5b22
commit 8eeefe86c2
111 changed files with 6623 additions and 923 deletions

View File

@ -439,6 +439,14 @@ fu! ctrlp#addfile(ch, file)
cal s:BuildPrompt(1)
endf
fu! s:safe_printf(format, ...)
try
retu call('printf', [a:format] + a:000)
cat
retu a:format
endt
endf
fu! s:UserCmd(lscmd)
let [path, lscmd] = [s:dyncwd, a:lscmd]
let do_ign =
@ -461,9 +469,9 @@ fu! s:UserCmd(lscmd)
let g:ctrlp_allfiles = []
let s:job = job_start([&shell, &shellcmdflag, printf(lscmd, path)], {'callback': 'ctrlp#addfile'})
elsei has('patch-7.4-597') && !(has('win32') || has('win64'))
let g:ctrlp_allfiles = systemlist(printf(lscmd, path))
let g:ctrlp_allfiles = systemlist(s:safe_printf(lscmd, path))
el
let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n")
let g:ctrlp_allfiles = split(system(s:safe_printf(lscmd, path)), "\n")
en
if exists('+ssl') && exists('ssl')
let &ssl = ssl

View File

@ -59,9 +59,11 @@ fu! ctrlp#line#accept(dict)
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(mode, bufnr, get(info, 2))
let @/ = input
call search(input, 'c')
call histadd("search", input)
if !empty(input)
let @/ = input
call search(input, 'c')
call histadd("search", input)
en
en
endf

View File

@ -51,7 +51,7 @@ landscape is my colorscheme, which is a high-contrast cui-supported colorscheme,
+ [vim-airline](https://github.com/vim-airline/vim-airline) is a nice plugin, but it uses too much functions of other plugins, which should be done by users in `.vimrc`.
## Spirit of this plugin
+ Minimalism. The core script is very small to achive enough functions as a statusline plugin.
+ Minimalism. The core script is very small to achieve enough functions as a statusline plugin.
+ Configurability. You can create your own component and easily add to the statusline and the tabline.
+ Orthogonality. The plugin does not rely on the implementation of other plugins. Such plugin crossing settings should be configured by users.
@ -110,7 +110,7 @@ if !has('gui_running')
endif
```
Your statusline appears to work correctly? If yes, great, thanks for choosing lightline.vim! If no, please file a issue report to the [issue tracker](https://github.com/itchyny/lightline.vim/issues).
Your statusline appears to work correctly? If yes, great, thanks for choosing lightline.vim! If no, please file an issue report to the [issue tracker](https://github.com/itchyny/lightline.vim/issues).
By the way, `-- INSERT --` is unnecessary anymore because the mode information is displayed in the statusline.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/13.png)

View File

@ -2,7 +2,7 @@
" Filename: autoload/lightline.vim
" Author: itchyny
" License: MIT License
" Last Change: 2017/11/11 13:29:26.
" Last Change: 2017/12/31 15:55:00.
" =============================================================================
let s:save_cpo = &cpo
@ -84,20 +84,20 @@ endfunction
let s:_lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ 'left': [['mode', 'paste'], ['readonly', 'filename', 'modified']],
\ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype']]
\ },
\ 'inactive': {
\ 'left': [ [ 'filename' ] ],
\ 'right': [ [ 'lineinfo' ], [ 'percent' ] ]
\ 'left': [['filename']],
\ 'right': [['lineinfo'], ['percent']]
\ },
\ 'tabline': {
\ 'left': [ [ 'tabs' ] ],
\ 'right': [ [ 'close' ] ]
\ 'left': [['tabs']],
\ 'right': [['close']]
\ },
\ 'tab': {
\ 'active': [ 'tabnum', 'filename', 'modified' ],
\ 'inactive': [ 'tabnum', 'filename', 'modified' ]
\ 'active': ['tabnum', 'filename', 'modified'],
\ 'inactive': ['tabnum', 'filename', 'modified']
\ },
\ 'component': {
\ 'mode': '%{lightline#mode()}',
@ -295,7 +295,7 @@ function! lightline#highlight(...) abort
endfunction
function! s:subseparator(components, subseparator, expanded) abort
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 [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]) ? (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"')

View File

@ -0,0 +1,40 @@
" =============================================================================
" Filename: autoload/lightline/colorscheme/deus.vim
" Author: nikersify
" License: MIT License
" Last Change: 2018/01/24 13:26:00
" =============================================================================
let s:term_red = 204
let s:term_green = 114
let s:term_yellow = 180
let s:term_blue = 39
let s:term_purple = 170
let s:term_white = 145
let s:term_black = 235
let s:term_grey = 236
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ '#292c33', '#98c379', s:term_black, s:term_green, 'bold' ], [ '#98c379', '#292c33', s:term_green, s:term_black ] ]
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 ] ]
let s:p.replace.right = [ [ '#292c33', '#e06c75', s:term_black, s:term_red, 'bold' ], s:p.normal.right[1], [ '#e06c75', '#292c33', s:term_red, s:term_black ] ]
let s:p.visual.left = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ]
let s:p.visual.right = [ [ '#292c33', '#c678dd', s:term_black, s:term_purple, 'bold' ], s:p.normal.right[1], [ '#c678dd', '#292c33', s:term_purple, s:term_black ] ]
let s:p.normal.middle = [ [ '#abb2bf', '#292c33', s:term_white, s:term_black ] ]
let s:p.insert.middle = s:p.normal.middle
let s:p.replace.middle = s:p.normal.middle
let s:p.tabline.left = [ s:p.normal.left[1] ]
let s:p.tabline.tabsel = [ s:p.normal.left[0] ]
let s:p.tabline.middle = s:p.normal.middle
let s:p.tabline.right = [ s:p.normal.left[1] ]
let s:p.normal.error = [ [ '#292c33', '#e06c75', s:term_black, s:term_red ] ]
let s:p.normal.warning = [ [ '#292c33', '#e5c07b', s:term_black, s:term_yellow ] ]
let g:lightline#colorscheme#deus#palette = lightline#colorscheme#fill(s:p)

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: 2017/11/18 20:07:05.
Last Change: 2017/12/24 21:34:15.
CONTENTS *lightline-contents*
@ -29,7 +29,7 @@ The *lightline* plugin is a light and configurable statusline/tabline for Vim.
SPIRIT *lightline-spirit*
Minimalism
The core script is very small to achive enough functions as a
The core script is very small to achieve enough functions as a
statusline plugin.
Configurability
@ -157,7 +157,7 @@ OPTIONS *lightline-option*
A 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
control the visibility of the sub-separators. You can use this
configuration to reduce the number of function calls for
performance improvement by setting the value 1 (to tell lightline
that the component is always visible).
@ -229,7 +229,8 @@ OPTIONS *lightline-option*
Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties,
PaperColor, seoul256, landscape, one, Dracula, darcula,
molokai, materia, material, OldHope, nord and 16color are available.
molokai, materia, material, OldHope, nord, 16color and deus
are available.
The default value is:
>
let g:lightline.colorscheme = 'default'
@ -1200,7 +1201,7 @@ Problem 11: *lightline-problem-11*
Problem 12: *lightline-problem-12*
How to make the plus sign red like |powerline|?
Use the following setings.
Use the following settings.
>
let g:lightline = {
\ 'component': {

View File

@ -21,7 +21,7 @@ Installation
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
Then reload Vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, and check out `:help NERDTree.txt`.
Then reload Vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`, and check out `:help NERDTree.txt`.
#### [apt-vim](https://github.com/egalpin/apt-vim)

View File

@ -261,62 +261,50 @@ function! s:displayHelp()
call b:NERDTree.ui.centerView()
endfunction
" FUNCTION: s:findAndRevealPath(path) {{{1
function! s:findAndRevealPath(path)
let l:path = a:path
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr)
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
if empty(l:path)
let l:path = expand('%:p')
if empty(l:pathStr)
call nerdtree#echoWarning('no file for the current buffer')
return
endif
try
let p = g:NERDTreePath.New(l:path)
let l:pathObj = g:NERDTreePath.New(l:pathStr)
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("no file for the current buffer")
call nerdtree#echoWarning('invalid path')
return
endtry
if p.isUnixHiddenPath()
let showhidden=g:NERDTreeShowHidden
let g:NERDTreeShowHidden = 1
endif
if !g:NERDTree.ExistsForTab()
try
let cwd = g:NERDTreePath.New(getcwd())
let l:cwd = g:NERDTreePath.New(getcwd())
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("current directory does not exist.")
let cwd = p.getParent()
call nerdtree#echo('current directory does not exist.')
let l:cwd = l:pathObj.getParent()
endtry
if p.isUnder(cwd)
call g:NERDTreeCreator.CreateTabTree(cwd.str())
if l:pathObj.isUnder(l:cwd)
call g:NERDTreeCreator.CreateTabTree(l:cwd.str())
else
call g:NERDTreeCreator.CreateTabTree(p.getParent().str())
call g:NERDTreeCreator.CreateTabTree(l:pathObj.getParent().str())
endif
else
if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path)
if !g:NERDTree.IsOpen()
call g:NERDTreeCreator.ToggleTabTree('')
else
call g:NERDTree.CursorToTreeWin()
endif
call b:NERDTree.ui.setShowHidden(g:NERDTreeShowHidden)
call s:chRoot(g:NERDTreeDirNode.New(p.getParent(), b:NERDTree))
else
if !g:NERDTree.IsOpen()
call g:NERDTreeCreator.ToggleTabTree("")
endif
NERDTreeFocus
if !l:pathObj.isUnder(b:NERDTree.root.path)
call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
endif
endif
call g:NERDTree.CursorToTreeWin()
let node = b:NERDTree.root.reveal(p)
call b:NERDTree.render()
call node.putCursorHere(1,0)
if p.isUnixHiddenFile()
let g:NERDTreeShowHidden = showhidden
if l:pathObj.isHiddenUnder(b:NERDTree.root.path)
call b:NERDTree.ui.setShowHidden(1)
endif
let l:node = b:NERDTree.root.reveal(l:pathObj)
call b:NERDTree.render()
call l:node.putCursorHere(1, 0)
endfunction
"FUNCTION: s:handleLeftClick() {{{1

View File

@ -126,20 +126,20 @@ The following features and functionality are provided by the NERD tree:
Changes made to one tree are reflected in both as they are actually the
same buffer.
If only one other NERD tree exists, that tree is automatically mirrored. If
more than one exists, the script will ask which tree to mirror.
If only one other NERD tree exists, that tree is automatically mirrored.
If more than one exists, the script will ask which tree to mirror.
:NERDTreeClose *:NERDTreeClose*
Close the NERD tree in this tab.
:NERDTreeFind *:NERDTreeFind*
Find the current file in the tree.
:NERDTreeFind [<path>] *:NERDTreeFind*
Without the optional argument, find and reveal the file for the active
buffer in the NERDTree window. With the <path> argument, find and
reveal the specified path.
If no tree exists and the current file is under vim's CWD, then init a
tree at the CWD and reveal the file. Otherwise init a tree in the current
file's directory.
In any case, the current file is revealed and the cursor is placed on it.
Focus will be shifted to the NERDTree window, and the cursor will be
placed on the tree node for the determined path. If a NERDTree for the
current tab does not exist, a new one will be initialized.
:NERDTreeCWD *:NERDTreeCWD*
Change tree root to current directory. If no NERD tree exists for this
@ -996,17 +996,16 @@ Other examples: >
------------------------------------------------------------------------------
*'NERDTreeStatusline'*
Values: Any valid statusline setting.
Default: %{b:NERDTree.root.path.strForOS(0)}
Values: Any valid |'statusline'| setting.
Default: %{exists('b:NERDTree')?b:NERDTree.root.path.str():''}
Tells the script what to use as the |'statusline'| setting for NERD tree
windows.
Defines the value for the |'statusline'| setting in NERDTree windows.
Note that the statusline is set using |:let-&| not |:set| so escaping spaces
isn't necessary.
Note: The setting is actually applied using |:let-&|, not |:set|, so
escaping spaces is not necessary.
Setting this option to -1 will will deactivate it so that your global
statusline setting is used instead.
|'statusline'| setting is used.
------------------------------------------------------------------------------
*'NERDTreeWinPos'*
@ -1128,13 +1127,12 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
Additionally, a "scope" argument may be supplied. This constrains the
mapping so that it is only activated if the cursor is on a certain object.
That object is then passed into the handling method. Possible values are:
"FileNode" - a file node
"DirNode" - a directory node
"Node" - a file or directory node
"Bookmark" - A bookmark
"all" - the keymap is not constrained to any scope (default). When
thei is used, the handling function is not passed any arguments.
"FileNode" .... a file node
"DirNode" ..... a directory node
"Node" ........ a file node OR a directory node
"Bookmark" .... a bookmark
"all" ......... global scope; handler receives no arguments (default)
Example: >
call NERDTreeAddKeyMap({

View File

@ -54,3 +54,5 @@ function! s:FlagSet.renderToString()
return '[' . flagstring . ']'
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -38,17 +38,26 @@ function! s:NERDTree.Close()
endif
if winnr("$") != 1
" Use the window ID to identify the currently active window or fall
" back on the buffer ID if win_getid/win_gotoid are not available, in
" which case we'll focus an arbitrary window showing the buffer.
let l:useWinId = exists('*win_getid') && exists('*win_gotoid')
if winnr() == s:NERDTree.GetWinNum()
call nerdtree#exec("wincmd p")
let bufnr = bufnr("")
let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("")
call nerdtree#exec("wincmd p")
else
let bufnr = bufnr("")
let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr("")
endif
call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w")
close
call nerdtree#exec(bufwinnr(bufnr) . " wincmd w")
if l:useWinId
call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")")
else
call nerdtree#exec(bufwinnr(l:activeBufOrWin) . " wincmd w")
endif
else
close
endif
@ -195,3 +204,5 @@ endfunction
function! s:NERDTree.render()
call self.ui.render()
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -32,4 +32,3 @@ function! s:Notifier.GetListenersForEvent(name)
endfunction
let g:NERDTreePathNotifier = deepcopy(s:Notifier)

View File

@ -14,21 +14,23 @@ lockvar s:NERDTreeSortStarIndex
let s:Path = {}
let g:NERDTreePath = s:Path
" FUNCTION: Path.AbsolutePathFor(str) {{{1
function! s:Path.AbsolutePathFor(str)
let prependCWD = 0
" FUNCTION: Path.AbsolutePathFor(pathStr) {{{1
function! s:Path.AbsolutePathFor(pathStr)
let l:prependWorkingDir = 0
if nerdtree#runningWindows()
let prependCWD = a:str !~# '^.:\(\\\|\/\)' && a:str !~# '^\(\\\\\|\/\/\)'
let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)' && a:pathStr !~# '^\(\\\\\|\/\/\)'
else
let prependCWD = a:str !~# '^/'
let l:prependWorkingDir = a:pathStr !~# '^/'
endif
let toReturn = a:str
if prependCWD
let toReturn = getcwd() . s:Path.Slash() . a:str
let l:result = a:pathStr
if l:prependWorkingDir
let l:result = getcwd() . s:Path.Slash() . a:pathStr
endif
return toReturn
return l:result
endfunction
" FUNCTION: Path.bookmarkNames() {{{1
@ -405,6 +407,25 @@ function! s:Path.getSortKey()
return self._sortKey
endfunction
" FUNCTION: Path.isHiddenUnder(path) {{{1
function! s:Path.isHiddenUnder(path)
if !self.isUnder(a:path)
return 0
endif
let l:startIndex = len(a:path.pathSegments)
let l:segments = self.pathSegments[l:startIndex : ]
for l:segment in l:segments
if l:segment =~# '^\.'
return 1
endif
endfor
return 0
endfunction
" FUNCTION: Path.isUnixHiddenFile() {{{1
" check for unix hidden files
@ -522,17 +543,16 @@ function! s:Path.equals(path)
return self.str() ==# a:path.str()
endfunction
" FUNCTION: Path.New() {{{1
" The Constructor for the Path object
function! s:Path.New(path)
let newPath = copy(self)
" FUNCTION: Path.New(pathStr) {{{1
function! s:Path.New(pathStr)
let l:newPath = copy(self)
call newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:path))
call l:newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:pathStr))
let newPath.cachedDisplayString = ""
let newPath.flagSet = g:NERDTreeFlagSet.New()
let l:newPath.cachedDisplayString = ''
let l:newPath.flagSet = g:NERDTreeFlagSet.New()
return newPath
return l:newPath
endfunction
" FUNCTION: Path.Slash() {{{1

View File

@ -1,22 +1,25 @@
"CLASS: TreeFileNode
"This class is the parent of the TreeDirNode class and is the
"'Component' part of the composite design pattern between the treenode
"classes.
"============================================================
" ============================================================================
" CLASS: TreeFileNode
"
" This class is the parent of the "TreeDirNode" class and is the "Component"
" part of the composite design pattern between the NERDTree node classes.
" ============================================================================
let s:TreeFileNode = {}
let g:NERDTreeFileNode = s:TreeFileNode
"FUNCTION: TreeFileNode.activate(...) {{{1
" FUNCTION: TreeFileNode.activate(...) {{{1
function! s:TreeFileNode.activate(...)
call self.open(a:0 ? a:1 : {})
endfunction
"FUNCTION: TreeFileNode.bookmark(name) {{{1
"bookmark this node with a:name
" FUNCTION: TreeFileNode.bookmark(name) {{{1
" bookmark this node with a:name
function! s:TreeFileNode.bookmark(name)
"if a bookmark exists with the same name and the node is cached then save
"it so we can update its display string
" if a bookmark exists with the same name and the node is cached then save
" it so we can update its display string
let oldMarkedNode = {}
try
let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1, self.getNerdtree())
@ -33,8 +36,8 @@ function! s:TreeFileNode.bookmark(name)
endif
endfunction
"FUNCTION: TreeFileNode.cacheParent() {{{1
"initializes self.parent if it isnt already
" FUNCTION: TreeFileNode.cacheParent() {{{1
" initializes self.parent if it isnt already
function! s:TreeFileNode.cacheParent()
if empty(self.parent)
let parentPath = self.path.getParent()
@ -45,7 +48,7 @@ function! s:TreeFileNode.cacheParent()
endif
endfunction
"FUNCTION: TreeFileNode.clearBookmarks() {{{1
" FUNCTION: TreeFileNode.clearBookmarks() {{{1
function! s:TreeFileNode.clearBookmarks()
for i in g:NERDTreeBookmark.Bookmarks()
if i.path.equals(self.path)
@ -55,7 +58,7 @@ function! s:TreeFileNode.clearBookmarks()
call self.path.cacheDisplayString()
endfunction
"FUNCTION: TreeFileNode.copy(dest) {{{1
" FUNCTION: TreeFileNode.copy(dest) {{{1
function! s:TreeFileNode.copy(dest)
call self.path.copy(a:dest)
let newPath = g:NERDTreePath.New(a:dest)
@ -68,44 +71,44 @@ function! s:TreeFileNode.copy(dest)
endif
endfunction
"FUNCTION: TreeFileNode.delete {{{1
"Removes this node from the tree and calls the Delete method for its path obj
" FUNCTION: TreeFileNode.delete {{{1
" Removes this node from the tree and calls the Delete method for its path obj
function! s:TreeFileNode.delete()
call self.path.delete()
call self.parent.removeChild(self)
endfunction
"FUNCTION: TreeFileNode.displayString() {{{1
" FUNCTION: TreeFileNode.displayString() {{{1
"
"Returns a string that specifies how the node should be represented as a
"string
" Returns a string that specifies how the node should be represented as a
" string
"
"Return:
"a string that can be used in the view to represent this node
" Return:
" a string that can be used in the view to represent this node
function! s:TreeFileNode.displayString()
return self.path.flagSet.renderToString() . self.path.displayString()
endfunction
"FUNCTION: TreeFileNode.equals(treenode) {{{1
" FUNCTION: TreeFileNode.equals(treenode) {{{1
"
"Compares this treenode to the input treenode and returns 1 if they are the
"same node.
" Compares this treenode to the input treenode and returns 1 if they are the
" same node.
"
"Use this method instead of == because sometimes when the treenodes contain
"many children, vim seg faults when doing ==
" Use this method instead of == because sometimes when the treenodes contain
" many children, vim seg faults when doing ==
"
"Args:
"treenode: the other treenode to compare to
" Args:
" treenode: the other treenode to compare to
function! s:TreeFileNode.equals(treenode)
return self.path.str() ==# a:treenode.path.str()
endfunction
"FUNCTION: TreeFileNode.findNode(path) {{{1
"Returns self if this node.path.Equals the given path.
"Returns {} if not equal.
" FUNCTION: TreeFileNode.findNode(path) {{{1
" Returns self if this node.path.Equals the given path.
" Returns {} if not equal.
"
"Args:
"path: the path object to compare against
" Args:
" path: the path object to compare against
function! s:TreeFileNode.findNode(path)
if a:path.equals(self.path)
return self
@ -113,18 +116,18 @@ function! s:TreeFileNode.findNode(path)
return {}
endfunction
"FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{1
" FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{1
"
"Finds the next sibling for this node in the indicated direction. This sibling
"must be a directory and may/may not have children as specified.
" Finds the next sibling for this node in the indicated direction. This sibling
" must be a directory and may/may not have children as specified.
"
"Args:
"direction: 0 if you want to find the previous sibling, 1 for the next sibling
" Args:
" direction: 0 if you want to find the previous sibling, 1 for the next sibling
"
"Return:
"a treenode object or {} if no appropriate sibling could be found
" Return:
" a treenode object or {} if no appropriate sibling could be found
function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction)
"if we have no parent then we can have no siblings
" if we have no parent then we can have no siblings
if self.parent != {}
let nextSibling = self.findSibling(a:direction)
@ -139,37 +142,37 @@ function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction)
return {}
endfunction
"FUNCTION: TreeFileNode.findSibling(direction) {{{1
" FUNCTION: TreeFileNode.findSibling(direction) {{{1
"
"Finds the next sibling for this node in the indicated direction
" Finds the next sibling for this node in the indicated direction
"
"Args:
"direction: 0 if you want to find the previous sibling, 1 for the next sibling
" Args:
" direction: 0 if you want to find the previous sibling, 1 for the next sibling
"
"Return:
"a treenode object or {} if no sibling could be found
" Return:
" a treenode object or {} if no sibling could be found
function! s:TreeFileNode.findSibling(direction)
"if we have no parent then we can have no siblings
" if we have no parent then we can have no siblings
if self.parent != {}
"get the index of this node in its parents children
" get the index of this node in its parents children
let siblingIndx = self.parent.getChildIndex(self.path)
if siblingIndx != -1
"move a long to the next potential sibling node
" move a long to the next potential sibling node
let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1
"keep moving along to the next sibling till we find one that is valid
" keep moving along to the next sibling till we find one that is valid
let numSiblings = self.parent.getChildCount()
while siblingIndx >= 0 && siblingIndx < numSiblings
"if the next node is not an ignored node (i.e. wont show up in the
"view) then return it
" if the next node is not an ignored node (i.e. wont show up in the
" view) then return it
if self.parent.children[siblingIndx].path.ignore(self.getNerdtree()) ==# 0
return self.parent.children[siblingIndx]
endif
"go to next node
" go to next node
let siblingIndx = a:direction ==# 1 ? siblingIndx+1 : siblingIndx-1
endwhile
endif
@ -178,13 +181,13 @@ function! s:TreeFileNode.findSibling(direction)
return {}
endfunction
"FUNCTION: TreeFileNode.getNerdtree(){{{1
" FUNCTION: TreeFileNode.getNerdtree(){{{1
function! s:TreeFileNode.getNerdtree()
return self._nerdtree
endfunction
"FUNCTION: TreeFileNode.GetRootForTab(){{{1
"get the root node for this tab
" FUNCTION: TreeFileNode.GetRootForTab(){{{1
" get the root node for this tab
function! s:TreeFileNode.GetRootForTab()
if g:NERDTree.ExistsForTab()
return getbufvar(t:NERDTreeBufName, 'NERDTree').root
@ -192,28 +195,32 @@ function! s:TreeFileNode.GetRootForTab()
return {}
endfunction
"FUNCTION: TreeFileNode.GetSelected() {{{1
"gets the treenode that the cursor is currently over
" FUNCTION: TreeFileNode.GetSelected() {{{1
" If the cursor is currently positioned on a tree node, return the node.
" Otherwise, return the empty dictionary.
function! s:TreeFileNode.GetSelected()
try
let path = b:NERDTree.ui.getPath(line("."))
if path ==# {}
let l:path = b:NERDTree.ui.getPath(line('.'))
if empty(l:path)
return {}
endif
return b:NERDTree.root.findNode(path)
return b:NERDTree.root.findNode(l:path)
catch /^NERDTree/
return {}
endtry
endfunction
"FUNCTION: TreeFileNode.isVisible() {{{1
"returns 1 if this node should be visible according to the tree filters and
"hidden file filters (and their on/off status)
" FUNCTION: TreeFileNode.isVisible() {{{1
" returns 1 if this node should be visible according to the tree filters and
" hidden file filters (and their on/off status)
function! s:TreeFileNode.isVisible()
return !self.path.ignore(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.isRoot() {{{1
" FUNCTION: TreeFileNode.isRoot() {{{1
function! s:TreeFileNode.isRoot()
if !g:NERDTree.ExistsForBuf()
throw "NERDTree.NoTreeError: No tree exists for the current buffer"
@ -222,12 +229,12 @@ function! s:TreeFileNode.isRoot()
return self.equals(self.getNerdtree().root)
endfunction
"FUNCTION: TreeFileNode.New(path, nerdtree) {{{1
"Returns a new TreeNode object with the given path and parent
" FUNCTION: TreeFileNode.New(path, nerdtree) {{{1
" Returns a new TreeNode object with the given path and parent
"
"Args:
"path: file/dir that the node represents
"nerdtree: the tree the node belongs to
" Args:
" path: file/dir that the node represents
" nerdtree: the tree the node belongs to
function! s:TreeFileNode.New(path, nerdtree)
if a:path.isDirectory
return g:NERDTreeDirNode.New(a:path, a:nerdtree)
@ -240,40 +247,40 @@ function! s:TreeFileNode.New(path, nerdtree)
endif
endfunction
"FUNCTION: TreeFileNode.open() {{{1
" FUNCTION: TreeFileNode.open() {{{1
function! s:TreeFileNode.open(...)
let opts = a:0 ? a:1 : {}
let opener = g:NERDTreeOpener.New(self.path, opts)
call opener.open(self)
endfunction
"FUNCTION: TreeFileNode.openSplit() {{{1
"Open this node in a new window
" FUNCTION: TreeFileNode.openSplit() {{{1
" Open this node in a new window
function! s:TreeFileNode.openSplit()
call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.')
call self.open({'where': 'h'})
endfunction
"FUNCTION: TreeFileNode.openVSplit() {{{1
"Open this node in a new vertical window
" FUNCTION: TreeFileNode.openVSplit() {{{1
" Open this node in a new vertical window
function! s:TreeFileNode.openVSplit()
call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.')
call self.open({'where': 'v'})
endfunction
"FUNCTION: TreeFileNode.openInNewTab(options) {{{1
" FUNCTION: TreeFileNode.openInNewTab(options) {{{1
function! s:TreeFileNode.openInNewTab(options)
echomsg 'TreeFileNode.openInNewTab is deprecated'
call self.open(extend({'where': 't'}, a:options))
endfunction
"FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
"Places the cursor on the line number this node is rendered on
" FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
" Places the cursor on the line number this node is rendered on
"
"Args:
"isJump: 1 if this cursor movement should be counted as a jump by vim
"recurseUpward: try to put the cursor on the parent if the this node isnt
"visible
" Args:
" isJump: 1 if this cursor movement should be counted as a jump by vim
" recurseUpward: try to put the cursor on the parent if the this node isnt
" visible
function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
let ln = self.getNerdtree().ui.getLineNum(self)
if ln != -1
@ -294,18 +301,18 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
endif
endfunction
"FUNCTION: TreeFileNode.refresh() {{{1
" FUNCTION: TreeFileNode.refresh() {{{1
function! s:TreeFileNode.refresh()
call self.path.refresh(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.refreshFlags() {{{1
" FUNCTION: TreeFileNode.refreshFlags() {{{1
function! s:TreeFileNode.refreshFlags()
call self.path.refreshFlags(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.rename() {{{1
"Calls the rename method for this nodes path obj
" FUNCTION: TreeFileNode.rename() {{{1
" Calls the rename method for this nodes path obj
function! s:TreeFileNode.rename(newName)
let newName = substitute(a:newName, '\(\\\|\/\)$', '', '')
call self.path.rename(newName)
@ -320,17 +327,17 @@ function! s:TreeFileNode.rename(newName)
endif
endfunction
"FUNCTION: TreeFileNode.renderToString {{{1
"returns a string representation for this tree to be rendered in the view
" FUNCTION: TreeFileNode.renderToString {{{1
" returns a string representation for this tree to be rendered in the view
function! s:TreeFileNode.renderToString()
return self._renderToString(0, 0)
endfunction
"Args:
"depth: the current depth in the tree for this call
"drawText: 1 if we should actually draw the line for this node (if 0 then the
"child nodes are rendered only)
"for each depth in the tree
" Args:
" depth: the current depth in the tree for this call
" drawText: 1 if we should actually draw the line for this node (if 0 then the
" child nodes are rendered only)
" for each depth in the tree
function! s:TreeFileNode._renderToString(depth, drawText)
let output = ""
if a:drawText ==# 1
@ -346,7 +353,7 @@ function! s:TreeFileNode._renderToString(depth, drawText)
let output = output . line . "\n"
endif
"if the node is an open dir, draw its children
" if the node is an open dir, draw its children
if self.path.isDirectory ==# 1 && self.isOpen ==# 1
let childNodesToDraw = self.getVisibleChildren()

View File

@ -1,11 +1,14 @@
"CLASS: UI
"============================================================
" ============================================================================
" CLASS: UI
" ============================================================================
let s:UI = {}
let g:NERDTreeUI = s:UI
"FUNCTION: s:UI.centerView() {{{2
"centers the nerd tree window around the cursor (provided the nerd tree
"options permit)
" FUNCTION: s:UI.centerView() {{{2
" centers the nerd tree window around the cursor (provided the nerd tree
" options permit)
function! s:UI.centerView()
if g:NERDTreeAutoCenter
let current_line = winline()
@ -17,8 +20,8 @@ function! s:UI.centerView()
endif
endfunction
"FUNCTION: s:UI._dumpHelp {{{1
"prints out the quick help
" FUNCTION: s:UI._dumpHelp {{{1
" prints out the quick help
function! s:UI._dumpHelp()
if self.getShowHelp()
let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n"
@ -93,7 +96,7 @@ function! s:UI._dumpHelp()
let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
"add quickhelp entries for each custom key map
" add quickhelp entries for each custom key map
let help .= "\"\n\" ----------------------------\n"
let help .= "\" Custom mappings~\n"
for i in g:NERDTreeKeyMap.All()
@ -124,7 +127,7 @@ function! s:UI._dumpHelp()
endfunction
"FUNCTION: s:UI.new(nerdtree) {{{1
" FUNCTION: s:UI.new(nerdtree) {{{1
function! s:UI.New(nerdtree)
let newObj = copy(self)
let newObj.nerdtree = a:nerdtree
@ -137,22 +140,16 @@ function! s:UI.New(nerdtree)
return newObj
endfunction
"FUNCTION: s:UI.getPath(ln) {{{1
"Gets the full path to the node that is rendered on the given line number
"
"Args:
"ln: the line number to get the path for
"
"Return:
"A path if a node was selected, {} if nothing is selected.
"If the 'up a dir' line was selected then the path to the parent of the
"current root is returned
" FUNCTION: s:UI.getPath(ln) {{{1
" Return the "Path" object for the node that is rendered on the given line
" number. If the "up a dir" line is selected, return the "Path" object for
" the parent of the root. Return the empty dictionary if the given line
" does not reference a tree node.
function! s:UI.getPath(ln)
let line = getline(a:ln)
let rootLine = self.getRootLineNum()
"check to see if we have the root node
if a:ln == rootLine
return self.nerdtree.root.path
endif
@ -161,9 +158,13 @@ function! s:UI.getPath(ln)
return self.nerdtree.root.path.getParent()
endif
if a:ln < rootLine
return {}
endif
let indent = self._indentLevelFor(line)
"remove the tree parts and the leading space
" remove the tree parts and the leading space
let curFile = self._stripMarkup(line)
let dir = ""
@ -173,7 +174,7 @@ function! s:UI.getPath(ln)
let curLine = getline(lnum)
let curLineStripped = self._stripMarkup(curLine)
"have we reached the top of the tree?
" have we reached the top of the tree?
if lnum == rootLine
let dir = self.nerdtree.root.path.str({'format': 'UI'}) . dir
break
@ -193,19 +194,19 @@ function! s:UI.getPath(ln)
return toReturn
endfunction
"FUNCTION: s:UI.getLineNum(file_node){{{1
"returns the line number this node is rendered on, or -1 if it isnt rendered
" FUNCTION: s:UI.getLineNum(file_node){{{1
" returns the line number this node is rendered on, or -1 if it isnt rendered
function! s:UI.getLineNum(file_node)
"if the node is the root then return the root line no.
" if the node is the root then return the root line no.
if a:file_node.isRoot()
return self.getRootLineNum()
endif
let totalLines = line("$")
"the path components we have matched so far
" the path components we have matched so far
let pathcomponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/ *$', '', '')]
"the index of the component we are searching for
" the index of the component we are searching for
let curPathComponent = 1
let fullpath = a:file_node.path.str({'format': 'UI'})
@ -213,7 +214,7 @@ function! s:UI.getLineNum(file_node)
let lnum = self.getRootLineNum()
while lnum > 0
let lnum = lnum + 1
"have we reached the bottom of the tree?
" have we reached the bottom of the tree?
if lnum ==# totalLines+1
return -1
endif
@ -241,8 +242,8 @@ function! s:UI.getLineNum(file_node)
return -1
endfunction
"FUNCTION: s:UI.getRootLineNum(){{{1
"gets the line number of the root node
" FUNCTION: s:UI.getRootLineNum(){{{1
" gets the line number of the root node
function! s:UI.getRootLineNum()
let rootLine = 1
while getline(rootLine) !~# '^\(/\|<\)'
@ -251,29 +252,29 @@ function! s:UI.getRootLineNum()
return rootLine
endfunction
"FUNCTION: s:UI.getShowBookmarks() {{{1
" FUNCTION: s:UI.getShowBookmarks() {{{1
function! s:UI.getShowBookmarks()
return self._showBookmarks
endfunction
"FUNCTION: s:UI.getShowFiles() {{{1
" FUNCTION: s:UI.getShowFiles() {{{1
function! s:UI.getShowFiles()
return self._showFiles
endfunction
"FUNCTION: s:UI.getShowHelp() {{{1
" FUNCTION: s:UI.getShowHelp() {{{1
function! s:UI.getShowHelp()
return self._showHelp
endfunction
"FUNCTION: s:UI.getShowHidden() {{{1
" FUNCTION: s:UI.getShowHidden() {{{1
function! s:UI.getShowHidden()
return self._showHidden
endfunction
"FUNCTION: s:UI._indentLevelFor(line) {{{1
" FUNCTION: s:UI._indentLevelFor(line) {{{1
function! s:UI._indentLevelFor(line)
"have to do this work around because match() returns bytes, not chars
" have to do this work around because match() returns bytes, not chars
let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
" 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'))
@ -281,27 +282,27 @@ function! s:UI._indentLevelFor(line)
return leadChars / s:UI.IndentWid()
endfunction
"FUNCTION: s:UI.IndentWid() {{{1
" FUNCTION: s:UI.IndentWid() {{{1
function! s:UI.IndentWid()
return 2
endfunction
"FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1
" FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1
function! s:UI.isIgnoreFilterEnabled()
return self._ignoreEnabled == 1
endfunction
"FUNCTION: s:UI.isMinimal() {{{1
" FUNCTION: s:UI.isMinimal() {{{1
function! s:UI.isMinimal()
return g:NERDTreeMinimalUI
endfunction
"FUNCTION: s:UI.MarkupReg() {{{1
" FUNCTION: s:UI.MarkupReg() {{{1
function! s:UI.MarkupReg()
return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+\)'
endfunction
"FUNCTION: s:UI._renderBookmarks {{{1
" FUNCTION: s:UI._renderBookmarks {{{1
function! s:UI._renderBookmarks()
if !self.isMinimal()
@ -322,12 +323,12 @@ function! s:UI._renderBookmarks()
call cursor(line(".")+1, col("."))
endfunction
"FUNCTION: s:UI.restoreScreenState() {{{1
" FUNCTION: s:UI.restoreScreenState() {{{1
"
"Sets the screen state back to what it was when nerdtree#saveScreenState was last
"called.
" Sets the screen state back to what it was when nerdtree#saveScreenState was last
" called.
"
"Assumes the cursor is in the NERDTree window
" Assumes the cursor is in the NERDTree window
function! s:UI.restoreScreenState()
if !has_key(self, '_screenState')
return
@ -342,9 +343,9 @@ function! s:UI.restoreScreenState()
let &scrolloff=old_scrolloff
endfunction
"FUNCTION: s:UI.saveScreenState() {{{1
"Saves the current cursor position in the current buffer and the window
"scroll position
" FUNCTION: s:UI.saveScreenState() {{{1
" Saves the current cursor position in the current buffer and the window
" scroll position
function! s:UI.saveScreenState()
let win = winnr()
call g:NERDTree.CursorToTreeWin()
@ -355,31 +356,31 @@ function! s:UI.saveScreenState()
call nerdtree#exec(win . "wincmd w")
endfunction
"FUNCTION: s:UI.setShowHidden(val) {{{1
" FUNCTION: s:UI.setShowHidden(val) {{{1
function! s:UI.setShowHidden(val)
let self._showHidden = a:val
endfunction
"FUNCTION: s:UI._stripMarkup(line){{{1
"returns the given line with all the tree parts stripped off
" FUNCTION: s:UI._stripMarkup(line){{{1
" returns the given line with all the tree parts stripped off
"
"Args:
"line: the subject line
" Args:
" line: the subject line
function! s:UI._stripMarkup(line)
let line = a:line
"remove the tree parts and the leading space
" remove the tree parts and the leading space
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
"strip off any read only flag
" strip off any read only flag
let line = substitute (line, ' \['.g:NERDTreeGlyphReadOnly.'\]', "","")
"strip off any bookmark flags
" strip off any bookmark flags
let line = substitute (line, ' {[^}]*}', "","")
"strip off any executable flags
" strip off any executable flags
let line = substitute (line, '*\ze\($\| \)', "","")
"strip off any generic flags
" strip off any generic flags
let line = substitute (line, '\[[^]]*\]', "","")
let line = substitute (line,' -> .*',"","") " remove link to
@ -387,22 +388,22 @@ function! s:UI._stripMarkup(line)
return line
endfunction
"FUNCTION: s:UI.render() {{{1
" FUNCTION: s:UI.render() {{{1
function! s:UI.render()
setlocal modifiable
"remember the top line of the buffer and the current line so we can
"restore the view exactly how it was
" remember the top line of the buffer and the current line so we can
" restore the view exactly how it was
let curLine = line(".")
let curCol = col(".")
let topLine = line("w0")
"delete all lines in the buffer (being careful not to clobber a register)
" delete all lines in the buffer (being careful not to clobber a register)
silent 1,$delete _
call self._dumpHelp()
"delete the blank line before the help and add one after it
" delete the blank line before the help and add one after it
if !self.isMinimal()
call setline(line(".")+1, "")
call cursor(line(".")+1, col("."))
@ -412,24 +413,24 @@ function! s:UI.render()
call self._renderBookmarks()
endif
"add the 'up a dir' line
" add the 'up a dir' line
if !self.isMinimal()
call setline(line(".")+1, s:UI.UpDirLine())
call cursor(line(".")+1, col("."))
endif
"draw the header line
" draw the header line
let header = self.nerdtree.root.path.str({'format': 'UI', 'truncateTo': winwidth(0)})
call setline(line(".")+1, header)
call cursor(line(".")+1, col("."))
"draw the tree
" draw the tree
silent put =self.nerdtree.root.renderToString()
"delete the blank line at the top of the buffer
" delete the blank line at the top of the buffer
silent 1,1delete _
"restore the view
" restore the view
let old_scrolloff=&scrolloff
let &scrolloff=0
call cursor(topLine, 1)
@ -441,14 +442,14 @@ function! s:UI.render()
endfunction
"FUNCTION: UI.renderViewSavingPosition {{{1
"Renders the tree and ensures the cursor stays on the current node or the
"current nodes parent if it is no longer available upon re-rendering
" FUNCTION: UI.renderViewSavingPosition {{{1
" Renders the tree and ensures the cursor stays on the current node or the
" current nodes parent if it is no longer available upon re-rendering
function! s:UI.renderViewSavingPosition()
let currentNode = g:NERDTreeFileNode.GetSelected()
"go up the tree till we find a node that will be visible or till we run
"out of nodes
" go up the tree till we find a node that will be visible or till we run
" out of nodes
while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot()
let currentNode = currentNode.parent
endwhile
@ -460,7 +461,7 @@ function! s:UI.renderViewSavingPosition()
endif
endfunction
"FUNCTION: s:UI.toggleHelp() {{{1
" FUNCTION: s:UI.toggleHelp() {{{1
function! s:UI.toggleHelp()
let self._showHelp = !self._showHelp
endfunction
@ -515,7 +516,9 @@ function! s:UI.toggleZoom()
endif
endfunction
"FUNCTION: s:UI.UpDirLine() {{{1
" FUNCTION: s:UI.UpDirLine() {{{1
function! s:UI.UpDirLine()
return '.. (up a dir)'
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -335,4 +335,5 @@ function! NERDTreeExecuteFile()
call system("open '" . treenode.path.str() . "'")
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -69,8 +69,9 @@ MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity,
Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL,
Vim help, VimL, Vue.js, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models,
z80, Zope page templates, and Zsh. See the [manual][checkers] for details about
the corresponding supported checkers (`:help syntastic-checkers` in Vim).
YARA rules, z80, Zope page templates, and Zsh. See the [manual][checkers] for
details about the corresponding supported checkers (`:help syntastic-checkers`
in Vim).
A number of third-party Vim plugins also provide checkers for syntastic, for
example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust],

View File

@ -634,17 +634,27 @@ endfunction " }}}2
function! syntastic#preprocess#mypy(errors) abort " {{{2
let out = []
for e in a:errors
" new format
let parts = matchlist(e, '\v^(.{-1,}):(\d+): error: (.+)')
if len(parts) > 3
call add(out, join(parts[1:3], ':'))
" column numbers
let parts = matchlist(e, '\v^(.{-1,}):(\d+):(\d+): ([ew])%(rror|arning): (.+)')
if len(parts) > 5
let parts[3] += 1
call add(out, join(parts[1:5], ':'))
continue
endif
" old format
" no column numbers
let parts = matchlist(e, '\v^(.{-1,}):(\d+): ([ew])%(rror|arning): (.+)')
if len(parts) > 4
call add(out, join(parts[1:4], ':'))
continue
endif
" obsolete format
let parts = matchlist(e, '\v^(.{-1,}), line (\d+): (.+)')