Refactor everything to smaller libs

+ autoload
This commit is contained in:
baabelfish 2016-01-30 15:26:11 +02:00
commit a8812f5f18
13 changed files with 382 additions and 323 deletions

42
autoload/util.vim Normal file
View file

@ -0,0 +1,42 @@
if exists("s:loaded")
finish
endif
let s:loaded = 1
function! util#FirstNonEmpty(lines)
for line in a:lines
if len(line) > 0
return line
endif
endfor
endfunction
function! util#CheckDependency(command)
if !executable(a:command)
echoerr "Not found: " . a:command
finish
endif
return exepath(a:command)
endfunction
function! util#JumpToLocation(file, line, col)
if expand("%:p") != a:file
execute ":e " . a:file
endif
execute ":" . a:line
execute ":norm " . a:col . "|"
endfunction
function! util#JumpFromQuickfix(shouldReturn)
let [file, location, _] = split(getline(line(".")), "|")
let [l, c] = split(location, " col ")
wincmd p
call s:JumpToLocation(file, l, c)
if a:shouldReturn
wincmd p
endif
endfunction