如何在vi中从中间开始缩进多行? [英] How to indent multiple lines starting from the middle in vi?

查看:25
本文介绍了如何在vi中从中间开始缩进多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如转换这个

$example = array(
    'First' => 'This,
    'Second' => 'is',
    'Third' => 'an',
    'Fourth'=> 'example',
    'Fifth' => '.',
);

进入这个

$example = array(
    'First'     => 'This',
    'Second'    => 'is',
    'Third'     => 'an',
    'Fourth'    => 'example',
    'Fifth'     => '.',
);

不必缩进每个 =>;'无论如何', 每次.

without having to indent each => 'whatever', each time.

这可以在 vi 中实现吗?

Is this possible to do in vi?

推荐答案

有两个 Vim 插件,对齐表格.使用对齐,选择行并执行

There are two Vim plugins for that, Align and Tabular. With Align, select the lines and execute

:'<,'>Align =>

Tabular 是古老的 Align 的更新替代品,但两者都提供相似的功能.根据您的喜好选择.

Tabular is a more recent alternative to the venerable Align, but both offer similar functionality. Pick according to your preferences.

这篇关于如何在vi中从中间开始缩进多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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