""" Plug-in management " Install vim-plug if not found 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 endif " Run PlugInstall if there are missing plugins autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) \| PlugInstall --sync | source $MYVIMRC \| endif " Load Plug-ins call plug#begin() Plug 'fatih/vim-go' Plug 'bronson/vim-trailing-whitespace' call plug#end() """ " Tmux integration to switch panes with Ctrl+{hjkl} if exists('$TMUX') function! TmuxOrSplitSwitch(wincmd, tmuxdir) let previous_winnr = winnr() silent! execute "wincmd " . a:wincmd if previous_winnr == winnr() call system("tmux select-pane -" . a:tmuxdir) redraw! endif endfunction let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '') let &t_ti = "\2;vim\\\" . &t_ti let &t_te = "\2;". previous_title . "\\\" . &t_te nnoremap :call TmuxOrSplitSwitch('h', 'L') nnoremap :call TmuxOrSplitSwitch('j', 'D') nnoremap :call TmuxOrSplitSwitch('k', 'U') nnoremap :call TmuxOrSplitSwitch('l', 'R') else map h map j map k map l endif " coding preferences filetype off filetype plugin indent on syntax on set backspace=indent,eol,start set noautoindent set noswapfile set number set ruler set showmatch set smarttab set ts=2 sw=2 sts=2 expandtab let mapleader="," if has("autocmd") autocmd FileType go set ts=2 sw=2 sts=2 noet nolist autowrite endif