"====================================== " " Edit by Ben-Ja http://www.net4me.net " On Fri 04 Jun 2010 04:25:10 PM MSD " "====================================== 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=80 " keep 80 lines of command line history set ruler " show the cursor position all the time set showcmd " show partial command in status line set viminfo='80,%,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="|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 "for autocreate files content. Change path to your files or comment this: ":autocmd BufNewFile *.py 0r ~/vim/mytemplates/python.txt ":autocmd BufNewFile *.html 0r ~/vim/mytemplates/html.txt "for auto change path to dir with edited file: :autocmd BufEnter * lcd %:p:h 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: " HEX view on/off: map :Hex4me " 3 windows map :vs:sp " Insert my stamp (in i mode) imap =MyStamp() function! MyStamp() let myhead = "#======================================\n#\n" \ . "# Edit by Ben-Ja http://www.net4me.net\n# On " \ . strftime("%c") \ . "\n#\n#======================================\n" return myhead endfunction " " HEX function for F8 menu. " ex command for toggling hex mode - define mapping if desired command -bar Hex4me call HexView() " hex mode helper function HexView() " hex mode should be considered a read-only operation " save values for modified and read-only for restoration later, " and clear the read-only flag for now let l:modified=&mod let l:oldreadonly=&readonly let &readonly=0 let l:oldmodifiable=&modifiable let &modifiable=1 if !exists("b:editHex") || !b:editHex " save old options let b:oldft=&ft let b:oldbin=&bin " set new options setlocal binary " make sure it overrides any textwidth, etc. let &ft="xxd" " set status let b:editHex=1 " switch to hex editor %!xxd else " restore old options let &ft=b:oldft if !b:oldbin setlocal nobinary endif " set status let b:editHex=0 " return to normal editing %!xxd -r endif " restore values for modified and read only state let &mod=l:modified let &readonly=l:oldreadonly let &modifiable=l:oldmodifiable endfunction " force exit (without save): map :qall! " my menu for comments: set wildmenu set wcm= " menu REM.Java(//) :s/^/\/\// menu REM.Bash(#) :s/^/#/ menu REM.Vim(") :s/^/"/ " menu UNREM.Java_UN :s/^\/\/// menu UNREM.Bash_UN :s/^#// menu UNREM.Vim_UN :s/^"// " map :emenu REM. map :emenu UNREM. " tabbed (move visual blocks): vmap :s/^/\t/ vmap :s/^\t// " autocompletion {} " imap { {}O " Encodings " EOL format (dos ,unix ,mac ) set wildmenu set wcm= menu EOL.unix :set fileformat=unix menu EOL.dos :set fileformat=dos menu EOL.mac :set fileformat=mac menu EOL.my_win2unix :%s /\r\n/\r/g map :emenu EOL. " Change encoding set wildmenu set wcm= menu Enc.cp1251 :e ++enc=cp1251 menu Enc.koi8-r :e ++enc=koi8-r menu Enc.cp866 :e ++enc=ibm866 menu Enc.utf-8 :e ++enc=utf-8 menu Enc.ucs-2le :e ++enc=ucs-2le menu Enc.HexView :Hex4me map :emenu Enc. " Convert file encoding set wildmenu set wcm= menu FEnc.cp1251 :set fenc=cp1251 menu FEnc.koi8-r :set fenc=koi8-r menu FEnc.cp866 :set fenc=ibm866 menu FEnc.utf-8 :set fenc=utf-8 menu FEnc.ucs-2le :set fenc=ucs-2le map :emenu FEnc. " 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