github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

askedrelic / homedir

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

My linux home directory — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Latest changes from my home directory. 
askedrelic (author)
Mon Jan 25 13:45:24 -0800 2010
commit  758a9278393952e5ebad720624f8beb50ac64bd6
tree    e2104de998c309e9c065cada6fd8d0c11b2f47a5
parent  db28e8e452a2c6f3e86ede6774d32796d8332752
homedir / .vimrc.vim .vimrc.vim
100644 530 lines (453 sloc) 17.201 kb
edit raw blame history
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
"Vim file is organized into
" 1. Vim Settings (many subcategories)
" 2. Aliases and key functions
" 3. Plugins
"
" -----------------------------------------------------------------------------
" | VIM Settings |
" -----------------------------------------------------------------------------
set nocompatible
 
" first clear any existing autocommands:
autocmd!
 
" Restore the screen when we're exiting and set correct terminal
behave xterm
if &term == "xterm"
    let &term = "xtermc"
 
    set rs
    set t_ti= 7 [r [?47h
    set t_te= [?47l 8
endif
 
 
" General *********************************************************************
" save last 50 search history items, last 50 edit marks, don't remember search
" highlight
set viminfo=/50,'50,h
 
" Custom status line
set statusline= " clear the statusline for when vimrc is reloaded
set statusline+=%f\ " file name
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%h%m%r%w " flags
set statusline+=%= "left/right separator
" set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\ " highlight
set statusline+=%b,0x%-6B " current char
set statusline+=%c,%l/ "cursor column/total lines
set statusline+=%L\ %P "total lines/percentage in file
 
" allow you to have multiple files open and change between them without saving
set hidden
"make backspace work
set backspace=indent,eol,start
" Show line numbers
set number
" Show matching brackets.
set showmatch
" have % bounce between angled brackets, as well as other kinds:
set matchpairs+=<:>
set comments=s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:-
" This being the 21st century, I use Unicode
set encoding=utf-8
" Don't keep a backup file
set nobackup
" keep 100 lines of command line history
set history=100
" Automatically save before commands like :next and :make
set autowrite
" report: show a report when N lines were changed. 0 means 'all'
set report=0
" runtimepath: list of dirs to search for runtime files
set runtimepath+=~/.vim
" Like File Explorer, preview window height is 8
set previewheight=8
" always show status line
set ls=2
" Turn off bell, this could be more annoying, but I'm not sure how
set vb t_vb=
 
" when using list, keep tabs at their full width and display `arrows':
" (Character 187 is a right double-chevron, and 183 a mid-dot.)
execute 'set listchars+=tab:' . nr2char(187) . nr2char(183)
"check if file is written to elsewhere and ask to reload immediately, not when
"saving
au CursorHold * checktime
 
" Tabs **********************************************************************
 
function! Tabstyle_tabs()
" Using 4 column tabs
    set softtabstop=4
    set shiftwidth=4
    set tabstop=4
    set noexpandtab
endfunction
 
function! Tabstyle_spaces()
" Use 4 spaces
    set softtabstop=4
    set shiftwidth=4
    set tabstop=4
    set expandtab
endfunction
 
call Tabstyle_spaces()
 
" Scrollbars/Status ***********************************************************
set sidescrolloff=2
" top bottom scroll off
set scrolloff=2
" set numberwidth=4
" show in title bar
set title
" show the cursor position all the time
set ruler
" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd
 
" Bash tab style completion is awesome
set wildmode=longest,list
" wildchar-the char used for "expansion" on the command line default value is
" "<C-E>" but I prefer the tab key:
set wildchar=<TAB>
" ignore these files when completing
set wildignore=*~,#*#,*.sw?,*.o,*.obj,*.bak,*.exe,*.pyc,*.DS_Store,*.db,*.class,*.java.html,*.cgi.html,*.html.html,.viminfo,*.pdf
 
" shortmess: shorten messages where possible, especially to stop annoying
" 'already open' messages!
" set shortmess=atIAr
set shortmess=flnrxoOItTA
 
" Windows *********************************************************************
set splitbelow splitright
"
" don't always keep windows at equal size (for minibufexplorer)
set noequalalways
 
" Cursor highlights ***********************************************************
set cursorline
"set cursorcolumn
 
" Searching *******************************************************************
" highlight search
set hlsearch
" make searches case-insensitive
set ignorecase
"unless they contain upper-case letters:
set smartcase
" show the `best match so far' as search strings are typed:
set incsearch
" assume the /g flag on :s substitutions to replace all matches in a line:
set gdefault
" hide mouse on search
set mousehide
 
" Colors **********************************************************************
syntax on
set background=dark
if has("gui_running")
"set guifont=Consolas:h12.00 " use this font
    set transparency=6 " Barely transparent
    let moria_style = 'black'
    colo moria
    set lines=73 columns=263
" Turn off the button bar in gvim
    set guioptions-=T
    set guioptions-=m
" No scrollbars
    set guioptions-=r
    set guioptions-=l
    set guioptions-=R
    set guioptions-=L
else
    colorscheme ir_black
endif
 
" Omni Completion *************************************************************
" set ofu=syntaxcomplete#Complete
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
 
" Line Wrapping ***************************************************************
" don't make it look like there are line breaks where there aren't:
set nowrap
" Wrap at word
set linebreak
 
" have the h and l cursor keys wrap between lines (like <Space> and <BkSpc> do
" by default), and ~ covert case over line breaks; also have the cursor keys
" wrap in insert mode:
set whichwrap=h,l,~,[,]
 
" normally don't automatically format `text' as it is typed, IE only do this
" with comments, at 79 characters:
set formatoptions=cq
set textwidth=79
 
" treat lines starting with a quote mark as comments (for `Vim' files, such as
" this very one!), and colons as well so that reformatting usenet messages from
" `Tin' users works OK:
set comments+=b:\"
set comments+=n::
 
" File Stuff ******************************************************************
" To show current filetype use: set filetype
filetype plugin indent on
 
" Filetypes (au = autocmd)
au FileType helpfile set nonumber " no line numbers when viewing help
au FileType helpfile nnoremap <buffer><cr> <c-]> " Enter selects subject
au FileType helpfile nnoremap <buffer><bs> <c-T> " Backspace to go back
 
"Laszlo
au BufNewFile,BufRead *.lzx setf lzx
au BufNewFile,BufRead *.module setf php
au BufNewFile,BufRead *.inc setf php
au BufNewFile,BufRead *.pl,*.pm,*.t setf perl
 
" For C-like programming, have automatic indentation:
au FileType c,cpp,slang set cindent
 
" for actual C (not C++) programming where comments have explicit end
" characters, if starting a new line in the middle of a comment automatically
" insert the comment leader characters:
au FileType c set formatoptions+=ro
 
" for Perl programming, have things in braces indenting themselves:
au FileType perl set smartindent
 
au FileType python set formatoptions-=t
 
" we couldn't care less about html
au BufNewFile,BufRead *.htm,*.html setf xml
 
" for CSS, also have things in braces indented:
au FileType css set smartindent
 
" for HTML, generally format text, but if a long line has been created leave it
" alone when editing:
au FileType xhtml set formatoptions+=l
au FileType xhtml set formatoptions-=t
au FileType djangohtml set formatoptions+=l
au FileType djangohtml set formatoptions-=t
 
" Keep comments indented
" inoremap # #
 
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.svn,.git,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
 
"jump to last cursor position when opening a file
"dont do it when writing a svn commit log entry
"TODO do this for git commits?
autocmd BufReadPost * call SetCursorPosition()
function! SetCursorPosition()
  if &filetype !~ 'commit\c' && &filetype !~ 'svn\c'
    if line("'\"") > 0 && line("'\"") <= line("$")
     exe "normal g`\""
    endif
  end
endfunction
 
" tell complete to look in the dictionary
set complete-=k complete+=k
 
" if problems, check here
" http://vim.wikia.com/wiki/Completion_using_a_syntax_file
au FileType * exec('setlocal dict+='.$VIMRUNTIME.'/syntax/'.expand('<amatch>').'.vim')
 
" Redraw *********************************************************************
" lazyredraw: do not update screen while executing macros
"set lazyredraw
" ttyfast: are we using a fast terminal? Let's try it for a while.
set ttyfast
" ttyscroll: redraw instead of scrolling
"set ttyscroll=0
 
" -----------------------------------------------------------------------------
" | Aliases and custom key functions |
" -----------------------------------------------------------------------------
" Professor VIM says '87% of users prefer jj over esc', jj abrams strongly disagrees
imap jj <Esc>
 
" page down with <Space> (like in `Lynx', `Mutt', `Pine', `Netscape Navigator',
" `SLRN', `Less', and `More'); page up with - (like in `Lynx', `Mutt', `Pine'),
" or <BkSpc> (like in `Netscape Navigator'):
noremap <Space> <PageDown>
noremap - <PageUp>
 
" have <F1> prompt for a help topic, rather than displaying the introduction
" page, and have it do this from any mode:
nnoremap <F1> :help<Space>
vmap <F1> <C-C><F1>
omap <F1> <C-C><F1>
map! <F1> <C-C><F1>
 
 
" use <Ctrl>+N/<Ctrl>+P to cycle through files:
" [<Ctrl>+N by default is like j, and <Ctrl>+P like k.]
nnoremap <C-N> :bn<CR>
nnoremap <C-P> :bp<CR>
 
" swap windows
nmap , <C-w><C-w>
 
"move around windows with ctrl key!
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
 
" discussion of different tab functions
" http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion
 
" "trick to fix shift-tab http://vim.wikia.com/wiki/Make_Shift-Tab_work
map <Esc>[Z <s-tab>
ounmap <Esc>[Z
 
"---TAB BINDINGS
"Tab and Ctrl-i are bound to the same internal key with vim, therefore
"they cannot be bound to different commands in normal mode :(
"IE bind Tab to indent and Ctrl-I to 'move into movement stack'
nmap <S-Tab> :<<CR>
 
"Change tab of selected lines while in visual mode
vmap <Tab> >gv
vnoremap <S-Tab> <gv
 
" [<Ctrl>+V <Tab> still inserts an actual tab character.]
inoremap <Tab> <c-r>=InsertTabWrapper ("forward")<CR>
imap <S-Tab> <C-D>
 
" Remap TAB to keyword completion and indenting. The tab key is a still a work
" in progress.
function! InsertTabWrapper(direction)
" alternate line checking
"" let col = col('.') - 1
" if !col || strpart(getline('.'), col-1, col) =~ '\s'
  if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
    return "\<tab>"
  elseif "forward" == a:direction
    return "\<c-n>"
  elseif "backward" == a:direction
    return "\<c-d>"
  else
    return "\<c-x>\<c-k>"
  endif
endfunction
 
" imap <C-Tab> <c-r>=InsertTabWrapper ("startkey")<CR>
 
" toggle tab completion
" function! ToggleTabCompletion()
" if mapcheck("\<tab>", "i") != ""
" iunmap <tab>
" iunmap <s-tab>
" iunmap <c-tab>
" echo "tab completion off"
" else
" imap <tab> <c-n>
" imap <s-tab> <c-p>
" imap <c-tab> <c-x><c-l>
" echo "tab completion on"
" endif
" endfunction
" map <Leader>tc :call ToggleTabCompletion()<CR>
 
" insert new line without going into insert mode
nnoremap <Enter> o<ESC>
nnoremap <S-Enter> :put!=''<CR>
" set fo-=r " do not insert a comment leader after an enter, (no work, fix!!)
 
" have Q reformat the current paragraph (or selected text if there is any):
nnoremap Q gqap
vnoremap Q gq
 
" have Y behave analogously to D and C rather than to dd and cc (which is
" already done by yy):
noremap Y y$
 
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>
 
" toggle paste on/off
nnoremap \tp :set invpaste paste?<CR>
 
"toggle list on/off and report the change:
nnoremap \tl :set invlist list?<CR>
 
"toggle highlighting of search matches, and report the change:
nnoremap \th :set invhls hls?<CR>
 
"toggle numbers
nnoremap \tn :set number!<Bar> set number?<CR>
 
"toggle wrap and easy movement keys while in wrap mode
noremap <silent> <Leader>tw :call ToggleWrap()<CR>
function! ToggleWrap()
  if &wrap
    echo "Wrap OFF"
    setlocal nowrap
    set virtualedit=all
    silent! nunmap <buffer> k
    silent! nunmap <buffer> j
    silent! nunmap <buffer> 0
    silent! nunmap <buffer> $
    silent! nunmap <buffer> <Up>
    silent! nunmap <buffer> <Down>
    silent! nunmap <buffer> <Home>
    silent! nunmap <buffer> <End>
    silent! iunmap <buffer> <Up>
    silent! iunmap <buffer> <Down>
    silent! iunmap <buffer> <Home>
    silent! iunmap <buffer> <End>
  else
    echo "Wrap ON"
    setlocal wrap linebreak nolist
    set virtualedit=
    setlocal display+=lastline
    noremap <buffer> <silent> k gk
    noremap <buffer> <silent> j gj
    noremap <buffer> <silent> 0 g0
    noremap <buffer> <silent> $ g$
    noremap <buffer> <silent> <Up> gk
    noremap <buffer> <silent> <Down> gj
    noremap <buffer> <silent> <Home> g<Home>
    noremap <buffer> <silent> <End> g<End>
    inoremap <buffer> <silent> <Up> <C-o>gk
    inoremap <buffer> <silent> <Down> <C-o>gj
    inoremap <buffer> <silent> <Home> <C-o>g<Home>
    inoremap <buffer> <silent> <End> <C-o>g<End>
  endif
endfunction
 
" toggle showbreak for long lines
function! TYShowBreak()
  if &showbreak == ''
    set showbreak=>
    echo "show break on"
  else
    set showbreak=
    echo "show break off"
  endif
endfunction
nmap \tb TYShowBreak()
 
"clear the fucking search buffer, not just remove the highlight
map \c :let @/ = ""<CR>
 
" Revert the current buffer
nnoremap \r :e!<CR>
 
"Easy edit of vimrc
nmap \s :source $MYVIMRC<CR>
nmap \v :e $MYVIMRC<CR>
 
"show indent settings
nmap \I :verbose set ai? cin? cink? cino? si? inde? indk? formatoptions?<CR>
 
"replace all tabs with 4 spaces
" map \ft :%s/ / /g<CR>
 
"OSX only: Open a web-browser with the URL in the current line
function! HandleURI()
  let s:uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;]*')
  echo s:uri
  if s:uri != ""
   exec "!open \"" . s:uri . "\""
  else
   echo "No URI found in line."
  endif
endfunction
map \o :call HandleURI()<CR>
 
" Custom text inserts *********************************************************
"insert THE time!
"TODO move this into some kind of autotext complete thing
nmap \tt :execute "normal i" . strftime("%x %X (%Z) ")<Esc>
imap \tt <Esc>:execute "normal i" . strftime("%x %X (%Z) ")<Esc>i
 
" -----------------------------------------------------------------------------
" | Pluggins |
" -----------------------------------------------------------------------------
"Taglist
map \a :TlistToggle<CR>
" Jump to taglist window on open.
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Close_OnSelect=1
" if you are the last window, kill yourself
let Tlist_Exist_OnlyWindow = 1
" sort by order or name
let Tlist_Sort_Type = "order"
" do not show prototypes and not tags in the taglist window.
let Tlist_Display_Prototype = 0
" Remove extra information and blank lines from the taglist window.
let Tlist_Compart_Format = 1
" Show tag scope next to the tag name.
let Tlist_Display_Tag_Scope = 1
let Tlist_WinWidth = 40
" Show only current file
let Tlist_Show_One_File = 1
 
"NERDTree
map <silent> \e :NERDTreeToggle<CR>
let NERDTreeWinPos='right'
let NERDTreeChDirMode='2'
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyo$', '\.pyc$', '\.svn[\//]$', '\.swp$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
 
"FuzzyFinder
"Seriously FF, setting up your options sucks
if !exists('g:FuzzyFinderOptions')
    let g:FuzzyFinderOptions = { 'Base':{}, 'Buffer':{}, 'File':{}, 'Dir':{}, 'MruFile':{}, 'MruCmd':{}, 'Bookmark':{}, 'Tag':{}, 'TaggedFile':{}}
    let g:FuzzyFinderOptions.File.excluded_path = '\v\~$|\.o$|\.exe$|\.bak$|\.swp$|((^|[/\\])\.{1,2}[/\\]$)|\.pyo$|\.pyc$|\.svn[/\\]$'
    let g:FuzzyFinderOptions.Base.key_open_vsplit = '<Space>'
endif
let g:fuzzy_matching_limit = 50
let g:fuzzy_ceiling = 10000
let g:fuzzy_ignore = "*.log;*.pyc;*.svn;"
map <silent> \f :FuzzyFinderTextMate<CR>
map <silent> \F :FuzzyFinderTextMateRefreshFiles<CR>:FuzzyFinderTextMate<CR>
map <silent> \b :FuzzyFinderBuffer!<CR>
 
"newrw
let g:netrw_hide = 1
let g:netrw_list_hide = '^\.svn.*'
let g:netrw_menu = 0
let g:netrw_silent = 1
let g:netrw_special_syntax = 1
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server