From c0d87db309d2ba74230c9f1a2e64be1aa2c51c58 Mon Sep 17 00:00:00 2001 From: Bubba Date: Fri, 15 Jun 2018 10:43:20 -0400 Subject: [PATCH 1/3] Better OSX detection --- nerdtree_plugin/fs_menu.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index ecca9cd..997c063 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -225,10 +225,12 @@ endfunction function! NERDTreeListNode() let treenode = g:NERDTreeFileNode.GetSelected() if !empty(treenode) - if has("osx") - let stat_cmd = 'stat -f "%z" ' - else - let stat_cmd = 'stat -c "%s" ' + if has("unix") + let s:uname = system("uname") + let stat_cmd = 'stat -c "%s" ' + if s:uname == "Darwin\n" + let stat_cmd = 'stat -f "%z" ' + endif endif let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' . From a053179d6afe9c9272eb44f3d9ed9f2fe21703aa Mon Sep 17 00:00:00 2001 From: Bubba Date: Fri, 15 Jun 2018 11:29:09 -0400 Subject: [PATCH 2/3] Use the case-insensitive regex --- nerdtree_plugin/fs_menu.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index 997c063..553b760 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -228,7 +228,7 @@ function! NERDTreeListNode() if has("unix") let s:uname = system("uname") let stat_cmd = 'stat -c "%s" ' - if s:uname == "Darwin\n" + if s:uname =~? "Darwin" let stat_cmd = 'stat -f "%z" ' endif endif From 08db3a0eea7f7f28984ed029cb06db7ecc32c842 Mon Sep 17 00:00:00 2001 From: Bubba Date: Fri, 15 Jun 2018 12:02:58 -0400 Subject: [PATCH 3/3] Do not need to check for unix os here. --- nerdtree_plugin/fs_menu.vim | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index 553b760..36e2eae 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -225,12 +225,11 @@ endfunction function! NERDTreeListNode() let treenode = g:NERDTreeFileNode.GetSelected() if !empty(treenode) - if has("unix") - let s:uname = system("uname") - let stat_cmd = 'stat -c "%s" ' - if s:uname =~? "Darwin" - let stat_cmd = 'stat -f "%z" ' - endif + let s:uname = system("uname") + let stat_cmd = 'stat -c "%s" ' + + if s:uname =~? "Darwin" + let stat_cmd = 'stat -f "%z" ' endif let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' .