aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2020-09-27 18:46:12 +0800
committerjdhao <jdhao@hotmail.com>2020-09-27 18:46:12 +0800
commitab07e4069e72c9af0e9a7236a36aa49be787726b (patch)
tree9f7f0689f4b775c70532c1a6382e190800c18dda
parent233d6a2ba679409a41bee5795381ee3dcd6fd289 (diff)
use printf for string concatenation where needed
-rw-r--r--autoload/utils.vim6
-rw-r--r--init.vim2
-rw-r--r--mappings.vim4
-rw-r--r--plugins.vim4
4 files changed, 8 insertions, 8 deletions
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
diff --git a/init.vim b/init.vim
index a32dd4c..69c6eaf 100644
--- a/init.vim
+++ b/init.vim
@@ -65,7 +65,7 @@ let g:config_file_list = ['variables.vim',
\ ]
for s:fname in g:config_file_list
- execute 'source ' . g:nvim_config_root . '/' . s:fname
+ execute printf('source %s/%s', g:nvim_config_root, s:fname)
endfor
"}
diff --git a/mappings.vim b/mappings.vim
index b3f8cab..5c4a0a1 100644
--- a/mappings.vim
+++ b/mappings.vim
@@ -49,8 +49,8 @@ nnoremap <silent> \d :bprevious <bar> bdelete #<CR>
" Insert a blank line below or above current line (do not move the cursor),
" see https://stackoverflow.com/a/16136133/6064933
-nnoremap <expr> oo 'm`' . v:count1 . 'o<Esc>``'
-nnoremap <expr> OO 'm`' . v:count1 . 'O<Esc>``'
+nnoremap <expr> oo printf('m`%so<ESC>``', v:count1)
+nnoremap <expr> OO printf('m`%sO<ESC>``', v:count1)
" nnoremap oo @='m`o<c-v><Esc>``'<cr>
" nnoremap OO @='m`O<c-v><Esc>``'<cr>
diff --git a/plugins.vim b/plugins.vim
index ada53ea..4fe0376 100644
--- a/plugins.vim
+++ b/plugins.vim
@@ -13,8 +13,8 @@ if g:is_win || g:is_mac
if empty(glob(g:VIM_PLUG_PATH))
if executable('curl')
echomsg 'Installing Vim-plug on your system'
- silent execute '!curl -fLo ' . g:VIM_PLUG_PATH . ' --create-dirs '
- \ . 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
+ let l:vim_plug_furl = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
+ silent execute printf('!curl -fLo %s --create-dirs %s', l:vim_plug_furl, g:VIM_PLUG_PATH)
augroup plug_init
autocmd!
autocmd VimEnter * PlugInstall --sync | quit |source $MYVIMRC