Linux版本:RedHat9
输入 vi --version命令,查看vimrc的位置,编辑该文件,添加红色部分,就能很好的进行C编程了
if &t_Co > 2 || has("gui_running")
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set mouse=a
set autoindent
set cindent
set hlsearch
endif
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set mouse=a
set autoindent
set cindent
set hlsearch
endif
if &term=="xterm"
set t_Co=8
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
set t_Co=8
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
Linux版本:RedHat Enterprise 5
需要将vi解析成vim,修改vimrc文件(同上),还需要修改一个文件,操作如下:
# rpm -qa |grep vim(首先查找vim的rpm安装包名)
vim-X11-7.0.109-3
vim-common-7.0.109-3
vim-common-7.0.109-3
vim-minimal-7.0.109-3
vim-enhanced-7.0.109-3
# rpm -ql vim-enhanced-7.0.109-3(然后查找相关文件的路径)
……
/etc/profile.d/vim.sh
/etc/profile.d/vim.sh
……
# vi /etc/profile.d/vim.sh(编辑!)
if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then
[ -x /usr/bin/id ] || return
#[ `/usr/bin/id -u` -le 100 ] && return(注释掉该行)
# for bash and zsh, only if no alias is already set
alias vi >/dev/null 2>&1 || alias vi=vim
fi
if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then
[ -x /usr/bin/id ] || return
#[ `/usr/bin/id -u` -le 100 ] && return(注释掉该行)
# for bash and zsh, only if no alias is already set
alias vi >/dev/null 2>&1 || alias vi=vim
fi
重新打开终端即可!