[raw] [dotfiles.tar.gz]
   1 lang messages C
   2 scriptencoding utf8
   3 
   4 set viminfo+=n~/.vim/viminfo history=1000
   5 set noswapfile undofile undodir=~/.vim/undo//
   6 if !isdirectory(expand(&undodir)) " {{{
   7     call mkdir(expand(&undodir), 'p')
   8 endif " }}}
   9 
  10 set titlestring=%F%{&mod?'*':''}\ -\ Vim
  11 set tabline=%!TabLine() tabpagemax=100
  12 function! TabLine() " {{{
  13     let s = ''
  14 
  15     for i in range(tabpagenr('$'))
  16         let n = (i + 1)
  17         let s .= (n == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#')
  18         let s .= '%'.n.'T '.n.':%{TabLineLabel('.n.')} '
  19     endfor
  20 
  21     return s.'%#TabLine#%T'
  22 endfunction
  23 
  24 function! TabLineLabel(n)
  25     let list = tabpagebuflist(a:n)
  26     let num = list[tabpagewinnr(a:n) - 1]
  27 
  28     let name = fnamemodify(bufname(num), ':t')
  29     let mod = (getbufvar(num, '&mod') ? '*' : '')
  30 
  31     return (name == '' ? '[No Name]' : name.mod)
  32 endfunction " }}}
  33 
  34 set mouse=a mousefocus mousemodel=popup
  35 set virtualedit=block keymodel=startsel
  36 let [&t_SI, &t_SR, &t_EI] = ["\e[5 q", "\e[3 q", "\e[0 q"]
  37 
  38 set autochdir lazyredraw splitbelow splitright
  39 set foldmethod=marker foldcolumn=2 foldtext=FoldText()
  40 function! FoldText() " {{{
  41     let fold = (v:foldend - v:foldstart + 1).' lines'
  42 
  43     let line = foldtext()
  44     let line = substitute(line, '\(\d\+\)', ' \1', '')
  45     let line = substitute(line, ' .*: ', ' ', '')
  46     let line = substitute(line, '^+', '-', '')
  47 
  48     if strlen(v:folddashes) > 1 || line =~ '(' || line =~ '{'
  49         let line = substitute(line, '^-\+ ', '', '').'('.fold.')'
  50         let fill = getline(v:foldstart)
  51 
  52         if match(fill, '^\s') == 0
  53             let line = substitute(fill, '^\(\s\+\).*', '\1', '').line
  54         endif
  55     else
  56         let char = matchstr(&fillchars, '.*fold:\zs.')
  57         let fill = (&colorcolumn ? &colorcolumn : 80)
  58         let fill = (fill - 1 - 4 - strlen(line))
  59 
  60         let fold  = ' '.fold
  61         let line .= repeat(char, (fill - strlen(fold)))
  62         let line .= fold.' '.repeat(char, 3)
  63     endif
  64 
  65     redraw
  66     return line.repeat(' ', (winwidth(0) - strlen(line)))
  67 endfunction " }}}
  68 
  69 set list listchars=tab:›\ ,space:·
  70 set hlsearch incsearch ignorecase smartcase
  71 set spelllang+=ru fileencodings=utf8,cp1251
  72 
  73 set nowrap linebreak display=lastline
  74 set tabstop=4 shiftwidth=0 expandtab
  75 set autoindent smartindent shiftround smarttab
  76 
  77 set ttimeoutlen=0 completeopt=menuone,noinsert
  78 set whichwrap+=<,>,[,] backspace=indent,eol,start
  79 set nojoinspaces formatoptions+=j
  80 
  81 set confirm report=0 showcmd
  82 set wildmenu wildignorecase wildmode=list:longest,full
  83 
  84 " Keys {{{
  85 
  86 let mapleader = ' '
  87 let &langmap  =
  88 \ 'ё`,йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ъ],'.
  89 \ "фa,ыs,вd,аf,пg,рh,оj,лk,дl,ж\\;,э',".
  90 \ 'яz,чx,сc,мv,иb,тn,ьm,б\,,ю.,'.
  91 \ 'Ё~,ЙQ,ЦW,УE,КR,ЕT,HY,ГU,ШI,ЩO,ЗP,Х{,Ъ},'.
  92 \ 'ФA,ЫS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,Ж:,Э",'.
  93 \ 'ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Б<,Ю>'
  94 
  95 nnoremap Y y$
  96 nnoremap * *<C-o>
  97 nnoremap n nzvzz
  98 
  99 nnoremap <Bs> X
 100 vnoremap <Bs> x
 101 vnoremap <Tab> >gv
 102 vnoremap <S-Tab> <gv
 103 
 104 vnoremap <C-c> "+y
 105 vnoremap <C-x> "+x
 106 noremap  <C-v> "+gP
 107 inoremap <C-v> <C-r>+
 108 cnoremap <C-v> <C-r>+
 109 
 110 noremap  <C-z> u
 111 inoremap <C-z> <C-o>u
 112 noremap  <C-y> <C-r>
 113 inoremap <C-y> <C-o><C-r>
 114 
 115 noremap  <C-s> :update<Cr>
 116 vnoremap <C-s> <C-c>:update<Cr>
 117 inoremap <C-s> <C-o>:update<Cr>
 118 
 119 nnoremap - :call Ranger()<Cr>
 120 function! Ranger() " {{{
 121     call term_start(
 122         \ ['ranger', '--choosefiles', s:ranger_f, '--selectfile', expand('%')],
 123         \ { 'term_finish': 'close', 'exit_cb': 'RangerCb' }
 124     \ )
 125 endfunction
 126 
 127 function! RangerCb(msg, code)
 128     if !filereadable(s:ranger_f)
 129         redraw! | return
 130     endif
 131 
 132     exec 'tabe '.join(readfile(s:ranger_f), ' | tabe ')
 133     redraw! | call delete(s:ranger_f)
 134 endfunction
 135 let s:ranger_f = tempname() " }}}
 136 nnoremap <F5> :w \| make!<Cr>
 137 
 138 nmap <Leader>h :nohls<Cr>
 139 nmap <Leader>R :redraw!<Cr>
 140 nmap <Leader>s :setl spell!<Cr>
 141 nmap <Leader>w :setl wrap!<Cr>
 142 nmap <Leader>n :setl nu! nornu<Cr>
 143 nmap <Leader>g :call magit#show_magit('h', 1, 2)<Cr><C-w>T
 144 
 145 for s:i in range(1, 9)
 146     exec 'set <A-'.s:i.">=\e".s:i
 147     exec 'noremap <A-'.s:i.'> '.s:i.'gt'
 148     exec 'inoremap <A-'.s:i.'> <C-o>'.s:i.'gt'
 149 endfor
 150 
 151 " }}}
 152 " Colors {{{
 153 
 154 set t_Co=16
 155 syntax enable
 156 colors default
 157 
 158 hi! clear
 159 
 160 hi! Visual ctermbg=NONE ctermfg=grey cterm=reverse
 161 
 162 hi! Search ctermbg=NONE ctermfg=darkYellow cterm=reverse
 163 hi! IncSearch ctermbg=NONE ctermfg=yellow cterm=reverse
 164 
 165 hi! SpellBad ctermbg=NONE ctermfg=red cterm=underline
 166 hi! SpellCap ctermbg=NONE ctermfg=blue cterm=underline
 167 
 168 hi! link TabLine User1
 169 hi! link TabLineSel User2
 170 
 171 hi! LineNr ctermbg=NONE ctermfg=grey
 172 hi! SignColumn ctermbg=NONE ctermfg=NONE
 173 
 174 hi! Folded ctermbg=NONE ctermfg=grey
 175 hi! FoldColumn ctermbg=NONE ctermfg=grey
 176 
 177 hi! DiffAdd ctermbg=NONE ctermfg=green cterm=reverse
 178 hi! DiffChange ctermbg=NONE ctermfg=darkYellow cterm=reverse
 179 hi! DiffDelete ctermbg=NONE ctermfg=red cterm=reverse
 180 hi! DiffText ctermbg=NONE ctermfg=NONE cterm=reverse
 181 
 182 hi! Error ctermbg=NONE ctermfg=red
 183 hi! ErrorMsg ctermbg=NONE ctermfg=red
 184 
 185 hi! SpecialKey ctermbg=NONE ctermfg=darkGrey
 186 au BufEnter * call matchadd('SpecialKey', '[ \t]')
 187 
 188 " }}}
 189 " Statusline {{{
 190 
 191 set laststatus=2
 192 set statusline=%1*%{StatusLine()}
 193 set statusline+=\ %<%F%{&mod?'*':''}\ %r%=
 194 set statusline+=%{&et?'':'\\t\ '}%{&spell?'ая\ ':''}
 195 set statusline+=%{&fenc}\ %{&ff}\ %2*\ %P\ %0*
 196 function! StatusLine() " {{{
 197     if mode() == s:statusline
 198         return ''
 199     endif
 200 
 201     let s:statusline = mode()
 202     let mode = get({
 203         \ 'n': 'Normal', 'i': 'Insert',
 204         \ 'v': 'Visual', 'V': 'Visual', "\<C-v>": 'Visual'
 205     \ }, s:statusline, 'Replace')
 206 
 207     exec 'hi! link User2 Mode'.mode
 208     redrawstatus | redrawtabline
 209 
 210     return ''
 211 endfunction
 212 let s:statusline = '' " }}}
 213 
 214 hi! StatusLine cterm=reverse
 215 hi! StatusLineNC ctermbg=white ctermfg=black
 216 
 217 hi! User1 ctermbg=NONE
 218 hi! link User2 ModeNormal
 219 
 220 hi! ModeNormal ctermbg=NONE ctermfg=NONE cterm=reverse,bold
 221 hi! ModeInsert ctermbg=NONE ctermfg=blue cterm=reverse,bold
 222 hi! ModeVisual ctermbg=NONE ctermfg=darkYellow cterm=reverse,bold
 223 hi! ModeReplace ctermbg=NONE ctermfg=red cterm=reverse,bold
 224 
 225 " }}}
 226 " Commands {{{
 227 
 228 au VimResized  * wincmd =
 229 au BufReadPost * normal g`"zz
 230 au BufWritePre * setl eol | retab | %s/\s\+$//e
 231 
 232 au FileType *commit setl spell tw=72 sw=2
 233 au FileType mail,markdown setl wrap spell
 234 
 235 au BufRead *newsboat/urls nmap <Leader>S Vip:'<,'>!sort -k 2,3<Cr>
 236 
 237 " }}}
 238 " Plugins {{{
 239 
 240 if !filereadable(expand('~/.vim/autoload/plug.vim'))
 241     silent !curl -sLo ~/.vim/autoload/plug.vim --create-dirs
 242     \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
 243 endif
 244 
 245 call plug#begin('~/.vim/plug')
 246 
 247 Plug 'https://github.com/ctrlpvim/ctrlp.vim'
 248 Plug 'https://github.com/junegunn/vim-peekaboo'
 249 
 250 Plug 'https://github.com/jreybert/vimagit'
 251 Plug 'https://github.com/mhinz/vim-signify'
 252 
 253 Plug 'https://github.com/w0rp/ale'
 254 Plug 'https://github.com/lifepillar/vim-mucomplete'
 255 
 256 Plug 'https://github.com/sheerun/vim-polyglot'
 257 Plug 'https://github.com/jamessan/vim-gnupg'
 258 Plug 'https://github.com/calviken/vim-gdscript3'
 259 
 260 Plug 'https://github.com/tpope/vim-endwise'
 261 Plug 'https://github.com/adelarsq/vim-matchit'
 262 
 263 Plug 'https://github.com/tpope/vim-commentary'
 264 Plug 'https://github.com/dhruvasagar/vim-table-mode'
 265 Plug 'https://github.com/nelstrom/vim-visual-star-search'
 266 
 267 call plug#end()
 268 
 269 let ale_sign_warning = '>>'
 270 let ctrlp_prompt_mappings = {
 271     \ 'AcceptSelection("e")': ['<2-LeftMouse>'],
 272     \ 'AcceptSelection("t")': ['<Cr>', '<C-t>']
 273 \ }
 274 let mucomplete#enable_auto_at_startup = 1
 275 let mucomplete#chains = { 'default' : ['path', 'c-n', 'omni', 'uspl'] }
 276 
 277 " }}}