我有一个缩进正确的 HTML 文件。我删除了
标签和 ...
。我的文件现在也在右侧缩进,我想将所有内容移至左侧(大约四个空格)。
我尝试了 gg=G
命令,但没有成功
我在视觉上尝试了它模式,按 V
,选择每一行,按 I
,删除四个空格,然后按 ESC
- 没有成功。
有什么技巧可以将缩进向左移动吗?
谢谢
I had a HTML file with correct indentation. I deleted the <html>
tags and <head>...</head>
. My file is now indented too in the right and I'd like to shift everything to the left (about four spaces).
I tried the gg=G
command without success
I tried it in visual mode by pressing V
, selecting everyline, pressing I
, deleting four spaces and pressing ESC
- without success.
Is there some trick that can shift the indentation to the left?
thank you
发布评论
评论(3)
在命令模式下尝试。
Try
<G
in the command mode.选择行,然后按:
<
有关详细信息:
:help shift-left-right
您还可以使用
CTRL-V
输入块模式选择,然后删除不需要的列。您还可以使用CTRL-V
选择列,然后使用<
或>
仅缩进/取消缩进该列的右侧(这非常方便)。Select the lines, then press:
<
For more info:
:help shift-left-right
You could also use
CTRL-V
to enter block mode select, then delete the columns you don't want. You can also useCTRL-V
to select a column then use<
or>
to indent/unindent only text to the right of that column (that can be very handy).我不确定我是否遵循。它仍然是一个html文件吗?如果没有,则只需为文件名指定一个不同的扩展名(例如“.txt”)并重新打开它。然后,您可以根据需要调整缩进,而不会出现自动 html 缩进的问题。
I'm not sure I follow. Is it still an html file? If not, then just give the filename a different extension (e.g., '.txt') and reopen it. Then you can adjust indents however you want without the automatic html indenting being a problem.