Please bear with us as we work to restore functionality to dotfiles.org.
vim configuration file
" @(#) ~/.vimrc
" Description: vim имеет всего два режима - бибикать и все портить. :-)
" Author: dMitry Alexandrow
" Created: 2003-08-24
" Version: $Id: .vimrc,v b43dd42f7337 2008/12/23 18:47:09 mitry $
version 6.2
""" Options: {{{1
""" ======================================
""" General: {{{2
set nocompatible " It is important to set this first
set exrc " enable reading .vimrc/.exrc/.gvimrc in the current directory
set cpoptions=BceFsM " list of flags to specify Vi compatibility
"set nopaste " paste mode, insert typed text literally
"set pastetoggle= " key sequence to toggle paste mode
"set helpfile " name of the main help file
"set runtimepath " list of directories used for runtime files and plugins
if has('win32')
set runtimepath=~/.vim,$VIMRUNTIME,~/.vim/after
endif
""" Store an editing session in the viminfo file; can be used at next session.
set sessionoptions=buffers,folds,sesdir,slash,unix
set viminfo='50,<10,f1,s1,%,!,n~/.vim/.viminfo
set viewdir=~/.vim/view " directory where to store files with :mkview (~/.vim/view)
set directory=~/.backup// " directories for the swap file (last // - use full file path)
"set noloadplugins " don't load plugin scripts when starting up
set debug=msg " set to `msg` to see error messages for 'foldexpr' & 'indentexpr'
"set verbose=9 " the higher the more messages are given
"set insertmode " Insert mode is the default mode - makes Vim a modeless editor.
"set eventignore= " list of autocommand events which are to be ignored
set isfname-== isf-=[ isf-=] isf-=# " specifies the characters in a file name
let g:ausession= ".vimsession" " file for autosaved session
""" GUI: {{{2
"set lm=ru_RU.cp1251 " langmenu: language to be used for the menu
set winaltkeys=no " Don't use ALT keys for menus.
set guioptions=gmMr " list of flags that specify how the GUI works
" T = Toolbar
" M = '$VIMRUNTIME/menu.vim' isn't sourced.
" m = Show menu
" t = tear-off menus
" L = Left-hand scrollbar isn't present
""" Tab support for 7.+ version
if has('windows')
set guioptions+=e
set switchbuf+=usetab
set sessionoptions+=tabpages
endif
if has("gui_win32")
" set guifont=Andale_Mono:h8:cRUSSIAN
" set guifont=Lucida_Console:h10:cRUSSIAN
" set guifont=Lucida_Sans_Typewriter:h8:cRUSSIAN
" set guifont=Courier_New:h10:cDEFAULT
" set guifont=Liberation_Mono:h10:cRUSSIAN
" set guifont=DejaVu_Sans_Mono:h10:cRUSSIAN lines=999 columns=100
" VimTip414: межстрочный интервал в gvim можно уменьшать:
set guifont=Consolas:h11:cRUSSIAN lsp=-1 lines=999 columns=100
" set guifont=Droid_Sans_Mono:h10:cRUSSIAN lsp=0 lines=999 columns=100
" set columns=100
endif
""" Windows: {{{2
set noequalalways " don't make all windows the same size when adding/removing windows
" set eadirection=ver " in which direction 'equalalways' works: 'ver', 'hor' or 'both'
set hidden " don't unload a buffer when no longer shown in a window
set switchbuf=useopen,split " which window to use when jumping
set nowinfixheight " don't keep the height of the window
set splitbelow " a new window is put below the current one (with :split and :help)
set splitright " a new window is put right of the current one (with :vsplit)
set winwidth=20 " minimal number of columns used for the current window
" set lines=999 " number of lines in the VIM display
" set winminwidth=3 " minimal number of columns used for any window
" set winheight=20 " minimal number of lines used for the current window
" set helpheight=10 " initial height of the help window
" let &winheight=has('gui')? &lines-10 : 20
let &winheight=has('gui')? 35 : 20
""" statusline:
let &stl='--<%02n> %1*%t%* %3*%M%*[%(%R%W%Y%),%{&fenc}:%{&ff}] %2*%{mode()}%* %4*%k%* %= 0x%B at %1*%l%*/%L:%c%V --'
set laststatus=2 " Always a status line
""" Moving Around Searching And Patterns: {{{2
"set path=,;~/GTD/** " list of directory names used for file searching
set path=,~/GTD/** " -- "" --
set cdpath=,,.,~ " list of directory names used for :cd
set nogdefault " (don't) Use `g` flag by default in substitutes
set nohlsearch " (no)highlighting the last used search pattern
set incsearch " show match for partly typed search command
set ignorecase " ignore case when using a search pattern
set magic " 'magic' patterns - extended regular expressions: \s+
set smartcase " override 'ignorecase' when pattern has upper case characters
set nostartofline " Don't jump to start of line after delete and other misc commands
set whichwrap=<,>,[,],h,l,b,s,~ " list of flags specifying which commands wrap to another line
set nowrapscan " Searches wrap around the end of the file.
set virtualedit=block " Cursor can be anywhere in Visual block mode
"set virtualedit=all " Cursor can be anywhere in all modes
""" Tags: {{{2
set tags+=./tags;/ " list of file names to search for tags: Upward tag search
set showfulltag " when completing tags in Insert mode show more info
"set tagbsearch " use binary searching in tags files
"set taglength=0 " number of significant characters in a tag name or zero
"set tagrelative " file names in a tags file are relative to the tags file
"set tagstack " a :tag command will use the tagstack
""" Displaying Text: {{{2
set display=lastline " show the last line even if it doesn't fit - no @
set lazyredraw " don't redraw while executing macros
set nonumber " don't show the line number for each line
set scrolloff=3 " number of screen lines to show around the cursor
set sidescroll=1 " minimal number of columns to scroll horizontally
set sidescrolloff=3 " minimal number of columns to keep left and right of the cursor
set linebreak " wrap long lines at a character in 'breakat'
set fillchars=stl:-,stlnc:-,vert:\|,fold:\ ,diff:-
set showbreak=>>
set nolist " Don't show as ^I and end-of-line as $
set nowrap " no long lines wrap
if has('gui_running') || (&termencoding == "utf-8")
" list of strings used for list mode
" let &listchars = 'tab:|' . nr2char(0xBB) . ',trail:' .nr2char(0xB7) . ',eol:$'
set listchars=tab:\|»,trail:·,eol:¶,extends:…,precedes:…,nbsp:_
let &listchars = substitute(&listchars,'_',nr2char(0x208C),'')
let &fillchars="stl:".nr2char(0xAD).",stlnc:".nr2char(0xAD).',vert:|,fold:'.nr2char(0xB7).',diff:'.nr2char(0xBF)
endif " has('gui_running')
""" Terminal: {{{2
set ttyfast " terminal connection is fast
"set term=builtin_gui " name of the used terminal
"set guicursor " specifies what the cursor looks like in different modes
"set titlelen=85 " percentage of 'columns' used for the window title
set titlestring=%F\ %h%w\ -\ gViM " string to be used for the window title
set title " show info in the window title
set icon " set the text of the icon for this window
"set iconstring " when not empty, text for the icon of this window
"set norestorescreen " restore the screen contents when exiting Vim
set esckeys " recognize keys that start with in Insert mode
""" Mouse: {{{2
set mousehide " Hide the mouse pointer while typing
set mousemodel=extend " what the right mouse button is used for
set nomousefocus " the window with the mouse pointer becomes the current one
""" Messages And Info: {{{2
set confirm " Always use ':confirm'
set shortmess=aOItT " To avoid the 'Hit ENTER to continue' prompt
set showcmd " Show current uncompleted command
set showmode " (no)show the current mode
set report=0 " Report when N lines were changed. report=0 : show all changes
set noruler " (no)Show the cursor position all the time
set noerrorbells " no Ring the bell (beep or screen flash) for error messages.
set novisualbell " (don't) Use visual flashing instead of beeping.
"set verbose=0 " show messages about what VIM is doing.
""" Selecting: {{{2
set selection=exclusive " Selection is exclusive, mswin-style
"set selection=inclusive " Selection is inclusive, unix-style
"set selection=old " / behave mswin
set keymodel=startsel,stopsel " Use shifted cursor keys to start/stop selection
set selectmode= " No Select-mode: no replace selection with typing
""" Editing: {{{2
set backspace=2 " BackSpacing over everything (indent,eol,start) in insert mode
set undolevels=100 " maximum number of changes that can be undone
set tildeop " `~` command behaves like an operator
if has("unix") " list of dictionary files for keyword completion
set dictionary=~/.words,/usr/share/dict/*.words
else
set dictionary=~/.words,c:/usr/share/dict/*.words
endif
"set thesaurus= " list of thesaurus files for keyword completion
set complete=.,w,b,t,k,i " specifies how Insert mode completion works
if has('spell')
set complete+=kspell
endif
set formatoptions=crqon1 " list of flags that tell how automatic formatting works
" t = Auto-wrap text using textwidth (does not apply to comments)
" c = Auto-wrap comments, inserting the comment leader
" r = Insert the comment leader after hitting in Insert mode.
" o = Insert the comment leader after hitting 'o' or 'O' in Normal mode.
" q = Allow formatting of comments with "gq".
" n = Auto-listing
" 1 = Don't break a line after a one-letter word.
set infercase " adjust case of a keyword completion match
set showmatch " show the matching bracket for the last ')'
set matchtime=3 " tenth of a second to show a match for 'showmatch' (def=5)
set nrformats=alpha,hex " number formats recognized for CTRL-A and CTRL-X commands
if v:version >= 700
set completeopt=longest,menu,preview
endif
""" Tabs And Indenting: {{{2
set autoindent " always set autoindenting on
set smartindent " do clever autoindenting
set cinkeys+=; " figure out indent when ; is pressed
set noexpandtab " no expand to spaces in Insert mode
set shiftround " round to 'shiftwidth' for `<<` and `>>`
set smarttab " a in an indent inserts 'shiftwidth' spaces
set tabstop=8 " Number of spaces that a in the file counts for.
"set copyindent " Copy whitespace for indenting from previous line
"set preserveindent " Preserve kind of whitespace when changing indent
set cinoptions=:0,l1,t0,g0,(0 " C-Indent options: Linux-kernel style
""" Folding: {{{2
set foldenable " set to display all folds open
set foldlevel=0 " Min folding level
set foldlevelstart=-1 " value for 'foldlevel' when starting to edit a file
set foldclose=all " close a fold when the cursor leaves it
"set foldopen=all " specifies for which commands a fold will be opened
set foldminlines=1 " minimum number of screen lines for a fold to be closed
set foldmethod=marker " folding type: 'manual', 'indent', 'expr', 'marker' or 'syntax'
if has('gui') " && winwidth(0) > 80
set foldcolumn=3 " width of the column used to indicate folds
endif
""" DiffMode: {{{2
set diffopt=filler,context:4,iwhite " options for using diff mode
"set diffexpr " expression used to obtain a diff file
"set patchexpr " expression used to patch a file
""" Reading And Writing: {{{2
set noautoread " (don't) automatically read a file when it was modified outside of Vim
set backup " keep a backup file
"set patchmode=.orig " keep oldest version of a file with this extension
set backupskip+=.passwd " patterns which files a backup is not made
set backupdir=~/.backup,~/tmp,/tmp,c:/tmp
set fileformat=unix " end-of-line format: unix - not dos
set fileformats=unix,dos " list of file formats to look for when editing a file
set modeline " enable using settings from modelines when reading a file (vim:ts=8:fenc=koi8-r)
set modelines=3 " number of lines to scan for modeline
""" CommandLine Editing: {{{2
set history=50 " keep 50 lines of command line history
set wildmode=longest:full,full " specifies how command line completion works
set wildmenu " enhanced mode command-line completion
set wildcharm= " wildcard expansion inside a macro
""" Ignore at auto-completion:
set wildignore=*.o,*.obj,*.exe,*.dll,*.com,*.class,*.au,*.wav,*.mp[23g],*.jar,*.rar,*.zip,*.gz,*.tgz,*.jpg,*.png,*.gif,*.avi,*.wmv,*.flv,*.djvu,*.pdf,*.chm,*.ps,*.dvi,tags,descript.ion,desktop.ini,*/CVS/,*/.hg/,*.~*,*~
""" Name extensions with lower priority
set suffixes+=.log
set suffixes+=.out
set suffixes+=.COPYING
""" External Commands: {{{2
set shellslash " use forward slashes in file names; for Unix-like shells
if v:version < 700
set grepprg=grep\ -rnEH " program to use for the `:grep` command
else
set grepprg=internal
endif
if has("filterpipe")
set noshelltemp " Use pipes on Unix
endif
set formatprg= " program used to format lines with 'gq' command
set equalprg= " program used for '=' command (global or local to buffer)
set keywordprg= " program used for the 'K' command
" set warn " warn when using a shell command and a buffer has changes
""" MultiByte Chars: {{{2
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp1251,koi8-r,cp866,java
set keymap=russian-jcukenwin
set iminsert=0 " latin input as default
set imsearch=0 " latin search as default
" so :p:h/keymap/russian-jcuken-win.vim
if has('win32') && !has("gui_running") && $SHELL != ''
set termencoding=8bit-cp1252
endif
if has('win32')
language ctype Russian_Russia.1251
endif
""" Spelling: {{{2
if has("spell")
set spelllang=en,ru
set spellfile=~/.words.utf-8.add
map :setlocal spell! spell?
endif
" ====================================== }}}1
""" Colors And Position: {{{1
""" Color scheme must be loaded _before_ `syntax on`
if has('gui_running')
colorscheme tango-mitry
else
colorscheme Norton
endif
if has("gui_win32")
let g:browsefilter =
\ "All Files (*.*)\t*.*\n"
\."Config Files (*.ini *.cfg *.rc)\t*.ini;*.cfg;*.rc\n"
\."C/C++ Source Files (*.c *.cpp *.h *.hpp)\t*.c;*.cpp;*.c++;*.h;*hpp\n"
\."Java Source Files (*.java *.properties)\t*.java;*.properties\n"
\."Batch Files (*.bat *.cmd)\t*.bat;*.cmd\n"
\."Perl Scripts (*.pl *.pm)\t*.pl;*.pm\n"
\."HTML Files (*.htm *.html *.jsp *.css)\t*.htm;*.html;*.jsp;*.css\n"
\."Vim scripts (*.vim .vimrc)\t*.vim;.vimrc;.gvimrc;_vimrc;_gvimrc;\n"
endif
""" AutoCommands: {{{1
filetype plugin indent on " Enable file type detection
syntax on
function! s:HiddenExec(str) " Execute str keeping jumps and regisers {{{2
if &ma && ! &ro
normal! m`
silent exe a:str
normal! g``zv
call histdel("/", -1)
let @/ = histget("/", -1)
endif
endfunction " }}}2
augroup ENCODINGS " {{{2
au!
""" To show lang name on the statusline
au BufNewFile,BufRead * let b:keymap_name="RU"
au FileType jproperties nested Encoding java
au FileType mail nested Encoding koi8-r
" au FileType dosini nested Encoding cp1251
augroup END
augroup AUTOMOD " {{{2
au!
""" Save the buffer marks
au BufUnload * wviminfo!
""" Remove trailing blanks and ^M
au BufRead * call s:HiddenExec('%s/\r\+$//e')
au BufWritePre,FileWritePre * call s:HiddenExec('%s/\s\+$//e')
""" To insert the current date and time in a *.html file when writing it:
au BufWritePre *.htm,*.html,*.php call s:HiddenExec('%s/\') .'.vim')
" au FuncUndefined * silent! source ~/.vim/macros/.vim
""" Jump to the last place you had been while reading Vim help files by use 'H
au BufLeave * if &bt=='help' | mark H | endif
au BufWinEnter * if &ft=~'^\v(help|man|info)$' || &pvw | exe 'wincmd K' | endif
""" VimTip214: Current buffer based menus.
""" If you have different menus for different filetypes, and you want to have
""" only the menu relevant to current buffer displayed, you can use this approach:
au BufEnter * exe exists('b:BuffEnter')? b:BuffEnter : ''
au BufLeave * exe exists('b:BuffLeave')? b:BuffLeave : ''
au BufNewFile,BufRead *.m3u,*.pls :nno buffer>gx :!start /usr/opt/mplayer/mplayer -nocache
if has('windows')
au BufNewFile,BufRead ~/.passwd :wincmd T|tabmove 0
endif
" au CursorHold ~/.passwd :silent! foldclose!|setl ro
au CursorHold ~/.passwd :setl ro|norm! zX
augroup END
augroup SyntaxAdd " {{{2
au!
au Syntax * syn match WhitespaceEOL containedin=TOP /\s\+$/
au Syntax * syn match WhitespaceEOL containedin=TOP / \+\t/he=e-1
au Syntax * syn match WhitespaceEOL containedin=TOP /\t \+/hs=s+1
au Syntax help,todo syn clear WhitespaceEOL
au Syntax *.[ch],*.[ch]pp runtime syntax/doxygen.vim
augroup END
augroup SESSSIONS " {{{2
au!
au VimEnter * nested if !strlen(v:this_session) && !argc() && !expand("") && filereadable(g:ausession) | exec 'so' g:ausession | endif
au VimLeavePre * if strlen(v:this_session)
au VimLeavePre * let SESSION = v:this_session
au VimLeavePre * exe 'mksession!' v:this_session
if has('win32')
au VimLeavePre * exe 'silent!!start NirCmd.exe shortcut "'.v:this_session'" "~$folder.desktop$\Projects" '.fnamemodify(v:this_session,':p:h:t:r')
endif
au VimLeavePre * else
au VimLeavePre * silent! unlet SESSION
au VimLeavePre * endif
augroup END
augroup CMDWindow " // Command Window: {{{2
au!
""" Save new history after editing
au CmdwinEnter * map :q
au CmdwinLeave * exe 'call histdel("'.expand('').'")|%call histadd("'.expand('').'",getline("."))'
augroup END
augroup CVSCommand "{{{2
au User CVSBufferSetup map q :bwipeout
au User CVSBufferSetup map :bwipeout
augroup END
augroup GnuPG " {{{2
au!
au BufReadPost *.asc :%!gpg -qd
au BufWritePre *.asc :%!gpg -qea
au BufWritePost *.asc :undo
if !has("gui_running")
au BufReadPost *.asc :redraw!
"au VimLeave *.asc :!clear
endif
augroup END
augroup EXTEXE " // Associations: {{{2
au!
if has('win32')
""" Execute command and close opened for it buffer
command! -nargs=* -bang -complete=file SExe silent exe '!start' iconv(,&enc,'cp1251') |bu#|bw!#
""" To make gf worked for URL, say, file:///C:/myfile.txt
au BufReadCmd file://* bd!|edit :p:s?^file://??
au BufReadCmd reg://* SExe! NirCmd.exe regedit :p:s?^reg://??
au BufReadCmd http://* SExe! rundll32.exe shell32.dll,ShellExec_RunDLL :p
""" Multimedia (don't work w/out exe '!start' ; no spaces in path)
""" au BufReadCmd *.mp3 SExe! madplay --tty-control :p
au BufReadCmd *.exe SExe! :p
au BufReadCmd *.lnk,*.url,*.chm,*.pdf,*.djvu,*.zip,*.rar,*.mp3
\ SExe! NirCmd.exe shexec open ":p"
" \ SExe! RunDll32.exe shell32.dll,ShellExec_RunDLL ":p"
au BufReadCmd *.jpg,*.gif,*.ico,*.png,*.bmp,*.icl
\ SExe! NirCmd.exe shexec view ":p"
endif
""" Decompile java classes
au BufReadCmd *.class exe '0r!jad -p '
au BufReadCmd *.class exe setlocal ft=java bt=nowrite nomod noma
augroup END
" ====================================== }}}1
""" Syntax Highlighting: {{{1
""" Should be set _after_ 'syntax on'
hi! link StorageClass Statement
hi! link Structure Statement
hi! link Function Normal
""" Highlighting whitespaces at end of line
hi! link WhitespaceEOL WarningMsg
hi! link diffRemoved Comment
hi! link diffAdded PreProc
let readline_has_bash = 1
let is_bash = 1
let sh_fold_enabled= 1
""" Plugins: {{{1
let user = 'dMitry Alexandrov' " used by Templates
let replyto = strlen($REPLYTO)? $REPLYTO : "mitry@mitry.spb.ru" " - '' -
let copyright = strftime("%Y").', Mitrysoft Corp. All rights reserved.'
let username = 'mitry' " used by JCommenter
let spec_chglog_format = '%Y-%n-%d ' .user.' <'.replyto.'>'
""" Environment:
let $EDITOR = (has('gui_running')?'g':'') . 'vim --remote-tab-silent'
let $TERM = has('gui_running')? 'dumb' : $TERM
let $MAIL = 'Inbox.mbx' " Used by mailbrowser
""" Explore: {{{2
let explDetailedHelp=0 " Show more help
let explDetailedList=0 " the size and date to do not show by default
let explVertical=1 " Split vertically
let explWinSize=25 " the number of rows or columns
let explDirsFirst=-1 " Directories at the bottom of the list
let explSplitRight=1 " Put new window to the right of the explorer
let explStartRight=0 " Put new explorer window to the left of the current window
let explUseSeparators=0 " Include separator lines between directories, files, and suffixes
"let explHideFiles='^\.,\.gz$,\.exe$,\.dat$,\.zip$,\.class$,\.log$'
noremap :aboveleft 25vsplit %:p:h
map gz NetrwBrowseX
""" TagList: {{{2
let Tlist_Inc_Winwidth=1
let Tlist_Display_Prototype=0
let Tlist_Compact_Format=1
let Tlist_Exit_OnlyWindow=1
map :Tlist
""" Calendar: (cp-1251) {{{2
let g:calendar_navi_label = 'Пред,Сегодня,След'
let g:calendar_mruler = 'Янв,Фев,Мар,Апр,Май,Июн,Июл,Авг,Сен,Окт,Ноя,Дек'
let g:calendar_wruler = 'Вс Пн Вт Ср Чт Пт Сб'
let g:calendar_monday = 1
let g:calendar_focus_today=1
hi! CalWeekend guifg=red
hi! link CalSaturday CalWeekend
hi! link CalSunday CalWeekend
hi! link CalMemo Type
hi! link CalToday Todo
""" map this way to disable mapping in Calendar.vim plugin (NO noremap)
map CalendarV
map CalendarH
""" CVSCommand: {{{2
"let loaded_cvscommand = 1 " Don't load
let CVSCommandDeleteOnHide=1 " automatically delete temporary CVS results
let CVSCommandDiffOpt='wbBu' " options passed to the diff command (fefault: wbBc)
let CVSCommandEdit='split' " the original buffer is replaced ('edit') or split
let CVSCommandEnableBufferSetup=0 " set 'CVSRevision' 'CVSBranch' vars
""" MRU: {{{2
let MRU_File = expand('~/.vim/.mru_files')
" let MRU_Max_Entries=20
" let MRU_Add_Menu = 1
""" Changelog: {{{2
let changelog_username = username " used by changelog ftplugin
""" o - switches to the ChangeLog buffer opened for the current directory.
runt ftplugin/changelog.vim
""" Commenting: {{{2
""" EnhancedCommentify: {{{3
let EnhCommentifyRespectIndent='yes' " - yes/no - in lowcase ?!?!
let EnhCommentifyPretty='yes' " -
let EnhCommentifyUseSyntax='yes' " -
" let EnhCommentifyUseBlockIndent='yes' " -
let EnhCommentifyMultiPartBlocks='yes' " - Mulitline-comments
"let EnhCommentifyUseAltKeys='no' " Use alt keybindings instead of X.
"let EnhCommentifyUserBindings='yes' " -
nmap Traditionalj
imap i
" vmap VisualTraditionalgv
vmap Traditionalgv
""" Copy current line and commentify it
nmap :copy -1
imap
""" Doxygen: {{{3
let DoxygenToolkit_briefTag=".."
let DoxygenToolkit_authorName=username
""" Disable Some Plugins: {{{2
let loaded_matchparen=1 " showing matching parens ??? by Bram Moolenaar
let loaded_gzip=1 " plugin for editing compressed files
let loaded_GetLatestVimScripts=1 " disable GetLatestVimScripts
let loaded_rrhelper = 1 " helper function(s) for --remote-wait
" let loaded_netrw = 1 " file transfer and local/remote directory listing (Explore)
if has('win32')
let netrw_use_nt_rcp=1 " use the rcp of WinNT for netrw
endif
" let loaded_netrwFileHandlers=1
" let loaded_netrwSettings=1
" let loaded_vimball=1 " construct a file containing both paths and files ???
" ====================================== }}}1
""" Key Mapping: {{{1
""" See also:
""" ~/.vim/plugins/SpKeys.vim Standard mapping for and :
""" ~/.vim/plugins/MetaMove.vim blockwise select mode
""" Select Current Word: {{{2
nmap ciw
nmap ciw
nmap ciW
omap iw
omap iW
vmap iw
vmap iW
""" Undo: {{{2
map
map
""" Help: {{{2
if has("win32")
noremap :emenu Help.English-Russian
endif
""" Translate with Google translate (with `wget -qO -` or `curl -so -`)
map :echo system('wget -qO - "http://translate.google.com/translate_a/t?client=vim&sl=en&tl=ru&text='.expand('').'"')
vmap y:echo system('wget -qO - "http://translate.google.com/translate_a/t?client=vim&sl=en&tl=ru&text='.substitute(@@,'\_s\+','+','g').'"')
map :echo system('wget -qO - "http://translate.google.com/translate_a/t?client=vim&sl=ru&tl=en&text='.expand('').'"')
vmap y:echo system('wget -qO - "http://translate.google.com/translate_a/t?client=vim&sl=ru&tl=en&text='.substitute(@@,'\_s\+','+','g').'"')
""" In insert and command mode:
map!
""" How prev help topic
map s`H:setl bt=help
""" Show Syntax Highlighting groups the item under the cursor
map ? :echomsg "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"
""" Show buffer key mappings
map :map buffer>
""" Deleting: {{{2
noremap db
cnoremap
""" Delete current line
imap dd
nmap diw
""" Delete to the clipboard
imap "*yyddi
nmap "*dd
""" Delete the word right
map dw
""" Delete the rest of the line
map d$
""" Delete empty lines in the selection
vmap d :g/^$/d
""" Don't delete whole line if selection exists
vmap C c
""" Saving: {{{2
noremap :update
noremap :wall
noremap :browse confirm saveas
""" Save whit sudo when vim was started whitout sudo
"nnoremap es :w! /tmp/sudoSave \| let $fileToSave=expand('%') \| let $fileToSaveBackup=expand('%').'~' \| !sudo cp $fileToSave $fileToSaveBackup && sudo cp /tmp/sudoSave $fileToSave:e!
""" Searching: {{{2
nnoremap /
cnoremap %s!!!g
nnoremap :.,$s!\<\>!!g
vnoremap y:.,$s!=escape(@",'\!')!!g
cnoremap .,$s!!!g
nnoremap :%s!\<\>!!g
cnoremap %s!!!g
""" Search current word in the other window
noremap yiwpgg:call search(@@)
""" Windows: {{{2
map 5+
map _
map 5-
map 1_
map =
map K
map J
map H
map L
""" Jump between windows
nnoremap p
""" Sroll other window
nmap pp
nmap pp
""" Switch buffers
nmap :buffer
""" WinTabs support
if has('windows')
nnoremap ^T
" nnoremap :simalt ~n
" nnoremap :tabnew
map gt
map gT
map