├── .gitignore ├── sqlite3 └── .sqliterc ├── selene └── .config │ └── selene │ ├── selene.toml │ └── vim.toml ├── macOS ├── karabiner │ └── .config │ │ └── karabiner │ │ ├── .gitignore │ │ ├── assets │ │ └── complex_modifications │ │ │ └── swap_alt_and_command.json │ │ └── karabiner.json ├── hammerspoon │ └── .hammerspoon │ │ ├── init.lua │ │ └── window.lua ├── brew │ └── Brewfile ├── Code │ └── Library │ │ └── Application Support │ │ └── Code │ │ └── User │ │ ├── settings.json │ │ └── keybindings.json ├── raycast │ └── .config │ │ └── raycast │ │ └── scripts │ │ ├── left.applescript │ │ ├── right.applescript │ │ └── center.applescript └── alacritty │ └── .config │ └── alacritty │ └── alacritty.toml ├── bat └── .config │ └── bat │ └── config ├── stylua.toml ├── logo ├── asprite.icns ├── cat │ ├── cat.icns │ └── cat.png ├── duck │ ├── duck.png │ └── duck.icns ├── hep │ ├── hep.icns │ └── hep.png ├── normal │ ├── vim.icns │ ├── vs.icns │ ├── red-vs.icns │ ├── steam.icns │ ├── red-vs2.icns │ ├── purple-vs.icns │ └── cry-terminal.icns ├── big_duck │ ├── icon.icns │ └── cyberduck.png ├── kitty │ ├── kitty.icns │ └── kitty-new.icns ├── panhai │ ├── panhai.icns │ ├── panhai.png │ ├── panhai2.png │ ├── panhai2.icns │ └── panhai-origin.png ├── wizard │ ├── wizard.icns │ └── wizard.png ├── airmail │ ├── airmail.icns │ └── airmail.png ├── firefox │ ├── firefox.icns │ ├── firefox.png │ ├── firefox2.png │ └── firefox2.icns ├── changjinglu │ ├── changjinglu.icns │ └── changjinglu.png ├── rubber-duck │ ├── rubber-duck.icns │ ├── rubber-duck.png │ └── rubber-duck.svg └── auto.sh ├── fd └── .config │ └── fd │ └── ignore ├── zsh ├── .zshrc ├── .zsh_plugins.txt └── .config │ └── zsh │ ├── 00-init.zsh │ ├── 01-plugins.zsh │ ├── 02-options.zsh │ ├── 04-path.zsh │ ├── 03-env.zsh │ ├── starship.toml │ ├── 09-final.zsh │ ├── 05-aliases.zsh │ └── 06-functions.zsh ├── lsd └── .config │ └── lsd │ └── config.yaml ├── nvim └── .config │ └── nvim │ ├── queries │ ├── typescript │ │ └── textobjects.scm │ └── go │ │ └── textobjects.scm │ ├── lsp │ ├── ruff.lua │ ├── vtsls.lua │ ├── gopls.lua │ ├── pyright.lua │ └── tsgo.lua │ ├── lua │ ├── plugins │ │ ├── color.lua │ │ ├── mini.lua │ │ ├── vim-plugins.lua │ │ ├── gitsigns.lua │ │ ├── conform.lua │ │ ├── treesitter.lua │ │ ├── blink.lua │ │ ├── global.lua │ │ ├── neotree.lua │ │ ├── coc.lua │ │ ├── fzf.lua │ │ └── ui.lua │ ├── options_post.vim │ ├── vim-plugins.vim │ ├── options_prev.vim │ └── keymaps.vim │ ├── ftplugin │ └── go.vim │ ├── init.lua │ ├── coc-settings.json │ └── ultisnips │ └── go.snippets ├── README.md ├── stow └── .stowrc ├── Windows ├── AutoHotKey │ └── volumn.ahk └── alacritty │ └── alacritty.toml ├── pg_format └── .pg_format ├── kitty └── .config │ ├── moonfly.conf │ ├── taiga.conf │ └── kitty.conf ├── local └── .local │ └── bin │ ├── git_open │ ├── ins │ ├── clone │ └── gl ├── tmux ├── .local │ └── bin │ │ ├── tmux-sessionizer │ │ └── tmux-new-window └── .tmux.conf ├── LICENSE ├── fish └── .config │ └── fish │ └── starship.toml ├── server ├── .tmux.conf ├── .local │ └── bin │ │ └── clone ├── .bash_profile ├── .config │ ├── fish │ │ └── config.fish │ └── init │ │ └── init.vim └── .vimrc ├── backup ├── repro.lua └── miscellaneous │ └── recursive-code-config │ └── config.yaml ├── gitui └── .config │ └── gitui │ └── key_bindings.ron ├── biome └── code │ └── biome.json ├── bash └── .bash_profile ├── lf └── .config │ └── lf │ └── lfrc └── Linux ├── fontconfig └── .config │ └── fontconfig │ └── fonts.conf ├── Code └── .config │ └── Code │ └── User │ ├── keybindings.json │ └── settings.json └── alacritty └── .config └── alacritty └── alacritty.toml /.gitignore: -------------------------------------------------------------------------------- 1 | .luarc.json 2 | .env 3 | .repro/ -------------------------------------------------------------------------------- /sqlite3/.sqliterc: -------------------------------------------------------------------------------- 1 | .mode table 2 | .header on 3 | -------------------------------------------------------------------------------- /selene/.config/selene/selene.toml: -------------------------------------------------------------------------------- 1 | std = "vim" 2 | -------------------------------------------------------------------------------- /macOS/karabiner/.config/karabiner/.gitignore: -------------------------------------------------------------------------------- 1 | automatic_backups/ 2 | -------------------------------------------------------------------------------- /bat/.config/bat/config: -------------------------------------------------------------------------------- 1 | --style="plain" 2 | --theme="ansi" 3 | --paging=never 4 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | indent_type = "Spaces" 2 | indent_width = 4 3 | column_width = 120 4 | -------------------------------------------------------------------------------- /logo/asprite.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/asprite.icns -------------------------------------------------------------------------------- /logo/cat/cat.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/cat/cat.icns -------------------------------------------------------------------------------- /logo/cat/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/cat/cat.png -------------------------------------------------------------------------------- /logo/duck/duck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/duck/duck.png -------------------------------------------------------------------------------- /logo/hep/hep.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/hep/hep.icns -------------------------------------------------------------------------------- /logo/hep/hep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/hep/hep.png -------------------------------------------------------------------------------- /logo/duck/duck.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/duck/duck.icns -------------------------------------------------------------------------------- /logo/normal/vim.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/vim.icns -------------------------------------------------------------------------------- /logo/normal/vs.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/vs.icns -------------------------------------------------------------------------------- /logo/big_duck/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/big_duck/icon.icns -------------------------------------------------------------------------------- /logo/kitty/kitty.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/kitty/kitty.icns -------------------------------------------------------------------------------- /logo/normal/red-vs.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/red-vs.icns -------------------------------------------------------------------------------- /logo/normal/steam.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/steam.icns -------------------------------------------------------------------------------- /logo/panhai/panhai.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/panhai/panhai.icns -------------------------------------------------------------------------------- /logo/panhai/panhai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/panhai/panhai.png -------------------------------------------------------------------------------- /logo/panhai/panhai2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/panhai/panhai2.png -------------------------------------------------------------------------------- /logo/wizard/wizard.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/wizard/wizard.icns -------------------------------------------------------------------------------- /logo/wizard/wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/wizard/wizard.png -------------------------------------------------------------------------------- /fd/.config/fd/ignore: -------------------------------------------------------------------------------- 1 | .git 2 | .DS_Store 3 | /Users/taiga/code/go/pkg/ 4 | /home/taiga/code/go/pkg/ 5 | -------------------------------------------------------------------------------- /logo/airmail/airmail.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/airmail/airmail.icns -------------------------------------------------------------------------------- /logo/airmail/airmail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/airmail/airmail.png -------------------------------------------------------------------------------- /logo/firefox/firefox.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/firefox/firefox.icns -------------------------------------------------------------------------------- /logo/firefox/firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/firefox/firefox.png -------------------------------------------------------------------------------- /logo/firefox/firefox2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/firefox/firefox2.png -------------------------------------------------------------------------------- /logo/kitty/kitty-new.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/kitty/kitty-new.icns -------------------------------------------------------------------------------- /logo/normal/red-vs2.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/red-vs2.icns -------------------------------------------------------------------------------- /logo/panhai/panhai2.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/panhai/panhai2.icns -------------------------------------------------------------------------------- /zsh/.zshrc: -------------------------------------------------------------------------------- 1 | for config_file in ~/.config/zsh/*.zsh(N); do 2 | source "$config_file" 3 | done 4 | -------------------------------------------------------------------------------- /logo/big_duck/cyberduck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/big_duck/cyberduck.png -------------------------------------------------------------------------------- /logo/firefox/firefox2.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/firefox/firefox2.icns -------------------------------------------------------------------------------- /logo/normal/purple-vs.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/purple-vs.icns -------------------------------------------------------------------------------- /logo/normal/cry-terminal.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/normal/cry-terminal.icns -------------------------------------------------------------------------------- /logo/panhai/panhai-origin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/panhai/panhai-origin.png -------------------------------------------------------------------------------- /logo/changjinglu/changjinglu.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/changjinglu/changjinglu.icns -------------------------------------------------------------------------------- /logo/changjinglu/changjinglu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/changjinglu/changjinglu.png -------------------------------------------------------------------------------- /logo/rubber-duck/rubber-duck.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/rubber-duck/rubber-duck.icns -------------------------------------------------------------------------------- /logo/rubber-duck/rubber-duck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keaising/dotfile/HEAD/logo/rubber-duck/rubber-duck.png -------------------------------------------------------------------------------- /lsd/.config/lsd/config.yaml: -------------------------------------------------------------------------------- 1 | date: +%Y-%m-%d %H:%M 2 | icons: 3 | when: never 4 | 5 | sorting: 6 | dir-grouping: first 7 | 8 | hyperlink: always 9 | -------------------------------------------------------------------------------- /nvim/.config/nvim/queries/typescript/textobjects.scm: -------------------------------------------------------------------------------- 1 | ;; extends 2 | 3 | (pair (property_identifier) @keyed_element) 4 | (pair (property_identifier) ":" (_) @keyed_element) 5 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lsp/ruff.lua: -------------------------------------------------------------------------------- 1 | return { 2 | init_options = { 3 | settings = { 4 | organizeImports = true, 5 | showSyntaxErrors = true, 6 | }, 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /zsh/.zsh_plugins.txt: -------------------------------------------------------------------------------- 1 | zsh-users/zsh-autosuggestions 2 | 3 | # 如果需要,可以从 oh-my-zsh 添加插件 4 | # ohmyzsh/ohmyzsh path:plugins/git 5 | # ohmyzsh/ohmyzsh path:plugins/macos 6 | 7 | # 语法高亮(必须在最后加载!) 8 | zsh-users/zsh-syntax-highlighting 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfile 2 | 3 | ```shell 4 | # 1.all components managed by stow, install stow first. 5 | 6 | # 2. set .stowrc 7 | stow -vt ~ stow 8 | 9 | # 3. other components can just: 10 | stow {alacritty|vim|tmux|zsh} 11 | ``` 12 | -------------------------------------------------------------------------------- /macOS/hammerspoon/.hammerspoon/init.lua: -------------------------------------------------------------------------------- 1 | -- hs.hotkey.bind({ "cmd", "shift" }, "v", function() 2 | -- hs.eventtap.keyStrokes(hs.pasteboard.getContents()) 3 | -- end) 4 | 5 | require("clock") 6 | require("window") 7 | -- require("pr") 8 | -------------------------------------------------------------------------------- /stow/.stowrc: -------------------------------------------------------------------------------- 1 | # target folder 2 | --target=~ 3 | 4 | # verbose 5 | -v 6 | 7 | # only create links for files rather than folders, 8 | # because some config comes from both confidential and unconfidential repo. 9 | --no-folding 10 | -------------------------------------------------------------------------------- /Windows/AutoHotKey/volumn.ahk: -------------------------------------------------------------------------------- 1 | ; C:\Users\shuxiao\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup 2 | 3 | >!j::Send "{Volume_Down}" 4 | >!k::Send "{Volume_Up}" 5 | >!h::Send "{Volume_Mute}" 6 | ^!j::Send "{Volume_Down}" 7 | ^!k::Send "{Volume_Up}" 8 | ^!h::Send "{Volume_Mute}" 9 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/color.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "sainnhe/gruvbox-material", 3 | "sainnhe/sonokai", 4 | "gruvbox-community/gruvbox", 5 | "jonathanfilip/vim-lucius", 6 | "Mofiqul/dracula.nvim", 7 | "rebelot/kanagawa.nvim", 8 | "ribru17/bamboo.nvim", 9 | "projekt0n/github-nvim-theme", 10 | } 11 | -------------------------------------------------------------------------------- /pg_format/.pg_format: -------------------------------------------------------------------------------- 1 | # Change the case of the reserved keyword. Default is unchanged: 0. 2 | # Values: 0=>unchanged, 1=>lowercase, 2=>uppercase, 3=>capitalize. 3 | function-case=2 4 | 5 | # Use tabs instead of space characters, when used spaces is set to 1 whatever is its value. 6 | tabs=0 7 | 8 | # Wrap queries at a certain length. 9 | wrap-limit=88 10 | -------------------------------------------------------------------------------- /zsh/.config/zsh/00-init.zsh: -------------------------------------------------------------------------------- 1 | if [[ "$OSTYPE" == "darwin"* ]]; then 2 | # Homebrew 3 | eval "$(/opt/homebrew/bin/brew shellenv)" 4 | # Load antidote 5 | source $(brew --prefix)/opt/antidote/share/antidote/antidote.zsh 6 | else 7 | source ~/.antidote/antidote.zsh 8 | fi 9 | 10 | # initialize plugins 11 | # antidote load 12 | 13 | # Load plugins 14 | source ~/.zsh_plugins.zsh 15 | -------------------------------------------------------------------------------- /zsh/.config/zsh/01-plugins.zsh: -------------------------------------------------------------------------------- 1 | # zsh-autosuggestions 2 | ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#585858" 3 | ZSH_AUTOSUGGEST_STRATEGY=(history completion) 4 | ZSH_AUTOSUGGEST_USE_ASYNC=true 5 | bindkey '^F' autosuggest-accept 6 | 7 | # zsh-syntax-highlighting 8 | ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) 9 | ZSH_HIGHLIGHT_MAXLENGTH=512 10 | 11 | # Starship prompt 12 | eval "$(starship init zsh)" 13 | -------------------------------------------------------------------------------- /kitty/.config/moonfly.conf: -------------------------------------------------------------------------------- 1 | background #080808 2 | foreground #b2b2b2 3 | cursor #9e9e9e 4 | color0 #373c40 5 | color1 #ff5454 6 | color2 #8cc85f 7 | color3 #e3c78a 8 | color4 #80a0ff 9 | color5 #d183e8 10 | color6 #79dac8 11 | color7 #a1aab8 12 | color8 #7c8f8f 13 | color9 #ff5189 14 | color10 #36c692 15 | color11 #bfbf97 16 | color12 #78c2ff 17 | color13 #ae81ff 18 | color14 #85dc85 19 | color15 #e2637f 20 | selection_background #b2ceee 21 | selection_foreground #080808 22 | -------------------------------------------------------------------------------- /local/.local/bin/git_open: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 获取当前分支名 3 | CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) 4 | 5 | # 如果是在主分支(main 或 master),直接打开项目主页 6 | if [ "$CURRENT_BRANCH" = "main" ] || [ "$CURRENT_BRANCH" = "master" ]; then 7 | gh repo view --web 8 | exit 0 9 | fi 10 | 11 | # 检查当前分支是否已有PR 12 | PR_URL=$(gh pr list --head "$CURRENT_BRANCH" --state open --json url --jq '.[0].url') 13 | 14 | if [ -n "$PR_URL" ]; then 15 | # 已有PR,打开PR页面 16 | gh pr view --web 17 | else 18 | # 没有PR,打开创建PR页面 19 | gh pr create --web 20 | fi 21 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/mini.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "echasnovski/mini.ai", 4 | version = "*", 5 | config = function() 6 | require("mini.ai").setup({ 7 | n_lines = 1000, 8 | }) 9 | end, 10 | }, 11 | { 12 | "echasnovski/mini.splitjoin", 13 | config = function() 14 | require("mini.splitjoin").setup({ 15 | mappings = { 16 | toggle = ",", 17 | }, 18 | }) 19 | end, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /tmux/.local/bin/tmux-sessionizer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ $# -eq 1 ]]; then 4 | selected=$1 5 | else 6 | selected=$(find ~/code -mindepth 3 -maxdepth 3 -type d | fzf) 7 | fi 8 | 9 | if [[ -z $selected ]]; then 10 | exit 0 11 | fi 12 | 13 | selected_name=$(basename "$selected" | tr . _) 14 | tmux_running=$(pgrep tmux) 15 | 16 | if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then 17 | tmux new-session -s $selected_name -c $selected 18 | exit 0 19 | fi 20 | 21 | if ! tmux has-session -t=$selected_name 2>/dev/null; then 22 | tmux new-session -ds $selected_name -c $selected 23 | fi 24 | 25 | tmux switch-client -t $selected_name 26 | -------------------------------------------------------------------------------- /nvim/.config/nvim/ftplugin/go.vim: -------------------------------------------------------------------------------- 1 | " go 2 | nnoremap gj :GoAddTags json 3 | " nnoremap gt :GoTests 4 | nnoremap gl :silent !golines -w %:p 5 | 6 | nnoremap gg :call GormModify() 7 | vnoremap gg :call GormModify() 8 | 9 | function! GormModify() range 10 | execute a:firstline . "," . a:lastline . 'GoRemoveTags bson es2m' 11 | execute a:firstline . "," . a:lastline . 'GoAddTags json gorm db' 12 | silent! execute a:firstline . "," . a:lastline . 's/gorm:"\(.\{-}\)"/gorm:"column:\1;type:text"/g' 13 | endfunction 14 | 15 | nnoremap vv v(textobj-backtick-i) :!pg_format 16 | -------------------------------------------------------------------------------- /nvim/.config/nvim/queries/go/textobjects.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | (literal_element) @parameter.inner 4 | 5 | (keyed_element) @parameter.inner 6 | 7 | (literal_element) @parameter.outer 8 | 9 | (keyed_element) @parameter.outer 10 | 11 | (literal_element) @keyed_element 12 | 13 | (return_statement 14 | (expression_list 15 | "," @_start . 16 | (_) @parameter.inner 17 | (#make-range! "parameter.outer" @_start @parameter.inner)) 18 | ) 19 | 20 | (return_statement 21 | (expression_list 22 | . (_) @parameter.inner 23 | . ","? @_end 24 | (#make-range! "parameter.outer" @parameter.inner @_end)) 25 | ) 26 | 27 | (if_statement 28 | condition: (_) @parameter.inner) 29 | 30 | (expression_list) @expression_list 31 | 32 | (call_expression) @call_expression 33 | -------------------------------------------------------------------------------- /Windows/alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [terminal.shell] 2 | program = "Arch" 3 | 4 | [general] 5 | # import = ["gruvbox.toml"] 6 | 7 | [env] 8 | TERM = "screen-256color" 9 | 10 | [terminal] 11 | osc52 = "CopyPaste" 12 | 13 | [window] 14 | dimensions = { columns = 120, lines = 45 } 15 | padding = { x = 1, y = 1 } 16 | decorations = "full" 17 | dynamic_title = false 18 | # opacity = 0.9 19 | 20 | [font] 21 | # normal = { family = "Recursive Nerd Font", style = "Regular" } 22 | # size = 11 23 | # offset = { x = 1, y = 1 } 24 | normal = { family = "Consolas Nerd Font", style = "Regular" } 25 | # normal = { family = "IosevkaTaiga Nerd Font", style = "Regular" } 26 | size = 12 27 | offset = { x = 1, y = 1 } 28 | 29 | [keyboard] 30 | bindings = [ 31 | { action = "Paste", key = "V", mods = "Alt" }, 32 | { action = "Copy", key = "C", mods = "Alt" }, 33 | ] 34 | -------------------------------------------------------------------------------- /kitty/.config/taiga.conf: -------------------------------------------------------------------------------- 1 | font_size 14.0 2 | adjust_line_height 2 3 | cursor_blink_interval 1 4 | cursor #ff69b4 5 | cursor_text_color #eeeeee 6 | 7 | url_style double 8 | open_url_modifiers cmd 9 | inactive_text_alpha 0.75 10 | # hide_window_decorations titlebar-only 11 | tab_bar_style separator 12 | tab_separator " ┇ " 13 | dynamic_background_opacity yes 14 | 15 | window_border_width 2 16 | draw_minimal_borders no 17 | window_margin_width 0 18 | active_border_color #e5e5e5 19 | 20 | inactive_border_color #333333 21 | inactive_text_alpha 0.65 22 | 23 | macos_titlebar_color system 24 | macos_thicken_font 1 25 | 26 | map alt+c copy_to_clipboard 27 | map alt+v paste_from_clipboard 28 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/vim-plugins.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "voldikss/vim-floaterm", 3 | { 4 | "junegunn/vim-easy-align", 5 | lazy = false, 6 | }, 7 | "kshenoy/vim-signature", -- 用于在侧边符号栏显示 marks (ma-mz 记录的位置) 8 | "tpope/vim-abolish", -- crs/crm/crc 9 | "preservim/nerdcommenter", 10 | "tpope/vim-repeat", 11 | "matze/vim-move", 12 | "szw/vim-maximizer", 13 | { 14 | "ojroques/vim-oscyank", 15 | -- tag = "v1.0.0", -- new version breaks, old version is good enough 16 | }, 17 | { 18 | "fatih/vim-go", 19 | ft = "go", 20 | event = "VeryLazy", 21 | }, 22 | -- https://github.com/buoto/gotests-vim/pull/10 23 | { 24 | "jakereps/gotests-vim", 25 | ft = "go", 26 | branch = "patch-1", 27 | event = "VeryLazy", 28 | }, 29 | "svban/YankAssassin.vim", 30 | "prisma/vim-prisma", 31 | } 32 | -------------------------------------------------------------------------------- /zsh/.config/zsh/02-options.zsh: -------------------------------------------------------------------------------- 1 | # History 2 | HISTFILE="$HOME/.zsh_history" 3 | HISTSIZE=10000 4 | SAVEHIST=8000 5 | setopt SHARE_HISTORY # 共享历史 6 | setopt HIST_IGNORE_ALL_DUPS # 忽略重复 7 | setopt HIST_FIND_NO_DUPS # 搜索时不显示重复 8 | setopt HIST_IGNORE_SPACE # 忽略空格开头的命令 9 | setopt HIST_REDUCE_BLANKS # 删除多余空格 10 | setopt INC_APPEND_HISTORY # 实时追加历史 11 | 12 | # Completion 13 | autoload -Uz compinit 14 | if [[ -n $HOME/.zcompdump(#qN.mh+24) ]]; then 15 | compinit -i 16 | else 17 | compinit -C -i 18 | fi 19 | 20 | # Completion config 21 | zstyle ':completion:*' menu select 22 | zstyle ':completion:*' list-colors '' 23 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 24 | zstyle ':completion:*' rehash true 25 | 26 | # zsh options 27 | setopt AUTO_CD # 输入目录名自动 cd 28 | setopt EXTENDED_GLOB # 扩展通配符 29 | setopt NO_CASE_GLOB # 不区分大小写 30 | setopt INTERACTIVE_COMMENTS # 允许注释 31 | -------------------------------------------------------------------------------- /selene/.config/selene/vim.toml: -------------------------------------------------------------------------------- 1 | [selene] 2 | base = "lua51" 3 | name = "vim" 4 | 5 | [vim] 6 | any = true 7 | 8 | [[describe.args]] 9 | type = "string" 10 | [[describe.args]] 11 | type = "function" 12 | 13 | [[it.args]] 14 | type = "string" 15 | [[it.args]] 16 | type = "function" 17 | 18 | [[before_each.args]] 19 | type = "function" 20 | [[after_each.args]] 21 | type = "function" 22 | 23 | [assert.is_not] 24 | any = true 25 | 26 | [assert.matches] 27 | any = true 28 | 29 | [assert.has_error] 30 | any = true 31 | 32 | [[assert.equals.args]] 33 | type = "any" 34 | [[assert.equals.args]] 35 | type = "any" 36 | [[assert.equals.args]] 37 | type = "any" 38 | required = false 39 | 40 | [[assert.same.args]] 41 | type = "any" 42 | [[assert.same.args]] 43 | type = "any" 44 | 45 | [[assert.truthy.args]] 46 | type = "any" 47 | 48 | [[assert.falsy.args]] 49 | type = "any" 50 | 51 | [[assert.spy.args]] 52 | type = "any" 53 | 54 | [[assert.stub.args]] 55 | type = "any" 56 | -------------------------------------------------------------------------------- /zsh/.config/zsh/04-path.zsh: -------------------------------------------------------------------------------- 1 | # Find command in priority order 2 | typeset -U path # Keep unique entries only 3 | 4 | path=( 5 | # Go 6 | /usr/local/go/bin 7 | $HOME/code/go/bin 8 | $GOPATH/bin 9 | 10 | # Development tools 11 | $HOME/.local/share/nvim/mason/bin 12 | $HOME/code/gems/bin 13 | $HOME/.cargo/bin 14 | $HOME/.dotnet/tools 15 | 16 | # Node (n) 17 | $N_PREFIX/bin 18 | 19 | # Python 20 | $PYENV_ROOT/bin 21 | 22 | # JDK (macOS) 23 | /usr/local/opt/openjdk/bin 24 | /opt/homebrew/opt/openjdk/bin 25 | 26 | # CUDA (Linux) 27 | /usr/local/cuda/bin # Ubuntu/Debian 28 | /opt/cuda/bin # Arch 29 | 30 | # System 31 | $HOME/.local/bin 32 | /opt/homebrew/bin 33 | /opt/homebrew/sbin 34 | /usr/local/bin 35 | /usr/local/sbin 36 | /usr/local 37 | /usr/bin 38 | /usr/sbin 39 | 40 | # Keep existing PATH 41 | $path 42 | ) 43 | 44 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/options_post.vim: -------------------------------------------------------------------------------- 1 | " cSpell:disable 2 | 3 | " set background=dark 4 | 5 | " let g:sonokai_style = 'shusia' 6 | " colorscheme sonokai 7 | " colorscheme kanagawa-lotus 8 | 9 | let g:gruvbox_material_current_word = "underline" 10 | let g:gruvbox_material_background = 'medium' 11 | let g:gruvbox_material_enable_bold = 1 12 | let g:gruvbox_material_diagnostic_text_highlight = 1 13 | colorscheme gruvbox-material 14 | 15 | set termguicolors 16 | set t_Co=256 " 允许256色 17 | let &t_8f = "\[38;2;%lu;%lu;%lum" 18 | let &t_8b = "\[48;2;%lu;%lu;%lum" 19 | 20 | highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine 21 | highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine 22 | highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine 23 | highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine 24 | highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine 25 | highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine 26 | -------------------------------------------------------------------------------- /logo/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # usage: ./auto.sh image.png 4 | # need `brew install imagemagick` first 5 | # source: https://stackoverflow.com/a/41147126 6 | 7 | sizes=(16 32 64 128 256 512) 8 | largfile='icon_512x512@2x.png' 9 | if [ ! -f "$largfile" ]; then 10 | convert -background none -resize 1024x1024 "$1" "$largfile" 11 | fi 12 | for s in "${sizes[@]}"; do 13 | # echo $s 14 | convert -background none -resize ${s}x${s} "$largfile" "icon_${s}x$s.png" 15 | done 16 | 17 | cp 'icon_32x32.png' 'icon_16x16@2x.png' 18 | mv 'icon_64x64.png' 'icon_32x32@2x.png' 19 | cp 'icon_256x256.png' 'icon_128x128@2x.png' 20 | cp 'icon_512x512.png' 'icon_256x256@2x.png' 21 | 22 | IN="$1" 23 | fileName=(${IN//./ }) 24 | folder=${fileName[0]} 25 | 26 | iconset="$folder.iconset" 27 | mkdir -p "$iconset" 28 | 29 | mv icon_*x*.png "$iconset" 30 | iconutil -c icns "$iconset" 31 | 32 | rm "$iconset"/icon_*x*.png 33 | 34 | mv "$folder.icns" "$iconset" 35 | mv "$1" "$iconset" 36 | 37 | mv "$iconset" "$folder" 38 | 39 | -------------------------------------------------------------------------------- /tmux/.local/bin/tmux-new-window: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | prefix=( 4 | "$(pwd)" 5 | ) 6 | 7 | suffix=( 8 | "$HOME/.config" 9 | "$HOME/.local" 10 | "$HOME/Downloads" 11 | ) 12 | 13 | search=$(fd --type d \ 14 | --max-depth 3 \ 15 | --hidden \ 16 | --exclude "bin" \ 17 | --exclude "go" \ 18 | --exclude "include" \ 19 | --exclude "lib" \ 20 | --exclude "n" \ 21 | --exclude "share" \ 22 | --follow \ 23 | . \ 24 | "$HOME/code") 25 | 26 | lines=$( 27 | #1 28 | for p in "${prefix[@]}"; do 29 | # only use it when path exist 30 | [[ -d "${p}" ]] && printf '%s\n' "$p" 31 | done 32 | 33 | #2 append fd results 34 | printf '%s' "$search" 35 | 36 | #3 37 | for p in "${suffix[@]}"; do 38 | # only use it when path exist 39 | [[ -d "${p}" ]] && printf '%s\n' "$p" 40 | done 41 | ) 42 | 43 | selected="$(printf '%s\n' "$(echo "${lines}" | fzf)")" 44 | 45 | [[ ${#selected} != 0 ]] || exit 0 46 | 47 | selected_name=$(basename "$selected" | tr . _) 48 | 49 | tmux new-window -c "$selected" -n "$selected_name" -b 50 | -------------------------------------------------------------------------------- /nvim/.config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 3 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" 4 | local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) 5 | if vim.v.shell_error ~= 0 then 6 | vim.api.nvim_echo({ 7 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, 8 | { out, "WarningMsg" }, 9 | { "\nPress any key to exit..." }, 10 | }, true, {}) 11 | vim.fn.getchar() 12 | os.exit(1) 13 | end 14 | end 15 | vim.opt.rtp:prepend(lazypath) 16 | 17 | vim.cmd("source ~/.config/nvim/lua/vim-plugins.vim") 18 | vim.cmd("source ~/.config/nvim/lua/keymaps.vim") 19 | vim.cmd("source ~/.config/nvim/lua/options_prev.vim") 20 | 21 | require("lazy").setup({ 22 | spec = { { import = "plugins" } }, 23 | change_detection = { notify = false }, 24 | }) 25 | 26 | vim.cmd("source ~/.config/nvim/lua/options_post.vim") 27 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lsp/vtsls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | filetypes = { 3 | "javascript", 4 | "javascriptreact", 5 | "javascript.jsx", 6 | -- "typescript", 7 | -- "typescriptreact", 8 | -- "typescript.tsx", 9 | }, 10 | root_dir = function(bufnr, on_dir) 11 | -- The project root is where the LSP can be started from 12 | -- As stated in the documentation above, this LSP supports monorepos and simple projects. 13 | 14 | -- We select then from the project root, which is identified by the presence of a package 15 | -- manager lock file. 16 | local root_markers = 17 | { "package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock" } 18 | -- Give the root markers equal priority by wrapping them in a table 19 | -- We fallback to the current working directory if no project root is found 20 | local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() 21 | 22 | on_dir(project_root) 23 | end, 24 | } 25 | -------------------------------------------------------------------------------- /macOS/brew/Brewfile: -------------------------------------------------------------------------------- 1 | tap "homebrew/bundle" 2 | brew "python@3.11" 3 | brew "ansible" 4 | brew "curl" 5 | brew "exa" 6 | brew "fd" 7 | brew "fish" 8 | brew "fzf" 9 | brew "git" 10 | brew "gitui" 11 | brew "go" 12 | brew "htop" 13 | brew "lf" 14 | brew "mtr" 15 | brew "n" 16 | brew "neofetch" 17 | brew "neovim" 18 | brew "orbstack" 19 | brew "pgformatter" 20 | brew "ripgrep" 21 | brew "starship" 22 | brew "stow" 23 | brew "tmux" 24 | brew "v2ray" 25 | brew "vim" 26 | brew "wget" 27 | cask "1password" 28 | cask "alacritty" 29 | cask "alt-tab" 30 | cask "barrier" 31 | cask "bilibili" 32 | cask "dbeaver-community" 33 | cask "google-chrome" 34 | cask "hiddenbar" 35 | cask "iina" 36 | cask "itsycal" 37 | cask "karabiner-elements" 38 | cask "linearmouse" 39 | cask "microsoft-auto-update" 40 | cask "microsoft-office" 41 | cask "microsoft-remote-desktop" 42 | cask "notion" 43 | cask "openvpn-connect" 44 | cask "rapidapi" 45 | cask "slack" 46 | cask "squirrel" 47 | cask "tailscale" 48 | cask "visual-studio-code" 49 | cask "wechat" 50 | cask "wechatwork" 51 | cask "zoom" 52 | cask "skype" 53 | -------------------------------------------------------------------------------- /zsh/.config/zsh/03-env.zsh: -------------------------------------------------------------------------------- 1 | # XDG Base Directory 2 | export XDG_CONFIG_HOME="$HOME/.config" 3 | export XDG_CACHE_HOME="$HOME/.cache" 4 | 5 | # Editor 6 | export VISUAL=nvim 7 | export EDITOR=nvim 8 | export GIT_EDITOR=nvim 9 | 10 | # Locale 11 | export LANG="en_US.UTF-8" 12 | export LC_CTYPE="en_US.UTF-8" 13 | export LC_ALL="en_US.UTF-8" 14 | 15 | # GPG 16 | export GPG_TTY=$(tty) 17 | 18 | # Go 19 | export GOPATH="$HOME/code/go" 20 | # export GOPROXY=https://goproxy.cn,direct 21 | 22 | # Node (n-install) 23 | export N_PREFIX="$HOME/code/n" 24 | 25 | # Mise 26 | export MISE_ENV_FILE=".env" 27 | 28 | # macOS specific 29 | if [[ "$OSTYPE" == "darwin"* ]]; then 30 | export HOMEBREW_NO_AUTO_UPDATE=1 31 | export HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK=1 32 | export SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" 33 | fi 34 | 35 | # Starship 36 | export STARSHIP_CONFIG="$HOME/.config/zsh/starship.toml" 37 | 38 | # z.lua 39 | export _ZL_MATCH_MODE=1 40 | export _ZL_CMD=z 41 | export _ZL_ADD_ONCE=1 42 | 43 | # fzf 44 | export FZF_DEFAULT_OPTS='--height 60% --layout=reverse --border' 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Shuxiao WANG 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /zsh/.config/zsh/starship.toml: -------------------------------------------------------------------------------- 1 | # Inserts a blank line between shell prompts 2 | add_newline = true 3 | command_timeout = 1000 4 | 5 | [directory] 6 | truncation_length = 0 7 | truncate_to_repo = false 8 | 9 | [git_branch] 10 | format = "[$branch]($style) " 11 | # format = "[$symbol$branch]($style) " 12 | 13 | [golang] 14 | format = "[$symbol()]($style)" 15 | disabled = true 16 | 17 | [cmd_duration] 18 | format = "[$duration]($style) " 19 | min_time = 3_000 20 | 21 | [character] 22 | success_symbol = "[Δ](bold green)" 23 | error_symbol = "[✘](bold red)" 24 | vicmd_symbol = "[Ε](bold blue) " 25 | 26 | [username] 27 | style_user = "yellow bold" 28 | style_root = "black bold" 29 | format = "[$user@]($style)" 30 | disabled = false 31 | 32 | [hostname] 33 | ssh_only = true 34 | format = "[$hostname](bold yellow) " 35 | disabled = false 36 | 37 | [git_status] 38 | format = '([\[$conflicted$deleted$renamed$modified$staged$untracked\]]($style))' 39 | conflicted = '!' 40 | 41 | [package] 42 | disabled = true 43 | 44 | [gcloud] 45 | disabled = true 46 | 47 | [aws] 48 | disabled = true 49 | 50 | [dotnet] 51 | disabled = true 52 | 53 | [lua] 54 | disabled = true 55 | 56 | [docker_context] 57 | disabled = true 58 | -------------------------------------------------------------------------------- /fish/.config/fish/starship.toml: -------------------------------------------------------------------------------- 1 | # Inserts a blank line between shell prompts 2 | add_newline = true 3 | command_timeout = 1000 4 | 5 | [directory] 6 | truncation_length = 0 7 | truncate_to_repo = false 8 | 9 | [git_branch] 10 | format = "[$branch]($style) " 11 | # format = "[$symbol$branch]($style) " 12 | 13 | [golang] 14 | format = "[$symbol()]($style)" 15 | disabled = true 16 | 17 | [cmd_duration] 18 | format = "[$duration]($style) " 19 | min_time = 3_000 20 | 21 | [character] 22 | success_symbol = "[Δ](bold green)" 23 | error_symbol = "[✘](bold red)" 24 | vicmd_symbol = "[Ε](bold blue) " 25 | 26 | [username] 27 | style_user = "yellow bold" 28 | style_root = "black bold" 29 | format = "[$user@]($style)" 30 | disabled = false 31 | 32 | [hostname] 33 | ssh_only = true 34 | format = "[$hostname](bold yellow) " 35 | disabled = false 36 | 37 | [git_status] 38 | format = '([\[$conflicted$deleted$renamed$modified$staged$untracked\]]($style))' 39 | conflicted = '!' 40 | 41 | [package] 42 | disabled = true 43 | 44 | [gcloud] 45 | disabled = true 46 | 47 | [aws] 48 | disabled = true 49 | 50 | [dotnet] 51 | disabled = true 52 | 53 | [lua] 54 | disabled = true 55 | 56 | [docker_context] 57 | disabled = true 58 | -------------------------------------------------------------------------------- /nvim/.config/nvim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "sumneko-lua.enableNvimLuaDev": true, 3 | "Lua": { 4 | "workspace": { 5 | "checkThirdParty": false, 6 | "library": ["${3rd}/luv/library"] 7 | }, 8 | "hint.enable": false 9 | }, 10 | "ruff": { 11 | "autoFixOnSave": true, 12 | "nativeServer": true 13 | }, 14 | "git": { 15 | "addGBlameToVirtualText": true 16 | }, 17 | "coc": { 18 | "preferences": { 19 | "colorSupport": true 20 | }, 21 | "source": { 22 | "emoji": { 23 | "filetypes": null, 24 | "triggerCharacters": ["/"] 25 | }, 26 | "word.priority": -1, 27 | "dictionary.priority": -1 28 | } 29 | }, 30 | "inlayHint": { 31 | "enable": false 32 | }, 33 | "diagnostic": { 34 | "enable": false, 35 | "errorSign": "", 36 | "warningSign": "", 37 | "infoSign": "", 38 | "hintSign": "" 39 | }, 40 | "snippets": { 41 | "ultisnips": { 42 | "directories": ["$HOME/.config/nvim/ultisnips"], 43 | "pythonPrompt": false 44 | } 45 | }, 46 | "languageserver": { 47 | "terraform": { 48 | "command": "terraform-ls", 49 | "args": ["serve"], 50 | "filetypes": ["terraform", "tf"], 51 | "initializationOptions": {}, 52 | "settings": {} 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /server/.tmux.conf: -------------------------------------------------------------------------------- 1 | set -g @scroll-speed-num-lines-per-scroll 3 2 | set -g mouse on 3 | set -g history-limit 100000 4 | set -g display-time 4000 5 | set -g focus-events on 6 | set -g prefix C-a 7 | bind C-a send-prefix 8 | unbind C-b 9 | # reload config 10 | bind R source-file ~/.tmux.conf 11 | bind x kill-pane 12 | # window switch 13 | bind -r n next-window 14 | bind -r p previous-window 15 | # window rename 16 | bind-key c new-window #\; rename-window "#{b:pane_current_path}" 17 | bind-key r command-prompt "rename-window %%" 18 | # pane split 19 | bind | split-window -h -c "#{pane_current_path}" 20 | bind \\ split-window -h -c "#{pane_current_path}" 21 | bind - split-window -v -c "#{pane_current_path}" 22 | # pane resizing 23 | bind -r C-k resize-pane -U 5 24 | bind -r C-j resize-pane -D 5 25 | bind -r C-h resize-pane -L 5 26 | bind -r C-l resize-pane -R 5 27 | # pane switching 28 | bind k select-pane -U 29 | bind j select-pane -D 30 | bind h select-pane -L 31 | bind l select-pane -R 32 | set -g status-style "fg=white,bg=black" 33 | set -g window-status-current-style "fg=black,bg=yellow,bold" 34 | set -g window-status-style "fg=white,bg=colour238" 35 | set -g pane-border-style "fg=white" 36 | set -g pane-active-border-style "fg=yellow" 37 | set -g status-right "#[fg=yellow] %H:%M #[fg=white]| #[fg=yellow]%Y-%m-%d" 38 | -------------------------------------------------------------------------------- /zsh/.config/zsh/09-final.zsh: -------------------------------------------------------------------------------- 1 | # ============================================================ 2 | # Final Configuration & Tool Initialization 3 | # ============================================================ 4 | 5 | # Color settings 6 | export CLICOLOR=1 7 | export LSCOLORS=ExFxBxDxCxegedabagacad 8 | 9 | # z.lua initialization 10 | if [[ -f "$HOME/.local/bin/z.lua" ]]; then 11 | eval "$(lua "$HOME/.local/bin/z.lua" --init zsh)" 12 | fi 13 | 14 | # fzf key bindings 15 | if command -v fzf &>/dev/null; then 16 | source <(fzf --zsh) 17 | fi 18 | 19 | # macOS specific initialization 20 | if [[ "$OSTYPE" == "darwin"* ]]; then 21 | # Disable CapsLock delay when switching Input Method 22 | if [[ ! -f "$HOME/.cache/capslock_delay_disabled" ]]; then 23 | hidutil property --set '{"CapsLockDelayOverride":0}' &>/dev/null 24 | mkdir -p "$HOME/.cache" 25 | touch "$HOME/.cache/capslock_delay_disabled" 26 | fi 27 | fi 28 | 29 | # Load confidential configurations (if exist) 30 | [[ -f "$HOME/.config/zsh/cc.zsh" ]] && source "$HOME/.config/zsh/cc.zsh" 31 | [[ -f "$HOME/.config/zsh/mewtant.zsh" ]] && source "$HOME/.config/zsh/mewtant.zsh" 32 | 33 | # Key bindings 34 | # Alt+E: Open nvim 35 | bindkey -s '\ee' 'nvim\n' 36 | # Alt+I: Edit command in editor 37 | autoload -z edit-command-line 38 | zle -N edit-command-line 39 | bindkey '\ei' edit-command-line 40 | -------------------------------------------------------------------------------- /macOS/hammerspoon/.hammerspoon/window.lua: -------------------------------------------------------------------------------- 1 | -- Window management hotkeys 2 | hs.hotkey.bind({ "cmd", "ctrl" }, "Left", function() 3 | local win = hs.window.focusedWindow() 4 | local f = win:frame() 5 | local screen = win:screen() 6 | local max = screen:frame() 7 | 8 | f.x = max.x 9 | f.y = max.y 10 | f.w = max.w * 3 / 4 11 | f.h = max.h 12 | win:setFrame(f) 13 | end) 14 | 15 | hs.hotkey.bind({ "cmd", "ctrl" }, "Right", function() 16 | local win = hs.window.focusedWindow() 17 | local f = win:frame() 18 | local screen = win:screen() 19 | local max = screen:frame() 20 | 21 | f.x = max.x + max.w * 1 / 4 22 | f.y = max.y 23 | f.w = max.w * 3 / 4 24 | f.h = max.h 25 | win:setFrame(f) 26 | end) 27 | 28 | hs.hotkey.bind({ "cmd", "ctrl" }, "Up", function() 29 | local win = hs.window.focusedWindow() 30 | local f = win:frame() 31 | local screen = win:screen() 32 | local max = screen:frame() 33 | 34 | f.x = max.x 35 | f.y = max.y 36 | f.w = max.w 37 | f.h = max.h 38 | win:setFrame(f) 39 | end) 40 | 41 | hs.hotkey.bind({ "cmd", "ctrl" }, "Down", function() 42 | local win = hs.window.focusedWindow() 43 | local f = win:frame() 44 | local screen = win:screen() 45 | local max = screen:frame() 46 | 47 | f.x = max.x + max.w * 1 / 40 48 | f.y = max.y + max.h * 1 / 40 49 | f.w = max.w * 0.95 50 | f.h = max.h * 0.95 51 | win:setFrame(f) 52 | end) 53 | -------------------------------------------------------------------------------- /server/.local/bin/clone: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import re 5 | import os 6 | 7 | 8 | def main(): 9 | if len(sys.argv) == 1: 10 | sys.exit(0) 11 | elif len(sys.argv) == 2: 12 | clone(sys.argv[1]) 13 | 14 | 15 | def clone(url: str) -> None: 16 | host, org, repo = split_url(url) 17 | if host == "": 18 | print('no host') 19 | return None 20 | 21 | dir = get_dir() 22 | target = os.path.join(dir, host, org, repo) 23 | 24 | git_url = f"git@{host}:{org}/{repo}.git" 25 | cmd = f"git clone {git_url} {target}" 26 | print(cmd, flush=True) 27 | if os.path.exists(target): 28 | return 29 | run(cmd) 30 | 31 | 32 | def get_dir() -> str: 33 | return os.path.expanduser("~/code") 34 | 35 | 36 | def split_url(url: str) -> tuple[str, str, str]: 37 | # https://github.com/keaising/dotfile 38 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+)" 39 | if url.endswith("git"): 40 | # https://github.com/keaising/dotfile.git 41 | # git@github.com:keaising/dotfile.git 42 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+).git" 43 | result = re.match(reg_ex, url) 44 | if result is None: 45 | return "", "", "" 46 | return (result.group("host_name"), result.group("org"), result.group("repo")) 47 | 48 | 49 | def fetch(command: str) -> str: 50 | return os.popen(command).read().strip() 51 | 52 | 53 | def run(command: str) -> None: 54 | os.system(command) 55 | 56 | 57 | main() 58 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lsp/gopls.lua: -------------------------------------------------------------------------------- 1 | local mod_cache = nil 2 | 3 | ---@param fname string 4 | ---@return string? 5 | local function get_root(fname) 6 | if mod_cache and fname:sub(1, #mod_cache) == mod_cache then 7 | local clients = vim.lsp.get_clients({ name = "gopls" }) 8 | if #clients > 0 then 9 | return clients[#clients].config.root_dir 10 | end 11 | end 12 | return vim.fs.root(fname, { "go.work", "go.mod", ".git" }) 13 | end 14 | 15 | return { 16 | cmd = { "gopls" }, 17 | filetypes = { "go", "gomod", "gowork", "gotmpl" }, 18 | root_dir = function(bufnr, on_dir) 19 | local fname = vim.api.nvim_buf_get_name(bufnr) 20 | -- see: https://github.com/neovim/nvim-lspconfig/issues/804 21 | if mod_cache then 22 | on_dir(get_root(fname)) 23 | return 24 | end 25 | 26 | local cmd = { "go", "env", "GOMODCACHE" } 27 | vim.system(cmd, { text = true }, function(output) 28 | if output.code == 0 then 29 | if output.stdout then 30 | mod_cache = vim.trim(output.stdout) 31 | end 32 | on_dir(get_root(fname)) 33 | else 34 | vim.notify(("[gopls] cmd failed with code %d: %s\n%s"):format(output.code, cmd, output.stderr)) 35 | end 36 | end) 37 | end, 38 | settings = { 39 | gopls = { 40 | completeUnimported = true, 41 | usePlaceholders = false, 42 | analyses = { 43 | unusedparams = true, 44 | }, 45 | }, 46 | }, 47 | } 48 | -------------------------------------------------------------------------------- /nvim/.config/nvim/ultisnips/go.snippets: -------------------------------------------------------------------------------- 1 | snippet if "With Single Field" 2 | if err != nil { 3 | ${1} 4 | }${0} 5 | endsnippet 6 | 7 | snippet cc "context.TODO" i 8 | context.TODO(), 9 | endsnippet 10 | 11 | snippet ccc "ctx context.Context" i 12 | ctx context.Context 13 | endsnippet 14 | 15 | snippet logr "With Fields" i 16 | logrus.WithFields(f).Errorln("${1}", err)${0} 17 | endsnippet 18 | 19 | snippet logrr "With Fields" i 20 | logrus.WithFields(f).Errorln("${1}", err)${0} 21 | endsnippet 22 | 23 | snippet logf "logrus Fields" i 24 | f := logrus.Fields{"$1": $2} 25 | endsnippet 26 | 27 | snippet nowdate "now date" 28 | time.Now().Format("2006-01-02") ${0} 29 | endsnippet 30 | 31 | snippet now "now" 32 | time.Now().Unix()${0} 33 | endsnippet 34 | 35 | snippet spew "spew" i 36 | spew.Printf("${1}: %#+v\n", ${1})${0} 37 | endsnippet 38 | 39 | snippet yyyy "now date" 40 | "2006-01-02" ${0} 41 | endsnippet 42 | 43 | snippet predi "" 44 | func(${1:item} ${2:model}) bool { 45 | return ${3:true} 46 | } 47 | endsnippet 48 | 49 | snippet iter "" 50 | func(${1:item} ${2:T}, _ int) ${3:R} { 51 | return ${4:ret} 52 | } 53 | endsnippet 54 | 55 | snippet lofil "" 56 | lo.Filter(${1:slice}, func($2 ${3:T}, _ int) bool { 57 | return ${4:true} 58 | }) 59 | endsnippet 60 | 61 | snippet lomap "" 62 | lo.Map(${1:slice}, func(${2:item} ${3:T}, _ int) string { 63 | return ${4:ret} 64 | }) 65 | endsnippet 66 | 67 | snippet lofind "" 68 | lo.Find(${1:slice}, func(${2:item} ${3:model}) bool { 69 | return ${4:true} 70 | }) 71 | endsnippet 72 | 73 | snippet del "" 74 | "deleted": true, 75 | "deleted_by": c.DashboardUserEmail(), 76 | "deleted_at": time.Now().Unix(), 77 | endsnippet 78 | 79 | snippet upd "" 80 | "updated_by": c.DashboardUserEmail(), 81 | "updated_at": time.Now().Unix(), 82 | endsnippet 83 | 84 | snippet kv "key value" i 85 | "$1": $1$0 86 | endsnippet 87 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/gitsigns.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "lewis6991/gitsigns.nvim", 4 | config = function() 5 | require("gitsigns").setup({ 6 | attach_to_untracked = true, 7 | -- this blame info will cover my code, annoying! 8 | current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` 9 | current_line_blame_opts = { 10 | virt_text = true, 11 | virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' 12 | delay = 300, 13 | ignore_whitespace = true, 14 | }, 15 | current_line_blame_formatter = "  , ", 16 | sign_priority = 0, 17 | status_formatter = nil, -- Use default 18 | max_file_length = 3000, 19 | }) 20 | end, 21 | }, 22 | { 23 | "ruifm/gitlinker.nvim", 24 | dependencies = { "nvim-lua/plenary.nvim" }, 25 | config = function() 26 | require("gitlinker").setup({ 27 | opts = { 28 | print_url = false, 29 | }, 30 | }) 31 | vim.api.nvim_set_keymap( 32 | "n", 33 | "gh", 34 | 'lua require"gitlinker".get_buf_range_url("n", {action_callback = require"gitlinker.actions".open_in_browser})', 35 | { silent = true } 36 | ) 37 | vim.api.nvim_set_keymap( 38 | "v", 39 | "gh", 40 | 'lua require"gitlinker".get_buf_range_url("v", {action_callback = require"gitlinker.actions".open_in_browser})', 41 | {} 42 | ) 43 | end, 44 | }, 45 | } 46 | -------------------------------------------------------------------------------- /local/.local/bin/ins: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env fish 2 | 3 | function ins_nvim 4 | rm -rf ~/.local/bin/nvim 5 | sudo rm -f /usr/local/bin/nvim 6 | mkdir -p ~/.local/bin 7 | 8 | set -l WORKDIR "$(mktemp -d)" 9 | cd $WORKDIR 10 | 11 | set -l VERSION nightly 12 | [ $argv[1] ] && set -l VERSION $argv[1] 13 | 14 | set -l NVIM_FILE nvim-linux-x86_64 15 | [ (uname) != Linux ] && set -l NVIM_FILE nvim-macos-arm64 16 | wget https://github.com/neovim/neovim/releases/download/$VERSION/$NVIM_FILE.tar.gz 17 | tar -zxf $NVIM_FILE.tar.gz 18 | rm $NVIM_FILE.tar.gz 19 | mv $NVIM_FILE ~/.local/bin/nvim 20 | 21 | rm -r $WORKDIR 22 | 23 | sudo ln -s ~/.local/bin/nvim/bin/nvim /usr/local/bin/nvim 24 | nvim --version 25 | end 26 | 27 | function ins_gotools 28 | set -lx GOPROXY "https://goproxy.cn" 29 | set -lx GO111MODULE on 30 | 31 | go version 32 | echo $PWD 33 | # go env 34 | 35 | set -l REPOS \ 36 | golang.org/x/tools/gopls \ 37 | github.com/go-delve/delve/cmd/dlv \ 38 | github.com/haya14busa/goplay/cmd/goplay \ 39 | github.com/fatih/gomodifytags \ 40 | github.com/josharian/impl \ 41 | github.com/cweill/gotests/... \ 42 | honnef.co/go/tools/cmd/staticcheck \ 43 | github.com/golangci/golangci-lint/cmd/golangci-lint \ 44 | github.com/rinchsan/gosimports/cmd/gosimports \ 45 | github.com/segmentio/golines \ 46 | github.com/kisielk/errcheck \ 47 | golang.org/x/vuln/cmd/govulncheck 48 | 49 | for repo in $REPOS 50 | set -l run "go install $repo@latest" 51 | echo $run 52 | eval $run 53 | end 54 | 55 | end 56 | 57 | function main 58 | switch $argv[1] 59 | case nvim 60 | ins_nvim $argv[2..-1] 61 | case go gotools 62 | ins_gotools 63 | end 64 | end 65 | 66 | main $argv 67 | -------------------------------------------------------------------------------- /backup/repro.lua: -------------------------------------------------------------------------------- 1 | -- DO NOT change the paths and don't remove the colorscheme 2 | local root = vim.fn.fnamemodify("./.repro", ":p") 3 | 4 | -- set stdpaths to use .repro 5 | for _, name in ipairs({ "config", "data", "state", "cache" }) do 6 | vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name 7 | end 8 | 9 | -- bootstrap lazy 10 | local lazypath = root .. "/plugins/lazy.nvim" 11 | if not vim.loop.fs_stat(lazypath) then 12 | vim.fn.system({ 13 | "git", 14 | "clone", 15 | "--filter=blob:none", 16 | "--single-branch", 17 | "https://github.com/folke/lazy.nvim.git", 18 | lazypath, 19 | }) 20 | end 21 | vim.opt.runtimepath:prepend(lazypath) 22 | 23 | -- install plugins 24 | vim.keymap.set("n", "e", "(x-file-explorer)", { silent = true }) 25 | local M = { 26 | "nvim-telescope/telescope.nvim", 27 | dependencies = { 28 | "nvim-lua/plenary.nvim", 29 | "nvim-telescope/telescope-ui-select.nvim", 30 | "nvim-treesitter/nvim-treesitter", 31 | }, 32 | config = function() 33 | local bufopts = { noremap = true, silent = true } 34 | local builtin = require("telescope.builtin") 35 | vim.keymap.set("n", "gb", function() 36 | builtin.git_bcommits({ 37 | git_command = { 38 | "git", 39 | "log", 40 | -- "--pretty=oneline", 41 | -- "--abbrev-commit", 42 | "--date=format:%y/%m/%d", 43 | "--pretty=format:%C(auto) %h %ad %s", 44 | "--follow", 45 | }, 46 | }) 47 | end, bufopts) 48 | vim.keymap.set("n", "gj", builtin.git_bcommits, bufopts) 49 | 50 | require("telescope").setup({}) 51 | end, 52 | } 53 | local plugins = { 54 | M, 55 | } 56 | require("lazy").setup(plugins, { 57 | root = root .. "/plugins", 58 | }) 59 | -------------------------------------------------------------------------------- /local/.local/bin/clone: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import re 5 | import os 6 | 7 | 8 | def main(): 9 | if len(sys.argv) == 1: 10 | sys.exit(0) 11 | elif len(sys.argv) == 2: 12 | clone(sys.argv[1]) 13 | 14 | 15 | def clone(url: str) -> None: 16 | host, org, repo = split_url(url) 17 | if host == "": 18 | print('no host') 19 | return None 20 | 21 | dir = get_dir() 22 | target = os.path.join(dir, host, org, repo) 23 | 24 | git_url = f"git@{host}:{org}/{repo}.git" 25 | cmd = f"git clone {git_url} {target}" 26 | print(cmd, flush=True) 27 | if os.path.exists(target): 28 | return 29 | run(cmd) 30 | 31 | 32 | def get_dir() -> str: 33 | directory = fetch("git config clone.directory") 34 | if directory == "": 35 | print( 36 | "Please set clone directory by 'git config --global clone.directory YOUR.PATH'" 37 | ) 38 | return "" 39 | 40 | if directory.startswith("$HOME"): 41 | directory = "~" + directory[len("$HOME") :] 42 | return os.path.expanduser(directory) 43 | 44 | 45 | def split_url(url: str) -> tuple[str, str, str]: 46 | # https://github.com/keaising/dotfile 47 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+)" 48 | if url.endswith("git"): 49 | # https://github.com/keaising/dotfile.git 50 | # git@github.com:keaising/dotfile.git 51 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+).git" 52 | result = re.match(reg_ex, url) 53 | if result is None: 54 | return "", "", "" 55 | return (result.group("host_name"), result.group("org"), result.group("repo")) 56 | 57 | 58 | def fetch(command: str) -> str: 59 | return os.popen(command).read().strip() 60 | 61 | 62 | def run(command: str) -> None: 63 | os.system(command) 64 | 65 | 66 | main() 67 | -------------------------------------------------------------------------------- /gitui/.config/gitui/key_bindings.ron: -------------------------------------------------------------------------------- 1 | // Note: 2 | // If the default key layout is lower case, 3 | // and you want to use `Shift + q` to trigger the exit event, 4 | // the setting should like this `exit: Some(( code: Char('Q'), modifiers: "SHIFT")),` 5 | // The Char should be upper case, and the modifier should be set to "SHIFT". 6 | // 7 | // Note: 8 | // find `KeysList` type in src/keys/key_list.rs for all possible keys. 9 | // every key not overwritten via the config file will use the default specified there 10 | ( 11 | open_help: Some(( code: F(1), modifiers: "")), 12 | 13 | move_left: Some(( code: Char('h'), modifiers: "")), 14 | move_right: Some(( code: Char('l'), modifiers: "")), 15 | move_up: Some(( code: Char('k'), modifiers: "")), 16 | move_down: Some(( code: Char('j'), modifiers: "")), 17 | 18 | popup_up: Some(( code: Char('p'), modifiers: "CONTROL")), 19 | popup_down: Some(( code: Char('n'), modifiers: "CONTROL")), 20 | page_up: Some(( code: Char('b'), modifiers: "CONTROL")), 21 | page_down: Some(( code: Char('f'), modifiers: "CONTROL")), 22 | home: Some(( code: Char('g'), modifiers: "")), 23 | end: Some(( code: Char('G'), modifiers: "SHIFT")), 24 | shift_up: Some(( code: Char('K'), modifiers: "SHIFT")), 25 | shift_down: Some(( code: Char('J'), modifiers: "SHIFT")), 26 | 27 | edit_file: Some(( code: Char('I'), modifiers: "SHIFT")), 28 | 29 | // status_reset_item: Some(( code: Char('U'), modifiers: "SHIFT")), 30 | status_reset_item: Some(( code: Char('u'), modifiers: "")), 31 | 32 | // diff_reset_lines: Some(( code: Char('u'), modifiers: "")), 33 | diff_stage_lines: Some(( code: Char('s'), modifiers: "")), 34 | 35 | stashing_save: Some(( code: Char('w'), modifiers: "")), 36 | stashing_toggle_index: Some(( code: Char('m'), modifiers: "")), 37 | 38 | stash_open: Some(( code: Char('l'), modifiers: "")), 39 | 40 | abort_merge: Some(( code: Char('M'), modifiers: "SHIFT")), 41 | ) 42 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lsp/pyright.lua: -------------------------------------------------------------------------------- 1 | -- For what diagnostic is enabled in which type checking mode, check doc: 2 | -- https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-settings-defaults 3 | 4 | -- Currently, the pyright also has some issues displaying hover documentation: 5 | -- https://www.reddit.com/r/neovim/comments/1gdv1rc/what_is_causeing_the_lsp_hover_docs_to_looks_like/ 6 | 7 | local new_capability = { 8 | -- this will remove some of the diagnostics that duplicates those from ruff, idea taken and adapted from 9 | -- here: https://github.com/astral-sh/ruff-lsp/issues/384#issuecomment-1989619482 10 | textDocument = { 11 | publishDiagnostics = { 12 | tagSupport = { 13 | valueSet = { 2 }, 14 | }, 15 | }, 16 | 17 | hover = { 18 | contentFormat = { "plaintext" }, 19 | dynamicRegistration = true, 20 | }, 21 | }, 22 | } 23 | 24 | return { 25 | cmd = { "delance-langserver", "--stdio" }, 26 | settings = { 27 | pyright = { 28 | -- disable import sorting and use Ruff for this 29 | disableOrganizeImports = true, 30 | disableTaggedHints = false, 31 | }, 32 | python = { 33 | 34 | analysis = { 35 | autoSearchPaths = true, 36 | diagnosticMode = "workspace", 37 | typeCheckingMode = "standard", 38 | useLibraryCodeForTypes = true, 39 | -- we can this setting below to redefine some diagnostics 40 | diagnosticSeverityOverrides = { 41 | 42 | deprecateTypingAliases = false, 43 | }, 44 | -- inlay hint settings are provided by pylance? 45 | inlayHints = { 46 | callArgumentNames = "partial", 47 | functionReturnTypes = true, 48 | pytestParameters = true, 49 | variableTypes = true, 50 | }, 51 | }, 52 | }, 53 | }, 54 | 55 | capabilities = new_capability, 56 | } 57 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/vim-plugins.vim: -------------------------------------------------------------------------------- 1 | " cSpell:disable 2 | " The good old days in VIM 3 | 4 | " floaterm 5 | let g:floaterm_keymap_toggle = '' 6 | let g:floaterm_keymap_prev = '' 7 | let g:floaterm_keymap_next = '' 8 | let g:floaterm_width=0.85 9 | let g:floaterm_height=0.95 10 | 11 | " 'ruanyl/vim-gh-line' " invoke github/gitlab from vim 12 | " let g:gh_line_map_default = 0 13 | " let g:gh_line_blame_map_default = 1 14 | " let g:gh_line_map = 'gh' 15 | " let g:gh_line_blame_map = 'gb' 16 | " let g:gh_gitlab_domain = "git.curiostack.com" 17 | " let g:gh_use_canonical = 0 18 | 19 | " text object 20 | let g:vim_textobj_parameter_mapping = 'a' 21 | 22 | let g:UltiSnipsSnippetDirectories=[ "ultisnips" ] 23 | 24 | "let g:winresizer_start_key = '' 25 | 26 | let g:NERDDefaultAlign = 'left' 27 | let g:NERDSpaceDelims = 1 28 | let g:NERDAllowAnyVisualDelims = 0 29 | let g:NERDCreateDefaultMappings = 0 30 | 31 | " vim-repeat 32 | silent! call repeat#set("\MyWonderfulMap", v:count) 33 | 34 | 35 | " vim-go 36 | let g:go_auto_sameids = 0 37 | let g:go_fmt_autosave = 0 38 | let g:go_doc_keywordprg_enabled = 0 39 | let g:go_imports_mode = 'gopls' 40 | let g:go_gopls_gofumpt = v:true 41 | let g:go_def_mapping_enabled = 0 42 | let g:go_snippet_engine = "" 43 | " highlight 44 | let g:go_highlight_types = 1 45 | let g:go_highlight_fields = 1 46 | let g:go_highlight_functions = 1 47 | let g:go_highlight_function_calls = 1 48 | let g:go_highlight_extra_types = 1 49 | let g:go_highlight_operators = 1 50 | " msg 51 | let g:go_echo_command_info = 0 52 | 53 | 54 | " osc52 yank 55 | autocmd TextYankPost * 56 | \ if ( v:event.operator is 'y' || v:event.operator is 'c' || v:event.operator is 'd' ) 57 | \ && v:event.regname is '' | 58 | \ execute 'OSCYankReg "' | 59 | \ endif 60 | " autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | execute 'OSCYankReg +' | endif 61 | let g:oscyank_max_length = 100000000 62 | let g:oscyank_silent = v:true 63 | 64 | 65 | " kshenoy/vim-signature 66 | let g:SignatureMap = { 67 | \ 'GotoNextSpotAlpha' : "", 68 | \ 'GotoPrevSpotAlpha' : "", 69 | \ } 70 | 71 | " for coc 72 | function! CheckBackspace() abort 73 | let col = col('.') - 1 74 | return !col || getline('.')[col - 1] =~# '\s' 75 | endfunction 76 | -------------------------------------------------------------------------------- /biome/code/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://biomejs.dev/schemas/latest/schema.json", 3 | "files": { 4 | "includes": [ 5 | "**", 6 | "!**/node_modules", 7 | "!**/dist", 8 | "!**/build", 9 | "!**/coverage", 10 | "!**/vendor", 11 | "!**/packages.json" 12 | ] 13 | }, 14 | "formatter": { 15 | "indentStyle": "space", 16 | "includes": ["**", "!*.md"] 17 | }, 18 | "assist": { 19 | "actions": { 20 | "source": { 21 | "organizeImports": "on" 22 | } 23 | } 24 | }, 25 | "linter": { 26 | "rules": { 27 | "style": { 28 | "noUselessElse": "off", 29 | "useLiteralEnumMembers": "error", 30 | "useNodejsImportProtocol": "error", 31 | "useAsConstAssertion": "error", 32 | "useEnumInitializers": "error", 33 | "useSelfClosingElements": "error", 34 | "useConst": "error", 35 | "useSingleVarDeclarator": "error", 36 | "noUnusedTemplateLiteral": "error", 37 | "useNumberNamespace": "error", 38 | "noInferrableTypes": "error", 39 | "useExponentiationOperator": "error", 40 | "useTemplate": "error", 41 | "noParameterAssign": "warn", 42 | "noNonNullAssertion": "error", 43 | "useDefaultParameterLast": "error", 44 | "useImportType": "error", 45 | "useExportType": "error", 46 | "useShorthandFunctionType": "error" 47 | }, 48 | "correctness": { 49 | "noUnusedImports": "error", 50 | "noUnusedVariables": "info" 51 | }, 52 | "complexity": { 53 | "noBannedTypes": "off", 54 | "noUselessSwitchCase": "off", 55 | "useLiteralKeys": "off", 56 | "noForEach": "off", 57 | "noUselessCatch": "off", 58 | "noThisInStatic": "off", 59 | "useOptionalChain": "off", 60 | "noExtraBooleanCast": "off" 61 | }, 62 | "suspicious": { 63 | "noExplicitAny": "off", 64 | "noAssignInExpressions": "off", 65 | "noShadowRestrictedNames": "off", 66 | "noConfusingVoidType": "off" 67 | }, 68 | "nursery": { 69 | "noFloatingPromises": "warn" 70 | } 71 | } 72 | }, 73 | "javascript": { 74 | "formatter": { 75 | "quoteStyle": "single", 76 | "semicolons": "asNeeded", 77 | "arrowParentheses": "asNeeded" 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /bash/.bash_profile: -------------------------------------------------------------------------------- 1 | # path 2 | _enabled_paths=( 3 | "/usr/local/go/bin" 4 | "/usr/sbin" 5 | "/usr/local" 6 | "/usr/local/bin" 7 | "/usr/local/sbin" 8 | "$HOME/code/go/bin" 9 | ) 10 | 11 | for _enabled_path in ${_enabled_paths[@]}; do 12 | # only add to $PATH when path exist and path not in $PATH 13 | [[ ! :$PATH: == *":${_enabled_path}:"* ]] && 14 | PATH="$PATH:${_enabled_path}" 15 | done 16 | 17 | # alias 18 | alias .='cd .' 19 | alias ..='cd ..' 20 | alias ...='cd ../..' 21 | alias ....='cd ../../..' 22 | alias .....='cd ../../../..' 23 | alias i='sudo apt install' 24 | alias ll='ls -al' 25 | alias s='sudo systemctl' 26 | alias j='sudo journalctl' 27 | alias d='docker' 28 | alias dc='docker compose' 29 | alias ts='sudo tailscale' 30 | alias vi=vim 31 | 32 | # settings 33 | export VISUAL=vim 34 | export EDITOR=vim 35 | # go env 36 | export GOPROXY=https://goproxy.cn 37 | export GOPATH=$HOME/code/go 38 | 39 | # prompt 40 | PS1_PROMPT() { 41 | local e=$? 42 | (( e )) && printf "\033[0;31m $e> \033[0m\n" || printf "$ " 43 | return $e 44 | } 45 | PS1='\[\e[0m\]\u@\h:\w\[\e[0m\]' 46 | PS1="$PS1"'$(PS1_PROMPT)' 47 | 48 | # functions 49 | mc() { 50 | mkdir -p -- "$1" && cd -P -- "$1" 51 | } 52 | 53 | extract() { 54 | if [ -f $1 ]; then 55 | case $1 in 56 | *.tar.bz2) tar xjf $1 ;; 57 | *.tar.gz) tar xzf $1 ;; 58 | *.tar.xz) tar xf $1 ;; 59 | *.bz2) bunzip2 $1 ;; 60 | *.rar) unrar e $1 ;; 61 | *.gz) gunzip $1 ;; 62 | *.tar) tar xf $1 ;; 63 | *.tbz2) tar xjf $1 ;; 64 | *.tgz) tar xzf $1 ;; 65 | *.zip) unzip $1 ;; 66 | *.Z) uncompress $1 ;; 67 | *.7z) 7z x $1 ;; 68 | *) echo "'$1' cannot be extracted via extract()" ;; 69 | esac 70 | else 71 | echo "'$1' is not a valid file" 72 | fi 73 | } 74 | 75 | set_timezone() { 76 | sudo timedatectl set-timezone Asia/Shanghai 77 | } 78 | 79 | add_no_login_user() { 80 | sudo groupadd $1 81 | sudo useradd --system \ 82 | --gid $1 \ 83 | --create-home \ 84 | --home-dir /var/lib/$1 \ 85 | --shell /usr/sbin/nologin \ 86 | $1 87 | } 88 | 89 | add_user() { 90 | sudo groupadd $1 91 | sudo useradd \ 92 | --gid $1 93 | $1 94 | 95 | usermod -aG sudo $1 96 | } 97 | 98 | install_docker() { 99 | curl -fsSL https://get.docker.com -o get-docker.sh 100 | 101 | sudo sh get-docker.sh 102 | 103 | sudo groupadd docker 104 | sudo usermod -aG docker $USER 105 | 106 | newgrp docker 107 | docker info 108 | } 109 | 110 | install_tailscale() { 111 | curl -fsSL https://tailscale.com/install.sh | sh 112 | } 113 | -------------------------------------------------------------------------------- /server/.bash_profile: -------------------------------------------------------------------------------- 1 | # path 2 | _enabled_paths=( 3 | "/usr/local/go/bin" 4 | "/usr/sbin" 5 | "/usr/local" 6 | "/usr/local/bin" 7 | "/usr/local/sbin" 8 | "$HOME/code/go/bin" 9 | ) 10 | 11 | for _enabled_path in ${_enabled_paths[@]}; do 12 | # only add to $PATH when path exist and path not in $PATH 13 | [[ ! :$PATH: == *":${_enabled_path}:"* ]] && 14 | PATH="$PATH:${_enabled_path}" 15 | done 16 | 17 | # alias 18 | alias .='cd .' 19 | alias ..='cd ..' 20 | alias ...='cd ../..' 21 | alias ....='cd ../../..' 22 | alias .....='cd ../../../..' 23 | alias i='sudo apt install' 24 | alias ll='ls -al' 25 | alias s='sudo systemctl' 26 | alias j='sudo journalctl' 27 | alias d='docker' 28 | alias dc='docker compose' 29 | alias ts='sudo tailscale' 30 | alias vi=vim 31 | 32 | # settings 33 | export VISUAL=vim 34 | export EDITOR=vim 35 | # go env 36 | export GOPROXY=https://goproxy.cn 37 | export GOPATH=$HOME/code/go 38 | 39 | # prompt 40 | PS1_PROMPT() { 41 | local e=$? 42 | (( e )) && printf "\033[0;31m $e> \033[0m\n" || printf "$ " 43 | return $e 44 | } 45 | PS1='\[\e[0m\]\u@\h:\w\[\e[0m\]' 46 | PS1="$PS1"'$(PS1_PROMPT)' 47 | 48 | # functions 49 | mc() { 50 | mkdir -p -- "$1" && cd -P -- "$1" 51 | } 52 | 53 | extract() { 54 | if [ -f $1 ]; then 55 | case $1 in 56 | *.tar.bz2) tar xjf $1 ;; 57 | *.tar.gz) tar xzf $1 ;; 58 | *.tar.xz) tar xf $1 ;; 59 | *.bz2) bunzip2 $1 ;; 60 | *.rar) unrar e $1 ;; 61 | *.gz) gunzip $1 ;; 62 | *.tar) tar xf $1 ;; 63 | *.tbz2) tar xjf $1 ;; 64 | *.tgz) tar xzf $1 ;; 65 | *.zip) unzip $1 ;; 66 | *.Z) uncompress $1 ;; 67 | *.7z) 7z x $1 ;; 68 | *) echo "'$1' cannot be extracted via extract()" ;; 69 | esac 70 | else 71 | echo "'$1' is not a valid file" 72 | fi 73 | } 74 | 75 | set_timezone() { 76 | sudo timedatectl set-timezone Asia/Shanghai 77 | } 78 | 79 | add_no_login_user() { 80 | sudo groupadd $1 81 | sudo useradd --system \ 82 | --gid $1 \ 83 | --create-home \ 84 | --home-dir /var/lib/$1 \ 85 | --shell /usr/sbin/nologin \ 86 | $1 87 | } 88 | 89 | add_user() { 90 | sudo groupadd $1 91 | sudo useradd \ 92 | --gid $1 93 | $1 94 | 95 | usermod -aG sudo $1 96 | } 97 | 98 | install_docker() { 99 | curl -fsSL https://get.docker.com -o get-docker.sh 100 | 101 | sudo sh get-docker.sh 102 | 103 | sudo groupadd docker 104 | sudo usermod -aG docker $USER 105 | 106 | newgrp docker 107 | docker info 108 | } 109 | 110 | install_tailscale() { 111 | curl -fsSL https://tailscale.com/install.sh | sh 112 | } 113 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/conform.lua: -------------------------------------------------------------------------------- 1 | local biome = { 2 | "biome", 3 | "biome-check", 4 | -- "biome-organize-imports", 5 | } 6 | return { 7 | { 8 | -- := vim.bo.filetype 9 | "mfussenegger/nvim-lint", 10 | event = { "BufReadPre", "BufNewFile" }, 11 | config = function() 12 | local lint = require("lint") 13 | lint.linters_by_ft = { 14 | fish = { "fish" }, 15 | lua = { "selene" }, 16 | python = { "ruff" }, 17 | go = { "gofmt", "golines", "goimports" }, 18 | yaml = { "yamllint" }, 19 | } 20 | end, 21 | }, 22 | { 23 | "stevearc/conform.nvim", 24 | event = { "BufWritePre" }, 25 | cmd = { "ConformInfo" }, 26 | keys = { 27 | { 28 | "gm", 29 | function() 30 | require("conform").format({ async = true }) 31 | end, 32 | mode = "", 33 | desc = "Format buffer", 34 | }, 35 | }, 36 | ---@module "conform" 37 | ---@type conform.setupOpts 38 | opts = { 39 | formatters_by_ft = { 40 | lua = { "stylua" }, 41 | bash = { "shfmt" }, 42 | python = { "isort", "ruff_organize_imports", "ruff_format" }, 43 | go = { "gosimports", "gofmt", "golines" }, 44 | -- sql = { "pg_format" }, 45 | fish = { "fish_indent" }, 46 | css = biome, 47 | javascript = biome, 48 | javascriptreact = biome, 49 | json = biome, 50 | markdown = { "prettierd", "prettier", stop_after_first = true }, 51 | typescript = biome, 52 | typescriptreact = biome, 53 | }, 54 | default_format_opts = { 55 | lsp_format = "fallback", 56 | }, 57 | format_on_save = { 58 | timeout_ms = 500, 59 | lsp_fallback = true, 60 | }, 61 | formatters = { 62 | shfmt = { 63 | prepend_args = { "-i", "2" }, 64 | }, 65 | pg_format = { 66 | prepend_args = { "--keyword-case", "2", "--wrap-limit", "80" }, 67 | }, 68 | }, 69 | }, 70 | init = function() 71 | -- If you want the formatexpr, here is the place to set it 72 | vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" 73 | end, 74 | }, 75 | } 76 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-treesitter/nvim-treesitter", 3 | -- enabled = false, 4 | dependencies = { 5 | "nvim-treesitter/nvim-treesitter-textobjects", 6 | "nvim-treesitter/playground", 7 | }, 8 | config = function() 9 | require("nvim-treesitter.configs").setup({ 10 | playground = { 11 | enable = true, 12 | disable = {}, 13 | updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code 14 | persist_queries = false, -- Whether the query persists across vim sessions 15 | keybindings = { 16 | toggle_query_editor = "o", 17 | toggle_hl_groups = "i", 18 | toggle_injected_languages = "t", 19 | toggle_anonymous_nodes = "a", 20 | toggle_language_display = "I", 21 | focus_language = "f", 22 | unfocus_language = "F", 23 | update = "R", 24 | goto_node = "", 25 | show_help = "?", 26 | }, 27 | }, 28 | incremental_selection = { 29 | enable = true, 30 | keymaps = { 31 | node_incremental = "v", 32 | node_decremental = "V", 33 | }, 34 | }, 35 | textobjects = { 36 | select = { 37 | enable = true, 38 | -- Automatically jump forward to textobj, similar to targets.vim 39 | lookahead = true, 40 | keymaps = { 41 | ["af"] = "@function.outer", 42 | ["if"] = "@function.inner", 43 | ["ic"] = "@call_expression", 44 | ["ie"] = "@expression_list", 45 | ["ik"] = "@keyed_element", 46 | }, 47 | }, 48 | }, 49 | -- ensure_installed = "all", -- one of "all" or a list of languages 50 | ensure_installed = { 51 | -- "go", 52 | -- "gomod", 53 | "python", 54 | "query", 55 | "comment", -- highlight for "TODO", "FIXME" 56 | }, 57 | ignore_install = {}, -- List of parsers to ignore installing 58 | highlight = { 59 | enable = { "python", "lua", "go" }, 60 | -- enable = true, -- false will disable the whole extension 61 | disable = { "sql" }, -- list of language that will be disabled 62 | }, 63 | }) 64 | end, 65 | } 66 | -------------------------------------------------------------------------------- /zsh/.config/zsh/05-aliases.zsh: -------------------------------------------------------------------------------- 1 | # ============================================================ 2 | # Aliases 3 | # ============================================================ 4 | 5 | # ansible 6 | alias an='ansible' 7 | alias ap='ansible-playbook' 8 | 9 | # ci 10 | alias ci='git add -A && git amend && git push -f' 11 | 12 | # dir 13 | alias ...='cd ../..' 14 | alias ....='cd ../../..' 15 | alias .....='cd ../../../..' 16 | 17 | # modern unix tools 18 | alias cat='bat' 19 | alias ll='lsd -al' 20 | alias vi='vim' 21 | if command -v nvim &>/dev/null; then 22 | alias vi='nvim' 23 | fi 24 | alias which='type' 25 | 26 | # docker 27 | alias d='docker' 28 | alias dc='docker compose' 29 | alias dr='docker run --rm' 30 | alias dcup='docker compose up' 31 | alias dil='docker image ls' 32 | alias dcl='docker container ls -a' 33 | alias drm='docker rm' 34 | alias drmi='docker rmi' 35 | 36 | # git 37 | alias ga='git add .' 38 | alias gc='git commit -m' 39 | alias g='gitui' 40 | alias glm='git_open' 41 | 42 | # tmux 43 | alias t='tmux' 44 | alias ta='tmux attach-session -t' 45 | alias tn='tmux new-session -s' 46 | alias tka='tmux kill-session -a' 47 | alias tk='tmux kill-session -t' 48 | alias tx='tmuxp' 49 | 50 | # cursor 51 | alias c='cursor' 52 | 53 | # kubernetes 54 | alias k='kubectl' 55 | kctx() { 56 | echo "Current config: $KUBECONFIG" 57 | kubectl config current-context 58 | } 59 | alias kprod='export KUBECONFIG=~/.kube/prod.config; echo "🟡Switched to prod"' 60 | alias ktest='export KUBECONFIG=~/.kube/test.config; echo "🔵Switched to test"' 61 | 62 | # go 63 | alias goci='golangci-lint run --config $HOME/.data/.golangci.yml' 64 | alias gostrict='golangci-lint run --config $HOME/.data/.golangci-strict.yml' 65 | alias fmt='goimports -w . && go mod tidy' 66 | alias fmtf='gofumpt -l -w . && go mod tidy' 67 | alias fmts='gosimports -w . && go mod tidy' 68 | alias gocc='fmt && goci --allow-parallel-runners' 69 | alias goss='fmtf && fmts && goci --allow-parallel-runners' 70 | alias gdv='godotenv' 71 | alias gt='APP_ENV=dev go test --cover --race ./...' 72 | alias gts='APP_ENV=dev SKIP_TEST=true go test --cover --race ./...' 73 | 74 | # OS-specific aliases 75 | case "$OSTYPE" in 76 | linux*) 77 | alias j='sudo journalctl' 78 | alias s='sudo systemctl' 79 | command -v pacman &>/dev/null && alias i='sudo pacman -S' 80 | command -v apt &>/dev/null && alias i='sudo apt install' 81 | alias ts='sudo tailscale' 82 | ;; 83 | darwin*) 84 | alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale" 85 | alias ts="sudo /Applications/Tailscale.app/Contents/MacOS/Tailscale" 86 | # OCR (requires: brew install tesseract pngpaste) 87 | alias pocr='pngpaste - | tesseract stdin stdout' 88 | ;; 89 | esac 90 | 91 | -------------------------------------------------------------------------------- /server/.config/fish/config.fish: -------------------------------------------------------------------------------- 1 | set fish_prompt_pwd_dir_length 0 2 | set fish_greeting 3 | 4 | # ansible 5 | alias an='ansible' 6 | alias ap='ansible-playbook' 7 | 8 | # dir 9 | alias ..='cd ..' 10 | alias ...='cd ../..' 11 | alias ....='cd ../../..' 12 | alias .....='cd ../../../..' 13 | alias ll='exa -al --group-directories-first' 14 | alias vi=vim 15 | if type -q nvim 16 | alias vi=nvim 17 | end 18 | alias which=type 19 | 20 | # docker 21 | alias d='docker' 22 | alias dc='docker compose' 23 | alias dr='docker run --rm' 24 | alias dcup='docker compose up' 25 | alias dil='docker image ls' 26 | alias dcl='docker container ls -a' 27 | alias drm='docker rm' 28 | alias drmi='docker rmi' 29 | 30 | # git 31 | alias ga='git add .' 32 | alias gc='git commit -m' 33 | alias g='gitui' 34 | alias glp='gl -p' 35 | alias glm='gl -m' 36 | alias glb='gl -b' 37 | alias glc='gl -c' 38 | 39 | # tmux 40 | alias t='tmux' 41 | alias ta='tmux attach-session -t' 42 | alias tn='tmux new-session -s' 43 | alias tka='tmux kill-session -a' 44 | alias tk='tmux kill-seesion -t' 45 | alias tx='tmuxp' 46 | 47 | # go 48 | set -gx GOPATH $HOME/code/go 49 | set -gx GOPROXY https://goproxy.cn,direct 50 | 51 | # Added by n-install (see http://git.io/n-install-repo). 52 | set -Ux N_PREFIX "$HOME/code/n" 53 | 54 | # pyenv 55 | set -Ux PYENV_ROOT "$HOME/.pyenv" 56 | command -v pyenv >/dev/null && eval (pyenv init - | source) 57 | 58 | # misc 59 | set -Ux XDG_CONFIG_HOME "$HOME/.config" 60 | set -Ux XDG_CACHE_HOME "$HOME/.cache" 61 | set -Ux VISUAL vi 62 | set -Ux EDITOR vi 63 | set -Ux GIT_EDITOR vi 64 | set -Ux LANG "en_US.UTF-8" 65 | set -Ux LC_CTYPE "en_US.UTF-8" 66 | set -Ux LC_ALL "en_US.UTF-8" 67 | set -Ux GPG_TTY (tty) 68 | # for tmux in wezterm, kitty 69 | # set -x TERM "screen-256color" 70 | 71 | set -l _paths \ 72 | $HOME/.local/bin \ 73 | $HOME/code/go/bin \ 74 | $HOME/.local/share/nvim/mason/bin \ 75 | $HOME/code/gems/bin \ 76 | $GOPATH/bin \ 77 | $N_PREFIX/bin \ 78 | $HOME/.cargo/bin \ 79 | $PYENV_ROOT/bin \ 80 | /usr/bin \ 81 | /usr/sbin \ 82 | # for go on macOS 83 | /usr/local \ 84 | /usr/local/bin \ 85 | /usr/local/sbin \ 86 | # macOS JDK 87 | /usr/local/opt/openjdk/bin \ 88 | # CUDA: Ubuntu/Debian 89 | /usr/local/cuda/bin \ 90 | # CUDA: Arch 91 | /opt/cuda/bin \ 92 | # dotnet 93 | $HOME/.dotnet/tools 94 | 95 | for path in $_paths 96 | # only add to $PATH when path exist and path not in $PATH 97 | test -d "$path" && 98 | not contains $PATH "$path" && 99 | set -x PATH $PATH "$path" 100 | end 101 | 102 | function mc 103 | mkdir -p -- $argv[1] && cd -P -- $argv[1] 104 | end 105 | 106 | # os 107 | alias j='sudo journalctl' 108 | alias s='sudo systemctl' 109 | alias ts='sudo tailscale' 110 | type -q apt && alias i='sudo apt install' 111 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/blink.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "saghen/blink.cmp", 4 | dependencies = { "rafamadriz/friendly-snippets" }, 5 | version = "1.*", 6 | ---@module 'blink.cmp' 7 | ---@type blink.cmp.Config 8 | opts = { 9 | keymap = { 10 | [""] = { "hide" }, 11 | [""] = { "scroll_documentation_up" }, 12 | [""] = { "scroll_documentation_down" }, 13 | [""] = { "show_signature", "hide_signature", "fallback" }, 14 | [""] = { "select_prev", "fallback" }, 15 | [""] = { "select_next", "fallback" }, 16 | [""] = { "select_prev", "fallback" }, 17 | [""] = { "select_next", "fallback" }, 18 | [""] = { "select_and_accept", "fallback" }, 19 | [""] = { 20 | function(cmp) 21 | if cmp.snippet_active() then 22 | return cmp.accept() 23 | else 24 | return cmp.select_and_accept() 25 | end 26 | end, 27 | "snippet_forward", 28 | "fallback", 29 | }, 30 | [""] = { "snippet_backward", "fallback" }, 31 | }, 32 | completion = { 33 | documentation = { auto_show = true }, 34 | }, 35 | sources = { 36 | default = { "lsp", "path", "snippets", "buffer" }, 37 | providers = { 38 | path = { 39 | opts = { 40 | get_cwd = function(_) 41 | return vim.fn.getcwd() 42 | end, 43 | }, 44 | }, 45 | }, 46 | }, 47 | -- signature = { enabled = true }, 48 | fuzzy = { 49 | sorts = { 50 | "exact", 51 | "score", 52 | "sort_text", 53 | }, 54 | }, 55 | cmdline = { 56 | completion = { 57 | menu = { auto_show = true }, 58 | }, 59 | keymap = { 60 | [""] = { 61 | function(cmp) 62 | if cmp.snippet_active() then 63 | return cmp.accept() 64 | else 65 | return cmp.select_accept_and_enter() 66 | end 67 | end, 68 | "fallback", 69 | }, 70 | [""] = { "accept" }, 71 | }, 72 | }, 73 | }, 74 | opts_extend = { "sources.default" }, 75 | }, 76 | } 77 | -------------------------------------------------------------------------------- /macOS/Code/Library/Application Support/Code/User/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "window.commandCenter": true, 3 | "workbench.colorTheme": "GitHub Light Default", 4 | "editor.fontFamily": "'SauceCodePro Nerd Font', 'Consolas Nerd Font', Monaco, 'Courier New', monospace", 5 | "editor.fontSize": 14, 6 | "editor.formatOnSave": true, 7 | "explorer.confirmDelete": false, 8 | "gitlens.defaultDateFormat": "YYYY-MM-DD HH:mm", 9 | "gitlens.defaultDateStyle": "absolute", 10 | "editor.minimap.enabled": true, 11 | "git.enableSmartCommit": true, 12 | "diffEditor.ignoreTrimWhitespace": false, 13 | "extensions.ignoreRecommendations": true, 14 | "[yaml]": { 15 | "editor.defaultFormatter": "biomejs.biome", 16 | "editor.insertSpaces": true, 17 | "editor.tabSize": 2, 18 | "editor.autoIndent": "advanced", 19 | "diffEditor.ignoreTrimWhitespace": false, 20 | "editor.defaultColorDecorators": "never" 21 | }, 22 | "[typescriptreact]": { 23 | "editor.defaultFormatter": "biomejs.biome" 24 | }, 25 | "[typescript]": { 26 | "editor.defaultFormatter": "biomejs.biome" 27 | }, 28 | "[javascript]": { 29 | "editor.defaultFormatter": "biomejs.biome" 30 | }, 31 | "[json]": { 32 | "editor.defaultFormatter": "vscode.json-language-features" 33 | }, 34 | "workbench.editor.pinnedTabsOnSeparateRow": true, 35 | "vim.neovimUseConfigFile": true, 36 | "editor.lineNumbers": "relative", 37 | "python.analysis.typeCheckingMode": "standard", 38 | "terminal.integrated.enableMultiLinePasteWarning": "never", 39 | "git.confirmSync": false, 40 | "github.copilot.nextEditSuggestions.enabled": true, 41 | "workbench.activityBar.location": "top", 42 | "chat.commandCenter.enabled": false, 43 | "cSpell.enabledFileTypes": { 44 | "shellscript": false, 45 | "json": false, 46 | "yaml": false 47 | }, 48 | "cSpell.ignorePaths": [ 49 | "package-lock.json", 50 | "node_modules", 51 | "vscode-extension", 52 | ".git/{info,lfs,logs,refs,objects}/**", 53 | ".git/{index,*refs,*HEAD}", 54 | ".vscode", 55 | ".vscode-insiders" 56 | ], 57 | "cSpell.userWords": [ 58 | "admob", 59 | "asgi", 60 | "asyncio", 61 | "bouldin", 62 | "calinski", 63 | "cpython", 64 | "dssm", 65 | "enviscan", 66 | "fastapi", 67 | "harabasz", 68 | "httptools", 69 | "kaisou", 70 | "keaising", 71 | "mewtant", 72 | "mori", 73 | "msgpack", 74 | "ndarray", 75 | "olap", 76 | "pixai", 77 | "Pydantic", 78 | "Reco", 79 | "rerank", 80 | "reranked", 81 | "Reranker", 82 | "shumei", 83 | "Tanebi", 84 | "troph", 85 | "UMAP", 86 | "uvicorn", 87 | "uvloop", 88 | "venv" 89 | ], 90 | "files.defaultLanguage": "json", 91 | "vim.autoSwitchInputMethod.enable": true, 92 | "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC", 93 | "vim.autoSwitchInputMethod.obtainIMCmd": "/opt/homebrew/bin/macism", 94 | "vim.autoSwitchInputMethod.switchIMCmd": "/opt/homebrew/bin/macism {im}", 95 | "editor.wordWrap": "on", 96 | "workbench.startupEditor": "none", 97 | "remote.SSH.useLocalServer": false, 98 | "remote.SSH.remotePlatform": { 99 | "song": "linux" 100 | }, 101 | "explorer.confirmDragAndDrop": false 102 | } -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/options_prev.vim: -------------------------------------------------------------------------------- 1 | " cSpell:disable 2 | set autoindent 3 | set tabstop=4 " 按下 Tab 键时,Vim 显示的空格数 4 | set shiftwidth=4 5 | set softtabstop=0 " 关闭softtabstop 永远不要将空格和tabset cursorline 6 | set hidden 7 | set autowrite 8 | set winaltkeys=no " Windows 禁用 ALT 操作菜单(使得 ALT 可以用到 Vim里) 9 | set ttimeout " 功能键超时检测 50 毫秒 10 | set ttimeoutlen=50 11 | set updatetime=300 12 | set ruler " 显示光标位置 13 | set autoread " auto reload when file on disk changed 14 | set ignorecase " 智能搜索大小写判断,默认忽略大小写,除非搜索内容包含大写字母 15 | set smartcase " 16 | set incsearch " 查找输入时动态增量显示查找结果 17 | set showmatch " 显示匹配的括号 18 | set matchtime=2 " 显示括号匹配的时间 19 | set display=lastline " 显示最后一行 20 | set wildmenu " 允许下方显示目录 21 | set fdm=indent " 代码折叠默认使用缩进 22 | set backup " 允许备份 23 | set writebackup " 保存时备份 24 | set scrolloff=5 " 垂直滚动时,光标距离顶部/底部的位置(单位:行) 25 | set sidescrolloff=15 " 水平滚动时,光标距离行首或行尾的位置(单位:字符) 26 | set relativenumber 27 | set number 28 | set list " 设置显示制表符等隐藏字符 29 | set showcmd " 右下角显示命令 30 | set splitright " 水平切割窗口时,默认在右边显示新窗口 31 | set laststatus=2 " 总是显示状态栏 32 | set showtabline=2 " 总是显示标签栏 33 | set shortmess+=c " https://stackoverflow.com/a/25102964 34 | set whichwrap+=<,>,[,],h,l 35 | set iskeyword-=- 36 | set signcolumn=yes " 总是显示侧边栏(用于显示 mark/gitdiff/诊断信息) 37 | set colorcolumn=88 " 显示列宽 38 | set formatoptions+=B " 合并两行中文时,不在中间加空格 39 | set ffs=unix,dos,mac " 文件换行符,默认使用 unix 换行符 40 | set backupdir=~/.vim/tmp " 备份文件地址,统一管理 41 | set backupext=.bak " 备份文件扩展名 42 | set mouse= 43 | set noswapfile 44 | set noundofile 45 | set spo=camel 46 | set splitbelow 47 | set splitright 48 | set listchars=lead:⋅,tab:\▸\ ,trail:. " 设置分隔符可视 49 | set clipboard^=unnamed,unnamedplus " y/d/c copy to/from system clipboard 50 | set foldenable 51 | set foldlevelstart=99 52 | set foldlevel=99 " 默认打开所有缩进 53 | set foldmethod=expr 54 | set foldexpr=nvim_treesitter#foldexpr() 55 | 56 | " 恢复上次打开位置 57 | autocmd BufReadPost * 58 | \ if line("'\"") > 1 && line("'\"") <= line("$") | 59 | \ exe "normal! g`\"" | 60 | \ endif 61 | 62 | augroup filetypes 63 | autocmd! 64 | autocmd FileType fish setlocal expandtab 65 | autocmd FileType go setlocal tabstop=4 shiftwidth=4 noexpandtab 66 | autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 expandtab 67 | autocmd FileType javascriptreact setlocal tabstop=2 shiftwidth=2 expandtab 68 | autocmd FileType json setlocal tabstop=2 shiftwidth=2 expandtab 69 | autocmd FileType lua setlocal foldmarker={,} foldmethod=marker expandtab 70 | autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab 71 | autocmd FileType tmux setlocal foldmethod=marker 72 | autocmd FileType typescript setlocal tabstop=2 shiftwidth=2 expandtab 73 | autocmd FileType typescriptreact setlocal tabstop=2 shiftwidth=2 expandtab 74 | autocmd FileType zsh setlocal foldmethod=marker 75 | augroup END 76 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lsp/tsgo.lua: -------------------------------------------------------------------------------- 1 | local function tsgo_on_attach(_, bufnr) 2 | local bufopts = { noremap = true, silent = true, buffer = bufnr } 3 | local fzf = require("fzf-lua") 4 | local k = vim.keymap.set 5 | local go_to_definition = function() 6 | fzf.lsp_definitions({ 7 | jump1 = true, 8 | ignore_current_line = true, 9 | multiline = 2, 10 | }) 11 | end 12 | -- k("n", "", ":lua vim.lsp.buf.definition()", bufopts) 13 | k("n", "", go_to_definition, bufopts) 14 | k("n", "gd", go_to_definition, bufopts) 15 | k("n", "gi", function() 16 | fzf.lsp_implementations({ 17 | jump1 = true, 18 | ignore_current_line = true, 19 | show_line = false, 20 | 21 | multiline = 2, 22 | }) 23 | end, bufopts) 24 | k("n", "", function() 25 | return ":IncRename " .. vim.fn.expand("") 26 | end, { expr = true, noremap = true, silent = true, buffer = bufnr }) 27 | k("n", "", function() 28 | fzf.lsp_code_actions({ previewer = false }) 29 | end, bufopts) 30 | k("n", "ca", function() 31 | fzf.lsp_code_actions({ previewer = false }) 32 | end, bufopts) 33 | k("n", "gh", "lua require('pretty_hover').hover()", bufopts) 34 | k("n", "K", "lua require('pretty_hover').hover()", bufopts) 35 | k("n", "`", vim.diagnostic.open_float, bufopts) 36 | k("n", "gr", function() 37 | fzf.lsp_references({ 38 | jump1 = true, 39 | ignore_current_line = true, 40 | include_current_line = false, 41 | multiline = 2, 42 | }) 43 | end, bufopts) 44 | k("n", "ls", fzf.lsp_document_symbols, bufopts) 45 | k("n", "", function() 46 | vim.diagnostic.jump({ 47 | count = 1, 48 | float = true, 49 | severity = { 50 | vim.diagnostic.severity.ERROR, 51 | vim.diagnostic.severity.WARN, 52 | }, 53 | }) 54 | end, bufopts) 55 | end 56 | 57 | ---@type vim.lsp.Config 58 | return { 59 | cmd = { "tsgo", "--lsp", "--stdio" }, 60 | filetypes = { 61 | -- "javascript", 62 | -- "javascriptreact", 63 | -- "javascript.jsx", 64 | "typescript", 65 | "typescriptreact", 66 | "typescript.tsx", 67 | }, 68 | root_dir = function(bufnr, on_dir) 69 | -- Found tsconfig.json, now verify it's in a proper project root 70 | -- by checking for package manager files 71 | local root_markers = { 72 | "package-lock.json", 73 | "yarn.lock", 74 | "pnpm-lock.yaml", 75 | "bun.lockb", 76 | "bun.lock", 77 | "package.json", 78 | ".git", 79 | } 80 | local project_root = vim.fs.root(bufnr, root_markers) 81 | -- Use the project root if found, otherwise use tsconfig directory 82 | on_dir(project_root or tsconfig_root) 83 | end, 84 | on_attach = function(client, bufnr) 85 | tsgo_on_attach(client, bufnr) 86 | end, 87 | flags = { 88 | debounce_text_changes = 150, 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /macOS/karabiner/.config/karabiner/assets/complex_modifications/swap_alt_and_command.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Swap ALT and Command", 3 | "rules": [ 4 | { 5 | "description": "Swap option and command", 6 | "manipulators": [ 7 | { 8 | "type": "basic", 9 | "from": { 10 | "key_code": "left_option", 11 | "modifiers": { 12 | "optional": ["any"] 13 | } 14 | }, 15 | "to": [ 16 | { 17 | "key_code": "left_command" 18 | } 19 | ], 20 | "conditions": [ 21 | { 22 | "type": "frontmost_application_if", 23 | "bundle_identifiers": [ 24 | "org.alacritty", 25 | "com.valvesoftware.dota2", 26 | "dev.zed.Zed" 27 | ] 28 | } 29 | ] 30 | }, 31 | { 32 | "type": "basic", 33 | "from": { 34 | "key_code": "left_command", 35 | "modifiers": { 36 | "optional": ["any"] 37 | } 38 | }, 39 | "to": [ 40 | { 41 | "key_code": "left_option" 42 | } 43 | ], 44 | "conditions": [ 45 | { 46 | "type": "frontmost_application_if", 47 | "bundle_identifiers": [ 48 | "org.alacritty", 49 | "com.valvesoftware.dota2", 50 | "dev.zed.Zed" 51 | ] 52 | } 53 | ] 54 | }, 55 | { 56 | "type": "basic", 57 | "from": { 58 | "modifiers": { 59 | "mandatory": ["left_option"] 60 | }, 61 | "key_code": "spacebar" 62 | }, 63 | "to": [ 64 | { 65 | "repeat": false, 66 | "key_code": "spacebar", 67 | "modifiers": ["left_command"] 68 | } 69 | ], 70 | "conditions": [ 71 | { 72 | "type": "frontmost_application_if", 73 | "bundle_identifiers": [ 74 | "org.alacritty", 75 | "com.valvesoftware.dota2", 76 | "dev.zed.Zed" 77 | ] 78 | } 79 | ] 80 | }, 81 | { 82 | "type": "basic", 83 | "from": { 84 | "modifiers": { 85 | "mandatory": ["left_option"] 86 | }, 87 | "key_code": "tab" 88 | }, 89 | "to": [ 90 | { 91 | "repeat": false, 92 | "key_code": "tab", 93 | "modifiers": ["left_command"] 94 | } 95 | ], 96 | "conditions": [ 97 | { 98 | "type": "frontmost_application_if", 99 | "bundle_identifiers": [ 100 | "org.alacritty", 101 | "com.valvesoftware.dota2", 102 | "dev.zed.Zed" 103 | ] 104 | } 105 | ] 106 | } 107 | ] 108 | } 109 | ] 110 | } 111 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/global.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-lua/popup.nvim", 3 | "nvim-lua/plenary.nvim", 4 | "nvim-tree/nvim-web-devicons", 5 | "RRethy/vim-illuminate", 6 | { 7 | "keaising/im-select.nvim", 8 | -- dir = "~/code/github.com/keaising/im-select.nvim", 9 | -- dev = true, 10 | config = function() 11 | require("im_select").setup({}) 12 | end, 13 | }, 14 | { 15 | "kylechui/nvim-surround", 16 | version = "*", -- Use for stability; omit to use `main` branch for the latest features 17 | event = "VeryLazy", 18 | config = function() 19 | require("nvim-surround").setup({}) 20 | end, 21 | }, 22 | { 23 | "smjonas/inc-rename.nvim", 24 | config = function() 25 | require("inc_rename").setup({}) 26 | end, 27 | }, 28 | { 29 | "Mr-LLLLL/vim-interestingwords", 30 | branch = "fix-next-item", 31 | }, 32 | { 33 | "windwp/nvim-autopairs", 34 | config = function() 35 | require("nvim-autopairs").setup({ 36 | map_cr = true, 37 | check_ts = true, 38 | ts_config = { 39 | lua = { "string", "source" }, 40 | javascript = { "string", "template_string" }, 41 | java = false, 42 | }, 43 | disable_filetype = { "TelescopePrompt", "spectre_panel" }, 44 | fast_wrap = { 45 | map = "", 46 | chars = { "{", "[", "(", '"', "'" }, 47 | pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), 48 | offset = 0, -- Offset from pattern match 49 | end_key = "$", 50 | keys = "qwertyuiopzxcvbnmasdfghjkl", 51 | check_comma = true, 52 | highlight = "PmenuSel", 53 | highlight_grey = "LineNr", 54 | }, 55 | }) 56 | end, 57 | }, 58 | { 59 | "folke/flash.nvim", 60 | event = "VeryLazy", 61 | opts = { 62 | search = { 63 | multi_window = false, 64 | -- max_length = 2, 65 | }, 66 | jump = { 67 | nohlsearch = true, 68 | autojump = true, 69 | }, 70 | label = { 71 | uppercase = false, 72 | after = true, 73 | before = false, 74 | -- style = "overlay", 75 | current = true, 76 | }, 77 | modes = { 78 | char = { 79 | enabled = false, -- disable f/T/t/T 80 | }, 81 | }, 82 | }, 83 | keys = { 84 | { 85 | "s", 86 | mode = { "n", "o", "x" }, 87 | function() 88 | require("flash").jump() 89 | end, 90 | desc = "Flash", 91 | }, 92 | { 93 | "r", 94 | mode = "o", 95 | function() 96 | require("flash").remote() 97 | end, 98 | desc = "Remote Flash", 99 | }, 100 | { 101 | ";", 102 | mode = { "n" }, 103 | function() 104 | require("flash").jump({ continue = true }) 105 | end, 106 | desc = "Flash", 107 | }, 108 | }, 109 | }, 110 | { "sitiom/nvim-numbertoggle" }, 111 | } 112 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/neotree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-neo-tree/neo-tree.nvim", 4 | branch = "v3.x", 5 | priority = 1000, 6 | lazy = false, 7 | dependencies = { 8 | "nvim-lua/plenary.nvim", 9 | "nvim-tree/nvim-web-devicons", 10 | "MunifTanjim/nui.nvim", 11 | }, 12 | keys = { 13 | { "", "Neotree toggle", mode = "n", silent = true }, 14 | { "", "Neotree buffers", mode = "n", silent = true }, 15 | }, 16 | config = function() 17 | require("neo-tree").setup({ 18 | close_if_last_window = true, 19 | window = { 20 | mappings = { 21 | [""] = "none", 22 | ["o"] = "open", 23 | ["c"] = "close_node", 24 | [""] = "add_directory", 25 | }, 26 | }, 27 | filesystem = { 28 | filtered_items = { 29 | hide_dotfiles = false, 30 | hide_by_name = { 31 | "node_modules", 32 | }, 33 | never_show = { 34 | ".DS_Store", 35 | "thumbs.db", 36 | }, 37 | }, 38 | window = { 39 | mappings = { 40 | ["o"] = "open", 41 | [""] = "prev_git_modified", 42 | [""] = "next_git_modified", 43 | }, 44 | }, 45 | follow_current_file = { 46 | enabled = true, 47 | }, 48 | }, 49 | }) 50 | end, 51 | }, 52 | { 53 | "rmagatti/auto-session", 54 | dependencies = { "nvim-neo-tree/neo-tree.nvim" }, 55 | config = function() 56 | -- https://github.com/nvim-neo-tree/neo-tree.nvim/issues/357 57 | vim.api.nvim_create_autocmd({ "VimEnter" }, { 58 | callback = function() 59 | vim.defer_fn(function() 60 | vim.cmd("Neotree show") 61 | end, 10) 62 | end, 63 | }) 64 | 65 | -- fix https://github.com/neovim/neovim/issues/21856 66 | vim.api.nvim_create_autocmd({ "VimLeave" }, { 67 | callback = function() 68 | vim.fn.jobstart("", { detach = true }) 69 | end, 70 | }) 71 | 72 | require("auto-session").setup() 73 | end, 74 | }, 75 | { 76 | "hedyhli/outline.nvim", 77 | lazy = true, 78 | cmd = { "Outline", "OutlineOpen" }, 79 | keys = { 80 | { "o", "Outline", desc = "Toggle outline" }, 81 | }, 82 | config = function() 83 | require("outline").setup({ 84 | outline_window = { 85 | auto_jump = true, 86 | }, 87 | keymaps = { 88 | fold = "c", -- close 89 | unfold = "o", -- open 90 | }, 91 | outline_items = { 92 | show_symbol_lineno = true, 93 | }, 94 | symbols = { 95 | icon_fetcher = function() 96 | return "" 97 | end, 98 | }, 99 | }) 100 | end, 101 | }, 102 | } 103 | -------------------------------------------------------------------------------- /lf/.config/lf/lfrc: -------------------------------------------------------------------------------- 1 | # interpreter for shell commands 2 | set shell sh 3 | 4 | # show border 5 | set drawbox 6 | 7 | # show hidden files 8 | set hidden false 9 | 10 | # use "a" as appending new directory 11 | cmd mkdir %{{ 12 | IFS=" " 13 | mkdir -p -- "$@" 14 | lf -remote "send $id select \"$@\"" 15 | }} 16 | map push :mkdir 17 | map a push :touch 18 | 19 | cmd touch %touch $1 && lf -remote "send $id load" && lf -remote "send $id select $1" 20 | cmd mkdir %mkdir -p $1 && lf -remote "send $id load" && lf -remote "send $id select $1" 21 | 22 | map trash 23 | 24 | # set '-eu' options for shell commands 25 | # These options are used to have safer shell commands. Option '-e' is used to 26 | # exit on error and option '-u' is used to give error for unset variables. 27 | # Option '-f' disables pathname expansion which can be useful when $f, $fs, and 28 | # $fx variables contain names with '*' or '?' characters. However, this option 29 | # is used selectively within individual commands as it can be limiting at 30 | # times. 31 | set shellopts '-eu' 32 | 33 | # set internal field separator (IFS) to "\n" for shell commands 34 | # This is useful to automatically split file names in $fs and $fx properly 35 | # since default file separator used in these variables (i.e. 'filesep' option) 36 | # is newline. You need to consider the values of these options and create your 37 | # commands accordingly. 38 | set ifs "\n" 39 | 40 | # leave some space at the top and the bottom of the screen 41 | set scrolloff 10 42 | 43 | # use enter for shell commands 44 | map shell 45 | 46 | # execute current file (must be executable) 47 | map x $$f 48 | map X !$f 49 | 50 | # dedicated keys for file opener actions 51 | map o &mimeopen $f 52 | map O $mimeopen --ask $f 53 | 54 | # define a custom 'open' command 55 | # This command is called when current file is not a directory. You may want to 56 | # use either file extensions and/or mime types here. Below uses an editor for 57 | # text files and a file opener for the rest. 58 | cmd open ${{ 59 | test -L $f && f=$(readlink -f $f) 60 | case $(file --mime-type $f -b) in 61 | text/*) $EDITOR $fx;; 62 | *) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;; 63 | esac 64 | }} 65 | 66 | # define a custom 'rename' command without prompt for overwrite 67 | # cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 68 | # map r push :rename 69 | 70 | # make sure trash folder exists 71 | # %mkdir -p ~/.trash 72 | 73 | # move current file or selected files to trash folder 74 | # (also see 'man mv' for backup/overwrite options) 75 | cmd trash %set -f; mv $fx ~/.trash/ 76 | 77 | # define a custom 'delete' command 78 | cmd delete ${{ 79 | set -f 80 | printf "$fx\n" 81 | printf "delete?[y/n]" 82 | read ans 83 | [ $ans = "y" ] && rm -rf $fx 84 | }} 85 | 86 | # use '' key for either 'trash' or 'delete' command 87 | # map trash 88 | # map delete 89 | 90 | # extract the current file with the right command 91 | # (xkcd link: https://xkcd.com/1168/) 92 | cmd extract ${{ 93 | set -f 94 | case $f in 95 | *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;; 96 | *.tar.gz|*.tgz) tar xzvf $f;; 97 | *.tar.xz|*.txz) tar xJvf $f;; 98 | *.zip) unzip $f;; 99 | *.rar) unrar x $f;; 100 | *.7z) 7z x $f;; 101 | esac 102 | }} 103 | 104 | # compress current file or selected files with tar and gunzip 105 | cmd tar ${{ 106 | set -f 107 | mkdir $1 108 | cp -r $fx $1 109 | tar czf $1.tar.gz $1 110 | rm -rf $1 111 | }} 112 | 113 | # compress current file or selected files with zip 114 | cmd zip ${{ 115 | set -f 116 | mkdir $1 117 | cp -r $fx $1 118 | zip -r $1.zip $1 119 | rm -rf $1 120 | }} 121 | -------------------------------------------------------------------------------- /local/.local/bin/gl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import re 5 | import shutil 6 | import sys 7 | from platform import uname 8 | 9 | 10 | def main(): 11 | arg = "" 12 | if len(sys.argv) >= 2: 13 | arg = sys.argv[1] 14 | gitlab_open(arg) 15 | 16 | 17 | def gitlab_open(arg: str) -> None: 18 | if fetch("git rev-parse --is-inside-work-tree 2>/dev/null") != "true": 19 | print("not in git repo") 20 | sys.exit(0) 21 | 22 | host, org, repo = split_url(fetch("git config --get remote.origin.url")) 23 | if host == "": 24 | print("no host") 25 | return None 26 | 27 | url = f"https://{host}/{org}/{repo}" 28 | branch = fetch("git rev-parse --abbrev-ref HEAD 2>/dev/null") 29 | 30 | # merge link 31 | link_merge = f"{url}/-/merge_requests/new?merge_request[source_branch]={branch}" 32 | if branch == "master": 33 | link_merge = f"{link_merge}&merge_request[target_branch]=stage" 34 | 35 | for k, v in {"[": "%5B", "]": "%5D"}.items(): 36 | link_merge = link_merge.replace(k, v) 37 | 38 | # tree link 39 | link_tree = f"{url}/-/tree/{branch}" 40 | 41 | # commit id link 42 | commit_id = fetch("git rev-parse HEAD") 43 | link_commit_id = f"{url}/-/commit/{commit_id}" 44 | 45 | # pipeline link 46 | link_pipeline = f"{url}/-/pipelines" 47 | 48 | if host == "github.com": 49 | link_tree = f"{url}/tree/{branch}" 50 | link_commit_id = f"{url}/commit/{commit_id}" 51 | link_pipeline = f"{url}/actions" 52 | 53 | # concat url 54 | open_url = url 55 | match arg: 56 | case "-m": 57 | open_url = link_merge 58 | case "-p": 59 | open_url = link_pipeline 60 | case "-b": 61 | open_url = link_tree 62 | case "-c": 63 | open_url = link_commit_id 64 | case _: 65 | open_url = url 66 | 67 | # print and open 68 | # echo -e "\e]52;c;$(base64 <<< content)\a" 69 | match current_platform(): 70 | case "darwin": 71 | run(f"open '{open_url}'") 72 | case "wsl": 73 | # linux: run(f"echo '{open_url}' | xclip -selection clipboard -i") 74 | # wsl: run(f"echo '{open_url}' | clip.exe") 75 | # run(rf'''printf "\033]52;c;$(echo '{open_url}' | base64)\a"''') 76 | # print(open_url, flush=True) 77 | # You should install wslu manually first 78 | run(f"wslview '{open_url}'") 79 | case "linux": 80 | if shutil.which("xdg-open"): 81 | run(f"xdg-open '{open_url}' &> /dev/null 2>&1") 82 | else: 83 | print(open_url, flush=True) 84 | 85 | 86 | def split_url(url: str) -> tuple[str, str, str]: 87 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+)" 88 | if url.startswith("git"): 89 | reg_ex = r"[a-zA-Z]+(@|://)(?P\w[\w\.\-]+)(:|/)(?P\w[\w\.\-\/]+)/(?P\w[\w\.\-]+).git" 90 | result = re.match(reg_ex, url) 91 | if result is None: 92 | return "", "", "" 93 | return (result.group("host_name"), result.group("org"), result.group("repo")) 94 | 95 | 96 | def fetch(command: str) -> str: 97 | return os.popen(command).read().strip() 98 | 99 | 100 | def run(command: str) -> None: 101 | os.system(command) 102 | 103 | 104 | def current_platform() -> str: 105 | match sys.platform: 106 | case "darwin": 107 | return "darwin" 108 | case "linux": 109 | # WSL: 5.15.79.1-microsoft-standard-WSL2 110 | if "microsoft-standard" in uname().release: 111 | return "wsl" 112 | return "linux" 113 | return "unsupported" 114 | 115 | 116 | main() 117 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/coc.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "neoclide/coc.nvim", 3 | branch = "release", 4 | event = "BufRead", 5 | enabled = false, 6 | config = function() 7 | vim.g.coc_global_extensions = { 8 | "coc-go", 9 | "coc-pyright", 10 | -- "coc-spell-checker", 11 | "coc-snippets", 12 | "coc-sumneko-lua", 13 | "coc-tsserver", 14 | "@yaegassy/coc-ruff", 15 | "@yaegassy/coc-tailwindcss3", 16 | } 17 | -- Some servers have issues with backup files, see #649 18 | vim.opt.backup = false 19 | vim.opt.writebackup = false 20 | 21 | -- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable 22 | -- delays and poor user experience 23 | vim.opt.updatetime = 300 24 | 25 | local keyset = vim.keymap.set 26 | -- Autocomplete 27 | function _G.check_back_space() 28 | local col = vim.fn.col(".") - 1 29 | return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil 30 | end 31 | 32 | -- Use Tab for trigger completion with characters ahead and navigate 33 | -- NOTE: There's always a completion item selected by default, you may want to enable 34 | -- no select by setting `"suggest.noselect": true` in your configuration file 35 | 36 | -- NOTE: Use command ':verbose imap ' to make sure Tab is not mapped by 37 | -- other plugins before putting this into your config 38 | local opts = { silent = true, noremap = true, expr = true, replace_keycodes = false } 39 | keyset( 40 | "i", 41 | "", 42 | -- [[ coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "" : coc#refresh() ]], 43 | -- [[ coc#pum#visible() ? coc#_select_confirm() : coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : CheckBackspace() ? "\" : coc#refresh() ]], 44 | -- 有候选的时候选择下一个,否则往后跳 45 | [[ coc#pum#visible() ? coc#_select_confirm() : coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : "\" ]], 46 | opts 47 | ) 48 | keyset("i", "", [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], opts) 49 | -- Make to accept selected completion item or notify coc.nvim to format 50 | -- u breaks current undo, please make your own choice 51 | keyset("i", "", [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], opts) 52 | -- Use to trigger snippets 53 | keyset("i", "", "(coc-snippets-expand-jump)") 54 | 55 | -- Highlight the symbol and its references on a CursorHold event(cursor is idle) 56 | vim.api.nvim_create_augroup("CocGroup", {}) 57 | vim.api.nvim_create_autocmd("CursorHold", { 58 | group = "CocGroup", 59 | command = "silent call CocActionAsync('highlight')", 60 | desc = "Highlight symbol under cursor on CursorHold", 61 | }) 62 | 63 | -- Update signature help on jump placeholder 64 | vim.api.nvim_create_autocmd("User", { 65 | group = "CocGroup", 66 | pattern = "CocJumpPlaceholder", 67 | command = "call CocActionAsync('showSignatureHelp')", 68 | desc = "Update signature help on jump placeholder", 69 | }) 70 | 71 | -- Apply codeAction to the selected region 72 | -- Example: `aap` for current paragraph 73 | local opts2 = { silent = true, nowait = true } 74 | -- keyset("n", "", "(coc-definition)", { silent = true }) 75 | keyset("n", "gy", "(coc-type-definition)", { silent = true }) 76 | keyset("n", "", "(coc-rename)", { silent = true }) 77 | keyset("n", "rn", "(coc-rename)", { silent = true }) 78 | end, 79 | } 80 | -------------------------------------------------------------------------------- /kitty/.config/kitty.conf: -------------------------------------------------------------------------------- 1 | font_family Input Regular 2 | font_size 14.0 3 | 4 | # # ref: https://github.com/yamatsum/nvim-nonicons#kitty 5 | # symbol_map U+f101-U+f208 nonicon 6 | 7 | cursor_shape block 8 | cursor_stop_blinking_after 5.0 9 | 10 | scrollback_lines 10000 11 | scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER 12 | scrollback_pager_history_size 0 13 | 14 | url_color #0087bd 15 | url_style curly 16 | copy_on_select yes 17 | sync_to_monitor yes 18 | initial_window_width 1280 19 | initial_window_height 700 20 | 21 | tab_bar_edge top 22 | tab_bar_margin_width 0 23 | tab_bar_min_tabs 1 24 | tab_bar_style fade 25 | tab_switch_strategy previous 26 | 27 | shell . 28 | editor nvim 29 | close_on_child_death no 30 | allow_remote_control no 31 | clipboard_control write-clipboard write-primary 32 | term xterm-256color 33 | 34 | macos_titlebar_color system 35 | macos_option_as_alt yes 36 | macos_window_resizable yes 37 | macos_show_window_title_in all 38 | 39 | enabled_layouts stack, tall 40 | # enabled_layouts tall 41 | 42 | map cmd+t launch --cwd=current --type=tab 43 | map cmd+shift+t set_tab_title 44 | map cmd+d launch --cwd=current --location=vsplit 45 | map cmd+shift+d launch --cwd=current --location=hsplit 46 | map cmd+[ previous_window 47 | map cmd+] next_window 48 | map cmd+shift+[ previous_tab 49 | map cmd+shift+] next_tab 50 | map cmd+shift+n goto_layout stack 51 | map cmd+shift+p goto_layout tall 52 | map cmd+shift+i next_layout 53 | map cmd+shift+k move_window up 54 | map cmd+shift+h move_window left 55 | map cmd+shift+l move_window right 56 | map cmd+shift+j move_window down 57 | map kitty_mod+cmd+shift+n move_tab_forward 58 | map kitty_mod+cmd+shift+p move_tab_backward 59 | map cmd+1 goto_tab 1 60 | map cmd+2 goto_tab 2 61 | map cmd+3 goto_tab 3 62 | map cmd+4 goto_tab 4 63 | map cmd+5 goto_tab 5 64 | map cmd+equal change_font_size all +2.0 65 | map cmd+plus change_font_size all +2.0 66 | map cmd+minus change_font_size all -2.0 67 | map cmd+0 change_font_size all 0 68 | # map cmd+k combine : clear_terminal scroll active : send_text normal,application \x0c 69 | map kitty_mod+h resize_window narrower 70 | map kitty_mod+l resize_window wider 71 | map kitty_mod+k resize_window taller 72 | map kitty_mod+j resize_window shorter 3 73 | 74 | include ${USER}.conf 75 | # include base16-classic-light-256.conf 76 | include moonfly.conf 77 | -------------------------------------------------------------------------------- /backup/miscellaneous/recursive-code-config/config.yaml: -------------------------------------------------------------------------------- 1 | # Configure your own custom Rec Mono for Code font 2 | 3 | # 4 | # /$$$$$$ /$$ 5 | # /$$ / / / $$$ 6 | # /$$$$$$$ /$$$$$$$ /$$ $$$$$ /$$$$$$$$$ /$$$$$ /$$$$$$$ / 7 | # /$$_____/ /$$____ $$ | $$$___ $$ |___ $$__/ |___ $$ /$$ $$ 8 | # | $$ | $$ | $$ | $$ | $$ | $$ | $$ \ $$$$$$$ 9 | # | $$ | $$ | $$ | $$ | $$ | $$ | $$ \ $$ / 10 | # \ $$$$$$$ \ $$$$$$$ | $$ | $$ /$$$$$$$$$ /$$$$$$$$$ / $$$$$$$$ 11 | # \_______/ \_______/ |__/ |__/ |_________/ |_________/ | $$ $$ 12 | # \ $$$$$$$$ 13 | # \_______/ 14 | # 15 | 16 | # ----------------------------------------------------------------------------- 17 | # Family Name 18 | 19 | # The name you want after "Rec Mono" in your custom fonts. 20 | # Example: "Custom" will yield the family "Rec Mono Custom". 21 | # Keep under 13 characters in length to avoid potential OS bugs. 22 | 23 | Family Name: Wang 24 | 25 | # ----------------------------------------------------------------------------- 26 | # Font Styles 27 | 28 | # The variable axis values for the Regular, Italic, Bold, & Bold Italic fonts. 29 | # See https://recursive.design for more information on these. 30 | 31 | # MONO: 0 for Sans, 1 for Mono (or anything in-between) 32 | # CASL: 0 for Linear, 1 for Casual (or anything in-between) 33 | # wght: 300–1000 (realistically, about 400 for Regular & Italic and about 700 for Bold & Bold Italic) 34 | # slnt: 0 to -15 (negative numbers are more slanted, and approximately equal to degrees of slope) 35 | # CRSV: 0 (0 for Roman, 1 for Cursive) 36 | 37 | Fonts: 38 | Regular: 39 | MONO: 1 40 | CASL: 0.72 41 | wght: 500 42 | slnt: 0 43 | CRSV: 1 44 | 45 | Italic: 46 | MONO: 1 47 | CASL: 1 48 | wght: 500 49 | slnt: -10 50 | CRSV: 1 51 | 52 | Bold: 53 | MONO: 1 54 | CASL: 0.72 55 | wght: 750 56 | slnt: 0 57 | CRSV: 0 58 | 59 | Bold Italic: 60 | MONO: 1 61 | CASL: 1 62 | wght: 750 63 | slnt: -10 64 | CRSV: 1 65 | 66 | # ----------------------------------------------------------------------------- 67 | # Font Features 68 | 69 | # Freeze in code ligatures? True or False 70 | Code Ligatures: True 71 | 72 | # Include font features to freeze in stylistic options. Copy them below to use. 73 | # See README for details. 74 | 75 | # These options only have an affect at CRSV<=0.5 (Roman/normal styles) 76 | # ss01 # Single-story a 77 | # ss02 # Single-story g 78 | # ss03 # Simplified f 79 | # ss04 # Simplified i ### NOT CURRENTLY WORKING, see issue #4 80 | # ss05 # Simplified l 81 | # ss06 # Simplified r 82 | 83 | # These options affect both Roman & Cursive styles 84 | # ss07 # Simplified italic diagonals (kwxyz) ### NOT CURRENTLY WORKING, see issue #4 85 | # ss08 # No-serif L and Z 86 | # ss09 # Simplified 6 and 9 87 | # ss10 # Dotted 0 88 | # ss11 # Simplified 1 89 | # ss12 # Simplified @ 90 | 91 | # NOTE: 92 | # Only Sylistic Set features are recommended below. 93 | # Some features (especially "case") will disrupt code ligatures. 94 | # See Issue #20 for more details. 95 | 96 | # If you want to turn off all features, you can specify an empty array in YAML like this: 97 | # Features: [] 98 | 99 | # (Keep the hyphen before each list item) 100 | # The quick brown fox jumps over the lazy dog 101 | # THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 102 | Features: 103 | - ss01 # Single-story a 104 | - ss02 # Single-story g 105 | - ss03 # Simplified f 106 | - ss04 # Simplified i 107 | - ss05 # Simplified l 108 | - ss06 # Simplified r 109 | # - ss07 # Simplified italic diagonals (kwxyz) 110 | - ss08 # Serifless L and Z 111 | - ss09 # Simplified 6 and 9 112 | # - ss10 # Dotted 0 113 | - ss11 # Simplified 1 114 | - ss12 # Simplified @ 115 | - titl 116 | # That’s it! See README for next steps. 117 | # 118 | -------------------------------------------------------------------------------- /macOS/karabiner/.config/karabiner/karabiner.json: -------------------------------------------------------------------------------- 1 | { 2 | "global": { "show_in_menu_bar": false }, 3 | "profiles": [ 4 | { 5 | "devices": [ 6 | { 7 | "identifiers": { 8 | "is_keyboard": true, 9 | "product_id": 20778, 10 | "vendor_id": 1155 11 | }, 12 | "manipulate_caps_lock_led": false, 13 | "simple_modifications": [ 14 | { 15 | "from": { "key_code": "caps_lock" }, 16 | "to": [{ "key_code": "left_control" }] 17 | }, 18 | { 19 | "from": { "key_code": "left_command" }, 20 | "to": [{ "key_code": "left_option" }] 21 | }, 22 | { 23 | "from": { "key_code": "left_control" }, 24 | "to": [{ "key_code": "caps_lock" }] 25 | }, 26 | { 27 | "from": { "key_code": "left_option" }, 28 | "to": [{ "key_code": "left_command" }] 29 | } 30 | ] 31 | }, 32 | { 33 | "identifiers": { 34 | "is_keyboard": true, 35 | "is_pointing_device": true, 36 | "product_id": 20778, 37 | "vendor_id": 1155 38 | }, 39 | "ignore": false, 40 | "manipulate_caps_lock_led": false 41 | }, 42 | { 43 | "identifiers": { 44 | "is_keyboard": true, 45 | "is_pointing_device": true, 46 | "product_id": 272, 47 | "vendor_id": 1452 48 | }, 49 | "ignore": false 50 | }, 51 | { 52 | "identifiers": { 53 | "is_pointing_device": true, 54 | "product_id": 49734, 55 | "vendor_id": 1133 56 | }, 57 | "ignore": false 58 | }, 59 | { 60 | "identifiers": { 61 | "is_keyboard": true, 62 | "product_id": 21034, 63 | "vendor_id": 1155 64 | }, 65 | "simple_modifications": [ 66 | { 67 | "from": { "key_code": "left_command" }, 68 | "to": [{ "key_code": "left_option" }] 69 | }, 70 | { 71 | "from": { "key_code": "left_option" }, 72 | "to": [{ "key_code": "left_command" }] 73 | } 74 | ] 75 | } 76 | ], 77 | "fn_function_keys": [ 78 | { 79 | "from": { "key_code": "f3" }, 80 | "to": [{ "key_code": "mission_control" }] 81 | }, 82 | { 83 | "from": { "key_code": "f4" }, 84 | "to": [{ "key_code": "launchpad" }] 85 | }, 86 | { 87 | "from": { "key_code": "f5" }, 88 | "to": [{ "key_code": "illumination_decrement" }] 89 | }, 90 | { 91 | "from": { "key_code": "f6" }, 92 | "to": [{ "key_code": "illumination_increment" }] 93 | } 94 | ], 95 | "name": "MacBook", 96 | "selected": true, 97 | "virtual_hid_keyboard": { 98 | "country_code": 0, 99 | "keyboard_type_v2": "ansi" 100 | } 101 | } 102 | ] 103 | } -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/fzf.lua: -------------------------------------------------------------------------------- 1 | local rg_opts = table.concat({ 2 | -- "--column", 3 | "--line-number", 4 | "--no-heading", 5 | "--color=always", 6 | "--smart-case", 7 | "--max-columns=4096", 8 | -- "-j1", 9 | "--hidden", 10 | "-g '!{.git,node_modules}/'", 11 | -- "--fixed-strings", 12 | -- "--sort path", 13 | -- "-e", 14 | }, " ") 15 | 16 | return { 17 | { 18 | "ibhagwan/fzf-lua", 19 | dependencies = { "nvim-tree/nvim-web-devicons" }, 20 | keys = { 21 | { 22 | "s", 23 | function() 24 | require("fzf-lua").files({ 25 | multiprocess = false, 26 | }) 27 | end, 28 | }, 29 | { 30 | "f", 31 | function() 32 | require("fzf-lua").live_grep({ 33 | multiprocess = false, 34 | rg_opts = rg_opts, 35 | multiline = 2, 36 | }) 37 | end, 38 | }, 39 | { 40 | "", 41 | function() 42 | require("fzf-lua").blines() 43 | end, 44 | }, 45 | { 46 | "", 47 | function() 48 | require("fzf-lua").resume() 49 | end, 50 | }, 51 | { 52 | "lo", 53 | function() 54 | require("fzf-lua").oldfiles() 55 | end, 56 | }, 57 | { 58 | "dd", 59 | function() 60 | require("fzf-lua").diagnostics_document({ 61 | multiline = 2, 62 | sort = 1, 63 | }) 64 | end, 65 | }, 66 | { 67 | "dw", 68 | function() 69 | require("fzf-lua").diagnostics_workspace({ 70 | multiline = 2, 71 | sort = 1, 72 | }) 73 | end, 74 | }, 75 | { 76 | "gw", 77 | function() 78 | require("fzf-lua").grep_cword({ 79 | fzf_opts = { ["--no-sort"] = true }, 80 | }) 81 | end, 82 | }, 83 | }, 84 | config = function() 85 | local fzf = require("fzf-lua") 86 | fzf.register_ui_select() 87 | fzf.setup({ 88 | "hide", 89 | keymap = { 90 | builtin = { 91 | [""] = "preview-down", 92 | [""] = "preview-up", 93 | [""] = "preview-down", 94 | [""] = "preview-up", 95 | [""] = "toggle-fullscreen", 96 | [""] = "toggle-preview", 97 | [""] = "toggle-preview", 98 | }, 99 | }, 100 | winopts = { 101 | row = 1, 102 | height = 0.72, 103 | width = 1.0, 104 | preview = { 105 | border = "single", 106 | horizontal = "right:62%", 107 | wrap = true, 108 | }, 109 | border = "single", 110 | }, 111 | fzf_opts = { 112 | ["--cycle"] = true, 113 | ["--no-scrollbar"] = true, 114 | }, 115 | lsp = { 116 | jump1 = true, 117 | includeDeclaration = false, 118 | ignore_current_line = true, 119 | unique_line_items = true, 120 | code_actions = { previewer = "codeaction_native" }, 121 | }, 122 | }) 123 | end, 124 | }, 125 | } 126 | -------------------------------------------------------------------------------- /Linux/fontconfig/.config/fontconfig/fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | rgb 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | hintslight 16 | 17 | 18 | 19 | 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | zh_CN 29 | 30 | 31 | 32 | Noto Sans CJK SC 33 | 34 | 35 | 36 | 37 | 38 | 39 | sans-serif 40 | 41 | 42 | Noto Sans 43 | 44 | 45 | 46 | 47 | 48 | 49 | serif 50 | 51 | 52 | Noto Serif 53 | 54 | 55 | 56 | 57 | 58 | 59 | monospace 60 | 61 | 62 | Source Code Pro Medium 63 | 64 | 65 | 66 | 67 | sans-serif 68 | 69 | Noto Sans 70 | Noto Sans CJK SC 71 | Noto Sans CJK TC 72 | Noto Sans CJK JP 73 | Noto Sans CJK KR 74 | Noto Color Emoji 75 | Noto Emoji 76 | 77 | 78 | 79 | serif 80 | 81 | Noto Serif 82 | Noto Serif CJK SC 83 | Noto Serif CJK TC 84 | Noto Serif CJK JP 85 | Noto Serif CJK KR 86 | Noto Color Emoji 87 | Noto Emoji 88 | 89 | 90 | 91 | monospace 92 | 93 | JetBrainsMono Nerd Font 94 | Sarasa Term SC 95 | Sarasa Term TC 96 | Sarasa Term J 97 | Noto Serif 98 | Noto Serif CJK SC 99 | Noto Serif CJK TC 100 | Noto Serif CJK JP 101 | Noto Serif CJK KR 102 | Noto Color Emoji 103 | Noto Emoji 104 | 105 | 106 | 107 | 108 | 109 | 110 | Liberation Sans 111 | 112 | 113 | sans-serif 114 | 115 | 116 | 117 | 118 | Liberation Mono 119 | 120 | 121 | monospace 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /zsh/.config/zsh/06-functions.zsh: -------------------------------------------------------------------------------- 1 | # ============================================================ 2 | # Custom Functions 3 | # ============================================================ 4 | 5 | # Measure zsh start time 6 | timezsh() { 7 | for i in {1..3}; do 8 | /usr/bin/time zsh -i -c exit 2>&1 | grep real 9 | done | awk '/real/ {sum += $2; count++} END {printf "average: %.2fs\n", sum/count}' 10 | } 11 | 12 | # Enhanced cd with fzf and z.lua fallback 13 | cd() { 14 | if [[ $# -eq 0 ]]; then 15 | # No arguments: use fzf to search directories 16 | if command -v fzf &>/dev/null && command -v fd &>/dev/null; then 17 | local dir=$(fd --type d --hidden --max-depth 3 --follow . "$HOME/code" | fzf) 18 | [[ -d "$dir" ]] && builtin cd "$dir" 19 | else 20 | builtin cd 21 | fi 22 | else 23 | # Try normal cd first 24 | builtin cd "$@" 2>/dev/null 25 | # If failed and z.lua is available, try z.lua 26 | if [[ $? -ne 0 ]] && typeset -f _zlua &>/dev/null; then 27 | _zlua "$@" 28 | fi 29 | fi 30 | } 31 | 32 | # Clone and cd into directory 33 | glone() { 34 | [[ $# -ne 1 ]] && return 1 35 | clone "$1" | tee /tmp/goclone 36 | local dir=$(head -n 1 /tmp/goclone | awk '{print $4}') 37 | [[ -d "$dir" ]] && cd "$dir" 38 | } 39 | 40 | # Ping tailscale with fzf selection 41 | tsping() { 42 | if ! command -v tailscale &>/dev/null || ! command -v fzf &>/dev/null; then 43 | echo "Requires: tailscale and fzf" 44 | return 1 45 | fi 46 | 47 | local host=$(tailscale status | \ 48 | grep -v '^$' | \ 49 | grep -v '^#' | \ 50 | awk '{printf "%-20s %-20s %10s\n", $1, $2, $5}' | \ 51 | fzf | \ 52 | awk '{print $1}') 53 | 54 | [[ -n "$host" ]] && tailscale ping "$host" 55 | } 56 | 57 | # Make directory and cd into it 58 | mc() { 59 | mkdir -p -- "$1" && cd -P -- "$1" 60 | } 61 | 62 | # Cross-platform open command 63 | open() { 64 | case "$OSTYPE" in 65 | darwin*) 66 | /usr/bin/open "$@" 67 | ;; 68 | linux*) 69 | if [[ -n "$WSL_DISTRO_NAME" ]]; then 70 | wslview "$@" 71 | elif uname -r | grep -iq arch; then 72 | xdg-open "$@" &>/dev/null 2>&1 73 | else 74 | xdg-open "$@" 2>/dev/null 75 | fi 76 | ;; 77 | esac 78 | } 79 | 80 | # Extract various archive formats 81 | extract() { 82 | if [[ -z "$1" ]]; then 83 | echo "Usage: extract ." 84 | return 1 85 | fi 86 | 87 | if [[ ! -f "$1" ]]; then 88 | echo "$1 - file does not exist" 89 | return 1 90 | fi 91 | 92 | case "$1" in 93 | *.tar.bz2|*.tbz2) tar xvjf "$1" ;; 94 | *.tar.gz|*.tgz) tar xvzf "$1" ;; 95 | *.tar.xz) tar xvJf "$1" ;; 96 | *.tar) tar xvf "$1" ;; 97 | *.bz2) bunzip2 "$1" ;; 98 | *.gz) gunzip "$1" ;; 99 | *.zip) unzip "$1" ;; 100 | *.rar) unrar x -ad "$1" ;; 101 | *.Z) uncompress "$1" ;; 102 | *.7z) 7z x "$1" ;; 103 | *.xz) unxz "$1" ;; 104 | *.exe) cabextract "$1" ;; 105 | *.lzma) unlzma "$1" ;; 106 | *) echo "extract: '$1' - unknown archive method" ;; 107 | esac 108 | } 109 | 110 | # Change Cursor.app icon 111 | icon() { 112 | cp "$HOME/code/github.com/keaising/dotfile/logo/asprite.icns" \ 113 | "/Applications/Cursor.app/Contents/Resources/Cursor.icns" 114 | sudo killall Finder Dock 115 | } 116 | 117 | envup() { 118 | if [[ -f .env ]]; then 119 | set -a 120 | source .env 121 | set +a 122 | fi 123 | } 124 | 125 | envdown() { 126 | if [[ -f .env ]]; then 127 | local count=0 128 | for key in $(grep -oE '^[A-Z_][A-Z0-9_]*=' .env | sed 's/=$//'); do 129 | unset "$key" 2>/dev/null && ((count++)) 130 | done 131 | echo "unset $count env" 132 | fi 133 | } 134 | -------------------------------------------------------------------------------- /server/.vimrc: -------------------------------------------------------------------------------- 1 | set hlsearch 2 | set noswapfile 3 | set hidden 4 | set autowrite 5 | set clipboard=unnamed,unnamedplus " y/d/c copy to/from system clipboard 6 | set autoindent 7 | set winaltkeys=no " Windows 禁用 ALT 操作菜单(使得 ALT 可以用到 Vim里) 8 | set ruler " 显示光标位置 9 | set autoread " auto reload when file on disk changed 10 | set ignorecase " 智能搜索大小写判断,默认忽略大小写,除非搜索内容包含大写字母 11 | set smartcase 12 | set hlsearch " 高亮搜索内容 13 | set incsearch " 查找输入时动态增量显示查找结果 14 | set showmatch " 显示匹配的括号 15 | set display=lastline " 显示最后一行 16 | set wildmenu " 允许下方显示目录 17 | set formatoptions+=B " 合并两行中文时,不在中间加空格 18 | set ffs=unix,dos,mac " 文件换行符,默认使用 unix 换行符 19 | set foldenable " 允许代码折叠 20 | set fdm=indent " 代码折叠默认使用缩进 21 | set foldlevel=99 " 默认打开所有缩进 22 | set tabstop=4 " tab size 23 | set shiftwidth=4 24 | set laststatus=2 " 总是显示状态栏 25 | set number " 总是显示行号 26 | set relativenumber 27 | set signcolumn=yes " 总是显示侧边栏(用于显示 mark/gitdiff/诊断信息) 28 | set colorcolumn=88 " 显示列宽 29 | set showtabline=2 " 总是显示标签栏 30 | set listchars=tab:\|\ ,trail:.,extends:>,precedes:< " 设置分隔符可视 31 | set list " 设置显示制表符等隐藏字符 32 | set showcmd " 右下角显示命令 33 | set splitright " 水平切割窗口时,默认在右边显示新窗口 34 | set background=dark " 设置黑色背景 35 | set fileencoding=utf-8 " 文件默认编码 36 | set t_Co=256 " 允许256色 37 | let &t_8f = "\[38;2;%lu;%lu;%lum" 38 | let &t_8b = "\[48;2;%lu;%lu;%lum" 39 | set termguicolors 40 | set paste 41 | 42 | " different cursor shape in normal/insert mode 43 | let &t_SI = "\e[6 q" 44 | let &t_EI = "\e[2 q" 45 | 46 | 47 | syntax enable 48 | syntax on 49 | 50 | 51 | " support Alt 52 | function! Terminal_MetaMode(mode) 53 | set ttimeout 54 | if $TMUX != '' 55 | set ttimeoutlen=30 56 | elseif &ttimeoutlen > 80 || &ttimeoutlen <= 0 57 | set ttimeoutlen=80 58 | endif 59 | if has('nvim') || has('gui_running') 60 | return 61 | endif 62 | function! s:metacode(mode, key) 63 | if a:mode == 0 64 | exec "set =\e".a:key 65 | else 66 | exec "set =\e]{0}".a:key."~" 67 | endif 68 | endfunc 69 | for i in range(10) 70 | call s:metacode(a:mode, nr2char(char2nr('0') + i)) 71 | endfor 72 | for i in range(26) 73 | call s:metacode(a:mode, nr2char(char2nr('a') + i)) 74 | call s:metacode(a:mode, nr2char(char2nr('A') + i)) 75 | endfor 76 | if a:mode != 0 77 | for c in [',', '.', '/', ';', '[', ']', '{', '}'] 78 | call s:metacode(a:mode, c) 79 | endfor 80 | for c in ['?', ':', '-', '_'] 81 | call s:metacode(a:mode, c) 82 | endfor 83 | else 84 | for c in [',', '.', '/', ';', '{', '}'] 85 | call s:metacode(a:mode, c) 86 | endfor 87 | for c in ['?', ':', '-', '_'] 88 | call s:metacode(a:mode, c) 89 | endfor 90 | endif 91 | endfunc 92 | call Terminal_MetaMode(0) 93 | 94 | 95 | map 96 | 97 | inoremap :w 98 | nnoremap :w 99 | nnoremap :qa 100 | nnoremap q 101 | nnoremap :q 102 | 103 | " faster movement 104 | nnoremap 9 105 | nnoremap 9 106 | 107 | " Keep search pattern at the center of the screen. 108 | nnoremap n nzz 109 | nnoremap j gj 110 | nnoremap k gk 111 | nnoremap N Nzz 112 | nnoremap * *zz 113 | nnoremap # #zz 114 | nnoremap g* g*zz 115 | nnoremap % 116 | vnoremap % 117 | 118 | " move to line start/end 119 | noremap H ^ 120 | noremap L $ 121 | " mark 122 | nnoremap ' ` 123 | 124 | " search selected content in visual mode: https://blog.twofei.com/610/ 125 | vnoremap // y/" 126 | nnoremap // :noh 127 | 128 | " save file with sudo 129 | cnoremap sudow w !sudo tee % >/dev/null 130 | 131 | nnoremap nn :set nu! set rnu! set signcolumn=no 132 | 133 | colorscheme slate 134 | -------------------------------------------------------------------------------- /server/.config/init/init.vim: -------------------------------------------------------------------------------- 1 | set hlsearch 2 | set noswapfile 3 | set hidden 4 | set autowrite 5 | set clipboard=unnamed,unnamedplus " y/d/c copy to/from system clipboard 6 | set autoindent 7 | set winaltkeys=no " Windows 禁用 ALT 操作菜单(使得 ALT 可以用到 Vim里) 8 | set ruler " 显示光标位置 9 | set autoread " auto reload when file on disk changed 10 | set ignorecase " 智能搜索大小写判断,默认忽略大小写,除非搜索内容包含大写字母 11 | set smartcase 12 | set hlsearch " 高亮搜索内容 13 | set incsearch " 查找输入时动态增量显示查找结果 14 | set showmatch " 显示匹配的括号 15 | set display=lastline " 显示最后一行 16 | set wildmenu " 允许下方显示目录 17 | set formatoptions+=B " 合并两行中文时,不在中间加空格 18 | set ffs=unix,dos,mac " 文件换行符,默认使用 unix 换行符 19 | set foldenable " 允许代码折叠 20 | set fdm=indent " 代码折叠默认使用缩进 21 | set foldlevel=99 " 默认打开所有缩进 22 | set tabstop=4 " tab size 23 | set shiftwidth=4 24 | set laststatus=2 " 总是显示状态栏 25 | set number " 总是显示行号 26 | set relativenumber 27 | set signcolumn=yes " 总是显示侧边栏(用于显示 mark/gitdiff/诊断信息) 28 | set colorcolumn=88 " 显示列宽 29 | set showtabline=2 " 总是显示标签栏 30 | set listchars=tab:\|\ ,trail:.,extends:>,precedes:< " 设置分隔符可视 31 | set list " 设置显示制表符等隐藏字符 32 | set showcmd " 右下角显示命令 33 | set splitright " 水平切割窗口时,默认在右边显示新窗口 34 | set background=dark " 设置黑色背景 35 | set fileencoding=utf-8 " 文件默认编码 36 | set t_Co=256 " 允许256色 37 | let &t_8f = "\[38;2;%lu;%lu;%lum" 38 | let &t_8b = "\[48;2;%lu;%lu;%lum" 39 | set termguicolors 40 | set paste 41 | 42 | " different cursor shape in normal/insert mode 43 | let &t_SI = "\e[6 q" 44 | let &t_EI = "\e[2 q" 45 | 46 | 47 | syntax enable 48 | syntax on 49 | 50 | 51 | " support Alt 52 | function! Terminal_MetaMode(mode) 53 | set ttimeout 54 | if $TMUX != '' 55 | set ttimeoutlen=30 56 | elseif &ttimeoutlen > 80 || &ttimeoutlen <= 0 57 | set ttimeoutlen=80 58 | endif 59 | if has('nvim') || has('gui_running') 60 | return 61 | endif 62 | function! s:metacode(mode, key) 63 | if a:mode == 0 64 | exec "set =\e".a:key 65 | else 66 | exec "set =\e]{0}".a:key."~" 67 | endif 68 | endfunc 69 | for i in range(10) 70 | call s:metacode(a:mode, nr2char(char2nr('0') + i)) 71 | endfor 72 | for i in range(26) 73 | call s:metacode(a:mode, nr2char(char2nr('a') + i)) 74 | call s:metacode(a:mode, nr2char(char2nr('A') + i)) 75 | endfor 76 | if a:mode != 0 77 | for c in [',', '.', '/', ';', '[', ']', '{', '}'] 78 | call s:metacode(a:mode, c) 79 | endfor 80 | for c in ['?', ':', '-', '_'] 81 | call s:metacode(a:mode, c) 82 | endfor 83 | else 84 | for c in [',', '.', '/', ';', '{', '}'] 85 | call s:metacode(a:mode, c) 86 | endfor 87 | for c in ['?', ':', '-', '_'] 88 | call s:metacode(a:mode, c) 89 | endfor 90 | endif 91 | endfunc 92 | call Terminal_MetaMode(0) 93 | 94 | 95 | map 96 | 97 | inoremap :w 98 | nnoremap :w 99 | nnoremap :qa 100 | nnoremap q 101 | nnoremap :q 102 | 103 | " faster movement 104 | nnoremap 9 105 | nnoremap 9 106 | 107 | " Keep search pattern at the center of the screen. 108 | nnoremap n nzz 109 | nnoremap j gj 110 | nnoremap k gk 111 | nnoremap N Nzz 112 | nnoremap * *zz 113 | nnoremap # #zz 114 | nnoremap g* g*zz 115 | nnoremap % 116 | vnoremap % 117 | 118 | " move to line start/end 119 | noremap H ^ 120 | noremap L $ 121 | " mark 122 | nnoremap ' ` 123 | 124 | " search selected content in visual mode: https://blog.twofei.com/610/ 125 | vnoremap // y/" 126 | nnoremap // :noh 127 | 128 | " save file with sudo 129 | cnoremap sudow w !sudo tee % >/dev/null 130 | 131 | nnoremap nn :set nu! set rnu! set signcolumn=no 132 | 133 | colorscheme slate 134 | -------------------------------------------------------------------------------- /macOS/raycast/.config/raycast/scripts/left.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript -l JavaScript 2 | 3 | // Required parameters: 4 | // @raycast.schemaVersion 1 5 | // @raycast.title left window 6 | // @raycast.mode compact 7 | 8 | // Optional parameters: 9 | // @raycast.icon <- 10 | 11 | // Documentation: 12 | // @raycast.author Taiga 13 | // @raycast.authorURL https://raycast.com/keaising 14 | 15 | 16 | ObjC.import('Cocoa'); 17 | 18 | /** 19 | * Get the front application and its first window 20 | * @returns {Object} Object containing frontApp and frontWindow, or null if no window found 21 | */ 22 | function getFrontAppAndWindow() { 23 | const se = Application('System Events'); 24 | const frontApp = se.processes.whose({ frontmost: true })[0]; 25 | const appName = frontApp.name(); 26 | 27 | const frontWindows = frontApp.windows(); 28 | if (frontWindows.length === 0) { 29 | console.log("No windows found for front application"); 30 | return null; 31 | } 32 | 33 | return { 34 | frontApp: frontApp, 35 | frontWindow: frontWindows[0], 36 | windowCount: frontWindows.length 37 | }; 38 | } 39 | 40 | /** 41 | * Find the screen that contains the given window 42 | * @param {Object} window - The window object 43 | * @returns {Object} The screen object that contains the window 44 | */ 45 | function getScreenForWindow(window) { 46 | const windowFrame = window.position(); 47 | const windowX = windowFrame[0]; 48 | const windowY = windowFrame[1]; 49 | 50 | const screens = $.NSScreen.screens; 51 | let targetScreen = $.NSScreen.mainScreen; // fallback to main screen 52 | 53 | for (let i = 0; i < screens.count; i++) { 54 | const screen = screens.objectAtIndex(i); 55 | const screenFrame = screen.frame; 56 | const screenX = screenFrame.origin.x; 57 | const screenY = screenFrame.origin.y; 58 | const screenW = screenFrame.size.width; 59 | const screenH = screenFrame.size.height; 60 | 61 | // Check if window is within this screen bounds 62 | if (windowX >= screenX && windowX < (screenX + screenW) && 63 | windowY >= screenY && windowY < (screenY + screenH)) { 64 | targetScreen = screen; 65 | break; 66 | } 67 | } 68 | 69 | return targetScreen; 70 | } 71 | 72 | /** 73 | * Calculate new window dimensions and position 74 | * @param {Object} screen - The target screen object 75 | * @param {number} widthRatio - Width ratio (default 0.8 for 80% width) 76 | * @param {number} heightRatio - Height ratio (default 1.0 for full available height) 77 | * @returns {Object} Object containing newW, newH, newX, newY 78 | */ 79 | function calculateWindowBounds(screen, widthRatio = 0.8, heightRatio = 1.0) { 80 | const screenFrame = screen.frame; 81 | const visibleFrame = screen.visibleFrame; 82 | 83 | const availableW = visibleFrame.size.width; 84 | const availableH = visibleFrame.size.height; 85 | const availableX = visibleFrame.origin.x; 86 | 87 | const newW = Math.round(availableW * widthRatio); // 80% width 88 | const newH = Math.round(availableH * heightRatio); // 100% available height 89 | const newX = availableX; // align to left side 90 | 91 | const menuBarHeight = screenFrame.size.height - visibleFrame.size.height - visibleFrame.origin.y; 92 | const newY = menuBarHeight; 93 | 94 | return { newW, newH, newX, newY }; 95 | } 96 | 97 | /** 98 | * Resize the given window to the specified bounds 99 | * @param {Object} window - The window object to resize 100 | * @param {Object} bounds - Object containing newW, newH, newX, newY 101 | * @returns {boolean} True if successful, false otherwise 102 | */ 103 | function resizeWindow(window, bounds) { 104 | try { 105 | window.position = [bounds.newX, bounds.newY]; 106 | window.size = [bounds.newW, bounds.newH]; 107 | console.log("Window resized successfully"); 108 | return true; 109 | } catch (error) { 110 | console.log("Error manipulating window:", error.message); 111 | return false; 112 | } 113 | } 114 | 115 | /** 116 | * Main function that orchestrates the window resizing 117 | */ 118 | function main() { 119 | // Get front app and window 120 | const appInfo = getFrontAppAndWindow(); 121 | if (!appInfo) { 122 | return; 123 | } 124 | 125 | // Find the screen containing the window 126 | const targetScreen = getScreenForWindow(appInfo.frontWindow); 127 | 128 | // Calculate new window bounds 129 | const bounds = calculateWindowBounds(targetScreen); 130 | console.log(bounds.newW, bounds.newH, bounds.newX, bounds.newY); 131 | 132 | // Resize the window 133 | resizeWindow(appInfo.frontWindow, bounds); 134 | } 135 | 136 | // Execute main function 137 | main(); -------------------------------------------------------------------------------- /macOS/raycast/.config/raycast/scripts/right.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript -l JavaScript 2 | 3 | // Required parameters: 4 | // @raycast.schemaVersion 1 5 | // @raycast.title right window 6 | // @raycast.mode compact 7 | 8 | // Optional parameters: 9 | // @raycast.icon -> 10 | 11 | // Documentation: 12 | // @raycast.author Taiga 13 | // @raycast.authorURL https://raycast.com/keaising 14 | 15 | 16 | ObjC.import('Cocoa'); 17 | 18 | /** 19 | * Get the front application and its first window 20 | * @returns {Object} Object containing frontApp and frontWindow, or null if no window found 21 | */ 22 | function getFrontAppAndWindow() { 23 | const se = Application('System Events'); 24 | const frontApp = se.processes.whose({ frontmost: true })[0]; 25 | const appName = frontApp.name(); 26 | 27 | const frontWindows = frontApp.windows(); 28 | if (frontWindows.length === 0) { 29 | console.log("No windows found for front application"); 30 | return null; 31 | } 32 | 33 | return { 34 | frontApp: frontApp, 35 | frontWindow: frontWindows[0], 36 | windowCount: frontWindows.length 37 | }; 38 | } 39 | 40 | /** 41 | * Find the screen that contains the given window 42 | * @param {Object} window - The window object 43 | * @returns {Object} The screen object that contains the window 44 | */ 45 | function getScreenForWindow(window) { 46 | const windowFrame = window.position(); 47 | const windowX = windowFrame[0]; 48 | const windowY = windowFrame[1]; 49 | 50 | const screens = $.NSScreen.screens; 51 | let targetScreen = $.NSScreen.mainScreen; // fallback to main screen 52 | 53 | for (let i = 0; i < screens.count; i++) { 54 | const screen = screens.objectAtIndex(i); 55 | const screenFrame = screen.frame; 56 | const screenX = screenFrame.origin.x; 57 | const screenY = screenFrame.origin.y; 58 | const screenW = screenFrame.size.width; 59 | const screenH = screenFrame.size.height; 60 | 61 | // Check if window is within this screen bounds 62 | if (windowX >= screenX && windowX < (screenX + screenW) && 63 | windowY >= screenY && windowY < (screenY + screenH)) { 64 | targetScreen = screen; 65 | break; 66 | } 67 | } 68 | 69 | return targetScreen; 70 | } 71 | 72 | /** 73 | * Calculate new window dimensions and position 74 | * @param {Object} screen - The target screen object 75 | * @param {number} widthRatio - Width ratio (default 0.8 for 80% width) 76 | * @param {number} heightRatio - Height ratio (default 1.0 for full available height) 77 | * @returns {Object} Object containing newW, newH, newX, newY 78 | */ 79 | function calculateWindowBounds(screen, widthRatio = 0.8, heightRatio = 1.0) { 80 | const screenFrame = screen.frame; 81 | const visibleFrame = screen.visibleFrame; 82 | 83 | const availableW = visibleFrame.size.width; 84 | const availableH = visibleFrame.size.height; 85 | const availableX = visibleFrame.origin.x; 86 | 87 | const newW = Math.round(availableW * widthRatio); // 80% width 88 | const newH = Math.round(availableH * heightRatio); // 100% available height 89 | const newX = availableX + availableW - newW; // align to right side 90 | 91 | const menuBarHeight = screenFrame.size.height - visibleFrame.size.height - visibleFrame.origin.y; 92 | const newY = menuBarHeight; 93 | 94 | return { newW, newH, newX, newY }; 95 | } 96 | 97 | /** 98 | * Resize the given window to the specified bounds 99 | * @param {Object} window - The window object to resize 100 | * @param {Object} bounds - Object containing newW, newH, newX, newY 101 | * @returns {boolean} True if successful, false otherwise 102 | */ 103 | function resizeWindow(window, bounds) { 104 | try { 105 | window.position = [bounds.newX, bounds.newY]; 106 | window.size = [bounds.newW, bounds.newH]; 107 | console.log("Window resized successfully"); 108 | return true; 109 | } catch (error) { 110 | console.log("Error manipulating window:", error.message); 111 | return false; 112 | } 113 | } 114 | 115 | /** 116 | * Main function that orchestrates the window resizing 117 | */ 118 | function main() { 119 | // Get front app and window 120 | const appInfo = getFrontAppAndWindow(); 121 | if (!appInfo) { 122 | return; 123 | } 124 | 125 | // Find the screen containing the window 126 | const targetScreen = getScreenForWindow(appInfo.frontWindow); 127 | 128 | // Calculate new window bounds 129 | const bounds = calculateWindowBounds(targetScreen); 130 | console.log(bounds.newW, bounds.newH, bounds.newX, bounds.newY); 131 | 132 | // Resize the window 133 | resizeWindow(appInfo.frontWindow, bounds); 134 | } 135 | 136 | // Execute main function 137 | main(); -------------------------------------------------------------------------------- /Linux/Code/.config/Code/User/keybindings.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "alt+s", 4 | "command": "workbench.action.files.save" 5 | }, 6 | { 7 | "key": "ctrl+s", 8 | "command": "-workbench.action.files.save" 9 | }, 10 | { 11 | "key": "alt+b", 12 | "command": "editor.action.revealDefinition", 13 | "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" 14 | }, 15 | { 16 | "key": "f12", 17 | "command": "-editor.action.revealDefinition", 18 | "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" 19 | }, 20 | { 21 | "key": "alt+[", 22 | "command": "workbench.action.navigateBack", 23 | "when": "canNavigateBack" 24 | }, 25 | { 26 | "key": "ctrl+alt+-", 27 | "command": "-workbench.action.navigateBack", 28 | "when": "canNavigateBack" 29 | }, 30 | { 31 | "key": "alt+]", 32 | "command": "workbench.action.navigateForward", 33 | "when": "canNavigateForward" 34 | }, 35 | { 36 | "key": "ctrl+shift+-", 37 | "command": "-workbench.action.navigateForward", 38 | "when": "canNavigateForward" 39 | }, 40 | { 41 | "key": "alt+]", 42 | "command": "workbench.action.navigateRight" 43 | }, 44 | { 45 | "key": "alt+l", 46 | "command": "workbench.action.nextEditor", 47 | "when": "vim.mode != Insert" 48 | }, 49 | { 50 | "key": "ctrl+pagedown", 51 | "command": "-workbench.action.nextEditor" 52 | }, 53 | { 54 | "key": "alt+h", 55 | "command": "workbench.action.previousEditor", 56 | "when": "vim.mode != Insert" 57 | }, 58 | { 59 | "key": "ctrl+pageup", 60 | "command": "-workbench.action.previousEditor" 61 | }, 62 | { 63 | "key": "alt+w", 64 | "command": "workbench.action.closeActiveEditor" 65 | }, 66 | { 67 | "key": "ctrl+w", 68 | "command": "-workbench.action.closeActiveEditor" 69 | }, 70 | { 71 | "key": "ctrl+k e", 72 | "command": "-workbench.files.action.focusOpenEditorsView", 73 | "when": "workbench.explorer.openEditorsView.active" 74 | }, 75 | { 76 | "key": "ctrl+h", 77 | "command": "workbench.action.focusSideBar" 78 | }, 79 | { 80 | "key": "ctrl+l", 81 | "command": "workbench.action.focusLastEditorGroup" 82 | }, 83 | { 84 | "key": "alt+h", 85 | "command": "cursorLeft", 86 | "when": "textInputFocus && vim.mode == Insert" 87 | }, 88 | { 89 | "key": "alt+j", 90 | "command": "cursorDown", 91 | "when": "textInputFocus && vim.mode == Insert" 92 | }, 93 | { 94 | "key": "alt+l", 95 | "command": "cursorRight", 96 | "when": "textInputFocus && vim.mode == Insert" 97 | }, 98 | { 99 | "key": "alt+k", 100 | "command": "cursorUp", 101 | "when": "textInputFocus && vim.mode == Insert" 102 | }, 103 | { 104 | "key": "alt+v", 105 | "command": "editor.action.clipboardPasteAction" 106 | }, 107 | { 108 | "key": "alt+c", 109 | "command": "-toggleSearchCaseSensitive", 110 | "when": "searchViewletFocus" 111 | }, 112 | { 113 | "key": "alt+c", 114 | "command": "-toggleFindCaseSensitive", 115 | "when": "editorFocus" 116 | }, 117 | { 118 | "key": "alt+c", 119 | "command": "-workbench.action.terminal.toggleFindCaseSensitive", 120 | "when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" 121 | }, 122 | { 123 | "key": "alt+c", 124 | "command": "-toggleSearchEditorCaseSensitive", 125 | "when": "inSearchEditor && searchInputBoxFocus" 126 | }, 127 | { 128 | "key": "alt+c", 129 | "command": "editor.action.clipboardCopyAction" 130 | }, 131 | { 132 | "key": "ctrl+j", 133 | "command": "-editor.action.joinLines", 134 | "when": "editorTextFocus && !editorReadonly" 135 | }, 136 | { 137 | "key": "ctrl+j", 138 | "command": "-extension.vim_ctrl+j", 139 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" 140 | }, 141 | { 142 | "key": "ctrl+j", 143 | "command": "workbench.action.focusPanel" 144 | }, 145 | { 146 | "key": "ctrl+k", 147 | "command": "workbench.action.focusActiveEditorGroup" 148 | }, 149 | { 150 | "key": "ctrl+k", 151 | "command": "-deleteAllRight", 152 | "when": "textInputFocus && !editorReadonly" 153 | }, 154 | { 155 | "key": "ctrl+k", 156 | "command": "-extension.vim_ctrl+k", 157 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" 158 | }, 159 | { 160 | "key": "alt+a", 161 | "command": "editor.action.selectAll" 162 | }, 163 | { 164 | "key": "cmd+a", 165 | "command": "-editor.action.selectAll" 166 | } 167 | ] 168 | -------------------------------------------------------------------------------- /macOS/raycast/.config/raycast/scripts/center.applescript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript -l JavaScript 2 | 3 | // Required parameters: 4 | // @raycast.schemaVersion 1 5 | // @raycast.title center window 6 | // @raycast.mode compact 7 | 8 | // Optional parameters: 9 | // @raycast.icon 🎯 10 | 11 | // Documentation: 12 | // @raycast.author Taiga 13 | // @raycast.authorURL https://raycast.com/keaising 14 | 15 | 16 | ObjC.import('Cocoa'); 17 | 18 | /** 19 | * Get the front application and its first window 20 | * @returns {Object} Object containing frontApp and frontWindow, or null if no window found 21 | */ 22 | function getFrontAppAndWindow() { 23 | const se = Application('System Events'); 24 | const frontApp = se.processes.whose({ frontmost: true })[0]; 25 | const appName = frontApp.name(); 26 | 27 | const frontWindows = frontApp.windows(); 28 | if (frontWindows.length === 0) { 29 | console.log("No windows found for front application"); 30 | return null; 31 | } 32 | 33 | return { 34 | frontApp: frontApp, 35 | frontWindow: frontWindows[0], 36 | windowCount: frontWindows.length 37 | }; 38 | } 39 | 40 | /** 41 | * Find the screen that contains the given window 42 | * @param {Object} window - The window object 43 | * @returns {Object} The screen object that contains the window 44 | */ 45 | function getScreenForWindow(window) { 46 | const windowFrame = window.position(); 47 | const windowX = windowFrame[0]; 48 | const windowY = windowFrame[1]; 49 | 50 | const screens = $.NSScreen.screens; 51 | let targetScreen = $.NSScreen.mainScreen; // fallback to main screen 52 | 53 | for (let i = 0; i < screens.count; i++) { 54 | const screen = screens.objectAtIndex(i); 55 | const screenFrame = screen.frame; 56 | const screenX = screenFrame.origin.x; 57 | const screenY = screenFrame.origin.y; 58 | const screenW = screenFrame.size.width; 59 | const screenH = screenFrame.size.height; 60 | 61 | // Check if window is within this screen bounds 62 | if (windowX >= screenX && windowX < (screenX + screenW) && 63 | windowY >= screenY && windowY < (screenY + screenH)) { 64 | targetScreen = screen; 65 | break; 66 | } 67 | } 68 | 69 | return targetScreen; 70 | } 71 | 72 | /** 73 | * Calculate new window dimensions and position 74 | * @param {Object} screen - The target screen object 75 | * @param {number} widthRatio - Width ratio (default 0.8 for 80% width) 76 | * @param {number} heightRatio - Height ratio (default 0.8 for 80% height) 77 | * @returns {Object} Object containing newW, newH, newX, newY 78 | */ 79 | function calculateWindowBounds(screen, widthRatio = 0.8, heightRatio = 0.95) { 80 | const screenFrame = screen.frame; 81 | const visibleFrame = screen.visibleFrame; 82 | 83 | const availableW = visibleFrame.size.width; 84 | const availableH = visibleFrame.size.height; 85 | const availableX = visibleFrame.origin.x; 86 | 87 | const newW = Math.round(availableW * widthRatio); // 80% width 88 | const newH = Math.round(availableH * heightRatio); // 100% available height 89 | const newX = availableX + Math.round((availableW - newW) / 2); // center horizontally 90 | 91 | const menuBarHeight = screenFrame.size.height - visibleFrame.size.height - visibleFrame.origin.y; 92 | const newY = menuBarHeight + Math.round((availableH - newH) / 2); // center vertically 93 | 94 | return { newW, newH, newX, newY }; 95 | } 96 | 97 | /** 98 | * Resize the given window to the specified bounds 99 | * @param {Object} window - The window object to resize 100 | * @param {Object} bounds - Object containing newW, newH, newX, newY 101 | * @returns {boolean} True if successful, false otherwise 102 | */ 103 | function resizeWindow(window, bounds) { 104 | try { 105 | window.position = [bounds.newX, bounds.newY]; 106 | window.size = [bounds.newW, bounds.newH]; 107 | console.log("Window resized successfully"); 108 | return true; 109 | } catch (error) { 110 | console.log("Error manipulating window:", error.message); 111 | return false; 112 | } 113 | } 114 | 115 | /** 116 | * Main function that orchestrates the window resizing 117 | */ 118 | function main() { 119 | // Get front app and window 120 | const appInfo = getFrontAppAndWindow(); 121 | if (!appInfo) { 122 | return; 123 | } 124 | 125 | // Find the screen containing the window 126 | const targetScreen = getScreenForWindow(appInfo.frontWindow); 127 | 128 | // Calculate new window bounds 129 | const bounds = calculateWindowBounds(targetScreen); 130 | console.log(bounds.newW, bounds.newH, bounds.newX, bounds.newY); 131 | 132 | // Resize the window 133 | resizeWindow(appInfo.frontWindow, bounds); 134 | } 135 | 136 | // Execute main function 137 | main(); -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/plugins/ui.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "famiu/bufdelete.nvim", 3 | { 4 | "akinsho/bufferline.nvim", 5 | event = "VeryLazy", 6 | config = function() 7 | require("bufferline").setup({ 8 | options = { 9 | numbers = "ordinal", 10 | indicator = { 11 | style = "underline", 12 | }, 13 | show_buffer_close_icons = false, 14 | show_close_icon = false, 15 | show_tab_indicators = false, 16 | show_buffer_icons = false, 17 | }, 18 | }) 19 | end, 20 | }, 21 | { 22 | "axkirillov/hbac.nvim", 23 | config = function() 24 | require("hbac").setup({ 25 | autoclose = true, 26 | threshold = 11, 27 | }) 28 | end, 29 | }, 30 | { 31 | "nvim-lualine/lualine.nvim", 32 | event = "VeryLazy", 33 | config = function() 34 | require("lualine").setup({ 35 | options = { 36 | -- theme = "jellybeans", 37 | theme = "gruvbox", 38 | component_separators = { 39 | left = " ", 40 | right = " ", 41 | }, 42 | section_separators = { 43 | left = " ", 44 | right = " ", 45 | }, 46 | }, 47 | sections = { 48 | lualine_c = { 49 | { 50 | "filename", 51 | path = 1, -- show relative path 52 | symbols = { 53 | modified = "[+]", -- Text to show when the file is modified. 54 | readonly = "[-]", -- Text to show when the file is non-modifiable or readonly. 55 | unnamed = "[Empty]", -- Text to sho for unnamed buffers. 56 | }, 57 | }, 58 | }, 59 | }, 60 | }) 61 | end, 62 | }, 63 | { 64 | "lukas-reineke/indent-blankline.nvim", 65 | main = "ibl", 66 | config = function() 67 | vim.opt.list = true 68 | vim.opt.listchars:append("tab:| ") 69 | vim.opt.listchars:append("trail:.") 70 | vim.opt.listchars:append("extends:>") 71 | vim.opt.listchars:append("precedes:<") 72 | vim.opt.listchars:append("lead: ") 73 | vim.opt.listchars:append("space: ") 74 | require("ibl").setup({ 75 | indent = { 76 | char = "▏", 77 | }, 78 | scope = { 79 | show_start = false, 80 | }, 81 | }) 82 | end, 83 | }, 84 | { 85 | "kevinhwang91/nvim-ufo", 86 | lazy = false, 87 | dependencies = "kevinhwang91/promise-async", 88 | config = function() 89 | vim.keymap.set("n", "zr", require("ufo").openAllFolds) 90 | vim.keymap.set("n", "zm", require("ufo").closeAllFolds) 91 | require("ufo").setup({}) 92 | end, 93 | }, 94 | { 95 | "mrjones2014/smart-splits.nvim", 96 | event = "VeryLazy", 97 | keys = { 98 | { 99 | "", 100 | function() 101 | require("smart-splits").resize_left() 102 | end, 103 | mode = "n", 104 | silent = true, 105 | }, 106 | { 107 | "", 108 | function() 109 | require("smart-splits").resize_down() 110 | end, 111 | mode = "n", 112 | silent = true, 113 | }, 114 | { 115 | "", 116 | function() 117 | require("smart-splits").resize_up() 118 | end, 119 | mode = "n", 120 | silent = true, 121 | }, 122 | { 123 | "", 124 | function() 125 | require("smart-splits").resize_right() 126 | end, 127 | mode = "n", 128 | silent = true, 129 | }, 130 | }, 131 | }, 132 | { 133 | "projekt0n/circles.nvim", 134 | dependencies = { 135 | "nvim-tree/nvim-web-devicons", 136 | }, 137 | config = function() 138 | require("circles").setup({ 139 | icons = { empty = "", filled = "", lsp_prefix = "" }, 140 | lsp = true, 141 | }) 142 | end, 143 | }, 144 | { 145 | "utilyre/sentiment.nvim", 146 | event = "VeryLazy", 147 | version = "*", 148 | opts = {}, 149 | }, 150 | } 151 | -------------------------------------------------------------------------------- /logo/rubber-duck/rubber-duck.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /nvim/.config/nvim/lua/keymaps.vim: -------------------------------------------------------------------------------- 1 | " cSpell:disable 2 | " Leader key 3 | map 4 | 5 | " save & quit in window 6 | inoremap :wa 7 | nnoremap :wa 8 | nnoremap :w 9 | nnoremap :qa 10 | nnoremap :q 11 | " save file with sudo 12 | cnoremap sudow w !sudo tee % >/dev/null 13 | 14 | " switch window 15 | noremap h 16 | noremap l 17 | noremap j 18 | noremap k 19 | 20 | " split window 21 | noremap vs :vsplit 22 | noremap hs :split 23 | 24 | " switch location 25 | noremap 26 | noremap 27 | 28 | " faster movement 29 | nnoremap 9 30 | nnoremap 9 31 | 32 | " move in insert mode 33 | inoremap 34 | inoremap 35 | inoremap 36 | inoremap 37 | inoremap b 38 | inoremap w 39 | inoremap e 40 | inoremap 41 | 42 | " Keep search pattern at the center of the screen. 43 | nnoremap n nzzzv 44 | nnoremap j gj 45 | nnoremap k gk 46 | nnoremap N Nzzzv 47 | nnoremap * *zz 48 | nnoremap # #zz 49 | nnoremap g* g*zz 50 | nnoremap % 51 | vnoremap % 52 | 53 | " come from https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua 54 | nnoremap J mzJ`z 55 | vnoremap J :m '>+1gv=gv 56 | vnoremap K :m '<-2gv=gv 57 | 58 | " don't follow vim default behavior 59 | xnoremap p P 60 | 61 | nnoremap x :silent !chmod +x % 62 | 63 | " select all 64 | nnoremap ga ggVG 65 | 66 | " move to line start/end 67 | noremap H ^ 68 | noremap L $ 69 | 70 | " plus/minus 71 | noremap = 72 | noremap - 73 | 74 | " run macro q/w 75 | nnoremap @q 76 | nnoremap @w 77 | 78 | " mark 79 | nnoremap ' ` 80 | 81 | " toggle current block, all level 82 | nnoremap zo zA 83 | 84 | " disable 85 | nnoremap 86 | 87 | " search selected content in visual mode: https://blog.twofei.com/610/ 88 | vnoremap // y/" 89 | nnoremap / :noh 90 | 91 | " insert mode specials 92 | inoremap ;; := 93 | 94 | " resource configuration 95 | nnoremap la :Lazy 96 | 97 | " nnoremap sf :set filetype= 98 | " nnoremap st :set syntax= 99 | 100 | " buffer 101 | nnoremap :BufferLineCyclePrev 102 | nnoremap :BufferLineCycleNext 103 | nnoremap :BufferLineMovePrev 104 | nnoremap :BufferLineMoveNext 105 | nnoremap wh :BufferLineCloseLeft 106 | nnoremap wl :BufferLineCloseRight 107 | nnoremap wa :BufferLineCloseOthers 108 | nnoremap :BufferLinePick 109 | nnoremap :Bdelete 110 | 111 | " easy align 112 | " | Keystrokes | Description | 等价的命令 | 描述 | 113 | " | ---------- | ----------- | ------ | -- | 114 | " | 2 | Around 2nd whitespaces | :'<,'>EasyAlign2\ | 第二个空格分隔 | 115 | " | - | Around the last whitespaces | :'<,'>EasyAlign-\ | 最后一个空格分隔 | 116 | " | -2 | Around the 2nd to last whitespaces | :'<,'>EasyAlign-2\ | 倒数第二个空格分隔 | 117 | " | : | Around 1st colon (key: value) | :'<,'>EasyAlign: | 第一个 : 分隔 | 118 | " | : | Around 1st colon (key : value) | :'<,'>EasyAlign:>l1 | 同上, 分隔符右对齐 | 119 | " | = | Around 1st operators with = | :'<,'>EasyAlign= | 第一个 = 分隔 | 120 | " | 3= | Around 3rd operators with = | :'<,'>EasyAlign3= | 第三个 = 分隔 | 121 | " | *= | Around all operators with = | :'<,'>EasyAlign*= | 所有的 = 分隔 | 122 | " | **= | Left-right alternating around = | :'<,'>EasyAlign**= | = 先左->右对齐,然后交错对齐 | 123 | " | = | Right alignment around 1st = | :'<,'>EasyAlign!= | 第一个 = 前的右对齐, 其他不变 | 124 | " | **= | Right-left alternating around = | :'<,'>EasyAlign!**= | = 先右->左对齐,然后交错对齐 | 125 | " 126 | " tutorial: https://xu3352.github.io/linux/2018/10/18/vim-table-format-in-html-or-markdown 127 | " cheat sheet: https://devhints.io/vim-easyalign 128 | " Align by regex> :EasyAlign /[:;]+/ 129 | " Start interactive EasyAlign in visual mode (e.g. vipga) 130 | xnoremap ga (EasyAlign) 131 | " Align by regex 132 | " :'<,'>EasyAlign /regex/ 133 | vnoremap gs :EasyAlign 134 | " Start interactive EasyAlign for a motion/text object (e.g. gaip) 135 | " nnoremap ga (EasyAlign) 136 | 137 | " swap position for parameters 138 | " nnoremap , :SidewaysLeft 139 | " nnoremap . :SidewaysRight 140 | 141 | " vim-move 142 | let g:move_map_keys = 0 143 | nnoremap MoveCharLeft 144 | nnoremap MoveCharRight 145 | nnoremap MoveLineDown 146 | nnoremap MoveLineUp 147 | vnoremap MoveBlockLeft 148 | vnoremap MoveBlockRight 149 | vnoremap MoveBlockDown 150 | vnoremap MoveBlockUp 151 | 152 | " vim maximizer 153 | let g:maximizer_set_default_mapping = 0 154 | nnoremap :MaximizerToggle 155 | vnoremap :MaximizerTogglegv 156 | inoremap :MaximizerToggle 157 | 158 | nnoremap cc NERDCommenterToggle 159 | vnoremap cc NERDCommenterToggle 160 | nnoremap NERDCommenterToggle 161 | vnoremap NERDCommenterToggle 162 | 163 | " lsp 164 | nnoremap lr :LspStop:LspStart:LspRestart 165 | 166 | " xnoremap i` (textobj-backticks-backticks-ii) 167 | 168 | " kylechui/nvim-surround 169 | onoremap ir i[ 170 | onoremap ar a[ 171 | xnoremap ir i[ 172 | xnoremap ar a[ 173 | 174 | " AndrewRadev/sideways.vim 175 | " omap aa SidewaysArgumentTextobjA 176 | " xmap aa SidewaysArgumentTextobjA 177 | " omap ia SidewaysArgumentTextobjI 178 | " xmap ia SidewaysArgumentTextobjI 179 | -------------------------------------------------------------------------------- /macOS/Code/Library/Application Support/Code/User/keybindings.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "alt+s", 4 | "command": "workbench.action.files.save" 5 | }, 6 | { 7 | "key": "ctrl+s", 8 | "command": "-workbench.action.files.save" 9 | }, 10 | { 11 | "key": "cmd+b", 12 | "command": "editor.action.revealDefinition", 13 | "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" 14 | }, 15 | { 16 | "key": "f12", 17 | "command": "-editor.action.revealDefinition", 18 | "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" 19 | }, 20 | { 21 | "key": "alt+[", 22 | "command": "workbench.action.navigateBack", 23 | "when": "canNavigateBack" 24 | }, 25 | { 26 | "key": "ctrl+alt+-", 27 | "command": "-workbench.action.navigateBack", 28 | "when": "canNavigateBack" 29 | }, 30 | { 31 | "key": "alt+]", 32 | "command": "workbench.action.navigateForward", 33 | "when": "canNavigateForward" 34 | }, 35 | { 36 | "key": "ctrl+shift+-", 37 | "command": "-workbench.action.navigateForward", 38 | "when": "canNavigateForward" 39 | }, 40 | { 41 | "key": "alt+]", 42 | "command": "workbench.action.navigateRight" 43 | }, 44 | { 45 | "key": "ctrl+pagedown", 46 | "command": "-workbench.action.nextEditor" 47 | }, 48 | { 49 | "key": "ctrl+pageup", 50 | "command": "-workbench.action.previousEditor" 51 | }, 52 | { 53 | "key": "alt+w", 54 | "command": "workbench.action.closeActiveEditor" 55 | }, 56 | { 57 | "key": "ctrl+w", 58 | "command": "-workbench.action.closeActiveEditor" 59 | }, 60 | { 61 | "key": "ctrl+k e", 62 | "command": "-workbench.files.action.focusOpenEditorsView", 63 | "when": "workbench.explorer.openEditorsView.active" 64 | }, 65 | { 66 | "key": "ctrl+h", 67 | "command": "workbench.action.focusSideBar" 68 | }, 69 | { 70 | "key": "ctrl+l", 71 | "command": "workbench.action.focusLastEditorGroup" 72 | }, 73 | { 74 | "key": "alt+h", 75 | "command": "cursorLeft", 76 | "when": "textInputFocus && vim.mode == Insert" 77 | }, 78 | { 79 | "key": "alt+j", 80 | "command": "cursorDown", 81 | "when": "textInputFocus && vim.mode == Insert" 82 | }, 83 | { 84 | "key": "alt+l", 85 | "command": "cursorRight", 86 | "when": "textInputFocus && vim.mode == Insert" 87 | }, 88 | { 89 | "key": "alt+k", 90 | "command": "cursorUp", 91 | "when": "textInputFocus && vim.mode == Insert" 92 | }, 93 | { 94 | "key": "alt+v", 95 | "command": "editor.action.clipboardPasteAction" 96 | }, 97 | { 98 | "key": "alt+c", 99 | "command": "-toggleSearchCaseSensitive", 100 | "when": "searchViewletFocus" 101 | }, 102 | { 103 | "key": "alt+c", 104 | "command": "-toggleFindCaseSensitive", 105 | "when": "editorFocus" 106 | }, 107 | { 108 | "key": "alt+c", 109 | "command": "-workbench.action.terminal.toggleFindCaseSensitive", 110 | "when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" 111 | }, 112 | { 113 | "key": "alt+c", 114 | "command": "-toggleSearchEditorCaseSensitive", 115 | "when": "inSearchEditor && searchInputBoxFocus" 116 | }, 117 | { 118 | "key": "ctrl+j", 119 | "command": "-editor.action.joinLines", 120 | "when": "editorTextFocus && !editorReadonly" 121 | }, 122 | { 123 | "key": "ctrl+j", 124 | "command": "-extension.vim_ctrl+j", 125 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" 126 | }, 127 | { 128 | "key": "alt+m", 129 | "command": "workbench.action.focusPanel", 130 | "when": "editorFocus" 131 | }, 132 | { 133 | "key": "ctrl+k", 134 | "command": "workbench.action.focusActiveEditorGroup" 135 | }, 136 | { 137 | "key": "ctrl+k", 138 | "command": "-deleteAllRight", 139 | "when": "textInputFocus && !editorReadonly" 140 | }, 141 | { 142 | "key": "ctrl+k", 143 | "command": "-extension.vim_ctrl+k", 144 | "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" 145 | }, 146 | // macOS 147 | { 148 | "key": "cmd+a", 149 | "command": "editor.action.selectAll" 150 | }, 151 | { 152 | "key": "cmd+f", 153 | "command": "actions.find", 154 | "when": "editorFocus || editorIsOpen" 155 | }, 156 | { 157 | "key": "cmd+m", 158 | "command": "workbench.action.closePanel", 159 | "when": "panelFocus" 160 | }, 161 | { 162 | "key": "cmd+k", 163 | "command": "editor.action.rename", 164 | "when": "vim.mode == 'Normal' && editorHasRenameProvider && editorTextFocus && !editorReadonly" 165 | }, 166 | { 167 | "key": "cmd+/", 168 | "command": "editor.action.addCommentLine", 169 | "when": "editorTextFocus && !editorReadonly" 170 | }, 171 | { 172 | "key": "cmd+k cmd+c", 173 | "command": "-editor.action.addCommentLine", 174 | "when": "editorTextFocus && !editorReadonly" 175 | }, 176 | { 177 | "key": "cmd+k cmd+u", 178 | "command": "-editor.action.removeCommentLine", 179 | "when": "editorTextFocus && !editorReadonly" 180 | }, 181 | { 182 | "key": "alt+/", 183 | "command": "editor.action.removeCommentLine" 184 | }, 185 | { 186 | "key": "cmd+]", 187 | "command": "-editor.action.indentLines", 188 | "when": "editorTextFocus && !editorReadonly" 189 | }, 190 | { 191 | "key": "cmd+[", 192 | "command": "-editor.action.outdentLines", 193 | "when": "editorTextFocus && !editorReadonly" 194 | }, 195 | { 196 | "key": "shift+cmd+h", 197 | "command": "workbench.action.previousEditor" 198 | }, 199 | { 200 | "key": "cmd+[", 201 | "command": "workbench.action.navigateBackInEditLocations" 202 | }, 203 | { 204 | "key": "cmd+]", 205 | "command": "workbench.action.navigateForwardInEditLocations" 206 | }, 207 | { 208 | "key": "cmd+b", 209 | "command": "-workbench.action.toggleSidebarVisibility" 210 | }, 211 | { 212 | "key": "g r", 213 | "command": "editor.action.goToReferences", 214 | "when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor && vim.mode == Normal" 215 | }, 216 | { 217 | "key": "cmd+l cmd+o", 218 | "command": "-extension.liveServer.goOnline", 219 | "when": "editorTextFocus" 220 | }, 221 | { 222 | "key": "cmd+l", 223 | "command": "-expandLineSelection", 224 | "when": "textInputFocus" 225 | }, 226 | { 227 | "key": "cmd+l cmd+c", 228 | "command": "-extension.liveServer.goOffline", 229 | "when": "editorTextFocus" 230 | }, 231 | { 232 | "key": "shift+cmd+l", 233 | "command": "workbench.action.nextEditor" 234 | }, 235 | { 236 | "key": "cmd+l", 237 | "command": "github.copilot.chat.attachSelection" 238 | }, 239 | { 240 | "key": "cmd+m", 241 | "command": "workbench.action.togglePanel" 242 | } 243 | ] -------------------------------------------------------------------------------- /Linux/Code/.config/Code/User/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[csharp]": { 3 | "editor.defaultFormatter": "ms-dotnettools.csharp" 4 | }, 5 | "[css]": { 6 | "editor.defaultFormatter": "esbenp.prettier-vscode" 7 | }, 8 | "[go]": { 9 | "editor.codeActionsOnSave": { 10 | "source.organizeImports": "explicit" 11 | }, 12 | "editor.formatOnSave": true, 13 | "editor.insertSpaces": false, 14 | "editor.snippetSuggestions": "inline" 15 | }, 16 | "[html]": { 17 | "editor.defaultFormatter": "esbenp.prettier-vscode" 18 | }, 19 | "[javascript]": { 20 | "editor.defaultFormatter": "esbenp.prettier-vscode" 21 | }, 22 | "[json]": { 23 | "editor.defaultFormatter": "vscode.json-language-features" 24 | }, 25 | "[jsonc]": { 26 | "editor.defaultFormatter": "vscode.json-language-features" 27 | }, 28 | "[lua]": { 29 | "editor.defaultFormatter": "sumneko.lua" 30 | }, 31 | "[python]": { 32 | "editor.formatOnType": true 33 | }, 34 | "[sql]": { 35 | "editor.defaultFormatter": "adpyke.vscode-sql-formatter" 36 | }, 37 | "[typescript]": { 38 | "editor.defaultFormatter": "esbenp.prettier-vscode" 39 | }, 40 | "[typescriptreact]": { 41 | "editor.defaultFormatter": "esbenp.prettier-vscode" 42 | }, 43 | "application.shellEnvironmentResolutionTimeout": 120, 44 | "cSpell.userWords": [ 45 | "Aggs", 46 | "agollo", 47 | "bson", 48 | "CDNURL", 49 | "CQRs", 50 | "crondatalib", 51 | "curioim", 52 | "curioretail", 53 | "dbname", 54 | "dtask", 55 | "Errorln", 56 | "eshop", 57 | "Gitlab", 58 | "gjson", 59 | "golibs", 60 | "instanceid", 61 | "jinzhu", 62 | "JSID", 63 | "Lookupd", 64 | "mediaid", 65 | "mongodb", 66 | "mongoh", 67 | "Neovim", 68 | "nsqd", 69 | "nsqh", 70 | "nsqlookupd", 71 | "nvim", 72 | "oexcel", 73 | "olivere", 74 | "Openid", 75 | "oper", 76 | "parentid", 77 | "postgres", 78 | "qrcode", 79 | "qrcodes", 80 | "Repos", 81 | "resty", 82 | "signup", 83 | "structs", 84 | "sysphoto", 85 | "tagid", 86 | "Tampermonkey", 87 | "Unionid", 88 | "wechat", 89 | "Weixin", 90 | "Wesociety", 91 | "wxwork", 92 | "yorozuya" 93 | ], 94 | "diffEditor.wordWrap": "off", 95 | "editor.fontFamily": "'Consolas Nerd Font', 'Recursive Nerd Font', 'Source Code Pro', Menlo, monospace", 96 | "editor.fontWeight": "400", 97 | "editor.formatOnSave": true, 98 | "editor.inlineSuggest.enabled": true, 99 | "editor.lineHeight": 19, 100 | "editor.lineNumbers": "relative", 101 | "editor.rulers": [ 102 | 80, 103 | 120 104 | ], 105 | "editor.suggest.snippetsPreventQuickSuggestions": false, 106 | "editor.suggestSelection": "first", 107 | "editor.unicodeHighlight.ambiguousCharacters": false, 108 | "editor.wordWrapColumn": 100, 109 | "emmet.includeLanguages": { 110 | "wxml": "html" 111 | }, 112 | "explorer.confirmDelete": false, 113 | "explorer.confirmDragAndDrop": false, 114 | "extensions.ignoreRecommendations": true, 115 | "files.associations": { 116 | "*.cjson": "jsonc", 117 | "*.dae": "shellscript", 118 | "*.wxs": "javascript", 119 | "*.wxss": "css" 120 | }, 121 | "files.autoSaveDelay": 300, 122 | "files.defaultLanguage": "json", 123 | "files.exclude": { 124 | "**/.classpath": true, 125 | "**/.factorypath": true, 126 | "**/.git": false, 127 | "**/.project": true, 128 | "**/.settings": true 129 | }, 130 | "git.enableSmartCommit": true, 131 | "git.openRepositoryInParentFolders": "never", 132 | "go.formatTool": "goimports", 133 | "go.lintTool": "golangci-lint", 134 | "go.testEnvVars": { 135 | "APP_ENV": "dev" 136 | }, 137 | "go.toolsManagement.autoUpdate": true, 138 | "go.useLanguageServer": true, 139 | "go.vetOnSave": "off", 140 | "gopls": { 141 | "ui.completion.usePlaceholders": false 142 | }, 143 | "javascript.updateImportsOnFileMove.enabled": "always", 144 | "python.languageServer": "Pylance", 145 | "search.exclude": { 146 | "**/node_modules": false 147 | }, 148 | "security.workspace.trust.untrustedFiles": "newWindow", 149 | "terminal.integrated.fontSize": 12, 150 | "terminal.integrated.profiles.osx": { 151 | "bash": { 152 | "args": [ 153 | "-l" 154 | ], 155 | "icon": "terminal-bash", 156 | "path": "bash" 157 | }, 158 | "fish": { 159 | "args": [ 160 | "-l" 161 | ], 162 | "path": "fish" 163 | }, 164 | "pwsh": { 165 | "icon": "terminal-powershell", 166 | "path": "pwsh" 167 | }, 168 | "tmux": { 169 | "icon": "terminal-tmux", 170 | "path": "tmux" 171 | }, 172 | "zsh": { 173 | "args": [ 174 | "-l" 175 | ], 176 | "path": "zsh" 177 | } 178 | }, 179 | "typescript.updateImportsOnFileMove.enabled": "always", 180 | "vim.autoSwitchInputMethod.defaultIM": "keyboard-us", 181 | "vim.autoSwitchInputMethod.enable": true, 182 | "vim.autoSwitchInputMethod.obtainIMCmd": "fcitx5-remote -n", 183 | "vim.autoSwitchInputMethod.switchIMCmd": "fcitx5-remote -s {im}", 184 | "vim.cursorStylePerMode.replace": "block-outline", 185 | "vim.easymotion": true, 186 | "vim.easymotionKeys": "hklyuiopnmqwertzxcvbasdgjf", 187 | "vim.leader": "", 188 | "vim.useSystemClipboard": true, 189 | "vim.normalModeKeyBindingsNonRecursive": [ 190 | { 191 | "after": [ 192 | "C-y", 193 | "C-y", 194 | "C-y", 195 | "C-y", 196 | "C-y", 197 | "C-y", 198 | "C-y" 199 | ], 200 | "before": [ 201 | "C-y" 202 | ] 203 | }, 204 | { 205 | "after": [ 206 | "C-e", 207 | "C-e", 208 | "C-e", 209 | "C-e", 210 | "C-e", 211 | "C-e", 212 | "C-e", 213 | "C-e" 214 | ], 215 | "before": [ 216 | "C-e" 217 | ] 218 | }, 219 | { 220 | "after": [ 221 | "leader", 222 | "leader", 223 | "2", 224 | "s" 225 | ], 226 | "before": [ 227 | "s" 228 | ] 229 | } 230 | ], 231 | "vim.useCtrlKeys": true, 232 | "window.title": "${dirty}${rootName}", 233 | "workbench.editor.wrapTabs": true, 234 | "workbench.editorAssociations": { 235 | "*.ipynb": "jupyter.notebook.ipynb" 236 | }, 237 | "workbench.layoutControl.enabled": false, 238 | "workbench.startupEditor": "none", 239 | "workbench.colorTheme": "Default Light Modern", 240 | "symbols.hidesExplorerArrows": false, 241 | "redhat.telemetry.enabled": true, 242 | "editor.fontSize": 13, 243 | "[vue]": { 244 | "editor.defaultFormatter": "esbenp.prettier-vscode" 245 | }, 246 | "editor.largeFileOptimizations": false, 247 | "window.customTitleBarVisibility": "never" 248 | } -------------------------------------------------------------------------------- /tmux/.tmux.conf: -------------------------------------------------------------------------------- 1 | # normal --- {{{ 2 | set -g @scroll-speed-num-lines-per-scroll 3 3 | set -g mouse on 4 | set -g status-justify centre 5 | 6 | # scroll back buffer n lines 7 | set -g history-limit 100000 8 | set -g display-time 4000 9 | # for os x 10 | set -g set-clipboard on 11 | 12 | setw -g mode-keys vi 13 | 14 | set -g base-index 1 15 | setw -g pane-base-index 1 16 | 17 | # focus events enabled for terminals that support them 18 | set -g focus-events on 19 | # super useful when using "grouped sessions" and multi-monitor setup 20 | setw -g aggressive-resize on 21 | 22 | # --- }}} 23 | 24 | 25 | # style ---{{{ 26 | # set -g window-style 'fg=colour247,bg=colour236' 27 | # set -g window-active-style 'fg=colour251,bg=black' 28 | 29 | # terminal settings 30 | # https://github.com/microsoft/WSL/issues/5931#issuecomment-1296783606 31 | set -sg escape-time 1 32 | # cursor blink in vim 33 | set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' 34 | 35 | # for osc52, "screen-256color" must match with $TERM from shell 36 | set -ga terminal-overrides ",*256col*:Tc" 37 | # under curl 38 | set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' 39 | # underscore colours - needs tmux-3.0 40 | set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' 41 | set -g default-terminal "tmux-256color" 42 | set -as terminal-features ',tmux-256color:clipboard' 43 | 44 | # refresh every second 45 | set -g status-interval 1 46 | 47 | # --- }}} 48 | 49 | 50 | # key binding --- {{{ 51 | set -g prefix C-a 52 | bind C-a send-prefix 53 | unbind C-b 54 | unbind , 55 | unbind Right 56 | 57 | # reload config 58 | bind R source-file ~/.tmux.conf 59 | 60 | # kill 61 | bind x kill-pane 62 | bind X kill-window 63 | bind K confirm kill-session 64 | # bind K confirm kill-server 65 | # you should not use shortcut to kill server 66 | 67 | # window switch 68 | #| n => next window 69 | #| p => previous window 70 | #| { => move current pane to previous position 71 | #| } => move current pane to next position 72 | bind -r n next-window 73 | bind -r p previous-window 74 | bind Left previous-window 75 | bind Right next-window 76 | bind o move-window -r 77 | 78 | bind \{ swap-window -t -1\; select-window -t -1 79 | bind \} swap-window -t +1\; select-window -t +1 80 | bind , swap-window -t -1\; select-window -t -1 81 | bind . swap-window -t +1\; select-window -t +1 82 | 83 | # session 84 | bind Down switch-client -n 85 | bind Up switch-client -p 86 | bind Enter switch-client -l 87 | bind C-r command-prompt "rename-session %%" 88 | 89 | # layout 90 | bind ] next-layout 91 | bind [ previous-layout 92 | bind ! select-layout main-vertical # shift + 1 93 | bind @ select-layout main-horizontal # shift + 2 94 | bind \# select-layout even-vertical # shift + 3 95 | bind $ select-layout even-horizontal # shift + 4 96 | bind % select-layout tiled # shift + 5 97 | 98 | # window rename 99 | bind-key v new-window \; rename-window "#{b:pane_current_path}" 100 | bind-key c run-shell "tmux neww ~/.local/bin/tmux-new-window" 101 | bind-key r command-prompt "rename-window %%" 102 | 103 | bind-key Space rename-window "#{b:pane_current_path}" 104 | 105 | 106 | # window-pane switch 107 | bind b break-pane -s : 108 | bind t command-prompt -p "join pane from:" "join-pane -h -s '%%'" 109 | bind y command-prompt -p "join pane from:" "join-pane -v -s '%%'" 110 | # bind-key s command-prompt -p "send pane to:" "join-pane -h -t '%%'" 111 | 112 | ### C-o: rotate all panes 113 | 114 | # pane split 115 | bind | split-window -h -c "#{pane_current_path}" 116 | bind \\ split-window -h -c "#{pane_current_path}" 117 | bind - split-window -v -c "#{pane_current_path}" 118 | unbind '"' 119 | unbind % 120 | 121 | # pane resizing 122 | bind -r C-k resize-pane -U 5 123 | bind -r C-j resize-pane -D 5 124 | bind -r C-h resize-pane -L 5 125 | bind -r C-l resize-pane -R 5 126 | 127 | # pane switching 128 | bind k select-pane -U 129 | bind j select-pane -D 130 | bind h select-pane -L 131 | bind l select-pane -R 132 | 133 | # pane swap 134 | bind H swap-pane -U 135 | bind L swap-pane -D 136 | 137 | bind f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" 138 | # set-hook -g pane-focus-in 'rename-window "#{b:pane_current_path}"' 139 | 140 | bind -n S-M-Left { 141 | copy-mode 142 | send -X clear-selection 143 | send -X start-of-line 144 | send -X cursor-left 145 | send -X begin-selection 146 | send -X start-of-line 147 | send -X stop-selection 148 | } 149 | 150 | bind -n S-M-Up { 151 | copy-mode 152 | send -X clear-selection 153 | send -X cursor-up 154 | send -X start-of-line 155 | send -X start-of-line 156 | send -X cursor-left 157 | send -X begin-selection 158 | send -X search-backward "(Δ )|(Ε )|(✘ )" 159 | send -X start-of-line 160 | send -X start-of-line 161 | send -X stop-selection 162 | } 163 | 164 | bind -n S-M-Right { 165 | copy-mode 166 | send -X clear-selection 167 | send -X cursor-down 168 | send -X start-of-line 169 | send -X begin-selection 170 | send -X end-of-line 171 | send -X stop-selection 172 | } 173 | 174 | bind -n S-M-Down { 175 | copy-mode 176 | send -X clear-selection 177 | send -X end-of-line 178 | send -X end-of-line 179 | send -X search-forward "(Δ )|(Ε )|(✘ )" 180 | send -X start-of-line 181 | send -X start-of-line 182 | send -X begin-selection 183 | send -X search-forward "(Δ )|(Ε )|(✘ )" 184 | send -X cursor-up 185 | send -X start-of-line 186 | send -X start-of-line 187 | send -X cursor-left 188 | send -X stop-selection 189 | } 190 | 191 | # --- }}} 192 | 193 | 194 | # plugins --- {{{ 195 | set -g @plugin 'tmux-plugins/tpm' 196 | set -g @plugin 'tmux-plugins/tmux-sensible' 197 | set -g @plugin 'tmux-plugins/tmux-yank' 198 | 199 | # power line 200 | 201 | ### 魔改了 wfx/tmux-power 的以下内容 202 | # G04=#ebdbb2 203 | # G06=#ebdbb2 204 | # G10=#3c3836 205 | ### 值来自 gruvbox:https://github.com/morhetz/gruvbox 206 | 207 | set -g @plugin 'wfxr/tmux-power' 208 | set -g @tmux_power_theme '#7c6f64' 209 | set -g @tmux_power_left_arrow_icon ' ' 210 | set -g @tmux_power_right_arrow_icon ' ' 211 | if-shell '[ ! -z "$(env | grep SSH_CONNECTION 2>/dev/null)" ]' { 212 | set -g @tmux_power_theme 'gold' 213 | } 214 | 215 | # set -g @plugin 'egel/tmux-gruvbox' 216 | # set -g @tmux-gruvbox 'light' # or 'dark256', 'light', 'light256' 217 | # set -g @tmux-gruvbox-right-status-y '%H:%M:%S' 218 | # set -g @tmux-gruvbox-statusbar-alpha 'false' 219 | 220 | # set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" 221 | 222 | # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) 223 | # 1. git clone https://github.com/tmux-plugins/tpm.git $HOME/code/github.com/tmux-plugins/tpm 224 | # 2. $HOME/code/github.com/tmux-plugins/tpm/bin/install_plugins 225 | run '~/code/github.com/tmux-plugins/tpm/tpm' 226 | 227 | # --- }}} 228 | -------------------------------------------------------------------------------- /Linux/alacritty/.config/alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [env] 2 | TERM = "screen-256color" 3 | 4 | [terminal] 5 | osc52 = "CopyPaste" 6 | 7 | [window] 8 | dimensions = { columns = 180, lines = 40 } 9 | padding = { x = 1, y = 1 } 10 | decorations = "full" 11 | dynamic_title = false 12 | 13 | [font] 14 | normal = { family = "Recursive Nerd Font", style = "Regular" } 15 | size = 10 16 | offset = { x = 1, y = 1 } 17 | 18 | [keyboard] 19 | bindings = [ 20 | # Support for CSI u mode 21 | { chars = "\u001b[13;5u", key = "Return", mods = "Control" }, 22 | { chars = "\u001b[104;5u", key = "H", mods = "Control" }, 23 | { chars = "\u001b[105;5u", key = "I", mods = "Control" }, 24 | { chars = "\u001b[106;5u", key = "J", mods = "Control" }, 25 | { chars = "\u001b[109;5u", key = "M", mods = "Control" }, 26 | 27 | # (macOS only) 28 | { action = "ReceiveChar", key = "K", mode = "~Vi|~Search", mods = "Command" }, 29 | { action = "ReceiveChar", key = "Key0", mods = "Command" }, 30 | { action = "ReceiveChar", key = "Equals", mods = "Command" }, 31 | { action = "ReceiveChar", key = "Plus", mods = "Command" }, 32 | { action = "ReceiveChar", key = "NumpadAdd", mods = "Command" }, 33 | { action = "ReceiveChar", key = "Minus", mods = "Command" }, 34 | { action = "ReceiveChar", key = "NumpadSubtract", mods = "Command" }, 35 | { action = "ReceiveChar", key = "V", mods = "Command" }, 36 | { action = "ReceiveChar", key = "C", mods = "Command" }, 37 | { action = "ReceiveChar", key = "C", mode = "Vi|~Search", mods = "Command" }, 38 | { action = "ReceiveChar", key = "H", mods = "Command" }, 39 | { action = "ReceiveChar", key = "H", mods = "Command|Alt" }, 40 | { action = "ReceiveChar", key = "M", mods = "Command" }, 41 | { action = "ReceiveChar", key = "Q", mods = "Command" }, 42 | { action = "ReceiveChar", key = "W", mods = "Command" }, 43 | { action = "ReceiveChar", key = "N", mods = "Command" }, 44 | { action = "SpawnNewInstance", key = "N", mods = "Command|Shift" }, 45 | { action = "ReceiveChar", key = "F", mods = "Command|Control" }, 46 | { action = "ReceiveChar", key = "F", mode = "~Search", mods = "Command" }, 47 | { action = "ReceiveChar", key = "B", mode = "~Search", mods = "Command" }, 48 | { action = "ReceiveChar", key = "B", mods = "Command" }, 49 | 50 | # https://github.com/alacritty/alacritty/issues/93 51 | { action = "Paste", key = "V", mods = "Alt" }, 52 | { action = "Copy", key = "C", mods = "Alt" }, 53 | { chars = "\u001b-", key = "Minus", mods = "Alt" }, 54 | { chars = "\u001b=", key = "Equals", mods = "Alt" }, 55 | { chars = "\u001b+", key = "Plus", mods = "Alt" }, 56 | { chars = "\u001b[", key = "LBracket", mods = "Alt" }, 57 | { chars = "\u001b]", key = "RBracket", mods = "Alt" }, 58 | { chars = "\u001b{", key = "LBracket", mods = "Alt|Shift" }, 59 | { chars = "\u001b}", key = "RBracket", mods = "Alt|Shift" }, 60 | 61 | # https://github.com/alacritty/alacritty/issues/62 62 | { chars = "\u001ba", key = "A", mods = "Alt" }, 63 | { chars = "\u001bb", key = "B", mods = "Alt" }, 64 | { chars = "\u001bd", key = "D", mods = "Alt" }, 65 | { chars = "\u001be", key = "E", mods = "Alt" }, 66 | { chars = "\u001bf", key = "F", mods = "Alt" }, 67 | { chars = "\u001bg", key = "G", mods = "Alt" }, 68 | { chars = "\u001bh", key = "H", mods = "Alt" }, 69 | { chars = "\u001bi", key = "I", mods = "Alt" }, 70 | { chars = "\u001bj", key = "J", mods = "Alt" }, 71 | { chars = "\u001bk", key = "K", mods = "Alt" }, 72 | { chars = "\u001bl", key = "L", mods = "Alt" }, 73 | { chars = "\u001bm", key = "M", mods = "Alt" }, 74 | { chars = "\u001bn", key = "N", mods = "Alt" }, 75 | { chars = "\u001bo", key = "O", mods = "Alt" }, 76 | { chars = "\u001bp", key = "P", mods = "Alt" }, 77 | { chars = "\u001bq", key = "Q", mods = "Alt" }, 78 | { chars = "\u001br", key = "R", mods = "Alt" }, 79 | { chars = "\u001bs", key = "S", mods = "Alt" }, 80 | { chars = "\u001bt", key = "T", mods = "Alt" }, 81 | { chars = "\u001bu", key = "U", mods = "Alt" }, 82 | { chars = "\u001bw", key = "W", mods = "Alt" }, 83 | { chars = "\u001bx", key = "X", mods = "Alt" }, 84 | { chars = "\u001by", key = "Y", mods = "Alt" }, 85 | { chars = "\u001bz", key = "Z", mods = "Alt" }, 86 | { chars = "\u001bA", key = "A", mods = "Alt|Shift" }, 87 | { chars = "\u001bB", key = "B", mods = "Alt|Shift" }, 88 | { chars = "\u001bC", key = "C", mods = "Alt|Shift" }, 89 | { chars = "\u001bD", key = "D", mods = "Alt|Shift" }, 90 | { chars = "\u001bE", key = "E", mods = "Alt|Shift" }, 91 | { chars = "\u001bF", key = "F", mods = "Alt|Shift" }, 92 | { chars = "\u001bG", key = "G", mods = "Alt|Shift" }, 93 | { chars = "\u001bH", key = "H", mods = "Alt|Shift" }, 94 | { chars = "\u001bI", key = "I", mods = "Alt|Shift" }, 95 | { chars = "\u001bJ", key = "J", mods = "Alt|Shift" }, 96 | { chars = "\u001bK", key = "K", mods = "Alt|Shift" }, 97 | { chars = "\u001bL", key = "L", mods = "Alt|Shift" }, 98 | { chars = "\u001bM", key = "M", mods = "Alt|Shift" }, 99 | { chars = "\u001bN", key = "N", mods = "Alt|Shift" }, 100 | { chars = "\u001bO", key = "O", mods = "Alt|Shift" }, 101 | { chars = "\u001bP", key = "P", mods = "Alt|Shift" }, 102 | { chars = "\u001bQ", key = "Q", mods = "Alt|Shift" }, 103 | { chars = "\u001bR", key = "R", mods = "Alt|Shift" }, 104 | { chars = "\u001bS", key = "S", mods = "Alt|Shift" }, 105 | { chars = "\u001bT", key = "T", mods = "Alt|Shift" }, 106 | { chars = "\u001bU", key = "U", mods = "Alt|Shift" }, 107 | { chars = "\u001bV", key = "V", mods = "Alt|Shift" }, 108 | { chars = "\u001bW", key = "W", mods = "Alt|Shift" }, 109 | { chars = "\u001bX", key = "X", mods = "Alt|Shift" }, 110 | { chars = "\u001bY", key = "Y", mods = "Alt|Shift" }, 111 | { chars = "\u001bZ", key = "Z", mods = "Alt|Shift" }, 112 | { chars = "\u001b1", key = "Key1", mods = "Alt" }, 113 | { chars = "\u001b2", key = "Key2", mods = "Alt" }, 114 | { chars = "\u001b3", key = "Key3", mods = "Alt" }, 115 | { chars = "\u001b4", key = "Key4", mods = "Alt" }, 116 | { chars = "\u001b5", key = "Key5", mods = "Alt" }, 117 | { chars = "\u001b6", key = "Key6", mods = "Alt" }, 118 | { chars = "\u001b7", key = "Key7", mods = "Alt" }, 119 | { chars = "\u001b8", key = "Key8", mods = "Alt" }, 120 | { chars = "\u001b9", key = "Key9", mods = "Alt" }, 121 | { chars = "\u001b0", key = "Key0", mods = "Alt" }, 122 | { chars = "\u0000", key = "Space", mods = "Control" }, 123 | { chars = "\u001b`", key = "`", mods = "Alt" }, 124 | { chars = "\u001b~", key = "~", mods = "Alt|Shift" }, 125 | { chars = "\u001b.", key = "Period", mods = "Alt" }, 126 | { chars = "\u001b>", key = "Period", mods = "Alt|Shift" }, 127 | { chars = "\u001b<", key = "Comma", mods = "Alt|Shift" }, 128 | { chars = "\u001b_", key = "Minus", mods = "Alt|Shift" }, 129 | { chars = "\u001b#", key = "Key3", mods = "Alt|Shift" }, 130 | { chars = "\u001b%", key = "Key5", mods = "Alt|Shift" }, 131 | { chars = "\u001b^", key = "Key6", mods = "Alt|Shift" }, 132 | { chars = "\u001b*", key = "Key8", mods = "Alt|Shift" }, 133 | { chars = "\u001b\\", key = "Backslash", mods = "Alt" }, 134 | { chars = "\u001b|", key = "Backslash", mods = "Alt|Shift" }, 135 | { chars = "\u001b/", key = "Slash", mods = "Alt" }, 136 | ] 137 | -------------------------------------------------------------------------------- /macOS/alacritty/.config/alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [env] 2 | TERM = "screen-256color" 3 | 4 | [terminal] 5 | osc52 = "CopyPaste" 6 | 7 | [window] 8 | dimensions = { columns = 180, lines = 60 } 9 | padding = { x = 1, y = 1 } 10 | decorations = "full" 11 | dynamic_title = false 12 | option_as_alt = "Both" 13 | 14 | [font] 15 | # normal = { family = "Recursive Nerd Font", style = "Regular" } 16 | # size = 14 17 | # offset = { x = 1, y = 1 } 18 | normal = { family = "Consolas Nerd Font", style = "Regular" } 19 | size = 16 20 | offset = { x = 1, y = 2 } 21 | 22 | [keyboard] 23 | bindings = [ 24 | { action = "Paste", key = "V", mods = "Alt" }, 25 | { action = "Copy", key = "C", mods = "Alt" }, 26 | # Support for CSI u mode 27 | # { chars = "\u001b[13;5u", key = "Return", mods = "Control" }, 28 | # { chars = "\u001b[104;5u", key = "H", mods = "Control" }, 29 | # { chars = "\u001b[105;5u", key = "I", mods = "Control" }, 30 | # { chars = "\u001b[106;5u", key = "J", mods = "Control" }, 31 | # { chars = "\u001b[109;5u", key = "M", mods = "Control" }, 32 | 33 | # (macOS only) 34 | # { action = "ReceiveChar", key = "K", mode = "~Vi|~Search", mods = "Command" }, 35 | # { action = "ReceiveChar", key = "Key0", mods = "Command" }, 36 | # { action = "ReceiveChar", key = "Equals", mods = "Command" }, 37 | # { action = "ReceiveChar", key = "Plus", mods = "Command" }, 38 | # { action = "ReceiveChar", key = "NumpadAdd", mods = "Command" }, 39 | # { action = "ReceiveChar", key = "Minus", mods = "Command" }, 40 | # { action = "ReceiveChar", key = "NumpadSubtract", mods = "Command" }, 41 | # { action = "ReceiveChar", key = "V", mods = "Command" }, 42 | # { action = "ReceiveChar", key = "C", mods = "Command" }, 43 | # { action = "ReceiveChar", key = "C", mode = "Vi|~Search", mods = "Command" }, 44 | # { action = "ReceiveChar", key = "H", mods = "Command" }, 45 | # { action = "ReceiveChar", key = "H", mods = "Command|Alt" }, 46 | # { action = "ReceiveChar", key = "M", mods = "Command" }, 47 | # { action = "ReceiveChar", key = "Q", mods = "Command" }, 48 | # { action = "ReceiveChar", key = "W", mods = "Command" }, 49 | # { action = "ReceiveChar", key = "N", mods = "Command" }, 50 | # { action = "SpawnNewInstance", key = "N", mods = "Command|Shift" }, 51 | # { action = "ReceiveChar", key = "F", mods = "Command|Control" }, 52 | # { action = "ReceiveChar", key = "F", mode = "~Search", mods = "Command" }, 53 | # { action = "ReceiveChar", key = "B", mode = "~Search", mods = "Command" }, 54 | # { action = "ReceiveChar", key = "B", mods = "Command" }, 55 | 56 | # https://github.com/alacritty/alacritty/issues/93 57 | # { chars = "\u001b-", key = "Minus", mods = "Alt" }, 58 | # { chars = "\u001b=", key = "Equals", mods = "Alt" }, 59 | # { chars = "\u001b+", key = "Plus", mods = "Alt" }, 60 | # { chars = "\u001b[", key = "LBracket", mods = "Alt" }, 61 | # { chars = "\u001b]", key = "RBracket", mods = "Alt" }, 62 | # { chars = "\u001b{", key = "LBracket", mods = "Alt|Shift" }, 63 | # { chars = "\u001b}", key = "RBracket", mods = "Alt|Shift" }, 64 | 65 | # # https://github.com/alacritty/alacritty/issues/62 66 | # { chars = "\u001ba", key = "A", mods = "Alt" }, 67 | # { chars = "\u001bb", key = "B", mods = "Alt" }, 68 | # { chars = "\u001bd", key = "D", mods = "Alt" }, 69 | # { chars = "\u001be", key = "E", mods = "Alt" }, 70 | # { chars = "\u001bf", key = "F", mods = "Alt" }, 71 | # { chars = "\u001bg", key = "G", mods = "Alt" }, 72 | # { chars = "\u001bh", key = "H", mods = "Alt" }, 73 | # { chars = "\u001bi", key = "I", mods = "Alt" }, 74 | # { chars = "\u001bj", key = "J", mods = "Alt" }, 75 | # { chars = "\u001bk", key = "K", mods = "Alt" }, 76 | # { chars = "\u001bl", key = "L", mods = "Alt" }, 77 | # { chars = "\u001bm", key = "M", mods = "Alt" }, 78 | # { chars = "\u001bn", key = "N", mods = "Alt" }, 79 | # { chars = "\u001bo", key = "O", mods = "Alt" }, 80 | # { chars = "\u001bp", key = "P", mods = "Alt" }, 81 | # { chars = "\u001bq", key = "Q", mods = "Alt" }, 82 | # { chars = "\u001br", key = "R", mods = "Alt" }, 83 | # { chars = "\u001bs", key = "S", mods = "Alt" }, 84 | # { chars = "\u001bt", key = "T", mods = "Alt" }, 85 | # { chars = "\u001bu", key = "U", mods = "Alt" }, 86 | # { chars = "\u001bw", key = "W", mods = "Alt" }, 87 | # { chars = "\u001bx", key = "X", mods = "Alt" }, 88 | # { chars = "\u001by", key = "Y", mods = "Alt" }, 89 | # { chars = "\u001bz", key = "Z", mods = "Alt" }, 90 | # { chars = "\u001bA", key = "A", mods = "Alt|Shift" }, 91 | # { chars = "\u001bB", key = "B", mods = "Alt|Shift" }, 92 | # { chars = "\u001bC", key = "C", mods = "Alt|Shift" }, 93 | # { chars = "\u001bD", key = "D", mods = "Alt|Shift" }, 94 | # { chars = "\u001bE", key = "E", mods = "Alt|Shift" }, 95 | # { chars = "\u001bF", key = "F", mods = "Alt|Shift" }, 96 | # { chars = "\u001bG", key = "G", mods = "Alt|Shift" }, 97 | # { chars = "\u001bH", key = "H", mods = "Alt|Shift" }, 98 | # { chars = "\u001bI", key = "I", mods = "Alt|Shift" }, 99 | # { chars = "\u001bJ", key = "J", mods = "Alt|Shift" }, 100 | # { chars = "\u001bK", key = "K", mods = "Alt|Shift" }, 101 | # { chars = "\u001bL", key = "L", mods = "Alt|Shift" }, 102 | # { chars = "\u001bM", key = "M", mods = "Alt|Shift" }, 103 | # { chars = "\u001bN", key = "N", mods = "Alt|Shift" }, 104 | # { chars = "\u001bO", key = "O", mods = "Alt|Shift" }, 105 | # { chars = "\u001bP", key = "P", mods = "Alt|Shift" }, 106 | # { chars = "\u001bQ", key = "Q", mods = "Alt|Shift" }, 107 | # { chars = "\u001bR", key = "R", mods = "Alt|Shift" }, 108 | # { chars = "\u001bS", key = "S", mods = "Alt|Shift" }, 109 | # { chars = "\u001bT", key = "T", mods = "Alt|Shift" }, 110 | # { chars = "\u001bU", key = "U", mods = "Alt|Shift" }, 111 | # { chars = "\u001bV", key = "V", mods = "Alt|Shift" }, 112 | # { chars = "\u001bW", key = "W", mods = "Alt|Shift" }, 113 | # { chars = "\u001bX", key = "X", mods = "Alt|Shift" }, 114 | # { chars = "\u001bY", key = "Y", mods = "Alt|Shift" }, 115 | # { chars = "\u001bZ", key = "Z", mods = "Alt|Shift" }, 116 | # { chars = "\u001b1", key = "Key1", mods = "Alt" }, 117 | # { chars = "\u001b2", key = "Key2", mods = "Alt" }, 118 | # { chars = "\u001b3", key = "Key3", mods = "Alt" }, 119 | # { chars = "\u001b4", key = "Key4", mods = "Alt" }, 120 | # { chars = "\u001b5", key = "Key5", mods = "Alt" }, 121 | # { chars = "\u001b6", key = "Key6", mods = "Alt" }, 122 | # { chars = "\u001b7", key = "Key7", mods = "Alt" }, 123 | # { chars = "\u001b8", key = "Key8", mods = "Alt" }, 124 | # { chars = "\u001b9", key = "Key9", mods = "Alt" }, 125 | # { chars = "\u001b0", key = "Key0", mods = "Alt" }, 126 | # { chars = "\u0000", key = "Space", mods = "Control" }, 127 | # { chars = "\u001b`", key = "`", mods = "Alt" }, 128 | # { chars = "\u001b~", key = "~", mods = "Alt|Shift" }, 129 | # { chars = "\u001b.", key = "Period", mods = "Alt" }, 130 | # { chars = "\u001b>", key = "Period", mods = "Alt|Shift" }, 131 | # { chars = "\u001b<", key = "Comma", mods = "Alt|Shift" }, 132 | # { chars = "\u001b_", key = "Minus", mods = "Alt|Shift" }, 133 | # { chars = "\u001b#", key = "Key3", mods = "Alt|Shift" }, 134 | # { chars = "\u001b%", key = "Key5", mods = "Alt|Shift" }, 135 | # { chars = "\u001b^", key = "Key6", mods = "Alt|Shift" }, 136 | # { chars = "\u001b*", key = "Key8", mods = "Alt|Shift" }, 137 | # { chars = "\u001b\\", key = "Backslash", mods = "Alt" }, 138 | # { chars = "\u001b|", key = "Backslash", mods = "Alt|Shift" }, 139 | # { chars = "\u001b/", key = "Slash", mods = "Alt" }, 140 | ] 141 | --------------------------------------------------------------------------------