" ---------------------------------------------------------------------------- " GENERAL SETTINGS " ---------------------------------------------------------------------------- scriptencoding utf-16 " allow emojis in vimrc set encoding=utf-8 " necessery encoding for powerline set nocompatible " vim, not vi syntax on " syntax highlighting filetype plugin indent on " try to recognize filetypes and load rel' plugins let mapleader = ',' " set the mapleaders before mappings! " ---------------------------------------------------------------------------- " PLUGINS " ---------------------------------------------------------------------------- call plug#begin() if has('nvim') Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } endif Plug 'airblade/vim-gitgutter' Plug 'w0rp/ale' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'vim-airline/vim-airline' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-commentary' Plug 'tpope/vim-surround' Plug 'mbbill/undotree', {'on': 'UndotreeToggle'} Plug 'easymotion/vim-easymotion' Plug 'townk/vim-autoclose' Plug 'sheerun/vim-polyglot' Plug 'tpope/vim-repeat' Plug 'mileszs/ack.vim' "Plug 'lifepillar/vim-solarized8' "Plug 'phanviet/vim-monokai-pro' "Plug 'rakr/vim-one' Plug 'morhetz/gruvbox' Plug 'tpope/vim-unimpaired' Plug 'qpkorr/vim-bufkill' Plug 'luochen1990/rainbow' Plug 'tiagofumo/vim-nerdtree-syntax-highlight' Plug 'ryanoasis/vim-devicons' Plug 'machakann/vim-highlightedyank' call plug#end() " ---------------------------------------------------------------------------- " PLUGIN SETTINGS " ---------------------------------------------------------------------------- " Colorschemed set termguicolors set background=dark colorscheme gruvbox let g:gruvbox_contrast_dark = 'hard' let g:gruvbox_improved_warnings = '1' " Undotree let g:undotree_SetFocusWhenToggle = '1' nmap u :UndotreeToggle " ALE " Error and warning signs. let g:ale_sign_error = '⤫' let g:ale_sign_warning = '⚠' " Enable integration with airline. let g:airline#extensions#ale#enabled = 1 " Ack.vim " Tell ack.vim to use ag (the Silver Searcher) instead let g:ackprg = 'ag --vimgrep' " FZF nmap ; :Buffers nmap f :Files nmap t :Tags " Deoplete "let g:deoplete#enable_at_startup = 1 " Airline let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 " NERDTree " Close vim if nerdtree is the only window open autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " Ignore .git directories let NERDTreeIgnore=['^\.git','^__'] " Toggle NerdTree nmap b :NERDTreeToggle " Rainbow Parenthesis let g:rainbow_conf = { \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], \ 'operators': '_,_', \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], \ 'separately': { \ '*': {}, \ 'tex': { \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'], \ }, \ 'lisp': { \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], \ }, \ 'vim': { \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'], \ }, \ 'html': { \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], \ }, \ 'css': 0, \ } \} " ---------------------------------------------------------------------------- " KEY MAPS " ---------------------------------------------------------------------------- " Move *visually* up and down nmap j gj nmap k gk " Make movement down(j)-up(k)-left(l)-right(;) "noremap l h "noremap ; l "noremap h ; " Marks should go to the column, not just the line. Why isn't this the default? See :h mark-motions nnoremap ' ` " You don't know what you're missing if you don't use this. nmap :e# " Move between open buffers. nmap :bnext nmap :bprev " Use the space key to toggle folds nnoremap za vnoremap zf " Super fast window movement shortcuts nmap j nmap k nmap h nmap l " Searches always operate in "Very Magic" mode nnoremap / /\v vnoremap / /\v " In normal and visua mode use tab to jump to matching braces nnoremap % vnoremap % " Use ESC to exit terminal mode tnoremap " Clear out search highlighting nnoremap :noh " Strip trailing whitespace - e prevents an error if none are found " note this moves the cursor to the last match and resets the last search term. " nnoremap w :%s/\s\+$//e " a better way is to save the window view to a variable, run it, and restore it. fun! TrimWhitespace() let l:save = winsaveview() %s/\s\+$//e call winrestview(l:save) endfun command! TrimWhitespace call TrimWhitespace() nnoremap w :call TrimWhitespace() " easier quitting/closing nmap q :q " focusing/closing all splits nmap o :only " ---------------------------------------------------------------------------- " OPTIONS " ---------------------------------------------------------------------------- set autoindent " Carry over indenting from previous line set autoread " Don't bother me hen a file changes set autowrite " Write on :next/:prev/^Z set backspace=indent,eol,start " Allow backspace beyond insertion point set cindent " Automatic program indenting set cinkeys-=0# " Comments don't fiddle with indenting set copyindent " Make autoindent use the same chars as prev line set directory-=. " Don't store temp files in cwd set expandtab " No tabs set formatoptions=tcqn1 " t - autowrap normal text " c - autowrap comments " q - gq formats comments " n - autowrap lists " 1 - break _before_ single-letter words set hidden " Don't prompt to save hidden windows until exit set history=200 " How many lines of history to save set hlsearch " Hilight searching set ignorecase " Case insensitive set inccommand=split " Live preview of substitutions set incsearch " Search as you type set infercase " Completion recognizes capitalization set laststatus=2 " Always show the status bar set matchtime=2 " Tenths of second to hilight matching paren set number " Line numbers to start set scrolloff=3 " Numbers of context lines while scrolling set showcmd " Show (partial) command in the last line of the screen (turn off if terminal is slow) set showmatch " Hilight matching braces/parens/etc. "set showmode " Always tell us what mode were in set noshowmode " Airline shows us the mode set smartcase " Lets you search for ALL CAPS set softtabstop=2 " Spaces 'feel' like tabs set suffixes+=.pyc " Ignore these files when tab-completing set tabstop=2 " The One True Tab set textwidth=100 " 100 is the new 80 set ttyfast " Indicates fast terminal - more drawing set undofile " We want persistent undofiles set vb t_vb= " No visual bells set wildmenu " Enable command-line completion operates in an enhanced mode "set wildmode=longest:full,full " Setup completion set mouse=a " enable mouse (selection, resizing windows) " Make vim recogize 256 colors if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal" set t_Co=256 endif " ---------------------------------------------------------------------------- " NOTES " ---------------------------------------------------------------------------- " Config Files " * https://github.com/statico/dotfiles/blob/master/.vim/vimrc " " Resources: " * https://statico.github.io/vim.html " * https://statico.github.io/vim2.html " * https://statico.github.io/vim3.html " * https://github.com/mhinz/vim-galore