14 Commits
0.3.2 ... 0.3.4

Author SHA1 Message Date
Junegunn Choi
f90afc9081 Remove images from repo 2014-06-23 23:39:48 +09:00
Junegunn Choi
612b9b3afd Fix test cases for travis-ci 2014-06-23 13:16:14 +09:00
Junegunn Choi
58891e05be Travis-CI integration 2014-06-23 12:57:46 +09:00
Junegunn Choi
baf7b18f73 Update test runner script 2014-06-23 12:53:51 +09:00
Junegunn Choi
cc37ed48be Improve PlugStatus message
Invalid branch/tag: %s (expected: %s). Try PlugUpdate.
2014-06-23 12:22:25 +09:00
Junegunn Choi
afe7dc6f8f Use case-sensitive match 2014-06-23 04:04:03 +09:00
Junegunn Choi
8863a3a53c Fix #28: False alarm from PlugStatus when tag used 2014-06-23 04:02:49 +09:00
Junegunn Choi
ee04a646d3 Fix: dependent plugins not loaded after initial installaion 2014-06-22 21:49:51 +09:00
Junegunn Choi
6ddee62977 Ensure ftplugin files are loaded (#24) 2014-06-22 13:09:18 +09:00
Junegunn Choi
8cf5fca9ca Revert "Ensure ftplugin files are loaded (#24)"
This reverts commit a026eb39c4.

Conflicts:
	plug.vim
2014-06-22 12:49:22 +09:00
Junegunn Choi
347fccb030 Revert "Remove FileType autocmd after loaded"
This reverts commit db3f5ad5c3.

Conflicts:
	plug.vim
2014-06-22 12:45:21 +09:00
Junegunn Choi
a026eb39c4 Ensure ftplugin files are loaded (#24)
If `filetype plugin on` is called before `plug#end()`, filetype
plugin handler is invoked before ODL autocmd from vim-plug which
updates runtimepath and ftplugin files are not loaded.
2014-06-22 10:27:15 +09:00
Junegunn Choi
4d352e1849 Revert "Clear #filetypeplugin for filetype-based ODL (#24)"
This reverts commit 1d477a1a01.
2014-06-22 10:21:58 +09:00
Junegunn Choi
db3f5ad5c3 Remove FileType autocmd after loaded 2014-06-22 09:58:14 +09:00
14 changed files with 129 additions and 74 deletions

12
.travis.yml Normal file
View File

@@ -0,0 +1,12 @@
language: vim
before_script: |
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge --enable-rubyinterp
make
sudo make install
cd -
script: |
test/run !

View File

@@ -1,11 +1,12 @@
![vim-plug](https://raw.github.com/junegunn/vim-plug/master/plug.png)
![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)
A single-file Vim plugin manager.
Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and
[Vundle](https://github.com/gmarik/vundle), but with faster parallel installer.
![](https://raw.github.com/junegunn/vim-plug/master/gif/vim-plug.gif)
![](https://raw.github.com/junegunn/i/master/vim-plug/vim-plug.gif)
### Pros.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

View File

@@ -58,7 +58,6 @@ set cpo&vim
let s:plug_source = 'https://raw.github.com/junegunn/vim-plug/master/plug.vim'
let s:plug_file = 'Plugfile'
let s:plug_buf = -1
let s:loaded = {}
let s:is_win = has('win32') || has('win64')
let s:me = expand('<sfile>:p')
@@ -123,17 +122,9 @@ function! plug#end()
augroup END
augroup! PlugLOD
endif
let lod = {}
filetype off
if exists('#filetypeplugin') &&
\ !empty(filter(values(g:plugs), 'has_key(v:val, "for")'))
unlet! g:did_load_ftplugin
augroup filetypeplugin
autocmd!
augroup END
augroup! filetypeplugin
endif
" we want to make sure the plugin directories are added to rtp in the same
" order that they are registered with the Plug command. since the s:add_rtp
" function uses ^= to add plugin directories to the front of the rtp, we
@@ -168,12 +159,21 @@ function! plug#end()
for vim in split(globpath(s:rtp(plug), 'ftdetect/**/*.vim'), '\n')
execute 'source '.vim
endfor
augroup PlugLOD
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
\ join(s:to_a(plug.for), ','), string(name), string(plug))
augroup END
for key in s:to_a(plug.for)
if !has_key(lod, key)
let lod[key] = []
endif
call add(lod[key], name)
endfor
endif
endfor
for [key, names] in items(lod)
augroup PlugLOD
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
\ key, string(key), string(reverse(names)))
augroup END
endfor
filetype plugin indent on
syntax on
endfunction
@@ -207,12 +207,12 @@ function! s:lod(plug, types)
endfor
endfunction
function! s:lod_ft(name, plug)
if has_key(s:loaded, a:name)
return
endif
call s:lod(a:plug, ['plugin', 'after'])
let s:loaded[a:name] = 1
function! s:lod_ft(pat, names)
for name in a:names
call s:lod(g:plugs[name], ['plugin', 'after'])
endfor
execute 'autocmd! PlugLOD FileType ' . a:pat
let &l:filetype = &l:filetype
endfunction
function! s:lod_cmd(cmd, bang, l1, l2, args, plug)
@@ -406,11 +406,15 @@ function! s:update_impl(pull, args) abort
normal! 2G
redraw
let len = len(g:plugs)
if has('ruby') && threads > 1
call s:update_parallel(a:pull, todo, threads)
else
call s:update_serial(a:pull, todo)
endif
if len(g:plugs) > len
call plug#end()
endif
call s:finish(a:pull)
endfunction
@@ -687,6 +691,11 @@ function! s:system(cmd)
return system(s:is_win ? '('.a:cmd.')' : a:cmd)
endfunction
function! s:system_chomp(str)
let ret = s:system(a:str)
return v:shell_error ? '' : substitute(ret, '\n$', '', '')
endfunction
function! s:git_valid(spec, check_branch, cd)
let ret = 1
let msg = 'OK'
@@ -694,7 +703,7 @@ function! s:git_valid(spec, check_branch, cd)
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 remote = result[-1]
if v:shell_error != 0
if v:shell_error
let msg = join([remote, "PlugClean required."], "\n")
let ret = 0
elseif !s:compare_git_uri(remote, a:spec.uri)
@@ -704,9 +713,13 @@ function! s:git_valid(spec, check_branch, cd)
let ret = 0
elseif a:check_branch
let branch = result[0]
if a:spec.branch != branch
let msg = 'Invalid branch: '.branch.'. Try PlugUpdate.'
let ret = 0
if a:spec.branch !=# branch
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1')
if a:spec.branch !=# tag
let msg = printf('Invalid branch/tag: %s (expected: %s). Try PlugUpdate.',
\ (empty(tag) ? branch : tag), a:spec.branch)
let ret = 0
endif
endif
endif
if a:cd | cd - | endif

View File

@@ -7,8 +7,10 @@ Test cases for vim-plug
### Run
```vim
:e workflow.vader | Vader
```
./run
./run !
```
### TODO
@@ -18,7 +20,6 @@ Test cases for the following features are currently missing:
- Output formatting
- Timeout or interrupt cleaning up git processes
- User prompt in PlugClean command
- Automatic dependency resolution using Plugfile
- Single-threaded installer
- Windows support

View File

@@ -5,15 +5,18 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null
export VADER_RTP=$TMPDIR/vader-rtp
vim -e +Vader -c ':call writefile([fnamemodify(globpath(&rtp, "autoload/vader.vim"), ":h:h")], $VADER_RTP)' +q
if [ ! -d vader.vim ]; then
git clone https://github.com/junegunn/vader.vim.git
fi
MINI_VIMRC=$TMPDIR/mini-vimrc
cat > $MINI_VIMRC << EOF
let \$MYVIMRC = '$MINI_VIMRC'
set nocompatible
set rtp=$(cat $VADER_RTP)
cat > /tmp/mini-vimrc << VIMRC
set rtp+=vader.vim
source $PLUG_SRC
EOF
VIMRC
if [ "$1" = '!' ]; then
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null
else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
fi
vim -u $MINI_VIMRC +Vader*

View File

@@ -1,5 +1,5 @@
Execute (Initialize test environment):
Save &rtp, g:plug_home, $MYVIMRC
Save &rtp, g:plugs, g:plug_home, $MYVIMRC
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
@@ -15,6 +15,15 @@ Execute (Initialize test environment):
colo default
pclose
function! PlugStatusSorted()
PlugStatus
%y
q
normal! P
%sort
g/^$/d
endfunction
let g:vimrc_reloaded = 0
let vimrc = tempname()
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
@@ -64,9 +73,15 @@ Execute (Test Plug command):
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
" Git repo with tag
Plug 'junegunn/goyo.vim', '1.5.3'
AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
" Git URI
Plug 'git@github.com:junegunn/vim-emoji.git'
AssertEqual 'git@github.com:junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
@@ -75,18 +90,20 @@ Execute (Test Plug command):
AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 3, len(g:plugs)
AssertEqual 4, len(g:plugs)
Execute (Plug command with dictionary option):
Log string(g:plugs)
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp
AssertEqual 3, len(g:plugs)
Log string(g:plugs)
AssertEqual 4, len(g:plugs)
Execute (PlugStatus before installation):
PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "Not found"'))
AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "Not found"'))
q
Execute (PlugClean before installation):
@@ -116,25 +133,44 @@ Execute (PlugClean after installation):
Execute (PlugStatus after installation):
PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "OK"'))
AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "OK"'))
q
Execute (Change tag of goyo.vim):
call plug#begin()
Plug 'junegunn/goyo.vim'
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
Finished. 1 error(s).
[=]
x goyo.vim:
Execute (PlugUpdate to set the right branch):
PlugUpdate
call PlugStatusSorted()
AssertEqual 2, g:vimrc_reloaded
Expect:
- goyo.vim: OK
Finished. 0 error(s).
[=]
Execute (Change branch of seoul256.vim):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Invalid branch: no-t_co. Try PlugUpdate.
Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
- vim-emoji: OK
Finished. 1 error(s).
[==]
@@ -143,16 +179,11 @@ Expect:
Execute (Change URI of seoul256.vim):
call plug#begin()
Plug 'junegunn.choi/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git
@@ -172,6 +203,8 @@ Expect:
Execute (PlugClean! to remove seoul256.vim):
PlugClean!
" Three removed, emoji left
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
@@ -184,16 +217,11 @@ Execute (Change GIT URI of vim-emoji):
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Expected: https://git:@github.com/junegunn/vim-emoji.git
Invalid URI: git@github.com:junegunn/vim-emoji.git
Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
Not found. Try PlugInstall.
PlugClean required.
Finished. 2 error(s).
@@ -203,6 +231,7 @@ Expect:
Execute (PlugClean! to remove vim-emoji):
PlugClean!
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
@@ -211,7 +240,7 @@ Execute (PlugClean! to remove vim-emoji):
Execute (PlugUpdate to install both again):
PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Cloning into"'))
AssertEqual 2, g:vimrc_reloaded
AssertEqual 3, g:vimrc_reloaded
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
q
@@ -219,7 +248,7 @@ Execute (PlugUpdate to install both again):
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Already up-to-date"'))
AssertEqual 3, g:vimrc_reloaded
AssertEqual 4, g:vimrc_reloaded
normal D
AssertEqual 'No updates.', getline(1)
q
@@ -328,11 +357,7 @@ Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align 1
q
Execute (TODO Check dependent plugin):
^ It is a known issue that when a dependent plugin is installed, it is not
^ immediately added to runtimepath. It only becomes available when
^ plug#end() is called.
Execute (Check dependent plugin):
Assert &rtp =~ 'pseudocl', &rtp
Given (Unaligned code):
@@ -366,6 +391,6 @@ Execute (Cleanup):
unlet g:plug_home
unlet g:vimrc_reloaded
unlet temp_plugged vader plug basertp save_rtp repo lnum
delf PlugStatusSorted
Restore
source $MYVIMRC