Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: plugin declaration can be overwitten. #127

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugin/jetpack.vim
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function! jetpack#is_opt(pkg) abort
\ || !empty(a:pkg.cmd)
\ || !empty(a:pkg.keys)
\ || !empty(a:pkg.event)
endfunction
endfunction

function! jetpack#gets(pkg, keys, default) abort
let values = []
Expand All @@ -461,15 +461,15 @@ function! jetpack#gets(pkg, keys, default) abort
endfunction

function! jetpack#add(plugin, ...) abort
if has_key(s:declared_packages, a:plugin)
let opts = a:0 > 0 ? a:1 : {}
let name = jetpack#gets(opts, ['as', 'name'], [fnamemodify(a:plugin, ':t')])[0]
if has_key(s:declared_packages, name)
return
endif
let opts = a:0 > 0 ? a:1 : {}
let local = jetpack#is_local_plug(a:plugin)
let url = local ? expand(a:plugin) : (a:plugin !~# '.\+://' ? 'https://github.com/' : '') . a:plugin
let path = s:optdir . '/' . substitute(url, '.\+/\(.\+\)', '\1', '')
let path = expand(local ? a:plugin : jetpack#gets(opts, ['dir', 'path'], [path])[0])
let name = jetpack#gets(opts, ['as', 'name'], [fnamemodify(a:plugin, ':t')])[0]
let dependees = jetpack#gets(opts, ['requires', 'depends'], [])
call map(dependees, { _, r -> r =~# '/' ? substitute(r, '.*/', '', '') : r })
let dependers_before = jetpack#gets(opts, ['before', 'on_source'], [])
Expand Down
Loading