-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
341 lines (258 loc) · 8.72 KB
/
vimrc
File metadata and controls
341 lines (258 loc) · 8.72 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
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
" .vimrc File
" Maintained by: Josh Farneman
" http://farneman.net
" Forget compatibility with Vi. Who cares.
set nocompatible
" Enable filetypes
" filetype on
" filetype plugin on
" filetype indent on
filetype off
syntax on
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" Bundles here:
" original repos on github
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-obsession'
Plugin 'vim-scripts/tComment'
Plugin 'Raimondi/delimitMate'
Plugin 'tpope/vim-surround'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'vim-scripts/bufkill.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'scrooloose/syntastic'
Plugin 'marijnh/tern_for_vim'
Plugin 'kevinw/pyflakes-vim'
Plugin 'Valloric/YouCompleteMe'
" UltiSnips
Plugin 'SirVer/ultisnips'
Plugin 'farneman/vim-ultisnips-css'
call vundle#end()
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed...
" remap Ultisnips to prevent clash with YCM
set runtimepath+=~/.vim/bundle/ultisnips
let g:UltiSnipsExpandTrigger="<leader><tab>"
let g:UltiSnipsListSnippets ="<C-s-space>"
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>"
let g:syntastic_css_checkers = []
let g:syntastic_scss_checkers = []
let g:syntastic_eruby_ruby_quiet_messages = {'regex': 'possibly useless use of a variable in void context'}
" let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
" Write the old file out when switching between files.
set autowrite
" Display current cursor position in lower right corner.
set ruler
" Ever notice a slight lag after typing the leader key + command? This lowers
" the timeout.
set timeoutlen=500
" Switch between buffers without saving
set hidden
" Set the color scheme. Change this to your preference.
colorscheme badwolf
" Set font type and size. Depends on the resolution. Larger screens, prefer h20
set guifont=Inconsolata:h14
" Tab stuff
set tabstop=2
set expandtab
set shiftwidth=2
set softtabstop=2
" Only do this part when compiled with support for autocommands
if has("autocmd")
" Enable file type detection
filetype on
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customisations based on house-style (arbitrary)
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType xml setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType php setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType erb setlocal ts=2 sts=2 sw=2 expandtab
" Treat .rss files as XML
autocmd BufNewFile,BufRead *.rss setfiletype xml
" filetype settings for django
au BufNewFile,BufRead admin.py setlocal filetype=python.django
au BufNewFile,BufRead urls.py setlocal filetype=python.django
au BufNewFile,BufRead models.py setlocal filetype=python.django
au BufNewFile,BufRead views.py setlocal filetype=python.django
au BufNewFile,BufRead settings.py setlocal filetype=python.django
au BufNewFile,BufRead forms.py setlocal filetype=python.django
au BufNewFile,BufRead urls.py setlocal nowrap
au BufNewFile,BufRead settings.py normal! zR
au BufNewFile,BufRead dashboard.py normal! zR
" JS file settings
au FileType javascript setlocal foldmethod=marker
au FileType javascript setlocal foldmarker={,}
endif
" Switch filetypes
nnoremap _dt :set ft=htmldjango<CR>
nnoremap _pd :set ft=python.django<CR>
nnoremap _ss :set ft=css syn=scss<CR>
nnoremap _r :retab!<CR>
set modeline
" Show command in bottom right portion of the screen
set showcmd
" Show lines numbers
set number
" Indent stuff
set smartindent
set autoindent
" Always show the status line
set laststatus=2
" Prefer a slightly higher line height
set linespace=3
" Better line wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
" Set incremental searching
set incsearch
" Highlight searching
set hlsearch
" case insensitive search
set ignorecase
set smartcase
" Hide MacVim toolbar by default
set go-=T
" show invisibles
set list
set listchars=tab:……,trail:¬,eol:¶
" enable CtrlP
set runtimepath^=~/.vim/bundle/ctrlp.vim
" Hard-wrap paragraphs of text
nnoremap <leader>q gqip
" Enable code folding
set foldenable
" Hide mouse when typing
set mousehide
" Shortcut to fold tags with leader (usually \) + ft
nnoremap <leader>ft Vatzf
set foldmethod=marker
" Opens a vertical split and switches over (\v)
nnoremap <leader>v <C-w>v<C-w>l
" Split windows below the current window.
set splitbelow
" session settings
set sessionoptions=resize,winpos,winsize,buffers,tabpages,folds,curdir,help
" Map a change directory to the desktop - Mac specific
nmap <leader>d :cd ~/Desktop<cr>:e.<cr>
" Shortcut for editing vimrc file in a new tab
nmap <leader>ev :tabedit $MYVIMRC<cr>
" Source the vimrc file after saving it
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
" Faster shortcut for commenting. Requires T-Comment plugin
map <leader>c <c-_><c-_>
" Saves time; maps the spacebar to colon
nmap <space> :
" Automatically change current directory to that of the file in the buffer
autocmd BufEnter * cd %:p:h
" Map code completion to , + tab
" imap <leader><tab> <C-x><C-o>
" More useful command-line completion
set wildmenu
" Auto-completion menu
set wildmode=list:longest
" http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
" set completeopt=longest,menuone
" inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
" \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
" inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
" \ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
" Map escape key to jj -- much faster
imap jj <esc>
" Delete all buffers (via Derek Wyatt)
nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr>
" Bubble single lines (kicks butt)
" http://vimcasts.org/episodes/bubbling-text/
nmap <C-Up> ddkP
nmap <C-Down> ddp
" Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
" Source the vimrc file after saving it. This way, you don't have to reload Vim to see the changes.
if has("autocmd")
augroup myvimrchooks
au!
autocmd bufwritepost .vimrc source ~/.vimrc
augroup END
endif
" easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
" ------------------------ "
" NERDTREE PLUGIN SETTINGS
" ------------------------ "
" Shortcut for NERDTreeToggle
nmap <leader>nt :NERDTreeToggle <CR>
" Show hidden files in NerdTree
let NERDTreeShowHidden=1
" autopen NERDTree and focus cursor in new document
" autocmd VimEnter * NERDTree
" autocmd VimEnter * wincmd p
" Helpeful abbreviations
iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" Spelling corrects. Just for example. Add yours below.
iab teh the
iab Teh The
" Get to home dir easier
" <leader>hm is easier to type than :cd ~
nmap <leader>hm :cd ~/ <CR>
" Shortcut to opening a virtual split to right of current pane
" Makes more sense than opening to the left
nmap <leader>bv :bel vsp
" Saves file when Vim window loses focus
" au FocusLost * :wa
" Save folds
au BufWinLeave * mkview
" au BufWinEnter * silent loadview
" Backups
set backupdir=~/.vim/tmp/backups// " backups
set directory=~/.vim/tmp/swap// " swap files
set backup " enable backup
" No more stretching for navigating files
" noremap h ;
" noremap j h
" noremap k gj
" noremap l gk
" noremap ; l
" show matching brackets
set showmatch
" print empty <a> tag
map! ;h <a href=""></a><ESC>5hi
" Setup ctrlp
set runtimepath^=~/.vim/bundle/ctrlp.vim