summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-11-10 02:14:07 -0600
committerJesse Luehrs <doy@tozt.net>2011-11-10 02:14:22 -0600
commita14da603fa4b4f7fdf59dcf6384a9c26861a69cf (patch)
treebf86b02dd7985642e9e88ccf3d6c63069070ed71
parenta9e9f8d6465b414271db65506a026ab965644a3e (diff)
downloadconf-a14da603fa4b4f7fdf59dcf6384a9c26861a69cf.tar.gz
conf-a14da603fa4b4f7fdf59dcf6384a9c26861a69cf.zip
let's give the perl omnicompletion a try
-rw-r--r--.gitmodules3
-rw-r--r--vim/after/ftplugin/perl.vim22
m---------vim/bundle/perlomni0
-rw-r--r--vim/ftplugin/perl.vim2
4 files changed, 27 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index 70cbe06..68a0625 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -37,3 +37,6 @@
[submodule "vim/bundle/gundo"]
path = vim/bundle/gundo
url = git://github.com/sjl/gundo.vim.git
+[submodule "vim/bundle/perlomni"]
+ path = vim/bundle/perlomni
+ url = https://github.com/c9s/perlomni.vim.git
diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim
index 8d9585d..8072813 100644
--- a/vim/after/ftplugin/perl.vim
+++ b/vim/after/ftplugin/perl.vim
@@ -1,2 +1,24 @@
" the perl ftplugin hard-sets path, so this has to go in after/
setlocal path+=lib
+
+function s:SID()
+ return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID$')
+endfun
+fun! s:StringFilter(list,string)
+ let string = substitute(a:string,"'","''",'g')
+ return filter(copy(a:list),"stridx(v:val,'".string."') == 0 && v:val != '".string."'" )
+endf
+function! s:CompMooseTC(base, context)
+ let words = ['subtype', 'class_type', 'role_type', 'maybe_type',
+ \'duck_type', 'enum', 'union', 'as', 'where', 'message',
+ \'inline_as', 'optimize_as', 'type', 'match_on_type',
+ \'coerce', 'from', 'via', 'find_type_constraint',
+ \'register_type_constraint']
+ return s:StringFilter(words, a:base)
+endfunction
+call AddPerlOmniRule({
+ \'contains': 'use Moose::Util::TypeConstraints',
+ \'context': '.*',
+ \'backward': '\<\w*$',
+ \'comp': function(s:SID() . 'CompMooseTC')
+\})
diff --git a/vim/bundle/perlomni b/vim/bundle/perlomni
new file mode 160000
+Subproject 8a26a53e8186d0af81c5b2d27f023534a8f9049
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
index b86d4e2..2f1a6e2 100644
--- a/vim/ftplugin/perl.vim
+++ b/vim/ftplugin/perl.vim
@@ -45,3 +45,5 @@ function! s:unpostfix()
endfunction
map <buffer> <silent> <Leader>i :call <SID>unpostfix()<CR>
+
+let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"