Other file types

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Other file types

Steve Litt
Once again, I'm trying to find an easy way to declare other file types, as I
use VO not only on *.otl, but also on *.emdl, *.ebdl, and *.pho.

I can do it by inserting the wildcards into ~/.vim/ftdetect/vo_base.vim like
this:

augroup filetypedetect
  au! BufRead,BufNewFile *.otl setfiletype vo_base
  au! BufRead,BufNewFile *.pho setfiletype vo_base
  au! BufRead,BufNewFile *.emdl setfiletype vo_base
  au! BufRead,BufNewFile *.ebdl setfiletype vo_base
  au! BufRead,BufNewFile *.oln setfiletype xoutliner
augroup END

The problem with that is that this file gets blown away every time you upgrade
VO, which is quite often.

What's really needed is to put it in ~/.vimoutlinerrc. I tried this
in .vimoutlinerrc after removing the corresponding wildcards from
~/.vim/ftdetect/vo_base.vim:

augroup filetypedetect
  au! BufRead,BufNewFile *.pho setfiletype vo_base
  au! BufRead,BufNewFile *.emdl setfiletype vo_base
  au! BufRead,BufNewFile *.ebdl setfiletype vo_base
augroup END

The preceding worked perfectly with .pho files, but failed with *.emdl. HUH???
A grep command found no evidence of *.pho in any file in the .vim tree.
Reversing the order of the wildcards in .vimoutlinerrc did not change the
symptom. What in the world would the setup have against *.emdl (or for
*.pho)?

Well, it turns out that I edit my .pho files as interoutline links from
phone.otl, but I edit my *.emdl files directly from a command (actually from
UMENU). If I edit *.pho directly it fails, and *.emdl succeeds from an  
interoutline link.

In fact, if I pull up a *.pho or *.emdl directly VO isn't enabled, but if I
then do

:e /d/otl/master.otl

and then :bp to the .pho or .emdl file, it is now enabled for VO.

So my question is this: How can we put addition of all auxiliary file types
in .vimoutlinerrc and have it work perfectly every time, without the need to
edit an *.otl file in addition?

SteveT


SteveT


--
Steve Litt
Founder and acting president: GoLUG
http://www.golug.org
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Matej Cepl
Steve Litt wrote:
> So my question is this: How can we put addition of all auxiliary file
> types in .vimoutlinerrc and have it work perfectly every time, without the
> need to edit an *.otl file in addition?

How many files of each type you have -- is it really necessaryt to create a
special file type for them? Wouldn't this modeline (:he modeline) be
sufficient?

# vim: set ft=vo_base:

        Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
He loves nature in spite of what it did to him.
      -- Forrest Tucker


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Re: Other file types

Steve Litt
On Wednesday 08 June 2005 03:10 pm, Matej Cepl wrote:
> Steve Litt wrote:
> > So my question is this: How can we put addition of all auxiliary file
> > types in .vimoutlinerrc and have it work perfectly every time, without
> > the need to edit an *.otl file in addition?
>
> How many files of each type you have -- is it really necessaryt to create a
> special file type for them? Wouldn't this modeline (:he modeline) be
> sufficient?

I have about 7 .pho files, about 3 .emdl files, and IIRC 1 .ebdl file. I guess
it's as much a philosophy as anything. I believe filetypes should identify
the type of information, not necessarily the application that accesses them,
because over time the application will change, and more to the point, change
for some and not for others.

So for me it's absolutely worth it to tweak VO to consider other filetypes as
outlines.

SteveT

Steve Litt
Founder and acting president: GoLUG
http://www.golug.org
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Ross Boylan
In reply to this post by Steve Litt
On Wed, 2005-06-08 at 14:45 -0400, Steve Litt wrote:

> So my question is this: How can we put addition of all auxiliary file types
> in .vimoutlinerrc and have it work perfectly every time, without the need to
> edit an *.otl file in addition?
>
I though .vimoutlinerrc only comes into play if vim decides you are
dealing with a vo file (or more accurately, vim decides you have a vo
file, loads the vo module, and the latter looks for .vimoutlinerrc).

If that's the case, defining file types in .vimoutlinerrc won't help,
because the problem is to convince vim it's got a vo file.

Then again, I know almost nothing about how vim works.
--
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          [hidden email]
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Noel Henson
You are correct.

