mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
docs: Add documentational comments
This commit is contained in:
parent
1b050a13a8
commit
68ff1bb357
30 changed files with 732 additions and 562 deletions
|
|
@ -1,43 +0,0 @@
|
|||
#! /bin/bash
|
||||
# $DOTFILES/bootstrap/set_symblink_unix.bash
|
||||
# Date: 2024-12-01
|
||||
# Author: js0ny
|
||||
# Set symbolic links for Unix-like systems
|
||||
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython $XDG_CONFIG_HOME/lazygit
|
||||
# Not support XDG_CONFIG_HOME but same directory
|
||||
mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow
|
||||
# mkdir -p $WAKATIME_HOME
|
||||
# mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view
|
||||
# $DOTFILES/common
|
||||
ln -sf $DOTFILES/common/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc
|
||||
# ln -sf $DOTFILES/common/gitconfig $XDG_CONFIG_HOME/git/config
|
||||
cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config
|
||||
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
|
||||
ln -sf $DOTFILES/common/haskeline ~/.haskeline
|
||||
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
|
||||
ln -sf $DOTFILES/common/lazygit.yaml $XDG_CONFIG_HOME/lazygit/config.yml
|
||||
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
|
||||
# ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
|
||||
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
|
||||
ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
|
||||
ln -sf $DOTFILES/common/starship.toml ~/.config/starship.toml
|
||||
ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
|
||||
ln -sf $DOTFILES/common/vimrc $XDG_CONFIG_HOME/vim/vimrc
|
||||
ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl
|
||||
# $DOTFILES/tools
|
||||
ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython
|
||||
ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim
|
||||
ln -sf $DOTFILES/tools/yazi/config/keymap.toml ~/.config/yazi/keymap.toml
|
||||
ln -sf $DOTFILES/tools/yazi/config/yazi.toml ~/.config/yazi/yazi.toml
|
||||
ln -sf $DOTFILES/tools/fish ~/.config
|
||||
|
||||
|
||||
if [ $(uname) = "Darwin" ]; then
|
||||
mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar
|
||||
ln -sf $DOTFILES/platforms/mac/karabiner/karabiner.json ~/.config/karabiner/karabiner.json
|
||||
ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
|
||||
ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc
|
||||
ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc
|
||||
else
|
||||
ln -sf $DOTFILES/common/inputrc ~/.inputrc
|
||||
fi
|
||||
106
bootstrap/set_symlink_unix.sh
Normal file
106
bootstrap/set_symlink_unix.sh
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#! /usr/bin/env bash
|
||||
# $DOTFILES/bootstrap/set_symlink_unix.sh
|
||||
# Date: 2025-01-28
|
||||
# Author: js0ny
|
||||
# Set symbolic links for Unix-like systems
|
||||
# IMPORTANT: The default `bash` in macOS is outdated, run with zsh or install the latest `bash` via Homebrew
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status
|
||||
|
||||
DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
|
||||
ZDOTDIR="${ZDOTDIR:-$HOME/.config/zsh}"
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG:-$XDG_CONFIG_HOME/npm/npmrc}"
|
||||
|
||||
mkdir -p $ZDOTDIR/plugins
|
||||
|
||||
echo "[INFO] Setting up system-wide zsh configuration"
|
||||
echo "[ACTION] Elevation required!"
|
||||
test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zsh/zshenv"
|
||||
test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zshenv"
|
||||
|
||||
declare -A linkDots
|
||||
|
||||
linkDots=(
|
||||
["$DOTFILES/common/condarc.yaml"]="$XDG_CONFIG_HOME/conda/.condarc"
|
||||
# ["$DOTFILES/common/gitconfig"]="$XDG_CONFIG_HOME/git/config"
|
||||
["$DOTFILES/common/glow.yaml"]="$HOME/.config/glow/config.yml"
|
||||
["$DOTFILES/common/haskeline"]="$HOME/.haskeline"
|
||||
["$DOTFILES/common/ideavimrc"]="$XDG_CONFIG_HOME/ideavim/ideavimrc"
|
||||
["$DOTFILES/common/lazygit.yaml"]="$XDG_CONFIG_HOME/lazygit/config.yml"
|
||||
["$DOTFILES/common/lesskey"]="$XDG_CONFIG_HOME/lesskey"
|
||||
["$DOTFILES/common/npmrc"]="$NPM_CONFIG_USERCONFIG"
|
||||
["$DOTFILES/common/NuGet.Config"]="$XDG_CONFIG_HOME/NuGet/NuGet.Config"
|
||||
["$DOTFILES/common/pip.conf"]="$XDG_CONFIG_HOME/pip/pip.conf"
|
||||
["$DOTFILES/common/starship.toml"]="$HOME/.config/starship.toml"
|
||||
["$DOTFILES/common/tmux.conf"]="$XDG_CONFIG_HOME/tmux/tmux.conf"
|
||||
["$DOTFILES/common/vimrc"]="$XDG_CONFIG_HOME/vim/vimrc"
|
||||
["$DOTFILES/common/zellij.config.kdl"]="$HOME/.config/zellij/config.kdl"
|
||||
["$DOTFILES/tools/emacs.d"]="$HOME/.emacs.d"
|
||||
["$DOTFILES/tools/fish"]="$HOME/.config/fish"
|
||||
["$DOTFILES/tools/ipython"]="$XDG_CONFIG_HOME/ipython"
|
||||
["$DOTFILES/tools/nvim"]="$XDG_CONFIG_HOME/nvim"
|
||||
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
|
||||
["$DOTFILES/tools/yazi"]="$HOME/.config/yazi"
|
||||
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
|
||||
["$DOTFILES/tools/zsh/common.zshrc"]="$ZDOTDIR/.zshrc"
|
||||
["$DOTFILES/tools/zsh/.zshenv"]="$ZDOTDIR/.zshenv"
|
||||
)
|
||||
|
||||
if [ $(uname) = "Darwin" ]; then
|
||||
linkDots+=(
|
||||
["$DOTFILES/platforms/mac/karabiner"]="$HOME/.config/karabiner"
|
||||
["$DOTFILES/platforms/mac/skhdrc"]="$XDG_CONFIG_HOME/skhd/skhdrc"
|
||||
["$DOTFILES/platforms/mac/sketchybarrc"]="$XDG_CONFIG_HOME/sketchybar/sketchybarrc"
|
||||
["$DOTFILES/platforms/mac/yabairc"]="$XDG_CONFIG_HOME/yabai/yabairc"
|
||||
)
|
||||
else
|
||||
linkDots+=(
|
||||
["$DOTFILES/common/inputrc"]="$HOME/.inputrc"
|
||||
)
|
||||
if [ -n "$WSL_DISTRO_NAME" ]; then
|
||||
else
|
||||
linkDots+=(
|
||||
["$DOTFILES/platforms/linux/awesome"]="$HOME/.config/awesome"
|
||||
["$DOTFILES/platforms/linux/hypr"]="$HOME/.config/hypr"
|
||||
["$DOTFILES/platforms/linux/waybar"]="$HOME/.config/waybar"
|
||||
["$DOTFILES/platforms/linux/wlogout"]="$HOME/.config/wlogout"
|
||||
["$DOTFILES/platforms/linux/mako-config"]="$HOME/.config/mako/config"
|
||||
)
|
||||
for kde in "$DOTFILES/platforms/linux/kde/"*; do
|
||||
linkDots=["$kde"]="$HOME/.config/kde/$(basename $kde)"
|
||||
# echo "Linking $kde to $HOME/.config/kde/$(basename $kde)"
|
||||
done
|
||||
echo "[INFO] Setting up system environment variables"
|
||||
echo "[ACTION] Elevation required!"
|
||||
sudo cp "$DOTFILES/platforms/linux/etc/environment" "/etc/environment"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[INFO] Setting up symbolic links"
|
||||
for src in "${!linkDots[@]}"; do
|
||||
dest="${linkDots[$src]}"
|
||||
if [ -d "$src" ]; then
|
||||
mv $dest $dest.bak
|
||||
mkdir -p $dest
|
||||
ln -sf $src $dest
|
||||
elif [ -f "$src" ]; then
|
||||
dest_parent=$(dirname $dest)
|
||||
mkdir -p $dest_parent
|
||||
ln -sf $src $dest
|
||||
else
|
||||
echo "[ERROR] $src does not exist"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[INFO] Installing zsh plugins"
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search
|
||||
|
||||
echo "[INFO] Copying example files"
|
||||
cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config
|
||||
|
||||
export ZDOTDIR
|
||||
export DOTFILES
|
||||
export NPM_CONFIG_USERCONFIG
|
||||
|
|
@ -4,45 +4,64 @@
|
|||
# Set symlinks for dotfiles on Windows
|
||||
# 在 Windows 上设置 配置文件的符号链接
|
||||
|
||||
# Run this with Administrator privileges
|
||||
|
||||
$DOTFILES = Join-Path $Env:UserProfile ".dotfiles"
|
||||
$BASE_COMMON = Join-Path $DOTFILES "common"
|
||||
$BASE_TOOLS = Join-Path $DOTFILES "tools"
|
||||
$BASE_WIN = Join-Path $DOTFILES "platforms" "win"
|
||||
$STARTUP = [System.Environment]::GetFolderPath("Startup")
|
||||
|
||||
$BAT_CONF = Join-Path $Env:AppData "bat" "config"
|
||||
if ((Get-Command bat).Source -ccontains "scoop") {
|
||||
$BAT_CONF = Join-Path (scoop prefix bat) "config"
|
||||
}
|
||||
|
||||
$linkDots = @{
|
||||
"$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig"
|
||||
"$BASE_WIN\glzr" = "$Env:UserProfile\.glzr"
|
||||
"$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml"
|
||||
"$BASE_WIN\vsvimrc" = "$Env:UserProfile\.vsvimrc"
|
||||
"$BASE_COMMON\bat.config" = "$BAT_CONF"
|
||||
"$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc"
|
||||
"$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig"
|
||||
"$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml"
|
||||
"$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline"
|
||||
"$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc"
|
||||
"$BASE_COMMON\lazygit.yaml" = "$Env:AppData\lazygit\config.yml"
|
||||
"$BASE_COMMON\lesskey" = "$Env:LessKeyIn"
|
||||
"$BASE_COMMON\lsd" = "$Env:AppData\lsd\config.yaml"
|
||||
"$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG"
|
||||
"$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config"
|
||||
"$BASE_COMMON\starship.toml" = "$Env:UserProfile\.config\starship.toml"
|
||||
"$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini"
|
||||
"$BASE_COMMON\vimrc.noxdg.vimrc" = "$Env:UserProfile\_vimrc"
|
||||
"$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR"
|
||||
"$BASE_COMMON\emacs.d" = "$Env:AppData\.emacs.d"
|
||||
"$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR"
|
||||
"$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim"
|
||||
"$BASE_TOOLS\wezterm" = "$Env:XDG_CONFIG_HOME\wezterm"
|
||||
"$BASE_TOOLS\yazi" = "$Env:AppData\yazi\config"
|
||||
"$BASE_TOOLS\zed" = "$Env:AppData\Zed"
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($target in $linkDots.Keys) {
|
||||
$path = $linkDots[$target]
|
||||
foreach ($src in $linkDots.Keys) {
|
||||
$dest = $linkDots[$src]
|
||||
# Auto create directories (Untested)
|
||||
$dir = Split-Path $path
|
||||
if (!(Test-Path $dir)) {
|
||||
New-Item -ItemType Directory -Path $dir -Force
|
||||
if (Test-Path -Path $src -PathType Container) {
|
||||
New-Item -ItemType Directory -Path $dest -Force
|
||||
}
|
||||
New-Item -ItemType SymbolicLink -Target $target -Path $path -Force
|
||||
else {
|
||||
$Local:destParent = Split-Path -Path $dest -Parent
|
||||
New-Item -ItemType Directory -Path $destParent -Force
|
||||
}
|
||||
if (Test-Path -Path $dest) {
|
||||
Move-Item $dest "$dest.bak" -Force
|
||||
}
|
||||
New-Item -ItemType SymbolicLink -Target $src -Path $dest -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$Env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force
|
||||
|
||||
Copy-Item (Join-Path $BASE_WIN "ahk" "bin" "Caps.exe") $STARTUP
|
||||
Copy-Item (Join-Path $BASE_COMMON "gitconfig") $Env:UserProfile
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
set -e
|
||||
ZDOTDIR="${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}"
|
||||
mkdir -p $ZDOTDIR/plugins
|
||||
|
||||
#plugins=(
|
||||
# "zsh-autosuggestions"
|
||||
# "zsh-syntax-highlighting"
|
||||
# "zsh-history-substring-search"
|
||||
#)
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting
|
||||
git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search
|
||||
Loading…
Add table
Add a link
Reference in a new issue