put the fs operations in the top level of the menu
This commit is contained in:
parent
c75a022a23
commit
41029aef24
@ -15,7 +15,12 @@ if exists("g:loaded_nerdtree_fs_menu")
|
|||||||
endif
|
endif
|
||||||
let g:loaded_nerdtree_fs_menu = 1
|
let g:loaded_nerdtree_fs_menu = 1
|
||||||
|
|
||||||
call NERDTreeAddMenuItem('(f)ilesystem menu', 'f', 'NERDTreeShowFilesystemMenu')
|
call NERDTreeAddMenuItem('(a)dd a childnode', 'a', 'NERDTreeAddNode')
|
||||||
|
call NERDTreeAddMenuItem('(m)ove the curent node', 'm', 'NERDTreeMoveNode')
|
||||||
|
call NERDTreeAddMenuItem('(d)elete the curent node', 'd', 'NERDTreeDeleteNode')
|
||||||
|
if g:NERDTreePath.CopyingSupported()
|
||||||
|
call NERDTreeAddMenuItem('(c)copy the current node', 'c', 'NERDTreeCopyNode')
|
||||||
|
endif
|
||||||
|
|
||||||
"FUNCTION: s:echo(msg){{{1
|
"FUNCTION: s:echo(msg){{{1
|
||||||
function! s:echo(msg)
|
function! s:echo(msg)
|
||||||
@ -45,37 +50,8 @@ function! s:promptToDelBuffer(bufnum, msg)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: NERDTreeShowFilesystemMenu(){{{1
|
"FUNCTION: NERDTreeAddNode(){{{1
|
||||||
function! NERDTreeShowFilesystemMenu()
|
function! NERDTreeAddNode()
|
||||||
let prompt = "NERDTree Filesystem Menu\n" .
|
|
||||||
\ "==========================================================\n".
|
|
||||||
\ "Select the desired operation: \n" .
|
|
||||||
\ " (a)dd a childnode\n".
|
|
||||||
\ " (m)ove the current node\n".
|
|
||||||
\ " (d)elete the current node\n"
|
|
||||||
if g:NERDTreePath.CopyingSupported()
|
|
||||||
let prompt = prompt . " (c)opy the current node\n\n"
|
|
||||||
else
|
|
||||||
let prompt = prompt . " \n"
|
|
||||||
endif
|
|
||||||
|
|
||||||
echo prompt
|
|
||||||
|
|
||||||
let choice = nr2char(getchar())
|
|
||||||
|
|
||||||
if choice ==? "a"
|
|
||||||
call s:create()
|
|
||||||
elseif choice ==? "m"
|
|
||||||
call s:move()
|
|
||||||
elseif choice ==? "d"
|
|
||||||
call s:delete()
|
|
||||||
elseif choice ==? "c" && g:NERDTreePath.CopyingSupported()
|
|
||||||
call s:copy()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: s:create(){{{1
|
|
||||||
function! s:create()
|
|
||||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||||
|
|
||||||
let newNodeName = input("Add a childnode\n".
|
let newNodeName = input("Add a childnode\n".
|
||||||
@ -103,8 +79,8 @@ function! s:create()
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:move(){{{1
|
"FUNCTION: NERDTreeMoveNode(){{{1
|
||||||
function! s:move()
|
function! NERDTreeMoveNode()
|
||||||
let curNode = g:NERDTreeFileNode.GetSelected()
|
let curNode = g:NERDTreeFileNode.GetSelected()
|
||||||
if curNode ==# {}
|
if curNode ==# {}
|
||||||
call s:echo("Put the cursor on a node first" )
|
call s:echo("Put the cursor on a node first" )
|
||||||
@ -142,8 +118,8 @@ function! s:move()
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:delete() {{{1
|
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||||
function! s:delete()
|
function! NERDTreeDeleteNode()
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
if currentNode ==# {}
|
if currentNode ==# {}
|
||||||
call s:echo("Put the cursor on a node first")
|
call s:echo("Put the cursor on a node first")
|
||||||
@ -191,8 +167,8 @@ function! s:delete()
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:copy() {{{1
|
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||||
function! s:copy()
|
function! NERDTreeCopyNode()
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
if currentNode ==# {}
|
if currentNode ==# {}
|
||||||
call s:echo("Put the cursor on a file node first")
|
call s:echo("Put the cursor on a file node first")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user