mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(zsh): Finished reorganise zsh with a same entry point for all platforms
This commit is contained in:
parent
bd5ca49c3e
commit
2b21b63a13
22 changed files with 503 additions and 369 deletions
89
tools/zsh/mod/alias.zsh
Normal file
89
tools/zsh/mod/alias.zsh
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
# $DOTFILES/tools/zsh/mod/alias.zsh
|
||||
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
||||
|
||||
# PowerShell Equivalent, for cross-platform compatibility
|
||||
alias ni=touch
|
||||
alias cls=clear
|
||||
alias ii=open
|
||||
|
||||
# Dev #
|
||||
alias gpp='g++ -std=c++2b' # Set the default C++ standard to C++20
|
||||
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
||||
alias cl='clang -std=c99'
|
||||
alias clpp='clang++ -std=c++2b'
|
||||
alias python=python3 # Set the default Python version to Python 3
|
||||
alias py=python # Alias for Python
|
||||
alias pip=pip3 # Alias for pip
|
||||
# alias bashcfg="nvim ~/.bashrc"
|
||||
alias zshcfg="nvim $ZDOTDIR/.zshrc"
|
||||
alias shcfg=zshcfg
|
||||
alias reload="source $ZDOTDIR/.zshrc"
|
||||
alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/"
|
||||
alias pulldots="cd $DOTFILES && git pull"
|
||||
|
||||
# Editors #
|
||||
alias v=nvim
|
||||
alias c=code
|
||||
alias sv="sudo vim"
|
||||
alias sn="sudo nvim"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null; then
|
||||
alias ls='lsd -A'
|
||||
alias l='lsd -lah'
|
||||
alias ll='lsd -l'
|
||||
alias tree='lsd --tree'
|
||||
fi
|
||||
|
||||
# Functions #
|
||||
mkcd() {
|
||||
mkdir -p $1 && cd $1
|
||||
}
|
||||
cdls(){
|
||||
cd $1 && ls
|
||||
}
|
||||
tc(){
|
||||
touch $1 && code $1
|
||||
}
|
||||
tv(){
|
||||
touch $1 && nvim $1
|
||||
}
|
||||
|
||||
# Use neovide as gVim
|
||||
gvi() {
|
||||
local target=$1
|
||||
|
||||
if command -v neovide.exe > /dev/null; then
|
||||
neovide.exe "$target"
|
||||
else
|
||||
if command -v neovide > /dev/null; then
|
||||
neovide "$target"
|
||||
else
|
||||
echo "neovide is not installed"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
alias update="source $DOTFILES/scripts/update.zsh"
|
||||
|
||||
if command -v pacman > /dev/null; then
|
||||
alias pac="sudo pacman"
|
||||
alias paci="sudo pacman -S"
|
||||
alias pacr="sudo pacman -R"
|
||||
alias pacu="sudo pacman -Syu"
|
||||
fi
|
||||
|
||||
if command -v apt > /dev/null; then
|
||||
alias apt="sudo apt"
|
||||
alias apti="sudo apt install"
|
||||
alias aptu="sudo apt update && sudo apt upgrade"
|
||||
alias aptr="sudo apt autoremove && sudo apt remove"
|
||||
fi
|
||||
|
||||
if command -v brew > /dev/null; then
|
||||
alias brewi="brew install"
|
||||
alias brewu="brew update && brew upgrade"
|
||||
alias brewc="brew cleanup"
|
||||
alias brewr="brew uninstall"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue