From bd5ca49c3e6917aeb1e6f47ac4e28ceecd50ce30 Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 29 Nov 2024 23:28:18 +0000 Subject: [PATCH 1/9] refractor: Reorganise dotfiles structures --- .config/markdownlint/.markdownlint.json | 6 --- .config/npm/.npmrc | 4 -- .gitignore | 37 +++++++++---------- .vscode/settings.json | 25 +++++++++++++ {setup => bootstrap}/mac_setup.sh | 0 {setup => bootstrap}/set_symblink_unix.sh | 0 {setup => bootstrap}/win_setup.ps1 | 0 {.config/NuGet => common}/NuGet.Config | 0 {.config/conda => common}/condarc.yaml | 0 .config/git/.gitconfig => common/gitconfig | 0 {.config/glow => common}/glow.yaml | 0 .haskeline => common/haskeline | 0 .../ideavimrc.vimrc => common/ideavimrc | 0 {.config/readline => common}/inputrc | 0 {.config => common}/lesskey | 0 {.config/npm => common}/npmrc | 0 .obsidian.vimrc => common/obsidian.vimrc | 0 {.config/pip => common}/pip.conf | 0 {.config => common}/remote.bashrc | 0 {.config/tmux => common}/tmux.conf | 0 .../vim/noxdg.vimrc => common/vim.noxdg.vimrc | 0 {.config/vim => common}/vimrc | 0 .../config.kdl => common/zellij.config.kdl | 0 mac/plum | 1 - mirror/set_mirror.ps1 | 7 ---- mirror/set_mirror.sh | 22 ----------- mirror/tuna_ubuntu.list | 15 -------- mirror/ubuntu.sh | 5 --- {mac => platforms/mac}/.zshrc | 0 .../mac}/Microsoft.PowerShell_profile.ps1 | 0 .../mac}/karabiner/caps_to_esc_lcmd.json | 0 .../mac}/karabiner/fn-tab_to_cmd-tab.json | 0 .../mac}/karabiner/karabiner.json | 0 {mac => platforms/mac}/karabiner/readme.md | 0 {mac => platforms/mac}/neovide.toml | 0 {mac => platforms/mac}/readme.md | 0 {mac => platforms/mac}/set_mirror.sh | 0 .../mac}/shortcuts/finder_open.applescript | 0 {win => platforms/win}/.wslconfig | 0 .../win}/Microsoft.PowerShell_profile.ps1 | 0 {win => platforms/win}/WindowsTerminal.json | 0 {win => platforms/win}/neovide.toml | 0 {win => platforms/win}/readme.md | 0 {wsl => platforms/wsl}/.bashrc | 0 {wsl => platforms/wsl}/.zshrc | 0 {wsl => platforms/wsl}/winterop.zsh | 0 readme.md | 1 + setup/requirements.txt | 19 ---------- {browser => tools/browser}/surfingkeys.js | 0 .../ipython/profile_default/ipython_config.py | 0 .../ipython/profile_default/starup/keymap.py | 0 .../profile_default/starup/magic_ps.py | 0 {.config => tools}/nvim.lazy.d/.neoconf.json | 0 .../nvim.lazy.d/.options/obsidian.all.lua | 0 {.config => tools}/nvim.lazy.d/README.md | 0 {.config => tools}/nvim.lazy.d/init.lua | 0 {.config => tools}/nvim.lazy.d/lazy-lock.json | 0 {.config => tools}/nvim.lazy.d/lazyvim.json | 0 .../nvim.lazy.d/lua/config/autocmds.lua | 0 .../nvim.lazy.d/lua/config/keymaps.lua | 0 .../nvim.lazy.d/lua/config/lazy.lua | 0 .../nvim.lazy.d/lua/config/options.lua | 0 .../nvim.lazy.d/lua/plugins/catppuccin.lua | 0 .../nvim.lazy.d/lua/plugins/colorscheme.lua | 0 .../nvim.lazy.d/lua/plugins/dashboard.lua | 0 .../nvim.lazy.d/lua/plugins/example.lua | 0 .../nvim.lazy.d/lua/plugins/just.lua | 0 .../nvim.lazy.d/lua/plugins/lualine.lua | 0 .../nvim.lazy.d/lua/plugins/neo-tree.lua | 0 .../nvim.lazy.d/lua/plugins/nvim-tree.lua | 0 .../nvim.lazy.d/lua/plugins/obsidian.lua | 0 .../nvim.lazy.d/lua/plugins/wakatime.lua | 0 {.config => tools}/nvim.lazy.d/stylua.toml | 0 {.config => tools}/nvim/.editorconfig | 0 {.config => tools}/nvim/.gitignore | 0 {.config => tools}/nvim/init.lua | 0 .../nvim/lua/config/colorscheme.lua | 0 .../nvim/lua/config/keymaps.lua | 0 .../nvim/lua/config/options.lua | 0 .../nvim/lua/config/plugins.lua | 0 .../nvim/lua/config/servers.lua | 0 {.config => tools}/nvim/lua/keymaps/basic.lua | 0 {.config => tools}/nvim/lua/keymaps/init.lua | 0 .../nvim/lua/keymaps/language.lua | 0 .../nvim/lua/keymaps/leaders.lua | 0 .../nvim/lua/keymaps/nvim-tree.lua | 0 .../nvim/lua/plugins/appearance.lua | 0 .../nvim/lua/plugins/completion.lua | 0 .../nvim/lua/plugins/fileutils.lua | 0 {.config => tools}/nvim/lua/plugins/init.lua | 0 {.config => tools}/nvim/lua/plugins/lsp.lua | 0 {.config => tools}/nvim/lua/plugins/misc.lua | 0 .../nvim/lua/plugins/mod/alpha-nvim.lua | 0 .../nvim/lua/plugins/mod/auto-session.lua | 0 .../nvim/lua/plugins/mod/bufferline.lua | 0 .../nvim/lua/plugins/mod/lspconfig.lua | 0 .../nvim/lua/plugins/mod/lualine.lua | 0 .../nvim/lua/plugins/mod/nvim-cmp.lua | 0 .../nvim/lua/plugins/mod/nvim-tree.lua | 0 .../nvim/lua/plugins/mod/nvim-treesitter.lua | 0 .../nvim/lua/plugins/mod/obsidian-nvim.lua | 0 .../nvim/lua/plugins/mod/projects.lua | 0 .../nvim/lua/plugins/mod/winbar-nvim.lua | 0 .../nvim/lua/plugins/syntax.lua | 0 {.config => tools}/nvim/stylua.toml | 0 {powershell => tools/powershell}/Aliases.ps1 | 0 .../powershell}/Completions.ps1 | 0 {powershell => tools/powershell}/Config.ps1 | 0 {powershell => tools/powershell}/Keymap.ps1 | 0 {powershell => tools/powershell}/Modules.ps1 | 0 .../powershell}/Navigation.ps1 | 0 {powershell => tools/powershell}/Prompt.ps1 | 0 {powershell => tools/powershell}/Scripts.ps1 | 0 {powershell => tools/powershell}/readme.md | 0 {.config => tools}/starship/starship.toml | 0 {.config => tools}/starship/starship_nu.toml | 0 .../starship/starship_pwsh.toml | 0 {.config => tools}/starship/starship_zsh.toml | 0 {vscode => tools/vscode}/hsnips/latex.hsnips | 0 .../vscode}/hsnips/markdown.hsnips | 0 {vscode => tools/vscode}/hsnips/readme.md | 0 {vscode => tools/vscode}/hsnips/typst.hsnips | 0 {vscode => tools/vscode}/vscode.vimrc | 0 {zsh => tools/zsh}/.zshenv | 0 {zsh => tools/zsh}/alias.zsh | 0 {zsh => tools/zsh}/config.zsh | 0 {zsh => tools/zsh}/keymap.zsh | 0 {zsh => tools/zsh}/navi.zsh | 0 {zsh => tools/zsh}/prompt.zsh | 0 {zsh => tools/zsh}/update.sh | 0 vscode/hsnips/c.hsnips | 15 -------- 131 files changed, 43 insertions(+), 114 deletions(-) delete mode 100644 .config/markdownlint/.markdownlint.json delete mode 100644 .config/npm/.npmrc create mode 100644 .vscode/settings.json rename {setup => bootstrap}/mac_setup.sh (100%) rename {setup => bootstrap}/set_symblink_unix.sh (100%) rename {setup => bootstrap}/win_setup.ps1 (100%) rename {.config/NuGet => common}/NuGet.Config (100%) rename {.config/conda => common}/condarc.yaml (100%) rename .config/git/.gitconfig => common/gitconfig (100%) rename {.config/glow => common}/glow.yaml (100%) rename .haskeline => common/haskeline (100%) rename .config/ideavim/ideavimrc.vimrc => common/ideavimrc (100%) rename {.config/readline => common}/inputrc (100%) rename {.config => common}/lesskey (100%) rename {.config/npm => common}/npmrc (100%) rename .obsidian.vimrc => common/obsidian.vimrc (100%) rename {.config/pip => common}/pip.conf (100%) rename {.config => common}/remote.bashrc (100%) rename {.config/tmux => common}/tmux.conf (100%) rename .config/vim/noxdg.vimrc => common/vim.noxdg.vimrc (100%) rename {.config/vim => common}/vimrc (100%) rename .config/zellij/config.kdl => common/zellij.config.kdl (100%) delete mode 160000 mac/plum delete mode 100644 mirror/set_mirror.ps1 delete mode 100644 mirror/set_mirror.sh delete mode 100644 mirror/tuna_ubuntu.list delete mode 100644 mirror/ubuntu.sh rename {mac => platforms/mac}/.zshrc (100%) rename {mac => platforms/mac}/Microsoft.PowerShell_profile.ps1 (100%) rename {mac => platforms/mac}/karabiner/caps_to_esc_lcmd.json (100%) rename {mac => platforms/mac}/karabiner/fn-tab_to_cmd-tab.json (100%) rename {mac => platforms/mac}/karabiner/karabiner.json (100%) rename {mac => platforms/mac}/karabiner/readme.md (100%) rename {mac => platforms/mac}/neovide.toml (100%) rename {mac => platforms/mac}/readme.md (100%) rename {mac => platforms/mac}/set_mirror.sh (100%) rename {mac => platforms/mac}/shortcuts/finder_open.applescript (100%) rename {win => platforms/win}/.wslconfig (100%) rename {win => platforms/win}/Microsoft.PowerShell_profile.ps1 (100%) rename {win => platforms/win}/WindowsTerminal.json (100%) rename {win => platforms/win}/neovide.toml (100%) rename {win => platforms/win}/readme.md (100%) rename {wsl => platforms/wsl}/.bashrc (100%) rename {wsl => platforms/wsl}/.zshrc (100%) rename {wsl => platforms/wsl}/winterop.zsh (100%) delete mode 100644 setup/requirements.txt rename {browser => tools/browser}/surfingkeys.js (100%) rename {.config => tools}/ipython/profile_default/ipython_config.py (100%) rename {.config => tools}/ipython/profile_default/starup/keymap.py (100%) rename {.config => tools}/ipython/profile_default/starup/magic_ps.py (100%) rename {.config => tools}/nvim.lazy.d/.neoconf.json (100%) rename {.config => tools}/nvim.lazy.d/.options/obsidian.all.lua (100%) rename {.config => tools}/nvim.lazy.d/README.md (100%) rename {.config => tools}/nvim.lazy.d/init.lua (100%) rename {.config => tools}/nvim.lazy.d/lazy-lock.json (100%) rename {.config => tools}/nvim.lazy.d/lazyvim.json (100%) rename {.config => tools}/nvim.lazy.d/lua/config/autocmds.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/config/keymaps.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/config/lazy.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/config/options.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/catppuccin.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/colorscheme.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/dashboard.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/example.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/just.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/lualine.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/neo-tree.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/nvim-tree.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/obsidian.lua (100%) rename {.config => tools}/nvim.lazy.d/lua/plugins/wakatime.lua (100%) rename {.config => tools}/nvim.lazy.d/stylua.toml (100%) rename {.config => tools}/nvim/.editorconfig (100%) rename {.config => tools}/nvim/.gitignore (100%) rename {.config => tools}/nvim/init.lua (100%) rename {.config => tools}/nvim/lua/config/colorscheme.lua (100%) rename {.config => tools}/nvim/lua/config/keymaps.lua (100%) rename {.config => tools}/nvim/lua/config/options.lua (100%) rename {.config => tools}/nvim/lua/config/plugins.lua (100%) rename {.config => tools}/nvim/lua/config/servers.lua (100%) rename {.config => tools}/nvim/lua/keymaps/basic.lua (100%) rename {.config => tools}/nvim/lua/keymaps/init.lua (100%) rename {.config => tools}/nvim/lua/keymaps/language.lua (100%) rename {.config => tools}/nvim/lua/keymaps/leaders.lua (100%) rename {.config => tools}/nvim/lua/keymaps/nvim-tree.lua (100%) rename {.config => tools}/nvim/lua/plugins/appearance.lua (100%) rename {.config => tools}/nvim/lua/plugins/completion.lua (100%) rename {.config => tools}/nvim/lua/plugins/fileutils.lua (100%) rename {.config => tools}/nvim/lua/plugins/init.lua (100%) rename {.config => tools}/nvim/lua/plugins/lsp.lua (100%) rename {.config => tools}/nvim/lua/plugins/misc.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/alpha-nvim.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/auto-session.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/bufferline.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/lspconfig.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/lualine.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/nvim-cmp.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/nvim-tree.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/nvim-treesitter.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/obsidian-nvim.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/projects.lua (100%) rename {.config => tools}/nvim/lua/plugins/mod/winbar-nvim.lua (100%) rename {.config => tools}/nvim/lua/plugins/syntax.lua (100%) rename {.config => tools}/nvim/stylua.toml (100%) rename {powershell => tools/powershell}/Aliases.ps1 (100%) rename {powershell => tools/powershell}/Completions.ps1 (100%) rename {powershell => tools/powershell}/Config.ps1 (100%) rename {powershell => tools/powershell}/Keymap.ps1 (100%) rename {powershell => tools/powershell}/Modules.ps1 (100%) rename {powershell => tools/powershell}/Navigation.ps1 (100%) rename {powershell => tools/powershell}/Prompt.ps1 (100%) rename {powershell => tools/powershell}/Scripts.ps1 (100%) rename {powershell => tools/powershell}/readme.md (100%) rename {.config => tools}/starship/starship.toml (100%) rename {.config => tools}/starship/starship_nu.toml (100%) rename {.config => tools}/starship/starship_pwsh.toml (100%) rename {.config => tools}/starship/starship_zsh.toml (100%) rename {vscode => tools/vscode}/hsnips/latex.hsnips (100%) rename {vscode => tools/vscode}/hsnips/markdown.hsnips (100%) rename {vscode => tools/vscode}/hsnips/readme.md (100%) rename {vscode => tools/vscode}/hsnips/typst.hsnips (100%) rename {vscode => tools/vscode}/vscode.vimrc (100%) rename {zsh => tools/zsh}/.zshenv (100%) rename {zsh => tools/zsh}/alias.zsh (100%) rename {zsh => tools/zsh}/config.zsh (100%) rename {zsh => tools/zsh}/keymap.zsh (100%) rename {zsh => tools/zsh}/navi.zsh (100%) rename {zsh => tools/zsh}/prompt.zsh (100%) rename {zsh => tools/zsh}/update.sh (100%) delete mode 100644 vscode/hsnips/c.hsnips diff --git a/.config/markdownlint/.markdownlint.json b/.config/markdownlint/.markdownlint.json deleted file mode 100644 index 1f69f42..0000000 --- a/.config/markdownlint/.markdownlint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "line-length": false, - "no-inline-html": false, - "no-alt-text": false, - "ul-style": { "style": "dash" } -} \ No newline at end of file diff --git a/.config/npm/.npmrc b/.config/npm/.npmrc deleted file mode 100644 index ad82c4c..0000000 --- a/.config/npm/.npmrc +++ /dev/null @@ -1,4 +0,0 @@ -# ~/.npmrc -# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc -# ln -s $DOTFILES/.npmrc ~/.npmrc -# registry=https://registry.npmmirror.com diff --git a/.gitignore b/.gitignore index 0b80c5f..93c06d7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,24 +16,24 @@ test.* xdg-ninja/ # IPython config cache -.config/ipython/profile_default/db -.config/ipython/profile_default/log -.config/ipython/profile_default/pid -.config/ipython/profile_default/security -.config/ipython/profile_default/history.sqlite +tools/ipython/profile_default/db +tools/ipython/profile_default/log +tools/ipython/profile_default/pid +tools/ipython/profile_default/security +tools/ipython/profile_default/history.sqlite # nvim config cache -.config/nvim/tt.* -.config/nvim/.tests -.config/nvim/doc/tags -.config/nvim/debug -.config/nvim/.repro -.config/nvim/foo.* -.config/nvim/*.log -.config/nvim/data -.config/nvim/lazy-lock.json -.config/nvim/lazyvim.json -.config/nvim/lua/plugins/obsidian.lua +tools/nvim/tt.* +tools/nvim/.tests +tools/nvim/doc/tags +tools/nvim/debug +tools/nvim/.repro +tools/nvim/foo.* +tools/nvim/*.log +tools/nvim/data +tools/nvim/lazy-lock.json +tools/nvim/lazyvim.json +tools/nvim/lua/plugins/obsidian.lua # Undone # Windows PowerToys @@ -41,10 +41,7 @@ PowerToys/ # Just Script Justfile # Nushell -.config/nushell/ -# VSCode Neovim -vscode/ -.vscode/ +tools/nushell/ # OS generated files .DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1177b9b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,25 @@ +{ + "material-icon-theme.files.associations": { + "ideavimrc": "vim", + "vimrc": "vim", + "haskeline": "haskell", + "inputrc": "console", + "npmrc": "npm", + "lesskey": "less", + "config.kdl": "json", + "pip.conf": "python-misc", + "*.kdl": "json", + "gitconfig": "git", + "nvim/init.lua": "vim", + "markdownlint.json": "markdownlint", + ".wslconfig": "settings", + "*.hsnips": "" + }, + "material-icon-theme.folders.associations": { + "bootstrap": "admin" + }, + "files.associations": { + "ideavimrc": "Vimscript", + ".wslconfig": "properties", + }, +} diff --git a/setup/mac_setup.sh b/bootstrap/mac_setup.sh similarity index 100% rename from setup/mac_setup.sh rename to bootstrap/mac_setup.sh diff --git a/setup/set_symblink_unix.sh b/bootstrap/set_symblink_unix.sh similarity index 100% rename from setup/set_symblink_unix.sh rename to bootstrap/set_symblink_unix.sh diff --git a/setup/win_setup.ps1 b/bootstrap/win_setup.ps1 similarity index 100% rename from setup/win_setup.ps1 rename to bootstrap/win_setup.ps1 diff --git a/.config/NuGet/NuGet.Config b/common/NuGet.Config similarity index 100% rename from .config/NuGet/NuGet.Config rename to common/NuGet.Config diff --git a/.config/conda/condarc.yaml b/common/condarc.yaml similarity index 100% rename from .config/conda/condarc.yaml rename to common/condarc.yaml diff --git a/.config/git/.gitconfig b/common/gitconfig similarity index 100% rename from .config/git/.gitconfig rename to common/gitconfig diff --git a/.config/glow/glow.yaml b/common/glow.yaml similarity index 100% rename from .config/glow/glow.yaml rename to common/glow.yaml diff --git a/.haskeline b/common/haskeline similarity index 100% rename from .haskeline rename to common/haskeline diff --git a/.config/ideavim/ideavimrc.vimrc b/common/ideavimrc similarity index 100% rename from .config/ideavim/ideavimrc.vimrc rename to common/ideavimrc diff --git a/.config/readline/inputrc b/common/inputrc similarity index 100% rename from .config/readline/inputrc rename to common/inputrc diff --git a/.config/lesskey b/common/lesskey similarity index 100% rename from .config/lesskey rename to common/lesskey diff --git a/.config/npm/npmrc b/common/npmrc similarity index 100% rename from .config/npm/npmrc rename to common/npmrc diff --git a/.obsidian.vimrc b/common/obsidian.vimrc similarity index 100% rename from .obsidian.vimrc rename to common/obsidian.vimrc diff --git a/.config/pip/pip.conf b/common/pip.conf similarity index 100% rename from .config/pip/pip.conf rename to common/pip.conf diff --git a/.config/remote.bashrc b/common/remote.bashrc similarity index 100% rename from .config/remote.bashrc rename to common/remote.bashrc diff --git a/.config/tmux/tmux.conf b/common/tmux.conf similarity index 100% rename from .config/tmux/tmux.conf rename to common/tmux.conf diff --git a/.config/vim/noxdg.vimrc b/common/vim.noxdg.vimrc similarity index 100% rename from .config/vim/noxdg.vimrc rename to common/vim.noxdg.vimrc diff --git a/.config/vim/vimrc b/common/vimrc similarity index 100% rename from .config/vim/vimrc rename to common/vimrc diff --git a/.config/zellij/config.kdl b/common/zellij.config.kdl similarity index 100% rename from .config/zellij/config.kdl rename to common/zellij.config.kdl diff --git a/mac/plum b/mac/plum deleted file mode 160000 index 4c28f11..0000000 --- a/mac/plum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4c28f11f451facef809b380502874a48ba964ddb diff --git a/mirror/set_mirror.ps1 b/mirror/set_mirror.ps1 deleted file mode 100644 index 48a3fdf..0000000 --- a/mirror/set_mirror.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -# pip -Set-Alias pip pip3 -Set-Alias python python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com \ No newline at end of file diff --git a/mirror/set_mirror.sh b/mirror/set_mirror.sh deleted file mode 100644 index 1c04b24..0000000 --- a/mirror/set_mirror.sh +++ /dev/null @@ -1,22 +0,0 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Linuxbrew -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 镜像。 -# 请按需执行如下命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git - -# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git -brew update diff --git a/mirror/tuna_ubuntu.list b/mirror/tuna_ubuntu.list deleted file mode 100644 index ca0d87a..0000000 --- a/mirror/tuna_ubuntu.list +++ /dev/null @@ -1,15 +0,0 @@ -# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse - -# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换 -deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse -# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse - -# 预发布软件源,不建议启用 -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse -# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse \ No newline at end of file diff --git a/mirror/ubuntu.sh b/mirror/ubuntu.sh deleted file mode 100644 index 8657fb3..0000000 --- a/mirror/ubuntu.sh +++ /dev/null @@ -1,5 +0,0 @@ -echo "Making Backup of /etc/apt/sources.list..." -sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak - -echo "Adding Ubuntu Repositories..." -sudo cp ./tuna_ubuntu.list /etc/apt/sources.list \ No newline at end of file diff --git a/mac/.zshrc b/platforms/mac/.zshrc similarity index 100% rename from mac/.zshrc rename to platforms/mac/.zshrc diff --git a/mac/Microsoft.PowerShell_profile.ps1 b/platforms/mac/Microsoft.PowerShell_profile.ps1 similarity index 100% rename from mac/Microsoft.PowerShell_profile.ps1 rename to platforms/mac/Microsoft.PowerShell_profile.ps1 diff --git a/mac/karabiner/caps_to_esc_lcmd.json b/platforms/mac/karabiner/caps_to_esc_lcmd.json similarity index 100% rename from mac/karabiner/caps_to_esc_lcmd.json rename to platforms/mac/karabiner/caps_to_esc_lcmd.json diff --git a/mac/karabiner/fn-tab_to_cmd-tab.json b/platforms/mac/karabiner/fn-tab_to_cmd-tab.json similarity index 100% rename from mac/karabiner/fn-tab_to_cmd-tab.json rename to platforms/mac/karabiner/fn-tab_to_cmd-tab.json diff --git a/mac/karabiner/karabiner.json b/platforms/mac/karabiner/karabiner.json similarity index 100% rename from mac/karabiner/karabiner.json rename to platforms/mac/karabiner/karabiner.json diff --git a/mac/karabiner/readme.md b/platforms/mac/karabiner/readme.md similarity index 100% rename from mac/karabiner/readme.md rename to platforms/mac/karabiner/readme.md diff --git a/mac/neovide.toml b/platforms/mac/neovide.toml similarity index 100% rename from mac/neovide.toml rename to platforms/mac/neovide.toml diff --git a/mac/readme.md b/platforms/mac/readme.md similarity index 100% rename from mac/readme.md rename to platforms/mac/readme.md diff --git a/mac/set_mirror.sh b/platforms/mac/set_mirror.sh similarity index 100% rename from mac/set_mirror.sh rename to platforms/mac/set_mirror.sh diff --git a/mac/shortcuts/finder_open.applescript b/platforms/mac/shortcuts/finder_open.applescript similarity index 100% rename from mac/shortcuts/finder_open.applescript rename to platforms/mac/shortcuts/finder_open.applescript diff --git a/win/.wslconfig b/platforms/win/.wslconfig similarity index 100% rename from win/.wslconfig rename to platforms/win/.wslconfig diff --git a/win/Microsoft.PowerShell_profile.ps1 b/platforms/win/Microsoft.PowerShell_profile.ps1 similarity index 100% rename from win/Microsoft.PowerShell_profile.ps1 rename to platforms/win/Microsoft.PowerShell_profile.ps1 diff --git a/win/WindowsTerminal.json b/platforms/win/WindowsTerminal.json similarity index 100% rename from win/WindowsTerminal.json rename to platforms/win/WindowsTerminal.json diff --git a/win/neovide.toml b/platforms/win/neovide.toml similarity index 100% rename from win/neovide.toml rename to platforms/win/neovide.toml diff --git a/win/readme.md b/platforms/win/readme.md similarity index 100% rename from win/readme.md rename to platforms/win/readme.md diff --git a/wsl/.bashrc b/platforms/wsl/.bashrc similarity index 100% rename from wsl/.bashrc rename to platforms/wsl/.bashrc diff --git a/wsl/.zshrc b/platforms/wsl/.zshrc similarity index 100% rename from wsl/.zshrc rename to platforms/wsl/.zshrc diff --git a/wsl/winterop.zsh b/platforms/wsl/winterop.zsh similarity index 100% rename from wsl/winterop.zsh rename to platforms/wsl/winterop.zsh diff --git a/readme.md b/readme.md index 2475aca..139c5fb 100644 --- a/readme.md +++ b/readme.md @@ -2,3 +2,4 @@ Moving to *Colemak* +This branch is WIP. diff --git a/setup/requirements.txt b/setup/requirements.txt deleted file mode 100644 index 2a0f048..0000000 --- a/setup/requirements.txt +++ /dev/null @@ -1,19 +0,0 @@ -# This file lists all the must-have libraries for installing a new computer -# For scripting use -# pip install -r requirements.txt -colorama -# Basic Mathemetics -numpy -matplotlib -# Data Analysis -pandas -# Image Processing -pillow -# Web Scraping -requests -beautifulsoup4 -# Testing -pytest -mypy -# Healthy Neovim -pynvim diff --git a/browser/surfingkeys.js b/tools/browser/surfingkeys.js similarity index 100% rename from browser/surfingkeys.js rename to tools/browser/surfingkeys.js diff --git a/.config/ipython/profile_default/ipython_config.py b/tools/ipython/profile_default/ipython_config.py similarity index 100% rename from .config/ipython/profile_default/ipython_config.py rename to tools/ipython/profile_default/ipython_config.py diff --git a/.config/ipython/profile_default/starup/keymap.py b/tools/ipython/profile_default/starup/keymap.py similarity index 100% rename from .config/ipython/profile_default/starup/keymap.py rename to tools/ipython/profile_default/starup/keymap.py diff --git a/.config/ipython/profile_default/starup/magic_ps.py b/tools/ipython/profile_default/starup/magic_ps.py similarity index 100% rename from .config/ipython/profile_default/starup/magic_ps.py rename to tools/ipython/profile_default/starup/magic_ps.py diff --git a/.config/nvim.lazy.d/.neoconf.json b/tools/nvim.lazy.d/.neoconf.json similarity index 100% rename from .config/nvim.lazy.d/.neoconf.json rename to tools/nvim.lazy.d/.neoconf.json diff --git a/.config/nvim.lazy.d/.options/obsidian.all.lua b/tools/nvim.lazy.d/.options/obsidian.all.lua similarity index 100% rename from .config/nvim.lazy.d/.options/obsidian.all.lua rename to tools/nvim.lazy.d/.options/obsidian.all.lua diff --git a/.config/nvim.lazy.d/README.md b/tools/nvim.lazy.d/README.md similarity index 100% rename from .config/nvim.lazy.d/README.md rename to tools/nvim.lazy.d/README.md diff --git a/.config/nvim.lazy.d/init.lua b/tools/nvim.lazy.d/init.lua similarity index 100% rename from .config/nvim.lazy.d/init.lua rename to tools/nvim.lazy.d/init.lua diff --git a/.config/nvim.lazy.d/lazy-lock.json b/tools/nvim.lazy.d/lazy-lock.json similarity index 100% rename from .config/nvim.lazy.d/lazy-lock.json rename to tools/nvim.lazy.d/lazy-lock.json diff --git a/.config/nvim.lazy.d/lazyvim.json b/tools/nvim.lazy.d/lazyvim.json similarity index 100% rename from .config/nvim.lazy.d/lazyvim.json rename to tools/nvim.lazy.d/lazyvim.json diff --git a/.config/nvim.lazy.d/lua/config/autocmds.lua b/tools/nvim.lazy.d/lua/config/autocmds.lua similarity index 100% rename from .config/nvim.lazy.d/lua/config/autocmds.lua rename to tools/nvim.lazy.d/lua/config/autocmds.lua diff --git a/.config/nvim.lazy.d/lua/config/keymaps.lua b/tools/nvim.lazy.d/lua/config/keymaps.lua similarity index 100% rename from .config/nvim.lazy.d/lua/config/keymaps.lua rename to tools/nvim.lazy.d/lua/config/keymaps.lua diff --git a/.config/nvim.lazy.d/lua/config/lazy.lua b/tools/nvim.lazy.d/lua/config/lazy.lua similarity index 100% rename from .config/nvim.lazy.d/lua/config/lazy.lua rename to tools/nvim.lazy.d/lua/config/lazy.lua diff --git a/.config/nvim.lazy.d/lua/config/options.lua b/tools/nvim.lazy.d/lua/config/options.lua similarity index 100% rename from .config/nvim.lazy.d/lua/config/options.lua rename to tools/nvim.lazy.d/lua/config/options.lua diff --git a/.config/nvim.lazy.d/lua/plugins/catppuccin.lua b/tools/nvim.lazy.d/lua/plugins/catppuccin.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/catppuccin.lua rename to tools/nvim.lazy.d/lua/plugins/catppuccin.lua diff --git a/.config/nvim.lazy.d/lua/plugins/colorscheme.lua b/tools/nvim.lazy.d/lua/plugins/colorscheme.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/colorscheme.lua rename to tools/nvim.lazy.d/lua/plugins/colorscheme.lua diff --git a/.config/nvim.lazy.d/lua/plugins/dashboard.lua b/tools/nvim.lazy.d/lua/plugins/dashboard.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/dashboard.lua rename to tools/nvim.lazy.d/lua/plugins/dashboard.lua diff --git a/.config/nvim.lazy.d/lua/plugins/example.lua b/tools/nvim.lazy.d/lua/plugins/example.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/example.lua rename to tools/nvim.lazy.d/lua/plugins/example.lua diff --git a/.config/nvim.lazy.d/lua/plugins/just.lua b/tools/nvim.lazy.d/lua/plugins/just.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/just.lua rename to tools/nvim.lazy.d/lua/plugins/just.lua diff --git a/.config/nvim.lazy.d/lua/plugins/lualine.lua b/tools/nvim.lazy.d/lua/plugins/lualine.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/lualine.lua rename to tools/nvim.lazy.d/lua/plugins/lualine.lua diff --git a/.config/nvim.lazy.d/lua/plugins/neo-tree.lua b/tools/nvim.lazy.d/lua/plugins/neo-tree.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/neo-tree.lua rename to tools/nvim.lazy.d/lua/plugins/neo-tree.lua diff --git a/.config/nvim.lazy.d/lua/plugins/nvim-tree.lua b/tools/nvim.lazy.d/lua/plugins/nvim-tree.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/nvim-tree.lua rename to tools/nvim.lazy.d/lua/plugins/nvim-tree.lua diff --git a/.config/nvim.lazy.d/lua/plugins/obsidian.lua b/tools/nvim.lazy.d/lua/plugins/obsidian.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/obsidian.lua rename to tools/nvim.lazy.d/lua/plugins/obsidian.lua diff --git a/.config/nvim.lazy.d/lua/plugins/wakatime.lua b/tools/nvim.lazy.d/lua/plugins/wakatime.lua similarity index 100% rename from .config/nvim.lazy.d/lua/plugins/wakatime.lua rename to tools/nvim.lazy.d/lua/plugins/wakatime.lua diff --git a/.config/nvim.lazy.d/stylua.toml b/tools/nvim.lazy.d/stylua.toml similarity index 100% rename from .config/nvim.lazy.d/stylua.toml rename to tools/nvim.lazy.d/stylua.toml diff --git a/.config/nvim/.editorconfig b/tools/nvim/.editorconfig similarity index 100% rename from .config/nvim/.editorconfig rename to tools/nvim/.editorconfig diff --git a/.config/nvim/.gitignore b/tools/nvim/.gitignore similarity index 100% rename from .config/nvim/.gitignore rename to tools/nvim/.gitignore diff --git a/.config/nvim/init.lua b/tools/nvim/init.lua similarity index 100% rename from .config/nvim/init.lua rename to tools/nvim/init.lua diff --git a/.config/nvim/lua/config/colorscheme.lua b/tools/nvim/lua/config/colorscheme.lua similarity index 100% rename from .config/nvim/lua/config/colorscheme.lua rename to tools/nvim/lua/config/colorscheme.lua diff --git a/.config/nvim/lua/config/keymaps.lua b/tools/nvim/lua/config/keymaps.lua similarity index 100% rename from .config/nvim/lua/config/keymaps.lua rename to tools/nvim/lua/config/keymaps.lua diff --git a/.config/nvim/lua/config/options.lua b/tools/nvim/lua/config/options.lua similarity index 100% rename from .config/nvim/lua/config/options.lua rename to tools/nvim/lua/config/options.lua diff --git a/.config/nvim/lua/config/plugins.lua b/tools/nvim/lua/config/plugins.lua similarity index 100% rename from .config/nvim/lua/config/plugins.lua rename to tools/nvim/lua/config/plugins.lua diff --git a/.config/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua similarity index 100% rename from .config/nvim/lua/config/servers.lua rename to tools/nvim/lua/config/servers.lua diff --git a/.config/nvim/lua/keymaps/basic.lua b/tools/nvim/lua/keymaps/basic.lua similarity index 100% rename from .config/nvim/lua/keymaps/basic.lua rename to tools/nvim/lua/keymaps/basic.lua diff --git a/.config/nvim/lua/keymaps/init.lua b/tools/nvim/lua/keymaps/init.lua similarity index 100% rename from .config/nvim/lua/keymaps/init.lua rename to tools/nvim/lua/keymaps/init.lua diff --git a/.config/nvim/lua/keymaps/language.lua b/tools/nvim/lua/keymaps/language.lua similarity index 100% rename from .config/nvim/lua/keymaps/language.lua rename to tools/nvim/lua/keymaps/language.lua diff --git a/.config/nvim/lua/keymaps/leaders.lua b/tools/nvim/lua/keymaps/leaders.lua similarity index 100% rename from .config/nvim/lua/keymaps/leaders.lua rename to tools/nvim/lua/keymaps/leaders.lua diff --git a/.config/nvim/lua/keymaps/nvim-tree.lua b/tools/nvim/lua/keymaps/nvim-tree.lua similarity index 100% rename from .config/nvim/lua/keymaps/nvim-tree.lua rename to tools/nvim/lua/keymaps/nvim-tree.lua diff --git a/.config/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua similarity index 100% rename from .config/nvim/lua/plugins/appearance.lua rename to tools/nvim/lua/plugins/appearance.lua diff --git a/.config/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua similarity index 100% rename from .config/nvim/lua/plugins/completion.lua rename to tools/nvim/lua/plugins/completion.lua diff --git a/.config/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua similarity index 100% rename from .config/nvim/lua/plugins/fileutils.lua rename to tools/nvim/lua/plugins/fileutils.lua diff --git a/.config/nvim/lua/plugins/init.lua b/tools/nvim/lua/plugins/init.lua similarity index 100% rename from .config/nvim/lua/plugins/init.lua rename to tools/nvim/lua/plugins/init.lua diff --git a/.config/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua similarity index 100% rename from .config/nvim/lua/plugins/lsp.lua rename to tools/nvim/lua/plugins/lsp.lua diff --git a/.config/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua similarity index 100% rename from .config/nvim/lua/plugins/misc.lua rename to tools/nvim/lua/plugins/misc.lua diff --git a/.config/nvim/lua/plugins/mod/alpha-nvim.lua b/tools/nvim/lua/plugins/mod/alpha-nvim.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/alpha-nvim.lua rename to tools/nvim/lua/plugins/mod/alpha-nvim.lua diff --git a/.config/nvim/lua/plugins/mod/auto-session.lua b/tools/nvim/lua/plugins/mod/auto-session.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/auto-session.lua rename to tools/nvim/lua/plugins/mod/auto-session.lua diff --git a/.config/nvim/lua/plugins/mod/bufferline.lua b/tools/nvim/lua/plugins/mod/bufferline.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/bufferline.lua rename to tools/nvim/lua/plugins/mod/bufferline.lua diff --git a/.config/nvim/lua/plugins/mod/lspconfig.lua b/tools/nvim/lua/plugins/mod/lspconfig.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/lspconfig.lua rename to tools/nvim/lua/plugins/mod/lspconfig.lua diff --git a/.config/nvim/lua/plugins/mod/lualine.lua b/tools/nvim/lua/plugins/mod/lualine.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/lualine.lua rename to tools/nvim/lua/plugins/mod/lualine.lua diff --git a/.config/nvim/lua/plugins/mod/nvim-cmp.lua b/tools/nvim/lua/plugins/mod/nvim-cmp.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/nvim-cmp.lua rename to tools/nvim/lua/plugins/mod/nvim-cmp.lua diff --git a/.config/nvim/lua/plugins/mod/nvim-tree.lua b/tools/nvim/lua/plugins/mod/nvim-tree.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/nvim-tree.lua rename to tools/nvim/lua/plugins/mod/nvim-tree.lua diff --git a/.config/nvim/lua/plugins/mod/nvim-treesitter.lua b/tools/nvim/lua/plugins/mod/nvim-treesitter.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/nvim-treesitter.lua rename to tools/nvim/lua/plugins/mod/nvim-treesitter.lua diff --git a/.config/nvim/lua/plugins/mod/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/obsidian-nvim.lua rename to tools/nvim/lua/plugins/mod/obsidian-nvim.lua diff --git a/.config/nvim/lua/plugins/mod/projects.lua b/tools/nvim/lua/plugins/mod/projects.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/projects.lua rename to tools/nvim/lua/plugins/mod/projects.lua diff --git a/.config/nvim/lua/plugins/mod/winbar-nvim.lua b/tools/nvim/lua/plugins/mod/winbar-nvim.lua similarity index 100% rename from .config/nvim/lua/plugins/mod/winbar-nvim.lua rename to tools/nvim/lua/plugins/mod/winbar-nvim.lua diff --git a/.config/nvim/lua/plugins/syntax.lua b/tools/nvim/lua/plugins/syntax.lua similarity index 100% rename from .config/nvim/lua/plugins/syntax.lua rename to tools/nvim/lua/plugins/syntax.lua diff --git a/.config/nvim/stylua.toml b/tools/nvim/stylua.toml similarity index 100% rename from .config/nvim/stylua.toml rename to tools/nvim/stylua.toml diff --git a/powershell/Aliases.ps1 b/tools/powershell/Aliases.ps1 similarity index 100% rename from powershell/Aliases.ps1 rename to tools/powershell/Aliases.ps1 diff --git a/powershell/Completions.ps1 b/tools/powershell/Completions.ps1 similarity index 100% rename from powershell/Completions.ps1 rename to tools/powershell/Completions.ps1 diff --git a/powershell/Config.ps1 b/tools/powershell/Config.ps1 similarity index 100% rename from powershell/Config.ps1 rename to tools/powershell/Config.ps1 diff --git a/powershell/Keymap.ps1 b/tools/powershell/Keymap.ps1 similarity index 100% rename from powershell/Keymap.ps1 rename to tools/powershell/Keymap.ps1 diff --git a/powershell/Modules.ps1 b/tools/powershell/Modules.ps1 similarity index 100% rename from powershell/Modules.ps1 rename to tools/powershell/Modules.ps1 diff --git a/powershell/Navigation.ps1 b/tools/powershell/Navigation.ps1 similarity index 100% rename from powershell/Navigation.ps1 rename to tools/powershell/Navigation.ps1 diff --git a/powershell/Prompt.ps1 b/tools/powershell/Prompt.ps1 similarity index 100% rename from powershell/Prompt.ps1 rename to tools/powershell/Prompt.ps1 diff --git a/powershell/Scripts.ps1 b/tools/powershell/Scripts.ps1 similarity index 100% rename from powershell/Scripts.ps1 rename to tools/powershell/Scripts.ps1 diff --git a/powershell/readme.md b/tools/powershell/readme.md similarity index 100% rename from powershell/readme.md rename to tools/powershell/readme.md diff --git a/.config/starship/starship.toml b/tools/starship/starship.toml similarity index 100% rename from .config/starship/starship.toml rename to tools/starship/starship.toml diff --git a/.config/starship/starship_nu.toml b/tools/starship/starship_nu.toml similarity index 100% rename from .config/starship/starship_nu.toml rename to tools/starship/starship_nu.toml diff --git a/.config/starship/starship_pwsh.toml b/tools/starship/starship_pwsh.toml similarity index 100% rename from .config/starship/starship_pwsh.toml rename to tools/starship/starship_pwsh.toml diff --git a/.config/starship/starship_zsh.toml b/tools/starship/starship_zsh.toml similarity index 100% rename from .config/starship/starship_zsh.toml rename to tools/starship/starship_zsh.toml diff --git a/vscode/hsnips/latex.hsnips b/tools/vscode/hsnips/latex.hsnips similarity index 100% rename from vscode/hsnips/latex.hsnips rename to tools/vscode/hsnips/latex.hsnips diff --git a/vscode/hsnips/markdown.hsnips b/tools/vscode/hsnips/markdown.hsnips similarity index 100% rename from vscode/hsnips/markdown.hsnips rename to tools/vscode/hsnips/markdown.hsnips diff --git a/vscode/hsnips/readme.md b/tools/vscode/hsnips/readme.md similarity index 100% rename from vscode/hsnips/readme.md rename to tools/vscode/hsnips/readme.md diff --git a/vscode/hsnips/typst.hsnips b/tools/vscode/hsnips/typst.hsnips similarity index 100% rename from vscode/hsnips/typst.hsnips rename to tools/vscode/hsnips/typst.hsnips diff --git a/vscode/vscode.vimrc b/tools/vscode/vscode.vimrc similarity index 100% rename from vscode/vscode.vimrc rename to tools/vscode/vscode.vimrc diff --git a/zsh/.zshenv b/tools/zsh/.zshenv similarity index 100% rename from zsh/.zshenv rename to tools/zsh/.zshenv diff --git a/zsh/alias.zsh b/tools/zsh/alias.zsh similarity index 100% rename from zsh/alias.zsh rename to tools/zsh/alias.zsh diff --git a/zsh/config.zsh b/tools/zsh/config.zsh similarity index 100% rename from zsh/config.zsh rename to tools/zsh/config.zsh diff --git a/zsh/keymap.zsh b/tools/zsh/keymap.zsh similarity index 100% rename from zsh/keymap.zsh rename to tools/zsh/keymap.zsh diff --git a/zsh/navi.zsh b/tools/zsh/navi.zsh similarity index 100% rename from zsh/navi.zsh rename to tools/zsh/navi.zsh diff --git a/zsh/prompt.zsh b/tools/zsh/prompt.zsh similarity index 100% rename from zsh/prompt.zsh rename to tools/zsh/prompt.zsh diff --git a/zsh/update.sh b/tools/zsh/update.sh similarity index 100% rename from zsh/update.sh rename to tools/zsh/update.sh diff --git a/vscode/hsnips/c.hsnips b/vscode/hsnips/c.hsnips deleted file mode 100644 index 68b2008..0000000 --- a/vscode/hsnips/c.hsnips +++ /dev/null @@ -1,15 +0,0 @@ -snippet hio "include stdio.h" iA -#include -endsnippet - -snippet hlib "include stdlib.h" iA -#include -endsnippet - -snippet hmath "include math.h" iA -#include -endsnippet - -snippet hstr "include string.h" iA -#include -endsnippet \ No newline at end of file From 2b21b63a132190c4569380de32b2149d16ea2eb1 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sat, 30 Nov 2024 01:29:47 +0000 Subject: [PATCH 2/9] feat(zsh): Finished reorganise zsh with a same entry point for all platforms --- platforms/linux/.gitkeep | 0 platforms/mac/set_mirror.sh | 33 -------- platforms/mac/{.zshrc => zshrc} | 38 +++------ platforms/wsl/.zshrc | 83 -------------------- platforms/wsl/winterop.zsh | 18 +++++ platforms/wsl/zshrc | 31 ++++++++ scripts/update.zsh | 40 ++++++++++ tools/zsh/.zshenv | 20 ----- tools/zsh/alias.zsh | 50 ------------ tools/zsh/common.zshrc | 33 ++++++++ tools/zsh/config.zsh | 98 ------------------------ tools/zsh/global.zshenv | 20 +++++ tools/zsh/keymap.zsh | 23 ------ tools/zsh/mod/alias.zsh | 89 ++++++++++++++++++++++ tools/zsh/mod/config.zsh | 41 ++++++++++ tools/zsh/mod/keymap.zsh | 46 +++++++++++ tools/zsh/mod/navi.zsh | 39 ++++++++++ tools/zsh/mod/prompt.zsh | 6 ++ tools/zsh/navi.zsh | 11 --- tools/zsh/prompt.zsh | 3 - tools/zsh/update.sh | 19 ----- tools/zsh/zshenv | 131 ++++++++++++++++++++++++++++++++ 22 files changed, 503 insertions(+), 369 deletions(-) create mode 100644 platforms/linux/.gitkeep delete mode 100644 platforms/mac/set_mirror.sh rename platforms/mac/{.zshrc => zshrc} (51%) delete mode 100644 platforms/wsl/.zshrc create mode 100644 platforms/wsl/zshrc create mode 100644 scripts/update.zsh delete mode 100644 tools/zsh/.zshenv delete mode 100644 tools/zsh/alias.zsh create mode 100644 tools/zsh/common.zshrc delete mode 100644 tools/zsh/config.zsh create mode 100644 tools/zsh/global.zshenv delete mode 100644 tools/zsh/keymap.zsh create mode 100644 tools/zsh/mod/alias.zsh create mode 100644 tools/zsh/mod/config.zsh create mode 100644 tools/zsh/mod/keymap.zsh create mode 100644 tools/zsh/mod/navi.zsh create mode 100644 tools/zsh/mod/prompt.zsh delete mode 100644 tools/zsh/navi.zsh delete mode 100644 tools/zsh/prompt.zsh delete mode 100644 tools/zsh/update.sh create mode 100644 tools/zsh/zshenv diff --git a/platforms/linux/.gitkeep b/platforms/linux/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/platforms/mac/set_mirror.sh b/platforms/mac/set_mirror.sh deleted file mode 100644 index 1c7b27b..0000000 --- a/platforms/mac/set_mirror.sh +++ /dev/null @@ -1,33 +0,0 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Homebrew -# 手动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。 -# 请按需执行如下两行命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git -brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git - -# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git -brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git -brew update - -# 或使用下面的几行命令自动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" -for tap in core cask{,-fonts,-versions} command-not-found services; do - brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" -done -brew update diff --git a/platforms/mac/.zshrc b/platforms/mac/zshrc similarity index 51% rename from platforms/mac/.zshrc rename to platforms/mac/zshrc index 35da61f..ee504ee 100644 --- a/platforms/mac/.zshrc +++ b/platforms/mac/zshrc @@ -1,22 +1,15 @@ -# $XDG_CONFIG_HOME/zsh/.zshrc -# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc -### Variables ### +# $DOTFILES/platforms/mac/zshrc +# Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用,macOS 特定配置 +# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) -export DOTFILES="$HOME/.dotfiles" +# Homebrew Path export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH -for file in $DOTFILES/zsh/*.zsh; do - source $file -done -export ARCHFLAGS="-arch arm64" -### Navigation ### -# Absolute navigation -alias doku="cd ~/doku && ls" -alias docs="cd ~/Documents" -alias dt="cd ~/Desktop" -alias down="cd ~/Downloads" -alias one="cd ~/OneDrive" -alias gdrive="cd ~/Google\ Drive" +# macOS # + +alias xclip="pbcopy" +alias clip="pbcopy" +alias paste="pbpaste" # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! @@ -33,16 +26,3 @@ fi unset __conda_setup # <<< conda initialize <<< -# >>> juliaup initialize >>> - -# !! Contents within this block are managed by juliaup !! - -path=('$HOME/.juliaup/bin' $path) -export PATH - -# <<< juliaup initialize <<< - -# macOS # - -alias xclip="pbcopy" -alias clip="pbcopy" diff --git a/platforms/wsl/.zshrc b/platforms/wsl/.zshrc deleted file mode 100644 index a34d974..0000000 --- a/platforms/wsl/.zshrc +++ /dev/null @@ -1,83 +0,0 @@ -# $XDG_CONFIG_HOME/zsh/.zshrc -# ln -s $DOTFILES/wsl/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc -### Variables ### - -export IS_WSL=true -export DOTFILES="$HOME/.dotfiles" -for file in $DOTFILES/zsh/*.zsh; do - source $file -done -source $DOTFILES/wsl/winterop.zsh -source $ZDOTDIR/.zprivate.zsh -export ARCHFLAGS="-arch x86_64" - -# Absolute navigation -alias src="cd ~/Source && ls" -alias dotfiles="cd $DOTFILES && ls" - - -### WSL Options ### - -# WSL open -open() { - local target=$1 - - if command -v explorer.exe > /dev/null; then - explorer.exe "$target" - else - command open "$target" - fi -} - -# WSL Neovide -gvi() { - local target=$1 - - if command -v neovide.exe > /dev/null; then - neovide.exe "$target" - else - if command -v neovide > /dev/null; then - neovide "$target" - else - echo "neovide is not installed" - fi - fi -} - -### Misc ### - -export PATH=/opt/bin:$PATH - -# Conda # - -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('/home/js0ny/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/home/js0ny/miniconda3/etc/profile.d/conda.sh" ]; then - . "/home/js0ny/miniconda3/etc/profile.d/conda.sh" - else - export PATH="/home/js0ny/miniconda3/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< - - -if [ -f /usr/share/doc/pkgfile/command-not-found.sh ]; then - source /usr/share/doc/pkgfile/command-not-found.sh -fi - - -# vcpkg - -export VCPKG_ROOT=~/vcpkg - -# Package Manager - -alias pac="sudo pacman" -alias paci="sudo pacman -S" -alias pacr="sudo pacman -R" -alias pacu="sudo pacman -Syu" diff --git a/platforms/wsl/winterop.zsh b/platforms/wsl/winterop.zsh index 50e780a..8e30dbc 100644 --- a/platforms/wsl/winterop.zsh +++ b/platforms/wsl/winterop.zsh @@ -1,3 +1,10 @@ +# $DOTFILES/platforms/wsl/winterop.zsh +# Sourced by $DOTFILES/platforms/wsl/zshrc 在 $DOTFILES/platforms/wsl/zshrc 中被引用 + +# Defines the interop commands between WSL and Windows + +export FILE_EXPLORER="dopus.exe" # Directory Opus + alias clip="clip.exe" alias xclip="clip.exe" alias paste='pwsh.exe -NoProfile -Command "Get-Clipboard"' @@ -13,3 +20,14 @@ alias diskpart="diskpart.exe" alias winget="winget.exe" alias pastew='pwsh.exe -NoProfile -Command "Get-Clipboard"' alias ollama="ollama.exe" + +# WSL open +open() { + local target=$1 + + if command -v "$FILE_EXPLORER" > /dev/null; then + "$FILE_EXPLORER" "$target" + else + command open "$target" + fi +} diff --git a/platforms/wsl/zshrc b/platforms/wsl/zshrc new file mode 100644 index 0000000..3e6cb96 --- /dev/null +++ b/platforms/wsl/zshrc @@ -0,0 +1,31 @@ +# $DOTFILES/platforms//zshrc +# Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用,WSL 特定配置 +# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) +# TODO: Test on WSL + +### Variables ### +export IS_WSL=true +export ARCHFLAGS="-arch x86_64" +source $DOTFILES/wsl/winterop.zsh + + +### Misc ### + +export PATH=/opt/bin:$PATH + +# Conda # + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/conda.sh" + else + export PATH="$HOME/miniconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< diff --git a/scripts/update.zsh b/scripts/update.zsh new file mode 100644 index 0000000..ce4e5fd --- /dev/null +++ b/scripts/update.zsh @@ -0,0 +1,40 @@ +# $DOTFILES/scripts/update.zsh +# call by `update` alias defined in tools/zsh/alias.zsh +# 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh + +# Plugins # +# Auto `git pull` on $ZDOTDIR/plugins +for plugin in $ZDOTDIR/plugins/*; do + if [ -d "$plugin" ]; then + cd $plugin + git pull --quiet --no-edit + fi +done + +# Update package managers # +# Homebrew, macOS +if command -v brew > /dev/null; then + brew update + brew upgrade +fi + +# Arch +if command -v pacman > /dev/null; then + sudo pacman -Syu +fi + +# Debian +if command -v apt > /dev/null; then + sudo apt update + sudo apt upgrade +fi + +# Fedora +if command -v dnf > /dev/null; then + sudo dnf update +fi + +# WSL +if command -v winget.exe > /dev/null; then + winget.exe upgrade +fi diff --git a/tools/zsh/.zshenv b/tools/zsh/.zshenv deleted file mode 100644 index 9c83239..0000000 --- a/tools/zsh/.zshenv +++ /dev/null @@ -1,20 +0,0 @@ -# ~/.zshenv -# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv -# This file is sourced by all zsh sessions upon startup. - -# Use XDG Base Directory Specification -export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" -export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" -export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" -export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" -export XDG_RUNTIME_DIR="/run/user/$(id -u)" -# Disable shell sessions on macOS when using default terminal -SHELL_SESSIONS_DISABLE=1 - -# Zsh -export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" - -# Also put in /etc/zsh/zshenv -# or /etc/zshenv in macOS -# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv -# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv diff --git a/tools/zsh/alias.zsh b/tools/zsh/alias.zsh deleted file mode 100644 index 9949f23..0000000 --- a/tools/zsh/alias.zsh +++ /dev/null @@ -1,50 +0,0 @@ -# PowerShell Equivalent # -alias ni=touch -alias cls=clear -alias ii=open - -# Dev # -alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20 -alias gcc='gcc -std=c99' # Set the default C standard to C99 -alias cl='clang -std=c99' -alias clpp='clang++ -std=c++2b' -alias python=python3 # Set the default Python version to Python 3 -alias py=python # Alias for Python -alias pip=pip3 # Alias for pip -# alias bashcfg="nvim ~/.bashrc" -alias zshcfg="nvim $ZDOTDIR/.zshrc" -alias shcfg=zshcfg -alias reload="source $ZDOTDIR/.zshrc" -alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/" -alias ohmyzsh="code ~/.oh-my-zsh" -alias pulldots="cd $DOTFILES && git pull" - -# Conda # -alias pyact="conda activate" -alias pydact="conda deactivate" -alias pylsenv="conda env list" -alias pymkenv="conda create --name" - -# Editors # -alias v=nvim -alias c=code - -# lsd # -alias ls='lsd -a' -alias l='lsd -lah' -# Misc # -alias cf=cfiles - -# Functions # -mkcd() { - mkdir -p $1 && cd $1 -} -cdls(){ - cd $1 && ls -} -tc(){ - touch $1 && code $1 -} -tv(){ - touch $1 && nvim $1 -} diff --git a/tools/zsh/common.zshrc b/tools/zsh/common.zshrc new file mode 100644 index 0000000..3a46294 --- /dev/null +++ b/tools/zsh/common.zshrc @@ -0,0 +1,33 @@ +# $DOTFILES/zsh/common.zshrc +# This is the entry point for all zsh configuration files +# 这是所有zsh配置文件的入口点 + +# Location: $ZDOTDIR/.zshrc (default: $HOME/.zshrc) +# Linking: +# ln -sf $DOTFILES/tools/zsh/common.zshrc $ZDOTDIR/.zshrc + +export DOTFILES=$HOME/.dotfiles + +case "$(uname)" in + Linux) + if grep -q Microsoft /proc/version || [[ -n "$WSL_DISTRO_NAME" ]]; then + # WSL-specific configuration + source "$DOTFILES/platforms/wsl/zshrc" + else + # Native Linux configuration + source "$DOTFILES/platforms/linux/zshrc" + fi + ;; + Darwin) + # macOS-specific configuration + source "$DOTFILES/platforms/mac/zshrc" + ;; +# CYGWIN*|MINGW*|MSYS*) +# source "$DOTFILES/platform/wsl.zsh" +# ;; +esac + +for file in $DOTFILES/tools/zsh/mod/*.zsh; do + source $file +done + diff --git a/tools/zsh/config.zsh b/tools/zsh/config.zsh deleted file mode 100644 index 4ac50b3..0000000 --- a/tools/zsh/config.zsh +++ /dev/null @@ -1,98 +0,0 @@ -# ZSH Config # -export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH -export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables -HIST_STAMPS="yyyy-mm-dd" -HISTSIZE=10000 -SAVEHIST=10000 - -export NVM_DIR="$HOME/.config/nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm - -# plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions) - -# Plugins (Manually Managed) # -# $ZDOTDIR/plugins - -# echo "[DEBUG] Loading plugins..." -# echo $ZDOTDIR -# Load zsh-syntax-highlighting before zsh-history-substring-search -# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage -source $ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh -source $ZDOTDIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -source $ZDOTDIR/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh - -# Tools Related Environment Variables # - -PAGER="less" -EDITOR="nvim" -VISUAL="nvim" - -# Use XDG Base Directory Specification # - -# ~/.azure/ -> $XDG_DATA_HOME/azure/ -export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure -# ~/.cargo/ -> $XDG_DATA_HOME/cargo -export CARGO_HOME="$XDG_DATA_HOME"/cargo -# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/ -export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb -# ~/.docker -> $XDG_CONFIG_HOME/docker -export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker -# ~/.dotnet -> $XDG_DATA_HOME/dotnet -# Not working -# export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet -# ~/.gnupg -> $XDG_CONFIG_HOME/gnupg -export GNUPGHOME="$XDG_DATA_HOME"/gnupg -# ~/go -> $XDG_DATA_HOME/go -export GOPATH="$XDG_DATA_HOME"/go -# ~/.inputrc -> $XDG_CONFIG_HOME/readline/inputrc -export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc -# ~/.juliaup/ -> $XDG_DATA_HOME/julia/ -export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" -# Check if node is installed -if command -v node > /dev/null; then - # ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history - export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history - # ~/.ts_node_repl_history -> $XDG_STATE_HOME/node/ts_node_repl_history - export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history - # ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc - export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc - # ~/.npm -> $XDG_CACHE_HOME/npm - export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js - export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm - export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm -fi -# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA) -# macOS does not have Cuda; Check if CUDA is installed -if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then - export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv -fi -# ~/,parallel -> $XDG_CONFIG_HOME/parallel -export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel -# ~/.python_history -> $XDG_DATA_HOME/python/history -# Works only with Python 3.13.0a3 and later -export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history -# ~/.screenrc -> $XDG_CONFIG_HOME/screen/screenrc -export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc -# ~/.screen/ -> $XDG_RUNTIME_DIR/screen -export SCREENDIR="${XDG_RUNTIME_DIR}/screen" -# ~/.spacemacs/ -> $XDG_CONFIG_HOME/spacemacs -export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs -# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr -export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr -# ~/.w3m -> $XDG_DATA_HOME/w3m -export W3M_DIR="$XDG_DATA_HOME"/w3m -# ~/.wakatime.cfg -> $XDG_CONFIG_HOME/wakatime.cfg -# ~/.wakatime/ -> $XDG_CONFIG_HOME/wakatime/ -export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" -# ~/.wget-hsts -> $XDG_DATA_HOME/wget-hsts -alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' -# ~/.z -> $XDG_DATA_HOME/z -export _Z_DATA="$XDG_DATA_HOME/z" -# ~/.zcompdump* -> $XDG_CACHE_HOME/zsh/zcompdump* -# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" -# ~/.zsh_history -> $XDG_STATE_HOME/zsh/history -export HISTFILE="$XDG_STATE_HOME"/zsh/history - -# https://unix.stackexchange.com/questions/33994/ -# Use `set -k` to mark leading `#` as a comment character -set -k diff --git a/tools/zsh/global.zshenv b/tools/zsh/global.zshenv new file mode 100644 index 0000000..32f2829 --- /dev/null +++ b/tools/zsh/global.zshenv @@ -0,0 +1,20 @@ +# $DOTFILES/tools/zsh/global.zshenv +# system-wide zshenv file 系统级别的 zshenv 文件,用于设置全局环境变量 + +# Location: +# /etc/zshenv: (macOS and some distro) +# /etc/zsh/zshenv: (some distro) +# Linking: +# sudo cp $DOTFILES/tools/zsh/global.zshenv /etc/zshenv # or /etc/zsh/zshenv + +# Set ZDOTDIR to $HOME/.config/zsh if it exists +# This allows us to keep our zsh configuration in $HOME/.config/zsh +# and zshenv will be located at $HOME/.config/zsh/.zshenv instead of +# $HOME/.zshenv +# 如果存在 $HOME/.config/zsh 目录,则将 ZDOTDIR 设置为 $HOME/.config/zsh +# 防止 .zshenv 文件自动生成在用户目录下 + +# Ensure SPACE between [ and -d and ] +if [ -d $HOME/.config/zsh ]; then + export ZDOTDIR=$HOME/.config/zsh +fi diff --git a/tools/zsh/keymap.zsh b/tools/zsh/keymap.zsh deleted file mode 100644 index 9b2e537..0000000 --- a/tools/zsh/keymap.zsh +++ /dev/null @@ -1,23 +0,0 @@ -# $DOTFILES/keymap.zsh -bindkey -v # Vi Keybindings - -# Colemak hnei -# bindkey -M vicmd 'h' vi-backward-char # No change -bindkey -M vicmd 'n' down-line-or-history -bindkey -M vicmd 'e' up-line-or-history -bindkey -M vicmd 'i' vi-forward-char - -# Similar position to [i] in QWERTY -bindkey -M vicmd 'l' vi-insert -bindkey -M vicmd 'L' vi-insert-bol -# Ne{[k]s}t -bindkey -M vicmd 'k' vi-repeat-search -bindkey -M vicmd 'K' vi-rev-repeat-search -# [J]ump -bindkey -M vicmd 'j' vi-forward-word-end -bindkey -M vicmd 'J' vi-forward-blank-word-end -# Use N to Join -bindkey -M vicmd 'N' vi-join - -# Search History with [r]everse (default emacs keybinding) -bindkey '^R' history-incremental-search-backward diff --git a/tools/zsh/mod/alias.zsh b/tools/zsh/mod/alias.zsh new file mode 100644 index 0000000..1e55316 --- /dev/null +++ b/tools/zsh/mod/alias.zsh @@ -0,0 +1,89 @@ +# $DOTFILES/tools/zsh/mod/alias.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + +# PowerShell Equivalent, for cross-platform compatibility +alias ni=touch +alias cls=clear +alias ii=open + +# Dev # +alias gpp='g++ -std=c++2b' # Set the default C++ standard to C++20 +alias gcc='gcc -std=c99' # Set the default C standard to C99 +alias cl='clang -std=c99' +alias clpp='clang++ -std=c++2b' +alias python=python3 # Set the default Python version to Python 3 +alias py=python # Alias for Python +alias pip=pip3 # Alias for pip +# alias bashcfg="nvim ~/.bashrc" +alias zshcfg="nvim $ZDOTDIR/.zshrc" +alias shcfg=zshcfg +alias reload="source $ZDOTDIR/.zshrc" +alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/" +alias pulldots="cd $DOTFILES && git pull" + +# Editors # +alias v=nvim +alias c=code +alias sv="sudo vim" +alias sn="sudo nvim" + +# lsd - modern ls +if command -v lsd > /dev/null; then + alias ls='lsd -A' + alias l='lsd -lah' + alias ll='lsd -l' + alias tree='lsd --tree' +fi + +# Functions # +mkcd() { + mkdir -p $1 && cd $1 +} +cdls(){ + cd $1 && ls +} +tc(){ + touch $1 && code $1 +} +tv(){ + touch $1 && nvim $1 +} + +# Use neovide as gVim +gvi() { + local target=$1 + + if command -v neovide.exe > /dev/null; then + neovide.exe "$target" + else + if command -v neovide > /dev/null; then + neovide "$target" + else + echo "neovide is not installed" + fi + fi +} + + +alias update="source $DOTFILES/scripts/update.zsh" + +if command -v pacman > /dev/null; then + alias pac="sudo pacman" + alias paci="sudo pacman -S" + alias pacr="sudo pacman -R" + alias pacu="sudo pacman -Syu" +fi + +if command -v apt > /dev/null; then + alias apt="sudo apt" + alias apti="sudo apt install" + alias aptu="sudo apt update && sudo apt upgrade" + alias aptr="sudo apt autoremove && sudo apt remove" +fi + +if command -v brew > /dev/null; then + alias brewi="brew install" + alias brewu="brew update && brew upgrade" + alias brewc="brew cleanup" + alias brewr="brew uninstall" +fi diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh new file mode 100644 index 0000000..eab28a6 --- /dev/null +++ b/tools/zsh/mod/config.zsh @@ -0,0 +1,41 @@ +# $DOTFILES/tools/zsh/mod/config.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + +# ZSH Config, no need to `export` these variables +HISTFILE="$XDG_STATE_HOME"/zsh/history +HIST_STAMPS="yyyy-mm-dd" +HISTSIZE=10000 +SAVEHIST=10000 + + +# Manually manage plugins 手动管理插件 +# Load zsh-syntax-highlighting before zsh-history-substring-search +# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage +plugins=( + "zsh-autosuggestions" + "zsh-syntax-highlighting" + "zsh-history-substring-search" +) + +plugin_dir="$ZDOTDIR/plugins" + +for plugin in "${plugins[@]}"; do + plugin_path="$plugin_dir/$plugin/$plugin.zsh" + if [[ -f $plugin_path ]]; then + source "$plugin_path" + else + echo "Warning: Plugin not found: $plugin_path" + fi +done + + +# https://unix.stackexchange.com/questions/33994/ +# Use `set -k` to mark leading `#` as a comment character +set -k + +# TODO: Below should be reorganized +export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH +export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables + +export NVM_DIR="$HOME/.config/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/tools/zsh/mod/keymap.zsh b/tools/zsh/mod/keymap.zsh new file mode 100644 index 0000000..2242057 --- /dev/null +++ b/tools/zsh/mod/keymap.zsh @@ -0,0 +1,46 @@ +# $DOTFILES/tools/zsh/mod/keymap.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + + +bindkey -v # Vi Keybindings + +# Colemak hnei +# ^ +# n +# < h i > +# e +# v +# bindkey -M vicmd 'h' vi-backward-char # No change +bindkey -M vicmd 'n' down-line-or-history +bindkey -M vicmd 'e' up-line-or-history +bindkey -M vicmd 'i' vi-forward-char + +# Similar position to [i] in QWERTY +bindkey -M vicmd 'l' vi-insert +bindkey -M vicmd 'L' vi-insert-bol +# Ne{[k]s}t +bindkey -M vicmd 'k' vi-repeat-search +bindkey -M vicmd 'K' vi-rev-repeat-search +# [J]ump +bindkey -M vicmd 'j' vi-forward-word-end +bindkey -M vicmd 'J' vi-forward-blank-word-end +# Use N to Join +bindkey -M vicmd 'N' vi-join + +# Emacs Hybrid +bindkey '^A' beginning-of-line +bindkey '^E' end-of-line +bindkey '^F' forward-char +bindkey '^B' backward-char +bindkey '^P' up-line-or-history +bindkey '^N' down-line-or-history +bindkey '^R' history-incremental-search-backward +# TODO: did not test +bindkey '^K' kill-line +bindkey '^X^E' edit-command-line + +# LEADER CONVENTION +# ^X defines as a prefix key in shell +# ^A defines as a prefix key in tmux +# ^B defines as a prefix key in Terminal Emulators +# SPC defines as a prefix key in nvim diff --git a/tools/zsh/mod/navi.zsh b/tools/zsh/mod/navi.zsh new file mode 100644 index 0000000..3793178 --- /dev/null +++ b/tools/zsh/mod/navi.zsh @@ -0,0 +1,39 @@ +# $DOTFILES/tools/zsh/mod/navi.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + +# Relative navigation # +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ......="cd ../../../../.." + +# Use `-` to jump to the previous directory +# Oh-My-Zsh defines a similar one +function - { cd - } + +# Use `z` to jump to a directory +eval "$(zoxide init zsh)" + +# Absolute navigation # +alias dotfiles="cd $DOTFILES && ls" +# TODO: Test on WSL +if [ "$IS_WSL" = true ]; then # IS_WSL is defined in $DOTFILES/platforms/wsl/zshrc + alias dt="cd /mnt/c/Users/$(whoami)/Desktop && ls" + alias doku="cd /mnt/c/Users/$(whoami)/Documents && ls" + alias down="cd /mnt/c/Users/$(whoami)/Downloads && ls" + alias src="cd /mnt/d/Source" + alias one="cd /mnt/c/Users/$(whoami)/OneDrive" + alias gdrive="cd /mnt/g" +else + alias dt="cd $HOME/Desktop && ls" + alias doku="cd $HOME/Documents && ls" + alias down="cd $HOME/Downloads && ls" + alias src="cd $HOME/Documents/Source" +fi + +# macOS specific, no OneDrive & Google Drive on Linux +if [ "$(uname)" = "Darwin" ]; then + alias one="cd $HOME/OneDrive" + alias gdrive="cd $HOME/Google\ Drive" +fi diff --git a/tools/zsh/mod/prompt.zsh b/tools/zsh/mod/prompt.zsh new file mode 100644 index 0000000..be24212 --- /dev/null +++ b/tools/zsh/mod/prompt.zsh @@ -0,0 +1,6 @@ +# $DOTFILES/tools/zsh/mod/prompt.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + +export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml + +eval "$(starship init zsh)" diff --git a/tools/zsh/navi.zsh b/tools/zsh/navi.zsh deleted file mode 100644 index e74d95c..0000000 --- a/tools/zsh/navi.zsh +++ /dev/null @@ -1,11 +0,0 @@ - -# Relative navigation -alias ..="cd .." -alias ...="cd ../.." -alias ....="cd ../../.." -alias .....="cd ../../../.." -alias ......="cd ../../../../.." - -function - { cd - } - -eval "$(zoxide init zsh)" diff --git a/tools/zsh/prompt.zsh b/tools/zsh/prompt.zsh deleted file mode 100644 index 09bdb23..0000000 --- a/tools/zsh/prompt.zsh +++ /dev/null @@ -1,3 +0,0 @@ -export STARSHIP_CONFIG=$DOTFILES/.config/starship/starship_zsh.toml - -eval "$(starship init zsh)" \ No newline at end of file diff --git a/tools/zsh/update.sh b/tools/zsh/update.sh deleted file mode 100644 index 95d24da..0000000 --- a/tools/zsh/update.sh +++ /dev/null @@ -1,19 +0,0 @@ -# $DOTFILES/zsh/update.sh - -# This file won't be sourced by zsh by default -# Use `source` to run this file for updating plugins - -# Plugins # -# Auto `git pull` on $ZDOTDIR/plugins -for plugin in $ZDOTDIR/plugins/*; do - if [ -d "$plugin" ]; then - cd $plugin - git pull --quiet --no-edit - fi -done - -if [ which brew > /dev/null ]; then - brew update - brew upgrade -fi - diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv new file mode 100644 index 0000000..585adf5 --- /dev/null +++ b/tools/zsh/zshenv @@ -0,0 +1,131 @@ +# $DOTFILES/tools/zsh/zshenv +# User-specific environment variables for zsh 用户级别的 zsh 环境变量 + +# Location: +# $ZDOTDIR/.zshenv (specified by ZDOTDIR) +# ~/.zshenv (default location) +# Linking: +# ln -sf $DOTFILES/tools/zsh/.zshenv $ZDOTDIR/.zshenv +# This file is sourced by all zsh sessions upon startup. + +# For me (this user), define XDG Base Directory Specification variables +# and some configs that does not obey XDG Base Directory Specification +# but can be configured(by setting the variables) to (just like) obey it. +# 在此定义 XDG 基础目录规范变量和一些不遵循 XDG 基础目录规范的配置, +# 使得他们可以通过设置变量来遵循 XDG 基础目录规范。 + +# XDG Base Directory Specification +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" +export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +export XDG_RUNTIME_DIR="/run/user/$(id -u)" +# Disable shell sessions on macOS when using default terminal +SHELL_SESSIONS_DISABLE=1 + +# Zsh # Redefine to make sure it's in $XDG_CONFIG_HOME +export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" + +# Tools Related Environment Variables +export PAGER="less -R" +export EDITOR="nvim" +export VISUAL="nvim" + +# macOS Specific +# This syntax is POSIX standard, for portability +if [ "$(uname)" = "Darwin" ]; then + +fi + +# Linux Specific +if [ "$(uname)" = "Linux" ]; then + # CUDA + export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv +fi + +# Azure CLI +if command -v az > /dev/null; then + export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure +fi +# Cargo +if command -v cargo > /dev/null; then + export CARGO_HOME="$XDG_DATA_HOME"/cargo +fi +# CGDB +if command -v cgdb > /dev/null; then + export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb +fi +# .NET +if command -v dotnet > /dev/null; then + export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet +fi +# Docker +if command -v docker > /dev/null; then + export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker +fi +# GnuPG +if command -v gpg > /dev/null; then + export GNUPGHOME="$XDG_DATA_HOME"/gnupg +fi +# Go +if command -v go > /dev/null; then + export GOPATH="$XDG_DATA_HOME"/go +fi +# Julia +if command -v julia > /dev/null; then + export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" +fi +# Node.js +if command -v node > /dev/null; then + export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history + export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history + export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc + export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js + export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm + export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm +fi +# Parallel +if command -v parallel > /dev/null; then + export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel +fi +# Python +# Works only with Python 3.13.0a3 and later +if command -v python3 > /dev/null; then + export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history +fi +# GNU Screen +if command -v screen > /dev/null; then + export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc + export SCREENDIR="${XDG_RUNTIME_DIR}/screen" +fi +# Spacemacs +if command -v emacs > /dev/null; then + export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs +fi +# tldr +# Works only with C client (did not verify) +if command -v tldr > /dev/null; then + export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr +fi +# W3M +if command -v w3m > /dev/null; then + export W3M_DIR="$XDG_DATA_HOME"/w3m +fi +# Wakatime +if command -v wakatime > /dev/null; then + export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" +fi +# Wget +if command -v wget > /dev/null; then + alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' +fi +# z +if command -v z > /dev/null; then + export _Z_DATA="$XDG_DATA_HOME/z" +fi +# zsh .zcompdump +# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" +# Vcpkg TODO: Move vcpkg path +if command -v vcpkg > /dev/null; then + export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg +fi From fdf460a547377dab137307f2cb1a4f4f9b08e169 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sat, 30 Nov 2024 02:03:17 +0000 Subject: [PATCH 3/9] feat(zsh, ipython): New symblink scripts, IPython linked with directory --- tools/nvim.lazy.d/.neoconf.json | 15 -- tools/nvim.lazy.d/.options/obsidian.all.lua | 22 -- tools/nvim.lazy.d/README.md | 8 - tools/nvim.lazy.d/init.lua | 8 - tools/nvim.lazy.d/lazy-lock.json | 8 - tools/nvim.lazy.d/lazyvim.json | 10 - tools/nvim.lazy.d/lua/config/autocmds.lua | 3 - tools/nvim.lazy.d/lua/config/keymaps.lua | 146 ------------- tools/nvim.lazy.d/lua/config/lazy.lua | 53 ----- tools/nvim.lazy.d/lua/config/options.lua | 3 - tools/nvim.lazy.d/lua/plugins/catppuccin.lua | 54 ----- tools/nvim.lazy.d/lua/plugins/colorscheme.lua | 13 -- tools/nvim.lazy.d/lua/plugins/dashboard.lua | 65 ------ tools/nvim.lazy.d/lua/plugins/example.lua | 197 ------------------ tools/nvim.lazy.d/lua/plugins/just.lua | 4 - tools/nvim.lazy.d/lua/plugins/lualine.lua | 126 ----------- tools/nvim.lazy.d/lua/plugins/neo-tree.lua | 138 ------------ tools/nvim.lazy.d/lua/plugins/nvim-tree.lua | 11 - tools/nvim.lazy.d/lua/plugins/obsidian.lua | 22 -- tools/nvim.lazy.d/lua/plugins/wakatime.lua | 3 - tools/nvim.lazy.d/stylua.toml | 3 - 21 files changed, 912 deletions(-) delete mode 100644 tools/nvim.lazy.d/.neoconf.json delete mode 100644 tools/nvim.lazy.d/.options/obsidian.all.lua delete mode 100644 tools/nvim.lazy.d/README.md delete mode 100644 tools/nvim.lazy.d/init.lua delete mode 100644 tools/nvim.lazy.d/lazy-lock.json delete mode 100644 tools/nvim.lazy.d/lazyvim.json delete mode 100644 tools/nvim.lazy.d/lua/config/autocmds.lua delete mode 100644 tools/nvim.lazy.d/lua/config/keymaps.lua delete mode 100644 tools/nvim.lazy.d/lua/config/lazy.lua delete mode 100644 tools/nvim.lazy.d/lua/config/options.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/catppuccin.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/colorscheme.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/dashboard.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/example.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/just.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/lualine.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/neo-tree.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/nvim-tree.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/obsidian.lua delete mode 100644 tools/nvim.lazy.d/lua/plugins/wakatime.lua delete mode 100644 tools/nvim.lazy.d/stylua.toml diff --git a/tools/nvim.lazy.d/.neoconf.json b/tools/nvim.lazy.d/.neoconf.json deleted file mode 100644 index 6e89f00..0000000 --- a/tools/nvim.lazy.d/.neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/tools/nvim.lazy.d/.options/obsidian.all.lua b/tools/nvim.lazy.d/.options/obsidian.all.lua deleted file mode 100644 index c8af391..0000000 --- a/tools/nvim.lazy.d/.options/obsidian.all.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit - lazy = true, - ft = "markdown", - dependencies = { - -- Required. - "nvim-lua/plenary.nvim", - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - { - name = "Obsidian", - path = "~/Obsidian", - }, - }, - - -- see below for full list of options 👇 - }, -} diff --git a/tools/nvim.lazy.d/README.md b/tools/nvim.lazy.d/README.md deleted file mode 100644 index e4c3da5..0000000 --- a/tools/nvim.lazy.d/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Colemak *LazyVim* - -- Replace the default `hjkl` movement keys with `hnei` -- `j->e`, `k->n`, `h->h`, `l->i` - -```sh -ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim -``` \ No newline at end of file diff --git a/tools/nvim.lazy.d/init.lua b/tools/nvim.lazy.d/init.lua deleted file mode 100644 index eded2d3..0000000 --- a/tools/nvim.lazy.d/init.lua +++ /dev/null @@ -1,8 +0,0 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -if (vim.g.vscode) then - print("VSCode detected, skipping lazy loading") - require("vscode.code") -else - require("config.lazy") - -- require("config.lazy") -end diff --git a/tools/nvim.lazy.d/lazy-lock.json b/tools/nvim.lazy.d/lazy-lock.json deleted file mode 100644 index 43c566e..0000000 --- a/tools/nvim.lazy.d/lazy-lock.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, - "nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" }, - "nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" }, - "nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" } -} diff --git a/tools/nvim.lazy.d/lazyvim.json b/tools/nvim.lazy.d/lazyvim.json deleted file mode 100644 index bac2955..0000000 --- a/tools/nvim.lazy.d/lazyvim.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extras": [ - "lazyvim.plugins.extras.ai.copilot", - "lazyvim.plugins.extras.ai.copilot-chat" - ], - "news": { - "NEWS.md": "7429" - }, - "version": 7 -} \ No newline at end of file diff --git a/tools/nvim.lazy.d/lua/config/autocmds.lua b/tools/nvim.lazy.d/lua/config/autocmds.lua deleted file mode 100644 index d9ea6db..0000000 --- a/tools/nvim.lazy.d/lua/config/autocmds.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- Add any additional autocmds here diff --git a/tools/nvim.lazy.d/lua/config/keymaps.lua b/tools/nvim.lazy.d/lua/config/keymaps.lua deleted file mode 100644 index 0105618..0000000 --- a/tools/nvim.lazy.d/lua/config/keymaps.lua +++ /dev/null @@ -1,146 +0,0 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here - -vim.g.mapleader = " " - --- ================= GENERAL KEYBINDS ================= --- SAVE/QUIT {{{ -vim.keymap.set("n", "Q", "q", { desc = "Q to quit" }) -vim.keymap.set("n", "", "w", { desc = "S to write file" }) ---}}} - --- NVIM CONFIG SHORTCUTS {{{ --- stylua: ignore -vim.keymap.set("n", "rc", "e $HOME/.config/nvim/lua/config/options.lua", { desc = "Open nvim options.lua" }) -vim.keymap.set("n", "rp", "e $HOME/.config/nvim/lua/plugins/.", { desc = "lazy plugins dir" }) ---}}} - --- UNDO -vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" }) - --- INSERT -vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" }) -vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" }) - --- YANK TO SYSTEM CLIPBOARD -vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" }) - --- SEARCH {{{ -vim.keymap.set("n", "", "nohlsearch", { desc = "clear search highlight" }) ---}}} - --- SPACE TO TAB{{{ -vim.keymap.set("n", "tt", "%s/ /\t/g", { desc = "space to tab" }) -vim.keymap.set("v", "tt", "s/ /\t/g", { desc = "space to tab" }) ---}}} - --- MISC {{{ -vim.keymap.set("n", "o", "za", { desc = "folding" }) -vim.keymap.set("i", "", "A {}iko", { desc = "insert a pair of {} and goto next line" }) ---}}} - --- ================= CURSOR MOVEMENT ===================== {{{ --- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS) --- ^ --- e --- < h i > --- n --- v --- -vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" }) - -vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" }) -vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" }) - -vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" }) -vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" }) - -vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" }) -vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" }) - -vim.keymap.set("n", "\v", "v$h", { desc = "???" }) - --- FASTER IN-LINE NAVIGATION - --- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD' -vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" }) --- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR - -vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇧" }) -vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇩" }) - --- INSERT MODE CURSOR MOVEMENT -vim.keymap.set("i", "", "A") - --- COMMAND MODE CURSOR MOVEMENT -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") ---}}} - --- ================= SPLIT MANAGMENT ===================== {{{ -vim.keymap.set("n", "E", "set nosplitbelowsplitset splitbelow", { desc = "Split ⇧" }) -vim.keymap.set("n", "N", "set splitbelowsplit", { desc = "Split ⇩" }) -vim.keymap.set("n", "H", "set nosplitrightvsplitset splitright", { desc = "Split ⇦" }) -vim.keymap.set("n", "I", "set splitrightvsplit", { desc = "Split ⇨" }) - -vim.keymap.set({ "n", "t" }, "e", "k", { desc = "Move cursor to split ⇧" }) -vim.keymap.set({ "n", "t" }, "n", "j", { desc = "Move cursor to split ⇩" }) -vim.keymap.set({ "n", "t" }, "h", "h", { desc = "Move cursor to split ⇦" }) -vim.keymap.set({ "n", "t" }, "i", "l", { desc = "Move cursor to split ⇨" }) - -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇧" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇩" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇦" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇨" }) - -vim.keymap.set("n", "", "res -5", { desc = "Resize split 0,-5" }) -vim.keymap.set("n", "", "res +5", { desc = "Resize split 0,+5" }) -vim.keymap.set("n", "", "vertical resize +5", { desc = "Resize split +5,0" }) -vim.keymap.set("n", "", "vertical resize -5", { desc = "Resize split -5,0" }) - -vim.keymap.set("n", "H", "tK", { desc = "Make splits [H]orizontal" }) -vim.keymap.set("n", "V", "tH", { desc = "Make splits [V]ertical" }) - -vim.keymap.set("n", "ri", "bK", { desc = "Rotate splits 90" }) -vim.keymap.set("n", "rh", "bH", { desc = "Rotate splits -90" }) - -vim.keymap.set("n", "q", "jq", { desc = "Close Split ⇩ (Below)" }) ---}}} - --- TAB MANAGEMENT {{{ -vim.keymap.set("n", "", "tabe", { desc = "New [Tab]" }) - -vim.keymap.set("n", "h", "-tabnext", { desc = "Select Tab ⇦" }) -vim.keymap.set("n", "i", "+tabnext", { desc = "Select Tab ⇨" }) - -vim.keymap.set("n", "H", "-tabmove", { desc = "Tab move ⇦" }) -vim.keymap.set("n", "I", "+tabmove", { desc = "Tab move ⇨" }) - --- NOTE: Doesn't seem to work: --- vim.keymap.set("n", "c", "tab split", { desc = "New Tab from [C]urrent" }) --- vim.keymap.set('n', 'dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'}) - ---vim.keymap.del("n", "j") ---vim.keymap.del("n", "k") ---vim.keymap.del("n", "l") --- }}} - --- =================== TERM BEHAVIORS ==================== -vim.keymap.set("t", "", "", { desc = "escape terminal, allowing excmds" }) -vim.keymap.set("t", "", "", { desc = "close terminal" }) - ---vim: set fdm=marker fdl=0 - --- buffers -vim.keymap.set("n", "", "bprevious", { desc = "Prev Buffer" }) -vim.keymap.set("n", "", "bnext", { desc = "Next Buffer" }) diff --git a/tools/nvim.lazy.d/lua/config/lazy.lua b/tools/nvim.lazy.d/lua/config/lazy.lua deleted file mode 100644 index 532a434..0000000 --- a/tools/nvim.lazy.d/lua/config/lazy.lua +++ /dev/null @@ -1,53 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import/override with your plugins - { import = "plugins" }, - }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { - enabled = true, -- check for plugin updates periodically - notify = false, -- notify on update - }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, -}) diff --git a/tools/nvim.lazy.d/lua/config/options.lua b/tools/nvim.lazy.d/lua/config/options.lua deleted file mode 100644 index 415944a..0000000 --- a/tools/nvim.lazy.d/lua/config/options.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here diff --git a/tools/nvim.lazy.d/lua/plugins/catppuccin.lua b/tools/nvim.lazy.d/lua/plugins/catppuccin.lua deleted file mode 100644 index c6e52c7..0000000 --- a/tools/nvim.lazy.d/lua/plugins/catppuccin.lua +++ /dev/null @@ -1,54 +0,0 @@ -return { - "catppuccin/nvim", - lazy = true, - name = "catppuccin", - opts = { - integrations = { - aerial = true, - alpha = true, - cmp = true, - dashboard = true, - flash = true, - grug_far = true, - gitsigns = true, - headlines = true, - illuminate = true, - indent_blankline = { enabled = true }, - leap = true, - lsp_trouble = true, - mason = true, - markdown = true, - mini = true, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, - navic = { enabled = true, custom_bg = "lualine" }, - neotest = true, - neotree = true, - noice = true, - notify = true, - semantic_tokens = true, - telescope = true, - treesitter = true, - treesitter_context = true, - which_key = true, - }, - }, - specs = { - { - "akinsho/bufferline.nvim", - optional = true, - opts = function(_, opts) - if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() - end - end, - }, - }, -} diff --git a/tools/nvim.lazy.d/lua/plugins/colorscheme.lua b/tools/nvim.lazy.d/lua/plugins/colorscheme.lua deleted file mode 100644 index ab99258..0000000 --- a/tools/nvim.lazy.d/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "catppuccin", - }, - }, -} diff --git a/tools/nvim.lazy.d/lua/plugins/dashboard.lua b/tools/nvim.lazy.d/lua/plugins/dashboard.lua deleted file mode 100644 index 368524a..0000000 --- a/tools/nvim.lazy.d/lua/plugins/dashboard.lua +++ /dev/null @@ -1,65 +0,0 @@ -return { - "nvimdev/dashboard-nvim", - lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. - opts = function() - local logo = [[ - ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z - ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z - ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z - ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z - ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] - - -- logo = string.rep("\n", 8) .. logo .. "\n\n" - - local opts = { - theme = "doom", - hide = { - -- this is taken care of by lualine - -- enabling this messes up the actual laststatus setting after loading a file - statusline = false, - }, - config = { - header = vim.split(logo, "\n"), - -- stylua: ignore - center = { - { action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" }, - { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, - { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" }, - { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" }, - { action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" }, - { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, - { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, - { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, - { action = function() vim.api.nvim_input("qa") end, desc = " Quit", icon = " ", key = "q" }, - }, - footer = function() - local stats = require("lazy").stats() - local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } - end, - }, - } - - for _, button in ipairs(opts.config.center) do - button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - button.key_format = " %s" - end - - -- open dashboard after closing lazy - if vim.o.filetype == "lazy" then - vim.api.nvim_create_autocmd("WinClosed", { - pattern = tostring(vim.api.nvim_get_current_win()), - once = true, - callback = function() - vim.schedule(function() - vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) - end) - end, - }) - end - - return opts - end, -} diff --git a/tools/nvim.lazy.d/lua/plugins/example.lua b/tools/nvim.lazy.d/lua/plugins/example.lua deleted file mode 100644 index 17f53d6..0000000 --- a/tools/nvim.lazy.d/lua/plugins/example.lua +++ /dev/null @@ -1,197 +0,0 @@ --- since this is just an example spec, don't actually load anything here and return an empty spec --- stylua: ignore -if true then return {} end - --- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim --- --- In your plugin files, you can: --- * add extra plugins --- * disable/enabled LazyVim plugins --- * override the configuration of LazyVim plugins -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - }, - }, - - -- change trouble config - { - "folke/trouble.nvim", - -- opts will be merged with the parent spec - opts = { use_diagnostic_signs = true }, - }, - - -- disable trouble - { "folke/trouble.nvim", enabled = false }, - - -- override nvim-cmp and add cmp-emoji - { - "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-emoji" }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, { name = "emoji" }) - end, - }, - - -- change some telescope options and a keymap to browse plugin files - { - "nvim-telescope/telescope.nvim", - keys = { - -- add a keymap to browse plugin files - -- stylua: ignore - { - "fp", - function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, - desc = "Find Plugin File", - }, - }, - -- change some options - opts = { - defaults = { - layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, - sorting_strategy = "ascending", - winblend = 0, - }, - }, - }, - - -- add pyright to lspconfig - { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- pyright will be automatically installed with mason and loaded with lspconfig - pyright = {}, - }, - }, - }, - - -- add tsserver and setup with typescript.nvim instead of lspconfig - { - "neovim/nvim-lspconfig", - dependencies = { - "jose-elias-alvarez/typescript.nvim", - init = function() - require("lazyvim.util").lsp.on_attach(function(_, buffer) - -- stylua: ignore - vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) - vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) - end) - end, - }, - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- tsserver will be automatically installed with mason and loaded with lspconfig - tsserver = {}, - }, - -- you can do any additional lsp server setup here - -- return true if you don't want this server to be setup with lspconfig - ---@type table - setup = { - -- example to setup with typescript.nvim - tsserver = function(_, opts) - require("typescript").setup({ server = opts }) - return true - end, - -- Specify * to use this function as a fallback for any server - -- ["*"] = function(server, opts) end, - }, - }, - }, - - -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, - -- treesitter, mason and typescript.nvim. So instead of the above, you can use: - { import = "lazyvim.plugins.extras.lang.typescript" }, - - -- add more treesitter parsers - { - "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "bash", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "tsx", - "typescript", - "vim", - "yaml", - }, - }, - }, - - -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above - -- would overwrite `ensure_installed` with the new value. - -- If you'd rather extend the default config, use the code below instead: - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - -- add tsx and treesitter - vim.list_extend(opts.ensure_installed, { - "tsx", - "typescript", - }) - end, - }, - - -- the opts function can also be used to change the default opts: - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, { - function() - return "😄" - end, - }) - end, - }, - - -- or you can return new options to override all the defaults - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function() - return { - --[[add your custom lualine config here]] - } - end, - }, - - -- use mini.starter instead of alpha - { import = "lazyvim.plugins.extras.ui.mini-starter" }, - - -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc - { import = "lazyvim.plugins.extras.lang.json" }, - - -- add any tools you want to have installed below - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "stylua", - "shellcheck", - "shfmt", - "flake8", - }, - }, - }, -} diff --git a/tools/nvim.lazy.d/lua/plugins/just.lua b/tools/nvim.lazy.d/lua/plugins/just.lua deleted file mode 100644 index 41ae68a..0000000 --- a/tools/nvim.lazy.d/lua/plugins/just.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "NoahTheDuke/vim-just", - ft = { "just" }, -} diff --git a/tools/nvim.lazy.d/lua/plugins/lualine.lua b/tools/nvim.lazy.d/lua/plugins/lualine.lua deleted file mode 100644 index 756fd96..0000000 --- a/tools/nvim.lazy.d/lua/plugins/lualine.lua +++ /dev/null @@ -1,126 +0,0 @@ -return { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - init = function() - vim.g.lualine_laststatus = vim.o.laststatus - if vim.fn.argc(-1) > 0 then - -- set an empty statusline till lualine loads - vim.o.statusline = " " - else - -- hide the statusline on the starter page - vim.o.laststatus = 0 - end - end, - opts = function() - -- PERF: we don't need this lualine require madness 🤷 - local lualine_require = require("lualine_require") - lualine_require.require = require - - local icons = LazyVim.config.icons - - vim.o.laststatus = vim.g.lualine_laststatus - - local opts = { - options = { - theme = "auto", - globalstatus = vim.o.laststatus == 3, - disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard", "NvimTree_1" } }, - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { "branch" }, - - lualine_c = { - LazyVim.lualine.root_dir(), - { - "diagnostics", - symbols = { - error = icons.diagnostics.Error, - warn = icons.diagnostics.Warn, - info = icons.diagnostics.Info, - hint = icons.diagnostics.Hint, - }, - }, - { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, - { LazyVim.lualine.pretty_path() }, - }, - lualine_x = { - -- stylua: ignore - { - function() return require("noice").api.status.command.get() end, - cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end, - color = function() return LazyVim.ui.fg("Statement") end, - }, - -- stylua: ignore - { - function() return require("noice").api.status.mode.get() end, - cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end, - color = function() return LazyVim.ui.fg("Constant") end, - }, - -- stylua: ignore - { - function() return " " .. require("dap").status() end, - cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end, - color = function() return LazyVim.ui.fg("Debug") end, - }, - -- stylua: ignore - { - require("lazy.status").updates, - cond = require("lazy.status").has_updates, - color = function() return LazyVim.ui.fg("Special") end, - }, - { - "diff", - symbols = { - added = icons.git.added, - modified = icons.git.modified, - removed = icons.git.removed, - }, - source = function() - local gitsigns = vim.b.gitsigns_status_dict - if gitsigns then - return { - added = gitsigns.added, - modified = gitsigns.changed, - removed = gitsigns.removed, - } - end - end, - }, - }, - lualine_y = { - { "progress", separator = " ", padding = { left = 1, right = 0 } }, - { "location", padding = { left = 0, right = 1 } }, - }, - lualine_z = { - function() - return " " .. os.date("%R") - end, - }, - }, - extensions = { "neo-tree", "lazy" }, - } - - -- do not add trouble symbols if aerial is enabled - -- And allow it to be overriden for some buffer types (see autocmds) - if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then - local trouble = require("trouble") - local symbols = trouble.statusline({ - mode = "symbols", - groups = {}, - title = false, - filter = { range = true }, - format = "{kind_icon}{symbol.name:Normal}", - hl_group = "lualine_c_normal", - }) - table.insert(opts.sections.lualine_c, { - symbols and symbols.get, - cond = function() - return vim.b.trouble_lualine ~= false and symbols.has() - end, - }) - end - - return opts - end, -} diff --git a/tools/nvim.lazy.d/lua/plugins/neo-tree.lua b/tools/nvim.lazy.d/lua/plugins/neo-tree.lua deleted file mode 100644 index d9bccdf..0000000 --- a/tools/nvim.lazy.d/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,138 +0,0 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - cmd = "Neotree", - keys = { - { - "fe", - function() - require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) - end, - desc = "Explorer NeoTree (Root Dir)", - }, - { - "fE", - function() - require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) - end, - desc = "Explorer NeoTree (cwd)", - }, - { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, - { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, - { - "ge", - function() - require("neo-tree.command").execute({ source = "git_status", toggle = true }) - end, - desc = "Git Explorer", - }, - { - "be", - function() - require("neo-tree.command").execute({ source = "buffers", toggle = true }) - end, - desc = "Buffer Explorer", - }, - }, - deactivate = function() - vim.cmd([[Neotree close]]) - end, - init = function() - -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, - -- because `cwd` is not set up properly. - vim.api.nvim_create_autocmd("BufEnter", { - group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), - desc = "Start Neo-tree with directory", - once = true, - callback = function() - if package.loaded["neo-tree"] then - return - else - local stats = vim.uv.fs_stat(vim.fn.argv(0)) - if stats and stats.type == "directory" then - require("neo-tree") - end - end - end, - }) - end, - opts = { - sources = { "filesystem", "buffers", "git_status" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - filesystem = { - hide_dotfiles = false, - hide_hidden = false, - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - hide_by_name = { - ".git", - "node_modules", - "requirements.txt", - "desktop.ini", - }, - never_show = { - ".DS_Store", - }, - }, - window = { - mappings = { - -- MARKED - ["i"] = "open", - -- MARKED - ["e"] = "noop", - ["h"] = "close_node", - [""] = "none", - ["Y"] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - desc = "Copy Path to Clipboard", - }, - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - ["P"] = { "toggle_preview", config = { use_float = false } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - git_status = { - symbols = { - unstaged = "󰄱", - staged = "󰱒", - }, - }, - }, - }, - config = function(_, opts) - local function on_move(data) - LazyVim.lsp.on_rename(data.source, data.destination) - end - - local events = require("neo-tree.events") - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - require("neo-tree").setup(opts) - vim.api.nvim_create_autocmd("TermClose", { - pattern = "*lazygit", - callback = function() - if package.loaded["neo-tree.sources.git_status"] then - require("neo-tree.sources.git_status").refresh() - end - end, - }) - end, -} diff --git a/tools/nvim.lazy.d/lua/plugins/nvim-tree.lua b/tools/nvim.lazy.d/lua/plugins/nvim-tree.lua deleted file mode 100644 index 40e9b7c..0000000 --- a/tools/nvim.lazy.d/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "nvim-tree/nvim-tree.lua", - version = "*", - lazy = false, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - config = function() - require("nvim-tree").setup({}) - end, -} diff --git a/tools/nvim.lazy.d/lua/plugins/obsidian.lua b/tools/nvim.lazy.d/lua/plugins/obsidian.lua deleted file mode 100644 index 492e085..0000000 --- a/tools/nvim.lazy.d/lua/plugins/obsidian.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit - lazy = true, - ft = "markdown", - dependencies = { - -- Required. - "nvim-lua/plenary.nvim", - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - { - name = "Obsidian", - path = "/mnt/c/Users/citoy/Obsidian", - }, - }, - - -- see below for full list of options 👇 - }, -} diff --git a/tools/nvim.lazy.d/lua/plugins/wakatime.lua b/tools/nvim.lazy.d/lua/plugins/wakatime.lua deleted file mode 100644 index e37e7b5..0000000 --- a/tools/nvim.lazy.d/lua/plugins/wakatime.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - { 'wakatime/vim-wakatime', lazy = false }, -} \ No newline at end of file diff --git a/tools/nvim.lazy.d/stylua.toml b/tools/nvim.lazy.d/stylua.toml deleted file mode 100644 index 964e1aa..0000000 --- a/tools/nvim.lazy.d/stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Spaces" -indent_width = 2 -column_width = 120 \ No newline at end of file From f69dc967e0047c299f676b235806a798277d06e5 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sat, 30 Nov 2024 02:03:30 +0000 Subject: [PATCH 4/9] feat(zsh, ipython): New symblink scripts, IPython linked with directory --- .gitignore | 7 ------ .vscode/settings.json | 8 +++++-- bootstrap/{win_setup.ps1 => Windows.ps1} | 0 bootstrap/{mac_setup.sh => macOS.zsh} | 12 ++++++---- bootstrap/set_symblink_unix.bash | 24 +++++++++++++++++++ bootstrap/set_symblink_unix.sh | 22 ----------------- scripts/update.zsh | 1 + tools/ipython/.gitignore | 6 +++++ tools/ipython/profile_default/startup/README | 11 +++++++++ tools/ipython/profile_default/starup/README | 11 +++++++++ .../profile_default/starup/magic_ps.py | 2 +- tools/zsh/mod/env.zsh | 8 +++++++ 12 files changed, 75 insertions(+), 37 deletions(-) rename bootstrap/{win_setup.ps1 => Windows.ps1} (100%) rename bootstrap/{mac_setup.sh => macOS.zsh} (97%) create mode 100644 bootstrap/set_symblink_unix.bash delete mode 100644 bootstrap/set_symblink_unix.sh create mode 100644 tools/ipython/.gitignore create mode 100644 tools/ipython/profile_default/startup/README create mode 100644 tools/ipython/profile_default/starup/README create mode 100644 tools/zsh/mod/env.zsh diff --git a/.gitignore b/.gitignore index 93c06d7..8090e0e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,13 +15,6 @@ test.* # Utils xdg-ninja/ -# IPython config cache -tools/ipython/profile_default/db -tools/ipython/profile_default/log -tools/ipython/profile_default/pid -tools/ipython/profile_default/security -tools/ipython/profile_default/history.sqlite - # nvim config cache tools/nvim/tt.* tools/nvim/.tests diff --git a/.vscode/settings.json b/.vscode/settings.json index 1177b9b..a249144 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,10 +13,14 @@ "nvim/init.lua": "vim", "markdownlint.json": "markdownlint", ".wslconfig": "settings", - "*.hsnips": "" }, "material-icon-theme.folders.associations": { - "bootstrap": "admin" + "bootstrap": "admin", + "ipython": "jupyter", + "zsh": "command", + "starship": "ui", + "nvim": "config", + "wsl": "linux" }, "files.associations": { "ideavimrc": "Vimscript", diff --git a/bootstrap/win_setup.ps1 b/bootstrap/Windows.ps1 similarity index 100% rename from bootstrap/win_setup.ps1 rename to bootstrap/Windows.ps1 diff --git a/bootstrap/mac_setup.sh b/bootstrap/macOS.zsh similarity index 97% rename from bootstrap/mac_setup.sh rename to bootstrap/macOS.zsh index 62b9976..ef55894 100644 --- a/bootstrap/mac_setup.sh +++ b/bootstrap/macOS.zsh @@ -1,8 +1,7 @@ -#! /bin/sh -# This script is used to setup a new mac -# In a new mac (Sequoia) -# Enter the following command in the terminal -#! curl -fsSL https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/setup/mac_setup.sh | sh # Do not use this command +#! /bin/zsh +# $DOTFILES/bootstrap/macOS.zsh +# Run this script to set up macOS +# 运行此脚本以设置 macOS echo "Running the setup script" @@ -11,6 +10,9 @@ echo "[INFO] Installing Xcode Command Line Tools" echo "[ACTION] Request Human Takeover" xcode-select --install +# Press any key to continue (if Xcode Command Line Tools are installed) +read -n 1 -s -r -p "Press any key to continue when xcode CLI tools are installed" + # System Preferences # Installation Sources echo "[INFO] Setting Installation Sources" diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symblink_unix.bash new file mode 100644 index 0000000..eef5d91 --- /dev/null +++ b/bootstrap/set_symblink_unix.bash @@ -0,0 +1,24 @@ +#! /bin/bash +mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython +mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory +# mkdir -p $WAKATIME_HOME +# mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view +mkdir -p $HOME/Obsidian +# $DOTFILES/common +ln -sf $DOTFILES/common/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc +ln -sf $DOTFILES/common/gitconfig $XDG_CONFIG_HOME/git/config +ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml +ln -sf $DOTFILES/common/haskeline ~/.haskeline +ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc +ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey +ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG +ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config +ln -sf $DOTFILES/common/obsidian.vimrc $HOME/Obsidian/.obsidian.vimrc +ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf +ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf +ln -sf $DOTFILES/common/vimrc $XDG_CONFIG_HOME/vim/vimrc +ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl +# $DOTFILES/tools +ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython +ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim diff --git a/bootstrap/set_symblink_unix.sh b/bootstrap/set_symblink_unix.sh deleted file mode 100644 index b68006a..0000000 --- a/bootstrap/set_symblink_unix.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh -mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm -mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory -mkdir -p $WAKATIME_HOME -mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view -# $DOTFILES/.config -ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc -ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config -ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc -ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json -ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG -ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config -ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim -ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf -ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf -ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc -ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl -ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey -# $DOTFILES/vscode -ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc -# $DOTFILES root -ln -sf $DOTFILES/.haskeline ~/.haskeline \ No newline at end of file diff --git a/scripts/update.zsh b/scripts/update.zsh index ce4e5fd..b110e81 100644 --- a/scripts/update.zsh +++ b/scripts/update.zsh @@ -1,3 +1,4 @@ +#!/bin/zsh # $DOTFILES/scripts/update.zsh # call by `update` alias defined in tools/zsh/alias.zsh # 使用别名 `update` 引用,别名定义于 tools/zsh/alias.zsh diff --git a/tools/ipython/.gitignore b/tools/ipython/.gitignore new file mode 100644 index 0000000..6b49931 --- /dev/null +++ b/tools/ipython/.gitignore @@ -0,0 +1,6 @@ +# IPython config cache +*/db/ +*/log/ +*/pid/ +*/security/ +*/history.sqlite diff --git a/tools/ipython/profile_default/startup/README b/tools/ipython/profile_default/startup/README new file mode 100644 index 0000000..61d4700 --- /dev/null +++ b/tools/ipython/profile_default/startup/README @@ -0,0 +1,11 @@ +This is the IPython startup directory + +.py and .ipy files in this directory will be run *prior* to any code or files specified +via the exec_lines or exec_files configurables whenever you load this profile. + +Files will be run in lexicographical order, so you can control the execution order of files +with a prefix, e.g.:: + + 00-first.py + 50-middle.py + 99-last.ipy diff --git a/tools/ipython/profile_default/starup/README b/tools/ipython/profile_default/starup/README new file mode 100644 index 0000000..61d4700 --- /dev/null +++ b/tools/ipython/profile_default/starup/README @@ -0,0 +1,11 @@ +This is the IPython startup directory + +.py and .ipy files in this directory will be run *prior* to any code or files specified +via the exec_lines or exec_files configurables whenever you load this profile. + +Files will be run in lexicographical order, so you can control the execution order of files +with a prefix, e.g.:: + + 00-first.py + 50-middle.py + 99-last.ipy diff --git a/tools/ipython/profile_default/starup/magic_ps.py b/tools/ipython/profile_default/starup/magic_ps.py index 8800f71..351e003 100644 --- a/tools/ipython/profile_default/starup/magic_ps.py +++ b/tools/ipython/profile_default/starup/magic_ps.py @@ -2,7 +2,7 @@ from IPython.core.magic import register_line_magic @register_line_magic def ps(cmd): - output = get_ipython().getoutput(f"powershell -Command {cmd}") + output = get_ipython().getoutput(f"pwsh -NoProfile -Command {cmd}") # If no variable is assigned to the output, print it if get_ipython().last_execution_result is None: print("\n".join(output)) diff --git a/tools/zsh/mod/env.zsh b/tools/zsh/mod/env.zsh new file mode 100644 index 0000000..bf0ef34 --- /dev/null +++ b/tools/zsh/mod/env.zsh @@ -0,0 +1,8 @@ +# $DOTFILES/tools/zsh/mod/env.zsh +# Sourced by user's zshrc 在用户的 zshrc 中被引用 + +# This file stores only environment variables that only called by +# interactive session. +# 这个文件只存储只在交互式会话中调用的环境变量。 + +export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython From 567c8d1b3bd61d8ab20c35c1fd01e8fcc67178ab Mon Sep 17 00:00:00 2001 From: js0ny Date: Sat, 30 Nov 2024 02:31:01 +0000 Subject: [PATCH 5/9] feat(macOS): Add macOS TWM configs --- .gitattributes | 4 ++ .vscode/dotfiles.code-snippets | 29 ++++++++++ .vscode/settings.json | 1 + bootstrap/set_symblink_unix.bash | 8 +++ platforms/mac/sketchybarrc | 95 ++++++++++++++++++++++++++++++++ platforms/mac/skhdrc | 35 ++++++++++++ platforms/mac/yabairc | 51 +++++++++++++++++ platforms/mac/zshrc | 2 + tools/zsh/common.zshrc | 4 +- tools/zsh/global.zshenv | 3 + tools/zsh/mod/alias.zsh | 6 +- tools/zsh/mod/config.zsh | 2 + tools/zsh/mod/env.zsh | 2 + tools/zsh/mod/keymap.zsh | 2 + tools/zsh/mod/navi.zsh | 2 + tools/zsh/mod/prompt.zsh | 2 + tools/zsh/zshenv | 2 + 17 files changed, 247 insertions(+), 3 deletions(-) create mode 100644 .gitattributes create mode 100644 .vscode/dotfiles.code-snippets create mode 100755 platforms/mac/sketchybarrc create mode 100644 platforms/mac/skhdrc create mode 100644 platforms/mac/yabairc diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..008de29 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# $DOTFILES/.gitattributes +# Date: 2024-11-30 +# Author: contact@js0ny.net +skhdrc linguist-language=Shell diff --git a/.vscode/dotfiles.code-snippets b/.vscode/dotfiles.code-snippets new file mode 100644 index 0000000..5a49f9e --- /dev/null +++ b/.vscode/dotfiles.code-snippets @@ -0,0 +1,29 @@ +{ + // Place your .dotfiles 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "Dotfiles": { + "scope": "", + "prefix": "init", + "body": [ + "$LINE_COMMENT \\$DOTFILES/$RELATIVE_FILEPATH", + "$LINE_COMMENT Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE", + "$LINE_COMMENT Author: contact@js0ny.net", + "$LINE_COMMENT $0", + ] + + } +} diff --git a/.vscode/settings.json b/.vscode/settings.json index a249144..abc78ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,7 @@ "nvim/init.lua": "vim", "markdownlint.json": "markdownlint", ".wslconfig": "settings", + "skhdrc": "console" }, "material-icon-theme.folders.associations": { "bootstrap": "admin", diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symblink_unix.bash index eef5d91..0b056ac 100644 --- a/bootstrap/set_symblink_unix.bash +++ b/bootstrap/set_symblink_unix.bash @@ -22,3 +22,11 @@ ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl # $DOTFILES/tools ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim + +if [ $(uname) = "Darwin"]; then + mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar + ln -sf $DOTFILES/platforms/mac/karabiner/karabiner.json ~/.config/karabiner/karabiner.json + ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc + ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc + ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc +fi diff --git a/platforms/mac/sketchybarrc b/platforms/mac/sketchybarrc new file mode 100755 index 0000000..bc8b5a6 --- /dev/null +++ b/platforms/mac/sketchybarrc @@ -0,0 +1,95 @@ +# $DOTFILES/platforms/mac/sketchybarrc +# Date: 2024-11-30 +# Author: contact@js0ny.net +# TODO: Reorganize this file +# This is a demo config to showcase some of the most important commands. +# It is meant to be changed and configured, as it is intentionally kept sparse. +# For a (much) more advanced configuration example see my dotfiles: +# https://github.com/FelixKratz/dotfiles + +PLUGIN_DIR="$CONFIG_DIR/plugins" + +##### Bar Appearance ##### +# Configuring the general appearance of the bar. +# These are only some of the options available. For all options see: +# https://felixkratz.github.io/SketchyBar/config/bar +# If you are looking for other colors, see the color picker: +# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker + +sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000 + +##### Changing Defaults ##### +# We now change some default values, which are applied to all further items. +# For a full list of all available item properties see: +# https://felixkratz.github.io/SketchyBar/config/items + +default=( + padding_left=5 + padding_right=5 + icon.font="CaskaydiaCove Nerd Font:Bold:17.0" + label.font="CaskaydiaCove Nerd Font:Bold:14.0" + icon.color=0xffffffff + label.color=0xffffffff + icon.padding_left=4 + icon.padding_right=4 + label.padding_left=4 + label.padding_right=4 +) +sketchybar --default "${default[@]}" + +##### Adding Mission Control Space Indicators ##### +# Let's add some mission control spaces: +# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item +# to indicate active and available mission control spaces. + +SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") +for i in "${!SPACE_ICONS[@]}" +do + sid="$(($i+1))" + space=( + space="$sid" + icon="${SPACE_ICONS[i]}" + icon.padding_left=7 + icon.padding_right=7 + background.color=0x40ffffff + background.corner_radius=5 + background.height=25 + label.drawing=off + script="$PLUGIN_DIR/space.sh" + click_script="yabai -m space --focus $sid" + ) + sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" +done + +##### Adding Left Items ##### +# We add some regular items to the left side of the bar, where +# only the properties deviating from the current defaults need to be set + +sketchybar --add item chevron left \ + --set chevron icon= label.drawing=off \ + --add item front_app left \ + --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ + --subscribe front_app front_app_switched + +##### Adding Right Items ##### +# In the same way as the left items we can add items to the right side. +# Additional position (e.g. center) are available, see: +# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar + +# Some items refresh on a fixed cycle, e.g. the clock runs its script once +# every 10s. Other items respond to events they subscribe to, e.g. the +# volume.sh script is only executed once an actual change in system audio +# volume is registered. More info about the event system can be found here: +# https://felixkratz.github.io/SketchyBar/config/events + +sketchybar --add item clock right \ + --set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \ + --add item volume right \ + --set volume script="$PLUGIN_DIR/volume.sh" \ + --subscribe volume volume_change \ + --add item battery right \ + --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ + --subscribe battery system_woke power_source_change + +##### Force all scripts to run the first time (never do this in a script) ##### +sketchybar --update diff --git a/platforms/mac/skhdrc b/platforms/mac/skhdrc new file mode 100644 index 0000000..48e0bc8 --- /dev/null +++ b/platforms/mac/skhdrc @@ -0,0 +1,35 @@ +# $DOTFILES/platforms/mac/skhdrc +# Date: 2024-11-30 +# Author: contact@js0ny.net + +# Location: $XDG_CONFIG_HOME/skhd/skhdrc +# Linking: +# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc + +# Navigation +cmd - h : yabai -m window --focus west +cmd - n : yabai -m window --focus south +cmd - e : yabai -m window --focus north +cmd - i : yabai -m window --focus east + +# Moving windows +shift + cmd - h : yabai -m window --warp west +shift + cmd - n : yabai -m window --warp south +shift + cmd - e : yabai -m window --warp north +shift + cmd - i : yabai -m window --warp east + +shift + alt - h : \ + yabai -m window --resize left:-20:0 ; \ + yabai -m window --resize right:-20:0 + +shift + alt - n : \ + yabai -m window --resize bottom:0:20 ; \ + yabai -m window --resize top:0:20 + +shift + alt - e : \ + yabai -m window --resize top:0:-20 ; \ + yabai -m window --resize bottom:0:-20 + +shift + alt - i : \ + yabai -m window --resize right:20:0 ; \ + yabai -m window --resize left:20:0 diff --git a/platforms/mac/yabairc b/platforms/mac/yabairc new file mode 100644 index 0000000..d3fa357 --- /dev/null +++ b/platforms/mac/yabairc @@ -0,0 +1,51 @@ +#!/usr/bin/env sh +# $DOTFILES/platforms/mac/yabairc +# Date: 2024-11-30 +# Author: contact@js0ny.net +# TODO: Reorganize this file + +# +# for this to work you must configure sudo such that +# it will be able to run the command without password +# +# see this wiki page for information: +# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition +# +# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" +# sudo yabai --load-sa +# + +# global settings +yabai -m config \ + top_padding 40 \ + external_bar off:40:0 \ + menubar_opacity 1.0 \ + mouse_follows_focus off \ + focus_follows_mouse off \ + display_arrangement_order default \ + window_origin_display default \ + window_placement second_child \ + window_zoom_persist on \ + window_shadow on \ + window_animation_duration 0.0 \ + window_animation_easing ease_out_circ \ + window_opacity_duration 0.0 \ + active_window_opacity 1.0 \ + normal_window_opacity 0.90 \ + window_opacity off \ + insert_feedback_color 0xffd75f5f \ + split_ratio 0.50 \ + split_type auto \ + auto_balance off \ + top_padding 12 \ + bottom_padding 12 \ + left_padding 12 \ + right_padding 12 \ + window_gap 06 \ + layout bsp \ + mouse_modifier fn \ + mouse_action1 move \ + mouse_action2 resize \ + mouse_drop_action swap + +echo "yabai configuration loaded.." diff --git a/platforms/mac/zshrc b/platforms/mac/zshrc index ee504ee..cf41274 100644 --- a/platforms/mac/zshrc +++ b/platforms/mac/zshrc @@ -1,4 +1,6 @@ # $DOTFILES/platforms/mac/zshrc +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用,macOS 特定配置 # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) diff --git a/tools/zsh/common.zshrc b/tools/zsh/common.zshrc index 3a46294..8cac855 100644 --- a/tools/zsh/common.zshrc +++ b/tools/zsh/common.zshrc @@ -1,4 +1,6 @@ -# $DOTFILES/zsh/common.zshrc +# $DOTFILES/tools/zsh/common.zshrc +# Date: 2024-11-30 +# Author: contact@js0ny.net # This is the entry point for all zsh configuration files # 这是所有zsh配置文件的入口点 diff --git a/tools/zsh/global.zshenv b/tools/zsh/global.zshenv index 32f2829..a9c1a49 100644 --- a/tools/zsh/global.zshenv +++ b/tools/zsh/global.zshenv @@ -1,4 +1,7 @@ # $DOTFILES/tools/zsh/global.zshenv +# Date: 2024-11-30 +# Author: contact@js0ny.net +# $DOTFILES/tools/zsh/global.zshenv # system-wide zshenv file 系统级别的 zshenv 文件,用于设置全局环境变量 # Location: diff --git a/tools/zsh/mod/alias.zsh b/tools/zsh/mod/alias.zsh index 1e55316..f9c51cd 100644 --- a/tools/zsh/mod/alias.zsh +++ b/tools/zsh/mod/alias.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/alias.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # PowerShell Equivalent, for cross-platform compatibility @@ -29,10 +31,10 @@ alias sn="sudo nvim" # lsd - modern ls if command -v lsd > /dev/null; then - alias ls='lsd -A' + alias ls='lsd -A -I .DS_Store -I .git' alias l='lsd -lah' alias ll='lsd -l' - alias tree='lsd --tree' + alias tree='lsd --tree -I .DS_Store -I .git' fi # Functions # diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh index eab28a6..20ec160 100644 --- a/tools/zsh/mod/config.zsh +++ b/tools/zsh/mod/config.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/config.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # ZSH Config, no need to `export` these variables diff --git a/tools/zsh/mod/env.zsh b/tools/zsh/mod/env.zsh index bf0ef34..73beddd 100644 --- a/tools/zsh/mod/env.zsh +++ b/tools/zsh/mod/env.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/env.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # This file stores only environment variables that only called by diff --git a/tools/zsh/mod/keymap.zsh b/tools/zsh/mod/keymap.zsh index 2242057..eac5169 100644 --- a/tools/zsh/mod/keymap.zsh +++ b/tools/zsh/mod/keymap.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/keymap.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 diff --git a/tools/zsh/mod/navi.zsh b/tools/zsh/mod/navi.zsh index 3793178..361d762 100644 --- a/tools/zsh/mod/navi.zsh +++ b/tools/zsh/mod/navi.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/navi.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # Relative navigation # diff --git a/tools/zsh/mod/prompt.zsh b/tools/zsh/mod/prompt.zsh index be24212..01be5dc 100644 --- a/tools/zsh/mod/prompt.zsh +++ b/tools/zsh/mod/prompt.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/prompt.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index 585adf5..d390a44 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/zshenv +# Date: 2024-11-30 +# Author: contact@js0ny.net # User-specific environment variables for zsh 用户级别的 zsh 环境变量 # Location: From 9436322a73370663cd355b10971557a739bdc65e Mon Sep 17 00:00:00 2001 From: js0ny Date: Sat, 30 Nov 2024 05:14:00 +0000 Subject: [PATCH 6/9] fix(zsh): Cleanup environment variable --- ...PowerShell_profile.ps1 => pwshProfile.ps1} | 0 platforms/mac/zshrc | 3 --- tools/zsh/mod/config.zsh | 3 +-- tools/zsh/zshenv | 23 +++++++++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) rename platforms/mac/{Microsoft.PowerShell_profile.ps1 => pwshProfile.ps1} (100%) diff --git a/platforms/mac/Microsoft.PowerShell_profile.ps1 b/platforms/mac/pwshProfile.ps1 similarity index 100% rename from platforms/mac/Microsoft.PowerShell_profile.ps1 rename to platforms/mac/pwshProfile.ps1 diff --git a/platforms/mac/zshrc b/platforms/mac/zshrc index cf41274..bf3d429 100644 --- a/platforms/mac/zshrc +++ b/platforms/mac/zshrc @@ -4,9 +4,6 @@ # Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用,macOS 特定配置 # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) -# Homebrew Path -export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH - # macOS # alias xclip="pbcopy" diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh index 20ec160..f8cd08b 100644 --- a/tools/zsh/mod/config.zsh +++ b/tools/zsh/mod/config.zsh @@ -36,8 +36,7 @@ done set -k # TODO: Below should be reorganized -export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH -export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables +export PATH=$HOME/.local/bin:$PATH export NVM_DIR="$HOME/.config/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index d390a44..e78aa31 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -33,6 +33,15 @@ export PAGER="less -R" export EDITOR="nvim" export VISUAL="nvim" +# Minimal PATH for early commands +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" + +if [ -d "/opt/homebrew/bin" ]; then # macOS + export PATH="/opt/homebrew/bin:$PATH" +elif [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then # Linux + export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" +fi + # macOS Specific # This syntax is POSIX standard, for portability if [ "$(uname)" = "Darwin" ]; then @@ -52,6 +61,7 @@ fi # Cargo if command -v cargo > /dev/null; then export CARGO_HOME="$XDG_DATA_HOME"/cargo + export PATH="$CARGO_HOME/bin:$PATH" fi # CGDB if command -v cgdb > /dev/null; then @@ -60,6 +70,7 @@ fi # .NET if command -v dotnet > /dev/null; then export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet + export PATH="$DOTNET_CLI_HOME/.dotnet/tools:$PATH" fi # Docker if command -v docker > /dev/null; then @@ -72,6 +83,7 @@ fi # Go if command -v go > /dev/null; then export GOPATH="$XDG_DATA_HOME"/go + export PATH="$GOPATH/bin:$PATH" fi # Julia if command -v julia > /dev/null; then @@ -100,6 +112,17 @@ if command -v screen > /dev/null; then export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc export SCREENDIR="${XDG_RUNTIME_DIR}/screen" fi +# Ruby Gem +# Ruby Gem +if command -v gem > /dev/null; then + setopt nullglob + for dir in "$HOME/.local/share/gem/ruby/"*/bin; do + if [ -d "$dir" ]; then + export PATH="$dir:$PATH" + fi + done + unsetopt nullglob +fi # Spacemacs if command -v emacs > /dev/null; then export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs From 1416ae4f055f26d32f86529d07e75643cf390114 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 1 Dec 2024 05:44:40 +0000 Subject: [PATCH 7/9] fix(zsh): Some WSL glitches and migration --- bootstrap/set_symblink_unix.bash | 5 +++++ platforms/wsl/zshrc | 7 ++++--- tools/zsh/mod/navi.zsh | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symblink_unix.bash index 0b056ac..1a5c405 100644 --- a/bootstrap/set_symblink_unix.bash +++ b/bootstrap/set_symblink_unix.bash @@ -1,4 +1,8 @@ #! /bin/bash +# $DOTFILES/bootstrap/set_symblink_unix.bash +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Set symbolic links for Unix-like systems mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory # mkdir -p $WAKATIME_HOME @@ -22,6 +26,7 @@ ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl # $DOTFILES/tools ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim +ln -sf $DOTFILES/tools/zsh/common.zshrc $XDG_CONFIG_HOME/zsh/.zshrc if [ $(uname) = "Darwin"]; then mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar diff --git a/platforms/wsl/zshrc b/platforms/wsl/zshrc index 3e6cb96..fdc7691 100644 --- a/platforms/wsl/zshrc +++ b/platforms/wsl/zshrc @@ -1,12 +1,13 @@ -# $DOTFILES/platforms//zshrc +# $DOTFILES/platforms/wsl/zshrc +# Date: 2024-12-01 +# Author: contact@js0ny.net # Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用,WSL 特定配置 # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) -# TODO: Test on WSL ### Variables ### export IS_WSL=true export ARCHFLAGS="-arch x86_64" -source $DOTFILES/wsl/winterop.zsh +source $DOTFILES/platforms/wsl/winterop.zsh ### Misc ### diff --git a/tools/zsh/mod/navi.zsh b/tools/zsh/mod/navi.zsh index 361d762..ef9682b 100644 --- a/tools/zsh/mod/navi.zsh +++ b/tools/zsh/mod/navi.zsh @@ -1,5 +1,5 @@ # $DOTFILES/tools/zsh/mod/navi.zsh -# Date: 2024-11-30 +# Date: 2024-12-01 # Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 @@ -19,13 +19,13 @@ eval "$(zoxide init zsh)" # Absolute navigation # alias dotfiles="cd $DOTFILES && ls" -# TODO: Test on WSL if [ "$IS_WSL" = true ]; then # IS_WSL is defined in $DOTFILES/platforms/wsl/zshrc - alias dt="cd /mnt/c/Users/$(whoami)/Desktop && ls" - alias doku="cd /mnt/c/Users/$(whoami)/Documents && ls" - alias down="cd /mnt/c/Users/$(whoami)/Downloads && ls" + winuser=$(whoami.exe | cut -d'\' -f2 | tr -d '\r') + alias dt="cd /mnt/c/Users/$winuser/Desktop && ls" + alias doku="cd /mnt/c/Users/$winuser/Documents && ls" + alias down="cd /mnt/c/Users/$winuser/Downloads && ls" alias src="cd /mnt/d/Source" - alias one="cd /mnt/c/Users/$(whoami)/OneDrive" + alias one="cd /mnt/c/Users/$winuser/OneDrive" alias gdrive="cd /mnt/g" else alias dt="cd $HOME/Desktop && ls" From 8306264bdbdea549aa82b3072e7da93bdc7f4666 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 1 Dec 2024 07:02:12 +0000 Subject: [PATCH 8/9] feat(pwsh): Windows Migration and optimize powershell scripts --- .vscode/settings.json | 2 +- ...mblink_unix.bash => set_symlink_unix.bash} | 4 + bootstrap/set_symlink_win.ps1 | 36 +++++++ platforms/win/.wslconfig | 12 --- .../win/Microsoft.PowerShell_profile.ps1 | 94 ++++++------------- platforms/win/wslconfig | 19 ++++ {tools/powershell => scripts}/Completions.ps1 | 0 {tools/powershell => scripts}/Scripts.ps1 | 32 +++---- tools/powershell/Aliases.ps1 | 31 ++---- tools/powershell/Environment.ps1 | 10 ++ tools/powershell/Navigation.ps1 | 21 ++--- tools/powershell/Prompt.ps1 | 13 ++- 12 files changed, 141 insertions(+), 133 deletions(-) rename bootstrap/{set_symblink_unix.bash => set_symlink_unix.bash} (93%) create mode 100644 bootstrap/set_symlink_win.ps1 delete mode 100644 platforms/win/.wslconfig create mode 100644 platforms/win/wslconfig rename {tools/powershell => scripts}/Completions.ps1 (100%) rename {tools/powershell => scripts}/Scripts.ps1 (96%) create mode 100644 tools/powershell/Environment.ps1 diff --git a/.vscode/settings.json b/.vscode/settings.json index abc78ff..24eb11a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "gitconfig": "git", "nvim/init.lua": "vim", "markdownlint.json": "markdownlint", - ".wslconfig": "settings", + "wslconfig": "settings", "skhdrc": "console" }, "material-icon-theme.folders.associations": { diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symlink_unix.bash similarity index 93% rename from bootstrap/set_symblink_unix.bash rename to bootstrap/set_symlink_unix.bash index 0b056ac..78c6dbc 100644 --- a/bootstrap/set_symblink_unix.bash +++ b/bootstrap/set_symlink_unix.bash @@ -1,4 +1,8 @@ #! /bin/bash +# $DOTFILES/bootstrap/set_symlink_unix.bash +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Set symlinks for Unix-like operating systems mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory # mkdir -p $WAKATIME_HOME diff --git a/bootstrap/set_symlink_win.ps1 b/bootstrap/set_symlink_win.ps1 new file mode 100644 index 0000000..fe3116e --- /dev/null +++ b/bootstrap/set_symlink_win.ps1 @@ -0,0 +1,36 @@ +# $DOTFILES\bootstrap\set_symlink_win.ps1 +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Set symlinks for dotfiles on Windows +# 在 Windows 上设置 dotfiles 的符号链接 + +$DOTFILES = Join-Path $env:UserProfile ".dotfiles" +$BASE_COMMON = Join-Path $DOTFILES "common" +$BASE_TOOLS = Join-Path $DOTFILES "tools" +$BASE_WIN = Join-Path $DOTFILES "platforms" "win" +$linkDots = @{ + "$BASE_WIN\wslconfig" = "$env:UserProfile\.wslconfig" + "$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml" + "$BASE_COMMON\condarc.yaml" = "$env:XDG_CONFIG_HOME\conda\.condarc" + "$BASE_COMMON\gitconfig" = "$env:UserProfile\.gitconfig" + "$BASE_COMMON\glow.yaml" = "$env:AppData\glow\glow.yml" + "$BASE_COMMON\haskeline" = "$env:UserProfile\.haskeline" + "$BASE_COMMON\ideavimrc" = "$env:XDG_CONFIG_HOME\ideavim\ideavimrc" + "$BASE_COMMON\lesskey" = "$env:LessKeyIn" + "$BASE_COMMON\npmrc" = "$env:NPM_CONFIG_USERCONFIG" + "$BASE_COMMON\NuGet.Config" = "$env:AppData\NuGet\NuGet.Config" + "$BASE_COMMON\obsidian.vimrc" = "$env:UserProfile\Obsidian\.obsidian.vimrc" + "$BASE_COMMON\pip.conf" = "$env:AppData\pip\pip.ini" + "$BASE_COMMON\vimrc" = "$env:Vim\_vimrc" + "$BASE_TOOLS\ipython" = "$env:IPYTHONDIR" + "$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim" +} + +# TODO: Auto create directories + +foreach ($target in $linkDots.Keys) { + $path = $linkDots[$target] + New-Item -ItemType SymbolicLink -Target $target -Path $path -Force +} + +New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force diff --git a/platforms/win/.wslconfig b/platforms/win/.wslconfig deleted file mode 100644 index 2166134..0000000 --- a/platforms/win/.wslconfig +++ /dev/null @@ -1,12 +0,0 @@ -# ~/.wslconfig -# New-Item -ItemType SymbolicLink -Path ~\.wslconfig -Target ~\.dotfiles\win\.wslconfig -[wsl2] -# networkingMode=mirrored -# dnsTunneling=true -# firewall=true -# autoProxy=true - -[experimental] -# requires dnsTunneling but are also OPTIONAL -bestEffortDnsParsing=true -hostAddressLoopback=true diff --git a/platforms/win/Microsoft.PowerShell_profile.ps1 b/platforms/win/Microsoft.PowerShell_profile.ps1 index f87965e..08a6cff 100644 --- a/platforms/win/Microsoft.PowerShell_profile.ps1 +++ b/platforms/win/Microsoft.PowerShell_profile.ps1 @@ -1,69 +1,30 @@ +# $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1 +# Date: 2024-12-01 +# Author: contact@js0ny.net +# PowerShell profile for Windows + ### Load Configs ### -$DOTFILES = "$HOME\.dotfiles" -Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_} -Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_} +$DOTFILES = Join-Path $HOME ".dotfiles" +Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_} ### Aliases ### -# Shell Equivalents # -Set-Alias "grep" "Select-String" -${function:which} = { (Get-Command $args[0]).Path } - -# Shell Configurations # -${function:shcfg} = { code $PROFILE } -${function:reload} = { & $PROFILE } -${function:pulldots} = { Set-Location -Path $DOTFILES && git pull } -Set-Alias "pwshcfg" "shcfg" - -# C & C++ # -# Set-Alias "cl" "clang" -# Set-Alias "clpp" "clang++" -# ${function:clang} = { clang -std=c99 $args[0] } -# ${function:clang++} = { clang -std=c++2b $args[0] } - -# WSL # -${function:wsl1} = {wsl.exe --distribution Arch} -${function:wsl2} = {wsl.exe --distribution Ubuntu-22.04} - -# Search Software # -function Find-AppPackageListRemote { - param( - [string]$Name - ) - if (-not $Name) { - Write-Host "Please provide a package name." - return - } - Write-Host "Searching for $Name..." - Write-Host "=== winget ===" - winget search $Name - Write-Host "=== choco ===" - choco search $Name -# Too slow! -# Write-Host "=== scoop ===" -# scoop search $Name -} -Set-Alias "pkgsearch" "Find-AppPackageListRemote" -function Get-AppPackageListLocal { - winget list - choco list - scoop list -} # Toggle Theme # -function Set-SystemTheme { - $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" - $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme" - if ($currentMode.AppsUseLightTheme -eq 1) { - Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0 - Write-Host "已切换到深色模式" - } - else { - Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1 - Write-Host "已切换到浅色模式" - } -} -Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`) +# TODO: Change to `bat` script implementation +# function Set-SystemTheme { +# $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" +# $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme" +# if ($currentMode.AppsUseLightTheme -eq 1) { +# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0 +# Write-Host "已切换到深色模式" +# } +# else { +# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1 +# Write-Host "已切换到浅色模式" +# } +# } +# Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`) # Miscs # @@ -98,13 +59,16 @@ If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") { #Remove-Variable __lastStartup #Remove-Variable _currentDate -# Use some unix commands -${function:tree} = { wsl tree $args} -${function:ln} = { coreutils.exe ln $args} -${function:la} = { lsd.exe -la $args} - # Set default applications + $Env:PAGER = "less" $Env:EDITOR = "code --wait" $Env:VISUAL = "code --wait" $Env:FILE_MANAGER = "dopus.exe" + + +${function:wsl2} = {wsl.exe --distribution Ubuntu} +${function:wini} = { winget install $args } +${function:winr} = { winget uninstall $args } +${function:wins} = { winget search $args } +${function:winu} = { winget upgrade $args } diff --git a/platforms/win/wslconfig b/platforms/win/wslconfig new file mode 100644 index 0000000..bd68ee5 --- /dev/null +++ b/platforms/win/wslconfig @@ -0,0 +1,19 @@ +# $DOTFILES\platforms\win\wslconfig +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2) +# 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络) + +# Location: ~/.wslconfig +# Linking: (PowerShell) +# New-Item -ItemType SymbolicLink -Path ~\.wslconfig -Target ~\.dotfiles\platforms\win\wslconfig +[wsl2] +# networkingMode=mirrored +# dnsTunneling=true +# firewall=true +# autoProxy=true + +[experimental] +# requires dnsTunneling but are also OPTIONAL +bestEffortDnsParsing=true +hostAddressLoopback=true diff --git a/tools/powershell/Completions.ps1 b/scripts/Completions.ps1 similarity index 100% rename from tools/powershell/Completions.ps1 rename to scripts/Completions.ps1 diff --git a/tools/powershell/Scripts.ps1 b/scripts/Scripts.ps1 similarity index 96% rename from tools/powershell/Scripts.ps1 rename to scripts/Scripts.ps1 index 2878059..49f47f0 100644 --- a/tools/powershell/Scripts.ps1 +++ b/scripts/Scripts.ps1 @@ -1,17 +1,17 @@ -function CsvToMarkdown { - param( [string]$csv) - $counter = 0 - $column = $csv.Split("`n")[0].Split(",").Length - $aHeader = " --- |" - $header = "|" + $aHeader * $column - $csv.replace(",", " | ").Split("`n") | ForEach-Object { - if ($counter -eq 0) { - Write-Output "| $_ |" - $counter++ - Write-Output $header - } - else { - Write-Output "| $_ |" - } - } +function CsvToMarkdown { + param( [string]$csv) + $counter = 0 + $column = $csv.Split("`n")[0].Split(",").Length + $aHeader = " --- |" + $header = "|" + $aHeader * $column + $csv.replace(",", " | ").Split("`n") | ForEach-Object { + if ($counter -eq 0) { + Write-Output "| $_ |" + $counter++ + Write-Output $header + } + else { + Write-Output "| $_ |" + } + } } \ No newline at end of file diff --git a/tools/powershell/Aliases.ps1 b/tools/powershell/Aliases.ps1 index 4f5741b..b835dc0 100644 --- a/tools/powershell/Aliases.ps1 +++ b/tools/powershell/Aliases.ps1 @@ -1,13 +1,16 @@ +# $DOTFILES/tools\powershell\Aliases.ps1 +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Aliases for PowerShell ### VARIABLES ### $EDITOR = "code" # Shell Equivalents # Set-Alias "touch" "New-Item" -${function:ll} = { Get-ChildItem -Force } +${function:l} = { Get-ChildItem -Force } +${function:tree} = { lsd.exe --tree $args } +Set-Alias "which" "Get-Command" # Shell Configurations # -${function:shcfg} = { code $PROFILE } -Set-Alias "pwshcfg" "shcfg" -${function:reload} = { . $PROFILE } ${function:pulldots} = { Set-Location -Path $DOTFILES && git pull } # Editors # @@ -16,31 +19,13 @@ Set-Alias "c" "code" Set-Alias "gvi" "neovide" # File Creation # -function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname } +function mkcd { param ( [string] $dirname) New-Item -ItemType Directory -Name $dirname && Set-Location $dirname } function tc { param ( [string] $filename) New-Item $filename && code $filename } function tv { param ( [string] $filename) New-Item $filename && nvim $filename } function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem } ### Dev ### -# .NET # -${function:csi} = { dotnet repl --default-kernel csharp} -${function:fsi} = { dotnet repl --default-kernel fsharp} - # Python & Conda # Set-Alias "py" "python" Set-Alias "ipy" "ipython" -${function:pyact} = { conda activate $args[0] } -${function:pydact} = { conda deactivate } -${function:pylsenvs} = { conda env list } -${function:pymkenv} = { conda create --name $args[0] } -${function:pyrmenv} = { conda remove --name $args[0] --all } - -# Winget # - -if ($isWindows) { - ${function:wini} = { winget install $args } - ${function:winr} = { winget uninstall $args } - ${function:wins} = { winget search $args } - ${function:winu} = { winget upgrade $args } -} diff --git a/tools/powershell/Environment.ps1 b/tools/powershell/Environment.ps1 new file mode 100644 index 0000000..cf43c80 --- /dev/null +++ b/tools/powershell/Environment.ps1 @@ -0,0 +1,10 @@ +# $DOTFILES/tools\powershell\Environment.ps1 +# Date: 2024-12-01 +# Author: contact@js0ny.net +# Sourced by Microsoft.PowerShell_profile.ps1 + + +# This file stores only environment variables that only called by +# interactive session. + +$env:IPYTHONDIR = "$env:AppData\ipython" diff --git a/tools/powershell/Navigation.ps1 b/tools/powershell/Navigation.ps1 index c4f120a..c5ad86e 100644 --- a/tools/powershell/Navigation.ps1 +++ b/tools/powershell/Navigation.ps1 @@ -1,15 +1,14 @@ # ${function:~} = { Set-Location -Path ~ } cd is better -${function:...} = { Set-Location -Path ..\.. } -${function:....} = { Set-Location -Path ..\..\.. } -${function:.....} = { Set-Location -Path ..\..\..\.. } -${function:......} = { Set-Location -Path ..\..\..\..\.. } +${function:...} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) } +${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) } +${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } +${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) } # Absolute navigation -${function:docs} = { Set-Location -Path ~/Documents } -${function:down} = { Set-Location -Path ~/Downloads } -${function:dt} = { Set-Location -Path ~/Desktop } -${function:mytmp} = { Set-Location -Path ~/Temp } -${function:one} = { Set-Location -Path ~/OneDrive } -${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem } +${function:docs} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Documents") } +${function:down} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Downloads") } +${function:dt} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Desktop") } +${function:one} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "OneDrive") } -Invoke-Expression (& { (zoxide init powershell | Out-String) }) \ No newline at end of file + +Invoke-Expression (& { (zoxide init powershell | Out-String) }) diff --git a/tools/powershell/Prompt.ps1 b/tools/powershell/Prompt.ps1 index 40806a3..e34817b 100644 --- a/tools/powershell/Prompt.ps1 +++ b/tools/powershell/Prompt.ps1 @@ -1,7 +1,10 @@ +# $DOTFILES/tools\powershell\Prompt.ps1 +# Date: 2024-12-01 +# Author: contact@js0ny.net # Use starship to set prompt -$ENV:STARSHIP_CONFIG = "$DOTFILES/.config/starship/starship_pwsh.toml" +$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml" -Invoke-Expression (&starship init powershell) +# Invoke-Expression (&starship init powershell) # Below is the backup of original prompt function # $promptTime = $true @@ -16,7 +19,7 @@ Invoke-Expression (&starship init powershell) # } # # UserInfo # $prompt += " $Env:Username @ $Env:Userdomain" -# # Directory +# # Directory # $promptCurrentDirectory = $(PWD).Path # $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~") # $prompt += "`e[0m in `e[33m$promptCurrentDirectory " @@ -81,7 +84,7 @@ Invoke-Expression (&starship init powershell) # # if ( $global:promptWeather ) { # # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY) # # } -# # Error on last command +# # Error on last command # ## TODO: Seems does not work # if ($?) { # $prompt += "`n`e[32m PS > `e[0m" @@ -89,4 +92,4 @@ Invoke-Expression (&starship init powershell) # $prompt += "`n`e[31m PS > `e[0m" # } # return $prompt -# } \ No newline at end of file +# } From 06ddd359a744812c848cb5b96e9cc31c1b2a4837 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 1 Dec 2024 07:07:57 +0000 Subject: [PATCH 9/9] sync: from macOS --- bootstrap/set_symblink_unix.bash | 6 +- platforms/mac/sketchybarrc | 13 +++- platforms/mac/skhdrc | 1 + platforms/mac/yabairc | 6 +- tools/nvim/lua/keymaps/language.lua | 2 + tools/nvim/lua/plugins/lsp.lua | 11 ++++ tools/nvim/lua/plugins/mod/obsidian-nvim.lua | 4 +- tools/yazi/config/keymap.toml | 69 ++++++++++++++++++++ tools/yazi/config/yazi.toml | 2 + tools/zsh/common.zshrc | 1 - tools/zsh/zshenv | 8 +++ 11 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 tools/yazi/config/keymap.toml create mode 100644 tools/yazi/config/yazi.toml diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symblink_unix.bash index 0b056ac..3dac67a 100644 --- a/bootstrap/set_symblink_unix.bash +++ b/bootstrap/set_symblink_unix.bash @@ -1,6 +1,7 @@ #! /bin/bash mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython -mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory +# Not support XDG_CONFIG_HOME but same directory +mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow # mkdir -p $WAKATIME_HOME # mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view mkdir -p $HOME/Obsidian @@ -22,6 +23,9 @@ ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl # $DOTFILES/tools ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim +ln -sf $DOTFILES/tools/yazi/config/keymap.toml ~/.config/yazi/keymap.toml +ln -sf $DOTFILES/tools/yazi/config/yazi.toml ~/.config/yazi/yazi.toml + if [ $(uname) = "Darwin"]; then mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar diff --git a/platforms/mac/sketchybarrc b/platforms/mac/sketchybarrc index bc8b5a6..7486611 100755 --- a/platforms/mac/sketchybarrc +++ b/platforms/mac/sketchybarrc @@ -17,7 +17,6 @@ PLUGIN_DIR="$CONFIG_DIR/plugins" # https://felixkratz.github.io/SketchyBar/config/tricks#color-picker sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000 - ##### Changing Defaults ##### # We now change some default values, which are applied to all further items. # For a full list of all available item properties see: @@ -82,14 +81,22 @@ sketchybar --add item chevron left \ # volume is registered. More info about the event system can be found here: # https://felixkratz.github.io/SketchyBar/config/events -sketchybar --add item clock right \ +sketchybar --add item clock center \ --set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \ --add item volume right \ --set volume script="$PLUGIN_DIR/volume.sh" \ --subscribe volume volume_change \ --add item battery right \ --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ - --subscribe battery system_woke power_source_change + --subscribe battery system_woke power_source_change \ + --add item apple_music right + +sketchybar --add item music right +sketchybar --set music \ + script="$PLUGIN_DIR/music.sh" \ + update_freq=5 \ + label.color=0xffd7ba7d \ + background.corner_radius=5 ##### Force all scripts to run the first time (never do this in a script) ##### sketchybar --update diff --git a/platforms/mac/skhdrc b/platforms/mac/skhdrc index 48e0bc8..2dc756f 100644 --- a/platforms/mac/skhdrc +++ b/platforms/mac/skhdrc @@ -33,3 +33,4 @@ shift + alt - e : \ shift + alt - i : \ yabai -m window --resize right:20:0 ; \ yabai -m window --resize left:20:0 + diff --git a/platforms/mac/yabairc b/platforms/mac/yabairc index d3fa357..a9d6b8d 100644 --- a/platforms/mac/yabairc +++ b/platforms/mac/yabairc @@ -31,13 +31,12 @@ yabai -m config \ window_animation_easing ease_out_circ \ window_opacity_duration 0.0 \ active_window_opacity 1.0 \ - normal_window_opacity 0.90 \ - window_opacity off \ + normal_window_opacity 0.70 \ + window_opacity on \ insert_feedback_color 0xffd75f5f \ split_ratio 0.50 \ split_type auto \ auto_balance off \ - top_padding 12 \ bottom_padding 12 \ left_padding 12 \ right_padding 12 \ @@ -48,4 +47,5 @@ yabai -m config \ mouse_action2 resize \ mouse_drop_action swap + echo "yabai configuration loaded.." diff --git a/tools/nvim/lua/keymaps/language.lua b/tools/nvim/lua/keymaps/language.lua index 0f8ad64..29f5d97 100644 --- a/tools/nvim/lua/keymaps/language.lua +++ b/tools/nvim/lua/keymaps/language.lua @@ -22,6 +22,8 @@ vim.api.nvim_create_autocmd("FileType", { pattern = "markdown", callback = function() set_markdown_keymaps(0) + vim.opt_local.shiftwidth = 2 + vim.opt_local.tabstop = 2 end, }) diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 2a35089..514a3c4 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -1,6 +1,17 @@ return { { import = "plugins.mod.lspconfig" }, + { "MeanderingProgrammer/render-markdown.nvim" }, + -- { + -- "OXY2DEV/markview.nvim", + -- lazy = false, -- Recommended + -- -- ft = "markdown" -- If you decide to lazy-load anyway + -- + -- dependencies = { + -- "nvim-treesitter/nvim-treesitter", + -- "nvim-tree/nvim-web-devicons" + -- } + -- }, { "williamboman/mason.nvim", config = true }, { "williamboman/mason-lspconfig.nvim", diff --git a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua index 528036e..48ed3a7 100644 --- a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua +++ b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua @@ -1,7 +1,7 @@ return { "epwalsh/obsidian.nvim", version = "*", -- recommended, use latest release instead of latest commit - lazy = true, + lazy = false, ft = "markdown", -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: -- event = { @@ -21,7 +21,7 @@ return { workspaces = { { name = "personal", - path = "/mnt/c/Users/citoy/Obsidian", + path = "~/Obsidian", }, }, completion = { diff --git a/tools/yazi/config/keymap.toml b/tools/yazi/config/keymap.toml new file mode 100644 index 0000000..0c889b3 --- /dev/null +++ b/tools/yazi/config/keymap.toml @@ -0,0 +1,69 @@ +# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/prepend_keymap.json" + +[manager] + +prepend_keymap = [ + + # Hopping + { on = "e", run = "arrow -1", desc = "Move cursor up" }, + { on = "n", run = "arrow 1", desc = "Move cursor down" }, + { on = "i", run = "enter", desc = "Enter the child directory" }, + { on = "I", run = "forward", desc = "Go forward to the next directory" }, + + # Seeking + { on = "E", run = "seek -5", desc = "Seek up 5 units in the preview" }, + { on = "N", run = "seek 5", desc = "Seek down 5 units in the preview" }, + + # Find + { on = "k", run = "find_arrow", desc = "Go to the next found" }, + { on = "K", run = "find_arrow --previous", desc = "Go to the previous found" }, + + +] + +[tasks] + +prepend_keymap = [ + { on = "e", run = "arrow -1", desc = "Move cursor up" }, + { on = "n", run = "arrow 1", desc = "Move cursor down" }, +] + +[select] + +prepend_keymap = [ + { on = "e", run = "arrow -1", desc = "Move cursor up" }, + { on = "n", run = "arrow 1", desc = "Move cursor down" }, +] + +[input] + +prepend_keymap = [ + # Mode + { on = "l", run = "insert", desc = "Enter insert mode" }, + { on = "L", run = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = "i", run = "move 1", desc = "Move forward a character" }, + { on = "j", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, +] + +[confirm] +prepend_keymap = [ + { on = "N", run = "close", desc = "Cancel the confirm" }, + + { on = "e", run = "arrow -1", desc = "Move cursor up" }, + { on = "n", run = "arrow 1", desc = "Move cursor down" }, +] + +[completion] + +prepend_keymap = [ +] + +[help] + +prepend_keymap = [ + # Navigation + { on = "e", run = "arrow -1", desc = "Move cursor up" }, + { on = "n", run = "arrow 1", desc = "Move cursor down" }, +] \ No newline at end of file diff --git a/tools/yazi/config/yazi.toml b/tools/yazi/config/yazi.toml new file mode 100644 index 0000000..a01d710 --- /dev/null +++ b/tools/yazi/config/yazi.toml @@ -0,0 +1,2 @@ +[manager] +show_hidden = true \ No newline at end of file diff --git a/tools/zsh/common.zshrc b/tools/zsh/common.zshrc index 8cac855..d5ee087 100644 --- a/tools/zsh/common.zshrc +++ b/tools/zsh/common.zshrc @@ -32,4 +32,3 @@ esac for file in $DOTFILES/tools/zsh/mod/*.zsh; do source $file done - diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index e78aa31..d84cf50 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -58,6 +58,14 @@ fi if command -v az > /dev/null; then export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure fi +# Bun JS +# mv ~/.bun $XDG_DATA_HOME/bun +# ln -sf $XDG_DATA_HOME/bun/bin/bun ~/.local/bin/bun +if command -v bun > /dev/null; then + export BUN_INSTALL="$XDG_DATA_HOME"/bun + export PATH="$BUN_INSTALL/bin:$PATH" + [ -s "$BUN_INSTALL/_bun" ] && source "$BUN_INSTALL/_bun" +fi # Cargo if command -v cargo > /dev/null; then export CARGO_HOME="$XDG_DATA_HOME"/cargo