Last active
November 24, 2021 00:00
-
-
Save elulcao/d4acbc208ba6889d265dfd9fe4807a67 to your computer and use it in GitHub Desktop.
zshrc favorite configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# elulcao | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
setopt INC_APPEND_HISTORY_TIME # separate concurrent histories across shells until session closes | |
setopt EXTENDED_HISTORY # save each command’s beginning timestamp | |
setopt HIST_EXPIRE_DUPS_FIRST # the oldest history event that has a duplicate to be lost before losing a unique event from the lis | |
setopt HIST_IGNORE_DUPS # do not enter command lines into the history list if they are duplicates of the previous event | |
setopt HIST_IGNORE_ALL_DUPS # the older command is removed from the list | |
setopt HIST_IGNORE_SPACE # remove command lines from the history list when the first character on the line is a space | |
setopt HIST_FIND_NO_DUPS # do not display duplicates of a line previously found | |
setopt HIST_SAVE_NO_DUPS # older commands that duplicate newer ones are omitted | |
setopt HIST_BEEP # beep in ZLE when a widget attempts to access a history entry which isn’t there | |
unsetopt INC_APPEND_HISTORY # add commands to HISTFILE in order of execution | |
unsetopt SHARE_HISTORY # share command history data | |
unsetopt nomatch # This will prevent ZSH to print an error when no match can be found. | |
# Path to your oh-my-zsh installation | |
export ZSH="$HOME/.oh-my-zsh" | |
# Personal settings | |
export ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX=YES | |
export LANG=en_US.UTF-8 | |
# GPG | |
export GPG_TTY=`tty` | |
# JAVA | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
# TMUX | |
export TMUX_TMPDIR="$HOME/.tmuxserver" | |
# GO | |
export GOPATH="$HOME/go" | |
export GOPRIVATE="" | |
export GO111MODULE=auto | |
# VAULT | |
export VAULT_FORMAT=json | |
export VAULT_ADDR=http://1.1.1.1:31028 | |
export VAULT_TOKEN= | |
export VAULT_SKIP_VERIFY=true | |
# PATH | |
export PATH="$GOPATH/bin:$PATH" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes | |
# ZSH_THEME="dracula" | |
# ZSH_THEME="agnoster-dracula" | |
ZSH_THEME="dracula" | |
# Set list of themes to pick from when loading at random | |
# Setting this variable when ZSH_THEME=random will cause zsh to load | |
# a theme from this variable instead of looking in $ZSH/themes/ | |
# If set to an empty array, this variable will have no effect. | |
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) | |
# ZSH_THEME_RANDOM_CANDIDATES=("dracula" "agnoster-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 automatically update without prompting. | |
# DISABLE_UPDATE_PROMPT="true" | |
# Uncomment the following line to change how often to auto-update (in days). | |
# export UPDATE_ZSH_DAYS=13 | |
# Uncomment the following line if pasting URLs and other text is messed up. | |
# DISABLE_MAGIC_FUNCTIONS="true" | |
# 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. | |
# You can set one of the optional three formats: | |
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" | |
# or set a custom format using the strftime function format specifications, | |
# see 'man strftime' for details. | |
# 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? | |
# Standard plugins can be found in $ZSH/plugins/ | |
# Custom plugins may be added to $ZSH_CUSTOM/plugins/ | |
# Example format: plugins=(rails git textmate ruby lighthouse) | |
# Add wisely, as too many plugins slow down shell startup. | |
plugins=( | |
git | |
iterm2 | |
macports | |
zsh-autosuggestions | |
) | |
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" | |
# 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 myhome="ssh -t elulcao@node 'tmux new -A -s 000_NODE'" | |
alias rsyncmyhome="/usr/bin/rsync \ | |
-rlptzv \ | |
--progress \ | |
--update \ | |
--exclude=**.log \ | |
--exclude=**.mailmap \ | |
--exclude=**.DS_Store \ | |
--exclude=**.DS_Store? \ | |
--exclude=**._* \ | |
--exclude=**.Spotlight-V100 \ | |
--exclude=**.Trashes \ | |
--exclude=**ehthumbs.db \ | |
--exclude=**Thumbs.db \ | |
--exclude=**.darwin \ | |
--exclude=**.vscode \ | |
--exclude=**.code-workspace \ | |
--exclude=**.terraform* \ | |
--exclude=**certificates/* \ | |
--exclude=**terraform.tfstate* \ | |
--exclude=**environment.sh \ | |
/Users/elulcao/GitHub/ \ | |
1.1.1.1:/home/elulcao/GitHub/" | |
# Remove .DS_Store files recursively in a directory, default . | |
function rmdsstore () | |
{ | |
find "${@:-.}" -type f -name .DS_Store -delete | |
} | |
# squashon | |
squashon () | |
{ | |
# If user just enters 'squashon', give help text | |
if (( # == 0 )); then | |
echo Hello! This will squash your current branch down to one unstaged commit. | |
echo Use by typing squashon rootBranchName | |
echo usage: squashon develop | |
fi | |
# If a root branch is provided, run the squasher | |
if (( # == 1 )); then | |
branch=$(git symbolic-ref HEAD) | |
echo Squashing all commits from $branch | |
git reset $(git merge-base $1 $branch) | |
echo ------SUCCESS!------ | |
echo Commits successfully squashed, all file changes are unstaged. | |
echo Run 'git add -A' and 'git commit -m "your commit message"' to add your squashed commit. | |
fi | |
} | |
# X11 | |
# automate X11 DISPLAY reset for better use in tmux | |
update-x11-forwarding () | |
{ | |
if [ -z "$STY" -a -z "$TMUX" ]; then | |
echo $DISPLAY > ~/.display.txt | |
else | |
export DISPLAY=$(cat ~/.display.txt) | |
fi | |
} | |
# and run this before every command | |
preexec () | |
{ | |
[ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && return | |
update-x11-forwarding | |
} | |
trap 'preexec' DEBUG | |
set_proxy () | |
{ | |
echo "export http(s)_proxy" | |
export http_proxy= ; \ | |
export https_proxy="${http_proxy}" ; \ | |
export ftp_proxy="${http_proxy}" ; \ | |
export FTP_PROXY="${http_proxy}" ; \ | |
export HTTP_PROXY="${http_proxy}" ; \ | |
export HTTPS_PROXY="${http_proxy}" ; \ | |
export no_proxy="" ; \ | |
export NO_PROXY="${no_proxy}" ; | |
} | |
unset_proxy () | |
{ | |
echo "unset http(s)_proxy" | |
unset http_proxy https_proxy ftp_proxy FTP_PROXY HTTP_PROXY HTTPS_PROXY no_proxy NO_PROXY | |
} | |
test -e /Users/elulcao/.iterm2_shell_integration.zsh && \ | |
source /Users/elulcao/.iterm2_shell_integration.zsh || true | |
# Prevents duplicates of PATH variables | |
typeset -U PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment