aboutsummaryrefslogtreecommitdiff
path: root/vimrc
blob: 4f573d4bbe558d2b58102f4af5b6f89759f9aeb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
call plug#begin()

" Brilliant_Plugins_by_tpope: ========================.
Plug 'tpope/vim-sensible'                             | " a sane and modern default configuration
Plug 'tpope/vim-surround'                             | " plugin makes cs"' inside a line replace " with '
Plug 'tpope/vim-vinegar'                              | " Improves :Explore
" Plug 'tpope/vim-characterize'                       | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
" Plug 'tpope/vim-fugitive'                           | " the most complete GIT integration plugin
" Plug 'tpope/vim-repeat'                             | " lets . (dot) repeat plugin macros as well, specifically vim-surround

" Colorschemes: ======================================.
Plug 'nelstrom/vim-mac-classic-theme'                 | " light theme
Plug 'Valloric/vim-valloric-colorscheme'              | "
Plug 'chriskempson/vim-tomorrow-theme'                | "
Plug 'chriskempson/base16-vim'                        | "

" AIRLINE: ===========================================.
Plug 'vim-airline/vim-airline'                        | " beautification of the mode line
let g:airline_detect_modified                    = 0  |
let g:airline_detect_paste                       = 0  |
let g:airline_exclude_preview                    = 1  |
let g:airline_extensions                         = ['tabline']
let g:airline#extensions#tabline#disable_refresh = 1  |
let g:airline#extensions#tabline#enabled         = 1  |
let g:airline#extensions#tabline#fnamemod        = ':t:.' | " let airline just show the filename without its path
let g:airline#extensions#tabline#show_buffers    = 1  |
let g:airline#extensions#tabline#show_tabs       = 0  |
let g:airline#extensions#tagbar#enabled          = 1  |
let g:airline#extensions#tagbar#flags            = 's'
let g:airline#extensions#whitespace#enabled      = 0  |
let g:airline#extensions#wordcount#enabled       = 0  |
let g:airline_inactive_collapse                  = 1  |
let g:airline_powerline_fonts                    = 1  |
let g:airline_section_c                          = '%F'
" AIRLINE_Theme: =====================================.
Plug 'vim-airline/vim-airline-themes'                 | " airline themes to match any light and dark terminal using :AirlineTheme
let g:airline_theme='base16'                          | " specifies which colorscheme should airline uses
" let g:airline_theme='bubblegum'                     | " specifies which colorscheme should airline uses
" let g:airline_theme='dark'                          |
" let g:airline_theme='luna'                          | " specifies which colorscheme should airline uses
" let g:airline_theme='papercolor'                    | " specifies which colorscheme should airline uses
" let g:airline_theme='tomorrow'                      | " specifies which colorscheme should airline uses

" Additional: ========================================.
Plug 'sheerun/vim-polyglot'                           | " better syntax highlighting/indentation for multiple languages
Plug 'taglist-plus'                                   | " quick code navigator

" Autocompleter: =====================================.
Plug 'Valloric/MatchTagAlways'
Plug 'Valloric/YouCompleteMe'
let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
let g:ycm_complete_in_strings = 1 " Completion in string
Plug 'scrooloose/syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:LatexBox_latexmk_preview_continuously = 1
let g:LatexBox_viewer                       = "evince"
let g:syntastic_always_populate_loc_list    = 1
let g:syntastic_auto_loc_list               = 1
let g:syntastic_check_on_open               = 1
let g:syntastic_check_on_wq                 = 0
Plug 'davidhalter/jedi-vim'                           | " jedi gets used to display python function signatures
let g:jedi#completions_enabled              = 0       | " we do not need completions, because we have YouCompleteMe
let g:jedi#show_call_signatures             = 1       | " which sadly does not support signatures like jedi
let g:jedi#show_call_signatures_delay       = 0
let g:jedi#auto_vim_configure               = 0
Plug 'SirVer/ultisnips'                               | " replaces loremipsum (and many more)
Plug 'honza/vim-snippets'                             | " dependency of ultisnips
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
"" Ultisnips
let g:UltiSnipsExpandTrigger="<c-tab>"
let g:UltiSnipsListSnippets="<c-s-tab>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

