" proft gvim config [http://proft.me] "colorscheme rdark colorscheme lilypink " font for gvim set guifont=Courier\ New\ 17 set guioptions-=T set guioptions-=m " set lines=30 " set columns=105 set lines=42 set columns=130 " normal work backspace set backspace=indent,eol,start whichwrap+=<,>,[,] inoremap cb inoremap cw " Always keep 2 lines on the top and bottom of the screen set scrolloff=2 " fullscreen set guioptions-=e set guioptions-=r set guioptions-=R set guioptions-=b set guioptions-=l set guioptions-=L function ToggleFullScreen() exec('silent !wmctrl -r :ACTIVE: -b toggle,fullscreen') endfunction nmap :call ToggleFullScreen() function FixCursor() exec('highlight iCursor guifg=white guibg=orange') endfunction nmap ,f :call FixCursor() " m$ ïîâåäåíèå source $VIMRUNTIME/mswin.vim " increment nnoremap " spelling " setlocal spell spelllang=ru,en imap :set spell!:setlocal spell spelllang=ru,en nmap :set spell!:setlocal spell spelllang=ru,en map sn ]s map sp [s map sa zg map s? z= " autocmd FileType human,text set spell spelllang=ru,en " change color of cursor highlight iCursor guifg=white guibg=orange set guicursor+=i:ver10-iCursor " ââîä êîìàíä áåç ïåðåêëþ÷åíèÿ ðàñêëàäêè "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,ÍY,ÃU,ØI,ÙO,ÇP,Õ\{,Ú\},ÔA,ÛS,ÂD,ÀF,ÏG,ÐH,ÎJ,ËK,ÄL,Æ\:,Ý\",ßZ,×X,ÑC,ÌV,ÈB,ÒN,ÜM "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,ÍY,ÃU,ØI,ÙO,ÇP,Õ\{,Ú\},ÔA,ÛS,ÂD,ÀF,ÏG,ÐH,ÎJ,ËK,ÄL,Æ\:,Ý\",ßZ,×X,ÑC,ÌV,ÈB,ÒN,ÜM,Á\<,Þ\> " èñïîëüçîâàíèå êîäèðîâîê êëàâèàòóðû, ñîäåðæàùèõ ñèìâîëû êèðèëëèöû set iskeyword=@,48-57,_,192-255 " Çàñòàâëÿåì shift-insert ðàáîòàòü êàê â Xterm "map " tidy html vnoremap T :!tidy -q -i -xml " for python let python_highlight_all = 1 let python_highlight_space_errors = 0 "autocmd FileType python set omnifunc=pythoncomplete#Complete "autocmd FileType python set cc=80 autocmd FileType python iab pdb import ipdb; ipdb.set_trace() autocmd FileType python iab u8 # -*- coding: utf-8 -*- au Filetype htmldjango inoremap {{}} au Filetype htmldjango inoremap {%%} au Filetype htmldjango inoremap {{MEDIA_URL}} au Filetype htmldjango let b:surround_{char2nr("v")} = "{{ \r }}" au Filetype htmldjango let b:surround_{char2nr("{")} = "{{ \r }}" au Filetype htmldjango let b:surround_{char2nr("%")} = "{% \r %}" au Filetype htmldjango let b:surround_{char2nr("b")} = "{% block \1block name: \1 %}\r{% endblock \1\1 %}" au Filetype htmldjango let b:surround_{char2nr("i")} = "{% if \1condition: \1 %}\r{% endif %}" au Filetype htmldjango let b:surround_{char2nr("w")} = "{% with \1with: \1 %}\r{% endwith %}" au Filetype htmldjango let b:surround_{char2nr("f")} = "{% for \1for loop: \1 %}\r{% endfor %}" au Filetype htmldjango let b:surround_{char2nr("c")} = "{% comment %}\r{% endcomment %}" " for django let g:last_relative_dir = '' nnoremap \1 :call RelatedFile ("models.py") nnoremap \2 :call RelatedFile ("views.py") nnoremap \3 :call RelatedFile ("urls.py") nnoremap \4 :call RelatedFile ("admin.py") nnoremap \5 :call RelatedFile ("tests.py") nnoremap \6 :call RelatedFile ("templates/" ) nnoremap \7 :call RelatedFile ("templatetags/" ) nnoremap \8 :call RelatedFile ("management/" ) nnoremap \0 :e settings.py nnoremap \9 :e urls.py fun! RelatedFile(file) if filereadable(expand("%:h"). '/models.py') || isdirectory(expand("%:h") . "/templatetags/") exec "edit %:h/" . a:file let g:last_relative_dir = expand("%:h") . '/' return '' endif if g:last_relative_dir != '' exec "edit " . g:last_relative_dir . a:file return '' endif echo "Cant determine where relative file is : " . a:file return '' endfun fun SetAppDir() if filereadable(expand("%:h"). '/models.py') || isdirectory(expand("%:h") . "/templatetags/") let g:last_relative_dir = expand("%:h") . '/' return '' endif endfun autocmd BufEnter *.py call SetAppDir() " for markdown autocmd BufNewFile,BufRead *.{md,mkd,mkdn,mark*} set filetype=markdown autocmd BufNewFile,BufRead *.{md,mkd,mkdn,mark*} let g:surround_{char2nr("c")} = "
\r
" autocmd BufNewFile,BufRead *.{md,mkd,mkdn,mark*} let g:surround_{char2nr("h")} = "

\r

" " autocmd BufNewFile * silent! 0r ~/.vim/skel/tpl.%:e " for html autocmd BufNewFile,BufRead *.{html} let g:surround_{char2nr("c")} = "
\r
" autocmd BufNewFile,BufRead *.{html} let g:surround_{char2nr("h")} = "\r" autocmd BufNewFile,BufRead *.{html} let g:surround_{char2nr("u")} = "[\r]()" " for javascript au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType css set smartindent " load template function! LoadTemplate() silent! 0r ~/.vim/skel/tpl.%:e syn match Todo "%\u\+%" containedIn=ALL endfunction autocmd! BufNewFile * call LoadTemplate() nnoremap /%\u.\{-1,}%c/%/e " inoremap /%\u.\{-1,}%c/%/e " [TABS] " tab navigation like firefox nmap :tabprevious nmap :tabnext nmap :tabnew map :tabprevious map :tabnext map :tabclose imap :tabpreviousi imap :tabnexti imap :tabnew imap :tabclose map ,tl :call MoveTabLeft() map ,tr :call MoveTabRight() function MoveTabLeft() let current_tab = tabpagenr() if current_tab > 1 let current_tab = current_tab - 2 execute 'tabmove' current_tab endif endfunction function MoveTabRight() let current_tab = tabpagenr() execute 'tabmove' current_tab endfunction " set up tab labels with tab number, buffer name, number of windows function! GuiTabLabel() let label = '' let bufnrlist = tabpagebuflist(v:lnum) " Add '+' if one of the buffers in the tab page is modified for bufnr in bufnrlist if getbufvar(bufnr, "&modified") let label = '+' break endif endfor " Append the tab number let label .= v:lnum.': ' " Append the buffer name let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) if name == '' " give a name to no-name documents if &buftype=='quickfix' let name = '[Quickfix List]' else let name = '[No Name]' endif else " get only the file name let name = fnamemodify(name,":t") endif let label .= name " Append the number of windows in the tab page " let wincount = tabpagewinnr(v:lnum, '$') " return label . ' [' . wincount . ']' return label endfunction set guitablabel=%{GuiTabLabel()} " set tablabel= function MyTabLine() let s = '' for i in range(tabpagenr('$')) " select the highlighting if i + 1 == tabpagenr() let s .= '%#TabLineSel#' else let s .= '%#TabLine#' endif " set the tab page number (for mouse clicks) let s .= '%' . (i + 1) . 'T' " the label is made by MyTabLabel() let s .= '%{MyTabLabel(' . (i + 1) . ')} ' endfor " after the last tab fill with TabLineFill and reset tab page nr let s .= '%#TabLineFill#%T' " right-align the label to close the current tab page if tabpagenr('$') > 1 let s .= '%=%#TabLine#%999Xclose' endif return s endfunction function MyTabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) let label = fnamemodify(bufname(buflist[winnr - 1]), ':t') if label == '' if &buftype == 'quickfix' let label = '[Quickfix List]' else let label = 'NoName' endif endif if getbufvar(buflist[winnr - 1], "&modified") let label = "+".label endif let label = a:n.":".label return label endfunction set tabline=%!MyTabLine() " [PLUGINS] " *** mru *** "nmap :MRU "let MRU_Max_Entries = 30 " *** nerd tree *** autocmd BufEnter * lcd %:p:h "if exists("loaded_nerd_tree") " function ShowNerdTreeToggle() " :execute 'NERDTreeToggle' "set columns=140 " endfunction " nmap :call ShowNerdTreeToggle() "nmap :NERDTreeToggle "endif map NERDTreeTabsToggle let g:nerdtree_tabs_open_on_gui_startup = 0 " *** sessionman *** if exists("loaded_sessionman") nmap ,ss :SessionSave nmap ,so :SessionOpen nmap ,sc :SessionClose endif " *** fuzzyfinder *** let g:fuf_modesDisable = [] let g:fuf_mrufile_maxItem = 400 let g:fuf_mrucmd_maxItem = 400 let g:fuf_coveragefile_globPatterns = ['**/*.py', '**/*.html', '**/*.css', '**/*.js'] nnoremap sf :FufFile nnoremap sd :FufDir nnoremap sb :FufBuffer nnoremap 2 :FufFile ~/Dropbox/tabs/ nnoremap 3 :FufFile ~/Dropbox/blog/ nnoremap 1 :FufFile ~/Dropbox/blog/0force/ nnoremap h :FufFile ~/ nnoremap n :FufFile ~/Dropbox/notes/ nnoremap sc :FufCoverageFile " *** tcomment *** inoremap c :TComment nnoremap c :TComment vnoremap c :TComment " *** rope *** let ropevim_vim_completion=1 function! TabWrapperRope() if strpart(getline('.'), 0, col('.')-1) =~ '^\s*$' return "\" else return "\=RopeCodeAssistInsertMode()\" endif endfunction inoremap =RopeCodeAssistInsertMode() " *** rainbow_parenthsis *** nnoremap R :call rainbow_parentheses#Toggle() " *** vim-ack *** nnoremap a :Ack " *** tagbar *** " let g:tagbar_left = 1 "let g:tagbar_autoclose = 1 "nmap :TagbarToggle " *** scratch *** nmap :Sscratchx:resize 10 " *** pyflakes *** nmap e :cc let g:pyflakes_use_quickfix = 0 " *** pep8 *** let g:pep8_map='8' " *** supertab *** let g:SuperTabDefaultCompletionType="context" set completeopt=menuone,longest,preview " *** gundo *** map g :GundoToggle " *** indentline *** hi Conceal guifg=#404040 guibg=NONE " *** local config let gv_local = expand('~/.gvim.local') if filereadable(gv_local) exec ':so ' . gv_local endif " *** python-klen let g:pymode_lint_ignore = "E401,E501" let g:pymode_options = 0 let g:pymode_lint_write = 0 " off check on save let g:pymode_folding = 0 " off folding let g:pymode_rope_vim_completion = 0 " off rope autocompletion " create line break when pressing enter let g:delimitMate_expand_cr = 1 let g:delimitMate_expand_space = 1 " *** pydiction let g:pydiction_location = '/home/proft/.vim/bundle/pydiction/complete-dict'