Hi, 如果有任何想法与我沟通, 请用: lifr_nj 在 msn.com
vimrc
上一篇 /
下一篇 2007-12-19 09:51:12
/ 个人分类:other
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
"-----------------------------------------
" tab and indent
"-----------------------------------------
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
set autoindent
colorscheme darkblue
"-----------------------------------------
" edit
"-----------------------------------------
set ruler
set backspace=2
set nowrap
set number
set lbr
set tw=500
"quickly move cross/delete word in insert mode
imap <C-Left> <C-o>b
imap <C-Right> <C-o>w
imap <C-BS> <C-o>db
imap <C-Del> <C-o>dw
map <C-Return> $<Insert><CR><ESC>
"-----------------------------------------
" search
"-----------------------------------------
set is
set ic
set hlsearch
"set noignorecase
nmap <F2> :nohlsearch<CR>
"-----------------------------------------
" move
"-----------------------------------------
" scroll
map <c-j> <c-y>
map <c-k> <c-e>
"-----------------------------------------
" tag
"-----------------------------------------
"taglist
nnoremap <silent> <F8> :TlistToggle<CR>
let Tlist_Show_One_File = 1
"for develop everbright
"set tags=c:\\ruby\\lib\\ruby\\ruby.tags,d:\\CVSProject\\projects\\app_testing\\auto_test\\main\\bin\\everbright.tags
"-----------------------------------------
"edit vimrc
"-----------------------------------------
map <F11> <ESC>:edit $VIM\_vimrc<CR>
map <F12> <ESC>:source %<CR>
"-----------------------------------------
" buffer
"-----------------------------------------
set hidden
map <C-Tab> :bnext<CR>
imap <C-Tab> <ESC>:bnext<CR>
map <C-S-Tab> :bprevious<CR>
imap <C-S-Tab> <ESC>:bprevious<CR>
map <C-D> :w<CR>:bdelete!<CR>
imap <C-D> <ESC>:w<CR>:bdelete!<CR>
"-----------------------------------------
" leader command
"-----------------------------------------
"shotcut with mapleader
let mapleader=","
let g:mapleader=","
nmap <leader>w :w!<cr>
nmap <leader>f :find<cr>
nmap <leader>bn :bn<cr>
nmap <leader>bp :bp<cr>
nmap <leader>bd :bdelete<cr>
" with 'dd', to add/delete new line in normal mode
nmap <leader>o A<cr><esc>
nmap <leader>O I<cr><esc>
"-----------------------------------------
" abbrevs
"-----------------------------------------
"general abbrevs
iab xdate <c-r>=strftime("%Y-%m-%d %H:%M:%S")<cr>
"-----------------------------------------
" autocmd by FileType
"-----------------------------------------
" run scrīpt. not work. why?
autocmd FileType vim nmap <buffer> <F12> :w!<cr>:source %<cr>
autocmd FileType ruby map <buffer> <F12> :w!<cr>:!ruby %<cr>
"-----------------------------------------
" others
"-----------------------------------------
set nobackup "no backup. that's ~file
set autowrite
set go-=T "remove menu and boolbar
"auto change dir to the file currently being edited
set autochdir
map <F5> <C-l>
"favourity filetypes
set fileformats=unix,dos,mac
"no sound on errors
set noerrorbells
set novisualbell
set t_vb=
"format statusline
set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l/%L:%c
"-----------------------------------------
" functions
"-----------------------------------------
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &opt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if &sh =~ '\<cmd'
silent execute '!""C:\Program Files\Vim\vim70\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"'
else
silent execute '!C:\Program" Files\Vim\vim70\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endif
endfunction
收藏
举报
TAG:
VIM
Other
other