Skip to content

Instantly share code, notes, and snippets.

@surajRathi
Forked from srathi-monarch/.zshrc.local.zsh
Last active July 14, 2023 20:17
Show Gist options
  • Save surajRathi/6205189ac06345b1a39cce6119b10b70 to your computer and use it in GitHub Desktop.
Save surajRathi/6205189ac06345b1a39cce6119b10b70 to your computer and use it in GitHub Desktop.
Zsh config to be used on top of GRML zsh config. Includes ros, fzf.
export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.cargo/bin"
# export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
# export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
# setopt HIST_VERIFY # Don't execute immediately upon history expansion.
# setopt HIST_BEEP # Beep when accessing nonexistent history.
alias fgrep='grep -F'
alias dff='df -hT -x tmpfs -x devtmpfs -x squashfs'
fk () { $@ 2>&1 > /dev/null &!} # Silently Fork off the process
alias pycharm='fk pycharm'
alias clion='fk pycharm'
alias bat=batcat
mcd() {
mkdir $@ && cd $1
}
source /opt/ros/noetic/setup.zsh
source ~/.local/opt/zed_noetic/setup.zsh
# Second precision:
export ROSCONSOLE_FORMAT='[${severity} ${time:%H:%M.%S}] ${node}: ${message}'
# Subsecond precision:
# export ROSCONSOLE_FORMAT='[${severity} ${time}] ${node}: ${message}'
DEFAULT_WS="$HOME/ws"
# Source the local workspace if we are within one
alias source_ws='catkin locate | read -r WS_HOME && [ -f "${WS_HOME}/cc_setup.zsh" ] && source "${WS_HOME}/cc_setup.zsh" || source "${WS_HOME}/devel/setup.zsh"'
ws() {
if [ "$1" != "" ] ; then
cd "$1" && source_ws
else
cd "$DEFAULT_WS" && source_ws
fi
}
alias catkin_build="catkin build"
# sudo apt install zsh fzf zsh-autosuggetions zsh-syntax-highlighting
# wget -O ~/.zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
# wget 'https://raw.githubusercontent.com/lincheney/fzf-tab-completion/master/zsh/fzf-zsh-completion.sh' -P ~/.local/share
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
export FZF_DEFAULT_OPTS="--reverse"
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh
source /home/srathi/.local/share/fzf-zsh-completion.sh # Breaks ROS Completion
# toggle fzf complete to make ros commands autoconmplete
togcomp() {
if [ "${fzf_default_completion}" = "fzf_completion" ]; then
export fzf_default_completion=expand-or-complete
echo "fzf tab disabled"
else
export fzf_default_completion=fzf_completion
echo "fzf tab renabled"
fi
}
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.cargo/bin"
# HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
# setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
# setopt HIST_VERIFY # Don't execute immediately upon history expansion.
# setopt HIST_BEEP # Beep when accessing nonexistent history.
alias fgrep='grep -F'
alias dff='df -hT -x tmpfs -x devtmpfs -x squashfs'
fk () { $@ 2>&1 1>/dev/null &!} # Silently Fork off the process
alias bat=batcat
source /opt/ros/noetic/setup.zsh
# By default, go to ~/ws. Otherwise use the working directory zsh was invoked in
if [ "${PWD}" = "${HOME}" ] ; then
cd ~/ws
fi
# Source the local workspace if we are within one
catkin locate | read -r WS_HOME && source "${WS_HOME}/devel/setup.zsh"
# sudo apt install zsh fzf zsh-autosuggetions zsh-syntax-highlighting
# wget -O ~/.zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
# wget 'https://raw.githubusercontent.com/lincheney/fzf-tab-completion/master/zsh/fzf-zsh-completion.sh' -P ~/.local/share
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
export FZF_DEFAULT_OPTS="--reverse"
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh
alias ros='touch ~/.roscomp && zsh ; exit'
if [ ! -f ~/.roscomp ] ; then
source /home/srathi/.local/share/fzf-zsh-completion.sh # Breaks ROS Completion
else
rm -f ~/.roscomp
fi
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment