Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You seem to misuse vim, but that's likely due to not being very familiar with it.</p> <p>The right way <em>is</em> to press <kbd>Esc</kbd>, go where you want to do a small correction, fix it, go back and keep editing. It is effective because Vim has much more movements than usual character forward/backward/up/down. After you learn more of them, this will happen to be more productive.</p> <p>Here's a couple of use-cases:</p> <ul> <li>you accidentally typed "accifentally". No problem, the sequence <kbd>Esc</kbd><kbd>F</kbd><kbd>f</kbd><kbd>r</kbd><kbd>d</kbd><kbd>A</kbd> will correct the mistake and bring you back where you've been editing it. <kbd>F</kbd><kbd>f</kbd> movement will bring you back to the first encountered "f" character. Compare with <kbd>Ctrl</kbd>+<kbd>&lt;-</kbd><kbd>-></kbd><kbd>-></kbd><kbd>-></kbd><kbd>-></kbd><kbd>del</kbd><kbd>d</kbd><kbd>End</kbd>, that does virtually the same in a casual editor, but takes more keystrokes, makes you move your hand out of alphanumeric space of the keyboard.</li> <li>you accidentally typed "you accidentally typed", but want to correct it to "you intentionally typed". Then <kbd>Esc</kbd><kbd>2</kbd><kbd>b</kbd><kbd>c</kbd><kbd>w</kbd> will erase the word you want to fix and bring you to insert mode, so you can immediately retype it. To get back to editing, just press <kbd>A</kbd> instead of <kbd>End</kbd>, to reach which you should move your hand</li> <li>you accidentally typed "mouse" instead of "mice". No problem - the good old <kbd>Ctrl</kbd>+<kbd>W</kbd> will delete the previous word without going out from insert mode. And it happens to be much faster to erase small word than to fix errors in it. I'm so used to it that I had closed the browser page when I was typing this message...</li> <li>repetition count is largely underused. Before making a movement, you can type a number; and the movement will be repeated this number of times. For example, <kbd>1</kbd><kbd>5</kbd><kbd>h</kbd> will bring you 15 characters back and <kbd>4</kbd><kbd>j</kbd> will scroll you 4 lines down. Start using them and you'll get used soon and find out that pressing 10 times <kbd>&lt;-</kbd> key is less fast than iterative approach to moving cursor, when you type <kbd>1</kbd><kbd>2</kbd><kbd>h</kbd>, notice that you made a mistake and immediately correct yourself with <kbd>l</kbd><kbd>l</kbd>.</li> </ul> <p>But, if you <em>still</em> want to do small text traversals without leaving insert mode, follow <a href="https://stackoverflow.com/users/155299/rson">rson</a>'s <a href="https://stackoverflow.com/questions/1737163/vim-traversing-text-in-insert-mode#comment1620134_1737259">advice</a> and use <kbd>Ctrl</kbd>+<kbd>O</kbd>. As an example, <kbd>Ctrl</kbd>+<kbd>O</kbd><kbd>F</kbd>+<kbd>f</kbd> will move you to previous <code>f</code> character and leave you in insert mode.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload