vim-lining


Ⅰ. 插件描述

The silver lining of Vim/NeoVim statuslines

Ⅱ. 基本信息

创建日期:  2016-03-02
使用用户:  1
Github星:  1
插件作者:  Adrian Perez

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# vim-lining

Small and cute status line for Vim and
NeoVim.

Screenshot

(The screenshot uses the [elrond
theme](https://github.com/aperezdc/vim-elrond).)

Features

  • Automatically sets the laststatus=2 and showmode options for you. The
    latter can be disabled by setting g:lining#showmode=0.
  • Possible, the smallest nice-looking status line which does not require you
    to install patched fonts.
  • Visual paste mode indicator (not shown in screenshot).
  • If you have Fugitive installed, it
    will be used to show information on Git repositories.
  • Alternate status line for certain kinds of buffer (for now, this covers help
    buffers and the Netrw file browser).

Customization

The built-in items cannot be removed, but it is possible to add new ones. For
example, this will append one element to the right of the left part of the
status line which shows the status of the
Pencil plugin:

call lining#left("%{empty(PencilMode()) ? 'none' : PencilMode()}", 'Item')

or, to prepend to the left of the right part of the status line:

call lining#right("%{empty(PencilMode()) ? 'none' : PencilMode()}", 'Item')

(There are also functions to add items to the alternate status line used e.g.
for help buffers and the Netrw file browser: lining#altleft() and
lining#altright().)

The first argument is either a statusline format specifier (like in the
example above), or a Dict with a format function attribute. The item
above could have been written as:

let s:pencil_item = {}
function s:pencil_item.format(item, active)
    return active ? PencilMode() : ''
endfunction
call lining#left(s:pencil_item, 'Item')

The arguments passed to the .format() function are the Dict item itself,
and a boolean flag indicating whether the status bar being formatted belongs
to an active buffer.

Lining automatically adds spaces around non-empty items. To prevent this
behaviour (and manage the spacing yourself), you need to use this second form
of specifying items, and add a nospace attribute to the Dict:

let s:pencil_item = { 'nospace': 1 }
" ...

The second argument to lining#left() is the item kind, and is optional—if
omitted, 'Item' is used by default. This kind determines the colouring of
the element. See #theming below for more details.

Theming

Theming is done via highlight groups. Note that *by default colors for Lining
are not defined*, which means that your status line will be use the plain
colors defined by your theme for StatusLine and StatusLineNC.

The names of the highlight groups are the same as the names of the item kinds
with the Lining prefix added:

  • StatusLine and StatusLineNC, as used by the default status line.
  • LiningBufName: Name of the file in the buffer.
  • LiningWarn: Warning flag item.
  • LiningError: Error flag item.
  • LiningItem: Any other item in the status line.
  • LiningVcsInfo: Version control information.

For an example on how to theme Lining using these, you can check the [elrond
theme](https://github.com/aperezdc/vim-elrond).

Installation

Using Plug

  1. Add Plug 'aperezdc/vim-lining' to your vimrc.
  2. Run vim +PlugInstall +qall.

Using NeoBundle

  1. Add NeoBundle 'aperezdc/vim-lining' to your vimrc.

Using Vundle

  1. Add Plugin 'aperezdc/vim-lining' to your vimrc.
  2. Run vim +PluginInstall +qall'.

Using Pathogen

Execute the following commands in a terminal:

cd ~/.vim/bundle
git clone https://github.com/aperezdc/vim-lining

添加新评论