Initial Commit

This commit is contained in:
js0ny 2024-07-19 19:49:26 +08:00
commit 40e939bfb4
42 changed files with 4349 additions and 0 deletions

139
mac/.zshrc Normal file
View file

@ -0,0 +1,139 @@
### Variables ###
export DOTFILES="$HOME/.dotfiles"
### ZSH Config ###
set -o vi
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="avit"
# DISABLE_MAGIC_FUNCTIONS="true"
# DISABLE_LS_COLORS="true"
# DISABLE_AUTO_TITLE="true"
# 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"
HIST_STAMPS="yyyy-mm-dd"
plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
# export MANPATH="/usr/local/man:$MANPATH"
# export LANG= "en_US.UTF-8"
export ARCHFLAGS="-arch arm64"
### Navigation ###
# Relative navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
# Absolute navigation
alias doku="cd ~/doku && ls"
alias dotfiles="cd $DOTFILES && ls"
### Aliases ###
# `alias` to list all aliases
# PowerShell Equivalent #
alias ni=touch
alias cls=clear
# Dev #
alias g++='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'
alias cl++='clang++'
alias python=python3 # Set the default Python version to Python 3
alias py=python # Alias for Python
alias bashcfg="nvim ~/.bashrc"
alias zshcfg="nvim ~/.zshrc"
alias shcfg=zshcfg
alias nvimrc="nvim ~/.config/nvim/"
alias ohmyzsh="code ~/.oh-my-zsh"
# Editors #
alias v=nvim
alias gvi=neovide
alias c=code
# Misc #
alias cf=cfiles
### Functions ###
mcd() {
mkdir -p -- "$1" && cd -P -- "$1"
}
cdls(){
cd $1 && ls
}
tc(){
touch $1 && code $1
}
tv(){
touch $1 && nvim $1
}
source ~/.private.env.sh
### WSL Options ###
# WSL open
open() {
local target=$1
if command -v explorer.exe > /dev/null; then
explorer.exe "$target"
else
command open "$target"
fi
}
# WSL Neovide
neovide() {
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
}
### Misc ###
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
. "$HOME/miniconda3/etc/profile.d/conda.sh"
else
export PATH="$HOME/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

View file

@ -0,0 +1,95 @@
### Variables ###
$DOTFILES = "$HOME\.dotfiles"
### PSReadLine ###
Set-PSReadLineOption -EditMode vi # Vi Keybindings
Set-PSReadLineOption -PredictionViewStyle ListView # Prediction View Style
Set-PSReadLineOption -PredictionSource HistoryAndPlugin # Prediction Source
Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Continuation Prompt
### Keybindings ###
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord
### Navigator ###
# Relative navigation #
# ${function:~} = { Set-Location -Path ~ } cd is better
${function:...} = { Set-Location -Path ..\.. }
${function:....} = { Set-Location -Path ..\..\.. }
${function:.....} = { Set-Location -Path ..\..\..\.. }
${function:......} = { Set-Location -Path ..\..\..\..\.. }
# Absolute navigation #
${function:docs} = { Set-Location -Path ~\Documents }
${function:down} = { Set-Location -Path ~\Downloads }
${function:dt} = { Set-Location -Path ~\Desktop }
${function:mytmp} = { Set-Location -Path ~\Temp }
${function:one} = { Set-Location -Path ~\OneDrive }
${function:doku} = { Set-Location -Path ~\doku && Get-ChildItem }
### Aliases ###
# PowerShell Equivalents #
Set-Alias "touch" "New-Item"
Set-Alias "ll" "Get-ChildItem"
Set-Alias "curl" "Invoke-WebRequest"
Set-Alias "cd" "Set-Location"
Set-Alias "man" "Get-Help"
Set-Alias "kill" "Stop-Process"
# Dev #
${function:shcfg} = { code $PROFILE }
${function:zshcfg} = { nvim ~/.zshrc }
${function:bashcfg} = { nvim ~/.bashrc }
${function:reload} = { Invoke-Expression $PROFILE }
${function:csi} = { dotnet script }
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
Set-Alias "pwshcfg" "shcfg"
Set-Alias "python3" "python"
Set-Alias "pip3" "pip"
Set-Alias "py" "python"
Set-Alias "cl" "clang"
Set-Alias "cl++" "clang++"
Set-Alias "clang" "clang -std=c99"
Set-Alias "clang++" "clang++ -std=c++2b"
# Editors #
Set-Alias "v" "nvim"
Set-Alias "c" "code"
Set-Alias "gvi" "neovide"
# Miscs #
Set-Alias mcd CreateAndSet-Directory
### Functions ###
function tc { param ( [string] $filename)
New-Item $filename && code $filename
}
function tv { param ( [string] $filename)
New-Item $filename && nvim $filename
}
function cdls { param( [string] $dirname)
Set-Location $dirname && Get-ChildItem
}
### Modules ###
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
Import-Module CompletionPredictor
### Misc ###