Issues with ftdetect

View: New views
7 Messages — Rating Filter:   Alert me  

Issues with ftdetect

by Chris Sutcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hey All,

I have 2 files in vimfiles/ftdetect:

dlg.vim:
au BufRead,BufNewFile *.dlg set filetype=rc

in.vim:
au BufRead,BufNewFile *.in set filetype=make

Both files work well in GVim compiled for Windows.  However, when
running vim in Cygwin they don't seem to be read, since .dlg files and
.in files don't have their filetype set.

In my .vimrc I have:

set rtp^=~/vimfiles
set rtp+=~/vimfiles/after

set so that I can share the same files for both the Windows native
GVim and Cygwin's vim.

Is there something I need to do to enable the reading of the
vimfiles/ftdetect files with Cygwin vim?

Thank you,

Chris

--
Chris Sutcliffe
http://emergedesktop.org

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Issues with ftdetect

by Gary Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2009-11-05, Chris Sutcliffe wrote:

> Hey All,
>
> I have 2 files in vimfiles/ftdetect:
>
> dlg.vim:
> au BufRead,BufNewFile *.dlg set filetype=rc
>
> in.vim:
> au BufRead,BufNewFile *.in set filetype=make
>
> Both files work well in GVim compiled for Windows.  However, when
> running vim in Cygwin they don't seem to be read, since .dlg files and
> .in files don't have their filetype set.
>
> In my .vimrc I have:
>
> set rtp^=~/vimfiles
> set rtp+=~/vimfiles/after
>
> set so that I can share the same files for both the Windows native
> GVim and Cygwin's vim.
>
> Is there something I need to do to enable the reading of the
> vimfiles/ftdetect files with Cygwin vim?

I just put your in.vim in my ~/vimfiles/ftdetect directory and 'ft'
was set to "make" when I executed "vim foo.in" as it should.  I also
verified that 'ft' was not set when opening foo.in before I created
in.vim.  So it works for me.

I don't see anything wrong with your setup for sharing configuration
files between Windows and Cygwin, but instead of modifying 'rtp', I
put all my personal configuration files in ~/vimfiles and created
~/.vim as a Cygwin symbolic link to ~/vimfiles.  I assume that
you've verified that your scheme works for other configuration
files, just not for ftdetect files.  You might try executing

    :scriptnames

to see what files are being sourced.  The ftdetect files should be
sourced even if you don't specify a file name when you start vim.

As another experiment, I changed in.vim to use DOS line endings.
Editing foo.in still set the 'ft' but to "make^M", so that's not the
problem.

The version of Cygwin vim I was using was 7.2.148 that I compiled
myself.

I'm sorry I can't think of what might be causing the problem you're
seeing.

HTH,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Issues with ftdetect

by Chris Sutcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I just put your in.vim in my ~/vimfiles/ftdetect directory and 'ft'
> was set to "make" when I executed "vim foo.in" as it should.  I also
> verified that 'ft' was not set when opening foo.in before I created
> in.vim.  So it works for me.

Hrmm....  thank you for checking.

> I don't see anything wrong with your setup for sharing configuration
> files between Windows and Cygwin, but instead of modifying 'rtp', I
> put all my personal configuration files in ~/vimfiles and created
> ~/.vim as a Cygwin symbolic link to ~/vimfiles.  I assume that
> you've verified that your scheme works for other configuration
> files, just not for ftdetect files.  You might try executing
>
>    :scriptnames

In Cygwin vim I get:

  1: /cygdrive/c/Documents and Settings/csutclif/.vimrc
  2: /usr/share/vim/vim72/syntax/syntax.vim
  3: /usr/share/vim/vim72/syntax/synload.vim
  4: /usr/share/vim/vim72/syntax/syncolor.vim
  5: /usr/share/vim/vim72/filetype.vim
  6: /usr/share/vim/vim72/ftplugin.vim
  7: /usr/share/vim/vim72/indent.vim
  8: /cygdrive/c/Documents and Settings/csutclif/vimfiles/colors/ironhead.vim
  9: /cygdrive/c/Documents and Settings/csutclif/vimfiles/plugin/taglist.vim
 10: /usr/share/vim/vim72/plugin/getscriptPlugin.vim
 11: /usr/share/vim/vim72/plugin/gzip.vim
 12: /usr/share/vim/vim72/plugin/matchparen.vim
 13: /usr/share/vim/vim72/plugin/netrwPlugin.vim
 14: /usr/share/vim/vim72/plugin/rrhelper.vim
 15: /usr/share/vim/vim72/plugin/spellfile.vim
 16: /usr/share/vim/vim72/plugin/tarPlugin.vim
 17: /usr/share/vim/vim72/plugin/tohtml.vim
 18: /usr/share/vim/vim72/plugin/vimballPlugin.vim
 19: /usr/share/vim/vim72/plugin/zipPlugin.vim

