implements multiple todos

This commit is contained in:
js0ny 2025-01-15 15:13:02 +00:00
parent ef7b5680fb
commit 2aee2088c4
24 changed files with 355 additions and 331 deletions

4
.gitignore vendored
View file

@ -31,10 +31,6 @@ common/fzfrc
.venv/ .venv/
platforms/win/komorebi/applications.json
gitconfig gitconfig
*.exe
spacemacs/ spacemacs/

View file

@ -9,29 +9,34 @@ $BASE_COMMON = Join-Path $DOTFILES "common"
$BASE_TOOLS = Join-Path $DOTFILES "tools" $BASE_TOOLS = Join-Path $DOTFILES "tools"
$BASE_WIN = Join-Path $DOTFILES "platforms" "win" $BASE_WIN = Join-Path $DOTFILES "platforms" "win"
$linkDots = @{ $linkDots = @{
"$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig" "$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig"
"$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml" "$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml"
"$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc" "$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc"
"$BASE_WIN\komorebi" = "$Env:KOMOREBI_CONFIG_HOME" "$BASE_WIN\komorebi" = "$Env:KOMOREBI_CONFIG_HOME"
"$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc" "$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc"
"$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig" "$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig"
"$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml" "$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml"
"$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline" "$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline"
"$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc" "$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc"
"$BASE_COMMON\lesskey" = "$Env:LessKeyIn" "$BASE_COMMON\lesskey" = "$Env:LessKeyIn"
"$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG" "$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG"
"$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config" "$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config"
"$BASE_COMMON\obsidian.vimrc" = "$Env:UserProfile\Obsidian\.obsidian.vimrc" "$BASE_COMMON\obsidian.vimrc" = "$Env:UserProfile\Obsidian\.obsidian.vimrc"
"$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini" "$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini"
"$BASE_COMMON\vimrc" = "$Env:Vim\_vimrc" "$BASE_COMMON\vimrc" = "$Env:Vim\_vimrc"
"$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR" "$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR"
"$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim" "$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim"
} }
# TODO: Auto create directories
foreach ($target in $linkDots.Keys) { foreach ($target in $linkDots.Keys) {
$path = $linkDots[$target] $path = $linkDots[$target]
# Auto create directories (Untested)
$dir = Split-Path $path
if (!(Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force
}
New-Item -ItemType SymbolicLink -Target $target -Path $path -Force New-Item -ItemType SymbolicLink -Target $target -Path $path -Force
} }

View file

@ -0,0 +1,12 @@
set -e
ZDOTDIR="${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}"
mkdir -p $ZDOTDIR/plugins
#plugins=(
# "zsh-autosuggestions"
# "zsh-syntax-highlighting"
# "zsh-history-substring-search"
#)
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting
git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search

View file

@ -134,9 +134,7 @@ alias netl="netstat -tulnp"
alias apt="sudo apt" alias apt="sudo apt"
alias apts="apt search" alias apts="apt search"
alias apti="sudo apt install" alias apti="sudo apt install"
aptr() { alias aptr="sudo apt remove"
sudo apt remove $1 || sudo apt autoremove
}
alias aptu="sudo apt upgrade && sudo apt update" alias aptu="sudo apt upgrade && sudo apt update"
alias l="ls -lah" alias l="ls -lah"

View file

@ -8,6 +8,6 @@
if [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$WAYLAND_DISPLAY" ]; then
alias clip="wl-copy" alias clip="wl-copy"
alias paste="wl-paste" alias paste="wl-paste"
else [ -n "$DISPLAY" ]; then elif [ -n "$DISPLAY" ]; then
alias clip="xclip" alias clip="xclip"
fi fi

View file

@ -152,3 +152,5 @@ end
# pnpm end # pnpm end
test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish
test -f /opt/miniconda3/etc/fish/conf.d/conda.fish && source /opt/miniconda3/etc/fish/conf.d/conda.fish

View file

@ -66,8 +66,11 @@ if command -v pacman > /dev/null
abbr --add paci "sudo pacman -S" abbr --add paci "sudo pacman -S"
abbr --add pacr "sudo pacman -R" abbr --add pacr "sudo pacman -R"
abbr --add pacu "sudo pacman -Syu" abbr --add pacu "sudo pacman -Syu"
abbr --add pacs "sudo pacman -Ss"
end end
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty" if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
abbr --add icat "kitten icat" abbr --add icat "kitten icat"
else if test "$TERM_PROGRAM" = "WezTerm"
abbr --add icat "wezterm imgcat"
end end

View file

@ -25,4 +25,4 @@ bind -M default 'i' forward-char
bind -M default -m insert l repaint-mode bind -M default -m insert l repaint-mode
bind -M default -m insert L beginning-of-line repaint-mode bind -M default -m insert L beginning-of-line repaint-mode
# TODO: Add more key bindings here fzf --fish | source

View file

@ -5,25 +5,8 @@
@Date 2024-11-27 @Date 2024-11-27
@Description neovim @Description neovim
]] ]]
-- 针对特定文件类型设置快捷键
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown", -- 指定文件类型
callback = function()
vim.api.nvim_buf_set_keymap(
0,
"v",
"`",
'c`<C-r>"`<Esc>',
{ noremap = true, silent = true, desc = "Wrap selection with backticks" }
)
end,
})
-- 加载配置
require("config.options") require("config.options")
-- 加载插件
require("config.plugins") require("config.plugins")
-- 加载主题
require("config.colorscheme") require("config.colorscheme")
-- 加载键位映射
require("config.keymaps") require("config.keymaps")

