Last active
March 5, 2016 18:28
-
-
Save scrooloose/5eedbf80a4c62d01d25c to your computer and use it in GitHub Desktop.
nerdtree plugin to open a visual selection of files
This file contains hidden or 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
if exists("g:loaded_nerdtree_open_multiple") | |
finish | |
endif | |
let g:loaded_nerdtree_open_multiple=1 | |
vnoremap <buffer> o :call <SID>OpenMultiple()<cr> | |
function! s:OpenMultiple() range | |
let curLine = a:firstline | |
while curLine <= a:lastline | |
call cursor(curLine, 1) | |
let node = g:NERDTreeFileNode.GetSelected() | |
if !empty(node) && !node.path.isDirectory | |
if curLine == a:firstline | |
"open the first one in the previous window | |
call node.open({'where': 'p', 'stay': 1}) | |
else | |
call node.open({'where': 'h', 'stay': 1}) | |
endif | |
endif | |
let curLine += 1 | |
endwhile | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment