Refactoring

This commit is contained in:
Junegunn Choi
2015-08-17 18:03:00 +09:00
parent cf8fc837cb
commit 36289f9261

View File

@@ -94,6 +94,12 @@ function! s:align_lists(lists)
return a:lists return a:lists
endfunction endfunction
function! s:warn(message)
echohl WarningMsg
echom a:message
echohl None
endfunction
" ------------------------------------------------------------------ " ------------------------------------------------------------------
" Files " Files
" ------------------------------------------------------------------ " ------------------------------------------------------------------
@@ -105,9 +111,7 @@ function! s:files(dir, bang)
if !empty(a:dir) if !empty(a:dir)
if !isdirectory(expand(a:dir)) if !isdirectory(expand(a:dir))
echohl WarningMsg call s:warn('Invalid directory')
echom 'Invalid directory'
echohl None
return return
endif endif
let dir = substitute(a:dir, '/*$', '/', '') let dir = substitute(a:dir, '/*$', '/', '')
@@ -297,9 +301,7 @@ function! s:btags(bang)
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --prompt "BTags> "'.s:expect(), \ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --prompt "BTags> "'.s:expect(),
\ 'sink*': function('s:btags_sink')}, a:bang) \ 'sink*': function('s:btags_sink')}, a:bang)
catch catch
echohl WarningMsg call s:warn(v:exception)
echom v:exception
echohl None
endtry endtry
endfunction endfunction
@@ -323,9 +325,7 @@ endfunction
function! s:tags(bang) function! s:tags(bang)
if empty(tagfiles()) if empty(tagfiles())
echohl WarningMsg call s:warn('Preparing tags')
echom 'Preparing tags'
echohl None
call system('ctags -R') call system('ctags -R')
endif endif