在vim中的等号上对齐文本 [英] Align text on an equals sign in vim
本文介绍了在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 插件,然后将表格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屋!
查看全文