" Disabled ===========================================.
" Plug 'Shougo/neocomplete.vim'                       | " alternative to YouCompleteMe in some cases
" Plug 'Shougo/vimproc.vim'                           | " dependency for other Shougo plugins
" Plug 'indenthtml.vim'                               | " works better with mixed html/css/javascript
" Plug 'evanmiller/nginx-vim-syntax'                  | " TODO: check if now included in syntastic?

call plug#end()                                       | " all plugins are getting loaded on this line, don't remove!

filetype on
filetype plugin on
filetype indent on
syntax on                     | " enable syntax highlighting
syntax sync minlines=60       | " how many preceding lines will be parsed? (has performance impact)
" set term=xtermc             | " required on solaris

let base16colorspace=256
colorscheme base16-phd
" colorscheme Tomorrow
" colorscheme Tomorrow-Night
" colorscheme Tomorrow-Night
" colorscheme Tomorrow-Night-Blue
" colorscheme Tomorrow-Night-Bright
" colorscheme base16-default-dark
" colorscheme mac_classic       | " finally set which colorscheme to use
" colorscheme pencil
" colorscheme valloric
" colorscheme vividchalk       | " finally set which colorscheme to use

" Shortcut mods =======================================.
inoremap <C-Space> <C-x><C-o>
"inoremap <C-@> <C-Space>
" keep selection when indenting a selected block:
vnoremap < <gv
vnoremap > >gv
nnoremap <C-Tab> :bn<CR>|         " lets one use CTRL+Tab to switch between tabs
nnoremap <C-S-Tab> :bp<CR>|       " use CTRL+Shift+Tab to switch to preview tab
nnoremap <C-l> :TlistToggle<CR>|  " bind TagList to Hotkey Ctrl+L

" settings ============================================.
" set shell=/bin/bash           | " many scripts rely on bash, but its path varies why it is commented out here
set noshowmode                | " because we are using some powerline derivat
set hidden                    | " allows switiching buffers even if the current buffer contains changes (displays +)
set confirm                   | " asks 'do you want to save?'
set t_Co=256                  | " required on some ssh sessions
set ts=2 sts=2 sw=2 expandtab | " indentation which i like (abbr: tabstop, softtabstop, shiftwidth)
set scrolljump=5              | " how many lines get scrolled into view when cursor reaches the screens edge
set encoding=utf-8            | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=)
set ignorecase smartcase      | " search with ignorecase by default, but use case sensitive search when one captical char is contained
set ttimeoutlen=10            | " set esc key timeout in ms-
set notimeout ttimeout        | " improves performance but is known to cause problems on slow terminals
set linebreak                 | " wrap long lines at char 'breakat', not inside words
set nowrap                    | " but do not (by default) wrap long lines around
set clipboard=unnamedplus     | " makes copy and paste work (autoselectplus might work as well)
set nonumber                  | " turn line numbers off (improves performance)
set nocursorline              | " turn visual cursor line off (improves performance)
set nocursorcolumn            | " turn visual cursor column off (improves performance)
set ttyscroll=100               | " improves speed for terminal vim
set ttyfast                   | " improves speed for terminal vim
set lazyredraw                | " disables redraw during macro exectution (improves performance)
set re=1
set relativenumber            | " displays current lines line no as zero point from where relative numbers are getting counted
set nofoldenable              | " disable code folding. I hate code folding
set spell spelllang=en,de     | " enable spell checker
set nostartofline             | " when scrolling: do not move the cursor to column 1
set thesaurus+=/home/max/.vim/thesaurus/php.txt



set splitbelow                | " open new windows below the current one (i find that more intuitive)
set laststatus=2
set nocursorcolumn
set nocursorline
set norelativenumber
set writedelay=0

