function! Default() " Without it default syntax highlight very bright. MUST be " before another changing colors: colorscheme default syntax on set showcmd set nowrap " Count matches with search: set shortmess-=S " Comments color: hi Comment ctermfg=grey " Autocomplete color: hi Pmenu ctermbg=black ctermfg=darkgrey " Number column: set number set numberwidth=5 hi LineNr ctermfg=166 " For controling rule 80x25: set colorcolumn=80 hi ColorColumn ctermbg=2 " OpenBSD mailing rule: set textwidth=72 set keymap=russian-jcukenwin " Ctrl+^ switch language. set iminsert=0 " Make English first INSERT language. set imsearch=0 " For searching in Russian. "show current keyboard layout: set ruler set rulerformat=%20(%{printf('[%s]',&iminsert?'ru':'en')}%5l,%-6(%c%V%)\ %P%) "Use Ctrl-l and Ctrl-^ for switch language: imap " Color of search: set hlsearch hi Search ctermbg=darkgray " In some terminals it's black.. endfunction call Default() " LilyPond files: function! Setup_ly() filetype off set runtimepath+=~/.vim/vim-lilypond/ filetype on syntax on hi Identifier ctermfg=65 "DarkSeaGreen hi Comment ctermfg=grey hi ColorColumn ctermbg=2 "syntax clear Comment "match Comment /%.*$/ "syntax region Comment start="%{" end="%}" endfunction autocmd BufRead,BufNewFile *.ly call Setup_ly() " LaTeX files: function! Setup_tex() set smartindent " with tabulation. endfunction autocmd BufRead,BufNewFile *.tex call Setup_tex() " Arduino ino files: function! Setup_ino() set shiftwidth=8 " Works in VISUAL mode. set softtabstop=8 " Works with key. set nowrap set tabstop=8 " Don't replace \t with spaces. set noexpandtab " Don't replace \t with spaces also. endfunction autocmd BufRead,BufNewFile *.ino call Setup_ino() " `vim` autocomplete `make` targets with `:Make` command. " Thanks to habamax from linux.org.ru: function! MakeCompletion(A,L,P) abort return system( \ 'make -qp | \ awk -F'':'' ''/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ {split($1,A,/ /);for(i in A)print A[i]}'' \ | grep -v Makefile | sort -u') endfunction command! -nargs=* -complete=custom,MakeCompletion Make make " Scheme files: function! Setup_scm() hi Identifier ctermfg=65 " DarkSeaGreen endfunction autocmd BufRead,BufNewFile *.scm call Setup_scm() " Turn off highlight for .asm: autocmd Filetype asm set syntax=off " Prepare header file function! Header() call append(0, "#ifndef _SENTRY") call append(1, "#define _SENTRY") call append(2, "#ifdef __cplusplus") call append(3, "extern \"C\" {") call append(4, "#endif") call append(5, "") call append(6, "") call append(7, "") call append(8, "#ifdef __cplusplus") call append(9, "}") call append(10, "#endif") call append(11, "#endif /* ifndef _SENTRY */") endfunction command! Header call Header() " Thanks to CrX from linux.org.ru: set wcm= menu Encoding.CP1251 :e ++enc=cp1251 menu Encoding.CP1252 :e ++enc=cp1252 menu Encoding.CP866 :e ++enc=cp866 menu Encoding.KOI8-R :e ++enc=koi8-r menu Encoding.UTF-8 :e ++enc=utf-8 map :emenu Encoding.