Browse Source

Refactor global variables into script local variables.

These variables only occur in one file each.  By making them script local
variables this is "documented" in the code.  At the same time the global
namespace is polluted less.

Changed:
    g:bundle_names          -> s:bundle_names
    g:vundle_last_status    -> s:last_status
    g:vundle_log_file       -> s:log_file
    g:vundle_view           -> s:view
pull/450/head
Lucas Hoffmann 11 years ago
parent
commit
088295df77
3 changed files with 14 additions and 14 deletions
  1. +4
    -4
      autoload/vundle/config.vim
  2. +3
    -3
      autoload/vundle/installer.vim
  3. +7
    -7
      autoload/vundle/scripts.vim

+ 4
- 4
autoload/vundle/config.vim View File

@ -43,7 +43,7 @@ func! vundle#config#init()
if !exists('g:bundles') | let g:bundles = [] | endif if !exists('g:bundles') | let g:bundles = [] | endif
call s:rtp_rm_a() call s:rtp_rm_a()
let g:bundles = [] let g:bundles = []
let g:bundle_names = {}
let s:bundle_names = {}
endf endf
@ -91,14 +91,14 @@ endf
" return -- 0 if the bundle's name has been seen before, 1 otherwise " return -- 0 if the bundle's name has been seen before, 1 otherwise
" --------------------------------------------------------------------------- " ---------------------------------------------------------------------------
funct! s:check_bundle_name(bundle) funct! s:check_bundle_name(bundle)
if has_key(g:bundle_names, a:bundle.name)
if has_key(s:bundle_names, a:bundle.name)
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec . echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
\ '. Plugin ' . g:bundle_names[a:bundle.name] .
\ '. Plugin ' . s:bundle_names[a:bundle.name] .
\ ' previously used the name "' . a:bundle.name . '"' . \ ' previously used the name "' . a:bundle.name . '"' .
\ '. Skipping Plugin ' . a:bundle.name_spec . '.' \ '. Skipping Plugin ' . a:bundle.name_spec . '.'
return 0 return 0
endif endif
let g:bundle_names[a:bundle.name] = a:bundle.name_spec
let s:bundle_names[a:bundle.name] = a:bundle.name_spec
return 1 return 1
endf endf


+ 3
- 3
autoload/vundle/installer.vim View File

@ -55,11 +55,11 @@ func! s:process(bang, cmd)
exec ':norm '.a:cmd exec ':norm '.a:cmd
if 'error' == g:vundle_last_status
if 'error' == s:last_status
let msg = 'With errors; press l to view log' let msg = 'With errors; press l to view log'
endif endif
if 'updated' == g:vundle_last_status && empty(msg)
if 'updated' == s:last_status && empty(msg)
let msg = 'Plugins updated; press u to view changelog' let msg = 'Plugins updated; press u to view changelog'
endif endif
@ -118,7 +118,7 @@ func! vundle#installer#run(func_name, name, ...) abort
throw 'whoops, unknown status:'.status throw 'whoops, unknown status:'.status
endif endif
let g:vundle_last_status = status
let s:last_status = status
return status return status
endf endf


+ 7
- 7
autoload/vundle/scripts.vim View File

@ -54,12 +54,12 @@ endf
" View the logfile after an update or installation. " View the logfile after an update or installation.
" --------------------------------------------------------------------------- " ---------------------------------------------------------------------------
func! s:view_log() func! s:view_log()
if !exists('g:vundle_log_file')
let g:vundle_log_file = tempname()
if !exists('s:log_file')
let s:log_file = tempname()
endif endif
call writefile(g:vundle_log, g:vundle_log_file)
execute 'silent pedit ' . g:vundle_log_file
call writefile(g:vundle_log, s:log_file)
execute 'silent pedit ' . s:log_file
wincmd P | wincmd H wincmd P | wincmd H
endf endf
@ -139,15 +139,15 @@ endf
" strings) " strings)
" --------------------------------------------------------------------------- " ---------------------------------------------------------------------------
func! vundle#scripts#view(title, headers, results) func! vundle#scripts#view(title, headers, results)
if exists('g:vundle_view') && bufloaded(g:vundle_view)
exec g:vundle_view.'bd!'
if exists('s:view') && bufloaded(s:view)
exec s:view.'bd!'
endif endif
exec 'silent pedit [Vundle] '.a:title exec 'silent pedit [Vundle] '.a:title
wincmd P | wincmd H wincmd P | wincmd H
let g:vundle_view = bufnr('%')
let s:view = bufnr('%')
" "
" make buffer modifiable " make buffer modifiable
" to append without errors " to append without errors


Loading…
Cancel
Save