" Bootstrap Plug let autoload_plug_path = stdpath('config') . '/autoload/plug.vim' if !filereadable(autoload_plug_path) silent execute '!curl -fLo ' . autoload_plug_path . ' --create-dirs \ "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"' autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif unlet autoload_plug_path let g:plugged_home = stdpath('config') . '/plugged' " Plugins List call plug#begin(g:plugged_home) " UI related " Plug 'junegunn/fzf.vim' Plug 'base16-project/base16-vim' Plug 'itchyny/lightline.vim' " Better Visual Guide Plug 'Yggdroot/indentLine' " syntax check Plug 'w0rp/ale' " Autocomplete Plug 'ncm2/ncm2' Plug 'roxma/nvim-yarp' Plug 'ncm2/ncm2-bufword' Plug 'ncm2/ncm2-path' Plug 'ncm2/ncm2-jedi' " Formater Plug 'stsewd/isort.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Chiel92/vim-autoformat' Plug 'tpope/vim-surround' Plug 'tpope/vim-commentary' Plug 'mrk21/yaml-vim' Plug 'lepture/vim-jinja' " Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } Plug 'hashivim/vim-terraform' call plug#end() filetype plugin indent on " Configurations Part " UI configuration syntax on syntax enable " colorscheme let base16colorspace=256 colorscheme base16-gruvbox-dark-hard set background=dark " True Color Support if it's avaiable in terminal if has("termguicolors") set termguicolors endif if has("gui_running") set guicursor=n-v-c-sm:block,i-ci-ve:block,r-cr-o:blocks endif set clipboard+=unnamedplus set number set relativenumber set hidden set mouse=a set noshowmode set noshowmatch set nolazyredraw " Turn off backup set nobackup set noswapfile set nowritebackup " Search configuration set ignorecase " ignore case when searching set smartcase " turn on smartcase " Tab and Indent configuration set expandtab set tabstop=4 set shiftwidth=4 set colorcolumn=+1 set backspace=indent,eol,start set cursorline set textwidth=100 set list listchars=tab:\|\ ,extends:›,precedes:‹,nbsp:·,trail:· " Folding " set foldmethod=syntax set foldnestmax=10 set nofoldenable set foldlevel=1 set fillchars=fold:\ " Python let g:python3_host_prog = '~/src/python/.nvim/bin/python' let g:loaded_python_provider = 0 " Ruby let g:loaded_ruby_provider = 0 " Perl let g:loaded_perl_provider = 0 " Node.Js let g:loaded_node_provider = 0 function! MyFoldText() let indent_level = indent(v:foldstart) let indent = repeat(' ',indent_level) " setting fold text let nl = v:foldend - v:foldstart + 1 let comment = substitute(getline(v:foldstart),"^ *","",1) let linetext = substitute(getline(v:foldstart+1),"^ *","",1) let txt = indent . '+ Скрыто: ' . nl . ' строк' return txt endfunction set foldtext=MyFoldText() let g:indentLine_char_list = ['|', '¦', '┆', '┊'] " Hightlighting extra chars and spaces highlight ExtraWhitespace ctermfg=124 guifg=#cc241d match ExtraWhitespace /\s\+$/ autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@i :Isort noremap ' :Lex let g:go_fmt_command = "goimports" let g:go_auto_type_info = 1 map :cnext map :cprevious nnoremap a :cclose autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) " Ale let g:ale_lint_on_enter = 0 let g:ale_lint_on_text_changed = 'never' let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_warning_str = 'W' let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' let g:ale_linters = {'python': ['flake8']} let g:ale_sign_warning = '▲' let g:ale_sign_error = '✗' highlight link ALEWarningSign String highlight link ALEErrorSign Title nmap (ale_previous_wrap) nmap (ale_next_wrap) " Lightline let g:lightline = { \ 'colorscheme': 'seoul256', \ 'active': { \ 'left': [['mode', 'paste'], ['filename', 'modified']], \ 'right': [['lineinfo'], ['percent'], ['readonly', 'linter_warnings', 'linter_errors', 'linter_ok']] \ }, \ 'component_expand': { \ 'linter_warnings': 'LightlineLinterWarnings', \ 'linter_errors': 'LightlineLinterErrors', \ 'linter_ok': 'LightlineLinterOK' \ }, \ 'component_type': { \ 'readonly': 'error', \ 'linter_warnings': 'warning', \ 'linter_errors': 'error' \ }, \ } function! LightlineLinterWarnings() abort let l:counts = ale#statusline#Count(bufnr('')) let l:all_errors = l:counts.error + l:counts.style_error let l:all_non_errors = l:counts.total - l:all_errors return l:counts.total == 0 ? '' : printf('%d ◆', all_non_errors) endfunction function! LightlineLinterErrors() abort let l:counts = ale#statusline#Count(bufnr('')) let l:all_errors = l:counts.error + l:counts.style_error let l:all_non_errors = l:counts.total - l:all_errors return l:counts.total == 0 ? '' : printf('%d ✗', all_errors) endfunction function! LightlineLinterOK() abort let l:counts = ale#statusline#Count(bufnr('')) let l:all_errors = l:counts.error + l:counts.style_error let l:all_non_errors = l:counts.total - l:all_errors return l:counts.total == 0 ? '✓ ' : '' endfunction " Update and show lightline but only if it's visible (e.g., not in Goyo) autocmd User ALELint call s:MaybeUpdateLightline() function! s:MaybeUpdateLightline() if exists('#lightline') call lightline#update() end endfunction " vim-autoformat noremap :Autoformat " NCM2 augroup NCM2 autocmd! autocmd BufEnter * call ncm2#enable_for_buffer() set completeopt=noinsert,menuone,noselect inoremap (pumvisible() ? "\\" : "\") augroup END au BufEnter,BufNewFile,BufRead *.py set ts=4 sw=4 tw=79 sta et fo=croql ai ff=unix foldmethod=indent " add yaml stuffs au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab au BufNewFile,BufRead *.j2 set ft=jinja autocmd FileType jinja setlocal ts=2 sts=2 sw=2 expandtab