.vimrcメモ

set nocompatible

" encode
set encoding=utf-8
set fileencodings=utf-8,iso-2022-jp,sjis,euc-jp

" menu
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P
"set wildmenu
set wildmode=list:longest

" display
set number
syntax on
filetype on
set laststatus=2
set cmdheight=2
set showcmd
set wrap

" search
set history=100
set incsearch
set ignorecase
set smartcase
set showmatch
set hlsearch

" tab
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set noautoindent

" color
if &t_Co > 1
"    set t_Co=256
    colorscheme delek
    highlight Search cterm=none ctermfg=0
endif

" backup
set nobackup
"set writebackup
"set backup
"set backupdir=~/backup
"set directory=~/swap

" python develop setting
function PythonDev()
    set filetype=python
    nmap <F5> :!/usr/bin/python %<CR>
    nmap <F12> :!/usr/lib/python2.4/pdb.py %<CR>
endfunction
autocmd BufRead,BufNewFile *.py :call PythonDev()

" php develop setting
function PHPDev()
    set filetype=php
    nmap <F4> !ctags -f %:p:h/tags --langmap="php:+.inc" -h ".php.inc" -R --totals=yes --tag-relative=yes --PHP-kinds=+cf-v %:p:h<CR>
    nmap <F5> :!/usr/bin/php %<CR>
    nmap <F12> :!/usr/bin/php -l %<CR>
endfunction
"autocmd BufRead,BufNewFile *.php :call PHPDev()
autocmd BufRead,BufNewFile *.inc,*.view,*.edit,*.check,*.wui,*.mod,*.conf,*.cnf :call PHPDev() "for HDE

" php develop setting
function KaresansuiDev()
    set filetype=html
endfunction
autocmd BufRead,BufNewFile *.part,*.input :call KaresansuiDev() "for HDE

" buffer
nmap <C-P> :bprevious<CR>
nmap <C-N> :bnext<CR>
nmap bb :ls<CR>:buf

" complete
function TabOrComplete()
    let col = col('.')-1
    if !col || getline('.')[col-1] !~ '\k'
        return "\<Tab>"
    else
        return "\<C-X>\<C-N>"
    endif
endfunction
imap <silent> <Tab> <C-R>=TabOrComplete()<CR>

" omni complete
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
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 python set omnifunc=pythoncomplete#Complete
autocmd FileType c set omnifunc=ccomplete#Complete

" multi byte
if exists('&ambiwidth')
    set ambiwidth=double
endif

" highlight
highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray
match ZenkakuSpace / /
autocmd WinEnter * match ZenkakuSpace / /

set list
set listchars=tab:\ \ ,trail:\
highlight SpecialKey cterm=underline ctermfg=lightblue guibg=darkgray

" ctags
set tags=./tags
set tags+=tags;
set tags+=./**/tags

" fold
set foldcolumn=4
set foldmethod=indent
set foldlevel=100 "Don't autofold anything