4 ms·
^ Hey so for the novice to moderately experienced users, this actually works and is composed of three commands: dip => Operation - delete (cut) inner parag
by davidkuhta 9y ago
^ Hey so for the novice to moderately experienced users, this actually works and is composed of three commands:
dip => Operation - delete (cut) inner paragraph
} => Movement - go to end of paragraph (the end of the paragraph following the one you deleted)
p => Operation - paste (the paragraph cut using delete)
Edit: Removed 'not sure why dip copies'; Thanks for the TIL PaulBGD_ !
Some other cool diX (delete inner X) commands here: http://vimdoc.sourceforge.net/htmldoc/motion.html#diw http://vimdoc.sourceforge.net/htmldoc/motion.html#diw
- PaulBGD_ 9y agodip copies because d isn't delete, it's cut.
- davidkuhta 9y agoThat makes sense, thanks.
- fasquoika 9y agoWell, the mnemonic is delete, it just also puts the deleted text into your clipboard
- ThatGeoGuy 9y agoSince we're talking about pedantry and how it relates to users learning and using vim, let's talk about clipboards. Your clipboard is the '+' register. Cutting or yanking text does not put it into the '+' register, but rather a specified default local register (is it normally 0? Somebody feel free to correct me here). As a consequence, if you delete or yank some text, it doesn't go to the clipboard. If you really want it to go to your clipboard, specify '+' as the default register or call di"+p in place of dip. This naturally confuses beginners because the concept of registers is completely foreign to other editors. Emacs can provide similar functionality, but by that point Vim is no longer in "weird" mode compared to what you know. We do a lot of simplification when talking about Vim, but small points like this can be immensely confusing for people who just want something to behave the way they're used to.
- deleted 9y ago[deleted]
- hdhzy 9y agoThe default register is unnamed: > The unnamed register is the default and holds the most recently deleted or yanked text; it’s what’s called upon when you just type p without specifying a register. Source: https://pbrisbin.com/posts/vim_registers/ https://pbrisbin.com/posts/vim_registers/ Besides + there is also * for accessing alternate clipboard: http://vim.wikia.com/wiki/Accessing_the_system_clipboard http://vim.wikia.com/wiki/Accessing_the_system_clipboard