Skip to content

Commit

Permalink
Starting directory name not correctly set for recursive searches on M…
Browse files Browse the repository at this point in the history
…S-Windows
  • Loading branch information
yegappan committed Apr 14, 2018
1 parent e7708ff commit ddaf54e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions autoload/grep.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
" File: grep.vim
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
" Version: 2.1
" Last Modified: April 13, 2018
" Last Modified: April 14, 2018
"
" Plugin to integrate grep like utilities with Vim
" Supported utilities are: grep, fgrep, egrep, agrep, findstr, ag, ack,
Expand Down Expand Up @@ -694,16 +694,16 @@ function! grep#runGrepRecursive(cmd_name, grep_cmd, action, ...)
endif

" To compare against the current directory, convert to full path
let startdir = fnamemodify(startdir, ':p')
let startdir = fnamemodify(startdir, ':p:h')

if startdir == cwd
let startdir = '.'
endif

" On MS-Windows, convert the directory name to 8.3 style pathname.
" Otherwise, using a path with space characters causes problems.
if has('win32')
let startdir = fnamemodify(startdir, ':8')
else
" On MS-Windows, convert the directory name to 8.3 style pathname.
" Otherwise, using a path with space characters causes problems.
if has('win32')
let startdir = fnamemodify(startdir, ':8')
endif
endif

if filenames == ''
Expand Down Expand Up @@ -737,7 +737,8 @@ function! grep#runGrepRecursive(cmd_name, grep_cmd, action, ...)
endfor

let find_prune = '-type d ' . g:Grep_Shell_Escape_Char . '(' .
\ find_prune . ' ' . g:Grep_Shell_Escape_Char . ')'
\ find_prune . ' ' . g:Grep_Shell_Escape_Char . ')' .
\ ' -prune -o'
endif

let find_skip_files = '-type f'
Expand All @@ -755,7 +756,7 @@ function! grep#runGrepRecursive(cmd_name, grep_cmd, action, ...)
if g:Grep_Find_Use_Xargs == 1
let grep_cmd = s:formFullCmd(a:grep_cmd, opts, pattern, '')
let cmd = g:Grep_Find_Path . ' "' . startdir . '"'
\ . ' ' . find_prune . " -prune -o"
\ . ' ' . find_prune
\ . ' ' . find_skip_files
\ . ' ' . find_file_pattern
\ . " -print0 | "
Expand Down

0 comments on commit ddaf54e

Please sign in to comment.