I have <Up>
and <Down>
nnoremapped to gk
and gj
but this won't let me use them while in edit mode. I tried using inoremap but that just types out gk
or gj
.
So I could certainly do something like inoremap <Up> <ESC>gki
. Is this the best and only reasonable way to do it? I don't like this method because it isn't apparent to somebody reading the settings file what it does. Not that I could say that about any bit of vim setting file I have ever seen.
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). NOTE: If your terminal doesn't have an ESC key, or the ESC key doesn't work, use Ctrl-[ instead.
Note: For scrolling in vim editor, you can utilize the arrow keys too, but hjkl keys usage will make you scroll faster in the vim editor.
in my . vimrc for years. Press Enter to insert a blank line below current, Shift + Enter to insert it above. So simple!
Type i to switch into insert mode so that you can start editing the file. Enter or modify the text with your file. Once you're done, press the escape key Esc to get out of insert mode and back to command mode.
To execute a normal mode command in insert mode, use Control+o. Straight from the help:
CTRL-O execute one command, return to Insert mode *i_CTRL-O*
So something like this:
inoremap <Up> <C-O>gk
inoremap <Down> <C-O>gj
Might be more readable.
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