about summary refs log tree commit diff
path: root/usbify/vim/.vimrc
blob: c4ebeb098617fc3f9bcf9c80aa9b3f2b43ce56af (plain) (blame)
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
" -- BEGIN: Vundle config --
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'

" All of your Plugins must be added before the following line
Plugin 'Raimondi/delimitMate'
Plugin 'Valloric/YouCompleteMe'
Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'

Plugin 'sickill/vim-monokai'
Plugin 'altercation/vim-colors-solarized'

Plugin 'sjl/clam.vim'
" NOTE: use <C-n> to run miltiple cursors not <C-d>
Plugin 'terryma/vim-multiple-cursors'


call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" -- END: Vundle config --


set noswapfile


set grepprg=ack\ -k


" backspace settings
set backspace=2
set backspace=indent,eol,start


" Javascript specific variables
let g:javascript_plugin_jsdoc = 1
" set foldmethod=syntax

" GlobalListchars
set list
set listchars=eol:¶,trail:~,nbsp:␣


" Keeps everything concealed at all times. Even when my cursor is on the word.
set conceallevel=1
set concealcursor=nvic

" JavaScript thanks to pangloss/vim-javascript
" let g:javascript_conceal_function = "ƒ"
" match ErrorMsg /ƒ/


" Ultisnips
" Track the engine.
Plugin 'SirVer/ultisnips'

" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'

" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-x>"
" let g:UltiSnipsJumpForwardTrigger="<c-j>"
" let g:UltiSnipsJumpBackwardTrigger="<c-k>"


" keyword completion
inoremap ;; <C-n>


" remap <C- keys in insert mode to have similar directional behavior to the
" behavior that they have in normal and visual modes
inoremap <C-w> <Esc>lwi
inoremap <C-W> <Esc>lWi

" TODO: debug why <C-b><C-b> repetition is needed
inoremap <C-b> <Esc>bi
inoremap <C-B> <Esc>Bi


" set -o emacs line-editor defaults
inoremap <C-a> <Esc>I
inoremap <C-e> <Esc>A


" vs and sp keybinding
nnoremap vs <Esc>:vs<CR>
nnoremap vv <Esc>:vs<CR>
nnoremap sp <Esc>:sp<CR>
nnoremap ss <Esc>:sp<CR>


" Remap window keybinding
nnoremap <space> <C-w>


" tab movement bindings
nnoremap <C-h> gT
nnoremap <C-l> gt


" make Y do what is intuitive given D, etc.
nnoremap Y y$


" new tab keybinding
nnoremap <C-t> :tabnew<CR>
inoremap <C-t> <Esc>:tabnew<CR>
vnoremap <C-t> <Esc>:tabnew<CR>


" flip number keys to their shift+ counterparts
nnoremap t1 t!
nnoremap t2 t@
nnoremap t3 t#
nnoremap t4 t$
nnoremap t5 t%
nnoremap t6 t^
nnoremap t7 t&
nnoremap t8 t*
nnoremap t9 t(
nnoremap t0 t)

nnoremap T1 T!
nnoremap T2 T@
nnoremap T3 T#
nnoremap T4 T$
nnoremap T5 T%
nnoremap T6 T^
nnoremap T7 T&
nnoremap T8 T*
nnoremap T9 T(
nnoremap T0 T)

nnoremap f1 f!
nnoremap f2 f@
nnoremap f3 f#
nnoremap f4 f$
nnoremap f5 f%
nnoremap f6 f^
nnoremap f7 f&
nnoremap f8 f*
nnoremap f9 f(
nnoremap f0 f)

nnoremap F1 F!
nnoremap F2 F@
nnoremap F3 F#
nnoremap F4 F$
nnoremap F5 F%
nnoremap F6 F^
nnoremap F7 F&
nnoremap F8 F*
nnoremap F9 F(
nnoremap F0 F)


" Karate edits
nnoremap ca9 ca(
nnoremap da9 da(
nnoremap va9 va(

nnoremap ca0 ca)
nnoremap da0 da)
nnoremap va0 va)

nnoremap ci9 ci(
nnoremap di9 di(
nnoremap vi9 vi(

nnoremap ci0 ci)
nnoremap di0 di)
nnoremap vi0 vi)


" scrolling and maintaing mouse position
nnoremap <C-j> j<C-e>
nnoremap <C-k> k<C-y>


" reload file after git changes
nnoremap <C-r> :e<CR>


" resize vertical and horizontal splits
nnoremap <C-w><C-l> :vertical resize +3<CR>
nnoremap <C-w><C-h> :vertical resize -3<CR>
nnoremap <C-w><C-k> :resize +3<CR>
nnoremap <C-w><C-j> :resize -3<CR>


" -- Syntastic Settings --
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
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_javascript_checkers = ['gjslint']


" Basic settings
set number
set tabstop=2
set expandtab
set shiftwidth=2

syntax enable

if has('gui_running')
  set background=light
else
  set background=dark
endif

colorscheme solarized

set t_Co=255


" Support italics
highlight Comment cterm=italic


" Remove all characters until the end of the line
inoremap <C-c> <Esc>lC


" Ensure that <header> is "," character
let mapleader = ","


" Define highlighting groups
highlight InterestingWord1 ctermbg=Cyan ctermfg=Black
highlight InterestingWord2 ctermbg=Yellow ctermfg=Black
highlight InterestingWord3 ctermbg=Magenta ctermfg=Black


" h1 highlighting
nnoremap <silent> <leader>h1 :execute 'match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>xh1 :execute 'match none'<CR>

" h2 highlighting
nnoremap <silent> <leader>h2 :execute '2match InterestingWord2 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>xh2 :execute '2match none'<CR>

" h3 highlighting
nnoremap <silent> <leader>h3 :execute '3match InterestingWord3 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>xh3 :execute '3match none'<CR>

"clear all highlighted groups
nnoremap <silent> <leader>xhh :execute 'match none'<CR> :execute '2match none'<CR> :execute '3match none'<CR>


" pasteboard copy & paste
nnoremap <C-c> V"+y
vnoremap <C-c> "+y

inoremap <C-v> <Esc>"+pa
nnoremap <C-v> o<Esc>"+p
vnoremap <C-v> "+p


" add 80 character wrap line
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/


" map jj to <Esc>
imap jj <Esc>

" map ctrl + n to :NERDTree
map <C-n> :NERDTreeToggle<CR>


" BOL and EOL
nnoremap H ^
vnoremap H ^
nnoremap L $
vnoremap L $


" trim trailing whitespace on save
autocmd BufWritePre *.{js,py,tpl,html} :%s/\s\+$//e


" set default font and size
set guifont=Operator\ Mono:h16


" -- fuzzy-finder --
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = {
  \ 'dir':  'node_modules'
  \ }