Skip to content

Instantly share code, notes, and snippets.

@joe-wolfe21
Last active July 9, 2020 10:26
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joe-wolfe21/8be5dc36ab88b7007995871a2e91236a to your computer and use it in GitHub Desktop.
Save joe-wolfe21/8be5dc36ab88b7007995871a2e91236a to your computer and use it in GitHub Desktop.
The Ultimate Terminal
# use zsh & make pbcopy/paste work
set-option -g default-terminal /bin/zsh
set-option -g default-command "reattach-to-user-namespace -l zsh"
bind w new-window -c "#{pane_current_path}"
# It's 2016
set -g default-terminal "screen-256color"
# set the command escape time to 0
set -s escape-time 0
set -g history-limit 5000
# set-option -g mouse on
# Automatically set window title and don't let it change
set-option -g set-titles on
set-option -g allow-rename off
# Start copy mode when scrolling up
# bind -n WheelUpPane copy-mode
# bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
# bind -n WheelDownPane select-pane -t= \; send-keys -M
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# Bind ']' to use pbpaste
# bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# Use c-a as prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
bind-key a send-key C-a
#
## Start numbering at 1
set -g base-index 1
setw -g pane-base-index 1
bind * choose-session # choose session interactively
# use hjkl for moving
# and HJKL for resizing
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 :+
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
#split win=dow bindings
#unbind % # Remove default binding since we’re replacing
#bind | split-window -h
#bind _ split-window -v
# shortcut for closing windows and panes
bind-key c kill-pane
bind-key C kill-window
# bind-key q confirm-before kill-session
# bind-key Q confirm-before kill-server
unbind o
bind o kill-pane -a
# unbind c
# use v and s for windows splits
# unbind %
# bind s split-window -v
# bind v split-window -h
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
set -g aggressive-resize on
# Reload the tmux config
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# powerline
run-shell "powerline-daemon -q"
source "/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=path_to_oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="dracula"
# 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 brew node npm postgres rails)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# 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"
#
export EDITOR='vim'
# Adding tmuxinator completion file
source ~/.bin/tmuxinator.zsh

The Ultimate Terminal - Gist

This gist is a reference to my Medium Post The Ultimate Terminal

It contains my configuration files for zsh and tmux along with a sample tmuxinator project yml.

Also, feel free to leave any questions or comments on the original blog post.

# ~/.tmuxinator/sample.yml
name: sample
root: ~/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
# startup_window: editor
# Specitifes (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used.
# startup_pane: 1
# Controls whether the tmux session should be attached to automatically. Defaults to true.
# attach: false
# Runs after everything. Use it to attach to tmux with custom options etc.
# post: tmux -CC attach -t ams
# Tmuxinator Project that creates 6 windows in one tmux session called sample.
windows:
- git:
cd ~/Documents/workspace
- webAppName:
layout: main-vertical
panes:
- cd ~/Documents/workspace/webAppName && yarn start
- cd ~/Documents/workspace/webAppName && yarn run test
- storybook:
cd ~/Documents/workspace/webAppName && yarn storybook
- backendApi:
cd ~/Documents/workspace/backendApi && mvn clean package && java -jar target/backendApi-*.jar
- elasticsearch:
cd ~/Documents/workspace/elasticsearch-2.4.2/bin && ./elasticsearch
- psql:
cd ~/Documents/workspace && psql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment