.vimrc

The configuration file for the vim editor.

" ################### basics #####################
" allow for more features
set nocompatible
" enable the syntax highlighting
syntax on
" set indentation and filetype pluging on at startup
filetype plugin indent on
" allow the magic vim config string in source files
set modeline
"Reformat current paragraph with Ctrl-j
map  gqip
set wildmenu
"backups go there
set backupdir=~/.backups,.,/tmp
"swap files go there
set directory=~/.backups,.,/tmp
"do not beep on errors
set noerrorbells
"ignorecase:  ignore the case in search patterns?  NO!
set ignorecase
"be smart at the beginning of lines
"set smarttab
"indent with two spaces when hitting tab
set shiftwidth=2
"expand all tabs to spaces according to shiftwidth parameter
set expandtab
set tabstop=2
"always set autoindenting on
set autoindent
set smartindent
"use utf-8 is possible, fallback to iso-8859-5 otherwise
set fileencodings=utf-8,iso-8859-1
set encoding=utf-8
set fileformat=unix
" do not wrap text
set nowrap
" for those used to the dark XTerm
set background=dark
" Show tabs, trailing spaces, long lines
set list listchars=tab:→\ ,trail:¤
"enable 256 colors in xterm > 209
"set t_Co=256
"set langmap=ж;;
"set langmap=ё`,йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],фa,ыs,вd,аf,пg,рh,оj,лk,дl,э',яz,чx,сc,мv,иb,тn,ьm,б\,,ю.,Ё~,ЙQ,ЦW,УE,КR,ЕT,HY,ГU,ШI,ЩO,ЗP,Х{,Ъ},ФA,ЫS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,Ж:,Э\",ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Б
"langmap does not work in utf-8
   map ё `
   map й q
   map ц w
   map у e
   map к r
   map е t
   map н y
   map г u
   map ш i
   map щ o
   map з p
   map х [
   map ъ ]

   map ф a
   map ы s
   map в d
   map а f
   map п g
   map р h
   map о j
   map л k
   map д l
   map ж ;
   map э '

   map я z
   map ч x
   map с c
   map м v
   map и b
   map т n
   map ь m
   map б ,
   map ю .

   map Ё ~
   map Й Q
   map Ц W
   map У E
   map К R
   map Е T
   map Н Y
   map Г U
   map Ш I
   map Щ O
   map З P
   map Х {
   map Ъ }

   map Ф A
   map Ы S
   map В D
   map А F
   map П G
   map Р H
   map О J
   map Л K
   map Д L
   map Ж :
   map Э "

   map Я Z
   map Ч X
   map С C
   map М V
   map И B
   map Т N
   map Ь M
   map Б 

" #################### XML #######################
function XMLLintValidate()
  !xmllint --valid --noout --catalogs %
endfunction
nmap ,l :call XMLLintValidate()
" pretty-print document
vmap ,px !xmllint --format -
" pretty-print current line
"nmap ,px !!xmllint --format -
"pretty-print fragment
vmap ,pf 'msO[before]mb'>omeo[after]ma'sV'e!xmllint --format -'bj2dd
iabbrev dts =strftime("%d/%m/%Y %H:%M")


" use mail.vim by Artem Chuprina to format fido-like quotes
autocmd BufRead /tmp/mutt*      :source ~/.vim/ftplugin/mail.vim
autocmd BufRead ~/.article*     :source ~/.vim/ftplugin/mail.vim

autocmd FileType xml            :source ~/.vim/ftplugin/mail.vim
autocmd FileType text setlocal textwidth=72

if has("autocmd")
  " Drupal *.module files.
  augroup module
    autocmd BufRead *.module set filetype=php
  augroup END
endif

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event
" handler (happens when dropping a file on gvim).
autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") 
vnoremap  >gv 

" create xhtml from highlited code
let html_use_css = 1
let use_xhtml =1

"write the visual selection as HTML into a new buffer
fun! MyToHtml(line1, line2)
exec a:line1.','.a:line2.'TOhtml'
%g//
/ %s#\(.\|\n\)*