From 44f00f011110cebb284281bf8168ad8a9e578e0f Mon Sep 17 00:00:00 2001 From: xezo360hye Date: Tue, 19 Aug 2025 16:34:03 +0300 Subject: [PATCH] changed highlights and plugins (adding mini) --- lua/lsp.lua | 31 +++++++++++++---- lua/plugins.lua | 83 ++++++++++++++++++++++++++++++++++++++++++---- lua/treesitter.lua | 2 +- 3 files changed, 102 insertions(+), 14 deletions(-) diff --git a/lua/lsp.lua b/lua/lsp.lua index 0d991d8..74bf81b 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,4 +1,4 @@ -vim.lsp.enable({ "lua_ls", "denols" }) +vim.lsp.enable({ "lua_ls", "denols", "svelte" }) vim.lsp.config("lua_ls", { settings = { Lua = { @@ -42,10 +42,29 @@ vim.lsp.config("lua_ls", { }) vim.api.nvim_create_autocmd("LspAttach", { - callback = function(ev) - local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) - if client:supports_method "textDocument/completion" then - vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) - end + callback = function(event) + local highlight_augroup = vim.api.nvim_create_augroup("my.lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "InsertLeave" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "InsertEnter" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("my.lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { + group = highlight_augroup, + buffer = event2.buf, + } + end, + }) end, }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 198b4b9..108d5be 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,13 +1,82 @@ -vim.pack.add { - "https://github.com/NMAC427/guess-indent.nvim", - "https://github.com/hiphish/rainbow-delimiters.nvim", +vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter", - "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", "https://github.com/neovim/nvim-lspconfig", - "https://github.com/folke/tokyonight.nvim", - "https://github.com/echasnovski/mini.pick", + "https://github.com/nvim-lua/plenary.nvim", + + -- functional + "https://github.com/NMAC427/guess-indent.nvim", + "https://github.com/folke/trouble.nvim", "https://github.com/stevearc/oil.nvim", -} + + -- visual + "https://github.com/hiphish/rainbow-delimiters.nvim", + "https://github.com/folke/todo-comments.nvim", + "https://github.com/folke/tokyonight.nvim", + + -- mini + "https://github.com/echasnovski/mini.pick", + "https://github.com/echasnovski/mini.bracketed", + "https://github.com/echasnovski/mini.surround", + "https://github.com/echasnovski/mini.clue", + "https://github.com/echasnovski/mini.move", + "https://github.com/echasnovski/mini.ai", +}) require "guess-indent".setup {} require "oil".setup {} + +require "todo-comments".setup {} + +require "mini.bracketed".setup {} +require "mini.surround".setup {} +require "mini.move".setup {} +require "mini.ai".setup {} + +local miniclue = require "mini.clue" +miniclue.setup({ + triggers = { + -- Leader triggers + -- { mode = "n", keys = "" }, + -- { mode = "x", keys = "" }, + + -- Built-in completion + { mode = "i", keys = "" }, + + -- `g` key + -- { mode = "n", keys = "g" }, + -- { mode = "x", keys = "g" }, + + -- Marks + { mode = "n", keys = "'" }, + { mode = "n", keys = "`" }, + { mode = "x", keys = "'" }, + { mode = "x", keys = "`" }, + + -- Registers + { mode = "n", keys = '"' }, + { mode = "n", keys = "@" }, + { mode = "x", keys = '"' }, + { mode = "i", keys = "" }, + { mode = "c", keys = "" }, + + -- Window commands + { mode = "n", keys = "" }, + + -- `z` key + -- { mode = "n", keys = "z" }, + -- { mode = "x", keys = "z" }, + }, + + clues = { + miniclue.gen_clues.builtin_completion(), + -- miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers({ show_contents = true }), + miniclue.gen_clues.windows({ submode_resize = true }), + -- miniclue.gen_clues.z(), + }, + + window = { + delay = 200, + }, +}) diff --git a/lua/treesitter.lua b/lua/treesitter.lua index 583faee..f70ff4c 100644 --- a/lua/treesitter.lua +++ b/lua/treesitter.lua @@ -1,5 +1,5 @@ require "nvim-treesitter.configs".setup { - ensure_installed = { "c", "bash", "lua", "luadoc", "vim", "vimdoc", "diff", "html", "javascript", "markdown" }, + ensure_installed = { "c", "bash", "lua", "luadoc", "vim", "vimdoc", "diff", "html", "javascript", "typescript", "svelte", "markdown" }, highlight = { enable = true, },