![]() ![]() ![]() Then type the highlighted letter(s) that appear at the end of the word in question. Say you want to to delete from the current cursor position to the end of any given word on the screen, the motion keys would be e (akin to the normal e motion). The EasyMotion plugin, provides new motions you can use that could solve your problem in a quick and easy way. You can use the normal procedure of entering d plus a motion (as already explained in the other answers). There are some more options and a few commands (check the homepage), but the defaults should work for most people. If we then switch to insert mode, it will behave as if number was set by always showing absolute line numbers: 4 call plug#begin('~/.vim/plugged')ĩ " Add indentation 'guidelines' (:IndentLinesToggle or ) It shows you relative line numbers, except for the line where the cursor is on, where it shows the absolute line number (7 in this case). In normal mode it looks similar to :set relativenumber: 3 call plug#begin('~/.vim/plugged')Ģ " Add indentation 'guidelines' (:IndentLinesToggle or ) It's enabled by default after installation, you also want to add set number to your vimrc if you haven't got it already, since it behaves in strange ways if you don't have it. Like 'number' and 'relativenumber', both roled into one! It's an enhanced way to precede each line with a line number. The numbers.vim plugin is very useful for this. Then, once I've found it and copied it to a register, I just enter ' a to go back to mark "a", the line I saved beforehand, where I can then paste it. I simply mark the current line in the same way, m a, then wander off to find whatever you're looking for. (a) I also use this to save my place in the file if I have to go looking elsewhere for something like, for example, copy-pasting the definition of a function I want to call. It's also compatible with vi as well as vim, on the off chance that your environment is not blessed with the latter. Then you can paste it somewhere else with the normal paste commands, such as p or P. That will delete/yank all lines from the current to the marked one (inclusive). Then go to the last line and enter d ' a (delete to mark "a") or y ' a (yank to mark "a") (a). That being said, whatever was last yanked is stored in the 0 register, and even if it gets replaced in the unnamed register, it can still be pasted using "0p.Go to the starting line of your block, and type m a (mark "a", though you can of course use different letters, and even multiple letters for different marks provided you can keep it straight in your head what each letter is a mark of). The true delete command in the OP's context is "_D (or "_C if insert mode is desired) This sends the deleted content into the black hole register, designated by "_, where it will bother no one ever again (although you can still undo this action using u). This register tends to be treated like a default copy/paste clipboard, so none of these answers will work as desired if you are deleting the rest of a line to paste something in the same place afterward, as whatever was just deleted will be subsequently pasted in place of whatever was yanked before. This is a very old question, but as VIM is still relevant something should be clarified.Įvery answer and comment here as of October 2018 has referred to what would commonly be known as a "cut" action, thus using any of them will replace whatever is currently in VIM's unnamed register. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |