summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-03-21 13:09:02 +0000
committerw0rp <devw0rp@gmail.com>2017-03-21 13:09:02 +0000
commit2d1d6fb85011e07a6b5b29f57247254cbc4b8815 (patch)
tree7e789a6745525a7da99848424be7da3bd883293d /autoload
parent6550cdfbd0d8e4037e9097db5a0caa6284b35708 (diff)
downloadale-2d1d6fb85011e07a6b5b29f57247254cbc4b8815.zip
Add some utility functions for changing directories for commands
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/util.vim13
1 files changed, 13 insertions, 0 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 600717db..84ffe22e 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -144,3 +144,16 @@ endfunction
function! ale#util#ClockMilliseconds() abort
return float2nr(reltimefloat(reltime()) * 1000)
endfunction
+
+
+" Output 'cd <directory> && '
+" This function can be used changing the directory for a linter command.
+function! ale#util#CdString(directory) abort
+ return 'cd ' . fnameescape(a:directory) . ' && '
+endfunction
+
+" Output 'cd <buffer_filename_directory> && '
+" This function can be used changing the directory for a linter command.
+function! ale#util#BufferCdString(buffer) abort
+ return ale#util#CdString(fnamemodify(bufname(a:buffer), ':p:h'))
+endfunction