Содержание подраздела:
Пример конфигурационного файла vim
Вот мой vimrc:
Если нет возможности скопировать - то вот мой готовый файл vimrc.
"====================================
"
" Edit by Ben-Ja http://net4me.ru
" On Wed 28 Feb 2007 08:11:15 PM MSK
"
"====================================
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " show partial command in status line
set viminfo='50,%,n~/.viminfo
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
" my for not beep:
set vb t_vb="<Esc>|40f"
" my for olors:
":colorscheme ben-ja
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif
if has("title")
set notitle
set noicon
endif
" add key mappings for national keyboards
if has("langmap") && filereadable( $VIMRUNTIME . "/langmap/" . $LANG . ".vim" )
exe "so " . $VIMRUNTIME . "/langmap/" . $LANG . ".vim"
endif
" Tab = (4*space)
set tabstop=4
set sw=4
" set number
set nomodeline
set noautoindent
" on search T=t:
set ignorecase
" my for right vertical window active
set splitright
" my maps:
map <F2> :set encoding=UTF-8<CR>
" 3 windows
map <F3> :vs<CR>:sp<CR>
" Insert my stamp (in i mode)
imap <F4> <C-R>=MyStamp()<CR>
function! MyStamp()
let myhead = "#====================================\n#\n"
\ . "# Edit by Ben-Ja http://net4me.ru\n# On "
\ . strftime("%c")
\ . "\n#\n#====================================\n"
return myhead
endfunction
"
" force exit (without save):
map <F10> :qall!<CR>
" my menu for comments:
set wildmenu
set wcm=<Tab>
" <F5>
menu REM.Java(//) :s/^/\/\//<CR>
menu REM.Bash(#) :s/^/#/<CR>
menu REM.Vim(") :s/^/"/<CR>
" <F6>
menu UNREM.Java_UN :s/^\/\///<CR>
menu UNREM.Bash_UN :s/^#//<CR>
menu UNREM.Vim_UN :s/^"//<CR>
"
map <F5> :emenu REM.<TAB>
map <F6> :emenu UNREM.<TAB>
" tabbed (move visual blocks):
vmap <TAB> :s/^/\t/<CR>
vmap <S-TAB> :s/^\t//<CR>
" autocompletion {<Enter>}
" imap {<CR> {<CR>}<Esc>O<Tab>
" Encodings
"<F7> EOL format (dos <CR><NL>,unix <NL>,mac <CR>)
set wildmenu
set wcm=<Tab>
menu EOL.unix :set fileformat=unix<CR>
menu EOL.dos :set fileformat=dos<CR>
menu EOL.mac :set fileformat=mac<CR>
menu EOL.my_win2unix :%s /\r\n/\r/g<CR>
map <F7> :emenu EOL.<Tab>
"<F8> Change encoding
set wildmenu
set wcm=<Tab>
menu Enc.cp1251 :e ++enc=cp1251<CR>
menu Enc.koi8-r :e ++enc=koi8-r<CR>
menu Enc.cp866 :e ++enc=ibm866<CR>
menu Enc.utf-8 :e ++enc=utf-8<CR>
menu Enc.ucs-2le :e ++enc=ucs-2le<CR>
map <F8> :emenu Enc.<Tab>
"<Shift+F8> Convert file encoding
set wildmenu
set wcm=<Tab>
menu FEnc.cp1251 :set fenc=cp1251<CR>
menu FEnc.koi8-r :set fenc=koi8-r<CR>
menu FEnc.cp866 :set fenc=ibm866<CR>
menu FEnc.utf-8 :set fenc=utf-8<CR>
menu FEnc.ucs-2le :set fenc=ucs-2le<CR>
map <S-F8> :emenu FEnc.<Tab>
" Statusline
set statusline=%<%f%h%m%r%=format=%{&fileformat}\ file=%{&fileencoding}\ enc=%{&encoding}\ %b\ 0x%B\ %l,%c%V\ %P
set laststatus=2
"
" the end
|