AlignFromCursor


Ⅰ. 插件描述

Perform :left / :right only for the text on and right of the cursor.

Ⅱ. 基本信息

创建日期:  2012-08-01
使用用户:  2
Github星:  0
插件作者:  Ingo Karkat

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

DESCRIPTION
This plugin offers commands and mappings that align only the text to the right
of the cursor, and keep the text to the left unmodified, unlike the built-in
:left and :right, which always work on the entire line.
This is useful e.g. for right-aligning the "-- Author" attribution in a
fortune, the help tags definitions in this help file, or to left-align a
comment to a particular column.
The alignment width defaults to 'textwidth', can be passed as a [count] to the
mappings, and there are mappings that take the actual width from adjacent
previous / next lines.

RELATED WORKS

  • The Align plugin (vimscript #294) offers a general-purpose :Align command
      and many mappings for text alignment along various characters, but those are

  more specialized for certain syntax fragments and do not consider the
  current cursor position like this plugin.

  • The Tabular plugin (https://github.com/godlygeek/tabular) is similar to the
      Align plugin.
  • The vim-easy-align plugin (vimscript #4520) is also similar to Align, and
      asserts it's easy to use.
  • right_align (vimscript #3728) has a :RightAlign command that aligns to
      'textwidth' in full increments of 'shiftwidth'.

USAGE
[width]<Leader>le
:[range]LeftAlignFromCursor [width]
                        Left-align the text on and right of the cursor to
                        [width] columns (default 'textwidth' or 80 when
                        'textwidth' is 0). Cp. :left.
                        Applies to all lines in [range], based on the current
                        cursor position.
                        In visual mode: Applies to the selected text, based on
                        the leftmost selected column.

[count]<Leader>lp       Left-align the text on and right of the cursor to the
[count]<Leader>ln       indent of the [count]'th previous / next unfolded line.
                        In visual mode: Left-align the selected text to the
                        indent of the [count]'th unfolded line above / below
                        the visual selection.

[width]<Leader>ri
:[range]RightAlignFromCursor [width]
                        Right-align the text on and right of the cursor to
                        [width] columns (default 'textwidth' or 80 when
                        'textwidth' is 0). Cp. :right.
                        Applies to all lines in [range], based on the current
                        cursor position.
                        In visual mode: Applies to the selected text, based on
                        the leftmost selected column.

[count]<Leader>rp       Right-align the text on and right of the cursor to the
[count]<Leader>rn       width of the [count]'th previous / next unfolded line.
                        In visual mode: Right-align the selected text to the
                        width of the [count]'th unfolded line above / below
                        the visual selection.

添加新评论