3

So the problem is that I've installed (g)Vim and the arrow keys are moving around rather than going through command history.

It's a little complicated by the fact that there was an old version of vim installed by a different user (I've just inherited someone else's dev machine at a new job). I'm running on windows and have just deleted the vimrc under program files.

What setting has changed this behaviour and how do I change it back to normal mode?

1 Answer 1

6

Without a .vimrc vim will run in cp-mode (compatibility-mode). Just create a .vimrc in your home-dir and the problem should be fixed. The .vimrc can be empty, though it is advisable to put set nocp in there.

The full story can be found in :help 'cp

5
  • I disagree that it's advisable to put set nocompatible in your otherwise empty .vimrc. What's your reasoning for suggesting it?
    – Rich
    Sep 26, 2017 at 9:10
  • I suggested it to avoid surprises. Simple example : vim -u ~/.vimrc will not automatically set nocp.
    – Naumann
    Sep 26, 2017 at 11:58
  • How many times have you loaded your vimrc via that command line option? How many people do you think would load their vimrc in that way and also be unaware that doing so would not cause compatible to be automatically unset? Are you aware of the additional surprises that adding that line in can cause if the vimrc is sourced from an existing session? If so, don't you think those surprises are worth mentioning/guarding against?
    – Rich
    Sep 26, 2017 at 12:02
  • Probably true. But sourcing the vimrc from an existing session is full of surprises anyway. My real answer should hence have been read :help cp
    – Naumann
    Sep 26, 2017 at 19:18
  • actually, current Vims read defaults.vim which sets 'nocompatible' when no vimrc was read. Sep 27, 2017 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.