How to Change Vim's Default Mode

How do I switch between command and insert mode in Vim?

Looks like your Vim is launched in easy mode. See :help easy.

This happens when Vim is invoked with the -y argument or as evim, or maybe you have a :set insertmode somewhere in your .vimrc configuration. Find the source and disable it; temporarily this can be also done via Ctrl + O :set noim Enter.

How to switch to REPLACE mode in VIM

From the ViM manual:


5. Replace mode *Replace* *Replace-mode* *mode-replace*
Enter Replace mode with the "R" command in normal mode.

Of course you can map any key to R, for example by doing

:map <F5> R

How do I start vim in insert mode?

You can start vim like this:

vim -c 'startinsert' FILENAME

If you want, you can edit the .bashrc file (if you are using bash) and add this line:

alias vim="vim -c 'startinsert'"

Using normal-mode motions in command-line mode in Vim

By default you can press Control + f (or otherwise see set cedit) when on the Vim command-line, which opens the command-line window where you can edit the command using normal-mode Vim editing keys.
Enter will run the command or Control + c will return you to the standard command-line.

So in your specific example, you could press Control + f on the Vim command-line then db and it would do what you want.

When I have to do more sophisticated editing commands I use the above approach because I'm more familiar with Vim editing keys than I am with the alternatives. I also find the normal-mode vim keys more powerful.

See :help c_ctrl-f for more information.

Vim changes into replace mode on startup

It was some internal problem, what solved the problem was adding this line:

nnoremap <esc>^[ <esc>^[

Here you can find some details about this solution.

In CtrlP, how to set the `mru` mode as the default mode?

I agree with @romainl's answer, however for the sake of answering the question :

From :help CtrlP

                                                            *'g:ctrlp_map'*
Use this option to change the mapping to invoke CtrlP in |Normal| mode: >
let g:ctrlp_map = '<c-p>'
*'g:ctrlp_cmd'*
Set the default opening command to use when pressing the above mapping: >
let g:ctrlp_cmd = 'CtrlP'

Put in your vimrc :

let g:ctrlp_map='<c-p>'
let g:ctrlp_cmd = 'CtrlPMRU'

GVIM : Possible to begin editing the file without having to press i?

You can do this by editing your .vimrc file. It looks like set im! is the command you're looking for to set input mode as the default, but you'll also need to explicitly map escape to change to command mode.

A better question is why you would want to do this, though. Unless you're opening a brand new file, once you know vim, you'll probably spend very little time in insert mode, as you should be using more advanced command-mode commands (append, correct, etc) to edit and update your code at the appropriate places. If you're just going to use vim the same way you use gedit, don't bother - gedit is better than vim at being gedit.

EDIT: After reading the comments on your question, it sounds like you really, really shouldn't be using vim. It's not something you want to stumble into by default, certainly not if what you want is a basic editor with customizable display.



Related Topics



Leave a reply



Submit