From ab07e4069e72c9af0e9a7236a36aa49be787726b Mon Sep 17 00:00:00 2001 From: jdhao Date: Sun, 27 Sep 2020 18:46:12 +0800 Subject: use printf for string concatenation where needed --- autoload/utils.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'autoload/utils.vim') diff --git a/autoload/utils.vim b/autoload/utils.vim index 73c003b..6afda90 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -31,13 +31,13 @@ endfunction " Check if a colorscheme exists in runtimepath. " The following two functions are inspired by https://stackoverflow.com/a/5703164/6064933. function! utils#HasColorscheme(name) abort - let l:pat = 'colors/' . a:name . '.vim' + let l:pat = printf('colors/%s.vim', a:name) return !empty(globpath(&runtimepath, l:pat)) endfunction " Check if an Airline theme exists in runtimepath. function! utils#HasAirlinetheme(name) abort - let l:pat = 'autoload/airline/themes/' . a:name . '.vim' + let l:pat = printf('autoload/airline/themes/%s.vim', a:name) return !empty(globpath(&runtimepath, l:pat)) endfunction @@ -72,7 +72,7 @@ function! utils#MyFoldText() abort let folded_line_num = v:foldend - v:foldstart let line_text = substitute(line, '^"{\+', '', 'g') let fillcharcount = &textwidth - len(line_text) - len(folded_line_num) - 10 - return '+'. repeat('-', 4) . line_text . repeat('.', fillcharcount) . ' (' . folded_line_num . ' L)' + return printf('+%s%s%s (%s L)', repeat('-', 4), line_text, repeat('.', fillcharcount), folded_line_num) endfunction " Toggle cursor column -- cgit v1.2.3