2009年3月11日 星期三

CSH 與 VIM 環境設定

[CSH]
到 /etc/passwd 確認自己的 SHELL 是用 csh


修改
/etc/csh.cshrc (影響所有使用者) 或 ~/.cshrc (影響自己)


加入以下設定,完成後重新登入即生效:

# $FreeBSD: src/etc/csh.cshrc,v 1.3.52.1 2008/11/25 02:59:29 kensmith Exp $
#
# System-wide .cshrc file for csh(1).

set prompt = '[%B%n@%M%b] %B%~%b%#'
# color
setenv LSCOLORS ExGxFxdxCxegedabagExEx
setenv CLICOLOR yes
# autolist
set autolist

# bind keypad keys for console, vt100, vt102, xterm
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete
bindkey "\e[4~" end-of-line # End

# UTF8
setenv LC_ALL en_US.UTF-8
setenv LANG en_US.UTF-8




[VIM]
修改
~/.vimrc


加入以下設定,完成後重開 VIM 即生效:


syntax on
" 256 color
set t_Co=256
map tn :tabnext
map tp :tabprev
map to :tabnew
map tc :tabclose
nmap L
nmap H
set history=200
set ai
set ruler
set cin
set dir=/tmp
set hls
set ch=2
"set softtabstop=4
"set shiftwidth=4
set tabstop=4 shiftwidth=4 softtabstop=0
set ignorecase
"set expandtab
set bs=2 " allow backspacing over everything in insert mode
set ts=2
set ff=unix
set nobk
"set fileencodings=utf-8,big5,gbk,sjis,euc-jp,euc-kr,utf-bom,iso8859-1
"set encoding=utf-8
"set termencoding=utf-8
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,big5,euc-jp,gbk,euc-kr,utf-bom,iso8859-1
set termencoding=utf-8
set ambiwidth=double
"set =^U
"set =^B
"map :set enc=utf-8 :set termencoding=utf-8 :set fileencoding=utf-8
"map :set enc=big5 :set termencoding=big5 :set fileencoding=big5
set guifontset=-sgi-screen-medium-r-normal-*-14-*-*-*-*-*-iso8859-1,-*-mingliu-medium-r-normal-*-14-*-*-*-c-*-big5-0

hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "koehler"
hi Normal guifg=white guibg=black
hi Scrollbar guifg=darkcyan guibg=cyan
hi Menu guifg=black guibg=cyan
hi SpecialKey term=bold cterm=bold ctermfg=darkred guifg=Blue
hi NonText term=bold cterm=bold ctermfg=darkred gui=bold guifg=Blue
hi Directory term=bold cterm=bold ctermfg=brown guifg=Blue
hi ErrorMsg term=standout cterm=bold ctermfg=grey ctermbg=blue guifg=White guibg=Red
hi Search term=reverse ctermfg=white ctermbg=red guifg=white guibg=Red
hi MoreMsg term=bold cterm=bold ctermfg=darkgreen gui=bold guifg=SeaGreen
hi ModeMsg term=bold cterm=bold gui=bold guifg=White guibg=Blue
hi LineNr term=underline cterm=bold ctermfg=darkcyan guifg=Yellow
hi Question term=standout cterm=bold ctermfg=darkgreen gui=bold guifg=Green
hi StatusLine term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
hi StatusLineNC term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue
hi Title term=bold cterm=bold ctermfg=darkmagenta gui=bold guifg=Magenta
hi Visual term=reverse cterm=reverse gui=reverse
hi WarningMsg term=standout cterm=bold ctermfg=darkblue guifg=Red
hi Cursor guifg=bg guibg=Green
hi Comment term=bold cterm=bold ctermfg=cyan guifg=#80a0ff
hi Constant term=underline cterm=bold ctermfg=magenta guifg=#ffa0a0
hi Special term=bold cterm=bold ctermfg=red guifg=Orange
hi Identifier term=underline ctermfg=brown guifg=#40ffff
hi Statement term=bold cterm=bold ctermfg=yellow gui=bold guifg=#ffff60
hi PreProc term=underline ctermfg=darkblue guifg=#ff80ff
hi Type term=underline cterm=bold ctermfg=lightgreen gui=bold guifg=#60ff60
hi Error term=reverse ctermfg=darkcyan ctermbg=black guifg=Red guibg=Black
hi Todo term=standout ctermfg=black ctermbg=darkcyan guifg=Blue guibg=Yellow
hi link IncSearch Visual
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
hi link Float Number
hi link Function Identifier
hi link Conditional Statement
hi link Repeat Statement
hi link Label Statement
hi link Operator Statement
hi link Keyword Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Typedd
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special
" Hilight for tabline
hi TabLine guifg=#90fff0 guibg=#2050d0 ctermfg=black ctermbg=white
hi TabLineSel guifg=#90fff0 guibg=#2050d0 ctermfg=white ctermbg=LightMagenta
"set cursorline
"hi cursorline cterm=none ctermbg=gray
""------Restore cursor to file position in VIM
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

"設定副檔名為 XXX 時,為什麼檔案
au BufNewFile,BufRead *.tpl :set ft=php " all my .tpl files ARE html
au BufNewFile,BufRead *.ini :set ft=php " all my .tpl files ARE html
au BufNewFile,BufRead *.phtml :set ft=php " all my .tpl files ARE html
au BufNewFile,BufRead *.php :set ft=php " all my .tpl files ARE html

au FileType javascript so ~/.vim/indent/javascript.vim

"for textmate, plugin
filetype on
filetype plugin on
filetype indent on
"change gf buffer open to tabedit
nmap gf :tabedit

"Folding
set foldenable

"Highlight SQL syntax in string
let php_sql_query=1
"Highlight HTML in string
let php_htmlInStrings=1
"Folding for classes & functions
"let php_folding=1
nnoremap @=((foldclosed(line('.')) < 0) ? 'zc' :'zo')

" for omni
set completeopt=longest,menu
"set completeopt=menu,menuone
imap
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
" Omni補完関連
" $VIMRUNTIME/autoload/htmlcomplete.vimの645行目をコメントアウントしておくとhtmlの補完が小文字になる

" TabでOmni補完及びポップアップメニューの選択
function InsertTabWrapper(is_shift)
if pumvisible()
return a:is_shift ? "\" : "\"
endif
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k\|<\|/' " htmlで補完できるように<,/でもOmni補完
return "\"
elseif exists('&omnifunc') && &omnifunc == ''
return a:is_shift ? "\" : "\"
else
return "\\"
endif
endfunction
inoremap =InsertTabWrapper(0)
" Shift-Tabはうまくいかないようだ
" inoremap =InsertTabWrapper(1)

" CRでOmni確定&改行
function InsertCrWrapper()
return pumvisible() ? "\\" : "\"
endfunction
inoremap =InsertCrWrapper()
"colorscheme yzlin256
"colorscheme zenburn



參考資料:
我同事 JohnPuPu 的設定檔


0 意見: