I'm trying to get into the often recommended habit of not using the arrow keys but only the hjkl ones. Now I often find myself in the following situation. I have just typed
someFunction()
and the cursor is in insert mode in between the (
and )
. Next I only need to type ;
someFunction();
and press esc to finish. Pressing on the right arrow key is probably easiest but is starting to feel awkward and too much time needed to complete the action. Plus some people disable their arrow keys to get into the habit of not using them. Is there something faster than hitting esc and shift-A or is the right arrow key fastest in this case?
Once in insert mode, you can type in your text. Press ENTER at the end of each line. Use Backspace to delete to the left of the cursor. If you need to move the cursor to another line, or make a change, or pretty much anything else, you need to press ESC to get back to Command mode first.
To go into INSERT mode from COMMAND mode, you type i . To go back to COMMAND mode, you type the esc key. vim starts out in COMMAND mode. Over time, you will likely spend more time in COMMAND mode than INSERT mode.
Press w (“word”) to move the cursor to the right one word at a time. Press b (“back”) to move the cursor to the left one word at a time. Press W or B to move the cursor past the adjacent punctuation to the next or previous blank space.
I would argue that Control-ol (thats a lowercase L) is faster than escshift-A and the right arrow key. Control-o lets you execute one normal mode keystroke from insert mode.
Why would your cursor be in between the (
and )
? Shouldn't it be after the )
if you typed it?
If it was automatically closed via the vim plugin delimitMate, what you should be doing is typing the )
even though the plugin auto-completed for you. The plugin will notice that you're closing the parenthesis pair and just move your cursor after the auto-closed )
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With