tabfold


Ⅰ. 插件描述

to toggle folding in vim, without losing

Ⅱ. 基本信息

创建日期:  2016-12-04
使用用户:  3
Github星:  3
插件作者:  Thales Mello

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# Tabfold

Motivation

Plugin that enables fold toggle using the <Tab> key.

In the terminal, there is no distinction between the <Tab> the the <C-I> keys.

It's desireable to use the <Tab> key to apply folding, but it's also derieable to keep on
using <C-I> to move forward after moving backward.

So, to distinguishes between these two use cases, when <Tab> is pressed:

  1. Tries to navigate forward and;
  2. Toggles folding if it's still in the same location (i.e. did not move).

In most situations, you want to move forward right after you moved backward with <C-O>. In these
use cases, this key is supposed to work as intended.

In most other situtations, you are editing code and at the top of your jump list. It means that, if you
press the <Tab> key, you aren't going to jump anywhere. In those situations, it's possible to remap it
to be used to toggle folding.

When there is conflict

In the rare situations you want to toggle folding, but you just jumped back from a location, you can use the
<S-Tab> key combination to toggle folding.

Inspiration

This plugin was inspired by a Karabiner video by wincent, in which he solves this same problem with Karabiner.
I wanted to achieve a similar result using just Vimscript, so I came up with this plugin.

添加新评论