summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-04 18:24:46 +0100
committerw0rp <devw0rp@gmail.com>2016-10-04 18:24:46 +0100
commitc6dc324add0d03cadd624bcd0f990207bdd4210a (patch)
tree2a8440652e4a1ed03ad1122efd0afbe9b34c048d /plugin
parentbd2f39f21a772bda384c0ebf7bd7fba0d2ce667f (diff)
downloadale-c6dc324add0d03cadd624bcd0f990207bdd4210a.zip
Add a function for finding nearest files, and use it to fix JSHint so it will find configuration files automatically.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/ale/util.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/ale/util.vim b/plugin/ale/util.vim
index 64dd59dc..d3f44573 100644
--- a/plugin/ale/util.vim
+++ b/plugin/ale/util.vim
@@ -24,3 +24,9 @@ let g:ale#util#stdin_wrapper = s:FindWrapperScript()
function! ale#util#GetLineCount(buffer)
return len(getbufline(a:buffer, 1, '$'))
endfunction
+
+" Given a buffer and a filename, find the nearest file by searching upwards
+" through the paths relative to the given buffer.
+function! ale#util#FindNearestFile(buffer, filename)
+ return findfile(a:filename, fnamemodify(bufname(a:buffer), ':p') . ';')
+endfunction