-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
288 lines (231 loc) · 6.46 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
"Leah's vimrc
"General
"
" Useful Resources:
" http://zmievski.org/files/talks/codeworks-2009/vim-for-php-programmers.pdf
" Derek Wyatt's vimrc
" https://github.com/derekwyatt/vim-config/blob/master/vimrc
set wildignore+=*/tmp*,*.so,*.swp,*.zip,*.pyc,*.class
"Gui
if has('gui_running')
set guifont=Monospace:12
endif
"enable mouse
set mouse=a
" Many a man fails as an original thinker simply because his memory is too good. -Nietzsche
"you know, command line history
set history=1000
"virtualedit
"cursor doesn't just snap to text
set virtualedit=all
set showmode
"use per-directory exuberant ctags
set tags=./tags;/
"current buffer can be put to background without writing to disk
"marks and undos are remembered when a background process is foregrounded
set hidden
"no pinky jumps (default leader is \)
let mapleader = ","
let maplocalleader = "\\"
"want most completion options rather than let the dumb algorithm guess
set wildmode=list:longest
"for screen and tmux, this is more informative
set title
"search options
set hlsearch
set incsearch
set wrapscan "wrap around search
"ack is prettier
set grepprg=ack-grep
"General aesthetics
set background=dark
set guifont=Monaco:h18
let g:solarized_termcolors=16 "need this for something?
set number
syntax enable
"highlight whenever line is over 80chars
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/
"show tabs as errors
syn match tab display "\t"
hi link tab Error"
"backspace
set backspace=2
"Omnicompletion
set ofu=syntaxcomplete#Complete
"Emacs bindings for command line
cmap <C-p> <Up>
cmap <C-n> <Down>
cmap <C-b> <Left>
cmap <C-f> <Right>
cmap <C-a> <Home>
cmap <C-e> <End>
cmap <M-b> <S-Left>
cmap <M-f> <S-Right>
cnoremap <C-d> <Del>
cnoremap <C-h> <BS>
cnoremap <M-d> <S-Right><C-w>
cnoremap <M-h> <C-w>
cnoremap <C-k> <C-f>D<C-c><C-c>:<Up>
"Informative status line(copied)
"from Derek Wyatt's blog
set stl=%f\ %m\ %r%{fugitive#statusline()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B]\ %y
" set laststatus=2
" set showmode
"Window movement keys
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
"LaTeX
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
"Package Management
" switch to Vundle
" install with: $ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'https://github.com/altercation/vim-colors-solarized.git'
Bundle "tslime.vim"
Bundle 'Tagbar'
Bundle 'scrooloose/nerdtree'
Bundle 'surround.vim'
Bundle 'ack.vim'
Bundle 'trailing-whitespace'
Bundle 'bufexplorer.zip'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/vim-statline'
Bundle 'micheljansen/vim-latex'
Bundle 'snipMate'
Bundle 'Conque-Shell'
Bundle 'scrooloose/nerdcommenter'
Bundle 'vim-flake8'
Bundle 'ctrlp.vim'
Bundle 'pangloss/vim-javascript'
Bundle 'tpope/vim-eunuch'
Bundle 'Better-CSS-Syntax-for-Vim'
Bundle 'neocomplcache'
Bundle 'EasyMotion'
Bundle 'Superior-Haskell-Interaction-Mode-SHIM'
Bundle 'adimit/prolog.vim'
filetype plugin indent on
color solarized
"vim-javascript
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
"Haskell-mode
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
"NERDTree
nnoremap <silent> <F2> :NERDTreeToggle<CR>
nnoremap <leader>r :NERDTreeFind<CR>
let g:NERDTreeDirArrows=0
"Vim-LaTeX
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_ViewRule_pdf='open -a Preview'
" Conqueterm
" http://code.google.com/p/conque/wiki/Usage
let g:ConqueTerm_color = 1
let g:ConqueTerm_InsertOnEnter = 1
"ctrl-p
let g:ctrlp_max_depth=20
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|rvm)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
" searching speed
let g:ctrlp_max_files = 100000
if has("unix")
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files']
\ },
\ 'fallback': 'find %s -type f | head -' . g:ctrlp_max_files
\ }
endif
"Ack-grep
let g:ackprg="ack-grep"
"VimClojure
let vimclojure#HighlightBuiltins=1
let vimclojure#FuzzyIndent=1
let vimclojure#HighlightContrib=1
let vimclojure#DynamicHighlighting=1
let vimclojure#ParenRainbow=1
let vimclojure#WantNailgun = 1
"statline
let g:statline_fugitive=1
"klen/python-mode
let g:pymode_folding=0
""""""""""""""""""""
" Custom Functions "
""""""""""""""""""""
function! InsertPdbPython()
let trace = expand("import pdb; pdb.set_trace()")
execute "normal o".trace
endfunction
function! InsertHphpBreak()
let trace = expand("hphpd_break();")
execute "normal o".trace
endfunction
""""""""""""
" MAPPINGS "
""""""""""""
nnoremap <leader>p :call InsertPdbPython()<CR>
nnoremap <leader>pb :call InsertHphpBreak()<CR>
"arrow keys - don't cheat
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
"makes highlight search much less annoying
nnoremap <silent> <F3> :set hlsearch!<CR>
"Tagbar
nnoremap <silent> <F8> :TagbarToggle<CR>
"vimrc
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
"esc
inoremap jj <esc>
"Window navigation
noremap <silent> <C-h> :wincmd h<CR>
noremap <silent> <C-l> :wincmd l<CR>
noremap <silent> <C-j> :wincmd j<CR>
noremap <silent> <C-k> :wincmd k<CR>
""""""""""""""""""""
" FILETYPE COMMANDS"
""""""""""""""""""""
augroup filetypeindent
autocmd!
autocmd BufRead, BufNewFile *.sage, *.pyx, *.spyx set filetype=python
augroup END
augroup indent_rules
"clear autocmds in group on reload
autocmd!
autocmd FileType python setlocal ai tabstop=4 expandtab shiftwidth=4 backspace=indent
autocmd FileType clojure setlocal expandtab ai tabstop=2 shiftwidth=2 softtabstop=2
autocmd Filetype c setlocal tabstop=4 shiftwidth=4 expandtab cindent
autocmd Filetype php setlocal shiftwidth=2 expandtab tabstop=2 softtabstop=2 autoindent
augroup END
augroup ext_rules
autocmd!
" prolog > perl. duh
autocmd FileType pl set syntax=prolog
augroup END
""""""""""""""""""
" Facebook Stuff "
" """"""""""""""""
source /home/engshare/admin/scripts/vim/biggrep.vim
augroup filetypedetect
au! BufRead,BufNewFile *.phpt setfiletype php
autocmd Filetype java setlocal shiftwidth=2 expandtab tabstop=2 softtabstop=2 autoindent
augroup END