mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
cmd.exe /c start "" <filename> for windows default viewer support (#1130)
* support for default viewer in Windows * updated changelog * Update nerdtree_plugin/fs_menu.vim Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com> * Update nerdtree_plugin/fs_menu.vim Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com> Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com>
This commit is contained in:
@@ -34,6 +34,10 @@ if executable('xdg-open')
|
||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
|
||||
endif
|
||||
|
||||
if nerdtree#runningWindows()
|
||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
|
||||
endif
|
||||
|
||||
if g:NERDTreePath.CopyingSupported()
|
||||
call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||
endif
|
||||
@@ -451,4 +455,15 @@ function! NERDTreeExecuteFileLinux()
|
||||
call system('xdg-open ' . shellescape(l:node.path.str()))
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeExecuteFileWindows() {{{1
|
||||
function! NERDTreeExecuteFileWindows()
|
||||
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||
|
||||
if empty(l:node)
|
||||
return
|
||||
endif
|
||||
|
||||
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
||||
endfunction
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
||||
Reference in New Issue
Block a user