source /usr/share/vim/vim82/defaults.vim source /etc/vimrc let NERDTreeIgnore=['\.o$', '\.cmo$', '\.cmx$', '\.cmi$', '\.lib$', '\.pyc$', '^__pycache__$', '\.class$'] set encoding=utf-8 set cmdheight=2 if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif set exrc set hlsearch set number set relativenumber let mapleader="," " Tab modes. map m :set expandtab ts=2 sw=2 sts=2 map t :set noexpandtab ts=4 sw=4 sts=4 map T :set expandtab ts=4 sw=4 sts=4 set pastetoggle= " reload config map c :source ~/.vimrc " FZF bindings " " map f :FZF map ; :FZF map \ :Vista finder coc map b :Vista " Diagnostic messages map d :CocDiagnostics " map l :ALENextWrap nmap s (coc-diagnostic-prev) nmap f (coc-diagnostic-next) " map :cnext " map :cprevious " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window. nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') elseif (coc#rpc#ready()) call CocActionAsync('doHover') else execute '!' . &keywordprg . " " . expand('') endif endfunction " tab completion (coc) inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Symbol renaming. nmap rn (coc-rename) " Formatting selected code. "xmap f (coc-format-selected) "nmap f (coc-format-selected) " Append modeline after last line in buffer. " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX " files. function! AppendModeline() let l:modeline = printf(" vim: set sts=%d ts=%d sw=%d tw=%d %set :", \ &softtabstop, &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') let l:modeline = substitute(&commentstring, "%s", l:modeline, "") call append(line("$"), l:modeline) endfunction nnoremap ml :call AppendModeline() filetype plugin indent on set autoindent set smartindent set ts=4 sw=4 " indentation for long line wraps set wrap set linebreak set breakindent let &showbreak = '> ' set bg=dark au FileType make setl noexpandtab au FileType python setl sw=4 sts=4 et au FileType html setl sw=2 sts=2 et au FileType htmldjango setl sw=2 sts=2 et au FileType json setl sw=2 sts=2 et au FileType javascript setl sw=2 sts=2 et au FileType yaml setl sw=2 sts=2 et au FileType css setl sw=4 sts=4 et au FileType lua setl ts=4 sw=4 noet au FileType trema setl ts=2 sts=2 et au FileType trema setl ts=2 sts=2 et au FileType typescript.tsx setl ts=2 sts=2 et au FileType rust setl ts=4 sw=4 noet let g:ale_linters = {'rust': ['analyzer']} highlight Pmenu ctermbg=gray guibg=gray