summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2010-07-02 07:44:20 -0400
committerMike Crute <mike@crute.us>2010-07-02 07:44:20 -0400
commita65257b8506ecc73b63e4dbb7522f5d667d33304 (patch)
treec3d80616f8622c503cf6f435217d225de5635cae /.vimrc
parent2182f6229d021dc405de6267abf253572d67a13a (diff)
downloaddotfiles-a65257b8506ecc73b63e4dbb7522f5d667d33304.tar.bz2
dotfiles-a65257b8506ecc73b63e4dbb7522f5d667d33304.tar.xz
dotfiles-a65257b8506ecc73b63e4dbb7522f5d667d33304.zip
Cleaning up visual mode and key bindings in vimrc
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc147
1 files changed, 18 insertions, 129 deletions
diff --git a/.vimrc b/.vimrc
index b129a60..1a5543c 100644
--- a/.vimrc
+++ b/.vimrc
@@ -49,6 +49,10 @@ autocmd BufNewFile,BufRead,BufReadPost *.pd
49autocmd BufNewFile,BufRead,BufReadPost /*apache* 49autocmd BufNewFile,BufRead,BufReadPost /*apache*
50 \ set syntax=apache 50 \ set syntax=apache
51 51
52" JAD (Java Decompiled) Files
53autocmd BufNewFile,BufRead,BufReadPost *.jad
54 \ set syntax=java
55
52" Jinja2 Templates 56" Jinja2 Templates
53autocmd BufNewFile,BufRead,BufReadPost *.tmpl 57autocmd BufNewFile,BufRead,BufReadPost *.tmpl
54 \ set syntax=jinja 58 \ set syntax=jinja
@@ -58,7 +62,7 @@ autocmd BufNewFile,BufRead *.py
58 \ setlocal foldmarker=#{,#} 62 \ setlocal foldmarker=#{,#}
59 63
60autocmd Filetype html,xml,xsl 64autocmd Filetype html,xml,xsl
61 \ source ~/.vim/scripts/scripts/closetag.vim 65 \ source ~/.vim/scripts/closetag.vim
62" }}} 66" }}}
63" General Settings {{{ 67" General Settings {{{
64set backspace=indent,eol,start 68set backspace=indent,eol,start
@@ -72,6 +76,7 @@ set nojoinspaces
72set backup 76set backup
73set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp 77set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp
74set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp 78set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp
79set listchars=tab:▸\ ,eol:¬
75set vb t_vb= 80set vb t_vb=
76let mapleader="," 81let mapleader=","
77" }}} 82" }}}
@@ -118,12 +123,16 @@ let g:explVertical=1
118 123
119" Set closing tag style for closetag.vim 124" Set closing tag style for closetag.vim
120let g:closetag_html=1 125let g:closetag_html=1
126
127" Some sane defaults for the explorer
128let g:explHideFiles='^\.,.*\.sw[po]$,.*\.pyc$'
129let g:explDetailedHelp=0
121" }}} 130" }}}
122" Custom Commands {{{ 131" Custom Commands {{{
123" Cleanup windows crap from line endings 132" Cleanup windows crap from line endings
124command TrimSpaces %s/\s\+$//e 133command TrimSpaces %s/\s\+$//e
125command FixLineEnd %s/ //gi 134command FixLineEnd %s/ //gi
126command PEP8 call IsPEP8() 135command ReIndent !reindent %
127command W write 136command W write
128" }}} 137" }}}
129" Folding Settings {{{ 138" Folding Settings {{{
@@ -136,14 +145,6 @@ let python_highlight_all=1
136 145
137autocmd FileType python 146autocmd FileType python
138 \ set omnifunc=pythoncomplete#Complete 147 \ set omnifunc=pythoncomplete#Complete
139
140function! CheckIt()
141 if executable("pylint")
142 !pylint %
143 elseif executable("agi-pep8.py")
144 !agi-pep8.py %
145 endif
146endfunction
147" }}} 148" }}}
148" Line and Column Highlighting {{{ 149" Line and Column Highlighting {{{
149"autocmd BufEnter * call SetColumnHighlighting(1) 150"autocmd BufEnter * call SetColumnHighlighting(1)
@@ -178,123 +179,7 @@ function! DoTextMode()
178 call SetColumnHighlighting(0) 179 call SetColumnHighlighting(0)
179endfunction 180endfunction
180" }}} 181" }}}
181" Invisibles Display {{{
182function! Cream_listchars_init()
183 set listchars=
184
185 " tab
186 if v:version < 603
187 " greaterthan, followed by space
188 execute "set listchars+=tab:" . nr2char(62) . '\ '
189 elseif strlen(substitute(strtrans(nr2char(187)), ".", "x", "g")) == 1
190 " right angle quote, guillemotright followed by space (digraph >>)
191 execute "set listchars+=tab:" . nr2char(187) . '\ '
192 else
193 " greaterthan, followed by space
194 execute "set listchars+=tab:" . nr2char(62) . '\ '
195 endif
196
197 " eol
198 if v:version < 603
199 " dollar sign
200 execute "set listchars+=eol:" . nr2char(36)
201 elseif strlen(substitute(strtrans(nr2char(182)), ".", "x", "g")) == 1
202 " paragrah symbol (digraph PI)
203 execute "set listchars+=eol:" . nr2char(182)
204 else
205 " dollar sign
206 execute "set listchars+=eol:" . nr2char(36)
207 endif
208
209 " trail
210 if v:version < 603
211 " period
212 execute "set listchars+=trail:" . nr2char(46)
213 elseif strlen(substitute(strtrans(nr2char(183)), ".", "x", "g")) == 1
214 " others digraphs: 0U 0M/M0 sB .M 0m/m0 RO
215 " middle dot (digraph .M)
216 execute "set listchars+=trail:" . nr2char(183)
217 else
218 " period
219 execute "set listchars+=trail:" . nr2char(46)
220 endif
221
222 " precedes
223 if v:version < 603
224 " underscore
225 execute "set listchars+=precedes:" . nr2char(95)
226 elseif strlen(substitute(strtrans(nr2char(133)), ".", "x", "g")) == 1
227 " ellipses
228 execute "set listchars+=precedes:" . nr2char(133)
229 elseif strlen(substitute(strtrans(nr2char(8230)), ".", "x", "g")) == 1
230 " ellipses (2nd try)
231 execute "set listchars+=precedes:" . nr2char(8230)
232 elseif strlen(substitute(strtrans(nr2char(8249)), ".", "x", "g")) == 1
233 \&& v:lang != "C"
234 " mathematical lessthan (digraph <1)
235 execute "set listchars+=precedes:" . nr2char(8249)
236 elseif strlen(substitute(strtrans(nr2char(8592)), ".", "x", "g")) == 1
237 " left arrow (digraph <-)
238 execute "set listchars+=precedes:" . nr2char(8592)
239 else
240 " underscore
241 execute "set listchars+=precedes:" . nr2char(95)
242 endif
243
244 " extends
245 if v:version < 603
246 " underscore
247 execute "set listchars+=extends:" . nr2char(95)
248 elseif strlen(substitute(strtrans(nr2char(133)), ".", "x", "g")) == 1
249 " ellipses
250 execute "set listchars+=extends:" . nr2char(133)
251 elseif strlen(substitute(strtrans(nr2char(8230)), ".", "x", "g")) == 1
252 " ellipses (2nd try)
253 execute "set listchars+=extends:" . nr2char(8230)
254 elseif strlen(substitute(strtrans(nr2char(8250)), ".", "x", "g")) == 1
255 \&& v:lang != "C"
256 " mathematical greaterthan (digraph >1)
257 execute "set listchars+=extends:" . nr2char(8250)
258 elseif strlen(substitute(strtrans(nr2char(8594)), ".", "x", "g")) == 1
259 " right arrow (digraph ->)
260 execute "set listchars+=extends:" . nr2char(8594)
261 else
262 " underscore
263 execute "set listchars+=extends:" . nr2char(95)
264 endif
265
266endfunction
267call Cream_listchars_init()
268" }}}
269" {{{ Mercurial Support
270nnoremap <leader>qs :!hg qseries
271nnoremap <leader>qS :!hg status
272
273function! HGNewPatch()
274 let dirty_copy = system(join(["hg st", "wc -l", "awk '{print $1}'"], '|')) > 0
275
276 let patch_name = input('Patch name: ')
277 let commit_message = input('Commit message: ')
278
279 if dirty_copy && input('Force create patch (y/n)? ') == 'y'
280 let messages = system("hg qnew -f -m '".commit_message."' ".patch_name)
281 else
282 let messages = system("hg qnew -m '".commit_message."' ".patch_name)
283 endif
284
285 if v:shell_error != 0
286 hi RedBar ctermfg=white ctermbg=red guibg=red
287 echohl RedBar
288 echo messages
289 echohl
290 else
291 echo
292 endif
293endfunction
294" }}}
295" Key Bindings {{{ 182" Key Bindings {{{
296set pastetoggle=<F12>
297
298" Tab Key Bindings 183" Tab Key Bindings
299map nt :tabnew<CR> 184map nt :tabnew<CR>
300map tm :tabmove<CR> 185map tm :tabmove<CR>
@@ -308,6 +193,12 @@ map <C-h> :bprev!<CR>
308map bn :bnext<CR> 193map bn :bnext<CR>
309map bp :bprev<CR> 194map bp :bprev<CR>
310 195
196" Window Key Bindings
197map wj <C-w>j<CR>
198map wk <C-w>k<CR>
199map wh <C-w>h<CR>
200map wl <C-w>l<CR>
201
311" Paging Key Bindings 202" Paging Key Bindings
312map df <C-f> 203map df <C-f>
313map fd <C-b> 204map fd <C-b>
@@ -317,13 +208,11 @@ map <unique> <leader>tl :TlistToggle<CR>
317map <unique> <leader>fe :Vexplore<CR> 208map <unique> <leader>fe :Vexplore<CR>
318 209
319nmap \ih :call InsertTemplate("header", 1)<CR> 210nmap \ih :call InsertTemplate("header", 1)<CR>
320map <silent><F6> :call SVNDiff()<CR>
321 211
322" Convenience Key Bindings 212" Convenience Key Bindings
323" cs: clears search buffer 213" cs: clears search buffer
324map cs :let @/=""<CR> 214map cs :let @/=""<CR>
325map sp :set spell!<CR> 215map sp :set spell!<CR>
326map txt :set filetype=text<CR>
327 216
328" GUI-style Saving! 217" GUI-style Saving!
329map <C-s> :w<CR> 218map <C-s> :w<CR>
@@ -332,7 +221,7 @@ map <C-s> :w<CR>
332vnoremap <leader>dc :s/\v\C(([a-z]+)([A-Z]))/\2_\l\3/g<CR> 221vnoremap <leader>dc :s/\v\C(([a-z]+)([A-Z]))/\2_\l\3/g<CR>
333 222
334" Run python scripts and display the output 223" Run python scripts and display the output
335nnoremap <leader>lp :!python %:p<CR> 224nnoremap <leader>p :!python %:p<CR>
336" }}} 225" }}}
337" {{{ Workarounds For Broken Shit 226" {{{ Workarounds For Broken Shit
338" Without this fix you can't write a Mac OS X crontab file 227" Without this fix you can't write a Mac OS X crontab file