在vim中对齐等号上的文本 [英] Align text on an equals sign in vim

查看:30
本文介绍了在vim中对齐等号上的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我倾向于在等号上对齐代码以提高可读性.从这里:

I tend to align code on equal signs for better readability. From this:

$ = jQuery.sub()
Survey = App.Survey
Sidebar = App.Sidebar
Main = App.Main

为此:

$       = jQuery.sub()
Survey  = App.Survey
Sidebar = App.Sidebar
Main    = App.Main

在vim中有没有一种简单的方法可以做到这一点?

Is there an easy way to do this in vim?

推荐答案

目前我发现最好的插件是 Tabular.vim.

The best plugin I found so far is Tabular.vim.

最简单的安装方法是使用 Pathogen 插件,然后将 Tabular git 存储库克隆到 ~/.vim/bundle/tabular.病原体自述文件中的完整说明.

Easiest way to install it is by using the Pathogen plugin, and then cloning the Tabular git repository to ~/.vim/bundle/tabular. Full instructions in the Pathogen README.

安装后,使用它只需将光标放在要对齐和运行的段落中的某个位置:

After it's installed, using it is just a matter of putting your cursor somewhere in the paragraph you want to align and running:

:Tab /=

这篇关于在vim中对齐等号上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