" options {{{ set shiftwidth=4 set expandtab set termguicolors let &t_8f="\e[38;2;%lu;%lu;%lum" let &t_8b="\e[48;2;%lu;%lu;%lum" colorscheme local " }}} " hooks {{{ augroup vimrc autocmd! augroup END " }}} " bindings {{{ " general {{{ let g:mapleader = ';' let g:maplocalleader = ';' " }}} " M to :make {{{ noremap M :makek " }}} " S for spell checking {{{ noremap S &spell ? ":\setlocal nospell\" : ":\setlocal spell\" " }}} " easier tag traversal {{{ nnoremap nnoremap autocmd vimrc CmdWinEnter * nnoremap " }}} " buffer switching {{{ nnoremap H :bp nnoremap L :bn " }}} " use tab for completion {{{ inoremap \ strpart(getline('.'), 0, col('.') - 1) =~ '\(^\\|\s\+\)$' \ ? "\" \ : "\" inoremap " }}} " fixups for my keyboard remappings {{{ nmap ) 0 nmap g) g0 nmap \ " }}} " miscellaneous {{{ nnoremap e c nnoremap E C nnoremap r nnoremap , : xnoremap , : nnoremap ! :! xnoremap ! :! autocmd vimrc BufEnter * exe "nnoremap T :e " . expand('%') nnoremap / :nohl nnoremap :w nnoremap \ :q nnoremap :bd " }}} " }}} " plugin configuration {{{ " ale " airline " autobrace " commentary {{{ map x :Commentary " }}} " diff-changes {{{ nnoremap ds :DiffAgainstFilesystem nnoremap dc :DiffAgainstVCS nnoremap de :DiffStop " }}} " fzf {{{ let g:fzf_layout = { 'up': '~40%' } if &columns >= 160 let s:horiz_preview_layout = 'right:50%' else let s:horiz_preview_layout = 'right:50%:hidden' endif let s:ag_opts = {"options": ["-d:", "-n4.."]} function! s:fzf_files() silent let out = system("git rev-parse --show-toplevel 2>/dev/null") if strlen(out) exe "GFiles -co --exclude-standard" else exe "Files" endif endfunction command! -bang -nargs=* Rg \ call fzf#vim#grep('rg --column --line-number --no-heading --color=always --smart-case --no-ignore-messages '.shellescape(), \ 1, \ 0 ? fzf#vim#with_preview(s:ag_opts, 'up:60%') \ : fzf#vim#with_preview(s:ag_opts, s:horiz_preview_layout, '?'), \ 0) nnoremap t :call fzf_files() nnoremap ff :Rg nnoremap fh :Helptags nnoremap ft :Filetypes " }}} " gundo {{{ if has("python") nnoremap U :silent GundoToggle let g:gundo_help = 0 let g:gundo_preview_bottom = 1 else let g:gundo_disable = 1 endif " }}} " history-sync " matchit {{{ packadd! matchit " }}} " netrw {{{ let g:netrw_home = $HOME . '/.cache/vim/netrw' if !isdirectory(g:netrw_home) call mkdir(g:netrw_home, 'p') endif " }}} " polyglot {{{ " this is for things that can't be set in ftplugin files for whatever reason let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_types = 1 let g:polyglot_disabled = ['csv', 'sensible', 'autoindent', 'pascal'] " }}} " rainbow {{{ let g:rainbow = 1 let g:rainbow_paren = 1 let g:rainbow_bracket = 1 let g:rainbow_brace = 1 " }}} " startify {{{ let g:startify_list_order = ['dir', 'bookmarks', 'commands'] let g:startify_files_number = 7 let g:startify_commands = [ \ {'t': ['Open file', 'Files']}, \ {'ff': ['Grep', 'Rg']}, \ {'fh': ['Help', 'Helptags']}, \ ] let g:startify_change_to_vcs_root = 1 let g:startify_custom_indices = [ \'!', '@', '#', '$', '%', '^', '&', '*', '(', ')' \] let g:startify_custom_header = [] let s:fortune = system('fortune -n200 -s ~/.local/share/fortune | grep -v -E "^$"') let g:startify_custom_footer = [''] + map(split(s:fortune, '\n'), '" ".v:val') " }}} " textobj {{{ let g:textobj_defs = { \ '/': ['paired'], \ '\|': ['paired'], \} " }}} " }}} " vim: fdm=marker