Tuesday, September 27, 2011

Re: Remembering syntax when moving in and out of buffers

On Sep 25, 6:09 pm, Tony Mechelynck <antoine.mechelynck@gmail.com>
wrote:
> On 25/09/11 18:48, Tony Mechelynck wrote:
>
> > On 25/09/11 17:35, Spiros Bousbouras wrote:

> >> I also don't like how the functionality for one type of file is split
> >> among several directories which will in general also contain
> >> functionality for other kinds of files. So instead of having for
> >> example one directory with all the plugins for say C source code ,
> >> you have a syntax directory where you have syntax stuff for C code ,
> >> Lisp code , etc. and then another directory for indentation stuff for
> >> C code , Lisp code etc. and so forth for all other kinds of
> >> functionality vim supports. This is different than the way code is
> >> organised in every other programming language I know of. Say I want
> >> to have a listing of all the files associated with some filetype.
> >> With the way things get done outside of vim you would use a single ls
> >> command or a single find command. But with the way vim organises
> >> things how do you do it ?
> >>
> >
> > Easy.
> > For all files currently loaded in Vim:
> >
> > :filetype on " unnecessary if already set
> > :echomsg 'Files of type foobar currently loaded:'
> > :bufdo if &ft == 'foobar' echomsg bufnr('%') . ':' expand('%:p') | endif
> >
> > For all files in a given directory:
> >
> > :filetype on " unnecessary if already set
> > :cd /some/place
> > :args *
> > :echomsg 'Files of type foobar in /some/place'
> > :argdo if &ft == 'foobar' echomsg expand('%:t') | endif
> >
> > See
> > :help :bufdo
> > :help :argdo
> > :help expr-option
> > :help :echomsg
> > :help expand()
> > :help filename-modifiers
> > etc.
>
> Oh, and if you meant all the Vim scripts which handle a given filetype
> (let's say foobar) it's also rather easy:

Yes , that's what I meant and I also meant from the shell command
line rather than from within vim .

> just list any file named
> ftplugin/foobar.vim ftplugin/foobar_*.vim or ftplugin/foobar/*.vim below
> any directory listed in 'runtimepath'. Since the default syntax is
> usually the same as the filetype, you may want to add syntax/foobar.vim
> and syntax/foobar/*.vim to these.
>
> see :help 'runtimepath'

--
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:

Post a Comment