在FreeBSD中安装VIM编辑器

时间:2019-11-20 08:54:01  来源:igfitidea点击:

FreeBSD没有X11图形界面,如何安装vim编辑器?

使用portsnap命令更新ports树:

# portsnap fetch update

安装vim:

# cd /usr/ports/editors/vim
# make WITHOUT_X11=yes install clean

可选:vim配置

将/usr/local/share/vim/vimXY/vimrc_example.vim复制到/usr/local/share/vimrc:

# cp /usr/local/share/vim/vim72/vimrc_example.vim /usr/local/share/vimrc

创建~/.vimrc文件:

$ vi ~/.vimrc

添加自定义设置:

set nocompatible 
filetype on
filetype indent on
filetype plugin on
set laststatus=2
syntax on

设置bash别名:

$ echo "alias vi='vim'" >> ~/.bashrc

为bash设置INPUTRC:

# echo 'export INPUTRC=/usr/local/etc/inputrc' >> /etc/profile

创建/usr/local/etc/inputrc:

# cat >> /usr/local/etc/inputrc

添加下面配置:

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word