View file

@ -26,7 +26,7 @@
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" },
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" }, "nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
"nvim-treesitter": { "branch": "master", "commit": "984214ef8e4ca18d77639663319aabdfba89632f" }, "nvim-treesitter": { "branch": "master", "commit": "f0c928dbe93533b7e35894a8f957f40150d1f663" },
"nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" }, "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
@ -34,7 +34,7 @@
"orgmode": { "branch": "master", "commit": "4e4a14a7dd613953eddacbc0f0ff1583817d7de1" }, "orgmode": { "branch": "master", "commit": "4e4a14a7dd613953eddacbc0f0ff1583817d7de1" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"render-markdown.nvim": { "branch": "main", "commit": "d7b646f2e6136d963e1bd3abbb9e2ac3fa90837a" }, "render-markdown.nvim": { "branch": "main", "commit": "f0eb5893556200e9f945c0f0ea3c83bbd20dd963" },
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },

View file

@ -0,0 +1,55 @@
local M = {}
--- buffer that doesn't act as an editor or common buffer.
--- Use `q` to close the buffer.
local tmp_buf = {
"qf", -- quickfix
"crunner", -- code runner
}
local term_buf = {
"floaterm",
"term",
}
local term_mode = {
"n",
"i",
"t",
}
local term_keymaps = {
{ mode = term_mode, keys = "<C-q>", cmd = ":FloatermToggle", desc = "Exit terminal mode" },
}
M.tmp_buf_keymaps = {
{ mode = "n", keys = "q", cmd = "<Cmd>q<CR>", desc = "Close buffer" },
}
for _, buf in ipairs(tmp_buf) do
vim.api.nvim_create_autocmd("FileType", {
pattern = buf,
callback = function()
for _, map in ipairs(M.tmp_buf_keymaps) do
local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {})
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
end
end,
})
end
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*",
callback = function()
-- 检查当前 buffer 的 buftype
local buftype = vim.bo.buftype
if buftype == "terminal" then
for _, map in ipairs(term_keymaps) do
local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {})
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
end
end
end,
})
return M

View file

@ -1,26 +1,20 @@
local M = {} local M = {}
local keymaps_user_command = require("keymaps.user-command") local keymaps_user_command = require("keymaps.user-command")
local global_default_opts = { noremap = true, silent = true } local utils = require("keymaps.utils")
local global_default_mode = { "n" }
-- local mode_arrow = { "n", "v", "o", "s", "x" }
local function set_keymaps(maps, default_opts, default_mode)
for _, map in ipairs(maps) do
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
local mode = map.mode or default_mode
vim.keymap.set(mode, map.keys, map.cmd, opts)
end
end
local keymaps_basic = require("keymaps.basic")
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
local keymaps_leader = require("keymaps.leaders")
local keymaps_lsp = require("keymaps.lspkeys")
set_keymaps(keymaps_basic, global_default_opts, global_default_mode) local keymaps_general = vim.tbl_extend("force", {}, require("keymaps.leaders"), require("keymaps.lspkeys"))
set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode) -- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic`
set_keymaps(keymaps_leader, global_default_opts, global_default_mode) local keymaps_basic = require("keymaps.basic")
set_keymaps(keymaps_lsp, global_default_opts, global_default_mode) local keymaps_buffer = require("keymaps.buffer")
-- local keymaps_leader = require("keymaps.leaders")
-- local keymaps_lsp = require("keymaps.lspkeys")
utils.set_keymaps(keymaps_general)
utils.set_keymaps(keymaps_basic)
utils.set_keymaps(keymaps_nvim_tree_general)
utils.set_keymaps(keymaps_buffer)
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
@ -36,17 +30,17 @@ function M.cmp_nvim_keymaps(map)
} }
end end
local function set_markdown_keymaps(bufnr) -- local function set_markdown_keymaps(bufnr)
local opts = { noremap = true, silent = true, buffer = bufnr } -- local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts) -- vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts)
end -- end
vim.api.nvim_create_autocmd("FileType", { -- vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown", -- pattern = "markdown",
callback = function() -- callback = function()
set_markdown_keymaps(0) -- set_markdown_keymaps(0)
end, -- end,
}) -- })
-- which-key.nvim -- which-key.nvim
require("keymaps.which") require("keymaps.which")

View file

@ -25,27 +25,4 @@ vim.api.nvim_create_autocmd("FileType", {
end, end,
}) })
--- buffer that doesn't act as an editor or common buffer.
--- Use `q` to close the buffer.
local tmp_buf = {
"qf", -- quickfix
"crunner", -- code runner
}
M.tmp_buf_keymaps = {
{ mode = "n", keys = "q", cmd = "<Cmd>q<CR>", desc = "Close buffer" },
}
for _, buf in ipairs(tmp_buf) do
vim.api.nvim_create_autocmd("FileType", {
pattern = buf,
callback = function()
for _, map in ipairs(M.tmp_buf_keymaps) do
local opts = vim.tbl_extend("force", { buffer = 0 }, map.opts or {})
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
end
end,
})
end
return M return M

View file

@ -42,7 +42,7 @@ vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_mappings = { local leader_mappings = {
general = { general = {
{ keys = "<space>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } }, { keys = "<leader>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } },
{ keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } }, { keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } }, { keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } }, { keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
@ -51,6 +51,8 @@ local leader_mappings = {
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } }, { keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } }, { keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } }, { keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "!", cmd = ":FloatermToggle<CR>", opts = { desc = "" } },
}, },
b = { -- +buffer b = { -- +buffer
{ keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } }, { keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } },

View file

@ -0,0 +1,33 @@
local M = {}
-- local mode_arrow = { "n", "v", "o", "s", "x" }
local default_opts = { noremap = true, silent = true }
local default_mode = { "n" }
M.set_keymaps = function(maps)
for _, map in ipairs(maps) do
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
local mode = map.mode or default_mode
vim.keymap.set(mode, map.keys, map.cmd, opts)
end
end
M.set_lang_keymaps = function(maps)
vim.api.create_autocmd("FileType", {
pattern = maps.filetype,
callback = function()
M.set_keymaps(maps.keymaps)
end,
})
end
M.set_buf_keymaps = function(maps)
vim.api.create_autocmd("BufEnter", {
pattern = maps.filetype,
callback = function()
M.set_keymaps(maps.keymaps)
end,
})
end
return M

View file

@ -5,91 +5,3 @@
$ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "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
# # $promptWeather = $false
# function prompt {
# $prompt = "`e[35m"
# # Time
# if ($promptTime) {
# $promptTime = Get-Date -Format HH:mm
# $prompt += "`[$promptTime]"
# }
# # UserInfo
# $prompt += " $Env:Username @ $Env:Userdomain"
# # Directory
# $promptCurrentDirectory = $(PWD).Path
# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~")
# $prompt += "`e[0m in `e[33m$promptCurrentDirectory "
# # Git
# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") {
# $prompt += "`e[32m`u{e702} $(git branch --show-current)"
# }
# # Conda
# if ( $Env:CONDA_PROMPT_MODIFIER ) {
# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","")
# $pythonVersion = $(python --version).Split(" ")[1]
# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion"
# }
# # Programming Language (by Get-ChildItem)
# ## Python
# if (Test-Path -Path "$PWD\pyproject.toml") {
# $pythonVersion = $(python --version).Split(" ")[1]
# $prompt += " `e[33m`u{e73c} $pythonVersion"
# }
# ## Node.js
# if (Test-Path -Path "$PWD\package.json") {
# $nodeVersion = $(node --version)
# $prompt += " `e[32m`u{e3a0} $nodeVersion"
# # Locked
# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") {
# $prompt += "`u{f023}"
# }
# }
# ## .NET
# ### C Sharp
# if (Test-Path -Path "$PWD\*.csproj") {
# $dotnetVersion = $(dotnet --version)
# $prompt += " `e[34m`u{e648} $dotnetVersion"
# }
# ### F Sharp
# if (Test-Path -Path "$PWD\*.fsproj") {
# $dotnetVersion = $(dotnet --version)
# $prompt += " `e[35m`u{e65a} $dotnetVersion"
# }
# ## Rust
# if (Test-Path -Path "$PWD\Cargo.toml") {
# $rustVersion = $(cargo --version).Split(" ")[1]
# $prompt += " `e[31m`u{e7a8} $rustVersion"
# }
# ## Java
# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") {
# $javaVersion = $(java --version).Split(" ")[1]
# $prompt += " `e[31m`u{e738} $javaVersion"
# }
# ## Makefile
# if (Test-Path -Path "$PWD\Makefile") {
# $prompt += " `e[32m`u{e673}"
# }
# if (Test-Path -Path "$PWD\CMakeLists.txt") {
# $prompt += " `e[32m `u{e61d}"
# }
# # Docker
# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") {
# $prompt += " `e[33m`u{f21f}"
# }
# # Weather
# # if ( $global:promptWeather ) {
# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY)
# # }
# # Error on last command
# ## TODO: Seems does not work
# if ($?) {
# $prompt += "`n`e[32m PS > `e[0m"
# } else {
# $prompt += "`n`e[31m PS > `e[0m"
# }
# return $prompt
# }

View file

@ -380,37 +380,37 @@
// #region Terminal Control, use ^a as prefix / leader key // #region Terminal Control, use ^a as prefix / leader key
// tmux-like terminal control // tmux-like terminal control
{ // prefix + x : kill terminal { // prefix + x : kill terminal
"key": "ctrl+a x", "key": "ctrl+q x",
"command": "workbench.action.terminal.kill", "command": "workbench.action.terminal.kill",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + c : create new terminal { // prefix + c : create new terminal
"key": "ctrl+a c", "key": "ctrl+q c",
"command": "workbench.action.terminal.new", "command": "workbench.action.terminal.new",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + | : split terminal vertically { // prefix + | : split terminal vertically
"key": "ctrl+a shift+\\", "key": "ctrl+q shift+\\",
"command": "workbench.action.terminal.split", "command": "workbench.action.terminal.split",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + \ : split terminal vertically { // prefix + \ : split terminal vertically
"key": "ctrl+a \\", "key": "ctrl+q \\",
"command": "workbench.action.terminal.split", "command": "workbench.action.terminal.split",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + / : search { // prefix + / : search
"key": "ctrl+a /", "key": "ctrl+q /",
"command": "workbench.action.terminal.focusFind", "command": "workbench.action.terminal.focusFind",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + t : toggle terminal { // prefix + t : toggle terminal
"key": "ctrl+a t", "key": "ctrl+q t",
"command": "workbench.action.terminal.toggleTerminal", "command": "workbench.action.terminal.toggleTerminal",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ // prefix + ^a: show information { // prefix + ^a: show information
"key": "ctrl+a ctrl+a", "key": "ctrl+q ctrl+q",
"command": "workbench.action.terminal.focusHover", "command": "workbench.action.terminal.focusHover",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
}, },
@ -420,22 +420,22 @@
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
}, },
{ // prefix + 1 : focus terminal 1 { // prefix + 1 : focus terminal 1
"key": "ctrl+a 1", "key": "ctrl+q 1",
"command": "workbench.action.terminal.focusAtIndex1", "command": "workbench.action.terminal.focusAtIndex1",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
}, },
{ // prefix + 2 : focus terminal 2 { // prefix + 2 : focus terminal 2
"key": "ctrl+a 2", "key": "ctrl+q 2",
"command": "workbench.action.terminal.focusAtIndex2", "command": "workbench.action.terminal.focusAtIndex2",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
}, },
{ // prefix + 3 : focus terminal 3 { // prefix + 3 : focus terminal 3
"key": "ctrl+a 3", "key": "ctrl+q 3",
"command": "workbench.action.terminal.focusAtIndex3", "command": "workbench.action.terminal.focusAtIndex3",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus"
}, },
{ // prefix + g : Go to recent directory { // prefix + g : Go to recent directory
"key": "ctrl+a g", "key": "ctrl+q g",
"command": "workbench.action.terminal.goToRecentDirectory", "command": "workbench.action.terminal.goToRecentDirectory",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
@ -445,42 +445,42 @@
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ // prefix + d : detach terminal { // prefix + d : detach terminal
"key": "ctrl+a d", "key": "ctrl+q d",
"command": "workbench.action.terminal.detachSession", "command": "workbench.action.terminal.detachSession",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ // prefix + a : attach to session { // prefix + a : attach to session
"key": "ctrl+a a", "key": "ctrl+q a",
"command": "workbench.action.terminal.attachToSession", "command": "workbench.action.terminal.attachToSession",
"when": "terminalFocus" "when": "terminalFocus"
}, },
{ {
"key": "ctrl+a h", "key": "ctrl+q h",
"command": "workbench.action.terminal.focusPreviousPane", "command": "workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ {
"key": "ctrl+a i", "key": "ctrl+q i",
"command": "workbench.action.terminal.focusNextPane", "command": "workbench.action.terminal.focusNextPane",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ {
"key": "ctrl+a shift+H", "key": "ctrl+q shift+H",
"command": "workbench.action.terminal.resizePaneLeft", "command": "workbench.action.terminal.resizePaneLeft",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ {
"key": "ctrl+a shift+N", "key": "ctrl+q shift+N",
"command": "workbench.action.terminal.resizePaneDown", "command": "workbench.action.terminal.resizePaneDown",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ {
"key": "ctrl+a shift+E", "key": "ctrl+q shift+E",
"command": "workbench.action.terminal.resizePaneUp", "command": "workbench.action.terminal.resizePaneUp",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
}, },
{ {
"key": "ctrl+a shift+I", "key": "ctrl+q shift+I",
"command": "workbench.action.terminal.resizePaneRight", "command": "workbench.action.terminal.resizePaneRight",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
} }

View file

@ -0,0 +1,169 @@
" ~/.config/vscode/vscode.vimrc
" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc
" ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode/vscode.vimrc
" And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
" Arrow remap
noremap n j
noremap e k
noremap i l
" Switch between tabs
noremap H :bprevious<CR>
noremap I :bnext<CR>
noremap N 5j
noremap E 5k
" Similar position to i
" The `noremap` implements text-object-like behavior in VSCodeVim
noremap l i
noremap L I
" ne[k]st
noremap k n
noremap K N
" [j]ump
noremap j e
noremap J E
" Y to yank to end of line
noremap Y y$
" Define in settings.json, since this will remap <esc> under visual mode
" noremap <esc> :nohlsearch<CR>
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
" keep selection after indent (define in settings.json)
" voremap < <gv
" voremap > >gv
" lsp
noremap gi editor.action.goToImplementation
noremap gpi editor.action.peekImplementation
noremap gd editor.action.goToDefinition
noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover
noremap <leader><leader> workbench.action.quickOpen
noremap <leader>/ workbench.action.quickTextSearch
noremap <leader>: workbench.action.showCommands
noremap <leader>E workbench.view.explorer
noremap <leader>- workbench.action.splitEditorDown
noremap <leader>| workbench.action.splitEditorRight
noremap <leader>\ workbench.action.splitEditorRight
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
noremap <leader>ce editor.action.marker.next
noremap <leader>cE editor.action.marker.prev
noremap <leader>cg editor.action.dirtydiff.next
noremap <leader>cG editor.action.dirtydiff.previous
noremap <leader>cR editor.action.rename
" <leader>d : +debug
" <leader>f : +file
noremap <leader>ff workbench.action.quickOpen
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fo openInExternalApp.open
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
" Can only rename tracked files
noremap <leader>fR git.rename
" noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>h : +help
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>q : +quit
noremap <leader>qq :quit<CR>
noremap <leader>qQ :qall<CR>
noremap <leader>Q :quit<CR>
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>w : +write/window
noremap <leader>ww :write<CR>
noremap <leader>wa :wall<CR>
noremap <leader>wq :wq<CR>
noremap <leader>W :write<CR>
noremap <leader>wh workbench.action.focusLeftGroup
noremap <leader>wH workbench.action.splitEditorLeft
noremap <leader>wn workbench.action.focusBelowGroup
noremap <leader>wN workbench.action.splitEditorDown
noremap <leader>we workbench.action.focusAboveGroup
noremap <leader>wE workbench.action.splitEditorUp
noremap <leader>wi workbench.action.focusRightGroup
noremap <leader>wI workbench.action.splitEditorRight
noremap <leader>w- workbench.action.splitEditorDown
noremap <leader>w| workbench.action.splitEditorRight
noremap <leader>w\ workbench.action.splitEditorRight

View file

@ -4,6 +4,10 @@
" And go to vscode vim setting: " And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc", "vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
" Use VSpaceCode instead of <leader>
noremap <space> vspacecode.space
" Arrow remap " Arrow remap
noremap n j noremap n j
noremap e k noremap e k
@ -30,7 +34,8 @@ noremap J E
" Y to yank to end of line " Y to yank to end of line
noremap Y y$ noremap Y y$
noremap <esc> :nohlsearch<CR> " Define in settings.json, since this will remap <esc> under visual mode
" noremap <esc> :nohlsearch<CR>
" 分词版本的w和b支持中文需要插件 " 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap` " 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
@ -50,118 +55,3 @@ noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover noremap gh editor.action.showDefinitionPreviewHover
noremap <leader><leader> workbench.action.quickOpen
noremap <leader>/ workbench.action.quickTextSearch
noremap <leader>: workbench.action.showCommands
noremap <leader>E workbench.view.explorer
noremap <leader>- workbench.action.splitEditorDown
noremap <leader>| workbench.action.splitEditorRight
noremap <leader>\ workbench.action.splitEditorRight
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
noremap <leader>ce editor.action.marker.next
noremap <leader>cE editor.action.marker.prev
noremap <leader>cg editor.action.dirtydiff.next
noremap <leader>cG editor.action.dirtydiff.previous
noremap <leader>cR editor.action.rename
" <leader>d : +debug
" <leader>f : +file
noremap <leader>ff workbench.action.quickOpen
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fo openInExternalApp.open
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
" Can only rename tracked files
noremap <leader>fR git.rename
" noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>h : +help
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>q : +quit
noremap <leader>qq :quit<CR>
noremap <leader>qQ :qall<CR>
noremap <leader>Q :quit<CR>
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>w : +write/window
noremap <leader>ww :write<CR>
noremap <leader>wa :wall<CR>
noremap <leader>wq :wq<CR>
noremap <leader>W :write<CR>
noremap <leader>wh workbench.action.focusLeftGroup
noremap <leader>wH workbench.action.splitEditorLeft
noremap <leader>wn workbench.action.focusBelowGroup
noremap <leader>wN workbench.action.splitEditorDown
noremap <leader>we workbench.action.focusAboveGroup
noremap <leader>wE workbench.action.splitEditorUp
noremap <leader>wi workbench.action.focusRightGroup
noremap <leader>wI workbench.action.splitEditorRight
noremap <leader>w- workbench.action.splitEditorDown
noremap <leader>w| workbench.action.splitEditorRight
noremap <leader>w\ workbench.action.splitEditorRight

View file

@ -210,7 +210,6 @@ config.mouse_bindings = {
--#region Environment --#region Environment
config.set_environment_variables = { config.set_environment_variables = {
WEZTERM = "true", -- for `icat`
} }
--#endregion --#endregion

View file

@ -83,7 +83,7 @@ if command -v apt > /dev/null; then
alias apt="sudo apt" alias apt="sudo apt"
alias apti="sudo apt install" alias apti="sudo apt install"
alias aptu="sudo apt update && sudo apt upgrade" alias aptu="sudo apt update && sudo apt upgrade"
alias aptr="sudo apt autoremove && sudo apt remove" alias aptr="sudo apt remove"
fi fi
if command -v brew > /dev/null; then if command -v brew > /dev/null; then

View file

@ -38,8 +38,4 @@ done
# Use `set -k` to mark leading `#` as a comment character # Use `set -k` to mark leading `#` as a comment character
set -k set -k
# # TODO: Below should be reorganized source <(fzf --zsh)
# export PATH=$HOME/.local/bin:$PATH
# export NVM_DIR="$HOME/.config/nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

View file

@ -37,9 +37,7 @@ bindkey '^B' backward-char
bindkey '^P' up-line-or-history bindkey '^P' up-line-or-history
bindkey '^N' down-line-or-history bindkey '^N' down-line-or-history
bindkey '^R' history-incremental-search-backward bindkey '^R' history-incremental-search-backward
# TODO: did not test
bindkey '^K' kill-line bindkey '^K' kill-line
bindkey '^X^E' edit-command-line
# LEADER CONVENTION # LEADER CONVENTION
# ^X defines as a prefix key in shell # ^X defines as a prefix key in shell

View file

@ -158,7 +158,7 @@ if command -v z > /dev/null; then
fi fi
# zsh .zcompdump # zsh .zcompdump
# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" # compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
# Vcpkg TODO: Move vcpkg path # Vcpkg
if command -v vcpkg > /dev/null; then if command -v vcpkg > /dev/null; then
export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg
fi fi