OS X + Vim: Open Finder for a Folder in NerdTree (Vim)
This is available out-of-the-box with NERDTree now as part of the fs_menu.vim plugin. In fact, this feature only works on the Mac:
if has("gui_mac") || has("gui_macvim") || has("mac")
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
endif
Navigate to a node in the NERDTree view, type m
to bring up the fs menu, then o
to open the current node. Directories will be opened in a new Finder window, files will be opened in the application you have set as the default editor for the file's type.
This is accomplished compliments of the open command:
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("open '" . treenode.path.str() . "'")
endif
endfunction