>> I am probably too tired to figure out, why Berlin would get cl1.2 (a
>> subsubclass)
>
> How the instances Berlin, Paris, ... are classified (assigned to
> classes)
> is just a (dummy) example. In any case, this work is up to the human
> annotator, not the computer. The computer (vim) should just assist to
> choose
> quickly from the hierarchy.
>
> I assume that a completion extension could be configured to accomplish
> this?
> Which one would people recommend for this type of task?
Try the attached Plugin. Put it into your ~/.vim/plugin folder (on Unix)
or in $VIM/vimfiles/plugin (on Windows) and create any directory that
does not yet exist.
At a minimum, you want to set the file to the class-hierarchy in the plugin
(look for the variable s:class_hier).
The class hierarchy expects each class to end with any number of '.' plus
a decimal, that encodes the hierachy level (as your example file showed)
The top level doesn't need a herachy level.
After sourcing the file, you need to enable the completion function for
your file. In your annotating file, simple execute
:EnableAnnotateCompletion and it will set up a completion function
in you current buffer. After it is enabled, you can press any <C-X><C-U>
and the annotate plugin will present you a list of matching subclasses
(or all available subclasses). So if you are at the line (| represents the
cursor):
Berlin top|
It will show only '0 : top' (where top would be the top hierarchy from your
hierachy file.
If the line looks like this:
Berlin bar4|
The plugin will display a completion popup, which includes all available
items in your fourth level. Which would be from your example (4: cl4, 4.1
: cl4.1, 4.1.1 : cl4.1.1 and so on) You can press <Ctrl-N> and <Ctrl-P> to
insert the next/previous match.
If the line looks like this:
Berlin bar|
(the plugin will present you a list of all available subclasses (It simply
tries to guess, when a decimal at the end is included, that would like to
insert any items from that sublevel. Since there was no decimal, it will
show all available items.)
In any case, you can disable the plugin via :DisableAnnotateCompletion and
enable it with :EnableAnnotateCompletion.
See help popupmenu-completion for how to use the popup menu and what keys
can be used.
regards,
Christian
--
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