Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added reveal functionality for Windows platform in fs_menu #1366

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion nerdtree_plugin/fs_menu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'c
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})

if nerdtree#runningMac()
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Finder', '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
Expand All @@ -35,6 +35,7 @@ if executable('xdg-open')
endif

if nerdtree#runningWindows()
call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Explorer', 'shortcut': 'r', 'callback': 'NERDTreeRevealInExplorer'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
endif

Expand Down Expand Up @@ -514,6 +515,17 @@ function! NERDTreeExecuteFileLinux()
call system('xdg-open ' . shellescape(l:node.path.str()))
endfunction

" FUNCTION: NERDTreeRevealInExplorer() {{{1
function! NERDTreeRevealInExplorer()
let l:node = g:NERDTreeFileNode.GetSelected()

if empty(l:node)
return
endif

call system('cmd.exe /c explorer /select, ' . shellescape(l:node.path.str()))
endfunction

" FUNCTION: NERDTreeExecuteFileWindows() {{{1
function! NERDTreeExecuteFileWindows()
let l:node = g:NERDTreeFileNode.GetSelected()
Expand Down