歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

Linux VIM 搭建自己的IDE

文章參照把VIM打造成一個正真的IDE(見 http://www.linuxidc.com/Linux/2012-08/68082.htm ),版權歸原作者所有。

配置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  

試試,基本的功能都能實現了

Copyright © Linux教程網 All Rights Reserved