" 設定自動轉換為 UTF-8 編碼
set fileencodings=utf-8,big5,gbk,cp936,iso-2022-jp,sjis,euc-jp,euc-kr,utf-bom,iso8859-1
" 檔案存檔會存成utf-8編碼
set encoding=utf-8
set tenc=utf-8
"set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
"set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
"set guifont=Monospace\ 11
set guifont=DejaVu\ Sans\ Mono\ 12
" 解決一些寬字元被解釋成單字元的問題
if exists("&ambiwidth")
set ambiwidth=double
endif
" Basic
set nu
set history=50
set backspace=indent,eol,start
set autoread
set hls
set incsearch
set nocompatible
set autoindent "自動縮排
set smartindent "自動對位
"set cindent
set paste
set noerrorbells visualbell " be quiet
set showmatch "括號
set confirm
"set wildmode=list:full
set wildmenu
set showcmd
set showmode
set ruler
set cmdheight=2
set gcr=a:blinkon0 "游標不要再閃了
set report=0 " always report changes
set lz " do not redraw while running macros
set lsp=0 " space it out a little more
set ws
set more "use a pager for long listings
filetype on
filetype plugin on
filetype plugin indent on
set mouse=a " 啟動對滑鼠的支持
set guioptions-=T "關閉工具欄
"set guioptions+=b "顯示水平滾軸。
" 關掉viminfo
"set viminfo=
" 尋找時不分大小寫,這對中文會造成困擾。預設 off。
"set ignorecase
" 瀏覽檔案的目錄,GUI 版本始有。
set bsdir=buffer
"向上層目錄搜尋
set autochdir
" Statusline
set laststatus=2
" 狀態列顯示的格式
set statusline=%f\ %y%r%1*%m%*%=%<x%02B%4vv%4cc%7l\ %P
" Fileformats
set ffs=unix,dos,mac
set ff=unix
nmap <leader>fd :se ff=dos<cr>
" color
syntax on
"set background=dark
color desert
" zenburn
" http://www.vim.org/scripts/script.php?script_id=415
"colorscheme zenburn
"set cursorline
"set cursorcolumn
"Omni menu colors
hi Pmenu guibg=#333333
hi PmenuSel guibg=#555555 guifg=#ffffff
" key
"set showtabline=2
map th :tabnext<CR>
map tl :tabprev<CR>
map tn :tabnew<CR>
map td :tabclose<CR>
" Files and backups
" make backup file
set backup
" where to put backup file
set backupdir=~/saves/
" directory is the directory for temp file
set directory=~/saves/
" When using make, where should it dump the file
set makeef=error.err
" tabstop
set softtabstop=4 "即設置 softtabstop 為 4. 輸入 tab 後就跳了 4 格.
set shiftwidth=4 "設置自動縮進 4 個空格, 當然要設自動縮進先.
"set expandtab
"set smarttab
"set tabstop=8 "實際的 tab
" key
" 單鍵 <F7> 控制 syntax on/off。
map <F7> :if exists("syntax_on") <BAR>
\ syntax off <BAR><CR>
\ else <BAR>
\ syntax enable <BAR>
\ endif <CR>
" 按 F8 會在 searching highlight 及非 highlight 間切換
map <F8> :set hls!<BAR>set hls?<CR>
"" Toggle on/off paste mode,在 insert mode 要設 pastetoggle 才能生效。
map <F9> :set paste!<bar>set paste?<cr>
set pastetoggle=<F9>
" 插入日期
map <F11> <ESC>:read !date<CR>
" 使用 <F12> 來將文字編碼轉換成 Big5
map <F12> :set tenc=big5 <CR>
"縮寫
iabbrev #b /****************************************
iabbrev #e <Space>****************************************/
iabbrev xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
" turn completion on:
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" Ruby
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" CSS
autocmd FileType css setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
" Perl
" highlight advanced perl vars inside strings
let perl_extended_vars=1
" xmledit
let xml_use_xhtml = 1
" Filetype generic
"TOhtml
let html_use_css = 1
let html_number_lines = 0
"let use_xhtml = 1
[ 書籤 | 搜尋 | blog | 留言 | Home ]
最後更新 三月 14, 2008 , by alan
本 著作 係採用
創用 CC 姓名標示-非商業性-相同方式分享 2.5 台灣 授權條款授權.