Vim cheat sheet
Vim cheat sheet and reference guide. Also includes shortcuts and commands for NERDTree and Vimium. List of essential Vim commands. Learn Vim.
Press Esc
to switch to normal mode if you are in insert or visual mode.
D
command #The quickest way to delete from the current cursor position to the end of the line in Vim is by using the D
command:
D
in normal mode, and everything from the cursor position to the end of the line will be deleted.d$
, which also performs the same action.d$
command #Another way to achieve the same result is using the d$
command:
d
stands for “delete.”$
moves the cursor to the end of the line.d$
deletes everything from the cursor to the end of the line.x
for forward deletion #If you want to delete a single character forward from the cursor position, you can use the x
command:
x
in normal mode to delete the character under the cursor.x
will delete subsequent characters one by one.Mastering the D
or d$
command in Vim can help you navigate and edit text more efficiently. Additionally, using x
allows for quick character deletion. Whether you’re working with code, configuration files, or general text, these simple tricks will streamline your workflow and make you a more effective Vim user.
Sources and recommended, further resources on the topic:
Vim: Delete from current position to end of line by Jonas Jared Jacek is licensed under CC BY-NC-SA 4.0.
This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. If others modify or adapt the material, they must license the modified material under identical terms. To give credit, provide a link back to the original source, the author, and the license e.g. like this:
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/delete-from-current-position-to-end-of-line-in-vim">Vim: Delete from current position to end of line</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-NC-SA 4.0</a>.</p>
For more information see the Ditig legal page.
“Content precedes design. Design in the absence of content is not design, it's decoration.”