refractor: Reorganise dotfiles structures

This commit is contained in:
js0ny 2024-11-29 23:28:18 +00:00
parent 2bd9138a5f
commit bd5ca49c3e
131 changed files with 43 additions and 114 deletions

48
platforms/mac/.zshrc Normal file
View file

@ -0,0 +1,48 @@
# $XDG_CONFIG_HOME/zsh/.zshrc
# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc
### Variables ###
export DOTFILES="$HOME/.dotfiles"
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH
for file in $DOTFILES/zsh/*.zsh; do
source $file
done
export ARCHFLAGS="-arch arm64"
### Navigation ###
# Absolute navigation
alias doku="cd ~/doku && ls"
alias docs="cd ~/Documents"
alias dt="cd ~/Desktop"
alias down="cd ~/Downloads"
alias one="cd ~/OneDrive"
alias gdrive="cd ~/Google\ Drive"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# >>> juliaup initialize >>>
# !! Contents within this block are managed by juliaup !!
path=('$HOME/.juliaup/bin' $path)
export PATH
# <<< juliaup initialize <<<
# macOS #
alias xclip="pbcopy"
alias clip="pbcopy"

View file

@ -0,0 +1,24 @@
# $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1
# ln -sf $DOTFILES/mac/Microsoft.PowerShell_profile.ps1 $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1
### Variables ###
$DOTFILES = "$HOME/.dotfiles"
### Load Configs ###
Get-ChildItem -Path $DOTFILES/powershell -Filter *.ps1 | ForEach-Object {. $_}
Get-ChildItem -Path $DOTFILES/powershell_private -Filter *.ps1 | ForEach-Object {. $_}
## Aliases ###
# PowerShell Equivalents #
# Set-Alias "curl" "Invoke-WebRequest"
# Set-Alias "man" "Get-Help"
Set-Alias "kill" "Stop-Process"
Set-Alias "open" "Invoke-Item" # Use ii instead of open
# Dev #
${function:zshcfg} = { nvim ~/.zshrc }
${function:bashcfg} = { nvim ~/.bashrc }

View file

@ -0,0 +1,26 @@
{
"description": "CapsLock to ESC (alone) or LCommand (withKeys)",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_command"
}
],
"to_if_alone": [
{
"key_code": "escape"
}
],
"type": "basic"
}
]
}

View file

@ -0,0 +1,24 @@
{
"description": "Map fn+tab to cmd+tab",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"key_code": "tab",
"modifiers": [
"left_command"
]
}
],
"type": "basic"
}
]
}

View file

@ -0,0 +1,215 @@
{
"profiles": [
{
"complex_modifications": {
"rules": [
{
"description": "Caps Lock to Esc and Ctrl",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_control" }],
"to_if_alone": [{ "key_code": "escape" }],
"type": "basic"
}
]
},
{
"description": "Change left_control+hnei to arrow keys",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "i",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 626,
"vendor_id": 5426
},
"ignore": false,
"mouse_flip_y": true,
"simple_modifications": [
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "right_control" }]
},
{
"from": { "key_code": "left_control" },
"to": [{ "key_code": "left_command" }]
}
]
},
{
"identifiers": {
"is_pointing_device": true,
"product_id": 45088,
"vendor_id": 1133
},
"ignore": false,
"mouse_flip_vertical_wheel": true
}
],
"name": "Default profile",
"selected": true,
"simple_modifications": [
{
"from": { "apple_vendor_top_case_key_code": "keyboard_fn" },
"to": [{ "key_code": "left_command" }]
},
{
"from": { "key_code": "left_command" },
"to": [{ "apple_vendor_top_case_key_code": "keyboard_fn" }]
}
],
"virtual_hid_keyboard": { "keyboard_type_v2": "ansi" }
},
{
"complex_modifications": {
"rules": [
{
"description": "Change left_control+hnei to arrow keys",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "i",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 626,
"vendor_id": 5426
},
"ignore": false,
"mouse_flip_y": true,
"simple_modifications": [
{
"from": { "key_code": "left_command" },
"to": [{ "key_code": "right_control" }]
},
{
"from": { "key_code": "left_control" },
"to": [{ "key_code": "left_command" }]
}
]
},
{
"identifiers": {
"is_pointing_device": true,
"product_id": 45088,
"vendor_id": 1133
},
"ignore": false,
"mouse_flip_vertical_wheel": true
}
],
"name": "Default profile (copy)",
"simple_modifications": [
{
"from": { "apple_vendor_top_case_key_code": "keyboard_fn" },
"to": [{ "key_code": "left_command" }]
},
{
"from": { "key_code": "left_command" },
"to": [{ "apple_vendor_top_case_key_code": "keyboard_fn" }]
}
],
"virtual_hid_keyboard": { "keyboard_type_v2": "ansi" }
}
]
}

View file

@ -0,0 +1,4 @@
# Karabiner
- `karabiner.json` is the configuration file for Karabiner-Elements, located in `~/.config/karabiner/`.
- Other files are considered as snippets for the configuration file.

View file

@ -0,0 +1,21 @@
# $XDG_CONFIG_HOME/neovide/config.toml
# ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml
# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/neovide/config.toml -Value $DOTFILES\mac\neovide.toml (Mac)
# https://neovide.dev/config-file.html?highlight=toml#config-file
fork = false
frame = "full"
idle = true
maximized = false
neovim-bin = "/opt/homebrew/bin/nvim"
no-multigrid = false
srgb = false
tabs = true
theme = "auto"
title-hidden = true
vsync = true
wsl = false
[font]
normal = ["CaskaydiaCove Nerd Font"] # Will use the bundled Fira Code Nerd Font by default
size = 14.0

0
platforms/mac/readme.md Normal file
View file

View file

@ -0,0 +1,33 @@
# pip
alias pip=pip3
alias python=python3
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# npm
npm config set registry https://registry.npmmirror.com
# Homebrew
# 手动设置
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。
# 如果需要使用 Homebrew 的开发命令 (如 `brew cat <formula>`),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。
# 请按需执行如下两行命令:
brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像
brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git
brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git
brew update
# 或使用下面的几行命令自动设置
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
for tap in core cask{,-fonts,-versions} command-not-found services; do
brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git"
done
brew update

View file

@ -0,0 +1,4 @@
tell application "Finder"
activate
make new Finder window
end tell