Skip to content

Instantly share code, notes, and snippets.

@hbeita
Created August 11, 2020 19:42
Show Gist options
  • Save hbeita/e9d1f78f84e10e122aad1e62e9fed8cc to your computer and use it in GitHub Desktop.
Save hbeita/e9d1f78f84e10e122aad1e62e9fed8cc to your computer and use it in GitHub Desktop.
zsh-wsl-config v2
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Set up the prompt
autoload -Uz promptinit
promptinit
prompt adam1
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
plugins=(rails git ruby docker docker-compose)
ZSH_THEME="powerlevel10k/powerlevel10k"
# source ~/powerlevel10k/powerlevel10k.zsh-theme
source ~/powerlevel10k/powerlevel10k.zsh-theme
source ~/.oh-my-zsh/custom/ohmyzsh/plugins/git/git.plugin.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# ========================================
# A L I A S
# ========================================
alias ezsh="code ~/.zshrc"
alias glgi="git log --pretty='format:%Cgreen%h%Creset %an %cd - %s' --date=short --graph"
# compensation aliases
alias rubo="docker-compose exec compensation rubocop"
alias swc="cd /home/hbeita/Shareworks/oi/compensation"
alias swoi="cd /home/hbeita/Shareworks/oi/optionimpact"
alias swoia="cd /home/hbeita/Shareworks/oi/optionimpact-admin"
alias swoiw="cd /home/hbeita/Shareworks/oi/optionimpact-web"
alias ls='ls -X -h --group-directories-first --color'
alias grep='grep --color=auto'
alias gedit='subl'
# compensation project
alias dkr="docker restart"
alias dc="docker-compose"
alias dcst="docker-compose stop"
alias dcup="docker-compose up"
alias krailspid="dcr rm /compensation/tmp/pids/server.pid"
alias dc="docker-compose"
alias dce="docker-compose exec compensation"
alias dcr="docker-compose run compensation"
alias dcrt="docker-compose exec compensation rails t"
alias grantp="sudo chown -R $USER:$USER"
alias pr="cmd.exe /mnt/c start microsoft-edge:https://github.com/solium/compensation/pulls"
alias rubo="docker-compose exec compensation rubocop"
alias swc="cd /home/hbeita/Shareworks/oi/compensation"
alias swoi="cd /home/hbeita/Shareworks/oi/optionimpact"
alias swoia="cd /home/hbeita/Shareworks/oi/optionimpact-admin"
alias swoiw="cd /home/hbeita/Shareworks/oi/optionimpact-web"
alias untar='tar -zxvf'
alias untarxz='tar -xJf'
alias pbcopy='xclip -selection clipboard' # OSX compatibility
alias pbpaste='xclip -selection clipboard -o' # OSX compatibility
alias orphans='sudo pacman -Rs $(pacman -Qdtq)' # removes orphan packages from Archlinux
POWERLEVEL9K_INSTANT_PROMPT=quiet
# creates a directory and cds into it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# lists zombie processes
function zombie() {
ps aux | awk '{if ($8=="Z") { print $2 }}'
}
#lists npm packages installed
function npmls() {
npm ls --depth=0 "$@" 2>/dev/null
}
# Go up [n] directories
function up() {
local cdir="$(pwd)"
if [[ "${1}" == "" ]]; then
cdir="$(dirname "${cdir}")"
elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then
echo "Error: argument must be a number"
elif ! [[ "${1}" -gt "0" ]]; then
echo "Error: argument must be positive"
else
for i in {1..${1}}; do
local ncdir="$(dirname "${cdir}")"
if [[ "${cdir}" == "${ncdir}" ]]; then
break
else
cdir="${ncdir}"
fi
done
fi
cd "${cdir}"
}
bindkey '^[[1;5C' emacs-forward-word
bindkey '^[[1' emacs-backward-word
bindkey ";5C" forward-word
bindkey ";5D" backward-word
sudo service docker start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment