Permalink
Browse files

better initialization of YankRing variables

  • Loading branch information...
1 parent de86bdc commit 14d050ebecf2247726560cd0622aa7e7bdf213e5 @chrisbra committed Aug 15, 2012
Showing with 18 additions and 10 deletions.
  1. +18 −10 autoload/ftimproved.vim
View
@@ -264,25 +264,33 @@ fun! ftimproved#Activate(enable) "{{{1
" and reload the Yankring plugin
" github issue #1
let g:yr_mapped = [0, 0]
- if g:yankring_zap_keys =~# "[ft]"
- let g:yankring_zap_keys = substitute(g:yankring_zap_keys,
- \ '\c[ft] ', "", "g")
- let g:yr_mapped[0] = 1
- endif
- if g:yankring_o_keys =~ "[,;]"
- let g:yankring_o_keys = substitute(g:yankring_o_keys, '[,;] ',
- \ "", "g")
- let g:yr_mapped[1] = 1
- endif
if exists("g:loaded_yankring") &&
\ g:loaded_yankring > 1
" should make sure, the user didn't set this variable to simply
" deactivate the plugin. If so, he probably only set it to 1...
+ if g:yankring_zap_keys =~# "[ft]"
+ let g:yankring_zap_keys = substitute(g:yankring_zap_keys,
+ \ '\c[ft] ', "", "g")
+ let g:yr_mapped[0] = 1
+ endif
+ if g:yankring_o_keys =~ "[,;]"
+ let g:yankring_o_keys = substitute(g:yankring_o_keys, '[,;] ',
+ \ "", "g")
+ let g:yr_mapped[1] = 1
+ endif
if exists(":YRToggle") == 2
" turn off and on again yankring
YRToggle 0
YRToggle 1
endif
+ else
+ " YankRing wasn't loaded yet, so init those variables
+ let g:yankring_zap_keys = "/ ?"
+ let g:yankring_o_keys = 'b B w W e E d h j k l H M L y G ^ 0 $'
+ let g:yankring_o_keys .= ' g_ g^ gm g$ gk gj gg ge gE - + _ '
+ let g:yankring_o_keys .= ' iw iW aw aW as is ap ip a] a[ i] i['
+ let g:yankring_o_keys .= ' a) a( ab i) i( ib a> a< i> i< at it'
+ let g:yankring_o_keys .= ' a} a{ aB i} i{ iB a" a'' a` i" i'' i`'
endif
" f,F,t,T should be unmaped now, so we can map it.
call <sid>Map('f', 'ftimproved#FTCommand(1,1,X)')

0 comments on commit 14d050e

Please sign in to comment.