add vim conf files
[arrow.git] / conf_slk120 / vim / _vimrc
blobe4c859c70351a68b63ca1bdd55e543450f261278
1 "arrow's vim conf file
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"
6         finish
7 endif
9 " Use Vim settings, rather then Vi settings (much better!).
10 " This must be first, because it changes other options as a side effect.
11 set nocompatible
12 "if has("vms")
13         "set nobackup           " do not keep a backup file, use versions instead
14 "else
15         set backupdir=~/.tmp,/tmp,./
16         set backup              " keep a backup file
17 "endif
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
27 map Q gq
29 set encoding=UTF-8
30 "set guifontset="-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859-1,WenQuanYi Bitmap Song:style=medium"
31 "set imcmdline 
32 set report=0
33 set ignorecase
34 set nowrap
35 set incsearch
37 "set format when coding
38 filetype plugin indent on
39 set autoindent
40 set tabstop=8
41 set softtabstop=8
42 set shiftwidth=8
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
45 set noexpandtab
46 set cindent
47 "set indentexpr=GetMyIndent()
48 "set paste "it will disable all last set
49 "set swapsync=fsync
50 "set scrollbind
51 set notagbsearch
52 set tagrelative
53 "set fileformat=auto
54 "set fileformats=unix
55 if &t_Co > 2 || has("gui_running")
56         syntax on
57         set hlsearch
58 endif
59 nmap <F2> :nohlsearch<CR>
60 nmap <F3> :only<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 " allow backspacing over everything in insert mode
65 set backspace=indent,eol,start
66 set nosmartindent
67 "set smarttab
69 set formatoptions=croqlmM
70 set textwidth=80
71 set laststatus=2
72 set statusline=%((%1*%M%*%R%Y)%)%f%=%(\[%3l-%02c]%)[%03b/%02B]T9\ %P~%L
73 "set tags=./tags,/usr/include/tags,./TAGS,tags,TAGS
74 set tags=tags
75 "next line will set tag
76 "au BufEnter /home/my/proj1/* setlocal tags+=/home/my/proj1/tags
77 "au BufEnter /code/wnr834b/netgear/src/router setlocal tags+=/code/wnr834b/netgear/src/router/www/cgi/setup/tags
79 if has("multi_byte")
80         set fileencoding=utf-8
81         set fileencodings=utf-8,chinese,ucs-bom
82         set ambiwidth=double
83 endif
85 " Only do this part when compiled with support for autocommands.
86 " Enable file type detection.
87 " Use the default filetype settings, so that mail gets 'tw' set to 72,
88 " 'cindent' is on in C files, etc.
89 " Also load indent files, to automatically do language-dependent indenting.
90 if has("autocmd")
91         filetype plugin indent on
93         " For all text files set 'textwidth' to 78 characters.
94         "autocmd FileType text setlocal textwidth=78
96         " When editing a file, always jump to the last known cursor position.
97         " Don't do it when the position is invalid or when inside an event handler
98         " (happens when dropping a file on gvim).
99         
100         autocmd BufReadPost *
101         \ if line("'\"") > 0 && line("'\"") <= line("$") |
102         \   exe "normal g`\"" |
103         \ endif
105         "au BufReadPost *.c TlistToggle
106 "        au BufRead *.c setlocal formatprg=indent
107 "        au BufRead *.h setlocal formatprg=indent
108 "        au BufNewFile *.c setlocal formatprg=indent
109 "        au BufNewFile *.h setlocal formatprg=indent
110 "        au BufRead *.txt setlocal formatprg=fmt
111 "        au BufNewFile *.txt setlocal formatprg=fmt
112         set formatprg=fmt
113         au FileType c set formatprg=indent
114         au FileType cpp set formatprg=indent
115         "au BufRead *.c set formatprg=indent
116         "au BufRead *.h set formatprg=indent
117         if !exists("auto_arrow_c")
118         let auto_arrow_c=1
119                 au BufNewFile *.c 0r ~/.vim/files/c.skel
120                 "au BufNewFile *.c normal gnp 
121                 au BufNewFile *.h 0r ~/.vim/files/h.skel
122                 au BufNewFile *.sh 0r ~/.vim/files/sh.skel
123                 au BufNewFile *.txt 0r ~/.vim/files/txt.skel
124                 au BufNewFile Makefile 0r ~/.vim/files/makefile.skel
125                 au BufNewFile Rules.make 0r ~/.vim/files/Rules.make.skel
126                 ":%s/_filename_/\=bufname("%")
127                 :"%s/_datetime_/\=strftime("%c")
128                 map gse <ESC>:%s/_filename_/\=bufname("%")/<CR>:%s/_datetime_/\=strftime("%c")/<CR> 
129                 au BufNewFile *.[ch] normal gse
130                 au BufNewFile *.sh normal gse
131                 "au BufNewFile *.txt normal gse
132         endif
133 endif
134 ":45vsp
135 ":28sp
137 if has("gui_running")
138         "set imcmdline
139         "set guifontset=*-p-*
140         "set guifont=-wenquanyi-wenquanyi\ bitmap\ song-italic-*-normal-*-13-130-75-75-p-80-iso10646-1
142         "set menu
143         :source $VIMRUNTIME/delmenu.vim
144         :source $VIMRUNTIME/lang/menu_en_gb.utf-8.vim
145         :source $VIMRUNTIME/menu.vim
147         syntax on
148         set hlsearch
149         set foldcolumn=0
150         set guioptions=aegimlLtT
151 "        set guioptions=aegirLtb
152 "        set guioptions=aegimrLtb
153         "colorscheme delek
154         set guifont=Courier\ 12
155 "        set guifont=Terminus\ Bold\ 13
156 "        set guifont=Serif\ 13
157 "        set guifont="-*-courier-medium-r-*-*-14-140-*-75-*-*-*-*"
158 else
159         "colorscheme  default
160 endif
162 "set Tlist_Ctags_Cmd=/usr/bin/ctags
163 let Tlist_Use_Right_Window = 1
164 "let Tlist_Process_File_Always = 1
165 "let cscope = 1
166 "if has("cscope_arrow_commentout")
167         "nmap <C-@>s <C-W><C-S> :cs find s<C-R>=expand("<cword>")<CR><CR>
168         set csprg=/usr/bin/cscope
169         set csto=0
170         set cst
171         set nocsverb
172         "add any database in current directory
173         if filereadable("cscope.out")
174                 cs add cscope.out
175         "else add database pointed to by environment
176         elseif $CSCOPE_DB != ""
177                 cs add $CSCOPE_DB
178         endif
179         set csverb
180         set cscopetag
181         "set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
182 "endif
183 set mouse=a
184 "let loaded_project = 1
185 ":language en_US
186 ":language time en_US
187 ":language ctype en_US
188 ":language messages en_US
189 ":language C
190 :language time C
191 ":language ctype C
192 ":language messages C
194 "config the tabbar
195 map t gt 
196 map T gT 
198 if version >= 700
199         set showtabline=2
200 endif
202 "want make the shell work normal when gvim
203 ":set term=$TERM
205 "set input method
206 "set imactivatekey=C-space
207 "inoremap <ESC><ESC>:set iminsert=2<CR>
208 ":inoremap <ESC> <ESC>:set iminsert=0<CR>
210 "set guicursor="sm:blinkon0"
211 "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"
212 ":highlight "Cursor gui=NONE guifg=bg guibg=fg"
213 "check the spell right, key press it direct under command mode
214 "setlocal spell spelllang=en_US
216 "define my session
217 "set g:session_dir=/home/arrow/.vim#
218 let g:SessionMgr_Dir="."
219 let g:SessionMgr_DefaultName="arrow.vim"
220 let g:SessionMgr_AutoManage=0
221 "email fetch
223 "set expandtab
224 "if exists('b:current_syntax') && b:current_syntax =~ "cvs"
225 "        set expandtab
226 "endif
227 "my color set for search
228 hi IncSearch term=reverse cterm=reverse gui=reverse
229 "hi Search term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
230 "hi IncSearch term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
231 hi Search term=reverse ctermbg=darkmagenta ctermfg=white guibg=darkmagenta guifg=white
232 "hi Cursor gui=reverse guifg=lightgreen guibg=cyan
233 hi Cursor gui=reverse guifg=darkcyan guibg=white
234 "viki
235 let g:vikiUseParentSuffix=1
236 let g:vikiOpenUrlWith_mailto = 'mail %{URL}'
237 let g:vikiOpenFileWith_html  = "silent !firefox %{FILE}"
238 let g:vikiOpenFileWith_ANY   = "silent !gvim %{FILE}"
239 fun! ConvertPDF()
240         if !exists("b:convertedPDF")
241                 exec "cd ". expand("%:p:h")
242                 exec "%!pdftotext ". expand("%:t") ." -"
243                 :%!par 72w
244                 cd -
245                 setlocal noswapfile buftype=nowrite
246                 let b:convertedPDF = 1
247         endif
248 endf
249 let g:vikiOpenFileWith_pdf = 'call VikiOpenLink("%{FILE}", "", 1)|silent call ConvertPDF()'
250 let g:deplatePrg = "deplate -x -X "
251 au FileType viki compiler deplate
252 let g:vikiNameSuffix=".viki"
253 autocmd! BufRead,BufNewFile *.viki set filetype=viki
254 autocmd! BufRead,BufNewFile $HOME/viki/* set filetype=viki
255 set mousehide " Hide the mouse when typing text
256 set mousemodel=extend
257 "set helplang=cn
258 set path=.,include,/usr/include,,