setup> zsh / tmux / vim

config files for my dev setup.

install dependencies

# brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install autoconf automake
# asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0
# zsh powerline
curl https://raw.githubusercontent.com/riobard/zsh-powerline/master/zsh-powerline.sh > ~/.zsh-powerline.sh
# install tmux
asdf plugin add tmux && asdf install tmux latest
# tmux tpm
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# install vim
asdf plugin add vim && asdf install vim latest
# install vim plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

.zshrc


PATH=~/bin:$PATH

# make alt-left/right delete key work again in tmux on mac
bindkey -e
bindkey '^[[1;3C' forward-word
bindkey '^[[1;3D' backward-word
bindkey '^[[1;9D' backward-word
bindkey '^[[1;9C' forward-word
bindkey '^[[3~' delete-char
setopt +o nomatch

alias ls='ls -G'
alias ll="ls -l"
alias l="ls -la"
alias vi="vim"

. $HOME/.asdf/asdf.sh
. ~/.asdf/plugins/java/set-java-home.zsh

[ -f ~/.zsh-powerline.sh ] && source ~/.zsh-powerline.sh
fpath+=(~/.zsh/completion)
fpath=(${ASDF_DIR}/completions $fpath)

autoload -Uz compinit
for dump in ~/.zcompdump(N.mh+24); do
  compinit
done
compinit -C

.tmux.conf


set -g mouse on

bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D 
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R

set-option -g pane-active-border-style fg=red
set -sg escape-time 0
set -g @continuum-restore 'on'

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

.vimrc


call plug#begin('~/.vim/plugged')

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-sensible'
Plug 'kien/ctrlp.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'rizzatti/dash.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
Plug 'airblade/vim-gitgutter'
Plug '907th/vim-auto-save'
Plug 'fatih/vim-go'
Plug 'chiel92/vim-autoformat'
Plug 'evanleck/vim-svelte'
Plug 'sheerun/vim-polyglot'
Plug 'pangloss/vim-javascript'
Plug 'jiangmiao/auto-pairs'
Plug 'alvan/vim-closetag'
Plug 'sirtaj/vim-openscad'
Plug 'mhinz/vim-mix-format'
Plug 'vimwiki/vimwiki'
Plug 'chr4/nginx.vim'
Plug 'shanzi/autoheader'
Plug 'drmikehenry/vim-headerguard'
Plug 'xuhdev/vim-latex-live-preview'
Plug 'lervag/vimtex'
Plug 'ap/vim-css-color'

call plug#end()

" vim-airline themes see: https://github.com/vim-airline/vim-airline/wiki/Screenshots
let g:airline_powerline_fonts=0
" let g:airline_theme='tomorrow'
let g:vimwiki_list = [{'path': '~/workspace/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
let g:auto_save = 1
let g:auto_save_events = ["InsertLeave", "CursorHold"]
let g:livepreview_previewer = 'open -a Preview'
"linux: let g:livepreview_previewer = 'evince'
let NERDTreeShowHidden=1

set clipboard=unnamed expandtab shiftwidth=2
set tabstop=2
set wildignore+=deps,node_modules,target,*.png,*.jpg,*.jpeg,*.ico,*.bmp,*.webp
set ignorecase
set number
set cmdheight=2
set updatetime=300
set nobackup

set nowritebackup
set shortmess+=c
set signcolumn=yes
set nocompatible
filetype plugin on
syntax on

try
nmap <silent> gd <Plug>(coc-definition)
" nmap <silent> gi :CocCommand java.action.organizeImports<CR>
nmap <F1> <nop>
nmap <silent> gn :call CocAction('diagnosticNext')<cr>
nmap <silent> gp :call CocAction('diagnosticPrevious')<cr>
nmap <silent> gf :Autoformat <cr>
endtry

function NERDFocusOrToggle()
if &filetype == 'nerdtree' || &filetype == ''
  :NERDTreeToggle
else
  :NERDTreeFind
endif
endfunction
map <C-n> :call NERDFocusOrToggle()<CR>

.vim/coc-settings.json


{
  "suggest.noselect": false,
  "suggest.floatEnable": false,
  "diagnostic.messageTarget": "echo",
  "diagnostic.checkCurrentLine": true,
  "languageserver": {
    "gopls": {
      "command": "$GOPATH/bin/gopls",
      "filetypes": ["go"]
    },
    "ccls": {
      "command": "ccls",
      "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
      "filetypes": ["c", "cpp", "objc", "objcpp"],
      "initializationOptions": {
        "cache": {
          "directory": "/tmp/ccls"
        }
      }
    }
  },
  "tsserver.npm": "~/.asdf/shims/npm"
}

install plugins

tmux

install tmux plugins defined in .tmux.conf: prefix + I

default tmux prefix: ctrl + b

vim

install vim plugins defined in .vimrc
open vim first

:PlugInstall