[plug] editor

Peter Wright pete at akira.apana.org.au
Thu Jan 10 16:52:57 WST 2002


On Wed, Jan 09, 2002 at 05:31:04PM -0800, Wayne Vovil wrote:
> Hi
> 
> Thanks for that! But I am REALLY after something more professional and
> intuitive. Let's use C as an example. I want to type:
> 
> if (execl(childpath, childpath, wparm, (char *) 0) < 0)               err_sys("execl error");     
> 
> (sorry about the formatting)
> 
> I would like:
> 
> when I type "if" I get "if (" and when I have typed "if (execl" I get "if (execl(char *, char *, parm, " etc.
> 
> In other words, not only keyword completion; but more than that (call it
> parm prompting etc.

Hmmmm.

> Also it would be nice to have context sensitive scoping. By that I mean,
> using an OOP language, you would have a drop-down list of object
> references available that were valid for the current scope.

I think this may be more than something like Vim at least can provide. That
sort of feature sounds like the sort of thing that could only be provided
in an integrated development environment editor for a limited set of
languages (eg. I think the default editor in Microsoft Visual Studio does
something like this for C or C++).

I accomplish something that is effectively very close to this using a
combination of ctags and a utility called global (in C++), but it's not
what you want. For example, I could type:

if (execl

...then hit escape, make sure the cursor is on the word "execl" and hit
ctrl-]. Vim will leap straight to the definition of execl (in the system
header file). I can copy the definition in a number of ways (eg. if it's on
a single line I press 'yy'), leap back to where I started by pressing
ctrl-t, and paste the line with 'p'. To comment the line out I can
highlight the line with 'V' and press 'F8' (is a very useful macro
I've created that prepends the selected area with '//').

Now that probably sounds like a lot of work when I describe it, but it
actually takes no more than a few seconds.

There's also another simpler (and sometimes more effective) approach you
can sometimes take with system functions that have a man page for them (ie.
under UN*X/Linux or Cygwin under Windows) if you're using Vim in a terminal
- move your cursor over the word in question, eg. "execl", and press 'K'.
The man page for execl will then pop up (this option is, however, not so
effective on Windows where I do most of my development work).

This system is by no means perfect, but it's pretty decent - especially for
navigating through your own code. There's even more funky stuff that you
can do with the cscope interface, though I don't use that.

> I know that this is probably not clear to anyone but myself.

Oh, it's quite clear :). I just don't think that any IDEs (and I really
doubt any pure editors) on Linux supply this sort of
language-and-developmentenvironment-specific feature as yet - though I'd be
happy to be corrected on this point. More recent editions of KDevelop or
KDE Studio Gold may.

> Ta
> Wayne
> PS I would also like this without having to press
> (CNTR+Alt+Backspace+PGDwn+N - a minimum of keys - say tab)

:imap <Tab> <C-n>

:-)

Though the above probably won't help, I hope it was at least mildly
interesting. :)

Pete.
-- 
http://akira.apana.org.au/~pete/

-- 
    With sufficient thrust, pigs fly just fine.
                   -- RFC 1925



More information about the plug mailing list