Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
home
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Murukesh Mohanan
home
Commits
c14623ce
Commit
c14623ce
authored
Apr 07, 2016
by
Murukesh Mohanan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vim-plug update, guard for YCM
parent
d157bb07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
95 deletions
+145
-95
.vim/autoload/plug.vim
.vim/autoload/plug.vim
+126
-92
.vim/vimrc
.vim/vimrc
+19
-3
No files found.
.vim/autoload/plug.vim
View file @
c14623ce
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
" More information: https://github.com/junegunn/vim-plug
" More information: https://github.com/junegunn/vim-plug
"
"
"
"
" Copyright (c) 201
5
Junegunn Choi
" Copyright (c) 201
6
Junegunn Choi
"
"
" MIT License
" MIT License
"
"
...
@@ -337,7 +337,12 @@ function! s:err(msg)
...
@@ -337,7 +337,12 @@ function! s:err(msg)
echohl ErrorMsg
echohl ErrorMsg
echom
'[vim-plug] '
.
a:msg
echom
'[vim-plug] '
.
a:msg
echohl None
echohl None
return
0
endfunction
function
!
s:warn
(
cmd
,
msg
)
echohl WarningMsg
execute
a:cmd
'a:msg'
echohl None
endfunction
endfunction
function
!
s:esc
(
path
)
function
!
s:esc
(
path
)
...
@@ -386,6 +391,10 @@ function! s:reorg_rtp()
...
@@ -386,6 +391,10 @@ function! s:reorg_rtp()
endif
endif
endfunction
endfunction
function
!
s:doautocmd
(...)
execute
'doautocmd'
((
v
:
version
>
703
||
has
(
'patch442'
))
?
'<nomodeline>'
:
''
)
join
(
a:000
)
endfunction
function
!
plug#
load
(...)
function
!
plug#
load
(...)
if
a:0
==
0
if
a:0
==
0
return
s:err
(
'Argument missing: plugin name(s) required'
)
return
s:err
(
'Argument missing: plugin name(s) required'
)
...
@@ -440,7 +449,7 @@ function! s:lod(names, types, ...)
...
@@ -440,7 +449,7 @@ function! s:lod(names, types, ...)
call
s:source
(
rtp
,
a:2
)
call
s:source
(
rtp
,
a:2
)
endif
endif
if
exists
(
'#User#'
.
name
)
if
exists
(
'#User#'
.
name
)
execute
'doautocmd User'
name
call
s:doautocmd
(
'User'
,
name
)
endif
endif
endfor
endfor
endfunction
endfunction
...
@@ -563,14 +572,14 @@ function! s:syntax()
...
@@ -563,14 +572,14 @@ function! s:syntax()
syn
match
plugStar
/^*/
syn
match
plugStar
/^*/
syn
match
plugMessage
/\(^- \)\@<=.*/
syn
match
plugMessage
/\(^- \)\@<=.*/
syn
match
plugName
/\(^- \)\@<=[^ ]*:/
syn
match
plugName
/\(^- \)\@<=[^ ]*:/
syn
match
plugSha
/\%(: \)\@<=[0-9a-
z
]\{4,}$/
syn
match
plugSha
/\%(: \)\@<=[0-9a-
f
]\{4,}$/
syn
match
plugTag
/(tag: [^)]\+)/
syn
match
plugTag
/(tag: [^)]\+)/
syn
match
plugInstall
/\(^+ \)\@<=[^:]*/
syn
match
plugInstall
/\(^+ \)\@<=[^:]*/
syn
match
plugUpdate
/\(^* \)\@<=[^:]*/
syn
match
plugUpdate
/\(^* \)\@<=[^:]*/
syn
match
plugCommit
/^ \X*[0-9a-
z
]\{7} .*/
contains
=
plugRelDate
,
plugEdge
,
plugTag
syn
match
plugCommit
/^ \X*[0-9a-
f
]\{7} .*/
contains
=
plugRelDate
,
plugEdge
,
plugTag
syn
match
plugEdge
/^ \X\+$/
syn
match
plugEdge
/^ \X\+$/
syn
match
plugEdge
/^ \X*/
contained nextgroup
=
plugSha
syn
match
plugEdge
/^ \X*/
contained nextgroup
=
plugSha
syn
match
plugSha
/[0-9a-
z
]\{7}/
contained
syn
match
plugSha
/[0-9a-
f
]\{7}/
contained
syn
match
plugRelDate
/([^)]*)$/
contained
syn
match
plugRelDate
/([^)]*)$/
contained
syn
match
plugNotLoaded
/(not loaded)$/
syn
match
plugNotLoaded
/(not loaded)$/
syn
match
plugError
/^x.*/
syn
match
plugError
/^x.*/
...
@@ -656,7 +665,7 @@ function! s:switch_out(...)
...
@@ -656,7 +665,7 @@ function! s:switch_out(...)
endfunction
endfunction
function
!
s:finish_bindings
()
function
!
s:finish_bindings
()
nnoremap
<
silent
>
<
buffer
>
R
:
silent
!
call
<
SID
>
retry
()<
cr
>
nnoremap
<
silent
>
<
buffer
>
R
:
call
<
SID
>
retry
()<
cr
>
nnoremap
<
silent
>
<
buffer
>
D
:
PlugDiff
<
cr
>
nnoremap
<
silent
>
<
buffer
>
D
:
PlugDiff
<
cr
>
nnoremap
<
silent
>
<
buffer
>
S
:
PlugStatus
<
cr
>
nnoremap
<
silent
>
<
buffer
>
S
:
PlugStatus
<
cr
>
nnoremap
<
silent
>
<
buffer
>
U
:
call
<
SID
>
status_update
()<
cr
>
nnoremap
<
silent
>
<
buffer
>
U
:
call
<
SID
>
status_update
()<
cr
>
...
@@ -708,6 +717,28 @@ function! s:assign_name()
...
@@ -708,6 +717,28 @@ function! s:assign_name()
silent
!
execute
'f'
fnameescape
(
name
)
silent
!
execute
'f'
fnameescape
(
name
)
endfunction
endfunction
function
!
s:bang
(
cmd
,
...)
try
" 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
g:_plug_bang
=
'!'
.
escape
(
cmd
,
'#!%'
)
execute
"normal! :execute g:_plug_bang\<cr>\<cr>"
finally
unlet
g:_plug_bang
endtry
return
v
:
shell_error ?
'Exit status: '
.
v
:
shell_error
:
''
endfunction
function
!
s:regress_bar
()
let
bar
=
substitute
(
getline
(
2
)[
1
:
-2
],
'.*\zs='
,
'x'
,
''
)
call
s:progress_bar
(
2
,
bar
,
len
(
bar
))
endfunction
function
!
s:is_updated
(
dir
)
return
!
empty
(
s:system_chomp
(
'git log --pretty=format:"%h" "HEAD...HEAD@{1}"'
,
a:dir
))
endfunction
function
!
s:do
(
pull
,
force
,
todo
)
function
!
s:do
(
pull
,
force
,
todo
)
for
[
name
,
spec
]
in
items
(
a:todo
)
for
[
name
,
spec
]
in
items
(
a:todo
)
if
!
isdirectory
(
spec
.
dir
)
if
!
isdirectory
(
spec
.
dir
)
...
@@ -715,24 +746,14 @@ function! s:do(pull, force, todo)
...
@@ -715,24 +746,14 @@ function! s:do(pull, force, todo)
endif
endif
let
installed
=
has_key
(
s:update
.
new
,
name
)
let
installed
=
has_key
(
s:update
.
new
,
name
)
let
updated
=
installed ?
0
:
let
updated
=
installed ?
0
:
\
(
a:pull
&& index
(
s:update
.
errors
,
name
)
<
0
&&
!
empty
(
s:system_chomp
(
'git log --pretty=format:"%h" "HEAD...HEAD@{1}"'
,
spec
.
dir
)
))
\
(
a:pull
&& index
(
s:update
.
errors
,
name
)
<
0
&&
s:is_updated
(
spec
.
dir
))
if
a:force
||
installed
||
updated
if
a:force
||
installed
||
updated
execute
'cd'
s:esc
(
spec
.
dir
)
execute
'cd'
s:esc
(
spec
.
dir
)
call
append
(
3
,
'- Post-update hook for '
.
name
.
' ... '
)
call
append
(
3
,
'- Post-update hook for '
.
name
.
' ... '
)
let
error
=
''
let
error
=
''
let
type
=
type
(
spec
.
do
)
let
type
=
type
(
spec
.
do
)
if
type
==
s:TYPE
.
string
if
type
==
s:TYPE
.
string
try
let
error
=
s:bang
(
spec
.
do
)
" FIXME: Escaping is incomplete. We could use shellescape with eval,
" but it won't work on Windows.
let
g:_plug_do
=
'!'
.
escape
(
spec
.
do
,
'#!%'
)
execute
"normal! :execute g:_plug_do\<cr>\<cr>"
finally
if
v
:
shell_error
let
error
=
'Exit status: '
.
v
:
shell_error
endif
unlet
g:_plug_do
endtry
elseif
type
==
s:TYPE
.
funcref
elseif
type
==
s:TYPE
.
funcref
try
try
let
status
=
installed ?
'installed'
:
(
updated ?
'updated'
:
'unchanged'
)
let
status
=
installed ?
'installed'
:
(
updated ?
'updated'
:
'unchanged'
)
...
@@ -745,6 +766,10 @@ function! s:do(pull, force, todo)
...
@@ -745,6 +766,10 @@ function! s:do(pull, force, todo)
endif
endif
call
setline
(
4
,
empty
(
error
)
?
(
getline
(
4
)
.
'OK'
)
call
setline
(
4
,
empty
(
error
)
?
(
getline
(
4
)
.
'OK'
)
\
:
(
'x'
.
getline
(
4
)[
1
:]
.
error
))
\
:
(
'x'
.
getline
(
4
)[
1
:]
.
error
))
if
!
empty
(
error
)
call
add
(
s:update
.
errors
,
name
)
call
s:regress_bar
()
endif
cd
-
cd
-
endif
endif
endfor
endfor
...
@@ -754,32 +779,14 @@ function! s:hash_match(a, b)
...
@@ -754,32 +779,14 @@ function! s:hash_match(a, b)
return
stridx
(
a:a
,
a:b
)
==
0
||
stridx
(
a:b
,
a:a
)
==
0
return
stridx
(
a:a
,
a:b
)
==
0
||
stridx
(
a:b
,
a:a
)
==
0
endfunction
endfunction
function
!
s:checkout
(
plugs
)
function
!
s:checkout
(
spec
)
for
[
name
,
spec
]
in
items
(
a:plugs
)
let
sha
=
a:spec
.
commit
let
sha
=
spec
.
commit
let
output
=
s:system
(
'git rev-parse HEAD'
,
a:spec
.
dir
)
call
append
(
3
,
'- Checking out '
.
sha
[:
6
].
' of '
.
name
.
' ... '
)
if
!
v
:
shell_error &&
!
s:hash_match
(
sha
,
s:lines
(
output
)[
0
])
redraw
let
output
=
s:system
(
\
'git fetch --depth 999999 && git checkout '
.
s:esc
(
sha
),
a:spec
.
dir
)
let
error
=
[]
endif
let
output
=
s:lines
(
s:system
(
'git rev-parse HEAD'
,
spec
.
dir
))
return
output
if
v
:
shell_error
let
error
=
output
elseif
!
s:hash_match
(
sha
,
output
[
0
])
let
output
=
s:lines
(
s:system
(
\
'git fetch --depth 999999 && git checkout '
.
sha
,
spec
.
dir
))
if
v
:
shell_error
let
error
=
output
endif
endif
if
empty
(
error
)
call
setline
(
4
,
getline
(
4
)
.
'OK'
)
else
call
setline
(
4
,
'x'
.
getline
(
4
)[
1
:]
.
'Error'
)
for
line
in
reverse
(
error
)
call
append
(
4
,
' '
.
line
)
endfor
endif
endfor
endfunction
endfunction
function
!
s:finish
(
pull
)
function
!
s:finish
(
pull
)
...
@@ -788,7 +795,7 @@ function! s:finish(pull)
...
@@ -788,7 +795,7 @@ function! s:finish(pull)
let
s
=
new_frozen
>
1
?
's'
:
''
let
s
=
new_frozen
>
1
?
's'
:
''
call
append
(
3
,
printf
(
'- Installed %d frozen plugin%s'
,
new_frozen
,
s
))
call
append
(
3
,
printf
(
'- Installed %d frozen plugin%s'
,
new_frozen
,
s
))
endif
endif
call
append
(
3
,
'- Finishing ... '
)
call
append
(
3
,
'- Finishing ... '
)
|
4
redraw
redraw
call
plug#
helptags
()
call
plug#
helptags
()
call
plug#
end
()
call
plug#
end
()
...
@@ -810,6 +817,7 @@ function! s:retry()
...
@@ -810,6 +817,7 @@ function! s:retry()
if
empty
(
s:update
.
errors
)
if
empty
(
s:update
.
errors
)
return
return
endif
endif
echo
call
s:update_impl
(
s:update
.
pull
,
s:update
.
force
,
call
s:update_impl
(
s:update
.
pull
,
s:update
.
force
,
\
extend
(
copy
(
s:update
.
errors
),
[
s:update
.
threads
]))
\
extend
(
copy
(
s:update
.
errors
),
[
s:update
.
threads
]))
endfunction
endfunction
...
@@ -822,6 +830,16 @@ function! s:names(...)
...
@@ -822,6 +830,16 @@ function! s:names(...)
return
sort
(
filter
(
keys
(
g:plugs
),
'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'
))
return
sort
(
filter
(
keys
(
g:plugs
),
'stridx(v:val, a:1) == 0 && s:is_managed(v:val)'
))
endfunction
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
endif
redraw
!
return
s:warn
(
'echom'
,
'Warning: Ruby interface is broken'
)
endfunction
function
!
s:update_impl
(
pull
,
force
,
args
)
abort
function
!
s:update_impl
(
pull
,
force
,
args
)
abort
let
args
=
copy
(
a:args
)
let
args
=
copy
(
a:args
)
let
threads
=
(
len
(
args
)
>
0
&& args
[
-1
]
=~
'^[1-9][0-9]*$'
)
?
let
threads
=
(
len
(
args
)
>
0
&& args
[
-1
]
=~
'^[1-9][0-9]*$'
)
?
...
@@ -832,10 +850,7 @@ function! s:update_impl(pull, force, args) abort
...
@@ -832,10 +850,7 @@ function! s:update_impl(pull, force, args) abort
\
filter
(
managed
,
'index(args, v:key) >= 0'
)
\
filter
(
managed
,
'index(args, v:key) >= 0'
)
if
empty
(
todo
)
if
empty
(
todo
)
echohl WarningMsg
return
s:warn
(
'echo'
,
'No plugin to '
.
(
a:pull
?
'update'
:
'install'
))
echo
'No plugin to '
.
(
a:pull
?
'update'
:
'install'
)
.
'.'
echohl None
return
endif
endif
if
!
s:is_win
&&
s:git_version_requirement
(
2
,
3
)
if
!
s:is_win
&&
s:git_version_requirement
(
2
,
3
)
...
@@ -857,13 +872,11 @@ function! s:update_impl(pull, force, args) abort
...
@@ -857,13 +872,11 @@ function! s:update_impl(pull, force, args) abort
endif
endif
if
has
(
'nvim'
)
&&
!
exists
(
'*jobwait'
)
&& threads
>
1
if
has
(
'nvim'
)
&&
!
exists
(
'*jobwait'
)
&& threads
>
1
echohl WarningMsg
call
s:warn
(
'echom'
,
'[vim-plug] Update Neovim for parallel installer'
)
echomsg
'vim-plug: update Neovim for parallel installer'
echohl None
endif
endif
let
python
=
(
has
(
'python'
)
||
has
(
'python3'
))
&&
(!
s:nvim
||
has
(
'vim_starting'
))
let
python
=
(
has
(
'python'
)
||
has
(
'python3'
))
&&
(!
s:nvim
||
has
(
'vim_starting'
))
let
ruby
=
has
(
'ruby'
)
&&
!
s:nvim
&&
(
v
:
version
>=
703
||
v
:
version
==
702
&& has
(
'patch374'
))
&&
!(
s:is_win
&& has
(
'gui_running'
))
let
ruby
=
has
(
'ruby'
)
&&
!
s:nvim
&&
(
v
:
version
>=
703
||
v
:
version
==
702
&& has
(
'patch374'
))
&&
!(
s:is_win
&& has
(
'gui_running'
))
&&
s:check_ruby
()
let
s:update
=
{
let
s:update
=
{
\
'start'
:
reltime
(),
\
'start'
:
reltime
(),
...
@@ -931,13 +944,52 @@ function! s:update_impl(pull, force, args) abort
...
@@ -931,13 +944,52 @@ function! s:update_impl(pull, force, args) abort
endif
endif
endfunction
endfunction
function
!
s:log4
(
name
,
msg
)
call
setline
(
4
,
printf
(
'- %s (%s)'
,
a:msg
,
a:name
))
redraw
endfunction
function
!
s:update_finish
()
function
!
s:update_finish
()
if
exists
(
's:git_terminal_prompt'
)
if
exists
(
's:git_terminal_prompt'
)
let
$GIT_TERMINAL_PROMPT
=
s:git_terminal_prompt
let
$GIT_TERMINAL_PROMPT
=
s:git_terminal_prompt
endif
endif
if
s:switch_in
()
if
s:switch_in
()
call
s:checkout
(
filter
(
copy
(
s:update
.
all
),
'has_key(v:val, "commit")'
))
call
append
(
3
,
'- Updating ...'
)
|
4
call
s:do
(
s:update
.
pull
,
s:update
.
force
,
filter
(
copy
(
s:update
.
all
),
'has_key(v:val, "do")'
))
for
[
name
,
spec
]
in
items
(
filter
(
copy
(
s:update
.
all
),
'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))'
))
let
pos
=
s:logpos
(
name
)
if
!
pos
continue
endif
if
has_key
(
spec
,
'commit'
)
call
s:log4
(
name
,
'Checking out '
.
spec
.
commit
)
let
out
=
s:checkout
(
spec
)
elseif
has_key
(
spec
,
'tag'
)
call
s:log4
(
name
,
'Checking out '
.
spec
.
tag
)
let
out
=
s:system
(
'git checkout -q '
.
s:esc
(
spec
.
tag
).
' 2>&1'
,
spec
.
dir
)
else
let
branch
=
s:esc
(
get
(
spec
,
'branch'
,
'master'
))
call
s:log4
(
name
,
'Merging origin/'
.
branch
)
let
out
=
s:system
(
'git checkout -q '
.
branch
.
' 2>&1'
\
.
(
has_key
(
s:update
.
new
,
name
)
?
''
:
(
'&& git merge --ff-only origin/'
.
branch
.
' 2>&1'
)),
spec
.
dir
)
endif
if
!
v
:
shell_error && filereadable
(
spec
.
dir
.
'/.gitmodules'
)
&&
\
(
s:update
.
force
||
has_key
(
s:update
.
new
,
name
)
||
s:is_updated
(
spec
.
dir
))
call
s:log4
(
name
,
'Updating submodules. This may take a while.'
)
let
out
.=
s:bang
(
'git submodule update --init --recursive 2>&1'
,
spec
.
dir
)
endif
let
msg
=
printf
(
'%s %s: %s'
,
v
:
shell_error ?
'x'
:
'-'
,
name
,
get
(
s:lines
(
out
),
-1
,
''
))
if
v
:
shell_error
call
add
(
s:update
.
errors
,
name
)
call
s:regress_bar
()
execute pos
'd _'
call
append
(
4
,
msg
)
|
4
elseif
!
empty
(
out
)
call
setline
(
pos
,
msg
)
endif
redraw
endfor
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
s:finish
(
s:update
.
pull
)
call
setline
(
1
,
'Updated. Elapsed time: '
.
split
(
reltimestr
(
reltime
(
s:update
.
start
)))[
0
]
.
' sec.'
)
call
setline
(
1
,
'Updated. Elapsed time: '
.
split
(
reltimestr
(
reltime
(
s:update
.
start
)))[
0
]
.
' sec.'
)
call
s:switch_out
(
'normal! gg'
)
call
s:switch_out
(
'normal! gg'
)
...
@@ -1025,7 +1077,7 @@ function! s:reap(name)
...
@@ -1025,7 +1077,7 @@ function! s:reap(name)
endif
endif
let
s:update
.
bar
.=
job
.
error ?
'x'
:
'='
let
s:update
.
bar
.=
job
.
error ?
'x'
:
'='
call
s:log
(
job
.
error ?
'x'
:
'-'
,
a:name
,
job
.
result
)
call
s:log
(
job
.
error ?
'x'
:
'-'
,
a:name
,
empty
(
job
.
result
)
?
'OK'
:
job
.
result
)
call
s:bar
()
call
s:bar
()
call
remove
(
s:jobs
,
a:name
)
call
remove
(
s:jobs
,
a:name
)
...
@@ -1042,12 +1094,11 @@ function! s:bar()
...
@@ -1042,12 +1094,11 @@ function! s:bar()
endfunction
endfunction
function
!
s:logpos
(
name
)
function
!
s:logpos
(
name
)
for
i
in
range
(
1
,
line
(
'$'
))
for
i
in
range
(
4
,
line
(
'$'
))
if
getline
(
i
)
=~
#
'^[-+x*] '
.
a:name
.
':'
if
getline
(
i
)
=~
#
'^[-+x*] '
.
a:name
.
':'
return
i
return
i
endif
endif
endfor
endfor
return
0
endfunction
endfunction
function
!
s:log
(
bullet
,
name
,
lines
)
function
!
s:log
(
bullet
,
name
,
lines
)
...
@@ -1093,17 +1144,12 @@ while 1 " Without TCO, Vim stack is bound to explode
...
@@ -1093,17 +1144,12 @@ while 1 " Without TCO, Vim stack is bound to explode
redraw
redraw
let
has_tag
=
has_key
(
spec
,
'tag'
)
let
has_tag
=
has_key
(
spec
,
'tag'
)
let
checkout
=
s:shellesc
(
has_tag ? spec
.
tag
:
spec
.
branch
)
let
merge
=
s:shellesc
(
has_tag ? spec
.
tag
:
'origin/'
.
spec
.
branch
)
if
!
new
if
!
new
let
error
=
s:git_validate
(
spec
,
0
)
let
error
=
s:git_validate
(
spec
,
0
)
if
empty
(
error
)
if
empty
(
error
)
if
pull
if
pull
let
fetch_opt
=
(
has_tag &&
!
empty
(
globpath
(
spec
.
dir
,
'.git/shallow'
)))
?
'--depth 99999999'
:
''
let
fetch_opt
=
(
has_tag &&
!
empty
(
globpath
(
spec
.
dir
,
'.git/shallow'
)))
?
'--depth 99999999'
:
''
call
s:spawn
(
name
,
call
s:spawn
(
name
,
printf
(
'git fetch %s %s 2>&1'
,
fetch_opt
,
prog
),
{
'dir'
:
spec
.
dir
})
\
printf
(
'(git fetch %s %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only %s 2>&1 && git submodule update --init --recursive 2>&1)'
,
\
fetch_opt
,
prog
,
checkout
,
merge
),
{
'dir'
:
spec
.
dir
})
else
else
let
s:jobs
[
name
]
=
{
'running'
:
0
,
'result'
:
'Already installed'
,
'error'
:
0
}
let
s:jobs
[
name
]
=
{
'running'
:
0
,
'result'
:
'Already installed'
,
'error'
:
0
}
endif
endif
...
@@ -1112,11 +1158,10 @@ while 1 " Without TCO, Vim stack is bound to explode
...
@@ -1112,11 +1158,10 @@ while 1 " Without TCO, Vim stack is bound to explode
endif
endif
else
else
call
s:spawn
(
name
,
call
s:spawn
(
name
,
\
printf
(
'git clone %s %s
--recursive %s -b
%s %s 2>&1'
,
\
printf
(
'git clone %s %s %s %s 2>&1'
,
\
has_tag ?
''
:
s:clone_opt
,
\
has_tag ?
''
:
s:clone_opt
,
\
prog
,
\
prog
,
\
s:shellesc
(
spec
.
uri
),
\
s:shellesc
(
spec
.
uri
),
\
checkout
,
\
s:shellesc
(
s:trim
(
spec
.
dir
))),
{
'new'
:
1
})
\
s:shellesc
(
s:trim
(
spec
.
dir
))),
{
'new'
:
1
})
endif
endif
...
@@ -1345,10 +1390,7 @@ class Plugin(object):
...
@@ -1345,10 +1390,7 @@ class Plugin(object):
self
.
args
=
args
self
.
args
=
args
self
.
buf_q
=
buf_q
self
.
buf_q
=
buf_q
self
.
lock
=
lock
self
.
lock
=
lock
tag
=
args
.
get
(
'tag'
,
0
)
self
.
tag
=
args
.
get
(
'tag'
,
0
)
self
.
checkout
=
esc
(
tag
if
tag
else
args
[
'branch'
])
self
.
merge
=
esc
(
tag
if
tag
else
'origin/'
+
args
[
'branch'
])
self
.
tag
=
tag
def manage
(
self
):
def manage
(
self
):
try
:
try
:
...
@@ -1384,15 +1426,15 @@ class Plugin(object):
...
@@ -1384,15 +1426,15 @@ class Plugin(object):
self
.
write
(
Action
.
INSTALL
,
self
.
name
,
[
'Installing ...'
])
self
.
write
(
Action
.
INSTALL
,
self
.
name
,
[
'Installing ...'
])
callback
=
functools
.
partial
(
self
.
write
,
Action
.
INSTALL
,
self
.
name
)
callback
=
functools
.
partial
(
self
.
write
,
Action
.
INSTALL
,
self
.
name
)
cmd
=
'git clone {0} {1}
--recursive {2} -b {3} {4
} 2>&1'
.
format
(
cmd
=
'git clone {0} {1}
{2} {3
} 2>&1'
.
format
(
''
if
self
.
tag
else
G_CLONE_OPT
,
G_PROGRESS
,
self
.
args
[
'uri'
],
''
if
self
.
tag
else
G_CLONE_OPT
,
G_PROGRESS
,
self
.
args
[
'uri'
],
self
.
checkout
,
esc
(
target
))
esc
(
target
))
com
=
Command
(
cmd
,
None
,
G_TIMEOUT
,
callback
,
clean
(
target
))
com
=
Command
(
cmd
,
None
,
G_TIMEOUT
,
callback
,
clean
(
target
))
result
=
com
.
execute
(
G_RETRIES
)
result
=
com
.
execute
(
G_RETRIES
)
self
.
write
(
Action
.
DONE
,
self
.
name
,
result
[
-1
:])
self
.
write
(
Action
.
DONE
,
self
.
name
,
result
[
-1
:])
def repo_uri
(
self
):
def repo_uri
(
self
):
cmd
=
'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url'
cmd
=
'git rev-parse --abbrev-ref HEAD 2>&1 && git config
-f .git/config
remote.origin.url'
command
=
Command
(
cmd
,
self
.
args
[
'dir'
],
G_TIMEOUT
,)
command
=
Command
(
cmd
,
self
.
args
[
'dir'
],
G_TIMEOUT
,)
result
=
command
.
execute
(
G_RETRIES
)
result
=
command
.
execute
(
G_RETRIES
)
return
result
[
-1
]
return
result
[
-1
]
...
@@ -1412,11 +1454,7 @@ class Plugin(object):
...
@@ -1412,11 +1454,7 @@ class Plugin(object):
self
.
write
(
Action
.
UPDATE
,
self
.
name
,
[
'Updating ...'
])
self
.
write
(
Action
.
UPDATE
,
self
.
name
,
[
'Updating ...'
])
callback
=
functools
.
partial
(
self
.
write
,
Action
.
UPDATE
,
self
.
name
)
callback
=
functools
.
partial
(
self
.
write
,
Action
.
UPDATE
,
self
.
name
)
fetch_opt
=
'--depth 99999999'
if
self
.
tag and os
.
path
.
isfile
(
os
.
path
.
join
(
self
.
args
[
'dir'
],
'.git/shallow'
))
else
''
fetch_opt
=
'--depth 99999999'
if
self
.
tag and os
.
path
.
isfile
(
os
.
path
.
join
(
self
.
args
[
'dir'
],
'.git/shallow'
))
else
''
cmds
=
[
'git fetch {0} {1}'
.
format
(
fetch_opt
,
G_PROGRESS
),
cmd
=
'git fetch {0} {1} 2>&1'
.
format
(
fetch_opt
,
G_PROGRESS
)
'git checkout -q {0}'
.
format
(
self
.
checkout
),
'git merge --ff-only {0}'
.
format
(
self
.
merge
),
'git submodule update --init --recursive'
]
cmd
=
' 2>&1 && '
.
join
(
cmds
)
com
=
Command
(
cmd
,
self
.
args
[
'dir'
],
G_TIMEOUT
,
callback
)
com
=
Command
(
cmd
,
self
.
args
[
'dir'
],
G_TIMEOUT
,
callback
)
result
=
com
.
execute
(
G_RETRIES
)
result
=
com
.
execute
(
G_RETRIES
)
self
.
write
(
Action
.
DONE
,
self
.
name
,
result
[
-1
:])
self
.
write
(
Action
.
DONE
,
self
.
name
,
result
[
-1
:])
...
@@ -1508,7 +1546,7 @@ def main():
...
@@ -1508,7 +1546,7 @@ def main():
while
not buf_q
.
empty
()
or
thr
.
active_count
()
!=
start_cnt
:
while
not buf_q
.
empty
()
or
thr
.
active_count
()
!=
start_cnt
:
try
:
try
:
action
,
name
,
msg
=
buf_q
.
get
(
True
,
0
.
25
)
action
,
name
,
msg
=
buf_q
.
get
(
True
,
0
.
25
)
buf
.
write
(
action
,
name
,
msg
)
buf
.
write
(
action
,
name
,
[
'OK'
]
if
not msg
else
msg
)
buf_q
.
task_done
()
buf_q
.
task_done
()
except queue
.
Empty
:
except queue
.
Empty
:
pass
pass
...
@@ -1602,7 +1640,7 @@ function! s:update_ruby()
...
@@ -1602,7 +1640,7 @@ function! s:update_ruby()
end
end
result
=
result
=
if
type
||
type
.
nil?
if
type
||
type
.
nil?
[
"#{b} #{name}: #{result.lines.to_a.last}"
]
[
"#{b} #{name}: #{result.lines.to_a.last
|| 'OK'
}"
]
elsif result
=~
/^Interrupted|^Timeout/
elsif result
=~
/^Interrupted|^Timeout/
[
"#{b} #{name}: #{result}"
]
[
"#{b} #{name}: #{result}"
]
else
else
...
@@ -1692,15 +1730,12 @@ function! s:update_ruby()
...
@@ -1692,15 +1730,12 @@ function! s:update_ruby()
threads
<<
Thread
.
new
{
threads
<<
Thread
.
new
{
while
pair
=
take1
.
call
while
pair
=
take1
.
call
name
=
pair
.
first
name
=
pair
.
first
dir
,
uri
,
branch
,
tag
=
pair
.
last
.
values_at *%
w
[
dir
uri branch tag
]
dir
,
uri
,
tag
=
pair
.
last
.
values_at *%
w
[
dir
uri tag
]
checkout
=
esc
(
tag ? tag
:
branch
)
merge
=
esc
(
tag ? tag
:
"origin/#{branch}"
)
subm
=
"git submodule update --init --recursive 2>&1"
exists
=
File
.
directory?
dir
exists
=
File
.
directory?
dir
ok
,
result
=
ok
,
result
=
if
exists
if
exists
chdir
=
"#{cd} #{iswin ? dir : esc(dir)}"
chdir
=
"#{cd} #{iswin ? dir : esc(dir)}"
ret
,
data
=
bt
.
call
"#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url"
,
nil
,
nil
,
nil
ret
,
data
=
bt
.
call
"#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config
-f .git/config
remote.origin.url"
,
nil
,
nil
,
nil
current_uri
=
data
.
lines
.
to_a
.
last
current_uri
=
data
.
lines
.
to_a
.
last
if
!
ret
if
!
ret
if
data
=~
/^Interrupted|^Timeout/
if
data
=~
/^Interrupted|^Timeout/
...
@@ -1716,7 +1751,7 @@ function! s:update_ruby()
...
@@ -1716,7 +1751,7 @@ function! s:update_ruby()
if
pull
if
pull
log
.
call
name
,
'Updating ...'
,
:
update
log
.
call
name
,
'Updating ...'
,
:
update
fetch_opt
=
(
tag && File
.
exist?
(
File
.
join
(
dir
,
'.git/shallow'
)))
?
'--depth 99999999'
:
''
fetch_opt
=
(
tag && File
.
exist?
(
File
.
join
(
dir
,
'.git/shallow'
)))
?
'--depth 99999999'
:
''
bt
.
call
"#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1
&& git checkout -q #{checkout} 2>&1 && git merge --ff-only #{merge} 2>&1 && #{subm}
"
,
name
,
:
update
,
nil
bt
.
call
"#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1"
,
name
,
:
update
,
nil
else
else
[
true
,
skip
]
[
true
,
skip
]
end
end
...
@@ -1724,7 +1759,7 @@ function! s:update_ruby()
...
@@ -1724,7 +1759,7 @@ function! s:update_ruby()
else
else
d
=
esc
dir
.
sub
(
%
r
{[
\\/
]+
$
},
''
)
d
=
esc
dir
.
sub
(
%
r
{[
\\/
]+
$
},
''
)
log
.
call
name
,
'Installing ...'
,
:
install
log
.
call
name
,
'Installing ...'
,
:
install
bt
.
call
"git clone #{clone_opt unless tag} #{progress}
--recursive #{uri} -b #{checkout
} #{d} 2>&1"
,
name
,
:
install
,
proc
{
bt
.
call
"git clone #{clone_opt unless tag} #{progress}
#{uri
} #{d} 2>&1"
,
name
,
:
install
,
proc
{
FileUtils
.
rm_rf
dir
FileUtils
.
rm_rf
dir
}
}
end
end
...
@@ -1793,7 +1828,7 @@ endfunction
...
@@ -1793,7 +1828,7 @@ endfunction
function
!
s:git_validate
(
spec
,
check_branch
)
function
!
s:git_validate
(
spec
,
check_branch
)
let
err
=
''
let
err
=
''
if
isdirectory
(
a:spec
.
dir
)
if
isdirectory
(
a:spec
.
dir
)
let
result
=
s:lines
(
s:system
(
'git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url'
,
a:spec
.
dir
))
let
result
=
s:lines
(
s:system
(
'git rev-parse --abbrev-ref HEAD 2>&1 && git config
-f .git/config
remote.origin.url'
,
a:spec
.
dir
))
let
remote
=
result
[
-1
]
let
remote
=
result
[
-1
]
if
v
:
shell_error
if
v
:
shell_error
let
err
=
join
([
remote
,
'PlugClean required.'
],
"\n"
)
let
err
=
join
([
remote
,
'PlugClean required.'
],
"\n"
)
...
@@ -2001,7 +2036,6 @@ function! s:is_preview_window_open()
...
@@ -2001,7 +2036,6 @@ function! s:is_preview_window_open()
wincmd
p
wincmd
p
return
1
return
1
endif
endif
return
0
endfunction
endfunction
function
!
s:find_name
(
lnum
)
function
!
s:find_name
(
lnum
)
...
@@ -2023,7 +2057,7 @@ function! s:preview_commit()
...
@@ -2023,7 +2057,7 @@ function! s:preview_commit()
let
b:plug_preview
=
!
s:is_preview_window_open
()
let
b:plug_preview
=
!
s:is_preview_window_open
()
endif
endif
let
sha
=
matchstr
(
getline
(
'.'
),
'^ \X*\zs[0-9a-
z
]\{7}'
)
let
sha
=
matchstr
(
getline
(
'.'
),
'^ \X*\zs[0-9a-
f
]\{7}'
)
if
empty
(
sha
)
if
empty
(
sha
)
return
return
endif
endif
...
@@ -2036,7 +2070,7 @@ function! s:preview_commit()
...
@@ -2036,7 +2070,7 @@ function! s:preview_commit()
execute
'pedit'
sha
execute
'pedit'
sha
wincmd
P
wincmd
P
setlocal
filetype
=
git buftype
=
nofile nobuflisted modifiable
setlocal
filetype
=
git buftype
=
nofile nobuflisted modifiable
execute
'silent read !cd'
s:shellesc
(
g:plugs
[
name
].
dir
)
'&& git show --pretty=medium'
sha
execute
'silent read !cd'
s:shellesc
(
g:plugs
[
name
].
dir
)
'&& git show --
no-color --
pretty=medium'
sha
normal
!
gg"_dd
normal
!
gg"_dd
setlocal
nomodifiable
setlocal
nomodifiable
nnoremap
<
silent
>
<
buffer
>
q
:
q
<
cr
>
nnoremap
<
silent
>
<
buffer
>
q
:
q
<
cr
>
...
...
.vim/vimrc
View file @
c14623ce
...
@@ -93,6 +93,20 @@ inoremap <Up> <C-o>gk
...
@@ -93,6 +93,20 @@ inoremap <Up> <C-o>gk
nnoremap <Down> gj
nnoremap <Down> gj
nnoremap <Up> gk
nnoremap <Up> gk
function! YCMInstallCmd()
let l:ycm_cmd = 'python2 ./install.py'
if executable('c++')
let l:ycm_cmd .= ' --clang-completer'
endif
if executable('go')
let l:ycm_cmd .= ' --gocode-completer'
endif
if executable('npm')
let l:ycm_cmd .= ' --tern-completer'
endif
return l:ycm_cmd
endfunction
"execute pathogen#infect()
"execute pathogen#infect()
call plug#begin('~/.vim/plugged')
call plug#begin('~/.vim/plugged')
Plug 'murukeshm/vim-manpager'
Plug 'murukeshm/vim-manpager'
...
@@ -112,9 +126,11 @@ Plug 'gabrielelana/vim-markdown', {'for': 'markdown'}
...
@@ -112,9 +126,11 @@ Plug 'gabrielelana/vim-markdown', {'for': 'markdown'}
Plug 'majutsushi/tagbar', {'for': ['cpp', 'c', 'go', 'sh', 'js']}
Plug 'majutsushi/tagbar', {'for': ['cpp', 'c', 'go', 'sh', 'js']}
Plug 'fatih/vim-go', {'for': 'go'}
Plug 'fatih/vim-go', {'for': 'go'}
" YCM command lifted from vim-plug readme
if executable('cmake')
Plug 'Valloric/YouCompleteMe', { 'do': 'python2 ./install.py --clang-completer --gocode-completer --tern-completer', 'for': ['cpp', 'c', 'go', 'sh', 'js', 'vim'] }
" YCM command lifted from vim-plug readme
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
Plug 'Valloric/YouCompleteMe', { 'do': YCMInstallCmd(), 'for': ['cpp', 'c', 'go', 'sh', 'js', 'vim'] }
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
endif
Plug 'godlygeek/tabular'
Plug 'godlygeek/tabular'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment