sync: from macOS 2024-12-05

This commit is contained in:
js0ny 2024-12-05 20:06:17 +00:00
parent 7d220c3873
commit 053304c4d5
39 changed files with 1025 additions and 379 deletions

2
.gitattributes vendored
View file

@ -1,6 +1,6 @@
# $DOTFILES/.gitattributes # $DOTFILES/.gitattributes
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
skhdrc linguist-language=Shell skhdrc linguist-language=Shell
yabairc linguist-language=Shell yabairc linguist-language=Shell
sketchybarrc linguist-language=Shell sketchybarrc linguist-language=Shell

View file

@ -15,15 +15,14 @@
// ], // ],
// "description": "Log output to console" // "description": "Log output to console"
// } // }
"Dotfiles": { "Dotfiles": {
"scope": "", "scope": "",
"prefix": "init", "prefix": "init",
"body": [ "body": [
"$LINE_COMMENT \\$DOTFILES/$RELATIVE_FILEPATH", "$LINE_COMMENT \\$DOTFILES/$RELATIVE_FILEPATH",
"$LINE_COMMENT Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE", "$LINE_COMMENT Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
"$LINE_COMMENT Author: contact@js0ny.net", "$LINE_COMMENT Author: js0ny",
"$LINE_COMMENT $0", "$LINE_COMMENT $0",
] ]
}
} }
}

View file

@ -220,7 +220,7 @@ mas install 836500024 # WeChat
mas install 451108668 # QQ mas install 451108668 # QQ
# plum (Rime IME) # plum (Rime IME)
curl -fsSL https://raw.githubusercontent.com/rime/plum/master/rime-install | bash curl -fsSL https://raw.githubusercontent.com/rime/plum/master/rime-install -o $HOME | bash
# Set default apps (duti) # Set default apps (duti)
# The id of the app can be found by running # The id of the app can be found by running

5
bootstrap/set_path.ps1 Normal file
View file

@ -0,0 +1,5 @@
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "$Env:LocalAppData\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "$Env:LocalAppData\Go\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "$Env:LocalAppData\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User")

View file

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
# $DOTFILES/bootstrap/set_symblink_unix.bash # $DOTFILES/bootstrap/set_symblink_unix.bash
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Set symbolic links for Unix-like systems # 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 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
# Not support XDG_CONFIG_HOME but same directory # Not support XDG_CONFIG_HOME but same directory
@ -15,7 +15,6 @@ ln -sf $DOTFILES/common/gitconfig $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
@ -37,4 +36,6 @@ if [ $(uname) = "Darwin"]; then
ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc 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/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc
ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc
else
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
fi fi

View file

@ -1,6 +1,6 @@
# $DOTFILES\bootstrap\set_symlink_win.ps1 # $DOTFILES\bootstrap\set_symlink_win.ps1
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Set symlinks for dotfiles on Windows # Set symlinks for dotfiles on Windows
# 在 Windows 上设置 dotfiles 的符号链接 # 在 Windows 上设置 dotfiles 的符号链接
@ -23,7 +23,7 @@ $linkDots = @{
"$BASE_COMMON\NuGet.Config" = "$env:AppData\NuGet\NuGet.Config" "$BASE_COMMON\NuGet.Config" = "$env:AppData\NuGet\NuGet.Config"
"$BASE_COMMON\obsidian.vimrc" = "$env:UserProfile\Obsidian\.obsidian.vimrc" "$BASE_COMMON\obsidian.vimrc" = "$env:UserProfile\Obsidian\.obsidian.vimrc"
"$BASE_COMMON\pip.conf" = "$env:AppData\pip\pip.ini" "$BASE_COMMON\pip.conf" = "$env:AppData\pip\pip.ini"
"$BASE_COMMON\vim.noxdg.vimrc" = "$env:Vim\_vimrc" "$BASE_COMMON\vimrc" = "$env:Vim\_vimrc"
"$BASE_TOOLS\ipython" = "$env:IPYTHONDIR" "$BASE_TOOLS\ipython" = "$env:IPYTHONDIR"
"$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim" "$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim"
} }

View file

@ -3,8 +3,8 @@
# ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config # ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config
# New-Item -ItemType SymbolicLink -Path "$Env:XDG_CONFIG_HOME\git\config" -Target "$DOTFILES\.config\git\.gitconfig" # New-Item -ItemType SymbolicLink -Path "$Env:XDG_CONFIG_HOME\git\config" -Target "$DOTFILES\.config\git\.gitconfig"
[user] [user]
name = js0ny name = whoami
email = json.y@outlook.com email = whoami@example.com
[core] [core]
editor = nvim editor = nvim
pager = delta pager = delta

View file

@ -0,0 +1,11 @@
// ~/Library/Keybindings/DefaultKeyBinding.dict
{
// Colemak Vim Style Arrows
"^h" = "moveBackward:";
"^n" = "moveDown:";
"^e" = "moveUp:";
"^i" = "moveForward:";
// Colemak Vim Style Home/End, Insert & Append
"^l" = "moveToBeginningOfLine:";
"^a" = "moveToEndOfLine:";
}

View file

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)"
CHARGING="$(pmset -g batt | grep 'AC Power')"
if [ "$PERCENTAGE" = "" ]; then
exit 0
fi
case "${PERCENTAGE}" in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ "$CHARGING" != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"

View file

@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Some events send additional information specific to the event in the $INFO
# variable. E.g. the front_app_switched event sends the name of the newly
# focused application in the $INFO variable:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set "$NAME" label="$INFO"
fi

View file

@ -0,0 +1,8 @@
#!/bin/bash
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
ICON=""
sketchybar --set $NAME label="$music_info" icon="$ICON"

View file

@ -0,0 +1,7 @@
#!/bin/sh
# The $SELECTED variable is available for space components and indicates if
# the space invoking this script (with name: $NAME) is currently selected:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
sketchybar --set "$NAME" background.drawing="$SELECTED"

View file

@ -0,0 +1,20 @@
#!/bin/sh
# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.
if [ "$SENDER" = "volume_change" ]; then
VOLUME="$INFO"
case "$VOLUME" in
[6-9][0-9]|100) ICON="󰕾"
;;
[3-5][0-9]) ICON="󰖀"
;;
[1-9]|[1-2][0-9]) ICON="󰕿"
;;
*) ICON="󰖁"
esac
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
fi

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/sketchybarrc # $DOTFILES/platforms/mac/sketchybarrc
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# TODO: Reorganize this file # TODO: Reorganize this file
# This is a demo config to showcase some of the most important commands. # This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse. # It is meant to be changed and configured, as it is intentionally kept sparse.
@ -41,7 +41,7 @@ sketchybar --default "${default[@]}"
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item # https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces. # to indicate active and available mission control spaces.
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") SPACE_ICONS=("" "" "" "󰖟" "" "" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}" for i in "${!SPACE_ICONS[@]}"
do do
sid="$(($i+1))" sid="$(($i+1))"
@ -89,7 +89,7 @@ sketchybar --add item clock center \
--add item battery right \ --add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
--subscribe battery system_woke power_source_change \ --subscribe battery system_woke power_source_change \
--add item apple_music right --add item apple_music right
sketchybar --add item music right sketchybar --add item music right
sketchybar --set music \ sketchybar --set music \

View file

@ -1,36 +1,19 @@
# $DOTFILES/platforms/mac/skhdrc # $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Location: $XDG_CONFIG_HOME/skhd/skhdrc # Location: $XDG_CONFIG_HOME/skhd/skhdrc
# Linking: # Linking:
# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc # ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# Navigation # Navigation
cmd - h : yabai -m window --focus west alt - h : yabai -m window --focus west
cmd - n : yabai -m window --focus south alt - n : yabai -m window --focus south
cmd - e : yabai -m window --focus north alt - e : yabai -m window --focus north
cmd - i : yabai -m window --focus east alt - i : yabai -m window --focus east
# Moving windows # Moving windows
shift + cmd - h : yabai -m window --warp west shift + alt - h : yabai -m window --warp west
shift + cmd - n : yabai -m window --warp south shift + alt - n : yabai -m window --warp south
shift + cmd - e : yabai -m window --warp north shift + alt - e : yabai -m window --warp north
shift + cmd - i : yabai -m window --warp east shift + alt - i : yabai -m window --warp east
shift + alt - h : \
yabai -m window --resize left:-20:0 ; \
yabai -m window --resize right:-20:0
shift + alt - n : \
yabai -m window --resize bottom:0:20 ; \
yabai -m window --resize top:0:20
shift + alt - e : \
yabai -m window --resize top:0:-20 ; \
yabai -m window --resize bottom:0:-20
shift + alt - i : \
yabai -m window --resize right:20:0 ; \
yabai -m window --resize left:20:0

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# $DOTFILES/platforms/mac/yabairc # $DOTFILES/platforms/mac/yabairc
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# TODO: Reorganize this file # TODO: Reorganize this file
# #

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/zshrc # $DOTFILES/platforms/mac/zshrc
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用macOS 特定配置 # Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用macOS 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
@ -25,3 +25,4 @@ fi
unset __conda_setup unset __conda_setup
# <<< conda initialize <<< # <<< conda initialize <<<
alias start-twm="source $DOTFILES/scripts/__twm_osx_start.zsh"

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1 # $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# PowerShell profile for Windows # PowerShell profile for Windows
### Load Configs ### ### Load Configs ###

View file

@ -1,6 +1,6 @@
# $DOTFILES\platforms\win\wslconfig # $DOTFILES\platforms\win\wslconfig
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2) # Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2)
# 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络) # 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络)

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/wsl/zshrc # $DOTFILES/platforms/wsl/zshrc
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用WSL 特定配置 # Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用WSL 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)

View file

@ -0,0 +1,3 @@
yabai --start-service
skhd --start-service
brew services start sketchybar

View file

@ -0,0 +1,3 @@
yabai --stop-service
skhd --stop-service
brew services stop sketchybar

View file

