[UP] can install now
[arrow.git] / conf_slk120 / vim / _vimrc
blobc480ca45b13a88d46c3908049a2ce127117d368b
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 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
68 set nosmartindent
69 "set smarttab
71 set formatoptions=croqlmM
72 set textwidth=80
73 set laststatus=2
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
76 set 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
81 if has("multi_byte")
82         set fileencoding=utf-8
83         set fileencodings=utf-8,chinese,ucs-bom
84         set ambiwidth=double
85 endif
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.
92 if has("autocmd")
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).
101         
102         autocmd BufReadPost *
103         \ if line("'\"") > 0 && line("'\"") <= line("$") |
104         \   exe "normal g`\"" |
105         \ endif
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
114         set 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")
120         let auto_arrow_c=1
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
134         endif
135 endif
136 ":45vsp
137 ":28sp
139 if has("gui_running")
140         "set imcmdline
141         "set guifontset=*-p-*
142         "set guifont=-wenquanyi-wenquanyi\ bitmap\ song-italic-*-normal-*-13-130-75-75-p-80-iso10646-1
144         "set menu
145         :source $VIMRUNTIME/delmenu.vim
146         :source $VIMRUNTIME/lang/menu_en_gb.utf-8.vim
147         :source $VIMRUNTIME/menu.vim
149         syntax on
150         set hlsearch
151         set foldcolumn=0
152         set guioptions=aegimlLtb
153 "        set guioptions=aegimlLtTb
154 "        set guioptions=aegirLtb
155 "        set guioptions=aegimrLtb
156         "colorscheme delek
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-*-*-*-*"
161 else
162         "colorscheme  default
163 endif
165 "set Tlist_Ctags_Cmd=/usr/bin/ctags
166 let Tlist_Use_Right_Window = 1
167 "let Tlist_Process_File_Always = 1
168 "let cscope = 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
172         set csto=0
173         set cst
174         set nocsverb
175         "add any database in current directory
176         if filereadable("cscope.out")
177                 cs add cscope.out
178         "else add database pointed to by environment
179         elseif $CSCOPE_DB != ""
180                 cs add $CSCOPE_DB
181         endif
182         set csverb
183         set cscopetag
184         "set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
185 "endif
186 set mouse=a
187 "let loaded_project = 1
188 ":language en_US
189 ":language time en_US
190 ":language ctype en_US
191 ":language messages en_US
192 ":language C
193 :language time C
194 ":language ctype C
195 :language messages C
197 "config the tabbar
198 map t gt 
199 map T gT 
201 if version >= 700
202         set showtabline=2
203 endif
205 "want make the shell work normal when gvim
206 ":set term=$TERM
208 "set input method
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
219 "define my session
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
224 "email fetch
226 "set expandtab
227 "if exists('b:current_syntax') && b:current_syntax =~ "cvs"
228 "        set expandtab
229 "endif
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
237 "viki
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}"
242 fun! ConvertPDF()
243         if !exists("b:convertedPDF")
244                 exec "cd ". expand("%:p:h")
245                 exec "%!pdftotext ". expand("%:t") ." -"
246                 :%!par 72w
247                 cd -
248                 setlocal noswapfile buftype=nowrite
249                 let b:convertedPDF = 1
250         endif
251 endf
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
260 "set helplang=cn
261 set path=.,include,/usr/include,,
262 set wildmenu