commit 6b6cadf86ccce077212292b0585ab17e7884c81e
parent 729e8014b9ffb17ff1298ef96fb7094f8e5ffa49
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Wed, 10 Oct 2018 22:19:18 -0400
Use a better arg for FINDSTR when using the m,l command in Windows. (#887)
* Use a better arg for FINDSTR when using the m,l command in Windows.
* Remove trailing spaces.
* Use vim getf...() functions in place of DOS commands.
* Remove unnecessary variable.
* Put labels in the text of the file/dir listing.
Diffstat:
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim
@@ -226,9 +226,9 @@ function! NERDTreeListNode()
let treenode = g:NERDTreeFileNode.GetSelected()
if !empty(treenode)
let s:uname = system("uname")
- let stat_cmd = 'stat -c "%s" '
-
- if s:uname =~? "Darwin"
+ let stat_cmd = 'stat -c "%s" '
+
+ if s:uname =~? "Darwin"
let stat_cmd = 'stat -f "%z" '
endif
@@ -248,33 +248,13 @@ function! NERDTreeListNodeWin32()
let l:node = g:NERDTreeFileNode.GetSelected()
if !empty(l:node)
-
- let l:save_shell = &shell
- set shell&
-
- if exists('+shellslash')
- let l:save_shellslash = &shellslash
- set noshellslash
- endif
-
- let l:command = 'DIR /Q '
- \ . shellescape(l:node.path.str())
- \ . ' | FINDSTR "^[012][0-9]/[0-3][0-9]/[12][0-9][0-9][0-9]"'
-
- let l:metadata = split(system(l:command), "\n")
-
- if v:shell_error == 0
- call nerdtree#echo(l:metadata[0])
- else
- call nerdtree#echoError('shell command failed')
- endif
-
- let &shell = l:save_shell
-
- if exists('l:save_shellslash')
- let &shellslash = l:save_shellslash
- endif
-
+ let l:path = l:node.path.str()
+ call nerdtree#echo(printf("%s:%s MOD:%s BYTES:%d PERMISSIONS:%s",
+ \ toupper(getftype(l:path)),
+ \ fnamemodify(l:path, ':t'),
+ \ strftime("%c", getftime(l:path)),
+ \ getfsize(l:path),
+ \ getfperm(l:path)))
return
endif