From b59e7c315b668182320702fd2944eda9f74a3314 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Sun, 19 May 2024 01:33:42 -0600 Subject: [PATCH 1/8] docs: Update example plugin file to use native snippets with supertab. (#66) --- lua/plugins/example.lua | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua index de22bc8..8b7eabc 100644 --- a/lua/plugins/example.lua +++ b/lua/plugins/example.lua @@ -192,14 +192,6 @@ return { }, -- Use for completion and snippets (supertab) - -- first: disable default and behavior in LuaSnip - { - "L3MON4D3/LuaSnip", - keys = function() - return {} - end, - }, - -- then: setup supertab in cmp { "hrsh7th/nvim-cmp", dependencies = { @@ -213,17 +205,16 @@ return { return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end - local luasnip = require("luasnip") local cmp = require("cmp") opts.mapping = vim.tbl_extend("force", opts.mapping, { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- this way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() + elseif vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) elseif has_words_before() then cmp.complete() else @@ -233,8 +224,10 @@ return { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) + elseif vim.snippet.active({ direction = -1 }) then + vim.schedule(function() + vim.snippet.jump(-1) + end) else fallback() end From 4818e4b72fc24b0fceed88f83e21e908def4c386 Mon Sep 17 00:00:00 2001 From: DrummyFloyd Date: Sun, 2 Jun 2024 17:00:03 +0200 Subject: [PATCH 2/8] fix: removed unnecessary env var (#67) according to https://github.com/LazyVim/LazyVim/issues/2063#issuecomment-2143841592 this is not needed --- lua/config/lazy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index fd269d7..2e7bf62 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -5,7 +5,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then -- stylua: ignore vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) +vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { From cb79b0e6a9d0ec81041150dc87fe47352a54a2ba Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 14 Jun 2024 10:14:39 +0200 Subject: [PATCH 3/8] fix: improve comment about extras loading in config (#75) * fix: improve comment about extras loading in config * fix: use LazyExtras --------- Co-authored-by: Folke Lemaitre --- lua/config/lazy.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 2e7bf62..4aeb4bd 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -11,10 +11,6 @@ require("lazy").setup({ spec = { -- add LazyVim and import its plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import any extras modules here - -- { import = "lazyvim.plugins.extras.lang.typescript" }, - -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, -- import/override with your plugins { import = "plugins" }, }, From 0c370f4d5c537e6d41dea31b547accc8d5f70a8a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 18 Jun 2024 07:11:12 +0200 Subject: [PATCH 4/8] docs: removed supertab example --- lua/plugins/example.lua | 45 ----------------------------------------- 1 file changed, 45 deletions(-) diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua index 8b7eabc..4ad9825 100644 --- a/lua/plugins/example.lua +++ b/lua/plugins/example.lua @@ -190,49 +190,4 @@ return { }, }, }, - - -- Use for completion and snippets (supertab) - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-emoji", - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local cmp = require("cmp") - - opts.mapping = vim.tbl_extend("force", opts.mapping, { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif vim.snippet.active({ direction = 1 }) then - vim.schedule(function() - vim.snippet.jump(1) - end) - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif vim.snippet.active({ direction = -1 }) then - vim.schedule(function() - vim.snippet.jump(-1) - end) - else - fallback() - end - end, { "i", "s" }), - }) - end, - }, } From 79b3f27f5cea8fe6bbb95ba04f93dffa545c5197 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 3 Jul 2024 10:19:46 +0200 Subject: [PATCH 5/8] fix: add error handling to initial clone --- lua/config/lazy.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 4aeb4bd..732f55a 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,9 +1,16 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" - if not (vim.uv or vim.loop).fs_stat(lazypath) then - -- bootstrap lazy.nvim - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) From cb6349c8ae922d1c5745574f4d17b44f2731d451 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 20 Jul 2024 23:30:46 +0200 Subject: [PATCH 6/8] fix: disable lazy checker notify by default --- lua/config/lazy.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 732f55a..d73bfa1 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -31,7 +31,10 @@ require("lazy").setup({ -- version = "*", -- try installing the latest stable version for plugins that support semver }, install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { enabled = true }, -- automatically check for plugin updates + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates performance = { rtp = { -- disable some rtp plugins From 7a10a75dc3fc2fc6a4f35f2eb33d12995ac9efca Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:11:31 +0300 Subject: [PATCH 7/8] docs: fix `lualine` component example (#95) As per https://github.com/LazyVim/LazyVim/issues/4544 it creates confusion to the users who are just trying out the example to try things out. Better to avoid such misinterpretations in the future. I'm assuming this will also update the docs automatically as I can deduce from https://github.com/LazyVim/lazyvim.github.io/blob/25af26046a30be110f0aa19c87ad2a1a1e53ce45/lua/build.lua#L369-L372? --- lua/plugins/example.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua index 4ad9825..17f53d6 100644 --- a/lua/plugins/example.lua +++ b/lua/plugins/example.lua @@ -157,7 +157,11 @@ return { "nvim-lualine/lualine.nvim", event = "VeryLazy", opts = function(_, opts) - table.insert(opts.sections.lualine_x, "😄") + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) end, }, From 803bc181d7c0d6d5eeba9274d9be49b287294d99 Mon Sep 17 00:00:00 2001 From: Adrian Wilkins Date: Wed, 11 Dec 2024 16:56:39 +0000 Subject: [PATCH 8/8] docs: Explain more about how to add and remove autocmds (#105) Co-authored-by: Adrian Wilkins --- lua/config/autocmds.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 27e9e06..4221e75 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,3 +1,8 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- -- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")