Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent "modifiable is off" in vim

Tags:

vim

How can I prevent VIM to set modifiable to off?

I have many files opened in VIM and when I want to navigate to a directory I use :E. Sometimes (I cannot reproduce when) VIM sets modifiable to off. When I go back to my file, I cannot make changes until I run :set modifiable.

I want modifiable to be on always. How can I do this?

Seems that this question doesn't solve my problem...

like image 426
Ionică Bizău Avatar asked Sep 13 '13 08:09

Ionică Bizău


1 Answers

The problem lies in the sometimes (I cannot reproduce when). Vim doesn't set this on its own, it's probably a plugin or other part of your configuration that runs amiss. Next time this happens, find out where this got set via

:verbose setlocal modifiable?

Once the root cause is known, you can do something about it.

If everything fails, and you also cannot / do not want to (temporarily, for testing) shut down plugins and configuration, the "big hammer" method would be an autocmd like this, which attempts to always turn off the option:

:autocmd BufWinEnter * setlocal modifiable
like image 127
Ingo Karkat Avatar answered Nov 15 '22 10:11

Ingo Karkat