Skip to content

Instantly share code, notes, and snippets.

@danscotton
Created February 7, 2018 08:30
Show Gist options
  • Save danscotton/605253e3fafcd1e7fe401d6017d55abc to your computer and use it in GitHub Desktop.
Save danscotton/605253e3fafcd1e7fe401d6017d55abc to your computer and use it in GitHub Desktop.
# ----------------------------------------
# configuration
# ----------------------------------------
# fix tmux/vim colour issues
set -g default-terminal "screen-256color"
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# enable mouse (commented after sierra upgrade)
# setw -g mode-mouse on
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# re-number windows when one is closed
set -g renumber-windows on
# ----------------------------------------
# vim-tmux navigator
# ----------------------------------------
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# ----------------------------------------
# key bindings
# ----------------------------------------
# tmux prefix
unbind C-b
set -g prefix C-a
# resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# ----------------------------------------
# status bar
# ----------------------------------------
# enable UTF-8 support in status bar
# set -g status-utf8 on (commenated after sierra upgrade)
# set refresh interval for status bar
set -g status-interval 30
# center the status bar
set -g status-justify left
# ----------------------------------------
# colors
# ----------------------------------------
# color status bar
set -g status-bg colour235
set -g status-fg white
# highlight current window
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg green
# set color of active pane
set -g pane-border-fg colour235
set -g pane-border-bg black
set -g pane-active-border-fg green
set -g pane-active-border-bg black
" ----------------------------------------
" vundle setup
" ----------------------------------------
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'rking/ag.vim'
" navigation
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'christoomey/vim-tmux-navigator'
let g:NERDTreeShowHidden = 1
let g:NERDTreeIgnore = ['\.\.$', '\.$', '\~$', '\.git$', '\.DS_Store']
" formatting
Plugin 'godlygeek/tabular'
Plugin 'ervandew/supertab'
Plugin 'spacehi.vim'
Plugin 'nathanaelkane/vim-indent-guides'
" focus
Plugin 'junegunn/goyo.vim'
Plugin 'junegunn/limelight.vim'
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240
" colour schemes
Plugin 'altercation/vim-colors-solarized'
Plugin 'nanotech/jellybeans.vim'
Plugin 'w0ng/vim-hybrid'
" languages
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'kchmck/vim-coffee-script'
Plugin 'elzr/vim-json'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-bundler'
Plugin 'thoughtbot/vim-rspec'
Plugin 'tpope/vim-markdown'
Plugin 'othree/html5.vim'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-cucumber'
Plugin 'tpope/vim-fireplace'
Plugin 'guns/vim-clojure-static'
Plugin 'guns/vim-clojure-highlight'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'stephpy/vim-yaml'
Plugin 'tpope/vim-liquid'
Plugin 'digitaltoad/vim-pug'
Plugin 'pearofducks/ansible-vim'
Plugin 'fatih/vim-nginx'
" execute commands in tmux
Plugin 'benmills/vimux'
call vundle#end()
filetype plugin indent on
syntax on
let mapleader = ","
" ----------------------------------------
" general settings
" ----------------------------------------
set ruler
set number
set cursorline
set showcmd
set history=1000
set hidden
set showmatch
set nowrap
set noesckeys
set backspace=indent,eol,start
set timeout timeoutlen=1000 ttimeoutlen=100
" tabs vs spaces
set expandtab
set tabstop=4
set shiftwidth=4
" search
set incsearch
set hlsearch
set ignorecase
set smartcase
" disable backup
set nobackup
set nowritebackup
set noswapfile
" status bar
set laststatus=2
set showtabline=2
set cmdheight=1
" disable folding
set nofoldenable
" splits
set splitright
set splitbelow
" tab completion
set wildmode=longest,list,full
set wildmenu
" enable copy/paste between system
set clipboard=unnamed
" speed up ctrl-p
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard', '.rubies/', '~/.rubies/']
" vimux
let g:VimuxHeight = "40"
let g:VimuxOrientation = "h"
" let g:VimuxRunnerType = "window"
" let g:VimuxUseNearest = 0
" ----------------------------------------
" colour scheme
" ----------------------------------------
" set background=dark
" colorscheme hybrid
highlight TabLineFill ctermfg=Black
highlight StatusLine ctermfg=Black ctermbg=White
" ----------------------------------------
" spaces/tabs
" ----------------------------------------
autocmd Filetype html setlocal ts=4 sts=4 sw=4
autocmd Filetype ruby setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=4 sts=4 sw=4
autocmd Filetype cucumber setlocal ts=4 sts=4 sw=4
autocmd Filetype scss setlocal ts=2 sts=2 sw=2
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2
autocmd Filetype pug setlocal ts=2 sts=2 sw=2
" ----------------------------------------
" window movement
" ----------------------------------------
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
nnoremap <leader><leader> <C-^>
" ----------------------------------------
" key mappings
" ----------------------------------------
" clear search highlight
nnoremap § :nohls<cr>
" ctrlp
nnoremap <leader>y :CtrlPBuffer<cr>
" nerdtree
nnoremap <leader>[ :NERDTree<cr>
nnoremap <leader>] :NERDTreeClose<cr>
nnoremap <leader>' :NERDTreeFind<cr>
" tabularize
nnoremap <leader>a\| :Tabularize /\|<cr>
vnoremap <leader>a\| :Tabularize /\|<cr>
vnoremap <leader><leader>m :Tabularize /\|<cr>
" vimux
nnoremap <Leader>rc :call VimuxRunCommand("clear; grunt acceptance")<CR>
nnoremap <Leader>ru :call VimuxRunCommand("clear; grunt karma")<CR>
nnoremap <Leader>vp :VimuxPromptCommand<CR>
nnoremap <Leader>vl :VimuxRunLastCommand<CR>
nnoremap <Leader>vq :VimuxCloseRunner<CR>
nnoremap <Leader>vz :call VimuxZoomRunner()<CR>
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
autoload -Uz promptinit
promptinit
prompt steeef
# install casks into /Applications instead of /Users/danscotton/Applications
# export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/etc/Caskroom"
# sets up chruby and allows us to use .ruby-version files to switch ruby versions
source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
# set default ruby
chruby ruby-2.2.2
export EDITOR='vim'
export VISUAL='vim'
# aliases
alias go='git checkout'
alias gs='git status'
alias gd='git diff'
alias cat='ccat'
# nvm
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
# mld
source ~/.mldrc
# wd
wd() {
. /Users/danscotton/bin/wd/wd.sh
}
export ANDROID_HOME=${HOME}/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/Users/danscotton/.sdkman"
[[ -s "/Users/danscotton/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/danscotton/.sdkman/bin/sdkman-init.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment