diff --git a/CHANGELOG.md b/CHANGELOG.md index 318c543d..7bee06d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [10.9.1](https://github.com/LazyVim/LazyVim/compare/v10.9.0...v10.9.1) (2024-01-21) + + +### Bug Fixes + +* fixup for [#2137](https://github.com/LazyVim/LazyVim/issues/2137) ([fbe478a](https://github.com/LazyVim/LazyVim/commit/fbe478ae3f84ff842d18ff880af5842a50ee8e50)) + +## [10.9.0](https://github.com/LazyVim/LazyVim/compare/v10.8.2...v10.9.0) (2024-01-21) + + +### Features + +* **autocmds:** dont use conceal for json files ([23fe52a](https://github.com/LazyVim/LazyVim/commit/23fe52acd78c8e8f7c35c3ce4c1bae830adfa357)) +* **gitsigns:** update gitsigns.nvim preview command ([#2178](https://github.com/LazyVim/LazyVim/issues/2178)) ([f4ddb16](https://github.com/LazyVim/LazyVim/commit/f4ddb16b262e5ba14b417dc53bfd09d5b21f8a73)) +* **keymaps:** add function to toggle between light/dark backgrounds ([#2088](https://github.com/LazyVim/LazyVim/issues/2088)) ([fa6158a](https://github.com/LazyVim/LazyVim/commit/fa6158a59500c816b652e0fcb4c343270be54b6c)) +* **lsp:** add diagnostic signs to lsp options ([#2192](https://github.com/LazyVim/LazyVim/issues/2192)) ([33830f1](https://github.com/LazyVim/LazyVim/commit/33830f1e7d2e5a54fec676ce6e43a4a61882aaa9)) +* **neo-tree:** Adds copy file name command to Neo-Tree with 'Y' binding ([#2137](https://github.com/LazyVim/LazyVim/issues/2137)) ([5296d42](https://github.com/LazyVim/LazyVim/commit/5296d42e6ab4f6df80e801542382a3d774298364)) +* **test:** Add <leader>tl to neotest.run_last() ([#1968](https://github.com/LazyVim/LazyVim/issues/1968)) ([b71feb7](https://github.com/LazyVim/LazyVim/commit/b71feb7e45420a6e6dcac2f4491b73b70c32e5c7)) + + +### Bug Fixes + +* **dot:** treesitter for hypr was renamed to hyprlang ([979bb95](https://github.com/LazyVim/LazyVim/commit/979bb952a69d7dafac125da69cb27b70d5403f52)) +* **eslint:** correct working directories name ([#2071](https://github.com/LazyVim/LazyVim/issues/2071)) ([71a73e8](https://github.com/LazyVim/LazyVim/commit/71a73e8334a3692c549a09169e0f7a33923520f1)) + ## [10.8.2](https://github.com/LazyVim/LazyVim/compare/v10.8.1...v10.8.2) (2023-11-30) diff --git a/README-DE.md.txt b/README-DE.md similarity index 100% rename from README-DE.md.txt rename to README-DE.md diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 2d805f3b..2fa95fdf 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 November 30 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 January 23 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 4cc6f1ec..8e09ac0e 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -7,7 +7,11 @@ end -- Check if we need to reload the file when it changed vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { group = augroup("checktime"), - command = "checktime", + callback = function() + if vim.o.buftype ~= 'nofile' then + vim.cmd('checktime') + end + end }) -- Highlight on yank @@ -81,6 +85,15 @@ vim.api.nvim_create_autocmd("FileType", { end, }) +-- Fix conceallevel for json files +vim.api.nvim_create_autocmd({ "FileType" }, { + group = augroup("json_conceal"), + pattern = { "json", "jsonc", "json5" }, + callback = function() + vim.opt_local.conceallevel = 0 + end, +}) + -- Auto create dir when saving a file, in case some intermediate directory does not exist vim.api.nvim_create_autocmd({ "BufWritePre" }, { group = augroup("auto_create_dir"), diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index a296ef56..20aba534 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ local Util = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "10.8.2" -- x-release-please-version +M.version = "10.9.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { @@ -185,6 +185,11 @@ function M.setup(opts) vim.api.nvim_create_user_command("LazyExtras", function() Util.extras.show() end, { desc = "Manage LazyVim extras" }) + + vim.api.nvim_create_user_command("LazyHealth", function() + vim.cmd([[Lazy! load all]]) + vim.cmd([[checkhealth]]) + end, { desc = "Load all plugins and run :checkhealth" }) end, }) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index f7fe57d6..1e7cc1a2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -123,6 +123,7 @@ if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then map( "n", "uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" }) end map("n", "uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" }) +map("n", "ub", function() Util.toggle("background", false, {"light", "dark"}) end, { desc = "Toggle Background" }) -- lazygit map("n", "gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 3c9686b1..6d9f006b 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -17,7 +17,7 @@ local opt = vim.opt opt.autowrite = true -- Enable auto write opt.clipboard = "unnamedplus" -- Sync with system clipboard opt.completeopt = "menu,menuone,noselect" -opt.conceallevel = 3 -- Hide * markup for bold and italic +opt.conceallevel = 2 -- Hide * markup for bold and italic, but not markers with substitutions opt.confirm = true -- Confirm to save changes before exiting modified buffer opt.cursorline = true -- Enable highlighting of the current line opt.expandtab = true -- Use spaces instead of tabs diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index c6571433..662977f0 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -1,35 +1,5 @@ return { - -- snippets - { - "L3MON4D3/LuaSnip", - build = (not jit.os:find("Windows")) - and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" - or nil, - dependencies = { - "rafamadriz/friendly-snippets", - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, - opts = { - history = true, - delete_check_events = "TextChanged", - }, - -- stylua: ignore - keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, silent = true, mode = "i", - }, - { "", function() require("luasnip").jump(1) end, mode = "s" }, - { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, - }, - }, - -- auto completion { "hrsh7th/nvim-cmp", @@ -39,7 +9,6 @@ return { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", - "saadparwaiz1/cmp_luasnip", }, opts = function() vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) @@ -49,11 +18,6 @@ return { completion = { completeopt = "menu,menuone,noinsert", }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), @@ -73,7 +37,6 @@ return { }), sources = cmp.config.sources({ { name = "nvim_lsp" }, - { name = "luasnip" }, { name = "path" }, }, { { name = "buffer" }, @@ -104,6 +67,52 @@ return { end, }, + -- snippets + { + "L3MON4D3/LuaSnip", + build = (not jit.os:find("Windows")) + and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" + or nil, + dependencies = { + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + { + "nvim-cmp", + dependencies = { + "saadparwaiz1/cmp_luasnip", + }, + opts = function(_, opts) + opts.snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + } + table.insert(opts.sources, { name = "luasnip" }) + end, + }, + }, + opts = { + history = true, + delete_check_events = "TextChanged", + }, + -- stylua: ignore + keys = { + { + "", + function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, + expr = true, silent = true, mode = "i", + }, + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, + }, + -- auto pairs { "echasnovski/mini.pairs", diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index f23d4544..46860e7b 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -61,6 +61,11 @@ return { window = { mappings = { [""] = "none", + ["Y"] = function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, }, }, default_component_configs = { @@ -141,6 +146,7 @@ return { { "fc", Util.telescope.config_files(), desc = "Find Config File" }, { "ff", Util.telescope("files"), desc = "Find Files (root dir)" }, { "fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, + { "fg", "Telescope git_files", desc = "Find Files (git-files)" }, { "fr", "Telescope oldfiles", desc = "Recent" }, { "fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" }, -- git diff --git a/lua/lazyvim/plugins/extras/coding/native_snippets.lua b/lua/lazyvim/plugins/extras/coding/native_snippets.lua new file mode 100644 index 00000000..72080c92 --- /dev/null +++ b/lua/lazyvim/plugins/extras/coding/native_snippets.lua @@ -0,0 +1,59 @@ +return { + desc = "Use native snippets instead of LuaSnip. Only works on Neovim >= 0.10!", + { + "L3MON4D3/LuaSnip", + enabled = false, + }, + { + "nvim-cmp", + opts = { + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + }, + keys = { + { + "", + function() + if vim.snippet.jumpable(1) then + vim.schedule(function() + vim.snippet.jump(1) + end) + return + end + return "" + end, + expr = true, + silent = true, + mode = "i", + }, + { + "", + function() + vim.schedule(function() + vim.snippet.jump(1) + end) + end, + silent = true, + mode = "s", + }, + { + "", + function() + if vim.snippet.jumpable(-1) then + vim.schedule(function() + vim.snippet.jump(-1) + end) + return + end + return "" + end, + expr = true, + silent = true, + mode = { "i", "s" }, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 1e6e0594..bd8f7821 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -16,10 +16,8 @@ return { }, ---@param opts cmp.ConfigSchema opts = function(_, opts) - local cmp = require("cmp") - opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { - { name = "crates" }, - })) + opts.sources = opts.sources or {} + table.insert(opts.sources, { name = "crates" }) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 4f53ae8c..4bb280d6 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -46,21 +46,8 @@ return { desc = "Remove Unused Imports", }, }, + ---@diagnostic disable-next-line: missing-fields settings = { - typescript = { - format = { - indentSize = vim.o.shiftwidth, - convertTabsToSpaces = vim.o.expandtab, - tabSize = vim.o.tabstop, - }, - }, - javascript = { - format = { - indentSize = vim.o.shiftwidth, - convertTabsToSpaces = vim.o.expandtab, - tabSize = vim.o.tabstop, - }, - }, completions = { completeFunctionCalls = true, }, @@ -69,6 +56,7 @@ return { }, }, }, + { "mfussenegger/nvim-dap", optional = true, diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 9537303d..a92a2191 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -8,7 +8,7 @@ return { eslint = { settings = { -- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root - workingDirectory = { mode = "auto" }, + workingDirectories = { mode = "auto" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index 321955ab..12ce90ba 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -110,6 +110,7 @@ return { { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, { "tT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, { "tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index c25e0f6c..a37670ea 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -10,26 +10,27 @@ return { -- Add Hyprland Parser { - "luckasRanarison/tree-sitter-hypr", + "luckasRanarison/tree-sitter-hyprlang", + dependencies = { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + require("nvim-treesitter.parsers").get_parser_configs().hyprlang = { + install_info = { + url = "https://github.com/luckasRanarison/tree-sitter-hyprlang", + files = { "src/parser.c" }, + branch = "master", + }, + filetype = "hyprlang", + } + + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "hyprlang" }) + end, + }, enabled = function() return have("hypr") end, event = "BufRead */hypr/*.conf", - build = ":TSUpdate hypr", - config = function() - -- Fix ft detection for hyprland - vim.filetype.add({ - pattern = { [".*/hypr/.*%.conf"] = "hypr" }, - }) - require("nvim-treesitter.parsers").get_parser_configs().hypr = { - install_info = { - url = "https://github.com/luckasRanarison/tree-sitter-hypr", - files = { "src/parser.c" }, - branch = "master", - }, - filetype = "hypr", - } - end, }, -- add some stuff to treesitter diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 3b60d14b..fbb4aeac 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -26,6 +26,14 @@ return { -- prefix = "icons", }, severity_sort = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = require("lazyvim.config").icons.diagnostics.Error, + [vim.diagnostic.severity.WARN] = require("lazyvim.config").icons.diagnostics.Warn, + [vim.diagnostic.severity.HINT] = require("lazyvim.config").icons.diagnostics.Hint, + [vim.diagnostic.severity.INFO] = require("lazyvim.config").icons.diagnostics.Info, + }, + }, }, -- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0 -- Be aware that you also will need to properly configure your LSP server to @@ -86,7 +94,7 @@ return { -- setup autoformat Util.format.register(Util.lsp.formatter()) - -- deprectaed options + -- deprecated options if opts.autoformat ~= nil then vim.g.autoformat = opts.autoformat Util.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat") diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index db41c825..409556d1 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -43,7 +43,13 @@ end local enabled = true function M.diagnostics() + -- if this Neovim version supports checking if diagnostics are enabled + -- then use that for the current state + if vim.diagnostic.is_disabled then + enabled = not vim.diagnostic.is_disabled() + end enabled = not enabled + if enabled then vim.diagnostic.enable() Util.info("Enabled diagnostics", { title = "Diagnostics" })