应该说vim/gvim+gcc/g++的开发环境已经非常能够满足一般的变成需要,我试了几种不同的IDE,包括Eclipse和Anjuta,用一个JAVA环境的IDE(Eclipse)来改装成c++的,总有点挂羊头卖狗肉的嫌疑,而且eclipse启动非常慢,有时候我是在等不及。而anjuta则不错,有很多的语言支持,语法高亮等等应有尽有,而且配置一点也不麻烦,但是我们在平时写一个文件的程序的时候动摇这么一个IDE似乎总有点麻烦,况且gvim+g++也能做到,所以我配置了如题的环境。 安装gvim是简单的,只要在终端输入 sudo apt-get install gvim (我在ubuntu8.10下) 就可以安装上,然后可以在终端输入gvim打开gvim编辑器。 这个时候的编辑器什么也没有,没有语法高亮,自动补齐等等,所以要做一点工作,首先要找到vimrc这个文件 终端下输入 locate vimrc 我的机器是显示这个文件在/etc/vim中,所以我们要进入到这个文件中,这个时候可能文件的权限是root,为了方便点,我把权限先改成用户的,以我的电脑为例 eric@eric-laptop:cd /etc/vim eric@eric-laptop:sudo -s [sudo] password for eric: root@eric-laptop~vim:#chown eric:eric vimrc 好了,现在我们可以打开vimrc文件了 以下是我的配置文件 " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime " you can find below. If you wish to change any of those settings, you should " do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten " everytime an upgrade of the vim packages is performed. It is recommended to " make changes after sourcing debian.vim since it alters the value of the " 'compatible' option.
" 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. runtime! 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 compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next " line enables syntax highlighting by default. "语法高亮 syntax on "背景颜色 colorscheme blue " 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("autocmd") " au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") " \| exe "normal! g'\"" | endif "endif
" Uncomment the following to have Vim load indentation rules according to the " detected filetype. Per default Debian Vim only load filetype specific " plugins. "if has("autocmd") " filetype indent on "endif
" The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. "set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching set smartcase " Do smart case matching "set incsearch " Incremental search set autowrite " Automatically save before commands like :next and :make "set hidden " Hide buffers when they are abandoned "set mouse=a " Enable mouse usage (all modes) in terminals set autoindent " Source a global configuration file if available " XXX Deprecated, please move your changes here in /etc/vim/vimrc if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif