Use single-quotes whenever possible for consistency
This commit is contained in:
parent
2e691c6feb
commit
58c06ed77e
48
plug.vim
48
plug.vim
|
@ -73,10 +73,10 @@ let s:is_win = has('win32') || has('win64')
|
||||||
let s:me = expand('<sfile>:p')
|
let s:me = expand('<sfile>:p')
|
||||||
let s:base_spec = { 'branch': 'master', 'frozen': 0, 'local': 0 }
|
let s:base_spec = { 'branch': 'master', 'frozen': 0, 'local': 0 }
|
||||||
let s:TYPE = {
|
let s:TYPE = {
|
||||||
\ 'string': type(""),
|
\ 'string': type(''),
|
||||||
\ 'list': type([]),
|
\ 'list': type([]),
|
||||||
\ 'dict': type({}),
|
\ 'dict': type({}),
|
||||||
\ 'funcref': type(function("call"))
|
\ 'funcref': type(function('call'))
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! plug#begin(...)
|
function! plug#begin(...)
|
||||||
|
@ -110,7 +110,7 @@ function! plug#begin(...)
|
||||||
command! -nargs=* -complete=customlist,s:names PlugInstall call s:install(<f-args>)
|
command! -nargs=* -complete=customlist,s:names PlugInstall call s:install(<f-args>)
|
||||||
command! -nargs=* -complete=customlist,s:names PlugUpdate call s:update(<f-args>)
|
command! -nargs=* -complete=customlist,s:names PlugUpdate call s:update(<f-args>)
|
||||||
command! -nargs=0 -bang PlugClean call s:clean('<bang>' == '!')
|
command! -nargs=0 -bang PlugClean call s:clean('<bang>' == '!')
|
||||||
command! -nargs=0 PlugUpgrade if s:upgrade() | call s:upgrade_specs() | execute "source ". s:me | endif
|
command! -nargs=0 PlugUpgrade if s:upgrade() | call s:upgrade_specs() | execute 'source '. s:me | endif
|
||||||
command! -nargs=0 PlugStatus call s:status()
|
command! -nargs=0 PlugStatus call s:status()
|
||||||
command! -nargs=0 PlugDiff call s:diff()
|
command! -nargs=0 PlugDiff call s:diff()
|
||||||
|
|
||||||
|
@ -158,15 +158,15 @@ function! plug#end()
|
||||||
if cmd =~ '^<Plug>.\+'
|
if cmd =~ '^<Plug>.\+'
|
||||||
if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
|
if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
|
||||||
for [mode, map_prefix, key_prefix] in
|
for [mode, map_prefix, key_prefix] in
|
||||||
\ [['i', "<C-O>", ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||||
execute printf(
|
execute printf(
|
||||||
\ "%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, '%s')<CR>",
|
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, "%s")<CR>',
|
||||||
\ mode, cmd, map_prefix, string(cmd), string(name), key_prefix)
|
\ mode, cmd, map_prefix, string(cmd), string(name), key_prefix)
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
elseif !exists(':'.cmd)
|
elseif !exists(':'.cmd)
|
||||||
execute printf(
|
execute printf(
|
||||||
\ "command! -nargs=* -range -bang %s call s:lod_cmd(%s, '<bang>', <line1>, <line2>, <q-args>, %s)",
|
\ 'command! -nargs=* -range -bang %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
|
||||||
\ cmd, string(cmd), string(name))
|
\ cmd, string(cmd), string(name))
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -246,10 +246,10 @@ function! s:esc(path)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:add_rtp(rtp)
|
function! s:add_rtp(rtp)
|
||||||
execute "set rtp^=".s:esc(a:rtp)
|
execute 'set rtp^='.s:esc(a:rtp)
|
||||||
let after = globpath(a:rtp, 'after')
|
let after = globpath(a:rtp, 'after')
|
||||||
if isdirectory(after)
|
if isdirectory(after)
|
||||||
execute "set rtp+=".s:esc(after)
|
execute 'set rtp+='.s:esc(after)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ function! s:lod_cmd(cmd, bang, l1, l2, args, name)
|
||||||
execute 'delc '.a:cmd
|
execute 'delc '.a:cmd
|
||||||
call s:lod(g:plugs[a:name], ['plugin', 'ftdetect', 'after'])
|
call s:lod(g:plugs[a:name], ['plugin', 'ftdetect', 'after'])
|
||||||
call s:reorg_rtp()
|
call s:reorg_rtp()
|
||||||
execute printf("%s%s%s %s", (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_map(map, name, prefix)
|
function! s:lod_map(map, name, prefix)
|
||||||
|
@ -383,7 +383,7 @@ function! s:apply()
|
||||||
for spec in values(g:plugs)
|
for spec in values(g:plugs)
|
||||||
let docd = join([spec.dir, 'doc'], '/')
|
let docd = join([spec.dir, 'doc'], '/')
|
||||||
if isdirectory(docd)
|
if isdirectory(docd)
|
||||||
silent! execute "helptags ". join([spec.dir, 'doc'], '/')
|
silent! execute 'helptags '. join([spec.dir, 'doc'], '/')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
runtime! plugin/*.vim
|
runtime! plugin/*.vim
|
||||||
|
@ -473,10 +473,10 @@ function! s:assign_name()
|
||||||
let name = prefix
|
let name = prefix
|
||||||
let idx = 2
|
let idx = 2
|
||||||
while bufexists(name)
|
while bufexists(name)
|
||||||
let name = printf("%s (%s)", prefix, idx)
|
let name = printf('%s (%s)', prefix, idx)
|
||||||
let idx = idx + 1
|
let idx = idx + 1
|
||||||
endwhile
|
endwhile
|
||||||
silent! execute "f ".fnameescape(name)
|
silent! execute 'f '.fnameescape(name)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:do(pull, todo)
|
function! s:do(pull, todo)
|
||||||
|
@ -612,7 +612,7 @@ function! s:update_impl(pull, args) abort
|
||||||
call plug#end()
|
call plug#end()
|
||||||
endif
|
endif
|
||||||
call s:finish(a:pull)
|
call s:finish(a:pull)
|
||||||
call setline(1, "Updated. Elapsed time: " . split(reltimestr(reltime(st)))[0] . ' sec.')
|
call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(st)))[0] . ' sec.')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:find_plugfiles()
|
function! s:find_plugfiles()
|
||||||
|
@ -647,7 +647,7 @@ endfunction
|
||||||
|
|
||||||
function! s:update_progress(pull, cnt, bar, total)
|
function! s:update_progress(pull, cnt, bar, total)
|
||||||
call setline(1, (a:pull ? 'Updating' : 'Installing').
|
call setline(1, (a:pull ? 'Updating' : 'Installing').
|
||||||
\ " plugins (".a:cnt."/".a:total.")")
|
\ ' plugins ('.a:cnt.'/'.a:total.')')
|
||||||
call s:progress_bar(2, a:bar, a:total)
|
call s:progress_bar(2, a:bar, a:total)
|
||||||
normal! 2G
|
normal! 2G
|
||||||
redraw
|
redraw
|
||||||
|
@ -962,16 +962,16 @@ function! s:git_valid(spec, check_branch, cd)
|
||||||
let ret = 1
|
let ret = 1
|
||||||
let msg = 'OK'
|
let msg = 'OK'
|
||||||
if isdirectory(a:spec.dir)
|
if isdirectory(a:spec.dir)
|
||||||
if a:cd | execute "cd " . s:esc(a:spec.dir) | endif
|
if a:cd | execute 'cd ' . s:esc(a:spec.dir) | endif
|
||||||
let result = split(s:system("git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url"), '\n')
|
let result = split(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url'), '\n')
|
||||||
let remote = result[-1]
|
let remote = result[-1]
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
let msg = join([remote, "PlugClean required."], "\n")
|
let msg = join([remote, 'PlugClean required.'], "\n")
|
||||||
let ret = 0
|
let ret = 0
|
||||||
elseif !s:compare_git_uri(remote, a:spec.uri)
|
elseif !s:compare_git_uri(remote, a:spec.uri)
|
||||||
let msg = join(['Invalid URI: '.remote,
|
let msg = join(['Invalid URI: '.remote,
|
||||||
\ 'Expected: '.a:spec.uri,
|
\ 'Expected: '.a:spec.uri,
|
||||||
\ "PlugClean required."], "\n")
|
\ 'PlugClean required.'], "\n")
|
||||||
let ret = 0
|
let ret = 0
|
||||||
elseif a:check_branch
|
elseif a:check_branch
|
||||||
let branch = result[0]
|
let branch = result[0]
|
||||||
|
@ -1036,7 +1036,7 @@ function! s:clean(force)
|
||||||
call append(line('$'), 'Already clean.')
|
call append(line('$'), 'Already clean.')
|
||||||
else
|
else
|
||||||
call inputsave()
|
call inputsave()
|
||||||
let yes = a:force || (input("Proceed? (Y/N) ") =~? '^y')
|
let yes = a:force || (input('Proceed? (Y/N) ') =~? '^y')
|
||||||
call inputrestore()
|
call inputrestore()
|
||||||
if yes
|
if yes
|
||||||
for dir in todo
|
for dir in todo
|
||||||
|
@ -1056,22 +1056,22 @@ function! s:upgrade()
|
||||||
if executable('curl')
|
if executable('curl')
|
||||||
let mee = s:shellesc(s:me)
|
let mee = s:shellesc(s:me)
|
||||||
let new = s:shellesc(s:me . '.new')
|
let new = s:shellesc(s:me . '.new')
|
||||||
echo "Downloading ". s:plug_source
|
echo 'Downloading '. s:plug_source
|
||||||
redraw
|
redraw
|
||||||
let mv = s:is_win ? 'move /Y' : 'mv -f'
|
let mv = s:is_win ? 'move /Y' : 'mv -f'
|
||||||
let cp = s:is_win ? 'copy /Y' : 'cp -f'
|
let cp = s:is_win ? 'copy /Y' : 'cp -f'
|
||||||
call system(printf(
|
call system(printf(
|
||||||
\ "curl -fLo %s %s && ".cp." %s %s.old && ".mv." %s %s",
|
\ 'curl -fLo %s %s && '.cp.' %s %s.old && '.mv.' %s %s',
|
||||||
\ new, s:plug_source, mee, mee, new, mee))
|
\ new, s:plug_source, mee, mee, new, mee))
|
||||||
if v:shell_error == 0
|
if v:shell_error == 0
|
||||||
unlet g:loaded_plug
|
unlet g:loaded_plug
|
||||||
echo "Downloaded ". s:plug_source
|
echo 'Downloaded '. s:plug_source
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return s:err('Error upgrading vim-plug')
|
return s:err('Error upgrading vim-plug')
|
||||||
endif
|
endif
|
||||||
elseif has('ruby')
|
elseif has('ruby')
|
||||||
echo "Downloading ". s:plug_source
|
echo 'Downloading '. s:plug_source
|
||||||
ruby << EOF
|
ruby << EOF
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
@ -1085,7 +1085,7 @@ function! s:upgrade()
|
||||||
File.rename new, me
|
File.rename new, me
|
||||||
EOF
|
EOF
|
||||||
unlet g:loaded_plug
|
unlet g:loaded_plug
|
||||||
echo "Downloaded ". s:plug_source
|
echo 'Downloaded '. s:plug_source
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return s:err('curl executable or ruby support not found')
|
return s:err('curl executable or ruby support not found')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user