diff options
author | Mike Crute <mcrute@gmail.com> | 2010-07-02 07:44:20 -0400 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2010-07-02 07:44:20 -0400 |
commit | a65257b8506ecc73b63e4dbb7522f5d667d33304 (patch) | |
tree | c3d80616f8622c503cf6f435217d225de5635cae /.vimrc | |
parent | 2182f6229d021dc405de6267abf253572d67a13a (diff) | |
download | dotfiles-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-- | .vimrc | 147 |
1 files changed, 18 insertions, 129 deletions
@@ -49,6 +49,10 @@ autocmd BufNewFile,BufRead,BufReadPost *.pd | |||
49 | autocmd BufNewFile,BufRead,BufReadPost /*apache* | 49 | autocmd BufNewFile,BufRead,BufReadPost /*apache* |
50 | \ set syntax=apache | 50 | \ set syntax=apache |
51 | 51 | ||
52 | " JAD (Java Decompiled) Files | ||
53 | autocmd BufNewFile,BufRead,BufReadPost *.jad | ||
54 | \ set syntax=java | ||
55 | |||
52 | " Jinja2 Templates | 56 | " Jinja2 Templates |
53 | autocmd BufNewFile,BufRead,BufReadPost *.tmpl | 57 | autocmd 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 | ||
60 | autocmd Filetype html,xml,xsl | 64 | autocmd 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 {{{ |
64 | set backspace=indent,eol,start | 68 | set backspace=indent,eol,start |
@@ -72,6 +76,7 @@ set nojoinspaces | |||
72 | set backup | 76 | set backup |
73 | set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp | 77 | set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp |
74 | set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp | 78 | set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp |
79 | set listchars=tab:▸\ ,eol:¬ | ||
75 | set vb t_vb= | 80 | set vb t_vb= |
76 | let mapleader="," | 81 | let 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 |
120 | let g:closetag_html=1 | 125 | let g:closetag_html=1 |
126 | |||
127 | " Some sane defaults for the explorer | ||
128 | let g:explHideFiles='^\.,.*\.sw[po]$,.*\.pyc$' | ||
129 | let 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 |
124 | command TrimSpaces %s/\s\+$//e | 133 | command TrimSpaces %s/\s\+$//e |
125 | command FixLineEnd %s/ //gi | 134 | command FixLineEnd %s/ //gi |
126 | command PEP8 call IsPEP8() | 135 | command ReIndent !reindent % |
127 | command W write | 136 | command W write |
128 | " }}} | 137 | " }}} |
129 | " Folding Settings {{{ | 138 | " Folding Settings {{{ |
@@ -136,14 +145,6 @@ let python_highlight_all=1 | |||
136 | 145 | ||
137 | autocmd FileType python | 146 | autocmd FileType python |
138 | \ set omnifunc=pythoncomplete#Complete | 147 | \ set omnifunc=pythoncomplete#Complete |
139 | |||
140 | function! CheckIt() | ||
141 | if executable("pylint") | ||
142 | !pylint % | ||
143 | elseif executable("agi-pep8.py") | ||
144 | !agi-pep8.py % | ||
145 | endif | ||
146 | endfunction | ||
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) |
179 | endfunction | 180 | endfunction |
180 | " }}} | 181 | " }}} |
181 | " Invisibles Display {{{ | ||
182 | function! 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 | |||
266 | endfunction | ||
267 | call Cream_listchars_init() | ||
268 | " }}} | ||
269 | " {{{ Mercurial Support | ||
270 | nnoremap <leader>qs :!hg qseries | ||
271 | nnoremap <leader>qS :!hg status | ||
272 | |||
273 | function! 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 | ||
293 | endfunction | ||
294 | " }}} | ||
295 | " Key Bindings {{{ | 182 | " Key Bindings {{{ |
296 | set pastetoggle=<F12> | ||
297 | |||
298 | " Tab Key Bindings | 183 | " Tab Key Bindings |
299 | map nt :tabnew<CR> | 184 | map nt :tabnew<CR> |
300 | map tm :tabmove<CR> | 185 | map tm :tabmove<CR> |
@@ -308,6 +193,12 @@ map <C-h> :bprev!<CR> | |||
308 | map bn :bnext<CR> | 193 | map bn :bnext<CR> |
309 | map bp :bprev<CR> | 194 | map bp :bprev<CR> |
310 | 195 | ||
196 | " Window Key Bindings | ||
197 | map wj <C-w>j<CR> | ||
198 | map wk <C-w>k<CR> | ||
199 | map wh <C-w>h<CR> | ||
200 | map wl <C-w>l<CR> | ||
201 | |||
311 | " Paging Key Bindings | 202 | " Paging Key Bindings |
312 | map df <C-f> | 203 | map df <C-f> |
313 | map fd <C-b> | 204 | map fd <C-b> |
@@ -317,13 +208,11 @@ map <unique> <leader>tl :TlistToggle<CR> | |||
317 | map <unique> <leader>fe :Vexplore<CR> | 208 | map <unique> <leader>fe :Vexplore<CR> |
318 | 209 | ||
319 | nmap \ih :call InsertTemplate("header", 1)<CR> | 210 | nmap \ih :call InsertTemplate("header", 1)<CR> |
320 | map <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 |
324 | map cs :let @/=""<CR> | 214 | map cs :let @/=""<CR> |
325 | map sp :set spell!<CR> | 215 | map sp :set spell!<CR> |
326 | map txt :set filetype=text<CR> | ||
327 | 216 | ||
328 | " GUI-style Saving! | 217 | " GUI-style Saving! |
329 | map <C-s> :w<CR> | 218 | map <C-s> :w<CR> |
@@ -332,7 +221,7 @@ map <C-s> :w<CR> | |||
332 | vnoremap <leader>dc :s/\v\C(([a-z]+)([A-Z]))/\2_\l\3/g<CR> | 221 | vnoremap <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 |
335 | nnoremap <leader>lp :!python %:p<CR> | 224 | nnoremap <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 |