Skip to content

Commit

Permalink
modify macos zshrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Fireond committed Dec 17, 2024
1 parent ae225c7 commit 622ebc4
Showing 1 changed file with 47 additions and 151 deletions.
198 changes: 47 additions & 151 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -1,97 +1,29 @@
# 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

export ZSH=$HOME/.zsh
export PATH=/Users/hanyu_yan/Library/Python/3.11/bin:$PATH
## In order to use the executable scripts inside ~/bin directly
export PATH=$HOME/.bin:$PATH

## for Zathura to run, vimtex suggested
export DBUS_SESSION_BUS_ADDRESS="unix:path=$DBUS_LAUNCHD_SESSION_BUS_SOCKET"

export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

# Blur {{{
# if [[ $(ps --no-header -p $PPID -o comm) =~ '^yakuake|kitty$' ]]; then
# for wid in $(xdotool search --pid $PPID); do
# xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id $wid; done
# fi
# }}}

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
# 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
# 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" )

# 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.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# 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.

if [[ "$OSTYPE" == "darwin"* ]]; then
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/hanyu_yan/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/hanyu_yan/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/hanyu_yan/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/hanyu_yan/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
fi


### --- Plugins --- ###
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
Expand All @@ -117,29 +49,31 @@ function a() {
rm -f -- "$tmp"
}

# 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"

### --- Alias --- ###
alias ll='clear'
alias ld='learn ddl'
alias jj='cd ..'
alias proxy='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890'
alias unproxy='unset all_proxy'
alias disablesleep='sudo pmset -a disablesleep 1'
alias enablesleep='sudo pmset -a disablesleep 0'
alias op='open .'
function pdf() {
sioyek "$1" &
}
alias tt='toggle_alacritty_opacity'
alias bs='brew search'
alias bi='brew install'
alias skim='/Applications/Skim.app/Contents/MacOS/Skim'
alias cala='nvim ~/.config/alacritty/alacritty.yml'
alias cyabai='nvim ~/.config/yabai/yabairc'
alias cyazi='nvim ~/.config/yazi/keymap.toml'
alias cskhd='nvim ~/.config/skhd/skhdrc'
alias csket='nvim ~/.config/sketchybar/sketchybarrc'
alias ckitty='nvim ~/.config/kitty/kitty.conf'
alias cwez='nvim ~/.config/wezterm/wezterm.lua'

alias c='clear'
alias lg='l | grep'
alias vi='nvim'
alias v='nvim'
alias vf='nvim $(fzf)'
Expand All @@ -155,56 +89,18 @@ alias gps='git push'
alias gpl='git pull'
alias upd='git pull; git add --all; git commit -m "update"; git push'
alias gitlog='git log --all --graph --pretty=format:"%Cred%h%Creset %C(bold blue)%an%Creset %s %Cgreen(%cr) %Creset" --abbrev-commit'
alias ls='ls'
alias lg='l | grep'
alias disablesleep='sudo pmset -a disablesleep 1'
alias enablesleep='sudo pmset -a disablesleep 0'
alias op='open .'
function pdf() {
sioyek "$1" &
}
alias tt='toggle_alacritty_opacity'
alias jo='joshuto'
# alias a='joshuto'
alias bs='brew search'
alias bi='brew install'
alias gsu='git submodule update --remote'
alias gsi='git submodule init'
alias skim='/Applications/Skim.app/Contents/MacOS/Skim'
alias ca='ipython --profile=calculate'

alias szsh='source ~/.zshrc'
alias czsh='nvim ~/.zshrc'
alias cala='nvim ~/.config/alacritty/alacritty.yml'
alias cyabai='nvim ~/.config/yabai/yabairc'
alias cyazi='nvim ~/.config/yazi/keymap.toml'
alias cskhd='nvim ~/.config/skhd/skhdrc'
alias csket='nvim ~/.config/sketchybar/sketchybarrc'
alias ckitty='nvim ~/.config/kitty/kitty.conf'
alias cwez='nvim ~/.config/wezterm/wezterm.lua'

alias ca='ipython --profile=calculate'

alias ai='conda activate ai'
alias qq='conda activate QCX'


# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/hanyu_yan/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/hanyu_yan/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/hanyu_yan/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/hanyu_yan/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
alias qcx='conda activate QCX'



# source /opt/homebrew/share/powerlevel10k/powerlevel10k.zsh-theme
#
# # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
eval "$(zoxide init zsh)"
eval "$(starship init zsh)"

0 comments on commit 622ebc4

Please sign in to comment.