-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
135 lines (117 loc) · 3.38 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
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
"
" dthurn's vimrc
"
" Only run the script once
if exists("g:did_myvimrc")
finish
endif
let g:did_myvimrc = 1
" No vi compatibility!:
set nocompatible
" Line Numbers
set number
" Swap case is an operator
set tildeop
" Help vim guess my background color
set background=dark
" Lots of history!
set history=10000
" I have lots of RAM
set maxmemtot=2000000
" LOTS of RAM
set maxmem=2000000
" Don't jump to start of line on page up/dwn
set nostartofline
" Allow cursor where there's no character
set virtualedit=block
" Allow direction keys to wrap to the next line
set whichwrap=bs<>
" Menu for auto complete
set wildmenu
" Completion list to longest common match and then full
set wildmode=list:longest,full "
" Use tab for wild
set wildchar=<TAB>
" Ignore some characters for completion
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
" Support for non-native file formats
set fileformats=unix,dos,mac
" Do not redraw while running macros (much faster).
set lazyredraw
" Wrap long lines at 'breakat' char instead of last character
set linebreak
" Allow current buffer to be in the background without a disk write
set hidden
" Enable non-stupid backspace key behavior
set backspace=indent,eol,start
" Enable the mouse in supporting terminals
set mouse=a
" Enable the ruler with the format:
" {buffer number}{modified/readonly flag}: {file type}
" [current line, current column] {position percentage in file}
set ruler
set rulerformat=%25(%n%m%r:\ %Y\ [%l,%v]\ %p%%%)
" Configure Status Line
set statusline = "%f\\ %h%m%r%=%l,%v\\ \\ \\ \\ %P"
set laststatus=2
" Start scrolling 3 lines before the cursor reaches the bottom
set scrolloff=3
" save backups centrally
set backupdir=~/.vim
set directory=~/.vim
" remember some stuff after quiting vim:
" marks, registers, searches, buffer list
set viminfo='20,<50,s10,h,%
" Disable bell
set noerrorbells
" Disable scroll bars in gvim
set guioptions-=r
" Keep going until you find a tags file
set tags=tags;/
" Enable the filetype plugin
" Not sure if both of these are needed?
"filetype plugin indent on
"filetype plugin on
" Default indentation
" ftplugins to override
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set expandtab
" Colorize NERDTree
let NERDChristmasTree = 1
" Build help documentation on vim start
helptags ~/.vim/doc
if &t_Co > 2
syntax on
set hlsearch
set incsearch
endif
" Support for sablecc and stringtemplate file types
au BufRead,BufNewFile *.sablecc set syntax=sablecc
au BufRead,BufNewFile *.st set syntax=stringtemplate
" Highlight lines that are over 80 characters in length
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/
" Highlight tab characters
syn match tab display "\t"
hi link tab Error
" Kill trailing whitespace on save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd FileType c,cabal,cpp,haskell,javascript,php,python,readme,text
\ autocmd BufWritePre <buffer>
\ :call <SID>StripTrailingWhitespaces()
" This is sort of a hack, but t_Co never seems to get set correctly
set t_Co=256
" Default vim colorscheme
colorscheme desert256
source ~/.vim_mappings.vim
" Source local vim config if itexists
let VIM_CONFIG=expand("~/.vim_config.vim")
if filereadable(VIM_CONFIG) | exe "source " . VIM_CONFIG | endif