gvim 設定

Windows 的 Gvim 背景色彩和一些雜七雜八的設定.
之前都是在 Linux 使用 vim, 突然轉換到 Windows 不太習慣.
不過還是裝 gvim 來玩玩. 深入看看設定哪些會比較好用..


設定檔於 C:\Program Files\Vim\_vimrc
預設存檔會存在 C:\Documents and Settings\自己登入的帳號\
參考連結 Vim for Perl developers
colorscheme desert 設定 配色設定
vimrc 設定檔如下(於最下面自行加入即可)
set cindent
set nu
set smartindent
"set backup
"set backupdir=~/.bak
"set backupdir=D:\bak
set hls
set nocompatible
set sw=3
set showmatch
set background=light
colorscheme desert
syntax on
" 將註解由深藍色變綠色
" hi Comment ctermfg=Green
" 搜尋到的字加 hilight
set hlsearch
" 將註解由深藍色變淺藍色
highlight Comment ctermfg=darkcyan
highlight Search term=reverse ctermbg=4 ctermfg=7
highlight Normal ctermbg=black ctermfg=white
" 設定 tab 預設 4 格(並且自動把 tab(\t) 轉換成 空白)
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
" 設定摺疊 {{{ , }}}
set foldmethod=marker
" 設定 細明體 字體大小 12
set guifont=mingliu:h12
最終版: gvim 完整設定. 可以自動判斷 UTF-8, Big5.
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
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
if &sh =~ '\ ' . arg3 . '"'
else
silent execute '!C:\Program" Files\Vim\vim63\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endif
endfunction
"set fileencoding=taiwan
"set fileencoding=utf-8
"set guifontset=8x16,kc15f,-*-16-*-big5-0
set cindent
set smartindent
"set backup
"set backupdir=~/.bak
set backupdir=D:\bak
"set enc=taiwan
set hls
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set nocompatible
set sw=3
set showmatch
set background=light
set nu
colorscheme desert
syntax on
set guifont=mingliu:h12
highlight Comment ctermfg=darkcyan
highlight Search term=reverse ctermbg=4 ctermfg=7
highlight Normal ctermbg=black ctermfg=white
" Necessary. This setting tells vim to load latex-suite
" when a tex file opened.
filetype plugin on
" Optional. This enables automatic indentation as you
" type.
filetype indent on
"============utf8 ===============
" piaip's gvim settings for gvim/win32 with UTF8
" optimized for Traditional Chinese users
" last update: Mon Jun 7 17:59:54 CST 2004
"let $LANG="zh_TW.UTF-8" " locales
"set encoding=utf-8 " ability
"set fileencoding=big5 " prefer
" charset detect list. ucs-bom must be earlier than ucs*.
"set fileencodings=ascii,ucs-bom,utf-8,ucs-2,ucs-le,sjis,big5,latin1
" for console mode we use big5
set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1
"set encoding=utf8
set tenc=utf8
if has("gui_running")
set termencoding=utf-8
else
set termencoding=big5
endif
" vim:ft=vim
"============utf8 ===============


關於 Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
本篇發表於 Windows。將永久鏈結加入書籤。

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料