vim-endoscope


Ⅰ. 插件描述

A single keystroke to end your scope. Like autoclose plugins, but less automatic.

Ⅱ. 基本信息

创建日期:  2014-11-22
使用用户:  1
Github星:  11
插件作者:  David Briscoe

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

## vim-endoscope

Build Status

A single keystroke to end your scope. Like autoclose plugins, but less
automatic.

I don't like autoclose plugins because they add characters between where my
cursor is and where I want it to be. Instead, endoscope provides a single
keystroke to close the nearest scope. It's not brilliant, but it works
reasonably well.

Usage

endoscope adds <C-S> as an insert-mode map to close the current scope (parens
or quotes). Mnemonic: s for scope.

To set your own map, you can add this to your vimrc:

imap <C-S> <Plug>(endoscope-close-pair)

vim-surround also maps i_CTRL-s to insert paired characters. This is not as
useful when you can just close the previous one instead: It's the same number
of keystrokes but with endoscope you can keep typing, whereas with surround you
need to navigate past the close scope character.

Beware that CTRL-S won't work on terminals with flow control (if you
accidentally freeze your terminal, use CTRL-Q to unfreeze it). See [How to
unfreeze after accidentally pressing Ctrl-S in a terminal?][3] for how to avoid
this and What is the point of CTRL-s? for why it happens.

Limitations

Quote matching only works within a syntax-defined string region. So if you
don't have syntax enabled, it may not work. If you're in an irregular string,
it may not work.

Example: #includes in cpp aren't normal string regions, they're cIncluded

  1. However, this particular case is handled (endoscope treats all
  2. as strings).

Future Work

Ideally, I'd like endoscope to also add all end statements covered by tpope/endwise.

Thanks

License

MIT

添加新评论