Created
July 20, 2010 05:20
-
-
Save hotoo/482563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" open fiel in system file explorer plugin for NERDTree. | |
" put this in $VIM/vimfiles/nerdtree_plugin/fileexplorer.vim | |
" @author 闲耘™ (hotoo.cn[AT]gmail.com) | |
" @version 1.0 2010/07/20 | |
if exists("g:loaded_nerdtree_fileexplorer") | |
finish | |
endif | |
let g:loaded_nerdtree_fileexplorer = 1 | |
autocmd filetype nerdtree nmap <buffer> <F6> :call FileExplorer(g:NERDTreeFileNode.GetSelected().path.str({'escape':1}))<cr> | |
autocmd filetype nerdtree command! -nargs=0 -buffer Explor :call FileExplorer(g:NERDTreeFileNode.GetSelected().path.str({'escape':1})) | |
autocmd filetype nerdtree command! -nargs=0 -buffer Explorer :call FileExplorer(g:NERDTreeFileNode.GetSelected().path.str({'escape':1})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! FileExplorer(path) | |
if a:path == "" | |
let p = expand("%:p") | |
else | |
let p = a:path | |
endif | |
if executable("chcp") | |
let code_page = 'cp' . matchstr(system("chcp"), "\\d\\+") | |
else | |
" If chcp doesn't work, set its value manually here. | |
let code_page = 'cp936' | |
endif | |
if has('win32') && !has('win32unix') && (&enc!=code_page) | |
let p = iconv(p, &enc, code_page) | |
endif | |
exec ":!start explorer /select, " . p | |
" Open Explorer Tree. | |
"exec ":!start explorer /e,/select, " . p | |
endfunction | |
if has("win32") | |
" Open Windows Explorer and Fouse current file. | |
" %:p:h " Just Fold Name. | |
nmap <F6> :call FileExplorer("")<cr> | |
imap <F6> <C-o><F6> | |
command -nargs=0 Explor :call FileExplorer("") | |
command -nargs=0 Explorer :call FileExplorer("") | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
安装:
用法:
在打开的文件或 NERDTree 中按 、执行 :Explor 或 :Explorer
会在文件资源管理器中定位目标文件/夹。
如果希望同时展开资源管理器的树型结构,启用 explorer 的 /e 参数即可。