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.
This commit is contained in:
Phil Runninger 2018-10-10 22:19:18 -04:00 committed by GitHub
parent 729e8014b9
commit 6b6cadf86c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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