Skip to content

Instantly share code, notes, and snippets.

@dimitardanailov
Last active August 26, 2024 13:34
Show Gist options
  • Save dimitardanailov/d50d8c872446dc371a7d85bb93832260 to your computer and use it in GitHub Desktop.
Save dimitardanailov/d50d8c872446dc371a7d85bb93832260 to your computer and use it in GitHub Desktop.
My personal zsh and tmux configurations
# Path to your oh-my-zsh installation.
export ZSH=/Users/dimitar.danailov/.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"
ZSH_THEME="agnoster"
# 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 npm ssh-agent)
# Rupa z
# https://www.youtube.com/watch?v=qbNn5zJLZU0&index=10&list=PLu8EoSxDXHP7tXPJp5ZmUpuT7sFvrswzf
# brew install z
. `brew --prefix`/etc/profile.d/z.sh
# User configuration
# Always work in a tmux session if tmux is installed
# https://github.com/chrishunt/dot-files/blob/master/.zshrc
if which tmux 2>&1 >/dev/null; then
if [ $TERM != "screen-256color" ] && [ $TERM != "screen" ]; then
tmux attach -t hack || tmux new -s hack; exit
fi
fi
export EDITOR='vim'
source $ZSH/oh-my-zsh.sh
####### BASH PROFILE #######
export HOME_FOLDER="/Users/dimitar.danailov"
export PATH="/Users/dimitar.danailov/.rvm/gems/ruby-2.1.5/bin:/Users/dimitar.danailov/.rvm/gems/ruby-2.1.5@global/bin:/Users/dimitar.danailov/.rvm/rubies/ruby-2.1.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dimitar.danailov/.rvm/bin"
# export MANPATH="/usr/local/man:$MANPATH"
source ~/.bash_profile
source ~/.bashrc
source ~/.profile
export NVM_DIR="/Users/$USER/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# 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"
###########################
### Configuration
############################
#
# set Zsh as your default Tmux shell
set-option -g default-shell /bin/zsh
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# Retach userspaces
set -g default-command "reattach-to-user-namespace -l zsh"
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# increase repeat time for repeatable commands
set -g repeat-time 1000
# So this option has been renamed in version 2.1 (18 October 2015)
# http://stackoverflow.com/questions/11832199/tmux-set-g-mouse-mode-on-doesnt-work
set -g mouse on
# https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -t vi-copy PPage page-up
bind-key -t vi-copy NPage page-down
# UTF is great, let us use that
set -g utf8
set-window-option -g utf8 on
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# Set the numbering of windows to go from 1 instead of 0 - silly programmers :|
set-option -g base-index 1
set-window-option -g pane-base-index 1
setw -g pane-base-index 1
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
# Basically allows for faster key repetition
set -s escape-time 0
# 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*.
setw -g aggressive-resize on
###########################
## Key Bindings
############################
# Clear history with Command and Key
# http://stackoverflow.com/questions/10543684/how-can-i-clear-scrollback-buffer-in-tmux
# act like GNU screen
unbind C-b
set -g prefix `
bind ` send-prefix
# Open last window
bind-key L last-window
# Allow us to reload our Tmux configuration while using Tmux
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Getting interesting now, we use the vertical and horizontal
# symbols to split the screen
bind | split-window -h
bind - split-window -v
###########################
## tmux Copy & Paste
############################
#
# https://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future
# Use vim keybindings in copy mode
setw -g mode-keys vi
# 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"
###########################
## 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
@pfrozi
Copy link

pfrozi commented Nov 9, 2021

I have been looking for some examples like that. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment