Skip to content

Commit d9122b1

Browse files
committed
Rename the command params dictionary
This allows me to unlet the dictionary by name for faster sourcing. In the future I'd like to move this variable to autoload.
1 parent 5b39e1b commit d9122b1

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

plugin/EasyGrep.vim

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ endfunction
702702
" ChooseGrepProgram {{{
703703
function! <sid>ChooseGrepProgram(...)
704704

705-
let programNames = sort(keys(s:commandParamsDict))
705+
let programNames = sort(keys(g:EasyGrep_commandParamsDict))
706706

707707
if a:0 > 0
708708
let grepChoiceStr = a:1
@@ -758,13 +758,13 @@ function! s:SetGrepCommand(grepChoice)
758758
else
759759
let g:EasyGrepCommand = 1
760760

761-
if !has_key(s:commandParamsDict, a:grepChoice)
761+
if !has_key(g:EasyGrep_commandParamsDict, a:grepChoice)
762762
return 0
763763
endif
764764

765765
let args = ""
766-
if len(s:commandParamsDict[a:grepChoice]["req_str_programargs"])
767-
let args = '\ '.escape(s:commandParamsDict[a:grepChoice]["req_str_programargs"], ' ')
766+
if len(g:EasyGrep_commandParamsDict[a:grepChoice]["req_str_programargs"])
767+
let args = '\ '.escape(g:EasyGrep_commandParamsDict[a:grepChoice]["req_str_programargs"], ' ')
768768
endif
769769
exe "set grepprg=".a:grepChoice.args
770770
endif
@@ -2253,21 +2253,21 @@ endfunction
22532253
"}}}
22542254
" RegisterGrepProgram {{{
22552255
function! s:RegisterGrepProgram(programName, programSettingsDict)
2256-
if !exists("s:commandParamsDict")
2257-
let s:commandParamsDict = {}
2256+
if !exists("g:EasyGrep_commandParamsDict")
2257+
let g:EasyGrep_commandParamsDict = {}
22582258
endif
22592259

2260-
if has_key(s:commandParamsDict, a:programName)
2260+
if has_key(g:EasyGrep_commandParamsDict, a:programName)
22612261
call EasyGrep#Error("Cannot register '".a:programName."' because it is already registered")
22622262
return
22632263
endif
22642264

2265-
let s:commandParamsDict[a:programName] = a:programSettingsDict
2265+
let g:EasyGrep_commandParamsDict[a:programName] = a:programSettingsDict
22662266
endfunction
22672267
" }}}
22682268
" ConfigureGrepCommandParameters {{{
22692269
function! s:ConfigureGrepCommandParameters()
2270-
if exists("s:commandParamsDict")
2270+
if exists("g:EasyGrep_commandParamsDict")
22712271
return
22722272
endif
22732273

@@ -2364,7 +2364,7 @@ function! s:ConfigureGrepCommandParameters()
23642364
\ 'opt_bool_nofiletargets': '0',
23652365
\ })
23662366

2367-
call s:RegisterGrepProgram("ack-grep", s:commandParamsDict["ack"])
2367+
call s:RegisterGrepProgram("ack-grep", g:EasyGrep_commandParamsDict["ack"])
23682368

23692369
call s:RegisterGrepProgram("ag", {
23702370
\ 'req_str_programargs': '--nogroup --nocolor --column',
@@ -2462,15 +2462,15 @@ endfunction
24622462
" GetGrepCommandParameters {{{
24632463
function! s:GetGrepCommandParameters()
24642464
if s:IsCommandVimgrep()
2465-
return s:commandParamsDict["vimgrep"]
2465+
return g:EasyGrep_commandParamsDict["vimgrep"]
24662466
endif
24672467

24682468
let programName = s:GetGrepProgramName()
2469-
if !has_key(s:commandParamsDict, programName)
2469+
if !has_key(g:EasyGrep_commandParamsDict, programName)
24702470
return {}
24712471
endif
24722472

2473-
return s:commandParamsDict[programName]
2473+
return g:EasyGrep_commandParamsDict[programName]
24742474
endfunction
24752475
" }}}
24762476
" GetGrepCommandLine {{{

0 commit comments

Comments
 (0)