-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvimrc
More file actions
283 lines (218 loc) · 8.22 KB
/
vimrc
File metadata and controls
283 lines (218 loc) · 8.22 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
" Mephux <dustin.webber[at]gmail.com>
" ~/.VIMRC
set nocompatible " Must come first because it changes others
set shell=/bin/sh
" Setup Pathogen
filetype off " force reloading *after* pathogen loaded
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on " Turn on file type detection.
syntax on " syntax highlighting
"some stuff to get the mouse going in term
set mouse=a
set ttymouse=xterm2
set synmaxcol=2048 " Syntax coloring lines that are too
" long just slows down the world
set t_Co=256 " 256 colors
set background=dark
colorscheme epix
match LongLineWarning '\%>80v.\+'
set autoread
set winfixwidth
set ttyfast " you have a fast terminal
set ttyscroll=3
set lazyredraw " avoid scrolling problems
" Windowing settings
set equalalways " keep windows equal when splitting (default)
set eadirection=both " ver/hor/both - where does equalalways apply
set winheight=6 " height of current window
set showcmd
set laststatus=2 " Show the status line all the time
" I don't like it when the matching parens are automatically highlighted
" let loaded_matchparen = 1
set autoindent " automatic indent new lines
set smartindent " be smart about it
set nowrap " do not wrap lines
set softtabstop=2 " yep, two
set shiftwidth=2 " ..
set tabstop=2
set expandtab " expand tabs to spaces
set nosmarttab " no tabs
set formatoptions+=n " support for numbered/bullet lists
set textwidth=80 " wrap at 80 chars by default
set virtualedit=block " allow virtual edit in visual block mode
" Mark the ideal max text width
if exists('+colorcolumn')
set colorcolumn=80
endif
" Folding settings
set foldmethod=indent
set foldnestmax=3 " deepest fold is 3 levels
set nofoldenable " dont fold by default
set encoding=utf-8 " Set encoding
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
set wildmenu " Enhanced command line completion.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains
" a capital letter.
set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
" set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
" Terminal settings
set vb t_vb= " shut off bell entirely; see also .gvimrc
set title " Set the terminal's title
set visualbell " No beeping.
" Don't make a backup before overwriting a file.
set nobackup
set nowritebackup
" Keep swap files in one location
" +=,$HOME/.vim/tmp/
set directory=$HOME/.vim/tmp/,.
" Hide the mouse pointer while typing
set mousehide
" Allow the cursor to go in to 'invalid' places
" set virtualedit=all
" When the page starts to scroll, keep the cursor 8 lines from the top and 8
" lines from the bottom
set scrolloff=8
" Disable encryption (:X)
" set key=
" Wipe out all buffers
nmap <silent> ,wa :1,9000bwipeout<cr>
" put the vim directives for my file editing settings in
nmap <silent> ,vi ovim:set ts=2 sts=2 sw=2:<CR>vim600:fdm=marker fdl=1 fdc=0:<ESC>
" Turn off that stupid highlight search
nmap <silent> ,n :nohls<CR>
" set text wrapping toggles
nmap <silent> ,ww :set invwrap<CR>:set wrap?<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: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:nohls<CR
" CTags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
map <C-\> :tnext<CR>
" TagBar
map <Leader>o :TagbarToggle<CR>
" Underline the current line with '='
nmap <silent> ,ul :t.\|s/./=/g\|:nohls<cr>
" Zencoding Keymap
let g:user_zen_expandabbr_key = '<D-e>'
" Remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" Quickly edit/reload the vimrc file
nmap <silent> <leader>v :tabedit $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Edit .gvimrc
nmap <leader>g :tabedit $MYGVIMRC<CR>
" Source the vimrc file after saving it
" This can get really slow when making quick changes.
"if has("autocmd")
" autocmd bufwritepost .vimrc source $MYVIMRC
"autocmd bufwritepost .gvimrc source $MYVIMRC
"endif
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" Node/EJS
au BufRead,BufNewFile *.ejs set ft=html
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Unimpaired configuration
" Bubble single lines
nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines
vmap <C-Up> [egv
vmap <C-Down> ]egv
" Enable syntastic syntax checking
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=1
" MacVIM shift+arrow-keys behavior (required in .vimrc)
if has("gui_macvim")
let macvim_hig_shift_movement = 1
set selection=exclusive
" set selectmode=
endif
"nerdtree settings
map <Leader>p :NERDTree<Enter>
let g:NERDTreeMouseMode = 2
let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks")
let NERDTreeShowBookmarks=0
let g:NERDTreeWinSize = 30
let NERDTreeHighlightCursorline=1
" Show hidden files, too
let NERDTreeShowFiles=1
let NERDTreeShowHidden=0
" Gundo Change View
map <Leader>z :GundoToggle<Enter>
let g:gundo_width = 60
let g:gundo_preview_height = 40
let g:gundo_right = 1
" Buffer Explorer
map <leader>b :BufExplorer<Enter>
" pastetoggle (sane indentation on pastes)
set pastetoggle=<Leader>1
" Run Ruby Code
" nmap <D-r> :update<CR>:!ruby %<Enter>
" vmap <D-r> :update<CR>:!ruby %<Enter>
" imap <D-r> <Esc>:update<CR>:!ruby %<Enter>
nmap <D-b> :SCCompile<cr>
nmap <D-r> :update<CR>:SCCompileRun<cr>
vmap <D-r> :update<CR>:SCCompileRun<cr>
imap <D-r> <Esc>:SCCompileRun<cr>
" Force Save
cmap w!! w !sudo tee % >/dev/null
" Automatic fold settings for specific files. Uncomment to use.
" autocmd FileType ruby set foldmethod=syntax
autocmd FileType css setlocal foldmethod=indent shiftwidth=2 tabstop=2
autocmd filetype svn,*commit* setlocal spell
" Wrap Word
nmap <leader>w ysW
" Status Line Setup
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\
" Git branch and status
set statusline+=%{fugitive#statusline()}
" Display a warning if &paste is set
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':''}
set statusline+=%*
" Column/Line Information
set statusline+=%=%-10(\ %l,%c-%v\ %)
set statusline+=\ %P "percent through file
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
endif
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" Strip all trailing whitespace from a file, using ,w
nnoremap <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
" Highlight the current line and column
" Don't do this - It makes window redraws painfully slow
set nocursorline
set nocursorcolumn