Skip to content
Iury O. G. Figueiredo edited this page May 13, 2020 · 12 revisions

The following keycommands are responsible for performing basic editting on text.

Blank line insertion

These are used as shorthand for switching to INSERT MODE.

Insert a blank line up

This command works in NORMAL mode, it inserts a blank line above the cursor position then puts vy in INSERT mode.

Put the cursor over a non blank line then press:

<Key-n>

Insert a blank line down

As the keycommand to insert a blank line up, this one works in NORMAL mode. Put the cursor over a line then press:

<Key-m>

It will insert a blank line below the cursor line then put vy in INSERT mode.

Operating on selections

In vy, for simplicity and speed, there is no visual mode for selecting text, it is all done on NORMAL mode mostly. In this way, the keycommands to perform operations on selected text are implemented in NORMAL mode mostly.

Copy selected text

The keycommand to copy text to the clipboard is:

<Key-y>

in NORMAL mode. In order to have text copied to the clipboard it is needed to select some text. You can do it in so many different ways with vy.

Open a file then switch to NORMAL mode. Place the cursor over a line then press the key below to select the entire line:

<Key-f>

Then press:

<Key-y>

The line will be copied to the clipboard.

Delete selected text

There is a keycommand that deletes all selected text. Switch to NORMAL mode, place the cursor over a line then press the keycommand below to select the line:

<Key-f>

Move the cursor around then select some other lines. Now, press:

<Key-d>

You will notice all the selected text was deleted.

Delete a char

I don't use this command very much but its useful sometimes. Switch to NORMAL mode, then place the cursor over a character.

Now, try to press a few times the keycommand:

<Control-i>

Delete a line

I use this one a lot. Switch to NORMAL mode then place the cursor at a given line, then press:

<Key-D>

It will delete the line.

Paste text one line up

In order to better understand how to paste text one line up, place the cursor at a given line then select it by pressing the keycommand below in NORMAL mode:

<Key-f>

Then copy the line with.

<Key-y>

Place the cursor one line down from where to paste the text then press:

<Key-e>

That will paste the copied text at the beginning of the line above the cursor.

Paste text one line down

Switch to NORMAL mode, place the cursor in the middle of a line then press:

<Control-P>

The above keycommand will select a range of the line from the cursor position to the end of the line.

Then copy the selected text by pressing:

<Key-y>

Now that there is text in the clipboard, press:

<Key-r>

It will paste the selected range of the line at the beginning of the next line.

Paste text in the cursor position

Switch to NORMAL mode, place the cursor in the middle of a line then press the below command to copy a range of text from the cursor position to the end of line:

<Control-o>

Press the keycommand below to copy the selected text to the clipboard:

<Key-y>

Then move the cursor to a given position then press:

<Key-t>

It will paste the copied text in the cursor position.

Fixing mistakes

Sometimes it may happen of some operation being performed over text that shouldn't be done at all. The following keycommands are used to fix mistakes of this type.

Undo

After some keycommand is performed you can undo the text changes by pressing in NORMAL mode the keycommand below:

<Key-bracketleft>

Redo

Consider the situation that you have performed some keycommands then decided to undo the text operations but you notice you just were mistaken when undoing the text operations. What would you do? Well, i would press in NORMAL mode the following keycommand below:

<Key-bracketright>

Search forward for ( ) { } [ ] : .

I use this keycommand to spare time when looking for typos in programming files or jumping quickly through blocks of code in java/c.

Switch to NORMAL mode then press:

<Key-P>

It will put the cursor on the next occurrence of one of the:

() {} [] : .

Search backward for ( ) { } [ ] : .

This keycommand is used more than its friend, i use it whenever i'm finishing to write some statement then i notice i made a typo in the middle of the line.

Switch to NORMAL mode then press:

<Key-O>

That would put the cursor on the previous occurrence of the symbols.

Select text between pairs () {} []

I used this keycommand a lot when i was playing with scheme. It selects the text between matching pairs of the symbols below:

() {} []

Place the cursor on one of the symbols above, considering it is a matching pair, then press:

<Key-comma>

Note: Use the following keystroke to select the border chars as well.

<Control-comma>

Highlight pairs of () [] {}

Vy will highlight pairs of () [] {} whenever the cursor is placed on one of these chars.

Comment a block of code

There is a keycommand in EXTRA mode to comment a block of code based on the extension of the file being edited. It will add inline comments to the selected region of text when the keycommand below is pressed in EXTRA mode:

<Key-e>

I use this keycommand with the keycommand to select lines in NORMAL mode.

Uncomment a block of code

Once a block of code is commented you can uncomment it by selectiong the lines then pressing the keycommand below in EXTRA mode:

<Key-r>
Clone this wiki locally