Jas*_*son 7 vim nerdtree macos
我虔诚地使用MacVim 的 NerdTree插件,并且发现自己经常想在 Finder 中打开一个文件夹来处理文件。一个例子是想要预览和复制一些图像。
有没有一种不涉及更改当前目录的快速方法?我的完美场景是:
现在,作为fs_menu.vim插件的一部分,NERDTree 可以开箱即用。事实上,这个功能只适用于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
Run Code Online (Sandbox Code Playgroud)
导航到 NERDTree 视图中的节点,键入m以调出 fs 菜单,然后o打开当前节点。目录将在新的 Finder 窗口中打开,文件将在您设置为文件类型默认编辑器的应用程序中打开。
这是对open命令的补充:
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("open '" . treenode.path.str() . "'")
endif
endfunction
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3189 次 |
| 最近记录: |