@ -1,7 +1,9 @@
// Paste this into surfingkeys advanced settings // Paste this into surfingkeys advanced settings
// or use: // or use:
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js // Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js
// TODO: Visual Mode
// #region Example
/** Examples /** Examples
// an example to create a new mapping `ctrl-y` // an example to create a new mapping `ctrl-y`
@ -17,81 +19,110 @@ api.map('gt', 'T');
api.unmap('<ctrl-i>'); api.unmap('<ctrl-i>');
*/ */
// #endregion
// Settings // Settings
settings.language = "zh-CN" ; settings.language = "zh-CN";
settings.showModeStatus = false; settings.showModeStatus = false;
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main // Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
// #region Helper
const forward = { const forward = {
add: function (key) { // 转发即将被 unmap 的键 add: function (key) { // 转发即将被 unmap 的键
return api.map(`for${key}`, key) return api.map(`for${key}`, key)
}, },
cancel: function (key) { // 删除转发生成的键 cancel: function (key) { // 删除转发生成的键
api.unmap(`for${key}`) api.unmap(`for${key}`)
api.unmap(key) api.unmap(key)
}, },
use: function (key) { use: function (key) {
return `for${key}` return `for${key}`
} }
} }
const colemak = { const colemak = {
forward: function (key) { // 转发即将被 unmap 的键 forward: function (key) { // 转发即将被 unmap 的键
api.map(key, `col${key}`) api.map(key, `col${key}`)
api.unmap(`col${key}`) api.unmap(`col${key}`)
}, },
use: function (key) { use: function (key) {
return `col${key}` return `col${key}`
}, },
map: function (a, b) { map: function (a, b) {
api.map(colemak.use(a), forward.use(b)) api.map(colemak.use(a), forward.use(b))
} }
} }
const forwardFactory = { const forwardFactory = {
push: function (mapLists) { // forward original keys push: function (mapLists) { // forward original keys
for (let key in mapLists) { for (let key in mapLists) {
forward.add(mapLists[key]) forward.add(mapLists[key])
}
},
map: function (mapLists) {
for (let key in mapLists) {
colemak.map(key, mapLists[key])
} }
}, },
pull: function (mapLists) { map: function (mapLists) {
for (let key in mapLists) { for (let key in mapLists) {
forward.cancel(mapLists[key]) colemak.map(key, mapLists[key])
}
for (let key in mapLists) {
colemak.forward(key)
}
} }
},
pull: function (mapLists) {
for (let key in mapLists) {
forward.cancel(mapLists[key])
}
for (let key in mapLists) {
colemak.forward(key)
}
}
}
// #endregion
// #region Keymap
const mapLists = {
/// scroll page
// Arrow
'n': 'j',
'e': 'k',
'i': 'l',
// l <-> i
'l': 'i',
'L': 'I',
// k <-> n
'k': 'n',
'K': 'N',
// j <-> e
'j': 'e',
// PrevTab < H - I > NextTab
'H': 'E',
'I': 'R',
// E,N -> Up/Down HalfPage
'N': 'd',
'E': 'e',
// F -> Open Link in New Tab
'F': 'af',
// oH -> Tab History
'oH': 'H',
// gh/gi -> Prev/Next History
'gh': 'S',
'gi': 'D',
// t -> Open Link in New Tab
't': 'gf',
// 缩放
'zu': 'zi',
'zo': 'ze',
'zz': 'zr',
} }
const mapLists = { const vmapLists = {
/// scroll page 'n': 'j',
// Arrow 'N': 'J',
'n': 'j', 'e': 'k',
'e': 'k', 'E': 'K',
'i': 'l', 'i': 'l',
// l <-> i 'I': 'L',
'l': 'i', 'j': 'e',
'L': 'I', 'J': 'E',
// k <-> n 'k': 'n',
'k': 'n', 'K': 'N',
'K': 'N',
// j <-> e
'j': 'e',
'J': 'E',
// 缩放
'zu': 'zi',
'zo': 'ze',
'zz': 'zr',
} }
forwardFactory.push(mapLists) forwardFactory.push(mapLists)
api.unmap('t')
forwardFactory.map(mapLists) forwardFactory.map(mapLists)
// 鼠标点击 // 鼠标点击
api.unmap('gi') api.unmap('gi')
@ -101,260 +132,297 @@ api.unmap(';m')
api.unmap(';fs') api.unmap(';fs')
api.unmap('O') api.unmap('O')
api.unmap('C') api.unmap('C')
api.map('g/', 'gU') // Goto Root Domain
forwardFactory.pull(mapLists) forwardFactory.pull(mapLists)
// #endregion
// Search Alias // #region Search Alias
api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text); var res = JSON.parse(response.text);
return res.map(function(r){ return res.map(function (r) {
return r.phrase; return r.phrase;
}); });
}); });
api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text); var res = JSON.parse(response.text);
return res.map(function(r){ return res.map(function (r) {
return r.phrase; return r.phrase;
}); });
}); });
api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function(response) { api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text); var res = JSON.parse(response.text);
return res.map(function(r){ return res.map(function (r) {
return r.phrase; return r.phrase;
}); });
}); });
api.addSearchAlias('c', 'ChatGPT', 'https://chatgpt.com/?q=', 's', 'https://duckduckgo.com/ac/?q=', function (response) {
var res = JSON.parse(response.text);
return res.map(function (r) {
return r.phrase;
});
});
// #endregion
// #region Site-specific
// Theme, reference to https://github.com/Foldex/surfingkeys-config // chatgpt.com
api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;'); api.unmap('t', /chatgpt.com/);
api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text"); api.mapkey('tn', 'New Chat', function () {
api.Visual.style('marks', 'background-color: #A3BE8C99;'); var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)')
api.Visual.style('cursor', 'background-color: #88C0D0;'); btn.click();
settings.theme = ` }, { domain: /chatgpt.com/ });
fg: #E5E9F0; api.mapkey('ts', 'Start/Stop Generating', function () {
bg: #3B4252; var btn = document.querySelector('button.h-8:nth-child(2)');
bg-dark: #2E3440; btn.click();
border: #4C566A; }, { domain: /chatgpt.com/ });
main-fg: #88C0D0; api.mapkey('ts', 'Start/Stop Generating', function () {
accent-fg: #A3BE8C; var btn = document.querySelector('button.h-8:nth-child(2)');
info-fg: #5E81AC; btn.click();
select: #4C566A; }, { domain: /chatgpt.com/ });
/* ---------- Generic ---------- */ api.mapkey('S', 'Start/Stop Generating', function () {
.sk_theme { var btn = document.querySelector('button.h-8:nth-child(2)');
background: var(--bg); btn.click();
color: var(--fg); }, { domain: /chatgpt.com/ });
background-color: var(--bg); //api.mapkey('tm', 'Toggle Model', function () {
border-color: var(--border); // var btn = document.querySelector('#radix -\: r2i\:');
font-family: var(--font); // btn.click();
font-size: var(--font-size); //}, { domain: /chatgpt.com/ });
font-weight: var(--font-weight);
}
input { // #endregion
font-family: var(--font);
font-weight: var(--font-weight);
}
.sk_theme tbody { // #region Theme
color: var(--fg); // reference to https://github.com/Foldex/surfingkeys-config
} // api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;');
// api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text");
// api.Visual.style('marks', 'background-color: #A3BE8C99;');
// api.Visual.style('cursor', 'background-color: #88C0D0;');
// settings.theme = `
// fg: #E5E9F0;
// bg: #3B4252;
// bg-dark: #2E3440;
// border: #4C566A;
// main-fg: #88C0D0;
// accent-fg: #A3BE8C;
// info-fg: #5E81AC;
// select: #4C566A;
// /* ---------- Generic ---------- */
// .sk_theme {
// background: var(--bg);
// color: var(--fg);
// background-color: var(--bg);
// border-color: var(--border);
// font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// }
.sk_theme input { // input {
color: var(--fg); // font-family: var(--font);
} // font-weight: var(--font-weight);
// }
/* Hints */ // .sk_theme tbody {
#sk_hints .begin { // color: var(--fg);
color: var(--accent-fg) !important; // }
}
#sk_tabs .sk_tab { // .sk_theme input {
background: var(--bg-dark); // color: var(--fg);
border: 1px solid var(--border); // }
}
#sk_tabs .sk_tab_title { // /* Hints */
color: var(--fg); // #sk_hints .begin {
} // color: var(--accent-fg) !important;
// }
#sk_tabs .sk_tab_url { // #sk_tabs .sk_tab {
color: var(--main-fg); // background: var(--bg-dark);
} // border: 1px solid var(--border);
// }
#sk_tabs .sk_tab_hint { // #sk_tabs .sk_tab_title {
background: var(--bg); // color: var(--fg);
border: 1px solid var(--border); // }
color: var(--accent-fg);
}
.sk_theme #sk_frame { // #sk_tabs .sk_tab_url {
background: var(--bg); // color: var(--main-fg);
opacity: 0.2; // }
color: var(--accent-fg);
}
/* ---------- Omnibar ---------- */ // #sk_tabs .sk_tab_hint {
/* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */ // background: var(--bg);
/* .sk_theme#sk_omnibar { // border: 1px solid var(--border);
width: 100%; // color: var(--accent-fg);
left: 0; // }
} */
.sk_theme .title { // .sk_theme #sk_frame {
color: var(--accent-fg); // background: var(--bg);
} // opacity: 0.2;
// color: var(--accent-fg);
// }
.sk_theme .url { // /* ---------- Omnibar ---------- */
color: var(--main-fg); // /* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */
} // /* .sk_theme#sk_omnibar {
// width: 100%;
// left: 0;
// } */
.sk_theme .annotation { // .sk_theme .title {
color: var(--accent-fg); // color: var(--accent-fg);
} // }
.sk_theme .omnibar_highlight { // .sk_theme .url {
color: var(--accent-fg); // color: var(--main-fg);
} // }
.sk_theme .omnibar_timestamp { // .sk_theme .annotation {
color: var(--info-fg); // color: var(--accent-fg);
} // }
.sk_theme .omnibar_visitcount { // .sk_theme .omnibar_highlight {
color: var(--accent-fg); // color: var(--accent-fg);
} // }
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { // .sk_theme .omnibar_timestamp {
background: var(--bg-dark); // color: var(--info-fg);
} // }
.sk_theme #sk_omnibarSearchResult ul li.focused { // .sk_theme .omnibar_visitcount {
background: var(--border); // color: var(--accent-fg);
} // }
.sk_theme #sk_omnibarSearchArea { // .sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
border-top-color: var(--border); // background: var(--bg-dark);
border-bottom-color: var(--border); // }
}
.sk_theme #sk_omnibarSearchArea input, // .sk_theme #sk_omnibarSearchResult ul li.focused {
.sk_theme #sk_omnibarSearchArea span { // background: var(--border);
font-size: var(--font-size); // }
}
.sk_theme .separator { // .sk_theme #sk_omnibarSearchArea {
color: var(--accent-fg); // border-top-color: var(--border);
} // border-bottom-color: var(--border);
// }
/* ---------- Popup Notification Banner ---------- */ // .sk_theme #sk_omnibarSearchArea input,
#sk_banner { // .sk_theme #sk_omnibarSearchArea span {
font-family: var(--font); // font-size: var(--font-size);
font-size: var(--font-size); // }
font-weight: var(--font-weight);
background: var(--bg);
border-color: var(--border);
color: var(--fg);
opacity: 0.9;
}
/* ---------- Popup Keys ---------- */ // .sk_theme .separator {
#sk_keystroke { // color: var(--accent-fg);
background-color: var(--bg); // }
}
.sk_theme kbd .candidates { // /* ---------- Popup Notification Banner ---------- */
color: var(--info-fg); // #sk_banner {
} // font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// background: var(--bg);
// border-color: var(--border);
// color: var(--fg);
// opacity: 0.9;
// }
.sk_theme span.annotation { // /* ---------- Popup Keys ---------- */
color: var(--accent-fg); // #sk_keystroke {
} // background-color: var(--bg);
// }
/* ---------- Popup Translation Bubble ---------- */ // .sk_theme kbd .candidates {
#sk_bubble { // color: var(--info-fg);
background-color: var(--bg) !important; // }
color: var(--fg) !important;
border-color: var(--border) !important;
}
#sk_bubble * { // .sk_theme span.annotation {
color: var(--fg) !important; // color: var(--accent-fg);
} // }
#sk_bubble div.sk_arrow div:nth-of-type(1) { // /* ---------- Popup Translation Bubble ---------- */
border-top-color: var(--border) !important; // #sk_bubble {
border-bottom-color: var(--border) !important; // background-color: var(--bg) !important;
} // color: var(--fg) !important;
// border-color: var(--border) !important;
// }
#sk_bubble div.sk_arrow div:nth-of-type(2) { // #sk_bubble * {
border-top-color: var(--bg) !important; // color: var(--fg) !important;
border-bottom-color: var(--bg) !important; // }
}
/* ---------- Search ---------- */ // #sk_bubble div.sk_arrow div:nth-of-type(1) {
#sk_status, // border-top-color: var(--border) !important;
#sk_find { // border-bottom-color: var(--border) !important;
font-size: var(--font-size); // }
border-color: var(--border);
}
.sk_theme kbd { // #sk_bubble div.sk_arrow div:nth-of-type(2) {
background: var(--bg-dark); // border-top-color: var(--bg) !important;
border-color: var(--border); // border-bottom-color: var(--bg) !important;
box-shadow: none; // }
color: var(--fg);
}
.sk_theme .feature_name span { // /* ---------- Search ---------- */
color: var(--main-fg); // #sk_status,
} // #sk_find {
// font-size: var(--font-size);
// border-color: var(--border);
// }
/* ---------- ACE Editor ---------- */ // .sk_theme kbd {
#sk_editor { // background: var(--bg-dark);
background: var(--bg-dark) !important; // border-color: var(--border);
height: 50% !important; // box-shadow: none;
/* Remove this to restore the default editor size */ // color: var(--fg);
} // }
.ace_dialog-bottom { // .sk_theme .feature_name span {
border-top: 1px solid var(--bg) !important; // color: var(--main-fg);
} // }
.ace-chrome .ace_print-margin, // /* ---------- ACE Editor ---------- */
.ace_gutter, // #sk_editor {
.ace_gutter-cell, // background: var(--bg-dark) !important;
.ace_dialog { // height: 50% !important;
background: var(--bg) !important; // /* Remove this to restore the default editor size */
} // }
.ace-chrome { // .ace_dialog-bottom {
color: var(--fg) !important; // border-top: 1px solid var(--bg) !important;
} // }
.ace_gutter, // .ace-chrome .ace_print-margin,
.ace_dialog { // .ace_gutter,
color: var(--fg) !important; // .ace_gutter-cell,
} // .ace_dialog {
// background: var(--bg) !important;
// }
.ace_cursor { // .ace-chrome {
color: var(--fg) !important; // color: var(--fg) !important;
} // }
.normal-mode .ace_cursor { // .ace_gutter,
background-color: var(--fg) !important; // .ace_dialog {
border: var(--fg) !important; // color: var(--fg) !important;
opacity: 0.7 !important; // }
}
.ace_marker-layer .ace_selection { // .ace_cursor {
background: var(--select) !important; // color: var(--fg) !important;
} // }
.ace_editor, // .normal-mode .ace_cursor {
.ace_dialog span, // background-color: var(--fg) !important;
.ace_dialog input { // border: var(--fg) !important;
font-family: var(--font); // opacity: 0.7 !important;
font-size: var(--font-size); // }
font-weight: var(--font-weight);
}`; // .ace_marker-layer .ace_selection {
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y> // background: var(--select) !important;
// }
// .ace_editor,
// .ace_dialog span,
// .ace_dialog input {
// font-family: var(--font);
// font-size: var(--font-size);
// font-weight: var(--font-weight);
// }`;
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
// #endregion

