-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
executable file
·438 lines (342 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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
" An example for a vimrc file.
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" ========== Vim Basic Settings ============="
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
set modelines=0
" ========== Vundle settings ================"
"let s:vundlerc = expand($HOME . '/.vim/vundle.vimrc')
"if filereadable(s:vundlerc)
" exec ':so ' . s:vundlerc
"endif
" ========== Plug settings ================"
let s:plugrc = expand($HOME . '/.vim/plug.vimrc')
if filereadable(s:plugrc)
exec ':so ' . s:plugrc
endif
" add numbers at left of the buffer
set number
set relativenumber
" set backup and swap options
set nobackup " back up current file, delete afterwards
set writebackup " back up current file, delete afterwards
set backupdir=~/.vim/tmp,/tmp,. " backups directory
set dir=~/.vim/tmp,/tmp,. " swap directory
" set encodig for new files
set encoding=utf-8
" minimum number of screen lines above and below the cursor
set scrolloff=3
" Accerelate things up when working on a gnome-terminal
set scrolljump=5
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=100 " keep 100 lines of command line history
set matchpairs+=<:> " match to be used witrh %
" ruler bar options
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set laststatus=2
set ttyfast "enable fast scrolling
"activate the show mode
set showmode
" search options
set ignorecase
set smartcase " if the search string has a upper case character do the search case sensitive
set incsearch " do incremental searching
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" tab space configuration
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" html space configuration
autocmd Filetype html setlocal ts=2 sts=2 sw=2
set nowrap
"set undofile
set shell=/bin/bash
set lazyredraw
set matchtime=3
"Changing Leader Key
let mapleader = ","
" Set title to window
set title
" Dictionary path, from which the words are being looked up.
set dictionary=/usr/share/dict/words
" Make pasting done without any indentation break."
set pastetoggle=<F3>
" Make Vim able to edit corntab fiels again.
set backupskip=/tmp/*,/private/tmp/*"
" Mouse support even on terminals (in all modes)
set mouse=a
if has("mouse_sgr")
set ttymouse=sgr
else
set ttymouse=xterm2
end
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Hack for desabling bells and flashes.
autocmd VimEnter * set vb t_vb=
" search column 80 characters and highlight them
autocmd BufNewFile,BufRead,WinEnter,BufEnter,FileType python,*.py,javascript,*.js,c,*.c,cpp,*.cpp,*.m,objc,*.h,cs,*.cs,*.md let w:m2=matchadd('ErrorMsg', '\%<81v.\%>80v', -1)
" Compiler profile for c#
au FileType cs compiler gmcs
" we don't need matlab so associate *.m files with Objective-C syntax
" highlighting
let filetype_m='objc'
"au BufNewFile,BufRead *.m setf objc
" correcting the filetype for html filier
autocmd FileType html set ft=htmldjango.html " For SnipMate
autocmd FileType htmldjango set ft=htmldjango.html " For SnipMate
" Don't use Ex mode, use Q for formatting
map Q gq
" jquery.vim syntax
" au BufRead,BufNewFile *.js set ft=javascript syntax=jquery
" Golang slide filetype
au BufRead,BufNewFile *.slide set ft=slide
" GUI options
if has("gui_running")
set guifont=Monospace\ 12
let g:winManagerWindowLayout = "FileExplorer,TagsExplorer"
let g:TagBase_CleanUp = '2'
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Remove menus and guioptions
aunmenu *
set guioptions-=m
endif
" Get Rid of stupid Goddamned help keys
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Adding More Shorcuts keys using leader kye.
" Leader Kye provide separate namespace for specific commands.
",W Command to remove white space from a file.
nnoremap <leader>W :%s/\s\+//g<cr>:let @/=''<CR>
" ,ft Fold tag, helpful for HTML editing.
nnoremap <leader>ft vatzf
" ,q Re-hardwrap Paragraph
nnoremap <leader>q gqip
" ,v Select just pasted text.
nnoremap <leader>v V`]
" ,ev Shortcut to edit .vimrc file on the fly on a vertical window.
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
" clean the search
nnoremap <leader>h :noh<cr>
" enables wildmenu (show autocompleted terms in the bar)
set wildmenu
"set wildmode=list:longest
set wildignore+=.hg,.git,.svn " Version Controls"
set wildignore+=*.aux,*.out,*.toc "Latex Indermediate files"
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg "Binary Imgs"
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest "Compiled Object files"
set wildignore+=*.spl "Compiled speolling world list"
set wildignore+=*.sw? "Vim swap files"
set wildignore+=*.DS_Store "OSX SHIT"
set wildignore+=*.luac "Lua byte code"
"set wildignore+=migrations "Django migrations"
set wildignore+=*.pyc "Python Object codes"
set wildignore+=*.orig "Merge resolution files"
" =========== END Basic Vim Settings ===========
" Removing scrollbars
if has("gui_running")
set guitablabel=%-0.12t%M
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guioptions+=a
set guioptions+=m
colo badwolf
"set listchars=tab:▸\ ,eol:¬ " Invisibles using the Textmate style
endif
" Source the vimrc file after saving it
autocmd bufwritepost .vimrc source ~/.vimrc
" Markdown settingd
"
" augroup Formatting
" autocmd!
" autocmd BufNewFile,BufRead,WinEnter,BufEnter,FileType markdown,*.md,*.mkd setlocal formatoptions=ant textwidth=68 wrapmargin=0
" augroup END
"switch spellcheck languages
let g:myLang = 0
let g:myLangList = [ "nospell", "es", "en_us" ]
function! MySpellLang()
"loop through languages
let g:myLang = g:myLang + 1
if g:myLang >= len(g:myLangList) | let g:myLang = 0 | endif
if g:myLang == 0 | set nospell | endif
if g:myLang == 1 | setlocal spell spelllang=es | endif
if g:myLang == 2 | setlocal spell spelllang=en_us | endif
echo "language:" g:myLangList[g:myLang]
endf
map <F7> :call MySpellLang()<CR>
imap <F7> <C-o>:call MySpellLang()<CR>
" ========== END Gvim Settings ==========
" ========== Plugin Settings =========="
" CtrlP settings"
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" NERDTree
nnoremap <leader>n :NERDTreeToggle<cr>
let g:NERDTreeRespectWildIgnore = 1
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif "automatic open
" Mini Buffer some settigns."
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" Tagbar key bindings."
nmap <leader>l <ESC>:TagbarToggle<cr>
imap <leader>l <ESC>:TagbarToggle<cr>i
" Rainbow
let g:rainbow_active = 0
nmap <leader>r <ESC>::RainbowToggle<cr>
imap <leader>r <ESC>::RainbowToggle<cr>i
"Vim airline
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
" Dash settings
:nmap <silent> <leader>d <Plug>DashSearch
let g:dash_map = {
\ 'javascript' : 'web_js',
\ 'python' : 'python_fw'
\ }
" Snipmate settings
:imap <C-J> <Plug>snipMateNextOrTrigger
:smap <C-J> <Plug>snipMateNextOrTrigger
" Editorconfig settings
let g:EditorConfig_max_line_indicator = 'none'
let g:EditorConfig_preserve_formatoptions = 1
"" Add the virtualenv's site-packages to vim path
py << EOF
import os.path
import sys
import vim
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" vdebug settings
let g:vdebug_options = {}
let g:vdebug_options["port"] = 9000
let g:vdebug_options["break_on_open"] = 0
let g:vdebug_keymap = {
\ "run" : "<Leader>/",
\ "run_to_cursor" : "<Down>",
\ "step_over" : "<Up>",
\ "step_into" : "<Left>",
\ "step_out" : "<Right>",
\ "close" : "q",
\ "detach" : "x",
\ "set_breakpoint" : "<Leader>p",
\ "eval_visual" : "<Leader>e"
\}
" youcompleteme and omnicomplete
"
nmap <leader>k :YcmCompleter GoToDefinition<CR>
set omnifunc=syntaxcomplete#Complete
" Call YCM GoTo or vim-go GoTo depending on file type.
function! GoToDef()
if &ft == 'go'
"call go#def#Jump()
execute 'GoDef'
else
execute 'YcmCompleter GoTo'
endif
endfunction
imap <leader>k <ESC>:call GoToDef()<CR>
nmap <leader>k <ESC>:call GoToDef()<CR>
"syntastic
"
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
"
"Pandoc
nnoremap <leader>cow :Pandoc! docx<CR>
"Largefile
let g:LargeFile=15
" vim-jsx
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
" vim javascript
set conceallevel=1
let g:javascript_conceal_function = "ƒ"
let g:javascript_conceal_null = "ø"
let g:javascript_conceal_return = "⇚"
let g:javascript_conceal_NaN = "ℕ"
let g:javascript_conceal_static = "•"
let g:javascript_conceal_super = "Ω"
let g:javascript_conceal_arrow_function = "⇒"
" Simpyfold
set foldlevelstart=1
" vim grammarous
let g:grammarous#disabled_rules = {
\ '*' : ['WHITESPACE_RULE', 'EN_QUOTES'],
\ 'slide' : ['COMMA_PARENTHESIS_WHITESPACE', 'EN_QUOTES', 'DASH_RULE', 'SENTENCE_WHITESPACE', 'EN_QUOTES'],
\ }
let g:grammarous#default_lang = 'en-US'
" =========== END Plugin Settings =========="
set t_Co=256
syntax enable
colorscheme xoria256
hi Conceal ctermfg=255
hi Conceal ctermbg=52
"set background=dark
"colorscheme solarized
"colorscheme sift
"colorscheme desert
" ========== Private settings ================"
let s:extrarc = expand($HOME . '/.extra.vimrc')
if filereadable(s:extrarc)
exec ':so ' . s:extrarc
endif
" ========== Other settings ================"
let s:otherrc = expand($HOME . '/.vim/other.vimrc')
if filereadable(s:otherrc)
exec ':so ' . s:otherrc
endif
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
" ============neovim========================"
au FileType yaml setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
au Filetype javascript setlocal ts=2 sts=2 sw=2