diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd289f3..a6de0da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +## [10.7.1](https://github.com/LazyVim/LazyVim/compare/v10.7.0...v10.7.1) (2023-10-25) + + +### Bug Fixes + +* **catppuccin:** trouble integration. Fixes [#1872](https://github.com/LazyVim/LazyVim/issues/1872) ([f589154](https://github.com/LazyVim/LazyVim/commit/f589154268dfcb3e8f91075791a0a618c97fe59d)) +* **util:** pcall deletion of lazy_file augroup. See [#1863](https://github.com/LazyVim/LazyVim/issues/1863) ([60e5707](https://github.com/LazyVim/LazyVim/commit/60e57070131f4c544e17541610415d4d51769d62)) + +## [10.7.0](https://github.com/LazyVim/LazyVim/compare/v10.6.0...v10.7.0) (2023-10-25) + + +### Features + +* **nvim:** extend j/k enhancements to up/down arrows ([#1833](https://github.com/LazyVim/LazyVim/issues/1833)) ([9e1f835](https://github.com/LazyVim/LazyVim/commit/9e1f83522396d141455de8f2d5e0b3e8beca8d0a)) + + +### Bug Fixes + +* **extras.python-semshi:** improve highlights ([#1845](https://github.com/LazyVim/LazyVim/issues/1845)) ([3795358](https://github.com/LazyVim/LazyVim/commit/37953585bb06b3ffbdb37b40bb586590fde2b2a9)) +* fix jdtls not spwaning in windows ([#1864](https://github.com/LazyVim/LazyVim/issues/1864)) ([61fae7d](https://github.com/LazyVim/LazyVim/commit/61fae7d23f5689a9112b265f4bfb8468a131ae66)) +* **lang:** add cmakelint to ensure installed list ([#1826](https://github.com/LazyVim/LazyVim/issues/1826)) ([58ddf40](https://github.com/LazyVim/LazyVim/commit/58ddf405e09da967eca29169571114b01172fff3)) + +## [10.6.0](https://github.com/LazyVim/LazyVim/compare/v10.5.0...v10.6.0) (2023-10-25) + + +### Features + +* **telescope:** sort buffers with lastused and mru ([99598ef](https://github.com/LazyVim/LazyVim/commit/99598ef7c7c15c980b6d5c36f8e9cefd745fcf34)) + + +### Bug Fixes + +* **markdown:** create default numbered Headline groups for colorschemes that dont support them. Fixes [#1822](https://github.com/LazyVim/LazyVim/issues/1822) ([eab464d](https://github.com/LazyVim/LazyVim/commit/eab464d52d28d4e24e5d189ee627c96e720e057c)) +* **mini.hipatterns:** use `extmark_opts` instead of soft deprecated `priority` ([#1841](https://github.com/LazyVim/LazyVim/issues/1841)) ([e55ab41](https://github.com/LazyVim/LazyVim/commit/e55ab411b42c75919b33b87e19714b5c595316d4)) +* **treesitter:** make treesitter queries available at startup. See [#1816](https://github.com/LazyVim/LazyVim/issues/1816) Fixes [#1858](https://github.com/LazyVim/LazyVim/issues/1858) ([1e1b68d](https://github.com/LazyVim/LazyVim/commit/1e1b68d633d4bd4faa912ba5f49ab6b8601dc0c9)) + + +### Performance Improvements + +* **markdown:** prevent headlines.nvim slowing down initial rendering with `nvim README.md` ([b651560](https://github.com/LazyVim/LazyVim/commit/b651560ad0ee750c96bca6866cfdc008e75d397c)) +* **ui:** wrap treesitter.foldexpr and cache get_parser during a event loop tick. Fixes [#1846](https://github.com/LazyVim/LazyVim/issues/1846) ([a5c9708](https://github.com/LazyVim/LazyVim/commit/a5c9708736f6ecd3e3413ad0ca34b7b1fa3d4862)) + ## [10.5.0](https://github.com/LazyVim/LazyVim/compare/v10.4.4...v10.5.0) (2023-10-19) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index d3e0227b..181205b6 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 22 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2023 October 26 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 09e6c6e0..12d49ed6 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.5.0" -- x-release-please-version +M.version = "10.7.1" -- x-release-please-version ---@class LazyVimOptions local defaults = { diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index d7a480cb..c5f70016 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -7,7 +7,9 @@ local map = Util.safe_keymap_set -- better up/down map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -- Move to window using the hjkl keys map("n", "", "h", { desc = "Go to left window", remap = true }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index d1605f93..69e8e8d3 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -82,7 +82,7 @@ end -- HACK: causes freezes on <= 0.9, so only enable on >= 0.10 for now if vim.fn.has("nvim-0.10") == 1 then vim.opt.foldmethod = "expr" - vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()" else vim.opt.foldmethod = "indent" end diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 9ee3eb03..8c34f357 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -52,7 +52,7 @@ return { end, opts = { sources = { "filesystem", "buffers", "git_status", "document_symbols" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, filesystem = { bind_to_cwd = false, follow_current_file = { enabled = true }, @@ -127,12 +127,16 @@ return { }, }, keys = { - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { + ",", + "Telescope buffers sort_mru=true sort_lastused=true", + desc = "Switch Buffer", + }, { "/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, { ":", "Telescope command_history", desc = "Command History" }, { "", Util.telescope("files"), desc = "Find Files (root dir)" }, -- find - { "fb", "Telescope buffers", desc = "Buffers" }, + { "fb", "Telescope buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, { "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)" }, diff --git a/lua/lazyvim/plugins/extras/lang/cmake.lua b/lua/lazyvim/plugins/extras/lang/cmake.lua index 404a072a..e95dbfdd 100644 --- a/lua/lazyvim/plugins/extras/lang/cmake.lua +++ b/lua/lazyvim/plugins/extras/lang/cmake.lua @@ -30,7 +30,7 @@ return { "mason.nvim", opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "cmakelang" }) + vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" }) end, }, { diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index 64808bee..f7e7ca5f 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -85,7 +85,7 @@ return { -- How to run jdtls. This can be overridden to a full java command-line -- if the Python wrapper script doesn't suffice. - cmd = { "jdtls" }, + cmd = { vim.fn.exepath("jdtls") }, full_cmd = function(opts) local fname = vim.api.nvim_buf_get_name(0) local root_dir = opts.root_dir(fname) diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index ecb9b0a6..5aa9dc33 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -67,13 +67,24 @@ return { opts = function() local opts = {} for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do - opts[ft] = { headline_highlights = {} } + opts[ft] = { + headline_highlights = {}, + } for i = 1, 6 do - table.insert(opts[ft].headline_highlights, "Headline" .. i) + local hl = "Headline" .. i + vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true }) + table.insert(opts[ft].headline_highlights, hl) end end return opts end, ft = { "markdown", "norg", "rmd", "org" }, + config = function(_, opts) + -- PERF: schedule to prevent headlines slowing down opening a file + vim.schedule(function() + require("headlines").setup(opts) + require("headlines").refresh() + end) + end, }, } diff --git a/lua/lazyvim/plugins/extras/lang/python-semshi.lua b/lua/lazyvim/plugins/extras/lang/python-semshi.lua index a9a4870e..e4e32c10 100644 --- a/lua/lazyvim/plugins/extras/lang/python-semshi.lua +++ b/lua/lazyvim/plugins/extras/lang/python-semshi.lua @@ -17,13 +17,14 @@ return { -- Only add style, inherit or link to the LSP's colors vim.cmd([[ highlight! semshiGlobal gui=italic - highlight! semshiImported gui=bold + highlight! link semshiImported @none highlight! link semshiParameter @lsp.type.parameter highlight! link semshiParameterUnused DiagnosticUnnecessary highlight! link semshiBuiltin @function.builtin - highlight! link semshiAttribute @attribute + highlight! link semshiAttribute @field highlight! link semshiSelf @lsp.type.selfKeyword highlight! link semshiUnresolved @lsp.type.unresolvedReference + highlight! link semshiFree @none ]]) end, }) diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index 6cabd24d..e2513828 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -40,6 +40,12 @@ return { end, }, "Trouble", + { + ft = "trouble", + filter = function(buf, win) + return vim.api.nvim_win_get_config(win).relative == "" + end, + }, { ft = "qf", title = "QuickFix" }, { ft = "help", @@ -129,7 +135,7 @@ return { optional = true, opts = function(_, opts) opts.open_files_do_not_replace_types = opts.open_files_do_not_replace_types - or { "terminal", "Trouble", "qf", "Outline" } + or { "terminal", "Trouble", "qf", "Outline", "trouble" } table.insert(opts.open_files_do_not_replace_types, "edgy") end, }, diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 3277ef83..e66725c0 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -7,6 +7,15 @@ return { version = false, -- last release is way too old and doesn't work on Windows build = ":TSUpdate", event = { "LazyFile", "VeryLazy" }, + init = function(plugin) + -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early + -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which + -- no longer trigger the **nvim-treeitter** module to be loaded in time. + -- Luckily, the only thins that those plugins need are the custom queries, which we make available + -- during startup. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, dependencies = { { "nvim-treesitter/nvim-treesitter-textobjects", diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 88577395..50efb153 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -228,6 +228,7 @@ return { "dashboard", "neo-tree", "Trouble", + "trouble", "lazy", "mason", "notify", @@ -259,6 +260,7 @@ return { "dashboard", "neo-tree", "Trouble", + "trouble", "lazy", "mason", "notify", diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 9ff2c986..7ab69134 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -76,10 +76,12 @@ function M.lazy_file() local events = {} ---@type {event: string, buf: number, data?: any}[] + local done = false local function load() - if #events == 0 then + if #events == 0 or done then return end + done = true vim.api.nvim_del_augroup_by_name("lazy_file") ---@type table @@ -90,17 +92,19 @@ function M.lazy_file() vim.api.nvim_exec_autocmds("User", { pattern = "LazyFile", modeline = false }) for _, event in ipairs(events) do - Event.trigger({ - event = event.event, - exclude = skips[event.event], - data = event.data, - buf = event.buf, - }) - if vim.bo[event.buf].filetype then + if vim.api.nvim_buf_is_valid(event.buf) then Event.trigger({ - event = "FileType", + event = event.event, + exclude = skips[event.event], + data = event.data, buf = event.buf, }) + if vim.bo[event.buf].filetype then + Event.trigger({ + event = "FileType", + buf = event.buf, + }) + end end end vim.api.nvim_exec_autocmds("CursorMoved", { modeline = false }) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index c17a1e7b..68999eda 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -141,4 +141,42 @@ function M.fg(name) return fg and { fg = string.format("#%06x", fg) } or nil end +M.skip_foldexpr = {} ---@type table +local skip_check = assert(vim.loop.new_check()) + +function M.foldexpr() + local buf = vim.api.nvim_get_current_buf() + + -- still in the same tick and no parser + if M.skip_foldexpr[buf] then + return "0" + end + + -- don't use treesitter folds for non-file buffers + if vim.bo[buf].buftype ~= "" then + return "0" + end + + -- as long as we don't have a filetype, don't bother + -- checking if treesitter is available (it won't) + if vim.bo[buf].filetype == "" then + return "0" + end + + local ok = pcall(vim.treesitter.get_parser, buf) + + if ok then + return vim.treesitter.foldexpr() + end + + -- no parser available, so mark it as skip + -- in the next tick, all skip marks will be reset + M.skip_foldexpr[buf] = true + skip_check:start(function() + M.skip_foldexpr = {} + skip_check:stop() + end) + return "0" +end + return M