Skip to content

Commit

Permalink
Fix #16
Browse files Browse the repository at this point in the history
Updates to g:wildfire_objects take effect without the need to restart
Vim.
  • Loading branch information
Giacomo Comitti committed Jun 11, 2014
1 parent 0e54301 commit 8741918
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
34 changes: 15 additions & 19 deletions autoload/wildfire.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ let s:save_cpo = &cpo
set cpo&vim


" Settings
" =============================================================================

let g:wildfire_objects =
\ get(g:, "wildfire_objects", ["ip", "i)", "i]", "i}", "i'", 'i"', "it"])

" force `g:wildfire_objects` to be a dictionary
let s:wildfire_objects = type(g:wildfire_objects) == type([]) ?
\ {"*": g:wildfire_objects} : g:wildfire_objects

" split filetypes that share the same text objects
for [ftypes, objects] in items(s:wildfire_objects)
for ft in split(ftypes, ",")
let s:wildfire_objects[ft] = objects
endfor
endfor


" Internal variables
" =============================================================================

Expand All @@ -47,11 +29,25 @@ let s:origin = []
" Functions
" =============================================================================

fu! s:load_objects()
" force `g:wildfire_objects` to be a dictionary
let wildfire_objects = type(g:wildfire_objects) == type([]) ?
\ {"*": g:wildfire_objects} : copy(g:wildfire_objects)
" split filetypes that share the same text objects
for [ftypes, objects] in items(wildfire_objects)
for ft in split(ftypes, ",")
let wildfire_objects[ft] = objects
endfor
endfor
return wildfire_objects
endfu

fu! s:Init()
let s:origin = getpos(".")
let s:selections_history = []
let s:counts = {}
for object in get(s:wildfire_objects, &ft, get(s:wildfire_objects, "*", []))
let wildfire_objects = s:load_objects()
for object in get(wildfire_objects, &ft, get(wildfire_objects, "*", []))
let s:counts[object] = 1
endfor
endfu
Expand Down
3 changes: 3 additions & 0 deletions plugin/wildfire.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set cpo&vim
" Settings
" =============================================================================

let g:wildfire_objects =
\ get(g:, "wildfire_objects", split("ip,i),i],i},i',i\",it", ","))

let g:wildfire_fuel_map =
\ get(g:, "wildfire_fuel_map", "<ENTER>")

Expand Down

0 comments on commit 8741918

Please sign in to comment.