顯示具有 fullscreen 標籤的文章。 顯示所有文章
顯示具有 fullscreen 標籤的文章。 顯示所有文章

2009年2月10日 星期二

Windows gvim rc 與 Ubuntu 下的 vimrc 設定

新加一些自己需要的修改放在 ~\Program Files\Vim\_vimrc 裡


syntax on
set autoindent
" fonts 參數可以先在 GUI 編輯->設定字型後下 set gfn? 指令取得
set guifont=DFKai\-SB:h14:cCHINESEBIG5

" color patterns, 可以參考
" http://code.google.com/p/vimcolorschemetest/ 底下
" browse by file type 的部份取得 sample 檔,放在
" ~\Program Files\Vim\vimfiles\colors 中, 如 torte.vim 就是
colorscheme torte

set background=dark

" 256 colors
set t_Co=256

"initial window size
winpos 0 0
set columns=120
set textwidth=118
set lines=31
"or replace the above with the following for fullscreen
au GUIEnter * simalt ~x

"#按一次 Tab 縮四個空格
set tabstop=4

"#自動縮排時,一次縮四個空格
set shiftwidth=4

"#將 Tab 轉成空格
set expandtab

"#不顯示@
set display=lastline

"highlight for current search match
set incsearch

" tags search path
set tags=tags,../tags,../../tags,../../../tags

"keep columns when rows changed
set nosol

"搜尋時不管大小寫
set ignorecase
"當有大寫時才管大小寫
set smartcase

"help avoid hi-enter prompt
set cmdheight=1

"always have status line
set laststatus=2

" No backup files for gvim under windows
" set nobackup
" set nowritebackup
set noswapfile


Ubuntu 下的 vimrc 設定檔


set nocompatible

set history=800 " vim history buffer lines
set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1

" indent code differently based on file type
filetype plugin on
filetype indent on

set t_Co=256
syntax on

" Set to auto read when a file is changed from the outside
set autoread

"#按一次 Tab 縮四個空格
set tabstop=4

"#自動縮排時,一次縮四個空格
set shiftwidth=4

"#將 Tab 轉成空格
set expandtab

"#不顯示@
set display=lastline

"highlight for current search match
set incsearch
"highlight all matches for the pattern
set tags=tags,../tags,../../tags,../../../tags,../../../../tags,/home/sshuang/.vim/tags/tags,/usr/include/tags

" 顯示第幾列
set number

" 檢查拼字
"set spell
" 檢查拼字語系
"set spelllang=en

"keep columns when rows changed
set nosol

set autoindent smartindent "auto and smart indent
set smarttab "make and smarter
set backspace=eol,start,indent " allow backspacing over indent, eol, & start

" http://www.jukie.net/~bart/blog/vim-and-linux-coding-style, need fix!
" For Linux kernel specific highlighting
"syn match ErrorLeadSpace /^ \+/ " highlight any leading spaces
"syn match ErrorTailSpace / \+$/ " highlight any trailing spaces
"match Error80 /\%>80v.\+/ " highlight anything past 80 in red

"搜尋時不管大小寫
set ignorecase
"當有大寫時才管大小寫
set smartcase

"help avoid hi-enter prompt
set cmdheight=1

"always have status line
set laststatus=2

"在 vim 使用滑鼠
"set mouse=a

" Enrich status line, from
" http://www.packtpub.com/article/personalizing-vim?utm_source=rb_vim7.2_abr4_0510&utm_medium=content&utm_campaign=rahul
:set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\[HEX=\%02.2B]\ [POS=%04l,%04v]\ [%p%%]\ [LEN=%L]

" No backup files for gvim,
" http://thehumblecoder.wordpress.com/2006/08/08/vim-swap-and-backup-files/
" set nobackup
" set nowritebackup
" set noswapfile

" color files in ~/.vim/colors/railscasts.vim
colorscheme railscasts

" TagList settings,
" http://c9s.blogspot.com/2007/07/setting-up-ctags-gvim-in-windows.html
" http://vim-taglist.sourceforge.net/manual.html
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Exit_OnlyWindow = 1
" let Tlist_Auto_Open = 1


nnoremap :TlistToggle


" 方便在 terminal 剪貼 windows/browsers 文字檔,保持排版
nnoremap :set paste


" 恢復 indent

nnoremap :set nopaste


" include path for standard include directories and files
set path+=/usr/include

" from http://janitor.kernelnewbies.org/ suggestions to edit linux kernel
" codes and dealing with patches
set backupcopy=auto,breakhardlink
map ^iSigned-off-by: Sheng Jih Huang ^
map! Signed-off-by: Sheng Jih Huang
let c_space_errors=1
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

" ===============
" GUI Settings, gvim specific settings
" ===============
if has("gui_running")
"execute gui-only commands here.
" set height of window for your (17" LCD) Monitor
set clipboard=unnamed
set guioptions=amrb
else
endif

" vim in different OS
" or use :help 'some settings'
if has("win16") || has("win32") || has("win64")|| has("win95")
"always use gui vim in windows?
if has("gui_running")
"execute gui-only commands here.
"initial window size
winpos 0 0
set columns=120
set textwidth=118
set lines=31
"or replace the above with the following for fullscreen
au GUIEnter * simalt ~x
endif
" do windows things here
elseif has("unix")
" do linux/unix things here
endif

" from grep.vim
" You can map a key to invoke any of the above commands. For example, the
" following map invokes the :Grep command to search for the keyword under the
" cursor:
nnoremap :Grep


相關連結:

gvim

vim document:gui win32

vimrc 常用設定(問答)

Sample .gvimrc

gvim 設定

vim 的設定與一些快捷鍵

vim color scheme test

vim swap and backup files

https://github.com/vgod/vimrc

The ultimate Vim configuration - vimrc

The perfect .vimrc vim config file | Steve Francia's Blog