Debian中VI的配置方法简析

刚刚安装了Debian,却发现其自带的VI存在问题: html

1)不支持语法高亮提示 linux

2)不支持Backspace键的删除功能 vim

原来Debian中自带的VI是VIM-TINY,程序自己就是不支持语法高亮和Backspace删除功能。 ide

能够使用如下办法解决: spa

1)从新安装其它版本的VI unix

  apt-get install vim vim-runtime ctags orm

2)配置~/.vimrc   www.ahlinux.com  htm

  添加syntax on教程

VI经常使用的配置选项utf-8

-----------------------

set number

set showcmd

set incsearch

set expandtab

set showcmd

set history=400

set autoread

set ffs=unix,mac,dos

set hlsearch

set shiftwidth=2

set wrap

set ai

set si

set cindent

set termencoding=unix

set tabstop=2

set nocompatible

set showmatch

set fileencodings=utf-8,gb2312,18030,gbk

set fileformats=unix

set ttyfast

syntax on

set imcmdline

set previewwindow

set showfulltag

set cursorline

set ruler

" set mouse=a

" Close the error bells

set vb t_vb=

set nowrapscan

" When open a file, it will jump to the last cursor position

if has("autocmd")

autocmd BufReadPost *

 / if line("'/"") > 0 && line ("'/"") <= line("$") |

 /   exe "normal! g'/"" |

 / endif

endif

" For ctags

set tags=tags;

set autochdir

" For taglist

let Tlist_Show_One_File=1

let Tlist_Exit_OnlyWindow=1

let Tlist_Auto_Open=1

set updatetime=100

" For auto complete '(' and '{'

ino ( ()<esc>:let leavechar=")"<cr>i

ino { {}<esc>:let leavechar="}"<cr>i

ino ' ''<esc>:let leavechar="'"<cr>i

ino " ""<esc>:let leavechar='"'<cr>i

imap <c-l> <esc>:exec "normal f" . leavechar<cr>a

  www.ahlinux.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!

  不保存退出

摘自 邵巍的专栏

相关文章
相关标签/搜索