diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 77ca8ae..050b44d 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -7,7 +7,6 @@ "fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, "lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" }, "lazydev.nvim": { "branch": "main", "commit": "c2dfe354571a8255c5d3e96a9a4c297c89ce2347" }, @@ -17,6 +16,7 @@ "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, + "mini.indentscope": { "branch": "main", "commit": "e9fa0714fc753e1e737940577904e553ee340903" }, "mini.nvim": { "branch": "main", "commit": "ee4a4a4abed25e3d108d985b0553c5271f2f71aa" }, "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, "nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" }, diff --git a/nvim/lua/juancwu/plugins/indent-blankline.lua b/nvim/lua/juancwu/plugins/indent-blankline.lua deleted file mode 100644 index 61651ec..0000000 --- a/nvim/lua/juancwu/plugins/indent-blankline.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - "lukas-reineke/indent-blankline.nvim", - opts = { - indent = { - smart_indent_cap = true, - }, - scope = { - show_end = true, - }, - }, - main = "ibl", -} diff --git a/nvim/lua/juancwu/plugins/lsp.lua b/nvim/lua/juancwu/plugins/lsp.lua index e51e9da..d290bb3 100644 --- a/nvim/lua/juancwu/plugins/lsp.lua +++ b/nvim/lua/juancwu/plugins/lsp.lua @@ -17,48 +17,40 @@ return { vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), callback = function(event) + -- This is the helper function to set keymaps locally for this buffer local map = function(keys, func, desc, mode) mode = mode or "n" vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) end - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") + -- Use built-in LSP for definitions (replaces deprecated Telescope function) + map("gd", vim.lsp.buf.definition, "[G]oto [D]efinition") - -- Find references for the word under your cursor. - map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") + -- Use built-in LSP for references (replaces deprecated Telescope function) + map("gr", vim.lsp.buf.references, "[G]oto [R]eferences") - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") + -- Use built-in LSP for implementation (replaces deprecated Telescope function) + map("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation") - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") + -- Use built-in LSP for type definitions (replaces deprecated Telescope function) + map("D", vim.lsp.buf.type_definition, "Type [D]efinition") - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. + -- Telescope for document symbols (this is a good use for Telescope) map("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols") - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. + -- Telescope for workspace symbols (also a good use for Telescope) map("ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. + -- Built-in LSP for renaming map("rn", vim.lsp.buf.rename, "[R]e[n]ame") - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. + -- Built-in LSP for code actions map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" }) - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. + -- Built-in LSP for declaration map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + -- Built-in LSP for diagnostics map("[d", vim.diagnostic.goto_prev, "Go to previous diagnostic") map("]d", vim.diagnostic.goto_next, "Go to next diagnostic") diff --git a/nvim/lua/juancwu/plugins/mini.indentscope.lua b/nvim/lua/juancwu/plugins/mini.indentscope.lua new file mode 100644 index 0000000..5117827 --- /dev/null +++ b/nvim/lua/juancwu/plugins/mini.indentscope.lua @@ -0,0 +1,30 @@ +return { + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = { "BufReadPre", "BufNewFile" }, + opts = { + -- symbol = "▏", + symbol = "│", + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, +} diff --git a/nvim/lua/juancwu/plugins/telescope.lua b/nvim/lua/juancwu/plugins/telescope.lua index 8fcda7c..d3e13a5 100644 --- a/nvim/lua/juancwu/plugins/telescope.lua +++ b/nvim/lua/juancwu/plugins/telescope.lua @@ -132,10 +132,10 @@ return { 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", "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" }) -- Git pickers vim.keymap.set("n", "gf", builtin.git_files, { desc = "Search [G]it [F]iles" })