首先安装使用apt安装vim编辑器
sudo apt-get install vim
打开vim 编译器输入
vi ~/.vimrc
使用vim编辑配置文件,~/.vimrc文件中添加如下内容:
set nocompatible
set number
filetype on
set history=1000
set background=dark
syntax on
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set guioptions-=T
set vb t_vb=
set ruler
set nohls
set incsearch
set mouse=a
出现的错误:
line 16:
E319: Sorry, the command is not available in this version: filetype on
line 17:
E319: Sorry, the command is not available in this version: filetype plugin on
line 18:
E319: Sorry, the command is not available in this version: filetype indent on
line 21:
E319: Sorry, the command is not available in this version: syntax on
line 45:
E319: Sorry, the command is not available in this version: match ExtraWhitespace /\s\+$/
line 46:
E319: Sorry, the command is not available in this version: autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
line 47:
E319: Sorry, the command is not available in this version: autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
line 48:
E319: Sorry, the command is not available in this version: autocmd InsertLeave * match ExtraWhitespace /\s\+$/
line 49:
E319: Sorry, the command is not available in this version: autocmd BufWinLeave * call clearmatches()
修改方式:
sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime
Another cause might be that alternatives is pointing to the wrong one:
update-alternatives –display vim
to show what is used and ...
update-alternatives –config vim
to change to another vim. It could be that
/usr/bin/vim.gnome
is used and you need
/usr/bin/vim