Jhonny5 committed fc4771d

Added Autocomplete and TAB key for it

Comments (0)

Files changed (1)

 map <C-l> <C-w>>
 " Toggle whitespace with ,s
-"set listchars=tab:>-,trail:·,eol:$
-"nmap <silent> <leader>s :set nolist!<CR>
-"map <C-j> 5j
-"map <C-k> 5k
+set listchars=tab:>-,trail:·,eol:$
+nmap <silent> <leader>s :set nolist!<CR>
+map <C-j> 5j
+map <C-k> 5k
 " Useful aliases
 command! Q  q
 command! WQ  wq
 """ Plugin settings
 " Don't use pyflakes quickfix feature
 let g:pep8_map = '<leader>8'
 " Configure tab completion
-au FileType python set omnifunc=jedi#Complete
+autocmd FileType python set omnifunc=pythoncomplete#Complete
+autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
+autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
+autocmd FileType css set omnifunc=csscomplete#CompleteCSS
+autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
+autocmd FileType php set omnifunc=phpcomplete#CompletePHP
+autocmd FileType c set omnifunc=ccomplete#Complete
+autocmd FileType python set omnifunc=jedi#Complete
+autocmd FileType c set omnifunc=ccomplete#Complete
 let g:SuperTabDefaultCompletionType = "context"
 set completeopt=menuone,longest,preview
 " Nerd tree
 map <silent> <c-n> :NERDTreeToggle<CR>
-" TagBar
 nmap <F8> :TagbarToggle<CR>
+" OmniCppComplete
+set nocp
+filetype plugin on
+map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
+" configure tags - add additional tags here or comment out not-used ones
+set tags+=~/.vim/tags/cpp
+set tags+=~/.vim/tags/gl
+set tags+=~/.vim/tags/sdl
+set tags+=~/.vim/tags/qt4
+" " build tags of your own project with Ctrl-F12
+"map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
+" " OmniCppComplete
+let OmniCpp_NamespaceSearch = 1
+let OmniCpp_GlobalScopeSearch = 1
+let OmniCpp_ShowAccess = 1
+let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
+let OmniCpp_MayCompleteDot = 1 " autocomplete after .
+let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
+let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
+let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
+" " automatically open and close the popup menu / preview window
+au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
+set completeopt=menuone,menu,longest,preview
+function! InsertTabWrapper()
+    let col = col('.') - 1
+    if !col || getline('.')[col - 1] !~ '\k'
+        return "\<tab>"
+    else
+        return "\<c-n>"
+    endif
+    endfunction
+inoremap <tab> <c-r>=InsertTabWrapper()<cr>
 " Keep/Open session
 map <silent> <c-k> :mksession ~/.vim/.session <CR>
 map <silent> <c-o> :source ~/.vim/.session <CR>