Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So, I come back to my computer after the weekend and when I try to edit a file in vim now I can't get into insert mode at all. Used to be just by pressing I or Esc+I. The Insert key doesn't do it either.

I don't know much about vim, I haven't knowingly changed any settings.

Any idea what's gone wrong? I'm running Ubuntu 12.04.

My /etc/vim/vimrc file (minus comments) looks like:

runtime! debian.vim

if has("syntax")
  syntax on
endif

if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif

I don't have a vimrc.local file but there is a vimrc.tiny which contains:

set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

set compatible

Both are identical to the same files on a remote server where vim behaves normally.

share|improve this question
    
What abount I or R? Also try mv ~/.vimrc ~/.vimrc.bak before starting vim. –  speakr Aug 6 '12 at 11:07
    
do you mean shift+i and shift+r? They don't put me in insert mode either. And I don't have any ~/.vimrc file to move. –  Anentropic Aug 6 '12 at 11:19
    
What about /etc/vim/vimrc? –  speakr Aug 6 '12 at 12:53
    
have added details of my vimrc file to the question above –  Anentropic Aug 6 '12 at 14:09
1  
Do you use vi compatibility mode? Try the command :set nocompatible. In contrast to vim, in vi the insert mode notification is not shown on the status line - so if you press i you actually are in insert mode but perhaps you just don't know it. Also, does a ~/.vimrc exist on the remote server where vim behaves normally? –  speakr Aug 6 '12 at 14:26
show 3 more comments

2 Answers

up vote 3 down vote accepted

Do you use vi compatibility mode? Try the command :set nocompatible.

In vi the insert mode notification is not shown on the status line (in contrast to vim) – so if you press i you actually are in insert mode but perhaps you just don't know it.

To save user-defined settings just put them in your ~/.vimrc (create if not existing), e.g. like:

set nocompatible
share|improve this answer
    
thanks, that works! I didn't recognise insert mode when I was still stuck in vi compatibility mode, because it still does 'weird vi stuff' when you try and edit the content of the file (I'm not a vimmer...) –  Anentropic Aug 6 '12 at 16:22
    
You (=Anentropic) may not (yet) be a vimmer (please, do persist: you'll be happy you did), but you sure got a Winner (=speakr) ^^ –  Olivier Dulac Dec 28 '12 at 14:19
add comment
syntax on
set nocompatible

I am compiling vim 7.3 from source and still found it was the vi editor working even after using vim command. So, to have the same effect as I normally do apt-get install vim is .. follow the above post by @speakr

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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