Skip to content

Instantly share code, notes, and snippets.

@ashpreetbedi
Last active December 29, 2024 10:34
Show Gist options
  • Save ashpreetbedi/f31d29733c2e02c3ed0b11356f977630 to your computer and use it in GitHub Desktop.
Save ashpreetbedi/f31d29733c2e02c3ed0b11356f977630 to your computer and use it in GitHub Desktop.
Ashpreet's dotfiles
# Copying these from: http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# split panes using | and -
bind d split-window -h
bind - split-window -v
unbind '"'
unbind %
set -g base-index 1
setw -g pane-base-index 1
# reload config file using r
bind r source-file ~/.tmux.conf \; display "Config reloaded"
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Zoom pane
bind + resize-pane -Z
# Ctrl+Shift+Left will move the current window to the left
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
# Ctrl+Shift+Right will move the current window to the right
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# Select pane and windows
bind -r C-[ previous-window
bind -r C-] next-window
bind -r Tab last-window # cycle thru MRU tab
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# bind -t vi-copy WheelUpPane scroll-up
# bind -t vi-copy WheelDownPane scroll-down
# don't rename windows automatically
set-option -g allow-rename off
# ask for new name for window
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
# Kill pane/window/session shortcuts
bind x kill-pane
bind X kill-window
bind C-x confirm-before -p "kill other windows? (y/n)" "kill-window -a"
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session
# clear the screen in tmux
bind k send-keys -R \; send-keys C-l \; clear-history
# bind w to detach just like cmd-w to close tab in iterm
bind w detach
######################
### DESIGN CHANGES ###
######################
# statusbar
set -g status-style 'bg=colour77 fg=colour233'
set -g status-left ''
set -g status-right '#[fg=colour4,bg=colour18] %H:%M %p '
" Ashpreet Bedi
execute pathogen#infect()
filetype plugin indent on
syntax on " enable syntax processing
" Spaces & Tabs {{{
set tabstop=4 " 4 space tab " number of columns occupied by a tab character
set expandtab " use spaces for tabs
set softtabstop=4 " 4 space tab
set shiftwidth=4
set modelines=1
" set autoindent " indent a new line the same amount as the line just typed
" }}}
" UI Layout {{{
set number " show line numbers
set showcmd " show command in bottom bar
set nocursorline " highlight current line
set wildmenu
set lazyredraw
set showmatch " higlight matching parenthesis " Show matching brackets.
set wildmode=longest,list " get bash-like tab completions
set cc=80 " set an 80 column border for good coding style
" }}}
" Searching {{{
set ignorecase " ignore case when searching
set incsearch " search as characters are entered
set hlsearch " highlight all matches
set wildignore+=.log,.sql,*.cache
" }}}
set mouse=v " middle-click paste with mouse
map <leader>s :source ~/.vimrc<CR>
set hidden
set history=100
colorscheme Tomorrow-Night-Bright
set laststatus=2
let g:CommandTSuppressMaxFilesWarning=1
# Activate subl command by adding Sublime Text path to PATH
SUBL_PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin"
# Add Bun to path
export BUN_INSTALL="$HOME/.bun"
# Add global python to path
GLOBAL_PYTHON_PATH="/opt/homebrew/bin/python3.13"
export PATH=$GLOBAL_PYTHON_PATH:/opt/homebrew/bin:/usr/local/bin:$SUBL_PATH:$BUN_INSTALL/bin:$PATH
# enable direnv i.e. load env vars from a .envrc file in the current and parent directories.
eval "$(direnv hook zsh)"
# zsh theme
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="bedizsh"
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#b8a2ff"
# Disable auto-cd so commands matching a directory name don't cd into it
unsetopt autocd
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"
# Install the following plugins
plugins=(git python colorize zsh-syntax-highlighting zsh-autosuggestions kubectl kube-ps1)
source $ZSH/oh-my-zsh.sh
# kube-ps1
# use kubeon to activate
PROMPT='$(kube_ps1)'$PROMPT
export KUBE_PS1_SYMBOL_ENABLE="false"
# kubens
export KUBENS_CURRENT_FGCOLOR=$(tput setaf 6)
# Aliases
# Mac
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
# Python
alias del_pyc='find . -type f -name "*.py[co]" -delete -or -type d -name "_pycache_" -delete'
# Git
function git_commit_push() {
if [ -z "$1" ]; then
COMMIT_MESSAGE="Updated at $(date +'%Y-%m-%d %H:%M:%S')"
else
COMMIT_MESSAGE="$1"
fi
git add .
git commit -m "${COMMIT_MESSAGE}"
git push
}
alias gcp='git_commit_push'
alias gcb='git checkout -t origin/main -b'
alias gca='git add . ; git commit --amend'
alias gcm='git checkout main'
alias gpm='git pull origin main'
alias gcd='git checkout dev'
alias gpd='git pull origin dev'
alias gcs='git checkout stg'
alias gps='git pull origin stg'
# Docker
alias dc='docker compose'
alias dm='docker-machine'
alias dl='$LAB_DIR/scripts/docker/docker_logs.sh'
alias dlt='docker logs --tail 200'
alias de='$LAB_DIR/scripts/docker/docker_exec.sh'
# K8s
alias kg='kubectl get'
alias kd='kubectl describe'
alias kx='kubectx'
alias kns='kubens'
# Tmux
alias ta='tmux a -t '
alias t='tmux'
# Custom
alias ll='ls -alh'
# To install key bindings and fuzzy completion for fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Bun completions
[ -s "/Users/zu/.bun/_bun" ] && source "/Users/zu/.bun/_bun"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/zu/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/zu/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/zu/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/zu/google-cloud-sdk/completion.zsh.inc'; fi
############################################################################
#
# Custom zsh theme built from the mh theme
# Usage:
# in ~/.zshrc, ZSH_THEME="bedizsh"
# Features:
# - path is autoshortened to ~30 characters
# - displays git status (if applicable in current folder)
#
############################################################################
# prompt
PROMPT='[%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
RPROMPT='$(git_prompt_info)'
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B"
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱"
# LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment