nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 2e9d43b6f83b2d392521397693a940449fa7565c
parent 10eaa3a2f42d395a9a6dca14957a5862e709651b
Author: Jordi Altayó <jordialtayo@gmail.com>
Date:   Fri, 22 May 2020 14:57:19 +0200

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>
Diffstat:
MCHANGELOG.md | 1+
Mnerdtree_plugin/fs_menu.vim | 15+++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -5,6 +5,7 @@
         - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
 -->
 #### 6.7
+- **.13**: Invoke-Item for windows default viewer support. (J. Altayó) [#1130](https://github.com/preservim/nerdtree/pull/1130) 
 - **.12**: Fixed a bug that caused the file-tree construction to slow down significantly. [#1126](https://github.com/preservim/nerdtree/pull/1126)
 - **.11**: Fix exception in NERDTreeFind (on windows OS and If the file is located in the root directory of the disk)  [#1122](https://github.com/preservim/nerdtree/pull/1122)
 - **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120)
diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim
@@ -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: