diff options
Diffstat (limited to 'vimrc')
| -rw-r--r-- | vimrc | 108 |
1 files changed, 57 insertions, 51 deletions
| @@ -7,40 +7,37 @@ call vundle#begin('~/.vim/plugins/') | |||
| 7 | 7 | ||
| 8 | " Plugin dependant configurations... | 8 | " Plugin dependant configurations... |
| 9 | Plugin 'VundleVim/Vundle.vim' | 9 | Plugin 'VundleVim/Vundle.vim' |
| 10 | Plugin 'cscope_plus.vim' " run cscope -R -b in project folder then use | 10 | Plugin 'cscope_plus.vim' | " run cscope -R -b in project folder then use |
| 11 | Plugin 'autoload_cscope.vim' " CTRL+\ s searches word under cursor, CTRL+T back | 11 | Plugin 'autoload_cscope.vim' | " CTRL+\ s searches word under cursor, CTRL+T back |
| 12 | Plugin 'tpope/vim-fugitive' " the most complete GIT integration plugin | 12 | Plugin 'tpope/vim-fugitive' | " the most complete GIT integration plugin |
| 13 | Plugin 'taglist-plus' " quick code navigator | 13 | Plugin 'taglist-plus' | " quick code navigator |
| 14 | let Tlist_Compact_Format = 1 | 14 | let Tlist_Compact_Format = 1 | " |
| 15 | let Tlist_GainFocus_On_ToggleOpen = 1 | 15 | let Tlist_GainFocus_On_ToggleOpen = 1 | " |
| 16 | let Tlist_Close_On_Select = 1 | 16 | let Tlist_Close_On_Select = 1 | " |
| 17 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion | 17 | Plugin 'Valloric/YouCompleteMe' | " syntax checker and code completion |
| 18 | let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path | 18 | let g:ycm_global_ycm_extra_conf = '' | " fallback, right one should be in the applications path |
| 19 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' | 19 | let g:ycm_confirm_extra_conf = 0 | " disable 'do you really want to execute .py?' |
| 20 | let g:ycm_key_select_completion = '<Tab>' | " key completion key | 20 | let g:ycm_key_select_completion = '<Tab>' | " key completion key |
| 21 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar | 21 | let g:ycm_error_symbol = '✖' | " insert this as an error symbol in the gutter bar |
| 22 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar | 22 | let g:ycm_warning_symbol = '➔' | " insert this as a warning symbol in the gutter bar |
| 23 | let g:ycm_collect_identifiers_from_tags_files = 1 | " | 23 | let g:ycm_collect_identifiers_from_tags_files = 1 | " |
| 24 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode | 24 | let g:ycm_autoclose_preview_window_after_insertion=1 | " close the window when leaving insert mode |
| 25 | inoremap <buffer> ( <C-X><C-o>( | 25 | "let g:ycm_semantic_triggers = {'c' : ['(', ',']} | " add additional triggers (not recommend) |
| 26 | "if !exists("g:ycm_semantic_triggers") | 26 | |
| 27 | " let g:ycm_semantic_triggers = {} | 27 | let b:html_omni_flavor='xhtml' | " prever xhtml over html because that makes inline php code possible without hassle |
| 28 | "endif | ||
| 29 | "let g:ycm_semantic_triggers['c'] = ['('] | " | ||
| 30 | |||
| 31 | 28 | ||
| 32 | call vundle#end() | " required | 29 | call vundle#end() | " required |
| 33 | filetype plugin indent on | " required | 30 | filetype plugin indent on | " required |
| 34 | |||
| 35 | "================================================================================ | 31 | "================================================================================ |
| 36 | " custom config | 32 | " custom config |
| 33 | scriptencoding utf-8 | " tell vim that we are using utf-8 here | ||
| 37 | 34 | ||
| 38 | set noswapfile | " noundofile, nobackup, nowritebackup | 35 | set noswapfile | " noundofile, nobackup, nowritebackup |
| 39 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory | 36 | set backupdir=~/.vim/temp | " using :set backup will copy current file to this directory |
| 40 | set directory=~/.vim/temp | " | 37 | set directory=~/.vim/temp | " |
| 41 | set undodir=~/.vim/temp | " | 38 | set undodir=~/.vim/temp | " |
| 42 | 39 | ||
| 43 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like | 40 | set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) |
| 44 | set autoindent | " always set autoindenting on | 41 | set autoindent | " always set autoindenting on |
| 45 | set copyindent | " copy the previous indentation on autoindenting | 42 | set copyindent | " copy the previous indentation on autoindenting |
| 46 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) | 43 | set scrolloff=2 | " always keeps at least two lines visible (when seeking) |
| @@ -51,15 +48,24 @@ set whichwrap=b,s,<,>,[,] | " beyond beginning/end line causes cusor to wrap | |||
| 51 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap | 48 | set backspace=indent,eol,start| " allow backspacing over everything in insert mode, not needed with whichwrap |
| 52 | set diffopt+=iwhite,filler | " lets diff ignore white spaces | 49 | set diffopt+=iwhite,filler | " lets diff ignore white spaces |
| 53 | set spell| set spelllang=en,de| " enable spell checker | 50 | set spell| set spelllang=en,de| " enable spell checker |
| 54 | set showcmd | " displays status line messages while selecting (matrix size) | 51 | set virtualedit=onemore " one character beyond the line length should be navigatable (options: all,insert,block,onemore) |
| 55 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews | 52 | set breakindent cpoptions+=n | " when wrapping lines indent wrapped line to align with the previews |
| 56 | set linebreak | " do not wrap in the middle of words | 53 | set linebreak | " do not wrap in the middle of words |
| 57 | set showbreak=› | " symbol used in the beginning of a wrapped line | 54 | set showcmd | " displays status line messages while selecting (matrix size) |
| 58 | set listchars=tab:▸\ ,eol:¬ | " symbols used when using :set list (which displays non-printable chars) | 55 | set nofoldenable | " do not fold code automatically |
| 56 | set tags+=~/.vim/systags | " ctags -R -f ~/.vim/systags /usr/include /usr/local/include | ||
| 59 | 57 | ||
| 58 | set encoding=utf-8 | " we need default utf-8 encoding to use cool chars as line break and so on (see below) | ||
| 59 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 60 | set listchars=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 61 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 62 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 63 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 64 | set listchars+=tab:▸\ | " symbols used when using :set list (which displays non-printable chars) | ||
| 60 | 65 | ||
| 61 | set virtualedit=onemore " one character beyond the line length should be navigatable (options: all,insert,block,onemore) | 66 | |
| 62 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line:w | 67 | nnoremap $ g$| " and make the $ key position the cursor after the last char of that line, not before |
| 68 | nnoremap <End> g$| " and make the <End> key position the cursor after the last char of that line | ||
| 63 | 69 | ||
| 64 | " search... | 70 | " search... |
| 65 | set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive | 71 | set ignorecase|set smartcase " if search pattern contains uppercase then search is case sensitive |
| @@ -74,7 +80,7 @@ if has("autocmd") | |||
| 74 | set modeline " set variables specific to a file, like indentation by adding a comment | 80 | set modeline " set variables specific to a file, like indentation by adding a comment |
| 75 | set modelines=3 " how many lines in the beginning and end of the file can be mode lines? | 81 | set modelines=3 " how many lines in the beginning and end of the file can be mode lines? |
| 76 | 82 | ||
| 77 | 83 | ||
| 78 | augroup resCur | " make cursor appear in its previous position when reopening a file... | 84 | augroup resCur | " make cursor appear in its previous position when reopening a file... |
| 79 | "autocmd! | 85 | "autocmd! |
| 80 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | 86 | autocmd BufReadPost * call setpos(".", getpos("'\"")) |
| @@ -121,6 +127,7 @@ if has("gui_running") | |||
| 121 | set guioptions+=e " add tab pages | 127 | set guioptions+=e " add tab pages |
| 122 | set guioptions+=p " use gui pointer callback for x11 | 128 | set guioptions+=p " use gui pointer callback for x11 |
| 123 | set toolbariconsize=large " make the icon toolbar as big as possible | 129 | set toolbariconsize=large " make the icon toolbar as big as possible |
| 130 | |||
| 124 | else | 131 | else |
| 125 | if &term =~? 'mlterm\|xterm\|screen' | 132 | if &term =~? 'mlterm\|xterm\|screen' |
| 126 | set t_Co=256 | " fixes incompatibilities with our color scheme | 133 | set t_Co=256 | " fixes incompatibilities with our color scheme |
| @@ -136,30 +143,34 @@ colorscheme coderonline | |||
| 136 | syntax enable | 143 | syntax enable |
| 137 | 144 | ||
| 138 | "================================================================================ | 145 | "================================================================================ |
| 139 | " plugin hotkeys | 146 | " custom commands... |
| 140 | nnoremap <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L | 147 | map <C-h> <C-w>h|map <C-j> <C-w>j| " window navigation shortcuts |
| 148 | map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcuts | ||
| 141 | 149 | ||
| 142 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | 150 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user |
| 143 | " reacts on CTRL+P, CTRL+Space | ||
| 144 | inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
| 145 | inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | ||
| 146 | inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | ||
| 147 | inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | ||
| 148 | inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" | ||
| 149 | inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" | ||
| 150 | 151 | ||
| 151 | " custom commands... | 152 | " custom hotkeys... |
| 152 | cmap w!! w !sudo tee % >/dev/null| " write :w!! to execute :w as root user | 153 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs |
| 154 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | ||
| 155 | |||
| 156 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines | ||
| 153 | 157 | ||
| 154 | " custom hotkeys... | 158 | " plugin hotkeys |
| 155 | nnoremap <C-Tab> :tabnext<CR>| " lets one use CTRL+Tab to switch between tabs | 159 | map <C-l> :TlistToggle<CR>| " bind TagList to Hotkey Ctrl+L |
| 156 | nnoremap <C-S-Tab> :tabprevious<CR>| " use CTRL+Shift+Tab to switch to preview tab | 160 | inoremap <buffer> ( <C-X><C-o><C-p>(| " when opening a bracket: call the OmniComplete function, display the menu, but deselect the first entry (C-p) |
| 157 | nnoremap j gj|nnoremap k gk| " do not jump over wrapped lines... | ||
| 158 | map <C-h> <C-w>h|map <C-j> <C-w>j|map <C-k> <C-w>k|map <C-l> <C-w>l| " window navigation shortcut | ||
| 159 | 161 | ||
| 160 | 162 | ||
| 161 | "================================================================================ | 163 | "================================================================================ |
| 162 | " deactivated on-demand commands (just in case one needs them one day) | 164 | " deactivated on-demand commands (just in case one needs them one day) |
| 165 | " | ||
| 166 | " code completion: http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | ||
| 167 | " reacts on CTRL+P, CTRL+Space | ||
| 168 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | ||
| 169 | "inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | ||
| 170 | "inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>" | ||
| 171 | "inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>" | ||
| 172 | "inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>" | ||
| 173 | "inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>" | ||
| 163 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background | 174 | " set guiheadroom=0| " do not fill non-functional area of the empty editor with gtk background |
| 164 | " map shift-right to visually select and so on | 175 | " map shift-right to visually select and so on |
| 165 | "nnoremap <C-Right> El | 176 | "nnoremap <C-Right> El |
| @@ -176,12 +187,7 @@ map <C-h> <C-w>h|map <C-j> <C-w>j|map <C-k> <C-w>k|map <C-l> <C-w>l| " window na | |||
| 176 | "nnoremap <C-S-Tab> <C-PageUp> | 187 | "nnoremap <C-S-Tab> <C-PageUp> |
| 177 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | 188 | ":inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" |
| 178 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode | 189 | "map <Esc>OA k|map <Esc>OB j|map <Esc>OC l|map <Esc>OD h| " allow cursor keys in insert mode |
| 179 | " | ||
| 180 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! | 190 | "inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>" " breaks cursor keys! |
| 181 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) | 191 | " binding ESC can easily break cursor key movement on the console (tricky, because gvim works) |
| 182 | " | ||
| 183 | " | ||
| 184 | " | ||
| 185 | |||
| 186 | "inoremap <C-Space> <C-x><C-o> | 192 | "inoremap <C-Space> <C-x><C-o> |
| 187 | "inoremap <C-@> <C-Space> | 193 | "inoremap <C-@> <C-Space> |
