From 63daba3b4ae5fbbf296a256a8cb396fa0447632b Mon Sep 17 00:00:00 2001 From: juancwu <46619361+juancwu@users.noreply.github.com> Date: Wed, 30 Jul 2025 17:50:24 -0400 Subject: [PATCH] update neovim plugins --- nvim/lazy-lock.json | 51 ++- nvim/lua/juancwu/plugins/markdown-preview.lua | 10 - nvim/lua/juancwu/plugins/telescope.lua | 325 +++++++++--------- 3 files changed, 195 insertions(+), 191 deletions(-) delete mode 100644 nvim/lua/juancwu/plugins/markdown-preview.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 5d6c4c7..f2b4119 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,52 +1,51 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" }, - "catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" }, + "LuaSnip": { "branch": "master", "commit": "3d5bced1b9ae69fa3f9b1942e28af5dbc537f946" }, + "catppuccin": { "branch": "main", "commit": "94f6e8a06b6bb7b8e5529cf9f93adb4654534241" }, "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, + "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "git.nvim": { "branch": "main", "commit": "7354ed2efe31b979778cb62ffa2fa23df70eaf26" }, - "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, + "gitsigns.nvim": { "branch": "main", "commit": "b01433169be710d6c69f7b4ee264d9670698b831" }, "godoc.nvim": { "branch": "main", "commit": "356f79853dbb3b3e200064367603751895153c29" }, "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "67da97f8c2fd12d05427bb485ce07ee6418e0a51" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, - "mini.nvim": { "branch": "main", "commit": "de0a88d925c8e69fdbb498141207ee43504e5cd1" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f2fa60409630ec2d24acf84494fb55e1d28d593c" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "3671ab0d40aa5bd24b1686562bd0a23391ecf76a" }, + "mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" }, + "mini.nvim": { "branch": "main", "commit": "c122e852517adaf7257688e435369c050da113b1" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, - "nvim-lspconfig": { "branch": "master", "commit": "03bc581e05e81d33808b42b2d7e76d70adb3b595" }, + "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, + "nvim-lspconfig": { "branch": "master", "commit": "3db16ceeea947517f0dc1404c24dcb5ab0c91d26" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, - "onedark.nvim": { "branch": "master", "commit": "11de4da47f3e69cb70c3ae9816bd8af166cbe121" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "render-markdown.nvim": { "branch": "main", "commit": "d69f0d8c80ba293d25dad498ec86e9b583a6bbbf" }, - "rose-pine": { "branch": "main", "commit": "6b9840790cc7acdfadde07f308d34b62dd9cc675" }, + "nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" }, + "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, + "onedark.nvim": { "branch": "master", "commit": "de495fabe171d48aed5525f002d14414efcecbb2" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "render-markdown.nvim": { "branch": "main", "commit": "9e51b7711c6159511e966dc42fafd58a9db9ad1d" }, + "rose-pine": { "branch": "main", "commit": "72befaffeac38db7bdd49e0549eaa2c4806dd878" }, "solarized-osaka.nvim": { "branch": "main", "commit": "f796014c14b1910e08d42cc2077fef34f08e0295" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "7bf55ed0ff5be182ad3301cff266581fc1c56cce" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, - "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, - "vim-floaterm": { "branch": "master", "commit": "b02d1f4a87ad6f5b300d225e5ac62bde9d86086b" }, + "vim-floaterm": { "branch": "master", "commit": "fd4bdd66eca56c6cc59f2119e4447496d8cde2ea" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/nvim/lua/juancwu/plugins/markdown-preview.lua b/nvim/lua/juancwu/plugins/markdown-preview.lua deleted file mode 100644 index aedab6e..0000000 --- a/nvim/lua/juancwu/plugins/markdown-preview.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "iamcco/markdown-preview.nvim", - ft = "markdown", - build = function() - vim.fn["mkdp#util#install"]() - end, - keys = { - { "mp", "MarkdownPreviewToggle", desc = "Toggle [M]arkdown [P]review" } - } -} diff --git a/nvim/lua/juancwu/plugins/telescope.lua b/nvim/lua/juancwu/plugins/telescope.lua index 0af54aa..a95bd0f 100644 --- a/nvim/lua/juancwu/plugins/telescope.lua +++ b/nvim/lua/juancwu/plugins/telescope.lua @@ -1,166 +1,181 @@ +local function get_fd_command() + if vim.fn.executable("fd") == 1 then + return "fd" + elseif vim.fn.executable("fdfind") == 1 then + return "fdfind" + end + return nil +end + return { - "nvim-telescope/telescope.nvim", - version = "0.1.8", - dependencies = { - "nvim-lua/plenary.nvim", - { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'make', - enabled = true, - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { - "nvim-telescope/telescope-file-browser.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", - }, - enabled = true, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - local telescope = require("telescope") - local actions = require("telescope.actions") - local builtin = require("telescope.builtin") - local fb_actions = require("telescope").extensions.file_browser.actions + "nvim-telescope/telescope.nvim", + version = "0.1.8", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + enabled = true, + cond = function() + return vim.fn.executable("make") == 1 + end, + }, + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "nvim-lua/plenary.nvim", + }, + enabled = true, + }, + { "nvim-telescope/telescope-ui-select.nvim" }, + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + local builtin = require("telescope.builtin") + local fb_actions = require("telescope").extensions.file_browser.actions - local function telescope_buffer_dir() - return vim.fn.expand("%:p:h") - end + local function telescope_buffer_dir() + return vim.fn.expand("%:p:h") + end - telescope.setup({ - defaults = { - mappings = { - n = { - ["q"] = actions.close, - }, - }, - }, - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - file_browser = { - theme = "dropdown", - hijack_netrw = false, - hidden = true, - mappings = { - ["i"] = { - [""] = function() - vim.cmd("normal vbd") - end, - [""] = function(bufnr) - actions.move_selection_next(bufnr) - end, - [""] = function(bufnr) - actions.move_selection_previous(bufnr) - end, - [""] = function(bufnr) - actions.select_vertical(bufnr) - end, - }, - ["n"] = { - ["a"] = fb_actions.create, - ["h"] = fb_actions.goto_parent_dir, - ["/"] = function() - vim.cmd("startinsert") - end, - ["d"] = fb_actions.remove, - ["e"] = fb_actions.change_cwd, - [""] = function(bufnr) - actions.select_vertical(bufnr) - end, - [""] = function(bufnr) - actions.toggle_all(bufnr) - end, - [""] = function(bufnr) - actions.move_selection_next(bufnr) - end, - [""] = function(bufnr) - actions.move_selection_previous(bufnr) - end, - }, - }, - }, - }, - }) + telescope.setup({ + defaults = { + mappings = { + n = { + ["q"] = actions.close, + }, + }, + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, + file_browser = { + theme = "dropdown", + hijack_netrw = false, + hidden = true, + mappings = { + ["i"] = { + [""] = function() + vim.cmd("normal vbd") + end, + [""] = function(bufnr) + actions.move_selection_next(bufnr) + end, + [""] = function(bufnr) + actions.move_selection_previous(bufnr) + end, + [""] = function(bufnr) + actions.select_vertical(bufnr) + end, + }, + ["n"] = { + ["a"] = fb_actions.create, + ["h"] = fb_actions.goto_parent_dir, + ["/"] = function() + vim.cmd("startinsert") + end, + ["d"] = fb_actions.remove, + ["e"] = fb_actions.change_cwd, + [""] = function(bufnr) + actions.select_vertical(bufnr) + end, + [""] = function(bufnr) + actions.toggle_all(bufnr) + end, + [""] = function(bufnr) + actions.move_selection_next(bufnr) + end, + [""] = function(bufnr) + actions.move_selection_previous(bufnr) + end, + }, + }, + }, + }, + }) - pcall(telescope.load_extension, "file_browser") - pcall(telescope.load_extension, "fzf") - pcall(telescope.load_extension, "ui-select") + pcall(telescope.load_extension, "file_browser") + pcall(telescope.load_extension, "fzf") + pcall(telescope.load_extension, "ui-select") - -- Builtin pickers - vim.keymap.set("n", "sf", function() - builtin.find_files({ - hidden = true, - file_ignore_patterns = { - "node%_modules/.*", - "%.git/.*", - }, - find_command = { - "fd", - "--type", - "f", - "--color", - "never", - "--hidden", - "--no-ignore", - }, - }) - end, { desc = "[S]earch [F]iles" }) - vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp Tags" }) - vim.keymap.set("n", "sb", builtin.buffers, { desc = "[S]earch [B]uffers" }) - vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) - vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) - vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) - vim.keymap.set("n", "gr", builtin.lsp_references, { desc = "[G]o to [R]eferences", noremap = true }) - vim.keymap.set("n", "gd", builtin.lsp_definitions, { desc = "[G]o to [D]efinitions" }) - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "[G]o to [D]eclaration" }) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, { desc = "[R]e[N]ame" }) + -- Builtin pickers + vim.keymap.set("n", "sf", function() + local fd_cmd = get_fd_command() + local config = { + hidden = true, + file_ignore_patterns = { + "node%_modules/.*", + "%.git/.*", + }, + } - -- Git pickers - vim.keymap.set("n", "gf", builtin.git_files, { desc = "Search [G]it [F]iles" }) - vim.keymap.set("n", "gs", builtin.git_status, { desc = "List [G]it [S]tatus" }) - vim.keymap.set("n", "gh", builtin.git_stash, { desc = "List [G]it [S]tash" }) - vim.keymap.set("n", "gbb", builtin.git_branches, { desc = "List [G]it [B]ranches" }) - vim.keymap.set("n", "gc", builtin.git_bcommits, { desc = "List Buffer [G]it [C]ommits" }) + if fd_cmd then + config.find_command = { + fd_cmd, + "--type", + "f", + "--color", + "never", + "--hidden", + "--no-ignore", + } + end - -- File Browser Ext - vim.keymap.set("n", "fs", function() - telescope.extensions.file_browser.file_browser({ - path = "%:p:h", - cwd = telescope_buffer_dir(), - respect_gitignore = false, - hidden = true, - grouped = true, - previewer = false, - initial_mode = "normal", - layout_config = { height = 40 }, - }) - end, { desc = "Open [F]ile [S]ystem Menu" }) + builtin.find_files(config) + end, { desc = "[S]earch [F]iles" }) + vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp Tags" }) + vim.keymap.set("n", "sb", builtin.buffers, { desc = "[S]earch [B]uffers" }) + vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) + vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) + vim.keymap.set("n", "gr", builtin.lsp_references, { desc = "[G]o to [R]eferences", noremap = true }) + vim.keymap.set("n", "gd", builtin.lsp_definitions, { desc = "[G]o to [D]efinitions" }) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "[G]o to [D]eclaration" }) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, { desc = "[R]e[N]ame" }) - vim.keymap.set("n", "/", function() - builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ - winblend = 10, - previewer = false, - })) - end, { desc = "[/] Fuzzily serach in current buffer" }) + -- Git pickers + vim.keymap.set("n", "gf", builtin.git_files, { desc = "Search [G]it [F]iles" }) + vim.keymap.set("n", "gs", builtin.git_status, { desc = "List [G]it [S]tatus" }) + vim.keymap.set("n", "gh", builtin.git_stash, { desc = "List [G]it [S]tash" }) + vim.keymap.set("n", "gbb", builtin.git_branches, { desc = "List [G]it [B]ranches" }) + vim.keymap.set("n", "gc", builtin.git_bcommits, { desc = "List Buffer [G]it [C]ommits" }) - -- live grep in open files only - vim.keymap.set("n", "s/", function() - builtin.live_grep { - grep_open_files = true, - prompt_title = "Live Grep in Open Files", - } - end, { desc = "[S]search [/] in Open Files" }) + -- File Browser Ext + vim.keymap.set("n", "fs", function() + telescope.extensions.file_browser.file_browser({ + path = "%:p:h", + cwd = telescope_buffer_dir(), + respect_gitignore = false, + hidden = true, + grouped = true, + previewer = false, + initial_mode = "normal", + layout_config = { height = 40 }, + }) + end, { desc = "Open [F]ile [S]ystem Menu" }) - -- shortcut for searching neovim config files - vim.keymap.set("n", "sn", function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = "[S]earch [N]eovim files" }) - end, + vim.keymap.set("n", "/", function() + builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) + end, { desc = "[/] Fuzzily serach in current buffer" }) + + -- live grep in open files only + vim.keymap.set("n", "s/", function() + builtin.live_grep({ + grep_open_files = true, + prompt_title = "Live Grep in Open Files", + }) + end, { desc = "[S]search [/] in Open Files" }) + + -- shortcut for searching neovim config files + vim.keymap.set("n", "sn", function() + builtin.find_files({ cwd = vim.fn.stdpath("config") }) + end, { desc = "[S]earch [N]eovim files" }) + end, }