
转自:
http://www.vi-improved.org/vimrc.php
1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " Stuff I have decided I don’t like
3 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
4 "set ignorecase -- turns out, I like case sensitivity
5 "set list " turns out, I don’t like listchars -- show chars on end of line, whitespace, etc
6 "autocmd GUIEnter * :simalt ~x -- having it auto maximize the screen is annoying
7 "autocmd BufEnter * :lcd %:p:h -- switch to current dir (breaks some scripts)
8
9 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
10 " General
11 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 set nocompatible " get out of horrible vi-compatible mode
13 filetype on " detect the type of file
14 set history=1000 " How many lines of history to remember
15 set cf " enable error files and error jumping
16 set clipboard+=unnamed " turns out I do like is sharing windows clipboard
17 set ffs=dos,unix,mac " support all three, in this order
18 filetype plugin on " load filetype plugins
19 set viminfo+=! " make sure it can save viminfo
20 set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be
21
22 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
23 " Theme/Colors
24 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
25 set background=dark " we are using a dark background
26 syntax on " syntax highlighting on
27 colorscheme metacosm " my theme
28
29 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
30 " Files/Backups
31 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
32 set backup " make backup file
33 set backupdir=$VIM\vimfiles\backup " where to put backup file
34 set directory=$VIM\vimfiles\temp " directory is the directory for temp file
35 set makeef=error.err " When using make, where should it dump the file
36
37 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
38 " Vim UI
39 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
40 set lsp=0 " space it out a little more (easier to read)
41 set wildmenu " turn on wild menu
42 set ruler " Always show current positions along the bottom
43 set cmdheight=2 " the command bar is 2 high
44 set number " turn on line numbers
45 set lz " do not redraw while running macros (much faster) (LazyRedraw)
46 set hid " you can change buffer without saving
47 set backspace=2 " make backspace work normal
48 set whichwrap+=,>,h,l " backspace and cursor keys wrap to
49 set mouse=a " use mouse everywhere
50 set shortmess=atI " shortens messages to avoid ’press a key’ prompt
51 set report=0 " tell us when anything is changed via :...
52 set noerrorbells " don’t make noise
53 " make the splitters between windows be blank
54 set fillchars=vert:\ ,stl:\ ,stlnc:\
55
56 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
57 " Visual Cues
58 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
59 set showmatch " show matching brackets
60 set mat=5 " how many tenths of a second to blink matching brackets for
61 set nohlsearch " do not highlight searched for phrases
62 set incsearch " BUT do highlight as you type you search phrase
63 set listchars=tab:\|\ ,trail:.,extends:>,precedes:" what to show when I hit :set list
64 set lines=80 " 80 lines tall
65 set columns=160 " 160 cols wide
66 set so=10 " Keep 10 lines (top/bottom) for scope
67 set novisualbell " don’t blink
68 set noerrorbells " no noises
69 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
70 set laststatus=2 " always show the status line
71
72 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
73 " Text Formatting/Layout
74 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
75 set fo=tcrqn " See Help (complex)
76 set ai " autoindent
77 set si " smartindent
78 set cindent " do c-style indenting
79 set tabstop=8 " tab spacing (settings below are just to unify it)
80 set softtabstop=8 " unify
81 set shiftwidth=8 " unify
82 set noexpandtab " real tabs please!
83 set nowrap " do not wrap lines
84 set smarttab " use tabs at the start of a line, spaces elsewhere
85
86 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
87 " Folding
88 " Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
89 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
90 set foldenable " Turn on folding
91 set foldmethod=indent " Make folding indent sensitive
92 set foldlevel=100 " Don’t autofold anything (but I can still fold manually)
93 set foldopen-=search " don’t open folds when you search into them
94 set foldopen-=undo " don’t open folds when you undo stuff
95
96 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
97 " File Explorer
98 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
99 let g:explVertical=1 " should I split verticially
100 let g:explWinSize=35 " width of 35 pixels
101
102 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
103 " Win Manager
104 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
105 let g:winManagerWidth=35 " How wide should it be( pixels)
106 let g:winManagerWindowLayout = ’FileExplorer,TagsExplorer|BufExplorer’ " What windows should it
107
108 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
109 " CTags
110 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
111 let Tlist_Ctags_Cmd = $VIM.’\ctags.exe’ " Location of ctags
112 let Tlist_Sort_Type = "name" " order by
113 let Tlist_Use_Right_Window = 1 " split to the right side of the screen
114 let Tlist_Compart_Format = 1 " show small meny
115 let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
116 let Tlist_File_Fold_Auto_Close = 0 " Do not close tags for other files
117 let Tlist_Enable_Fold_Column = 0 " Do not show folding tree
118
119 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
120 " Minibuf
121 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
122 let g:miniBufExplTabWrap = 1 " make tabs show complete (no broken on two lines)
123 let g:miniBufExplModSelTarget = 1
124
125 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
126 " Matchit
127 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
128 let b:match_ignorecase = 1
129
130 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
131 " Perl
132 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
133 let perl_extended_vars=1 " highlight advanced perl vars inside strings
134
135 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
136 " Custom Functions
137 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
138 " Select range, then hit :SuperRetab($width) - by p0g and FallingCow
139 function! SuperRetab(width) range
140 silent! exe a:firstline . ’,’ . a:lastline . ’s/\v%(^ *)@141 endfunction
142
143 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
144 " Mappings
145 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
146 map right> ESC>:MBEbnRETURN> " right arrow (normal mode) switches buffers (excluding minibuf)
147 map left> ESC>:MBEbpRETURN> " left arrow (normal mode) switches buffers (excluding minibuf)
148 map up> ESC>:SexRETURN>ESC>C-W>C-W> " up arrow (normal mode) brings up a file list
149 map down> ESC>:TlistRETURN> " down arrow (normal mode) brings up the tag list
150 map A-i> i ESC>r " alt-i (normal mode) inserts a single char, and then switches back to normal
151 map F2> ESC>ggVG:call SuperRetab()left>
152 map F12> ggVGg? " encypt the file (toggle)
153
154 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
155 " Autocommands
156 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
157 autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
158 au BufNewFile,BufRead *.asp :set ft=aspjscript " all my .asp files ARE jscript
159 au BufNewFile,BufRead *.tpl :set ft=html " all my .tpl files ARE html
160 au BufNewFile,BufRead *.hta :set ft=html " all my .tpl files ARE html
161
162 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
163 " Useful abbrevs
164 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
165 iab xasp CR>CR>TAB>CR>BS>%>ESC>TAB>
166 iab xdate c-r>=strftime("%d/%m/%y %H:%M:%S")cr>
|