Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
[Abandoned -- see below]
VimL
tree: 66dd33b20d

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md

README.md

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:

    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
Something went wrong with that request. Please try again.