aboutsummaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authorMax Christian Pohle2017-02-20 03:50:37 +0100
committerMax Christian Pohle2017-02-20 03:50:37 +0100
commit4d4cc837bbf0cbfe35ff4ec642d7c6bafb3a3fe6 (patch)
tree2e7ff215da79698af9aa8011f1ccc32aba963575 /vimrc
parent0b2a2635c3ba74a73ca417fc8c4251134ca255fd (diff)
downloadvim-karlmarks-4d4cc837bbf0cbfe35ff4ec642d7c6bafb3a3fe6.tar.bz2
vim-karlmarks-4d4cc837bbf0cbfe35ff4ec642d7c6bafb3a3fe6.zip
Improved and partly fixed autocompletion
and added some shortcuts
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc135
1 files changed, 110 insertions, 25 deletions
diff --git a/vimrc b/vimrc
index 1e38ac7..5ed666d 100644
--- a/vimrc
+++ b/vimrc
@@ -1,7 +1,14 @@
1" vim: textwidth=160 tabstop=2 shiftwidth=2
2"
3if has('nvim')
4 runtime! python_setup.vim
5endif
6
1call plug#begin() 7call plug#begin()
2 8
9
3" Brilliant_Plugins_by_tpope: ========================. 10" Brilliant_Plugins_by_tpope: ========================.
4Plug 'tpope/vim-sensible' | " a sane and modern default configuration 11" Plug 'tpope/vim-sensible' | " a sane and modern default configuration # not required with nvim
5Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' 12Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
6Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin 13Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
7Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= 14Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
@@ -9,17 +16,30 @@ Plug 'mhinz/vim-signify' | " show changes in the cl
9 16
10 17
11" Colorschemes: ======================================. 18" Colorschemes: ======================================.
19Plug 'ryanoasis/vim-devicons' | " eye candy icons
12Plug 'chriskempson/base16-vim' | " 20Plug 'chriskempson/base16-vim' | "
13map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. 21map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
14 22
15 23
24" NETRW: =============================================.
25let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
26let g:netrw_hide = 1 | " show not-hidden files only
27let g:netrw_liststyle = 3 | " 3=tree
28let g:netrw_banner = 0 | " display help messages?
29let g:netrw_winsize = 20 | " window size in percent
30let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
31let g:netrw_keepdir = 0
32let g:netrw_browse_split = 4 | " 4=open in previous window
33let g:netrw_preview = 0 | "
34let g:netrw_alto = 0 | " open files on the right
35let g:netrw_altv = 1 | " open files on the right
36
16" NERDTree: ==========================================. 37" NERDTree: ==========================================.
17Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy 38Plug 'scrooloose/nerdtree' | " replace NetRW, which is kind of buggy
18let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory 39let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
19set winwidth=30 " keep NERDTreeWindow at least this size 40set winwidth=30 " keep NERDTreeWindow at least this size
20set winminwidth=30 " (and all other windows, so TODO: watch out) 41set winminwidth=30 " (and all other windows, so TODO: watch out)
21 42
22autocmd BufEnter * lcd %:p:h
23" depending on if NERDTree has the focus: 43" depending on if NERDTree has the focus:
24nnoremap <expr> 44nnoremap <expr>
25 \ <leader><leader> 45 \ <leader><leader>
@@ -33,6 +53,9 @@ nnoremap <expr>
33" close NERDTree if it is the last remaining window (taken from the official documentation) 53" close NERDTree if it is the last remaining window (taken from the official documentation)
34" autocmd bufenter * 54" autocmd bufenter *
35" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 55" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
56"
57" exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s)
58nnoremap Q !!$SHELL<CR>
36 59
37 60
38" AIRLINE: ===========================================. 61" AIRLINE: ===========================================.
@@ -86,20 +109,28 @@ let g:tagbar_foldlevel = 99
86nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L 109nnoremap <leader>l :TagbarToggle<CR>| " bind TagBar to Hotkey Ctrl+L
87 110
88 111
112
113
89" Autocompleter: =====================================. 114" Autocompleter: =====================================.
90Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... 115Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
91Plug 'Valloric/YouCompleteMe' 116Plug 'Valloric/YouCompleteMe'
92let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file 117let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
118let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
93let g:ycm_complete_in_comments = 1 " Completion in comments 119let g:ycm_complete_in_comments = 1 " Completion in comments
94let g:ycm_complete_in_strings = 1 " Completion in string 120let g:ycm_complete_in_strings = 1 " Completion in string
95let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar 121let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar
96let g:ycm_min_num_of_chars_for_completion = 1 122let g:ycm_min_num_of_chars_for_completion = 1
97let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
98let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure 123let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
99let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar 124let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar
125let g:ycm_confirm_extra_conf = 0 " security is overrated
126let g:ycm_key_list_select_completion = ['<Down>']
127let g:ycm_key_list_previous_completion = ['<Up>']
100" disable <tab>-key for YCM so that it can be used with ultisnips 128" disable <tab>-key for YCM so that it can be used with ultisnips
101" let g:ycm_key_list_select_completion=[] 129" let g:ycm_key_list_select_completion=[]
102" let g:ycm_key_list_previous_completion=[] 130" let g:ycm_key_list_previous_completion=[]
131Plug 'rdnetto/YCM-Generator'
132
133" Plug 'ervandew/supertab'
103 134
104 135
105Plug 'scrooloose/syntastic' 136Plug 'scrooloose/syntastic'
@@ -136,10 +167,25 @@ Plug 'SirVer/ultisnips' " replaces loremipsum (and
136"let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ 167"let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
137"let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ 168"let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
138"let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary 169"let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
139let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. 170" let g:UltiSnipsExpandTrigger = '<leader><tab>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
140let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \ 171" let g:UltiSnipsJumpForwardTrigger = '<PageDown>'| " \
141let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \ 172" let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'| " \
142let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary 173" let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
174
175" UltiSnips triggering
176" let g:UltiSnipsExpandTrigger = "<nop>"
177" let g:ulti_expand_or_jump_res = 0
178" function ExpandSnippetOrCarriageReturn()
179" let snippet = UltiSnips#ExpandSnippetOrJump()
180" if g:ulti_expand_or_jump_res > 0
181" return snippet
182" else
183" return "\<CR>"
184" endif
185" endfunction
186" inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>"
187" set completeopt-=preview
188
143" let g:UltiSnipsEditSplit = 'vertical' 189" let g:UltiSnipsEditSplit = 'vertical'
144 190
145 191
@@ -172,9 +218,25 @@ inoremap
172 218
173noremap <silent> <F5> :make<CR> 219noremap <silent> <F5> :make<CR>
174 220
221" default copy&paste insert key binding (just in insert mode, so it doesn't conflict
222" with visual block mode).
223inoremap <C-V> <C-R>+
224inoremap <C-S> <C-O>:w<CR>
225
226
227
228
229" spell checkers?
230set spell spelllang=en,de | " enable spell checker
231set dictionary=/usr/share/dict/cracklib-small
232set complete+=k " make default completer <C-N> respect the dictionary
175 233
234let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
176 235
177" settings ============================================. 236" settings ============================================.
237"
238" autocmd BufEnter * lcd %:p:h
239set autochdir | " When on, Vim will change the current working directory
178set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here 240set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
179" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END 241" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
180" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text 242" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
@@ -204,17 +266,20 @@ set notimeout ttimeout | " improves performance but is known to cause pro
204set nowrap | " but do not (by default) wrap long lines around 266set nowrap | " but do not (by default) wrap long lines around
205set number | " turn line numbers on/off (performance decreases when they are shown) 267set number | " turn line numbers on/off (performance decreases when they are shown)
206set pumheight=8 | " Determines the maximum number of items to show in the popup menu for 268set pumheight=8 | " Determines the maximum number of items to show in the popup menu for
269set path+=** | " allow recursive searches for files
207set redrawtime=400 | " The time in milliseconds for redrawing the display. 270set redrawtime=400 | " The time in milliseconds for redrawing the display.
208" set restorescreen | " restores the console after exiting vim 271" set restorescreen | " restores the console after exiting vim
272" set shada+=n~/.vim/shada | " shada file to use
209set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge 273set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge
210set spell spelllang=en,de | " enable spell checker
211set splitbelow | " open new windows below the current one (i find that more intuitive) 274set splitbelow | " open new windows below the current one (i find that more intuitive)
275set shiftround | " indent/unindent snaps to multiple of shiftwidth
276set showcmd | " essential: show keys of combined commands in the lower right corner
212" set t_Co=256 | " required on some ssh sessions 277" set t_Co=256 | " required on some ssh sessions
213" set textwidth=100 | " line length (80 used to be default, but...) 278" set textwidth=100 | " line length (80 used to be default, but...)
214set thesaurus+=/home/max/.vim/thesaurus/php.txt 279set thesaurus+=/home/max/.vim/thesaurus/php.txt
215set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth) 280set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth)
216set ttimeoutlen=10 | " set esc key timeout in ms- 281set ttimeoutlen=10 | " set esc key timeout in ms-
217set ttyfast | " improves speed for terminal vim 282" set ttyfast | " improves speed for terminal vim (incomp. with nvim)
218set updatetime=1000 | " updates the screen more often 283set updatetime=1000 | " updates the screen more often
219" set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim 284" set ttyscroll=100 | " improves speed for terminal vim, incomp. with nvim
220set writedelay=0 285set writedelay=0
@@ -243,6 +308,8 @@ if has("gui_running")
243 " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12 308 " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12
244 set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12 309 set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12
245 set guioptions-=e | " do not display tabs 310 set guioptions-=e | " do not display tabs
311 set guioptions-=L | " do not show left scrollbar
312 set guioptions-=r | " do not show right scrollbar
246 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped) 313 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
247endif 314endif
248 315
@@ -316,6 +383,21 @@ if has("autocmd")
316 autocmd VimLeave * silent !echo -ne "\033]112\007" 383 autocmd VimLeave * silent !echo -ne "\033]112\007"
317 augroup END 384 augroup END
318 385
386 augroup ChangeIcon
387 "if filereadable("/usr/bin/xseticon")
388 "if filereadable("~/.vim/nvim.png")
389 autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png"
390 autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png"
391 "endif
392 "endif
393 augroup END
394
395 if has('nvim')
396 else
397 augroup vimonly
398 autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib")
399 augroup END
400 endif
319 "set omnifunc=syntaxcomplete#Complete 401 "set omnifunc=syntaxcomplete#Complete
320 " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main 402 " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
321 " Enable omni completion. 403 " Enable omni completion.
@@ -334,15 +416,29 @@ if has("autocmd")
334 " endif 416 " endif
335endif 417endif
336 418
337 419let &t_Co=256
420set background=dark
421" set termguicolors
338let base16colorspace=256 422let base16colorspace=256
339if filereadable(expand("~/.vimrc_background")) 423if filereadable(expand("~/.vimrc_background"))
340 source ~/.vimrc_background 424 source ~/.vimrc_background
341 set background=light
342else 425else
343 colorscheme base16-phd 426 colorscheme base16-phd
344 set background=dark
345endif 427endif
428
429
430
431
432if !has('nvim')
433 set ttymouse=xterm2
434else
435 " shortcut \t opens a terminal in a horizontal split
436 nnoremap <leader>t :new +terminal<CR>
437endif
438
439
440
441
346" colorscheme base16-embers 442" colorscheme base16-embers
347" colorscheme base16-flat 443" colorscheme base16-flat
348" colorscheme base16-summerfruit-dark 444" colorscheme base16-summerfruit-dark
@@ -380,16 +476,5 @@ endif
380" let g:miniBufExplShowBufNumbers = 0 476" let g:miniBufExplShowBufNumbers = 0
381" let g:miniBufExplSplitToEdge = 1 477" let g:miniBufExplSplitToEdge = 1
382" let g:miniBufExplVSplit = 20 " column width in chars 478" let g:miniBufExplVSplit = 20 " column width in chars
383" NETRW: =============================================. 479
384" Plug 'tpope/vim-vinegar' | " Improves :Explore 480
385" let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
386" let g:netrw_hide = 1 | " show not-hidden files only
387" let g:netrw_liststyle = 3 | " 3=tree
388" let g:netrw_banner = 0 | " display help messages?
389" let g:netrw_winsize = 20 | " window size in percent
390" let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
391" let g:netrw_keepdir = 0
392" let g:netrw_browse_split = 4 | " 4=open in previous window
393" let g:netrw_preview = 0 | "
394" let g:netrw_alto = 0 | " open files on the right
395" let g:netrw_altv = 1 | " open files on the right
..