leocharre has asked for the wisdom of the Perl Monks concerning the following question:

I like cli tab completion.

I was writing some perl- and I got mixed up because I'd been using the command line all morning- so I was trying to hit tab to finish some function call.

(I use vim a lot.. So I find myself typing :wq on emails and form text areas a good bit also. I hope I'm not alone here.)

So.. I thought.. what about tab completion for code- in vim- a plugin?? Something that would look around and say.. oh.. you declared symbol $some_long_ass_descriptive_symbol_name and therefore if you start typing $some_long_ass...
Just like the cli.

I discussed this around the office- my boss thinks I'm not worthy of vim anymore and I should start using open office to edit code instead.

Has this been done before? Is this out there? Is this an idea solely conjured for the purpose of lazyness and the effect of slowing down a machine and just introducing more bugs?

This tickles my imagination.. Just me??
:wq

update

Just when you thought you were talking about something obscure.. Perl omnicompletion available for Vim 7

Replies are listed 'Best First'.
Re: (OT) tab completion for code?
by DStaal (Chaplain) on Feb 04, 2009 at 18:57 UTC
      Hmm.. that's pretty interesting.. Currently does not support perl. It's close.
      It doesn't actually analize your current code- still I'm gonna give it a spin.
      Thank you!
        from the link in the grandparent:
        "It is also possible to add custom omni completion scripts."

        And, personally, I prefer to "analyse" my code, though it may sometimes need a proctologist.

        :-{)
Re: (OT) tab completion for code?
by tilly (Archbishop) on Feb 04, 2009 at 20:10 UTC
    If you don't want to do omnicompletion or don't have the latest vim, try adding this to your .vimrc instead.
    function! TabOrCompletion() let col = col('.') - 1 if col==0 || getline('.')[col - 1] !~ '\k' return "\<TAB>" else return "\<C-N>" endif endfunction inoremap <tab> <c-r>=TabOrCompletion()<cr>
Re: (OT) tab completion for code?
by planetscape (Chancellor) on Feb 05, 2009 at 19:36 UTC
Re: (OT) tab completion for code?
by zwon (Abbot) on Feb 04, 2009 at 19:59 UTC

    I don't like Perl omnicompletion and prefer to use ordinary one, combined with perl-support plugin it works good enough for me.

Re: (OT) tab completion for code?
by parv (Parson) on Feb 05, 2009 at 06:43 UTC
    I use ctags (the exuberant version), and ...
    " Completion - tag inoremap ^T <C-x><C-]> nnoremap ^T a<C-x><C-]><Esc>
Re: (OT) tab completion for code?
by holli (Abbot) on Feb 05, 2009 at 08:29 UTC
    ... and I should start using open office to edit code instead.
    Open Office? Iieeek!


    holli

    When you're up to your ass in alligators, it's difficult to remember that your original purpose was to drain the swamp.