操作系统:Ubuntu Desktop 14.04
参考:
一步步将vim改造成C/C++开发环境(IDE)
原文地址http://blog168.chinaunix.net/space.php?uid=23089249&do=blog&id=2855999
原文地址http://blog168.chinaunix.net/space.php?uid=23089249&do=blog&id=2855999
1、安装Vim和基本插件
首先安装好Vim和Vim的基本插件。这些使用apt-get安装即可:
$sudo apt-get install vim vim-scripts vim-doc
其中vim-scripts是vim的一些基本插件,包括语法高亮的支持、缩进等等。
$sudo apt-get install vim vim-scripts vim-doc
其中vim-scripts是vim的一些基本插件,包括语法高亮的支持、缩进等等。
2、Vim配置文件
Vim强大的功能,其来源基本上就两个地方:Vim插件以及Vim配置文件。
Vim本身的系统配置文件夹是在/usr/share/vim/和/etc/vim/两个文件夹下。一般情况下,我们不会去改变这两个文件夹下的配置文件,而是在用户文件夹/home/user(其中,user为用户名,我的用户名是lingd)下建立自己的配置文件。进入用户文件夹(/home/user/)之后,用gedit新建一个名叫.vimrc的文件:
$ gedit .vimrc
Vim本身的系统配置文件夹是在/usr/share/vim/和/etc/vim/两个文件夹下。一般情况下,我们不会去改变这两个文件夹下的配置文件,而是在用户文件夹/home/user(其中,user为用户名,我的用户名是lingd)下建立自己的配置文件。进入用户文件夹(/home/user/)之后,用gedit新建一个名叫.vimrc的文件:
$ gedit .vimrc
注:使用gedit主要是为了方便大段大段的文字粘贴!
然后把下面的文字拷贝进这个文件之后保存:
- " This line should not be removed as it ensures that various options are
- " properly set to work with the Vim-related packages available in Debian.
- debian.vim
-
- " Uncomment the next line to make Vim more Vi-compatible
- " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
- " options, so any other options should be set AFTER setting 'compatible'.
- set nocompatible
-
- " Vim5 and later versions support syntax highlighting. Uncommenting the
- " following enables syntax highlighting by default.
- if has("syntax")
- syntax on " 语法高亮
- endif
- colorscheme ron " elflord ron peachpuff default 设置配色方案,vim自带的配色方案保存在/usr/share/vim/vim72/colors目录下
-
- " detect file type
- filetype on
- filetype plugin on
-
- " If using a dark background within the editing area and syntax highlighting
- " turn on this option as well
- set background=dark
-
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
- if has