Added optional YCM integration
This commit is contained in:
103
vimrc
103
vimrc
@@ -1,20 +1,29 @@
|
||||
execute pathogen#infect()
|
||||
|
||||
" Tab length-related settings
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
" Mouse mode
|
||||
set mouse=nicr
|
||||
set ttymouse=sgr "Support wide screens
|
||||
|
||||
" Search Settings
|
||||
set incsearch
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set smartindent
|
||||
set tags=./tags;
|
||||
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
|
||||
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
colorscheme apprentice
|
||||
set switchbuf+=uselast " Use last window when making selection from quickfix window
|
||||
set redrawtime=5000 " Increase maximum redraw time to use syntax highlighting for large files
|
||||
|
||||
set backspace=indent,eol,start " Make backspace key work in insert mode
|
||||
|
||||
nnoremap tn :tabnew<CR>
|
||||
|
||||
@@ -27,7 +36,12 @@ map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
|
||||
" Load all of the helptags now, after plugins have been loaded.
|
||||
" All messages and errors will be ignored.
|
||||
silent! helptags ALL
|
||||
"
|
||||
|
||||
" Return to last edit position whan opening a file
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
|
||||
if &term =~ '^screen'
|
||||
" tmux will send xterm-style keys when its xterm-keys option is on
|
||||
@@ -42,22 +56,56 @@ nnoremap <leader>n :NERDTreeFocus<CR>
|
||||
nnoremap <C-n> :NERDTreeToggle<CR>
|
||||
nnoremap <C-f> :NERDTreeFind<CR>
|
||||
|
||||
" Taglist
|
||||
"""" Taglist
|
||||
set tags=./tags; " Recursively search backwards for ctags file
|
||||
" CTRL-l to open taglist
|
||||
nnoremap <C-l> :TlistToggle<CR>
|
||||
" CTRL-p to show function name in status bar
|
||||
nnoremap <C-p> :TlistShowPrototype<CR>
|
||||
let Tlist_Use_Right_Window = 1 " Move window to right side
|
||||
let Tlist_Exit_OnlyWindow = 1 " Close if only window left
|
||||
let Tlist_Hightlight_Tag_On_BufEnter = 1 " Hightlight current tag
|
||||
let Tlist_Display_Prototypte = 1 " Show full prototype at bottom
|
||||
let Tlist_Use_Right_Window = 1 " Move window to right side
|
||||
let Tlist_Exit_OnlyWindow = 1 " Close if only window left
|
||||
let Tlist_Hightlight_Tag_On_BufEnter = 1 " Hightlight current tag
|
||||
let Tlist_Display_Prototypte = 1 " Show full prototype at bottom
|
||||
let Tlist_Ctags_Cmd = 'ctags --extra=-q --c++-kinds=-p'
|
||||
|
||||
" vim-rainbow
|
||||
"""" vim-rainbow
|
||||
let g:rainbow_active = 1
|
||||
let g:rainbow_guifgs = ['RoyalBlue3', 'DarkOrange3', 'DarkOrchid3', 'FireBrick']
|
||||
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']
|
||||
|
||||
"""" Gitgutter
|
||||
" CTRL-g to toggle GitGutter display
|
||||
nnoremap <C-g> :GitGutterToggle<CR>
|
||||
|
||||
" Fugitive conflict resolution
|
||||
nnoremap <leader>gd :Gvdiff<CR>
|
||||
nnoremap gdh :diffget //2<CR>
|
||||
nnoremap gdl :diffget //3<CR>
|
||||
|
||||
"""" YAML editor settings
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType puml setlocal ts=4 sts=4 sw=4 expandtab
|
||||
let g:indentLine_char = '┆'
|
||||
let g:indentLine_color_term = 237
|
||||
|
||||
" vim-airline
|
||||
let g:airline#extensions#whitespace#enabled = 0
|
||||
" Hide branch information in status line
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
let g:airline_symbols.colnr = ''
|
||||
let g:airline#extensions#taglist#enabled = 1
|
||||
let g:airline#extensions#tabline#enabled = 0
|
||||
let g:airline#extensions#bufferline#enabled = 0
|
||||
function! InitAirline()
|
||||
let g:airline_section_b = airline#section#create([])
|
||||
endfunction
|
||||
autocmd VimEnter * call InitAirline()
|
||||
|
||||
""" Use one of these options depending on software
|
||||
"" OPTION A: Vim 8.x without YCM (easy setup)
|
||||
" OmniCpp
|
||||
let OmniCpp_MayCompleteDot = 0
|
||||
let OmniCpp_MayCompleteArrow = 0
|
||||
@@ -66,17 +114,6 @@ let OmniCpp_MayCompleteArrow = 0
|
||||
" Supertab
|
||||
let g:SuperTabDefaultCompletionType = "<c-x><c-]>"
|
||||
|
||||
" Fugitive conflict resolution
|
||||
nnoremap <leader>gd :Gvdiff<CR>
|
||||
nnoremap gdh :diffget //2<CR>
|
||||
nnoremap gdl :diffget //3<CR>
|
||||
|
||||
" YAML editor settings
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
let g:indentLine_char = '┆'
|
||||
let g:indentLine_color_term = 237
|
||||
|
||||
" Syntastic
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlag()}
|
||||
@@ -95,10 +132,24 @@ nnoremap <C-y> :SyntasticToggleMode<CR>
|
||||
" autocmd FileType cpp if stridx(expand("%:p"), "/home/anaber/work/trenton/") == 0 |
|
||||
" \ let g:syntastic_cpp_clang_tidy_args = "-p /home/anaber/work/trenton" | endif
|
||||
|
||||
" vim-airline
|
||||
let g:airline#extensions#whitespace#enabled = 0
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
let g:airline_symbols.colnr = ''
|
||||
let g:airline#extensions#taglist#enabled = 1
|
||||
"" OPTION B: Vim 9.x + Python3 support + YCM (really nice)
|
||||
" YouCompleteMe settings
|
||||
"let g:ycm_autoclose_preview_window_after_insertion = 1
|
||||
"let g:ycm_autoclose_preview_window_after_completion = 1
|
||||
"let g:ycm_open_loclist_on_ycm_diags = 1 " Open location list to view diagnostics
|
||||
"let g:ycm_max_num_candidates = 20 " Max number of completion suggestions
|
||||
"let g:ycm_max_num_candidates = 20 " Max number of completion suggestions
|
||||
"let g:ycm_max_num_identifier_candidates = 10 " Max number of identifier-based suggestions
|
||||
"let g:ycm_auto_trigger = 0 " Disable completion menu. Use <C-space> for completion
|
||||
"let g:ycm_show_diagnostic_ui = 1 " Show diagnostic display features
|
||||
"let g:ycm_error_symbol = '>>' " The error symbol in Vim gutter
|
||||
"let g:ycm_enable_diagnostic_signs = 1 " Display icons in Vim's gutter, error, warnings
|
||||
"let g:ycm_enable_diagnostic_highlighting = 1 " Highlight regions of diagnostic text
|
||||
"let g:ycm_echo_current_diagnostic = 1 " Echo line's diagnostic that cursor is on
|
||||
"let g:ycm_min_num_of_chars_for_completion = 4 " Wait for 4 characters before completion
|
||||
"
|
||||
"" Show compilation errors
|
||||
"nnoremap <silent> <C-y> :YcmDiags<CR>
|
||||
"" Toggle documentation popup (\D)
|
||||
"nmap <leader>D <plug>(YCMHover)
|
||||
""" END OPTIONS
|
||||
|
||||
Reference in New Issue
Block a user