Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

latest nerdtree and syntastic haxx

  • Loading branch information...
commit e8375a7ceedd53633f8f73fc87044695d7dd8f67 1 parent 534f158
@scrooloose scrooloose authored
View
14 doc/NERD_tree.txt
@@ -27,7 +27,7 @@ CONTENTS *NERDTree-contents*
2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
2.3.NERD tree mappings................|NERDTreeMappings|
- 2.4.The NERDT tree menu...............|NERDTreeMenu|
+ 2.4.The NERD tree menu................|NERDTreeMenu|
3.Options.................................|NERDTreeOptions|
3.1.Option summary....................|NERDTreeOptionSummary|
3.2.Option details....................|NERDTreeOptionDetails|
@@ -1060,10 +1060,10 @@ NERDTreeRender() *NERDTreeRender()*
The author of the NERD tree is a terrible terrible monster called Martyzilla
who gobbles up small children with milk and sugar for breakfast.
-He can be reached at martin_grenfell at msn.com. He would love to hear from
-you, so feel free to send him suggestions and/or comments about this plugin.
-Don't be shy --- the worst he can do is slaughter you and stuff you in the
-fridge for later ;)
+He can be reached at martin.grenfell at gmail dot com. He would love to hear
+from you, so feel free to send him suggestions and/or comments about this
+plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in
+the fridge for later ;)
The latest stable versions can be found at
http://www.vim.org/scripts/script.php?script_id=1658
@@ -1089,6 +1089,9 @@ The latest dev versions are on github
thanks to Aggelos Orfanakos for the patch.
- fix a bug when using the x mapping on the tree root, thanks to Bryan
Venteicher for the patch.
+ - fix a bug where the cursor position/window size of the nerd tree buffer
+ wasnt being stored on closing the window, thanks to Richard Hart.
+ - fix a bug where NERDTreeMirror would mirror the wrong tree
3.1.1
- fix a bug where a non-listed no-name buffer was getting created every
@@ -1182,6 +1185,7 @@ just downloaded pr0n instead.
Lucas S. Buchala
Curtis Harvey
Guillaume Duranceau
+ Richard Hart (hates)
==============================================================================
8. License *NERDTreeLicense*
View
4 nerdtree_plugin/exec_menuitem.vim
@@ -1,8 +1,8 @@
" ============================================================================
" File: exec_menuitem.vim
" Description: plugin for NERD Tree that provides an execute file menu item
-" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
-" Last Change: 6 Sep, 2009
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" Last Change: 22 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
View
6 nerdtree_plugin/fs_menu.vim
@@ -1,8 +1,8 @@
" ============================================================================
" File: fs_menu.vim
" Description: plugin for the NERD Tree that provides a file system menu
-" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
-" Last Change: 6 Sep, 2009
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" Last Change: 17 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
@@ -85,7 +85,7 @@ function! NERDTreeMoveNode()
let newNodePath = input("Rename the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path for the node: \n" .
- \ "", curNode.path.str()
+ \ "", curNode.path.str())
if newNodePath ==# ''
call s:echo("Node Renaming Aborted.")
View
116 nerdtree_plugin/git_menu.vim
@@ -1,116 +0,0 @@
-" ============================================================================
-" File: git_menu.vim
-" Description: plugin for the NERD Tree that provides a git menu
-" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
-" Last Change: 20 July, 2009
-" License: This program is free software. It comes without any warranty,
-" to the extent permitted by applicable law. You can redistribute
-" it and/or modify it under the terms of the Do What The Fuck You
-" Want To Public License, Version 2, as published by Sam Hocevar.
-" See http://sam.zoy.org/wtfpl/COPYING for more details.
-"
-" ============================================================================
-"
-" Adds a "g" submenu to the NERD tree menu.
-"
-" Note: this plugin assumes that the current tree root has a .git dir under
-" it, and that the working tree and the .git repo are in the same place
-"
-if exists("g:loaded_nerdtree_git_menu")
- finish
-endif
-let g:loaded_nerdtree_git_menu = 1
-
-call NERDTreeAddMenuSeparator({'isActiveCallback': 'NERDTreeGitMenuEnabled'})
-let s:menu = NERDTreeAddSubmenu({
- \ 'text': '(g)it menu',
- \ 'shortcut': 'g',
- \ 'isActiveCallback': 'NERDTreeGitMenuEnabled' })
-
-call NERDTreeAddMenuItem({
- \ 'text': 'git (a)dd',
- \ 'shortcut': 'a',
- \ 'isActiveCallback': 'NERDTreeGitMenuEnabled',
- \ 'callback': 'NERDTreeGitAdd',
- \ 'parent': s:menu })
-
-call NERDTreeAddMenuItem({
- \ 'text': 'git (c)heckout',
- \ 'shortcut': 'c',
- \ 'isActiveCallback': 'NERDTreeGitMenuEnabled',
- \ 'callback': 'NERDTreeGitCheckout',
- \ 'parent': s:menu })
-
-call NERDTreeAddMenuItem({
- \ 'text': 'git (m)v',
- \ 'shortcut': 'm',
- \ 'isActiveCallback': 'NERDTreeGitMenuEnabled',
- \ 'callback': 'NERDTreeGitMove',
- \ 'parent': s:menu })
-
-call NERDTreeAddMenuItem({
- \ 'text': 'git (r)m',
- \ 'shortcut': 'r',
- \ 'isActiveCallback': 'NERDTreeGitMenuEnabled',
- \ 'callback': 'NERDTreeGitRemove',
- \ 'parent': s:menu })
-
-function! NERDTreeGitMenuEnabled()
- return isdirectory(s:GitRepoPath())
-endfunction
-
-function! s:GitRepoPath()
- return b:NERDTreeRoot.path.str() . ".git"
-endfunction
-
-function! NERDTreeGitMove()
- let node = g:NERDTreeFileNode.GetSelected()
- let path = node.path
- let p = path.str({'escape': 1})
-
- let newPath = input("==========================================================\n" .
- \ "Enter the new path for the file: \n" .
- \ "", node.path.str())
- if newPath ==# ''
- call s:echo("git mv aborted.")
- return
- endif
-
- call s:execGitCmd('mv ' . p . ' ' . newPath)
-endfunction
-
-function! NERDTreeGitAdd()
- let node = g:NERDTreeFileNode.GetSelected()
- let path = node.path
- call s:execGitCmd('add ' . path.str({'escape': 1}))
-endfunction
-
-function! NERDTreeGitRemove()
- let node = g:NERDTreeFileNode.GetSelected()
- let path = node.path
- call s:execGitCmd('rm ' . path.str({'escape': 1}))
-endfunction
-
-function! NERDTreeGitCheckout()
- let node = g:NERDTreeFileNode.GetSelected()
- let path = node.path
- call s:execGitCmd('checkout ' . path.str({'escape': 1}))
-endfunction
-
-function! s:execGitCmd(sub_cmd)
- let extra_options = '--git-dir=' . s:GitRepoPath() . ' '
- let extra_options .= '--work-tree=' . b:NERDTreeRoot.path.str()
- let cmd = "git" . ' ' . extra_options . ' ' . a:sub_cmd
-
- let output = system(cmd)
- redraw!
- if v:shell_error == 0
- let node = g:NERDTreeFileNode.GetSelected()
- if !node.isRoot()
- call node.parent.refresh()
- call NERDTreeRender()
- endif
- else
- echomsg output
- endif
-endfunction
View
60 plugin/NERD_tree.vim
@@ -1,8 +1,8 @@
" ============================================================================
" File: NERD_tree.vim
" Description: vim global plugin that provides a nice tree explorer
-" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
-" Last Change: 6 Sep, 2009
+" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
+" Last Change: 9 October, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
@@ -10,7 +10,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
-let s:NERD_tree_version = '3.1.1'
+let s:NERD_tree_version = '4.0.0'
" SECTION: Script init stuff {{{1
"============================================================
@@ -80,7 +80,12 @@ endif
let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*')
if !exists('g:NERDTreeStatusline')
- let g:NERDTreeStatusline = "%{b:NERDTreeRoot.path.str()}"
+
+ "the exists() crap here is a hack to stop vim spazzing out when
+ "loading a session that was created with an open nerd tree. It spazzes
+ "because it doesnt store b:NERDTreeRoot (its a b: var, and its a hash)
+ let g:NERDTreeStatusline = "%{exists('b:NERDTreeRoot')?b:NERDTreeRoot.path.str():''}"
+
endif
call s:initVariable("g:NERDTreeWinPos", "left")
call s:initVariable("g:NERDTreeWinSize", 31)
@@ -156,7 +161,7 @@ command! -n=0 -bar NERDTreeMirror call s:initNerdTreeMirror()
"============================================================
augroup NERDTree
"Save the cursor position whenever we close the nerd tree
- exec "autocmd BufWinLeave *". s:NERDTreeBufName ." call <SID>saveScreenState()"
+ exec "autocmd BufWinLeave ". s:NERDTreeBufName ."* call <SID>saveScreenState()"
"cache bookmarks when vim loads
autocmd VimEnter * call s:Bookmark.CacheBookmarks(0)
@@ -456,7 +461,6 @@ endfunction
"FUNCTION: KeyMap.Create(options) {{{3
function! s:KeyMap.Create(options)
- let newKeyMap = {}
let newKeyMap = copy(self)
let newKeyMap.key = a:options['key']
let newKeyMap.quickhelpText = a:options['quickhelpText']
@@ -470,7 +474,11 @@ let s:MenuController = {}
"create a new menu controller that operates on the given menu items
function! s:MenuController.New(menuItems)
let newMenuController = copy(self)
- let newMenuController.menuItems = a:menuItems
+ if a:menuItems[0].isSeparator()
+ let newMenuController.menuItems = a:menuItems[1:-1]
+ else
+ let newMenuController.menuItems = a:menuItems
+ endif
return newMenuController
endfunction
@@ -507,9 +515,7 @@ function! s:MenuController._echoPrompt()
for i in range(0, len(self.menuItems)-1)
if self.selection == i
- echohl todo
echo "> " . self.menuItems[i].text
- echohl normal
else
echo " " . self.menuItems[i].text
endif
@@ -1040,7 +1046,6 @@ function! s:TreeFileNode.New(path)
if a:path.isDirectory
return s:TreeDirNode.New(a:path)
else
- let newTreeNode = {}
let newTreeNode = copy(self)
let newTreeNode.path = a:path
let newTreeNode.parent = {}
@@ -1795,9 +1800,9 @@ function! s:Path.cacheDisplayString()
endfunction
"FUNCTION: Path.changeToDir() {{{3
function! s:Path.changeToDir()
- let dir = self.strForCd()
+ let dir = self.str({'format': 'Cd'})
if self.isDirectory ==# 0
- let dir = self.getParent().strForCd()
+ let dir = self.getParent().str({'format': 'Cd'})
endif
try
@@ -1941,7 +1946,7 @@ endfunction
function! s:Path.delete()
if self.isDirectory
- let cmd = g:NERDTreeRemoveDirCmd . self.str('escape': 1})
+ let cmd = g:NERDTreeRemoveDirCmd . self.str({'escape': 1})
let success = system(cmd)
if v:shell_error != 0
@@ -2009,7 +2014,12 @@ endfunction
"Return:
"a new Path object
function! s:Path.getParent()
- let path = '/'. join(self.pathSegments[0:-2], '/')
+ if s:running_windows
+ let path = self.drive . '\' . join(self.pathSegments[0:-2], '\')
+ else
+ let path = '/'. join(self.pathSegments[0:-2], '/')
+ endif
+
return s:Path.New(path)
endfunction
"FUNCTION: Path.getLastPathComponent(dirSlash) {{{3
@@ -2243,11 +2253,7 @@ endfunction
"
" returns a string that can be used with :cd
function! s:Path._strForCd()
- if s:running_windows
- return self.str()
- else
- return self.str({'escape': 1})
- endif
+ return escape(self.str(), s:escape_chars)
endfunction
"FUNCTION: Path._strForEdit() {{{3
"
@@ -2262,6 +2268,8 @@ function! s:Path._strForEdit()
let cwd = tolower(getcwd())
endif
+ let p = escape(p, s:escape_chars)
+
let cwd = cwd . s:Path.Slash()
"return a relative path if we can
@@ -2421,7 +2429,7 @@ function! s:initNerdTree(name)
"if instructed to, then change the vim CWD to the dir the NERDTree is
"inited in
if g:NERDTreeChDirMode != 0
- exec 'cd ' . path.strForCd()
+ call path.changeToDir()
endif
if s:treeExistsForTab()
@@ -2544,7 +2552,7 @@ function! s:initNerdTreeMirror()
return
endif
- let bufferName = options[keys(options)[choice-1]]
+ let bufferName = options[sort(keys(options))[choice-1]]
elseif len(keys(options)) ==# 1
let bufferName = values(options)[0]
else
@@ -2652,7 +2660,7 @@ function! s:centerView()
endif
endfunction
"FUNCTION: s:closeTree() {{{2
-"Closes the NERD tree window
+"Closes the primary NERD tree window for this tab
function! s:closeTree()
if !s:isTreeOpen()
throw "NERDTree.NoTreeFoundError: no NERDTree is open"
@@ -2663,7 +2671,7 @@ function! s:closeTree()
close
call s:exec("wincmd p")
else
- :q
+ close
endif
endfunction
@@ -3345,10 +3353,10 @@ function! s:toggle(dir)
if s:treeExistsForTab()
if !s:isTreeOpen()
call s:createTreeWin()
- call s:restoreScreenState()
if !&hidden
call s:renderView()
endif
+ call s:restoreScreenState()
else
call s:closeTree()
endif
@@ -3574,7 +3582,7 @@ function! s:closeTreeWindow()
exec "buffer " . b:NERDTreePreviousBuf
else
if winnr("$") > 1
- wincmd c
+ call s:closeTree()
else
call s:echo("Cannot close last window")
endif
@@ -3920,7 +3928,7 @@ function! s:upDir(keepState)
endif
if g:NERDTreeChDirMode ==# 2
- exec 'cd ' . b:NERDTreeRoot.path.strForCd()
+ call b:NERDTreeRoot.path.changeToDir()
endif
call s:renderView()
View
60 plugin/syntastic.vim
@@ -19,7 +19,7 @@ let g:loaded_syntastic_plugin = 1
let s:running_windows = has("win16") || has("win32") || has("win64")
-if !exists("g:syntastic_enable_signs")
+if !exists("g:syntastic_enable_signs") || !has('signs')
let g:syntastic_enable_signs = 0
endif
@@ -31,6 +31,10 @@ if !exists("g:syntastic_quiet_warnings")
let g:syntastic_quiet_warnings = 0
endif
+if !exists("g:syntastic_disabled_filetypes")
+ let g:syntastic_disabled_filetypes = []
+endif
+
"load all the syntax checkers
runtime! syntax_checkers/*.vim
@@ -58,17 +62,16 @@ endfunction
"
"depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing
"elsewhere
-"
-"saves and restores some settings that the syntax checking function may wish
-"to screw with if it uses :lmake!
function! s:CacheErrors()
let b:syntastic_loclist = []
- for ft in split(&ft, '\.')
- if exists("*SyntaxCheckers_". ft ."_GetLocList") && filereadable(expand("%"))
- let b:syntastic_loclist = extend(b:syntastic_loclist, SyntaxCheckers_{ft}_GetLocList())
- endif
- endfor
+ if filereadable(expand("%"))
+ for ft in split(&ft, '\.')
+ if s:Checkable(ft)
+ let b:syntastic_loclist = extend(b:syntastic_loclist, SyntaxCheckers_{ft}_GetLocList())
+ endif
+ endfor
+ endif
endfunction
"return true if there are cached errors/warnings for this buf
@@ -92,9 +95,11 @@ function! s:ErrorsForType(type)
return filter(copy(b:syntastic_loclist), 'v:val["type"] ==# "' . a:type . '"')
endfunction
-"use >> to display syntax errors in the sign column
-sign define SyntasticError text=>> texthl=error
-sign define SyntasticWarning text=>> texthl=todo
+if g:syntastic_enable_signs
+ "use >> to display syntax errors in the sign column
+ sign define SyntasticError text=>> texthl=error
+ sign define SyntasticWarning text=>> texthl=todo
+endif
"start counting sign ids at 5000, start here to hopefully avoid conflicting
"with any other code that places signs (not sure if this precaution is
@@ -146,7 +151,11 @@ endfunction
function! s:ShowLocList()
if exists("b:syntastic_loclist")
call setloclist(0, b:syntastic_loclist)
+ let num = winnr()
lopen
+ if num != winnr()
+ wincmd p
+ endif
endif
endfunction
@@ -225,4 +234,31 @@ function! SyntasticMake(options)
return errors
endfunction
+function! s:Checkable(ft)
+ return exists("*SyntaxCheckers_". a:ft ."_GetLocList") &&
+ \ index(g:syntastic_disabled_filetypes, a:ft) == -1
+endfunction
+
+command! -nargs=? SyntasticEnable call s:Enable(<f-args>)
+command! -nargs=? SyntasticDisable call s:Disable(<f-args>)
+
+"disable syntax checking for the given filetype (defaulting to current ft)
+function! s:Disable(...)
+ let ft = a:0 ? a:1 : &filetype
+
+ if !empty(ft) && index(g:syntastic_disabled_filetypes, ft) == -1
+ call add(g:syntastic_disabled_filetypes, ft)
+ endif
+endfunction
+
+"enable syntax checking for the given filetype (defaulting to current ft)
+function! s:Enable(...)
+ let ft = a:0 ? a:1 : &filetype
+
+ let i = index(g:syntastic_disabled_filetypes, ft)
+ if i != -1
+ call remove(g:syntastic_disabled_filetypes, i)
+ endif
+endfunction
+
" vim: set et sts=4 sw=4:
View
27 syntax_checkers/cucumber.vim
@@ -0,0 +1,27 @@
+"============================================================================
+"File: cucumber.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
+"License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+"============================================================================
+if exists("loaded_cucumber_syntax_checker")
+ finish
+endif
+let loaded_cucumber_syntax_checker = 1
+
+"bail if the user doesnt have cucumber installed
+if !executable("cucumber")
+ finish
+endif
+
+function! SyntaxCheckers_cucumber_GetLocList()
+ let makeprg = 'cucumber --dry-run --quiet --strict --format pretty %'
+ let errorformat = '%f:%l:%c:%m,%W %.%# (%m),%-Z%f:%l:%.%#,%-G%.%#'
+
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
2  syntax_checkers/eruby.vim
@@ -20,7 +20,7 @@ if !executable("ruby") || !executable("cat")
endif
function! SyntaxCheckers_eruby_GetLocList()
- let makeprg='cat '. expand("%") . ' \| ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| ruby -c'
+ let makeprg='cat '. expand("%") . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c'
let errorformat='%-GSyntax OK,%E-:%l: syntax error\, %m,%Z%p^,%W-:%l: warning: %m,%Z%p^,%-C%.%#'
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
View
3  syntax_checkers/haml.vim
@@ -25,8 +25,7 @@ function! SyntaxCheckers_haml_GetLocList()
"haml only outputs the first error, so parse it ourselves
let line = substitute(output, '^Syntax error on line \(\d*\):.*', '\1', '')
let msg = substitute(output, '^Syntax error on line \d*:\(.*\)', '\1', '')
- "return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }]
- return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr("")}]
+ return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }]
endif
return []
endfunction
View
2  syntax_checkers/javascript.vim
@@ -21,6 +21,6 @@ endif
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "jsl -nologo -nofilelisting -nosummary -nocontext -process %"
- let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
+ let errorformat='%W%f(%l): lint warning: %m,%-Z%p^,%W%f(%l): warning: %m,%-Z%p^,%E%f(%l): SyntaxError: %m,%-Z%p^,%-G'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
View
2  syntax_checkers/ruby.vim
@@ -20,7 +20,7 @@ if !executable("ruby")
endif
function! SyntaxCheckers_ruby_GetLocList()
- let makeprg = 'ruby -w -c %'
+ let makeprg = 'RUBYOPT= ruby -w -c %'
let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
Please sign in to comment.
Something went wrong with that request. Please try again.