1

This should be too simple, but I have wanted to know for a long time and haven't seen this question, it's hard to search for.

I often want to delete from somewhere in a line to the beginning of the code on next line. For instance, in C-ish syntax, let's say I want to remove the first boolean in:

if (long_boolean_expression1 &&
    long_boolean_expression2) {
  /* code */
}

and get:

if (long_boolean_expression2) {
  /* code */
}

Here I can do 0wdb. from the second line. (Is there anything shorter or more intuitive? There must be a single command that does 0w but I can't find it.)

When editing HTML though, nothing seems to work. Whenever I need to do something like turning this:

<table>
  <tr>

into this:

<table><tr>

I end up doing it with backspace in insert mode, because all my attempts to do it in normal mode fail, often deleting too much and leaving me with:

<table<tr>  <!-- Fail! -->

How do I do this?

4

2 に答える 2

9

カーソルを の上に置き、lと入力してみてくださいDJ

Dカーソルから行末まで削除すること、J次の行を現在の行に結合することです。

HTML の例でJは、最初の行で 2 行目を結合してみてください。

于 2013-01-22T19:39:54.617 に答える
4

SHIFT+Jは 2 つの行を結合します。

于 2013-01-22T19:36:56.807 に答える