From c6dc324add0d03cadd624bcd0f990207bdd4210a Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 4 Oct 2016 18:24:46 +0100 Subject: Add a function for finding nearest files, and use it to fix JSHint so it will find configuration files automatically. --- plugin/ale/util.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugin') 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 -- cgit v1.2.3