-
Notifications
You must be signed in to change notification settings - Fork 3
/
.vimrc
300 lines (248 loc) · 5.51 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
"Go
"{
set rtp+=$GOROOT/misc/vim
filetype plugin indent on
setlocal omnifunc=gocomplete#Complete
"}
"Powerline
"{
let g:Powerline_symbols = 'fancy'
"}
"NERDTree
"{
let g:NERDTreeWinSize = 40
let NERDTreeShowBookmarks=1
"}
" Pathogen
"{
" Ignore list
let g:pathogen_disabled = []
" Powerline is slowing vim down
call add(g:pathogen_disabled, 'vim-powerline')
if v:version < '703'
call add(g:pathogen_disabled, 'numbers')
endif
let g:solarized_visibility='low'
call pathogen#infect()
call pathogen#helptags()
"}
" set up color scheme
"{
syntax enable
"set t_Co=256
"let g:solarized_termcolors=16
set background=dark
colorscheme solarized
call togglebg#map("<F5>")
"}
"JSHint
"{
let g:jshintconfig = "$HOME/.jshintrc"
"}
" Command T
"{
set wildignore+=app/cache/**
set wildignore+=web/**
"}
"Session options
"{
" do not store global and local values in a session
set ssop-=options
" do not store folds
set ssop-=folds"
"}
" Spell check
"{
setlocal spell spelllang=en_us
setlocal spellfile+=~/.vim/spell/en.utf-8.add
"}
" Search
"{
" clear search with space bar
nnoremap <silent> <Space> :silent noh<Bar>echo<CR>
" jumps to search word as you type
set incsearch
" highlight search terms
set hlsearch
hi Search cterm=NONE ctermfg=grey ctermbg=darkblue
" case insensitive search
set ignorecase
set smartcase
command! -nargs=+ MyGrep execute 'silent grep! <args>' | copen 33
"}
"Misc
"{
" Set directory to current file
"set autochdir
" normal mode with jk
imap jk <Esc>
" Save files after accidently forgetting to sudo
cmap w!! w !sudo tee % >/dev/null
" Don't create .swp file
set noswapfile
" No visual or audible errors
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
" set paste toggle
noremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
"}
"
"GitGutter
"{
highlight clear SignColumn
"}
" File
"{
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
"}
"Leader Commands
"}
" use ,, for omni completion
let mapleader=","
inoremap <leader>, <C-x><C-o>
set completeopt+=longest
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Select pasted text
nnoremap <leader>v V`]
noremap <leader>p :set invpaste paste?<CR>
set pastetoggle=<F2>
" put new split window on the right
set splitright
"}
" Invisible Chars
"{
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=trail:☢,tab:\|\ ,eol:¬
set list
"}
" Window and file management
"{
" Use tree-mode as default view
let g:netrw_liststyle=3
" Set tree-mode file ignores
let g:netrw_list_hide= '.git,.sass-cache,.svn,nbproject'
" preview window shown in a vertically split
let g:netrw_preview=1
" navigate splits
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" open file in split to right
map oo o<C-w>L
" expand current vert split to full width
map ff <C-w><Bar>
" sets the min widnow height to 0 - only show the file name
set wmh=0
"}
" Comment Block formating
"{
" auto format comment blocks
set comments=sl:/**,mb:\ *,elx:\ */
set formatoptions+=r
"}
" Yank rink config
"{
let g:yankring_min_element_length = 2
let g:yankring_history_dir = '~/.vim/yanks'
let g:yankring_zap_keys = 'f F t T / ?'
let g:yankring_enabled = 0 " Disables the yankring
"}
" Below from - https://github.com/spf13/spf13-vim/blob/master/.vimrc (partial)
" Vim UI
"{
" only show 15 tabs
set tabpagemax=15
" display the current mode
set showmode
" Improves vim cursor speed
set nocursorcolumn
set nocursorline
syntax sync minlines=256
if has('cmdline_info')
" show the ruler
set ruler
" a ruler on steroids
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%)
" show partial commands in status line and
set showcmd
endif
" backspace for dummys
set backspace=indent,eol,start
" No extra spaces between rows
set linespace=0
" Line numbers on
set nu
" show matching brackets/parenthesis
set showmatch
" windows can be 0 line high
set winminheight=0
" backspace and cursor keys wrap to
set whichwrap=b,s,h,l,<,>,[,]
" lines to scroll when cursor leaves screen
set scrolljump=5
" minimum lines to keep above and below cursor
set scrolloff=3
" Remove mvim scroll bars
set guioptions-=L
set guioptions-=r
" }
" Formatting
"{
" wrap long lines
set nowrap
" indent at the same level of the previous line
set autoindent
set smartindent
" don't expand tab to spaces
set noexpandtab
" use indents of 4 spaces
set shiftwidth=4
" an indentation every four columns
set tabstop=4
" let backspace delete indent
set softtabstop=4
" }
" Folding
"{
"fold based on indent
set foldmethod=indent
"deepest fold is 10 levels
set foldnestmax=10
"don't fold by default
set nofoldenable
set foldlevel=1
"}
" Highligts
"{
" highlight ExtraWhiteSpace ctermbg=darkgray
" Show trailing whitespace
" Show spaces before a tab
" Show tabs that are not at the start of a line:
" Show spaces used for indenting (so you use only tabs for indenting).
" match ExtraWhitespace /\s\+$\| \+\ze\t\| [^\t]\zs\t\+\|^\t*\zs \+/
"}
" Status Line
"{
set laststatus=2
"}
" Add add extra files if they exist
"{
let WLION = expand("~/vim_files/.work")
if filereadable(WLION)
source ~/vim_files/.work
endif
let APPEND = expand("~/vim_files/.vimrc_append")
if filereadable(APPEND)
source ~/vim_files/.vimrc_append
endif
"}