I've stayed out of this thread while I try out different, smart ways to
automatically edit ftdetect during (re)install instead of just replace it.

Noel

On Thursday 09 June 2005 04:00 pm, Ross Boylan wrote:

> On Wed, 2005-06-08 at 14:45 -0400, Steve Litt wrote:
> > So my question is this: How can we put addition of all auxiliary file
> > types in .vimoutlinerrc and have it work perfectly every time, without
> > the need to edit an *.otl file in addition?
>
> I though .vimoutlinerrc only comes into play if vim decides you are
> dealing with a vo file (or more accurately, vim decides you have a vo
> file, loads the vo module, and the latter looks for .vimoutlinerrc).
>
> If that's the case, defining file types in .vimoutlinerrc won't help,
> because the problem is to convince vim it's got a vo file.
>
> Then again, I know almost nothing about how vim works.

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Steve Litt
In reply to this post by Ross Boylan
On Thursday 09 June 2005 07:00 pm, Ross Boylan wrote:

> On Wed, 2005-06-08 at 14:45 -0400, Steve Litt wrote:
> > So my question is this: How can we put addition of all auxiliary file
> > types in .vimoutlinerrc and have it work perfectly every time, without
> > the need to edit an *.otl file in addition?
>
> I though .vimoutlinerrc only comes into play if vim decides you are
> dealing with a vo file (or more accurately, vim decides you have a vo
> file, loads the vo module, and the latter looks for .vimoutlinerrc).
>
> If that's the case, defining file types in .vimoutlinerrc won't help,
> because the problem is to convince vim it's got a vo file.

Doooohhhhh! That's exactly why my .vimoutlinerrc hosted code worked only if
you loaded a .otl file.

I guess what we need is a ~/.vo_filetypes.vim file that, if and only if it
exists, is run at the top of ~/.vim/ftplugin/vo_base.vim. I can then simlink
that filename to a file in my data tree, so that neither replacing VO, nor
vim, nor the OS will disturb it.

SteveT

Steve Litt
Founder and acting president: GoLUG
http://www.golug.org
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Steve Litt
In reply to this post by Ross Boylan
On Thursday 09 June 2005 07:00 pm, Ross Boylan wrote:

> On Wed, 2005-06-08 at 14:45 -0400, Steve Litt wrote:
> > So my question is this: How can we put addition of all auxiliary file
> > types in .vimoutlinerrc and have it work perfectly every time, without
> > the need to edit an *.otl file in addition?
>
> I though .vimoutlinerrc only comes into play if vim decides you are
> dealing with a vo file (or more accurately, vim decides you have a vo
> file, loads the vo module, and the latter looks for .vimoutlinerrc).
>
> If that's the case, defining file types in .vimoutlinerrc won't help,
> because the problem is to convince vim it's got a vo file.

I think perhaps I should have said .vimrc.

SteveT

Steve Litt
Founder and acting president: GoLUG
http://www.golug.org
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Other file types

Matej Cepl
In reply to this post by Steve Litt
Steve Litt wrote:
> I guess what we need is a ~/.vo_filetypes.vim file that, if and only if it
> exists, is run at the top of ~/.vim/ftplugin/vo_base.vim. I can then
> simlink that filename to a file in my data tree, so that neither replacing
> VO, nor vim, nor the OS will disturb it.

