-
Notifications
You must be signed in to change notification settings - Fork 1
Vim is the must know text editor for Linux and usable for any other operating system because it is open source software.
While everyone is entitled to their opinion on which text editor you should use (be it emacs, nano, gedit, etc.), Vim is how we roll with Rigel.
Here's what you need to know about a few vim commands:
-
mXmeans set a mark with a markX. X can be any letter a through z. -
dis the start of a "delete" command, but in Vim, it really means CUT rather than delete. -
yis the start of a "yank" command, or COPY. -
pandPare the "put" commands, or PASTE.
The useage of d and y commands are complex, but for simplcity, well just explain cutting or copying from a mark to the current line. Assuming you've set a mark, you can scroll to the other line that you want to set as the place to cut or copy from. It can be above or below the line you marked, it really doesn't matter. If will matter if you use number in your cut/copy command, so we won't mess with that.
A good way to keep thing straight is to use the buffer d for when you delete (cut) a set of lines, and y for when you yank (copy) a set of lines. Thus.
-
d'dmeans "delete the lines from here (the current line) to where markdis marked" -
y'ymeans "yank the lines from here to where markyis marked."
This here is the process for deleting (cutting) a set of lines and pasting them elsewhere.
-
md(mark the current line with the markd.) - Scroll up or down to the other line you wish to use as a boundary.
-
d'ddelete the lines fromdto here. The lines between wheredwas marked and the line that the cursor was currently one should be removed.
Now let's see how yanking (copying) works. This here is the process for deleting (cutting) a set of lines and pasting them elsewhere.
-
my(mark the current line with the marky.) - Scroll up or down to the other line you wish to use as a boundary.
-
y'ydelete the lines fromyto here. The lines between whereywas marked and the line that the cursor is is still there.
Note that these two methods DO NOT store our lines to a named buffer. Marks and buffers are not the same.
Finally the putting (pasting) part.
- Use
pto put the cut or copied lines on the next line. - Use
Pto put the cut or copied on the current line.
For more information see