call plug#begin('~/.vim/plugged') Plug 'airblade/vim-gitgutter' Plug 'ctrlpvim/ctrlp.vim' Plug 'godlygeek/tabular' Plug 'itchyny/lightline.vim' Plug 'mhinz/vim-startify' Plug 'mileszs/ack.vim' Plug 'ntpeters/vim-better-whitespace' Plug 'raimondi/delimitmate' " provides automatic closing of quotes, parenthesis, brackets Plug 'saltstack/salt-vim' Plug 'scrooloose/nerdtree' Plug 'sheerun/vim-polyglot' " syntax and indentation support Plug 'tomtom/tcomment_vim' Plug 'tpope/vim-fugitive' " git intergration Plug 'tpope/vim-surround' Plug 'easymotion/vim-easymotion' Plug 'w0rp/ale' Plug 'morhetz/gruvbox' call plug#end() syntax enable filetype plugin indent on set autoindent set backspace=start,eol,indent " fix backspace set confirm " dialogue asking if you wish to save changed files set copyindent " copy the previous indentation on autoindenting set expandtab " tabs are spaces set ignorecase " ignore case when searching set incsearch " search as characters are entered set hlsearch " highlight search pattern set laststatus=2 " always display status line set mouse=a " enable mouse support set noerrorbells set noshowmode " Don't show the current mode (airline.vim takes care of us) set nostartofline " stop certain movements from always going to the first character of a line set number " show line numbers set scrolloff=3 " lines display above/below cursor when scrolling set shiftwidth=2 " normal mode indentation commands use 2 spaces set showcmd " show command in bottom bar set showmatch " highlight matching [{()}] set smartcase " search case sensitive when uppercase is used set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop set softtabstop=2 " number of spaces in tab when editing set tabstop=2 " number of visual spaces per TAB set title " Show the filename in the window titlebar set visualbell " Use visual bell instead of audible bell set wildchar= " Character for CLI expansion (TAB-completion) set wildignore+=.DS_Store,*/.git/*,.swp set wildmenu " visual autocomplete for command menu set wildmode=longest,list,full set complete-=i " word completion (options .,w,b,u,t,i) in insert mode (ctrl-p) set lazyredraw " don’t update screen during macro and script execution set backupdir=~/.vim/tmp/ " backup files set directory=~/.vim/tmp/ " swap files set shiftround " when shifting lines, round the indentation to the nearest multiple of shiftwidth. set hidden " show line break character set breakindent set breakindentopt=sbr set showbreak=↪>\ if has('unix') if has('mac') set clipboard=unnamed " copy/paste to system clipboard else set clipboard=unnamedplus " copy/paste to system clipboard endif endif " ===== Display ====== set background=dark "set t_Co=256 " 256 colours in terminal. "set term=xterm-256color "set term=screen-256color colorscheme gruvbox let g:gruvbox_contrast_dark = 'hard' if &term =~# '^screen' let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" endif if (has("termguicolors")) set termguicolors endif " ===== Shortcuts ===== let mapleader = "\" " leader is space key nnoremap :NERDTreeFocus set pastetoggle= nnoremap q :set number! " Map tab to % - moves to nearest bracket match nnoremap % vnoremap % let g:ackprg = 'rg --vimgrep --no-heading' " Use ripgrep when searching via ack.vim nnoremap a :Ack! " split pane vertically nnoremap d vl " move focus on window panes nnoremap l l nnoremap h h nnoremap k k nnoremap j j " disable arrow keys noremap noremap noremap noremap " Move visual block vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv " Clear search highlight nnoremap :nohlsearch " Buffers nnoremap b :buffers:buffer nnoremap n :bnext nnoremap p :bprev " EasyMotion map f (easymotion-bd-f) map w (easymotion-bd-w) " Use ripgrep when using Ctrl-P if executable('rg') set grepprg=rg\ --color=never let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' let g:ctrlp_use_caching = 0 endif let g:lightline = { \ 'colorscheme': 'gruvbox', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': {'gitbranch': 'fugitive#head'}, \ }