View file

@ -0,0 +1,489 @@
[
{trigger: "mk", replacement: "$$0$", options: "tA"
},
{trigger: "dm", replacement: "$$\n$0\n$$", options: "tAw"
},
{trigger: "beg", replacement: "\\begin{$0}\n$1\n\\end{$0}", options: "mA"
},
// Dashes
// {trigger: "--", replacement: "", options: "tA"},
// {trigger: "-", replacement: "—", options: "tA"},
// {trigger: "—-", replacement: "---", options: "tA"},
// Greek letters
{trigger: "@a", replacement: "\\alpha", options: "mA"
},
{trigger: "@b", replacement: "\\beta", options: "mA"
},
{trigger: "@g", replacement: "\\gamma", options: "mA"
},
{trigger: "@G", replacement: "\\Gamma", options: "mA"
},
{trigger: "@d", replacement: "\\delta", options: "mA"
},
{trigger: "@D", replacement: "\\Delta", options: "mA"
},
{trigger: "@e", replacement: "\\epsilon", options: "mA"
},
{trigger: ":e", replacement: "\\varepsilon", options: "mA"
},
{trigger: "@z", replacement: "\\zeta", options: "mA"
},
{trigger: "@t", replacement: "\\theta", options: "mA"
},
{trigger: "@T", replacement: "\\Theta", options: "mA"
},
{trigger: ":t", replacement: "\\vartheta", options: "mA"
},
{trigger: "@i", replacement: "\\iota", options: "mA"
},
{trigger: "@k", replacement: "\\kappa", options: "mA"
},
{trigger: "@l", replacement: "\\lambda", options: "mA"
},
{trigger: "@L", replacement: "\\Lambda", options: "mA"
},
{trigger: "@s", replacement: "\\sigma", options: "mA"
},
{trigger: "@S", replacement: "\\Sigma", options: "mA"
},
{trigger: "@u", replacement: "\\upsilon", options: "mA"
},
{trigger: "@U", replacement: "\\Upsilon", options: "mA"
},
{trigger: "@o", replacement: "\\omega", options: "mA"
},
{trigger: "@O", replacement: "\\Omega", options: "mA"
},
{trigger: "ome", replacement: "\\omega", options: "mA"
},
{trigger: "Ome", replacement: "\\Omega", options: "mA"
},
// Text environment
{trigger: "text", replacement: "\\text{$0}$1", options: "mA"
},
{trigger: "\"", replacement: "\\text{$0}$1", options: "mA"
},
// Basic operations
{trigger: "sr", replacement: "^{2}", options: "mA"
},
{trigger: "cb", replacement: "^{3}", options: "mA"
},
{trigger: "pow", replacement: "^{$0}$1", options: "mA"
},
{trigger: "_", replacement: "_{$0}$1", options: "mA"
},
{trigger: "sb", replacement: "_{$0}$1", options: "mA"
},
{trigger: "sts", replacement: "_\\text{$0}", options: "mA"
},
{trigger: "sq", replacement: "\\sqrt{ $0 }$1", options: "mA"
},
{trigger: "//", replacement: "\\frac{$0}{$1}$2", options: "mA"
},
{trigger: "ee", replacement: "e^{ $0 }$1", options: "mA"
},
{trigger: "invs", replacement: "^{-1}", options: "mA"
},
{trigger: /([A-Za-z
])(\d)/, replacement: "[[0]]_{[[1]]}", options: "rmA", description: "Auto letter subscript", priority: -1
},
{trigger: /([^\\
])(exp|log|ln)/, replacement: "[[0]]\\[[1]]", options: "rmA"
},
{trigger: "conj", replacement: "^{*}", options: "mA"
},
{trigger: "Re", replacement: "\\mathrm{Re}", options: "mA"
},
{trigger: "Im", replacement: "\\mathrm{Im}", options: "mA"
},
{trigger: "bf", replacement: "\\mathbf{$0}", options: "mA"
},
{trigger: "rm", replacement: "\\mathrm{$0}$1", options: "mA"
},
// Linear algebra
{trigger: /([^\\
])(det)/, replacement: "[[0]]\\[[1]]", options: "rmA"
},
{trigger: "trace", replacement: "\\mathrm{Tr}", options: "mA"
},
// More operations
{trigger: "([a-zA-Z])hat", replacement: "\\hat{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z])bar", replacement: "\\bar{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z])dot", replacement: "\\dot{[[0]]}", options: "rmA", priority: -1
},
{trigger: "([a-zA-Z])ddot", replacement: "\\ddot{[[0]]}", options: "rmA", priority: 1
},
{trigger: "([a-zA-Z])tilde", replacement: "\\tilde{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z])und", replacement: "\\underline{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z])vec", replacement: "\\vec{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z]),\\.", replacement: "\\mathbf{[[0]]}", options: "rmA"
},
{trigger: "([a-zA-Z])\\.,", replacement: "\\mathbf{[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}),\\.", replacement: "\\boldsymbol{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK})\\.,", replacement: "\\boldsymbol{\\[[0]]}", options: "rmA"
},
{trigger: "hat", replacement: "\\hat{$0}$1", options: "mA"
},
{trigger: "bar", replacement: "\\bar{$0}$1", options: "mA"
},
{trigger: "dot", replacement: "\\dot{$0}$1", options: "mA", priority: -1
},
{trigger: "ddot", replacement: "\\ddot{$0}$1", options: "mA"
},
{trigger: "cdot", replacement: "\\cdot", options: "mA"
},
{trigger: "tilde", replacement: "\\tilde{$0}$1", options: "mA"
},
{trigger: "und", replacement: "\\underline{$0}$1", options: "mA"
},
{trigger: "vec", replacement: "\\vec{$0}$1", options: "mA"
},
// More auto letter subscript
{trigger: /([A-Za-z
])_(\d\d)/, replacement: "[[0]]_{[[1]]}", options: "rmA"
},
{trigger: /\\hat{([A-Za-z
])
}(\d)/, replacement: "\\hat{[[0]]}_{[[1]]}", options: "rmA"
},
{trigger: /\\vec{([A-Za-z
])
}(\d)/, replacement: "\\vec{[[0]]}_{[[1]]}", options: "rmA"
},
{trigger: /\\mathbf{([A-Za-z
])
}(\d)/, replacement: "\\mathbf{[[0]]}_{[[1]]}", options: "rmA"
},
{trigger: "xnn", replacement: "x_{n}", options: "mA"
},
{trigger: "xii", replacement: "x_{i}", options: "mA"
},
{trigger: "xjj", replacement: "x_{j}", options: "mA"
},
{trigger: "xp1", replacement: "x_{n+1}", options: "mA"
},
{trigger: "ynn", replacement: "y_{n}", options: "mA"
},
{trigger: "yii", replacement: "y_{i}", options: "mA"
},
{trigger: "yjj", replacement: "y_{j}", options: "mA"
},
// Symbols
{trigger: "ooo", replacement: "\\infty", options: "mA"
},
{trigger: "sum", replacement: "\\sum", options: "mA"
},
{trigger: "prod", replacement: "\\prod", options: "mA"
},
{trigger: "\\sum", replacement: "\\sum_{${0:i}=${1:1}}^{${2:N}} $3", options: "m"
},
{trigger: "\\prod", replacement: "\\prod_{${0:i}=${1:1}}^{${2:N}} $3", options: "m"
},
{trigger: "lim", replacement: "\\lim_{ ${0:n} \\to ${1:\\infty} } $2", options: "mA"
},
{trigger: "+-", replacement: "\\pm", options: "mA"
},
{trigger: "-+", replacement: "\\mp", options: "mA"
},
{trigger: "...", replacement: "\\dots", options: "mA"
},
{trigger: "nabl", replacement: "\\nabla", options: "mA"
},
{trigger: "del", replacement: "\\nabla", options: "mA"
},
{trigger: "xx", replacement: "\\times", options: "mA"
},
{trigger: "**", replacement: "\\cdot", options: "mA"
},
{trigger: "para", replacement: "\\parallel", options: "mA"
},
{trigger: "===", replacement: "\\equiv", options: "mA"
},
{trigger: "!=", replacement: "\\neq", options: "mA"
},
{trigger: ">=", replacement: "\\geq", options: "mA"
},
{trigger: "<=", replacement: "\\leq", options: "mA"
},
{trigger: ">>", replacement: "\\gg", options: "mA"
},
{trigger: "<<", replacement: "\\ll", options: "mA"
},
{trigger: "simm", replacement: "\\sim", options: "mA"
},
{trigger: "sim=", replacement: "\\simeq", options: "mA"
},
{trigger: "prop", replacement: "\\propto", options: "mA"
},
{trigger: "<->", replacement: "\\leftrightarrow ", options: "mA"
},
{trigger: "->", replacement: "\\to", options: "mA"
},
{trigger: "!>", replacement: "\\mapsto", options: "mA"
},
{trigger: "=>", replacement: "\\implies", options: "mA"
},
{trigger: "=<", replacement: "\\impliedby", options: "mA"
},
{trigger: "and", replacement: "\\cap", options: "mA"
},
{trigger: "orr", replacement: "\\cup", options: "mA"
},
{trigger: "inn", replacement: "\\in", options: "mA"
},
{trigger: "notin", replacement: "\\not\\in", options: "mA"
},
{trigger: "\\\\\\", replacement: "\\setminus", options: "mA"
},
{trigger: "sub=", replacement: "\\subseteq", options: "mA"
},
{trigger: "sup=", replacement: "\\supseteq", options: "mA"
},
{trigger: "eset", replacement: "\\emptyset", options: "mA"
},
{trigger: "set", replacement: "\\{ $0 \\}$1", options: "mA"
},
{trigger: "e\\xi sts", replacement: "\\exists", options: "mA", priority: 1
},
{trigger: "LL", replacement: "\\mathcal{L}", options: "mA"
},
{trigger: "HH", replacement: "\\mathcal{H}", options: "mA"
},
{trigger: "CC", replacement: "\\mathbb{C}", options: "mA"
},
{trigger: "RR", replacement: "\\mathbb{R}", options: "mA"
},
{trigger: "ZZ", replacement: "\\mathbb{Z}", options: "mA"
},
{trigger: "NN", replacement: "\\mathbb{N}", options: "mA"
},
// Handle spaces and backslashes
// Snippet variables can be used as shortcuts when writing snippets.
// For example, ${GREEK} below is shorthand for "alpha|beta|gamma|Gamma|delta|..."
// You can edit snippet variables under the Advanced snippet settings section.
{trigger: "([^\\\\])(${GREEK})", replacement: "[[0]]\\[[1]]", options: "rmA", description: "Add backslash before Greek letters"
},
{trigger: "([^\\\\])(${SYMBOL})", replacement: "[[0]]\\[[1]]", options: "rmA", description: "Add backslash before symbols"
},
// Insert space after Greek letters and symbols
{trigger: "\\\\(${GREEK}|${SYMBOL}|${MORE_SYMBOLS})([A-Za-z])", replacement: "\\[[0]] [[1]]", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) sr", replacement: "\\[[0]]^{2}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) cb", replacement: "\\[[0]]^{3}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) rd", replacement: "\\[[0]]^{$0}$1", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) hat", replacement: "\\hat{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) dot", replacement: "\\dot{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) bar", replacement: "\\bar{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) vec", replacement: "\\vec{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) tilde", replacement: "\\tilde{\\[[0]]}", options: "rmA"
},
{trigger: "\\\\(${GREEK}|${SYMBOL}) und", replacement: "\\underline{\\[[0]]}", options: "rmA"
},
// Derivatives and integrals
{trigger: "par", replacement: "\\frac{ \\partial ${0:y} }{ \\partial ${1:x} } $2", options: "m"
},
{trigger: /pa([A-Za-z
])([A-Za-z
])/, replacement: "\\frac{ \\partial [[0]] }{ \\partial [[1]] } ", options: "rm"
},
{trigger: "ddt", replacement: "\\frac{d}{dt} ", options: "mA"
},
{trigger: /([^\\
])int/, replacement: "[[0]]\\int", options: "mA", priority: -1
},
{trigger: "\\int", replacement: "\\int $0 \\, d${1:x} $2", options: "m"
},
{trigger: "dint", replacement: "\\int_{${0:0}}^{${1:1}} $2 \\, d${3:x} $4", options: "mA"
},
{trigger: "oint", replacement: "\\oint", options: "mA"
},
{trigger: "iint", replacement: "\\iint", options: "mA"
},
{trigger: "iiint", replacement: "\\iiint", options: "mA"
},
{trigger: "oinf", replacement: "\\int_{0}^{\\infty} $0 \\, d${1:x} $2", options: "mA"
},
{trigger: "infi", replacement: "\\int_{-\\infty}^{\\infty} $0 \\, d${1:x} $2", options: "mA"
},
// Trigonometry
{trigger: /([^\\
])(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)/, replacement: "[[0]]\\[[1]]", options: "rmA", description: "Add backslash before trig funcs"
},
{trigger: /\\(arcsin|sin|arccos|cos|arctan|tan|csc|sec|cot)([A-Za-gi-z
])/,
replacement: "\\[[0]] [[1]]", options: "rmA",
description: "Add space after trig funcs. Skips letter h to allow sinh, cosh, etc."
},
{trigger: /\\(sinh|cosh|tanh|coth)([A-Za-z
])/,
replacement: "\\[[0]] [[1]]", options: "rmA",
description: "Add space after hyperbolic trig funcs"
},
// Visual operations
{trigger: "U", replacement: "\\underbrace{ ${VISUAL} }_{ $0 }", options: "mA"
},
{trigger: "O", replacement: "\\overbrace{ ${VISUAL} }^{ $0 }", options: "mA"
},
{trigger: "B", replacement: "\\underset{ $0 }{ ${VISUAL} }", options: "mA"
},
{trigger: "C", replacement: "\\cancel{ ${VISUAL} }", options: "mA"
},
{trigger: "K", replacement: "\\cancelto{ $0 }{ ${VISUAL} }", options: "mA"
},
{trigger: "S", replacement: "\\sqrt{ ${VISUAL} }", options: "mA"
},
// Physics
{trigger: "kbt", replacement: "k_{B}T", options: "mA"
},
{trigger: "msun", replacement: "M_{\\odot}", options: "mA"
},
// Quantum mechanics
{trigger: "dag", replacement: "^{\\dagger}", options: "mA"
},
{trigger: "o+", replacement: "\\oplus ", options: "mA"
},
{trigger: "ox", replacement: "\\otimes ", options: "mA"
},
{trigger: "bra", replacement: "\\bra{$0} $1", options: "mA"
},
{trigger: "ket", replacement: "\\ket{$0} $1", options: "mA"
},
{trigger: "brk", replacement: "\\braket{ $0 | $1 } $2", options: "mA"
},
{trigger: "outer", replacement: "\\ket{${0:\\psi}} \\bra{${0:\\psi}} $1", options: "mA"
},
// Chemistry
{trigger: "pu", replacement: "\\pu{ $0 }", options: "mA"
},
{trigger: "cee", replacement: "\\ce{ $0 }", options: "mA"
},
{trigger: "he4", replacement: "{}^{4}_{2}He ", options: "mA"
},
{trigger: "he3", replacement: "{}^{3}_{2}He ", options: "mA"
},
{trigger: "iso", replacement: "{}^{${0:4}}_{${1:2}}${2:He}", options: "mA"
},
// Environments
{trigger: "pmat", replacement: "\\begin{pmatrix}\n$0\n\\end{pmatrix}", options: "MA"
},
{trigger: "bmat", replacement: "\\begin{bmatrix}\n$0\n\\end{bmatrix}", options: "MA"
},
{trigger: "Bmat", replacement: "\\begin{Bmatrix}\n$0\n\\end{Bmatrix}", options: "MA"
},
{trigger: "vmat", replacement: "\\begin{vmatrix}\n$0\n\\end{vmatrix}", options: "MA"
},
{trigger: "Vmat", replacement: "\\begin{Vmatrix}\n$0\n\\end{Vmatrix}", options: "MA"
},
{trigger: "matrix", replacement: "\\begin{matrix}\n$0\n\\end{matrix}", options: "MA"
},
{trigger: "pmat", replacement: "\\begin{pmatrix}$0\\end{pmatrix}", options: "nA"
},
{trigger: "bmat", replacement: "\\begin{bmatrix}$0\\end{bmatrix}", options: "nA"
},
{trigger: "Bmat", replacement: "\\begin{Bmatrix}$0\\end{Bmatrix}", options: "nA"
},
{trigger: "vmat", replacement: "\\begin{vmatrix}$0\\end{vmatrix}", options: "nA"
},
{trigger: "Vmat", replacement: "\\begin{Vmatrix}$0\\end{Vmatrix}", options: "nA"
},
{trigger: "matrix", replacement: "\\begin{matrix}$0\\end{matrix}", options: "nA"
},
{trigger: "cases", replacement: "\\begin{cases}\n$0\n\\end{cases}", options: "mA"
},
{trigger: "align", replacement: "\\begin{align}\n$0\n\\end{align}", options: "mA"
},
{trigger: "array", replacement: "\\begin{array}\n$0\n\\end{array}", options: "mA"
},
// Brackets
{trigger: "avg", replacement: "\\langle $0 \\rangle $1", options: "mA"
},
{trigger: "norm", replacement: "\\lvert $0 \\rvert $1", options: "mA", priority: 1
},
{trigger: "Norm", replacement: "\\lVert $0 \\rVert $1", options: "mA", priority: 1
},
{trigger: "ceil", replacement: "\\lceil $0 \\rceil $1", options: "mA"
},
{trigger: "floor", replacement: "\\lfloor $0 \\rfloor $1", options: "mA"
},
{trigger: "mod", replacement: "|$0|$1", options: "mA"
},
{trigger: "(", replacement: "(${VISUAL})", options: "mA"
},
{trigger: "[", replacement: "[${VISUAL}]", options: "mA"
},
{trigger: "{", replacement: "{${VISUAL}}", options: "mA"
},
{trigger: "(", replacement: "($0)$1", options: "mA"
},
{trigger: "{", replacement: "{$0}$1", options: "mA"
},
{trigger: "[", replacement: "[$0]$1", options: "mA"
},
{trigger: "lr(", replacement: "\\left( $0 \\right) $1", options: "mA"
},
{trigger: "lr{", replacement: "\\left\\{ $0 \\right\\} $1", options: "mA"
},
{trigger: "lr[", replacement: "\\left[ $0 \\right] $1", options: "mA"
},
{trigger: "lr|", replacement: "\\left| $0 \\right| $1", options: "mA"
},
{trigger: "lra", replacement: "\\left< $0 \\right> $1", options: "mA"
},
// User defined
{trigger: "b\\otimes ed", replacement: "\\boxed{$1}", options: "mA"
},
{trigger: "\\disp", replacement: "\\displaystyle $0", options: "mA"
},
// Misc
// Automatically convert standalone letters in text to math (except a, A, I).
// (Un-comment to enable)
// {trigger: /([^'])\b([B-HJ-Zb-z])\b([\n\s.,?!:'])/, replacement: "[[0]]$[[1]]$[[2]]", options: "tA"},
// Automatically convert Greek letters in text to math.
// {trigger: "(${GREEK})([\\n\\s.,?!:'])", replacement: "$\\[[0]]$[[1]]", options: "rtAw"},
// Automatically convert text of the form "x=2" and "x=n+1" to math.
// {trigger: /([A-Za-z]=\d+)([\n\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "rtAw"},
// {trigger: /([A-Za-z]=[A-Za-z][+-]\d+)([\n\s.,?!:'])/, replacement: "$[[0]]$[[1]]", options: "tAw"},
// Snippet replacements can have placeholders.
{trigger: "tayl", replacement: "${0:f}(${1:x} + ${2:h}) = ${0:f}(${1:x}) + ${0:f}'(${1:x})${2:h} + ${0:f}''(${1:x}) \\frac{${2:h}^{2}}{2!} + \\dots$3", options: "mA", description: "Taylor expansion"
},
// Snippet replacements can also be JavaScript functions.
// See the documentation for more information.
{trigger: /iden(\d)/, replacement: (match) => {
const n = match[
1
];
let arr = [];
for (let j = 0; j < n; j++) {
arr[j
] = [];
for (let i = 0; i < n; i++) {
arr[j
][i
] = (i === j) ? 1 : 0;
}
}
let output = arr.map(el => el.join(" & ")).join(" \\\\\n");
output = `\\begin{pmatrix
}\n${output
}\n\\end{pmatrix
}`;
return output;
}, options: "mA", description: "N x N identity matrix"
},
]

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools\powershell\Aliases.ps1 # $DOTFILES/tools\powershell\Aliases.ps1
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Aliases for PowerShell # Aliases for PowerShell
### VARIABLES ### ### VARIABLES ###
$EDITOR = "code" $EDITOR = "code"

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools\powershell\Environment.ps1 # $DOTFILES/tools\powershell\Environment.ps1
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Sourced by Microsoft.PowerShell_profile.ps1 # Sourced by Microsoft.PowerShell_profile.ps1

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools\powershell\Prompt.ps1 # $DOTFILES/tools\powershell\Prompt.ps1
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Use starship to set prompt # Use starship to set prompt
$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml" $ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml"

