vim:删除所有空格,直到下一个非空白字符 [英] vim: delete all blank space until next non-blank character

查看:33
本文介绍了vim:删除所有空格,直到下一个非空白字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有以下代码:

<p>
    Hello
</p>

我想成功

<p>Hello</p>

我想在第 1 行的末尾将光标置于正常模式,所以在 ' > ' 并有一个命令来删除所有空格,直到下一个字符.我能想到的最接近的是运动

I would like to put the cursor in normal mode at the end of line 1, so on the ' > ' and have a command to delete all spaces until the next character. The closest I can think of is the motion

d/Hello

它会删除所有内容直到你好,但问题是它还删除了光标下的字符('>')所以我最终得到

which deletes everything until Hello but the issue is that it deletes also the character under the cursor (the ' > ') so I end up with

<pHello
</p>

你会怎么做?

推荐答案

一种无需多次重复此操作的方法.

One way when you won't need to repeat this action many times.

JxJx

说明:

J           # Join current line with next one but substitute end of line with a space.
x           # Remove the space.
Jx          # Repeat same process for last line.

这篇关于vim:删除所有空格,直到下一个非空白字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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