if has("multi_byte")
  set encoding=utf-8          | " we need default utf-8 encoding to use cool chars as line break and so on (see below)
  scriptencoding utf-8        | " tell vim that we are using utf-8 here
  set showbreak+=| " symbol used in the beginning of a wrapped line
  set listchars=eol:| " symbols used when using :set list (which displays non-printable chars)
  set listchars+=trail:·      | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=precedes:«   | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=extends:»    | " symbols used when using :set list (which displays non-printable chars)
  set listchars+=tab:▸\       | " symbols used when using :set list (which displays non-printable chars)
end

if has("gui_running")
  set guioptions+=eig
  set guioptions-=T           | " toolbar
  set guioptions+=c           | " use console dialogs instead of popups
  set guioptions+=a           | " autoselect: copy&paste using middleclick
  set guioptions-=m           | " remove menu
  " set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 12
  set guifont=Dejavu\ Sans\ Mono\ for\ Powerline\ 12
  set guioptions-=e           | " do not display tabs
endif

if bufname('%') == ''
  set bufhidden=wipe
endif

noautocmd

if has("autocmd")
  set modeline                | " set variables specific to a file, like indentation by adding a comment
  " set default completion function in case YouCompleteMe cannot help
  set omnifunc=syntaxcomplete#Complete

  " automatically reload this file when it gets edited
  augroup reload_vimrc " {
    autocmd!
    autocmd BufWritePost $MYVIMRC source $MYVIMRC
  augroup END " }

  augroup remove_whitespaces " {
    " automatically remove trailing white spaces on save..
    autocmd BufWritePre * %s/\s\+$//e
  augroup END " }

  augroup set_window_title " {
    " autocmd BufWinEnter quickfix setl statusline=%t
    autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"


    " set window title for screen(3)
    if &term == "screen"
      set t_ts=k
      set t_fs=\
    endif
    if &term == "screen" || &term == "xterm"
      set title
    endif
  augroup END

  augroup visual_mode_shows_unprintable " {
    set list                      | " shows unprinable characters in the current line
    autocmd ColorScheme * highlight NonText ctermbg=0 guifg=#061229
    "
    "
    " highlight NonText guifg=#1d1f21 | " make non printable chars invisible. The active line is an exception.
    " highlight ColorColumn guibg=#005f87
    " highlight ColorColumn guibg=#F0F0E0
  augroup END " }
  "set omnifunc=syntaxcomplete#Complete
  " au BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
  " Enable omni completion.
  " autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  " autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  " auto complete closing tag name when entering </-[space]
  " autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
  " autocmd FileType python setlocal omnifunc=jedi#completions
  " following autocommands are there to call neovim functions...
  " autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  " autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  " autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  " " Enable heavy omni completion.
  " if !exists('g:neocomplete#sources#omni#input_patterns')
  "   let g:neocomplete#sources#omni#input_patterns = {}
  " endif
endif








" if filereadable(expand("~/.vimrc_background"))
"   let base16colorspace=256
"   source ~/.vimrc_background
" endif
" set colorcolumn=80            | " show an indicator (different background in column 80)
" set title
" set t_ts=^[k
" set t_fs=^[\
" auto BufEnter * :set title | let &titlestring = 'v:' . expand('%')
" auto VimLeave * :set t_ts=^[k^[\
"
" ALTERNATIVE:                                        |
" LightLine_and_MiniBufExplorer: =====================.
" Plug 'itchyny/lightline.vim'
" let g:lightline = {
"       \ 'colorscheme': 'PaperColor',
"       \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
"       \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
"       \ }
" Plug 'fholgado/minibufexpl.vim'
" let g:miniBufExplAutoStart = 1
" let g:miniBufExplBRSplit = 1
" let g:miniBufExplShowBufNumbers = 0
" let g:miniBufExplSplitToEdge = 1
" let g:miniBufExplVSplit = 20   " column width in chars
..