-
Notifications
You must be signed in to change notification settings - Fork 2
/
rc
367 lines (273 loc) · 6.72 KB
/
rc
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
" vim: set filetype=vim:
" Screw legacy
set nocompatible
" REFERENCES
"{{{
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" http://amix.dk/vim/vimrc.html
" https://bitbucket.org/rride_a/myvim/src/8fea90269713/.vimrc
" http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen
" http://www.vim.org/scripts/script.php?script_id=2332
" https://github.com/gmarik/vimfiles/blob/master/vimrc
" http://joshuaborn.name/blog/9d0b/
" http://vim.spf13.com/
"}}}
" PLUGIN MANAGEMENT (VUNDLE)
" NOTE comments after Bundle command are not allowed
"{{{
" This is required
filetype off
" Initialize Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Also required
Bundle 'gmarik/vundle'
"}}}
" GENERAL
"{{{
" Automatically reload .vimrc on save
autocmd! bufwritepost .vimrc source %
" Smart indentation
set autoindent
set smartindent
" Tab stops
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Show unwanted hidden characters and toggle with <leader>l
set list
set listchars=tab:↹\ ,trail:☠
nmap <leader>l :set list!<CR>
" Unicode
set encoding=utf-8
" Highlight matching brace/parenthese/bracket
set showmatch
" Visual bell
set vb t_vb=
set novisualbell
" Watch for file changes
set autoread
" Line endings
set fileformats=unix
set ff=unix
" Free-range cursor in INSERT mode
"set virtualedit=all
" Keep all the temporary and backup files in one place
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set nobackup
set noswapfile
" Remap split commands
nnoremap <leader>h :split<cr>
nnoremap <leader>v :vsplit<cr>
" Undo in INSERT mode
imap <c-z> <c-o>u
" Make tabbing in VISUAL mode keep highlighting
vmap <tab> >gv
vmap <s-tab> <gv
" Remove scrollbars
if has('gui_running')
set guioptions-=l
set guioptions-=r
set guioptions-=b
end
"}}}
" SPELL CHECKING
"{{{
" Turn off spell checking (colors made text unreadable)
set nospell
set spelllang=en
" Show only 9 suggestions for misspelled words
set spellsuggest=9
"}}}
" SEARCH
"{{{
" Incremental search with ignore case (except explicit caps)
set incsearch
set ignorecase
set smartcase
set showmatch
set hlsearch
" Clear search highlighting
nnoremap <leader><space> :noh<cr>
" Search highlighting
set hls
"set nohls
" Ruby-ish regular expressions
map / /\v
" Center search results while browsing
map N Nzz
map n nzz
"}}}
" EDITING
"{{{
" Align text
Bundle 'godlygeek/tabular'
" Cool tab completion stuff
Bundle 'ervandew/supertab'
set wildmenu
set wildmode=list:longest,full
" Toggle comments with <leader><leader><leader>
Bundle 'tpope/vim-commentary'
" toggle comments with <leader>c<space>
"Bundle 'scrooloose/nerdcommenter'
" Verify syntax against external tools
Bundle 'scrooloose/syntastic'
" Create empty line and stay in NORMAL mode
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
"}}}
" FOLDING
"{{{
" Enable indent folding
set foldenable
set fdm=indent
" Turn off folding by default
set foldlevel=100
" Set space to toggle a fold
nnoremap <space> za
"}}}
" DECORATION
"{{{
" Some nice themes
"Bundle 'molokai'
"Bundle 'nelstrom/vim-mac-classic-theme'
"Bundle 'altercation/vim-colors-solarized'
"Bundle 'gmarik/ingretu'
Bundle 'duff/vim-wombat256mod'
" Turn on line numbering
set number
" Width reserved for line numbers
set numberwidth=4
" Relative numbering in NORMAL mode
" Absolute numbering in INSERT mode
Bundle 'myusuf3/numbers.vim'
nnoremap <F3> :NumbersToggle<CR>
" Mark long lines
"set colorcolumn=80
" Highlight current line
set cursorline
" Font
set guifont=Mensch\ for\ Powerline\ 8
" Theme
set background=dark
"colorscheme desert
"colorscheme slate
"colorscheme solarized
if has('gui_running')
colorscheme wombat256mod
else
colorscheme desert
end
" Remove gui toolbar
if has('gui_running')
set guioptions-=T
end
"}}}
" STATUSBAR
"{{{
Bundle 'Lokaltog/vim-powerline'
let g:Powerline_symbols = 'fancy'
" Turn on statusbar
set ruler
" Always show the statusline
set laststatus=2
"}}}
" SAVING
"{{{
" Save with ctrl+s
map <c-s> <esc>:w<cr>
imap <c-s> <c-o><c-s>
imap <c-s> <esc><c-s>
" Make saving less annoying
map :W :w
"}}}
" PROJECT MANAGEMENT
"{{{
Bundle 'ravinggenius/vim-open'
" Projects Directory
let g:project_dir = '~/Code'
let g:open_dir_auto_open_nerdtree = 0
let g:open_dir_callback = 'CtrlP'
Bundle 'scrooloose/nerdtree'
let g:NERDTreeChDirMode=2
map <F9> :NERDTreeToggle<CR>
"}}}
" QUICK OPEN
"{{{
" http://kien.github.com/ctrlp.vim/
Bundle 'kien/ctrlp.vim'
"nmap <leader>o :CtrlP<CR>
let g:ctrlp_working_path_mode = 2
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
set wildignore+=*/.sass-cache/*,*/tmp/*,*/.tmp/*,*.so
set wildignore+=*/vendor/*
let g:ctrlp_custom_ignore = 'coverage$'
"set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*.so
"set wildignore+=.git\*,.hg\*,.svn\*,*.dll,*.exe
"let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
"let g:ctrlp_custom_ignore = {
" \ 'dir': '\.git$\|\.hg$\|\.svn$',
" \ 'file': '\.exe$\|\.so$\|\.dll$',
" \ 'link': 'some_bad_symbolic_link',
" \ }
" Other...
"Bundle 'L9'
" FuzzyFinder depends on L9...
"Bundle 'FuzzyFinder'
"Bundle 'git://git.wincent.com/command-t.git'
"}}}
" MOTIONS
"{{{
" Move a line of text using ALT+[jk] (Comamnd+[jk] on mac)
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
" Turn off training wheels in NORMAL mode
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
" Turn off training wheels in INSERT mode
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" Move up and down by screen lines, not file lines
nnoremap j gj
nnoremap k gk
" Keep at least 3 lines above/below
set scrolloff=3
" Keep at least 2 lines left/right
set sidescrolloff=2
"}}}
" INTEGRATION (GIT)
"{{{
" Syntax highlighting for git-specific files and stuff
Bundle 'tpope/vim-git'
" Run git commands from vim
Bundle 'tpope/vim-fugitive'
" Extends vim-fugitive with gitk functionality
Bundle 'gregsexton/gitv'
"}}}
" INTEGRATION (HTML)
"{{{
" Write condensed HTML (expands CSS selector to full HTML tags)
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"}}}
" INTEGRATION (MARKDOWN)
"{{{
Bundle 'plasticboy/vim-markdown'
"}}}
" INTEGRATION (RUBY)
"{{{
Bundle 'tpope/vim-rails.git'
Bundle 'vim-ruby/vim-ruby'
"}}}
" Detect file formats
" Keep at end - vundle wants this to be off when calling Bundle '...'
syntax on
filetype indent plugin on