vim-code_block_markers


Ⅰ. 插件描述

Vim mappings to quickly insert start and end keywords/characters for code blocks in the following languages: C, C++, C#, CMakeLists.txt, DOS batch, shell script and Vim script.

Ⅱ. 基本信息

创建日期:  2015-01-10
使用用户:  1
Github星:  1
插件作者:  Shane Harper

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

vim-code_block_markers

Go from

int my_new_function

to:

int my_new_function()
{

}

with a single key-mapping with this plugin; The cursor will be positioned to begin entering the first statement of the function body.

Inserting and moving past code block markers are (trivial) tasks done all the time by software developers: This plugin can reduce the tedium. This Vim editor plugin defines key mappings for C, C++, C#, CMakeLists.txt, DOS batch, shell script and Vim script files.

<Ctrl>k Insert block start and end markers. Cursor is moved to the middle of the new block.
jj An insert mode mapping that continues insertion beyond the end of the current block.
<Ctrl>j If the current line has an unmatched '(' then a ')' is inserted followed by block start and end markers. If there was no '(' then '()' (an empty function argument list) is inserted followed by block start and end markers.

A better alternative?

Programmers commonly use indentation so that code blocks are easy to see. The use of indentation is sufficient to define code blocks and extra block begin/end keywords/characters are then redundant. Python does not use code block markers, just indentation. To write Vim script without end statements see: add_vim_script_end_statements.

Setup

Vundle can be used to install and update this plugin.

添加新评论