0

After using XCode for a while (couple years), I'm attempting to move to MacVim for development/code editing. Mostly, I'm doing this because I'm starting up some non-obj-c projects and I don't want to keep switching between code editors.

I've setup MacVim with a few convenient plugins:

  • Janus (which is a host of plugins, I know)
  • cocoa.vim
  • clang_complete, which is the most important one to me, since it mimics XCode's code completion.

So far everything works fine except I can't seem to configure it to popup the completion box automatically. I have to use "tab" every time I want to view the code completion. I'd rather it open up after a certain number of characters for a word are entered, say 3 characters. I've searched around for a while (couple hours) but haven't been able to get it to work.

Any help would be appreciated. Thanks!
Here's my .vimrc file:

""
"" Janus setup
""

" Define paths
let g:janus_path = escape(fnamemodify(resolve(expand("<sfile>:p")), ":h"), ' ')
let g:janus_vim_path = escape(fnamemodify(resolve(expand("<sfile>:p" . "vim")), ":h"), ' ')
let g:janus_custom_path = expand("~/.janus")

" Source janus's core
exe 'source ' . g:janus_vim_path . '/core/before/plugin/janus.vim'

" You should note that groups will be processed by Pathogen in reverse
" order they were added.
call janus#add_group("tools")
call janus#add_group("langs")
call janus#add_group("colors")

""
"" Customisations
""

if filereadable(expand("~/.vimrc.before"))
  source ~/.vimrc.before
endif


" Disable plugins prior to loading pathogen
exe 'source ' . g:janus_vim_path . '/core/plugins.vim'

""
"" Pathogen setup
""

" Load all groups, custom dir, and janus core
call janus#load_pathogen()

 colorscheme Wombat256

 "clang_autocomplete options
 set conceallevel=2
 set concealcursor=vin
 let g:clang_use_library=1
 let g:clang_library_path='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib'
 let g:clang_complete_auto=1
 let g:clang_periodic_quickfix=1
 let g:clang_snippets=1
 let g:clang_conceal_snippets=1
 let g:clang_snippets_engine='clang_complete'
 " Show clang errors in the quickfix window
 "let g:clang_complete_copen = 1
 set completeopt=longest,menuone,preview
timss
  • 9,982
  • 4
  • 34
  • 56
Aaron Hayman
  • 8,492
  • 2
  • 36
  • 63
  • Get rid of Janus before it's too late. – romainl May 30 '13 at 15:00
  • @romainl You might want to explain why using a vim distribution like Janus might be a bad idea. – timss May 30 '13 at 15:03
  • This doesn't seem to be specific for MacVim. You might want to change the title of your question. – timss May 30 '13 at 15:05
  • @timss I wasn't actually sure if it was MacVim or just Vim related, which is why I left it up there. However, oddly, I have no idea how to edit the title. – Aaron Hayman May 30 '13 at 15:19
  • @AaronHayman I removed it for you, but I believe you should be able to edit it yourself by just pressing "edit" just below the tags, even as the OP. – timss May 30 '13 at 15:21
  • @timss Woah...wow, I think I've been staring at the screen too long. Of course, I know how to edit the title, I've done it before. I added "Vim" back to the title since it is related to Vim. – Aaron Hayman May 30 '13 at 15:24
  • @AaronHayman [You probably shouldn't add tags to your title](http://meta.stackexchange.com/a/130208/218539), however I won't go as far as re-editing the title of your question again. – timss May 30 '13 at 15:28

1 Answers1

1

This can be achieved using AutoComplPop (vimscripts, old / Github, somewhat old).
The number of characters needed to be entered before it'll try keyword completion can also be set.

let g:acp_behaviorKeywordLength = 3

Note that the the newer versions requires the L9 library. The old one at vimscripts does not.
It's kind of confusing since there's different versions on all the different sites (vimscripts, github, bitbucket).

Install the plugin(s) using your favorite plugin manager.
Personally I prefer Vundle, but Janus uses Pathogen.

timss
  • 9,982
  • 4
  • 34
  • 56