From d709583dd11da8583240f33625819bf00b3c1812 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 30 Apr 2016 11:34:23 +0300 Subject: [PATCH 1/3] Fix :AckHelp command bug with missing *.txt files If there are no *.txt files in the doc directory, the ack command errors out. Globbing for those files while generating the file list fixes the issue. --- autoload/ack.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/ack.vim b/autoload/ack.vim index 82d3de65..4e8cda61 100644 --- a/autoload/ack.vim +++ b/autoload/ack.vim @@ -134,15 +134,15 @@ function! s:ApplyMappings() "{{{ endfunction "}}} function! s:GetDocLocations() "{{{ - let dp = '' + let dp = [] for p in split(&rtp, ',') let p = p . '/doc/' if isdirectory(p) - let dp = p . '*.txt ' . dp + call extend(dp, glob(p . '*.txt', 0, 1)) endif endfor - return dp + return join(dp, ' ') endfunction "}}} function! s:Highlight(args) "{{{ From d936f7ac99ecdd97ca747d507ba34650cb58fc08 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Sat, 30 Apr 2016 11:34:39 +0300 Subject: [PATCH 2/3] Shorten file path as much as possible This improves the quickfix list filenames in the case when the found files are under the current directory. --- autoload/ack.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ack.vim b/autoload/ack.vim index 4e8cda61..8f833b4d 100644 --- a/autoload/ack.vim +++ b/autoload/ack.vim @@ -136,7 +136,7 @@ endfunction "}}} function! s:GetDocLocations() "{{{ let dp = [] for p in split(&rtp, ',') - let p = p . '/doc/' + let p = fnamemodify(p . '/doc/', ':~:.') if isdirectory(p) call extend(dp, glob(p . '*.txt', 0, 1)) endif From fd0f1c3660cd8d351b68388715daedfd32b0cf28 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Tue, 3 May 2016 21:33:10 +0300 Subject: [PATCH 3/3] Fix issue with `isdirectory` and home-relative paths --- autoload/ack.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ack.vim b/autoload/ack.vim index 8f833b4d..5d4ae123 100644 --- a/autoload/ack.vim +++ b/autoload/ack.vim @@ -137,7 +137,7 @@ function! s:GetDocLocations() "{{{ let dp = [] for p in split(&rtp, ',') let p = fnamemodify(p . '/doc/', ':~:.') - if isdirectory(p) + if isdirectory(expand(p)) call extend(dp, glob(p . '*.txt', 0, 1)) endif endfor