View file

@ -32,6 +32,7 @@
"command": "-code-runner.run" "command": "-code-runner.run"
}, },
// #endregion // #endregion
// #region Comment and semicolons
{ {
"key": "ctrl+oem_1", // ctrl+; "key": "ctrl+oem_1", // ctrl+;
"command": "extension.insertSemicolon", "command": "extension.insertSemicolon",
@ -62,6 +63,7 @@
"command": "-github.copilot.acceptCursorPanelSolution", "command": "-github.copilot.acceptCursorPanelSolution",
"when": "github.copilot.activated && github.copilot.panelVisible" "when": "github.copilot.activated && github.copilot.panelVisible"
}, },
// #endregion
{ {
"key": "f9", "key": "f9",
"command": "csdevkit.debug.noDebugFileLaunch" "command": "csdevkit.debug.noDebugFileLaunch"
@ -114,7 +116,52 @@
// #region Nvim-Tree like File Explorer // #region Nvim-Tree like File Explorer
// n, e : move cursor up/down // n, e : move cursor up/down
// h : move cursor to parent folder // h : move cursor to parent folder
// l : open file or folder // i : open file or folder
{
"key": "e",
"command": "list.focusUp",
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused"
},
{
"key": "k",
"command": "-list.focusUp",
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused"
},
{
"key": "e",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "k",
"command": "-list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "f",
"command": "filesExplorer.findInWorkspace",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "n",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "j",
"command": "-list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "i",
"command": "list.select",
"when": "listFocus && !inputFocus"
},
{
"key": "l",
"command": "-list.select",
"when": "listFocus && !inputFocus"
},
{ // z: Close all folders { // z: Close all folders
"key": "z", "key": "z",
"command": "workbench.files.action.collapseExplorerFolders", "command": "workbench.files.action.collapseExplorerFolders",
@ -270,51 +317,6 @@
"when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'" "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'"
}, },
// #endregion // #endregion
{
"key": "e",
"command": "list.focusUp",
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused"
},
{
"key": "k",
"command": "-list.focusUp",
"when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused"
},
{
"key": "e",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "k",
"command": "-list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "f",
"command": "filesExplorer.findInWorkspace",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "n",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "j",
"command": "-list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "i",
"command": "list.select",
"when": "listFocus && !inputFocus"
},
{
"key": "l",
"command": "-list.select",
"when": "listFocus && !inputFocus"
},
{ {
"key": "ctrl+shift+g c", "key": "ctrl+shift+g c",
"command": "-gitlens.showQuickCommitFileDetails", "command": "-gitlens.showQuickCommitFileDetails",
@ -482,4 +484,4 @@
"command": "workbench.action.terminal.resizePaneRight", "command": "workbench.action.terminal.resizePaneRight",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
} }
] ]

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/common.zshrc # $DOTFILES/tools/zsh/common.zshrc
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# This is the entry point for all zsh configuration files # This is the entry point for all zsh configuration files
# 这是所有zsh配置文件的入口点 # 这是所有zsh配置文件的入口点

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/global.zshenv # $DOTFILES/tools/zsh/global.zshenv
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# $DOTFILES/tools/zsh/global.zshenv # $DOTFILES/tools/zsh/global.zshenv
# system-wide zshenv file 系统级别的 zshenv 文件,用于设置全局环境变量 # system-wide zshenv file 系统级别的 zshenv 文件,用于设置全局环境变量

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/alias.zsh # $DOTFILES/tools/zsh/mod/alias.zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# PowerShell Equivalent, for cross-platform compatibility # PowerShell Equivalent, for cross-platform compatibility

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/config.zsh # $DOTFILES/tools/zsh/mod/config.zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# ZSH Config, no need to `export` these variables # ZSH Config, no need to `export` these variables

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/env.zsh # $DOTFILES/tools/zsh/mod/env.zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# This file stores only environment variables that only called by # This file stores only environment variables that only called by

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/keymap.zsh # $DOTFILES/tools/zsh/mod/keymap.zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/navi.zsh # $DOTFILES/tools/zsh/mod/navi.zsh
# Date: 2024-12-01 # Date: 2024-12-01
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# Relative navigation # # Relative navigation #

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/mod/prompt.zsh # $DOTFILES/tools/zsh/mod/prompt.zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml

View file

@ -1,6 +1,6 @@
# $DOTFILES/tools/zsh/zshenv # $DOTFILES/tools/zsh/zshenv
# Date: 2024-11-30 # Date: 2024-11-30
# Author: contact@js0ny.net # Author: js0ny
# User-specific environment variables for zsh 用户级别的 zsh 环境变量 # User-specific environment variables for zsh 用户级别的 zsh 环境变量
# Location: # Location: