mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-08 18:04:46 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44ea685aa | ||
|
|
9df0580eff | ||
|
|
e15598fe45 | ||
|
|
326cb71a2a | ||
|
|
c9a7ca1e9e | ||
|
|
5695fb8474 | ||
|
|
f68a4fddae | ||
|
|
17996cedce | ||
|
|
460fbe82e0 | ||
|
|
05a1620bb1 | ||
|
|
cb5bed0e35 | ||
|
|
44893a1901 | ||
|
|
765a2d21d3 | ||
|
|
eb25f320a0 | ||
|
|
7c7ef8cf2f | ||
|
|
a8b09617f9 | ||
|
|
bf1e0fb8eb | ||
|
|
656ccef8dc | ||
|
|
41de3c713c |
17
README.md
17
README.md
@@ -62,9 +62,9 @@ $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
|
||||
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
|
||||
|
||||
1. Begin the section with `plug#begin()`
|
||||
1. Begin the section with `call plug#begin()`
|
||||
1. List the plugins with `Plug` commands
|
||||
1. `plug#end()` to update `&runtimepath` and initialize plugin system
|
||||
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
|
||||
|
||||
#### Example
|
||||
|
||||
@@ -141,6 +141,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||
| `g:plug_shallow` | 1 | Use shallow clone |
|
||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
||||
| `g:plug_pwindow` | `above 12new` | Command to open preview window in `PlugDiff` |
|
||||
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
|
||||
|
||||
|
||||
@@ -182,9 +183,9 @@ Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||
" On-demand loading on both conditions
|
||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||
|
||||
" Code to execute when the plugin is loaded on demand
|
||||
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
|
||||
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
|
||||
" Code to execute when the plugin is lazily loaded on demand
|
||||
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
|
||||
autocmd! User goyo.vim echom 'Goyo is now loaded!'
|
||||
```
|
||||
|
||||
`for` option is generally not needed as most plugins for specific file types
|
||||
@@ -201,6 +202,12 @@ Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
|
||||
```
|
||||
|
||||
If the value starts with `:`, it will be recognized as a Vim command.
|
||||
|
||||
```vim
|
||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||
```
|
||||
|
||||
If you need more control, you can pass a reference to a Vim function that
|
||||
takes a single argument.
|
||||
|
||||
|
||||
190
plug.vim
190
plug.vim
@@ -131,7 +131,7 @@ function! plug#begin(...)
|
||||
endfunction
|
||||
|
||||
function! s:define_commands()
|
||||
command! -nargs=+ -bar Plug call s:Plug(<args>)
|
||||
command! -nargs=+ -bar Plug call plug#(<args>)
|
||||
if !executable('git')
|
||||
return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.')
|
||||
endif
|
||||
@@ -171,14 +171,22 @@ function! s:assoc(dict, key, val)
|
||||
let a:dict[a:key] = add(get(a:dict, a:key, []), a:val)
|
||||
endfunction
|
||||
|
||||
function! s:ask(message)
|
||||
function! s:ask(message, ...)
|
||||
call inputsave()
|
||||
echohl WarningMsg
|
||||
let proceed = input(a:message.' (y/N) ') =~? '^y'
|
||||
let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) '))
|
||||
echohl None
|
||||
call inputrestore()
|
||||
echo "\r"
|
||||
return proceed
|
||||
return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0
|
||||
endfunction
|
||||
|
||||
function! s:ask_no_interrupt(...)
|
||||
try
|
||||
return call('s:ask', a:000)
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! plug#end()
|
||||
@@ -196,6 +204,9 @@ function! plug#end()
|
||||
|
||||
filetype off
|
||||
for name in g:plugs_order
|
||||
if !has_key(g:plugs, name)
|
||||
continue
|
||||
endif
|
||||
let plug = g:plugs[name]
|
||||
if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for')
|
||||
let s:loaded[name] = 1
|
||||
@@ -264,7 +275,7 @@ function! plug#end()
|
||||
syntax enable
|
||||
end
|
||||
else
|
||||
call s:reload()
|
||||
call s:reload_plugins()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -272,9 +283,13 @@ function! s:loaded_names()
|
||||
return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)')
|
||||
endfunction
|
||||
|
||||
function! s:reload()
|
||||
function! s:load_plugin(spec)
|
||||
call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
|
||||
endfunction
|
||||
|
||||
function! s:reload_plugins()
|
||||
for name in s:loaded_names()
|
||||
call s:source(s:rtp(g:plugs[name]), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
|
||||
call s:load_plugin(g:plugs[name])
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@@ -397,7 +412,20 @@ function! s:reorg_rtp()
|
||||
endfunction
|
||||
|
||||
function! s:doautocmd(...)
|
||||
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
||||
if exists('#'.join(a:000, '#'))
|
||||
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:dobufread(names)
|
||||
for name in a:names
|
||||
let path = s:rtp(g:plugs[name]).'/**'
|
||||
for dir in ['ftdetect', 'ftplugin']
|
||||
if len(finddir(dir, path))
|
||||
return s:doautocmd('BufRead')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! plug#load(...)
|
||||
@@ -415,9 +443,7 @@ function! plug#load(...)
|
||||
for name in a:000
|
||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
endfor
|
||||
if exists('#BufRead')
|
||||
doautocmd BufRead
|
||||
endif
|
||||
call s:dobufread(a:000)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -453,9 +479,7 @@ function! s:lod(names, types, ...)
|
||||
endif
|
||||
call s:source(rtp, a:2)
|
||||
endif
|
||||
if exists('#User#'.name)
|
||||
call s:doautocmd('User', name)
|
||||
endif
|
||||
call s:doautocmd('User', name)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@@ -463,21 +487,19 @@ function! s:lod_ft(pat, names)
|
||||
let syn = 'syntax/'.a:pat.'.vim'
|
||||
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
||||
execute 'autocmd! PlugLOD FileType' a:pat
|
||||
if exists('#filetypeplugin#FileType')
|
||||
doautocmd filetypeplugin FileType
|
||||
endif
|
||||
if exists('#filetypeindent#FileType')
|
||||
doautocmd filetypeindent FileType
|
||||
endif
|
||||
call s:doautocmd('filetypeplugin', 'FileType')
|
||||
call s:doautocmd('filetypeindent', 'FileType')
|
||||
endfunction
|
||||
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
call s:dobufread(a:names)
|
||||
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||
endfunction
|
||||
|
||||
function! s:lod_map(map, names, prefix)
|
||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
call s:dobufread(a:names)
|
||||
let extra = ''
|
||||
while 1
|
||||
let c = getchar(0)
|
||||
@@ -486,10 +508,17 @@ function! s:lod_map(map, names, prefix)
|
||||
endif
|
||||
let extra .= nr2char(c)
|
||||
endwhile
|
||||
if v:count
|
||||
call feedkeys(v:count, 'n')
|
||||
endif
|
||||
call feedkeys('"'.v:register, 'n')
|
||||
if mode(1) == 'no'
|
||||
call feedkeys(v:operator)
|
||||
endif
|
||||
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
|
||||
endfunction
|
||||
|
||||
function! s:Plug(repo, ...)
|
||||
function! plug#(repo, ...)
|
||||
if a:0 > 1
|
||||
return s:err('Invalid number of arguments (1..2)')
|
||||
endif
|
||||
@@ -588,6 +617,7 @@ function! s:syntax()
|
||||
syn match plugRelDate /([^)]*)$/ contained
|
||||
syn match plugNotLoaded /(not loaded)$/
|
||||
syn match plugError /^x.*/
|
||||
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
|
||||
syn match plugH2 /^.*:\n-\+$/
|
||||
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
|
||||
hi def link plug1 Title
|
||||
@@ -607,6 +637,7 @@ function! s:syntax()
|
||||
hi def link plugUpdate Type
|
||||
|
||||
hi def link plugError Error
|
||||
hi def link plugDeleted Ignore
|
||||
hi def link plugRelDate Comment
|
||||
hi def link plugEdge PreProc
|
||||
hi def link plugSha Identifier
|
||||
@@ -684,6 +715,12 @@ function! s:prepare(...)
|
||||
throw 'Invalid current working directory. Cannot proceed.'
|
||||
endif
|
||||
|
||||
for evar in ['$GIT_DIR', '$GIT_WORK_TREE']
|
||||
if exists(evar)
|
||||
throw evar.' detected. Cannot proceed.'
|
||||
endif
|
||||
endfor
|
||||
|
||||
call s:job_abort()
|
||||
if s:switch_in()
|
||||
normal q
|
||||
@@ -699,10 +736,9 @@ function! s:prepare(...)
|
||||
let s:plug_buf = winbufnr(0)
|
||||
call s:assign_name()
|
||||
|
||||
silent! unmap <buffer> <cr>
|
||||
silent! unmap <buffer> L
|
||||
silent! unmap <buffer> o
|
||||
silent! unmap <buffer> X
|
||||
for k in ['<cr>', 'L', 'o', 'X', 'd', 'dd']
|
||||
execute 'silent! unmap <buffer>' k
|
||||
endfor
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable
|
||||
setf vim-plug
|
||||
if exists('g:syntax_on')
|
||||
@@ -722,15 +758,25 @@ function! s:assign_name()
|
||||
silent! execute 'f' fnameescape(name)
|
||||
endfunction
|
||||
|
||||
function! s:chsh(swap)
|
||||
let prev = [&shell, &shellredir]
|
||||
if !s:is_win && a:swap
|
||||
set shell=sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
return prev
|
||||
endfunction
|
||||
|
||||
function! s:bang(cmd, ...)
|
||||
try
|
||||
let [sh, shrd] = s:chsh(a:0)
|
||||
" FIXME: Escaping is incomplete. We could use shellescape with eval,
|
||||
" but it won't work on Windows.
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
let g:_plug_bang = '!'.escape(cmd, '#!%')
|
||||
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
||||
finally
|
||||
unlet g:_plug_bang
|
||||
let [&shell, &shellredir] = [sh, shrd]
|
||||
endtry
|
||||
return v:shell_error ? 'Exit status: ' . v:shell_error : ''
|
||||
endfunction
|
||||
@@ -758,7 +804,12 @@ function! s:do(pull, force, todo)
|
||||
let error = ''
|
||||
let type = type(spec.do)
|
||||
if type == s:TYPE.string
|
||||
let error = s:bang(spec.do)
|
||||
if spec.do[0] == ':'
|
||||
call s:load_plugin(spec)
|
||||
execute spec.do[1:]
|
||||
else
|
||||
let error = s:bang(spec.do)
|
||||
endif
|
||||
elseif type == s:TYPE.funcref
|
||||
try
|
||||
let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged')
|
||||
@@ -769,6 +820,7 @@ function! s:do(pull, force, todo)
|
||||
else
|
||||
let error = 'Invalid hook type'
|
||||
endif
|
||||
call s:switch_in()
|
||||
call setline(4, empty(error) ? (getline(4) . 'OK')
|
||||
\ : ('x' . getline(4)[1:] . error))
|
||||
if !empty(error)
|
||||
@@ -836,13 +888,14 @@ function! s:names(...)
|
||||
endfunction
|
||||
|
||||
function! s:check_ruby()
|
||||
silent! ruby require 'thread'; VIM::command('let g:plug_ruby = 1')
|
||||
if get(g:, 'plug_ruby', 0)
|
||||
unlet g:plug_ruby
|
||||
return 1
|
||||
silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'")
|
||||
if !exists('g:plug_ruby')
|
||||
redraw!
|
||||
return s:warn('echom', 'Warning: Ruby interface is broken')
|
||||
endif
|
||||
redraw!
|
||||
return s:warn('echom', 'Warning: Ruby interface is broken')
|
||||
let ruby_version = split(g:plug_ruby, '\.')
|
||||
unlet g:plug_ruby
|
||||
return s:version_requirement(ruby_version, [1, 8, 7])
|
||||
endfunction
|
||||
|
||||
function! s:update_impl(pull, force, args) abort
|
||||
@@ -995,14 +1048,14 @@ function! s:update_finish()
|
||||
if v:shell_error
|
||||
call add(s:update.errors, name)
|
||||
call s:regress_bar()
|
||||
execute pos 'd _'
|
||||
silent execute pos 'd _'
|
||||
call append(4, msg) | 4
|
||||
elseif !empty(out)
|
||||
call setline(pos, msg)
|
||||
endif
|
||||
redraw
|
||||
endfor
|
||||
4 d _
|
||||
silent 4 d _
|
||||
call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")'))
|
||||
call s:finish(s:update.pull)
|
||||
call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.')
|
||||
@@ -1119,7 +1172,7 @@ function! s:log(bullet, name, lines)
|
||||
if s:switch_in()
|
||||
let pos = s:logpos(a:name)
|
||||
if pos > 0
|
||||
execute pos 'd _'
|
||||
silent execute pos 'd _'
|
||||
if pos > winheight('.')
|
||||
let pos = 4
|
||||
endif
|
||||
@@ -1823,10 +1876,7 @@ endfunction
|
||||
|
||||
function! s:system(cmd, ...)
|
||||
try
|
||||
let [sh, shrd] = [&shell, &shellredir]
|
||||
if !s:is_win
|
||||
set shell=sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
let [sh, shrd] = s:chsh(1)
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||
finally
|
||||
@@ -1948,16 +1998,48 @@ function! s:clean(force)
|
||||
if empty(todo)
|
||||
call append(line('$'), 'Already clean.')
|
||||
else
|
||||
if a:force || s:ask('Proceed?')
|
||||
for dir in todo
|
||||
call s:rm_rf(dir)
|
||||
endfor
|
||||
call append(3, ['Removed.', ''])
|
||||
let s:clean_count = 0
|
||||
call append(3, ['Directories to delete:', ''])
|
||||
redraw!
|
||||
if a:force || s:ask_no_interrupt('Delete all directories?')
|
||||
call s:delete([6, line('$')], 1)
|
||||
else
|
||||
call append(3, ['Cancelled.', ''])
|
||||
call setline(4, 'Cancelled.')
|
||||
nnoremap <silent> <buffer> d :set opfunc=<sid>delete_op<cr>g@
|
||||
nmap <silent> <buffer> dd d_
|
||||
xnoremap <silent> <buffer> d :<c-u>call <sid>delete_op(visualmode(), 1)<cr>
|
||||
echo 'Delete the lines (d{motion}) to delete the corresponding directories'
|
||||
endif
|
||||
endif
|
||||
4
|
||||
setlocal nomodifiable
|
||||
endfunction
|
||||
|
||||
function! s:delete_op(type, ...)
|
||||
call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0)
|
||||
endfunction
|
||||
|
||||
function! s:delete(range, force)
|
||||
let [l1, l2] = a:range
|
||||
let force = a:force
|
||||
while l1 <= l2
|
||||
let line = getline(l1)
|
||||
if line =~ '^- ' && isdirectory(line[2:])
|
||||
execute l1
|
||||
redraw!
|
||||
let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1)
|
||||
let force = force || answer > 1
|
||||
if answer
|
||||
call s:rm_rf(line[2:])
|
||||
setlocal modifiable
|
||||
call setline(l1, '~'.line[1:])
|
||||
let s:clean_count += 1
|
||||
call setline(4, printf('Removed %d directories.', s:clean_count))
|
||||
setlocal nomodifiable
|
||||
endif
|
||||
endif
|
||||
let l1 += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:upgrade()
|
||||
@@ -2099,11 +2181,15 @@ function! s:preview_commit()
|
||||
return
|
||||
endif
|
||||
|
||||
execute 'pedit' sha
|
||||
wincmd P
|
||||
setlocal filetype=git buftype=nofile nobuflisted modifiable
|
||||
execute 'silent read !cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
|
||||
normal! gg"_dd
|
||||
if exists('g:plug_pwindow') && !s:is_preview_window_open()
|
||||
execute g:plug_pwindow
|
||||
execute 'e' sha
|
||||
else
|
||||
execute 'pedit' sha
|
||||
wincmd P
|
||||
endif
|
||||
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
|
||||
execute 'silent %!cd' s:shellesc(g:plugs[name].dir) '&& git show --no-color --pretty=medium' sha
|
||||
setlocal nomodifiable
|
||||
nnoremap <silent> <buffer> q :q<cr>
|
||||
wincmd p
|
||||
@@ -2189,7 +2275,7 @@ function! s:revert()
|
||||
setlocal modifiable
|
||||
normal! "_dap
|
||||
setlocal nomodifiable
|
||||
echo 'Reverted.'
|
||||
echo 'Reverted'
|
||||
endfunction
|
||||
|
||||
function! s:snapshot(force, ...) abort
|
||||
|
||||
@@ -7,19 +7,19 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||
redir => out
|
||||
tabnew a.c
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
|
||||
* The same applies to plug#load())
|
||||
redir => out
|
||||
call plug#load('ftplugin-msg')
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
q
|
||||
|
||||
|
||||
**********************************************************************
|
||||
Execute (#114 Should not contain empty path in &rtp):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
@@ -35,7 +35,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
|
||||
" Cleared on command
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
@@ -52,7 +52,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
|
||||
" Cleared on FileType
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
@@ -78,13 +78,13 @@ Execute (#131 Syntax error):
|
||||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
@@ -95,14 +95,14 @@ Execute (#139-1 Using new remote branch):
|
||||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
" Create a new branch on origin
|
||||
call system('cd /tmp/new-branch && git checkout -b new &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
|
||||
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
|
||||
\. 'git commit -m second')
|
||||
|
||||
" We're setting up two plugins so that parallel installer is used
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -125,14 +125,14 @@ Expect:
|
||||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd /tmp/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'git checkout -b brand-new &&'
|
||||
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
|
||||
\. 'git commit -m third')
|
||||
|
||||
" Test Vim installer here
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -154,19 +154,19 @@ Expect:
|
||||
|
||||
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||
" Commit on cloned repo
|
||||
call system('cd /tmp/plugged/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
|
||||
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||
|
||||
" Different commit on remote
|
||||
call system('cd /tmp/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -210,7 +210,7 @@ Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
@@ -224,7 +224,7 @@ Execute (#159: shell=/bin/tcsh):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('/tmp/plug it')
|
||||
call plug#begin('/tmp/vim-plug-test/plug it')
|
||||
Plug 'seoul256 vim'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
@@ -232,7 +232,7 @@ Execute (#154: Spaces in &rtp should not be escaped):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#184: Duplicate entries in &rtp):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
@@ -250,7 +250,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
@@ -259,19 +259,19 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
@@ -279,7 +279,7 @@ Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
|
||||
" Now unshallowed
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
@@ -289,16 +289,44 @@ Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#474: Load ftdetect files in filetypedetect augroup):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
q
|
||||
|
||||
tabnew /tmp/any.rs
|
||||
tabnew /tmp/vim-plug-test/any.rs
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
filetype detect
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
bd
|
||||
|
||||
**********************************************************************
|
||||
Execute (#489 On-demand loading with 'on' option should trigger BufRead autocmd):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug 'ftplugin-msg', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
|
||||
tabnew a.java
|
||||
redir => out
|
||||
silent! XXX
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin-java') >= 0
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (Cursor moved to another window during post-update hook):
|
||||
function! DoSplit(...)
|
||||
new
|
||||
call setline(1, 'empty')
|
||||
endfunction
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
AssertEqual 1, line('$')
|
||||
AssertEqual 'empty', getline(1)
|
||||
q!
|
||||
q
|
||||
|
||||
22
test/run
22
test/run
@@ -6,9 +6,12 @@ export BASE="$PWD"
|
||||
export PLUG_SRC="$PWD/../plug.vim"
|
||||
export PLUG_FIXTURES="$PWD/fixtures"
|
||||
mkdir -p "$PLUG_FIXTURES"
|
||||
export TEMP=/tmp/vim-plug-test
|
||||
rm -rf "$TEMP"
|
||||
mkdir -p "$TEMP"
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
cat > $TEMP/mini-vimrc << VIMRC
|
||||
set rtp+=$TEMP/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
VIMRC
|
||||
|
||||
@@ -19,7 +22,7 @@ clone() {
|
||||
}
|
||||
|
||||
clone_repos() (
|
||||
cd /tmp
|
||||
cd $TEMP
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||
@@ -77,10 +80,11 @@ DOC
|
||||
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
||||
|
||||
rm -rf /tmp/new-branch
|
||||
cd /tmp
|
||||
rm -rf $TEMP/new-branch
|
||||
cd $TEMP
|
||||
git init new-branch
|
||||
cd new-branch
|
||||
mkdir plugin
|
||||
@@ -108,10 +112,10 @@ git --version
|
||||
VIM=$(select_vim)
|
||||
echo "Selected Vim: $VIM"
|
||||
if [ "$1" = '!' ]; then
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Execute (Initialize test environment):
|
||||
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
||||
unlet! g:plugs g:plug_home g:plug_window
|
||||
|
||||
let g:plug_url_format = 'file:///tmp/%s'
|
||||
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
|
||||
let g:base_rtp = &rtp
|
||||
let g:first_rtp = split(&rtp, ',')[0]
|
||||
let g:last_rtp = split(&rtp, ',')[-1]
|
||||
|
||||
@@ -34,7 +34,7 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
||||
Execute (Test Plug command):
|
||||
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
|
||||
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual 'file:///tmp/vim-plug-test/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
||||
|
||||
@@ -43,7 +43,7 @@ Execute (Test Plug command):
|
||||
|
||||
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
|
||||
Plug 'junegunn/goyo.vim', '1.5.2'
|
||||
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||
AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
|
||||
|
||||
@@ -51,14 +51,14 @@ Execute (Test Plug command):
|
||||
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
|
||||
|
||||
" Git URI
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
||||
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||
|
||||
" vim-scripts/
|
||||
Plug 'beauty256'
|
||||
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri
|
||||
AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
|
||||
AssertEqual 'master', g:plugs.beauty256.branch
|
||||
|
||||
AssertEqual 4, len(g:plugs)
|
||||
@@ -84,7 +84,7 @@ Execute (PlugClean before installation):
|
||||
|
||||
Execute (plug#end() updates &rtp):
|
||||
" Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
" Plug 'file:///tmp/jg/vim-emoji'
|
||||
" Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
" Plug 'beauty256'
|
||||
" Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
|
||||
call plug#end()
|
||||
@@ -159,7 +159,7 @@ Expect:
|
||||
Execute (Change branch of seoul256.vim):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
Execute (PlugStatus):
|
||||
@@ -197,15 +197,15 @@ Expect:
|
||||
Execute (Change URI of seoul256.vim):
|
||||
call plug#begin()
|
||||
Plug 'junegunn.choi/seoul256.vim'
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: file:///tmp/junegunn.choi/seoul256.vim
|
||||
Invalid URI: file:///tmp/junegunn/seoul256.vim
|
||||
Expected: file:///tmp/vim-plug-test/junegunn.choi/seoul256.vim
|
||||
Invalid URI: file:///tmp/vim-plug-test/junegunn/seoul256.vim
|
||||
PlugClean required.
|
||||
- vim-emoji: OK
|
||||
Finished. 1 error(s).
|
||||
@@ -215,7 +215,7 @@ Expect:
|
||||
Execute (Corrected the URI but diverged from master):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
for _ in range(3)
|
||||
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['seoul256.vim'].dir))
|
||||
@@ -240,8 +240,8 @@ Expect:
|
||||
Execute (PlugClean! to remove seoul256.vim):
|
||||
PlugClean!
|
||||
" Three removed, emoji left
|
||||
AssertEqual 'Removed.', getline(4)
|
||||
AssertExpect '^- ', 3
|
||||
AssertEqual 'Removed 3 directories.', getline(4)
|
||||
AssertExpect '^\~ ', 3
|
||||
AssertExpect 'Diverged', 1
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
@@ -257,8 +257,8 @@ Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: file:///tmp/junegunn/vim-emoji
|
||||
Invalid URI: file:///tmp/jg/vim-emoji
|
||||
Expected: file:///tmp/vim-plug-test/junegunn/vim-emoji
|
||||
Invalid URI: file:///tmp/vim-plug-test/jg/vim-emoji
|
||||
Not found. Try PlugInstall.
|
||||
PlugClean required.
|
||||
Finished. 2 error(s).
|
||||
@@ -268,8 +268,8 @@ Expect:
|
||||
|
||||
Execute (PlugClean! to remove vim-emoji):
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 1
|
||||
AssertEqual 'Removed.', getline(4)
|
||||
AssertExpect '^\~ ', 1
|
||||
AssertEqual 'Removed 1 directories.', getline(4)
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -300,7 +300,7 @@ Execute (PlugDiff - 'No updates.'):
|
||||
Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
for repo in ['seoul256.vim', 'vim-emoji']
|
||||
for _ in range(2)
|
||||
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
endfor
|
||||
endfor
|
||||
unlet repo
|
||||
@@ -365,6 +365,22 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
AssertEqual 1, &previewwindow
|
||||
pclose
|
||||
|
||||
Execute (Test g:plug_pwindow):
|
||||
let g:plug_pwindow = 'below 5new'
|
||||
PlugDiff
|
||||
AssertExpect '^- ', 1
|
||||
execute "normal ]]jo"
|
||||
|
||||
AssertEqual 0, &previewwindow
|
||||
AssertEqual 1, winnr()
|
||||
wincmd P
|
||||
AssertEqual 1, &previewwindow
|
||||
AssertEqual 2, winnr()
|
||||
AssertEqual 5, winheight('.')
|
||||
wincmd p
|
||||
normal q
|
||||
unlet g:plug_pwindow
|
||||
|
||||
Execute (Reuse Plug window in another tab):
|
||||
let tabnr = tabpagenr()
|
||||
PlugDiff
|
||||
@@ -596,7 +612,7 @@ Execute (PlugStatus should point out that the plugin is missing):
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call RmRf(fzf)
|
||||
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf))
|
||||
Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
@@ -769,7 +785,7 @@ Execute (On update):
|
||||
call plug#end()
|
||||
|
||||
" New commits on remote
|
||||
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
@@ -841,7 +857,12 @@ Execute (PlugUpdate!):
|
||||
Execute (When submodules are not initialized):
|
||||
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
|
||||
|
||||
^ #481 submodule update should use standard shell
|
||||
let sh = &shell
|
||||
set sh=/bin/echo
|
||||
silent PlugUpdate!
|
||||
let &shell = sh
|
||||
unlet sh
|
||||
q
|
||||
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
|
||||
\ 'subsubmodule/subsubmodule should be initialized'
|
||||
@@ -856,7 +877,7 @@ Execute (Using Funcref):
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
|
||||
call plug#end()
|
||||
|
||||
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
|
||||
@@ -916,8 +937,8 @@ Execute (Should not run when failed to update):
|
||||
call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir))
|
||||
|
||||
" New commits on remote
|
||||
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
@@ -928,18 +949,31 @@ Execute (Should not run when failed to update):
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
|
||||
\ 'vim-pseudocl/not-failed should exist'
|
||||
|
||||
Execute (Vim command with : prefix):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': ':call setline(2, 12345)' }
|
||||
call plug#end()
|
||||
|
||||
PlugInstall!
|
||||
Log getline(1, '$')
|
||||
AssertEqual '12345', getline(2)
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ Overriding `dir`
|
||||
**********************************************************************
|
||||
|
||||
Execute (Using custom dir):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
call plug#end()
|
||||
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
call RmRf('/tmp/easy-align')
|
||||
call RmRf('/tmp/vim-plug-test/easy-align')
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' }
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
|
||||
call plug#end()
|
||||
AssertEqual '/tmp/easy-align/', g:plugs['vim-easy-align'].dir
|
||||
AssertEqual '/tmp/vim-plug-test/easy-align/', g:plugs['vim-easy-align'].dir
|
||||
|
||||
PlugClean!
|
||||
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
@@ -1255,11 +1289,11 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
|
||||
|
||||
" Remove z1, z2
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 2
|
||||
AssertExpect '^\~ ', 2
|
||||
AssertExpect 'Already clean', 0
|
||||
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 0
|
||||
AssertExpect '^\~ ', 0
|
||||
AssertExpect 'Already clean', 1
|
||||
q
|
||||
|
||||
@@ -1419,10 +1453,10 @@ Execute (#371 - 'as' option):
|
||||
Assert g:plugs.yogo.dir =~# '/yogo/$'
|
||||
|
||||
call plug#begin()
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/gogo'}
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/vim-plug-test/gogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['yogo'], sort(keys(g:plugs))
|
||||
AssertEqual '/tmp/gogo/', g:plugs.yogo.dir
|
||||
AssertEqual '/tmp/vim-plug-test/gogo/', g:plugs.yogo.dir
|
||||
|
||||
Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
|
||||
if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
|
||||
|
||||
Reference in New Issue
Block a user