NOOOOOOOOOOOOOOOOOOO -- not yet another dotfile in $HOME. Moreover, it is
absolutely useless: just create
~/.vim/ftdetect/steves_beloved_filetypes_oh_i_love_them.vim and it will be
automagically run by /usr/share/vim/vim*/filetype.vim, where on line 1730
(in my case, some 14 lines from the bottom) there is

        " Use the plugin-filetype checks last, they may overrule any of
        " the previously detected filetypes.
        runtime! ftdetect/*.vim

It is why whole ftdetect mechanism was created, so that we could do simple
way how to manage filetypes.

Best,

        Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development.
        -- [hidden email]


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Re: Other file types

Steve Litt
On Thursday 09 June 2005 10:11 pm, Matej Cepl wrote:

> Steve Litt wrote:
> > I guess what we need is a ~/.vo_filetypes.vim file that, if and only if
> > it exists, is run at the top of ~/.vim/ftplugin/vo_base.vim. I can then
> > simlink that filename to a file in my data tree, so that neither
> > replacing VO, nor vim, nor the OS will disturb it.
>
> NOOOOOOOOOOOOOOOOOOO -- not yet another dotfile in $HOME. Moreover, it is
> absolutely useless: just create
> ~/.vim/ftdetect/steves_beloved_filetypes_oh_i_love_them.vim and it will be
> automagically run by /usr/share/vim/vim*/filetype.vim, where on line 1730
> (in my case, some 14 lines from the bottom) there is
>
>         " Use the plugin-filetype checks last, they may overrule any of
>         " the previously detected filetypes.
>         runtime! ftdetect/*.vim
>
> It is why whole ftdetect mechanism was created, so that we could do simple
> way how to manage filetypes.

Did everyone hear that? It works perfectly, and completely solves my problem.
Here's exactly what I did...

I created file /data/inst/vo/steve_vo_types.vim

Then, in the ~/.vim/ftplugin directory I did this:

ln -s /data/inst/vo/steve_vo_types.vim  steve_vo_types.vim

After doing that, all my desired types work perfectly. The beauty of the
symbolic link is that when I upgrade, I can simply restore the symbolic link
and everything works perfectly.

Thanks Matej!

SteveT

Steve Litt
Founder and acting president: GoLUG
http://www.golug.org
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Re: Other file types

Noel Henson
On Friday 10 June 2005 04:59 am, Steve Litt wrote:

> >         " Use the plugin-filetype checks last, they may overrule any
> > of " the previously detected filetypes.
> >         runtime! ftdetect/*.vim
> >
> > It is why whole ftdetect mechanism was created, so that we could do
> > simple way how to manage filetypes.
>
> Did everyone hear that? It works perfectly, and completely solves my
> problem. Here's exactly what I did...
>
> I created file /data/inst/vo/steve_vo_types.vim
>
> Then, in the ~/.vim/ftplugin directory I did this:
>
> ln -s /data/inst/vo/steve_vo_types.vim  steve_vo_types.vim
>
> After doing that, all my desired types work perfectly. The beauty of the
> symbolic link is that when I upgrade, I can simply restore the symbolic
> link and everything works perfectly.
>

Yeah, thanks! I was trying to do some smart file editing from withing
install.sh. I forgot that ftdetect could do that.

Steve, could you write a short, simple passage about the problem and
solution so I can include it in the help?

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner
Reply | Threaded
Open this post in threaded view
|

Re: Re: Other file types

Steve Litt
On Friday 10 June 2005 08:35 am, Noel Henson wrote:

> On Friday 10 June 2005 04:59 am, Steve Litt wrote:
> > >         " Use the plugin-filetype checks last, they may overrule any
> > > of " the previously detected filetypes.
> > >         runtime! ftdetect/*.vim
> > >
> > > It is why whole ftdetect mechanism was created, so that we could do
> > > simple way how to manage filetypes.
> >
> > Did everyone hear that? It works perfectly, and completely solves my
> > problem. Here's exactly what I did...
> >
> > I created file /data/inst/vo/steve_vo_types.vim
> >
> > Then, in the ~/.vim/ftplugin directory I did this:
> >
> > ln -s /data/inst/vo/steve_vo_types.vim  steve_vo_types.vim
> >
> > After doing that, all my desired types work perfectly. The beauty of the
> > symbolic link is that when I upgrade, I can simply restore the symbolic
> > link and everything works perfectly.
>
> Yeah, thanks! I was trying to do some smart file editing from withing
> install.sh. I forgot that ftdetect could do that.
>
> Steve, could you write a short, simple passage about the problem and
> solution so I can include it in the help?
>
> Noel
Here it is, as an attachment:

SteveT

Steve Litt
Founder and acting president: GoLUG
http://www.golug.org

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner

vo_types.html (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Other file types

Matej Cepl
Steve Litt wrote:
>> > After doing that, all my desired types work perfectly. The beauty of
>> > the symbolic link is that when I upgrade, I can simply restore the
>> > symbolic link and everything works perfectly.

Do you mean that the installation script for VO wipes some non-vo_*.vim
files? Then it is _seriously_ broken -- it has no business whatsoever in
doing mess in ~/.vim, because it is place which should be shared by any
other vim plugin or configuration.

Matej

--
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
I went to a Grateful Dead Concert and they played for SEVEN
hours.  Great song.
    -- Fred Reuss


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner