blockit


Ⅰ. 插件描述

a vim plugin to wrap lines in a block

Ⅱ. 基本信息

创建日期:  2014-01-15
使用用户:  5
Github星:  28
插件作者:  Kent Yuan

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

blockit readme

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. <><><><><><><><><><><><><><><><><><><><><><><><><><><> ..
.. ^ -------------------------------------------------- ^ ..
.. ^ |       ____   __              __      ____ __   | ^ ..
.. ^ |      / __ ) / /____   _____ / /__   /  _// /_  | ^ ..
.. ^ |     / __  |/ // __ \ / ___// //_/   / / / __/  | ^ ..
.. ^ |    / /_/ // // /_/ // /__ / ,<    _/ / / /_    | ^ ..
.. ^ |   /_____//_/ \____/ \___//_/|_|  /___/ \__/    | ^ ..
.. ^ |                        - wrap text in block    | ^ ..
.. ^ -------------------------------------------------- ^ ..
.. <><><><><><><><><><><><><><><><><><><><><><><><><><><> ..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(http://www.vim.org/scripts/script.php?script_id=4848)

Introduction

When we are coding or editing text in vim, sometimes we want to wrap some lines of text (or in visual selections) in a
block, which built by ASCII chars. blockit is the vim plugin, to make this work easily to be done. One can "draw"
block in different style. Please read next section for detailed features.

Features

  • horizontal/vertical char of the block border could be defined separately
  • margin between text and block border can be customized
  • block width can be dynamic (auto fit text width) or fixed
  • supports 4 in-block text alignment (No align., left-align., right align. center align.)
  • supports line-wise and block-wise visual selection text blocking (via key-mapping)
  • provide command to block line range

Configuration

There are 5 variables could be customized to configure block style: (more detailed information please check the plugin
doc.)

variablevaluesdefault
g:blockit_H_charstring: horizontal border char(s)'-'
g:blockit_V_charstring: vertical border char(s)'|'
g:blockit_marginint: margin between text and border1
*g:blockit_fixed_lengthint: if you want the block has fixed width, value >=50
g:blockit_alignstring: one of 'c','l','r','n''n' (no alignment)

* for the fixed length, please read the plugin docs for details.

Usage

It is easy to use the blockit plugin. There are two commands and one mapping ready to use.

command

  • [range]:Block: This command will block the line range, with the settings in "Configuration" section.
  • :BlockitVersion will print the current version info of installed blockit

Mapping

Mapping is only available in line-wise or block-wise visual selection mode.

Default:

<leader>bi

This mapping will block the visual selected text.

You can customize the mapping in this way:

vmap (Your_Mapping) <Plug>BlockitVisual

Demo

Demo1

  • dynamic block width
  • H-border '@' (g:blockit_H_char='@')
  • V-border '*' (g:blockit_V_char='*')
  • blockit via command
  • text alignment: center (g:blockit_align='c')

demo1

Demo2

Use all default configurations:

  • dynamic block width
  • H-char in border: '-' (default)
  • V-char in border: '|' (default)
  • blockit via visual selection (<leader>bi)
  • text alignment: no alignment (default)

demo2

Demo3

  • fixed block width: 40 (g:blockit_fixed_length=40)
  • H-char in border: '.-' (g:blockit_H_char='.-')
  • V-char in border: '..' (g:blockit_V_char='..')
  • blockit via visual selection (<leader>bi)
  • text alignment: right (g:blockit_align='r')

demo3

添加新评论