" vi: foldmethod=marker scriptencoding utf-8 " Plugins {{{ " Unload unneeded plugins {{{ let g:loaded_netrwPlugin = 1 "$VIMRUNTIME/plugin/netrwPlugin.vim let g:loaded_2html_plugin = 1 "$VIMRUNTIME/plugin/tohtml.vim " }}} command! -bar PackUpdate call plugins#reload() | call minpac#update() command! -bar PackClean call plugins#reload() | call minpac#clean() set rtp+=/usr/local/opt/fzf set packpath^=~/.local/share/nvim " }}} " Identation {{{ set tabstop=4 shiftwidth=0 expandtab set textwidth=80 set nowrap linebreak formatoptions+=l " }}} " User interface {{{ " set lazyredraw " Ignore case. If your code uses different casing to differentiate files, then " you need mental help set wildignorecase fileignorecase " Colors {{{ syntax sync minlines=256 set termguicolors colorscheme blame " }}} " Ignore all automatic files and folders {{{ set wildignore+=*.o,*~,*/.git,*/tmp,*/node_modules,*/_build,*/deps,*/target " }}} " Display tabs and trailing spaces visually {{{ set fillchars=vert:┃,fold:· set list listchars=tab:→\ ,trail:·,nbsp:␣,extends:↦,precedes:↤ set conceallevel=2 " }}} " Do not show current mode down the bottom {{{ set noshowmode " }}} " Autowrite files when possible {{{ set nohidden autowriteall " }}} " Keep cursor in the middle {{{ set scrolloff=9999 " }}} " Enable mouse suport {{{ set mouse=a " }}} " Hypen is part of the keyword, if you want to substract then add spaces {{{ set iskeyword+=- " }}} " Show 80 column {{{ set colorcolumn=+1 " }}} " Split in CORRECT places {{{ set splitright splitbelow " }}} " Statusline {{{ let &statusline = '' let &statusline .= ' ' let &statusline .= '» %f%{statusline#modified()} «%<' let &statusline .= '%=' let &statusline .= '%{statusline#quickfix()} %4c:%l' let &statusline .= ' ' " }}} " }}} " Search {{{ " Smart case searches set ignorecase smartcase inccommand=nosplit " }}} " Permanent undo {{{ set undofile " }}} " Custom configurations {{{ " Fuzzy file search {{{ nnoremap :FZF " }}} " Git shortcuts {{{ nnoremap U nnoremap Up :Gina push nnoremap Us :Gina status -s nnoremap Ud :Gina diff nnoremap Ub :Gina branch nnoremap UB :Gina blame nnoremap Uc :Gina commit nnoremap Uu :Gina pull nnoremap Ug :Gina log --graph nmap UU Uu cabbrev G Gina cabbrev G! Gina! " }}} " Asynchronous commands {{{ command! -bang -nargs=* Make call asyncdo#run(0, &makeprg, ) command! -bang -nargs=* Grep call asyncdo#run(0, &grepprg, ) command! -bang -nargs=* LMake call asyncdo#lrun(0, &makeprg, ) command! -bang -nargs=* LGrep call asyncdo#lrun(0, &grepprg, ) " }}} " Expand abbreviations on enter {{{ inoremap " }}} " Smart `0` {{{ " `0` goes to the beginning of the text on first press and to the beginning " of the line on second press. It alternates afterwards. nnoremap 0 virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_' " }}} " File closing {{{ nnoremap ZS :wa nnoremap ZA :qa nnoremap ZX :cq " }}} " Simplify switching to Command mode {{{ nnoremap ; : vnoremap ; : nnoremap : ; vnoremap : ; nnoremap q; q: " }}} " Fix idiotic vim defaults {{{ nnoremap Y y$ " }}} " Folding {{{ nnoremap foldlevel('.') ? 'za' : "\" " }}} " Scratchpad {{{ command! Scratchify setlocal nobuflisted buftype=nofile bufhidden=delete command! Scratch enew | Scratchify command! SScratch new | Scratchify command! VScratch vnew | Scratchify command! TScratch tabnew | Scratchify " }}} " Format {{{ nnoremap g= gg=Gg`` noremap Q gq nnoremap gQ gggqG`` command! Clean let _s = @/ | %s/\s\+$//e | let @/ = _s | set nohlsearch " }}} " Search {{{ if executable('rg') set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case set grepformat=%f:%l:%c:%m,%f:%l%m,%f\ \ %l%m elseif executable('ag') set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep set grepformat^=%f:%l:%c:%m endif " Quickly disable highligh nnoremap , :nohlsearch " }}} " Tabs {{{ nnoremap ]w gt nnoremap [w gT " }}} " Terminal {{{ nmap nnoremap c :term nnoremap s :split +term nnoremap v :vsplit +term nnoremap t :tabnew +term tnoremap if executable('nvr') let $EDITOR = 'nvr -cc split -c "set bufhidden=delete" --remote-wait' endif " }}} " Split management {{{ augroup align_windows au! au VimResized * wincmd = augroup END nmap q (choosewin) nmap (choosewin) " }}} " Startify {{{ let g:startify_list_order = ['sessions', 'dir'] let g:startify_session_dir = '~/.local/share/nvim/sessions/' let g:startify_session_autoload = 1 let g:startify_session_persistence = 1 let g:startify_change_to_dir = 0 let g:startify_change_to_vcs_root = 1 " }}} " Match up {{{ let g:matchup_matchparen_status_offscreen = 0 " }}} " HighlihtedYank {{{ let g:highlightedyank_highlight_duration = 200 " }}} " Snipe f/F/t/T {{{ " let g:snipe_jump_tokens = 'asdfghklqwertyuiopzxcvbnm' let g:snipe_jump_tokens = 'fhghdjskal' nmap F (snipe-F) nmap f (snipe-f) nmap T (snipe-T) nmap t (snipe-t) " }}} " }}} " Completions {{{ set complete=.,w,b,t,u set completeopt=menu,longest,noselect let g:echodoc_enable_at_startup = 1 let g:cpty_awk_cmd = 'mawk -f' let g:lsp_servers = [ \ { \ 'name': 'elixir-ls', \ 'cmd': {server_info->[&shell, &shellcmdflag, 'env ERL_LIBS=/Users/hauleth/Workspace/JakeBecker/elixir-ls/lsp mix elixir_ls.language_server']}, \ 'whitelist': ['elixir'], \ }, \ { \ 'name': 'rls', \ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']}, \ 'whitelist': ['rust'], \ }, \ { \ 'name': 'vue-language-server', \ 'cmd': {server_info->['vls']}, \ 'whitelist': ['vue'], \ } \ ] augroup lsp_servers au! au User lsp_setup call completion#lsp() augroup END " }}} nnoremap zS :echo 'hi<' . synIDattr(synID(line('.'),col('.'),1),'name') . '> trans<' \ . synIDattr(synID(line('.'),col('.'),0),'name') . '> lo<' \ . synIDattr(synIDtrans(synID(line('.'),col('.'),1)),'name') . '>'