Debian中VI的配置方法简析

来源:岁月联盟 编辑:exp 时间:2012-04-03

刚刚安装了Debian,却发现其自带的VI存在问题: 
1)不支持语法高亮提示 2)不支持Backspace键的删除功能 原来Debian中自带的VI是VIM-TINY,程序本身就是不支持语法高亮和Backspace删除功能。  可以使用以下办法解决: 1)重新安装其它版本的VI   apt-get install vim vim-runtime ctags 2)配置~/.vimrc   www.2cto.com    添加syntax onVI常用的配置选项-----------------------set numberset showcmdset incsearchset expandtabset showcmdset history=400set autoreadset ffs=unix,mac,dosset hlsearchset shiftwidth=2set wrapset aiset siset cindentset termencoding=unixset tabstop=2set nocompatibleset showmatchset fileencodings=utf-8,gb2312,18030,gbkset fileformats=unixset ttyfastsyntax onset imcmdlineset previewwindowset showfulltagset cursorlineset ruler" set mouse=a " Close the error bellsset vb t_vb=set nowrapscan " When open a file, it will jump to the last cursor positionif has("autocmd")autocmd BufReadPost * / if line("'/"") > 0 && line ("'/"") <= line("$") | /   exe "normal! g'/"" | / endifendif " For ctagsset tags=tags;set autochdir " For taglistlet Tlist_Show_One_File=1let Tlist_Exit_OnlyWindow=1let Tlist_Auto_Open=1set updatetime=100 " For auto complete '(' and '{'ino ( ()<esc>:let leavechar=")"<cr>iino { {}<esc>:let leavechar="}"<cr>iino ' ''<esc>:let leavechar="'"<cr>iino " ""<esc>:let leavechar='"'<cr>iimap <c-l> <esc>:exec "normal f" . leavechar<cr>a  www.2cto.com  " For comment in C program /**/set comments=s1:/*,mb:*,ex0:/ VI最常用操作-----------------i  进入编辑状态可在光标处插入内容o  在当前行下方插入空白行并进入编辑状态O  在当前行上方插入空白行并进入编辑状态D  删除当前行光标后的所有内容dd  删除当前行gg  跳至文件顶部G  跳至文件底部0  移至本行开头$  移至本行末尾x  删除CTRL+u  向上翻页CTRL+d  向下翻页yw  复制光标所在单词yy  复制当前行p  粘贴至光标后P  粘贴至光标前#  查找与当前光标相同的单词或字符并高亮显示/  查找字符串:sp  以分栏方式打开另一文件CTRL+ww  在分栏方式打开的多个文件之间跳转:num  跳至文本的第num行:g/str1/s//str2/  用字符串str2替换文本中所有的str1:x  保存退出:q!  不保存退出    摘自 邵巍的专栏