From f10828fdac65d1bf9c6f11e218e7ce4ef3f3e782 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 26 Feb 2025 03:06:43 +0000 Subject: [PATCH] chore(nvim): Change to lazy.nvim recommended format --- tools/browser/surfingkeys.js | 3 +- tools/nvim/lua/config/options.lua | 11 +- tools/nvim/lua/keymaps/leaders.bak | 194 ++++++++++++++++++ tools/nvim/lua/keymaps/leaders.lua | 30 --- tools/nvim/lua/plugins/appearance.lua | 74 ++++--- tools/nvim/lua/plugins/completion.lua | 7 +- tools/nvim/lua/plugins/edit.lua | 23 +-- tools/nvim/lua/plugins/fileutils.lua | 60 ++---- tools/nvim/lua/plugins/lsp.lua | 23 ++- tools/nvim/lua/plugins/misc.lua | 36 +++- tools/nvim/lua/plugins/mod/alpha-nvim.lua | 9 +- tools/nvim/lua/plugins/mod/auto-session.lua | 15 -- tools/nvim/lua/plugins/mod/bufferline.lua | 65 +++--- tools/nvim/lua/plugins/mod/hover-nvim.lua | 58 ++++++ tools/nvim/lua/plugins/mod/lspconfig.lua | 4 - tools/nvim/lua/plugins/mod/lualine/init.lua | 35 +--- tools/nvim/lua/plugins/mod/markview.lua | 37 ++-- tools/nvim/lua/plugins/mod/nvim-tree.lua | 41 ++-- .../nvim/lua/plugins/mod/nvim-treesitter.lua | 11 - tools/nvim/lua/plugins/mod/projects.lua | 15 -- .../nvim/lua/plugins/mod/render-markdown.lua | 134 ++++++------ tools/nvim/lua/plugins/mod/telescope.lua | 67 +++--- tools/nvim/lua/plugins/mod/winbar-nvim.lua | 41 ---- 23 files changed, 579 insertions(+), 414 deletions(-) create mode 100644 tools/nvim/lua/keymaps/leaders.bak delete mode 100644 tools/nvim/lua/plugins/mod/auto-session.lua create mode 100644 tools/nvim/lua/plugins/mod/hover-nvim.lua delete mode 100644 tools/nvim/lua/plugins/mod/lspconfig.lua delete mode 100644 tools/nvim/lua/plugins/mod/nvim-treesitter.lua delete mode 100644 tools/nvim/lua/plugins/mod/projects.lua delete mode 100644 tools/nvim/lua/plugins/mod/winbar-nvim.lua diff --git a/tools/browser/surfingkeys.js b/tools/browser/surfingkeys.js index 3e88888..84d493f 100644 --- a/tools/browser/surfingkeys.js +++ b/tools/browser/surfingkeys.js @@ -449,7 +449,7 @@ mapkey( ); mapkey( ",d", - "Extract [d]aw link", + "Extract [d]ownload link", function () { const url = new URL(window.location.href); if (url.href.endsWith("&dl=0")) { @@ -1003,3 +1003,4 @@ addVimMapKey( // #region Hints api.Hints.setCharacters("qwfpgarstdcv"); // Left-hand keys // #endregion +// diff --git a/tools/nvim/lua/config/options.lua b/tools/nvim/lua/config/options.lua index ebedc25..b58f849 100644 --- a/tools/nvim/lua/config/options.lua +++ b/tools/nvim/lua/config/options.lua @@ -51,9 +51,6 @@ opt.foldlevel = 99 opt.foldenable = false opt.foldlevelstart = 1 --- Disable status line: Use `lualine` instead -opt.laststatus = 0 - -- Hide Command Line if empty opt.cmdheight = 0 @@ -64,7 +61,15 @@ opt.sidescrolloff = 10 -- Always show 10 columns left/right of cursor -- Conceal: Hide some characters, might be useful for markdown and LaTeX opt.conceallevel = 2 +-- `laststatus` +-- Disable status line: Use `lualine` instead +-- opt.laststatus = 0 +-- 3: Global status line (always at the bottom) +opt.laststatus = 3 + vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" +-- hover.nvim +vim.o.mousemoveevent = true -- Hide zero-width space vim.api.nvim_create_autocmd("FileType", { diff --git a/tools/nvim/lua/keymaps/leaders.bak b/tools/nvim/lua/keymaps/leaders.bak new file mode 100644 index 0000000..0c69dba --- /dev/null +++ b/tools/nvim/lua/keymaps/leaders.bak @@ -0,0 +1,194 @@ +local M = {} + +local formatFx = function() + require("conform").format({ async = true }) +end + +local renameCurrentBuffer = function() + local old_name = vim.fn.expand("%:p") + local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/") + + if new_name == "" then + print("No new name provided") + return + elseif new_name == old_name then + return + end + + vim.cmd("write") + + local success, err = os.rename(old_name, new_name) + if not success then + print("Error renaming file: " .. err) + return + end + + vim.cmd("edit " .. new_name) + vim.cmd("bdelete " .. old_name) +end + +-- 通用映射函数 +local function apply_mappings(maps, prefix) + for _, map in ipairs(maps) do + local new_map = { + keys = prefix .. map.keys, + cmd = map.cmd, + opts = map.opts, + } + table.insert(M, new_map) + end +end +vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {}) + +local leader_mappings = { + general = { + { keys = "", cmd = ":Telescope find_files", opts = { desc = "Find Files" } }, + { keys = "/", cmd = ":Telescope live_grep", opts = { desc = "Grep Files" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "\\", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "F", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Explorer" } }, + { keys = "", cmd = "b#", opts = { desc = "Switch to last buffer" } }, + { keys = "!", cmd = ":FloatermToggle", opts = { desc = "Toggle Terminal" } }, + { keys = '"', cmd = ":!wezterm-gui &", pots = { desc = "Open External Terminal(wezterm)" } }, + { keys = ";", cmd = ":Telescope", pots = { desc = "Show Telescope Commands" } }, + }, + b = { -- +buffer + { keys = "0", cmd = "b#", opts = { desc = "Switch to last buffer" } }, + { keys = "1", cmd = ":BufferLineGotoBuffer 1", opts = { desc = "Switch to Buffer #1" } }, + { keys = "2", cmd = ":BufferLineGotoBuffer 2", opts = { desc = "Switch to Buffer #2" } }, + { keys = "3", cmd = ":BufferLineGotoBuffer 3", opts = { desc = "Switch to Buffer #3" } }, + { keys = "4", cmd = ":BufferLineGotoBuffer 4", opts = { desc = "Switch to Buffer #4" } }, + { keys = "5", cmd = ":BufferLineGotoBuffer 5", opts = { desc = "Switch to Buffer #5" } }, + { keys = "6", cmd = ":BufferLineGotoBuffer 6", opts = { desc = "Switch to Buffer #6" } }, + { keys = "7", cmd = ":BufferLineGotoBuffer 7", opts = { desc = "Switch to Buffer #7" } }, + { keys = "8", cmd = ":BufferLineGotoBuffer 8", opts = { desc = "Switch to Buffer #8" } }, + { keys = "9", cmd = ":BufferLineGotoBuffer 9", opts = { desc = "Switch to Buffer #9" } }, + { keys = "a", cmd = ":Alpha", opts = { desc = "Dashboard" } }, + { keys = "b", cmd = ":BufferLinePick", opts = { desc = "Quick Switch Buffers" } }, + { keys = "B", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, + { keys = "d", cmd = ":bdelete", opts = { desc = "Delete Buffer" } }, + { keys = "D", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "xx", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "xh", cmd = ":BufferLineCloseLeft", opts = { desc = "Delete Buffers Left" } }, + { keys = "xi", cmd = ":BufferLineCloseRight", opts = { desc = "Delete Buffers Right" } }, + { keys = "X", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "h", cmd = ":bprevious", opts = { desc = "Previous Buffer" } }, + { keys = "i", cmd = ":bnext", opts = { desc = "Next Buffer" } }, + { keys = "H", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "I", cmd = ":blast", opts = { desc = "Last Buffer" } }, + { keys = "0", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "^", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "$", cmd = ":blast", opts = { desc = "Last Buffer" } }, + { keys = "s", cmd = ":new", opts = { desc = "Scratch buffers" } }, + { keys = "t", cmd = ":BufferLineTogglePin", opts = { desc = "Pin Buffer" } }, + { keys = "y", cmd = ":%y+", opts = { desc = "Copy Buffer to Clipboard" } }, + }, + c = { -- +code/compile + { keys = "r", cmd = ":RunCode", opts = { desc = "Run code" } }, + { keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } }, + { keys = "e", cmd = ":Telescope diagnostics", opts = { desc = "Navigate errors/warnings" } }, + { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, + { keys = "s", cmd = ":Telescope treesitter", opts = { desc = "Search symbols" } }, + { keys = "S", cmd = ":Telescope grep_string", opts = { desc = "Search current symbol" } }, + }, + f = { -- +file/find + { keys = "f", cmd = ":Telescope fd", opts = { desc = "Find Files" } }, + { keys = "F", cmd = ":GrugFar", opts = { desc = "Search & Replace" } }, + { keys = "l", cmd = ":set filetype=", opts = { desc = "Set Filetype to ..." } }, + { keys = "n", cmd = ":new", opts = { desc = "New File" } }, + { keys = "s", cmd = ":write", opts = { desc = "Save File" } }, + { keys = "S", cmd = ":wall", opts = { desc = "Save All Files" } }, + { keys = "b", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, + { keys = "D", cmd = "!trash-rm %", opts = { desc = "Delete current file" } }, + { keys = "t", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Tree" } }, + { keys = "T", cmd = ":FloatermNew", opts = { desc = "Spawn a float terminal" } }, + { keys = "h", cmd = ":Telescope oldfiles", opts = { desc = "Search history files" } }, + { keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim", opts = { desc = "Search Config" } }, + { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, + { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, + { keys = "x", cmd = ":Lazy", opts = { desc = "Open extension view" } }, + { keys = "yy", cmd = ":let @+ = expand('%:p')", opts = { desc = "Copy file path" } }, + { keys = "yY", cmd = ":let @+ = expand('%')", opts = { desc = "Copy relative file path" } }, + { keys = "yn", cmd = ":let @+ = expand('%:t')", opts = { desc = "Copy file name" } }, + { keys = "yN", cmd = ":let @+ = expand('%:t:r')", opts = { desc = "Copy file name without extension" } }, + { keys = "yd", cmd = ":let @+ = expand('%:p:h')", opts = { desc = "Copy directory path" } }, + { + keys = "yl", + cmd = ":let @+ = expand('%:p') . ':' . line('.')", + opts = { desc = "Copy file path with line number" }, + }, + { + keys = "yL", + cmd = ":let @+ = expand('%') . ':' . line('.')", + opts = { desc = "Copy relative file path with line number" }, + }, + }, + g = { -- +git/version control + { keys = "g", cmd = ":LazyGit", opts = { desc = "Toggle LazyGit" } }, + { keys = "c", cmd = ":Telescope git_commits", opts = { desc = "Show commits" } }, + { keys = "b", cmd = ":Gitsigns blame", opts = { desc = "Blame file" } }, + { keys = "d", cmd = ":Gitsigns diffthis", opts = { desc = "Diff file" } }, + { keys = "B", cmd = ":Gitsigns toggle_current_line_blame", opts = { desc = "Toggle line blame" } }, + { keys = "s", cmd = ":Telescope git_status", opts = { desc = "Git Status" } }, + { keys = "t", cmd = ":Telescope git_branches", opts = { desc = "Git Branches" } }, + }, + j = { -- +lsp + { keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } }, + }, + p = { -- +project + { keys = "p", cmd = ":Telescope projects", opts = { desc = "List all Projects" } }, + { keys = "g", cmd = ":Telescope projects", opts = { desc = "List all Git Projects" } }, + { keys = "s", cmd = ":Telescope session-lens", opts = { desc = "List all sessions" } }, + }, + q = { -- +quit + { keys = "q", cmd = ":q", opts = { desc = "Quit" } }, + { keys = "Q", cmd = ":qa!", opts = { desc = "Force Quit" } }, + { keys = "w", cmd = ":wq", opts = { desc = "Write and Quit" } }, + { keys = "W", cmd = ":wall:qa!", opts = { desc = "Write all and Force Quit" } }, + }, + t = { -- +toggle/test + { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, + { keys = "F", cmd = ":FormatToggle", opts = { desc = "Toggle autoformat-on-save" } }, + { keys = "t", cmd = ":FloatermToggle", opts = { desc = "toggle visibility of the float terminal" } }, + }, + u = { -- +ui + { keys = "i", cmd = ":Telescope colorscheme", opts = { desc = "Change colorscheme" } }, + { keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } }, + }, + w = { -- +window + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "H", cmd = "H", opts = { desc = "Move Window Left" } }, + { keys = "N", cmd = "J", opts = { desc = "Move Window Down" } }, + { keys = "E", cmd = "K", opts = { desc = "Move Window Up" } }, + { keys = "I", cmd = "L", opts = { desc = "Move Window Right" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "/", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "d", cmd = "c", opts = { desc = "Close Window" } }, + { keys = "D", cmd = "o", opts = { desc = "Close Other Windows" } }, + { keys = "r", cmd = "r", opts = { desc = "Rotate Windows" } }, + { keys = "R", cmd = "R", opts = { desc = "Reverse Rotate Windows" } }, + { keys = "t", cmd = "T", opts = { desc = "Move Window to New Tab" } }, + { keys = "]", cmd = ":resize +5", opts = { desc = "Increase Window Size" } }, + { keys = "[", cmd = ":resize -5", opts = { desc = "Decrease Window Size" } }, + { keys = "M", cmd = ":resize:vertical resize", opts = { desc = "Maximize window size" } }, + }, +} + +for key, maps in pairs(leader_mappings) do + if key == "general" then + apply_mappings(maps, "") + else + apply_mappings(maps, "" .. key) + end +end + +return M diff --git a/tools/nvim/lua/keymaps/leaders.lua b/tools/nvim/lua/keymaps/leaders.lua index 0c69dba..2026f79 100644 --- a/tools/nvim/lua/keymaps/leaders.lua +++ b/tools/nvim/lua/keymaps/leaders.lua @@ -42,8 +42,6 @@ vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {}) local leader_mappings = { general = { - { keys = "", cmd = ":Telescope find_files", opts = { desc = "Find Files" } }, - { keys = "/", cmd = ":Telescope live_grep", opts = { desc = "Grep Files" } }, { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, { keys = "\\", cmd = ":vsplit", opts = { desc = "Split to right" } }, { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, @@ -51,11 +49,8 @@ local leader_mappings = { { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, - { keys = "F", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Explorer" } }, { keys = "", cmd = "b#", opts = { desc = "Switch to last buffer" } }, - { keys = "!", cmd = ":FloatermToggle", opts = { desc = "Toggle Terminal" } }, { keys = '"', cmd = ":!wezterm-gui &", pots = { desc = "Open External Terminal(wezterm)" } }, - { keys = ";", cmd = ":Telescope", pots = { desc = "Show Telescope Commands" } }, }, b = { -- +buffer { keys = "0", cmd = "b#", opts = { desc = "Switch to last buffer" } }, @@ -68,9 +63,7 @@ local leader_mappings = { { keys = "7", cmd = ":BufferLineGotoBuffer 7", opts = { desc = "Switch to Buffer #7" } }, { keys = "8", cmd = ":BufferLineGotoBuffer 8", opts = { desc = "Switch to Buffer #8" } }, { keys = "9", cmd = ":BufferLineGotoBuffer 9", opts = { desc = "Switch to Buffer #9" } }, - { keys = "a", cmd = ":Alpha", opts = { desc = "Dashboard" } }, { keys = "b", cmd = ":BufferLinePick", opts = { desc = "Quick Switch Buffers" } }, - { keys = "B", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, { keys = "d", cmd = ":bdelete", opts = { desc = "Delete Buffer" } }, { keys = "D", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, { keys = "xx", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, @@ -89,26 +82,15 @@ local leader_mappings = { { keys = "y", cmd = ":%y+", opts = { desc = "Copy Buffer to Clipboard" } }, }, c = { -- +code/compile - { keys = "r", cmd = ":RunCode", opts = { desc = "Run code" } }, { keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } }, - { keys = "e", cmd = ":Telescope diagnostics", opts = { desc = "Navigate errors/warnings" } }, { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, - { keys = "s", cmd = ":Telescope treesitter", opts = { desc = "Search symbols" } }, - { keys = "S", cmd = ":Telescope grep_string", opts = { desc = "Search current symbol" } }, }, f = { -- +file/find - { keys = "f", cmd = ":Telescope fd", opts = { desc = "Find Files" } }, - { keys = "F", cmd = ":GrugFar", opts = { desc = "Search & Replace" } }, - { keys = "l", cmd = ":set filetype=", opts = { desc = "Set Filetype to ..." } }, { keys = "n", cmd = ":new", opts = { desc = "New File" } }, { keys = "s", cmd = ":write", opts = { desc = "Save File" } }, { keys = "S", cmd = ":wall", opts = { desc = "Save All Files" } }, - { keys = "b", cmd = ":Telescope buffers", opts = { desc = "List Buffers" } }, { keys = "D", cmd = "!trash-rm %", opts = { desc = "Delete current file" } }, { keys = "t", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Tree" } }, - { keys = "T", cmd = ":FloatermNew", opts = { desc = "Spawn a float terminal" } }, - { keys = "h", cmd = ":Telescope oldfiles", opts = { desc = "Search history files" } }, - { keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim", opts = { desc = "Search Config" } }, { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, { keys = "x", cmd = ":Lazy", opts = { desc = "Open extension view" } }, @@ -129,21 +111,11 @@ local leader_mappings = { }, }, g = { -- +git/version control - { keys = "g", cmd = ":LazyGit", opts = { desc = "Toggle LazyGit" } }, - { keys = "c", cmd = ":Telescope git_commits", opts = { desc = "Show commits" } }, - { keys = "b", cmd = ":Gitsigns blame", opts = { desc = "Blame file" } }, - { keys = "d", cmd = ":Gitsigns diffthis", opts = { desc = "Diff file" } }, - { keys = "B", cmd = ":Gitsigns toggle_current_line_blame", opts = { desc = "Toggle line blame" } }, - { keys = "s", cmd = ":Telescope git_status", opts = { desc = "Git Status" } }, - { keys = "t", cmd = ":Telescope git_branches", opts = { desc = "Git Branches" } }, }, j = { -- +lsp { keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } }, }, p = { -- +project - { keys = "p", cmd = ":Telescope projects", opts = { desc = "List all Projects" } }, - { keys = "g", cmd = ":Telescope projects", opts = { desc = "List all Git Projects" } }, - { keys = "s", cmd = ":Telescope session-lens", opts = { desc = "List all sessions" } }, }, q = { -- +quit { keys = "q", cmd = ":q", opts = { desc = "Quit" } }, @@ -154,10 +126,8 @@ local leader_mappings = { t = { -- +toggle/test { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, { keys = "F", cmd = ":FormatToggle", opts = { desc = "Toggle autoformat-on-save" } }, - { keys = "t", cmd = ":FloatermToggle", opts = { desc = "toggle visibility of the float terminal" } }, }, u = { -- +ui - { keys = "i", cmd = ":Telescope colorscheme", opts = { desc = "Change colorscheme" } }, { keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } }, }, w = { -- +window diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 6424a0e..7f1ad5d 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -9,13 +9,10 @@ return { light = "latte", dark = "mocha", }, - styles = { - -- keywords = { "underline" }, - }, integrations = { "lualine", }, - } + }, }, { "olimorris/onedarkpro.nvim" }, @@ -31,30 +28,61 @@ return { }, { -- Highlight yanked text "gbprod/yanky.nvim", - config = function() - require("yanky").setup({ - highlight = { - on_put = true, - on_yank = true, - timer = 500, - }, - }) - end, + opts = { + highlight = { + on_put = true, + on_yank = true, + timer = 500, + }, + }, }, - { import = "plugins.mod.alpha-nvim" }, -- Dashboard - { import = "plugins.mod.winbar-nvim" }, -- Breadcrumb - { import = "plugins.mod.bufferline" }, -- Buffer Top Bar - { -- Git Blames, Changes + { import = "plugins.mod.alpha-nvim" }, -- Dashboard + { -- Breadcrumb + "Bekaboo/dropbar.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + opts = {}, + keys = { + { + "+", + 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 "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup({ - current_line_blame = true, - }) - end, + opts = { + current_line_blame = true, + }, + keys = { + { "b", ":Gitsigns blame", desc = "Blame file" }, + { "d", ":Gitsigns diffthis", desc = "Diff file" }, + { "B", ":Gitsigns toggle_current_line_blame", desc = "Toggle line blame" }, + }, }, { -- Highlight and navigate between TODOs "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, opts = {}, + dependencies = { "nvim-lua/plenary.nvim" }, }, } diff --git a/tools/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua index 5ab5914..6212e5b 100644 --- a/tools/nvim/lua/plugins/completion.lua +++ b/tools/nvim/lua/plugins/completion.lua @@ -15,8 +15,9 @@ return { }, { "zbirenbaum/copilot-cmp", - config = function() - require("copilot_cmp").setup() - end, + opts = {}, + -- config = function() + -- require("copilot_cmp").setup() + -- end, }, } diff --git a/tools/nvim/lua/plugins/edit.lua b/tools/nvim/lua/plugins/edit.lua index 25dc599..6d3331f 100644 --- a/tools/nvim/lua/plugins/edit.lua +++ b/tools/nvim/lua/plugins/edit.lua @@ -2,16 +2,15 @@ return { { "folke/flash.nvim", event = "VeryLazy", - ---@type Flash.Config opts = {}, -- 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" }, - { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, - }, + 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" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, }, { "js0ny/vim-visual-multi-colemak-hnei", @@ -21,20 +20,12 @@ return { "echasnovski/mini.pairs", version = false, opts = {}, - -- config = function() - -- require("mini.pairs").setup() - -- end, }, { "kylechui/nvim-surround", version = "*", -- Use for stability; omit to use `main` branch for the latest features event = "VeryLazy", opts = {}, - -- config = function() - -- require("nvim-surround").setup({ - -- -- Configuration here, or leave empty to use defaults - -- }) - -- end, }, { "MagicDuck/grug-far.nvim", diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index 75b0457..0d88b3d 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -1,51 +1,29 @@ return { - { import = "plugins.mod.auto-session" }, + { + "rmagatti/auto-session", + lazy = false, + + opts = { + suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, + }, + }, { import = "plugins.mod.nvim-tree" }, { import = "plugins.mod.telescope" }, - { import = "plugins.mod.projects" }, { - "lewis6991/hover.nvim", + "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("hover").setup({ - init = function() - -- Require providers - require("hover.providers.lsp") - -- require('hover.providers.gh') - -- require('hover.providers.gh_user') - -- require('hover.providers.jira') - -- require('hover.providers.dap') - -- require('hover.providers.fold_preview') - require("hover.providers.diagnostic") - -- require('hover.providers.man') - -- require('hover.providers.dictionary') - end, - preview_opts = { - border = "single", - }, - -- Whether the contents of a currently open hover window should be moved - -- to a :h preview-window when pressing the hover keymap. - preview_window = false, - title = true, - mouse_providers = { - "LSP", - }, - mouse_delay = 1000, - }) - - -- Setup keymaps - vim.keymap.set("n", "gE", require("hover").hover_select, { desc = "hover.nvim (select)" }) - vim.keymap.set("n", "", function() - require("hover").hover_switch("previous") - end, { desc = "hover.nvim (previous source)" }) - vim.keymap.set("n", "", function() - require("hover").hover_switch("next") - end, { desc = "hover.nvim (next source)" }) - - -- Mouse support - vim.keymap.set("n", "", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" }) - vim.o.mousemoveevent = true + require("telescope").load_extension("projects") end, + dependencies = { "nvim-telescope/telescope.nvim" }, }, + { import = "plugins.mod.hover-nvim" }, { "kdheepak/lazygit.nvim", lazy = true, diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index ed3f607..ff6543f 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -32,15 +32,10 @@ return { { "williamboman/mason.nvim" }, { "neovim/nvim-lspconfig" }, }, - config = function() - local mason_lspconfig = require("mason-lspconfig") - local servers = require("config.servers").servers - - mason_lspconfig.setup({ - ensure_installed = servers, - automatic_installation = false, - }) - end, + opts = { + ensure_installed = require("config.servers").servers, + automatic_installation = false, + }, }, { import = "plugins.mod.conform-nvim" }, { "nvim-treesitter/nvim-treesitter-context" }, @@ -82,7 +77,15 @@ return { end, }, { import = "plugins.mod.trouble-nvim" }, - { import = "plugins.mod.nvim-treesitter" }, + { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + opts = { + ensure_installed = { "markdown", "markdown_inline", "latex", "python" }, + highlight = { enable = true }, + indent = { enable = true }, + }, + }, { "folke/lazydev.nvim", ft = "lua", -- only load on lua files diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 3517c3b..b193994 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,16 +1,36 @@ return { { "wakatime/vim-wakatime", lazy = false }, - { "voldikss/vim-floaterm" }, { - "CRAG666/betterTerm.nvim", - opts = { - position = "bot", - size = 15, - } + "voldikss/vim-floaterm", + keys = { + { "!", ":FloatermToggle", desc = "Toggle Terminal" }, + { "tt", ":FloatermToggle", desc = "Toggle Terminal" }, + { "fT", ":FloatermNew", desc = "Spawn a float terminal" }, + }, + cmd = { + "FloatermToggle", + "FloatermNew", + }, + }, + { + "CRAG666/code_runner.nvim", + config = true, + keys = { + { "cr", ":RunCode", desc = "Run code" }, + }, + dependencies = { + + { + "CRAG666/betterTerm.nvim", + opts = { + position = "bot", + size = 15, + }, + }, + }, }, - { "CRAG666/code_runner.nvim", config = true }, { import = "plugins.mod.obsidian-nvim" }, { import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.copilot-lua" }, - { import = "plugins.mod.avante-nvim" } + { import = "plugins.mod.avante-nvim" }, } diff --git a/tools/nvim/lua/plugins/mod/alpha-nvim.lua b/tools/nvim/lua/plugins/mod/alpha-nvim.lua index b052569..738e2ff 100644 --- a/tools/nvim/lua/plugins/mod/alpha-nvim.lua +++ b/tools/nvim/lua/plugins/mod/alpha-nvim.lua @@ -2,9 +2,12 @@ return { { "goolord/alpha-nvim", - dependencies = { - -- 'echasnovski/mini.icons', - -- 'nvim-lua/plenary.nvim' + dependencies = {}, + keys = { + { "ba", ":Alpha", desc = "Toggle Alpha Dashboard" }, + }, + cmd = { + "Alpha", }, config = function() local alpha = require("alpha") diff --git a/tools/nvim/lua/plugins/mod/auto-session.lua b/tools/nvim/lua/plugins/mod/auto-session.lua deleted file mode 100644 index 829f1c5..0000000 --- a/tools/nvim/lua/plugins/mod/auto-session.lua +++ /dev/null @@ -1,15 +0,0 @@ ----@diagnostic disable: undefined-doc-name -return { - { - "rmagatti/auto-session", - lazy = false, - - ---enables autocomplete for opts - ---@module "auto-session" - ---@type AutoSession.Config - opts = { - suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, - -- log_level = 'debug', - }, - }, -} diff --git a/tools/nvim/lua/plugins/mod/bufferline.lua b/tools/nvim/lua/plugins/mod/bufferline.lua index bde9588..e20c466 100644 --- a/tools/nvim/lua/plugins/mod/bufferline.lua +++ b/tools/nvim/lua/plugins/mod/bufferline.lua @@ -2,29 +2,46 @@ return { "akinsho/bufferline.nvim", dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 after = "catppuccin", - config = function() - require("bufferline").setup({ - options = { - indicator = { - icon = "▎", -- this should be omitted if indicator style is not 'icon' - style = "icon", - }, - diagnostics = "nvim_lsp", - diagnostics_indicator = function(count, level, diagnostics_dict, context) - local icon = level:match("error") and " " or " " - return " " .. icon .. count - end, - - show_buffer_icons = true, - numbers = "ordinal", -- 显示 buffer 序号 - close_command = "bdelete! %d", -- 关闭 buffer 的命令 - right_mouse_command = "bdelete! %d", -- 右键关闭 - offsets = { - { filetype = "NvimTree", text = "资源管理器", text_align = "center" }, - }, - separator_style = "thin", + lazy = false, + keys = { + { "b1", ":BufferLineGotoBuffer 1", desc = "Switch to Buffer #1" }, + { "b2", ":BufferLineGotoBuffer 2", desc = "Switch to Buffer #2" }, + { "b3", ":BufferLineGotoBuffer 3", desc = "Switch to Buffer #3" }, + { "b4", ":BufferLineGotoBuffer 4", desc = "Switch to Buffer #4" }, + { "b5", ":BufferLineGotoBuffer 5", desc = "Switch to Buffer #5" }, + { "b6", ":BufferLineGotoBuffer 6", desc = "Switch to Buffer #6" }, + { "b7", ":BufferLineGotoBuffer 7", desc = "Switch to Buffer #7" }, + { "b8", ":BufferLineGotoBuffer 8", desc = "Switch to Buffer #8" }, + { "b9", ":BufferLineGotoBuffer 9", desc = "Switch to Buffer #9" }, + { "bb", ":BufferLinePick", desc = "Quick Switch Buffers" }, + { "bD", ":BufferLineCloseOthers", desc = "Delete Other Buffers" }, + { "bxx", ":BufferLineCloseOthers", desc = "Delete Other Buffers" }, + { "bxh", ":BufferLineCloseLeft", desc = "Delete Buffers Left" }, + { "bxi", ":BufferLineCloseRight", desc = "Delete Buffers Right" }, + { "bX", ":BufferLineCloseOthers", desc = "Delete Other Buffers" }, + { "bt", ":BufferLineTogglePin", desc = "Pin Buffer" }, + }, + opts = { + options = { + indicator = { + icon = "▎", -- this should be omitted if indicator style is not 'icon' + style = "icon", }, - highlights = require("catppuccin.groups.integrations.bufferline").get(), - }) - end, + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local icon = level:match("error") and " " or " " + return " " .. icon .. count + end, + + show_buffer_icons = true, + numbers = "ordinal", -- 显示 buffer 序号 + close_command = "bdelete! %d", -- 关闭 buffer 的命令 + right_mouse_command = "bdelete! %d", -- 右键关闭 + offsets = { + { filetype = "NvimTree", text = "资源管理器", text_align = "center" }, + }, + separator_style = "thin", + }, + highlights = require("catppuccin.groups.integrations.bufferline").get(), + }, } diff --git a/tools/nvim/lua/plugins/mod/hover-nvim.lua b/tools/nvim/lua/plugins/mod/hover-nvim.lua new file mode 100644 index 0000000..cb52557 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/hover-nvim.lua @@ -0,0 +1,58 @@ +return { + "lewis6991/hover.nvim", + opts = { + init = function() + -- Require providers + require("hover.providers.lsp") + -- require('hover.providers.gh') + -- require('hover.providers.gh_user') + -- require('hover.providers.jira') + -- require('hover.providers.dap') + -- require('hover.providers.fold_preview') + require("hover.providers.diagnostic") + -- require('hover.providers.man') + -- require('hover.providers.dictionary') + end, + preview_opts = { + border = "single", + }, + -- Whether the contents of a currently open hover window should be moved + -- to a :h preview-window when pressing the hover keymap. + preview_window = false, + title = true, + mouse_providers = { + "LSP", + }, + mouse_delay = 1000, + }, + keys = { + { + "gE", + function() + require("hover").hover_select() + end, + desc = "hover.nvim (select)", + }, + { + "", + function() + require("hover").hover_switch("previous") + end, + desc = "hover.nvim (previous source)", + }, + { + "", + function() + require("hover").hover_switch("next") + end, + desc = "hover.nvim (next source)", + }, + { + "", + function() + require("hover").hover_mouse() + end, + desc = "hover.nvim (mouse)", + }, + }, +} diff --git a/tools/nvim/lua/plugins/mod/lspconfig.lua b/tools/nvim/lua/plugins/mod/lspconfig.lua deleted file mode 100644 index 3d657d0..0000000 --- a/tools/nvim/lua/plugins/mod/lspconfig.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "neovim/nvim-lspconfig", - lazy = false, -} diff --git a/tools/nvim/lua/plugins/mod/lualine/init.lua b/tools/nvim/lua/plugins/mod/lualine/init.lua index 0d73211..03fec6d 100644 --- a/tools/nvim/lua/plugins/mod/lualine/init.lua +++ b/tools/nvim/lua/plugins/mod/lualine/init.lua @@ -20,39 +20,8 @@ local config = { component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, theme = "catppuccin", - -- theme = { - -- -- We are going to use lualine_c an lualine_x as left and - -- -- right section. Both are highlighted by c theme . So we - -- -- are just setting default looks o statusline - -- -- normal = { c = { fg = colors.mantle, bg = colors.mantle } }, - -- -- visual = { c = { fg = colors.mantle, bg = colors.mauve } }, - -- -- normal = { c = { fg = colors.mantle, bg = colors.sapphire } }, - -- inactive = { c = { fg = colors.mantle, bg = colors.mantle } }, - -- normal = { - -- a = { - -- fg = colors.scheme.mantle, - -- bg = colors.mode.n, - -- }, - -- b = { - -- bg = colors.scheme.surface2, - -- }, - -- c = { - -- bg = colors.scheme.crust, - -- }, - -- }, - -- visual = { - -- a = { - -- fg = colors.scheme.mantle, - -- bg = colors.mode.v, - -- }, - -- }, - -- insert = { - -- a = { - -- fg = colors.scheme.mantle, - -- bg = colors.mode.i, - -- }, - -- }, - -- }, + -- IDE-like Global Status + globalstaus = true, }, sections = { -- these are to remove the defaults diff --git a/tools/nvim/lua/plugins/mod/markview.lua b/tools/nvim/lua/plugins/mod/markview.lua index f4a097f..39c52d0 100644 --- a/tools/nvim/lua/plugins/mod/markview.lua +++ b/tools/nvim/lua/plugins/mod/markview.lua @@ -1,3 +1,5 @@ +-- This won't be loaded +-- I keep this since render-markdown sometimes buggy return { { "OXY2DEV/markview.nvim", @@ -6,25 +8,22 @@ return { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons", }, - config = function() - local presets = require("markview.presets") - require("markview").setup({ - checkboxes = presets.checkboxes.nerd, - headings = { - enable = true, - shift_width = 1, - heading_1 = { - style = "label", - hl = "MarkviewH1", - }, + opts = { + checkboxes = require("markview-presets").checkboxes.nerd, + headings = { + enable = true, + shift_width = 1, + heading_1 = { + style = "label", + hl = "MarkviewH1", }, - code_blocks = { - style = "language", - language_direction = "right", - hl = "MarkviewCode", - info_hl = "MarkviewCodeInfo", - }, - }) - end, + }, + code_blocks = { + style = "language", + language_direction = "right", + hl = "MarkviewCode", + info_hl = "MarkviewCodeInfo", + }, + }, }, } diff --git a/tools/nvim/lua/plugins/mod/nvim-tree.lua b/tools/nvim/lua/plugins/mod/nvim-tree.lua index 66091d9..f86592e 100644 --- a/tools/nvim/lua/plugins/mod/nvim-tree.lua +++ b/tools/nvim/lua/plugins/mod/nvim-tree.lua @@ -23,30 +23,31 @@ return { "nvim-tree/nvim-tree.lua", version = "*", lazy = false, + keys = { + { "ft", ":NvimTreeToggle", desc = "Toggle File Explorer" }, + }, dependencies = { "nvim-tree/nvim-web-devicons", }, - config = function() - require("nvim-tree").setup({ - on_attach = my_on_attach, - sync_root_with_cwd = true, - respect_buf_cwd = true, - disable_netrw = true, - renderer = { - icons = { - glyphs = { - git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29 - unmerged = "", - renamed = "➜", - deleted = "", - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - }, + opts = { + on_attach = my_on_attach, + sync_root_with_cwd = true, + respect_buf_cwd = true, + disable_netrw = true, + renderer = { + icons = { + glyphs = { + git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29 + unmerged = "", + renamed = "➜", + deleted = "", + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", }, }, }, - }) - end, + }, + }, } diff --git a/tools/nvim/lua/plugins/mod/nvim-treesitter.lua b/tools/nvim/lua/plugins/mod/nvim-treesitter.lua deleted file mode 100644 index ca5ba90..0000000 --- a/tools/nvim/lua/plugins/mod/nvim-treesitter.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { "markdown", "markdown_inline", "latex", "python" }, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, -} diff --git a/tools/nvim/lua/plugins/mod/projects.lua b/tools/nvim/lua/plugins/mod/projects.lua deleted file mode 100644 index d8b66e0..0000000 --- a/tools/nvim/lua/plugins/mod/projects.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "ahmedkhalf/project.nvim", - config = function() - require("project_nvim").setup({ - detection_methods = { "lsp", "pattern" }, - patterns = { ".git", "Makefile", "package.json" }, - sync_root_with_cwd = true, - silent_chdir = true, - scope_chdir = "global", - }) - - require("telescope").load_extension("projects") - end, - dependencies = { "nvim-telescope/telescope.nvim" }, -} diff --git a/tools/nvim/lua/plugins/mod/render-markdown.lua b/tools/nvim/lua/plugins/mod/render-markdown.lua index 13d26f3..97573ef 100644 --- a/tools/nvim/lua/plugins/mod/render-markdown.lua +++ b/tools/nvim/lua/plugins/mod/render-markdown.lua @@ -2,77 +2,73 @@ return { { "MeanderingProgrammer/render-markdown.nvim", lazy = false, + ft = { "markdown", "Avante" }, opts = { file_types = { "markdown", "Avante" }, + render_modes = { "n", "c", "t" }, + latex = { + enabled = true, + converter = "latex2text", + highlight = "RenderMarkdownMath", + 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, + }, + link = { + custom = { + python = { pattern = "%.py", icon = " " }, + lua = { pattern = "%.lua", icon = " " }, + markdown = { pattern = "%.md", icon = " " }, + }, + }, + bullet = { + icons = { "󰮯 ", "●", "○", "◆", "◇" }, + }, + checkbox = { + checked = { scope_highlight = "@markup.strikethrough" }, + unchecked = { scope_highlight = "@comment.todo" }, + }, + code = { + position = "right", + width = "block", + right_pad = 10, + }, + callout = { + note = { raw = "[!NOTE]", rendered = "󰋽 Note", highlight = "RenderMarkdownInfo" }, + tip = { raw = "[!TIP]", rendered = "󰌶 Tip", highlight = "RenderMarkdownSuccess" }, + important = { raw = "[!IMPORTANT]", rendered = "󰅾 Important", highlight = "RenderMarkdownHint" }, + warning = { raw = "[!WARNING]", rendered = "󰀪 Warning", highlight = "RenderMarkdownWarn" }, + caution = { raw = "[!CAUTION]", rendered = "󰳦 Caution", highlight = "RenderMarkdownError" }, + abstract = { raw = "[!ABSTRACT]", rendered = "󰨸 Abstract", highlight = "RenderMarkdownInfo" }, + summary = { raw = "[!SUMMARY]", rendered = "󰨸 Summary", highlight = "RenderMarkdownInfo" }, + tldr = { raw = "[!TLDR]", rendered = "󰨸 Tldr", highlight = "RenderMarkdownInfo" }, + info = { raw = "[!INFO]", rendered = "󰋽 Info", highlight = "RenderMarkdownInfo" }, + todo = { raw = "[!TODO]", rendered = "󰗡 Todo", highlight = "RenderMarkdownInfo" }, + hint = { raw = "[!HINT]", rendered = "󰌶 Hint", highlight = "RenderMarkdownSuccess" }, + success = { raw = "[!SUCCESS]", rendered = "󰄬 Success", highlight = "RenderMarkdownSuccess" }, + check = { raw = "[!CHECK]", rendered = "󰄬 Check", highlight = "RenderMarkdownSuccess" }, + done = { raw = "[!DONE]", rendered = "󰄬 Done", highlight = "RenderMarkdownSuccess" }, + question = { raw = "[!QUESTION]", rendered = "󰘥 Question", highlight = "RenderMarkdownWarn" }, + help = { raw = "[!HELP]", rendered = "󰘥 Help", highlight = "RenderMarkdownWarn" }, + faq = { raw = "[!FAQ]", rendered = "󰘥 Faq", highlight = "RenderMarkdownWarn" }, + attention = { raw = "[!ATTENTION]", rendered = "󰀪 Attention", highlight = "RenderMarkdownWarn" }, + failure = { raw = "[!FAILURE]", rendered = "󰅖 Failure", highlight = "RenderMarkdownError" }, + fail = { raw = "[!FAIL]", rendered = "󰅖 Fail", highlight = "RenderMarkdownError" }, + missing = { raw = "[!MISSING]", rendered = "󰅖 Missing", highlight = "RenderMarkdownError" }, + danger = { raw = "[!DANGER]", rendered = "󱐌 Danger", highlight = "RenderMarkdownError" }, + error = { raw = "[!ERROR]", rendered = "󱐌 Error", highlight = "RenderMarkdownError" }, + bug = { raw = "[!BUG]", rendered = "󰨰 Bug", highlight = "RenderMarkdownError" }, + example = { raw = "[!EXAMPLE]", rendered = "󰉹 Example", highlight = "RenderMarkdownHint" }, + quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" }, + cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" }, + }, }, - ft = { "markdown", "Avante" }, - config = function() - require("render-markdown").setup({ - render_modes = { "n", "c", "t" }, - latex = { - enabled = true, - converter = "latex2text", - highlight = "RenderMarkdownMath", - 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, - }, - link = { - custom = { - python = { pattern = "%.py", icon = " " }, - lua = { pattern = "%.lua", icon = " " }, - markdown = { pattern = "%.md", icon = " " }, - }, - }, - bullet = { - icons = { "󰮯 ", "●", "○", "◆", "◇" }, - }, - checkbox = { - checked = { scope_highlight = "@markup.strikethrough" }, - unchecked = { scope_highlight = "@comment.todo" }, - }, - code = { - position = "right", - width = "block", - right_pad = 10, - }, - callout = { - note = { raw = "[!NOTE]", rendered = "󰋽 Note", highlight = "RenderMarkdownInfo" }, - tip = { raw = "[!TIP]", rendered = "󰌶 Tip", highlight = "RenderMarkdownSuccess" }, - important = { raw = "[!IMPORTANT]", rendered = "󰅾 Important", highlight = "RenderMarkdownHint" }, - warning = { raw = "[!WARNING]", rendered = "󰀪 Warning", highlight = "RenderMarkdownWarn" }, - caution = { raw = "[!CAUTION]", rendered = "󰳦 Caution", highlight = "RenderMarkdownError" }, - abstract = { raw = "[!ABSTRACT]", rendered = "󰨸 Abstract", highlight = "RenderMarkdownInfo" }, - summary = { raw = "[!SUMMARY]", rendered = "󰨸 Summary", highlight = "RenderMarkdownInfo" }, - tldr = { raw = "[!TLDR]", rendered = "󰨸 Tldr", highlight = "RenderMarkdownInfo" }, - info = { raw = "[!INFO]", rendered = "󰋽 Info", highlight = "RenderMarkdownInfo" }, - todo = { raw = "[!TODO]", rendered = "󰗡 Todo", highlight = "RenderMarkdownInfo" }, - hint = { raw = "[!HINT]", rendered = "󰌶 Hint", highlight = "RenderMarkdownSuccess" }, - success = { raw = "[!SUCCESS]", rendered = "󰄬 Success", highlight = "RenderMarkdownSuccess" }, - check = { raw = "[!CHECK]", rendered = "󰄬 Check", highlight = "RenderMarkdownSuccess" }, - done = { raw = "[!DONE]", rendered = "󰄬 Done", highlight = "RenderMarkdownSuccess" }, - question = { raw = "[!QUESTION]", rendered = "󰘥 Question", highlight = "RenderMarkdownWarn" }, - help = { raw = "[!HELP]", rendered = "󰘥 Help", highlight = "RenderMarkdownWarn" }, - faq = { raw = "[!FAQ]", rendered = "󰘥 Faq", highlight = "RenderMarkdownWarn" }, - attention = { raw = "[!ATTENTION]", rendered = "󰀪 Attention", highlight = "RenderMarkdownWarn" }, - failure = { raw = "[!FAILURE]", rendered = "󰅖 Failure", highlight = "RenderMarkdownError" }, - fail = { raw = "[!FAIL]", rendered = "󰅖 Fail", highlight = "RenderMarkdownError" }, - missing = { raw = "[!MISSING]", rendered = "󰅖 Missing", highlight = "RenderMarkdownError" }, - danger = { raw = "[!DANGER]", rendered = "󱐌 Danger", highlight = "RenderMarkdownError" }, - error = { raw = "[!ERROR]", rendered = "󱐌 Error", highlight = "RenderMarkdownError" }, - bug = { raw = "[!BUG]", rendered = "󰨰 Bug", highlight = "RenderMarkdownError" }, - example = { raw = "[!EXAMPLE]", rendered = "󰉹 Example", highlight = "RenderMarkdownHint" }, - quote = { raw = "[!QUOTE]", rendered = "󱆨 Quote", highlight = "RenderMarkdownQuote" }, - cite = { raw = "[!CITE]", rendered = "󱆨 Cite", highlight = "RenderMarkdownQuote" }, - }, - }) - end, }, } diff --git a/tools/nvim/lua/plugins/mod/telescope.lua b/tools/nvim/lua/plugins/mod/telescope.lua index 8a2f93f..719dfed 100644 --- a/tools/nvim/lua/plugins/mod/telescope.lua +++ b/tools/nvim/lua/plugins/mod/telescope.lua @@ -1,32 +1,49 @@ return { "nvim-telescope/telescope.nvim", - config = function() - require("telescope").setup({ - defaults = { - prompt_prefix = require("config.icons").telescope, - selection_caret = " ", - entry_prefix = " ", - layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua - horizontal = { - prompt_position = "top", - preview_width = 0.55, - }, - width = 0.87, - height = 0.80, + opts = { + defaults = { + prompt_prefix = require("config.icons").telescope, + selection_caret = " ", + entry_prefix = " ", + layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua + horizontal = { + prompt_position = "top", + preview_width = 0.55, }, - mappings = { - n = { - ["n"] = "move_selection_next", - ["e"] = "move_selection_previous", - ["w"] = "preview_scrolling_up", - ["r"] = "preview_scrolling_down", - ["a"] = "preview_scrolling_left", - ["s"] = "preview_scrolling_right", - ["q"] = require("telescope.actions").close, - }, + width = 0.87, + height = 0.80, + }, + mappings = { + n = { + ["n"] = "move_selection_next", + ["e"] = "move_selection_previous", + ["w"] = "preview_scrolling_up", + ["r"] = "preview_scrolling_down", + ["a"] = "preview_scrolling_left", + ["s"] = "preview_scrolling_right", + ["q"] = require("telescope.actions").close, }, }, - }) - end, + }, + }, dependencies = { "nvim-lua/plenary.nvim" }, + keys = { + { "", ":Telescope find_files", desc = "Find Files" }, + { "/", ":Telescope live_grep", desc = "Grep Files" }, + { ";", ":Telescope", desc = "Show Telescope Commands" }, + { "ui", ":Telescope colorscheme", desc = "Change colorscheme" }, + { "pp", ":Telescope projects", desc = "List all Projects" }, + { "pg", ":Telescope projects", desc = "List all Git Projects" }, + { "ps", ":Telescope session-lens", desc = "List all sessions" }, + { "gs", ":Telescope git_status", desc = "Git Status" }, + { "gt", ":Telescope git_branches", desc = "Git Branches" }, + { "gc", ":Telescope git_commits", desc = "Show commits" }, + { "fb", ":Telescope buffers", desc = "List Buffers" }, + { "ff", ":Telescope fd", desc = "Find Files" }, + { "ce", ":Telescope diagnostics", desc = "Navigate errors/warnings" }, + { "cs", ":Telescope treesitter", desc = "Search symbols" }, + { "cS", ":Telescope grep_string", desc = "Search current symbol" }, + { "bB", ":Telescope buffers", desc = "List Buffers" }, + { "fl", ":Telescope filetypes", desc = "Set Filetype/Lang to ..." }, + }, } diff --git a/tools/nvim/lua/plugins/mod/winbar-nvim.lua b/tools/nvim/lua/plugins/mod/winbar-nvim.lua deleted file mode 100644 index b841aa6..0000000 --- a/tools/nvim/lua/plugins/mod/winbar-nvim.lua +++ /dev/null @@ -1,41 +0,0 @@ -return { - { - "fgheng/winbar.nvim", - config = function() - require("winbar").setup({ - enabled = true, - show_file_path = true, - show_symbols = true, - colors = { - path = "", - file_name = "", - symbols = "", - }, - icons = { - file_icon_default = "", - seperator = ">", - editor_state = "●", - lock_icon = "", - }, - exclude_filetype = { - "help", - "startify", - "dashboard", - "packer", - "neogitstatus", - "NvimTree", - "Trouble", - "alpha", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "qf", - "floaterm", - "orgagenda", - "grug-far" - }, - }) - end, - }, -}