Tuesday, July 5, 2011

Re: Spell checker not working for files opened with ":e"

On 05/07/11 19:45, Alexandre Provencio wrote:
>
>
> On Tue, Jul 5, 2011 at 2:07 AM, Tony Mechelynck
> <antoine.mechelynck@gmail.com <mailto:antoine.mechelynck@gmail.com>> wrote:
>
> On 05/07/11 05:38, Alexandre Provencio wrote:
>
>
>
> On Mon, Jul 4, 2011 at 6:35 PM, Gary Johnson
> <garyjohn@spocom.com <mailto:garyjohn@spocom.com>
> <mailto:garyjohn@spocom.com <mailto:garyjohn@spocom.com>>> wrote:
>
> On 2011-07-04, Alexandre Provencio wrote:
> > Hello everyone, the spell checker here is is not working when
> opening files
> > with ":e", but it works if I ":e" again on the same viewport, or
> using the
> > ":tabe" or calling the file as an argument for vim as in "vim
> filename" (same
> > for gvim).
> >
> > I've already tried leaving only "set spell spelllang=en" on
> vimrc, and renaming
> > the plugins folder, and that behavior does not change.
>
> If I'm understanding you, you have renamed ~/.vim and you have
> created a ~/.vimrc containing only that command above,
>
> That is correct.
>
> then when you
> start vim as just
>
> vim
>
> you have spell-checking enabled,
>
> Well I don't know if it is enabled on this point, what i meant
> was that
> if i launch vim with a file as an argument, as in "vim
> filename.txt",
> the spell check visually works for this file
>
> but when you open a file using
>
> :e filename
>
> spell-checking is no longer enabled.
>
> Yes. But if i open a second file with :e again, it does work.
>
>
> OK then. When you first start vim, execute
>
> :verbose set spell?
>
> You should see
>
> spell
> Last set from ~/.vimrc
>
> Then open a file using ":e" and again execute
>
> :verbose set spell?
>
> What do you see?
>
> I've made this test as you said and also for a second file
> opened with
> :e, because as I said above, the spell checking works on this
> one. On
> the three situations the same message is returned:
> spell
> Last set from ~/.vimrc (but this text on my local
> language, pt-br)
>
>
> Regards,
> Gary
>
> Thanks for your attention Gary.
>
>
> OK, well, if 'spell' is set then spell-checking is enabled. There
> might be a problem with the spell dictionary, or with spell being
> enabled or not by the syntax script. Try
>
> :verbose set spelllang? syntax?
>
> (with three l's in 'spelllang') in the case where spell checking
> seems to be enabled, and seems to be disabled.
>
>
> First of all, I wanna make a correction of my last reply, stating that
> the spellchecking does start enabled, then it gets disabled after
> editing a file with :e, and get enabled again when editing subsequent
> files with :e.
>
> I've made the tests and they seem to make things clearer, but not for me
> yet :) Here is the output:
>
> Starting vim with no arguments (seems to be enabled)
> spelllang=en
> Last set from ~/.vimrc
> syntax=
>
> Opening a file with :e (seems to be disabled)
> spelllang=en
> Last set from ~/.vimrc
> syntax=desktop
> Last set from /usr/share/vim/vim73/syntax/syntax.vim
>
> Subsequent files opened with :e (seems to be enabled)
> spelllang=en
> syntax=
>
> See also :help spell-load
>
> Ok, going to check out.
>
>
>
> Best regards,
> Tony.
>
> Thanks Tony.
>
> --
> Well, see, Joyce, there we were, trapped in the elevator. Now, I had
> my tennis racquet and the goldfish; she was holding the Crisco. Surely
> you can imagine how one thing naturally led to another!
>
>

The relevant lines in syntax.vim seem to be the following:

> " Set up the connection between FileType and Syntax autocommands.
> " This makes the syntax automatically set when the file type is detected.
> augroup syntaxset
> au! FileType * exe "set syntax=" . expand("<amatch>")
> augroup END
>
>
> " Execute the syntax autocommands for the each buffer.
> " If the filetype wasn't detected yet, do that now.
> " Always do the syntaxset autocommands, for buffers where the 'filetype'
> " already was set manually (e.g., help buffers).
> doautoall syntaxset FileType
> if !s:did_ft
> doautoall filetypedetect BufRead
> endif

so the reason your problematic file gets "desktop" 'syntax' is probably
that it gets "desktop" 'filetype'. But no matter, let's have a look at
$VIMRUNTIME/syntax/desktop.vim... AFAICT it says nothing about spell
checking, so IIUC (see ":help spell-syntax") checking should happen
everywhere... unless... no, there is no $VIMRUNTIME/ftplugin/desktop.vim

So, I'm at the end of my withs here. Maybe someone else can help you
(and that's why it was a bad idea to reply to me only: I'm adding back
the list as a Cc).


Best regards,
Tony.
--
"Here's something to think about: How come you never see a headline like
`Psychic Wins Lottery'?"
-- Jay Leno

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: