老生常談:vim 配置


1.自動補全

  插件名字:NeoComplCache  

  下載地址:http://www.vim.org/scripts/script.php?script_id=2620

  配置:把文件直接復制到vimfiles 下

let g:neocomplcache_enable_at_startup=1  

2.快速編輯

  插件名字:SnipMate

  下載地址:http://www.vim.org/scripts/script.php?script_id=2540

  配置:把文件直接復制到vimfiles 下

3.配色

  配色選擇:http://vimcolorschemetest.googlecode.com/svn/html/index-html.html

  http://www.vim.org/scripts/script.php?script_id=2855

  配置:

  "配色方案
  colo github

3.我的gVIM配置文件

"關閉兼容模式
set nocompatible

"模仿windows快捷鍵 Ctrl+A全選、Ctrl+C復制、Ctrl+V粘貼
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

"gvim字體設置
set guifont=新宋體:h13:cGB2312

"gvim內部編碼
set encoding=utf-8

"當前編輯的文件編碼
set fileencoding=utf-8

"gvim打開支持編碼的文件
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb2312,big5,euc-jp,euc-kr,latin1
"set langmenu=zh_CN
"let $LANG = 'zh_CN.UTF-8'

"解決consle輸出亂碼
language messages zh_CN.utf-8

"解決菜單亂碼
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

"設置終端編碼為gvim內部編碼encoding
let &termencoding=&encoding

"防止特殊符號無法正常顯示
set ambiwidth=double

"縮進尺寸為4個空格
set sw=4

"tab寬度為4個字符
set ts=4

"編輯時將所有tab替換為空格
set et

"按一次backspace就刪除4個空格
set smarttab

"不生成備份文件
set nobackup

"開啟行號標記
set number

"配色方案
colo desert

"關閉上側工具欄
set guioptions-=T

"關閉右側滾動條
"set guioptions-=r

"開啟自動縮進
set autoindent

"默認的自己的參數代碼段,可以不寫。自己喜歡就寫上吧。
set diffexpr=MyDiff()
function MyDiff()
    let opt = '-a --binary'
    if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
    if &diffopt =~ 'iwhite' | let opt = opt . '-b' | endif
    let arg1 = v:fname_in
    if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
    let arg2 = v:fname_new
    if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
    let arg3 = v:fname_out
    if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
    let eq = ''
    if $VIMRUNTIME =~ ' '
        if &sh =~ '\<cmd'
            let cmd = '""' . $VIMRUNTIME . '\diff"'
            let eq = '"'
        else
            let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
        endif
    else
        let cmd = $VIMRUNTIME . '\diff'
    endif
    silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction


let g:neocomplcache_enable_at_startup=1 

 5.用法

  ①。自動排版

  在命令行模式下,首先使用“gg”將光標移動到文檔開頭,然后使用“v”切換到可視模式,再用“G”將光標移動到文檔尾部(相當於全選),最后使用“=”,即可完成整個文檔的自動排版。

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM