forked from nathanielescribano/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
458 lines (362 loc) · 12.3 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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
" Essentially took Derek Wyatt's .vimrc and heavily modified it through the
" years. Added various things, removed what I didn't like, etc.
"----------------------------------------------------------------------------
"Global Stuff
"-----------------------------------------------------------------------------
" Set filetype stuff to on
filetype on
filetype plugin on
filetype indent on
" set numbers
set number
" Tabstops are 4 spaces
set tabstop=2
set shiftwidth=2
" set the search scan to wrap lines
set wrapscan
" set the search scan so that it ignores case when the search is all lower
" case but recognizes uppercase if it's specified
set ignorecase
set smartcase
" set the forward slash to be the slash of note. Backslashes suck
set shellslash
" Make command line two lines high
set ch=2
" set visual bell -- i hate that damned beeping
set vb
" Allow backspacing over indent, eol, and the start of an insert
set backspace=2
" Make sure that unsaved buffers that are to be put in the background are
" allowed to go in there (ie. the "must save first" error doesn't come up)
set hidden
" Set the status line the way i like it
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ [%b][0x%B]
" tell VIM to always put a status line in, even if there is only one window
set laststatus=2
" Don't update the display while executing macros
set lazyredraw
" Show the current command in the lower right corner
set showcmd
" Show the current mode
set showmode
" Switch on syntax highlighting.
syntax on
" Hide the mouse pointer while typing
set mousehide
" Set up the gui cursor to look nice
set guicursor=n-v-c:block-Cursor-blinkon0
set guicursor+=ve:ver35-Cursor
set guicursor+=o:hor50-Cursor
set guicursor+=i-ci:ver25-Cursor
set guicursor+=r-cr:hor20-Cursor
set guicursor+=sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
" set the gui options the way I like
set guioptions=ac
" This is the timeout used while waiting for user input on a multi-keyed macro
" or while just sitting and waiting for another key to be pressed measured
" in milliseconds.
"
" i.e. for the ",d" command, there is a "timeoutlen" wait period between the
" "," key and the "d" key. If the "d" key isn't pressed before the
" timeout expires, one of two things happens: The "," command is executed
" if there is one (which there isn't) or the command aborts.
set timeoutlen=500
" Keep some stuff in the history
set history=100
" These commands open folds
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
" When the page starts to scroll, keep the cursor 8 lines from the top and 8
" lines from the bottom
set scrolloff=12
" Allow the cursor to go in to "invalid" places
set virtualedit=all
" These things start comment lines
"set comments=sl:/*,mb:\ *,ex:\ */,O://,b:#,:%,:XCOMM,n:>,fb:-
" Disable encryption (:X)
set key=
" Make the command-line completion better
set wildmenu
" Same as default except that I remove the 'u' option
set complete=.,w,b,t
" When completing by tag, show the whole tag, not just the function name
set showfulltag
" Set the textwidth to be 120 chars
set textwidth=120
" get rid of the silly characters in window separators
set fillchars=""
" Turn tabs into spaces
" set noexpandtab
set expandtab
" Add ignorance of whitespace to diff
set diffopt+=iwhite
" Enable search highlighting
set hlsearch
" Incrementally match the search
set incsearch
" Initial path seeding
set path=
set path+=/usr/local/include/**
set path+=/usr/include/**
set path+=~/code/**
" Set the tags files to be the following
set tags=./tags,tags
" Let the syntax highlighting for Java files allow cpp keywords
let java_allow_cpp_keywords = 1
" cd to the directory containing the file in the buffer
nmap <silent> ,cd :lcd %:h<CR>
nmap <silent> ,md :!mkdir -p %:p:h<CR>
" Turn off that stupid highlight search
nmap <silent> ,n :set invhls<CR>:set hls?<CR>
" allow command line editing like emacs
cnoremap <C-A> <Home>
cnoremap <C-B> <Left>
cnoremap <C-E> <End>
cnoremap <C-F> <Right>
cnoremap <C-N> <End>
cnoremap <C-P> <Up>
cnoremap <ESC>b <S-Left>
cnoremap <ESC><C-B> <S-Left>
cnoremap <ESC>f <S-Right>
cnoremap <ESC><C-F> <S-Right>
cnoremap <ESC><C-H> <C-W>
" Maps to make handling windows a bit easier
noremap <silent> ,h :wincmd h<CR>
noremap <silent> ,j :wincmd j<CR>
noremap <silent> ,k :wincmd k<CR>
noremap <silent> ,l :wincmd l<CR>
noremap <silent> ,sb :wincmd p<CR>
noremap <silent> <C-F9> :vertical resize -10<CR>
noremap <silent> <C-F10> :resize +10<CR>
noremap <silent> <C-F11> :resize -10<CR>
noremap <silent> <C-F12> :vertical resize +10<CR>
noremap <silent> ,s8 :vertical resize 83<CR>
noremap <silent> ,cj :wincmd j<CR>:close<CR>
noremap <silent> ,ck :wincmd k<CR>:close<CR>
noremap <silent> ,ch :wincmd h<CR>:close<CR>
noremap <silent> ,cl :wincmd l<CR>:close<CR>
noremap <silent> ,cc :close<CR>
noremap <silent> ,cw :cclose<CR>
noremap <silent> ,ml <C-W>L
noremap <silent> ,mk <C-W>K
noremap <silent> ,mh <C-W>H
noremap <silent> ,mj <C-W>J
noremap <silent> <C-7> <C-W>>
noremap <silent> <C-8> <C-W>+
noremap <silent> <C-9> <C-W>+
noremap <silent> <C-0> <C-W>>
" Map CTRL-E to do what ',' used to do
nnoremap <c-e> ,
vnoremap <c-e> ,
" Edit the vimrc file
nmap <silent> ,ev :e $MYVIMRC<CR>
nmap <silent> ,sv :so $MYVIMRC<CR>
" Make horizontal scrolling easier
nmap <silent> <C-o> 10zl
nmap <silent> <C-i> 10zh
" Highlight all instances of the current word under the cursor
" nmap <silent> ^ :setl hls<CR>:let @/="<C-r><C-w>"<CR>
" Search the current file for what's currently in the search
" register and display matches
nmap <silent> ,gs
\ :vimgrep /<C-r>// %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR>
" Search the current file for the word under the cursor and display matches
nmap <silent> ,gw
\ :vimgrep /<C-r><C-w>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR>
" Search the current file for the WORD under the cursor and display matches
nmap <silent> ,gW
\ :vimgrep /<C-r><C-a>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:set nohls<CR>
" Swap two words
nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
" Syntax coloring lines that are too long just slows down the world
set synmaxcol=2048
"-----------------------------------------------------------------------------
" NERD Tree Plugin Settings
"-----------------------------------------------------------------------------
" Store the bookmarks file in perforce
let NERDTreeBookmarksFile="~/.vim/NERDTreeBookmarks"
" Show the bookmarks table on startup
let NERDTreeShowBookmarks=1
" Don't display these kinds of files
let NERDTreeIgnore=[ '\.ncb$', '\.suo$', '\.vcproj\.RIMNET', '\.obj$',
\ '\.ilk$', '^BuildLog.htm$', '\.pdb$', '\.idb$',
\ '\.embed\.manifest$', '\.embed\.manifest.res$',
\ '\.intermediate\.manifest$', '^mt.dep$' ]
map <Leader>n :NERDTreeToggle<CR>
"-----------------------------------------------------------------------------
" Functions
"-----------------------------------------------------------------------------
function! RunSystemCall(systemcall)
let output = system(a:systemcall)
let output = substitute(output, "\n", '', 'g')
return output
endfunction
"-----------------------------------------------------------------------------
" Fix constant spelling mistakes
"-----------------------------------------------------------------------------
iab teh the
iab Teh The
iab taht that
iab Taht That
iab alos also
iab Alos Also
iab aslo also
iab Aslo Also
iab becuase because
iab Becuase Because
iab bianry binary
iab Bianry Binary
iab bianries binaries
iab Bianries Binaries
iab charcter character
iab Charcter Character
iab charcters characters
iab Charcters Characters
iab exmaple example
iab Exmaple Example
iab exmaples examples
iab Exmaples Examples
iab shoudl should
iab Shoudl Should
iab seperate separate
iab Seperate Separate
iab fone phone
iab Fone Phone
iab sop System.out.println
"-----------------------------------------------------------------------------
" Set up the window colors and size
"-----------------------------------------------------------------------------
"colorscheme solarized
if has("gui_running")
colorscheme Tomorrow-Night
else
set background=dark
colorscheme solarized
endif
:nohls
"change esc
imap jj <Esc>
"next method remap
map mm ]m
map MM [m
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
"ruby
"autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
"autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
"autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
"autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
"improve autocomplete menu color
highlight Pmenu ctermbg=238 gui=bold
"Mappings to access buffers (don't use "\p" because a
" delay before pressing "p" would accidentally paste).
" \l : list buffers
" \b \f \g : go back/forward/last-used
" \1 \2 \3 : go to buffer 1/2/3 etc
"nnoremap <Leader>u :ls<CR>
nnoremap <Leader>e :bp<CR>
nnoremap <Leader>o :bn<CR>
nnoremap <Leader>a :e#<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
" It's useful to show the buffer number in the status line.
set laststatus=2 statusline=%02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" easymotion
"let g:EasyMotion_keys = '1234567890'
"let g:EasyMotion_do_shade = 0
let g:EasyMotion_leader_key = '<Leader>'
" let g:EasyMotion_leader_key = 'f'
map f <Leader>f
map F <Leader>F
" remapping e to _e to avoid conflicts
" with my buffer scrolling
let g:EasyMotion_mapping_e = '_e'
nnoremap <leader>' :Ack
nnoremap <leader>, :CommandT<CR>
nnoremap <leader>x :BufOnly<CR>
nnoremap <leader>q :Bclose<CR>
" Cmd-Shift-R for RSpec
nmap <silent> <D-R> :call RunRspecCurrentFileConque()<CR>
" Cmd-r for RSpec Current Line
nmap <silent> <D-r> :call RunRspecCurrentLineConque()<CR>
" Cmd-Shift-C for Cucumber
nmap <silent> <D-C> :call RunCucumberCurrentFileConque()<CR>
" Cmd-c for Cucumber Current Line
nmap <silent> <D-c> :call RunCucumberCurrentLineConque()<CR>
nnoremap <leader><tab> :Scratch<CR>
nnoremap <leader>. :LustyBufferGrep<CR>
nnoremap <Leader>u :LustyBufferExplorer<CR>
let g:LustyExplorerSuppressRubyWarning = 1
" tabing
set ts=8 sts=2 sw=2
" set period on trailing whitespace
set list listchars=tab:\ \ ,trail:·
" Directories for swp files
set backupdir=~/.vim/backup
set directory=~/.vim/backup
" ZoomWin configuration
map <Leader><Leader> :ZoomWin<CR>
" Remember last location in file
" I LOVE THIS
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
map <Leader>h :e <C-R>=expand("%:p:h") . "/" <CR>
" Without setting this, ZoomWin restores windows in a way that causes
" equalalways behavior to be triggered the next time CommandT is used.
" This is likely a bludgeon to solve some other issue, but it works
set noequalalways
" automatically update buffer
" I LOVE THIS
set autoread
" :80D deletes a line in location 80
command! -range -nargs=0 D <line1>,<line2>d|norm ``
" cp yanks the path of the file
map cp :let @+ = expand("%:p")<CR>
" copies all yanking to clipboard
set clipboard=unnamed
" toggles relative and absolute number
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunction
nnoremap <C-n> :call NumberToggle()<cr>
" map that aligns on '=' marks
vnoremap <C-a> :Tabularize /=<CR>
" switch the mapping of 0 and ^
" since it's a little easier to
" reach and more useful IMHO
noremap 0 ^
noremap ^ 0
" lets command-t search through more files
let g:CommandTMaxFiles = 50000
" sets files for command-t to ignore
set wildignore+=.git,.svn,.log,*.png,*.jpg
" Disable plugins list
" There are a couple of plugins
" I'm just keeping around because
" I may want to use them later
let g:pathogen_disabled = []
call add(g:pathogen_disabled, 'vim-asynccommand')
if !has("gui_running")
call add(g:pathogen_disabled, 'vim-powerline')
else
"set gfn=DejaVu\ Sans\ Mono:h12
"set gfn=Menlo\ Bold:h12
set gfn=Menlo:h12
endif
call pathogen#infect()
call pathogen#helptags()