-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
279 lines (240 loc) · 11.1 KB
/
.vimrc
File metadata and controls
279 lines (240 loc) · 11.1 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
" ********************************************************************************************************
" GLOBAL SETTINGS
set nocompatible " be iMproved, required
filetype off " required
set splitright
set encoding=utf-8
set expandtab
set softtabstop=2
set tabstop=2
set shiftwidth=2
set number
set autoindent
set cursorline
set synmaxcol=120
set hlsearch
set nowrap
set smartcase
set backupcopy=yes
set autoread
set backupdir=~/.cache/vim
set dir=~/.cache/vim
set history=1000
set updatetime=1300
" ********************************************************************************************************
" LOCAL SETTINGS
setlocal spell spelllang=en
" ********************************************************************************************************
" RUNTIME VIM MACROS
runtime macros/matchit.vim
" ********************************************************************************************************
" THE PLUGIN LOADER IS PLUG
call plug#begin('~/.vim/plugged')
" ********************************************************************************************************
" PLUGINS LIST START HERE, THE GLOBAL ONES ARE FIRST
Plug 'easymotion/vim-easymotion'
Plug '907th/vim-auto-save'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Raimondi/delimitMate'
Plug 'bronson/vim-trailing-whitespace'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-commentary'
Plug 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
" ********************************************************************************************************
" MULTI DEVELOPMENT PLUGINS
Plug 'tpope/vim-fugitive'
Plug 'vim-syntastic/syntastic', { 'for': ['python', 'ruby', 'javascript'] }
Plug 'flazz/vim-colorschemes', { 'for': ['python', 'ruby', 'javascript'] }
Plug 'Valloric/YouCompleteMe', { 'for': ['python', 'ruby', 'javascript'] }
Plug 'SirVer/ultisnips', { 'for': ['python', 'ruby', 'javascript'] }
Plug 'honza/vim-snippets', { 'for': ['python', 'ruby', 'javascript'] }
Plug 'craigemery/vim-autotag', { 'for': ['python', 'ruby', 'javascript'] }
" ********************************************************************************************************
" PYTHON
Plug 'jmcantrell/vim-virtualenv', { 'for': 'python' }
Plug 'heavenshell/vim-pydocstring', { 'for': 'python' }
" ********************************************************************************************************
" SYSTEM LANGUAGES
Plug 'octol/vim-cpp-enhanced-highlight', { 'for': 'cpp' }
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
" ********************************************************************************************************
" FRONTEND
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'mxw/vim-jsx', { 'for': 'javascript' }
" ********************************************************************************************************
" RUBY
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'tpope/vim-rails', { 'for': 'ruby' }
Plug 'tpope/vim-rbenv', { 'for': 'ruby' }
Plug 'tpope/vim-bundler', { 'for': 'ruby' }
Plug 'tpope/vim-endwise', { 'for': 'ruby' }
Plug 'slim-template/vim-slim', { 'for': 'ruby' }
Plug 'benmills/vimux', { 'for': 'ruby' }
Plug 'skalnik/vim-vroom', { 'for': 'ruby' }
" ALL OF YOUR PLUGINS MUST BE ADDED BEFORE THE FOLLOWING LINE
" INITIALIZE PLUGIN SYSTEM
call plug#end()
filetype plugin indent on " required
" ********************************************************************************************************
" 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
let g:ycm_autoclose_preview_window_after_completion = 1
" ********************************************************************************************************
" AUTO SAVE
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_events = ["InsertLeave", "TextChanged"]
" ********************************************************************************************************
" ULTISNIPS
let g:UltiSnipsExpandTrigger = "<c-j>"
let g:UltiSnipsJumpForwardTrigger = "<c-b>"
let g:UltiSnipsJumpBackwardTrigger = "<c-z>"
" ********************************************************************************************************
" POWERLINE SETUP
set t_Co=256
set laststatus=2
set term=xterm-256color
set termencoding=utf-8
set guifont=Ubuntu\ Mono\ derivative\
" ********************************************************************************************************
" AIRLINE THEME
let g:airline_theme='murmur'
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
" ********************************************************************************************************
" SYNTASTIC
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%{virtualenv#statusline()}
set statusline+=%*
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 = 1
let g:syntastic_python_checkers = ['pylint']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_ruby_checkers = ['rubocop', 'mri']
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_jump = 0
let g:syntastic_aggregate_errors = 1
" ********************************************************************************************************
" MOTION
let g:EasyMotion_do_mapping = 0 " Disable default mappings
"Jump to anywhere you want with minimal keystrokes, with just one key
"binding.
" `s{char}{label}`
nmap s <Plug>(easymotion-overwin-f)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
nmap s <Plug>(easymotion-overwin-f2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" ********************************************************************************************************
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
let g:ctrlp_by_filename = 1
let g:ctrlp_use_caching = 1
" let g:ctrlp_regexp = 1
let g:ctrlp_dotfiles = 0
let g:ctrlp_max_files = 0
let g:ctrlp_max_depth = 100
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_tabpage_position = 'ac'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
set wildignore+=*/.git/*
nnoremap <leader>. :CtrlPTag<CR>
" ********************************************************************************************************
" VIM-COLORS
colorscheme badwolf
" ********************************************************************************************************
" JSX
let g:jsx_ext_required = 0 " Allow JSX in normal JS files"
" ********************************************************************************************************
" VIMUX
map <Leader>z :call VimuxZoomRunner()<CR>
map <Leader>x :call VimuxCloseRunner()<CR>
map <Leader>c :call VimuxOpenRunner()<CR>
" ********************************************************************************************************
" VROOM
let g:vroom_use_colors = 1
let g:vroom_use_vimux = 1
let g:vroom_detect_spec_helper = 1
let g:vroom_spec_command = 'rspec -fd '
" ********************************************************************************************************
" SHORTCUTS
" will make formatted text
nnoremap <Leader>p ggvGgq
" ********************************************************************************************************
" SPELLING RULES
fun! SetSpellingColors()
highlight SpellBad cterm=bold ctermfg=white ctermbg=red
highlight SpellCap cterm=bold ctermfg=red ctermbg=white
endfun
augroup spellrulez
autocmd!
autocmd BufWinEnter *.txt call SetSpellingColors()
autocmd BufNewFile *.txt call SetSpellingColors()
autocmd BufRead *.txt call SetSpellingColors()
autocmd InsertEnter *.txt call SetSpellingColors()
autocmd InsertLeave *.txt call SetSpellingColors()
autocmd BufWritePost *.txt call SetSpellingColors()
augroup END
" ********************************************************************************************************
" Transparent editing of GnuPG-encrypted files
" Written by Patrick R. McDonald at https://www.antagonism.org/privacy/gpg-vi.shtml
" Based on a solution by Wouter Hanegraaff
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg,*.asc set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk.
autocmd BufReadPre,FileReadPre *.gpg,*.asc set noswapfile
" Switch to binary mode to read the encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set bin
autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg,*.asc '[,']!sh -c 'gpg --decrypt 2> /dev/null'
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg set nobin
autocmd BufReadPost,FileReadPost *.gpg,*.asc let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gpg,*.asc execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg set bin
autocmd BufWritePre,FileWritePre *.gpg '[,']!sh -c 'gpg --default-recipient-self -e 2>/dev/null'
autocmd BufWritePre,FileWritePre *.asc '[,']!sh -c 'gpg --default-recipient-self -e -a 2>/dev/null'
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg,*.asc u
augroup END
" ********************************************************************************************************
" automatically leave insert mode after 'updatetime' milliseconds of inaction
au CursorHoldI * stopinsert
" ********************************************************************************************************
autocmd FileType python setlocal ts=4 sw=4 softtabstop=4
" ********************************************************************************************************
" RUN RSPEC ON SAVE
" autocmd BufWritePost *.rb VroomRunTestFile
" ********************************************************************************************************
" UPDATE CTAGS ON SAVE
autocmd BufWritePost *
\ if filereadable('tags') |
\ call system('ctags -a '.expand('%')) |
\ endif