vim-sort-folds


Ⅰ. 插件描述

Sort vim folds based on their first line

Ⅱ. 基本信息

创建日期:  2017-05-09
使用用户:  1
Github星:  7
插件作者:  Oliver Breitwieser

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# SortFolds

Overview


_(Demo w SimpylFold,
colorscheme xoria256)_

Sorting folds is not easily possible in vanilla vim. You could join all lines
in a fold, sort and split them up again; however, it is time consuming and
tedious.

This little plugin solves that issue: It sorts a visually selected region while
keeping closed folds intact. Since folds can be created in a variety of ways,
it is therefore straight-forward to sort arbitrary groups of text based on
their first line.

One use-case (demonstrated above and the original motivation for this plugin)
is to sort functions alphabetically after the fact.

Furthermore, it is possible to sort based on a other lines than then first.

Installation

SortFolds is compatible with most plugin managers for vim.
Just drop the following line in your .vimrc:

Plugin 'obreitwi/vim-sort-folds'
(for Vundle)

Plug 'obreitwi/vim-sort-folds'
(for vim-plug)

Mappings

Per default, sorting visually selected folds is mapped to <leader>sf, if
available, but can be easily remapped.

Note: manual foldmethod

This plugin was not tested and is not expected to work with foldmethod set to
manual for now.

Python 3

vim-sort-folds is now Python 3 compatible. The last Python 2 compatible
commit is still available as tag
last-py2.

添加新评论