I want to do something similar to this question VI (VIM): delete/change right to left? i.e. delete from the end of a line to the last instance of = in that line, which can be done using dT=
with the cursor placed at the end of the line.
However this and other such commands do not delete the final character of the line, so I have to add an x
to that command. I don't mind doing this, yet it seems surprising that vim wouldn't have a command to delete from the current character. Is there one that I just haven't been able to find?
To delete one character, position the cursor over the character to be deleted and type x . The x command also deletes the space the character occupied—when a letter is removed from the middle of a word, the remaining letters will close up, leaving no gap. You can also delete blank spaces in a line with the x command.
Press the Esc key to go to normal mode. Type %d and hit Enter to delete all the lines.
In short press the Esc key and then press Shift + G to move cursor to end of file in vi or vim text editor under Linux and Unix-like systems. However, you can use the following keyboard shortcuts too.
if your cursor is at the end of the line, you could try
F=D
oh, didn't notice that OP wants to keep the '='. then:
T=D
Alternatively, you can:
set virtualedit=onemore
This will let you move the cursor one characer beyond the end of the line. From that position, dT=
will work as you expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With