4

I am using spf13 destribution. How can I disable spell function in vimrc? For every file I open?

I tried(in my .vimrc.local):

set nospell
" vim: set nospell: // it is working only for first file I had opened.
nospell

Maybe It helps to someone: there are a fresh discussion at official git, but for it not solved problem at all https://github.com/spf13/spf13-vim/issues/67

alexche8
  • 1,270
  • 3
  • 19
  • 26
  • 2
    Side comment: This is one of the problems with the using a distribution. You can never know where settings are being set. For instance spell defaults to nospell. While @merlin2011 answer will work its really a work around for a setting that is set in the distribution that you never wanted. Generally it is easier to set up your own vim configuration than it is to use someone else's. – FDinoff Jul 04 '14 at 17:20
  • Also is that really the contents of your the file? Because that looks like a syntax error. (Also is the file called `vimrc.local` or `.vimrc.local`. The leading dot makes a difference) and placing `set nospell` in `~/.vimrc.local` should work (Try `echo set nospell >> ~/.vimrc.local` and reload vim) – FDinoff Jul 04 '14 at 17:26
  • Edited question - I use .vimrc.local – alexche8 Jul 04 '14 at 17:35
  • Does the file show up in the output of `:scriptnames`? Also what is the output of `:verbose set spell?` maybe something else is setting it other than spf13 – FDinoff Jul 04 '14 at 17:36
  • Can you answer my other question? – FDinoff Jul 04 '14 at 18:38
  • If I do :verbose set spell, spellcheker turns on,but no output. – alexche8 Jul 07 '14 at 08:48
  • 1
    please re run the command and don't forget the question mark. – FDinoff Jul 07 '14 at 14:13
  • 1
    Oh, yes. Output: Last set from ~/.vimviews/~=+projects=+cms=+api=+views.py= – alexche8 Jul 07 '14 at 14:26
  • 1
    And this is why distributions are annoying. You to disable the views plugin inside spf13. It is restoring your settings even though you changed them in your vimrc. – FDinoff Jul 07 '14 at 14:34

2 Answers2

2

FDinoff gave a great answer which I'll paste here:

alexche8 said the output of this

:verbose set spell?

was

Last set from ~/.vimviews/~=+projects=+cms=+api=+views.py=

This indicates that the vimviews plugin is restoring spf13's settings even though you changed them in your vimrc.

You need to disable the views plugin inside spf13.

idbrii
  • 10,975
  • 5
  • 66
  • 107
  • Another option is to blow away all the files in ~/.vimviews then put set nospell and restart vim. The vimviews were remembering when you hadn't yet set nospell. – Boggin Oct 22 '15 at 10:04
1

This is a more general problem than just nospell. It can corrected by using autocmd to run the same command when new buffers are open. You can view the full list of events on the linked page, but here is what I normally use. I am not 100% sure it covers all new file opens, but it seems to cover all the cases I have tried.

au BufNew,BufRead  * set nospell

Update: The following may cover all cases, based on the documentation.

au BufNewFile,BufReadPost,FilterReadPost,FileReadPost  * set nospell
merlin2011
  • 71,677
  • 44
  • 195
  • 329
  • Yeah, As you have said it is works but not covers all file opening. I tried to open file from NERDTree or from ctrlp but spell checking presents – alexche8 Jul 04 '14 at 17:33
  • I have tried you updated - but the same. Maybe solutions is handling events from plugins? But it is maybe cumbersome. – alexche8 Jul 04 '14 at 17:45
  • @alexche8, If you read over the documentation I linked, and read some of the source code the plugin, then you will probably understand where the root cause of the problem lies. My speculation is that the plugins are running *after* these autocmds and setting the spelling **back**. – merlin2011 Jul 04 '14 at 17:46
  • Disabling spelling for every file you open is a functional hack to solve this problem, but it shouldn't be necessary. As you point out, the plugin is fighting with you, so it's better to configure or disable the plugin. – idbrii Jun 12 '15 at 19:09