-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
349 lines (291 loc) · 11.5 KB
/
.vimrc
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
set nocompatible " be iMproved, required
filetype off " required
"=====================================================
" Vundle settings
"=====================================================
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim' " let Vundle manage Vundle, required
"---------=== Code/project navigation ===-------------
Plugin 'scrooloose/nerdtree' " A tree explorer plugin for vim
Plugin 'Shougo/unite.vim' " Navigation between buffers and files
Plugin 'majutsushi/tagbar' " Class/module browser
"------------------=== Other ===----------------------
Plugin 'bling/vim-airline' " lean & mean status/tabline for vim that's light as air
Plugin 'fisadev/FixedTaskList.vim' " Pending tasks list
Plugin 'rosenfeld/conque-term' " Consoles as buffers
Plugin 'tpope/vim-surround' " Parentheses, brackets, quotes, XML tags, and more
"--------------=== Snippets support ===---------------
Plugin 'garbas/vim-snipmate' " Snippets manager
Plugin 'MarcWeber/vim-addon-mw-utils' " Dependencies #1
Plugin 'tomtom/tlib_vim' " Dependencies #2
Plugin 'honza/vim-snippets' " Snippets repo
"---------------=== Languages support ===-------------
Plugin 'scrooloose/syntastic' " Syntax checking plugin for Vim
Plugin 'tpope/vim-commentary' " Comment stuff out
Plugin 'mitsuhiko/vim-sparkup' " Sparkup (XML/jinja/htlm-django/etc.) support
" --- Clojure ---
" Plugin 'tpope/vim-fireplace' " Clojure completion
" Plugin 'guns/vim-clojure-highlight' " Highlighting code
" Plugin 'guns/vim-clojure-static' " Highlighting for static types
" --- Erlang ---
" Plugin 'jimenezrick/vimerl' " The Erlang plugin for Vim
" --- CSS ---
" Plugin 'JulesWang/css.vim' " CSS syntax file
" Plugin 'groenewege/vim-less' " Vim syntax for LESS (dynamic CSS)
" --- JavaScript ---
" Plugin 'pangloss/vim-javascript' " Vastly improved Javascript indentation and syntax support in Vim
" --- HTML ---
" Plugin 'othree/html5.vim' " HTML5 omnicomplete and sytnax
" Plugin 'idanarye/breeze.vim' " Html navigation like vim-easymotion, tag matching, tag highlighting and DOM navigation
" --- Python ---
Plugin 'davidhalter/jedi-vim' " Awesome Python autocompletion with VIM
Plugin 'klen/python-mode' " Vim python-mode. PyLint, Rope, Pydoc, breakpoints from box
Plugin 'mitsuhiko/vim-jinja' " Jinja support for vim
Plugin 'mitsuhiko/vim-python-combined' " Combined Python 2/3 for Vim
Plugin 'hynek/vim-python-pep8-indent' " PEP8 indent
Plugin 'jmcantrell/vim-virtualenv' " Virtualenv support in VIM
" --- Rust ---
" Plugin 'rust-lang/rust.vim' " Vim support for Rust file detection and syntax highlighting
" Plugin 'phildawes/racer' " Rust code completion in vim via racer
" Plugin 'timonv/vim-cargo' " Simple vim command bindings to quickly run cargo stuff from vim
call vundle#end() " required
filetype on
filetype plugin on
filetype plugin indent on
"=====================================================
" General settings
"=====================================================
set backspace=indent,eol,start
" This must happen before the syntax system is enabled
aunmenu Help.
aunmenu Window.
let no_buffers_menu=1
set mousemodel=popup
" Activate a permanent ruler and add line highlightng as well as numbers.
" Also disable the sucking pydoc preview window for the omni completion
" and highlight current line and disable the blinking cursor.
set ruler
set completeopt-=preview
set gcr=a:blinkon0
if has("gui_running")
set cursorline
endif
set ttyfast
colorscheme jellybeans
" set guifont=Consolas:h13
" set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12
" Enable Syntax Colors
" in GUI mode we go with fruity and Monaco 13
" in CLI mode myterm looks better (fruity is GUI only)
syntax on
" if has("gui_running")
" set macmeta
" set lines=50 columns=125
" endif
" special settings for vim
" if has("mac")
" let macvim_hig_shift_movement = 1
" endif
tab sball
set switchbuf=useopen
" Use system clipboard
set clipboard=unnamedplus
" Customize the wildmenu
set wildmenu
set wildignore+=*.dll,*.o,*.pyc,*.bak,*.exe,*.jpg,*.jpeg,*.png,*.gif,*$py.class,*.class,*/*.dSYM/*,*.dylib
set wildmode=list:full
" Don't bell and blink
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
set enc=utf-8 " utf-8 default encoding
set ls=2 " always show status bar
set incsearch " incremental search
set hlsearch " highlighted search results
set nu " line numbers
set scrolloff=5 " keep some more lines for scope
set showmatch " show matching brackets/parenthesis
set matchtime=0 " don't blink when matching
" Swaps and backups
if has("win32") || has("win64")
set dir=$TMP
set backupdir=$TMP
else
set dir=/tmp
set backupdir=/tmp
endif
" Hide some panels
"set guioptions-=m " remove menu bar
set guioptions-=T " remove toolbar
"set guioptions-=r " remove right-hand scroll bar
" Tab Settings
set smarttab
set tabstop=8
" Highlight characters past column 120
augroup vimrc_autocmds
autocmd!
autocmd FileType ruby,python,javascript,c,cpp highlight Excess ctermbg=DarkGrey guibg=#c12a0f
autocmd FileType ruby,python,javascript,c,cpp match Excess /\%80v.*/
autocmd FileType ruby,python,javascript,c,cpp set nowrap
augroup END
" SnipMate settings
let g:snippets_dir = "~/.vim/vim-snippets/snippets"
"NERDTree
map <F1> :NERDTreeToggle<CR> " browse the list of files in the current directory
" Unite settings
nnoremap <F2> :Unite buffer<CR> " browse a list of the currently opened buffers
" TaskList settings
map <F3> :TaskList<CR> " show pending tasks list
" TagBar settings
map <F4> :TagbarToggle<CR>
let g:tagbar_autofocus = 0 " autofocus on Tagbar open
" ConqueTerm
nnoremap <F5> :ConqueTermSplit ipython<CR> " run python-scripts at <F5>
nnoremap <F6> :exe "ConqueTermSplit ipython " . expand("%")<CR> " and debug-mode for <F6>
let g:ConqueTerm_StartMessages = 0
let g:ConqueTerm_CloseOnEnd = 0
" Jedi-vim
let g:jedi#show_call_signatures = 0 " Show call signatures
let g:jedi#popup_on_dot = 1 " Enable autocomplete on dot
let g:jedi#popup_select_first = 0 " Disable first select from auto-complete
" Syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_enable_signs = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
noremap <f7> :w<CR>:SyntasticCheck<CR>
" Better :sign interface symbols
let g:syntastic_error_symbol = 'X'
let g:syntastic_style_error_symbol = 'X'
let g:syntastic_warning_symbol = 'x'
let g:syntastic_style_warning_symbol = 'x'
" Vim-Airline
let g:airline_theme='dark'
"=====================================================
" Python-mode settings
"=====================================================
" Python-mode
" Activate rope
" Keys:
" K Show python docs
" <Ctrl-Space> Rope autocomplete
" <Ctrl-c>g Rope goto definition
" <Ctrl-c>d Rope show documentation
" <Ctrl-c>f Rope find occurrences
" <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
" [[ Jump on previous class or function (normal, visual, operator modes)
" ]] Jump on next class or function (normal, visual, operator modes)
" [M Jump on previous class or method (normal, visual, operator modes)
" ]M Jump on next class or method (normal, visual, operator modes)
let g:pymode_rope = 0
" Documentation
let g:pymode_doc = 0
let g:pymode_doc_key = 'K'
"Linting
let g:pymode_lint = 1
let g:pymode_lint_checkers = ['pylint', 'pep8']
let g:pymode_lint_cwindow = 1
let g:pymode_lint_ignore="E501,W601,C0110,C0111"
let g:pymode_lint_write = 0
" Support virtualenv
let g:pymode_virtualenv = 1
" Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
" Syntax highlighting
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
" Don't autofold code
let g:pymode_folding = 0
" Get possibility to run Python code
let g:pymode_run = 0
" Other options
let g:pymode_options_colorcolumn = 1
" if has("gui_running")
" let g:airline_powerline_fonts = 1
"else
let g:airline_powerline_fonts = 1
" endif
"=====================================================
" User hotkeys
"=====================================================
" Easier moving of code blocks
vnoremap < <gv " Shift+> keys
vnoremap > >gv " Shift+< keys
" Backspace in Visual mode deletes selection
vnoremap <BS> d
" CTRL-Z is Undo
noremap <C-z> u
inoremap <C-z> <C-O>u
" CTRL-Y is Redo
noremap <C-y> <C-R>
inoremap <C-y> <C-O><C-R>
" CTRL-A is Select all
noremap <C-a> gggH<C-O>G
inoremap <C-a> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-a> <C-C>gggH<C-O>G
onoremap <C-a> <C-C>gggH<C-O>G
snoremap <C-a> <C-C>gggH<C-O>G
xnoremap <C-a> <C-C>ggVG
" CTRL-S is Quicksave command
noremap <C-s> :update<CR>
vnoremap <C-s> <C-C>:update<CR>
inoremap <C-s> <C-O>:update<CR>
" Settings for buffers
map <C-q> :bd<CR> " close current buffer
noremap <C-Right> :bn<CR> " move to next buffer
noremap <C-Left> :bp<CR> " move to previous buffer
" Easier split navigations
nnoremap <C-j> <C-w><C-j>
nnoremap <C-k> <C-w><C-k>
nnoremap <C-l> <C-w><C-l>
let g:syntastic_c_include_dirs = ['include', '../include']
let g:syntastic_c_compiler = 'clang'
let python_highlight_exceptions=0
let python_highlight_builtins=0
let python_slow_sync=1
autocmd FileType python setlocal completeopt-=preview
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
\ formatoptions+=croq softtabstop=4 smartindent
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd FileType pyrex setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4 smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
let g:syntastic_python_checkers = ['flake8', 'python']
let g:syntastic_python_flake8_args='--ignore=E121,E128,E711,E301,E261,E241,E124,E126,E721
\ --max-line-length=80'
" --- Rust ---
" set hidden
" let $RUST_SRC_PATH = "/Users/savicvalera/rust/src"
" let g:racer_cmd = "/Users/savicvalera/racer/target/release/racer"
" autocmd BufRead,BufNewFile *.rs set filetype=rust
" autocmd FileType rust setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4
" autocmd FileType rust setlocal commentstring=//\ %s
" --- Vim ---
autocmd FileType vim setlocal expandtab shiftwidth=2 tabstop=8 softtabstop=2
" --- template language support (SGML / XML too) ---
" autocmd FileType xml,html,htmljinja,htmldjango setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" autocmd FileType html,htmljinja,htmldjango imap <buffer> <c-e> <Plug>SparkupExecute
" autocmd FileType html,htmljinja,htmldjango imap <buffer> <c-l> <Plug>SparkupNext
" autocmd FileType htmljinja setlocal commentstring={#\ %s\ #}
" let html_no_rendering=1
" let g:syntastic_html_checkers = []
"=====================================================
" User functions
"=====================================================
" Small helper that inserts a random uuid4
" ----------------------------------------
function! InsertUUID4()
python << endpython
if 1:
import uuid, vim
s = str(uuid.uuid4())
cpos = vim.current.window.cursor
cline = vim.current.line
vim.current.line = cline[:cpos[1] + 1] + s + cline[cpos[1] + 1:]
vim.current.window.cursor = (cpos[0], cpos[1] + len(s))
endpython
endfunction
highlight ColorColumn ctermbg=8