安裝gitv 在vim 中版本控制

通常在電腦中都有 git 了,若是你沒有裝,可以找這裡:安裝git
另外這是 git 的詳解書:Pro Git 中文

要用vim 的plugin 與 git 進行版本控制,
首先你要先裝 vim plugin 的控制plugin : Vundle
然後再用vundle 來裝 vim-fugitivegitv
首先輸入 (以下摘自 https://github.com/VundleVim/Vundle.vim )

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

安裝 Vundle。

然後在 ~/.vimrc 中多加:

set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}
Plugin 'gregsexton/gitv'

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

其中最重要的兩個是

Plugin 'tpope/vim-fugitive'
Plugin 'gregsexton/gitv'

然後在vim 的環境中輸入

:PluginInstall

Vundle 會開始幫你檢查,並開始安裝 plugin

在vim中使用github的安裝版本控制
gitv the download page

讓vim同時能讀寫utf8和big5的檔案

edit ~/.vimrc

set enc=utf-8
set fileencodings=utf-8,cp950,ucs-bom,default,latin1
set termencoding=cp950

重點是termencoding,vim會把utf8格式的檔案讀出來轉成termencoding (for terminal),也就是big5,於是putty / screen可以直接用big5(cp950)接收,不用為了讀寫utf8對putty / screen做一堆設定

可參考 fileencodings、 fileencoding、 encoding 和 termencoding

from 讓vim同時能讀寫utf8和big5的檔案

另外,可以在unix下轉編碼

iconv -f big5 -t utf-8 liu.cin

把 liu.cin 這個檔案由 big5 碼轉成 utf-8 編碼。
iconv 指令,-f 是 from 原始編碼,-t 是 to 目的編碼。

from linux中unicode & utf-8 & big5互轉??

在unix中讀DOS文檔,轉換

如何得知目前的設定

:set 或 :se 會顯示所有經過修改的部份,就是和預設值不一樣的部份。
:set all 顯示目前所有設定值內容。
:set option? 顯示 option 這設定的目前值。
:set option 直接線上設定,有些設定需加 = 後加上設定值內容。
:set nooption 取消該設定。

fileformat(ff)  
這是寫入檔案時置放 EOL(end of line) 的形式
dos 是以 0D 0A 來斷行。
unix 是以 0A 來斷行。
mac 是以 0D 來斷行。
預設以各系統平檯而定,在 Linux 當然是 unix 形式。

fileformats(ffs)   
可指定多個,會依載入的檔案形式來調整 ff。
繼續閱讀 在unix中讀DOS文檔,轉換