Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help craeting supertab function to omnicomplete on perl isms #3

Closed
cazador481 opened this issue Aug 26, 2010 · 2 comments
Closed

help craeting supertab function to omnicomplete on perl isms #3

cazador481 opened this issue Aug 26, 2010 · 2 comments

Comments

@cazador481
Copy link

I am trying to get supertab to omni complete on the following and I am having problems.

random text $wor->supertab
random %w->supertab
random &w->supertab

Where the key to have it omnicomplete is if the begining of the current word has the following char
%,$,&
Thanks

@ervandew
Copy link
Owner

If you are using the context completion feature, then you can add a new context to be evaluated. I did something like this for clojure coding, but here is a perl example that should work as you've described (put this in a perl ftplugin, Ex: ~/.vim/ftplugin/perl_supertab.vim):

if exists('g:SuperTabCompletionContexts')
  let b:SuperTabCompletionContexts =
    \ ['PerlContext'] + g:SuperTabCompletionContexts
  function! PerlContext()
    let curline = getline('.')
    let cnum = col('.')
    let synname = synIDattr(synID(line('.'), cnum - 1, 1), 'name')
    if curline =~ '[%$&]\w*\%' . cnum . 'c' && synname !~ '\(String\|Comment\)'
      return "\<c-x>\<c-o>"
    endif
  endfunction
endif

Let me know if this is what you were looking for or not.

@ervandew
Copy link
Owner

ervandew commented Oct 5, 2010

Closing this do to no response.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants