剛剛安裝了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! 不儲存退出 摘自 邵巍的專欄