sometimes my file just freezes in my vi |vim, what happened?

Unix

Unix Problem Overview


Sometimes when I edit my file using vi or vim, my file just freezes. Even if I type Ctrl+C or Ctrl+D, it still freezes there. I kill -9 <pid> from another terminal, the pid is killed, but the file still freezes there.

I guess I must have typed some combination of key which I do not know. Does anybody have an idea?

Unix Solutions


Solution 1 - Unix

Ctrl-S is probably the culprit; it stops your screen output in most terminals. As Michael mentioned, you can restore your screen to normal by entering Ctrl-Q.

Theoretically, setting stty -ixon should prevent Ctrl-S from freezing your screen, but it's not working on my local Solaris 10 login.

Solution 2 - Unix

Do you happen to use it inside GNU Screen? (As pra points out, this is apparently true even outside screen) It's pretty common to accidentally hit Ctrl+S (xoff), which disables screen painting until you hit Ctrl+Q (xon)

Solution 3 - Unix

If Ctrl+S isn't your problem (as in pra's answer) this may help you.

If you've tried to install a bunch of custom plugins using Vundle, sometimes things go awry. You can try to remove these packages manually and see if it helps. Find out where the plugins have been written to - in my case they were all inside the .vim/bundle directory because I used git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim to install Vundle. So once inside the .vim directory you can wipe the entire bundle folder to remove all plugins, and start again, by executing rm -rf bundle.

Hope it helps!

Solution 4 - Unix

You can try to change keyboard layout. Vi|vim interacts with English(-like?) input only.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser399517View Question on Stackoverflow
Solution 1 - UnixpraView Answer on Stackoverflow
Solution 2 - UnixMichael MrozekView Answer on Stackoverflow
Solution 3 - UnixbibzzzzView Answer on Stackoverflow
Solution 4 - UnixSplatView Answer on Stackoverflow