-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
297 lines (228 loc) · 8.3 KB
/
vimrc
File metadata and controls
297 lines (228 loc) · 8.3 KB
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
" noncompatible with vi
set nocompatible
" ==========================================================
" Vundle
" ==========================================================
filetype off " necessary for Vundle to work
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'jmcantrell/vim-virtualenv'
Plugin 'davidhalter/jedi-vim'
Plugin 'andviro/ropevim-bundled'
call vundle#end()
" ==========================================================
" Basic Settings
" ==========================================================
" set correct filetypes
autocmd BufRead,BufNewFile *.md,*markdown
\ setlocal filetype=markdown
" syntax highlighting
syntax on
" umoznit nacteni odsazovaciho souboru pro dany typ souboru
filetype plugin indent on
" disable backup and swap files
set nobackup
set noswapfile
" show what is typing as a command
set showcmd
" Rebind <Leader> key
" leader key - nastaveni klavesy na dodatecne custom mapovaci zkratky, protoze ve vimu uz je jich spousta vycerpana
let mapleader=","
" indenting automatically
set autoindent
" tab is 4 spaces wide
set tabstop=4
" use spaces, not tabs, for autoindent/tab key
set expandtab
" indent level is 4 spaces wide
set shiftwidth=2
" width of space used by <TAB> and <BS> keys
set softtabstop=2
" use 4 spaces for indentation in source codes of some languages
autocmd FileType python,java,c setlocal softtabstop=4 shiftwidth=4
" round indent to a multiple of shiftwidth
set shiftround
" handle tabs more intelligently
set smarttab
" but do not be to much intelligent in tex files
autocmd FileType tex setlocal nosmarttab
" no wrapping, let the line crawl out of page
set nowrap
" wrap on whitespace and some other characters (!@*-+;:,./?)
set linebreak
" auto-wrap comments (c), allow formatting command gq (q),
" remove comment leader when joint two comment lines (j)
autocmd BufNewFile,BufRead * setlocal formatoptions=cqj
" note: it is necessary to set it this way, otherwise it would be overwriten
" Copying and pasting
" use system clipboard for pasting
set clipboard=unnamedplus
" other clipboards
" usage: "[a-z]y for copy to one of the clipboards a - z
" "[a-z]p for paste
" when a tab is closed, remove the buffer
set nohidden
" mouse
set mouse=a " enable mouse
" easier moving code blocks
vnoremap < <gv
vnoremap > >gv
" keep 3 context lines above and below the cursor
set scrolloff=3
" wildmenu
set wildmenu
set wildignore=*.o,*.obj,*.swp,*~,*.pyc
" on 1st TAB complete the longest common prefix, on next TABs complete the next full option
set wildmode=longest:full,full
" shorten some messages (to avoid 'hit ENTER messages' when message is too long)
set shortmess=aItT
" length of command line history
set history=100
" trailing whitespace when saving
" autocmd BufWritePre * :%s/\s\+$//e
" Let cursor move past the last char in <C-v> mode
set virtualedit=block
" line numbers
set number " display line numbers
set numberwidth=2 " using at least 2 columns (+ 1 space) for number column
"" automatically reload _vimrc on save
autocmd! bufwritepost _vimrc source %
" ==========================================================
" Source code settings
" ==========================================================
" Allow visual break on ony character (nolinebreak).
" Highlight 80th column and set textwidth to 79 (important e.g. for comments
" to automatically break).
autocmd FileType python,java,javascript,haskell
\ setlocal nolinebreak
\ | setlocal colorcolumn=80
\ | setlocal textwidth=79
" Note: comments can be aligned properly using 'gq' command.
" Latex settings
let Tex_AutoFolding = 0
" ==========================================================
" Search
" ==========================================================
set ignorecase " Default to using case insensitive searches,
set smartcase " unless uppercase letters are used in the regex.
set incsearch " Incrementally search while typing a /regex
" experimentalne: zvyraznovani vyhledavani
set hlsearch " Highlight searches by default.
"Turn off highlighting on entering insert mode
nnoremap i :noh<CR>i
"Experimental : Turn off highlighting on pressing <enter>
nnoremap <CR> :noh<CR>
"Experimental : very magic search by defaut
:nnoremap / /\v
:cnoremap %s/ %s/\v
" ==========================================================
" Mappings
" ==========================================================
" remap qq to escape from insert mode
inoremap kj <Esc>
" navigating through splits with CTRL+j/k/l/m
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" make Y behave like other capitals, i.e. copy to the end of the line
map Y y$
" improve up/down movement on wrapped lines
nnoremap j gj
nnoremap k gk
" ==========================================================
" Commands
" ==========================================================
" show whitespace (tabes and new lines)
nmap <leader>i :set list!<CR>
" ==========================================================
" File Execution/Compilation (F5)
" ==========================================================
" Python: save and execute
autocmd FileType python map <buffer> <f5> <cr>:!python %<cr>
" AsciiDoc: save and convert to PDF
autocmd FileType asciidoc map <buffer> <f5> :w<cr>:!a2pdf %<cr>
" set asciidoc highlighing
autocmd BufRead,BufNewFile *.ad set filetype=asciidoc
"" LaTeX: call make (cc -> show the first error or No errors message)
"autocmd FileType tex map <buffer> <f5> :w<cr>:silent make\|redraw!\|cw<cr>
" ==========================================================
" Solarized + theme options
" ==========================================================
set background=dark
colorscheme delek
" highlight current line
set cursorline
hi CursorLine term=bold cterm=bold
hi DiffText ctermbg=2
" toggle light and dark background with F4
call togglebg#map("<F4>")
" ==========================================================
" AirLine
" ==========================================================
" display all the time
set laststatus=2
" set symbols
let g:airline_powerline_fonts = 0
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.branch = ''
"let g:airline_symbols.paste = 'ρ'
"let g:airline_symbols.whitespace = 'Ξ'
" use solarized color theme
let g:airline_theme = 'sol'
" top line (for tabs and buffers)
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#show_buffers = 1
let g:airline#extensions#tabline#buffer_min_count = 2
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
" :tabe - otevrit v nove zalozce soubor
" gt - posune se na dalsi zalozku
" 4gt - posune se na ctvrtou zalozku
" :exit - zavre zalozku
" to avoid pause when leaving insert mode
set ttimeoutlen=50
" integration of other plugins
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#virtualenv#enabled = 1
let g:airline#extensions#branch#enabled = 1
" ==========================================================
" NerdTree
" ==========================================================
map <C-n> :NERDTreeToggle<CR>
" ==========================================================
" Syntastic
" ==========================================================
" Python Checkers
let g:syntastic_python_checkers = ['pylint']
" write errors to loc list
"let g:syntastic_always_populate_loc_list = 1
" location list can be populated explicitly by :Errors
" jump automatically to first error
" let g:syntastic_auto_jump=1
" jump to next error
map <leader>e :lnext<CR>
" jump to previous error
map <leader>p :lprev<CR>
" ignore some messages (note: can be set in ~/.pylintrc)
" F403 = 'from foo import *' used
" E265 = block comment should start with '# '
" E501 = line too long
"let g:syntastic_python_pylint_args = '--disable="F403,E265,E501"'
"" messages filtering
"let g:syntastic_rst_rst2pseudoxml_quiet_messages = {"regex": "Unknown directive type"}