From 969a10daf308c6a88588a1594e88dcd2dbc3741d Mon Sep 17 00:00:00 2001 From: Bas van den Wollenberg Date: Wed, 7 Aug 2024 22:32:18 +0200 Subject: [PATCH] Update nvim config - Update which-key config for latest version - Show startup time in lualine - Switch from Copilot to Maven and move config - Add lspkind for icons in nvim-cmp - Add nvim-highlight-colors - Switch from tsserver to vtsls and map GotoSourceDefinition - Add tailwindcss language server - Add nvim-lsp-file-operations - Add formatters to conform.nvim, stop after first formatter, add commands to toggle autoformat on save - Add luvit-meta library to lazydev - Change Telscope buffers keybinds to avoid conflict with tmux - Follow current file in neo-tree, hide node_modules and .. (which shows up after moving something using a relative path), don't use floating window for preview - Add mini.files (disable for now) - Add oil.nvim - Use opts for presence.nvim config - Change config = true to opts = {} for a bunch of plugins - Add dial.nvim augends - Add nvim-colorizer (disabled) and nvim-highlight-colors - Autoload last session using nvim-session-manager - Disable default tmux.nvim keybinds - Add barbar.nvim keybinds, disable offset with neo-tree --- nvim/.config/nvim/lazy-lock.json | 94 ++--- nvim/.config/nvim/lua/plugins.lua | 562 ++++++++++++++++++++++-------- 2 files changed, 465 insertions(+), 191 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index e982d5f..cbc534e 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,68 +1,76 @@ { "42header_codam": { "branch": "master", "commit": "727e299117075f87b154a40f2e4ec8a48594d7de" }, - "barbar.nvim": { "branch": "master", "commit": "d181f2cfd4b828f9c6f1e10e69c68241de59f54f" }, + "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, "c_formatter_42.vim": { "branch": "master", "commit": "7a2d50f6683d6f58a2c95375524b4406d6bdc2c3" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "conform.nvim": { "branch": "master", "commit": "c26dadf8a47a547768d1048a0d698ecec33494ce" }, - "copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" }, - "dial.nvim": { "branch": "master", "commit": "750f802879c90ea51f92b68c35fa562ee575804a" }, + "conform.nvim": { "branch": "master", "commit": "25d48271e3d4404ba017cb92a37d3a681c1ad149" }, + "dial.nvim": { "branch": "master", "commit": "ed4d6a5bbd5e479b4c4a3019d148561a2e6c1490" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, - "dropbar.nvim": { "branch": "master", "commit": "79847a78ec0c58f5e5c0360192b03d0cee803e95" }, - "eyeliner.nvim": { "branch": "main", "commit": "c540d58bf52aa979d4cca639c60387ae0c0ccf88" }, - "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, - "gitsigns.nvim": { "branch": "main", "commit": "fa42613096ebfa5fee1ea87d70f8625ab9685d01" }, - "guess-indent.nvim": { "branch": "main", "commit": "6c75506e71836f34fe5c5efa322dfce3e0494e7b" }, + "dropbar.nvim": { "branch": "master", "commit": "aa4c0ab1ade45ff9a3c5d4c06365c9b119f32d36" }, + "eyeliner.nvim": { "branch": "main", "commit": "828da1c18de397f7bf8fd4fff1daa1c4352b28cf" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "gitsigns.nvim": { "branch": "main", "commit": "58bd9e98d8e3c5a1c98af312e85247ee1afd3ed2" }, + "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, "highlight-undo.nvim": { "branch": "main", "commit": "1ea1c79372d7d93c88fd97543880927b7635e3d2" }, - "inc-rename.nvim": { "branch": "main", "commit": "535b508c0cb14d00c1836ad901b3c531cb1152bb" }, - "lazy.nvim": { "branch": "main", "commit": "69041bccb70f68408633e93ed33012ee18889bb0" }, - "lazydev.nvim": { "branch": "main", "commit": "6184ebbbc8045d70077659b7d30c705a588dc62f" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "luasnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, + "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" }, + "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "luasnip": { "branch": "master", "commit": "7552e6504ee95a9c8cfc6db53e389122ded46cd4" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, "marks.nvim": { "branch": "master", "commit": "74e8d01b2a2131b6e46354cffc553aa7f81bcf5b" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, - "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.files": { "branch": "main", "commit": "99aef1d68a01dd8fd8d37bbf62d67766f97311e3" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, - "neogit": { "branch": "master", "commit": "d27a36009114f61d620817d8cc6e421dc8d6bd77" }, - "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, - "neovim-session-manager": { "branch": "master", "commit": "29f80e9c6f3620b81908e287b3d1ed79c2290dd5" }, - "noice.nvim": { "branch": "main", "commit": "cade1f972ba226e7753a7a113f3f1a942908e73c" }, + "neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" }, + "neoscroll.nvim": { "branch": "master", "commit": "532dcc8cea4287c4cad6bb77532989a8217cfc7b" }, + "neovim-session-manager": { "branch": "master", "commit": "cbaebd92dce84e9ba63cb07d3199e5a19b204c1a" }, + "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, "nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" }, - "nui.nvim": { "branch": "main", "commit": "a2bc1e9d0359caa5d11ad967cd1e30e8d4676226" }, - "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, - "nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" }, + "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" }, + "nvim-dap": { "branch": "master", "commit": "dcc85d12d6e2c18c5fa0f9a304d9f5e767e1401a" }, "nvim-dap-projects": { "branch": "main", "commit": "f319ffd99c6c8a0b930bcfc4bee0c751ffbf5808" }, - "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" }, + "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" }, + "nvim-highlight-colors": { "branch": "main", "commit": "a411550ef85cae467b889ba7d1a96bd78332d90e" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lspconfig": { "branch": "master", "commit": "9c9eb07fecc578e25e28db8dc9002b43fff2ed79" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, + "nvim-lspconfig": { "branch": "master", "commit": "6c505d4220b521f3b0e7b645f6ce45fa914d0eed" }, "nvim-luadev": { "branch": "master", "commit": "3ba0c02c378503739f1fdb95cff3ea2aad48db3e" }, - "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-pqf": { "branch": "main", "commit": "148ee2ca8b06d83fd9bf6f9b9497724ad39a07d6" }, "nvim-scrollbar": { "branch": "main", "commit": "d09f14aa16c9f2748e77008f9da7b1f76e4e7b85" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, - "nvim-treesitter": { "branch": "master", "commit": "09700b88b41ed96391de3d2010d74dc54fd5c210" }, + "nvim-treesitter": { "branch": "master", "commit": "c79b068f395817c39ed147d4ee76855c36b846e6" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" }, - "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "33a17515b79ddb10d750320fa994098bdc3e93ef" }, + "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, + "nvim-vtsls": { "branch": "main", "commit": "45c6dfea9f83a126e9bfc5dd63430562b3f8af16" }, + "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, + "oil.nvim": { "branch": "master", "commit": "fcca212c2e966fc3dec1d4baf888e670631d25d1" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "qf_helper.nvim": { "branch": "master", "commit": "fa3c2f3f2706e2c9984409c9c14b5993302ddfa7" }, - "schemastore.nvim": { "branch": "main", "commit": "93ccaf12b9fb6df87d13da2782d83b34a3cbb893" }, + "schemastore.nvim": { "branch": "main", "commit": "218a9887085b81b3eb0ee8f1e2d20c4a7fd7b1c9" }, "suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" }, + "supermaven-nvim": { "branch": "main", "commit": "d71257f431e190d9236d7f30da4c2d659389e91f" }, "swap-split.nvim": { "branch": "main", "commit": "d2c705d279b384a6b47a67f85a6dc8569c4d775d" }, - "tabout.nvim": { "branch": "master", "commit": "3d7fbc7f5e91ef0f96b4d787c78ad9f8820de3ec" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "tabout.nvim": { "branch": "master", "commit": "923aea2613c9e7abf81e099d46086f62c7e54896" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "72f01ba654ffaf382c1df996b77cc53ec7860f70" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "tmux.nvim": { "branch": "main", "commit": "da618e075f42793400c3ee1e59ef3ebada2cb23c" }, - "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, - "treesj": { "branch": "main", "commit": "f98deb33805485b56a8d44d1a27d16874af00d7f" }, - "trouble.nvim": { "branch": "main", "commit": "88c3be40c061ce053ab326ce4fdcb973a1f785ff" }, - "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "035d92eab05ac1390afef7204e3fcad9a50fa443" }, - "which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" } -} \ No newline at end of file + "tmux.nvim": { "branch": "main", "commit": "65ee9d6e6308afcd7d602e1320f727c5be63a947" }, + "toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" }, + "treesj": { "branch": "main", "commit": "0d81326b5afd36babe7dd480aabbb0b05f33e688" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "1420fb9e07b1d80cc6d87e7d90827fb2c1109cb3" }, + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" } +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 5924667..181c3e4 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -32,10 +32,9 @@ require("lazy").setup({ { "folke/which-key.nvim", + event = "VeryLazy", opts = { - window = { - border = "single", - }, + preset = "modern", }, }, @@ -44,8 +43,15 @@ require("lazy").setup({ dependencies = { "nvim-tree/nvim-web-devicons", }, - config = function() - require("lualine").setup({ + config = function(plugin) + local lualine = require("lualine") + local startuptime_visible = true + -- hide startup time after 3 seconds + vim.defer_fn(function() + startuptime_visible = false + end, 3000) + + lualine.setup({ options = { theme = "nord", component_separators = "|", @@ -72,7 +78,11 @@ require("lazy").setup({ lualine_x = { { function() - return require("lazy").stats().startuptime + return math.floor(require("lazy").stats().startuptime) .. "ms" + end, + icon = "󱎫", + cond = function() + return startuptime_visible end, }, }, @@ -104,59 +114,69 @@ require("lazy").setup({ "RRethy/nvim-treesitter-endwise", "windwp/nvim-ts-autotag", }, - config = function() - ---@diagnostic disable-next-line: missing-fields - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "lua", - "vim", - "vimdoc", - "bash", - "fish", - "diff", - "json", - "jsonc", - "markdown", - "markdown_inline", - "regex", - }, - auto_install = true, - highlight = { + opts = { + ensure_installed = { + "lua", + "vim", + "vimdoc", + "bash", + "fish", + "diff", + "json", + "jsonc", + "markdown", + "markdown_inline", + "regex", + "javascript", + "typescript", + "html", + "css", + "python", + "ruby", + "c", + "go", + "elixir", + "rust", + }, + auto_install = true, + highlight = { + enable = true, + disable = { "gitcommit" }, + }, + textobjects = { + select = { enable = true, - disable = { "gitcommit" }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@comment.outer", - ["ic"] = "@comment.outer", - ["aa"] = "@parameter.outer", - ["ia"] = "@parameter.inner", - }, - selection_modes = { - ["@function.outer"] = "V", - ["@function.inner"] = "V", - }, + lookahead = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@comment.outer", + ["ic"] = "@comment.outer", + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", }, - move = { - enable = true, - set_jumps = true, - goto_next_start = { - ["]m"] = "@function.outer", - }, + selection_modes = { + ["@function.outer"] = "V", + ["@function.inner"] = "V", }, }, - endwise = { - enable = true, - }, - autotag = { + move = { enable = true, + set_jumps = true, + goto_next_start = { + ["]m"] = "@function.outer", + }, }, - }) + }, + endwise = { + enable = true, + }, + autotag = { + enable = true, + }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) end, }, @@ -178,6 +198,43 @@ require("lazy").setup({ }, }, + { + "zbirenbaum/copilot.lua", + enabled = false, + opts = { + filetypes = { + gitcommit = true, + markdown = true, + yaml = true, + }, + panel = { + enabled = false, + }, + suggestion = { + auto_trigger = true, + keymap = { + accept = "", + accept_word = "", + accept_line = "", + next = "", + prev = "", + dismiss = "", + }, + }, + }, + }, + + { + "supermaven-inc/supermaven-nvim", + opts = { + keymaps = { + accept_suggestion = "", + accept_word = "", + clear_suggestion = "", + }, + }, + }, + { "vonheikemen/lsp-zero.nvim", branch = "v3.x", @@ -187,40 +244,17 @@ require("lazy").setup({ "neovim/nvim-lspconfig", "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", + "onsails/lspkind.nvim", "l3mon4d3/luasnip", "b0o/schemastore.nvim", - { - "zbirenbaum/copilot.lua", - opts = { - filetypes = { - gitcommit = true, - markdown = true, - yaml = true, - }, - panel = { - enabled = false, - }, - suggestion = { - auto_trigger = true, - keymap = { - accept = "", - accept_word = "", - accept_line = "", - next = "", - prev = "", - dismiss = "", - }, - }, - }, - }, - -- { "zbirenbaum/copilot-cmp", config = true }, + "yioneko/nvim-vtsls", + -- { "zbirenbaum/copilot-cmp", opts = {} }, }, config = function() local lsp_zero = require("lsp-zero") local lspconfig = require("lspconfig") local schemastore = require("schemastore") local cmp = require("cmp") - local cmp_format = require("lsp-zero").cmp_format() cmp.setup({ sources = { @@ -231,7 +265,21 @@ require("lazy").setup({ mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.complete(), }), - formatting = cmp_format, + formatting = { + fields = { "abbr", "kind", "menu" }, + format = function(entry, item) + local color_item = require("nvim-highlight-colors").format(entry, { kind = item.kind }) + item = require("lspkind").cmp_format({ + -- before = require("tailwind-tools.cmp").lspkind_format, + })(entry, item) + if color_item.abbr_hl_group then + item.kind_hl_group = color_item.abbr_hl_group + item.kind = color_item.abbr + end + return item + end, + expandable_indicator = true, + }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), @@ -239,12 +287,28 @@ require("lazy").setup({ }) lsp_zero.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions + -- :h lsp-zero-keybindings lsp_zero.default_keymaps({ buffer = bufnr, preserve_mappings = false, + exclude = { "gs" }, }) + + vim.keymap.set( + "n", + "gk", + "lua vim.lsp.buf.signature_help()", + { desc = "Show function signature", silent = true, buffer = bufnr } + ) + + if client.name == "vtsls" then + vim.keymap.set( + "n", + "gs", + "VtsExec goto_source_definition", + { desc = "Goto source definition", silent = true, buffer = bufnr } + ) + end end) require("mason").setup({}) @@ -261,18 +325,25 @@ require("lazy").setup({ "tailwindcss", "terraformls", "tflint", - "tsserver", + "vtsls", }, handlers = { lsp_zero.default_setup, lua_ls = function() - local lua_opts = lsp_zero.nvim_lua_ls() - lua_opts.settings.Lua.format = { - enable = false, + -- local lua_opts = lsp_zero.nvim_lua_ls() + local lua_opts = { + settings = { + Lua = { + format = { + enable = false, + }, + }, + }, } lspconfig.lua_ls.setup(lua_opts) end, + jsonls = function() lspconfig.jsonls.setup({ settings = { @@ -288,6 +359,7 @@ require("lazy").setup({ }, }) end, + yamlls = function() lspconfig.yamlls.setup({ settings = { @@ -304,13 +376,63 @@ require("lazy").setup({ }, }) end, + + tailwindcss = function() + lspconfig.tailwindcss.setup({ + settings = { + tailwindCSS = { + experimental = { + classRegex = { + { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" }, + { "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" }, + }, + }, + }, + }, + }) + end, + + vtsls = function() + lspconfig.vtsls.setup({ + settings = { + javascript = { + updateImportsOnFileMove = "always", + }, + typescript = { + updateImportsOnFileMove = "always", + }, + vtsls = { + enableMoveToFileCodeAction = true, + }, + }, + }) + end, }, }) end, }, + { + "antosha417/nvim-lsp-file-operations", + requires = { + "nvim-lua/plenary.nvim", + "nvim-neo-tree/neo-tree.nvim", + }, + opts = {}, + }, + + { + "luckasRanarison/tailwind-tools.nvim", + enabled = false, + ---@module "tailwind-tools" + ---@type TailwindTools.Option + opts = {}, + }, + { "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo", "Format", "FormatDisable", "FormatEnable", "FormatToggle" }, init = function() vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end, @@ -318,24 +440,93 @@ require("lazy").setup({ formatters_by_ft = { lua = { "stylua" }, yaml = { "yamlfmt" }, - javascript = { { "prettierd", "prettier" } }, - javascriptreact = { { "prettierd", "prettier" } }, - typescript = { { "prettierd", "prettier" } }, - typescriptreact = { { "prettierd", "prettier" } }, - css = { { "prettierd", "prettier" } }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + javascriptreact = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + typescriptreact = { "prettierd", "prettier", stop_after_first = true }, + html = { "prettierd", "prettier", stop_after_first = true }, + css = { "prettierd", "prettier", stop_after_first = true }, + graphql = { "prettierd", "prettier", stop_after_first = true }, sh = { "shfmt" }, fish = { "fish_indent" }, }, - format_on_save = { - lsp_fallback = true, - }, + format_on_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + return { lsp_format = "fallback" } + end, + format_after_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + return { lsp_format = "fallback" } + end, }, + config = function(_, opts) + require("conform").setup(opts) + + vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + + require("conform").format({ async = true, lsp_format = "fallback", range = range }) + end, {}) + + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + bang = true, + desc = "Disable autoformat on save (bang to disable for current buffer only)", + }) + + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Re-enable autoformat on save", + }) + + vim.api.nvim_create_user_command("FormatToggle", function() + if vim.g.disable_autoformat then + vim.g.disable_autoformat = false + else + vim.g.disable_autoformat = true + end + end, { + desc = "Toggle autoformat on save", + }) + end, }, { "folke/lazydev.nvim", ft = "lua", - opts = {}, + ---@module "lazydev" + ---@type lazydev.Config + opts = { + ---@type lazydev.Library.spec[] + library = { + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, + + { + "Bilal2453/luvit-meta", + lazy = true, }, --TODO: configure @@ -360,7 +551,7 @@ require("lazy").setup({ keys = { { "", "Telescope resume", desc = "Telescope resume" }, { "", "Telescope find_files", desc = "Telescope find files" }, - { "", "Telescope buffers", desc = "Telescope buffers" }, + { "", "Telescope buffers", desc = "Telescope buffers" }, { "", "Telescope live_grep", desc = "Telescope grep" }, { "", "Telescope help_tags", desc = "Telescope help" }, { "", "Telescope man_pages", desc = "Telescope man" }, @@ -408,12 +599,20 @@ require("lazy").setup({ }, keys = { { "", "Neotree toggle", desc = "Toggle Neotree" }, + { "fh", "Neotree reveal", desc = "Reveal file in Neotree" }, }, opts = { close_if_last_window = true, filesystem = { + follow_current_file = { + enabled = true, + }, filtered_items = { visible = true, + never_show = { + "..", + "node_modules", + }, }, find_command = "fd", find_args = { @@ -433,6 +632,33 @@ require("lazy").setup({ -- end, -- }, }, + window = { + mappings = { + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + }, + }, + + { + "echasnovski/mini.files", + enabled = false, + keys = { + { "", "lua if not MiniFiles.close() then MiniFiles.open() end", desc = "Toggle MiniFiles" }, + }, + opts = { + mappings = { + close = "", + }, + }, + }, + + { + "stevearc/oil.nvim", + opts = { + skip_confirm_for_simple_edits = true, + prompt_save_on_select_new_entry = false, + watch_for_changes = true, }, }, @@ -467,14 +693,12 @@ require("lazy").setup({ { "andweeb/presence.nvim", - enabled = true, - config = function() - require("presence"):setup({ - show_time = false, - neovim_image_text = "Neovim", - -- log_level = "debug", - }) - end, + -- enabled = false, + opts = { + show_time = false, + neovim_image_text = "Neovim", + -- log_level = "debug", + }, }, { @@ -485,12 +709,12 @@ require("lazy").setup({ { "q", "QFToggle!" }, { "l", "LLToggle!" }, }, - config = true, + opts = {}, }, { "yorickpeterse/nvim-pqf", - config = true, + opts = {}, }, { @@ -519,7 +743,7 @@ require("lazy").setup({ { "g*", "g*lua require('hlslens').start()" }, { "g#", "g#lua require('hlslens').start()" }, }, - config = true, + opts = {}, }, { @@ -536,17 +760,17 @@ require("lazy").setup({ { "ethanholz/nvim-lastplace", - config = true, + opts = {}, }, { "kylechui/nvim-surround", - config = true, + opts = {}, }, { "numtostr/comment.nvim", - config = true, + opts = {}, }, { @@ -557,6 +781,19 @@ require("lazy").setup({ { "g", "lua require('dial.map').manipulate('increment', 'gnormal')", mode = { "n", "v" } }, { "g", "lua require('dial.map').manipulate('decrement', 'gnormal')", mode = { "n", "v" } }, }, + config = function() + local augend = require("dial.augend") + + require("dial.config").augends:register_group({ + default = { + augend.integer.alias.decimal, + augend.integer.alias.hex, + augend.date.alias["%Y/%m/%d"], + augend.date.alias["%Y-%m-%d"], + augend.constant.alias.bool, + }, + }) + end, }, { @@ -566,7 +803,7 @@ require("lazy").setup({ { "lewis6991/gitsigns.nvim", - config = true, + opts = {}, }, { @@ -609,40 +846,53 @@ require("lazy").setup({ { "abecodes/tabout.nvim", - config = true, + opts = {}, }, { "NMAC427/guess-indent.nvim", - config = true, + opts = {}, }, { "NvChad/nvim-colorizer.lua", + enabled = false, + main = "colorizer", opts = { filetypes = { "*", "!lazy" }, - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - names = false, -- "Name" codes like Blue or blue - RRGGBBAA = false, -- #RRGGBBAA hex codes - AARRGGBB = false, -- 0xAARRGGBB hex codes - rgb_fn = true, -- CSS rgb() and rgba() functions - hsl_fn = true, -- CSS hsl() and hsla() functions - css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn - -- Available modes for `mode`: foreground, background, virtualtext - mode = "background", - -- Available methods are false / true / "normal" / "lsp" / "both" - -- True is same as normal - tailwind = "both", - sass = { - enable = true, - parsers = { "css" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = false, -- "Name" codes like Blue or blue + RRGGBBAA = false, -- #RRGGBBAA hex codes + AARRGGBB = false, -- 0xAARRGGBB hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = "both", + sass = { + enable = true, + parsers = { "css" }, + }, + virtualtext = "■", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = true, }, - virtualtext = "■", - -- update color values even if buffer is not focused - -- example use: cmp_menu, cmp_docs - always_update = false, + }, + }, + + { + "brenoprata10/nvim-highlight-colors", + enabled = true, + opts = { + render = "virtual", + enable_tailwind = true, }, }, @@ -693,19 +943,19 @@ require("lazy").setup({ { "Shatur/neovim-session-manager", dependencies = { "nvim-lua/plenary.nvim" }, - config = function() + main = "session_manager", + opts = function() local config = require("session_manager.config") - -- print(config.AutoloadMode.CurrentDir) - require("session_manager").setup({ - autoload_mode = config.AutoloadMode.Disabled, - }) + return { + autoload_mode = { config.AutoloadMode.GitSession, config.AutoloadMode.CurrentDir }, + } end, }, { "chentoast/marks.nvim", - config = true, + opts = {}, }, { @@ -739,8 +989,8 @@ require("lazy").setup({ { "", "lua require('tmux').resize_right()", desc = "Resize right", mode = { "n", "t" } }, }, opts = { - copy_sync = { - redirect_to_clipboard = true, + navigation = { + enable_default_keybindings = false, }, resize = { enable_custom_bindings = false, @@ -755,26 +1005,42 @@ require("lazy").setup({ dependencies = { "nvim-telescope/telescope-fzf-native.nvim", }, - config = function() - require("dropbar").setup() - + init = function() vim.cmd.highlight("WinBar guibg=none") vim.cmd.highlight("WinBarNC guibg=none") end, + opts = {}, }, { "romgrk/barbar.nvim", + lazy = false, dependencies = { "lewis6991/gitsigns.nvim", "nvim-tree/nvim-web-devicons", }, + keys = { + { "", "BufferNext", desc = "Buffer next" }, + { "", "BufferPrevious", desc = "Buffer previous" }, + { "", "BufferClose", desc = "Buffer close" }, + { "", "BufferMovePrevious", desc = "Buffer move previous" }, + { ">", "BufferMoveNext", desc = "Buffer move next" }, + { "BufferPin", desc = "Buffer pin" }, + { "", "BufferPick", desc = "Buffer pick" }, + { "", "BufferGoto 1", desc = "Buffer goto 1" }, + { "", "BufferGoto 2", desc = "Buffer goto 2" }, + { "", "BufferGoto 3", desc = "Buffer goto 3" }, + { "", "BufferGoto 4", desc = "Buffer goto 4" }, + { "", "BufferGoto 5", desc = "Buffer goto 5" }, + { "", "BufferGoto 6", desc = "Buffer goto 6" }, + { "", "BufferGoto 7", desc = "Buffer goto 7" }, + { "", "BufferGoto 8", desc = "Buffer goto 8" }, + { "", "BufferGoto 9", desc = "Buffer goto 9" }, + { "", "BufferLast", desc = "Buffer goto last" }, + }, opts = { auto_hide = 1, focus_on_close = "previous", - sidebar_filetypes = { - ["neo-tree"] = { event = "BufWipeout" }, - }, no_name_title = "new", }, }, -- 2.51.2