"" __ _______ _____ _____ "" \ \ / / ____| ____|_ _| "" \ V /| _| | _| | | "" | | | |___| |___ | | "" |_| |_____|_____| |_| "" Yeet's vim configuration " XDG Base Directory Specification set runtimepath^=$XDG_CONFIG_HOME/vim set runtimepath+=$XDG_DATA_HOME/vim set runtimepath+=$XDG_CONFIG_HOME/vim/after set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after let g:netrw_home = $XDG_DATA_HOME."/vim" call mkdir($XDG_DATA_HOME."/vim/spell", 'p') set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p') set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p') set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p') set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p') let s:MRU_File = $XDG_CACHE_HOME."/vim/mru" if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif if has('nvim') source ~/.config/nvim/plugin/plugins.vim endif map c :w! \| !compiler "%" " Set leader let mapleader = "," " Leader Mappings map w :update map q :qall map gs :Gstatus " map Q to gq for line formatting cuz Q is useless nnoremap Q gq " Recently edited files map h :History " CtrlP use FZF (faster!) nnoremap :Files nnoremap b :Buffers noremap u :wsilent !urlview " System clipboard copy nnoremap y "+y nnoremap p "+p vnoremap y "+y vnoremap p "+p nnoremap Y "+Y nnoremap P "+P vnoremap d "+d nnoremap D "+D syntax on filetype plugin on set autoread " Auto reload changed files set wildmenu " Tab autocomplete in command mode set backspace=indent,eol,start " http://vi.stackexchange.com/a/2163 set laststatus=2 " Show status line on startup set splitright " Open new splits to the right set splitbelow " Open new splits to the bottom set lazyredraw " Reduce the redraw frequency set ttyfast " Send more characters in fast terminals set nowrap " Don't wrap long lines set listchars=extends:→ " Show arrow if line continues rightwards set listchars+=precedes:← " Show arrow if line continues leftwards set nobackup nowritebackup noswapfile " Turn off backup files set noerrorbells novisualbell " Turn off visual and audible bells set expandtab shiftwidth=2 tabstop=2 " Two spaces for tabs everywhere set history=500 set hidden " Save buffers automatically set ignorecase smartcase " Search queries intelligently set case set incsearch " Show search results as you type set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape set showcmd " Show size of visual selection set cmdheight=2 set t_Co=256 noh " set clipboard=unnamedplus set shortmess+=c set updatetime=300 if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif " Persistent undo set undodir=~/.local/share/vim/undo/ set undofile set undolevels=1000 set undoreload=10000 " Ignored files/directories from autocomplete (and CtrlP) set wildignore+=*/tmp/* set wildignore+=*.so set wildignore+=*.zip set wildignore+=*/vendor/bundle/* set wildignore+=*/node_modules/ " Enable autocompletion: set wildmode=longest,list,full " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o vnoremap . :normal . map f :Goyo \| set linebreak map o :setlocal spell! spelllang=en_us set splitbelow splitright map s :!clear && shellcheck -x % cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! "------------------------------------------------------------------------------- " Interface "------------------------------------------------------------------------------- set number " Enable line numbers set scrolloff=5 " Leave 5 lines of buffer when scrolling set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling "------------------------------------------------------------------------------- " Colors & Formatting "------------------------------------------------------------------------------- let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" if (has("termguicolors")) set termguicolors endif let g:material_theme_style='ocean-community' set background=dark try colorscheme material catch /^Vim\%((\a\+)\)\=:E185/ colorscheme default endtry " Showcase comments in italics highlight Comment cterm=italic gui=italic " Easy tab navigation nnoremap :tabprevious nnoremap :tabnext " Find/replace vnoremap "hy:%s/h//g " DON'T USE ARROWS NORMIE nnoremap :echoe "Use Esc" nnoremap :echoe "Use h" nnoremap :echoe "Use l" nnoremap :echoe "Use k" nnoremap :echoe "Use j" " Split resize nnoremap + :exe "resize " . (winheight(0) * 3/2) nnoremap - :exe "resize " . (winheight(0) * 2/3) " Make vim obey transparency hi! Normal ctermbg=NONE guibg=NONE hi! NonText ctermbg=NONE guibg=NONE "------------------------------------------------------------------------------- " Neovim-specific configurations if has('nvim') let $NVIM_TUI_ENABLE_TRUE_COLOR=1 set termguicolors " Fix vim-tmux-navigator https://git.io/viGRU nmap h " Fix vim-tmux-navigator https://git.io/vS5QH nmap :TmuxNavigateLeft " The following require plugins to be loaded so they should only be set in neovim let g:vimtex_view_general_viewer = 'zathura' " Syntastic max file size for python let g:syntastic_python_pylint_post_args="--max-line-length=120" " Widths fot several plugins let g:goyo_width = 120 " Goyo let g:Tlist_WinWidth = 40 " Tlist endif " Don't clear clipboard on exit autocmd VimLeave * call system("xsel -ib", getreg('+')) " Useful for GDB debugging packadd termdebug " File Specific Settings if has("autocmd") " Use skeleton files augroup templates autocmd BufNewFile *.* silent! execute '0r ~/.config/vim/templates/skeleton.'.expand(":e") autocmd BufNewFile * %substitute#\[:VIM_EVAL:\]\(.\{-\}\)\[:END_EVAL:\]#\=eval(submatch(1))#ge augroup END autocmd BufWinLeave *.tex !texclear %:p " Run texclear on exit autocmd BufRead calcurse-note.* :set filetype=markdown " Use markdown for calcurse notes endif