paren-crosshairs


Ⅰ. 插件描述

[Abandoned -- see below]

Ⅱ. 基本信息

创建日期:  2012-12-23
使用用户:  27
Github星:  47
插件作者:  Bryan Richter

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'chreekat/paren-crosshairs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'chreekat/paren-crosshairs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'chreekat/paren-crosshairs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/chreekat/vim-paren-crosshairs

Ⅳ. 文档说明

Heads up! I don't use this anymore. It ended up being too distracting and occasionally counterproductive. Here's what I use now:

Edit again: I don't even use this anymore. <cue deal-with-it gif>

" Matchparen is confusing in normal mode
"augroup insertMatch
"    au!
"    au BufReadPost * NoMatchParen
"    au InsertEnter * DoMatchParen
"    au InsertLeave * NoMatchParen
"augroup END</strike>

We now take you to your regularly scheduled program.

Ripped straight from an email I wrote to some friends, it's

Parentheses Crosshairs

Showing crosshairs on the cursor when it's on top of parentheses (or other
elements of 'matchpairs').

Install

Use pathogen or vundle, or copy plugin/paren_crosshairs.vim to ~.vim/plugin.

Why?

The matchparen plugin tries to do a good thing; namely, highlight the paren that
matches the one under the cursor. However, my friends and I found that having
two parentheses highlighted always confounds our intuition about *where the
cursor actually is*.

This plugin deals with this problem by setting cursorline and cursorcolumn when
the cursor is on a paren.

Screenshot time!

Before

Demo of two highlighted parens

Where's the cursor?

After

Demo of paren crosshairs

There it is!

Historie

Here's the original text of the email. The current plugin just has a few
niceties added:

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

添加新评论