Sometimes you just need to copy some code from one file to another. Vim allows you to do this, in a quick and efficient way.
As you can expect, VIM has the ability to copy and paste text from within the editor. Let's copy this sentence by hitting V to enter visual mode. With the whole sentence selected we can press Y on our keyboard to copy or yank the text. Then further down the file while in normal mode, we can press P to paste or put the copy text into the file. You can also do the same thing with VIM's delete command.
Back at the top of the file, pressing DD to delete the entire line behaves the same as cut would in any other editor. The text is deleted but we can still paste it back. One thing to know about VIM is that copied text does not get added to the system clipboard. If we copy this sentence again and then open up a different editor, when we try to paste we won't get the text from VIM.
You must be a Pro Member to view code
Access all courses and lessons, track your progress, gain confidence and expertise.