2 " $Id: .vimrc,v 1.6 2006/04/20 01:59:18 arrow Exp $
3 "Author:arrow <arrow_zhang@sdc.sercomm.com>
5 if v:progname =~? "evim"
9 " Use Vim settings, rather then Vi settings (much better!).
10 " This must be first, because it changes other options as a side effect.
13 "set nobackup " do not keep a backup file, use versions instead
15 set backupdir=~/.tmp,/tmp,./
16 set backup " keep a backup file
18 "set nobackup " do not keep a backup file, use versions instead
19 set history=100 " keep 50 lines of command line history
20 set ruler " show the cursor position all the time
21 set showcmd " display incomplete commands
22 set incsearch " do incremental searching
24 " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
25 " let &guioptions = substitute(&guioptions, "t", "", "g")
26 " Don't use Ex mode, use Q for formatting
30 "set guifontset="-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859-1,WenQuanYi Bitmap Song:style=medium"
37 "set format when coding
38 filetype plugin indent on
43 set cinoptions=>8,n-8,{8,^-8,:8,=8,g8,h8,p8,t8,+8,(8,u8,w1,m1 shiftwidth=8 tabstop=8
44 "set cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1 shiftwidth=8 tabstop=8
47 "set indentexpr=GetMyIndent()
48 "set paste "it will disable all last set
55 if &t_Co > 2 || has("gui_running")
59 nmap <F2> :nohlsearch<CR>
61 nmap <F4> :set noscrollbind<CR>:set scrollopt=<CR>:set nowrap<CR>:set foldmethod=manual<CR>:set foldcolumn=0<CR>:only<CR>zR
62 nmap <F5> :set tags-=/usr/include/tags<CR>
63 nmap <F6> :set tags+=/usr/include/tags<CR>
64 nmap <F7> :set tags+=/kernel/tags<CR>
65 nmap <F8> :set tags-=/kernel/tags<CR>
66 " allow backspacing over everything in insert mode
67 set backspace=indent,eol,start
71 set formatoptions=croqlmM
74 set statusline=%((%1*%M%*%R%Y)%)%f%=%(\[%3l-%02c]%)[%03b/%02B]T9\ %P~%L
75 "set tags=./tags,/usr/include/tags,./TAGS,tags,TAGS
77 "next line will set tag
78 "au BufEnter /home/my/proj1/* setlocal tags+=/home/my/proj1/tags
79 "au BufEnter /code/wnr834b/netgear/src/router setlocal tags+=/code/wnr834b/netgear/src/router/www/cgi/setup/tags
82 set fileencoding=utf-8
83 set fileencodings=utf-8,chinese,ucs-bom
87 " Only do this part when compiled with support for autocommands.
88 " Enable file type detection.
89 " Use the default filetype settings, so that mail gets 'tw' set to 72,
90 " 'cindent' is on in C files, etc.
91 " Also load indent files, to automatically do language-dependent indenting.
93 filetype plugin indent on
95 " For all text files set 'textwidth' to 78 characters.
96 "autocmd FileType text setlocal textwidth=78
98 " When editing a file, always jump to the last known cursor position.
99 " Don't do it when the position is invalid or when inside an event handler
100 " (happens when dropping a file on gvim).
102 autocmd BufReadPost *
103 \ if line("'\"") > 0 && line("'\"") <= line("$") |
104 \ exe "normal g`\"" |
107 "au BufReadPost *.c TlistToggle
108 " au BufRead *.c setlocal formatprg=indent
109 " au BufRead *.h setlocal formatprg=indent
110 " au BufNewFile *.c setlocal formatprg=indent
111 " au BufNewFile *.h setlocal formatprg=indent
112 " au BufRead *.txt setlocal formatprg=fmt
113 " au BufNewFile *.txt setlocal formatprg=fmt
115 au FileType c set formatprg=indent
116 au FileType cpp set formatprg=indent
117 "au BufRead *.c set formatprg=indent
118 "au BufRead *.h set formatprg=indent
119 if !exists("auto_arrow_c")
121 au BufNewFile *.c 0r ~/.vim/files/c.skel
122 "au BufNewFile *.c normal gnp
123 au BufNewFile *.h 0r ~/.vim/files/h.skel
124 au BufNewFile *.sh 0r ~/.vim/files/sh.skel
125 au BufNewFile *.txt 0r ~/.vim/files/txt.skel
126 au BufNewFile Makefile 0r ~/.vim/files/makefile.skel
127 au BufNewFile Rules.make 0r ~/.vim/files/Rules.make.skel
128 ":%s/_filename_/\=bufname("%")
129 :"%s/_datetime_/\=strftime("%c")
130 map gse <ESC>:%s/_filename_/\=bufname("%")/<CR>:%s/_datetime_/\=strftime("%c")/<CR>
131 au BufNewFile *.[ch] normal gse
132 au BufNewFile *.sh normal gse
133 "au BufNewFile *.txt normal gse
139 if has("gui_running")
141 "set guifontset=*-p-*
142 "set guifont=-wenquanyi-wenquanyi\ bitmap\ song-italic-*-normal-*-13-130-75-75-p-80-iso10646-1
145 :source $VIMRUNTIME/delmenu.vim
146 :source $VIMRUNTIME/lang/menu_en_gb.utf-8.vim
147 :source $VIMRUNTIME/menu.vim
152 set guioptions=aegimlLtb
153 " set guioptions=aegimlLtTb
154 " set guioptions=aegirLtb
155 " set guioptions=aegimrLtb
157 set guifont=Courier\ 12
158 " set guifont=Terminus\ Bold\ 13
159 " set guifont=Serif\ 13
160 " set guifont="-*-courier-medium-r-*-*-14-140-*-75-*-*-*-*"
165 "set Tlist_Ctags_Cmd=/usr/bin/ctags
166 let Tlist_Use_Right_Window = 1
167 "let Tlist_Process_File_Always = 1
169 "if has("cscope_arrow_commentout")
170 "nmap <C-@>s <C-W><C-S> :cs find s<C-R>=expand("<cword>")<CR><CR>
171 set csprg=/usr/bin/cscope
175 "add any database in current directory
176 if filereadable("cscope.out")
178 "else add database pointed to by environment
179 elseif $CSCOPE_DB != ""
184 "set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
187 "let loaded_project = 1
189 ":language time en_US
190 ":language ctype en_US
191 ":language messages en_US
205 "want make the shell work normal when gvim
209 "set imactivatekey=C-space
210 "inoremap <ESC><ESC>:set iminsert=2<CR>
211 ":inoremap <ESC> <ESC>:set iminsert=0<CR>
213 "set guicursor="sm:blinkon0"
214 "set guicursor="guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175"
215 ":highlight "Cursor gui=NONE guifg=bg guibg=fg"
216 "check the spell right, key press it direct under command mode
217 "setlocal spell spelllang=en_US
220 "set g:session_dir=/home/arrow/.vim#
221 let g:SessionMgr_Dir="."
222 let g:SessionMgr_DefaultName="arrow.vim"
223 let g:SessionMgr_AutoManage=0
227 "if exists('b:current_syntax') && b:current_syntax =~ "cvs"
230 "my color set for search
231 hi IncSearch term=reverse cterm=reverse gui=reverse
232 "hi Search term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
233 "hi IncSearch term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
234 hi Search term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
235 "hi Cursor gui=reverse guifg=lightgreen guibg=cyan
236 hi Cursor gui=reverse guifg=darkcyan guibg=white
238 let g:vikiUseParentSuffix=1
239 let g:vikiOpenUrlWith_mailto = 'mail %{URL}'
240 let g:vikiOpenFileWith_html = "silent !firefox %{FILE}"
241 let g:vikiOpenFileWith_ANY = "silent !gvim %{FILE}"
243 if !exists("b:convertedPDF")
244 exec "cd ". expand("%:p:h")
245 exec "%!pdftotext ". expand("%:t") ." -"
248 setlocal noswapfile buftype=nowrite
249 let b:convertedPDF = 1
252 let g:vikiOpenFileWith_pdf = 'call VikiOpenLink("%{FILE}", "", 1)|silent call ConvertPDF()'
253 let g:deplatePrg = "deplate -x -X "
254 au FileType viki compiler deplate
255 let g:vikiNameSuffix=".viki"
256 autocmd! BufRead,BufNewFile *.viki set filetype=viki
257 autocmd! BufRead,BufNewFile $HOME/viki/* set filetype=viki
258 set mousehide " Hide the mouse when typing text
259 set mousemodel=extend
261 set path=.,include,/usr/include,,