-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
70 lines (60 loc) · 2.74 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
execute pathogen#infect()
syntax on
filetype plugin indent on
set smarttab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set expandtab
set ruler
" GUI options
set guioptions+=T
" Color scheme
colorscheme wombat256mod
" trim trailing whitespace on any write
autocmd! BufWrite * mark ' | silent! %s/\s\+$// | norm ''
" trim whitespace at end of file on any write
autocmd BufWrite * mark ' | silent! g/^[\s\l\n]*\%$/d | norm ''
au BufReadCmd *.sonas.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.xiv.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.svc.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.ds.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.vmware.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.cisco_mds.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.netapp7mode.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.ibmi.Z call tar#Browse(expand("<amatch>"))
au BufReadCmd *.ibmi.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.brocade.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.ds8k.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.flash.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.gpfscluster.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.gem call tar#Browse(expand("<amatch>"))
au BufReadCmd *.isilon.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.oracle.gz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.hitachi.gz call tar#Browse(expand("<amatch>"))
au BufNewFile,BufRead *.rspec set filetype=ruby
" Omni completion (autocomplete) options
set completeopt=longest,menuone
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
" Smart tab-key mapping; insert tab at beginning of line, trigger autocomplete
" elsewehere
function! Smart_TabComplete()
let line = getline('.') " current line
let substr = strpart(line, -1, col('.')+1) " from the start of the current
" line to one character right
" of the cursor
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return "\<tab>"
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return "\<C-X>\<C-P>" " existing text matching
elseif ( has_slash )
return "\<C-X>\<C-F>" " file matching
else
return "\<C-X>\<C-O>" " plugin matching
endif
endfunction