" set x=y {{{ " au BufWinEnter * set relativenumber " set background=dark set encoding=utf-8 set background=light " set t_Co=256 filetype plugin on syntax on set tabstop=4 set tw=80 set linebreak " set colorcolumn=80 set shiftwidth=4 set autoindent " set mouse=c set mouse=a set clipboard+=unnamedplus set foldmethod=marker set linespace=5 " cursor indicator {{{ " " set listchars=tab:\|\ " set list " set cursorcolumn " set cursorline " }}} cursor indicator " " set timeoutlen=500 set timeoutlen=350 set hlsearch " set noswapfile " let maplocalleader="-" let maplocalleader="\\" " }}} set x=y " " commands for file types {{{ " autocmd VimResized * wincmd = autocmd BufNewFile,BufRead .* set syntax=sh filetype plugin on filetype indent on autocmd FileType *css,htmldjango,html,javascript,markdown,tex,yaml set tabstop=2 shiftwidth=2 expandtab autocmd BufNewFile,BufRead *.txt set tabstop=2 shiftwidth=2 expandtab autocmd BufNewFile,BufRead *.md set filetype=markdown autocmd Filetype markdown set textwidth=0 " autocmd Filetype html set foldmarker=0 autocmd VimLeave *.tex !tex-clean % " " auto-reload vimrc {{{ " " augroup myvimrc " au! " au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif " augroup END " " }}} auto-reload vimrc " " }}} commands for file types " " commands for specific files {{{ " autocmd BufNewFile,BufRead watson*.fish set tabstop=2 shiftwidth=2 expandtab autocmd BufRead commit-msg.txt set filetype=gitcommit tw=72 autocmd BufWritePost key_* !sync-shortcuts autocmd BufNewFile,BufRead main.scss map :silent !sass main.scss main.css " map :autocmd BufWritePost main.scss silent !sass main.scss main.css autocmd BufNewFile,BufRead main.scss map :autocmd BufWritePost main.scss silent !sass main.scss main.css autocmd BufNewFile,BufRead main.scss map :autocmd! BufWritePost main.scss " }}} commands for specific files " " vim-plug {{{ " " plug auto-install if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/plugged') " prequisite for other plugins Plug 'vim-scripts/L9' " find files from within Vim " Plug 'vim-scripts/FuzzyFinder' " Gotham color scheme " Plug 'whatyouhide/vim-gotham' " " collection of Vim color schemes " Plug 'flazz/vim-colorschemes' " " preview Vim color scheme easily within Vim " Plug 'xolox/vim-colorscheme-switcher' " " prerequisite for above plugin " Plug 'xolox/vim-misc' " automatically save buffers upon returning to normal mode Plug '907th/vim-auto-save' let g:auto_save = 1 " provides various functionality for writing LaTeX in Vim Plug 'lervag/vimtex' au BufWritePost *.tex silent call Tex_RunLaTeX() au BufWritePost *.tex silent !pkill -USR1 xdvi.bin let g:vimtex_view_general_viewer = 'zathura' let g:vimtex_quickfix_latexlog = { \ 'overfull' : 0, \ 'underfull' : 0, \ 'global' : 0, \ 'unused' : 0, \} " auto-completion for various languages Plug 'Valloric/YouCompleteMe' let g:ycm_filetype_blacklist = { \ 'tagbar': 1, \ 'qf': 1, \ 'notes': 1, \ 'unite': 1, \ 'vimwiki': 1, \ 'pandoc': 1, \ 'infolog': 1, \ 'mail': 1 \} " wrote short bits of text that expand into whatever you want " demo: https://www.youtube.com/watch?v=Zik6u0klD40 Plug 'SirVer/ultisnips' " better key bindings for UltiSnipsExpandTrigger let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" let g:ultisnips_javascript = { \ 'keyword-spacing': 'always', \ 'semi': 'never', \ 'space-before-function-paren': 'never', \ } " custom snippets Plug 'Kevin-Mok/vim-snippets' " to make YouCompleteMe work with UltiSnips (both use Tab) Plug 'ervandew/supertab' " make YCM compatible with UltiSnips (using supertab) let g:ycm_key_list_select_completion = ['', ''] let g:ycm_key_list_previous_completion = ['', ''] let g:SuperTabDefaultCompletionType = '' " easily comment/uncomment lines Plug 'scrooloose/nerdcommenter' let g:NERDTrimTrailingWhitespace = 1 let g:NERDSpaceDelims = 1 " add quotes/brackets around chunks of text easily Plug 'tpope/vim-surround' " navigate around file easily and precisely Plug 'easymotion/vim-easymotion' map (easymotion-prefix) " status bar displaying various info about the current buffer Plug 'vim-airline/vim-airline' let g:airline_section_c = '%F' Plug 'vim-airline/vim-airline-themes' let g:airline_powerline_fonts = 1 " continue Markdown lists when started Plug 'dkarter/bullets.vim' " coordinate Vim color scheme with terminal color scheme Plug 'dylanaraps/wal.vim' " repeat plugin commands Plug 'tpope/vim-repeat' " better Django support Plug 'tweekmonster/django-plus.vim' " auto-close brackets Plug 'jiangmiao/auto-pairs' let g:AutoPairsMapSpace = 0 Plug 'henrik/vim-indexed-search' Plug 'PotatoesMaster/i3-vim-syntax' " vim file explorer Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'terryma/vim-multiple-cursors' " let g:multi_cursor_select_all_word_key='' Plug 'dag/vim-fish' Plug 'shime/vim-livedown' call plug#end() " }}} vim-plug " " colorscheme gotham256 colorscheme wal " Mappings {{{ " " function keys {{{ " " map silent !sass main.scss main.css " " map :autocmd BufWritePost main.scss silent !sass main.scss main.css " map :autocmd BufWritePost main.scss silent !sass main.scss main.css " map :autocmd! BufWritePost main.scss " map :silent !scp %:p k@192.168.0.17:/home/k/a1 " map :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1 map :xa map :q! " map :make -C ~/Documents/resume cv " map :AutoSaveToggle map :!clear && shellcheck % map :VimtexCompile:VimtexView " map :VimtexCompile nnoremap :set paste"+p:set nopaste map :LivedownPreview " }}} function keys " map O " swap text visually vnoremap `.``gvP``P " splits {{{ " nnoremap nnoremap nnoremap nnoremap " Maximize height/width. nnoremap _ nnoremap | " }}} splits " " leader mappings {{{ " let mapleader="\" " replace until end of line nnoremap c c$ " delete entire buffer nnoremap d d$ " delete entire buffer nnoremap dg ggdG " delete line into system clipboard nnoremap D "+dd " delete entire buffer into system clipboard nnoremap DA "+ggdG " find copied text nnoremap f q/p " find alias nnoremap fa /^ " find merge conflicts nnoremap fc /[<>=\|]\{7\} " reload folds nnoremap ff :set foldmethod=marker zM " find copied text nnoremap ft /TODO nnoremap g :YcmCompleter GoTo " toggle search highlighting nnoremap h :set hlsearch! hlsearch? " help nnoremap he :help nnoremap ht :set tabstop=2 shiftwidth=2 expandtab nnoremap vhe :vert help " move cursor to middle of line nnoremap m :call cursor(0, len(getline('.'))/2) " apply normal command to selection vnoremap n q:anorm " don't wrap lines nnoremap nw :set nowrap " check if in neovim nnoremap nv :echo has('nvim') " Plug commands nnoremap p "*p nnoremap pli :PlugInstall nnoremap plc :PlugClean nnoremap plu :PlugUpdate " don't break lines nnoremap py :set tw=0 " reload file nnoremap r :e " replace in next x lines nnoremap re q:i.,.+s///gFsi " replace in line nnoremap rl q:i.s///g " replace in visual selection vnoremap r q:is///g3ha " reload vim config nnoremap rv :source $MYVIMRC " replace in entire file nnoremap R q:i%s///g2F/i " sort lines until end of file vnoremap s :sort nnoremap sc :set spell spelllang=en_us " run current file in shell nnoremap sh :!%:p " sort lines until end of file nnoremap so q:i.,$sort " sort lines nnoremap sol q:i.,.+sortFsi " set syntax to shell (for dotfiles) nnoremap sys :set syn=sh " open vimrc in vertical split nnoremap vv :vsp ~/.vimrc " format current line nnoremap ww Vgq " format this and next line nnoremap www Vjgq " copy next thing to system clipboard " nnoremap y "+ " nnoremap Y "+Y nnoremap y y$ " yank entire buffer nnoremap yg ggyG " toggle fold nnoremap z za " }}} leader mappings " " }}} Mappings " " Local Mappings {{{ " " tex {{{ " autocmd Filetype tex inoremap bt \bowtie autocmd Filetype tex inoremap c \checkmark autocmd Filetype tex inoremap d \delta autocmd Filetype tex inoremap D \Delta autocmd Filetype tex inoremap e \exists autocmd Filetype tex inoremap ep \epsilon autocmd Filetype tex inoremap fa \forall autocmd Filetype tex inoremap g \geq autocmd Filetype tex inoremap i \in autocmd Filetype tex inoremap l \leq autocmd Filetype tex inoremap lr \Leftrightarrow " autocmd Filetype tex inoremap n \neg autocmd Filetype tex inoremap n \neq autocmd Filetype tex inoremap N \mathbb{N} autocmd Filetype tex inoremap q \qquad autocmd Filetype tex inoremap r \rightarrow autocmd Filetype tex inoremap R \Rightarrow autocmd Filetype tex inoremap s \subset autocmd Filetype tex inoremap st such that autocmd Filetype tex inoremap S \Sigma autocmd Filetype tex inoremap t \times " autocmd Filetype tex inoremap T $T$ autocmd Filetype tex inoremap T \Theta " replace bars/underscores in URL autocmd Filetype tex inoremap url :.s/\([-_]\)/\\\1/g autocmd Filetype tex inoremap v \vee autocmd Filetype tex inoremap w \wedge autocmd Filetype tex inoremap x $x$-axis autocmd Filetype tex inoremap y $y$-axis autocmd Filetype tex inoremap Z \mathbb{Z} " par3 autocmd Filetype tex inoremap wx $w(x)$ autocmd Filetype tex inoremap tx $t(x)$ " }}} tex " autocmd Filetype fish inoremap 1 $argv[1] autocmd Filetype fish inoremap 2 $argv[2] autocmd Filetype markdown nnoremap x 0f[lrx " nnoremap x 0f[lrx " }}} Local Mappings "