Skip to content

Commit 088295d

Browse files
committed
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
1 parent cad5f50 commit 088295d

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

autoload/vundle/config.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func! vundle#config#init()
4343
if !exists('g:bundles') | let g:bundles = [] | endif
4444
call s:rtp_rm_a()
4545
let g:bundles = []
46-
let g:bundle_names = {}
46+
let s:bundle_names = {}
4747
endf
4848

4949

@@ -91,14 +91,14 @@ endf
9191
" return -- 0 if the bundle's name has been seen before, 1 otherwise
9292
" ---------------------------------------------------------------------------
9393
funct! s:check_bundle_name(bundle)
94-
if has_key(g:bundle_names, a:bundle.name)
94+
if has_key(s:bundle_names, a:bundle.name)
9595
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
96-
\ '. Plugin ' . g:bundle_names[a:bundle.name] .
96+
\ '. Plugin ' . s:bundle_names[a:bundle.name] .
9797
\ ' previously used the name "' . a:bundle.name . '"' .
9898
\ '. Skipping Plugin ' . a:bundle.name_spec . '.'
9999
return 0
100100
endif
101-
let g:bundle_names[a:bundle.name] = a:bundle.name_spec
101+
let s:bundle_names[a:bundle.name] = a:bundle.name_spec
102102
return 1
103103
endf
104104

autoload/vundle/installer.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ func! s:process(bang, cmd)
5555

5656
exec ':norm '.a:cmd
5757

58-
if 'error' == g:vundle_last_status
58+
if 'error' == s:last_status
5959
let msg = 'With errors; press l to view log'
6060
endif
6161

62-
if 'updated' == g:vundle_last_status && empty(msg)
62+
if 'updated' == s:last_status && empty(msg)
6363
let msg = 'Plugins updated; press u to view changelog'
6464
endif
6565

@@ -118,7 +118,7 @@ func! vundle#installer#run(func_name, name, ...) abort
118118
throw 'whoops, unknown status:'.status
119119
endif
120120

121-
let g:vundle_last_status = status
121+
let s:last_status = status
122122

123123
return status
124124
endf

autoload/vundle/scripts.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ endf
5454
" View the logfile after an update or installation.
5555
" ---------------------------------------------------------------------------
5656
func! s:view_log()
57-
if !exists('g:vundle_log_file')
58-
let g:vundle_log_file = tempname()
57+
if !exists('s:log_file')
58+
let s:log_file = tempname()
5959
endif
6060

61-
call writefile(g:vundle_log, g:vundle_log_file)
62-
execute 'silent pedit ' . g:vundle_log_file
61+
call writefile(g:vundle_log, s:log_file)
62+
execute 'silent pedit ' . s:log_file
6363

6464
wincmd P | wincmd H
6565
endf
@@ -139,15 +139,15 @@ endf
139139
" strings)
140140
" ---------------------------------------------------------------------------
141141
func! vundle#scripts#view(title, headers, results)
142-
if exists('g:vundle_view') && bufloaded(g:vundle_view)
143-
exec g:vundle_view.'bd!'
142+
if exists('s:view') && bufloaded(s:view)
143+
exec s:view.'bd!'
144144
endif
145145

146146
exec 'silent pedit [Vundle] '.a:title
147147

148148
wincmd P | wincmd H
149149

150-
let g:vundle_view = bufnr('%')
150+
let s:view = bufnr('%')
151151
"
152152
" make buffer modifiable
153153
" to append without errors

0 commit comments

Comments
 (0)