So the taglist plugin is getting loaded, but the ftdetect scripts are
suspiciously missing (they do list if I execute :scriptnames in the
native Windows GVim).  I've checked file permissions and they match
the taglist.vim plugin, so I'm at a loss as to how to correct the
behaviour at this point.  Could it be perhaps the spaces in the path?

Chris

--
Chris Sutcliffe
http://emergedesktop.org

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Issues with ftdetect

by Chris Sutcliffe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>> I don't see anything wrong with your setup for sharing configuration
>> files between Windows and Cygwin, but instead of modifying 'rtp', I
>> put all my personal configuration files in ~/vimfiles and created
>> ~/.vim as a Cygwin symbolic link to ~/vimfiles.  I assume that
>> you've verified that your scheme works for other configuration
>> files, just not for ftdetect files.

I've removed the modification of runtimepath from my .vimrc and
created a symbolic link between vimfiles and .vim and it's now
working.  Dunno what the difference is, but I'm a happy camper.

Thank you for the help!

Chris

--
Chris Sutcliffe
http://emergedesktop.org

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Issues with ftdetect

by Matt Wozniski-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, Nov 5, 2009 at 2:15 PM, Chris Sutcliffe wrote:

>
>>> I don't see anything wrong with your setup for sharing configuration
>>> files between Windows and Cygwin, but instead of modifying 'rtp', I
>>> put all my personal configuration files in ~/vimfiles and created
>>> ~/.vim as a Cygwin symbolic link to ~/vimfiles.  I assume that
>>> you've verified that your scheme works for other configuration
>>> files, just not for ftdetect files.
>
> I've removed the modification of runtimepath from my .vimrc and
> created a symbolic link between vimfiles and .vim and it's now
> working.  Dunno what the difference is, but I'm a happy camper.
>
> Thank you for the help!

IIRC, ftdetect files are read at the first "filetype on" (or "syntax
on", which indirectly calls the former), and aren't re-read after
'runtimepath' is changed.  So, I haven't tested this, but I'm
relatively certain you could have fixed your original problem by doing
"filetype off" and "filetype on" as the next two lines after your
'runtimepath' change, to force the ftdetect scripts to be reloaded.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Issues with ftdetect

by Tony Mechelynck-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/11/09 06:29, Matt Wozniski wrote:

>
> On Thu, Nov 5, 2009 at 2:15 PM, Chris Sutcliffe wrote:
>>
>>>> I don't see anything wrong with your setup for sharing configuration
>>>> files between Windows and Cygwin, but instead of modifying 'rtp', I
>>>> put all my personal configuration files in ~/vimfiles and created
>>>> ~/.vim as a Cygwin symbolic link to ~/vimfiles.  I assume that
>>>> you've verified that your scheme works for other configuration
>>>> files, just not for ftdetect files.
>>
>> I've removed the modification of runtimepath from my .vimrc and
>> created a symbolic link between vimfiles and .vim and it's now
>> working.  Dunno what the difference is, but I'm a happy camper.
>>
>> Thank you for the help!
>
> IIRC, ftdetect files are read at the first "filetype on" (or "syntax
> on", which indirectly calls the former), and aren't re-read after
> 'runtimepath' is changed.  So, I haven't tested this, but I'm
> relatively certain you could have fixed your original problem by doing
> "filetype off" and "filetype on" as the next two lines after your
> 'runtimepath' change, to force the ftdetect scripts to be reloaded.
>
> ~Matt

...or, of course, by placing your ":set rtp" commands near the top of
your vimrc, before any of the following:

        filetype [plugin] [indent] on
        syntax on
        source $VIMRUNTIME/vimrc_example.vim
        runtime vimrc_example.vim


Indeed, any modification to the 'runtimepath' option only influences
where _future_ sourced scripts will be searched. Anything already done,
is done.


Best regards,
Tony.
--
You worry too much about your job.  Stop it.  You're not paid enough to
worry.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Re: Issues with ftdetect

by Matt Wozniski-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Dec 1, 2009 at 10:51 PM, Tony Mechelynck wrote:

> On 10/11/09 06:29, Matt Wozniski wrote:
>>
>> IIRC, ftdetect files are read at the first "filetype on" (or "syntax
>> on", which indirectly calls the former), and aren't re-read after
>> 'runtimepath' is changed.  So, I haven't tested this, but I'm
>> relatively certain you could have fixed your original problem by doing
>> "filetype off" and "filetype on" as the next two lines after your
>> 'runtimepath' change, to force the ftdetect scripts to be reloaded.
>
> ...or, of course, by placing your ":set rtp" commands near the top of your
> vimrc, before any of the following:
>
>        filetype [plugin] [indent] on
>        syntax on
>        source $VIMRUNTIME/vimrc_example.vim
>        runtime vimrc_example.vim

That doesn't help if there's a "filetype on" or "syntax on" in the
systemwide vimrc, as there is on many linux distros.

    :filetype off | filetype on

should always work to make sure that all needed ftdetect files are
sourced, regardless of what's in the systemwide rcs or what other
commands have already been run.

~Matt

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php