" vim:foldmethod=marker:foldlevel=0 let mapleader="=" " remap leader to =, must be at start of file " Vim-Plug {{{ 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() Plug 'ycm-core/YouCompleteMe', { 'do': 'python3 ./install.py --clang-completer' } Plug 'scrooloose/nerdtree' Plug 'sjl/gundo.vim' Plug 'tmhedberg/SimpylFold' Plug 'vim-airline/vim-airline' Plug 'sheerun/vim-polyglot' Plug 'joshdick/onedark.vim' Plug 'tpope/vim-fugitive' Plug 'jmcantrell/vim-virtualenv' call plug#end() " }}} " NERDTRee {{{ " Open NERDTree if vim launched with dir autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif " Open NERDTree if vim launched with no files and no dir autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " }}} " Gundo {{{ let g:gundo_prefer_python3 = 1 " required for gundo to use python 3 " }}} " YouCompleteMe {{{ let g:ycm_confirm_extra_conf = 1 " Don't ask about confirming conf file let g:ycm_key_list_select_completion = ['', ''] " previous completion with nothing let g:ycm_autoclose_preview_window_after_completion = 1 " autoclose preview after inserting completion let g:ycm_error_symbol = 'E' " change error symbol let g:ycm_warning_symbol = 'W' " change warning symbol highlight YcmErrorLine guibg=#3f0000 " error is dark read highlight YcmWarningLine guibg=#ff7700 " warning is dark orange " }}} " SimplyIFold {{{ let g:SimplyIFold_docstring_preview = 1 " preview docstring in fold test " }}} " Airline {{{ let g:airline_theme='onedark' " set the theme let g:airline#extensions#tabline#enabled = 1 " enable tabs " }}} " OneDark Theme {{{ let g:onedark_hide_endofbuffer = 1 " hide end of buffer let g:onedark_terminal_italics = 1 "italics support " }}} " Appearance {{{ syntax on " Turn syntax highlighting on colorscheme onedark " badass color scheme set number " show line numbers set cursorline " highlight current line set wildmenu " visual autocomplete for command menu set showmatch " highlight matching [{()}] set incsearch " search as characters are entered set hlsearch " higlight matches " mac italics support let &t_ZH="\e[3m" let &t_ZR="\e[23m" " }}} " Shortcuts {{{ " Less delay set timeout set timeoutlen=200 " turn off search highlight nnoremap :nohlsearch " save session (super save) nnoremap s :mksession! " + w/q/a to execute that command nnoremap w :w nnoremap wq :wq nnoremap wqa :wqa nnoremap q :q nnoremap qa :qa nnoremap qq :q! nnoremap qqa :qa! " WARNING: Any shortcuts that append to z will cause folding to be slow " -z closes all folds " =z opens all folds " z opens/closses current fold " [z open and started at beginning of fold " ]z open and start at end of fold nnoremap -z zM nnoremap =z zR nnoremap z za nnoremap ]z za]z nnoremap [z za[z " auto indent whole file and keep cursor at position nnoremap i mzgg=G`z " Open NERDTree with leader-d nnoremap d :NERDTreeToggle " toggle gundo nnoremap u :GundoToggle " toggle spelling with tc key noremap tc :set spell!:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3) " c gives spell suggestions noremap c z= " f will now call YCM FixIt noremap f :YcmCompleter FixIt " resize splits from 5 to 8 nnoremap 5 :res +2 nnoremap 6 :res -2 nnoremap 8 :vertical res +2 nnoremap 7 :vertical res -2 " YouCompleteMe let down arrow escape inoremap pumvisible() ? "\" : "\" "}}} " Editing {{{ filetype plugin indent on " use indent scripts in the indent folder of vim set tabstop=4 " number of visual spaces per TAB set softtabstop=4 " number of spaces in tab when editing set expandtab " tabs are spaces set shiftwidth=4 " set siftwidth to one tab set mouse=a " enable mouse set backspace=indent,eol,start set splitbelow set splitright " }}} " Spelling {{{ if has("spell") " spelling off by default " they were using white on white highlight PmenuSel ctermfg=black ctermbg=lightgray " limit it to just the top 10 items set sps=best,10 endif " }}} " Folding {{{ " Note: See Shortcuts for fold modifications set foldenable "enable folding set foldlevelstart=10 " open most folds by default set foldnestmax=10 " 10 nested fold max set foldmethod=indent " fold based on indent level " }}} " Modelines {{{ set modeline set modelines=1 " }}} " Backups {{{ " Move backups to /tmp set backup set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set backupskip=/tmp/*,/private/tmp/* set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set writebackup " }}}