set isk+=_,@,- " none of these should be word dividers, so make them not be
set nobackup
+set completeopt=longest,menuone,preview
+inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
+inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
+ \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
+
+inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
+ \ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Theme/Colors
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set number " turn on line numbers
set lz " do not redraw while running macros (much faster) (LazyRedraw)
set hid " you can change buffer without saving
-set backspace=2 " make backspace work normal
+set backspace=eol,start,indent " make backspace work normal
set whichwrap+=<,>,h,l " backspace and cursor keys wrap to
set shortmess=atI " shortens messages to avoid 'press a key' prompt
set report=0 " tell us when anything is changed via :...
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set showmatch " show matching brackets
set mat=5 " how many tenths of a second to blink matching brackets for
-set hlsearch " highlight searched for phrases
+set nohlsearch " highlight searched for phrases
set incsearch " do highlight as you type you search phrase
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " what to show when I hit :set list
set so=10 " Keep 10 lines (top/bottom) for scope
" Text Formatting/Layout
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fo=tcrqn " See Help (complex)
+set ai " autoindent
set si " smartindent
set tabstop=4 " tab spacing (settings below are just to unify it)
set softtabstop=4 " unify
set smarttab "Use the "shiftwidth" setting for inserting <TAB>s instead of the "tabstop" setting, when at the beginning of a line.
set nowrap " do not wrap lines
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Folding
-" Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-set foldenable " Turn on folding
-set foldmethod=indent " Make folding indent sensitive
-set foldlevel=100 " Don't autofold anything (but I can still fold manually)
-set foldopen-=search " don't open folds when you search into them
-set foldopen-=undo " don't open folds when you undo stuff
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mouse Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map NERDTree show and hide
map <F2> :NERDTreeToggle<CR>
imap <F2> <Esc>:NERDTreeToggle<CR>
-" Taglist toggle
-map <F3> :TlistOpen<CR>
-imap <F3> <Esc>:TlistClose<CR>
+" Tagbar toggle
+map <F3> :TagbarToggle<CR>
+imap <F3> <Esc>:TagbarToggle<CR>
+" Alt-right/left to navigate forward/backward in the tags stack
+map <M-Left> <C-T>
+map <M-Right> <C-]>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Autocommands
autocmd FileType c,cpp,slang set cindent
autocmd FileType c,cpp,slang set textwidth=79
+ autocmd FileType c,cpp,slang set tags=./tags,/usr/src/linux/tags,~/.vim/tags/usr/include/tags
autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
autocmd BufNewFile *.sh call append(0, "#!/bin/bash")
autocmd BufNewFile *.pl call append(0, "#!/usr/bin/perl")
autocmd BufNewFile *.py call append(0, "#!/bin/python")
+
+ " PHP documenter script bound to Control-P
+ autocmd FileType php inoremap <C-p> <ESC>:call PhpDocSingle()<CR>i
+ autocmd FileType php nnoremap <C-p> :call PhpDocSingle()<CR>
+ autocmd FileType php vnoremap <C-p> :call PhpDocRange()<CR>
+
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
endif
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Useful abbrevs
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General configs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set title
endif
+
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin activation
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
exec 'set runtimepath+='.vam_install_path.'/vim-addon-manager'
" Enable addons with vim-addon-manager using file type recognition
let ft_addons = {
- \ 'always': ['surround', 'checksyntax', 'LargeFile', 'snipmate', 'snipmate-snippets', 'The_NERD_tree'],
+ \ 'always': ['desert', 'gnupg', 'surround', 'checksyntax', 'quickfixsigns', 'LargeFile', 'snipmate', 'snipmate-snippets', 'The_NERD_tree', 'SuperTab%1643', 'fugitive'],
\ 'r': [ 'Screen_vim__gnu_screentmux', 'Vim-R-plugin' ],
- \ '^\%(c\|cpp\|javascript\|python\|php\|html\|xml\|r\|sh\|css\|java\|make\|xslt\|vim\)$': [ 'taglist-plus'],
- \ 'python': ['pythoncomplete', 'pydoc', 'python%790'],
+ \ '^\%(c\|cpp\|cuda\|javascript\|python\|php\|html\|xml\|r\|sh\|css\|java\|make\|xslt\|vim\)$': [ 'Tagbar', 'checksyntax', 'TagHighlight', 'sleuth'],
+ \ '^\%(c\|cpp\|h\|cuda\)$': [ 'clang_complete' ],
+ \ 'python': [ 'python_pydoc'],
+ \ 'php': ['phpcomplete', 'PDV_-_phpDocumentor_for_Vim'],
\ 'gpg': ['gnupg'],
\ }
call vam#ActivateAddons(ft_addons['always'], {'auto_install': 1})
au FileType * for l in values(filter(copy(ft_addons), string(expand('<amatch>')).' =~ v:key')) | call vam#ActivateAddons(l, {'force_loading_plugins_now':1}) | endfor
+
+" SuperTab option for context aware completion
+let g:SuperTabDefaultCompletionType = "context"
+" If you prefer the Omni-Completion tip window to close when a selection is
+" " made, these lines close it on movement in insert mode or when leaving
+" " insert mode
+if has("autocmd")
+ autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
+ autocmd InsertLeave * if pumvisible() == 0|pclose|endif
+endif
+
+let g:clang_complete_copen = 1
+let g:clang_complete_auto = 1
+let g:clang_user_options='|| exit 0'
+
+if has("cscope")
+ set csto=0
+ set cst
+ set nocsverb
+ " add any database in current directory
+ if filereadable("cscope.out")
+ cs add cscope.out
+ " else add database pointed to by environment
+ elseif $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ endif
+ if filereadable("/usr/linux/cscope.out")
+ cs add /usr/linux/cscope.out
+ endif
+ set csverb
+endif