Skip to content

Instantly share code, notes, and snippets.

@dylanerichards
Created August 19, 2015 21:27
Show Gist options
  • Select an option

  • Save dylanerichards/81d6439000d6b42ea17f to your computer and use it in GitHub Desktop.

Select an option

Save dylanerichards/81d6439000d6b42ea17f to your computer and use it in GitHub Desktop.
Sweet
# Prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse scrolling
set-window-option -g mode-mouse on
# improve colors
set -g default-terminal 'screen-256color'
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
set -g prefix2 C-s
# Smart pane switching with awareness of vim splits
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"
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-bg '#666666'
set -g status-fg '#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# prefix -> back-one-character
bind-key C-b send-prefix
# prefix-2 -> forward-incremental-history-search
bind-key C-s send-prefix -2
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont=Inconsolata
set smartindent
set cursorline
set tabstop=2
set shiftwidth=2
set colorcolumn=80
set expandtab
set t_Co=256
set relativenumber
set number
set noswapfile
set splitbelow
set splitright
set incsearch
set hlsearch
set backspace=indent,eol,start
hi cursorLine cterm=NONE
let mapleader=","
filetype on
filetype plugin indent on
nnoremap <leader><leader> <c-^>
" map <Leader> <Plug>(easymotion-s2)
" Quick mapping to clear the highlighting of previous search pattern matches
nmap <leader>h :nohlsearch<cr>
"make powerline show up by default
set laststatus=2
"Reset TSLIME settings
nmap <C-e> <Plug>SetTmuxVars
nnoremap <C-n> :NERDTreeToggle<CR>
" Run Ruby
nnoremap <C-b> :!ruby %<CR>
map ,t :CommandT<CR>
" Move modifier key
let g:move_key_modifier = 'C'
" Map s to save
nmap s :w <enter>
" Map Q to quit
nmap Q :q <enter>
" K to split lines
nmap K i<cr><esc>k$
" Map jk to go from insert mode to normal mode
:imap jk <Esc>
" Space to bring current line to middle of screen
nmap <space> zz
" Searches stay in middle of screen
nmap n nzz
nmap N Nzz
" Switch between the last two files
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Dem trailing spaces
set list lcs=trail:·
"apply vimrc changes with leader av
nmap <silent> <leader>av :so $MYVIMRC<CR>
"edit vimrc with leader ev
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" Quicker 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
"TMUX pane switching with vim
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 = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
endif
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " MULTIPURPOSE TAB KEY
" " Indent if we're at the beginning of a line. Else, do completion.
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" function! InsertTabWrapper()
" let col = col('.') - 1
" if !col || getline('.')[col - 1] !~ '\k'
" return "\<tab>"
" else
" return "\<c-p>"
" endif
" endfunction
" inoremap <expr> <tab> InsertTabWrapper()
" inoremap <s-tab> <c-n>
" """""""""""""""""""""""""""""""""""""""
# Path to your oh-my-zsh installation.
export ZSH=/Users/dylanrichards/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
# User configuration
export PATH="/Users/dylanrichards/.rbenv/shims:/usr/local/bin:/Users/dylanrichards/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias be='bundle exec'
# Show hidden files
alias showHidden='defaults write com.apple.finder AppleShowAllFiles YES;
killall Finder /System/Library/CoreServices/Finder.app'
# RubyMotion Rake
alias rmr='sudo rake'
# Hide hidden files
alias hideHidden='defaults write com.apple.finder AppleShowAllFiles NO;
killall Finder /System/Library/CoreServices/Finder.app'
# Fun git aliases
alias gd='git diff'
alias gb='git branch'
alias gaa='git add -u && git add . && git status'
alias gc='git commit -m'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gdone="git fetch upstream && git rebase origin/master && git checkout master && git merge @{-1} && git push"
alias gp="git push"
alias gphm="git push heroku master"
alias gup="git pull upstream master && git pull heroku master && git push"
# Guidebox API Key
export GUIDEBOX_API_KEY="rKwUY998610zjh3gmGKPf5umBipLAmA7"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment