asd

  1 " {{{
  2 " DesCRiption: shiguangqi
  3 " Created Date: 2012-05-04
  4 " Last Changed: 2012-12-13 
  5 " Author:      shiguangqi
  6 " Version:     0.3
  7 "}}}
  8 let performance_mode=0
  9 "function
 10 function! MySys()
 11     if has("win32")
 12         return "win32"
 13     elseif has("unix")
 14         return "unix"
 15     else
 16         return "mac"
 17     endif
 18 endfunction
 19 
 20 " Sets how many lines of history VIM has to remember
 21 set history=700
 22 " Enable filetype plugins
 23 filetype plugin on
 24 filetype indent on
 25 
 26 " Set to auto read when a file is changed from the outside
 27 set autoread
 28 
 29 " With a map leader it's possible to do extra key combinations
 30 " like <leader>w saves the current file
 31 let mapleader = ","
 32 let g:mapleader = ","
 33 
 34 " Fast saving
 35 nmap <leader>w :w!<cr>
 36 
 37 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 38 " => VIM user interface
 39 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 40 " Set 7 lines to the cursor - when moving vertically using j/k
 41 set so=7
 42 
 43 " Turn on the WiLd menu
 44 set wildmenu
 45 
 46 "Always show current position
 47 set ruler
 48 
 49 " Height of the command bar
 50 set cmdheight=2
 51 
 52 " A buffer becomes hidden when it is abandoned
 53 set hid
 54 
 55 " Configure backspace so it acts as it should act
 56 set backspace=eol,start,indent
 57 set whichwrap+=<,>,h,l
 58 
 59 " Ignore case when searching
 60 set ignorecase
 61 
 62 " When searching try to be smart about cases 
 63 set smartcase
 64 
 65 " Highlight search results
 66 set hlsearch
 67 
 68 " Makes search act like search in modern browsers
 69 set incsearch 
 70 
 71 " Don't redraw while executing macros (good performance config)
 72 set lazyredraw 
 73 
 74 " For regular expressions turn magic on
 75 set magic
 76 
 77 " Show matching brackets when text indicator is over them
 78 set showmatch 
 79 
 80 " How many tenths of a second to blink when matching brackets
 81 set mat=2
 82 
 83 " No annoying sound on errors
 84 set noerrorbells
 85 set novisualbell
 86 set t_vb=
 87 set tm=500
 88 
 89 " => Colors and Font
 90 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 91 "Enable syntax hl
 92 if MySys()=="unix"
 93   if v:version<600
 94       if filereadable(expand("$VIM/syntax/syntax.vim"))
 95           syntax on
 96       endif
 97   else
 98       syntax on
 99   endif
100 else
101   syntax on
102 endif
103 
104 "set encoding=utf-8
105 set fileencodings=ucs-bom,utf-8,iso8859-1,gbk,default,latin
106 
107 if has("gui_running")
108 set guioptions-=m
109   set guioptions-=T
110   set guioptions-=l
111   set guioptions-=L
112   set guioptions-=r
113   set guioptions-=R
114 set guioptions-=t
115 
116   if MySys()=="win32"
117       "start gvim maximized
118       if has("autocmd")
119           au GUIEnter * simalt ~x
120       endif
121   endif
122   "let psc_style='cool'
123   if v:version > 601
124       "colorscheme ps_color
125       "colorscheme default
126       colorscheme desert 
127     set guifont=Consolas:h10
128   endif
129 else
130   if v:version > 601
131       "set background=dark
132       colorscheme default " desert
133       "colorscheme desert "elflord
134     set guifont=Consolas:h10
135   endif
136 endif
137 
138 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
139 " => Fileformat
140 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
141 "Favorite filetype
142 set ffs=unix,dos,mac
143 
144 nmap <leader>fd :se ff=dos<cr>
145 nmap <leader>fu :se ff=unix<cr>
146 
147 """"""""""""""""""""""""""""""
148 " => Statusline
149 """"""""""""""""""""""""""""""
150 "Format the statusline
151 " Nice statusbar
152 if performance_mode
153 else
154   set laststatus=2
155   set statusline=
156   "set statusline+=%2*%-3.3n%0*/ " buffer number
157   set statusline+=%f/ " file name
158   set statusline+=%1*%h%m%r%w%0* " flags
159   set statusline+=%2*0x%-8B " current char
160 "set statusline+=%-8O
161 set statusline+=%-8b
162   set statusline+=%-14.(%l,%c%V%)/%5p%% " offset
163   set statusline+=%= " right align
164   set statusline+=%0*[
165   if v:version >= 600
166       set statusline+=%{strlen(&ft)?&ft:'none'}, " filetype
167       set statusline+=%{&encoding}, " encoding
168   endif
169   set statusline+=%{&fileformat}]%1* " file format
170   if filereadable(expand("$VIM/vimfiles/plugin/vimbuddy.vim"))
171       set statusline+=/ %{VimBuddy()} " vim buddy
172   endif
173 
174 "    " special statusbar for special windows
175 "    if has("autocmd")
176 "        au FileType qf
177 "                    / if &buftype == "quickfix" |
178 "                    / setlocal statusline=%2*%-3.3n%0* |
179 "                    / setlocal statusline+=/ /[Compiler/ Messages/] |
180 "                    / setlocal statusline+=%=%2*/ %<%P |
181 "                    / endif
182 "
183 "        fun! FixMiniBufExplorerTitle()
184 "            if "-MiniBufExplorer-" == bufname("%")
185 "                setlocal statusline=%2*%-3.3n%0*
186 "                setlocal statusline+=/[Buffers/]
187 "                setlocal statusline+=%=%2*/ %<%P
188 "            endif
189 "        endfun
190 "
191 "        if v:version>=600
192 "            au BufWinEnter *
193 "                        / let oldwinnr=winnr() |
194 "                        / windo call FixMiniBufExplorerTitle() |
195 "                        / exec oldwinnr . " wincmd w"
196 "        endif
197 "    endif
198 "
199 "    " Nice window title
200 "    if has('title') && (has('gui_running') || &title)
201 "        set titlestring=
202 "        set titlestring+=%f/ " file name
203 "        set titlestring+=%h%m%r%w " flags
204 "        set titlestring+=/ -/ %{v:progname} " program name
205 "    endif
206 endif
207 
208 function! InsertStatuslineColor(mode)
209   if a:mode == 'i'
210       hi statusline guibg=peru
211   elseif a:mode == 'r'
212       hi statusline guibg=blue
213   else
214       hi statusline guibg=red
215   endif
216 endfunction
217 au InsertEnter * call InsertStatuslineColor(v:insertmode)
218 au InsertLeave * hi statusline guibg=#9932CC guifg=white
219 hi statusline guibg=#696969 guifg=#B8860B
220 
221 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
222 " => Spell checking
223 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
224 map <leader>sn ]
225 map <leader>sp [
226 map <leader>sa zg
227 map <leader>s? z=
228 
229 "Fast reloading of the .vimrc
230 map <silent> <leader>ss :source $HOME/.vimrc<cr>
231 "Fast editing of .vimrc
232 map <silent> <leader>ee :e $HOME/.vimrc<cr>
233 "When .vimrc is edited, reload it
234 autocmd! bufwritepost .vimrc source $VIM/.vimrc 
235 
236 " autoload _vimrc
237 autocmd! bufwritepost .vimrc source %
238 
239 " use chinese help
240 set helplang=cn
241 
242 " NERDTree
243 map <F10> :NERDTreeToggle<CR>
244 
245 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
246 
247 " => Plugin configuration
248 
249 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
250 
251 " taglist
252 let Tlist_Show_One_File = 1 
253 let Tlist_Exit_OnlyWindow = 1 
254 let Tlist_Use_Right_Window = 1 
255 let Tlist_Auto_Highlight_Tag = 1
256 let Tlist_Auto_Open = 0
257 let Tlist_Auto_Update = 1
258 let Tlist_Close_On_Select = 0
259 let Tlist_Compact_Format = 0
260 let Tlist_Display_Prototype = 0
261 let Tlist_Display_Tag_Scope = 1
262 let Tlist_Enable_Fold_Column = 0
263 "let Tlist_Exit_OnlyWindow = 0
264 let Tlist_File_Fold_Auto_Close = 1
265 let Tlist_GainFocus_On_ToggleOpen = 1
266 let Tlist_Hightlight_Tag_On_BufEnter = 1
267 let Tlist_Inc_Winwidth = 0
268 map <silent> <F9> :TlistToggle<cr> 
269 
270 "map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
271 "imap <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
272 
273 set nocompatible               " be iMproved
274 filetype off                   " required!
275 set rtp+=~/.vim/bundle/vundle/
276 call vundle#rc()
277 " let Vundle manage Vundle
278 " 
279 " required! 
280 Bundle 'gmarik/vundle'
281 Bundle 'tpope/vim-fugitive'
282  Bundle 'Lokaltog/vim-easymotion'
283   Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
284    Bundle 'tpope/vim-rails.git'
285 
286 Bundle 'L9'
287  Bundle 'FuzzyFinder'
288 Bundle 'git://git.wincent.com/command-t.git'
289 filetype plugin indent on     " required!

 

posted @ 2012-12-13 19:20  站在巨人肩上  阅读(228)  评论(0编辑  收藏  举报