> I think what Antony wanted to say is: What do you understand by 'a
> function'? How can it be identified in text?
>
> IMHO a function is such a highly language-dependent construct that a
> definition for a corresponding text object can not be easily described
> by a single flag or even some parameters and that it is best put inside
> a filetype plugin where you can make use of Vim's scripting language,
> e.g., by defining expressions for start and end of a function or for the
> whole body.
>
> Regards,
> Jürgen
Sorry... Indeed Antony wrote "define". It seems that I wanted so much
not to read that "write a function" :)
Vim is and was primarily c and c++ programmers editor, and lots of
features are tuned for c.
* Without going deep into c's (or C++'s) grammar I think by starting
backwards to search for an opening "{" that has no ";" before it.
* The statement before it can be only a function definition or
while/for/if/switch statement. If we found a statement keep going
backwards.
* If we found a function header we do our best to find the full header
(ret type, name , formal params)
* After the opening "{" was found, use existing algo to find its pair.
Such an algo should work with C, C++, java, php, javascript, etc. etc.
So.. nobody moves functions around? Just reordering time to time,
based on logical groups etc... would make sense... and with such a
selection tool, job would be easier :)
rgrds,
mobi phil
being mobile, but including technology
http://mobiphil.com
--
You received this message from the "vim_dev" 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