vim-smarttabs


Ⅰ. 插件描述

Vim Smart Tabs

Ⅱ. 基本信息

创建日期:  2015-09-02
使用用户:  3
Github星:  10
插件作者:  Dawid Ciężarkiewicz

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# Vim Smart Tabs

This is a github copy of Smart Tabs : Use tabs for indent, spaces for alignment originally created by Michael Geddes.

It seems author is not actively maintaining it anymore, and trivial bugs are not
being fixed, so for convenience of mine and other people I've gave it a new

  1. I'm not a skilled Vim dev, so feel free to contact me to take it over.

Introduction (adopted from from vim.org)

There are many different arguments about tabs and stuff. My current personal
preference is a choice of tabbing that is independent of anybody's viewing
setting.

For the beginning of the line, this means we can use <tabs> which will expand
whatever the reader wants it to. Trying to line up tabs at the end of the line
is a little trickier, and making a few assumptions, my preference is to use
spaces there.

This script allows you to use your normal tab settings for the beginning of the
line, and have tabs expanded as spaces anywhere else. This effectively
distinguishes indent from alignment.

  • <tab> Uses editor tab settings to insert a tab at the beginning of the
    line (before the first non-space character), and inserts spaces otherwise.
  • <BS> Uses editor tab settings to delete tabs or expanded tabs ala
    smarttab

:RetabIndent[!] [tabstop] - This is similar to the :retab command, with the
exception that it affects all and only whitespace at the start of the line,
changing it to suit your current (or new) tabstop and expandtab setting.
With the bang (!) at the end, the command also strips trailing whitespace.

Installation:

With Patogen:

mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && git clone https://github.com/dpc/vim-smarttabs.git

Manually:

Just copy smarttabs.vim into ~/.vim/plugin.

添加新评论