Skip to content

Instantly share code, notes, and snippets.

@Maple-pro

Maple-pro/.zshrc Secret

Last active May 7, 2024 12:48
Show Gist options
  • Save Maple-pro/296474db4107f64941e009b203bbe162 to your computer and use it in GitHub Desktop.
Save Maple-pro/296474db4107f64941e009b203bbe162 to your computer and use it in GitHub Desktop.
My `~/.zshrc` file
# 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.
export ZSH="$HOME/.oh-my-zsh"
export PATH="$PATH:/opt/cuda/bin:/home/yangfeng/Android/Sdk/platform-tools"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/targets/x86_64-linux/lib"
# export KOTSUITE_PUBLISH_TOKEN="perm:MjAxODMwMjExMDQyMQ==.OTItODExNw==.7xe5rE9ZXYQh8bGMi3Ob1KbcQpXrXg"
# 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="lambda"
# 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 one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 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.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #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.
plugins=(git)
source $ZSH/oh-my-zsh.sh
source /usr/share/nvm/init-nvm.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 setproxy='export HTTP_PROXY=http://127.0.0.1:7890;export HTTPS_PROXY=http://127.0.0.1:7890;export ALL_PROXY=socks5://127.0.0.1:7890'
alias unsetproxy='unset HTTP_PROXY HTTPS_PROXY ALL_PROXY'
alias setgitproxy='git config --global http.proxy "http://127.0.0.1:7890";git config --global https.proxy "http://127.0.0.1:7890"'
alias unsetgitproxy='git config --global --unset http.proxy; git config --global --unset https.proxy'
alias reclash="sudo systemctl restart clash"
alias updateclash="sudo wget 'https://api.balala.top/net/67d58cf047f2a63b?app=clash' -O /etc/clash/config.yaml"
alias tonvidia="prime-offload;optimus-manager --switch nvidia"
alias tointel="prime-offload;optimus-manager --switch integrated"
alias showgpu="glxinfo | grep 'OpenGL renderer'"
alias startyakuake="nohup yakuake > ~/Documents/log/yakuake.log &"
alias startoptimusqt="nohup optimus-manager-qt > ~/Documents/log/optimus-manager-qt.log &"
alias nvidia="__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
# Mount windows disk
alias mountwin="sudo mkdir /run/media/yangfeng/Windows-SSD;sudo mount -o rw /dev/nvme0n1p3 /run/media/yangfeng/Windows-SSD"
alias umountwin="sudo umount -v /run/media/yangfeng/Windows-SSD;sudo rm -r /run/media/yangfeng/Windows-SSD"
# Start wine in zh_CN
alias chwine="env LANG=zh_CN.UTF-8 wine"
# Extend external monitor to left/right, scale it to 1.5x1.5, and set the built-in monitor refresh rate to 60MHz
alias monleft="xrandr --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --scale 2x2 --output eDP-1-1 --mode 2560x1600 --pos 2880x0 --rotate normal --rate 60.00;xrandr --output HDMI-0 --scale 1.5x1.5"
alias monright="xrandr --output eDP-1-1 --mode 2560x1600 --pos 0x0 --rotate normal --rate 60.00 --output HDMI-0 --mode 1920x1080 --pos 2560x0 --rotate normal --scale 2x2;xrandr --output HDMI-0 --scale 1.5x1.5"
# Restart KDE
alias restartkde="kquitapp5 plasmashell || killall plasmashell && kstart5 plasmashell &"
# restart kwin: kwin_x11 --replace
# pbcopy & pbpaste
alias pbcopy="xclip -selection clipboard"
alias pbpaste="xclip -selection clipboard -o"
alias d="nohup dolphin . 1>~/.cache/nohup_log/dolphin.out 2>~/.cache/nohup_log/dolphin.err &"
# upload clipboard image and get markdown image link on clipboard
# alias uploadimg='echo "![]($(picgo upload | tail -n +6))" | xclip -selection clipboard'
function _upload_image() {
local output=$(picgo upload)
local image_url=$(echo "$output" | grep -o "https://.*")
echo "![]($image_url)" | xclip -selection clipboard
echo "Image URL copied to clipboard: $image_url"
}
alias uploadimg='_upload_image'
alias unzipch="unzip -O CP936"
alias ff="find /home/yangfeng/Documents/Personal -type f | fzf -m | xargs -d '\n' -r -n 1 xdg-open"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/yangfeng/mambaforge/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/yangfeng/mambaforge/etc/profile.d/conda.sh" ]; then
. "/home/yangfeng/mambaforge/etc/profile.d/conda.sh"
else
export PATH="/home/yangfeng/mambaforge/bin:$PATH"
fi
fi
unset __conda_setup
if [ -f "/home/yangfeng/mambaforge/etc/profile.d/mamba.sh" ]; then
. "/home/yangfeng/mambaforge/etc/profile.d/mamba.sh"
fi
# <<< conda initialize <<<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment