Command mode is used for cursor movement, editing, retrieving and saving files, etc. If you want to type in text, you need to be in Insert mode. To move from Command mode to Insert mode, press "i" (no quotes). To move from Insert mode to Command mode, press "ESC" (the Escape key).
The append command will put the cursor after the current position, while the insert command will put the cursor before it. Using the append command is like moving the cursor one character to the right, and using the insert command.
If you are OK with leaving INSERT mode only once (at the end), this sequence works:
Ctrl+o 80i-
Esc
80
the repetition, i
to insert,-
the character you want to insert,Another one without EVER leaving INSERT mode:
Ctrl+o :norm 8ia
Return
Escnic Esc Esc.
E.g. Esc4iJEsc Esc will output JJJJ
.
Through single repeat:
Insert mode
-
Esc
80.
Will output: 80 -
---------------------------------------------------------------------------------
More details about single repeat: :help .
<ESC>
<the number of times you want to repeat>
i
<the char you want to repeat>
<ESC>
for example: <ESC>12ia<ESC> will insert 12 a's.
Slightly different version of Eelvex's solution:
function! Repeat()
let times = input("Count: ")
let char = input("Char: ")
exe ":normal a" . repeat(char, times)
endfunction
imap <C-u> <C-o>:call Repeat()<cr>
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