c - - C89
` - C99
xml -- ant
| -- html 2
| -- php?
| -- pom
| -- hibernate_cfg
| -- ....
` - ....
Would it make sense to introduce some kind of ft subtype?
Then the filetype would be c and the subtype would be 89, 99, borland,
gcc
I've been thinking of this a while now
There are many filetypes where you would need a mix or a base +
additions
My solution now is having the ftplugin/ant.vim file source the
ftplugin/xml.vim file ...
Think of jsp, its a mix of of Java and html Which ft?
I want to have my Java mappings and xml/html mappings
Eclipse has a similar problem: Every project can have different
additions (eg maven, aspectJ, ..) They call it nature and a project can
have more than one.
It's not that easy because what should be the setting of 'comments' for
filetype c? Should it exclude // than because c89 doesn' support them?
Would it be a solution to do it the same way than buffer/global? If a
nature-filetype setting exists use this else use the one of ft?
When allowing multiple natures, should the user be able to provide a
custom function to combine the values of comments of nature c89 and c99?
Don't get me wrong: I'm not sure wether its worth implementing something
like this. I'd like to get your opinion about this again:
I could imagine something new beeing independent of buffer, window and
global mappings (for mappings and variables in this order take the first match
vim-window manager (eg here ZZ and ZQ and <c-w>hjkl should be mapped ...)
buffer (eg command :SaveToFTPHostWhenNewer set by user for
this specific file)
nature dependend ( eg: :ListAllWrongC99Comments, set 'comments' for c89
to override filetype settings in nature c89)
filetype dependend ( eg autocommand to load my c-tags files)
global mappings ( eg automatically save original files and 3 diffs
somewhere, create directory before saving autocommand,
..)
But what to do if you associate a buffer with 2 natures having defined
the same mapping? (assign numbers to natures and take the smallest one?)
Having something like natures would allow you to add/remove mappings
without effort.. Might be used for browsing/ or debugging modes.
Eg while adding a debug nature you might remap c n s h r to continue,
next, step, halt, rerun, ... To stop the debugging mode you would have
to remove debug from the natures list instead of calling unmap for each
mappnig.
Marc