Skip to content
Browse files

Readme, and code

  • Loading branch information...
0 parents commit 66dd33b20def6b8bb4e6aeade70c8a10050ea832 @chreekat committed
Showing with 34 additions and 0 deletions.
  1. +34 −0 README.md
34 README.md
@@ -0,0 +1,34 @@
+Ripped straight from an email I wrote to some friends, it's
+
+= Target Parentheses
+
+Showing crosshairs on the cursor when it's on top of parentheses (or othere
+elements of 'matchpairs'.
+
+To hell with code files, here's the code:
+
+```vim
+ func! TargetMatchpairs()
+ if !exists('b:targetAcquired')
+ let b:targetAcquired = 0
+ endif
+ if !exists('b:matchPairs')
+ " '[:],{,},(,)' --> '[]{}()'
+ let b:matchPairs = substitute(&matchpairs, "[,:]", "", "g")
+ endif
+ let curChar = getline('.')[col('.') - 1]
+ let targetInReticule = stridx(b:matchPairs, curChar) >= 0
+ if targetInReticule && !b:targetAcquired
+ set cuc cul
+ let b:targetAcquired = 1
+ elseif !targetInReticule && b:targetAcquired
+ set nocuc nocul
+ let b:targetAcquired = 0
+ endif
+ endfu
+
+ augroup TargetMatchpairs
+ au!
+ au CursorMoved,CursorMovedI * call TargetMatchpairs()
+ augroup END
+```

0 comments on commit 66dd33b

Please sign in to comment.
Something went wrong with that request. Please try again.