Permalink
Browse files

add custom supertab context function for erlang

  • Loading branch information...
1 parent 0ee032d commit 7b64005dd1a844de03fbfb8e6893a8572f3c4fc7 @RJ committed Jan 5, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 vimrc.after
View
@@ -75,3 +75,21 @@ if has('gui_running')
"highlight SpellBad term=underline gui=undercurl guisp=Orange
endif
+" Use omni completion if module_name:something, for erlang:
+" (by default, supertab uses . :: ->, but not a single :
+function SuperErlangContext()
+ let exclusions = exists('g:SuperTabContextTextFileTypeExclusions') ?
+ \ g:SuperTabContextTextFileTypeExclusions : []
+ if index(exclusions, &ft) == -1
+ let curline = getline('.')
+ let cnum = col('.')
+ let synname = synIDattr(synID(line('.'), cnum - 1, 1), 'name')
+ if curline =~ '.*\(\w\|[\])]\)\(:\)\w*\%' . cnum . 'c' && synname !~ '\(String\|Comment\)'
+ return "\<c-x>\<c-o>"
+ endif
+ endif
+ " no return will result in the evaluation of the next
+ " configured context
+endfunction
+let g:SuperTabDefaultCompletionType = "context"
+let g:SuperTabCompletionContexts = ['SuperErlangContext', 's:ContextText', 's:ContextDiscover']

0 comments on commit 7b64005

Please sign in to comment.