Linux VIM 搭建自己的IDE


文章参照把VIM打造成一个正真的IDE(见  ),版权归原作者所有。

配置vimrc文件,使得vim能够完美的支持各种源代码

1、保存vimrc文件

sudo cp /usr/share/vim/vimrc /usr/share/vim/vimrc.bak 

2、打开vimrc文件

sudo gedit /usr/share/vim/vimrc 

3、在末尾处追加一下代码:

  1. set nocompatible "不要vim模仿vi模式,建议设置,否则会有很多不兼容的问题  
  2. syntax on"打开高亮  
  3. if has("autocmd")  
  4.     filetype plugin indent on "根据文件进行缩进  
  5.     augroup vimrcEx  
  6.         au!  
  7.         autocmd FileType text setlocal textwidth=78  
  8.         autocmd BufReadPost *  
  9.                     \ if line("'\"") > 1 && line("'\"") <= line("$") |  
  10.                     \ exe "normal! g`\"" |  
  11.                     \ endif  
  12.     augroup END  
  13. else  
  14.     "智能缩进,相应的有cindent,官方说autoindent可以支持各种文件的缩进,但是效果会比只支持C/C++的cindent效果会差一点,但笔者并没有看出来  
  15.     set autoindent " always set autoindenting on   
  16. endif " has("autocmd")  
  17. set tabstop=4 "让一个tab等于4个空格  
  18. set vb t_vb=  
  19. set nowrap "不自动换行  
  20. set hlsearch "高亮显示结果  
  21. set incsearch "在输入要搜索的文字时,vim会实时匹配  
  22. set backspace=indent,eol,start whichwrap+=<,>,[,] "允许退格键的使用  
  23.   
  24. "鼠标可用  
  25. "防止linux终端下无法拷贝  
  26. if has('mouse')  
  27. set mouse=a  
  28. endif  
  29. au GUIEnter * simalt ~x  
  30.   
  31.   
  32. "字体的设置  
  33. set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI "记住空格用下划线代替哦  
  34. set gfw=幼圆:h10:cGB2312  

试试,基本的功能都能实现了

相关内容