Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
whoami 2025-04-10 23:21:07 +01:00
commit 5e26e71219
136 changed files with 4129 additions and 1449 deletions

View file

@ -5,6 +5,8 @@
# ln -sf $DOTFILES/tools/bash/bashrc ~/.bashrc
export DOTFILES=$HOME/.dotfiles
# Force to choose English font name
export LC_CTYPE=en_GB.UTF-8
if [ -n "$WSL_DISTRO_NAME" ]; then
alias clip="clip.exe"

View file

@ -42,8 +42,11 @@ minimal_path=(
"/usr/local/sbin"
"$HOME/.local/bin"
"$HOME/.local/sbin"
"$HOME/.local/scripts"
)
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
for p in "${minimal_path[@]}"; do
pathadd "$p"
done

View file

@ -8,9 +8,9 @@
# Set XDG Base Directory Path
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="~/.cache"
export XDG_DATA_HOME="~/.local/share"
export XDG_STATE_HOME="~/.local/state"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
# Source user's XDG-compliant Bash configs

View file

@ -341,6 +341,16 @@ mapkey("yY", "yank link without parameter", function () {
Clipboard.write(url.origin + url.pathname);
});
unmap("yma")
unmap("ymc")
unmap("ymv")
map("ym", "yank link as markdown", function () {
const url = new URL(window.location.href);
const title = document.title;
Clipboard.write(`[${title}](${url.origin + url.pathname})`);
});
// #region bilibili.com
mapkey(
",n",

View file

@ -22,20 +22,20 @@
;; accept. For example:
;;
;; https://emacs-china.org/t/doom-emacs/23513/13
(setq doom-font (font-spec :family "Iosevka Nerd Font Propo" :size 14)
(setq doom-font (font-spec :family "Sarasa Mono SC Nerd Font" :size 14)
doom-serif-font doom-font
doom-symbol-font (font-spec :family "LXGW WenKai Mono")
doom-variable-pitch-font (font-spec :family "LXGW WenKai Mono" :weight 'extra-bold))
doom-symbol-font (font-spec :family "Sarasa Mono SC Nerd Font")
doom-variable-pitch-font (font-spec :family "Sarasa Mono SC Nerd Font" :weight 'extra-bold))
;; 如果不把这玩意设置为 nil, 会默认去用 fontset-default 来展示, 配置无效
(setq use-default-font-for-symbols nil)
;; Doom 的字体加载顺序问题, 如果不设定这个 hook, 配置会被覆盖失效
(add-hook! 'after-setting-font-hook
(set-fontset-font t 'latin (font-spec :family "Iosevka Nerd Font Propo"))
(set-fontset-font t 'symbol (font-spec :family "Symbola"))
(set-fontset-font t 'mathematical (font-spec :family "Symbola"))
(set-fontset-font t 'emoji (font-spec :family "Symbola")))
;;(add-hook! 'after-setting-font-hook
;; (set-fontset-font t 'latin (font-spec :family "Iosevka Nerd Font Propo"))
;; (set-fontset-font t 'symbol (font-spec :family "Symbola"))
;; (set-fontset-font t 'mathematical (font-spec :family "Symbola"))
;; (set-fontset-font t 'emoji (font-spec :family "Symbola")))
;; (dolist (charset '(kana han cjk-misc bopomofo))
;; (set-fontset-font t charset (font-spec :family "LXGW WenKai Mono" :size 16)))
@ -133,10 +133,12 @@
(if (eq system-type 'gnu/linux)
(use-package! rime
:config
(setq default-input-method "rime")
(add-hook! (org-mode markdown-mode) (activate-input-method default-input-method))
(setq rime-user-data-dir (expand-file-name "emacs-rime" (getenv "XDG_CONFIG_HOME")))
:custom
(rime-user-data-dir (expand-file-name "emacs-rime" (getenv "XDG_CONFIG_HOME")))
; (rime-share-data-dir "~/.local/share/fcitx5/rime")
(default-input-method "rime")
;; :config
;; (add-hook! (org-mode markdown-mode) (activate-input-method default-input-method))
))
(load! "calendar.el")

View file

@ -15,7 +15,7 @@
(save-excursion (insert char ?\u200B)))
;; Directory
(setq org-archive-location "~/OrgFiles/archive/%s_archive::")
(setq org-archive-location "~/OrgFiles/.archive/%s_archive::")
(setq org-default-notes-file "~/OrgFiles/tasks/inbox.org")
;; Initial Visibility

View file

@ -26,3 +26,5 @@ bookmarks
.cache
eln-cache
org-persist
local.el

View file

@ -44,8 +44,10 @@
(global-evil-leader-mode)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"b" 'buffer-menu
"ft" 'treemacs))
"ft" 'treemacs
"fc" '(dired user-emacs-directory)
"b" 'buffer-menu
))
;; Evil Commentary: Use gc<action> to toggle comments
(use-package evil-commentary

View file

@ -22,6 +22,10 @@
(org-directory "~/OrgFiles/")
(org-agenda-files (list (concat org-directory "tasks/")))
(org-persist-directory (expand-file-name "org-persist" user-emacs-data))
(org-archive-location "~/OrgFiles/.archive/%s_archive::")
(org-default-notes-file "~/OrgFiles/tasks/inbox.org")
(org-startup-folded "show2levels")
(org-log-into-drawer "LOGBOOK")
(org-pretty-entities t)
(org-src-fontify-natively t)
(org-src-tab-acts-natively t) ; Use TAB to indent inside source block
@ -94,13 +98,13 @@
;; For CJK users
;; Insert zero width space around the emphasis symbols, this might be useful for
;; languages that does not rely on space
(defun my/insert-emphasis-with-zws (char)
(defun js0ny/insert-emphasis-with-zws (char)
(interactive "c")
(insert ?\u200B char)
(save-excursion (insert char ?\u200B)))
(global-set-key (kbd "C-c b") (lambda () (interactive) (my/insert-emphasis-with-zws ?*)))
(global-set-key (kbd "C-c i") (lambda () (interactive) (my/insert-emphasis-with-zws ?/)))
(global-set-key (kbd "C-c b") (lambda () (interactive) (js0ny/insert-emphasis-with-zws ?*)))
(global-set-key (kbd "C-c i") (lambda () (interactive) (js0ny/insert-emphasis-with-zws ?/)))
;; Pomodoro for org clock
(use-package org-pomodoro)
@ -209,7 +213,7 @@
;; Integrate Emacs Timer with System Notifications
;; 定义通知函数
(defun my/org-clock-notification (title message &optional icon)
(defun js0ny/org-clock-notification (title message &optional icon)
"发送一个系统通知"
(alert message
:title title
@ -217,7 +221,7 @@
:category 'org-clock))
;; 添加定时器检查函数
(defun my/org-clock-check-timer ()
(defun js0ny/org-clock-check-timer ()
"检查当前正在运行的 clock 是否到期"
(when (org-clocking-p)
(let* ((clocked-time (org-clock-get-clocked-time))
@ -226,45 +230,24 @@
"0")))
(remaining (- effort clocked-time)))
(when (and (> effort 0) (<= remaining 0))
(my/org-clock-notification
(js0ny/org-clock-notification
"Org Clock 提醒"
(format "任务 '%s' 的预计时间已到!"
(org-clock-get-clock-string)))))))
;; 设置定时器,每分钟检查一次
(run-with-timer 0 60 #'my/org-clock-check-timer)
(run-with-timer 0 60 #'js0ny/org-clock-check-timer)
;; 在 org-clock-in-hook 中添加检查
(add-hook 'org-clock-in-hook
(lambda ()
(let ((effort (org-entry-get (point) "Effort")))
(when effort
(my/org-clock-notification
(js0ny/org-clock-notification
"开始计时"
(format "开始计时任务: %s\n预计用时: %s"
(org-get-heading t t t t)
effort))))))
(use-package org-roam
:ensure t
:custom
(org-roam-directory (file-truename (concat org-directory "roam")))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today))
:config
;; If you're using a vertical completion framework, you might want a more informative completion interface
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
(setq org-roam-db-location (expand-file-name "org-roam.db" user-emacs-data))
(org-roam-db-autosync-mode)
;; If using org-roam-protocol
(require 'org-roam-protocol))
(provide 'init-org)

View file

@ -1,3 +1,4 @@
fish_variables
completions
functions/br.fish
functions/dotenv.fish

View file

@ -23,13 +23,14 @@ else
set -gx XDG_RUNTIME_DIR /run/user/(id -u)
end
set -gx GHCUP_USE_XDG_DIRS 1
set -gx PAGER "less -R"
set -gx EDITOR nvim
set -gx VISUAL nvim
# Minimal PATH for early commands
for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin"
for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin" /opt/share/bin
if test -d "$dir" -a ! -L "$dir"
fish_add_path "$dir"
end

View file

@ -141,6 +141,16 @@ if command -v apt > /dev/null
abbr --add aptl "apt list --installed"
end
if command -v dnf > /dev/null
abbr --add dnf "sudo dnf"
abbr --add dnfi "sudo dnf install"
abbr --add dnfr "sudo dnf remove"
abbr --add dnfu "sudo dnf update"
abbr --add dnfs "dnf search"
abbr --add dnfl "dnf list --installed"
end
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
abbr --add icat "kitten icat"
else if test "$TERM_PROGRAM" = "WezTerm"

View file

@ -6,6 +6,7 @@
## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# Accent: Lavender #B4BEFE
# The basic colors
@ -32,16 +33,16 @@ macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111B
active_tab_background #CBA6F7
active_tab_background #B4BEFE
inactive_tab_foreground #CDD6F4
inactive_tab_background #181825
tab_bar_background #11111B
inactive_tab_background #1E1E2E
tab_bar_background #181825
# Colors for marks (marked text in the terminal)
mark1_foreground #1E1E2E
mark1_background #B4BEFE
mark2_foreground #1E1E2E
mark2_background #CBA6F7
mark2_background #B4BEFE
mark3_foreground #1E1E2E
mark3_background #74C7EC

View file

@ -3,10 +3,10 @@
# Fonts {{{
# Family
font_family family="Iosevka Nerd Font"
bold_font auto
italic_font auto
bold_italic_font auto
font_family family="Maple Mono NF CN"
bold_font auto
italic_font auto
bold_italic_font auto
# Ligature
disable_ligatures never
@ -77,3 +77,6 @@ map ctrl+q>shift+I kitten window.py -resize right
map cmd+enter toggle_layout stack
map ctrl+shift+enter toggle_layout stack
# }}}
shell fish

View file

@ -16,6 +16,7 @@ else -- Vanilla neovim
end
require("config.keymaps")
require("config.diagnostics")
require("config.migration")
-- If current session is spawn by neovide, do:
if vim.g.neovide then

15
tools/nvim/lsp/bashls.lua Normal file
View file

@ -0,0 +1,15 @@
-- Bash
--[[ Installation
brew install bash-language-server
npm i -g bash-language-server
dnf install -y nodejs-bash-language-server # Fedora Linux
--]]
return {
cmd = { "bash-language-server", "start" },
filetypes = { "bash", "sh" },
settings = {
bashIde = {
globPattern = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)",
},
},
}

View file

@ -0,0 +1,16 @@
-- Beancount
--[[ Installation:
Dependency:
uv tool install beancount
LSP:
cargo install beancount-language-server
brew install beancount-language-server
--]]
return {
cmd = { "beancount-language-server" },
filetypes = { "beancount" },
settings = {
},
}

30
tools/nvim/lsp/clangd.lua Normal file
View file

@ -0,0 +1,30 @@
-- C/C++
-- Clangd requires compile_commands.json to work and the easiest way to generate it is to use CMake.
-- How to use clangd C/C++ LSP in any project: https://gist.github.com/Strus/042a92a00070a943053006bf46912ae9
return {
cmd = {
"clangd",
"--clang-tidy",
"--header-insertion=iwyu",
"--completion-style=detailed",
"--function-arg-placeholders",
"--fallback-style=none",
},
filetypes = { "c", "cpp" },
root_markers = {
".clangd",
".clang-format",
"compile_commands.json",
"compile_flags.txt",
".git",
},
capabilities = {
textDocument = {
completion = {
editsNearCursor = true,
},
},
offsetEncoding = { "utf-8", "utf-16" },
},
}

19
tools/nvim/lsp/gopls.lua Normal file
View file

@ -0,0 +1,19 @@
-- Golang
--[[ Installation
go install golang.org/x/tools/gopls@latest
brew install gopls
--]]
return {
cmd = { "gopls" },
filetypes = { "go", "gomod", "gowork", "gotmpl" },
root_markers = { "go.work", "go.mod", ".git" },
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
-- semanticTokens = true, -- go's semantic token highlight is not accurate so far
},
},
}

18
tools/nvim/lsp/jsonls.lua Normal file
View file

@ -0,0 +1,18 @@
-- JSON
--[[
npm i vscode-json-languageserver
--]]
return {
cmd = { "vscode-json-language-server", "--stdio" },
filetypes = { "json", "jsonc" },
root_markers = { ".git" },
init_options = {
provideFormatter = true,
},
settings = {
-- See setting options
-- https://github.com/microsoft/vscode/tree/main/extensions/json-language-features/server#settings
json = {
},
},
}

37
tools/nvim/lsp/luals.lua Normal file
View file

@ -0,0 +1,37 @@
-- Lua
--[[ Installation
scoop install lua-language-server
brew install lua-language-server
sudo port install lua-language-server
--]]
--[[ Build: Ninja & C++17 Required
git clone https://github.com/LuaLS/lua-language-server --depth 1
cd lua-language-server
./make.sh
--]]
--[[ Note: For building from source, wrapper script is required
Accompanied with a wrapper script
#!/bin/bash
exec "$HOME/.local/build/lua-language-server/bin/lua-language-server" "$@"
--]]
return {
cmd = { "lua-language-server" },
root_markers = {
".luarc.json",
".luarc.jsonc",
".luacheckrc",
".stylua.toml",
"stylua.toml",
"selene.toml",
"selene.yml",
},
filetypes = { "lua" },
settings = {
Lua = {
hint = {
enable = true,
setType = true,
},
},
},
}

View file

@ -0,0 +1,15 @@
-- Markdown PKM
--[[ Installation:
cargo install --locked --git https://github.com/Feel-ix-343/markdown-oxide.git markdown-oxide
--]]
return {
cmd = { "markdown-oxide" },
root_markers = {
".obsidian",
},
filetypes = { "markdown" },
settings = {
Markdown = {
},
},
}

View file

@ -0,0 +1,27 @@
-- Python
--[[ Installation
uv tool install pyright
--]]
return {
cmd = { "pyright-langserver", "--stdio" },
filetypes = { "python" },
root_markers = {
".python_version",
"pyproject.toml",
"setup.py",
"setup.cfg",
"requirements.txt",
"Pipfile",
"pyrightconfig.json",
".git",
},
settings = {
python = {
analysis = {
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
},
},
},
}

View file

@ -0,0 +1,33 @@
-- Rust
--[[ Installation
rustup component add rust-src
--]]
return {
cmd = { "rust-analyzer" },
filetypes = { "rust" },
root_dir = function(bufnr, cb)
local root = vim.fs.root(bufnr, { "Cargo.toml" })
if root then
vim.system({ "cargo", "metadata", "--no-depts", "--format-version", "1" }, { cwd = root }, function(obj)
if obj.code ~= 0 then
cb(root)
else
local success, result = pcall(vim.json.decode, obj.stdout)
if success and result.workspace_root then
cb(result.workspace_root)
else
cb(root)
end
end
end)
else
cb(vim.fs.root(bufnr, { "rust-project.json", ".git" }))
end
end,
before_init = function(init_params, config)
-- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26
if config.settings and config.settings["rust-analyzer"] then
init_params.initializationOptions = config.settings["rust-analyzer"]
end
end,
}

32
tools/nvim/lsp/taplo.lua Normal file
View file

@ -0,0 +1,32 @@
-- TOML
--[[ Installation
cargo install taplo-cli --locked
brew install taplo
pnpm install -g @taplo/cli
--]]
return {
cmd = { "taplo", "lsp", "stdio" },
filetypes = { "toml" },
root_markers = { ".git" },
settings = {
-- See all the setting options
-- https://github.com/tamasfe/taplo/blob/master/editors/vscode/package.json
evenBetterToml = {
taplo = {
configFile = {
enabled = true,
},
},
schema = {
enabled = true,
catalogs = {
"https://www.schemastore.org/api/json/catalog.json",
},
cache = {
memoryExpiration = 60,
diskExpiration = 600,
},
},
},
},
}

19
tools/nvim/lsp/vimls.lua Normal file
View file

@ -0,0 +1,19 @@
return {
cmd = { "vim-language-server", "--stdio" },
filetypes = { "vim" },
root_markers = { ".git" },
init_options = {
isNeovim = true,
iskeyword = "@,48-57,_,192-255,-#",
vimruntime = "",
runtimepath = "",
diagnostic = { enable = true },
indexes = {
runtimepath = true,
gap = 100,
count = 3,
projectRootPatterns = { "runtime", "nvim", ".git", "autoload", "plugin" },
},
suggest = { fromVimruntime = true, fromRuntimepath = true },
},
}

View file

@ -0,0 +1,9 @@
return {
cmd = { "yaml-language-server", "--stdio" },
filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" },
root_markers = { ".git" },
settings = {
yaml = {
},
},
}

View file

@ -1,2 +1,2 @@
-- Change the colorscheme here, use SPACE u i or :Telescope colorscheme to change colorscheme
-- Change the colorscheme here, use SPACE u i or :FzfLua colorscheme to change colorscheme
vim.cmd.colorscheme("catppuccin")

View file

@ -0,0 +1,31 @@
local nvim_version = vim.version()
if nvim_version.minor ~= 11 then
return
end
vim.diagnostic.config({
virtual_lines = true,
})
-- vim.lsp.enable({
-- "clangd",
-- "luals",
-- })
local lsp_configs = {}
for _, v in ipairs(vim.api.nvim_get_runtime_file('lsp/*', true)) do
local name = vim.fn.fnamemodify(v, ':t:r')
lsp_configs[name] = true
end
vim.lsp.enable(vim.tbl_keys(lsp_configs))
-- Delete 0.11 new gr- keymaps
vim.keymap.del({ "n" }, "grn")
vim.keymap.del({ "n", "x" }, "gra")
vim.keymap.del({ "n" }, "gri")

View file

@ -5,27 +5,20 @@ local M = {}
-- Ensure that the following servers are installed and set
-- Use :Mason to list all available servers
M.servers = {
"bashls", -- Bash
"clangd", -- C/C++
"cssls", -- CSS
-- "cmake", -- CMake
"eslint", -- JavaScript
"html", -- HTML
"jsonls", -- JSON
"lua_ls", -- Lua
"markdown_oxide", -- Markdown
"omnisharp", -- C# & F#
"powershell_es", -- PowerShell
"pyright", -- Python
"rust_analyzer", -- Rust
"svelte", -- Svelte
"svlangserver", -- SystemVerilog
"tailwindcss", -- TailwindCSS
"taplo", -- TOML
"ts_ls", -- TypeScript
"vimls", -- vimscript
"yamlls", -- YAML
"beancount", -- Beancount
"bashls", -- Bash
"clangd", -- C/C++
"gopls", -- Go
"html", -- HTML
"jsonls", -- JSON
"lua_ls", -- Lua
-- "markdown_oxide", -- Markdown
"pyright", -- Python
"rust_analyzer", -- Rust
"taplo", -- TOML
"ts_ls", -- TypeScript
"vimls", -- vimscript
"yamlls", -- YAML
"beancount", -- Beancount
}
-- Configuration for each server defines here

View file

@ -42,61 +42,61 @@ vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_mappings = {
general = {
{ 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" } },
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up 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 = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
{ 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" } },
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up 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 = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
},
b = { -- +buffer
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "1", cmd = ":BufferLineGotoBuffer 1<CR>", opts = { desc = "Switch to Buffer #1" } },
{ keys = "2", cmd = ":BufferLineGotoBuffer 2<CR>", opts = { desc = "Switch to Buffer #2" } },
{ keys = "3", cmd = ":BufferLineGotoBuffer 3<CR>", opts = { desc = "Switch to Buffer #3" } },
{ keys = "4", cmd = ":BufferLineGotoBuffer 4<CR>", opts = { desc = "Switch to Buffer #4" } },
{ keys = "5", cmd = ":BufferLineGotoBuffer 5<CR>", opts = { desc = "Switch to Buffer #5" } },
{ keys = "6", cmd = ":BufferLineGotoBuffer 6<CR>", opts = { desc = "Switch to Buffer #6" } },
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xh", cmd = ":BufferLineCloseLeft<CR>", opts = { desc = "Delete Buffers Left" } },
{ keys = "xi", cmd = ":BufferLineCloseRight<CR>", opts = { desc = "Delete Buffers Right" } },
{ keys = "X", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "s", cmd = ":new<CR>", opts = { desc = "Scratch buffers" } },
{ keys = "t", cmd = ":BufferLineTogglePin<CR>", opts = { desc = "Pin Buffer" } },
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
{ keys = "1", cmd = ":BufferLineGotoBuffer 1<CR>", opts = { desc = "Switch to Buffer #1" } },
{ keys = "2", cmd = ":BufferLineGotoBuffer 2<CR>", opts = { desc = "Switch to Buffer #2" } },
{ keys = "3", cmd = ":BufferLineGotoBuffer 3<CR>", opts = { desc = "Switch to Buffer #3" } },
{ keys = "4", cmd = ":BufferLineGotoBuffer 4<CR>", opts = { desc = "Switch to Buffer #4" } },
{ keys = "5", cmd = ":BufferLineGotoBuffer 5<CR>", opts = { desc = "Switch to Buffer #5" } },
{ keys = "6", cmd = ":BufferLineGotoBuffer 6<CR>", opts = { desc = "Switch to Buffer #6" } },
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "xh", cmd = ":BufferLineCloseLeft<CR>", opts = { desc = "Delete Buffers Left" } },
{ keys = "xi", cmd = ":BufferLineCloseRight<CR>", opts = { desc = "Delete Buffers Right" } },
{ keys = "X", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
{ keys = "s", cmd = ":new<CR>", opts = { desc = "Scratch buffers" } },
{ keys = "t", cmd = ":BufferLineTogglePin<CR>", opts = { desc = "Pin Buffer" } },
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
},
c = { -- +code/compile
{ keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
},
f = { -- +file/find
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
{ keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
{ keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
{ keys = "yy", cmd = ":let @+ = expand('%:p')<CR>", opts = { desc = "Copy file path" } },
{ keys = "yY", cmd = ":let @+ = expand('%')<CR>", opts = { desc = "Copy relative file path" } },
{ keys = "yn", cmd = ":let @+ = expand('%:t')<CR>", opts = { desc = "Copy file name" } },
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
-- { keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
-- { keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
{ keys = "yy", cmd = ":let @+ = expand('%:p')<CR>", opts = { desc = "Copy file path" } },
{ keys = "yY", cmd = ":let @+ = expand('%')<CR>", opts = { desc = "Copy relative file path" } },
{ keys = "yn", cmd = ":let @+ = expand('%:t')<CR>", opts = { desc = "Copy file name" } },
{ keys = "yN", cmd = ":let @+ = expand('%:t:r')<CR>", opts = { desc = "Copy file name without extension" } },
{ keys = "yd", cmd = ":let @+ = expand('%:p:h')<CR>", opts = { desc = "Copy directory path" } },
{
@ -118,37 +118,37 @@ local leader_mappings = {
p = { -- +project
},
q = { -- +quit
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", opts = { desc = "Write all and Force Quit" } },
},
t = { -- +toggle/test
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
},
u = { -- +ui
{ keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } },
},
w = { -- +window
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "H", cmd = "<C-w>H", opts = { desc = "Move Window Left" } },
{ keys = "N", cmd = "<C-w>J", opts = { desc = "Move Window Down" } },
{ keys = "E", cmd = "<C-w>K", opts = { desc = "Move Window Up" } },
{ keys = "I", cmd = "<C-w>L", opts = { desc = "Move Window Right" } },
{ 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" } },
{ keys = "d", cmd = "<C-w>c", opts = { desc = "Close Window" } },
{ keys = "D", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
{ keys = "]", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Size" } },
{ keys = "[", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Size" } },
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "H", cmd = "<C-w>H", opts = { desc = "Move Window Left" } },
{ keys = "N", cmd = "<C-w>J", opts = { desc = "Move Window Down" } },
{ keys = "E", cmd = "<C-w>K", opts = { desc = "Move Window Up" } },
{ keys = "I", cmd = "<C-w>L", opts = { desc = "Move Window Right" } },
{ 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" } },
{ keys = "d", cmd = "<C-w>c", opts = { desc = "Close Window" } },
{ keys = "D", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
{ keys = "]", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Size" } },
{ keys = "[", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Size" } },
{ keys = "M", cmd = ":resize<CR>:vertical resize<CR>", opts = { desc = "Maximize window size" } },
},
}

View file

@ -7,6 +7,37 @@ local M = {
{ keys = "<leader>,", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
{ keys = "ga", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
{ keys = "gh", cmd = vim.lsp.buf.hover, opts = { desc = "Show hover" } },
-- [c]hange [d]efinition
{ keys = "cd", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
}
-- local function smart_split_definition()
-- local width = vim.api.nvim_win_get_width(0)
-- if width > 80 then -- Adjust 80 to your preference
-- vim.api.nvim_command("vsp")
-- else
-- vim.api.nvim_command("sp")
-- end
-- vim.lsp.buf.definition()
-- end
-- vim.keymap.set("n", "<C-w>d", smart_split_definition, { desc = "Go to Definition (Smart Split)" })
local function smart_split(func)
local width = vim.api.nvim_win_get_width(0)
if width > 80 then
vim.api.nvim_command("vsp")
else
vim.api.nvim_command("sp")
end
func()
end
vim.keymap.set("n", "<C-w>d", function()
smart_split(vim.lsp.buf.definition)
end, { desc = "Go to Definition (Smart Split)" })
vim.keymap.set("n", "<C-w>D", function()
smart_split(vim.lsp.buf.declaration)
end, { desc = "Go to Declaration (Smart Split)" })
return M

View file

@ -1,10 +1,10 @@
local keymaps_modifier = {
-- Use C-w to move between windows
{ keys = "<C-w>h", cmd = "<C-w>h", opts = { desc = "left Window" } },
{ keys = "<C-w>n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "<C-w>e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "<C-w>i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "<A-x>", cmd = "<Cmd>Telescope commands<CR>", opts = { desc = "Commands" } },
{ keys = "<C-w>h", cmd = "<C-w>h", opts = { desc = "left Window" } },
{ keys = "<C-w>n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
{ keys = "<C-w>e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
{ keys = "<C-w>i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
{ keys = "<A-x>", cmd = "<Cmd>FzfLua commands<CR>", opts = { desc = "Commands" } },
}
return keymaps_modifier

View file

@ -1,5 +1,7 @@
local M = {}
M.event = "BufEnter"
M.global = {
{ mode = "n", keys = "<leader>E", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", keys = "<A-0>", cmd = ":NvimTreeFindFileToggle<CR>" },

View file

@ -1,8 +1,19 @@
-- https://stackoverflow.com/a/73365602
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("highlight_yank", {}),
desc = "Hightlight selection on yank",
pattern = "*",
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 500 })
end,
})
return {
-- Colorschemes
{
"catppuccin/nvim",
name = "catppuccin",
lazy = true,
opts = {
flavor = "auto",
background = {
@ -10,6 +21,7 @@ return {
dark = "mocha",
},
integrations = {
-- lualine = true,
"lualine",
},
},
@ -20,90 +32,66 @@ return {
opts = {
variant = "dawn",
},
cmd = "FzfLua colorschemes",
},
{ "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" },
{ "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" },
-- Highlight objects under the cursor
{ "RRethy/vim-illuminate" },
{ "rebelot/kanagawa.nvim", cmd = "FzfLua colorschemes" },
{ -- Modern Status Line
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = "VeryLazy",
config = function()
require("plugins.mod.lualine")
end,
},
{ -- Highlight yanked text
"gbprod/yanky.nvim",
opts = {
highlight = {
on_put = true,
on_yank = true,
timer = 500,
},
},
},
{ import = "plugins.mod.alpha-nvim" }, -- Dashboard
{ -- Breadcrumb
"Bekaboo/dropbar.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
opts = {},
keys = {
{
"<Leader>+",
function()
require("dropbar.api").pick()
end,
desc = "Pick symbols in winbar",
},
{
"[;",
function()
require("dropbar.api").goto_context_start()
end,
desc = "Go to start of current context",
},
{
"];",
function()
require("dropbar.api").select_next_context()
end,
desc = "Select next context",
},
},
},
-- { -- Breadcrumb
-- "Bekaboo/dropbar.nvim",
-- dependencies = {
-- "nvim-telescope/telescope-fzf-native.nvim",
-- build = "make",
-- },
-- opts = {},
-- keys = {
-- {
-- "<Leader>+",
-- function()
-- require("dropbar.api").pick()
-- end,
-- desc = "Pick symbols in winbar",
-- },
-- {
-- "[;",
-- function()
-- require("dropbar.api").goto_context_start()
-- end,
-- desc = "Go to start of current context",
-- },
-- {
-- "];",
-- function()
-- require("dropbar.api").select_next_context()
-- end,
-- desc = "Select next context",
-- },
-- },
-- },
{ import = "plugins.mod.bufferline" }, -- Buffer Top Bar
{ -- Git Blames, Changes
{ -- Git Blames, Changes
"lewis6991/gitsigns.nvim",
opts = {
current_line_blame = true,
},
event = "BufReadPre",
keys = {
{ "<leader>gb", "<cmd>Gitsigns blame<CR>", desc = "Blame file" },
{ "<leader>gd", "<cmd>Gitsigns diffthis<CR>", desc = "Diff file" },
{ "<leader>gb", "<cmd>Gitsigns blame<CR>", desc = "Blame file" },
{ "<leader>gd", "<cmd>Gitsigns diffthis<CR>", desc = "Diff file" },
{ "<leader>gB", "<cmd>Gitsigns toggle_current_line_blame<CR>", desc = "Toggle line blame" },
},
},
{ -- Highlight and navigate between TODOs
"folke/todo-comments.nvim",
opts = {},
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
-- add any options here
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
},
-- { -- Highlight and navigate between TODOs
-- "folke/todo-comments.nvim",
-- cmd = { "TodoTelescope" },
-- event = "BufRead",
-- opts = {},
-- dependencies = { "nvim-lua/plenary.nvim" },
-- },
}

View file

@ -1,24 +1,11 @@
return {
{ import = "plugins.mod.nvim-cmp" },
{
"saadparwaiz1/cmp_luasnip",
},
{ import = "plugins.mod.blink-cmp" },
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp",
event = "InsertEnter",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" })
-- require("luasnip.loaders.from_vscode").lazy_load()
end,
-- TODO: Remove this, simply delete this will let nvim-cmp not work
-- dependencies = { "rafamadriz/friendly-snippets" },
},
{
"zbirenbaum/copilot-cmp",
opts = {},
-- config = function()
-- require("copilot_cmp").setup()
-- end,
},
}

View file

@ -2,6 +2,7 @@
return {
{
"mfussenegger/nvim-dap",
event = "BufReadPre",
config = function()
local dap = require("dap")
dap.adapters.codelldb = {
@ -28,10 +29,13 @@ return {
"rcarriga/nvim-dap-ui",
opts = {},
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
cmd = "DapNew",
},
{ "theHamsta/nvim-dap-virtual-text", opts = {} },
{ "theHamsta/nvim-dap-virtual-text", opts = {}, cmd = "DapNew" },
{
"mfussenegger/nvim-dap-python",
event = "BufReadPost",
ft = "python",
config = function()
require("dap-python").setup("uv")
end,

View file

@ -1,26 +1,23 @@
return {
{
"folke/flash.nvim",
event = "VeryLazy",
event = "BufEnter",
opts = {},
-- stylua: ignore
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
{
"js0ny/vim-visual-multi-colemak-hnei",
-- "mg979/vim-visual-multi",
},
{ import = "plugins.mod.mc" }, -- Multiple-cursors
{ import = "plugins.mod.autopairs" },
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
event = "BufEnter",
opts = {},
},
{

View file

@ -1,50 +1,39 @@
return {
{
"rmagatti/auto-session",
lazy = false,
event = "BufReadPre",
cmd = {
"SessionSearch",
"SessionSave",
},
opts = {
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
},
},
{ import = "plugins.mod.nvim-tree" },
{ import = "plugins.mod.telescope" },
-- { import = "plugins.mod.fzf" },
{
"ahmedkhalf/project.nvim",
opts = {
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
sync_root_with_cwd = true,
silent_chdir = true,
scope_chdir = "global",
},
config = function()
require("telescope").load_extension("projects")
end,
dependencies = { "nvim-telescope/telescope.nvim" },
},
-- { import = "plugins.mod.nvim-tree" },
-- { import = "plugins.mod.telescope" },
{ import = "plugins.mod.fzf" },
-- {
-- "kdheepak/lazygit.nvim",
-- lazy = true,
-- "ahmedkhalf/project.nvim",
-- event = "VeryLazy",
-- opts = {
-- detection_methods = { "lsp", "pattern" },
-- patterns = { ".git", "Makefile", "package.json" },
-- sync_root_with_cwd = true,
-- silent_chdir = true,
-- scope_chdir = "global",
-- },
-- config = function()
-- require("telescope").load_extension("projects")
-- end,
-- dependencies = { "nvim-telescope/telescope.nvim" },
-- },
-- {
-- "NeogitOrg/neogit",
-- config = true,
-- cmd = {
-- "LazyGit",
-- "LazyGitConfig",
-- "LazyGitCurrentFile",
-- "LazyGitFilter",
-- "LazyGitFilterCurrentFile",
-- },
-- -- optional for floating window border decoration
-- dependencies = {
-- "nvim-lua/plenary.nvim",
-- },
-- -- setting the keybinding for LazyGit with 'keys' is recommended in
-- -- order to load the plugin when the command is run for the first time
-- keys = {
-- { "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
-- "Neogit",
-- },
-- },
{
"NeogitOrg/neogit",
},
{ import = "plugins.mod.neo-tree" }
}

View file

@ -3,17 +3,13 @@ require("plugins.lazy-nvim")
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins.appearance" },
{ import = "plugins.completion" },
{ import = "plugins.fileutils" },
{ import = "plugins.lsp" },
{ import = "plugins.lang" },
{ import = "plugins.dap" },
{ import = "plugins.edit" },
{ import = "plugins.misc" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
-- automatically check for plugin updates
checker = { enabled = true },
checker = { enabled = false },
})

View file

@ -0,0 +1,13 @@
-- 在 init.lua 或者你的配置文件中添加
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.bean",
callback = function()
vim.bo.filetype = "beancount"
end,
})
return {
"nathangrigg/vim-beancount",
ft = "beancount",
}

View file

@ -0,0 +1,33 @@
return {
{ import = "plugins.lang.org" },
{ import = "plugins.lang.markdown" },
{ import = "plugins.lang.just" },
{ import = "plugins.lang.typst" },
{ import = "plugins.lang.beancount" },
{ import = "plugins.lang.tex" },
{ import = "plugins.lang.lua" },
{ import = "plugins.lang.treesitter" },
{ import = "plugins.mod.trouble-nvim" },
{
"williamboman/mason.nvim",
cmd = "Mason",
build = ":MasonUpdate",
-- opts_extend = { "ensure_installed" },
opts = {
-- ensure_installed = require("config.servers").servers,
},
},
-- {
-- "williamboman/mason-lspconfig.nvim",
-- event = "BufReadPre",
-- dependencies = {
-- { "williamboman/mason.nvim" },
-- { "neovim/nvim-lspconfig" },
-- },
-- opts = {
-- -- ensure_installed = require("config.servers").servers,
-- -- automatic_installation = false,
-- },
-- },
{ import = "plugins.mod.conform-nvim" },
}

View file

@ -0,0 +1,4 @@
return {
"NoahTheDuke/vim-just",
ft = { "just" },
}

View file

@ -0,0 +1,9 @@
return {
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View file

@ -0,0 +1,6 @@
return {
{ import = "plugins.lang.markdown.render-markdown" },
-- { import = "plugins.mod.lang.markdown.markview" },
{ import = "plugins.lang.markdown.obsidian-nvim" },
{ "bullets-vim/bullets.vim", ft = "markdown" },
}

View file

@ -1,5 +1,5 @@
return {
"epwalsh/obsidian.nvim",
"obsidian-nvim/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
-- lazy = false,
ft = "markdown",
@ -38,11 +38,15 @@ return {
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
keys = {
{ "<leader>fo", "<cmd>ObsidianQuickSwitch<CR>", desc = "Obsidian: Quick Switch" },
},
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
"ibhagwan/fzf-lua",
},
opts = {
workspaces = {
@ -52,12 +56,19 @@ return {
},
},
completion = {
nvim_cmp = true,
nvim_cmp = false,
blink = true,
min_chars = 2,
},
ui = {
enable = false,
},
daily_notes = {
folder = "_Global/Periodic",
date_format = "%Y-%m-%d",
default_tags = { "daily" },
template = nil,
},
-- see below for full list of options 👇
attachments = {
img_folder = "_Global/Assets",
@ -65,5 +76,14 @@ return {
return string.format("%s-", os.time())
end,
},
mappings = {
["<cr>"] = {
action = function()
require("obsidian").util.smart_action()
end,
opts = { buffer = true, expr = true },
},
},
new_notes_location = "current_dir",
},
}

View file

@ -1,7 +1,7 @@
return {
{
"MeanderingProgrammer/render-markdown.nvim",
lazy = false,
event = "BufRead",
ft = { "markdown", "Avante" },
opts = {
file_types = { "markdown", "Avante" },
@ -14,14 +14,13 @@ return {
top_pad = 0,
bottom_pad = 0,
},
heading = {
sign = false,
position = "inline",
width = "block",
left_margin = 0.5,
left_pad = 0.2,
right_pad = 0.2,
},
-- heading = {
-- position = "overlay",
-- width = "block",
-- left_margin = 0.5,
-- left_pad = 0.2,
-- right_pad = 0.2,
-- },
link = {
custom = {
python = { pattern = "%.py", icon = "" },

View file

@ -0,0 +1,88 @@
return {
{
"nvim-orgmode/orgmode",
dependencies = {
-- "nvim-telescope/telescope.nvim",
-- "nvim-orgmode/telescope-orgmode.nvim",
"nvim-orgmode/org-bullets.nvim",
"Saghen/blink.cmp",
},
cmd = {
"Org",
},
ft = {
"org",
"orgagenda",
},
keys = {
{ "<leader>A", "<cmd>Org agenda<CR>", desc = "Org Agenda" },
},
event = "BufEnter *.org",
config = function()
require("orgmode").setup({
org_agenda_files = "~/OrgFiles/tasks/*",
org_default_notes_file = "~/OrgFiles/tasks/inbox.org",
org_archive_location = "~/OrgFiles/.archive/%s_archive::",
org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" },
org_hide_leading_stars = true,
org_hide_emphasis_markers = true,
org_log_into_drawer = "LOGBOOK",
org_highlight_latex_and_related = "native",
org_startup_indented = true,
org_deadline_warning_days = 10,
mappings = {
agenda = {
org_agenda_schedule = "<C-c><C-s>",
org_agenda_deadline = "<C-c><C-d>",
org_agenda_todo = "<C-c><C-t>",
org_agenda_set_tags = "<C-c><C-c>",
org_agenda_earlier = { "[[", "<" },
org_agenda_later = { "]]", ">" },
org_agenda_archive = "$",
},
org = {
org_deadline = "<C-c><C-d>",
org_schedule = "<C-c><C-s>",
org_todo = "<C-c><C-t>",
org_set_tags_command = "<C-c><C-c>",
org_archive_subtree = "<C-c>$",
},
},
})
require("org-bullets").setup()
require("blink.cmp").setup({
sources = {
per_filetype = {
org = { "orgmode" },
},
providers = {
orgmode = {
name = "Orgmode",
module = "orgmode.org.autocompletion.blink",
fallbacks = { "buffer" },
},
},
},
})
-- require("telescope").setup()
-- require("telescope").load_extension("orgmode")
-- vim.keymap.set("n", "<leader>r", require("telescope").extensions.orgmode.refile_heading)
-- vim.keymap.set("n", "<leader>oP", require("telescope").extensions.orgmode.search_headings)
vim.keymap.set("n", "<leader>op", "<cmd>FzfLua files cwd=~/OrgFiles<CR>")
-- vim.keymap.set("n", "<leader>li", require("telescope").extensions.orgmode.insert_link)
end,
},
-- {
-- dir = "~/Source/org-pomodoro.nvim",
-- name = "org-pomodoro.nvim",
-- lazy = false,
-- opts = {},
-- dependencies = {
-- "nvim-orgmode/orgmode",
-- },
-- cmd = {
-- "OrgPomodoro",
-- },
-- },
}

View file

@ -0,0 +1,7 @@
return {
"lervag/vimtex",
ft = { "tex", "bib" },
init = function()
vim.g.vimtex_view_method = "okular"
end,
}

View file

@ -0,0 +1,20 @@
return {
{ "nvim-treesitter/nvim-treesitter-context", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
cmd = {
"TSInstall",
"TSUpdate",
"TSUpdateSync",
},
event = {
"BufReadPre",
},
opts = {
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline" },
highlight = { enable = true },
indent = { enable = true },
},
},
}

View file

@ -0,0 +1,6 @@
return {
'chomosuke/typst-preview.nvim',
ft = { 'typst' },
version = '1.*',
opts = {}, -- lazy.nvim will implicitly calls `setup {}`
}

View file

@ -6,7 +6,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()

View file

@ -1,115 +0,0 @@
return {
{
"neovim/nvim-lspconfig",
lazy = false,
},
{ import = "plugins.mod.render-markdown" },
-- { import = "plugins.mod.markview" },
{
"lervag/vimtex",
ft = { "tex", "bib" },
-- lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "okular"
end,
},
{
"js0ny/luasnip-latex-snippets.nvim",
-- vimtex isn't required if using treesitter
requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
config = function()
require("luasnip-latex-snippets").setup()
-- or setup({ use_treesitter = true })
require("luasnip").config.setup({ enable_autosnippets = true })
end,
},
{ "williamboman/mason.nvim", config = true },
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
dependencies = {
{ "williamboman/mason.nvim" },
{ "neovim/nvim-lspconfig" },
},
opts = {
ensure_installed = require("config.servers").servers,
automatic_installation = false,
},
},
{ import = "plugins.mod.conform-nvim" },
{ "nvim-treesitter/nvim-treesitter-context" },
{
"NoahTheDuke/vim-just",
ft = { "just" },
},
{
"akinsho/org-bullets.nvim",
ft = { "org" },
config = function()
require("org-bullets").setup()
end,
},
{
"nvim-orgmode/orgmode",
ft = { "org" },
config = function()
-- Setup orgmode
require("orgmode").setup({
org_agenda_files = "~/OrgFiles/tasks/*",
org_default_notes_file = "~/OrgFiles/tasks/inbox.org",
org_archive_location = "~/OrgFiles/archive/%s_archive::",
org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" },
org_hide_leading_stars = true,
org_hide_emphasis_markers = true,
org_log_into_drawer = "LOGBOOK",
org_highlight_latex_and_related = "native",
org_startup_indented = true,
org_deadline_warning_days = 10,
})
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
-- add ~org~ to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
},
{ import = "plugins.mod.trouble-nvim" },
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
cmd = {
"TSInstall",
"TSUpdate",
"TSUpdateSync",
},
event = {
"VeryLazy",
},
opts = {
ensure_installed = { "markdown", "markdown_inline", "latex", "python" },
highlight = { enable = true },
indent = { enable = true },
},
},
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"nvim-neorg/neorg",
lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default
version = "*", -- Pin Neorg to the latest stable release
config = true,
}
}

View file

@ -1,24 +1,7 @@
return {
{ "wakatime/vim-wakatime", lazy = false },
{ "nvim-lua/plenary.nvim", lazy = true },
{ "wakatime/vim-wakatime", lazy = false },
{ import = "plugins.mod.toggleterm" },
{
"CRAG666/code_runner.nvim",
config = true,
keys = {
{ "<leader>cr", "<cmd>RunCode<CR>", desc = "Run code" },
},
dependencies = {
{
"CRAG666/betterTerm.nvim",
opts = {
position = "bot",
size = 15,
},
},
},
},
{ import = "plugins.mod.obsidian-nvim" },
{ import = "plugins.mod.which-keys-nvim" },
{ import = "plugins.mod.copilot-lua" },
{ import = "plugins.mod.avante-nvim" },
@ -28,10 +11,11 @@ return {
cmd = {
"Leet",
},
event = "VeryLazy",
lazy = true,
-- event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope.nvim",
-- "ibhagwan/fzf-lua",
-- "nvim-telescope/telescope.nvim",
"ibhagwan/fzf-lua",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
@ -40,7 +24,5 @@ return {
},
},
{ import = "plugins.mod.image-nvim" },
-- "3rd/image.nvim",
-- opts = {},
-- },
{ import = "plugins.mod.snacks-nvim" },
}

View file

@ -8,10 +8,10 @@ return {
-- for example
provider = "openai",
openai = {
endpoint = "https://yunwu.ai/v1",
endpoint = "https://aihubmix.com/v1",
model = "claude-3-7-sonnet-20250219", -- your desired model (or use gpt-4o, etc.)
timeout = 30000, -- timeout in milliseconds
temperature = 0, -- adjust if needed
timeout = 30000, -- timeout in milliseconds
temperature = 0, -- adjust if needed
max_tokens = 4096,
-- reasoning_effort = "high" -- only supported for "o" models
},
@ -25,14 +25,17 @@ return {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
-- "nvim-telescope/telescope.nvim", -- for file_selector provider telescope
"ibhagwan/fzf-lua",
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
"zbirenbaum/copilot.lua", -- for providers='copilot'
"zbirenbaum/copilot.lua", -- for providers='copilot'
{
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
ft = { "avante", "markdown", "typst", "org", "tex" },
cmd = "PasteImage",
opts = {
-- recommended settings
default = {

View file

@ -0,0 +1,79 @@
return {
"saghen/blink.cmp",
-- optional: provides snippets for the snippet source
-- dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
-- use a release tag to download pre-built binaries
version = "*",
event = "InsertEnter",
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
enabled = function()
if vim.fn.getcmdtype() ~= "" then
return true
end
return not vim.tbl_contains({ "TelescopePrompt", "dap-repl", "snacks_picker_list" }, vim.bo.filetype)
end,
keymap = {
preset = "default",
["<Tab>"] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
"snippet_forward",
"fallback",
},
["<C-f>"] = { "select_and_accept" },
["<C-b>"] = { "hide", "fallback" },
["<CR>"] = { "accept", "fallback" },
},
completion = {
menu = { border = "single" },
documentation = { window = { border = "single" } },
},
signature = { window = { border = "single" } },
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "normal",
},
snippets = {
preset = "luasnip",
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
per_filetype = {
org = { "orgmode" },
},
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
orgmode = {
name = "Orgmode",
module = "orgmode.org.autocompletion.blink",
fallbacks = { "buffer" },
},
},
},
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" },
},
opts_extend = { "sources.default" },
}

View file

@ -10,7 +10,7 @@ return {
"akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
after = "catppuccin",
lazy = false,
event = "VeryLazy",
keys = {
{ "<leader>b1", "<cmd>BufferLineGotoBuffer 1<CR>", desc = "Switch to Buffer #1" },
{ "<leader>b2", "<cmd>BufferLineGotoBuffer 2<CR>", desc = "Switch to Buffer #2" },

View file

@ -2,5 +2,29 @@ return {
"ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "FzfLua",
keys = {
{ "<leader><leader>", "<cmd>FzfLua files<CR>", desc = "Find Files" },
{ "<leader>fc", "<cmd>FzfLua files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
{ "<leader>/", "<cmd>FzfLua live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", "<cmd>FzfLua<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", "<cmd>FzfLua colorschemes<CR>", desc = "Change colorscheme" },
-- find_files { "<leader>pp", "<cmd>FzfLua projects<CR>", desc = "Listfind_files all Projects" },
{ "<leader>pd", "<cmd>FzfLua zoxide<CR>", desc = "List recent directories" },
-- { "<leader>pg", "<cmd>FzfLua projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", "<cmd>FzfLua session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", "<cmd>FzfLua git_status<CR>", desc = "Git Status" },
{ "<leader>gt", "<cmd>FzfLua git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", "<cmd>FzfLua git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", "<cmd>FzfLua fd<CR>", desc = "Find Files" },
{ "<leader>fh", "<cmd>FzfLua oldfiles<CR>", desc = "Recent Files" },
{ "<leader>ce", "<cmd>FzfLua diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", "<cmd>FzfLua treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", "<cmd>FzfLua grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", "<cmd>FzfLua buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", ":FzfLua filetypes", desc = "Set Filetype/Lang to ..." },
{ "<leader>R", "<cmd>FzfLua resume<CR>", desc = "Resume FzfLua" },
},
opts = {},
}

View file

@ -112,6 +112,13 @@ M.progress = {
"progress",
}
-- TODO: Implement orgmode
M.orgmode = {
function()
return _G.orgmode.statusline()
end,
}
-- local conditions = {
-- buffer_not_empty = function()
-- return vim.fn.empty(vim.fn.expand("%:t")) ~= 1

View file

@ -14,7 +14,7 @@ Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | E
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha", "grug-far" },
statusline = { "NvimTree", "alpha", "grug-far", "snacks_dashboard" },
},
-- Disable sections and component separators
component_separators = { left = "", right = "" },
@ -36,6 +36,7 @@ local config = {
components.diagnostics,
},
lualine_x = {
components.orgmode,
components.indent,
components.encoding,
components.eol,

View file

@ -0,0 +1,47 @@
return {
"js0ny/multiple-cursors.nvim",
version = "*", -- Use the latest tagged version
-- opts = , -- This causes the plugin setup function to be called
keys = {
{ "<A-n>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "x" }, desc = "Add cursor and move down" },
{ "<A-e>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "x" }, desc = "Add cursor and move up" },
{ "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move up" },
{ "<C-Down>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move down" },
{ "<A-LeftMouse>", "<Cmd>MultipleCursorsMouseAddDelete<CR>", mode = { "n", "i" }, desc = "Add or remove cursor" },
},
config = function()
local normal_mode_motion = require("multiple-cursors.normal_mode.motion")
local normal_mode_edit = require("multiple-cursors.normal_mode.edit")
local visual_mode_edit = require("multiple-cursors.visual_mode.edit")
local normal_mode_mode_change = require("multiple-cursors.normal_mode.mode_change")
local visual_mode_modify_area = require("multiple-cursors.visual_mode.modify_area")
require("multiple-cursors").setup({
pre_hook = function()
require("nvim-autopairs").disable()
end,
post_hook = function()
require("nvim-autopairs").enable()
end,
custom_key_maps = {
{ { "n", "x" }, { "e", "<Up>" }, normal_mode_motion.k, "nowrap" },
{ { "n", "x" }, { "n", "<Down>" }, normal_mode_motion.j, "nowrap" },
{ { "n", "x" }, { "i", "<Right>", "<Space>" }, normal_mode_motion.l, "nowrap" },
{ { "n", "x" }, "j", normal_mode_motion.e, "nowrap" },
{ { "n", "x" }, "J", normal_mode_motion.E, "nowrap" },
{ { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" },
{ { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" },
{ "n", "E", normal_mode_edit.J, "nowrap" },
{ "n", "gE", normal_mode_edit.gJ, "nowrap" },
{ "n", { "l", "<Insert>" }, normal_mode_mode_change.i, "nowrap" },
{ "n", "L", normal_mode_mode_change.I, "nowrap" },
{ "x", "l", visual_mode_modify_area.i, "nowrap" },
{ "x", "E", visual_mode_edit.J, "nowrap" },
{ "x", "gE", visual_mode_edit.gJ, "nowrap" },
},
})
end,
}

View file

@ -0,0 +1,89 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
},
lazy = false, -- neo-tree will lazily load itself
---@module "neo-tree"
---@type neotree.Config?
opts = {
window = {
mappings = {
["<space>"] = "noop",
["e"] = "noop",
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["i"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
-- Read `# Preview Mode` for more information
-- ["i"] = "focus_preview",
["S"] = "open_split",
["s"] = "open_vsplit",
-- ["S"] = "split_with_window_picker",
-- ["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
-- ["<cr>"] = "open_drop",
-- ["t"] = "open_tab_drop",
["w"] = "open_with_window_picker",
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
["C"] = "close_node",
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["a"] = {
"add",
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
["d"] = "delete",
["r"] = "rename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
-- ["c"] = {
-- "copy",
-- config = {
-- show_path = "none" -- "none", "relative", "absolute"
-- }
--}
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
["l"] = "show_file_details",
-- ["i"] = {
-- "show_file_details",
-- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`)
-- -- both options accept a string or a function that takes in the date in seconds and returns a string to display
-- -- config = {
-- -- created_format = "%Y-%m-%d %I:%M %p",
-- -- modified_format = "relative", -- equivalent to the line below
-- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end
-- -- }
-- },
}
}
-- fill any relevant options here
},
keys = {
{
"<leader>ft",
"<cmd>Neotree toggle<CR>",
desc = "Toggle File Explorer",
}
}
}

View file

@ -1,12 +1,3 @@
-- FIXME: Completion not working on GNU/Linux
local function set_keymaps(keymaps_cmp)
local mappings = {}
for _, map in ipairs(keymaps_cmp) do
mappings[map.keys] = map.cmd
end
return mappings
end
return {
"hrsh7th/nvim-cmp",
-- lazy = false,

View file

@ -0,0 +1,40 @@
return {
"neovim/nvim-lspconfig",
dependencies = { "saghen/blink.cmp" },
event = {
"BufReadPost",
"BufWritePost",
"BufNewFile",
},
-- example using `opts` for defining servers
opts = {
servers = {
lua_ls = {},
bashls = {},
clangd = {},
eslint = {}, -- JavaScript
gopls = {}, -- Go
jsonls = {}, -- JSON
markdown_oxide = {}, -- Markdown
omnisharp = {}, -- C# & F#
powershell_es = {}, -- PowerShell
pyright = {}, -- Python
taplo = {}, -- TOML
rust_analyzer = {}, -- Rust
ts_ls = {}, -- TypeScript
vimls = {}, -- vimscript
yamlls = {}, -- YAML
beancount = {}, -- Beancount
},
},
config = function(_, opts)
local lspconfig = require("lspconfig")
for server, config in pairs(opts.servers) do
-- passing config.capabilities to blink.cmp merges with the capabilities in your
-- `opts[server].capabilities, if you've defined it
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
lspconfig[server].setup(config)
end
end,

View file

@ -0,0 +1,55 @@
-- Welcome to nvim's systemd :D
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = {
enabled = true,
preset = {
keys = {
-- { key = "p", icon = "󰈞 ", desc = "查找项目", action = "<cmd>Telescope projects<CR>" },
{ key = "h", icon = "", desc = "历史文件", action = "<cmd>FzfLua oldfiles<CR>" },
{ key = "l", icon = "", desc = "加载会话", action = "<cmd>SessionSearch<CR>" },
{
key = "c",
icon = "",
desc = "转到设置",
action = "<cmd>FzfLua files cwd=~/.config/nvim<CR>",
},
{ key = "q", icon = "󱊷 ", desc = "退出", action = "<cmd>qa<CR>" },
},
},
sections = {
{ section = "header" },
{ icon = "", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
{ icon = "", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
{ icon = "", title = "Projects", section = "projects", indent = 2, padding = 1 },
{ section = "startup" },
},
},
-- explorer = {
-- },
indent = { enabled = true },
-- input = { enabled = true },
notifier = { enabled = true },
-- quickfile = { enabled = true },
scope = { enabled = true },
-- scroll = { enabled = true },
statuscolumn = { enabled = true },
-- words = { enabled = true },
image = { enabled = true },
},
keys = {
-- {
-- "<leader>ft",
-- function()
-- require("snacks").explorer()
-- end,
-- desc = "Toggle File Explorer",
-- },
},
}

View file

@ -1,5 +1,6 @@
return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
opts = {
defaults = {
prompt_prefix = require("config.icons").telescope,
@ -28,24 +29,24 @@ return {
},
dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader><leader>", "<cmd>Telescope find_files<CR>", desc = "Find Files" },
{ "<leader>fc", "<cmd>Telescope find_files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
{ "<leader>/", "<cmd>Telescope live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", "<cmd>Telescope<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", "<cmd>Telescope colorscheme<CR>", desc = "Change colorscheme" },
{ "<leader>pp", "<cmd>Telescope projects<CR>", desc = "List all Projects" },
{ "<leader>pg", "<cmd>Telescope projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", "<cmd>Telescope session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Git Status" },
{ "<leader>gt", "<cmd>Telescope git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", "<cmd>Telescope fd<CR>", desc = "Find Files" },
{ "<leader>fh", "<cmd>Telescope oldfiles<CR>", desc = "Recent Files" },
{ "<leader>ce", "<cmd>Telescope diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", "<cmd>Telescope treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", "<cmd>Telescope grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", "<cmd>Telescope filetypes", desc = "Set Filetype/Lang to ..." },
{ "<leader><leader>", "<cmd>Telescope find_files<CR>", desc = "Find Files" },
{ "<leader>fc", "<cmd>Telescope find_files cwd=~/.config/nvim<CR>", desc = "Edit configs" },
{ "<leader>/", "<cmd>Telescope live_grep<CR>", desc = "Grep Files" },
{ "<leader>;", "<cmd>Telescope<CR>", desc = "Show Telescope Commands" },
{ "<leader>ui", "<cmd>FzfLua colorscheme<CR>", desc = "Change colorscheme" },
{ "<leader>pp", "<cmd>Telescope projects<CR>", desc = "List all Projects" },
{ "<leader>pg", "<cmd>Telescope projects<CR>", desc = "List all Git Projects" },
{ "<leader>ps", "<cmd>Telescope session-lens<CR>", desc = "List all sessions" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Git Status" },
{ "<leader>gt", "<cmd>Telescope git_branches<CR>", desc = "Git Branches" },
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "Show commits" },
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>ff", "<cmd>Telescope fd<CR>", desc = "Find Files" },
{ "<leader>fh", "<cmd>Telescope oldfiles<CR>", desc = "Recent Files" },
{ "<leader>ce", "<cmd>Telescope diagnostics<CR>", desc = "Navigate errors/warnings" },
{ "<leader>cs", "<cmd>Telescope treesitter<CR>", desc = "Search symbols" },
{ "<leader>cS", "<cmd>Telescope grep_string<CR>", desc = "Search current symbol" },
{ "<leader>bB", "<cmd>Telescope buffers<CR>", desc = "List Buffers" },
{ "<leader>fl", "<cmd>Telescope filetypes", desc = "Set Filetype/Lang to ..." },
},
}

View file

@ -14,13 +14,6 @@ return {
{ "<leader>!", "<cmd>ToggleTerm direction=float<CR>", desc = "Toggle Terminal" },
{ "<leader>tf", "<cmd>ToggleTerm direction=float<CR>", desc = "Toggle Terminal" },
{ "<leader>tt", "<cmd>ToggleTerm<CR>", desc = "Spawn a float terminal" },
-- TODO: Implement lazygit
-- {
-- "<leader>gg",
-- "<cmd>lua _lazygit_toggle()<CR>",
-- -- require("toggleterm.terminal").Terminal:new({ cmd = "lazygit", hidden = true }),
-- desc = "Toggle LazyGit",
-- },
},
event = "ColorScheme",
opts = {

4
tools/nvim/readme.md Normal file
View file

@ -0,0 +1,4 @@
## Language Servers (v0.11)
[References](https://github.com/rockyzhang24/dotfiles/tree/master/.config/nvim/lsp)

View file

@ -0,0 +1,15 @@
# vim: ft=screen
bind h focus left
bind n focus down
bind e focus up
bind i focus right
bind H resize -h -5
bind N resize -v +5
bind E resize -v -5
bind I resize -h +5
# Window navigation (prev/next)
bind ^h prev
bind ^i next

View file

@ -0,0 +1,16 @@
# vim: ft=screen
bind h focus left
bind j focus down
bind k focus up
bind l focus right
bind H resize -h -5
bind J resize -v +5
bind K resize -v -5
bind L resize -h +5
# Window navigation (prev/next)
bind ^h prev
bind ^l next

56
tools/screen/screenrc Normal file
View file

@ -0,0 +1,56 @@
# export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
# export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
# $XDG_CONFIG_HOME/screen/screenrc
# Set prefix key to Ctrl-a
escape ^Aa
# Allow sending Ctrl+a to applications by pressing Ctrl+a twice
bind a command -c screen
# Enable mouse scrolling and click
termcapinfo xterm* ti@:te@
# 256 colors support
term screen-256color
attrcolor b ".I"
defbce "on"
# Set window titles
autodetach on
shelltitle "$ |bash"
startup_message off
altscreen on
defscrollback 4096 # History limit
# Status line (similar to tmux status bar)
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c%{g}]'
# Start window numbering at 1
bind c screen 1
bind 0 select 10
bind ^c screen 1
screen 1
# Visual bell instead of audible bell
vbell on
vbell_msg " Bell "
# Window splitting with | and -
# Note: Screen doesn't support true splitting like tmux
# These commands just create regions, not true panes
bind | split
bind - split -v
# Default to vi keybindings
defutf8 on
defescape ^Aa
markkeys h=^B:l=^F:$=^E:^U=^Z:^D=^V
bind x kill
source ~/.config/screen/+colemak.screenrc
# Reload config (not directly supported in screen, but added for reference)
# To reload config in screen, you typically do Ctrl+a : source ~/.screenrc

12
tools/tmux/+colemak.tmux Normal file
View file

@ -0,0 +1,12 @@
# vim: ft=tmux
bind h select-pane -L
bind n select-pane -D
bind e select-pane -U
bind i select-pane -R
bind -r H resize-pane -L 5
bind -r N resize-pane -D 5
bind -r E resize-pane -U 5
bind -r I resize-pane -R 5
bind C-h select-window -t :-
bind C-i select-window -t :+

12
tools/tmux/+qwerty.tmux Normal file
View file

@ -0,0 +1,12 @@
# vim: ft=tmux
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind C-h select-window -t :-
bind C-l select-window -t :+

67
tools/tmux/tmux.conf Normal file
View file

@ -0,0 +1,67 @@
# $DOTFILES/common/tmux.conf
# Date: 2024-12-22
# Author: js0ny
# `tmux` - Terminal Multiplexer
# Location:
# $XDG_CONFIG_HOME/tmux/tmux.conf
# Linking:
# ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf
# Theme
# -----------------
set -g @catppuccin_flavor "mocha"
run ~/.config/tmux/plugins/catppuccin/tmux/catppuccin.tmux
# Prefix
# -----------------
set-option -g prefix C-a
unbind C-b
bind C-a send-prefix
# Options
set-option -g mouse on
set-option -g default-terminal "tmux-256color"
set-option -g allow-rename on
set-option -g alternate-screen on
set-option -g visual-activity on
set-option -g pane-border-style fg=colour244
# set-option -g pane-activity-border-style fg=colour239
# Index
# -----------------
set -g base-index 1
set -g pane-base-index 1
# History
# -----------------
set -g history-limit 4096
# Reload Config
# -----------------
bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded Config"
# Vi Mode
# -----------------
set -g status-keys vi
set-window-option -g mode-keys vi
# Windows Management
# -----------------
bind | split-window -h
unbind '"'
bind - split-window -v
unbind %
bind ` resize-pane -Z
source-file ~/.config/tmux/+colemak.tmux
# Status Bar
# -----------------
# set -g status-position top
# set-option -g status-bg black
# set-option -g status-fg white
# set-option -g status-left '#[fg=green][#S] '
# setw -g window-status-current-format '#[fg=colour236,bg=colour39] #I #W '

View file

@ -59,6 +59,8 @@ noremap gr editor.action.goToReferences
noremap gpr editor.action.referenceSearch.trigger
noremap ga editor.action.quickFix
" Rename, or [c]hange [d]efinition
nnoremap cd editor.action.rename
" Requires matchit by redguardtoo
" nnoremap % extension.matchitJumpItems
@ -72,8 +74,9 @@ vnoremap > editor.action.indentLines
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
" This is buggy
"nmap w cjkWordHandler.cursorWordEndRight
"nmap b cjkWordHandler.cursorWordStartLeft
" <C-w> will be parsed by VSCode itself.
" noremap <C-w>n <C-w>j

View file

@ -25,7 +25,7 @@ end
return function(config)
config.max_fps = 120
config.font = wezterm.font({
family = "JetBrainsMono Nerd Font",
family = "Maple Mono NF CN",
})
config.color_scheme = scheme_for_appearance(get_appearance())
config.font_size = 12.0

View file

@ -1,268 +0,0 @@
-- vim: foldmethod=marker foldmarker=#region,#endregion
-- Reference to: https://github.com/KevinSilvester/wezterm-config/blob/master/config/bindings.lua
local wezterm = require("wezterm")
local action = wezterm.action
local act = wezterm.action
local os_type = require("utils").detected_os
local SUPER
if os_type.is_mac then
SUPER = "SUPER"
else
SUPER = "ALT"
end
-- #region Key Tables
local key_tables = {
copy_mode = {
-- #region Built-in CopyMode
-- This keymaps seems cannot be merged.
{ key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") },
{ key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") },
{ key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") },
{ key = "Escape", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "Space", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) },
{ key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = ",", mods = "NONE", action = act.CopyMode("JumpReverse") },
{ key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") },
{ key = ";", mods = "NONE", action = act.CopyMode("JumpAgain") },
{ key = "F", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = false } }) },
{ key = "F", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = false } }) },
{ key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") },
{ key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") },
{ key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") },
{ key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") },
{ key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") },
{ key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") },
{ key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") },
{ key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") },
{ key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") },
{ key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") },
{ key = "T", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = true } }) },
{ key = "T", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = true } }) },
{ key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) },
{ key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) },
{ key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "b", mods = "NONE", action = act.CopyMode("MoveBackwardWord") },
{ key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") },
{ key = "b", mods = "CTRL", action = act.CopyMode("PageUp") },
{ key = "c", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "d", mods = "CTRL", action = act.CopyMode({ MoveByPage = 0.5 }) },
{ key = "e", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") },
{ key = "f", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = false } }) },
{ key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") },
{ key = "f", mods = "CTRL", action = act.CopyMode("PageDown") },
{ key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") },
{ key = "g", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") },
{ key = "j", mods = "NONE", action = act.CopyMode("MoveDown") },
{ key = "k", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "l", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "m", mods = "ALT", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") },
{ key = "q", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "t", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = true } }) },
{ key = "u", mods = "CTRL", action = act.CopyMode({ MoveByPage = -0.5 }) },
{ key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) },
{ key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) },
{ key = "w", mods = "NONE", action = act.CopyMode("MoveForwardWord") },
{
key = "y",
mods = "NONE",
action = act.Multiple({
{ CopyTo = "ClipboardAndPrimarySelection" },
{ Multiple = { "ScrollToBottom", { CopyMode = "Close" } } },
}),
},
{ key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") },
{ key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") },
{ key = "End", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = "Home", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") },
{ key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") },
{ key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") },
{ key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") },
{ key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") },
-- #endregion
-- #region Customized CopyMode
{ key = "n", mods = "NONE", action = act.CopyMode("MoveDown") },
{ key = "e", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "i", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "j", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") },
-- #endregion
},
resize_pane = {
{ key = "h", mods = "NONE", action = act.AdjustPaneSize({ "Left", 1 }) },
{ key = "n", mods = "NONE", action = act.AdjustPaneSize({ "Down", 1 }) },
{ key = "e", mods = "NONE", action = act.AdjustPaneSize({ "Up", 1 }) },
{ key = "i", mods = "NONE", action = act.AdjustPaneSize({ "Right", 1 }) },
{ key = "q", mods = "NONE", action = "PopKeyTable" },
},
}
-- #endregion
-- #region Leader Keymaps
local leader_keys = {
{
key = "q",
mods = "LEADER",
action = act.SendKey({ key = "q", mods = "CTRL" }),
},
-- Windows Management
{ -- leader keys
key = "|",
mods = "LEADER|SHIFT",
action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = "-",
mods = "LEADER",
action = act.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "h",
mods = "LEADER",
action = act.ActivatePaneDirection("Left"),
},
{
key = "n",
mods = "LEADER",
action = act.ActivatePaneDirection("Down"),
},
{
key = "e",
mods = "LEADER",
action = act.ActivatePaneDirection("Up"),
},
{
key = "i",
mods = "LEADER",
action = act.ActivatePaneDirection("Right"),
},
{
key = "H",
mods = "LEADER",
action = act.AdjustPaneSize({ "Left", 5 }),
},
{
key = "N",
mods = "LEADER",
action = act.AdjustPaneSize({ "Down", 5 }),
},
{
key = "E",
mods = "LEADER",
action = act.AdjustPaneSize({ "Up", 5 }),
},
{
key = "I",
mods = "LEADER",
action = act.AdjustPaneSize({ "Right", 5 }),
},
{
key = "/",
mods = "LEADER",
action = act.Search({ Regex = "" }),
},
{
key = "?",
mods = "LEADER|SHIFT",
action = act.Search({ CaseSensitiveString = "" }),
},
{
key = ";",
mods = "LEADER",
action = act.ShowLauncher,
},
{
key = ":",
mods = "LEADER|SHIFT",
action = act.ActivateCommandPalette,
},
{
key = "r",
mods = "LEADER",
action = act.ActivateKeyTable({
name = "resize_pane",
one_shot = false,
timeout_milliseconds = 2000,
}),
},
}
-- #endregion
-- #region Ctrl Keymaps
local ctrl_keys = {
{
key = "W",
mods = "CTRL",
action = act.CloseCurrentPane({ confirm = true }),
},
{ -- ^C to copy if selection is active, otherwise send signal
-- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection
key = "c",
mods = "CTRL",
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then
window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(act.ClearSelection, pane)
else
window:perform_action(act.SendKey({ key = "c", mods = "CTRL" }), pane)
end
end),
},
}
-- #endregion
-- #region SUPER Keymaps
local super_keys = {
{ key = "LeftArrow", mods = SUPER, action = act.SendString("\u{1b}OH") },
{ key = "RightArrow", mods = SUPER, action = act.SendString("\u{1b}OF") },
{ key = "Backspace", mods = SUPER, action = act.SendString("\u{15}") },
{ key = "0", mods = SUPER, action = act.ActivateTab(-1) },
{ key = "t", mods = SUPER, action = act.SpawnTab("DefaultDomain") },
{ key = "w", mods = SUPER, action = act.CloseCurrentTab({ confirm = false }) },
}
for i = 1, 9 do
table.insert(super_keys, { key = tostring(i), mods = SUPER, action = act.ActivateTab(i - 1) })
end
-- #endregion
-- Concat all keymaps
local keys = {}
for _, keymap in ipairs(leader_keys) do
table.insert(keys, keymap)
end
for _, keymap in ipairs(ctrl_keys) do
table.insert(keys, keymap)
end
for _, keymap in ipairs(super_keys) do
table.insert(keys, keymap)
end
return function(config)
config.leader = { key = "q", mods = "CTRL" }
config.keys = keys
config.key_tables = key_tables
config.mouse_bindings = {
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.OpenLinkAtMouseCursor,
},
{
event = { Up = { streak = 1, button = "Left" } },
mods = "SUPER",
action = act.OpenLinkAtMouseCursor,
},
}
end

View file

@ -0,0 +1,44 @@
local M = {}
local wezterm = require("wezterm")
local act = wezterm.action
M.leader = {
{
key = "n",
mods = "LEADER",
action = act.ActivatePaneDirection("Down"),
},
{
key = "e",
mods = "LEADER",
action = act.ActivatePaneDirection("Up"),
},
{
key = "i",
mods = "LEADER",
action = act.ActivatePaneDirection("Right"),
},
{
key = "N",
mods = "LEADER",
action = act.AdjustPaneSize({ "Down", 5 }),
},
{
key = "E",
mods = "LEADER",
action = act.AdjustPaneSize({ "Up", 5 }),
},
{
key = "I",
mods = "LEADER",
action = act.AdjustPaneSize({ "Right", 5 }),
},
}
local leader_common = require("keymaps.leaders").common
for _, v in ipairs(leader_common) do
table.insert(M.leader, v)
end
return M

View file

@ -0,0 +1,183 @@
-- vim: foldmethod=marker foldmarker=#region,#endregion
-- Reference to: https://github.com/KevinSilvester/wezterm-config/blob/master/config/bindings.lua
local wezterm = require("wezterm")
local action = wezterm.action
local act = wezterm.action
local os_type = require("utils").detected_os
local SUPER
if os_type.is_mac then
SUPER = "SUPER"
else
SUPER = "ALT"
end
local layout = require("keymaps.colemak")
-- #region Key Tables
local key_tables = {
copy_mode = {
-- #region Built-in CopyMode
-- This keymaps seems cannot be merged.
{ key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") },
{ key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") },
{ key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") },
{ key = "Escape", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "Space", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) },
{ key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = ",", mods = "NONE", action = act.CopyMode("JumpReverse") },
{ key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") },
{ key = ";", mods = "NONE", action = act.CopyMode("JumpAgain") },
{ key = "F", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = false } }) },
{ key = "F", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = false } }) },
{ key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") },
{ key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") },
{ key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") },
{ key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") },
{ key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") },
{ key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") },
{ key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") },
{ key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") },
{ key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") },
{ key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") },
{ key = "T", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = true } }) },
{ key = "T", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = true } }) },
{ key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) },
{ key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) },
{ key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "b", mods = "NONE", action = act.CopyMode("MoveBackwardWord") },
{ key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") },
{ key = "b", mods = "CTRL", action = act.CopyMode("PageUp") },
{ key = "c", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "d", mods = "CTRL", action = act.CopyMode({ MoveByPage = 0.5 }) },
{ key = "e", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") },
{ key = "f", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = false } }) },
{ key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") },
{ key = "f", mods = "CTRL", action = act.CopyMode("PageDown") },
{ key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") },
{ key = "g", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") },
{ key = "j", mods = "NONE", action = act.CopyMode("MoveDown") },
{ key = "k", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "l", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "m", mods = "ALT", action = act.CopyMode("MoveToStartOfLineContent") },
{ key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") },
{ key = "q", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) },
{ key = "t", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = true } }) },
{ key = "u", mods = "CTRL", action = act.CopyMode({ MoveByPage = -0.5 }) },
{ key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) },
{ key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) },
{ key = "w", mods = "NONE", action = act.CopyMode("MoveForwardWord") },
{
key = "y",
mods = "NONE",
action = act.Multiple({
{ CopyTo = "ClipboardAndPrimarySelection" },
{ Multiple = { "ScrollToBottom", { CopyMode = "Close" } } },
}),
},
{ key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") },
{ key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") },
{ key = "End", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") },
{ key = "Home", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") },
{ key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") },
{ key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") },
{ key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") },
{ key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") },
-- #endregion
-- #region Customized CopyMode
{ key = "n", mods = "NONE", action = act.CopyMode("MoveDown") },
{ key = "e", mods = "NONE", action = act.CopyMode("MoveUp") },
{ key = "i", mods = "NONE", action = act.CopyMode("MoveRight") },
{ key = "j", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") },
-- #endregion
},
resize_pane = {
{ key = "h", mods = "NONE", action = act.AdjustPaneSize({ "Left", 1 }) },
{ key = "n", mods = "NONE", action = act.AdjustPaneSize({ "Down", 1 }) },
{ key = "e", mods = "NONE", action = act.AdjustPaneSize({ "Up", 1 }) },
{ key = "i", mods = "NONE", action = act.AdjustPaneSize({ "Right", 1 }) },
{ key = "q", mods = "NONE", action = "PopKeyTable" },
},
}
-- #endregion
local leader_keys = layout.leader
-- #region Ctrl Keymaps
local ctrl_keys = {
{
key = "W",
mods = "CTRL",
action = act.CloseCurrentPane({ confirm = true }),
},
{ -- ^C to copy if selection is active, otherwise send signal
-- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection
key = "c",
mods = "CTRL",
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then
window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(act.ClearSelection, pane)
else
window:perform_action(act.SendKey({ key = "c", mods = "CTRL" }), pane)
end
end),
},
}
-- #endregion
-- #region SUPER Keymaps
local super_keys = {
{ key = "LeftArrow", mods = SUPER, action = act.SendString("\u{1b}OH") },
{ key = "RightArrow", mods = SUPER, action = act.SendString("\u{1b}OF") },
{ key = "Backspace", mods = SUPER, action = act.SendString("\u{15}") },
{ key = "0", mods = SUPER, action = act.ActivateTab(-1) },
{ key = "t", mods = SUPER, action = act.SpawnTab("DefaultDomain") },
{ key = "w", mods = SUPER, action = act.CloseCurrentTab({ confirm = false }) },
}
for i = 1, 9 do
table.insert(super_keys, { key = tostring(i), mods = SUPER, action = act.ActivateTab(i - 1) })
end
-- #endregion
-- Concat all keymaps
local keys = {}
for _, keymap in ipairs(leader_keys) do
table.insert(keys, keymap)
end
for _, keymap in ipairs(ctrl_keys) do
table.insert(keys, keymap)
end
for _, keymap in ipairs(super_keys) do
table.insert(keys, keymap)
end
return function(config)
config.leader = { key = "q", mods = "CTRL" }
config.keys = keys
config.key_tables = key_tables
config.mouse_bindings = {
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.OpenLinkAtMouseCursor,
},
{
event = { Up = { streak = 1, button = "Left" } },
mods = "SUPER",
action = act.OpenLinkAtMouseCursor,
},
}
end

View file

@ -0,0 +1,67 @@
local M = {}
local wezterm = require("wezterm")
local act = wezterm.action
-- #region Leader Keymaps
M.common = {
{
key = "q",
mods = "LEADER",
action = act.SendKey({ key = "q", mods = "CTRL" }),
},
-- Windows Management
{ -- leader keys
key = "|",
mods = "LEADER|SHIFT",
action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = "-",
mods = "LEADER",
action = act.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "h",
mods = "LEADER",
action = act.ActivatePaneDirection("Left"),
},
{
key = "H",
mods = "LEADER",
action = act.AdjustPaneSize({ "Left", 5 }),
},
{
key = "/",
mods = "LEADER",
action = act.Search({ Regex = "" }),
},
{
key = "?",
mods = "LEADER|SHIFT",
action = act.Search({ CaseSensitiveString = "" }),
},
{
key = ";",
mods = "LEADER",
action = act.ShowLauncher,
},
{
key = ":",
mods = "LEADER|SHIFT",
action = act.ActivateCommandPalette,
},
{
key = "r",
mods = "LEADER",
action = act.ActivateKeyTable({
name = "resize_pane",
one_shot = false,
timeout_milliseconds = 2000,
}),
},
}
-- #endregion
return M

View file

@ -0,0 +1,45 @@
local M = {}
local wezterm = require("wezterm")
local act = wezterm.action
M.qwerty = {
{
key = "j",
mods = "LEADER",
action = act.ActivatePaneDirection("Down"),
},
{
key = "k",
mods = "LEADER",
action = act.ActivatePaneDirection("Up"),
},
{
key = "l",
mods = "LEADER",
action = act.ActivatePaneDirection("Right"),
},
{
key = "J",
mods = "LEADER",
action = act.AdjustPaneSize({ "Down", 5 }),
},
{
key = "K",
mods = "LEADER",
action = act.AdjustPaneSize({ "Up", 5 }),
},
{
key = "L",
mods = "LEADER",
action = act.AdjustPaneSize({ "Right", 5 }),
},
}
local leader_common = require("keymaps.leaders").common
for _, v in ipairs(leader_common) do
table.insert(M.leader, v)
end
return M

View file

@ -47,8 +47,22 @@
"bindings": {
"N": "vim::JoinLines",
"l": "vim::InsertBefore",
"L": "vim::InsertFirstNonWhitespace",
"H": "pane::ActivatePrevItem",
"L": "vim::InsertFirstNonWhitespace"
}
},
{
"context": "vim_mode == visual || vim_mode == operator",
"bindings": {
"H": "vim::StartOfLine",
"I": "vim::EndOfLine"
}
},
{
"context": "vim_mode == normal",
"bindings": {
"H": "pane::ActivatePreviousItem",
"I": "pane::ActivateNextItem"
}
},
@ -75,7 +89,7 @@
"e": "vim::Up",
"i": "vim::Right",
"k": "search::SelectNextMatch",
"K": "search::SelectPrevMatch",
"K": "search::SelectPreviousMatch",
"N": ["workspace::SendKeystrokes", "n n n n n"],
"E": ["workspace::SendKeystrokes", "e e e e e"]
}
@ -85,7 +99,7 @@
"bindings": {
"n": "menu::SelectNext",
"e": "menu::SelectPrev",
"e": "menu::SelectPrevious",
"i": "project_panel::ExpandSelectedEntry",
"A": "project_panel::NewDirectory",
"a": "project_panel::NewFile",

View file

@ -47,20 +47,38 @@
"bindings": {
"N": "vim::JoinLines",
"l": "vim::InsertBefore",
"L": "vim::InsertFirstNonWhitespace",
"L": "vim::InsertFirstNonWhitespace"
}
},
{
"context": "vim_mode == visual || vim_mode == operator",
"bindings": {
"H": "vim::StartOfLine",
"I": "vim::EndOfLine"
}
},
{
"context": "vim_mode == normal",
"bindings": {
"H": "pane::ActivatePrevItem",
"I": "pane::ActivateNextItem"
}
},
{
"context": "vim_mode == normal || not_editing || EmptyPane",
"context": "GitPanel || ProjectPanel || CollabPanel || OutlinePanel || ChatPanel || VimControl || EmptyPane || SharedScreen || MarkdownPreview || KeyContextView",
"bindings": {
"space space": "file_finder::Toggle",
"space ;": "command_palette::Toggle",
"space f c": "zed::OpenSettings",
"space f e c": "zed::OpenSettings",
"space f t": "project_panel::ToggleFocus"
"space f t": "project_panel::ToggleFocus",
"ctrl-w h": "workspace::ActivatePaneLeft",
"ctrl-w i": "workspace::ActivatePaneRight",
"ctrl-w e": "workspace::ActivatePaneUp",
"ctrl-w n": "workspace::ActivatePaneDown"
}
},
{

View file

@ -18,6 +18,9 @@
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"outline_panel": {
"dock": "right"
},
"edit_predictions": {
"disabled_globs": ["*.bean"],
"mode": "eager_preview",
@ -36,6 +39,6 @@
"dark": "Catppuccin Mocha"
},
"relative_line_numbers": true,
"buffer_font_family": "JetBrainsMono Nerd Font",
"buffer_font_family": "Maple Mono NF CN",
"remove_trailing_whitespace_on_save": true
}

View file

@ -1 +0,0 @@
export FZF_DEFAULT_OPTS_FILE="$DOTFILES/common/fzfrc"

View file

@ -33,8 +33,11 @@ export PAGER="less -R"
export EDITOR="nvim"
export VISUAL="nvim"
export GHCUP_USE_XDG_DIRS=1
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
# Minimal PATH for early commands
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
export PATH="$HOME/.local/bin:/opt/share/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
if [ -d "/opt/homebrew/bin" ]; then # macOS
export PATH="/opt/homebrew/bin:$PATH"
@ -135,6 +138,11 @@ fi
if command -v emacs >/dev/null; then
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
fi
# Fzf
# This will make shell integration buggy
# if command -v fzf > /dev/null; then
# export FZF_DEFAULT_OPTS_FILE="$HOME/.dotfiles/common/fzfrc"
# fi
# tldr
# Works only with C client (did not verify)
if command -v tldr >/dev/null; then
@ -162,3 +170,4 @@ fi
if command -v vcpkg >/dev/null; then
export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg
fi

View file

@ -32,3 +32,5 @@ esac
for file in $DOTFILES/tools/zsh/mod/*.zsh; do
source $file
done
[ -f "/home/js0ny/.local/share/ghcup/env" ] && . "/home/js0ny/.local/share/ghcup/env" # ghcup-env