mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 11:32:25 +08:00
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:
parent
729e8014b9
commit
6b6cadf86c
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user