Permalink
Browse files

Same buffer, multiple windows, only one crosshair.

Inspired by OmnipotentEntity's comment: http://goo.gl/dDp54
  • Loading branch information...
1 parent 44d7c56 commit 45763b073cbf5f67029ec643bc96145c82f5c71b @chreekat committed Dec 24, 2012
Showing with 12 additions and 11 deletions.
  1. +12 −11 plugin/paren_crosshairs.vim
@@ -9,9 +9,10 @@ endif
let g:loaded_paren_crosshairs = 1
func! s:targetMatchpairs()
- if !exists('b:targetAcquired')
- let b:targetAcquired = 0
+ if !exists('w:targetAcquired')
+ let w:targetAcquired = 0
endif
+ " Global to buffer:
if !exists('b:matchPairs')
" '[:],{,},(,)' --> '[]{}()'
let b:matchPairs = substitute(&matchpairs, "[,:]", "", "g")
@@ -20,21 +21,21 @@ func! s:targetMatchpairs()
let curChar = getline('.')[col('.') - 1]
let targetInReticule = len(curChar) > 0 && stridx(b:matchPairs, curChar) >= 0
- if targetInReticule && !b:targetAcquired
- let b:disengage = "set " . (&cuc ? "cuc" : "nocuc")
+ if targetInReticule && !w:targetAcquired
+ let w:disengage = "set " . (&cuc ? "cuc" : "nocuc")
\. ' ' . (&cul ? "cul" : "nocul")
set cuc cul
- let b:targetAcquired = 1
- elseif !targetInReticule && b:targetAcquired
- exec b:disengage
- let b:targetAcquired = 0
+ let w:targetAcquired = 1
+ elseif !targetInReticule && w:targetAcquired
+ exec w:disengage
+ let w:targetAcquired = 0
endif
endfu
func! s:suspendTargeting()
- if b:targetAcquired
- exec b:disengage
- let b:targetAcquired = 0
+ if w:targetAcquired
+ exec w:disengage
+ let w:targetAcquired = 0
endif
endfu

0 comments on commit 45763b0

Please sign in to comment.