Skip to content

Commit

Permalink
Use a better arg for FINDSTR when using the m,l command in Windows. (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
PhilRunninger committed Oct 11, 2018
1 parent 729e801 commit 6b6cadf
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions nerdtree_plugin/fs_menu.vim
Expand Up @@ -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

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

Expand Down

0 comments on commit 6b6cadf

Please sign in to comment.