if v:version < 800 set syntax=off set noloadplugins finish endif " fix indent for normal paste by mouse if has('patch-8.0.0238') set nofixendofline if $TERM =~ "xterm" || $TERM =~ "foot" let &t_BE = "\[?2004h" let &t_BD = "\[?2004l" let &t_PS = "\[200~" let &t_PE = "\[201~" endif endif " Russian support commands "set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz set langmap=ФТШРВНГОПСМЗЬДЫКЧЩЖЛАЮБИЕЁ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фтшрвнгопсмзьдыкчщжлаюбиеё;abcdefghijklmnopqrstuvwxyz "set for support old config nnoremap :set invnumber " Add these in the basic settings section set scrolloff=8 " Keep 8 lines above/below cursor set sidescrolloff=8 " Keep 8 columns left/right of cursor "set sj=-50 " -50 - half window on scroll, -100 - one page set timeout timeoutlen=1000 set nocompatible set encoding=utf-8 set viminfo= filetype plugin indent on set incsearch set ignorecase set smartcase set linebreak set textwidth=100 set wrap set showbreak=↪\ set breakindent set ttimeoutlen=0 set ttyfast set clipboard=unnamed set expandtab set tabstop=4 set shiftwidth=4 set softtabstop=4 set autoindent set nosmartindent " Ensure mouse is completely disabled except for visual selection set mouse= set ttymouse= set mousemodel=popup set noshowmode set nobackup set nowritebackup set history=100 set belloff=all set directory=/tmp// " for swap files (temp) set modelines=0 " Disable modelines completely (security feature) " Stricter formatting set textwidth=100 " Line wrap at 100 chars set formatoptions=tcqjn " Automatic formatting options augroup NoAutoComment autocmd! autocmd BufEnter * setlocal formatoptions-=o formatoptions-=r augroup END " Enhanced editing behaviors set autoindent " Copy indent from current line when starting new line set nosmartindent set nocindent set matchpairs+=<:> " Terminal cursor mode section let &t_SI = "\e[6 q" let &t_EI = "\e[2 q" let &t_TI = "\[>4;2m" let &t_TE = "\[>4;m" " Show problematic whitespace set list set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:· " Make splits more natural set splitbelow set splitright " Better command-line completion set wildmode=longest:full,full set wildmenu " Large file handling (100 character line length limit) let g:LargeFile = 1024 * 1024 * 10 " Define large file size (10MB), LOGS - welcome! augroup LargeFile autocmd! autocmd BufReadPre * \ let f=getfsize(expand("")) | \ if f > g:LargeFile || f == -2 | \ set eventignore+=FileType | \ setlocal noswapfile | \ setlocal bufhidden=unload | \ setlocal buftype=nowrite | \ setlocal undolevels=-1 | \ setlocal synmaxcol=100 | \ else | \ set eventignore-=FileType | \ endif augroup END " config color for terminal emu if !has('gui_running') set t_Co=256 if has('termguicolors') && ($COLORTERM ==# 'truecolor' || $COLORTERM ==# '24bit') let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" set termguicolors endif endif " My best color (righteous theme) " First, disable all syntax syntax clear highlight clear " Basic colors if &term == "linux" " Console-specific (16 colors) hi String cterm=NONE ctermfg=2 ctermbg=NONE " green hi Normal cterm=NONE ctermfg=7 ctermbg=NONE " white hi Comment cterm=NONE ctermfg=8 ctermbg=NONE " bright black (gray) hi Error cterm=bold ctermfg=1 ctermbg=NONE " red hi MatchParen cterm=bold ctermfg=5 ctermbg=NONE " magenta hi SpecialKey cterm=NONE ctermfg=6 ctermbg=NONE " cyan (closest to #668b8b) hi NonText cterm=NONE ctermfg=6 ctermbg=NONE " cyan (closest to #668b8b) hi Search cterm=NONE ctermfg=0 ctermbg=6 " black on cyan hi Visual cterm=NONE ctermfg=0 ctermbg=6 " black on cyan else " Terminal with 256 colors and truecolor hi String cterm=NONE ctermfg=72 ctermbg=NONE gui=NONE guifg=#5faf87 guibg=NONE hi Normal cterm=NONE ctermfg=247 ctermbg=NONE gui=NONE guifg=#93a1a1 guibg=NONE hi Comment cterm=NONE ctermfg=239 ctermbg=NONE gui=NONE guifg=#4e4e4e guibg=NONE hi Error cterm=bold ctermfg=196 ctermbg=NONE gui=bold guifg=#E50000 guibg=NONE hi MatchParen cterm=bold ctermfg=201 ctermbg=NONE gui=bold guifg=#fe1eff guibg=NONE hi SpecialKey cterm=NONE ctermfg=66 ctermbg=NONE gui=NONE guifg=#668b8b guibg=NONE hi NonText cterm=NONE ctermfg=66 ctermbg=NONE gui=NONE guifg=#668b8b guibg=NONE hi Search cterm=NONE ctermfg=16 ctermbg=66 gui=NONE guifg=#000000 guibg=#668b8b hi Visual cterm=NONE ctermfg=16 ctermbg=66 gui=NONE guifg=#000000 guibg=#668b8b endif " Set default (fallback) syntax for all files syntax region String start='"' skip='\\"' end='"' " Double quoted syntax region String start="'" skip="\\'" end="'" " Single quoted syntax region String start='`' end='`' " Backticks " Language specific settings (combined syntax and formatting) augroup programming_langs autocmd! " Clear old comments and define new ones autocmd FileType vim syntax clear Comment autocmd FileType vim syntax match MyVimLineComment '^[ \t]*".*$' contains=NONE autocmd FileType vim syntax match MyVimLineComment2 '\s"[^"]*$' contains=NONE autocmd FileType vim hi def link MyVimLineComment Comment autocmd FileType vim hi def link MyVimLineComment2 Comment " ----------------------------------------------------------------------- " C-style languages (C, C++, Java) " Clear old comments and define new ones autocmd FileType c,cpp,java syntax clear Comment autocmd FileType c,cpp,java syntax match MyCLineComment "//.*$" contains=NONE autocmd FileType c,cpp,java hi def link MyCLineComment Comment autocmd FileType c,cpp,java syntax region MyCBlockComment start="/\*" end="\*/" contains=NONE autocmd FileType c,cpp,java hi def link MyCBlockComment Comment " ----------------------------------------------------------------------- " C#/F# " Clear old comments and define new ones autocmd FileType cs,fsharp syntax clear Comment autocmd FileType cs,fsharp syntax match MyCsLineComment "//.*$" contains=NONE autocmd FileType cs,fsharp hi def link MyCsLineComment Comment autocmd FileType cs,fsharp syntax match MyCsTripleLineComment "///.*$" contains=NONE autocmd FileType cs,fsharp hi def link MyCsTripleLineComment Comment autocmd FileType cs,fsharp syntax region MyCsBlockComment start="/\*" end="\*/" contains=NONE autocmd FileType cs,fsharp hi def link MyCsBlockComment Comment " Keep string regions for C# autocmd FileType cs syntax region String start='@"' end='"' autocmd FileType cs syntax region String start='$"' end='"' autocmd FileType cs syntax region String start='$@"' end='"' autocmd FileType cs syntax region String start='"""' end='"""' autocmd FileType cs syntax region String start='$"""' end='"""' " ----------------------------------------------------------------------- " Haskell " Clear old comments and define new ones autocmd FileType haskell syntax clear Comment autocmd FileType haskell syntax match MyHsLineComment "--.*$" contains=NONE autocmd FileType haskell hi def link MyHsLineComment Comment autocmd FileType haskell syntax region MyHsBlockComment start="{-" end="-}" contains=NONE autocmd FileType haskell hi def link MyHsBlockComment Comment " ----------------------------------------------------------------------- " JavaScript/TypeScript " Clear old comments and define new ones autocmd FileType javascript,typescript,javascriptreact,typescriptreact syntax clear Comment autocmd FileType javascript,typescript,javascriptreact,typescriptreact syntax match MyJsLineComment "//.*$" contains=NONE autocmd FileType javascript,typescript,javascriptreact,typescriptreact hi def link MyJsLineComment Comment autocmd FileType javascript,typescript,javascriptreact,typescriptreact syntax region MyJsBlockComment start="/\*" end="\*/" contains=NONE autocmd FileType javascript,typescript,javascriptreact,typescriptreact hi def link MyJsBlockComment Comment " ----------------------------------------------------------------------- " Python/Perl " Clear old comments and define new ones autocmd FileType python,perl syntax clear Comment autocmd FileType python,perl syntax match MyPyLineComment "#.*$" contains=NONE autocmd FileType python,perl hi def link MyPyLineComment Comment " Keep Python multi-line strings autocmd FileType python syntax region String start='"""' end='"""' autocmd FileType python syntax region String start="'''" end="'''" autocmd FileType python syntax region String start='r"' end='"' autocmd FileType python syntax region String start="r'" end="'" " ----------------------------------------------------------------------- " Shell scripts " Clear old comments and define new ones autocmd FileType sh,bash syntax clear Comment autocmd FileType sh,bash syntax match MyShLineComment "#.*$" contains=NONE autocmd FileType sh,bash hi def link MyShLineComment Comment " ----------------------------------------------------------------------- " SQL " Clear old comments and define new ones autocmd FileType sql syntax clear Comment autocmd FileType sql syntax match MySqlLineComment "--.*$" contains=NONE autocmd FileType sql hi def link MySqlLineComment Comment " Also clear and redefine string for SQL autocmd FileType sql syntax clear String autocmd FileType sql syntax region String start="'" skip="''" end="'" autocmd FileType sql syntax region String start='"' skip='""' end='"' " ----------------------------------------------------------------------- " Lisp family " Clear old comments and define new ones autocmd FileType lisp,scheme,elisp,emacs-lisp syntax clear Comment autocmd FileType lisp,scheme,elisp,emacs-lisp syntax match MyLispLineComment ";.*$" contains=NONE autocmd FileType lisp,scheme,elisp,emacs-lisp hi def link MyLispLineComment Comment " ----------------------------------------------------------------------- " HTML/XML autocmd FileType html,xml syntax clear Comment autocmd FileType html,xml syntax region MyHtmlComment start="" contains=NONE autocmd FileType html,xml hi def link MyHtmlComment Comment " CSS/SCSS/LESS autocmd FileType css,scss,sass,less syntax clear Comment autocmd FileType css,scss,sass,less syntax match MyCssLineComment "//.*$" contains=NONE autocmd FileType css,scss,sass,less hi def link MyCssLineComment Comment autocmd FileType css,scss,sass,less syntax region MyCssBlockComment start="/\*" end="\*/" contains=NONE autocmd FileType css,scss,sass,less hi def link MyCssBlockComment Comment " ----------------------------------------------------------------------- " Go (keeps tabs) " Clear old comments and define new ones autocmd FileType go syntax clear Comment autocmd FileType go syntax match MyGoLineComment "//.*$" contains=NONE autocmd FileType go hi def link MyGoLineComment Comment autocmd FileType go syntax region MyGoBlockComment start="/\*" end="\*/" contains=NONE autocmd FileType go hi def link MyGoBlockComment Comment " ----------------------------------------------------------------------- " Markdown and Plain text autocmd FileType markdown setlocal wrap linebreak nolist autocmd FileType markdown setlocal spell spelllang=en_us autocmd FileType text,mail setlocal wrap linebreak nolist autocmd FileType mail setlocal textwidth=72 " Better Markdown syntax for multilingual content autocmd FileType markdown syntax clear autocmd FileType markdown syntax region markdownCode start=/```/ end=/```/ keepend contains=@NoSpell autocmd FileType markdown syntax region markdownCode start=/`/ end=/`/ keepend contains=@NoSpell autocmd FileType markdown syntax region \ markdownMultiLang start=/[^\x00-\x7F]/ end=/[^\x00-\x7F]\@!/ contains=@NoSpell oneline autocmd FileType markdown syntax match markdownUrl "\w\+://[^\])>]\+" contains=@NoSpell autocmd FileType markdown syntax match markdownReference "\[\d\+\]" contains=@NoSpell autocmd FileType markdown syntax match markdownCyrillic /[А-Яа-яЁё]\+/ contains=@NoSpell " ----------------------------------------------------------------------- " YAML, TOML, Puppet (#-style comments) autocmd FileType yaml,toml,puppet syntax clear Comment autocmd FileType yaml,toml,puppet syntax match MyYamlLineComment "#.*$" contains=NONE autocmd FileType yaml,toml,puppet hi def link MyYamlLineComment Comment " JSON (//-style comments) autocmd FileType json syntax clear Comment autocmd FileType json syntax match MyJsonLineComment "//.*$" contains=NONE autocmd FileType json hi def link MyJsonLineComment Comment " INI (;-style comments) autocmd FileType ini syntax clear Comment autocmd FileType ini syntax match MyIniLineComment ";.*$" contains=NONE autocmd FileType ini hi def link MyIniLineComment Comment augroup END autocmd BufNewFile,BufRead * if expand('%:e') == '' | syntax clear Comment | \ syntax match MyNoExtComment "#.*$" contains=NONE | \ hi def link MyNoExtComment Comment | endif " Custom syntax takes precedence (after languages) syntax sync fromstart " ------------------------------------------------------------------------------------------------- " Config end