mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 22:59:15 +08:00
Fix support for vim 7.4.1689 (#3663)
This commit is contained in:
parent
44b3a99d06
commit
c0a652c028
@ -781,7 +781,7 @@ let g:spacevim_sidebar_direction = ''
|
||||
" The default plugin manager of SpaceVim.
|
||||
" if has patch 7.4.2071, the default value is dein. Otherwise it is neobundle.
|
||||
" Options are dein, neobundle, or vim-plug.
|
||||
if has('patch-7.4.2071')
|
||||
if has('patch-7.4.1689')
|
||||
let g:spacevim_plugin_manager = 'dein'
|
||||
else
|
||||
let g:spacevim_plugin_manager = 'neobundle'
|
||||
|
@ -36,7 +36,7 @@ endfunction
|
||||
let s:self = {}
|
||||
let s:self.jobs = {}
|
||||
let s:self.nvim_job = has('nvim')
|
||||
let s:self.vim_job = !has('nvim') && has('job') && has('patch-8.0.0027')
|
||||
let s:self.vim_job = !has('nvim') && has('job') && has('patch-7.4.1689')
|
||||
let s:self.vim_co = SpaceVim#api#import('vim#compatible')
|
||||
let s:self._message = []
|
||||
|
||||
@ -49,7 +49,7 @@ if !s:self.nvim_job && !s:self.vim_job
|
||||
augroup END
|
||||
endif
|
||||
|
||||
function! s:self.warn(...) abort
|
||||
function! s:self.warn(...) abort dict
|
||||
if len(a:000) == 0
|
||||
echohl WarningMsg | echom 'Current version do not support job feature, fallback to sync system()' | echohl None
|
||||
elseif len(a:000) == 1 && type(a:1) == type('')
|
||||
@ -57,25 +57,25 @@ function! s:self.warn(...) abort
|
||||
else
|
||||
endif
|
||||
endfunction
|
||||
function! s:self.warp(argv, opts) abort
|
||||
function! s:self.warp(argv, opts) abort dict
|
||||
let obj = {}
|
||||
let obj._argv = a:argv
|
||||
let obj._opts = a:opts
|
||||
let obj.in_io = get(a:opts, 'in_io', 'pipe')
|
||||
" @vimlint(EVL103, 1, a:job_id)
|
||||
function! obj._out_cb(job_id, data) abort
|
||||
function! obj._out_cb(job_id, data) abort dict
|
||||
if has_key(self._opts, 'on_stdout')
|
||||
call self._opts.on_stdout(self._opts.jobpid, [a:data], 'stdout')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! obj._err_cb(job_id, data) abort
|
||||
function! obj._err_cb(job_id, data) abort dict
|
||||
if has_key(self._opts, 'on_stderr')
|
||||
call self._opts.on_stderr(self._opts.jobpid, [a:data], 'stderr')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! obj._exit_cb(job_id, data) abort
|
||||
function! obj._exit_cb(job_id, data) abort dict
|
||||
if has_key(self._opts, 'on_exit')
|
||||
call self._opts.on_exit(self._opts.jobpid, a:data, 'exit')
|
||||
endif
|
||||
@ -98,12 +98,12 @@ function! s:self.warp(argv, opts) abort
|
||||
return obj
|
||||
endfunction
|
||||
|
||||
function! s:self.warp_nvim(argv, opts) abort
|
||||
function! s:self.warp_nvim(argv, opts) abort dict
|
||||
let obj = {}
|
||||
let obj._argv = a:argv
|
||||
let obj._opts = a:opts
|
||||
" @vimlint(EVL103, 1, a:job_id)
|
||||
function! obj.__on_stdout(id, data, event) abort
|
||||
function! obj.__on_stdout(id, data, event) abort dict
|
||||
if has_key(self._opts, 'on_stdout')
|
||||
if a:data[-1] == ''
|
||||
call self._opts.on_stdout(a:id, [self._eof . a:data[0]] + a:data[1:], 'stdout')
|
||||
@ -115,7 +115,7 @@ function! s:self.warp_nvim(argv, opts) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! obj.__on_stderr(id, data, event) abort
|
||||
function! obj.__on_stderr(id, data, event) abort dict
|
||||
if has_key(self._opts, 'on_stderr')
|
||||
if a:data[-1] == ''
|
||||
call self._opts.on_stderr(a:id, [self._eof . a:data[0]] + a:data[1:], 'stderr')
|
||||
@ -127,7 +127,7 @@ function! s:self.warp_nvim(argv, opts) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! obj.__on_exit(id, data, event) abort
|
||||
function! obj.__on_exit(id, data, event) abort dict
|
||||
if has_key(self._opts, 'on_exit')
|
||||
call self._opts.on_exit(a:id, a:data, 'exit')
|
||||
endif
|
||||
@ -151,7 +151,7 @@ function! s:self.warp_nvim(argv, opts) abort
|
||||
endfunction
|
||||
|
||||
" start a job, and return the job_id.
|
||||
function! s:self.start(argv, ...) abort
|
||||
function! s:self.start(argv, ...) abort dict
|
||||
if self.nvim_job
|
||||
try
|
||||
if len(a:000) > 0
|
||||
@ -245,7 +245,7 @@ function! s:self.start(argv, ...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:self.stop(id) abort
|
||||
function! s:self.stop(id) abort dict
|
||||
if self.nvim_job
|
||||
if has_key(self.jobs, a:id)
|
||||
call jobstop(a:id)
|
||||
@ -261,7 +261,7 @@ function! s:self.stop(id) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:self.send(id, data) abort
|
||||
function! s:self.send(id, data) abort dict
|
||||
if self.nvim_job
|
||||
if has_key(self.jobs, a:id)
|
||||
if type(a:data) == type('')
|
||||
@ -289,7 +289,7 @@ function! s:self.send(id, data) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:self.status(id) abort
|
||||
function! s:self.status(id) abort dict
|
||||
if self.nvim_job
|
||||
if has_key(self.jobs, a:id)
|
||||
return get(self.jobs, a:id)[1]
|
||||
@ -303,11 +303,11 @@ function! s:self.status(id) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:self.list() abort
|
||||
function! s:self.list() abort dict
|
||||
return copy(self.jobs)
|
||||
endfunction
|
||||
|
||||
function! s:self.info(id) abort
|
||||
function! s:self.info(id) abort dict
|
||||
let info = {}
|
||||
if self.nvim_job
|
||||
let info.status = self.status(a:id)
|
||||
@ -324,7 +324,7 @@ function! s:self.info(id) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:self.chanclose(id, type) abort
|
||||
function! s:self.chanclose(id, type) abort dict
|
||||
if self.nvim_job
|
||||
call chanclose(a:id, a:type)
|
||||
elseif self.vim_job
|
||||
@ -335,6 +335,6 @@ function! s:self.chanclose(id, type) abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:self.debug() abort
|
||||
function! s:self.debug() abort dict
|
||||
echo join(self._message, "\n")
|
||||
endfunction
|
||||
|
@ -93,6 +93,12 @@ function! SpaceVim#custom#apply(config, type) abort
|
||||
call SpaceVim#logger#info('start to apply config [' . a:type . ']')
|
||||
let options = get(a:config, 'options', {})
|
||||
for [name, value] in items(options)
|
||||
if name ==# 'filemanager'
|
||||
if value ==# 'defx' && !has("python3")
|
||||
call SpaceVim#logger#warn('defx requires +python3!', 0)
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
exe 'let g:spacevim_' . name . ' = value'
|
||||
if name ==# 'project_rooter_patterns'
|
||||
" clear rooter cache
|
||||
|
@ -26,9 +26,22 @@ let s:SYS = SpaceVim#api#import('system')
|
||||
function! SpaceVim#layers#load(layer, ...) abort
|
||||
if a:layer ==# '-l'
|
||||
call s:list_layers()
|
||||
return
|
||||
endif
|
||||
let loadable = 1
|
||||
try
|
||||
let loadable = SpaceVim#layers#{a:layer}#loadable()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
if index(s:enabled_layers, a:layer) == -1
|
||||
call add(s:enabled_layers, a:layer)
|
||||
if loadable
|
||||
call add(s:enabled_layers, a:layer)
|
||||
else
|
||||
call SpaceVim#logger#warn('Failed to load '
|
||||
\ . a:layer
|
||||
\ . ' layer, read :h SpaceVim-layer-' . a:layer
|
||||
\ . ' for more info!', 0)
|
||||
endif
|
||||
endif
|
||||
if a:0 == 1 && type(a:1) == 4
|
||||
try
|
||||
|
@ -6,8 +6,20 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section leaderf, layer-leaderf
|
||||
" @parentsection layers
|
||||
" This layer provides fuzzy finder feature which is based on leaderf, and this
|
||||
" layer requires vim compiled with `+python` or `+python3`.
|
||||
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
function! SpaceVim#layers#leaderf#loadable()
|
||||
|
||||
return s:CMP.has('python') || s:CMP.has('python3')
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#leaderf#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins,
|
||||
|
@ -117,28 +117,8 @@ function! s:install_manager() abort
|
||||
endif
|
||||
" auto install plugin manager
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
"auto install neobundle
|
||||
if filereadable(expand(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'. s:Fsep. 'README.md')
|
||||
let g:_spacevim_neobundle_installed = 1
|
||||
else
|
||||
if executable('git')
|
||||
exec '!git clone '
|
||||
\ .'https://github.com/'
|
||||
\ .'Shougo/neobundle.vim'
|
||||
\ . ' '
|
||||
\ . fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'
|
||||
let g:_spacevim_neobundle_installed = 1
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom 'You need install git!'
|
||||
echohl None
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='
|
||||
\ . fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'
|
||||
let g:_spacevim_neobundle_installed = 1
|
||||
exec 'set runtimepath+=' . g:_spacevim_root_dir . 'bundle/neobundle.vim/'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
let g:_spacevim_dein_installed = 1
|
||||
exec 'set runtimepath+=' . g:_spacevim_root_dir . 'bundle/dein.vim/'
|
||||
|
@ -26,80 +26,6 @@ let s:plugin_manager_buffer = 0
|
||||
let s:plugin_manager_buffer_lines = []
|
||||
let s:jobpid = 0
|
||||
|
||||
" install plugin manager
|
||||
function! s:install_manager() abort
|
||||
" Fsep && Psep
|
||||
if has('win16') || has('win32') || has('win64')
|
||||
let s:Psep = ';'
|
||||
let s:Fsep = '\'
|
||||
else
|
||||
let s:Psep = ':'
|
||||
let s:Fsep = '/'
|
||||
endif
|
||||
" auto install plugin manager
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
"auto install neobundle
|
||||
if filereadable(expand(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'. s:Fsep. 'README.md')
|
||||
let g:_spacevim_neobundle_installed = 1
|
||||
else
|
||||
if s:need_cmd('git')
|
||||
call s:VIM_CO.system([
|
||||
\ 'git',
|
||||
\ 'clone',
|
||||
\ 'https://github.com/Shougo/neobundle.vim',
|
||||
\ expand(g:spacevim_plugin_bundle_dir) . 'neobundle.vim'
|
||||
\ ])
|
||||
let g:_spacevim_neobundle_installed = 1
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='
|
||||
\ . fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
"auto install dein
|
||||
if filereadable(expand(g:spacevim_plugin_bundle_dir)
|
||||
\ . join(['repos', 'github.com',
|
||||
\ 'Shougo', 'dein.vim', 'README.md'],
|
||||
\ s:Fsep))
|
||||
let g:_spacevim_dein_installed = 1
|
||||
else
|
||||
if s:need_cmd('git')
|
||||
call s:VIM_CO.system([
|
||||
\ 'git',
|
||||
\ 'clone',
|
||||
\ 'https://github.com/Shougo/dein.vim',
|
||||
\ expand(g:spacevim_plugin_bundle_dir)
|
||||
\ . join(['repos', 'github.com',
|
||||
\ 'Shougo', 'dein.vim"'], s:Fsep)
|
||||
\ ])
|
||||
let g:_spacevim_dein_installed = 1
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='. fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . join(['repos', 'github.com', 'Shougo',
|
||||
\ 'dein.vim'], s:Fsep)
|
||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||
"auto install vim-plug
|
||||
if filereadable(expand(g:spacevim_data_dir.'/vim-plug/autoload/plug.vim'))
|
||||
let g:_spacevim_vim_plug_installed = 1
|
||||
else
|
||||
if s:need_cmd('curl')
|
||||
|
||||
call s:VIM_CO.system([
|
||||
\ 'curl',
|
||||
\ '-fLo',
|
||||
\ expand(g:spacevim_data_dir.'/vim-plug/autoload/plug.vim'),
|
||||
\ '--create-dirs',
|
||||
\ 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
\ ])
|
||||
let g:_spacevim_vim_plug_installed = 1
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='.g:spacevim_data_dir.'/vim-plug/'
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:need_cmd(cmd) abort
|
||||
if executable(a:cmd)
|
||||
return 1
|
||||
@ -467,11 +393,21 @@ function! s:pull(repo) abort
|
||||
endfunction
|
||||
|
||||
function! s:get_uri(repo) abort
|
||||
if a:repo.repo =~# '^[^/]\+/[^/]\+$'
|
||||
let url = 'https://github.com/' . (has_key(a:repo, 'repo') ? a:repo.repo : a:repo.orig_path)
|
||||
return url
|
||||
else
|
||||
return a:repo.repo
|
||||
if g:spacevim_plugin_manager ==# 'dein'
|
||||
if a:repo.repo =~# '^[^/]\+/[^/]\+$'
|
||||
let url = 'https://github.com/' . (has_key(a:repo, 'repo') ? a:repo.repo : a:repo.orig_path)
|
||||
return url
|
||||
else
|
||||
return a:repo.repo
|
||||
endif
|
||||
elseif g:spacevim_plugin_manager ==# 'neobundle'
|
||||
return a:repo.uri
|
||||
if has_key(a:repo, 'uri')
|
||||
return a:repo.uri
|
||||
else
|
||||
let url = 'https://github.com/' . (has_key(a:repo, 'orig_name') ? a:repo.orig_name : a:repo.orig_path)
|
||||
return url
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -189,7 +189,7 @@ function! dein#disable(names) abort
|
||||
return dein#util#_disable(a:names)
|
||||
endfunction
|
||||
function! dein#config(arg, ...) abort
|
||||
return type(a:arg) != v:t_list ?
|
||||
return type(a:arg) != 3 ?
|
||||
\ dein#util#_config(a:arg, get(a:000, 0, {})) :
|
||||
\ map(copy(a:arg), 'dein#util#_config(v:val, a:1)')
|
||||
endfunction
|
||||
|
@ -4,6 +4,9 @@
|
||||
" License: MIT license
|
||||
"=============================================================================
|
||||
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
|
||||
function! dein#autoload#_source(...) abort
|
||||
let plugins = empty(a:000) ? values(g:dein#_plugins) :
|
||||
\ dein#util#_convert2list(a:1)
|
||||
@ -11,7 +14,7 @@ function! dein#autoload#_source(...) abort
|
||||
return
|
||||
endif
|
||||
|
||||
if type(plugins[0]) != v:t_dict
|
||||
if type(plugins[0]) != 4
|
||||
let plugins = map(dein#util#_convert2list(a:1),
|
||||
\ 'get(g:dein#_plugins, v:val, {})')
|
||||
endif
|
||||
@ -116,11 +119,11 @@ function! s:source_events(event, plugins) abort
|
||||
return
|
||||
endif
|
||||
|
||||
let prev_autocmd = execute('autocmd ' . a:event)
|
||||
let prev_autocmd = s:CMP.execute('autocmd ' . a:event)
|
||||
|
||||
call dein#autoload#_source(a:plugins)
|
||||
|
||||
let new_autocmd = execute('autocmd ' . a:event)
|
||||
let new_autocmd = s:CMP.execute('autocmd ' . a:event)
|
||||
|
||||
if a:event ==# 'InsertCharPre'
|
||||
" Queue this key again
|
||||
@ -321,7 +324,7 @@ function! s:get_input() abort
|
||||
|
||||
while 1
|
||||
let char = getchar()
|
||||
let input .= (type(char) == v:t_number) ? nr2char(char) : char
|
||||
let input .= (type(char) == 0) ? nr2char(char) : char
|
||||
|
||||
let idx = stridx(input, termstr)
|
||||
if idx >= 1
|
||||
|
@ -597,7 +597,7 @@ function! s:lock_revision(process, context) abort
|
||||
if empty(cmd) || plugin.new_rev ==# get(plugin, 'rev', '')
|
||||
" Skipped.
|
||||
return 0
|
||||
elseif type(cmd) == v:t_string && cmd =~# '^E: '
|
||||
elseif type(cmd) == 1 && cmd =~# '^E: '
|
||||
" Errored.
|
||||
call s:error(plugin.path)
|
||||
call s:error(cmd[3:])
|
||||
@ -671,7 +671,7 @@ function! dein#install#_system(command) abort
|
||||
" let job = s:Job.start()
|
||||
" let exitval = job.wait()
|
||||
|
||||
if !has('nvim') && type(a:command) == v:t_list
|
||||
if !has('nvim') && type(a:command) == 3
|
||||
" system() does not support List arguments in Vim.
|
||||
let command = s:args2string(a:command)
|
||||
else
|
||||
@ -936,7 +936,7 @@ function! s:init_variables(context) abort
|
||||
endfunction
|
||||
function! s:convert_args(args) abort
|
||||
let args = s:iconv(a:args, &encoding, 'char')
|
||||
if type(args) != v:t_list
|
||||
if type(args) != 3
|
||||
let args = split(&shell) + split(&shellcmdflag) + [args]
|
||||
endif
|
||||
return args
|
||||
@ -997,7 +997,7 @@ function! s:sync(plugin, context) abort
|
||||
return
|
||||
endif
|
||||
|
||||
if type(cmd) == v:t_string && cmd =~# '^E: '
|
||||
if type(cmd) == 1 && cmd =~# '^E: '
|
||||
" Errored.
|
||||
|
||||
call s:print_progress_message(s:get_plugin_message(
|
||||
@ -1239,7 +1239,7 @@ function! s:iconv(expr, from, to) abort
|
||||
return a:expr
|
||||
endif
|
||||
|
||||
if type(a:expr) == v:t_list
|
||||
if type(a:expr) == 3
|
||||
return map(copy(a:expr), 'iconv(v:val, a:from, a:to)')
|
||||
else
|
||||
let result = iconv(a:expr, a:from, a:to)
|
||||
@ -1413,7 +1413,7 @@ function! s:strwidthpart_reverse(str, width) abort
|
||||
endfunction
|
||||
|
||||
function! s:args2string(args) abort
|
||||
return type(a:args) == v:t_string ? a:args :
|
||||
return type(a:args) == 1 ? a:args :
|
||||
\ dein#util#_is_windows() ?
|
||||
\ dein#install#_args2string_windows(a:args) :
|
||||
\ dein#install#_args2string_unix(a:args)
|
||||
|
@ -104,7 +104,7 @@ function! dein#parse#_dict(plugin) abort
|
||||
let plugin.path .= '/' . plugin.script_type
|
||||
endif
|
||||
|
||||
if has_key(plugin, 'depends') && type(plugin.depends) != v:t_list
|
||||
if has_key(plugin, 'depends') && type(plugin.depends) != 3
|
||||
let plugin.depends = [plugin.depends]
|
||||
endif
|
||||
|
||||
@ -137,7 +137,7 @@ function! dein#parse#_dict(plugin) abort
|
||||
\ && stridx(plugin.rtp, dein#util#_get_base_path()) == 0
|
||||
endif
|
||||
|
||||
if has_key(plugin, 'if') && type(plugin.if) == v:t_string
|
||||
if has_key(plugin, 'if') && type(plugin.if) == 1
|
||||
let plugin.if = eval(a:plugin.if)
|
||||
endif
|
||||
|
||||
@ -145,7 +145,7 @@ function! dein#parse#_dict(plugin) abort
|
||||
for hook in filter([
|
||||
\ 'hook_add', 'hook_source',
|
||||
\ 'hook_post_source', 'hook_post_update',
|
||||
\ ], 'has_key(plugin, v:val) && type(plugin[v:val]) == v:t_string')
|
||||
\ ], 'has_key(plugin, v:val) && type(plugin[v:val]) == 1')
|
||||
let plugin[hook] = substitute(plugin[hook],
|
||||
\ '\n\s*\\\|\%(^\|\n\)\s*"[^\n]*', '', 'g')
|
||||
endfor
|
||||
@ -160,7 +160,7 @@ function! dein#parse#_load_toml(filename, default) abort
|
||||
call dein#util#_error(v:exception)
|
||||
return 1
|
||||
endtry
|
||||
if type(toml) != v:t_dict
|
||||
if type(toml) != 4
|
||||
call dein#util#_error('Invalid toml file: ' . a:filename)
|
||||
return 1
|
||||
endif
|
||||
@ -236,7 +236,7 @@ function! dein#parse#_plugins2toml(plugins) abort
|
||||
call add(toml, "'''")
|
||||
else
|
||||
call add(toml, key . ' = ' . string(
|
||||
\ (type(val) == v:t_list && len(val) == 1) ? val[0] : val))
|
||||
\ (type(val) == 3 && len(val) == 1) ? val[0] : val))
|
||||
endif
|
||||
unlet! val
|
||||
endfor
|
||||
@ -280,8 +280,8 @@ function! s:parse_lazy(plugin) abort
|
||||
\ 'on_ft', 'on_path', 'on_cmd', 'on_func', 'on_map',
|
||||
\ 'on_source', 'on_event',
|
||||
\ ], 'has_key(a:plugin, v:val)
|
||||
\ && type(a:plugin[v:val]) != v:t_list
|
||||
\ && type(a:plugin[v:val]) != v:t_dict
|
||||
\ && type(a:plugin[v:val]) != 3
|
||||
\ && type(a:plugin[v:val]) != 4
|
||||
\')
|
||||
let a:plugin[key] = [a:plugin[key]]
|
||||
endfor
|
||||
@ -328,11 +328,11 @@ function! s:generate_dummy_commands(plugin) abort
|
||||
endfunction
|
||||
function! s:generate_dummy_mappings(plugin) abort
|
||||
let a:plugin.dummy_mappings = []
|
||||
let items = type(a:plugin.on_map) == v:t_dict ?
|
||||
let items = type(a:plugin.on_map) == 4 ?
|
||||
\ map(items(a:plugin.on_map),
|
||||
\ "[split(v:val[0], '\\zs'), dein#util#_convert2list(v:val[1])]") :
|
||||
\ map(copy(a:plugin.on_map),
|
||||
\ "type(v:val) == v:t_list ?
|
||||
\ "type(v:val) == 3 ?
|
||||
\ [split(v:val[0], '\\zs'), v:val[1:]] :
|
||||
\ [['n', 'x'], [v:val]]")
|
||||
for [modes, mappings] in items
|
||||
|
@ -325,9 +325,9 @@ function! s:_put_dict(dict, key, value) abort
|
||||
|
||||
let ref = a:dict
|
||||
for key in keys[ : -2]
|
||||
if has_key(ref, key) && type(ref[key]) == v:t_dict
|
||||
if has_key(ref, key) && type(ref[key]) == 4
|
||||
let ref = ref[key]
|
||||
elseif has_key(ref, key) && type(ref[key]) == v:t_list
|
||||
elseif has_key(ref, key) && type(ref[key]) == 3
|
||||
let ref = ref[key][-1]
|
||||
else
|
||||
let ref[key] = {}
|
||||
@ -345,7 +345,7 @@ function! s:_put_array(dict, key, value) abort
|
||||
for key in keys[ : -2]
|
||||
let ref[key] = get(ref, key, {})
|
||||
|
||||
if type(ref[key]) == v:t_list
|
||||
if type(ref[key]) == 3
|
||||
let ref = ref[key][-1]
|
||||
else
|
||||
let ref = ref[key]
|
||||
|
@ -149,8 +149,8 @@ function! dein#util#_is_powershell() abort
|
||||
return dein#install#_is_async() && fnamemodify(&shell, ':t:r') =~? 'powershell\|pwsh'
|
||||
endfunction
|
||||
function! dein#util#_has_job() abort
|
||||
return (has('nvim') && exists('v:t_list'))
|
||||
\ || (has('patch-8.0.0027') && has('job'))
|
||||
return has('nvim')
|
||||
\ || (has('patch-7.4.1689') && has('job'))
|
||||
endfunction
|
||||
|
||||
function! dein#util#_check_lazy_plugins() abort
|
||||
@ -211,7 +211,7 @@ function! dein#util#_save_cache(vimrcs, is_state, is_starting) abort
|
||||
\ 'hook_add', 'hook_source',
|
||||
\ 'hook_post_source', 'hook_post_update',
|
||||
\ ], 'has_key(plugin, v:val)
|
||||
\ && type(plugin[v:val]) == v:t_func')
|
||||
\ && type(plugin[v:val]) == 2')
|
||||
call remove(plugin, hook)
|
||||
endfor
|
||||
endfor
|
||||
@ -328,7 +328,7 @@ function! dein#util#_save_state(is_starting) abort
|
||||
let lines += s:skipempty(g:dein#_hook_add)
|
||||
endif
|
||||
for plugin in dein#util#_tsort(values(dein#get()))
|
||||
if has_key(plugin, 'hook_add') && type(plugin.hook_add) == v:t_string
|
||||
if has_key(plugin, 'hook_add') && type(plugin.hook_add) == 1
|
||||
let lines += s:skipempty(plugin.hook_add)
|
||||
endif
|
||||
endfor
|
||||
@ -484,9 +484,9 @@ function! dein#util#_end() abort
|
||||
endif
|
||||
endfunction
|
||||
function! dein#util#_config(arg, dict) abort
|
||||
let name = type(a:arg) == v:t_dict ?
|
||||
let name = type(a:arg) == 4 ?
|
||||
\ g:dein#name : a:arg
|
||||
let dict = type(a:arg) == v:t_dict ?
|
||||
let dict = type(a:arg) == 4 ?
|
||||
\ a:arg : a:dict
|
||||
if !has_key(g:dein#_plugins, name)
|
||||
\ || g:dein#_plugins[name].sourced
|
||||
@ -517,7 +517,7 @@ function! dein#util#_execute_hook(plugin, hook) abort
|
||||
try
|
||||
let g:dein#plugin = a:plugin
|
||||
|
||||
if type(a:hook) == v:t_string
|
||||
if type(a:hook) == 1
|
||||
call s:execute(a:hook)
|
||||
else
|
||||
call call(a:hook, [])
|
||||
@ -539,7 +539,7 @@ function! dein#util#_set_hook(plugins, hook_name, hook) abort
|
||||
endif
|
||||
let plugin = g:dein#_plugins[name]
|
||||
let plugin[a:hook_name] =
|
||||
\ type(a:hook) != v:t_string ? a:hook :
|
||||
\ type(a:hook) != 1 ? a:hook :
|
||||
\ substitute(a:hook, '\n\s*\\\|\%(^\|\n\)\s*"[^\n]*', '', 'g')
|
||||
if a:hook_name ==# 'hook_add'
|
||||
call dein#util#_execute_hook(plugin, plugin[a:hook_name])
|
||||
@ -597,13 +597,13 @@ function! dein#util#_globlist(path) abort
|
||||
endfunction
|
||||
|
||||
function! dein#util#_convert2list(expr) abort
|
||||
return type(a:expr) ==# v:t_list ? copy(a:expr) :
|
||||
\ type(a:expr) ==# v:t_string ?
|
||||
return type(a:expr) ==# 3 ? copy(a:expr) :
|
||||
\ type(a:expr) ==# 1 ?
|
||||
\ (a:expr ==# '' ? [] : split(a:expr, '\r\?\n', 1))
|
||||
\ : [a:expr]
|
||||
endfunction
|
||||
function! dein#util#_split(expr) abort
|
||||
return type(a:expr) ==# v:t_list ? copy(a:expr) :
|
||||
return type(a:expr) ==# 3 ? copy(a:expr) :
|
||||
\ split(a:expr, '\r\?\n')
|
||||
endfunction
|
||||
|
||||
@ -630,7 +630,7 @@ function! dein#util#_get_plugins(plugins) abort
|
||||
return empty(a:plugins) ?
|
||||
\ values(dein#get()) :
|
||||
\ filter(map(dein#util#_convert2list(a:plugins),
|
||||
\ 'type(v:val) == v:t_dict ? v:val : dein#get(v:val)'),
|
||||
\ 'type(v:val) == 4 ? v:val : dein#get(v:val)'),
|
||||
\ '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
@ -713,7 +713,7 @@ function! dein#util#_check_install(plugins) abort
|
||||
endfunction
|
||||
|
||||
function! s:msg2list(expr) abort
|
||||
return type(a:expr) ==# v:t_list ? a:expr : split(a:expr, '\n')
|
||||
return type(a:expr) ==# 3 ? a:expr : split(a:expr, '\n')
|
||||
endfunction
|
||||
function! s:skipempty(string) abort
|
||||
return filter(split(a:string, '\n'), "v:val !=# ''")
|
||||
@ -725,7 +725,7 @@ function! s:escape(path) abort
|
||||
endfunction
|
||||
|
||||
function! s:sort(list, expr) abort
|
||||
if type(a:expr) == v:t_func
|
||||
if type(a:expr) == 2
|
||||
return sort(a:list, a:expr)
|
||||
endif
|
||||
let s:expr = a:expr
|
||||
|
@ -100,7 +100,7 @@ endfunction
|
||||
" Neovim can send \0 by using \n splitted list but in Vim.
|
||||
" So replace all \n in \n splitted list to ''
|
||||
function! s:_job_send(data) abort dict
|
||||
let data = type(a:data) == v:t_list
|
||||
let data = type(a:data) == 3
|
||||
\ ? join(map(a:data, 'substitute(v:val, "\n", '''', ''g'')'), "\n")
|
||||
\ : a:data
|
||||
return ch_sendraw(self.__job, data)
|
||||
|
1
bundle/neobundle.vim/.gitignore
vendored
Normal file
1
bundle/neobundle.vim/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
doc/tags
|
13
bundle/neobundle.vim/.travis.yml
Normal file
13
bundle/neobundle.vim/.travis.yml
Normal file
@ -0,0 +1,13 @@
|
||||
language: viml
|
||||
|
||||
sudo: false
|
||||
|
||||
before_script:
|
||||
- vim --version
|
||||
- git clone https://github.com/syngan/vim-vimlint /tmp/vim-vimlint
|
||||
- git clone https://github.com/ynkdir/vim-vimlparser /tmp/vim-vimlparser
|
||||
- git clone https://github.com/thinca/vim-themis
|
||||
|
||||
script:
|
||||
- sh /tmp/vim-vimlint/bin/vimlint.sh -l /tmp/vim-vimlint -p /tmp/vim-vimlparser -e EVL103=1 -e EVL102.l:_=1 autoload
|
||||
- make test
|
7
bundle/neobundle.vim/LICENSE-MIT.txt
Normal file
7
bundle/neobundle.vim/LICENSE-MIT.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (C) 2010 http://github.com/gmarik
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
bundle/neobundle.vim/Makefile
Normal file
15
bundle/neobundle.vim/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
test: vim-themis
|
||||
vim-themis/bin/themis --reporter spec test/commands.vim test/parse.vim test/sample.vim test/tsort.vim test/toml.vim
|
||||
vim-themis/bin/themis --reporter spec test/source.vim
|
||||
vim-themis/bin/themis --reporter spec test/lock.vim
|
||||
|
||||
# Use existing vim-themis install from ~/.vim, or clone it.
|
||||
vim-themis:
|
||||
existing=$(firstword $(wildcard ~/.vim/*bundle*/*themis*/plugin/themis.vim)); \
|
||||
if [ -n "$$existing" ]; then \
|
||||
( cd test && ln -s $$(dirname $$(dirname $$existing)) vim-themis ); \
|
||||
else \
|
||||
git clone https://github.com/thinca/vim-themis vim-themis; \
|
||||
fi
|
||||
|
||||
.PHONY: test
|
148
bundle/neobundle.vim/README.md
Normal file
148
bundle/neobundle.vim/README.md
Normal file
@ -0,0 +1,148 @@
|
||||
[](https://waffle.io/Shougo/neobundle.vim)
|
||||
|
||||
**Note**: Active developement on NeoBundle has stopped. The only future changes will be bug fixes.
|
||||
|
||||
Please see [Dein.vim](https://github.com/Shougo/dein.vim) -- A faster, well-tested plugin manager for Vim and Neovim. It can do everything NeoBundle does, including asynchronous installs.
|
||||
|
||||
## About
|
||||
|
||||
NeoBundle is a next generation Vim plugin manager. This plugin is based on
|
||||
[Vundle](https://github.com/gmarik/vundle), but I renamed and added tons of
|
||||
features, while Vundle tends to stay simple.
|
||||
|
||||
Requirements:
|
||||
* Vim 7.2.051 or above.
|
||||
* "git" command in $PATH (if you want to install github or vim.org plugins)
|
||||
|
||||
Recommends:
|
||||
* [vimproc](https://github.com/Shougo/vimproc.vim) if you want to
|
||||
install/update asynchronously in Unite interface.
|
||||
|
||||
Note: In :NeoBundleUpdate/:NeoBundleInstall commands, you can parallel update by
|
||||
vimproc, but you cannot do other work unlike Unite interface.
|
||||
|
||||
Note: Neobundle is not a stable plugin manager. If you want a stable plugin
|
||||
manager, you should use Vundle plugin. It well works widely and it is more
|
||||
tested. If you want to use extended features, you can use neobundle.
|
||||
|
||||
Vundle features: Stable, simple, good for beginners
|
||||
|
||||
Neobundle features: Early development (may break compatibility), very complex,
|
||||
good for plugin power users (for example, 50+ plugins and over 1000 lines
|
||||
.vimrc, ...)
|
||||
|
||||
Note: Neobundle only accepts "https" or "ssh".
|
||||
https://glyph.twistedmatrix.com/2015/11/editor-malware.html
|
||||
|
||||
## How it works
|
||||
|
||||
Plugins are defined in NeoBundle by calling `NeoBundle '<plugin repository
|
||||
location>'`. NeoBundle assumes Github as the default location for plugins, so
|
||||
for most plugins you can simply use `NeoBundle 'username/plugin'` rather than
|
||||
using the absolute URL of the plugin. These calls should be made in your
|
||||
.vimrc file. Once you have defined these, you must call `NeoBundleInstall`,
|
||||
and NeoBundle will clone all of the repos into the desired folder (generally
|
||||
`~/.vim/bundle`) and load them into Vim. If you want to update these
|
||||
repositories, simply call `NeoBundleUpdate`.
|
||||
|
||||
A few other useful commands:
|
||||
- `:NeoBundleList` - list configured bundles
|
||||
- `:NeoBundleInstall(!)` - install (update) bundles
|
||||
|
||||
Refer to `:help neobundle` for more examples and for a full list of commands.
|
||||
|
||||
## Quick start
|
||||
|
||||
### 1. Install NeoBundle
|
||||
|
||||
#### If you are using Unix/Linux or Mac OS X.
|
||||
|
||||
1. Run below script.
|
||||
|
||||
```
|
||||
$ curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh > install.sh
|
||||
$ sh ./install.sh
|
||||
```
|
||||
Complete.
|
||||
|
||||
#### If you want to install manually or you are using Windows.
|
||||
|
||||
1. Setup NeoBundle:
|
||||
|
||||
```
|
||||
$ mkdir ~/.vim/bundle
|
||||
$ git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
|
||||
```
|
||||
|
||||
2. Configure bundles:
|
||||
|
||||
Sample `.vimrc`:
|
||||
|
||||
```vim
|
||||
" Note: Skip initialization for vim-tiny or vim-small.
|
||||
if 0 | endif
|
||||
|
||||
if &compatible
|
||||
set nocompatible " Be iMproved
|
||||
endif
|
||||
|
||||
" Required:
|
||||
set runtimepath+=~/.vim/bundle/neobundle.vim/
|
||||
|
||||
" Required:
|
||||
call neobundle#begin(expand('~/.vim/bundle/'))
|
||||
|
||||
" Let NeoBundle manage NeoBundle
|
||||
" Required:
|
||||
NeoBundleFetch 'Shougo/neobundle.vim'
|
||||
|
||||
" My Bundles here:
|
||||
" Refer to |:NeoBundle-examples|.
|
||||
" Note: You don't set neobundle setting in .gvimrc!
|
||||
|
||||
call neobundle#end()
|
||||
|
||||
" Required:
|
||||
filetype plugin indent on
|
||||
|
||||
" If there are uninstalled bundles found on startup,
|
||||
" this will conveniently prompt you to install them.
|
||||
NeoBundleCheck
|
||||
```
|
||||
|
||||
### 2. Install configured bundles
|
||||
|
||||
Launch `vim`, run `:NeoBundleInstall` or `:Unite neobundle/install` (required
|
||||
unite.vim) Or Command run `bin/neoinstall` or `vim +NeoBundleInstall +qall`
|
||||
|
||||
|
||||
## How to test
|
||||
|
||||
Run `make test` command in command line(required vim-themis).
|
||||
|
||||
https://github.com/thinca/vim-themis
|
||||
|
||||
|
||||
## Advantages over Vundle
|
||||
|
||||
1. Plugin prefixed command name (:Bundle vs :NeoBundle).
|
||||
2. Support for vimproc (asynchronous update/install).
|
||||
3. Support for unite.vim interface (update/install/search).
|
||||
4. Support for revision locking.
|
||||
5. Support for multiple version control systems (Subversion/Git).
|
||||
6. Support for lazy initialization for optimizing startup time.
|
||||
7. and so on...
|
||||
|
||||
## Tips
|
||||
|
||||
If you use a single .vimrc across systems where build programs are
|
||||
named differently (e.g. GNU Make is often `gmake` on non-GNU
|
||||
systems), the following pattern is useful:
|
||||
|
||||
```vim
|
||||
let g:make = 'gmake'
|
||||
if system('uname -o') =~ '^GNU/'
|
||||
let g:make = 'make'
|
||||
endif
|
||||
NeoBundle 'Shougo/vimproc.vim', {'build': {'unix': g:make}}
|
||||
```
|
448
bundle/neobundle.vim/autoload/neobundle.vim
Normal file
448
bundle/neobundle.vim/autoload/neobundle.vim
Normal file
@ -0,0 +1,448 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Check 'term' option value.
|
||||
if exists('g:loaded_neobundle') && &term ==# 'builtin_gui'
|
||||
echoerr 'neobundle is initialized in .gvimrc!'
|
||||
\' neobundle must be initialized in .vimrc.'
|
||||
endif
|
||||
|
||||
if v:version < 702
|
||||
echoerr 'neobundle does not work this version of Vim (' . v:version . ').'
|
||||
finish
|
||||
endif
|
||||
|
||||
" Global options definition." "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#log_filename', '', 'g:neobundle_log_filename')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#default_site', 'github', 'g:neobundle_default_site')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#enable_name_conversion', 0)
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#default_options', {})
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#install_max_processes', 8,
|
||||
\ 'g:unite_source_neobundle_install_max_processes')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#install_process_timeout', 120)
|
||||
"}}}
|
||||
|
||||
let g:neobundle#tapped = {}
|
||||
let g:neobundle#hooks = {}
|
||||
let s:neobundle_dir = ''
|
||||
let s:neobundle_runtime_dir = neobundle#util#substitute_path_separator(
|
||||
\ fnamemodify(expand('<sfile>'), ':p:h:h'))
|
||||
|
||||
command! -nargs=+
|
||||
\ NeoBundle
|
||||
\ call neobundle#parser#bundle(
|
||||
\ substitute(<q-args>, '\s"[^"]\+$', '', ''))
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleCheck
|
||||
\ call neobundle#commands#check()
|
||||
|
||||
command! -nargs=? -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleCheckUpdate
|
||||
\ call neobundle#commands#check_update(<q-args>)
|
||||
|
||||
command! -nargs=+
|
||||
\ NeoBundleLazy
|
||||
\ call neobundle#parser#lazy(
|
||||
\ substitute(<q-args>, '\s"[^"]\+$', '', ''))
|
||||
|
||||
command! -nargs=+
|
||||
\ NeoBundleFetch
|
||||
\ call neobundle#parser#fetch(
|
||||
\ substitute(<q-args>, '\s"[^"]\+$', '', ''))
|
||||
|
||||
command! -nargs=1 -complete=dir -bar
|
||||
\ NeoBundleLocal
|
||||
\ call neobundle#local(<q-args>, {})
|
||||
|
||||
command! -nargs=+ -bar
|
||||
\ NeoBundleDirectInstall
|
||||
\ call neobundle#parser#direct(
|
||||
\ substitute(<q-args>, '\s"[^"]\+$', '', ''))
|
||||
|
||||
command! -nargs=* -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_lazy_bundles
|
||||
\ NeoBundleSource
|
||||
\ call neobundle#commands#source([<f-args>])
|
||||
|
||||
command! -nargs=+ -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleDisable
|
||||
\ call neobundle#config#disable(<f-args>)
|
||||
|
||||
command! -nargs=? -bang -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleInstall
|
||||
\ call neobundle#commands#install(
|
||||
\ '!' == '<bang>', <q-args>)
|
||||
command! -nargs=? -bang -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleUpdate
|
||||
\ call neobundle#commands#install(
|
||||
\ ('!' == '<bang>' ? 2 : 1), <q-args>)
|
||||
|
||||
command! -nargs=+ -bang -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleReinstall
|
||||
\ call neobundle#commands#reinstall(<q-args>)
|
||||
|
||||
command! -nargs=? -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleGC
|
||||
\ call neobundle#commands#gc(<q-args>)
|
||||
|
||||
command! -nargs=? -bang -bar
|
||||
\ NeoBundleList
|
||||
\ call neobundle#commands#list()
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleDocs
|
||||
\ call neobundle#commands#helptags(
|
||||
\ neobundle#config#get_enabled_bundles())
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleLog
|
||||
\ echo join(neobundle#installer#get_log(), "\n")
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleUpdatesLog
|
||||
\ echo join(neobundle#installer#get_updates_log(), "\n")
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleExtraEdit
|
||||
\ execute 'edit' fnameescape(
|
||||
\ neobundle#get_neobundle_dir()).'/extra_bundles.vim'
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleCount
|
||||
\ echo len(neobundle#config#get_neobundles())
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleSaveCache
|
||||
\ call neobundle#commands#save_cache()
|
||||
command! -bar
|
||||
\ NeoBundleLoadCache
|
||||
\ call neobundle#util#print_error(
|
||||
\ 'NeoBundleLoadCache is deprecated command.') |
|
||||
\ call neobundle#util#print_error(
|
||||
\ 'It will be removed in the next version.') |
|
||||
\ call neobundle#util#print_error(
|
||||
\ 'Please use neobundle#load_cache() instead.') |
|
||||
\ call neobundle#commands#load_cache([$MYVIMRC])
|
||||
command! -bar
|
||||
\ NeoBundleClearCache
|
||||
\ call neobundle#commands#clear_cache()
|
||||
|
||||
command! -nargs=1 -bar
|
||||
\ -complete=customlist,neobundle#commands#complete_bundles
|
||||
\ NeoBundleRollback
|
||||
\ call neobundle#commands#rollback(<f-args>)
|
||||
|
||||
command! -nargs=+ -bar
|
||||
\ NeoBundleLock
|
||||
\ call neobundle#commands#lock(<f-args>)
|
||||
|
||||
command! -bar
|
||||
\ NeoBundleRemotePlugins
|
||||
\ call neobundle#commands#remote_plugins()
|
||||
|
||||
function! neobundle#rc(...) abort "{{{
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#rc() is removed function.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please use neobundle#begin()/neobundle#end() instead.')
|
||||
return 1
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#begin(...) abort "{{{
|
||||
if a:0 > 0
|
||||
let path = a:1
|
||||
else
|
||||
" Use default path
|
||||
let paths = filter(split(globpath(&runtimepath,
|
||||
\ 'bundle', 1), '\n'), 'isdirectory(v:val)')
|
||||
if empty(paths)
|
||||
let rtps = neobundle#util#split_rtp(&runtimepath)
|
||||
if empty(rtps)
|
||||
call neobundle#util#print_error(
|
||||
\ 'Invalid runtimepath is detected.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return 1
|
||||
endif
|
||||
|
||||
let paths = [rtps[0].'/bundle']
|
||||
endif
|
||||
|
||||
let path = paths[0]
|
||||
endif
|
||||
|
||||
return neobundle#init#_rc(path)
|
||||
endfunction"}}}
|
||||
function! neobundle#append() abort "{{{
|
||||
call neobundle#config#append()
|
||||
endfunction"}}}
|
||||
function! neobundle#end() abort "{{{
|
||||
call neobundle#config#final()
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#add(repository, ...) abort "{{{
|
||||
let options = get(a:000, 0, {})
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ a:repository, [options])
|
||||
if empty(bundle)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let bundle.orig_arg = [a:repository, options]
|
||||
call neobundle#config#add(bundle)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
function! neobundle#add_meta(name, ...) abort "{{{
|
||||
let metadata = neobundle#metadata#get(a:name)
|
||||
if empty(metadata)
|
||||
call neobundle#util#print_error(
|
||||
\ 'Plugin name "' . a:name . '" is not found.')
|
||||
return {}
|
||||
endif
|
||||
|
||||
let repository = substitute(metadata.url, '^git://', 'https://', '')
|
||||
let options = { 'name' : a:name }
|
||||
if has_key(metadata, 'addon-info')
|
||||
\ && has_key(metadata['addon-info'], 'dependencies')
|
||||
let options.depends = map(keys(metadata['addon-info'].dependencies),
|
||||
\ "substitute(neobundle#metadata#get(v:val).url,
|
||||
\ '^git://', 'https://', '')")
|
||||
endif
|
||||
call extend(options, get(a:000, 0, {}))
|
||||
|
||||
return neobundle#add(repository, options)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#set_neobundle_dir(path) abort "{{{
|
||||
let s:neobundle_dir = a:path
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_neobundle_dir() abort "{{{
|
||||
if s:neobundle_dir == ''
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle directory is empty.')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let dir = s:neobundle_dir
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
return dir
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_runtime_dir() abort "{{{
|
||||
return s:neobundle_runtime_dir
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_tags_dir() abort "{{{
|
||||
if s:neobundle_dir == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let dir = s:neobundle_dir . '/.neobundle/doc'
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
return dir
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_rtp_dir() abort "{{{
|
||||
if s:neobundle_dir == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let dir = s:neobundle_dir . '/.neobundle'
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
return dir
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#source(bundle_names) abort "{{{
|
||||
return neobundle#config#source(a:bundle_names)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#local(localdir, ...) abort "{{{
|
||||
return neobundle#parser#local(
|
||||
\ a:localdir, get(a:000, 0, {}), get(a:000, 1, ['*']))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#exists_not_installed_bundles() abort "{{{
|
||||
return !empty(neobundle#get_not_installed_bundles([]))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#is_installed(...) abort "{{{
|
||||
return type(get(a:000, 0, [])) == type([]) ?
|
||||
\ !empty(neobundle#_get_installed_bundles(get(a:000, 0, []))) :
|
||||
\ neobundle#config#is_installed(a:1)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#is_sourced(name) abort "{{{
|
||||
return neobundle#config#is_sourced(a:name)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#has_cache() abort "{{{
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#has_cache() is deprecated function.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'It will be removed in the next version.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please use neobundle#load_cache() instead.')
|
||||
|
||||
return filereadable(neobundle#commands#get_cache_file())
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#load_cache(...) abort "{{{
|
||||
let vimrcs = len(a:000) == 0 ? [$MYVIMRC] : a:000
|
||||
return neobundle#commands#load_cache(vimrcs)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_not_installed_bundle_names() abort "{{{
|
||||
return map(neobundle#get_not_installed_bundles([]), 'v:val.name')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_not_installed_bundles(bundle_names) abort "{{{
|
||||
let bundles = empty(a:bundle_names) ?
|
||||
\ neobundle#config#get_neobundles() :
|
||||
\ neobundle#config#fuzzy_search(a:bundle_names)
|
||||
|
||||
call neobundle#installer#_load_install_info(bundles)
|
||||
|
||||
return filter(copy(bundles), "
|
||||
\ !v:val.disabled && v:val.path != '' && !v:val.local
|
||||
\ && !isdirectory(neobundle#util#expand(v:val.path))
|
||||
\")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get_force_not_installed_bundles(bundle_names) abort "{{{
|
||||
let bundles = empty(a:bundle_names) ?
|
||||
\ neobundle#config#get_neobundles() :
|
||||
\ neobundle#config#fuzzy_search(a:bundle_names)
|
||||
|
||||
call neobundle#installer#_load_install_info(bundles)
|
||||
|
||||
return filter(copy(bundles), "
|
||||
\ !v:val.disabled && v:val.path != '' && !v:val.local
|
||||
\ && (!isdirectory(neobundle#util#expand(v:val.path))
|
||||
\ || v:val.install_rev !=#
|
||||
\ neobundle#installer#get_revision_number(v:val))
|
||||
\")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#get(name) abort "{{{
|
||||
return neobundle#config#get(a:name)
|
||||
endfunction"}}}
|
||||
function! neobundle#get_hooks(name) abort "{{{
|
||||
return get(neobundle#config#get(a:name), 'hooks', {})
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#tap(name) abort "{{{
|
||||
let g:neobundle#tapped = neobundle#get(a:name)
|
||||
let g:neobundle#hooks = get(neobundle#get(a:name), 'hooks', {})
|
||||
return !empty(g:neobundle#tapped) && !g:neobundle#tapped.disabled
|
||||
endfunction"}}}
|
||||
function! neobundle#untap() abort "{{{
|
||||
let g:neobundle#tapped = {}
|
||||
let g:neobundle#hooks = {}
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#bundle(arg, ...) abort "{{{
|
||||
let opts = get(a:000, 0, {})
|
||||
call map(neobundle#util#convert2list(a:arg),
|
||||
\ "neobundle#config#add(neobundle#parser#_init_bundle(
|
||||
\ v:val, [deepcopy(opts)]))")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config(arg, ...) abort "{{{
|
||||
" Use neobundle#tapped or name.
|
||||
return type(a:arg) == type({}) ?
|
||||
\ neobundle#config#set(g:neobundle#tapped.name, a:arg) :
|
||||
\ type(a:arg) == type('') ?
|
||||
\ neobundle#config#set(a:arg, a:1) :
|
||||
\ map(copy(a:arg), "neobundle#config#set(v:val, deepcopy(a:1))")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#call_hook(hook_name, ...) abort "{{{
|
||||
let bundles = neobundle#util#convert2list(
|
||||
\ (empty(a:000) ? neobundle#config#get_neobundles() : a:1))
|
||||
let bundles = filter(copy(bundles),
|
||||
\ 'has_key(v:val.hooks, a:hook_name)')
|
||||
|
||||
if a:hook_name ==# 'on_source' || a:hook_name ==# 'on_post_source'
|
||||
let bundles = filter(neobundle#config#tsort(filter(bundles,
|
||||
\ 'neobundle#config#is_sourced(v:val.name) &&
|
||||
\ neobundle#config#is_installed(v:val.name)')),
|
||||
\ 'has_key(v:val.hooks, a:hook_name)')
|
||||
endif
|
||||
|
||||
for bundle in bundles
|
||||
if type(bundle.hooks[a:hook_name]) == type('')
|
||||
execute 'source' fnameescape(bundle.hooks[a:hook_name])
|
||||
else
|
||||
call call(bundle.hooks[a:hook_name], [bundle], bundle)
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#_get_installed_bundles(bundle_names) abort "{{{
|
||||
let bundles = empty(a:bundle_names) ?
|
||||
\ neobundle#config#get_neobundles() :
|
||||
\ neobundle#config#search(a:bundle_names)
|
||||
|
||||
return filter(copy(bundles),
|
||||
\ 'neobundle#config#is_installed(v:val.name)')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#load_toml(filename, ...) abort "{{{
|
||||
let opts = get(a:000, 0, {})
|
||||
return neobundle#parser#load_toml(a:filename, opts)
|
||||
endfunction"}}}
|
||||
|
||||
let s:init_vim_path = fnamemodify(expand('<sfile>'), ':h')
|
||||
\ . '/neobundle/init.vim'
|
||||
function! neobundle#get_cache_version() abort "{{{
|
||||
return getftime(s:init_vim_path)
|
||||
endfunction "}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
332
bundle/neobundle.vim/autoload/neobundle/TOML.vim
Normal file
332
bundle/neobundle.vim/autoload/neobundle/TOML.vim
Normal file
@ -0,0 +1,332 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
"
|
||||
" public api
|
||||
"
|
||||
function! neobundle#TOML#parse(text) abort
|
||||
let input = {
|
||||
\ 'text': a:text,
|
||||
\ 'p': 0,
|
||||
\ 'length': strlen(a:text),
|
||||
\}
|
||||
return s:_parse(input)
|
||||
endfunction
|
||||
|
||||
function! neobundle#TOML#parse_file(filename) abort
|
||||
if !filereadable(a:filename)
|
||||
throw printf("vital: Text.TOML: No such file `%s'.", a:filename)
|
||||
endif
|
||||
|
||||
let text = join(readfile(a:filename), "\n")
|
||||
" fileencoding is always utf8
|
||||
return neobundle#TOML#parse(iconv(text, 'utf8', &encoding))
|
||||
endfunction
|
||||
|
||||
"
|
||||
" private api
|
||||
"
|
||||
" work around: '[^\r\n]*' doesn't work well in old-vim, but "[^\r\n]*" works well
|
||||
let s:skip_pattern = '\C^\%(\_s\+\|' . "#[^\r\n]*" . '\)'
|
||||
let s:table_name_pattern = '\%([^ [:tab:]#.[\]=]\+\)'
|
||||
let s:table_key_pattern = s:table_name_pattern
|
||||
|
||||
function! s:_skip(input) abort
|
||||
while s:_match(a:input, '\%(\_s\|#\)')
|
||||
let a:input.p = matchend(a:input.text, s:skip_pattern, a:input.p)
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:_consume(input, pattern) abort
|
||||
call s:_skip(a:input)
|
||||
let end = matchend(a:input.text, '\C^' . a:pattern, a:input.p)
|
||||
|
||||
if end == -1
|
||||
call s:_error(a:input)
|
||||
elseif end == a:input.p
|
||||
return ''
|
||||
endif
|
||||
|
||||
let matched = strpart(a:input.text, a:input.p, end - a:input.p)
|
||||
let a:input.p = end
|
||||
return matched
|
||||
endfunction
|
||||
|
||||
function! s:_match(input, pattern) abort
|
||||
return match(a:input.text, '\C^' . a:pattern, a:input.p) != -1
|
||||
endfunction
|
||||
|
||||
function! s:_eof(input) abort
|
||||
return a:input.p >= a:input.length
|
||||
endfunction
|
||||
|
||||
function! s:_error(input) abort
|
||||
let buf = []
|
||||
let offset = 0
|
||||
while (a:input.p + offset) < a:input.length && a:input.text[a:input.p + offset] !~# "[\r\n]"
|
||||
let buf += [a:input.text[a:input.p + offset]]
|
||||
let offset += 1
|
||||
endwhile
|
||||
|
||||
throw printf("vital: Text.TOML: Illegal toml format at `%s'.", join(buf, ''))
|
||||
endfunction
|
||||
|
||||
function! s:_parse(input) abort
|
||||
let data = {}
|
||||
|
||||
call s:_skip(a:input)
|
||||
while !s:_eof(a:input)
|
||||
if s:_match(a:input, '[^ [:tab:]#.[\]]')
|
||||
let key = s:_key(a:input)
|
||||
call s:_equals(a:input)
|
||||
let value = s:_value(a:input)
|
||||
|
||||
call s:_put_dict(data, key, value)
|
||||
|
||||
unlet value
|
||||
elseif s:_match(a:input, '\[\[')
|
||||
let [key, value] = s:_array_of_tables(a:input)
|
||||
|
||||
call s:_put_array(data, key, value)
|
||||
|
||||
unlet value
|
||||
elseif s:_match(a:input, '\[')
|
||||
let [key, value] = s:_table(a:input)
|
||||
|
||||
call s:_put_dict(data, key, value)
|
||||
|
||||
unlet value
|
||||
else
|
||||
call s:_error(a:input)
|
||||
endif
|
||||
call s:_skip(a:input)
|
||||
endwhile
|
||||
|
||||
return data
|
||||
endfunction
|
||||
|
||||
function! s:_key(input) abort
|
||||
let s = s:_consume(a:input, s:table_key_pattern)
|
||||
return s
|
||||
endfunction
|
||||
|
||||
function! s:_equals(input) abort
|
||||
call s:_consume(a:input, '=')
|
||||
return '='
|
||||
endfunction
|
||||
|
||||
function! s:_value(input) abort
|
||||
call s:_skip(a:input)
|
||||
|
||||
if s:_match(a:input, '"\{3}')
|
||||
return s:_multiline_basic_string(a:input)
|
||||
elseif s:_match(a:input, '"\{1}')
|
||||
return s:_basic_string(a:input)
|
||||
elseif s:_match(a:input, "'\\{3}")
|
||||
return s:_multiline_literal(a:input)
|
||||
elseif s:_match(a:input, "'\\{1}")
|
||||
return s:_literal(a:input)
|
||||
elseif s:_match(a:input, '\[')
|
||||
return s:_array(a:input)
|
||||
elseif s:_match(a:input, '\%(true\|false\)')
|
||||
return s:_boolean(a:input)
|
||||
elseif s:_match(a:input, '\d\{4}-')
|
||||
return s:_datetime(a:input)
|
||||
elseif s:_match(a:input, '[+-]\?\%(\d\+\.\d\|\d\+\%(\.\d\+\)\?[eE]\)')
|
||||
return s:_float(a:input)
|
||||
else
|
||||
return s:_integer(a:input)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
" String
|
||||
"
|
||||
function! s:_basic_string(input) abort
|
||||
let s = s:_consume(a:input, '"\%(\\"\|[^"]\)*"')
|
||||
let s = s[1 : -2]
|
||||
return s:_unescape(s)
|
||||
endfunction
|
||||
|
||||
function! s:_multiline_basic_string(input) abort
|
||||
let s = s:_consume(a:input, '"\{3}\_.\{-}"\{3}')
|
||||
let s = s[3 : -4]
|
||||
let s = substitute(s, "^\n", '', '')
|
||||
let s = substitute(s, '\\' . "\n" . '\_s*', '', 'g')
|
||||
return s:_unescape(s)
|
||||
endfunction
|
||||
|
||||
function! s:_literal(input) abort
|
||||
let s = s:_consume(a:input, "'[^']*'")
|
||||
return s[1 : -2]
|
||||
endfunction
|
||||
|
||||
function! s:_multiline_literal(input) abort
|
||||
let s = s:_consume(a:input, "'\\{3}.\\{-}'\\{3}")
|
||||
let s = s[3 : -4]
|
||||
let s = substitute(s, "^\n", '', '')
|
||||
return s
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Integer
|
||||
"
|
||||
function! s:_integer(input) abort
|
||||
let s = s:_consume(a:input, '[+-]\?\d\+')
|
||||
return str2nr(s)
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Float
|
||||
"
|
||||
function! s:_float(input) abort
|
||||
if s:_match(a:input, '[+-]\?[0-9.]\+[eE][+-]\?\d\+')
|
||||
return s:_exponent(a:input)
|
||||
else
|
||||
return s:_fractional(a:input)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:_fractional(input) abort
|
||||
let s = s:_consume(a:input, '[+-]\?[0-9.]\+')
|
||||
return str2float(s)
|
||||
endfunction
|
||||
|
||||
function! s:_exponent(input) abort
|
||||
let s = s:_consume(a:input, '[+-]\?[0-9.]\+[eE][+-]\?\d\+')
|
||||
return str2float(s)
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Boolean
|
||||
"
|
||||
function! s:_boolean(input) abort
|
||||
let s = s:_consume(a:input, '\%(true\|false\)')
|
||||
return (s ==# 'true') ? 1 : 0
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Datetime
|
||||
"
|
||||
function! s:_datetime(input) abort
|
||||
let s = s:_consume(a:input, '\d\{4}-\d\{2}-\d\{2}T\d\{2}:\d\{2}:\d\{2}\%(Z\|-\?\d\{2}:\d\{2}\|\.\d\+-\d\{2}:\d\{2}\)')
|
||||
return s
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Array
|
||||
"
|
||||
function! s:_array(input) abort
|
||||
let ary = []
|
||||
let _ = s:_consume(a:input, '\[')
|
||||
call s:_skip(a:input)
|
||||
while !s:_eof(a:input) && !s:_match(a:input, '\]')
|
||||
let ary += [s:_value(a:input)]
|
||||
call s:_consume(a:input, ',\?')
|
||||
call s:_skip(a:input)
|
||||
endwhile
|
||||
let _ = s:_consume(a:input, '\]')
|
||||
return ary
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Table
|
||||
"
|
||||
function! s:_table(input) abort
|
||||
let tbl = {}
|
||||
let name = s:_consume(a:input, '\[\s*' . s:table_name_pattern . '\%(\s*\.\s*' . s:table_name_pattern . '\)*\s*\]')
|
||||
let name = name[1 : -2]
|
||||
call s:_skip(a:input)
|
||||
" while !s:_eof(a:input) && !s:_match(a:input, '\[\{1,2}[a-zA-Z0-9.]\+\]\{1,2}')
|
||||
while !s:_eof(a:input) && !s:_match(a:input, '\[')
|
||||
let key = s:_key(a:input)
|
||||
call s:_equals(a:input)
|
||||
let value = s:_value(a:input)
|
||||
|
||||
let tbl[key] = value
|
||||
|
||||
unlet value
|
||||
call s:_skip(a:input)
|
||||
endwhile
|
||||
return [name, tbl]
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Array of tables
|
||||
"
|
||||
function! s:_array_of_tables(input) abort
|
||||
let tbl = {}
|
||||
let name = s:_consume(a:input, '\[\[\s*' . s:table_name_pattern . '\%(\s*\.\s*' . s:table_name_pattern . '\)*\s*\]\]')
|
||||
let name = name[2 : -3]
|
||||
call s:_skip(a:input)
|
||||
" while !s:_eof(a:input) && !s:_match(a:input, '\[\{1,2}[a-zA-Z0-9.]\+\]\{1,2}')
|
||||
while !s:_eof(a:input) && !s:_match(a:input, '\[')
|
||||
let key = s:_key(a:input)
|
||||
call s:_equals(a:input)
|
||||
let value = s:_value(a:input)
|
||||
|
||||
let tbl[key] = value
|
||||
|
||||
unlet value
|
||||
call s:_skip(a:input)
|
||||
endwhile
|
||||
return [name, [tbl]]
|
||||
endfunction
|
||||
|
||||
function! s:_unescape(text) abort
|
||||
let text = a:text
|
||||
let text = substitute(text, '\\"', '"', 'g')
|
||||
let text = substitute(text, '\\b', "\b", 'g')
|
||||
let text = substitute(text, '\\t', "\t", 'g')
|
||||
let text = substitute(text, '\\n', "\n", 'g')
|
||||
let text = substitute(text, '\\f', "\f", 'g')
|
||||
let text = substitute(text, '\\r', "\r", 'g')
|
||||
let text = substitute(text, '\\/', "/", 'g')
|
||||
let text = substitute(text, '\\\\', '\', 'g')
|
||||
let text = substitute(text, '\C\\u\(\x\{4}\)', '\=s:_nr2char("0x" . submatch(1))', 'g')
|
||||
let text = substitute(text, '\C\\U\(\x\{8}\)', '\=s:_nr2char("0x" . submatch(1))', 'g')
|
||||
return text
|
||||
endfunction
|
||||
|
||||
function! s:_nr2char(nr) abort
|
||||
return iconv(nr2char(a:nr), &encoding, 'utf8')
|
||||
endfunction
|
||||
|
||||
function! s:_put_dict(dict, key, value) abort
|
||||
let keys = split(a:key, '\.')
|
||||
|
||||
let ref = a:dict
|
||||
for key in keys[ : -2]
|
||||
if has_key(ref, key) && type(ref[key]) == type({})
|
||||
let ref = ref[key]
|
||||
elseif has_key(ref, key) && type(ref[key]) == type([])
|
||||
let ref = ref[key][-1]
|
||||
else
|
||||
let ref[key] = {}
|
||||
let ref = ref[key]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let ref[keys[-1]] = a:value
|
||||
endfunction
|
||||
|
||||
function! s:_put_array(dict, key, value) abort
|
||||
let keys = split(a:key, '\.')
|
||||
|
||||
let ref = a:dict
|
||||
for key in keys[ : -2]
|
||||
let ref[key] = get(ref, key, {})
|
||||
|
||||
if type(ref[key]) == type([])
|
||||
let ref = ref[key][-1]
|
||||
else
|
||||
let ref = ref[key]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let ref[keys[-1]] = get(ref, keys[-1], []) + a:value
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vim:set et ts=2 sts=2 sw=2 tw=0:
|
275
bundle/neobundle.vim/autoload/neobundle/autoload.vim
Normal file
275
bundle/neobundle.vim/autoload/neobundle/autoload.vim
Normal file
@ -0,0 +1,275 @@
|
||||
"=============================================================================
|
||||
" FILE: autoload.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#autoload#init() abort "{{{
|
||||
let s:active_auto_source = 0
|
||||
let s:loaded_path = 0
|
||||
|
||||
augroup neobundle
|
||||
autocmd FileType *
|
||||
\ call s:on_filetype()
|
||||
autocmd FuncUndefined *
|
||||
\ call s:on_function()
|
||||
autocmd InsertEnter *
|
||||
\ call s:on_insert()
|
||||
augroup END
|
||||
|
||||
if has('patch-7.4.414')
|
||||
autocmd neobundle CmdUndefined *
|
||||
\ call s:on_command_prefix()
|
||||
endif
|
||||
|
||||
augroup neobundle-path
|
||||
autocmd!
|
||||
augroup END
|
||||
for event in [
|
||||
\ 'BufRead', 'BufCreate', 'BufEnter',
|
||||
\ 'BufWinEnter', 'BufNew', 'VimEnter', 'BufNewFile'
|
||||
\ ]
|
||||
execute 'autocmd neobundle-path' event
|
||||
\ "* call s:on_path(expand('<afile>'), ".string(event) . ")"
|
||||
endfor
|
||||
|
||||
augroup neobundle-focus
|
||||
autocmd!
|
||||
autocmd CursorHold * if s:active_auto_source
|
||||
\ | call s:source_focus()
|
||||
\ | endif
|
||||
autocmd FocusLost * let s:active_auto_source = 1 | call s:source_focus()
|
||||
autocmd FocusGained * let s:active_auto_source = 0
|
||||
augroup END
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#autoload#_command(command, name, args, bang, line1, line2) abort "{{{
|
||||
call neobundle#config#source(a:name)
|
||||
|
||||
if !exists(':' . a:command)
|
||||
call neobundle#util#print_error(
|
||||
\ printf('command %s is not found.', a:command))
|
||||
return
|
||||
endif
|
||||
|
||||
let range = (a:line1 == a:line2) ? '' :
|
||||
\ (a:line1==line("'<") && a:line2==line("'>")) ?
|
||||
\ "'<,'>" : a:line1.",".a:line2
|
||||
|
||||
try
|
||||
execute range.a:command.a:bang a:args
|
||||
catch /^Vim\%((\a\+)\)\=:E481/
|
||||
" E481: No range allowed
|
||||
execute a:command.a:bang a:args
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#autoload#_command_dummy_complete(arglead, cmdline, cursorpos) abort "{{{
|
||||
" Load plugins
|
||||
let command = tolower(matchstr(a:cmdline, '\a\S*'))
|
||||
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "!empty(filter(map(copy(v:val.pre_cmd), 'tolower(v:val)'),
|
||||
\ 'stridx(command, v:val) == 0'))")
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
|
||||
" Print the candidates
|
||||
call feedkeys("\<C-d>", 'n')
|
||||
return ['']
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#autoload#_mapping(mapping, name, mode) abort "{{{
|
||||
let cnt = v:count > 0 ? v:count : ''
|
||||
|
||||
let input = s:get_input()
|
||||
|
||||
call neobundle#config#source(a:name)
|
||||
|
||||
if a:mode ==# 'v' || a:mode ==# 'x'
|
||||
call feedkeys('gv', 'n')
|
||||
elseif a:mode ==# 'o'
|
||||
" TODO: omap
|
||||
" v:prevcount?
|
||||
" Cancel waiting operator mode.
|
||||
call feedkeys(v:operator, 'm')
|
||||
endif
|
||||
|
||||
call feedkeys(cnt, 'n')
|
||||
|
||||
let mapping = a:mapping
|
||||
while mapping =~ '<[[:alnum:]-]\+>'
|
||||
let mapping = substitute(mapping, '\c<Leader>',
|
||||
\ get(g:, 'mapleader', '\'), 'g')
|
||||
let mapping = substitute(mapping, '\c<LocalLeader>',
|
||||
\ get(g:, 'maplocalleader', '\'), 'g')
|
||||
let ctrl = matchstr(mapping, '<\zs[[:alnum:]-]\+\ze>')
|
||||
execute 'let mapping = substitute(
|
||||
\ mapping, "<' . ctrl . '>", "\<' . ctrl . '>", "")'
|
||||
endwhile
|
||||
call feedkeys(mapping . input, 'm')
|
||||
|
||||
return ''
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#autoload#_source(bundle_name) abort "{{{
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "index(v:val.on_source, a:bundle_name) >= 0")
|
||||
if !empty(bundles)
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#autoload#_set_function_prefixes(bundles) abort "{{{
|
||||
for bundle in filter(copy(a:bundles), "empty(v:val.pre_func)")
|
||||
let bundle.pre_func =
|
||||
\ neobundle#util#uniq(map(split(globpath(
|
||||
\ bundle.path, 'autoload/**/*.vim', 1), "\n"),
|
||||
\ "substitute(matchstr(
|
||||
\ neobundle#util#substitute_path_separator(
|
||||
\ fnamemodify(v:val, ':r')),
|
||||
\ '/autoload/\\zs.*$'), '/', '#', 'g').'#'"))
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_filetype() abort "{{{
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "!empty(v:val.on_ft)")
|
||||
for filetype in add(neobundle#util#get_filetypes(), 'all')
|
||||
call neobundle#config#source_bundles(filter(copy(bundles),"
|
||||
\ index(v:val.on_ft, filetype) >= 0"))
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_insert() abort "{{{
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "v:val.on_i")
|
||||
if !empty(bundles)
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
doautocmd InsertEnter
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_function() abort "{{{
|
||||
let function = expand('<amatch>')
|
||||
let function_prefix = substitute(function, '[^#]*$', '', '')
|
||||
if function_prefix =~# '^neobundle#'
|
||||
\ || function_prefix ==# 'vital#'
|
||||
\ || has('vim_starting')
|
||||
return
|
||||
endif
|
||||
|
||||
let bundles = neobundle#config#get_autoload_bundles()
|
||||
call neobundle#autoload#_set_function_prefixes(bundles)
|
||||
|
||||
let bundles = filter(bundles,
|
||||
\ "index(v:val.pre_func, function_prefix) >= 0
|
||||
\ || (index(v:val.on_func, function) >= 0)")
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_command_prefix() abort "{{{
|
||||
let command = tolower(expand('<afile>'))
|
||||
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "!empty(filter(map(copy(v:val.pre_cmd), 'tolower(v:val)'),
|
||||
\ 'stridx(command, v:val) == 0'))")
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_path(path, event) abort "{{{
|
||||
if a:path == ''
|
||||
return
|
||||
endif
|
||||
|
||||
let path = a:path
|
||||
" For ":edit ~".
|
||||
if fnamemodify(path, ':t') ==# '~'
|
||||
let path = '~'
|
||||
endif
|
||||
|
||||
let path = neobundle#util#expand(path)
|
||||
let bundles = filter(neobundle#config#get_autoload_bundles(),
|
||||
\ "len(filter(copy(v:val.on_path),
|
||||
\ 'path =~? v:val')) > 0")")
|
||||
if !empty(bundles)
|
||||
call neobundle#config#source_bundles(bundles)
|
||||
execute 'doautocmd' a:event
|
||||
|
||||
if !s:loaded_path && has('vim_starting')
|
||||
\ && neobundle#util#redir('filetype') =~# 'detection:ON'
|
||||
" Force enable auto detection if path bundles are loaded
|
||||
autocmd neobundle VimEnter * filetype detect
|
||||
endif
|
||||
let s:loaded_path = 1
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_focus() abort "{{{
|
||||
let bundles = neobundle#util#sort_by(filter(
|
||||
\ neobundle#config#get_autoload_bundles(),
|
||||
\ "v:val.focus > 0"), 'v:val.focus')
|
||||
if empty(bundles)
|
||||
augroup neobundle-focus
|
||||
autocmd!
|
||||
augroup END
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#config#source_bundles([bundles[0]])
|
||||
call feedkeys("g\<ESC>", 'n')
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_input() abort "{{{
|
||||
let input = ''
|
||||
let termstr = "<M-_>"
|
||||
|
||||
call feedkeys(termstr, 'n')
|
||||
|
||||
let type_num = type(0)
|
||||
while 1
|
||||
let char = getchar()
|
||||
let input .= (type(char) == type_num) ? nr2char(char) : char
|
||||
|
||||
let idx = stridx(input, termstr)
|
||||
if idx >= 1
|
||||
let input = input[: idx - 1]
|
||||
break
|
||||
elseif idx == 0
|
||||
let input = ''
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return input
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_lazy_bundles() abort "{{{
|
||||
return filter(neobundle#config#get_neobundles(),
|
||||
\ "!v:val.sourced && v:val.rtp != '' && v:val.lazy")
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
79
bundle/neobundle.vim/autoload/neobundle/cache.vim
Normal file
79
bundle/neobundle.vim/autoload/neobundle/cache.vim
Normal file
@ -0,0 +1,79 @@
|
||||
" Utilities for output cache.
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#cache#getfilename(cache_dir, filename) abort
|
||||
return s:_encode_name(a:cache_dir, a:filename)
|
||||
endfunction
|
||||
|
||||
function! neobundle#cache#filereadable(cache_dir, filename) abort
|
||||
let cache_name = s:_encode_name(a:cache_dir, a:filename)
|
||||
return filereadable(cache_name)
|
||||
endfunction
|
||||
|
||||
function! neobundle#cache#readfile(cache_dir, filename) abort
|
||||
let cache_name = s:_encode_name(a:cache_dir, a:filename)
|
||||
return filereadable(cache_name) ? readfile(cache_name) : []
|
||||
endfunction
|
||||
|
||||
function! neobundle#cache#writefile(cache_dir, filename, list) abort
|
||||
let cache_name = s:_encode_name(a:cache_dir, a:filename)
|
||||
|
||||
call writefile(a:list, cache_name)
|
||||
endfunction
|
||||
|
||||
function! neobundle#cache#deletefile(cache_dir, filename) abort
|
||||
let cache_name = s:_encode_name(a:cache_dir, a:filename)
|
||||
return delete(cache_name)
|
||||
endfunction
|
||||
|
||||
function! s:_encode_name(cache_dir, filename) abort
|
||||
" Check cache directory.
|
||||
if !isdirectory(a:cache_dir)
|
||||
call mkdir(a:cache_dir, 'p')
|
||||
endif
|
||||
let cache_dir = a:cache_dir
|
||||
if cache_dir !~ '/$'
|
||||
let cache_dir .= '/'
|
||||
endif
|
||||
|
||||
return cache_dir . s:_create_hash(cache_dir, a:filename)
|
||||
endfunction
|
||||
|
||||
function! neobundle#cache#check_old_cache(cache_dir, filename) abort
|
||||
" Check old cache file.
|
||||
let cache_name = s:_encode_name(a:cache_dir, a:filename)
|
||||
let ret = getftime(cache_name) == -1
|
||||
\ || getftime(cache_name) <= getftime(a:filename)
|
||||
if ret && filereadable(cache_name)
|
||||
" Delete old cache.
|
||||
call delete(cache_name)
|
||||
endif
|
||||
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! s:_create_hash(dir, str) abort
|
||||
if len(a:dir) + len(a:str) < 150
|
||||
let hash = substitute(substitute(
|
||||
\ a:str, ':', '=-', 'g'), '[/\\]', '=+', 'g')
|
||||
elseif exists('*sha256')
|
||||
let hash = sha256(a:str)
|
||||
else
|
||||
" Use simple hash.
|
||||
let sum = 0
|
||||
for i in range(len(a:str))
|
||||
let sum += char2nr(a:str[i]) * (i + 1)
|
||||
endfor
|
||||
|
||||
let hash = printf('%x', sum)
|
||||
endif
|
||||
|
||||
return hash
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:set et ts=2 sts=2 sw=2 tw=0:
|
757
bundle/neobundle.vim/autoload/neobundle/commands.vim
Normal file
757
bundle/neobundle.vim/autoload/neobundle/commands.vim
Normal file
@ -0,0 +1,757 @@
|
||||
"=============================================================================
|
||||
" FILE: commands.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
" Version: 3.0, for Vim 7.2
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#rm_command',
|
||||
\ (neobundle#util#is_windows() ? 'rmdir /S /Q' : 'rm -rf'),
|
||||
\ 'g:neobundle_rm_command')
|
||||
|
||||
let s:vimrcs = []
|
||||
|
||||
function! neobundle#commands#install(bang, bundle_names) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return
|
||||
endif
|
||||
|
||||
let bundle_names = split(a:bundle_names)
|
||||
|
||||
let bundles = !a:bang ?
|
||||
\ neobundle#get_force_not_installed_bundles(bundle_names) :
|
||||
\ empty(bundle_names) ?
|
||||
\ neobundle#config#get_enabled_bundles() :
|
||||
\ neobundle#config#fuzzy_search(bundle_names)
|
||||
|
||||
let reinstall_bundles =
|
||||
\ neobundle#installer#get_reinstall_bundles(bundles)
|
||||
if !empty(reinstall_bundles)
|
||||
call neobundle#installer#reinstall(reinstall_bundles)
|
||||
endif
|
||||
|
||||
if empty(bundles)
|
||||
call neobundle#installer#error(
|
||||
\ 'Target bundles not found.')
|
||||
call neobundle#installer#error(
|
||||
\ 'You may have used the wrong bundle name,'.
|
||||
\ ' or all of the bundles are already installed.')
|
||||
return
|
||||
endif
|
||||
|
||||
call sort(bundles, 's:cmp_vimproc')
|
||||
|
||||
call neobundle#installer#_load_install_info(bundles)
|
||||
|
||||
call neobundle#installer#clear_log()
|
||||
|
||||
call neobundle#installer#echomsg(
|
||||
\ 'Update started: ' .
|
||||
\ strftime('(%Y/%m/%d %H:%M:%S)'))
|
||||
|
||||
let [installed, errored] = s:install(a:bang, bundles)
|
||||
if !has('vim_starting')
|
||||
redraw!
|
||||
endif
|
||||
|
||||
call neobundle#installer#update(installed)
|
||||
|
||||
call neobundle#installer#echomsg(
|
||||
\ neobundle#installer#get_updated_bundles_message(installed))
|
||||
|
||||
call neobundle#installer#echomsg(
|
||||
\ neobundle#installer#get_errored_bundles_message(errored))
|
||||
|
||||
call neobundle#installer#echomsg(
|
||||
\ 'Update done: ' . strftime('(%Y/%m/%d %H:%M:%S)'))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#helptags(bundles) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return
|
||||
endif
|
||||
|
||||
let help_dirs = filter(copy(a:bundles), 's:has_doc(v:val.rtp)')
|
||||
|
||||
if !empty(help_dirs)
|
||||
try
|
||||
call s:update_tags()
|
||||
if !has('vim_starting')
|
||||
call neobundle#installer#echomsg(
|
||||
\ 'Helptags: done. '
|
||||
\ .len(help_dirs).' bundles processed')
|
||||
endif
|
||||
catch
|
||||
call neobundle#installer#error('Error generating helptags:')
|
||||
call neobundle#installer#error(v:exception)
|
||||
endtry
|
||||
endif
|
||||
|
||||
return help_dirs
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#check() abort "{{{
|
||||
if neobundle#installer#get_tags_info() !=#
|
||||
\ sort(map(neobundle#config#get_enabled_bundles(), 'v:val.name'))
|
||||
" Recache automatically.
|
||||
NeoBundleDocs
|
||||
endif
|
||||
|
||||
let reinstall_bundles = neobundle#installer#get_reinstall_bundles(
|
||||
\ neobundle#config#get_neobundles())
|
||||
if !empty(reinstall_bundles)
|
||||
call neobundle#installer#reinstall(reinstall_bundles)
|
||||
endif
|
||||
|
||||
if !neobundle#exists_not_installed_bundles()
|
||||
return
|
||||
endif
|
||||
|
||||
" Defer call during Vim startup.
|
||||
" This is required for 'gui_running' and fixes issues otherwise.
|
||||
if has('vim_starting')
|
||||
autocmd neobundle VimEnter * NeoBundleCheck
|
||||
else
|
||||
echomsg 'Not installed bundles: '
|
||||
\ string(neobundle#get_not_installed_bundle_names())
|
||||
if confirm('Install bundles now?', "yes\nNo", 2) == 1
|
||||
call neobundle#commands#install(0,
|
||||
\ join(neobundle#get_not_installed_bundle_names()))
|
||||
endif
|
||||
echo ''
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#check_update(bundle_names) abort "{{{
|
||||
let bundle_names = split(a:bundle_names)
|
||||
|
||||
" Set context.
|
||||
let context = {}
|
||||
let context.source__updated_bundles = []
|
||||
let context.source__processes = []
|
||||
let context.source__number = 0
|
||||
let context.source__bundles = empty(bundle_names) ?
|
||||
\ neobundle#config#get_neobundles() :
|
||||
\ neobundle#config#fuzzy_search(bundle_names)
|
||||
|
||||
let context.source__max_bundles =
|
||||
\ len(context.source__bundles)
|
||||
let statusline_save = &l:statusline
|
||||
try
|
||||
while 1
|
||||
while context.source__number < context.source__max_bundles
|
||||
\ && len(context.source__processes) <
|
||||
\ g:neobundle#install_max_processes
|
||||
|
||||
let bundle = context.source__bundles[context.source__number]
|
||||
call s:check_update_init(bundle, context, 0)
|
||||
call s:print_message(
|
||||
\ neobundle#installer#get_progress_message(bundle,
|
||||
\ context.source__number,
|
||||
\ context.source__max_bundles))
|
||||
endwhile
|
||||
|
||||
for process in context.source__processes
|
||||
call s:check_update_process(context, process, 0)
|
||||
endfor
|
||||
|
||||
" Filter eof processes.
|
||||
call filter(context.source__processes, '!v:val.eof')
|
||||
|
||||
if empty(context.source__processes)
|
||||
\ && context.source__number == context.source__max_bundles
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
finally
|
||||
let &l:statusline = statusline_save
|
||||
endtry
|
||||
|
||||
let bundles = context.source__updated_bundles
|
||||
redraw!
|
||||
|
||||
if !empty(bundles)
|
||||
echomsg 'Updates available bundles: '
|
||||
\ string(map(copy(bundles), 'v:val.name'))
|
||||
echomsg ' '
|
||||
|
||||
for bundle in bundles
|
||||
let cwd = getcwd()
|
||||
try
|
||||
call neobundle#util#cd(bundle.path)
|
||||
|
||||
let type = neobundle#config#get_types(bundle.type)
|
||||
let rev = neobundle#installer#get_revision_number(bundle)
|
||||
let fetch_command = has_key(type, 'get_fetch_remote_command') ?
|
||||
\ type.get_fetch_remote_command(bundle) : ''
|
||||
let log_command = has_key(type, 'get_log_command') ?
|
||||
\ type.get_log_command(bundle, bundle.remote_rev, rev) : ''
|
||||
if log_command != ''
|
||||
echomsg bundle.name
|
||||
call neobundle#util#system(fetch_command)
|
||||
for output in split(neobundle#util#system(log_command), '\n')
|
||||
echomsg output
|
||||
endfor
|
||||
echomsg ' '
|
||||
endif
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
endfor
|
||||
|
||||
if confirm('Update bundles now?', "yes\nNo", 2) == 1
|
||||
call neobundle#commands#install(1,
|
||||
\ join(map(copy(bundles), 'v:val.name')))
|
||||
endif
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#clean(bang, ...) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return
|
||||
endif
|
||||
|
||||
if a:0 == 0
|
||||
let all_dirs = filter(split(neobundle#util#substitute_path_separator(
|
||||
\ globpath(neobundle#get_neobundle_dir(), '*', 1)), "\n"),
|
||||
\ 'isdirectory(v:val)')
|
||||
let bundle_dirs = map(copy(neobundle#config#get_enabled_bundles()),
|
||||
\ "(v:val.script_type != '') ?
|
||||
\ v:val.base . '/' . v:val.directory : v:val.path")
|
||||
let x_dirs = filter(all_dirs,
|
||||
\ "neobundle#config#is_disabled(fnamemodify(v:val, ':t'))
|
||||
\ && index(bundle_dirs, v:val) < 0 && v:val !~ '/neobundle.vim$'")
|
||||
else
|
||||
let x_dirs = map(neobundle#config#search_simple(a:000), 'v:val.path')
|
||||
if len(x_dirs) > len(a:000)
|
||||
" Check bug.
|
||||
call neobundle#util#print_error('Bug: x_dirs = %s but arguments is %s',
|
||||
\ string(x_dirs), map(copy(a:000), 'v:val.path'))
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(x_dirs)
|
||||
let message = a:0 == 0 ?
|
||||
\ 'All clean!' :
|
||||
\ string(a:000) . ' is not found.'
|
||||
call neobundle#installer#log(message)
|
||||
return
|
||||
end
|
||||
|
||||
if !a:bang && !s:check_really_clean(x_dirs)
|
||||
return
|
||||
endif
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
" x_dirs may contain current directory.
|
||||
call neobundle#util#cd(neobundle#get_neobundle_dir())
|
||||
|
||||
if !has('vim_starting')
|
||||
redraw
|
||||
endif
|
||||
|
||||
for dir in x_dirs
|
||||
call neobundle#util#rmdir(dir)
|
||||
call neobundle#config#rmdir(dir)
|
||||
endfor
|
||||
|
||||
try
|
||||
call s:update_tags()
|
||||
catch
|
||||
call neobundle#installer#error('Error generating helptags:')
|
||||
call neobundle#installer#error(v:exception)
|
||||
endtry
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#reinstall(bundle_names) abort "{{{
|
||||
let bundles = neobundle#config#search_simple(split(a:bundle_names))
|
||||
|
||||
if empty(bundles)
|
||||
call neobundle#installer#error(
|
||||
\ 'Target bundles not found.')
|
||||
call neobundle#installer#error(
|
||||
\ 'You may have used the wrong bundle name.')
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#installer#reinstall(bundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#gc(bundle_names) abort "{{{
|
||||
let bundle_names = split(a:bundle_names)
|
||||
let number = 0
|
||||
let bundles = empty(bundle_names) ?
|
||||
\ neobundle#config#get_enabled_bundles() :
|
||||
\ neobundle#config#search_simple(bundle_names)
|
||||
let max = len(bundles)
|
||||
for bundle in bundles
|
||||
|
||||
let number += 1
|
||||
|
||||
let type = neobundle#config#get_types(bundle.type)
|
||||
if empty(type) || !has_key(type, 'get_gc_command')
|
||||
continue
|
||||
endif
|
||||
|
||||
let cmd = type.get_gc_command(bundle)
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
" Cd to bundle path.
|
||||
call neobundle#util#cd(bundle.path)
|
||||
|
||||
redraw
|
||||
call neobundle#util#redraw_echo(
|
||||
\ printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ number, max, bundle.name, cmd))
|
||||
let result = neobundle#util#system(cmd)
|
||||
redraw
|
||||
call neobundle#util#redraw_echo(result)
|
||||
let status = neobundle#util#get_last_status()
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
if status
|
||||
call neobundle#installer#error(bundle.path)
|
||||
call neobundle#installer#error(result)
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#rollback(bundle_name) abort "{{{
|
||||
let bundle = get(neobundle#config#search_simple([a:bundle_name]), 0, {})
|
||||
if empty(bundle) || !isdirectory(bundle.path)
|
||||
call neobundle#util#print_error(a:bundle_name . ' is not found.')
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#installer#_load_install_info([bundle])
|
||||
|
||||
if len(bundle.revisions) <= 1
|
||||
call neobundle#util#print_error('No revision information.')
|
||||
return
|
||||
endif
|
||||
|
||||
let cnt = 1
|
||||
let selections = []
|
||||
let revisions = neobundle#util#sort_by(
|
||||
\ items(bundle.revisions), 'v:val[0]')
|
||||
for [date, revision] in revisions
|
||||
call add(selections, cnt . strftime(
|
||||
\ '. %Y/%D/%m %H:%M:%S ', date) . ' ' . revision)
|
||||
let cnt += 1
|
||||
endfor
|
||||
|
||||
let select = inputlist(['Select revision:'] + selections)
|
||||
if select == ''
|
||||
return
|
||||
endif
|
||||
|
||||
redraw
|
||||
|
||||
let revision = revisions[select-1][1]
|
||||
call neobundle#installer#log('[neobundle] ' . a:bundle_name .
|
||||
\ ' rollbacked to ' . revision)
|
||||
|
||||
let cwd = getcwd()
|
||||
let revision_save = bundle.rev
|
||||
try
|
||||
let bundle.rev = revision
|
||||
let type = neobundle#config#get_types(bundle.type)
|
||||
if !has_key(type, 'get_revision_lock_command')
|
||||
call neobundle#util#print_error(
|
||||
\ a:bundle_name . ' is not supported this feature.')
|
||||
return
|
||||
endif
|
||||
|
||||
let cmd = type.get_revision_lock_command(bundle)
|
||||
|
||||
call neobundle#util#cd(bundle.path)
|
||||
call neobundle#util#system(cmd)
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
let bundle.rev = revision_save
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#list() abort "{{{
|
||||
call neobundle#util#redraw_echo('#: not sourced, X: not installed')
|
||||
for bundle in neobundle#util#sort_by(
|
||||
\ neobundle#config#get_neobundles(), 'tolower(v:val.name)')
|
||||
echo (bundle.sourced ? ' ' :
|
||||
\ neobundle#is_installed(bundle.name) ? '#' : 'X')
|
||||
\ . ' ' . bundle.name
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#lock(name, rev) abort "{{{
|
||||
let bundle = neobundle#config#get(a:name)
|
||||
if empty(bundle)
|
||||
return
|
||||
endif
|
||||
|
||||
let bundle.install_rev = a:rev
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#remote_plugins() abort "{{{
|
||||
if !has('nvim')
|
||||
return
|
||||
endif
|
||||
|
||||
" Load not loaded neovim remote plugins
|
||||
call neobundle#config#source(map(filter(
|
||||
\ neobundle#config#get_autoload_bundles(),
|
||||
\ "isdirectory(v:val.rtp . '/rplugin')"), 'v:val.name'))
|
||||
|
||||
UpdateRemotePlugins
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#source(names, ...) abort "{{{
|
||||
let is_force = get(a:000, 0, 1)
|
||||
|
||||
let names = neobundle#util#convert2list(a:names)
|
||||
if empty(names)
|
||||
let bundles = []
|
||||
for bundle in neobundle#config#get_neobundles()
|
||||
let bundles += neobundle#config#search([bundle.name])
|
||||
endfor
|
||||
let names = neobundle#util#uniq(map(bundles, 'v:val.name'))
|
||||
endif
|
||||
|
||||
call neobundle#config#source(names, is_force)
|
||||
endfunction "}}}
|
||||
|
||||
function! neobundle#commands#complete_bundles(arglead, cmdline, cursorpos) abort "{{{
|
||||
return filter(map(neobundle#config#get_neobundles(), 'v:val.name'),
|
||||
\ 'stridx(tolower(v:val), tolower(a:arglead)) >= 0')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#complete_lazy_bundles(arglead, cmdline, cursorpos) abort "{{{
|
||||
return filter(map(filter(neobundle#config#get_neobundles(),
|
||||
\ "!v:val.sourced && v:val.rtp != ''"), 'v:val.name'),
|
||||
\ 'stridx(tolower(v:val), tolower(a:arglead)) == 0')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#complete_deleted_bundles(arglead, cmdline, cursorpos) abort "{{{
|
||||
let bundle_dirs = map(copy(neobundle#config#get_neobundles()), 'v:val.path')
|
||||
let all_dirs = split(neobundle#util#substitute_path_separator(
|
||||
\ globpath(neobundle#get_neobundle_dir(), '*', 1)), "\n")
|
||||
let x_dirs = filter(all_dirs, 'index(bundle_dirs, v:val) < 0')
|
||||
|
||||
return filter(map(x_dirs, "fnamemodify(v:val, ':t')"),
|
||||
\ 'stridx(v:val, a:arglead) == 0')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#get_default_cache_file() abort "{{{
|
||||
return neobundle#get_rtp_dir() . '/cache'
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#get_cache_file() abort "{{{
|
||||
return get(g:, 'neobundle#cache_file', neobundle#commands#get_default_cache_file())
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#commands#save_cache() abort "{{{
|
||||
if !has('vim_starting')
|
||||
" Ignore if loaded
|
||||
return
|
||||
endif
|
||||
|
||||
let cache = neobundle#commands#get_cache_file()
|
||||
|
||||
" Set function prefixes before save cache
|
||||
call neobundle#autoload#_set_function_prefixes(
|
||||
\ neobundle#config#get_autoload_bundles())
|
||||
|
||||
let bundles = neobundle#config#tsort(
|
||||
\ deepcopy(neobundle#config#get_neobundles()))
|
||||
for bundle in bundles
|
||||
" Clear hooks. Because, VimL cannot save functions in JSON.
|
||||
let bundle.hooks = {}
|
||||
let bundle.sourced = 0
|
||||
endfor
|
||||
|
||||
let current_vim = neobundle#util#redir('version')
|
||||
|
||||
call writefile([neobundle#get_cache_version(),
|
||||
\ v:progname, current_vim, string(s:vimrcs),
|
||||
\ neobundle#util#vim2json(bundles)], cache)
|
||||
endfunction"}}}
|
||||
function! neobundle#commands#load_cache(vimrcs) abort "{{{
|
||||
let s:vimrcs = a:vimrcs
|
||||
|
||||
let cache = neobundle#commands#get_cache_file()
|
||||
if !filereadable(cache) | return 1 | endif
|
||||
|
||||
for vimrc in a:vimrcs
|
||||
let vimrc_ftime = getftime(vimrc)
|
||||
if vimrc_ftime != -1 && getftime(cache) < vimrc_ftime | return 1 | endif
|
||||
endfor
|
||||
|
||||
let current_vim = neobundle#util#redir('version')
|
||||
|
||||
try
|
||||
let list = readfile(cache)
|
||||
let ver = list[0]
|
||||
let prog = get(list, 1, '')
|
||||
let vim = get(list, 2, '')
|
||||
let vimrcs = get(list, 3, '')
|
||||
|
||||
if len(list) != 5
|
||||
\ || ver !=# neobundle#get_cache_version()
|
||||
\ || v:progname !=# prog
|
||||
\ || current_vim !=# vim
|
||||
\ || string(a:vimrcs) !=# vimrcs
|
||||
call neobundle#commands#clear_cache()
|
||||
return 1
|
||||
endif
|
||||
|
||||
let bundles = neobundle#util#json2vim(list[4])
|
||||
|
||||
if type(bundles) != type([])
|
||||
call neobundle#commands#clear_cache()
|
||||
return 1
|
||||
endif
|
||||
|
||||
for bundle in bundles
|
||||
call neobundle#config#add(bundle)
|
||||
endfor
|
||||
catch
|
||||
call neobundle#util#print_error(
|
||||
\ 'Error occurred while loading cache : ' . v:exception)
|
||||
call neobundle#commands#clear_cache()
|
||||
return 1
|
||||
endtry
|
||||
endfunction"}}}
|
||||
function! neobundle#commands#clear_cache() abort "{{{
|
||||
let cache = neobundle#commands#get_cache_file()
|
||||
if !filereadable(cache)
|
||||
return
|
||||
endif
|
||||
|
||||
call delete(cache)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:print_message(msg) abort "{{{
|
||||
if !has('vim_starting')
|
||||
let &l:statusline = a:msg
|
||||
redrawstatus
|
||||
else
|
||||
call neobundle#util#redraw_echo(a:msg)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:install(bang, bundles) abort "{{{
|
||||
" Set context.
|
||||
let context = {}
|
||||
let context.source__bang = a:bang
|
||||
let context.source__synced_bundles = []
|
||||
let context.source__errored_bundles = []
|
||||
let context.source__processes = []
|
||||
let context.source__number = 0
|
||||
let context.source__bundles = a:bundles
|
||||
let context.source__max_bundles =
|
||||
\ len(context.source__bundles)
|
||||
|
||||
let statusline_save = &l:statusline
|
||||
try
|
||||
|
||||
while 1
|
||||
while context.source__number < context.source__max_bundles
|
||||
\ && len(context.source__processes) <
|
||||
\ g:neobundle#install_max_processes
|
||||
|
||||
let bundle = context.source__bundles[context.source__number]
|
||||
call neobundle#installer#sync(
|
||||
\ context.source__bundles[context.source__number],
|
||||
\ context, 0)
|
||||
call s:print_message(
|
||||
\ neobundle#installer#get_progress_message(bundle,
|
||||
\ context.source__number,
|
||||
\ context.source__max_bundles))
|
||||
endwhile
|
||||
|
||||
for process in context.source__processes
|
||||
call neobundle#installer#check_output(context, process, 0)
|
||||
endfor
|
||||
|
||||
" Filter eof processes.
|
||||
call filter(context.source__processes, '!v:val.eof')
|
||||
|
||||
if empty(context.source__processes)
|
||||
\ && context.source__number == context.source__max_bundles
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
finally
|
||||
let &l:statusline = statusline_save
|
||||
endtry
|
||||
|
||||
return [context.source__synced_bundles,
|
||||
\ context.source__errored_bundles]
|
||||
endfunction"}}}
|
||||
|
||||
function! s:check_update_init(bundle, context, is_unite) abort "{{{
|
||||
let a:context.source__number += 1
|
||||
|
||||
let num = a:context.source__number
|
||||
let max = a:context.source__max_bundles
|
||||
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
let cmd = has_key(type, 'get_revision_remote_command') ?
|
||||
\ type.get_revision_remote_command(a:bundle) : ''
|
||||
if cmd == '' || !isdirectory(a:bundle.path)
|
||||
return
|
||||
endif
|
||||
|
||||
let message = printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, a:bundle.name, cmd)
|
||||
|
||||
call neobundle#installer#log(message, a:is_unite)
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
" Cd to bundle path.
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
let process = {
|
||||
\ 'number' : num,
|
||||
\ 'bundle' : a:bundle,
|
||||
\ 'output' : '',
|
||||
\ 'status' : -1,
|
||||
\ 'eof' : 0,
|
||||
\ 'start_time' : localtime(),
|
||||
\ }
|
||||
if neobundle#util#has_vimproc()
|
||||
let process.proc = vimproc#pgroup_open(vimproc#util#iconv(
|
||||
\ cmd, &encoding, 'char'), 0, 2)
|
||||
|
||||
" Close handles.
|
||||
call process.proc.stdin.close()
|
||||
" call process.proc.stderr.close()
|
||||
else
|
||||
let process.output = neobundle#util#system(cmd)
|
||||
let process.status = neobundle#util#get_last_status()
|
||||
endif
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
call add(a:context.source__processes, process)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:check_update_process(context, process, is_unite) abort "{{{
|
||||
if neobundle#util#has_vimproc() && has_key(a:process, 'proc')
|
||||
let is_timeout = (localtime() - a:process.start_time)
|
||||
\ >= a:process.bundle.install_process_timeout
|
||||
let a:process.output .= vimproc#util#iconv(
|
||||
\ a:process.proc.stdout.read(-1, 300), 'char', &encoding)
|
||||
if !a:process.proc.stdout.eof && !is_timeout
|
||||
return
|
||||
endif
|
||||
call a:process.proc.stdout.close()
|
||||
|
||||
let status = a:process.proc.waitpid()[1]
|
||||
else
|
||||
let is_timeout = 0
|
||||
let status = a:process.status
|
||||
endif
|
||||
|
||||
let num = a:process.number
|
||||
let max = a:context.source__max_bundles
|
||||
let bundle = a:process.bundle
|
||||
|
||||
let remote_rev = matchstr(a:process.output, '^\S\+')
|
||||
|
||||
let revision_save = bundle.rev
|
||||
try
|
||||
" Get HEAD revision
|
||||
let rev = neobundle#installer#get_revision_number(bundle)
|
||||
finally
|
||||
let bundle.rev = revision_save
|
||||
let bundle.remote_rev = remote_rev
|
||||
endtry
|
||||
|
||||
if is_timeout || status
|
||||
let message = printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, bundle.name, 'Error')
|
||||
call neobundle#installer#log(message, a:is_unite)
|
||||
call neobundle#installer#error(bundle.path)
|
||||
call neobundle#installer#error(
|
||||
\ (is_timeout ? 'Process timeout.' :
|
||||
\ split(a:process.output, '\n')))
|
||||
elseif remote_rev != '' && remote_rev !=# rev
|
||||
call add(a:context.source__updated_bundles,
|
||||
\ bundle)
|
||||
endif
|
||||
|
||||
let a:process.eof = 1
|
||||
endfunction"}}}
|
||||
|
||||
function! s:check_really_clean(dirs) abort "{{{
|
||||
echo join(a:dirs, "\n")
|
||||
|
||||
return input('Are you sure you want to remove '
|
||||
\ .len(a:dirs).' bundles? [y/n] : ') =~? 'y'
|
||||
endfunction"}}}
|
||||
|
||||
function! s:update_tags() abort "{{{
|
||||
let enabled = neobundle#config#get_enabled_bundles()
|
||||
let bundles = [{ 'rtp' : neobundle#get_runtime_dir()}] + enabled
|
||||
call neobundle#util#copy_bundle_files(bundles, 'doc')
|
||||
call neobundle#util#writefile('tags_info', sort(map(enabled, 'v:val.name')))
|
||||
silent execute 'helptags' fnameescape(neobundle#get_tags_dir())
|
||||
endfunction"}}}
|
||||
|
||||
function! s:has_doc(path) abort "{{{
|
||||
return a:path != '' &&
|
||||
\ isdirectory(a:path.'/doc')
|
||||
\ && (!filereadable(a:path.'/doc/tags')
|
||||
\ || filewritable(a:path.'/doc/tags'))
|
||||
\ && (!filereadable(a:path.'/doc/tags-??')
|
||||
\ || filewritable(a:path.'/doc/tags-??'))
|
||||
\ && (glob(a:path.'/doc/*.txt') != ''
|
||||
\ || glob(a:path.'/doc/*.??x') != '')
|
||||
endfunction"}}}
|
||||
|
||||
" Vimproc is first.
|
||||
function! s:cmp_vimproc(a, b) abort "{{{
|
||||
return !(a:a.name ==# 'vimproc' || a:a.name ==# 'vimproc.vim')
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
754
bundle/neobundle.vim/autoload/neobundle/config.vim
Normal file
754
bundle/neobundle.vim/autoload/neobundle/config.vim
Normal file
@ -0,0 +1,754 @@
|
||||
"=============================================================================
|
||||
" FILE: config.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('s:neobundles')
|
||||
let s:within_block = 0
|
||||
let s:lazy_rtp_bundles = []
|
||||
let s:neobundles = {}
|
||||
let neobundle#tapped = {}
|
||||
endif
|
||||
|
||||
function! neobundle#config#init() abort "{{{
|
||||
if neobundle#config#within_block()
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#begin()/neobundle#end() usage is invalid.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
|
||||
augroup neobundle
|
||||
autocmd VimEnter * call s:on_vim_enter()
|
||||
augroup END
|
||||
|
||||
call s:filetype_off()
|
||||
|
||||
let s:within_block = 1
|
||||
let s:lazy_rtp_bundles = []
|
||||
|
||||
" Load extra bundles configuration.
|
||||
call neobundle#config#load_extra_bundles()
|
||||
endfunction"}}}
|
||||
function! neobundle#config#append() abort "{{{
|
||||
if neobundle#config#within_block()
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#begin()/neobundle#end() usage is invalid.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
|
||||
if neobundle#get_rtp_dir() == ''
|
||||
call neobundle#util#print_error(
|
||||
\ 'You must call neobundle#begin() before.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
|
||||
call s:filetype_off()
|
||||
|
||||
let s:within_block = 1
|
||||
let s:lazy_rtp_bundles = []
|
||||
endfunction"}}}
|
||||
function! neobundle#config#final() abort "{{{
|
||||
if !neobundle#config#within_block()
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#begin()/neobundle#end() usage is invalid.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
|
||||
" Join to the tail in runtimepath.
|
||||
let rtps = neobundle#util#split_rtp(&runtimepath)
|
||||
let index = index(rtps, neobundle#get_rtp_dir())
|
||||
if index < 0
|
||||
call neobundle#util#print_error(
|
||||
\ 'Invalid runtimepath is detected.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
for bundle in filter(s:lazy_rtp_bundles,
|
||||
\ 'isdirectory(v:val.rtp) && !v:val.disabled')
|
||||
let bundle.sourced = 1
|
||||
call insert(rtps, bundle.rtp, index)
|
||||
let index += 1
|
||||
|
||||
if isdirectory(bundle.rtp.'/after')
|
||||
call add(rtps, s:get_rtp_after(bundle))
|
||||
endif
|
||||
endfor
|
||||
let &runtimepath = neobundle#util#join_rtp(rtps, &runtimepath, '')
|
||||
|
||||
call neobundle#call_hook('on_source', s:lazy_rtp_bundles)
|
||||
|
||||
let s:within_block = 0
|
||||
let s:lazy_rtp_bundles = []
|
||||
endfunction"}}}
|
||||
function! neobundle#config#within_block() abort "{{{
|
||||
return s:within_block
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get(name) abort "{{{
|
||||
return get(s:neobundles, a:name, {})
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get_neobundles() abort "{{{
|
||||
return values(s:neobundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get_enabled_bundles() abort "{{{
|
||||
return filter(values(s:neobundles),
|
||||
\ "!v:val.disabled")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get_autoload_bundles() abort "{{{
|
||||
return filter(values(s:neobundles),
|
||||
\ "!v:val.sourced && v:val.lazy && !v:val.disabled")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#source_bundles(bundles) abort "{{{
|
||||
if !empty(a:bundles)
|
||||
call neobundle#config#source(map(copy(a:bundles),
|
||||
\ "type(v:val) == type({}) ? v:val.name : v:val"))
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#check_not_exists(names, ...) abort "{{{
|
||||
" For infinite loop.
|
||||
let self = get(a:000, 0, [])
|
||||
|
||||
let _ = map(neobundle#get_not_installed_bundles(a:names), 'v:val.name')
|
||||
for bundle in map(filter(copy(a:names),
|
||||
\ 'index(self, v:val) < 0 && has_key(s:neobundles, v:val)'),
|
||||
\ 's:neobundles[v:val]')
|
||||
call add(self, bundle.name)
|
||||
|
||||
if !empty(bundle.depends)
|
||||
let _ += neobundle#config#check_not_exists(
|
||||
\ map(copy(bundle.depends), 'v:val.name'), self)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if len(_) > 1
|
||||
let _ = neobundle#util#uniq(_)
|
||||
endif
|
||||
|
||||
return _
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#source(names, ...) abort "{{{
|
||||
let is_force = get(a:000, 0, 1)
|
||||
|
||||
let bundles = neobundle#config#search(
|
||||
\ neobundle#util#convert2list(a:names))
|
||||
|
||||
let bundles = filter(bundles, "!v:val.disabled && !v:val.sourced")
|
||||
if empty(bundles)
|
||||
return
|
||||
endif
|
||||
|
||||
let filetype_before = neobundle#util#redir("autocmd FileType")
|
||||
|
||||
let reset_ftplugin = 0
|
||||
for bundle in bundles
|
||||
let bundle.sourced = 1
|
||||
let bundle.disabled = 0
|
||||
|
||||
if !empty(bundle.dummy_commands)
|
||||
for command in bundle.dummy_commands
|
||||
silent! execute 'delcommand' command
|
||||
endfor
|
||||
let bundle.dummy_commands = []
|
||||
endif
|
||||
|
||||
if !empty(bundle.dummy_mappings)
|
||||
for [mode, mapping] in bundle.dummy_mappings
|
||||
silent! execute mode.'unmap' mapping
|
||||
endfor
|
||||
let bundle.dummy_mappings = []
|
||||
endif
|
||||
|
||||
call neobundle#config#rtp_add(bundle)
|
||||
|
||||
if exists('g:loaded_neobundle') || is_force
|
||||
try
|
||||
call s:on_source(bundle)
|
||||
catch
|
||||
call neobundle#util#print_error(
|
||||
\ 'Uncaught error while sourcing "' . bundle.name .
|
||||
\ '": '.v:exception . ' in ' . v:throwpoint)
|
||||
endtry
|
||||
endif
|
||||
|
||||
call neobundle#autoload#_source(bundle.name)
|
||||
|
||||
if !reset_ftplugin
|
||||
let reset_ftplugin = s:is_reset_ftplugin(&filetype, bundle.rtp)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let filetype_after = neobundle#util#redir('autocmd FileType')
|
||||
|
||||
if reset_ftplugin && &filetype != ''
|
||||
if &verbose
|
||||
call neobundle#util#print_error(
|
||||
\ "Neobundle: resetting ftplugin, after loading bundles:"
|
||||
\ .join(map(copy(bundles), 'v:val.name'), ", "))
|
||||
endif
|
||||
call s:reset_ftplugin()
|
||||
elseif filetype_before !=# filetype_after
|
||||
if &verbose
|
||||
call neobundle#util#print_error(
|
||||
\ "Neobundle: FileType autocommand triggered by:"
|
||||
\ .join(map(copy(bundles), 'v:val.name'), ", "))
|
||||
endif
|
||||
execute 'doautocmd FileType' &filetype
|
||||
endif
|
||||
|
||||
if exists('g:loaded_neobundle')
|
||||
call neobundle#call_hook('on_post_source', bundles)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#disable(...) abort "{{{
|
||||
let bundle_names = neobundle#config#search(a:000)
|
||||
" do not print errors, same as dein
|
||||
for bundle in bundle_names
|
||||
call neobundle#config#rtp_rm(bundle)
|
||||
let bundle.refcnt -= 1
|
||||
|
||||
if bundle.refcnt <= 0
|
||||
if bundle.sourced
|
||||
call neobundle#util#print_error(
|
||||
\ bundle.name . ' is already sourced. Cannot be disabled.')
|
||||
continue
|
||||
endif
|
||||
|
||||
let bundle.disabled = 1
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#is_disabled(name) abort "{{{
|
||||
return get(neobundle#config#get(a:name), 'disabled', 1)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#is_sourced(name) abort "{{{
|
||||
return get(neobundle#config#get(a:name), 'sourced', 0)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#is_installed(name) abort "{{{
|
||||
return isdirectory(get(neobundle#config#get(a:name), 'path', ''))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#rm(bundle) abort "{{{
|
||||
call neobundle#config#rtp_rm(a:bundle)
|
||||
call remove(s:neobundles, a:bundle.name)
|
||||
endfunction"}}}
|
||||
function! neobundle#config#rmdir(path) abort "{{{
|
||||
for bundle in filter(neobundle#config#get_neobundles(),
|
||||
\ 'v:val.path ==# a:path')
|
||||
call neobundle#config#rm(bundle)
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get_types(...) abort "{{{
|
||||
let type = get(a:000, 0, '')
|
||||
|
||||
if type ==# 'git'
|
||||
if !exists('s:neobundle_type_git')
|
||||
let s:neobundle_type_git = neobundle#types#git#define()
|
||||
endif
|
||||
|
||||
return s:neobundle_type_git
|
||||
endif
|
||||
|
||||
if !exists('s:neobundle_types')
|
||||
" Load neobundle types.
|
||||
let s:neobundle_types = []
|
||||
for list in map(split(globpath(&runtimepath,
|
||||
\ 'autoload/neobundle/types/*.vim', 1), '\n'),
|
||||
\ "neobundle#util#convert2list(
|
||||
\ neobundle#types#{fnamemodify(v:val, ':t:r')}#define())")
|
||||
let s:neobundle_types += list
|
||||
endfor
|
||||
|
||||
let s:neobundle_types = neobundle#util#uniq(
|
||||
\ s:neobundle_types, 'v:val.name')
|
||||
endif
|
||||
|
||||
return (type == '') ? s:neobundle_types :
|
||||
\ get(filter(copy(s:neobundle_types), 'v:val.name ==# type'), 0, {})
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#rtp_rm_all_bundles() abort "{{{
|
||||
call filter(values(s:neobundles), 'neobundle#config#rtp_rm(v:val)')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#rtp_rm(bundle) abort "{{{
|
||||
execute 'set rtp-='.fnameescape(a:bundle.rtp)
|
||||
if isdirectory(a:bundle.rtp.'/after')
|
||||
execute 'set rtp-='.s:get_rtp_after(a:bundle)
|
||||
endif
|
||||
|
||||
" Remove from lazy runtimepath
|
||||
call filter(s:lazy_rtp_bundles, "v:val.name !=# a:bundle.name")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#rtp_add(bundle) abort "{{{
|
||||
if has_key(s:neobundles, a:bundle.name)
|
||||
call neobundle#config#rtp_rm(s:neobundles[a:bundle.name])
|
||||
endif
|
||||
|
||||
if s:within_block && !a:bundle.force
|
||||
" Add rtp lazily.
|
||||
call add(s:lazy_rtp_bundles, a:bundle)
|
||||
return
|
||||
endif
|
||||
|
||||
let rtp = a:bundle.rtp
|
||||
if isdirectory(rtp)
|
||||
" Join to the tail in runtimepath.
|
||||
let rtps = neobundle#util#split_rtp(&runtimepath)
|
||||
let &runtimepath = neobundle#util#join_rtp(
|
||||
\ insert(rtps, rtp, index(rtps, neobundle#get_rtp_dir())),
|
||||
\ &runtimepath, rtp)
|
||||
endif
|
||||
if isdirectory(rtp.'/after')
|
||||
execute 'set rtp+='.s:get_rtp_after(a:bundle)
|
||||
endif
|
||||
let a:bundle.sourced = 1
|
||||
|
||||
call neobundle#call_hook('on_source', a:bundle)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#search(bundle_names, ...) abort "{{{
|
||||
" For infinite loop.
|
||||
let self = get(a:000, 0, [])
|
||||
|
||||
let bundle_names = filter(copy(a:bundle_names), 'index(self, v:val) < 0')
|
||||
if empty(bundle_names)
|
||||
return []
|
||||
endif
|
||||
|
||||
let _ = []
|
||||
let bundles = len(bundle_names) != 1 ?
|
||||
\ filter(neobundle#config#get_neobundles(),
|
||||
\ 'index(a:bundle_names, v:val.name) >= 0') :
|
||||
\ has_key(s:neobundles, bundle_names[0]) ?
|
||||
\ [s:neobundles[bundle_names[0]]] : []
|
||||
for bundle in bundles
|
||||
call add(self, bundle.name)
|
||||
|
||||
if !empty(bundle.depends)
|
||||
let _ += neobundle#config#search(
|
||||
\ map(copy(bundle.depends), 'v:val.name'), self)
|
||||
endif
|
||||
call add(_, bundle)
|
||||
endfor
|
||||
|
||||
if len(_) > 1
|
||||
let _ = neobundle#util#uniq(_)
|
||||
endif
|
||||
|
||||
return _
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#search_simple(bundle_names) abort "{{{
|
||||
return filter(neobundle#config#get_neobundles(),
|
||||
\ 'index(a:bundle_names, v:val.name) >= 0')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#fuzzy_search(bundle_names) abort "{{{
|
||||
let bundles = []
|
||||
for name in a:bundle_names
|
||||
let bundles += filter(neobundle#config#get_neobundles(),
|
||||
\ 'stridx(v:val.name, name) >= 0')
|
||||
endfor
|
||||
|
||||
let _ = []
|
||||
for bundle in bundles
|
||||
if !empty(bundle.depends)
|
||||
let _ += neobundle#config#search(
|
||||
\ map(copy(bundle.depends), 'v:val.name'))
|
||||
endif
|
||||
call add(_, bundle)
|
||||
endfor
|
||||
|
||||
if len(_) > 1
|
||||
let _ = neobundle#util#uniq(_)
|
||||
endif
|
||||
|
||||
return _
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#load_extra_bundles() abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/extra_bundles.vim'
|
||||
|
||||
if filereadable(path)
|
||||
execute 'source' fnameescape(path)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#save_direct(arg) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return
|
||||
endif
|
||||
|
||||
let path = neobundle#get_neobundle_dir() . '/extra_bundles.vim'
|
||||
let bundles = filereadable(path) ? readfile(path) : []
|
||||
call writefile(add(bundles, 'NeoBundle ' . a:arg), path)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#set(name, dict) abort "{{{
|
||||
let bundle = neobundle#config#get(a:name)
|
||||
if empty(bundle)
|
||||
call neobundle#util#print_error(
|
||||
\ 'Plugin name "' . a:name . '" is not defined.')
|
||||
return
|
||||
endif
|
||||
if bundle.sourced
|
||||
return
|
||||
endif
|
||||
if !neobundle#config#within_block()
|
||||
call neobundle#util#print_error(
|
||||
\ 'You must call neobundle#config() '
|
||||
\ .'within neobundle#begin()/neobundle#end() block.')
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#config#add(
|
||||
\ neobundle#init#_bundle(extend(bundle, a:dict)))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#add(bundle) abort "{{{
|
||||
if empty(a:bundle)
|
||||
return
|
||||
endif
|
||||
|
||||
let bundle = a:bundle
|
||||
|
||||
let prev_bundle = get(s:neobundles, bundle.name, {})
|
||||
if !empty(prev_bundle) && prev_bundle.lazy != bundle.lazy
|
||||
let bundle.lazy = 0
|
||||
endif
|
||||
|
||||
if !empty(bundle.depends)
|
||||
call s:add_depends(bundle)
|
||||
endif
|
||||
|
||||
if !empty(prev_bundle)
|
||||
if prev_bundle.sourced
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#config#rtp_rm(prev_bundle)
|
||||
endif
|
||||
let s:neobundles[bundle.name] = bundle
|
||||
|
||||
if bundle.disabled
|
||||
" Ignore load.
|
||||
return
|
||||
endif
|
||||
|
||||
if !bundle.lazy && bundle.rtp != ''
|
||||
if !has('vim_starting')
|
||||
" Load automatically.
|
||||
call neobundle#config#source(bundle.name, bundle.force)
|
||||
else
|
||||
call neobundle#config#rtp_add(bundle)
|
||||
|
||||
if bundle.force
|
||||
execute 'runtime!' bundle.rtp . '/plugin/**/*.vim'
|
||||
endif
|
||||
endif
|
||||
elseif bundle.lazy && !bundle.sourced
|
||||
if !empty(bundle.on_cmd)
|
||||
call s:add_dummy_commands(bundle)
|
||||
endif
|
||||
|
||||
if !empty(bundle.on_map)
|
||||
call s:add_dummy_mappings(bundle)
|
||||
endif
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#tsort(bundles) abort "{{{
|
||||
let sorted = []
|
||||
let mark = {}
|
||||
for target in a:bundles
|
||||
call s:tsort_impl(target, a:bundles, mark, sorted)
|
||||
endfor
|
||||
|
||||
return sorted
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#get_lazy_rtp_bundles() abort "{{{
|
||||
return s:lazy_rtp_bundles
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#config#check_commands(commands) abort "{{{
|
||||
" Environment check.
|
||||
if type(a:commands) == type([])
|
||||
\ || type(a:commands) == type('')
|
||||
let commands = a:commands
|
||||
elseif neobundle#util#is_windows() && has_key(a:commands, 'windows')
|
||||
let commands = a:commands.windows
|
||||
elseif neobundle#util#is_mac() && has_key(a:commands, 'mac')
|
||||
let commands = a:commands.mac
|
||||
elseif neobundle#util#is_cygwin() && has_key(a:commands, 'cygwin')
|
||||
let commands = a:commands.cygwin
|
||||
elseif !neobundle#util#is_windows() && has_key(a:commands, 'unix')
|
||||
let commands = a:commands.unix
|
||||
elseif has_key(a:commands, 'others')
|
||||
let commands = a:commands.others
|
||||
else
|
||||
" Invalid.
|
||||
return 0
|
||||
endif
|
||||
|
||||
for command in neobundle#util#convert2list(commands)
|
||||
if !executable(command)
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! s:tsort_impl(target, bundles, mark, sorted) abort "{{{
|
||||
if has_key(a:mark, a:target.name)
|
||||
return
|
||||
endif
|
||||
|
||||
let a:mark[a:target.name] = 1
|
||||
for depend in get(a:target, 'depends', [])
|
||||
call s:tsort_impl(get(s:neobundles, depend.name, depend),
|
||||
\ a:bundles, a:mark, a:sorted)
|
||||
endfor
|
||||
|
||||
call add(a:sorted, a:target)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_vim_enter() abort "{{{
|
||||
if !empty(s:lazy_rtp_bundles)
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#begin() was called without calling ' .
|
||||
\ 'neobundle#end() in .vimrc.')
|
||||
" We're past the point of plugins being sourced, so don't bother
|
||||
" trying to recover.
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#call_hook('on_post_source')
|
||||
endfunction"}}}
|
||||
|
||||
function! s:add_depends(bundle) abort "{{{
|
||||
" Add depends.
|
||||
for depend in a:bundle.depends
|
||||
let depend.lazy = a:bundle.lazy
|
||||
|
||||
if !has_key(s:neobundles, depend.name)
|
||||
call neobundle#config#add(depend)
|
||||
else
|
||||
let depend_bundle = s:neobundles[depend.name]
|
||||
" Add reference count
|
||||
let depend_bundle.refcnt += 1
|
||||
|
||||
if (a:bundle.sourced && !depend_bundle.sourced) || !a:bundle.lazy
|
||||
" Load automatically.
|
||||
call neobundle#config#source(depend.name, depend.force)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! s:add_dummy_commands(bundle) abort "{{{
|
||||
let a:bundle.dummy_commands = []
|
||||
for command in map(copy(a:bundle.on_cmd), "
|
||||
\ type(v:val) == type('') ?
|
||||
\ { 'name' : v:val } : v:val
|
||||
\")
|
||||
|
||||
for name in neobundle#util#convert2list(command.name)
|
||||
" Define dummy commands.
|
||||
silent! execute 'command '
|
||||
\ . '-complete=customlist,neobundle#autoload#_command_dummy_complete'
|
||||
\ . ' -bang -bar -range -nargs=*' name printf(
|
||||
\ "call neobundle#autoload#_command(%s, %s, <q-args>,
|
||||
\ expand('<bang>'), expand('<line1>'), expand('<line2>'))",
|
||||
\ string(name), string(a:bundle.name))
|
||||
|
||||
call add(a:bundle.dummy_commands, name)
|
||||
endfor
|
||||
endfor
|
||||
endfunction"}}}
|
||||
function! s:add_dummy_mappings(bundle) abort "{{{
|
||||
let a:bundle.dummy_mappings = []
|
||||
for [modes, mappings] in map(copy(a:bundle.on_map), "
|
||||
\ type(v:val) == type([]) ?
|
||||
\ [v:val[0], v:val[1:]] : ['nxo', [v:val]]
|
||||
\ ")
|
||||
if mappings ==# ['<Plug>']
|
||||
" Use plugin name.
|
||||
let mappings = ['<Plug>(' . a:bundle.normalized_name]
|
||||
if stridx(a:bundle.normalized_name, '-') >= 0
|
||||
" The plugin mappings may use "_" instead of "-".
|
||||
call add(mappings, '<Plug>(' .
|
||||
\ substitute(a:bundle.normalized_name, '-', '_', 'g'))
|
||||
endif
|
||||
endif
|
||||
|
||||
for mapping in mappings
|
||||
" Define dummy mappings.
|
||||
for mode in filter(split(modes, '\zs'),
|
||||
\ "index(['n', 'v', 'x', 'o', 'i', 'c'], v:val) >= 0")
|
||||
let mapping_str = substitute(mapping, '<', '<lt>', 'g')
|
||||
silent! execute mode.'noremap <unique><silent>' mapping printf(
|
||||
\ (mode ==# 'c' ? "\<C-r>=" :
|
||||
\ (mode ==# 'i' ? "\<C-o>:" : ":\<C-u>")."call ").
|
||||
\ "neobundle#autoload#_mapping(%s, %s, %s)<CR>",
|
||||
\ string(mapping_str), string(a:bundle.name), string(mode))
|
||||
|
||||
call add(a:bundle.dummy_mappings, [mode, mapping])
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! s:on_source(bundle) abort "{{{
|
||||
if a:bundle.verbose && a:bundle.lazy
|
||||
redraw
|
||||
echo 'source:' a:bundle.name
|
||||
endif
|
||||
|
||||
" Reload script files.
|
||||
for directory in filter(['plugin', 'after/plugin'],
|
||||
\ "isdirectory(a:bundle.rtp.'/'.v:val)")
|
||||
for file in split(glob(a:bundle.rtp.'/'.directory.'/**/*.vim'), '\n')
|
||||
" Note: "silent!" is required to ignore E122, E174 and E227.
|
||||
" try/catching them aborts sourcing of the file.
|
||||
" "unsilent" then displays any messages while sourcing.
|
||||
execute 'silent! unsilent source' fnameescape(file)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
if !has('vim_starting')
|
||||
if exists('#'.a:bundle.augroup.'#VimEnter')
|
||||
execute 'doautocmd' a:bundle.augroup 'VimEnter'
|
||||
endif
|
||||
|
||||
if has('gui_running') && &term ==# 'builtin_gui'
|
||||
\ && exists('#'.a:bundle.augroup.'#GUIEnter')
|
||||
execute 'doautocmd' a:bundle.augroup 'GUIEnter'
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:bundle.verbose && a:bundle.lazy
|
||||
redraw
|
||||
echo 'sourced:' a:bundle.name
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:clear_dummy(bundle) abort "{{{
|
||||
endfunction"}}}
|
||||
|
||||
function! s:is_reset_ftplugin(filetype, rtp) abort "{{{
|
||||
for filetype in split(a:filetype, '\.')
|
||||
for directory in ['ftplugin', 'indent',
|
||||
\ 'after/ftplugin', 'after/indent']
|
||||
let base = a:rtp . '/' . directory
|
||||
if filereadable(base.'/'.filetype.'.vim') ||
|
||||
\ (directory =~# 'ftplugin$' &&
|
||||
\ isdirectory(base . '/' . filetype) ||
|
||||
\ glob(base.'/'.filetype.'_*.vim') != '')
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction"}}}
|
||||
|
||||
function! s:reset_ftplugin() abort "{{{
|
||||
let filetype_out = s:filetype_off()
|
||||
|
||||
if filetype_out =~# 'detection:ON'
|
||||
\ && filetype_out =~# 'plugin:ON'
|
||||
\ && filetype_out =~# 'indent:ON'
|
||||
silent! filetype plugin indent on
|
||||
else
|
||||
if filetype_out =~# 'detection:ON'
|
||||
silent! filetype on
|
||||
endif
|
||||
|
||||
if filetype_out =~# 'plugin:ON'
|
||||
silent! filetype plugin on
|
||||
endif
|
||||
|
||||
if filetype_out =~# 'indent:ON'
|
||||
silent! filetype indent on
|
||||
endif
|
||||
endif
|
||||
|
||||
if filetype_out =~# 'detection:ON'
|
||||
filetype detect
|
||||
endif
|
||||
|
||||
" Reload filetype plugins.
|
||||
let &l:filetype = &l:filetype
|
||||
|
||||
" Recall FileType autocmd
|
||||
execute 'doautocmd FileType' &filetype
|
||||
endfunction"}}}
|
||||
|
||||
function! s:filetype_off() abort "{{{
|
||||
let filetype_out = neobundle#util#redir('filetype')
|
||||
|
||||
if filetype_out =~# 'plugin:ON'
|
||||
\ || filetype_out =~# 'indent:ON'
|
||||
filetype plugin indent off
|
||||
endif
|
||||
|
||||
if filetype_out =~# 'detection:ON'
|
||||
filetype off
|
||||
endif
|
||||
|
||||
return filetype_out
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_rtp_after(bundle) abort "{{{
|
||||
return substitute(
|
||||
\ fnameescape(a:bundle.rtp . '/after'), '//', '/', 'g')
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
300
bundle/neobundle.vim/autoload/neobundle/init.vim
Normal file
300
bundle/neobundle.vim/autoload/neobundle/init.vim
Normal file
@ -0,0 +1,300 @@
|
||||
"=============================================================================
|
||||
" FILE: init.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" Copyright (C) 2010 http://github.com/gmarik
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#init#_rc(path) abort "{{{
|
||||
let path =
|
||||
\ neobundle#util#substitute_path_separator(
|
||||
\ neobundle#util#expand(a:path))
|
||||
if path =~ '/$'
|
||||
let path = path[: -2]
|
||||
endif
|
||||
|
||||
if path == ''
|
||||
call neobundle#util#print_error(
|
||||
\ 'neobundle#rc() argument is empty.')
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#set_neobundle_dir(path)
|
||||
|
||||
" Join to the tail in runtimepath.
|
||||
let rtp = neobundle#get_rtp_dir()
|
||||
execute 'set rtp-='.fnameescape(rtp)
|
||||
let rtps = neobundle#util#split_rtp(&runtimepath)
|
||||
let n = index(rtps, $VIMRUNTIME)
|
||||
if n < 0
|
||||
call neobundle#util#print_error(
|
||||
\ 'Invalid runtimepath is detected.')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Please check your .vimrc.')
|
||||
return
|
||||
endif
|
||||
let &runtimepath = neobundle#util#join_rtp(
|
||||
\ insert(rtps, rtp, n-1), &runtimepath, rtp)
|
||||
|
||||
augroup neobundle
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
call neobundle#config#init()
|
||||
call neobundle#autoload#init()
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#init#_bundle(bundle) abort "{{{
|
||||
if (!has_key(a:bundle, 'type') && get(a:bundle, 'local', 0))
|
||||
\ || get(a:bundle, 'type', '') ==# 'nosync'
|
||||
" Default type.
|
||||
let a:bundle.type = 'none'
|
||||
endif
|
||||
if !has_key(a:bundle, 'type')
|
||||
call neobundle#installer#error(
|
||||
\ printf('Failed parse name "%s" and args %s',
|
||||
\ a:bundle.orig_name, string(a:bundle.orig_opts)))
|
||||
return {}
|
||||
endif
|
||||
|
||||
let bundle = {
|
||||
\ 'uri' : '',
|
||||
\ 'script_type' : '',
|
||||
\ 'rev' : '',
|
||||
\ 'rtp' : '',
|
||||
\ 'depends' : [],
|
||||
\ 'fetch' : 0,
|
||||
\ 'force' : 0,
|
||||
\ 'gui' : 0,
|
||||
\ 'terminal' : 0,
|
||||
\ 'autoload' : {},
|
||||
\ 'hooks' : {},
|
||||
\ 'external_commands' : {},
|
||||
\ 'build_commands': {},
|
||||
\ 'description' : '',
|
||||
\ 'dummy_commands' : [],
|
||||
\ 'dummy_mappings' : [],
|
||||
\ 'sourced' : 0,
|
||||
\ 'disabled' : 0,
|
||||
\ 'local' : 0,
|
||||
\ 'focus' : 0,
|
||||
\ 'verbose' : 0,
|
||||
\ 'orig_name' : '',
|
||||
\ 'vim_version' : '',
|
||||
\ 'orig_opts' : {},
|
||||
\ 'base' : neobundle#get_neobundle_dir(),
|
||||
\ 'install_rev' : '',
|
||||
\ 'install_process_timeout'
|
||||
\ : g:neobundle#install_process_timeout,
|
||||
\ 'refcnt' : 1,
|
||||
\ 'frozen' : 0,
|
||||
\ 'on_i' : 0,
|
||||
\ 'on_ft' : [],
|
||||
\ 'on_cmd' : [],
|
||||
\ 'on_func' : [],
|
||||
\ 'on_map' : [],
|
||||
\ 'on_path' : [],
|
||||
\ 'on_source' : [],
|
||||
\ 'pre_cmd' : [],
|
||||
\ 'pre_func' : [],
|
||||
\ }
|
||||
call extend(bundle, a:bundle)
|
||||
|
||||
if !has_key(bundle, 'name')
|
||||
let bundle.name = neobundle#util#name_conversion(bundle.orig_name)
|
||||
endif
|
||||
|
||||
if !has_key(bundle, 'normalized_name')
|
||||
let bundle.normalized_name = substitute(
|
||||
\ fnamemodify(bundle.name, ':r'),
|
||||
\ '\c^vim[_-]\|[_-]vim$', '', 'g')
|
||||
endif
|
||||
if !has_key(bundle.orig_opts, 'name') &&
|
||||
\ g:neobundle#enable_name_conversion
|
||||
" Use normalized name.
|
||||
let bundle.name = bundle.normalized_name
|
||||
endif
|
||||
|
||||
if !has_key(bundle, 'directory')
|
||||
let bundle.directory = bundle.name
|
||||
|
||||
if bundle.rev != ''
|
||||
let bundle.directory .= '_' . substitute(bundle.rev,
|
||||
\ '[^[:alnum:]_-]', '_', 'g')
|
||||
endif
|
||||
endif
|
||||
|
||||
if bundle.base[0] == '~'
|
||||
let bundle.base = neobundle#util#expand(bundle.base)
|
||||
endif
|
||||
if bundle.base[-1] == '/' || bundle.base[-1] == '\'
|
||||
" Chomp.
|
||||
let bundle.base = bundle.base[: -2]
|
||||
endif
|
||||
|
||||
let bundle.path = isdirectory(bundle.uri) ?
|
||||
\ bundle.uri : bundle.base.'/'.bundle.directory
|
||||
|
||||
" Check relative path.
|
||||
if bundle.rtp !~ '^\%([~/]\|\a\+:\)'
|
||||
let bundle.rtp = bundle.path.'/'.bundle.rtp
|
||||
endif
|
||||
if bundle.rtp[0] == '~'
|
||||
let bundle.rtp = neobundle#util#expand(bundle.rtp)
|
||||
endif
|
||||
if bundle.rtp[-1] == '/' || bundle.rtp[-1] == '\'
|
||||
" Chomp.
|
||||
let bundle.rtp = bundle.rtp[: -2]
|
||||
endif
|
||||
if bundle.normalized_name ==# 'neobundle' || bundle.fetch
|
||||
" Do not add runtimepath.
|
||||
let bundle.rtp = ''
|
||||
endif
|
||||
|
||||
if bundle.script_type != ''
|
||||
" Add script_type.
|
||||
" Note: To check by neobundle#config#is_installed().
|
||||
let bundle.path .= '/' . bundle.script_type
|
||||
endif
|
||||
|
||||
if !has_key(bundle, 'augroup')
|
||||
let bundle.augroup = bundle.normalized_name
|
||||
endif
|
||||
|
||||
" Convert old name
|
||||
if has_key(bundle, 'stay_same')
|
||||
let bundle.frozen = bundle.stay_same
|
||||
endif
|
||||
call s:init_lazy(bundle)
|
||||
|
||||
" Parse depends.
|
||||
if !empty(bundle.depends)
|
||||
call s:init_depends(bundle)
|
||||
endif
|
||||
|
||||
if type(bundle.disabled) == type('')
|
||||
let bundle.disabled = eval(bundle.disabled)
|
||||
endif
|
||||
|
||||
let bundle.disabled = bundle.disabled
|
||||
\ || (bundle.gui && !has('gui_running'))
|
||||
\ || (bundle.terminal && has('gui_running'))
|
||||
\ || (bundle.vim_version != ''
|
||||
\ && s:check_version(bundle.vim_version))
|
||||
\ || (!empty(bundle.external_commands)
|
||||
\ && neobundle#config#check_commands(bundle.external_commands))
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! s:init_lazy(bundle) abort "{{{
|
||||
let bundle = a:bundle
|
||||
|
||||
" Auto set autoload keys.
|
||||
for key in filter([
|
||||
\ 'filetypes', 'filename_patterns',
|
||||
\ 'commands', 'functions', 'mappings',
|
||||
\ 'insert', 'explorer',
|
||||
\ 'command_prefix', 'function_prefixes',
|
||||
\ ], 'has_key(bundle, v:val)')
|
||||
let bundle.autoload[key] = bundle[key]
|
||||
call remove(bundle, key)
|
||||
endfor
|
||||
|
||||
" Auto set on keys.
|
||||
for [key, value] in items(filter({
|
||||
\ 'filetypes' : 'on_ft',
|
||||
\ 'filename_patterns' : 'on_path',
|
||||
\ 'commands' : 'on_cmd',
|
||||
\ 'functions' : 'on_func',
|
||||
\ 'mappings' : 'on_map',
|
||||
\ 'insert' : 'on_i',
|
||||
\ 'explorer' : 'on_path',
|
||||
\ 'on_source' : 'on_source',
|
||||
\ 'command_prefix' : 'pre_cmd',
|
||||
\ 'function_prefixes' : 'pre_func',
|
||||
\ }, 'has_key(bundle.autoload, v:key)'))
|
||||
|
||||
let bundle[value] = (key ==# 'explorer'
|
||||
\ && type(bundle.autoload[key]) == type(0)
|
||||
\ && bundle.autoload[key] == 1) ? '.*' : bundle.autoload[key]
|
||||
endfor
|
||||
|
||||
if empty(bundle.pre_cmd)
|
||||
let bundle.pre_cmd = substitute(bundle.normalized_name, '[_-]', '', 'g')
|
||||
endif
|
||||
|
||||
" Auto convert2list.
|
||||
for key in filter([
|
||||
\ 'on_ft', 'on_path', 'on_cmd',
|
||||
\ 'on_func', 'on_map',
|
||||
\ 'on_source', 'pre_cmd', 'pre_func',
|
||||
\ ], "type(bundle[v:val]) != type([])
|
||||
\")
|
||||
let bundle[key] = [bundle[key]]
|
||||
endfor
|
||||
|
||||
if !has_key(bundle, 'lazy')
|
||||
" Set lazy flag automatically
|
||||
let bundle.lazy = bundle.on_i
|
||||
\ || !empty(filter(['on_ft', 'on_path', 'on_cmd',
|
||||
\ 'on_func', 'on_map', 'on_source'],
|
||||
\ '!empty(bundle[v:val])'))
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:init_depends(bundle) abort "{{{
|
||||
let bundle = a:bundle
|
||||
let _ = []
|
||||
|
||||
for depend in neobundle#util#convert2list(bundle.depends)
|
||||
if type(depend) == type('')
|
||||
let depend = string(depend)
|
||||
endif
|
||||
|
||||
let depend_bundle = type(depend) == type({}) ?
|
||||
\ depend : neobundle#parser#bundle(depend, 1)
|
||||
let depend_bundle.lazy = bundle.lazy
|
||||
call add(_, depend_bundle)
|
||||
|
||||
unlet depend
|
||||
endfor
|
||||
|
||||
let bundle.depends = _
|
||||
endfunction"}}}
|
||||
|
||||
function! s:check_version(min_version) abort "{{{
|
||||
let versions = split(a:min_version, '\.')
|
||||
let major = get(versions, 0, 0)
|
||||
let minor = get(versions, 1, 0)
|
||||
let patch = get(versions, 2, 0)
|
||||
let min_version = major * 100 + minor
|
||||
return v:version < min_version ||
|
||||
\ (patch != 0 && v:version == min_version && !has('patch'.patch))
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
892
bundle/neobundle.vim/autoload/neobundle/installer.vim
Normal file
892
bundle/neobundle.vim/autoload/neobundle/installer.vim
Normal file
@ -0,0 +1,892 @@
|
||||
"=============================================================================
|
||||
" FILE: installer.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:install_info_version = '3.0'
|
||||
|
||||
let s:log = []
|
||||
let s:updates_log = []
|
||||
|
||||
function! neobundle#installer#update(bundles) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return
|
||||
endif
|
||||
|
||||
let all_bundles = neobundle#config#get_enabled_bundles()
|
||||
|
||||
call neobundle#commands#helptags(all_bundles)
|
||||
call s:reload(filter(copy(a:bundles),
|
||||
\ "v:val.sourced && !v:val.disabled && v:val.rtp != ''"))
|
||||
|
||||
call s:save_install_info(all_bundles)
|
||||
|
||||
let lazy_bundles = filter(copy(all_bundles), 'v:val.lazy')
|
||||
call neobundle#util#merge_bundle_files(
|
||||
\ lazy_bundles, 'ftdetect')
|
||||
call neobundle#util#merge_bundle_files(
|
||||
\ lazy_bundles, 'after/ftdetect')
|
||||
|
||||
" For neovim remote plugins
|
||||
NeoBundleRemotePlugins
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#build(bundle) abort "{{{
|
||||
if !empty(a:bundle.build_commands)
|
||||
\ && neobundle#config#check_commands(a:bundle.build_commands)
|
||||
call neobundle#installer#log(
|
||||
\ printf('|%s| ' .
|
||||
\ 'Build dependencies not met. Skipped', a:bundle.name))
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Environment check.
|
||||
let build = get(a:bundle, 'build', {})
|
||||
if type(build) == type('')
|
||||
let cmd = build
|
||||
elseif neobundle#util#is_windows() && has_key(build, 'windows')
|
||||
let cmd = build.windows
|
||||
elseif neobundle#util#is_mac() && has_key(build, 'mac')
|
||||
let cmd = build.mac
|
||||
elseif neobundle#util#is_cygwin() && has_key(build, 'cygwin')
|
||||
let cmd = build.cygwin
|
||||
elseif !neobundle#util#is_windows() && has_key(build, 'linux')
|
||||
\ && !executable('gmake')
|
||||
let cmd = build.linux
|
||||
elseif !neobundle#util#is_windows() && has_key(build, 'unix')
|
||||
let cmd = build.unix
|
||||
elseif has_key(build, 'others')
|
||||
let cmd = build.others
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
|
||||
call neobundle#installer#log('Building...')
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
if !neobundle#util#has_vimproc()
|
||||
let result = neobundle#util#system(cmd)
|
||||
|
||||
if neobundle#util#get_last_status()
|
||||
call neobundle#installer#error(result)
|
||||
else
|
||||
call neobundle#installer#log(result)
|
||||
endif
|
||||
else
|
||||
call s:async_system(cmd)
|
||||
endif
|
||||
catch
|
||||
" Build error from vimproc.
|
||||
let message = (v:exception !~# '^Vim:')?
|
||||
\ v:exception : v:exception . ' ' . v:throwpoint
|
||||
call neobundle#installer#error(message)
|
||||
|
||||
return 1
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
return neobundle#util#get_last_status()
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#reinstall(bundles) abort "{{{
|
||||
let bundles = neobundle#util#uniq(a:bundles)
|
||||
|
||||
for bundle in bundles
|
||||
if bundle.type ==# 'none'
|
||||
\ || bundle.local
|
||||
\ || bundle.normalized_name ==# 'neobundle'
|
||||
\ || (bundle.sourced &&
|
||||
\ index(['vimproc', 'unite'], bundle.normalized_name) >= 0)
|
||||
call neobundle#installer#error(
|
||||
\ printf('|%s| Cannot reinstall the plugin!', bundle.name))
|
||||
continue
|
||||
endif
|
||||
|
||||
" Reinstall.
|
||||
call neobundle#installer#log(
|
||||
\ printf('|%s| Reinstalling...', bundle.name))
|
||||
|
||||
" Save info.
|
||||
let arg = copy(bundle.orig_arg)
|
||||
|
||||
" Remove.
|
||||
call neobundle#commands#clean(1, bundle.name)
|
||||
|
||||
call call('neobundle#parser#bundle', [arg])
|
||||
endfor
|
||||
|
||||
call s:save_install_info(neobundle#config#get_neobundles())
|
||||
|
||||
" Install.
|
||||
call neobundle#commands#install(0,
|
||||
\ join(map(copy(bundles), 'v:val.name')))
|
||||
|
||||
call neobundle#installer#update(bundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_reinstall_bundles(bundles) abort "{{{
|
||||
call neobundle#installer#_load_install_info(a:bundles)
|
||||
|
||||
let reinstall_bundles = filter(copy(a:bundles),
|
||||
\ "neobundle#config#is_installed(v:val.name)
|
||||
\ && v:val.type !=# 'none'
|
||||
\ && !v:val.local
|
||||
\ && v:val.path ==# v:val.installed_path
|
||||
\ && v:val.uri !=# v:val.installed_uri")
|
||||
if !empty(reinstall_bundles)
|
||||
call neobundle#util#print_error(
|
||||
\ 'Reinstall bundles are detected!')
|
||||
|
||||
for bundle in reinstall_bundles
|
||||
echomsg printf('%s: %s -> %s',
|
||||
\ bundle.name, bundle.installed_uri, bundle.uri)
|
||||
endfor
|
||||
|
||||
let cwd = neobundle#util#substitute_path_separator(getcwd())
|
||||
let warning_bundles = map(filter(copy(reinstall_bundles),
|
||||
\ 'v:val.path ==# cwd'), 'v:val.path')
|
||||
if !empty(warning_bundles)
|
||||
call neobundle#util#print_error(
|
||||
\ 'Warning: current directory is the
|
||||
\ reinstall bundles directory! ' . string(warning_bundles))
|
||||
endif
|
||||
let ret = confirm('Reinstall bundles now?', "yes\nNo", 2)
|
||||
redraw
|
||||
if ret != 1
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
return reinstall_bundles
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_updated_bundles_message(bundles) abort "{{{
|
||||
let msg = ''
|
||||
|
||||
let installed_bundles = filter(copy(a:bundles),
|
||||
\ "v:val.old_rev == ''")
|
||||
if !empty(installed_bundles)
|
||||
let msg .= "\nInstalled bundles:\n".
|
||||
\ join(map(copy(installed_bundles),
|
||||
\ "' ' . v:val.name"), "\n")
|
||||
endif
|
||||
|
||||
let updated_bundles = filter(copy(a:bundles),
|
||||
\ "v:val.old_rev != ''")
|
||||
if !empty(updated_bundles)
|
||||
let msg .= "\nUpdated bundles:\n".
|
||||
\ join(map(updated_bundles,
|
||||
\ "' ' . v:val.name . (v:val.commit_count == 0 ? ''
|
||||
\ : printf('(%d change%s)',
|
||||
\ v:val.commit_count,
|
||||
\ (v:val.commit_count == 1 ? '' : 's')))
|
||||
\ . (v:val.uri =~ '^\\h\\w*://github.com/' ? \"\\n\"
|
||||
\ . printf(' %s/compare/%s...%s',
|
||||
\ substitute(substitute(v:val.uri, '\\.git$', '', ''),
|
||||
\ '^\\h\\w*:', 'https:', ''),
|
||||
\ v:val.old_rev, v:val.new_rev) : '')")
|
||||
\ , "\n")
|
||||
endif
|
||||
|
||||
return msg
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_errored_bundles_message(bundles) abort "{{{
|
||||
if empty(a:bundles)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let msg = "\nError installing bundles:\n".join(
|
||||
\ map(copy(a:bundles), "' ' . v:val.name"), "\n")
|
||||
let msg .= "\n"
|
||||
let msg .= "Please read the error message log with the :message command.\n"
|
||||
|
||||
return msg
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_sync_command(bang, bundle, number, max) abort "{{{
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
if empty(type)
|
||||
return ['E: Unknown Type', '']
|
||||
endif
|
||||
|
||||
let is_directory = isdirectory(a:bundle.path)
|
||||
|
||||
let cmd = type.get_sync_command(a:bundle)
|
||||
|
||||
if cmd == ''
|
||||
return ['', 'Not supported sync action.']
|
||||
elseif (is_directory && !a:bang
|
||||
\ && a:bundle.install_rev ==#
|
||||
\ neobundle#installer#get_revision_number(a:bundle))
|
||||
return ['', 'Already installed.']
|
||||
endif
|
||||
|
||||
let message = printf('(%'.len(a:max).'d/%d): |%s| %s',
|
||||
\ a:number, a:max, a:bundle.name, cmd)
|
||||
|
||||
return [cmd, message]
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_revision_lock_command(bang, bundle, number, max) abort "{{{
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
if empty(type)
|
||||
return ['E: Unknown Type', '']
|
||||
endif
|
||||
|
||||
let cmd = type.get_revision_lock_command(a:bundle)
|
||||
|
||||
if cmd == ''
|
||||
return ['', '']
|
||||
endif
|
||||
|
||||
return [cmd, '']
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_revision_number(bundle) abort "{{{
|
||||
let cwd = getcwd()
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
|
||||
if !isdirectory(a:bundle.path)
|
||||
\ || !has_key(type, 'get_revision_number_command')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let cmd = type.get_revision_number_command(a:bundle)
|
||||
if cmd == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
try
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
let rev = neobundle#util#system(cmd)
|
||||
|
||||
if type.name ==# 'vba' || type.name ==# 'raw'
|
||||
" If rev is ok, the output is the checksum followed by the filename
|
||||
" separated by two spaces.
|
||||
let pat = '^[0-9a-f]\+ ' . a:bundle.path . '/' .
|
||||
\ fnamemodify(a:bundle.uri, ':t') . '$'
|
||||
return (rev =~# pat) ? matchstr(rev, '^[0-9a-f]\+') : ''
|
||||
else
|
||||
" If rev contains spaces, it is error message
|
||||
return (rev !~ '\s') ? rev : ''
|
||||
endif
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_commit_date(bundle) abort "{{{
|
||||
let cwd = getcwd()
|
||||
try
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
|
||||
if !isdirectory(a:bundle.path) ||
|
||||
\ !has_key(type, 'get_commit_date_command')
|
||||
return 0
|
||||
endif
|
||||
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
return neobundle#util#system(
|
||||
\ type.get_commit_date_command(a:bundle))
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_updated_log_message(bundle, new_rev, old_rev) abort "{{{
|
||||
let cwd = getcwd()
|
||||
try
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
let log_command = has_key(type, 'get_log_command') ?
|
||||
\ type.get_log_command(a:bundle, a:new_rev, a:old_rev) : ''
|
||||
let log = (log_command != '' ?
|
||||
\ neobundle#util#system(log_command) : '')
|
||||
return log != '' ? log :
|
||||
\ (a:old_rev == a:new_rev) ? ''
|
||||
\ : printf('%s -> %s', a:old_rev, a:new_rev)
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#sync(bundle, context, is_unite) abort "{{{
|
||||
let a:context.source__number += 1
|
||||
|
||||
let num = a:context.source__number
|
||||
let max = a:context.source__max_bundles
|
||||
|
||||
let before_one_day = localtime() - 60 * 60 * 24
|
||||
let before_one_week = localtime() - 60 * 60 * 24 * 7
|
||||
|
||||
if a:context.source__bang == 1 &&
|
||||
\ a:bundle.frozen
|
||||
let [cmd, message] = ['', 'is frozen.']
|
||||
elseif a:context.source__bang == 1 &&
|
||||
\ a:bundle.uri ==# a:bundle.installed_uri &&
|
||||
\ a:bundle.updated_time < before_one_week
|
||||
\ && a:bundle.checked_time >= before_one_day
|
||||
let [cmd, message] = ['', 'Outdated plugin.']
|
||||
else
|
||||
let [cmd, message] =
|
||||
\ neobundle#installer#get_sync_command(
|
||||
\ a:context.source__bang, a:bundle,
|
||||
\ a:context.source__number, a:context.source__max_bundles)
|
||||
endif
|
||||
|
||||
if cmd == ''
|
||||
" Skipped.
|
||||
call neobundle#installer#log(s:get_skipped_message(
|
||||
\ num, max, a:bundle, '', message), a:is_unite)
|
||||
return
|
||||
elseif cmd =~# '^E: '
|
||||
" Errored.
|
||||
|
||||
call neobundle#installer#update_log(
|
||||
\ printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, a:bundle.name, 'Error'), a:is_unite)
|
||||
call neobundle#installer#error(cmd[3:])
|
||||
call add(a:context.source__errored_bundles,
|
||||
\ a:bundle)
|
||||
return
|
||||
endif
|
||||
|
||||
call neobundle#installer#log(message, a:is_unite)
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
let lang_save = $LANG
|
||||
let $LANG = 'C'
|
||||
|
||||
" Cd to bundle path.
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
|
||||
let rev = neobundle#installer#get_revision_number(a:bundle)
|
||||
|
||||
let process = {
|
||||
\ 'number' : num,
|
||||
\ 'rev' : rev,
|
||||
\ 'bundle' : a:bundle,
|
||||
\ 'output' : '',
|
||||
\ 'status' : -1,
|
||||
\ 'eof' : 0,
|
||||
\ 'start_time' : localtime(),
|
||||
\ }
|
||||
|
||||
if isdirectory(a:bundle.path) && !a:bundle.local
|
||||
let rev_save = a:bundle.rev
|
||||
try
|
||||
" Force checkout HEAD revision.
|
||||
" The repository may be checked out.
|
||||
let a:bundle.rev = ''
|
||||
|
||||
call neobundle#installer#lock_revision(
|
||||
\ process, a:context, a:is_unite)
|
||||
finally
|
||||
let a:bundle.rev = rev_save
|
||||
endtry
|
||||
endif
|
||||
|
||||
if has('nvim') && a:is_unite
|
||||
" Use neovim async jobs
|
||||
let process.proc = jobstart(
|
||||
\ iconv(cmd, &encoding, 'char'), {
|
||||
\ 'on_stdout' : function('s:job_handler'),
|
||||
\ 'on_stderr' : function('s:job_handler'),
|
||||
\ 'on_exit' : function('s:job_handler'),
|
||||
\ })
|
||||
elseif neobundle#util#has_vimproc()
|
||||
let process.proc = vimproc#pgroup_open(vimproc#util#iconv(
|
||||
\ cmd, &encoding, 'char'), 0, 2)
|
||||
|
||||
" Close handles.
|
||||
call process.proc.stdin.close()
|
||||
call process.proc.stderr.close()
|
||||
else
|
||||
let process.output = neobundle#util#system(cmd)
|
||||
let process.status = neobundle#util#get_last_status()
|
||||
endif
|
||||
finally
|
||||
let $LANG = lang_save
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
call add(a:context.source__processes, process)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#check_output(context, process, is_unite) abort "{{{
|
||||
if has('nvim') && a:is_unite && has_key(a:process, 'proc')
|
||||
let is_timeout = (localtime() - a:process.start_time)
|
||||
\ >= a:process.bundle.install_process_timeout
|
||||
|
||||
if !has_key(s:job_info, a:process.proc)
|
||||
return
|
||||
endif
|
||||
|
||||
let job = s:job_info[a:process.proc]
|
||||
|
||||
if !job.eof && !is_timeout
|
||||
let output = join(job.candidates[: -2], "\n")
|
||||
if output != ''
|
||||
let a:process.output .= output
|
||||
call neobundle#util#redraw_echo(output)
|
||||
endif
|
||||
let job.candidates = job.candidates[-1:]
|
||||
return
|
||||
else
|
||||
if is_timeout
|
||||
call jobstop(a:process.proc)
|
||||
endif
|
||||
let output = join(job.candidates, "\n")
|
||||
if output != ''
|
||||
let a:process.output .= output
|
||||
call neobundle#util#redraw_echo(output)
|
||||
endif
|
||||
let job.candidates = []
|
||||
endif
|
||||
|
||||
let status = job.status
|
||||
elseif neobundle#util#has_vimproc() && has_key(a:process, 'proc')
|
||||
let is_timeout = (localtime() - a:process.start_time)
|
||||
\ >= a:process.bundle.install_process_timeout
|
||||
let output = vimproc#util#iconv(
|
||||
\ a:process.proc.stdout.read(-1, 300), 'char', &encoding)
|
||||
if output != ''
|
||||
let a:process.output .= output
|
||||
call neobundle#util#redraw_echo(output)
|
||||
endif
|
||||
if !a:process.proc.stdout.eof && !is_timeout
|
||||
return
|
||||
endif
|
||||
call a:process.proc.stdout.close()
|
||||
|
||||
let status = a:process.proc.waitpid()[1]
|
||||
else
|
||||
let is_timeout = 0
|
||||
let status = a:process.status
|
||||
endif
|
||||
|
||||
let num = a:process.number
|
||||
let max = a:context.source__max_bundles
|
||||
let bundle = a:process.bundle
|
||||
|
||||
if bundle.rev != '' || !a:context.source__bang
|
||||
" Restore revision.
|
||||
let rev_save = bundle.rev
|
||||
try
|
||||
if !a:context.source__bang && bundle.rev == ''
|
||||
" Checkout install_rev revision.
|
||||
let bundle.rev = bundle.install_rev
|
||||
endif
|
||||
|
||||
call neobundle#installer#lock_revision(
|
||||
\ a:process, a:context, a:is_unite)
|
||||
finally
|
||||
let bundle.rev = rev_save
|
||||
endtry
|
||||
endif
|
||||
|
||||
let rev = neobundle#installer#get_revision_number(bundle)
|
||||
|
||||
let updated_time = s:get_commit_date(bundle)
|
||||
let bundle.checked_time = localtime()
|
||||
|
||||
if is_timeout || status
|
||||
let message = printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, bundle.name, 'Error')
|
||||
call neobundle#installer#update_log(message, a:is_unite)
|
||||
call neobundle#installer#error(bundle.path)
|
||||
|
||||
call neobundle#installer#error(
|
||||
\ (is_timeout ? 'Process timeout.' :
|
||||
\ split(a:process.output, '\n')))
|
||||
|
||||
call add(a:context.source__errored_bundles,
|
||||
\ bundle)
|
||||
elseif a:process.rev ==# rev
|
||||
if updated_time != 0
|
||||
let bundle.updated_time = updated_time
|
||||
endif
|
||||
|
||||
call neobundle#installer#log(s:get_skipped_message(
|
||||
\ num, max, bundle, '', 'Same revision.'), a:is_unite)
|
||||
else
|
||||
call neobundle#installer#update_log(
|
||||
\ printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, bundle.name, 'Updated'), a:is_unite)
|
||||
if a:process.rev != ''
|
||||
let log_messages = split(
|
||||
\ neobundle#installer#get_updated_log_message(
|
||||
\ bundle, rev, a:process.rev), '\n')
|
||||
let bundle.commit_count = len(log_messages)
|
||||
call call((!has('vim_starting') ? 'neobundle#installer#update_log'
|
||||
\ : 'neobundle#installer#log'), [
|
||||
\ map(log_messages, "printf('|%s| ' .
|
||||
\ substitute(v:val, '%', '%%', 'g'), bundle.name)"),
|
||||
\ a:is_unite
|
||||
\ ])
|
||||
else
|
||||
let bundle.commit_count = 0
|
||||
endif
|
||||
|
||||
if updated_time == 0
|
||||
let updated_time = bundle.checked_time
|
||||
endif
|
||||
let bundle.updated_time = updated_time
|
||||
let bundle.installed_uri = bundle.uri
|
||||
let bundle.revisions[updated_time] = rev
|
||||
let bundle.old_rev = a:process.rev
|
||||
let bundle.new_rev = rev
|
||||
if neobundle#installer#build(bundle)
|
||||
\ && confirm('Build failed. Uninstall "'
|
||||
\ .bundle.name.'" now?', "yes\nNo", 2) == 1
|
||||
" Remove.
|
||||
call neobundle#commands#clean(1, bundle.name)
|
||||
else
|
||||
call add(a:context.source__synced_bundles, bundle)
|
||||
endif
|
||||
endif
|
||||
|
||||
let bundle.install_rev = rev
|
||||
|
||||
let a:process.eof = 1
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#lock_revision(process, context, is_unite) abort "{{{
|
||||
let num = a:process.number
|
||||
let max = a:context.source__max_bundles
|
||||
let bundle = a:process.bundle
|
||||
|
||||
let bundle.new_rev = neobundle#installer#get_revision_number(bundle)
|
||||
|
||||
let [cmd, message] =
|
||||
\ neobundle#installer#get_revision_lock_command(
|
||||
\ a:context.source__bang, bundle, num, max)
|
||||
|
||||
if cmd == '' || bundle.new_rev ==# bundle.rev
|
||||
" Skipped.
|
||||
return 0
|
||||
elseif cmd =~# '^E: '
|
||||
" Errored.
|
||||
call neobundle#installer#error(bundle.path)
|
||||
call neobundle#installer#error(cmd[3:])
|
||||
return -1
|
||||
endif
|
||||
|
||||
if bundle.rev != ''
|
||||
call neobundle#installer#log(
|
||||
\ printf('(%'.len(max).'d/%d): |%s| %s',
|
||||
\ num, max, bundle.name, 'Locked'), a:is_unite)
|
||||
|
||||
call neobundle#installer#log(message, a:is_unite)
|
||||
endif
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
" Cd to bundle path.
|
||||
call neobundle#util#cd(bundle.path)
|
||||
|
||||
let result = neobundle#util#system(cmd)
|
||||
let status = neobundle#util#get_last_status()
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
if status
|
||||
call neobundle#installer#error(bundle.path)
|
||||
call neobundle#installer#error(result)
|
||||
return -1
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_release_revision(bundle, command) abort "{{{
|
||||
let cwd = getcwd()
|
||||
let rev = ''
|
||||
try
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
let rev = get(neobundle#util#sort_human(
|
||||
\ split(neobundle#util#system(a:command), '\n')), -1, '')
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
return rev
|
||||
endfunction"}}}
|
||||
|
||||
function! s:save_install_info(bundles) abort "{{{
|
||||
let s:install_info = {}
|
||||
for bundle in filter(copy(a:bundles),
|
||||
\ "!v:val.local && has_key(v:val, 'updated_time')")
|
||||
" Note: Don't save local repository.
|
||||
let s:install_info[bundle.name] = {
|
||||
\ 'checked_time' : bundle.checked_time,
|
||||
\ 'updated_time' : bundle.updated_time,
|
||||
\ 'installed_uri' : bundle.installed_uri,
|
||||
\ 'installed_path' : bundle.path,
|
||||
\ 'revisions' : bundle.revisions,
|
||||
\ }
|
||||
endfor
|
||||
|
||||
call neobundle#util#writefile('install_info',
|
||||
\ [s:install_info_version, string(s:install_info)])
|
||||
|
||||
" Save lock file
|
||||
call s:save_lockfile(a:bundles)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#_load_install_info(bundles) abort "{{{
|
||||
let install_info_path =
|
||||
\ neobundle#get_neobundle_dir() . '/.neobundle/install_info'
|
||||
if !exists('s:install_info')
|
||||
call s:source_lockfile()
|
||||
|
||||
let s:install_info = {}
|
||||
|
||||
if filereadable(install_info_path)
|
||||
try
|
||||
let list = readfile(install_info_path)
|
||||
let ver = list[0]
|
||||
sandbox let s:install_info = eval(list[1])
|
||||
if ver !=# s:install_info_version
|
||||
\ || type(s:install_info) != type({})
|
||||
let s:install_info = {}
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
endif
|
||||
|
||||
call map(a:bundles, "extend(v:val, get(s:install_info, v:val.name, {
|
||||
\ 'checked_time' : localtime(),
|
||||
\ 'updated_time' : localtime(),
|
||||
\ 'installed_uri' : v:val.uri,
|
||||
\ 'installed_path' : v:val.path,
|
||||
\ 'revisions' : {},
|
||||
\}))")
|
||||
|
||||
return s:install_info
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_skipped_message(number, max, bundle, prefix, message) abort "{{{
|
||||
let messages = [a:prefix . printf('(%'.len(a:max).'d/%d): |%s| %s',
|
||||
\ a:number, a:max, a:bundle.name, 'Skipped')]
|
||||
if a:message != ''
|
||||
call add(messages, a:prefix . a:message)
|
||||
endif
|
||||
return messages
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#log(msg, ...) abort "{{{
|
||||
let msg = neobundle#util#convert2list(a:msg)
|
||||
if empty(msg)
|
||||
return
|
||||
endif
|
||||
call extend(s:log, msg)
|
||||
|
||||
call s:append_log_file(msg)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#update_log(msg, ...) abort "{{{
|
||||
let is_unite = get(a:000, 0, 0)
|
||||
|
||||
if !(&filetype == 'unite' || is_unite)
|
||||
call neobundle#util#redraw_echo(a:msg)
|
||||
endif
|
||||
|
||||
call neobundle#installer#log(a:msg)
|
||||
|
||||
let s:updates_log += neobundle#util#convert2list(a:msg)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#echomsg(msg) abort "{{{
|
||||
call neobundle#util#redraw_echomsg(a:msg)
|
||||
|
||||
call neobundle#installer#log(a:msg)
|
||||
|
||||
let s:updates_log += neobundle#util#convert2list(a:msg)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#error(msg) abort "{{{
|
||||
let msgs = neobundle#util#convert2list(a:msg)
|
||||
if empty(msgs)
|
||||
return
|
||||
endif
|
||||
call extend(s:log, msgs)
|
||||
call extend(s:updates_log, msgs)
|
||||
|
||||
call neobundle#util#print_error(msgs)
|
||||
call s:append_log_file(msgs)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:append_log_file(msg) abort "{{{
|
||||
if g:neobundle#log_filename == ''
|
||||
return
|
||||
endif
|
||||
|
||||
let msg = a:msg
|
||||
" Appends to log file.
|
||||
if filereadable(g:neobundle#log_filename)
|
||||
let msg = readfile(g:neobundle#log_filename) + msg
|
||||
endif
|
||||
|
||||
let dir = fnamemodify(g:neobundle#log_filename, ':h')
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
call writefile(msg, g:neobundle#log_filename)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_log() abort "{{{
|
||||
return s:log
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_updates_log() abort "{{{
|
||||
return s:updates_log
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#clear_log() abort "{{{
|
||||
let s:log = []
|
||||
let s:updates_log = []
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_progress_message(bundle, number, max) abort "{{{
|
||||
return printf('(%'.len(a:max).'d/%d) [%-20s] %s',
|
||||
\ a:number, a:max,
|
||||
\ repeat('=', (a:number*20/a:max)), a:bundle.name)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#installer#get_tags_info() abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/.neobundle/tags_info'
|
||||
if !filereadable(path)
|
||||
return []
|
||||
endif
|
||||
|
||||
return readfile(path)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:save_lockfile(bundles) abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/NeoBundle.lock'
|
||||
let dir = fnamemodify(path, ':h')
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
|
||||
return writefile(sort(map(filter(map(copy(a:bundles),
|
||||
\ '[v:val.name, neobundle#installer#get_revision_number(v:val)]'),
|
||||
\ "v:val[1] != '' && v:val[1] !~ '\s'"),
|
||||
\ "printf('NeoBundleLock %s %s',
|
||||
\ escape(v:val[0], ' \'), v:val[1])")), path)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_lockfile() abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/NeoBundle.lock'
|
||||
if filereadable(path)
|
||||
execute 'source' fnameescape(path)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:reload(bundles) abort "{{{
|
||||
if empty(a:bundles)
|
||||
return
|
||||
endif
|
||||
|
||||
call filter(copy(a:bundles), 'neobundle#config#rtp_add(v:val)')
|
||||
|
||||
silent! runtime! ftdetect/**/*.vim
|
||||
silent! runtime! after/ftdetect/**/*.vim
|
||||
silent! runtime! plugin/**/*.vim
|
||||
silent! runtime! after/plugin/**/*.vim
|
||||
|
||||
" Call hooks.
|
||||
call neobundle#call_hook('on_post_source', a:bundles)
|
||||
endfunction"}}}
|
||||
|
||||
let s:job_info = {}
|
||||
function! s:job_handler(job_id, data, event) abort "{{{
|
||||
if !has_key(s:job_info, a:job_id)
|
||||
let s:job_info[a:job_id] = {
|
||||
\ 'candidates' : [],
|
||||
\ 'eof' : 0,
|
||||
\ 'status' : -1,
|
||||
\ }
|
||||
endif
|
||||
|
||||
let job = s:job_info[a:job_id]
|
||||
|
||||
if a:event ==# 'exit'
|
||||
let job.eof = 1
|
||||
let job.status = a:data
|
||||
return
|
||||
endif
|
||||
|
||||
let lines = a:data
|
||||
|
||||
let candidates = job.candidates
|
||||
if !empty(lines) && lines[0] != "\n" && !empty(job.candidates)
|
||||
" Join to the previous line
|
||||
let candidates[-1] .= lines[0]
|
||||
call remove(lines, 0)
|
||||
endif
|
||||
|
||||
let candidates += map(lines, "iconv(v:val, 'char', &encoding)")
|
||||
endfunction"}}}
|
||||
|
||||
function! s:async_system(cmd) abort "{{{
|
||||
let proc = vimproc#pgroup_open(a:cmd)
|
||||
|
||||
" Close handles.
|
||||
call proc.stdin.close()
|
||||
|
||||
while !proc.stdout.eof
|
||||
if !proc.stderr.eof
|
||||
" Print error.
|
||||
call neobundle#installer#error(proc.stderr.read_lines(-1, 100))
|
||||
endif
|
||||
|
||||
call neobundle#util#redraw_echo(proc.stdout.read_lines(-1, 100))
|
||||
endwhile
|
||||
|
||||
if !proc.stderr.eof
|
||||
" Print error.
|
||||
call neobundle#installer#error(proc.stderr.read_lines(-1, 100))
|
||||
endif
|
||||
|
||||
call proc.waitpid()
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
84
bundle/neobundle.vim/autoload/neobundle/metadata.vim
Normal file
84
bundle/neobundle.vim/autoload/neobundle/metadata.vim
Normal file
@ -0,0 +1,84 @@
|
||||
"=============================================================================
|
||||
" FILE: metadata.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:metadata = {}
|
||||
let s:repository =
|
||||
\ 'https://gist.githubusercontent.com/Shougo/'
|
||||
\ . '028d6ae320cc8f354f88/raw/'
|
||||
\ . '3b62ad42d39a4d3d4f236a45e00eb6b03ca23352/vim-pi.json'
|
||||
|
||||
function! neobundle#metadata#get(...) abort "{{{
|
||||
if empty(s:metadata)
|
||||
call s:load()
|
||||
endif
|
||||
return (a:0 == 0) ? copy(s:metadata) : get(s:metadata, a:1, {})
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#metadata#update() abort "{{{
|
||||
" Reload cache.
|
||||
let cache_path = neobundle#get_neobundle_dir() . '/.neobundle/metadata.json'
|
||||
|
||||
if filereadable(cache_path)
|
||||
call delete(cache_path)
|
||||
endif
|
||||
|
||||
let cmd = neobundle#util#wget(s:repository, cache_path)
|
||||
if cmd =~# '^E:'
|
||||
call neobundle#util#print_error(
|
||||
\ 'curl or wget command is not available!')
|
||||
return
|
||||
endif
|
||||
|
||||
let result = neobundle#util#system(cmd)
|
||||
|
||||
if neobundle#util#get_last_status()
|
||||
call neobundle#util#print_error('Error occurred!')
|
||||
call neobundle#util#print_error(cmd)
|
||||
call neobundle#util#print_error(result)
|
||||
elseif !filereadable(cache_path)
|
||||
call neobundle#util#print_error('Temporary file was not created!')
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:load() abort "{{{
|
||||
" Reload cache.
|
||||
let cache_path = neobundle#get_neobundle_dir() . '/.neobundle/metadata.json'
|
||||
|
||||
if !filereadable(cache_path)
|
||||
call neobundle#metadata#update()
|
||||
endif
|
||||
|
||||
sandbox let s:metadata = eval(get(readfile(cache_path), 0, '{}'))
|
||||
|
||||
return s:metadata
|
||||
endfunction"}}}
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
314
bundle/neobundle.vim/autoload/neobundle/parser.vim
Normal file
314
bundle/neobundle.vim/autoload/neobundle/parser.vim
Normal file
@ -0,0 +1,314 @@
|
||||
"=============================================================================
|
||||
" FILE: parser.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" Copyright (C) 2010 http://github.com/gmarik
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#parser#bundle(arg, ...) abort "{{{
|
||||
let bundle = s:parse_arg(a:arg)
|
||||
let is_parse_only = get(a:000, 0, 0)
|
||||
if !is_parse_only
|
||||
call neobundle#config#add(bundle)
|
||||
|
||||
if !neobundle#config#within_block()
|
||||
\ && !bundle.lazy && has('vim_starting')
|
||||
call neobundle#util#print_error(
|
||||
\ '`NeoBundle` commands must be executed within' .
|
||||
\ ' a neobundle#begin/end block. Please check your usage.')
|
||||
endif
|
||||
endif
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#lazy(arg) abort "{{{
|
||||
let bundle = s:parse_arg(a:arg)
|
||||
if empty(bundle)
|
||||
return {}
|
||||
endif
|
||||
|
||||
" Update lazy flag.
|
||||
let bundle.lazy = 1
|
||||
let bundle.orig_opts.lazy = 1
|
||||
for depend in bundle.depends
|
||||
let depend.lazy = bundle.lazy
|
||||
endfor
|
||||
|
||||
call neobundle#config#add(bundle)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#fetch(arg) abort "{{{
|
||||
let bundle = s:parse_arg(a:arg)
|
||||
if empty(bundle)
|
||||
return {}
|
||||
endif
|
||||
|
||||
" Clear runtimepath.
|
||||
let bundle.fetch = 1
|
||||
let bundle.rtp = ''
|
||||
|
||||
call neobundle#config#add(bundle)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#direct(arg) abort "{{{
|
||||
let bundle = neobundle#parser#bundle(a:arg, 1)
|
||||
|
||||
if empty(bundle)
|
||||
return {}
|
||||
endif
|
||||
|
||||
if !empty(neobundle#get(bundle.name))
|
||||
call neobundle#util#print_error(
|
||||
\ bundle.name . ' is already installed.')
|
||||
return {}
|
||||
endif
|
||||
|
||||
call neobundle#config#add(bundle)
|
||||
|
||||
call neobundle#config#save_direct(a:arg)
|
||||
|
||||
" Direct install.
|
||||
call neobundle#commands#install(0, bundle.name)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! s:parse_arg(arg) abort "{{{
|
||||
let arg = type(a:arg) == type([]) ?
|
||||
\ string(a:arg) : '[' . a:arg . ']'
|
||||
let args = eval(arg)
|
||||
if empty(args)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ args[0], args[1:])
|
||||
if empty(bundle)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let bundle.orig_arg = copy(a:arg)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#_init_bundle(name, opts) abort "{{{
|
||||
let path = substitute(a:name, "['".'"]\+', '', 'g')
|
||||
if path[0] == '~'
|
||||
let path = neobundle#util#expand(path)
|
||||
endif
|
||||
let opts = s:parse_options(a:opts)
|
||||
let bundle = extend(neobundle#parser#path(
|
||||
\ path, opts), opts)
|
||||
|
||||
let bundle.orig_name = a:name
|
||||
let bundle.orig_path = path
|
||||
let bundle.orig_opts = opts
|
||||
let bundle.orig_arg = string(a:name).', '.string(opts)
|
||||
|
||||
let bundle = neobundle#init#_bundle(bundle)
|
||||
|
||||
return bundle
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#local(localdir, options, includes) abort "{{{
|
||||
let base = fnamemodify(neobundle#util#expand(a:localdir), ':p')
|
||||
let directories = []
|
||||
for glob in a:includes
|
||||
let directories += map(filter(split(glob(base . glob), '\n'),
|
||||
\ "isdirectory(v:val)"), "
|
||||
\ substitute(neobundle#util#substitute_path_separator(
|
||||
\ fnamemodify(v:val, ':p')), '/$', '', '')")
|
||||
endfor
|
||||
|
||||
for dir in neobundle#util#uniq(directories)
|
||||
let options = extend({ 'local' : 1, 'base' : base }, a:options)
|
||||
let name = fnamemodify(dir, ':t')
|
||||
let bundle = neobundle#get(name)
|
||||
if !empty(bundle) && !bundle.sourced
|
||||
call extend(options, copy(bundle.orig_opts))
|
||||
if bundle.lazy
|
||||
let options.lazy = 1
|
||||
endif
|
||||
|
||||
call neobundle#config#rm(bundle)
|
||||
endif
|
||||
|
||||
call neobundle#parser#bundle([dir, options])
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#load_toml(filename, default) abort "{{{
|
||||
try
|
||||
let toml = neobundle#TOML#parse_file(neobundle#util#expand(a:filename))
|
||||
catch /vital: Text.TOML:/
|
||||
call neobundle#util#print_error(
|
||||
\ 'Invalid toml format: ' . a:filename)
|
||||
call neobundle#util#print_error(v:exception)
|
||||
return 1
|
||||
endtry
|
||||
if type(toml) != type({}) || !has_key(toml, 'plugins')
|
||||
call neobundle#util#print_error(
|
||||
\ 'Invalid toml file: ' . a:filename)
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Parse.
|
||||
for plugin in toml.plugins
|
||||
if has_key(plugin, 'repository')
|
||||
let plugin.repo = plugin.repository
|
||||
endif
|
||||
if !has_key(plugin, 'repo')
|
||||
call neobundle#util#print_error(
|
||||
\ 'No repository plugin data: ' . a:filename)
|
||||
return 1
|
||||
endif
|
||||
|
||||
if has_key(plugin, 'depends')
|
||||
let _ = []
|
||||
for depend in neobundle#util#convert2list(plugin.depends)
|
||||
if type(depend) == type('') || type(depend) == type([])
|
||||
call add(_, depend)
|
||||
elseif type(depend) == type({})
|
||||
if has_key(depend, 'repository')
|
||||
let plugin.repo = plugin.repository
|
||||
endif
|
||||
if !has_key(depend, 'repo')
|
||||
call neobundle#util#print_error(
|
||||
\ 'No repository plugin data: ' . a:filename)
|
||||
return 1
|
||||
endif
|
||||
|
||||
call add(_, [depend.repo, depend])
|
||||
endif
|
||||
|
||||
unlet depend
|
||||
endfor
|
||||
|
||||
let plugin.depends = _
|
||||
endif
|
||||
|
||||
let options = extend(plugin, a:default, 'keep')
|
||||
" echomsg string(options)
|
||||
call neobundle#parser#bundle([plugin.repo, options])
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#parser#path(path, ...) abort "{{{
|
||||
let opts = get(a:000, 0, {})
|
||||
let site = get(opts, 'site', g:neobundle#default_site)
|
||||
let path = substitute(a:path, '/$', '', '')
|
||||
|
||||
if path !~ '^/\|^\a:' && path !~ ':'
|
||||
" Add default site.
|
||||
let path = site . ':' . path
|
||||
endif
|
||||
|
||||
if has_key(opts, 'type')
|
||||
let type = neobundle#config#get_types(opts.type)
|
||||
let types = empty(type) ? [] : [type]
|
||||
else
|
||||
let detect = neobundle#config#get_types('git').detect(path, opts)
|
||||
if !empty(detect)
|
||||
let detect.name = neobundle#util#name_conversion(path)
|
||||
return detect
|
||||
endif
|
||||
|
||||
let types = neobundle#config#get_types()
|
||||
endif
|
||||
|
||||
let detect = {}
|
||||
for type in types
|
||||
let detect = type.detect(path, opts)
|
||||
if !empty(detect)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if empty(detect) && isdirectory(path)
|
||||
" Detect none type.
|
||||
return { 'uri' : path, 'type' : 'none' }
|
||||
endif
|
||||
|
||||
if !empty(detect) && !has_key(detect, 'name')
|
||||
let detect.name = neobundle#util#name_conversion(path)
|
||||
endif
|
||||
|
||||
return detect
|
||||
endfunction"}}}
|
||||
|
||||
function! s:parse_options(opts) abort "{{{
|
||||
if empty(a:opts)
|
||||
return has_key(g:neobundle#default_options, '_') ?
|
||||
\ copy(g:neobundle#default_options['_']) : {}
|
||||
endif
|
||||
|
||||
if len(a:opts) == 3
|
||||
" rev, default, options
|
||||
let [rev, default, options] = a:opts
|
||||
elseif len(a:opts) == 2 && type(a:opts[-1]) == type('')
|
||||
" rev, default
|
||||
let [rev, default, options] = a:opts + [{}]
|
||||
elseif len(a:opts) == 2 && type(a:opts[-1]) == type({})
|
||||
" rev, options
|
||||
let [rev, default, options] = [a:opts[0], '', a:opts[1]]
|
||||
elseif len(a:opts) == 1 && type(a:opts[-1]) == type('')
|
||||
" rev
|
||||
let [rev, default, options] = [a:opts[0], '', {}]
|
||||
elseif len(a:opts) == 1 && type(a:opts[-1]) == type({})
|
||||
" options
|
||||
let [rev, default, options] = ['', '', a:opts[0]]
|
||||
else
|
||||
call neobundle#installer#error(
|
||||
\ printf('Invalid option : "%s".', string(a:opts)))
|
||||
return {}
|
||||
endif
|
||||
|
||||
if rev != ''
|
||||
let options.rev = rev
|
||||
endif
|
||||
|
||||
if !has_key(options, 'default')
|
||||
let options.default = (default == '') ? '_' : default
|
||||
endif
|
||||
|
||||
" Set default options.
|
||||
if has_key(g:neobundle#default_options, options.default)
|
||||
call extend(options,
|
||||
\ g:neobundle#default_options[options.default], 'keep')
|
||||
endif
|
||||
|
||||
return options
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
119
bundle/neobundle.vim/autoload/neobundle/sources/github.vim
Normal file
119
bundle/neobundle.vim/autoload/neobundle/sources/github.vim
Normal file
@ -0,0 +1,119 @@
|
||||
"=============================================================================
|
||||
" FILE: github.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#sources#github#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'github',
|
||||
\ 'short_name' : 'github',
|
||||
\ }
|
||||
|
||||
" sorter
|
||||
let s:filter = {
|
||||
\ "name" : "sorter_stars",
|
||||
\}
|
||||
|
||||
function! s:filter.filter(candidates, context) abort
|
||||
return unite#util#sort_by(a:candidates, 'v:val.source__stars')
|
||||
endfunction
|
||||
|
||||
call unite#define_filter(s:filter)
|
||||
unlet s:filter
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
let plugins = s:get_github_searches(a:context.source__input)
|
||||
|
||||
|
||||
return map(copy(plugins), "{
|
||||
\ 'word' : v:val.full_name. ' ' . v:val.description,
|
||||
\ 'source__name' : (v:val.fork ? '| ' : '') .
|
||||
\ v:val.full_name,
|
||||
\ 'source__path' : v:val.full_name,
|
||||
\ 'source__description' : v:val.description,
|
||||
\ 'source__stars' : v:val.stargazers_count,
|
||||
\ 'source__options' : [],
|
||||
\ 'action__uri' : v:val.html_url,
|
||||
\ }")
|
||||
endfunction"}}}
|
||||
|
||||
" Misc.
|
||||
" @vimlint(EVL102, 1, l:true)
|
||||
" @vimlint(EVL102, 1, l:false)
|
||||
" @vimlint(EVL102, 1, l:null)
|
||||
function! s:get_github_searches(string) abort "{{{
|
||||
let uri = 'https://api.github.com/search/repositories?q='
|
||||
\ . a:string . '+language:VimL'.'\&sort=stars'.'\&order=desc'
|
||||
let temp = neobundle#util#substitute_path_separator(tempname())
|
||||
|
||||
let cmd = neobundle#util#wget(uri, temp)
|
||||
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:github] Searching plugins from github...')
|
||||
redraw
|
||||
|
||||
let result = unite#util#system(cmd)
|
||||
|
||||
if cmd =~# '^E:'
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:github] '.
|
||||
\ 'wget or curl command is not available!')
|
||||
return []
|
||||
elseif unite#util#get_last_status()
|
||||
call unite#print_message('[neobundle/search:github] ' . cmd)
|
||||
call unite#print_error('[neobundle/search:github] Error occurred!')
|
||||
call unite#print_error(result)
|
||||
return []
|
||||
elseif !filereadable(temp)
|
||||
call unite#print_error('[neobundle/search:github] '.
|
||||
\ 'Temporary file was not created!')
|
||||
return []
|
||||
else
|
||||
call unite#print_message('[neobundle/search:github] Done!')
|
||||
endif
|
||||
|
||||
let [true, false, null] = [1,0,"''"]
|
||||
sandbox let data = eval(join(readfile(temp)))
|
||||
call filter(data.items,
|
||||
\ "stridx(v:val.full_name, a:string) >= 0")
|
||||
|
||||
call delete(temp)
|
||||
|
||||
return data.items
|
||||
endfunction"}}}
|
||||
" @vimlint(EVL102, 0, l:true)
|
||||
" @vimlint(EVL102, 0, l:false)
|
||||
" @vimlint(EVL102, 0, l:null)
|
||||
|
||||
call unite#custom_source('neobundle/search', 'sorters', 'sorters_stars')
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
104
bundle/neobundle.vim/autoload/neobundle/sources/metadata.vim
Normal file
104
bundle/neobundle.vim/autoload/neobundle/sources/metadata.vim
Normal file
@ -0,0 +1,104 @@
|
||||
"=============================================================================
|
||||
" FILE: metadata.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:repository_cache = []
|
||||
|
||||
function! neobundle#sources#metadata#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'metadata',
|
||||
\ 'short_name' : 'meta',
|
||||
\ }
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
let plugins = s:get_repository_plugins(a:context)
|
||||
|
||||
try
|
||||
return map(copy(plugins), "{
|
||||
\ 'word' : v:val.name . ' ' . v:val.description,
|
||||
\ 'source__name' : v:val.name,
|
||||
\ 'source__path' : v:val.repository,
|
||||
\ 'source__script_type' : s:convert2script_type(v:val.raw_type),
|
||||
\ 'source__description' : v:val.description,
|
||||
\ 'source__options' : [],
|
||||
\ 'action__uri' : v:val.uri,
|
||||
\ }")
|
||||
catch
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:metadata] '
|
||||
\ .'Error occurred in loading cache.')
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:metadata] '
|
||||
\ .'Please re-make cache by <Plug>(unite_redraw) mapping.')
|
||||
call neobundle#installer#error(v:exception . ' ' . v:throwpoint)
|
||||
|
||||
return []
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
" Misc.
|
||||
function! s:get_repository_plugins(context) abort "{{{
|
||||
if a:context.is_redraw
|
||||
" Reload cache.
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:metadata] '
|
||||
\ .'Reloading cache from metadata repository')
|
||||
redraw
|
||||
|
||||
call neobundle#metadata#update()
|
||||
endif
|
||||
|
||||
return s:convert_metadata(neobundle#metadata#get())
|
||||
endfunction"}}}
|
||||
|
||||
function! s:convert_metadata(data) abort "{{{
|
||||
return values(map(copy(a:data), "{
|
||||
\ 'name' : v:key,
|
||||
\ 'raw_type' : get(v:val, 'script-type', ''),
|
||||
\ 'repository' : substitute(v:val.url, '^git://', 'https://', ''),
|
||||
\ 'description' : '',
|
||||
\ 'uri' : get(v:val, 'homepage', ''),
|
||||
\ }"))
|
||||
endfunction"}}}
|
||||
|
||||
function! s:convert2script_type(type) abort "{{{
|
||||
if a:type ==# 'utility'
|
||||
return 'plugin'
|
||||
elseif a:type ==# 'color scheme'
|
||||
return 'colors'
|
||||
else
|
||||
return a:type
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
@ -0,0 +1,160 @@
|
||||
"=============================================================================
|
||||
" FILE: vim_scripts_org.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:Cache = unite#util#get_vital_cache()
|
||||
|
||||
let s:repository_cache = []
|
||||
|
||||
function! neobundle#sources#vim_scripts_org#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'vim-scripts.org',
|
||||
\ 'short_name' : 'vim.org',
|
||||
\ }
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
let repository =
|
||||
\ 'https://raw.githubusercontent.com/vim-scraper/'
|
||||
\ .'vim-scraper.github.com/master/api/scripts_recent.json'
|
||||
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:vim-scripts.org] repository: ' . repository)
|
||||
|
||||
let plugins = s:get_repository_plugins(a:context, repository)
|
||||
|
||||
try
|
||||
return map(copy(plugins), "{
|
||||
\ 'word' : v:val.name . ' ' . v:val.description,
|
||||
\ 'source__name' : v:val.name,
|
||||
\ 'source__path' : v:val.name,
|
||||
\ 'source__script_type' : s:convert2script_type(v:val.raw_type),
|
||||
\ 'source__description' : v:val.description,
|
||||
\ 'source__options' : [],
|
||||
\ 'action__uri' : v:val.uri,
|
||||
\ }")
|
||||
catch
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:vim-scripts.org] '
|
||||
\ .'Error occurred in loading cache.')
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:vim-scripts.org] '
|
||||
\ .'Please re-make cache by <Plug>(unite_redraw) mapping.')
|
||||
call neobundle#installer#error(v:exception . ' ' . v:throwpoint)
|
||||
|
||||
return []
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
" Misc.
|
||||
function! s:get_repository_plugins(context, path) abort "{{{
|
||||
let cache_dir = neobundle#get_neobundle_dir() . '/.neobundle'
|
||||
|
||||
if a:context.is_redraw || !s:Cache.filereadable(cache_dir, a:path)
|
||||
" Reload cache.
|
||||
let cache_path = s:Cache.getfilename(cache_dir, a:path)
|
||||
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:vim-scripts.org] '
|
||||
\ .'Reloading cache from ' . a:path)
|
||||
redraw
|
||||
|
||||
if s:Cache.filereadable(cache_dir, a:path)
|
||||
call delete(cache_path)
|
||||
endif
|
||||
|
||||
let temp = unite#util#substitute_path_separator(tempname())
|
||||
|
||||
let cmd = neobundle#util#wget(a:path, temp)
|
||||
if cmd =~# '^E:'
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:vim-scripts.org] '.
|
||||
\ 'curl or wget command is not available!')
|
||||
return []
|
||||
endif
|
||||
|
||||
let result = unite#util#system(cmd)
|
||||
|
||||
if unite#util#get_last_status()
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:vim-scripts.org] ' . cmd)
|
||||
call unite#print_message(
|
||||
\ '[neobundle/search:vim-scripts.org] ' . result)
|
||||
call unite#print_error(
|
||||
\ '[neobundle/search:vim-scripts.org] Error occurred!')
|
||||
return []
|
||||
elseif !filereadable(temp)
|
||||
call unite#print_error('[neobundle/search:vim-scripts.org] '.
|
||||
\ 'Temporary file was not created!')
|
||||
return []
|
||||
else
|
||||
call unite#print_message('[neobundle/search:vim-scripts.org] Done!')
|
||||
endif
|
||||
|
||||
sandbox let data = eval(get(readfile(temp), 0, '[]'))
|
||||
|
||||
" Convert cache data.
|
||||
call s:Cache.writefile(cache_dir, a:path,
|
||||
\ [string(s:convert_vim_scripts_data(data))])
|
||||
|
||||
call delete(temp)
|
||||
endif
|
||||
|
||||
if empty(s:repository_cache)
|
||||
sandbox let s:repository_cache =
|
||||
\ eval(get(s:Cache.readfile(cache_dir, a:path), 0, '[]'))
|
||||
endif
|
||||
|
||||
return s:repository_cache
|
||||
endfunction"}}}
|
||||
|
||||
function! s:convert_vim_scripts_data(data) abort "{{{
|
||||
return map(copy(a:data), "{
|
||||
\ 'name' : v:val.n,
|
||||
\ 'raw_type' : v:val.t,
|
||||
\ 'repository' : v:val.rv,
|
||||
\ 'description' : printf('%-5s %s', v:val.rv, v:val.s),
|
||||
\ 'uri' : 'https://github.com/vim-scripts/' . v:val.n,
|
||||
\ }")
|
||||
endfunction"}}}
|
||||
|
||||
function! s:convert2script_type(type) abort "{{{
|
||||
if a:type ==# 'utility'
|
||||
return 'plugin'
|
||||
elseif a:type ==# 'color scheme'
|
||||
return 'colors'
|
||||
else
|
||||
return a:type
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
312
bundle/neobundle.vim/autoload/neobundle/types/git.vim
Normal file
312
bundle/neobundle.vim/autoload/neobundle/types/git.vim
Normal file
@ -0,0 +1,312 @@
|
||||
"=============================================================================
|
||||
" FILE: git.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" Robert Nelson <robert@rnelson.ca>
|
||||
" Copyright (C) 2010 http://github.com/gmarik
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Global options definition. "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#git#command_path', 'git')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#git#default_protocol', 'https',
|
||||
\ 'g:neobundle_default_git_protocol')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#git#enable_submodule', 1)
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#git#clone_depth', 0,
|
||||
\ 'g:neobundle_git_clone_depth')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#git#pull_command', 'pull --ff --ff-only')
|
||||
"}}}
|
||||
|
||||
function! neobundle#types#git#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'git',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
if a:path =~ '^/\|^\a:/' && s:is_git_dir(a:path.'/.git')
|
||||
" Local repository.
|
||||
return { 'uri' : a:path, 'type' : 'git' }
|
||||
elseif isdirectory(a:path)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let protocol = matchstr(a:path, '^.\{-}\ze://')
|
||||
if protocol == '' || a:path =~#
|
||||
\'\<\%(gh\|github\|bb\|bitbucket\):\S\+'
|
||||
\ || has_key(a:opts, 'type__protocol')
|
||||
let protocol = get(a:opts, 'type__protocol',
|
||||
\ g:neobundle#types#git#default_protocol)
|
||||
endif
|
||||
|
||||
if protocol !=# 'https' && protocol !=# 'ssh'
|
||||
call neobundle#util#print_error(
|
||||
\ 'Path: ' . a:path . ' The protocol "' . protocol .
|
||||
\ '" is unsecure and invalid.')
|
||||
return {}
|
||||
endif
|
||||
|
||||
if a:path !~ '/'
|
||||
" www.vim.org Vim scripts.
|
||||
let name = split(a:path, ':')[-1]
|
||||
let uri = (protocol ==# 'ssh') ?
|
||||
\ 'git@github.com:vim-scripts/' :
|
||||
\ protocol . '://github.com/vim-scripts/'
|
||||
let uri .= name
|
||||
else
|
||||
let name = substitute(split(a:path, ':')[-1],
|
||||
\ '^//github.com/', '', '')
|
||||
let uri = (protocol ==# 'ssh') ?
|
||||
\ 'git@github.com:' . name :
|
||||
\ protocol . '://github.com/'. name
|
||||
endif
|
||||
|
||||
if a:path !~# '\<\%(gh\|github\):\S\+\|://github.com/'
|
||||
let uri = s:parse_other_pattern(protocol, a:path, a:opts)
|
||||
if uri == ''
|
||||
" Parse failure.
|
||||
return {}
|
||||
endif
|
||||
endif
|
||||
|
||||
if uri !~ '\.git\s*$'
|
||||
" Add .git suffix.
|
||||
let uri .= '.git'
|
||||
endif
|
||||
|
||||
return { 'uri': uri, 'type' : 'git' }
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return 'E: "git" command is not installed.'
|
||||
endif
|
||||
|
||||
if !isdirectory(a:bundle.path)
|
||||
let cmd = 'clone'
|
||||
if g:neobundle#types#git#enable_submodule
|
||||
let cmd .= ' --recursive'
|
||||
endif
|
||||
|
||||
let depth = get(a:bundle, 'type__depth',
|
||||
\ g:neobundle#types#git#clone_depth)
|
||||
if depth > 0 && a:bundle.rev == '' && a:bundle.uri !~ '^git@'
|
||||
let cmd .= ' --depth=' . depth
|
||||
endif
|
||||
|
||||
let cmd .= printf(' %s "%s"', a:bundle.uri, a:bundle.path)
|
||||
else
|
||||
let cmd = g:neobundle#types#git#pull_command
|
||||
if g:neobundle#types#git#enable_submodule
|
||||
let shell = fnamemodify(split(&shell)[0], ':t')
|
||||
let and = (!neobundle#util#has_vimproc() && shell ==# 'fish') ?
|
||||
\ '; and ' : ' && '
|
||||
|
||||
let cmd .= and . g:neobundle#types#git#command_path
|
||||
\ . ' submodule update --init --recursive'
|
||||
endif
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path . ' ' . cmd
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path .' rev-parse HEAD'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_pretty_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path .
|
||||
\ ' log -1 --pretty=format:"%h [%cr] %s"'
|
||||
endfunction"}}}
|
||||
function! s:type.get_commit_date_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path .
|
||||
\ ' log -1 --pretty=format:"%ct"'
|
||||
endfunction"}}}
|
||||
function! s:type.get_log_command(bundle, new_rev, old_rev) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
\ || a:new_rev == '' || a:old_rev == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Note: If the a:old_rev is not the ancestor of two branchs. Then do not use
|
||||
" %s^. use %s^ will show one commit message which already shown last time.
|
||||
let is_not_ancestor = neobundle#util#system(
|
||||
\ g:neobundle#types#git#command_path . ' merge-base '
|
||||
\ . a:old_rev . ' ' . a:new_rev) ==# a:old_rev
|
||||
return printf(g:neobundle#types#git#command_path .
|
||||
\ ' log %s%s..%s --graph --pretty=format:"%%h [%%cr] %%s"',
|
||||
\ a:old_rev, (is_not_ancestor ? '' : '^'), a:new_rev)
|
||||
|
||||
" Test.
|
||||
" return g:neobundle#types#git#command_path .
|
||||
" \ ' log HEAD^^^^..HEAD --graph --pretty=format:"%h [%cr] %s"'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let rev = a:bundle.rev
|
||||
if rev ==# 'release'
|
||||
" Use latest released tag
|
||||
let rev = neobundle#installer#get_release_revision(a:bundle,
|
||||
\ g:neobundle#types#git#command_path . ' tag')
|
||||
endif
|
||||
if rev == ''
|
||||
" Fix detach HEAD.
|
||||
let rev = 'master'
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path . ' checkout ' . rev
|
||||
endfunction"}}}
|
||||
function! s:type.get_gc_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path .' gc'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_remote_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let rev = a:bundle.rev
|
||||
if rev == ''
|
||||
let rev = 'HEAD'
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path
|
||||
\ .' ls-remote origin ' . rev
|
||||
endfunction"}}}
|
||||
function! s:type.get_fetch_remote_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#git#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#git#command_path
|
||||
\ .' fetch origin '
|
||||
endfunction"}}}
|
||||
|
||||
function! s:parse_other_pattern(protocol, path, opts) abort "{{{
|
||||
let uri = ''
|
||||
|
||||
if a:path =~# '\<gist:\S\+\|://gist.github.com/'
|
||||
let name = split(a:path, ':')[-1]
|
||||
let uri = (a:protocol ==# 'ssh') ?
|
||||
\ 'git@gist.github.com:' . split(name, '/')[-1] :
|
||||
\ a:protocol . '://gist.github.com/'. split(name, '/')[-1]
|
||||
elseif a:path =~# '\<git@\S\+'
|
||||
\ || a:path =~# '\.git\s*$'
|
||||
\ || get(a:opts, 'type', '') ==# 'git'
|
||||
if a:path =~# '\<\%(bb\|bitbucket\):\S\+'
|
||||
let name = substitute(split(a:path, ':')[-1],
|
||||
\ '^//bitbucket.org/', '', '')
|
||||
let uri = (a:protocol ==# 'ssh') ?
|
||||
\ 'git@bitbucket.org:' . name :
|
||||
\ a:protocol . '://bitbucket.org/' . name
|
||||
else
|
||||
let uri = a:path
|
||||
endif
|
||||
endif
|
||||
|
||||
return uri
|
||||
endfunction"}}}
|
||||
|
||||
function! s:is_git_dir(path) abort "{{{
|
||||
if isdirectory(a:path)
|
||||
let git_dir = a:path
|
||||
elseif filereadable(a:path)
|
||||
" check if this is a gitdir file
|
||||
" File starts with "gitdir: " and all text after this string is treated
|
||||
" as the path. Any CR or NLs are stripped off the end of the file.
|
||||
let buf = join(readfile(a:path, 'b'), "\n")
|
||||
let matches = matchlist(buf, '\C^gitdir: \(\_.*[^\r\n]\)[\r\n]*$')
|
||||
if empty(matches)
|
||||
return 0
|
||||
endif
|
||||
let path = fnamemodify(a:path, ':h')
|
||||
if fnamemodify(a:path, ':t') == ''
|
||||
" if there's no tail, the path probably ends in a directory separator
|
||||
let path = fnamemodify(path, ':h')
|
||||
endif
|
||||
let git_dir = neobundle#util#join_paths(path, matches[1])
|
||||
if !isdirectory(git_dir)
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Git only considers it to be a git dir if a few required files/dirs exist
|
||||
" and are accessible inside the directory.
|
||||
" Note: we can't actually test file permissions the way we'd like to, since
|
||||
" getfperm() gives the mode string but doesn't tell us whether the user or
|
||||
" group flags apply to us. Instead, just check if dirname/. is a directory.
|
||||
" This should also check if we have search permissions.
|
||||
" I'm assuming here that dirname/. works on windows, since I can't test.
|
||||
" Note: Git also accepts having the GIT_OBJECT_DIRECTORY env var set instead
|
||||
" of using .git/objects, but we don't care about that.
|
||||
for name in ['objects', 'refs']
|
||||
if !isdirectory(neobundle#util#join_paths(git_dir, name))
|
||||
return 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Git also checks if HEAD is a symlink or a properly-formatted file.
|
||||
" We don't really care to actually validate this, so let's just make
|
||||
" sure the file exists and is readable.
|
||||
" Note: it may also be a symlink, which can point to a path that doesn't
|
||||
" necessarily exist yet.
|
||||
let head = neobundle#util#join_paths(git_dir, 'HEAD')
|
||||
if !filereadable(head) && getftype(head) != 'link'
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Sure looks like a git directory. There's a few subtleties where we'll
|
||||
" accept a directory that git itself won't, but I think we can safely ignore
|
||||
" those edge cases.
|
||||
return 1
|
||||
endfunction "}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
119
bundle/neobundle.vim/autoload/neobundle/types/hg.vim
Normal file
119
bundle/neobundle.vim/autoload/neobundle/types/hg.vim
Normal file
@ -0,0 +1,119 @@
|
||||
"=============================================================================
|
||||
" FILE: hg.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Global options definition. "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#hg#command_path', 'hg')
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#hg#default_protocol', 'https',
|
||||
\ 'g:neobundle_default_hg_protocol')
|
||||
"}}}
|
||||
|
||||
function! neobundle#types#hg#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'hg',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
if isdirectory(a:path.'/.hg')
|
||||
" Local repository.
|
||||
return { 'uri' : a:path, 'type' : 'hg' }
|
||||
elseif isdirectory(a:path)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let protocol = matchstr(a:path, '^.\{-}\ze://')
|
||||
if protocol == '' || a:path =~#
|
||||
\'\<\%(bb\|bitbucket\):\S\+'
|
||||
\ || has_key(a:opts, 'type__protocol')
|
||||
let protocol = get(a:opts, 'type__protocol',
|
||||
\ g:neobundle#types#hg#default_protocol)
|
||||
endif
|
||||
|
||||
if protocol !=# 'https' && protocol !=# 'ssh'
|
||||
call neobundle#util#print_error(
|
||||
\ 'Path: ' . a:path . ' The protocol "' . protocol .
|
||||
\ '" is unsecure and invalid.')
|
||||
return {}
|
||||
endif
|
||||
|
||||
if a:path =~# '\<\%(bb\|bitbucket\):'
|
||||
let name = substitute(split(a:path, ':')[-1],
|
||||
\ '^//bitbucket.org/', '', '')
|
||||
let uri = (protocol ==# 'ssh') ?
|
||||
\ 'ssh://hg@bitbucket.org/' . name :
|
||||
\ protocol . '://bitbucket.org/' . name
|
||||
elseif a:path =~? '[/.]hg[/.@]'
|
||||
\ || (a:path =~# '\<https://bitbucket\.org/'
|
||||
\ || get(a:opts, 'type', '') ==# 'hg')
|
||||
let uri = a:path
|
||||
else
|
||||
return {}
|
||||
endif
|
||||
|
||||
return { 'uri' : uri, 'type' : 'hg' }
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#hg#command_path)
|
||||
return 'E: "hg" command is not installed.'
|
||||
endif
|
||||
|
||||
if !isdirectory(a:bundle.path)
|
||||
let cmd = 'clone'
|
||||
let cmd .= printf(' %s "%s"', a:bundle.uri, a:bundle.path)
|
||||
else
|
||||
let cmd = 'pull -u'
|
||||
endif
|
||||
|
||||
return g:neobundle#types#hg#command_path . ' ' . cmd
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#hg#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#hg#command_path
|
||||
\ . ' heads --quiet --rev default'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#hg#command_path)
|
||||
\ || a:bundle.rev == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#hg#command_path
|
||||
\ . ' up ' . a:bundle.rev
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
75
bundle/neobundle.vim/autoload/neobundle/types/none.vim
Normal file
75
bundle/neobundle.vim/autoload/neobundle/types/none.vim
Normal file
@ -0,0 +1,75 @@
|
||||
"=============================================================================
|
||||
" FILE: none.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! neobundle#types#none#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'none',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
" No Auto detect.
|
||||
return {}
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
if isdirectory(a:bundle.path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Try auto install.
|
||||
let path = a:bundle.orig_path
|
||||
let site = get(a:bundle, 'site', g:neobundle#default_site)
|
||||
if path !~ '^/\|^\a:' && path !~ ':'
|
||||
" Add default site.
|
||||
let path = site . ':' . path
|
||||
endif
|
||||
|
||||
for type in neobundle#config#get_types()
|
||||
let detect = type.detect(path, a:bundle.orig_opts)
|
||||
|
||||
if !empty(detect)
|
||||
return type.get_sync_command(
|
||||
\ extend(copy(a:bundle), detect))
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 'E: Failed to auto installation.'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
return ''
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
return ''
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
116
bundle/neobundle.vim/autoload/neobundle/types/raw.vim
Normal file
116
bundle/neobundle.vim/autoload/neobundle/types/raw.vim
Normal file
@ -0,0 +1,116 @@
|
||||
"=============================================================================
|
||||
" FILE: raw.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Global options definition. "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#raw#calc_hash_command',
|
||||
\ executable('sha1sum') ? 'sha1sum' :
|
||||
\ executable('md5sum') ? 'md5sum' : '')
|
||||
"}}}
|
||||
|
||||
function! neobundle#types#raw#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'raw',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
" No auto detect.
|
||||
let type = ''
|
||||
let name = ''
|
||||
|
||||
if a:path =~# '^https:.*\.vim$'
|
||||
" HTTPS
|
||||
|
||||
let name = neobundle#util#name_conversion(a:path)
|
||||
|
||||
let type = 'raw'
|
||||
elseif a:path =~#
|
||||
\ '^https://www\.vim\.org/scripts/download_script.php?src_id=\d\+$'
|
||||
" For www.vim.org
|
||||
let name = 'vim-scripts-' . matchstr(a:path, '\d\+$')
|
||||
let type = 'raw'
|
||||
endif
|
||||
|
||||
return type == '' ? {} :
|
||||
\ { 'name': name, 'uri' : a:path, 'type' : type }
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
if a:bundle.script_type == ''
|
||||
return 'E: script_type is not found.'
|
||||
endif
|
||||
|
||||
let path = a:bundle.path
|
||||
|
||||
if !isdirectory(path)
|
||||
" Create script type directory.
|
||||
call mkdir(path, 'p')
|
||||
endif
|
||||
|
||||
let filename = path . '/' . get(a:bundle,
|
||||
\ 'type__filename', fnamemodify(a:bundle.uri, ':t'))
|
||||
let a:bundle.type__filepath = filename
|
||||
|
||||
let cmd = neobundle#util#wget(a:bundle.uri, filename)
|
||||
|
||||
return cmd
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
if g:neobundle#types#raw#calc_hash_command == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
if !filereadable(a:bundle.type__filepath)
|
||||
" Not Installed.
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Calc hash.
|
||||
return printf('%s %s',
|
||||
\ g:neobundle#types#raw#calc_hash_command,
|
||||
\ a:bundle.type__filepath)
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
let new_rev = matchstr(a:bundle.new_rev, '^\S\+')
|
||||
if a:bundle.rev != '' && new_rev != '' &&
|
||||
\ new_rev !=# a:bundle.rev
|
||||
" Revision check.
|
||||
return printf('E: revision digest is not matched : "%s"(got) and "%s"(rev).',
|
||||
\ new_rev, a:bundle.rev)
|
||||
endif
|
||||
|
||||
" Not supported.
|
||||
return ''
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
93
bundle/neobundle.vim/autoload/neobundle/types/svn.vim
Normal file
93
bundle/neobundle.vim/autoload/neobundle/types/svn.vim
Normal file
@ -0,0 +1,93 @@
|
||||
"=============================================================================
|
||||
" FILE: svn.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Global options definition. "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#svn#command_path', 'svn')
|
||||
"}}}
|
||||
|
||||
function! neobundle#types#svn#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'svn',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
if isdirectory(a:path)
|
||||
return {}
|
||||
endif
|
||||
|
||||
let type = ''
|
||||
let uri = ''
|
||||
|
||||
if (a:path =~# '\<\%(file\|https\)://'
|
||||
\ && a:path =~? '[/.]svn[/.]')
|
||||
\ || a:path =~# '\<svn+ssh://'
|
||||
let uri = a:path
|
||||
let type = 'svn'
|
||||
endif
|
||||
|
||||
return type == '' ? {} : { 'uri': uri, 'type' : type }
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#svn#command_path)
|
||||
return 'E: svn command is not installed.'
|
||||
endif
|
||||
|
||||
if !isdirectory(a:bundle.path)
|
||||
let cmd = 'checkout'
|
||||
let cmd .= printf(' %s "%s"', a:bundle.uri, a:bundle.path)
|
||||
else
|
||||
let cmd = 'up'
|
||||
endif
|
||||
|
||||
return g:neobundle#types#svn#command_path . ' ' . cmd
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#svn#command_path)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#svn#command_path . ' info'
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
if !executable(g:neobundle#types#svn#command_path)
|
||||
\ || a:bundle.rev == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
return g:neobundle#types#svn#command_path
|
||||
\ . ' up -r ' . a:bundle.rev
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
146
bundle/neobundle.vim/autoload/neobundle/types/vba.vim
Normal file
146
bundle/neobundle.vim/autoload/neobundle/types/vba.vim
Normal file
@ -0,0 +1,146 @@
|
||||
"=============================================================================
|
||||
" FILE: vba.vim
|
||||
" AUTHOR: Yu Huang <paulhybryant@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Global options definition. "{{{
|
||||
call neobundle#util#set_default(
|
||||
\ 'g:neobundle#types#vba#calc_hash_command',
|
||||
\ executable('sha1sum') ? 'sha1sum' :
|
||||
\ executable('md5sum') ? 'md5sum' : '')
|
||||
"}}}
|
||||
|
||||
function! neobundle#types#vba#define() abort "{{{
|
||||
return s:type
|
||||
endfunction"}}}
|
||||
|
||||
let s:type = {
|
||||
\ 'name' : 'vba',
|
||||
\ }
|
||||
|
||||
function! s:type.detect(path, opts) abort "{{{
|
||||
" No auto detect.
|
||||
let type = ''
|
||||
let name = ''
|
||||
|
||||
if a:path =~# '^https:.*\.vba\(\.gz\)\?$'
|
||||
" HTTPS
|
||||
" .*.vba / .*.vba.gz
|
||||
let name = fnamemodify(split(a:path, ':')[-1],
|
||||
\ ':s?/$??:t:s?\c\.vba\(\.gz\)*\s*$??')
|
||||
let type = 'vba'
|
||||
elseif a:path =~# '\.vba\(\.gz\)\?$' && filereadable(a:path)
|
||||
" local
|
||||
" .*.vba
|
||||
let name = fnamemodify(a:path, ':t:s?\c\.vba\(\.gz\)*\s*$??')
|
||||
let type = 'vba'
|
||||
endif
|
||||
|
||||
if a:path =~# '^https:.*\.vmb$'
|
||||
" HTTPS
|
||||
" .*.vmb
|
||||
let name = fnamemodify(split(a:path, ':')[-1],
|
||||
\ ':s?/$??:t:s?\c\.vba\s*$??')
|
||||
let type = 'vba'
|
||||
elseif a:path =~# '\.vmb$' && filereadable(a:path)
|
||||
" local
|
||||
" .*.vmb
|
||||
let name = fnamemodify(a:path, ':t:s?\c\.vba\s*$??')
|
||||
let type = 'vba'
|
||||
endif
|
||||
|
||||
return type == '' ? {} :
|
||||
\ { 'name': name, 'uri' : a:path, 'type' : type }
|
||||
endfunction"}}}
|
||||
function! s:type.get_sync_command(bundle) abort "{{{
|
||||
let path = a:bundle.path
|
||||
|
||||
if !isdirectory(path)
|
||||
" Create script type directory.
|
||||
call mkdir(path, 'p')
|
||||
endif
|
||||
|
||||
let filename = path . '/' . get(a:bundle,
|
||||
\ 'type__filename', fnamemodify(a:bundle.uri, ':t'))
|
||||
let a:bundle.type__filepath = filename
|
||||
|
||||
let cmd = ''
|
||||
if filereadable(a:bundle.uri)
|
||||
call writefile(readfile(a:bundle.uri, 'b'), filename, 'b')
|
||||
else
|
||||
let cmd = neobundle#util#wget(a:bundle.uri, filename)
|
||||
if cmd =~# '^E:'
|
||||
return cmd
|
||||
endif
|
||||
let cmd .= ' && '
|
||||
endif
|
||||
|
||||
let cmd .= printf('%s -u NONE' .
|
||||
\ ' -c "set nocompatible"' .
|
||||
\ ' -c "filetype plugin on"' .
|
||||
\ ' -c "runtime plugin/gzip.vim"' .
|
||||
\ ' -c "runtime plugin/vimballPlugin.vim"' .
|
||||
\ ' -c "edit %s"' .
|
||||
\ ' -c "UseVimball %s"' .
|
||||
\ ' -c "q"', v:progpath, filename, path)
|
||||
" let cmd .= printf(' rm %s &&', filename)
|
||||
" let cmd .= printf(' rm %s/.VimballRecord', path)
|
||||
|
||||
return cmd
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_number_command(bundle) abort "{{{
|
||||
if g:neobundle#types#vba#calc_hash_command == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
if !has_key(a:bundle, 'type__filepath')
|
||||
\ || !filereadable(a:bundle.type__filepath)
|
||||
" Not Installed.
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Calc hash.
|
||||
return printf('%s %s',
|
||||
\ g:neobundle#types#vba#calc_hash_command,
|
||||
\ a:bundle.type__filepath)
|
||||
endfunction"}}}
|
||||
function! s:type.get_revision_lock_command(bundle) abort "{{{
|
||||
let new_rev = matchstr(a:bundle.new_rev, '^\S\+')
|
||||
if a:bundle.rev != '' && new_rev != '' &&
|
||||
\ new_rev !=# a:bundle.rev
|
||||
" Revision check.
|
||||
return printf('E: revision digest is not matched : "%s"(got) and "%s"(rev).',
|
||||
\ new_rev, a:bundle.rev)
|
||||
endif
|
||||
|
||||
" Not supported.
|
||||
return ''
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
510
bundle/neobundle.vim/autoload/neobundle/util.vim
Normal file
510
bundle/neobundle.vim/autoload/neobundle/util.vim
Normal file
@ -0,0 +1,510 @@
|
||||
"=============================================================================
|
||||
" FILE: util.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:is_windows = has('win32')
|
||||
let s:is_cygwin = has('win32unix')
|
||||
let s:is_mac = !s:is_windows && !s:is_cygwin
|
||||
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
|
||||
\ (!isdirectory('/proc') && executable('sw_vers')))
|
||||
|
||||
function! neobundle#util#substitute_path_separator(path) abort "{{{
|
||||
return (s:is_windows && a:path =~ '\\') ?
|
||||
\ tr(a:path, '\', '/') : a:path
|
||||
endfunction"}}}
|
||||
function! neobundle#util#expand(path) abort "{{{
|
||||
let path = (a:path =~ '^\~') ? fnamemodify(a:path, ':p') :
|
||||
\ (a:path =~ '^\$\h\w*') ? substitute(a:path,
|
||||
\ '^\$\h\w*', '\=eval(submatch(0))', '') :
|
||||
\ a:path
|
||||
return (s:is_windows && path =~ '\\') ?
|
||||
\ neobundle#util#substitute_path_separator(path) : path
|
||||
endfunction"}}}
|
||||
function! neobundle#util#join_paths(path1, path2) abort "{{{
|
||||
" Joins two paths together, handling the case where the second path
|
||||
" is an absolute path.
|
||||
if s:is_absolute(a:path2)
|
||||
return a:path2
|
||||
endif
|
||||
if a:path1 =~ (s:is_windows ? '[\\/]$' : '/$') ||
|
||||
\ a:path2 =~ (s:is_windows ? '^[\\/]' : '^/')
|
||||
" the appropriate separator already exists
|
||||
return a:path1 . a:path2
|
||||
else
|
||||
" note: I'm assuming here that '/' is always valid as a directory
|
||||
" separator on Windows. I know Windows has paths that start with \\?\ that
|
||||
" diasble behavior like that, but I don't know how Vim deals with that.
|
||||
return a:path1 . '/' . a:path2
|
||||
endif
|
||||
endfunction "}}}
|
||||
if s:is_windows
|
||||
function! s:is_absolute(path) abort "{{{
|
||||
return a:path =~ '^[\\/]\|^\a:'
|
||||
endfunction "}}}
|
||||
else
|
||||
function! s:is_absolute(path) abort "{{{
|
||||
return a:path =~ "^/"
|
||||
endfunction "}}}
|
||||
endif
|
||||
|
||||
function! neobundle#util#is_windows() abort "{{{
|
||||
return s:is_windows
|
||||
endfunction"}}}
|
||||
function! neobundle#util#is_mac() abort "{{{
|
||||
return s:is_mac
|
||||
endfunction"}}}
|
||||
function! neobundle#util#is_cygwin() abort "{{{
|
||||
return s:is_cygwin
|
||||
endfunction"}}}
|
||||
|
||||
" Sudo check.
|
||||
function! neobundle#util#is_sudo() abort "{{{
|
||||
return $SUDO_USER != '' && $USER !=# $SUDO_USER
|
||||
\ && $HOME !=# expand('~'.$USER)
|
||||
\ && $HOME ==# expand('~'.$SUDO_USER)
|
||||
endfunction"}}}
|
||||
|
||||
" Check vimproc. "{{{
|
||||
function! neobundle#util#has_vimproc() abort "{{{
|
||||
if !exists('*vimproc#version')
|
||||
try
|
||||
call vimproc#version()
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
|
||||
return exists('*vimproc#version')
|
||||
endfunction"}}}
|
||||
"}}}
|
||||
" iconv() wrapper for safety.
|
||||
function! s:iconv(expr, from, to) abort "{{{
|
||||
if a:from == '' || a:to == '' || a:from ==? a:to
|
||||
return a:expr
|
||||
endif
|
||||
let result = iconv(a:expr, a:from, a:to)
|
||||
return result != '' ? result : a:expr
|
||||
endfunction"}}}
|
||||
function! neobundle#util#system(str, ...) abort "{{{
|
||||
let command = a:str
|
||||
let input = a:0 >= 1 ? a:1 : ''
|
||||
let command = s:iconv(command, &encoding, 'char')
|
||||
let input = s:iconv(input, &encoding, 'char')
|
||||
|
||||
if a:0 == 0
|
||||
let output = neobundle#util#has_vimproc() ?
|
||||
\ vimproc#system(command) : system(command, "\<C-d>")
|
||||
elseif a:0 == 1
|
||||
let output = neobundle#util#has_vimproc() ?
|
||||
\ vimproc#system(command, input) : system(command, input)
|
||||
else
|
||||
" ignores 3rd argument unless you have vimproc.
|
||||
let output = neobundle#util#has_vimproc() ?
|
||||
\ vimproc#system(command, input, a:2) : system(command, input)
|
||||
endif
|
||||
|
||||
let output = s:iconv(output, 'char', &encoding)
|
||||
|
||||
return substitute(output, '\n$', '', '')
|
||||
endfunction"}}}
|
||||
function! neobundle#util#get_last_status() abort "{{{
|
||||
return neobundle#util#has_vimproc() ?
|
||||
\ vimproc#get_last_status() : v:shell_error
|
||||
endfunction"}}}
|
||||
|
||||
" Split a comma separated string to a list.
|
||||
function! neobundle#util#split_rtp(runtimepath) abort "{{{
|
||||
if stridx(a:runtimepath, '\,') < 0
|
||||
return split(a:runtimepath, ',')
|
||||
endif
|
||||
|
||||
let split = split(a:runtimepath, '\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val, ''\\\([\\,]\)'', "\\1", "g")')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#join_rtp(list, runtimepath, rtp) abort "{{{
|
||||
return (stridx(a:runtimepath, '\,') < 0 && stridx(a:rtp, ',') < 0) ?
|
||||
\ join(a:list, ',') : join(map(copy(a:list), 's:escape(v:val)'), ',')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#split_envpath(path) abort "{{{
|
||||
let delimiter = neobundle#util#is_windows() ? ';' : ':'
|
||||
if stridx(a:path, '\' . delimiter) < 0
|
||||
return split(a:path, delimiter)
|
||||
endif
|
||||
|
||||
let split = split(a:path, '\\\@<!\%(\\\\\)*\zs' . delimiter)
|
||||
return map(split,'substitute(v:val, ''\\\([\\'
|
||||
\ . delimiter . ']\)'', "\\1", "g")')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#join_envpath(list, orig_path, add_path) abort "{{{
|
||||
let delimiter = neobundle#util#is_windows() ? ';' : ':'
|
||||
return (stridx(a:orig_path, '\' . delimiter) < 0
|
||||
\ && stridx(a:add_path, delimiter) < 0) ?
|
||||
\ join(a:list, delimiter) :
|
||||
\ join(map(copy(a:list), 's:escape(v:val)'), delimiter)
|
||||
endfunction"}}}
|
||||
|
||||
" Removes duplicates from a list.
|
||||
function! neobundle#util#uniq(list, ...) abort "{{{
|
||||
let list = a:0 ? map(copy(a:list), printf('[v:val, %s]', a:1)) : copy(a:list)
|
||||
let i = 0
|
||||
let seen = {}
|
||||
while i < len(list)
|
||||
let key = string(a:0 ? list[i][1] : list[i])
|
||||
if has_key(seen, key)
|
||||
call remove(list, i)
|
||||
else
|
||||
let seen[key] = 1
|
||||
let i += 1
|
||||
endif
|
||||
endwhile
|
||||
return a:0 ? map(list, 'v:val[0]') : list
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#set_default(var, val, ...) abort "{{{
|
||||
if !exists(a:var) || type({a:var}) != type(a:val)
|
||||
let alternate_var = get(a:000, 0, '')
|
||||
|
||||
let {a:var} = exists(alternate_var) ?
|
||||
\ {alternate_var} : a:val
|
||||
endif
|
||||
endfunction"}}}
|
||||
function! neobundle#util#set_dictionary_helper(variable, keys, pattern) abort "{{{
|
||||
for key in split(a:keys, '\s*,\s*')
|
||||
if !has_key(a:variable, key)
|
||||
let a:variable[key] = a:pattern
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#get_filetypes() abort "{{{
|
||||
let filetype = exists('b:neocomplcache.context_filetype') ?
|
||||
\ b:neocomplcache.context_filetype : &filetype
|
||||
return split(filetype, '\.')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#convert2list(expr) abort "{{{
|
||||
return type(a:expr) ==# type([]) ? a:expr :
|
||||
\ type(a:expr) ==# type('') ?
|
||||
\ (a:expr == '' ? [] : split(a:expr, '\r\?\n', 1))
|
||||
\ : [a:expr]
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#print_error(expr) abort "{{{
|
||||
return s:echo(a:expr, 'error')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#redraw_echo(expr) abort "{{{
|
||||
return s:echo(a:expr, 'echo')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#redraw_echomsg(expr) abort "{{{
|
||||
return s:echo(a:expr, 'echomsg')
|
||||
endfunction"}}}
|
||||
|
||||
function! s:echo(expr, mode) abort "{{{
|
||||
let msg = map(neobundle#util#convert2list(a:expr),
|
||||
\ "'[neobundle] ' . v:val")
|
||||
if empty(msg)
|
||||
return
|
||||
endif
|
||||
|
||||
if has('vim_starting') || a:mode ==# 'error'
|
||||
call s:echo_mode(join(msg, "\n"), a:mode)
|
||||
return
|
||||
endif
|
||||
|
||||
let more_save = &more
|
||||
let showcmd_save = &showcmd
|
||||
let ruler_save = &ruler
|
||||
try
|
||||
set nomore
|
||||
set noshowcmd
|
||||
set noruler
|
||||
|
||||
let height = max([1, &cmdheight])
|
||||
echo ''
|
||||
for i in range(0, len(msg)-1, height)
|
||||
redraw
|
||||
|
||||
call s:echo_mode(join(msg[i : i+height-1], "\n"), a:mode)
|
||||
endfor
|
||||
finally
|
||||
let &more = more_save
|
||||
let &showcmd = showcmd_save
|
||||
let &ruler = ruler_save
|
||||
endtry
|
||||
endfunction"}}}
|
||||
function! s:echo_mode(m, mode) abort "{{{
|
||||
for m in split(a:m, '\r\?\n', 1)
|
||||
if !has('vim_starting') && a:mode !=# 'error'
|
||||
let m = neobundle#util#truncate_skipping(
|
||||
\ m, &columns - 1, &columns/3, '...')
|
||||
endif
|
||||
|
||||
if a:mode ==# 'error'
|
||||
echohl WarningMsg | echomsg m | echohl None
|
||||
elseif a:mode ==# 'echomsg'
|
||||
echomsg m
|
||||
else
|
||||
echo m
|
||||
endif
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#name_conversion(path) abort "{{{
|
||||
return fnamemodify(split(a:path, ':')[-1], ':s?/$??:t:s?\c\.git\s*$??')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#vim2json(expr) abort "{{{
|
||||
return has('patch-7.4.1498') ? json_encode(a:expr) : string(a:expr)
|
||||
endfunction "}}}
|
||||
function! neobundle#util#json2vim(expr) abort "{{{
|
||||
sandbox return has('patch-7.4.1498') ? json_decode(a:expr) : eval(a:expr)
|
||||
endfunction "}}}
|
||||
|
||||
" Escape a path for runtimepath.
|
||||
function! s:escape(path) abort"{{{
|
||||
return substitute(a:path, ',\|\\,\@=', '\\\0', 'g')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#unify_path(path) abort "{{{
|
||||
return fnamemodify(resolve(a:path), ':p:gs?\\\+?/?')
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#cd(path) abort "{{{
|
||||
if isdirectory(a:path)
|
||||
execute (haslocaldir() ? 'lcd' : 'cd') fnameescape(a:path)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#writefile(path, list) abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/.neobundle/' . a:path
|
||||
let dir = fnamemodify(path, ':h')
|
||||
if !isdirectory(dir)
|
||||
call mkdir(dir, 'p')
|
||||
endif
|
||||
|
||||
return writefile(a:list, path)
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#cleandir(path) abort "{{{
|
||||
let path = neobundle#get_neobundle_dir() . '/.neobundle/' . a:path
|
||||
|
||||
for file in filter(split(globpath(path, '*', 1), '\n'),
|
||||
\ '!isdirectory(v:val)')
|
||||
call delete(file)
|
||||
endfor
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#rmdir(path) abort "{{{
|
||||
if has('patch-7.4.1120')
|
||||
call delete(a:path, 'rf')
|
||||
else
|
||||
let cmdline = '"' . a:path . '"'
|
||||
if neobundle#util#is_windows()
|
||||
" Note: In rm command, must use "\" instead of "/".
|
||||
let cmdline = substitute(cmdline, '/', '\\\\', 'g')
|
||||
endif
|
||||
|
||||
" Use system instead of vimproc#system()
|
||||
let result = system(g:neobundle#rm_command . ' ' . cmdline)
|
||||
if v:shell_error
|
||||
call neobundle#installer#error(result)
|
||||
endif
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#copy_bundle_files(bundles, directory) abort "{{{
|
||||
" Delete old files.
|
||||
call neobundle#util#cleandir(a:directory)
|
||||
|
||||
let files = {}
|
||||
for bundle in a:bundles
|
||||
for file in filter(split(globpath(
|
||||
\ bundle.rtp, a:directory.'/**', 1), '\n'),
|
||||
\ '!isdirectory(v:val)')
|
||||
let filename = fnamemodify(file, ':t')
|
||||
let files[filename] = readfile(file)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
for [filename, list] in items(files)
|
||||
if filename =~# '^tags\%(-.*\)\?$'
|
||||
call sort(list)
|
||||
endif
|
||||
call neobundle#util#writefile(a:directory . '/' . filename, list)
|
||||
endfor
|
||||
endfunction"}}}
|
||||
function! neobundle#util#merge_bundle_files(bundles, directory) abort "{{{
|
||||
" Delete old files.
|
||||
call neobundle#util#cleandir(a:directory)
|
||||
|
||||
let files = []
|
||||
for bundle in a:bundles
|
||||
for file in filter(split(globpath(
|
||||
\ bundle.rtp, a:directory.'/**', 1), '\n'),
|
||||
\ '!isdirectory(v:val)')
|
||||
let files += readfile(file, ':t')
|
||||
endfor
|
||||
endfor
|
||||
|
||||
call neobundle#util#writefile(
|
||||
\ a:directory.'/'.a:directory . '.vim', files)
|
||||
endfunction"}}}
|
||||
|
||||
" Sorts a list using a set of keys generated by mapping the values in the list
|
||||
" through the given expr.
|
||||
" v:val is used in {expr}
|
||||
function! neobundle#util#sort_by(list, expr) abort "{{{
|
||||
let pairs = map(a:list, printf('[v:val, %s]', a:expr))
|
||||
return map(s:sort(pairs,
|
||||
\ 'a:a[1] ==# a:b[1] ? 0 : a:a[1] ># a:b[1] ? 1 : -1'), 'v:val[0]')
|
||||
endfunction"}}}
|
||||
|
||||
" Executes a command and returns its output.
|
||||
" This wraps Vim's `:redir`, and makes sure that the `verbose` settings have
|
||||
" no influence.
|
||||
function! neobundle#util#redir(cmd) abort "{{{
|
||||
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
|
||||
set verbose=0 verbosefile=
|
||||
redir => res
|
||||
silent! execute a:cmd
|
||||
redir END
|
||||
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
|
||||
return res
|
||||
endfunction"}}}
|
||||
|
||||
" Sorts a list with expression to compare each two values.
|
||||
" a:a and a:b can be used in {expr}.
|
||||
function! s:sort(list, expr) abort "{{{
|
||||
if type(a:expr) == type(function('function'))
|
||||
return sort(a:list, a:expr)
|
||||
endif
|
||||
let s:expr = a:expr
|
||||
return sort(a:list, 's:_compare')
|
||||
endfunction"}}}
|
||||
|
||||
function! s:_compare(a, b) abort
|
||||
return eval(s:expr)
|
||||
endfunction
|
||||
|
||||
function! neobundle#util#print_bundles(bundles) abort "{{{
|
||||
echomsg string(map(copy(a:bundles), 'v:val.name'))
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#sort_human(filenames) abort "{{{
|
||||
return sort(a:filenames, 's:compare_filename')
|
||||
endfunction"}}}
|
||||
|
||||
" Compare filename by human order. "{{{
|
||||
function! s:compare_filename(i1, i2) abort
|
||||
let words_1 = s:get_words(a:i1)
|
||||
let words_2 = s:get_words(a:i2)
|
||||
let words_1_len = len(words_1)
|
||||
let words_2_len = len(words_2)
|
||||
|
||||
for i in range(0, min([words_1_len, words_2_len])-1)
|
||||
if words_1[i] >? words_2[i]
|
||||
return 1
|
||||
elseif words_1[i] <? words_2[i]
|
||||
return -1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return words_1_len - words_2_len
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_words(filename) abort "{{{
|
||||
let words = []
|
||||
for split in split(a:filename, '\d\+\zs\ze')
|
||||
let words += split(split, '\D\zs\ze\d\+')
|
||||
endfor
|
||||
|
||||
return map(words, "v:val =~ '^\\d\\+$' ? str2nr(v:val) : v:val")
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#wget(uri, outpath) abort "{{{
|
||||
if executable('curl')
|
||||
return printf('curl --fail -s -o "%s" "%s"', a:outpath, a:uri)
|
||||
elseif executable('wget')
|
||||
return printf('wget -q -O "%s" "%s"', a:outpath, a:uri)
|
||||
else
|
||||
return 'E: curl or wget command is not available!'
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neobundle#util#truncate_skipping(str, max, footer_width, separator) abort "{{{
|
||||
let width = s:wcswidth(a:str)
|
||||
if width <= a:max
|
||||
let ret = a:str
|
||||
else
|
||||
let header_width = a:max - s:wcswidth(a:separator) - a:footer_width
|
||||
let ret = s:strwidthpart(a:str, header_width) . a:separator
|
||||
\ . s:strwidthpart_reverse(a:str, a:footer_width)
|
||||
endif
|
||||
|
||||
return ret
|
||||
endfunction"}}}
|
||||
function! s:strwidthpart(str, width) abort "{{{
|
||||
if a:width <= 0
|
||||
return ''
|
||||
endif
|
||||
let ret = a:str
|
||||
let width = s:wcswidth(a:str)
|
||||
while width > a:width
|
||||
let char = matchstr(ret, '.$')
|
||||
let ret = ret[: -1 - len(char)]
|
||||
let width -= s:wcswidth(char)
|
||||
endwhile
|
||||
|
||||
return ret
|
||||
endfunction"}}}
|
||||
function! s:strwidthpart_reverse(str, width) abort "{{{
|
||||
if a:width <= 0
|
||||
return ''
|
||||
endif
|
||||
let ret = a:str
|
||||
let width = s:wcswidth(a:str)
|
||||
while width > a:width
|
||||
let char = matchstr(ret, '^.')
|
||||
let ret = ret[len(char) :]
|
||||
let width -= s:wcswidth(char)
|
||||
endwhile
|
||||
|
||||
return ret
|
||||
endfunction"}}}
|
||||
function! s:wcswidth(str) abort "{{{
|
||||
return v:version >= 704 ? strwidth(a:str) : strlen(a:str)
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
||||
|
106
bundle/neobundle.vim/autoload/unite/kinds/neobundle.vim
Normal file
106
bundle/neobundle.vim/autoload/unite/kinds/neobundle.vim
Normal file
@ -0,0 +1,106 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#kinds#neobundle#define() abort "{{{
|
||||
return s:kind
|
||||
endfunction"}}}
|
||||
|
||||
let s:kind = {
|
||||
\ 'name' : 'neobundle',
|
||||
\ 'action_table': {},
|
||||
\ 'parents' : ['uri', 'directory'],
|
||||
\ 'default_action' : 'update',
|
||||
\}
|
||||
|
||||
" Actions "{{{
|
||||
let s:kind.action_table.update = {
|
||||
\ 'description' : 'update bundles',
|
||||
\ 'is_selectable' : 1,
|
||||
\ 'is_start' : 1,
|
||||
\ }
|
||||
function! s:kind.action_table.update.func(candidates) abort "{{{
|
||||
call unite#start_script([['neobundle/update', '!']
|
||||
\ + map(copy(a:candidates), 'v:val.action__bundle_name')],
|
||||
\ { 'log' : 1 })
|
||||
endfunction"}}}
|
||||
let s:kind.action_table.delete = {
|
||||
\ 'description' : 'delete bundles',
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ 'is_quit' : 0,
|
||||
\ 'is_selectable' : 1,
|
||||
\ }
|
||||
function! s:kind.action_table.delete.func(candidates) abort "{{{
|
||||
call call('neobundle#commands#clean', insert(map(copy(a:candidates),
|
||||
\ 'v:val.action__bundle_name'), 0))
|
||||
endfunction"}}}
|
||||
let s:kind.action_table.reinstall = {
|
||||
\ 'description' : 'reinstall bundles',
|
||||
\ 'is_selectable' : 1,
|
||||
\ }
|
||||
function! s:kind.action_table.reinstall.func(candidates) abort "{{{
|
||||
call neobundle#installer#reinstall(
|
||||
\ map(copy(a:candidates), 'v:val.action__bundle'))
|
||||
endfunction"}}}
|
||||
let s:kind.action_table.preview = {
|
||||
\ 'description' : 'view the plugin documentation',
|
||||
\ 'is_quit' : 0,
|
||||
\ }
|
||||
function! s:kind.action_table.preview.func(candidate) abort "{{{
|
||||
" Search help files.
|
||||
let readme = get(split(globpath(
|
||||
\ a:candidate.action__path, 'doc/*.?*', 1), '\n'), 0, '')
|
||||
|
||||
if readme == ''
|
||||
" Search README files.
|
||||
let readme = get(split(globpath(
|
||||
\ a:candidate.action__path, 'README*', 1), '\n'), 0, '')
|
||||
if readme == ''
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
let buflisted = buflisted(
|
||||
\ unite#util#escape_file_searching(readme))
|
||||
|
||||
execute 'pedit' fnameescape(readme)
|
||||
|
||||
" Open folds.
|
||||
normal! zv
|
||||
normal! zt
|
||||
|
||||
if !buflisted
|
||||
call unite#add_previewed_buffer_list(
|
||||
\ bufnr(unite#util#escape_file_searching(readme)))
|
||||
endif
|
||||
endfunction"}}}
|
||||
"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
143
bundle/neobundle.vim/autoload/unite/sources/neobundle.vim
Normal file
143
bundle/neobundle.vim/autoload/unite/sources/neobundle.vim
Normal file
@ -0,0 +1,143 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neobundle#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'neobundle',
|
||||
\ 'description' : 'candidates from bundles',
|
||||
\ 'hooks' : {},
|
||||
\ }
|
||||
|
||||
function! s:source.hooks.on_init(args, context) abort "{{{
|
||||
let bundle_names = filter(copy(a:args), 'v:val != "!"')
|
||||
let a:context.source__bang =
|
||||
\ index(a:args, '!') >= 0
|
||||
let a:context.source__bundles = neobundle#util#sort_by(
|
||||
\ (empty(bundle_names) ?
|
||||
\ neobundle#config#get_neobundles() :
|
||||
\ neobundle#config#search(bundle_names)),
|
||||
\ 'tolower(v:val.orig_name)')
|
||||
endfunction"}}}
|
||||
|
||||
" Filters "{{{
|
||||
function! s:source.source__converter(candidates, context) abort "{{{
|
||||
for candidate in a:candidates
|
||||
if candidate.source__uri =~
|
||||
\ '^\%(https\?\|git\)://github.com/'
|
||||
let candidate.action__uri = candidate.source__uri
|
||||
let candidate.action__uri =
|
||||
\ substitute(candidate.action__uri, '^git://', 'https://', '')
|
||||
let candidate.action__uri =
|
||||
\ substitute(candidate.action__uri, '.git$', '', '')
|
||||
endif
|
||||
endfor
|
||||
|
||||
return a:candidates
|
||||
endfunction"}}}
|
||||
|
||||
let s:source.converters = s:source.source__converter
|
||||
"}}}
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
let _ = map(copy(a:context.source__bundles), "{
|
||||
\ 'word' : substitute(v:val.orig_name,
|
||||
\ '^\%(https\?\|git\)://\%(github.com/\)\?', '', ''),
|
||||
\ 'kind' : 'neobundle',
|
||||
\ 'action__path' : v:val.path,
|
||||
\ 'action__directory' : v:val.path,
|
||||
\ 'action__bundle' : v:val,
|
||||
\ 'action__bundle_name' : v:val.name,
|
||||
\ 'source__uri' : v:val.uri,
|
||||
\ 'source__description' : v:val.description,
|
||||
\ 'is_multiline' : 1,
|
||||
\ }
|
||||
\")
|
||||
|
||||
let max = max(map(copy(_), 'len(v:val.word)'))
|
||||
|
||||
call unite#print_source_message(
|
||||
\ '#: not sourced, X: not installed', self.name)
|
||||
|
||||
for candidate in _
|
||||
let candidate.abbr =
|
||||
\ neobundle#is_sourced(candidate.action__bundle_name) ? ' ' :
|
||||
\ neobundle#is_installed(candidate.action__bundle_name) ? '#' : 'X'
|
||||
let candidate.abbr .= ' ' . unite#util#truncate(candidate.word, max)
|
||||
if candidate.source__description != ''
|
||||
let candidate.abbr .= ' : ' . candidate.source__description
|
||||
endif
|
||||
|
||||
if a:context.source__bang
|
||||
let status = s:get_commit_status(candidate.action__bundle)
|
||||
if status != ''
|
||||
let candidate.abbr .= "\n " . status
|
||||
endif
|
||||
endif
|
||||
|
||||
let candidate.word .= candidate.source__description
|
||||
endfor
|
||||
|
||||
return _
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_commit_status(bundle) abort "{{{
|
||||
if !isdirectory(a:bundle.path)
|
||||
return 'Not installed'
|
||||
endif
|
||||
|
||||
let type = neobundle#config#get_types(a:bundle.type)
|
||||
let cmd = has_key(type, 'get_revision_pretty_command') ?
|
||||
\ type.get_revision_pretty_command(a:bundle) :
|
||||
\ type.get_revision_number_command(a:bundle)
|
||||
if cmd == ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let cwd = getcwd()
|
||||
try
|
||||
call neobundle#util#cd(a:bundle.path)
|
||||
let output = neobundle#util#system(cmd)
|
||||
finally
|
||||
call neobundle#util#cd(cwd)
|
||||
endtry
|
||||
|
||||
if neobundle#util#get_last_status()
|
||||
return printf('Error(%d) occurred when executing "%s"',
|
||||
\ neobundle#util#get_last_status(), cmd)
|
||||
endif
|
||||
|
||||
return output
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
@ -0,0 +1,190 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle/install.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neobundle_install#define() abort "{{{
|
||||
return [s:source_install, s:source_update]
|
||||
endfunction"}}}
|
||||
|
||||
let s:source_install = {
|
||||
\ 'name' : 'neobundle/install',
|
||||
\ 'description' : 'install bundles',
|
||||
\ 'hooks' : {},
|
||||
\ 'default_kind' : 'word',
|
||||
\ 'syntax' : 'uniteSource__NeoBundleInstall',
|
||||
\ }
|
||||
|
||||
function! s:source_install.hooks.on_init(args, context) abort "{{{
|
||||
let bundle_names = filter(copy(a:args), "v:val != '!'")
|
||||
let a:context.source__bang =
|
||||
\ index(a:args, '!') >= 0 || !empty(bundle_names)
|
||||
let a:context.source__not_fuzzy = 0
|
||||
call s:init(a:context, bundle_names)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_install.hooks.on_syntax(args, context) abort "{{{
|
||||
syntax match uniteSource__NeoBundleInstall_Progress /(.\{-}):\s*.*/
|
||||
\ contained containedin=uniteSource__NeoBundleInstall
|
||||
highlight default link uniteSource__NeoBundleInstall_Progress String
|
||||
syntax match uniteSource__NeoBundleInstall_Source /|.\{-}|/
|
||||
\ contained containedin=uniteSource__NeoBundleInstall_Progress
|
||||
highlight default link uniteSource__NeoBundleInstall_Source Type
|
||||
syntax match uniteSource__NeoBundleInstall_URI /-> diff URI/
|
||||
\ contained containedin=uniteSource__NeoBundleInstall
|
||||
highlight default link uniteSource__NeoBundleInstall_URI Underlined
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_install.hooks.on_close(args, context) abort "{{{
|
||||
if !empty(a:context.source__processes)
|
||||
for process in a:context.source__processes
|
||||
if has('nvim')
|
||||
call jobstop(process.proc)
|
||||
else
|
||||
call process.proc.waitpid()
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_install.async_gather_candidates(args, context) abort "{{{
|
||||
if !a:context.sync && empty(filter(range(1, winnr('$')),
|
||||
\ "getwinvar(v:val, '&l:filetype') ==# 'unite'"))
|
||||
return []
|
||||
endif
|
||||
|
||||
let old_msgs = copy(neobundle#installer#get_updates_log())
|
||||
|
||||
if a:context.source__number < a:context.source__max_bundles
|
||||
while a:context.source__number < a:context.source__max_bundles
|
||||
\ && len(a:context.source__processes) <
|
||||
\ g:neobundle#install_max_processes
|
||||
let bundle = a:context.source__bundles[a:context.source__number]
|
||||
call neobundle#installer#sync(bundle, a:context, 1)
|
||||
|
||||
call unite#clear_message()
|
||||
call unite#print_source_message(
|
||||
\ neobundle#installer#get_progress_message(bundle,
|
||||
\ a:context.source__number,
|
||||
\ a:context.source__max_bundles), self.name)
|
||||
redrawstatus
|
||||
endwhile
|
||||
endif
|
||||
|
||||
if !empty(a:context.source__processes)
|
||||
for process in a:context.source__processes
|
||||
call neobundle#installer#check_output(a:context, process, 1)
|
||||
endfor
|
||||
|
||||
" Filter eof processes.
|
||||
call filter(a:context.source__processes, '!v:val.eof')
|
||||
else
|
||||
call neobundle#installer#update_log(
|
||||
\ neobundle#installer#get_updated_bundles_message(
|
||||
\ a:context.source__synced_bundles), 1)
|
||||
call neobundle#installer#update_log(
|
||||
\ neobundle#installer#get_errored_bundles_message(
|
||||
\ a:context.source__errored_bundles), 1)
|
||||
call neobundle#installer#update(
|
||||
\ a:context.source__synced_bundles)
|
||||
|
||||
" Finish.
|
||||
call neobundle#installer#update_log('Completed.', 1)
|
||||
|
||||
let a:context.is_async = 0
|
||||
endif
|
||||
|
||||
return map(neobundle#installer#get_updates_log()[len(old_msgs) :], "{
|
||||
\ 'word' : (v:val =~ '^\\s*\\h\\w*://' ? ' -> diff URI' : v:val),
|
||||
\ 'is_multiline' : 1,
|
||||
\ 'kind' : (v:val =~ '^\\s*\\h\\w*://' ? 'uri' : 'word'),
|
||||
\ 'action__uri' : substitute(v:val, '^\\s\\+', '', ''),
|
||||
\}")
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source_install.complete(args, context, arglead, cmdline, cursorpos) abort "{{{
|
||||
return ['!'] +
|
||||
\ neobundle#commands#complete_bundles(a:arglead, a:cmdline, a:cursorpos)
|
||||
endfunction"}}}
|
||||
|
||||
let s:source_update = deepcopy(s:source_install)
|
||||
let s:source_update.name = 'neobundle/update'
|
||||
let s:source_update.description = 'update bundles'
|
||||
|
||||
function! s:source_update.hooks.on_init(args, context) abort "{{{
|
||||
let a:context.source__bang =
|
||||
\ index(a:args, 'all') >= 0 ? 2 : 1
|
||||
let a:context.source__not_fuzzy = index(a:args, '!') >= 0
|
||||
let bundle_names = filter(copy(a:args),
|
||||
\ "v:val !=# 'all' && v:val !=# '!'")
|
||||
call s:init(a:context, bundle_names)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:init(context, bundle_names) abort "{{{
|
||||
let a:context.source__synced_bundles = []
|
||||
let a:context.source__errored_bundles = []
|
||||
|
||||
let a:context.source__processes = []
|
||||
|
||||
let a:context.source__number = 0
|
||||
|
||||
let a:context.source__bundles = !a:context.source__bang ?
|
||||
\ neobundle#get_force_not_installed_bundles(a:bundle_names) :
|
||||
\ empty(a:bundle_names) ?
|
||||
\ neobundle#config#get_enabled_bundles() :
|
||||
\ a:context.source__not_fuzzy ?
|
||||
\ neobundle#config#search(a:bundle_names) :
|
||||
\ neobundle#config#fuzzy_search(a:bundle_names)
|
||||
|
||||
call neobundle#installer#_load_install_info(
|
||||
\ a:context.source__bundles)
|
||||
|
||||
let reinstall_bundles =
|
||||
\ neobundle#installer#get_reinstall_bundles(
|
||||
\ a:context.source__bundles)
|
||||
if !empty(reinstall_bundles)
|
||||
call neobundle#installer#reinstall(reinstall_bundles)
|
||||
endif
|
||||
|
||||
let a:context.source__max_bundles =
|
||||
\ len(a:context.source__bundles)
|
||||
|
||||
call neobundle#installer#clear_log()
|
||||
|
||||
if empty(a:context.source__bundles)
|
||||
let a:context.is_async = 0
|
||||
call neobundle#installer#error(
|
||||
\ 'Target bundles not found. You may use wrong bundle name.')
|
||||
else
|
||||
call neobundle#installer#update_log(
|
||||
\ 'Update started: ' . strftime('(%Y/%m/%d %H:%M:%S)'))
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
@ -0,0 +1,76 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle_lazy.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neobundle_lazy#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'neobundle/lazy',
|
||||
\ 'description' : 'candidates from lazy bundles',
|
||||
\ 'action_table' : {},
|
||||
\ 'default_action' : 'source',
|
||||
\ }
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
let _ = []
|
||||
for bundle in filter(copy(neobundle#config#get_neobundles()),
|
||||
\ '!v:val.sourced')
|
||||
let name = substitute(bundle.orig_name,
|
||||
\ '^\%(https\?\|git\)://\%(github.com/\)\?', '', '')
|
||||
let dict = {
|
||||
\ 'word' : name,
|
||||
\ 'kind' : 'neobundle',
|
||||
\ 'action__path' : bundle.path,
|
||||
\ 'action__directory' : bundle.path,
|
||||
\ 'action__bundle' : bundle,
|
||||
\ 'action__bundle_name' : bundle.name,
|
||||
\ 'source__uri' : bundle.uri,
|
||||
\ }
|
||||
call add(_, dict)
|
||||
endfor
|
||||
|
||||
return _
|
||||
endfunction"}}}
|
||||
|
||||
" Actions "{{{
|
||||
let s:source.action_table.source = {
|
||||
\ 'description' : 'source bundles',
|
||||
\ 'is_selectable' : 1,
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ }
|
||||
function! s:source.action_table.source.func(candidates) abort "{{{
|
||||
call call('neobundle#config#source',
|
||||
\ map(copy(a:candidates), 'v:val.action__bundle_name'))
|
||||
endfunction"}}}
|
||||
"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
@ -0,0 +1,66 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle/log.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neobundle_log#define() abort "{{{
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:source = {
|
||||
\ 'name' : 'neobundle/log',
|
||||
\ 'description' : 'print previous neobundle install logs',
|
||||
\ 'syntax' : 'uniteSource__NeoBundleLog',
|
||||
\ 'hooks' : {},
|
||||
\ }
|
||||
|
||||
function! s:source.hooks.on_syntax(args, context) abort "{{{
|
||||
syntax match uniteSource__NeoBundleLog_Message /.*/
|
||||
\ contained containedin=uniteSource__NeoBundleLog
|
||||
highlight default link uniteSource__NeoBundleLog_Message Comment
|
||||
syntax match uniteSource__NeoBundleLog_Progress /(.\{-}):\s*.*/
|
||||
\ contained containedin=uniteSource__NeoBundleLog
|
||||
highlight default link uniteSource__NeoBundleLog_Progress String
|
||||
syntax match uniteSource__NeoBundleLog_Source /|.\{-}|/
|
||||
\ contained containedin=uniteSource__NeoBundleLog_Progress
|
||||
highlight default link uniteSource__NeoBundleLog_Source Type
|
||||
syntax match uniteSource__NeoBundleLog_URI /-> diff URI/
|
||||
\ contained containedin=uniteSource__NeoBundleLog
|
||||
highlight default link uniteSource__NeoBundleLog_URI Underlined
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
return map(copy(neobundle#installer#get_log()), "{
|
||||
\ 'word' : (v:val =~ '^\\s*\\h\\w*://' ? ' -> diff URI' : v:val),
|
||||
\ 'kind' : (v:val =~ '^\\s*\\h\\w*://' ? 'uri' : 'word'),
|
||||
\ 'action__uri' : substitute(v:val, '^\\s\\+', '', ''),
|
||||
\ }")
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
265
bundle/neobundle.vim/autoload/unite/sources/neobundle_search.vim
Normal file
265
bundle/neobundle.vim/autoload/unite/sources/neobundle_search.vim
Normal file
@ -0,0 +1,265 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle_search.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:Cache = unite#util#get_vital_cache()
|
||||
|
||||
function! unite#sources#neobundle_search#define() abort "{{{
|
||||
" Init sources.
|
||||
if !exists('s:neobundle_sources')
|
||||
let s:neobundle_sources = {}
|
||||
for define in map(split(globpath(&runtimepath,
|
||||
\ 'autoload/neobundle/sources/*.vim', 1), '\n'),
|
||||
\ "neobundle#sources#{fnamemodify(v:val, ':t:r')}#define()")
|
||||
for dict in (type(define) == type([]) ? define : [define])
|
||||
if !empty(dict) && !has_key(s:neobundle_sources, dict.name)
|
||||
let s:neobundle_sources[dict.name] = dict
|
||||
endif
|
||||
endfor
|
||||
unlet define
|
||||
endfor
|
||||
endif
|
||||
|
||||
return s:source
|
||||
endfunction"}}}
|
||||
|
||||
let s:plugin_names = []
|
||||
|
||||
" Source rec.
|
||||
let s:source = {
|
||||
\ 'name' : 'neobundle/search',
|
||||
\ 'description' : 'search plugins for neobundle',
|
||||
\ 'hooks' : {},
|
||||
\ 'action_table' : {},
|
||||
\ 'default_action' : 'yank',
|
||||
\ 'max_candidates' : 200,
|
||||
\ 'syntax' : 'uniteSource__NeoBundleSearch',
|
||||
\ 'parents' : ['uri'],
|
||||
\ }
|
||||
|
||||
function! s:source.hooks.on_init(args, context) abort "{{{
|
||||
let a:context.source__sources = copy(s:neobundle_sources)
|
||||
if !empty(a:args)
|
||||
let a:context.source__sources = filter(
|
||||
\ a:context.source__sources,
|
||||
\ 'index(a:args, v:key) >= 0')
|
||||
endif
|
||||
|
||||
let a:context.source__input = a:context.input
|
||||
if a:context.source__input == ''
|
||||
let a:context.source__input =
|
||||
\ unite#util#input('Please input search word: ', '',
|
||||
\ 'customlist,unite#sources#neobundle_search#complete_plugin_names')
|
||||
endif
|
||||
endfunction"}}}
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
if neobundle#util#is_sudo()
|
||||
call neobundle#util#print_error(
|
||||
\ '"sudo vim" is detected. This feature is disabled.')
|
||||
return []
|
||||
endif
|
||||
|
||||
call unite#print_source_message('Search word: '
|
||||
\ . a:context.source__input, s:source.name)
|
||||
|
||||
let candidates = []
|
||||
let a:context.source__source_names = []
|
||||
|
||||
let s:plugin_names = []
|
||||
|
||||
for source in values(a:context.source__sources)
|
||||
let source_candidates = source.gather_candidates(a:args, a:context)
|
||||
let source_name = get(source, 'short_name', source.name)
|
||||
for candidate in source_candidates
|
||||
let candidate.source__source = source_name
|
||||
if !has_key(candidate, 'source__script_type')
|
||||
let candidate.source__script_type = ''
|
||||
endif
|
||||
if !has_key(candidate, 'source__description')
|
||||
let candidate.source__description = ''
|
||||
endif
|
||||
endfor
|
||||
|
||||
let candidates += source_candidates
|
||||
call add(a:context.source__source_names, source_name)
|
||||
|
||||
let s:plugin_names += map(copy(source_candidates), 'v:val.source__name')
|
||||
endfor
|
||||
|
||||
call s:initialize_plugin_names(a:context)
|
||||
|
||||
return filter(candidates,
|
||||
\ 'stridx(v:val.word, a:context.source__input) >= 0')
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source.complete(args, context, arglead, cmdline, cursorpos) abort "{{{
|
||||
let arglead = get(a:args, -1, '')
|
||||
return filter(keys(s:neobundle_sources),
|
||||
\ "stridx(v:val, arglead) == 0")
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source.hooks.on_syntax(args, context) abort "{{{
|
||||
syntax match uniteSource__NeoBundleSearch_DescriptionLine
|
||||
\ / -- .*$/
|
||||
\ contained containedin=uniteSource__NeoBundleSearch
|
||||
syntax match uniteSource__NeoBundleSearch_Description
|
||||
\ /.*$/
|
||||
\ contained containedin=uniteSource__NeoBundleSearch_DescriptionLine
|
||||
syntax match uniteSource__NeoBundleSearch_Marker
|
||||
\ / -- /
|
||||
\ contained containedin=uniteSource__NeoBundleSearch_DescriptionLine
|
||||
syntax match uniteSource__NeoBundleSearch_Install
|
||||
\ / Installed /
|
||||
\ contained containedin=uniteSource__NeoBundleSearch
|
||||
highlight default link uniteSource__NeoBundleSearch_Install Statement
|
||||
highlight default link uniteSource__NeoBundleSearch_Marker Special
|
||||
highlight default link uniteSource__NeoBundleSearch_Description Comment
|
||||
endfunction"}}}
|
||||
|
||||
" Actions "{{{
|
||||
let s:source.action_table.yank = {
|
||||
\ 'description' : 'yank plugin settings',
|
||||
\ 'is_selectable' : 1,
|
||||
\ }
|
||||
function! s:source.action_table.yank.func(candidates) abort "{{{
|
||||
let @" = join(map(a:candidates,
|
||||
\ "'NeoBundle ' . s:get_neobundle_args(v:val)"), "\n")
|
||||
if has('clipboard')
|
||||
call setreg(v:register, @")
|
||||
endif
|
||||
|
||||
echo 'Yanked plugin settings!'
|
||||
endfunction"}}}
|
||||
|
||||
let s:source.action_table.install = {
|
||||
\ 'description' : 'direct install plugins',
|
||||
\ 'is_selectable' : 1,
|
||||
\ 'is_quit' : 0,
|
||||
\ }
|
||||
function! s:source.action_table.install.func(candidates) abort "{{{
|
||||
for candidate in a:candidates
|
||||
execute 'NeoBundleDirectInstall' s:get_neobundle_args(candidate)
|
||||
endfor
|
||||
endfunction"}}}
|
||||
"}}}
|
||||
|
||||
" Filters "{{{
|
||||
function! s:source.source__sorter(candidates, context) abort "{{{
|
||||
return s:sort_by(a:candidates, 'v:val.source__name')
|
||||
endfunction"}}}
|
||||
function! s:source.source__converter(candidates, context) abort "{{{
|
||||
let max_plugin_name = max(map(copy(a:candidates),
|
||||
\ 'len(v:val.source__name)'))
|
||||
let max_script_type = max(map(copy(a:candidates),
|
||||
\ 'len(v:val.source__script_type)'))
|
||||
let max_source_name = max(map(copy(a:context.source__source_names),
|
||||
\ 'len(v:val)'))
|
||||
let format = '%-'. max_plugin_name .'s %-'.
|
||||
\ max_source_name .'s %-'. max_script_type .'s -- %s'
|
||||
|
||||
for candidate in a:candidates
|
||||
let candidate.abbr = printf(format,
|
||||
\ candidate.source__name, candidate.source__source,
|
||||
\ candidate.source__script_type,
|
||||
\ (neobundle#is_installed(candidate.source__name) ?
|
||||
\ 'Installed' : candidate.source__description))
|
||||
let candidate.is_multiline = 1
|
||||
let candidate.kind =
|
||||
\ get(candidate, 'action__path', '') != '' ?
|
||||
\ 'file' : 'common'
|
||||
endfor
|
||||
|
||||
return a:candidates
|
||||
endfunction"}}}
|
||||
|
||||
let s:source.sorters = s:source.source__sorter
|
||||
let s:source.converters = s:source.source__converter
|
||||
"}}}
|
||||
|
||||
" Misc. "{{{
|
||||
function! s:sort_by(list, expr) abort
|
||||
let pairs = map(a:list, printf('[v:val, %s]', a:expr))
|
||||
return map(s:sort(pairs,
|
||||
\ 'a:a[1] == a:b[1] ? 0 : a:a[1] > a:b[1] ? 1 : -1'), 'v:val[0]')
|
||||
endfunction
|
||||
|
||||
" Sorts a list with expression to compare each two values.
|
||||
" a:a and a:b can be used in {expr}.
|
||||
function! s:sort(list, expr) abort
|
||||
if type(a:expr) == type(function('function'))
|
||||
return sort(a:list, a:expr)
|
||||
endif
|
||||
let s:expr = a:expr
|
||||
return sort(a:list, 's:_compare')
|
||||
endfunction
|
||||
|
||||
function! s:_compare(a, b) abort
|
||||
return eval(s:expr)
|
||||
endfunction
|
||||
|
||||
function! s:get_neobundle_args(candidate) abort
|
||||
return string(substitute(a:candidate.source__path,
|
||||
\ '^https://github.com/', '', ''))
|
||||
\ . (empty(a:candidate.source__options) ?
|
||||
\ '' : ', ' . string(a:candidate.source__options))
|
||||
\ . (a:candidate.source__description == '' ? '' :
|
||||
\ ' " ' . a:candidate.source__description)
|
||||
endfunction
|
||||
|
||||
function! unite#sources#neobundle_search#complete_plugin_names(arglead, cmdline, cursorpos) abort "{{{
|
||||
return filter(s:get_plugin_names(), "stridx(v:val, a:arglead) == 0")
|
||||
endfunction"}}}
|
||||
|
||||
function! s:initialize_plugin_names(context) abort "{{{
|
||||
let cache_dir = neobundle#get_neobundle_dir() . '/.neobundle'
|
||||
let path = 'plugin_names'
|
||||
|
||||
if a:context.is_redraw || !s:Cache.filereadable(cache_dir, path)
|
||||
" Convert cache data.
|
||||
call s:Cache.writefile(cache_dir, path, [string(s:plugin_names)])
|
||||
endif
|
||||
|
||||
return s:get_plugin_names()
|
||||
endfunction"}}}
|
||||
|
||||
function! s:get_plugin_names() abort "{{{
|
||||
let cache_dir = neobundle#get_neobundle_dir() . '/.neobundle'
|
||||
let path = 'plugin_names'
|
||||
|
||||
if empty(s:plugin_names) && s:Cache.filereadable(cache_dir, path)
|
||||
sandbox let s:plugin_names =
|
||||
\ eval(get(s:Cache.readfile(cache_dir, path), 0, '[]'))
|
||||
endif
|
||||
|
||||
return neobundle#util#uniq(s:plugin_names)
|
||||
endfunction"}}}
|
||||
"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: foldmethod=marker
|
137
bundle/neobundle.vim/bin/install.sh
Normal file
137
bundle/neobundle.vim/bin/install.sh
Normal file
@ -0,0 +1,137 @@
|
||||
#!/bin/sh
|
||||
# Standalone installer for Unixs
|
||||
# Original version is created by shoma2da
|
||||
# https://github.com/shoma2da/neobundle_installer
|
||||
|
||||
# Installation directory
|
||||
BUNDLE_DIR=~/.vim/bundle
|
||||
INSTALL_DIR="$BUNDLE_DIR/neobundle.vim"
|
||||
echo "$INSTALL_DIR"
|
||||
if [ -e "$INSTALL_DIR" ]; then
|
||||
echo "$INSTALL_DIR already exists!"
|
||||
fi
|
||||
|
||||
NVIM_DIR=~/.config/nvim
|
||||
NVIM_BUNDLE_DIR="$NVIM_DIR/bundle"
|
||||
NVIM_INSTALL_DIR="$NVIM_BUNDLE_DIR/neobundle.vim"
|
||||
echo "$NVIM_INSTALL_DIR"
|
||||
if [ -e "$NVIM_INSTALL_DIR" ]; then
|
||||
echo "$NVIM_INSTALL_DIR already exists!"
|
||||
fi
|
||||
|
||||
if [ -e "$INSTALL_DIR" ] && [ -e "$NVIM_INSTALL_DIR" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check git command
|
||||
if type git; then
|
||||
: # You have git command. No Problem.
|
||||
else
|
||||
echo 'Please install git or update your path to include the git executable!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make bundle dir and fetch neobundle
|
||||
echo "Begin fetching NeoBundle..."
|
||||
if ! [ -e "$INSTALL_DIR" ]; then
|
||||
mkdir -p "$BUNDLE_DIR"
|
||||
git clone https://github.com/Shougo/neobundle.vim "$INSTALL_DIR"
|
||||
fi
|
||||
|
||||
if type nvim > /dev/null 2>&1 && ! [ -e "$NVIM_INSTALL_DIR" ]; then
|
||||
mkdir -p "$NVIM_BUNDLE_DIR"
|
||||
git clone https://github.com/Shougo/neobundle.vim "$NVIM_INSTALL_DIR"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
|
||||
# write initial setting for .vimrc
|
||||
echo "Please add the following settings for NeoBundle to the top of your .vimrc file:"
|
||||
{
|
||||
echo ""
|
||||
echo ""
|
||||
echo "\"NeoBundle Scripts-----------------------------"
|
||||
echo "if &compatible"
|
||||
echo " set nocompatible \" Be iMproved"
|
||||
echo "endif"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "set runtimepath+=$BUNDLE_DIR/neobundle.vim/"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "call neobundle#begin(expand('$BUNDLE_DIR'))"
|
||||
echo ""
|
||||
echo "\" Let NeoBundle manage NeoBundle"
|
||||
echo "\" Required:"
|
||||
echo "NeoBundleFetch 'Shougo/neobundle.vim'"
|
||||
echo ""
|
||||
echo "\" Add or remove your Bundles here:"
|
||||
echo "NeoBundle 'Shougo/neosnippet.vim'"
|
||||
echo "NeoBundle 'Shougo/neosnippet-snippets'"
|
||||
echo "NeoBundle 'tpope/vim-fugitive'"
|
||||
echo "NeoBundle 'ctrlpvim/ctrlp.vim'"
|
||||
echo "NeoBundle 'flazz/vim-colorschemes'"
|
||||
echo ""
|
||||
echo "\" You can specify revision/branch/tag."
|
||||
echo "NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "call neobundle#end()"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "filetype plugin indent on"
|
||||
echo ""
|
||||
echo "\" If there are uninstalled bundles found on startup,"
|
||||
echo "\" this will conveniently prompt you to install them."
|
||||
echo "NeoBundleCheck"
|
||||
echo "\"End NeoBundle Scripts-------------------------"
|
||||
echo ""
|
||||
echo ""
|
||||
}
|
||||
|
||||
# write initial setting for ~/.config/nvim/init.vim
|
||||
if type nvim > /dev/null 2>&1; then
|
||||
echo "Please add the following settings for NeoBundle to the top of your init.vim file:"
|
||||
{
|
||||
echo ""
|
||||
echo ""
|
||||
echo "\"NeoBundle Scripts-----------------------------"
|
||||
echo "if has('vim_starting')"
|
||||
echo " \" Required:"
|
||||
echo " set runtimepath+=$NVIM_BUNDLE_DIR/neobundle.vim/"
|
||||
echo "endif"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "call neobundle#begin(expand('$NVIM_BUNDLE_DIR'))"
|
||||
echo ""
|
||||
echo "\" Let NeoBundle manage NeoBundle"
|
||||
echo "\" Required:"
|
||||
echo "NeoBundleFetch 'Shougo/neobundle.vim'"
|
||||
echo ""
|
||||
echo "\" Add or remove your Bundles here:"
|
||||
echo "NeoBundle 'Shougo/neosnippet.vim'"
|
||||
echo "NeoBundle 'Shougo/neosnippet-snippets'"
|
||||
echo "NeoBundle 'tpope/vim-fugitive'"
|
||||
echo "NeoBundle 'ctrlpvim/ctrlp.vim'"
|
||||
echo "NeoBundle 'flazz/vim-colorschemes'"
|
||||
echo ""
|
||||
echo "\" You can specify revision/branch/tag."
|
||||
echo "NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "call neobundle#end()"
|
||||
echo ""
|
||||
echo "\" Required:"
|
||||
echo "filetype plugin indent on"
|
||||
echo ""
|
||||
echo "\" If there are uninstalled bundles found on startup,"
|
||||
echo "\" this will conveniently prompt you to install them."
|
||||
echo "NeoBundleCheck"
|
||||
echo "\"End NeoBundle Scripts-------------------------"
|
||||
echo ""
|
||||
echo ""
|
||||
}
|
||||
fi
|
||||
echo "Done."
|
||||
|
||||
echo "Complete setup NeoBundle!"
|
12
bundle/neobundle.vim/bin/neoinstall
Normal file
12
bundle/neobundle.vim/bin/neoinstall
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Detect .vimrc path.
|
||||
VIMRC=$HOME/.vimrc
|
||||
|
||||
if [ ! -e $VIMRC ]; then
|
||||
VIMRC=$HOME/.vim/vimrc
|
||||
fi
|
||||
|
||||
vim -N -u $VIMRC -c "try | NeoBundleUpdate! $* | finally | qall! | endtry" \
|
||||
-U NONE -i NONE -V1 -e -s
|
||||
echo ''
|
30
bundle/neobundle.vim/bin/neoinstall.bat
Normal file
30
bundle/neobundle.vim/bin/neoinstall.bat
Normal file
@ -0,0 +1,30 @@
|
||||
@echo off
|
||||
for /F "usebackq" %%t in (`where vim`) do SET _VIM=%%t
|
||||
set VIM=%_VIM:\vim.exe=%
|
||||
if "%HOME%"=="" set HOME=%USERPROFILE%
|
||||
set _VIMRC=%HOME%\_vimrc
|
||||
if exist %_VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %_VIMRC% goto DOTVIMRC
|
||||
|
||||
:DOTVIMRC
|
||||
set VIMRC=%HOME%\.vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto VIMFILES
|
||||
|
||||
:VIMFILES
|
||||
set VIMRC=%HOME%\vimfiles\vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto ORIGIN_VIM
|
||||
|
||||
:ORIGIN_VIM
|
||||
set VIMRC=%VIM%\_vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto NO_EXEC_NEOBUNDLE_INSTALL
|
||||
|
||||
@echo on
|
||||
:EXEC_NEOBUNDLE_INSTALL
|
||||
vim -N -u %VIMRC% -c "try | NeoBundleUpdate! %* | finally | qall! | endtry" -U NONE -i NONE -V1 -e -s
|
||||
|
||||
|
||||
:NO_EXEC_NEOBUNDLE_INSTALL
|
||||
echo 'vimrc is NotFound.'
|
30
bundle/neobundle.vim/bin/neoinstall_novimproc.bat
Normal file
30
bundle/neobundle.vim/bin/neoinstall_novimproc.bat
Normal file
@ -0,0 +1,30 @@
|
||||
@echo off
|
||||
for /F "usebackq" %%t in (`where vim`) do SET _VIM=%%t
|
||||
set VIM=%_VIM:\vim.exe=%
|
||||
if "%HOME%"=="" set HOME=%USERPROFILE%
|
||||
set _VIMRC=%HOME%\_vimrc
|
||||
if exist %_VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %_VIMRC% goto DOTVIMRC
|
||||
|
||||
:DOTVIMRC
|
||||
set VIMRC=%HOME%\.vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto VIMFILES
|
||||
|
||||
:VIMFILES
|
||||
set VIMRC=%HOME%\vimfiles\vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto ORIGIN_VIM
|
||||
|
||||
:ORIGIN_VIM
|
||||
set VIMRC=%VIM%\_vimrc
|
||||
if exist %VIMRC% goto EXEC_NEOBUNDLE_INSTALL
|
||||
if not exist %VIMRC% goto NO_EXEC_NEOBUNDLE_INSTALL
|
||||
|
||||
@echo on
|
||||
:EXEC_NEOBUNDLE_INSTALL
|
||||
vim -N -u %VIMRC% --cmd "let g:vimproc#disable = 1" -c "try | NeoBundleUpdate! %* | finally | qall! | endtry" -U NONE -i NONE -V1 -e -s
|
||||
|
||||
|
||||
:NO_EXEC_NEOBUNDLE_INSTALL
|
||||
echo 'vimrc is NotFound.'
|
1753
bundle/neobundle.vim/doc/neobundle.txt
Normal file
1753
bundle/neobundle.vim/doc/neobundle.txt
Normal file
File diff suppressed because it is too large
Load Diff
60
bundle/neobundle.vim/plugin/neobundle.vim
Normal file
60
bundle/neobundle.vim/plugin/neobundle.vim
Normal file
@ -0,0 +1,60 @@
|
||||
"=============================================================================
|
||||
" FILE: neobundle.vim
|
||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||
" License: MIT license {{{
|
||||
" Permission is hereby granted, free of charge, to any person obtaining
|
||||
" a copy of this software and associated documentation files (the
|
||||
" "Software"), to deal in the Software without restriction, including
|
||||
" without limitation the rights to use, copy, modify, merge, publish,
|
||||
" distribute, sublicense, and/or sell copies of the Software, and to
|
||||
" permit persons to whom the Software is furnished to do so, subject to
|
||||
" the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included
|
||||
" in all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
" }}}
|
||||
"=============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists('g:loaded_neobundle')
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
finish
|
||||
elseif v:version < 702 || (v:version == 702 && !has('patch51'))
|
||||
" Neobundle uses glob()/globpath() another parameter.
|
||||
" It is implemented in Vim 7.2.051.
|
||||
echoerr 'neobundle does not work this version of Vim "' . v:version . '".'
|
||||
\ .' You must use Vim 7.2.051 or later.'
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
finish
|
||||
elseif fnamemodify(&shell, ':t') ==# 'fish' && !has('patch-7.4.276')
|
||||
echoerr 'Vim does not support "' . &shell . '".'
|
||||
\ .' You must use Vim 7.4.276 or later.'
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_neobundle = 1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" __END__
|
||||
" vim: foldmethod=marker
|
117
bundle/neobundle.vim/test/commands.vim
Normal file
117
bundle/neobundle.vim/test/commands.vim
Normal file
@ -0,0 +1,117 @@
|
||||
" Basic commands test.
|
||||
set verbose=1
|
||||
|
||||
let path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
if isdirectory(path)
|
||||
let rm_command = neobundle#util#is_windows() ? 'rmdir /S /Q' : 'rm -rf'
|
||||
call system(printf('%s "%s"', rm_command, path))
|
||||
endif
|
||||
|
||||
call mkdir(path, 'p')
|
||||
|
||||
call neobundle#begin(path)
|
||||
|
||||
let g:neobundle#types#git#default_protocol = 'https'
|
||||
|
||||
" My Bundles here:
|
||||
"
|
||||
|
||||
" Original repositories in github.
|
||||
NeoBundle 'Shougo/neocomplcache-clang.git'
|
||||
|
||||
" Vim-script repositories.
|
||||
NeoBundle 'rails.vim'
|
||||
|
||||
" Username with dashes.
|
||||
NeoBundle 'vim-scripts/ragtag.vim'
|
||||
|
||||
" Original repo.
|
||||
NeoBundle 'altercation/vim-colors-solarized'
|
||||
|
||||
" With extension.
|
||||
" Comment is allowed.
|
||||
NeoBundle 'nelstrom/vim-mac-classic-theme.git' " Foo, Bar
|
||||
|
||||
" Invalid uri.
|
||||
NeoBundle 'nonexistinguser/hogehoge.git'
|
||||
|
||||
" Full uri.
|
||||
NeoBundle 'https://github.com/vim-scripts/vim-game-of-life'
|
||||
NeoBundle 'git@github.com:gmarik/ingretu.git'
|
||||
|
||||
" Short uri.
|
||||
NeoBundle 'gh:gmarik/snipmate.vim.git'
|
||||
NeoBundle 'github:mattn/gist-vim.git'
|
||||
|
||||
" Camel case.
|
||||
NeoBundle 'vim-scripts/RubySinatra'
|
||||
|
||||
" With options.
|
||||
NeoBundle 'Shougo/vimshell', '3787e5'
|
||||
|
||||
" None repos.
|
||||
NeoBundle 'muttator', {'type' : 'none', 'base' : '~/.vim/bundle'}
|
||||
|
||||
" Raw repos.
|
||||
NeoBundle 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
|
||||
\ {'script_type' : 'plugin'}
|
||||
|
||||
" NeoBundleLocal test.
|
||||
NeoBundleLocal ~/.vim/bundle/
|
||||
|
||||
" Depends repos.
|
||||
NeoBundle 'Shougo/neocomplcache',
|
||||
\ {'depends' : [
|
||||
\ 'Shougo/neocomplcache-snippets-complete.git',
|
||||
\ ['rstacruz/sparkup', {'rtp': 'vim'}],
|
||||
\ ]}
|
||||
NeoBundle 'Shougo/vimfiler',
|
||||
\ { 'depends' : 'Shougo/unite.vim' }
|
||||
|
||||
" Build repos.
|
||||
NeoBundle 'Shougo/vimproc', {
|
||||
\ 'build' : {
|
||||
\ 'windows' : 'echo "Sorry, cannot update vimproc binary file in Windows."',
|
||||
\ 'cygwin' : 'make -f make_cygwin.mak',
|
||||
\ 'mac' : 'make -f make_mac.mak',
|
||||
\ 'unix' : 'make -f make_unix.mak',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" Lazy load.
|
||||
NeoBundleLazy 'c9s/perlomni.vim.git'
|
||||
NeoBundleSource perlomni.vim
|
||||
call neobundle#source(['CSApprox'])
|
||||
|
||||
NeoBundleLazy 'The-NERD-tree', {'augroup' : 'NERDTree'}
|
||||
call neobundle#source(['The-NERD-tree'])
|
||||
|
||||
NeoBundleLazy 'masudaK/vim-python'
|
||||
NeoBundleLazy 'klen/python-mode'
|
||||
|
||||
NeoBundleLazy 'Rip-Rip/clang_complete', {
|
||||
\ 'autoload' : {
|
||||
\ 'filetypes' : ['c', 'cpp'],
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" script_type support.
|
||||
NeoBundle 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
|
||||
\ {'script_type' : 'plugin'}
|
||||
|
||||
" Fetch only.
|
||||
NeoBundleFetch 'Shougo/neobundle.vim'
|
||||
|
||||
call neobundle#end()
|
||||
|
||||
filetype plugin indent on " required!
|
||||
|
||||
" Should not break helptags.
|
||||
set wildignore+=doc
|
||||
|
||||
" Should not break clone.
|
||||
set wildignore+=.git
|
||||
set wildignore+=.git/*
|
||||
set wildignore+=*/.git/*
|
||||
|
35
bundle/neobundle.vim/test/lock.vim
Normal file
35
bundle/neobundle.vim/test/lock.vim
Normal file
@ -0,0 +1,35 @@
|
||||
" Lock file test.
|
||||
set verbose=1
|
||||
|
||||
let path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
if isdirectory(path)
|
||||
let rm_command = neobundle#util#is_windows() ? 'rmdir /S /Q' : 'rm -rf'
|
||||
call system(printf('%s "%s"', rm_command, path))
|
||||
endif
|
||||
|
||||
call mkdir(path, 'p')
|
||||
|
||||
call neobundle#begin(path)
|
||||
|
||||
NeoBundleFetch 'Shougo/neocomplete.vim'
|
||||
|
||||
call neobundle#end()
|
||||
|
||||
filetype plugin indent on " Required!
|
||||
|
||||
" Create lock file
|
||||
call writefile([
|
||||
\ 'NeoBundleLock neocomplete.vim 8200dfd83ba829f77f028ea26e81eebbe95e6a89',
|
||||
\ ], path . '/NeoBundle.lock')
|
||||
|
||||
NeoBundleInstall
|
||||
|
||||
let s:suite = themis#suite('lock')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.revision_check() abort
|
||||
let bundle = neobundle#get('neocomplete.vim')
|
||||
call s:assert.equals(neobundle#installer#get_revision_number(bundle),
|
||||
\ '8200dfd83ba829f77f028ea26e81eebbe95e6a89')
|
||||
endfunction
|
333
bundle/neobundle.vim/test/parse.vim
Normal file
333
bundle/neobundle.vim/test/parse.vim
Normal file
@ -0,0 +1,333 @@
|
||||
let s:suite = themis#suite('parser')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
let g:neobundle#types#git#default_protocol = 'https'
|
||||
let g:neobundle#types#hg#default_protocol = 'https'
|
||||
let g:neobundle#enable_name_conversion = 0
|
||||
|
||||
function! s:suite.github_git_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'Shougo/neocomplcache-clang.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/Shougo/neocomplcache-clang.git',
|
||||
\ 'name' : 'neocomplcache-clang'})
|
||||
call s:assert.equals(neobundle#parser#path('Shougo/vimshell'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/Shougo/vimshell.git',
|
||||
\ 'name' : 'vimshell'})
|
||||
call s:assert.equals(neobundle#parser#path('rails.vim'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/vim-scripts/rails.vim.git',
|
||||
\ 'name' : 'rails.vim'})
|
||||
call s:assert.equals(neobundle#parser#path('vim-scripts/ragtag.vim'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/vim-scripts/ragtag.vim.git',
|
||||
\ 'name' : 'ragtag.vim'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://github.com/vim-scripts/vim-game-of-life'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'https://github.com/vim-scripts/vim-game-of-life.git',
|
||||
\ 'name' : 'vim-game-of-life'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'git@github.com:gmarik/ingretu.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'git@github.com:gmarik/ingretu.git',
|
||||
\ 'name' : 'ingretu'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'gh:gmarik/snipmate.vim.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/gmarik/snipmate.vim.git',
|
||||
\ 'name' : 'snipmate.vim'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'github:mattn/gist-vim.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol .
|
||||
\ '://github.com/mattn/gist-vim.git',
|
||||
\ 'name' : 'gist-vim'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'git@github.com:Shougo/neocomplcache.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'git@github.com:Shougo/neocomplcache.git',
|
||||
\ 'name' : 'neocomplcache'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://github.com/Shougo/neocomplcache/'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'https://github.com/Shougo/neocomplcache.git',
|
||||
\ 'name' : 'neocomplcache'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'git://git.wincent.com/command-t.git'),
|
||||
\ {})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'http://github.com/Shougo/neocomplcache/'),
|
||||
\ {})
|
||||
endfunction
|
||||
|
||||
function! s:suite.svn_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'http://svn.macports.org/repository/macports/contrib/mpvim/'),
|
||||
\ {})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'svn://user@host/repos/bar'),
|
||||
\ {})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://svn.macports.org/repository/macports/contrib/mpvim/'),
|
||||
\ {'type' : 'svn', 'uri' :
|
||||
\ 'https://svn.macports.org/repository/macports/contrib/mpvim',
|
||||
\ 'name' : 'mpvim'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'svn+ssh://user@host/repos/bar'),
|
||||
\ {'type' : 'svn', 'uri' :
|
||||
\ 'svn+ssh://user@host/repos/bar',
|
||||
\ 'name' : 'bar'})
|
||||
endfunction
|
||||
|
||||
function! s:suite.hg_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://bitbucket.org/ns9tks/vim-fuzzyfinder'),
|
||||
\ {'type' : 'hg', 'uri' :
|
||||
\ 'https://bitbucket.org/ns9tks/vim-fuzzyfinder',
|
||||
\ 'name' : 'vim-fuzzyfinder'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'bitbucket://bitbucket.org/ns9tks/vim-fuzzyfinder'),
|
||||
\ {'type' : 'hg', 'uri' :
|
||||
\ g:neobundle#types#hg#default_protocol.
|
||||
\ '://bitbucket.org/ns9tks/vim-fuzzyfinder',
|
||||
\ 'name' : 'vim-fuzzyfinder'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'bitbucket:ns9tks/vim-fuzzyfinder'),
|
||||
\ {'type' : 'hg', 'uri' :
|
||||
\ g:neobundle#types#hg#default_protocol.
|
||||
\ '://bitbucket.org/ns9tks/vim-fuzzyfinder',
|
||||
\ 'name' : 'vim-fuzzyfinder'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'ns9tks/vim-fuzzyfinder', {'site': 'bitbucket'}),
|
||||
\ {'type' : 'hg', 'uri' :
|
||||
\ g:neobundle#types#hg#default_protocol.
|
||||
\ '://bitbucket.org/ns9tks/vim-fuzzyfinder',
|
||||
\ 'name' : 'vim-fuzzyfinder'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'ssh://hg@bitbucket.org/ns9tks/vim-fuzzyfinder'),
|
||||
\ {'type' : 'hg', 'uri' :
|
||||
\ 'ssh://hg@bitbucket.org/ns9tks/vim-fuzzyfinder',
|
||||
\ 'name' : 'vim-fuzzyfinder'})
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'type' : 'hg'}])
|
||||
call s:assert.equals(bundle.name, 'neobundle.vim')
|
||||
call s:assert.equals(bundle.type, 'hg')
|
||||
call s:assert.equals(bundle.uri,
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git')
|
||||
endfunction
|
||||
|
||||
function! s:suite.gitbucket_git_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
|
||||
\ 'name' : 'vim-qt-syntax'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'bitbucket:kh3phr3n/vim-qt-syntax.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ g:neobundle#types#git#default_protocol.
|
||||
\ '://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
|
||||
\ 'name' : 'vim-qt-syntax'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'git@bitbucket.com:accountname/reponame.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'git@bitbucket.com:accountname/reponame.git',
|
||||
\ 'name' : 'reponame'})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'ssh://git@bitbucket.com:foo/bar.git'),
|
||||
\ {'type' : 'git', 'uri' :
|
||||
\ 'ssh://git@bitbucket.com:foo/bar.git',
|
||||
\ 'name' : 'bar'})
|
||||
endfunction
|
||||
|
||||
function! s:suite.raw_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'http://raw.github.com/m2ym/rsense/master/etc/rsense.vim'),
|
||||
\ {})
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'http://www.vim.org/scripts/download_script.php?src_id=19237'),
|
||||
\ {})
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
|
||||
\ [{ 'script_type' : 'plugin'}])
|
||||
call s:assert.equals(bundle.name, 'rsense.vim')
|
||||
call s:assert.equals(bundle.type, 'raw')
|
||||
call s:assert.equals(bundle.uri,
|
||||
\ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim')
|
||||
endfunction
|
||||
|
||||
function! s:suite.vba_repos() abort
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://foo/bar.vba'),
|
||||
\ { 'name' : 'bar', 'uri' : 'https://foo/bar.vba', 'type' : 'vba' })
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'https://foo/bar.vba.gz'),
|
||||
\ { 'name' : 'bar', 'uri' : 'https://foo/bar.vba.gz', 'type' : 'vba' })
|
||||
call s:assert.equals(neobundle#parser#path(
|
||||
\ 'http://foo/bar.vba.gz'),
|
||||
\ {})
|
||||
endfunction
|
||||
|
||||
function! s:suite.default_options() abort
|
||||
let g:default_options_save = g:neobundle#default_options
|
||||
let g:neobundle#default_options =
|
||||
\ { 'rev' : {'type__update_style' : 'current'},
|
||||
\ '_' : {'type' : 'hg'} }
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'Shougo/neocomplcache', ['', 'rev', {}])
|
||||
call s:assert.equals(bundle.type__update_style, 'current')
|
||||
|
||||
let bundle2 = neobundle#parser#_init_bundle(
|
||||
\ 'Shougo/neocomplcache', [])
|
||||
call s:assert.equals(bundle2.type, 'hg')
|
||||
|
||||
let g:neobundle#default_options = g:default_options_save
|
||||
endfunction
|
||||
|
||||
function! s:suite.ssh_protocol() abort
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'accountname/reponame', [{
|
||||
\ 'site' : 'github', 'type' : 'git', 'type__protocol' : 'ssh' }])
|
||||
call s:assert.equals(bundle.uri,
|
||||
\ 'git@github.com:accountname/reponame.git')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'accountname/reponame', [{
|
||||
\ 'site' : 'bitbucket', 'type' : 'hg', 'type__protocol' : 'ssh' }])
|
||||
call s:assert.equals(bundle.uri,
|
||||
\ 'ssh://hg@bitbucket.org/accountname/reponame')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'accountname/reponame.git', [{
|
||||
\ 'site' : 'bitbucket', 'type' : 'git', 'type__protocol' : 'ssh' }])
|
||||
call s:assert.equals(bundle.uri,
|
||||
\ 'git@bitbucket.org:accountname/reponame.git')
|
||||
endfunction
|
||||
|
||||
function! s:suite.fetch_plugins() abort
|
||||
let bundle = neobundle#parser#fetch(
|
||||
\ string('accountname/reponame.git'))
|
||||
call s:assert.equals(bundle.rtp, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.parse_directory() abort
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'Shougo/neocomplcache', [])
|
||||
call s:assert.equals(bundle.directory, 'neocomplcache')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'Shougo/neocomplcache', ['ver.3'])
|
||||
call s:assert.equals(bundle.directory, 'neocomplcache_ver_3')
|
||||
endfunction
|
||||
|
||||
function! s:suite.name_conversion() abort
|
||||
let g:neobundle#enable_name_conversion = 1
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'type' : 'hg'}])
|
||||
call s:assert.equals(bundle.name, 'neobundle')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
|
||||
\ [{ 'type' : 'hg'}])
|
||||
call s:assert.equals(bundle.name, 'qt-syntax')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://bitbucket.org/kh3phr3n/qt-syntax-vim.git',
|
||||
\ [{ 'type' : 'hg'}])
|
||||
call s:assert.equals(bundle.name, 'qt-syntax')
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
|
||||
\ [{ 'name' : 'vim-qt-syntax'}])
|
||||
call s:assert.equals(bundle.name, 'vim-qt-syntax')
|
||||
|
||||
let g:neobundle#enable_name_conversion = 0
|
||||
endfunction
|
||||
|
||||
function! s:suite.autoload() abort
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'filetypes' : 'foo_ft' }])
|
||||
call s:assert.equals(bundle.on_ft, ['foo_ft'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'filename_patterns' : 'foo_filename' }])
|
||||
call s:assert.equals(bundle.on_path, ['foo_filename'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'explorer' : 1 }])
|
||||
call s:assert.equals(bundle.on_path, ['.*'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'commands' : 'Foo' }])
|
||||
call s:assert.equals(bundle.on_cmd, ['Foo'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'functions' : 'foo#bar' }])
|
||||
call s:assert.equals(bundle.on_func, ['foo#bar'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'mappings' : '<Plug>' }])
|
||||
call s:assert.equals(bundle.on_map, ['<Plug>'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'insert' : 1 }])
|
||||
call s:assert.equals(bundle.on_i, 1)
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'on_source' : 'plug_foo' }])
|
||||
call s:assert.equals(bundle.on_source, ['plug_foo'])
|
||||
call s:assert.equals(bundle.lazy, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'command_prefix' : 'PreFoo' }])
|
||||
call s:assert.equals(bundle.pre_cmd, ['PreFoo'])
|
||||
call s:assert.equals(bundle.lazy, 0)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'function_prefixes' : 'foo#' }])
|
||||
call s:assert.equals(bundle.pre_func, ['foo#'])
|
||||
call s:assert.equals(bundle.lazy, 0)
|
||||
endfunction
|
||||
|
||||
function! s:suite.deprecated() abort
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'stay_same' : '1' }])
|
||||
call s:assert.equals(bundle.frozen, 1)
|
||||
|
||||
let bundle = neobundle#parser#_init_bundle(
|
||||
\ 'https://github.com/Shougo/neobundle.vim.git',
|
||||
\ [{ 'type' : 'nosync' }])
|
||||
call s:assert.equals(bundle.type, 'none')
|
||||
endfunction
|
||||
|
||||
" vim:foldmethod=marker:fen:
|
39
bundle/neobundle.vim/test/sample.vim
Normal file
39
bundle/neobundle.vim/test/sample.vim
Normal file
@ -0,0 +1,39 @@
|
||||
" Sample configurations test.
|
||||
set verbose=1
|
||||
|
||||
let path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
if isdirectory(path)
|
||||
let rm_command = neobundle#util#is_windows() ? 'rmdir /S /Q' : 'rm -rf'
|
||||
call system(printf('%s "%s"', rm_command, path))
|
||||
endif
|
||||
|
||||
let neobundle#types#git#default_protocol = 'git'
|
||||
|
||||
call neobundle#begin(path)
|
||||
|
||||
" Let NeoBundle manage NeoBundle
|
||||
NeoBundleFetch 'Shougo/neobundle.vim'
|
||||
|
||||
" Recommended to install
|
||||
" After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
|
||||
NeoBundle 'Shougo/vimproc'
|
||||
|
||||
" My Bundles here:
|
||||
"
|
||||
" Note: You don't set neobundle setting in .gvimrc!
|
||||
" Original repos on github
|
||||
NeoBundle 'tpope/vim-fugitive'
|
||||
NeoBundle 'Lokaltog/vim-easymotion'
|
||||
NeoBundle 'rstacruz/sparkup', {'rtp': 'vim/'}
|
||||
" vim-scripts repos
|
||||
NeoBundle 'L9'
|
||||
NeoBundle 'FuzzyFinder'
|
||||
NeoBundle 'rails.vim'
|
||||
" Non git repos
|
||||
NeoBundle 'https://bitbucket.org/ns9tks/vim-fuzzyfinder'
|
||||
|
||||
call neobundle#end()
|
||||
|
||||
filetype plugin indent on " Required!
|
||||
|
95
bundle/neobundle.vim/test/source.vim
Normal file
95
bundle/neobundle.vim/test/source.vim
Normal file
@ -0,0 +1,95 @@
|
||||
" Source test.
|
||||
set verbose=1
|
||||
|
||||
let path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
if isdirectory(path)
|
||||
let rm_command = neobundle#util#is_windows() ? 'rmdir /S /Q' : 'rm -rf'
|
||||
call system(printf('%s "%s"', rm_command, path))
|
||||
endif
|
||||
|
||||
let neobundle#types#git#default_protocol = 'https'
|
||||
|
||||
call neobundle#begin(path)
|
||||
|
||||
" Test dependencies.
|
||||
|
||||
let s:suite = themis#suite('source')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
NeoBundleLazy 'Shougo/echodoc'
|
||||
NeoBundle 'Shougo/unite-build', { 'depends' : 'Shougo/echodoc' }
|
||||
|
||||
NeoBundle 'Shougo/unite-ssh', { 'depends' : 'Shougo/unite-sudo' }
|
||||
NeoBundleLazy 'Shougo/unite-sudo'
|
||||
|
||||
NeoBundleLazy 'Shougo/neomru.vim', { 'depends': 'Shougo/neocomplcache' }
|
||||
NeoBundle 'Shougo/neocomplcache.vim', 'ver.8'
|
||||
|
||||
NeoBundleLazy 'Shougo/vimshell', { 'depends': 'Shougo/vinarise' }
|
||||
NeoBundleLazy 'Shougo/vinarise'
|
||||
|
||||
NeoBundle 'Shougo/vimfiler', { 'depends' : 'foo/var' }
|
||||
|
||||
NeoBundleLazy 'Shougo/unite.vim', {
|
||||
\ 'depends' : ['Shougo/unite-outline', 'basyura/TweetVim'],
|
||||
\ 'autoload' : { 'commands' : 'Unite' } }
|
||||
NeoBundleLazy 'Shougo/unite-outline', {
|
||||
\ 'depends' : 'Shougo/unite.vim' }
|
||||
|
||||
" Dependencies test.
|
||||
NeoBundleLazy 'basyura/twibill.vim'
|
||||
NeoBundleLazy 'yomi322/neco-tweetvim'
|
||||
NeoBundleLazy 'rhysd/tweetvim-advanced-filter'
|
||||
NeoBundleLazy 'rhysd/TweetVim', {
|
||||
\ 'depends' :
|
||||
\ ['basyura/twibill.vim',
|
||||
\ 'tyru/open-browser.vim',
|
||||
\ 'yomi322/neco-tweetvim',
|
||||
\ 'rhysd/tweetvim-advanced-filter'],
|
||||
\ 'autoload' : {
|
||||
\ 'commands' :
|
||||
\ ['TweetVimHomeTimeline',
|
||||
\ 'TweetVimMentions',
|
||||
\ 'TweetVimSay',
|
||||
\ 'TweetVimUserTimeline']
|
||||
\ }
|
||||
\ }
|
||||
|
||||
" Law.
|
||||
NeoBundle 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
|
||||
\ {'script_type' : 'plugin', 'rev' : '0'}
|
||||
" NeoBundleReinstall rsense.vim
|
||||
|
||||
call neobundle#end()
|
||||
|
||||
filetype plugin indent on " required!
|
||||
|
||||
" Should not break helptags.
|
||||
set wildignore+=doc
|
||||
|
||||
" Should not break clone.
|
||||
set wildignore+=.git
|
||||
set wildignore+=.git/*
|
||||
set wildignore+=*/.git/*
|
||||
|
||||
function! s:suite.pattern_a() abort
|
||||
call s:assert.equals(neobundle#is_sourced('echodoc'), 1)
|
||||
call s:assert.equals(neobundle#is_sourced('unite-build'), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.pattern_b() abort
|
||||
call s:assert.equals(neobundle#is_sourced('unite-ssh'), 1)
|
||||
call s:assert.equals(neobundle#is_sourced('unite-sudo'), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.pattern_c() abort
|
||||
call s:assert.equals(neobundle#is_sourced('neomru.vim'), 0)
|
||||
call s:assert.equals(neobundle#is_sourced('neocomplcache.vim'), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.pattern_d() abort
|
||||
call s:assert.equals(neobundle#is_sourced('vimshell'), 0)
|
||||
call s:assert.equals(neobundle#is_sourced('vinarise'), 0)
|
||||
endfunction
|
||||
|
49
bundle/neobundle.vim/test/toml.vim
Normal file
49
bundle/neobundle.vim/test/toml.vim
Normal file
@ -0,0 +1,49 @@
|
||||
let s:suite = themis#suite('toml')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
let g:path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
function! s:suite.before_each() abort
|
||||
let g:temp = tempname()
|
||||
call neobundle#begin(g:path)
|
||||
endfunction
|
||||
|
||||
function! s:suite.after_each() abort
|
||||
call neobundle#end()
|
||||
call delete(g:temp)
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_toml() abort
|
||||
call writefile([
|
||||
\ 'foobar'
|
||||
\ ], g:temp)
|
||||
call s:assert.equals(neobundle#parser#load_toml(g:temp, {}), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_plugins() abort
|
||||
call writefile([], g:temp)
|
||||
call s:assert.equals(neobundle#parser#load_toml(g:temp, {}), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_repository() abort
|
||||
call writefile([
|
||||
\ "[[plugins]]",
|
||||
\ "filetypes = 'all'",
|
||||
\ "[[plugins]]",
|
||||
\ "filetypes = 'all'"
|
||||
\ ], g:temp)
|
||||
call s:assert.equals(neobundle#parser#load_toml(g:temp, {}), 1)
|
||||
endfunction
|
||||
|
||||
function! s:suite.normal() abort
|
||||
call writefile([
|
||||
\ "[[plugins]]",
|
||||
\ "repository = 'Shougo/tabpagebuffer.vim'",
|
||||
\ "filetypes = 'all'",
|
||||
\ "[[plugins]]",
|
||||
\ "repository = 'Shougo/tabpagebuffer.vim'",
|
||||
\ "filetypes = 'all'"
|
||||
\ ], g:temp)
|
||||
call s:assert.equals(neobundle#parser#load_toml(g:temp, {}), 0)
|
||||
endfunction
|
||||
|
182
bundle/neobundle.vim/test/tsort.vim
Normal file
182
bundle/neobundle.vim/test/tsort.vim
Normal file
@ -0,0 +1,182 @@
|
||||
let s:suite = themis#suite('tsort')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
let g:path = expand('~/test-bundle/'.fnamemodify(expand('<sfile>'), ':t:r'))
|
||||
|
||||
function! s:comp_bundle(bundle1, bundle2) abort
|
||||
return a:bundle1.name > a:bundle2.name
|
||||
endfunction
|
||||
|
||||
function! s:rotate_bundle(bundles) abort
|
||||
return a:bundles[1:-1]+a:bundles[0:0]
|
||||
endfunction
|
||||
|
||||
function! s:suite.before_each() abort
|
||||
endfunction
|
||||
|
||||
function! s:suite.after_each() abort
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_depends() abort
|
||||
" [a, b, c] => [a, b, c]
|
||||
let neobundle_test_data = [{'name' : 'a'}, {'name' : 'b'}, {'name' : 'c'},]
|
||||
call s:assert.equals(neobundle#config#tsort(neobundle_test_data),
|
||||
\ neobundle_test_data)
|
||||
endfunction
|
||||
|
||||
function! s:suite.normal() abort
|
||||
" a -> b -> c
|
||||
" b -> d
|
||||
" c
|
||||
" [a, b, c] => [c, b, a]
|
||||
let neobundle_test_data = [
|
||||
\ {'name' : 'a', 'depends' : [
|
||||
\ {'name' : 'b', 'depends' : [
|
||||
\ {'name' : 'c'},
|
||||
\ ]},
|
||||
\ ]},
|
||||
\ {'name' : 'b', 'skip' : 1, 'depends' : [
|
||||
\ {'name' : 'd', 'skipped' : 1, },
|
||||
\ ]},
|
||||
\ {'name' : 'c', 'skip' : 1},
|
||||
\ ]
|
||||
call s:assert.equals(neobundle#config#tsort(neobundle_test_data), [
|
||||
\ neobundle_test_data[0].depends[0].depends[0],
|
||||
\ neobundle_test_data[0].depends[0],
|
||||
\ neobundle_test_data[0],
|
||||
\ ])
|
||||
|
||||
" a -> c -> b
|
||||
" a -> d
|
||||
" b
|
||||
" c
|
||||
" [a, b, c] => [b, c, d, a]
|
||||
let neobundle_test_data = [
|
||||
\ {'name' : 'a', 'depends' : [
|
||||
\ {'name' : 'c', 'depends' : [
|
||||
\ {'name' : 'b'},
|
||||
\ ]},
|
||||
\ {'name' : 'd'},
|
||||
\ ]},
|
||||
\ {'name' : 'b', 'skip' : 1},
|
||||
\ {'name' : 'c', 'skip' : 1},
|
||||
\ ]
|
||||
call s:assert.equals(neobundle#config#tsort(neobundle_test_data),
|
||||
\ [
|
||||
\ neobundle_test_data[0].depends[0].depends[0],
|
||||
\ neobundle_test_data[0].depends[0],
|
||||
\ neobundle_test_data[0].depends[1],
|
||||
\ neobundle_test_data[0],
|
||||
\ ])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tsort_circular_reference() abort
|
||||
" a -> b -> c -> a
|
||||
" b
|
||||
" c
|
||||
" [a, b, c] => [c, b, a]
|
||||
let neobundle_test_data = [
|
||||
\ {'name' : 'a', 'depends' : [
|
||||
\ {'name' : 'b', 'depends' : [
|
||||
\ {'name' : 'c', 'depends' : [
|
||||
\ {'name' : 'a', 'skip' : 1},
|
||||
\ ]},
|
||||
\ ]},
|
||||
\ ]},
|
||||
\ {'name' : 'b', 'skip' : 1},
|
||||
\ {'name' : 'c', 'skip' : 1},
|
||||
\ ]
|
||||
call s:assert.equals(neobundle#config#tsort(neobundle_test_data),
|
||||
\ [
|
||||
\ neobundle_test_data[0].depends[0].depends[0],
|
||||
\ neobundle_test_data[0].depends[0],
|
||||
\ neobundle_test_data[0],
|
||||
\ ])
|
||||
endfunction
|
||||
|
||||
function! s:suite.bundled_no_depends() abort
|
||||
call neobundle#begin(g:path)
|
||||
NeoBundleLazy 'a/a'
|
||||
NeoBundleLazy 'b/b'
|
||||
NeoBundleLazy 'c/c'
|
||||
call neobundle#end()
|
||||
|
||||
let neobundle_test_data = sort(filter(neobundle#config#get_neobundles(),
|
||||
\ "v:val.name =~# '^[abc]$'"), "s:comp_bundle")
|
||||
|
||||
" [a, b, c] => [a, b, c]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(neobundle_test_data)),
|
||||
\ s:map(neobundle_test_data))
|
||||
|
||||
" [c, b, a] => [c, b, a]
|
||||
call reverse(neobundle_test_data)
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(neobundle_test_data)),
|
||||
\ s:map(neobundle_test_data))
|
||||
endfunction
|
||||
|
||||
function! s:suite.bundled_normal() abort
|
||||
call neobundle#begin(g:path)
|
||||
NeoBundleLazy 'a/a'
|
||||
NeoBundleLazy 'b/b', {'depends' : 'a/a'}
|
||||
NeoBundleLazy 'c/c', {'depends' : 'b/b'}
|
||||
call neobundle#end()
|
||||
|
||||
let neobundle_test_data = sort(filter(neobundle#config#get_neobundles(),
|
||||
\ "v:val.name =~# '^[abc]$'"), "s:comp_bundle")
|
||||
|
||||
" [a, b, c] => [a, b, c]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(neobundle_test_data)),
|
||||
\ s:map(neobundle_test_data))
|
||||
|
||||
" [c, b, a] => [a, b, c]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(
|
||||
\ reverse(copy(neobundle_test_data)))), s:map(neobundle_test_data))
|
||||
endfunction
|
||||
|
||||
function! s:suite.bundled_normal2() abort
|
||||
call neobundle#begin(g:path)
|
||||
NeoBundleLazy 'a/a', {'depends' : ['c/c', 'b/b']}
|
||||
NeoBundleLazy 'b/b'
|
||||
NeoBundleLazy 'c/c', {'depends' : 'b/b'}
|
||||
call neobundle#end()
|
||||
|
||||
let neobundle_test_data = sort(filter(neobundle#config#get_neobundles(),
|
||||
\ "v:val.name =~# '^[abc]$'"), "s:comp_bundle")
|
||||
let neobundle_test_rotated = s:map(s:rotate_bundle(neobundle_test_data))
|
||||
|
||||
" [a, b, c] => [b, c, a]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(
|
||||
\ neobundle_test_data)),
|
||||
\ neobundle_test_rotated)
|
||||
|
||||
" [c, b, a] => [b, c, a]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(
|
||||
\ reverse(copy(neobundle_test_data)))),
|
||||
\ neobundle_test_rotated)
|
||||
endfunction
|
||||
|
||||
function! s:suite.bundled_circular_reference() abort
|
||||
call neobundle#begin(g:path)
|
||||
NeoBundleLazy 'a/a', {'depends' : 'b/b'}
|
||||
NeoBundleLazy 'b/b', {'depends' : 'c/c'}
|
||||
NeoBundleLazy 'c/c', {'depends' : 'a/a'}
|
||||
call neobundle#end()
|
||||
|
||||
let neobundle_test_data = sort(filter(neobundle#config#get_neobundles(),
|
||||
\ "v:val.name =~# '^[abc]$'"), "s:comp_bundle")
|
||||
|
||||
" [a, b, c] => [c, b, a]
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(neobundle_test_data)),
|
||||
\ s:map(reverse(copy(neobundle_test_data))))
|
||||
|
||||
" [c, b, a] => [b, a, c]
|
||||
call reverse(neobundle_test_data)
|
||||
let neobundle_test_rotated = s:rotate_bundle(neobundle_test_data)
|
||||
call s:assert.equals(s:map(neobundle#config#tsort(neobundle_test_data)),
|
||||
\ s:map(neobundle_test_rotated))
|
||||
endfunction
|
||||
|
||||
function! s:map(list) abort
|
||||
return map(copy(a:list), 'v:val.name')
|
||||
endfunction
|
||||
|
@ -259,9 +259,9 @@ function! s:view_github_starred_repos() abort
|
||||
Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos
|
||||
endif
|
||||
endfunction
|
||||
if SpaceVim#layers#isLoaded('tools#mpv')
|
||||
call SpaceVim#layers#tools#mpv#loadMusics()
|
||||
endif
|
||||
" if SpaceVim#layers#isLoaded('tools#mpv')
|
||||
" call SpaceVim#layers#tools#mpv#loadMusics()
|
||||
" endif
|
||||
augroup unite_buffer_feature
|
||||
autocmd FileType unite call s:unite_my_settings()
|
||||
augroup END
|
||||
|
@ -149,12 +149,13 @@ CONTENTS *SpaceVim-contents*
|
||||
73. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
74. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
||||
75. language server protocol........................|SpaceVim-layer-lsp|
|
||||
76. operator...................................|SpaceVim-layer-operator|
|
||||
77. shell.........................................|SpaceVim-layer-shell|
|
||||
78. test...........................................|SpaceVim-layer-test|
|
||||
79. tmux...........................................|SpaceVim-layer-tmux|
|
||||
80. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
81. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||
76. leaderf.....................................|SpaceVim-layer-leaderf|
|
||||
77. operator...................................|SpaceVim-layer-operator|
|
||||
78. shell.........................................|SpaceVim-layer-shell|
|
||||
79. test...........................................|SpaceVim-layer-test|
|
||||
80. tmux...........................................|SpaceVim-layer-tmux|
|
||||
81. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
82. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||
7. Usage....................................................|SpaceVim-usage|
|
||||
1. custom_plugins........................|SpaceVim-usage-custom_plugins|
|
||||
2. tasks..........................................|SpaceVim-usage-tasks|
|
||||
@ -3099,6 +3100,12 @@ LANGUAGE SERVER PROTOCOL *SpaceVim-layer-lsp*
|
||||
|
||||
This layer provides language client support for SpaceVim.
|
||||
|
||||
==============================================================================
|
||||
LEADERF *SpaceVim-layer-leaderf*
|
||||
|
||||
This layer provides fuzzy finder feature which is based on leaderf, and this
|
||||
layer requires vim compiled with `+python` or `+python3`.
|
||||
|
||||
==============================================================================
|
||||
OPERATOR *SpaceVim-layer-operator*
|
||||
|
||||
|
@ -75,7 +75,10 @@ With layers feature, this version of Vim distribution try to turn Vim/Neovim int
|
||||
|
||||
- Which version of Vim/Neovim is needed?
|
||||
|
||||
Vim 7.4/Neovim v0.1.7, and `+lua` or `+python3` is needed.
|
||||
SpaceVim has been tested in following version of vim/neovim:
|
||||
|
||||
1. vim `7.4.1689`,`8.0.0027`,`8.0.1453`
|
||||
2. neovim ~~`0.2.0`~~,`0.2.2`,`0.3.0`,`0.3.1`,`0.3.2`,`0.3.3`,`0.3.4`,`0.3.5`,`0.3.7`,`0.3.8`,`0.4.2`,`0.4.3`
|
||||
|
||||
For more general questions, please read SpaceVim [FAQ](faq/).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user