From be6d1f995f9680588a5452f1e92e1f8d52503c2d Mon Sep 17 00:00:00 2001 From: siduck Date: Mon, 15 Aug 2022 19:23:55 +0530 Subject: [PATCH 01/21] fix mapleader not mapped properly to general mappings this happens cuz all mappings are set just after calling core.options and custom module is called at the end of the init.lua #1475 --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 1c19c3f..0e2e5fa 100644 --- a/init.lua +++ b/init.lua @@ -5,8 +5,6 @@ end, 0) require "core" require "core.options" -require("core.utils").load_mappings() - -- setup packer + plugins local fn = vim.fn local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" @@ -23,3 +21,5 @@ if fn.empty(fn.glob(install_path)) > 0 then end pcall(require, "custom") + +require("core.utils").load_mappings() From 8e8d18ed8db0d353bbccfae53dabf104ea39e56f Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Mon, 15 Aug 2022 19:26:25 +0900 Subject: [PATCH 02/21] fix: not detecting subdir in git repo --- lua/core/lazy_load.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 1ddd62f..a12ad11 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,11 +79,11 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - if vim.fn.isdirectory ".git" ~= 0 then - vim.schedule(function() - require("packer").loader "gitsigns.nvim" - end) - end + vim.fn.system([[git rev-parse 2>/dev/null]]) + if vim.v.shell_error == 0 then + vim.schedule(function() + require("packer").loader "gitsigns.nvim" + end) end, }) end From 14ef6759bebe469b63e05d797da44b3d02f6ac60 Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Mon, 15 Aug 2022 19:33:44 +0900 Subject: [PATCH 03/21] Format with stylua --- lua/core/lazy_load.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index a12ad11..5cde671 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,11 +79,12 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - vim.fn.system([[git rev-parse 2>/dev/null]]) - if vim.v.shell_error == 0 then - vim.schedule(function() - require("packer").loader "gitsigns.nvim" - end) + vim.fn.system [[git rev-parse 2>/dev/null]] + if vim.v.shell_error == 0 then + vim.schedule(function() + require("packer").loader "gitsigns.nvim" + end) + end end, }) end From e0d3950f5066c3ea316bb3ad0674554437a25f20 Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Mon, 15 Aug 2022 19:41:39 +0900 Subject: [PATCH 04/21] fix not using current file's path --- lua/core/lazy_load.lua | 124 ++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 5cde671..7f7a6b6 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -5,27 +5,27 @@ local autocmd = vim.api.nvim_create_autocmd -- This must be used for plugins that need to be loaded just after a file -- ex : treesitter, lspconfig etc M.lazy_load = function(tb) - autocmd(tb.events, { - group = vim.api.nvim_create_augroup(tb.augroup_name, {}), - callback = function() - if tb.condition() then - vim.api.nvim_del_augroup_by_name(tb.augroup_name) + autocmd(tb.events, { + group = vim.api.nvim_create_augroup(tb.augroup_name, {}), + callback = function() + if tb.condition() then + vim.api.nvim_del_augroup_by_name(tb.augroup_name) - -- dont defer for treesitter as it will show slow highlighting - -- This deferring only happens only when we do "nvim filename" - if tb.plugin ~= "nvim-treesitter" then - vim.defer_fn(function() - require("packer").loader(tb.plugin) - if tb.plugin == "nvim-lspconfig" then - vim.cmd "silent! do FileType" - end - end, 0) - else - require("packer").loader(tb.plugin) - end - end - end, - }) + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if tb.plugin ~= "nvim-treesitter" then + vim.defer_fn(function() + require("packer").loader(tb.plugin) + if tb.plugin == "nvim-lspconfig" then + vim.cmd("silent! do FileType") + end + end, 0) + else + require("packer").loader(tb.plugin) + end + end + end, + }) end -- load certain plugins only when there's a file opened in the buffer @@ -33,60 +33,60 @@ end -- This gives an instant preview of nvim with the file opened M.on_file_open = function(plugin_name) - M.lazy_load { - events = { "BufRead", "BufWinEnter", "BufNewFile" }, - augroup_name = "BeLazyOnFileOpen" .. plugin_name, - plugin = plugin_name, - condition = function() - local file = vim.fn.expand "%" - return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" - end, - } + M.lazy_load({ + events = { "BufRead", "BufWinEnter", "BufNewFile" }, + augroup_name = "BeLazyOnFileOpen" .. plugin_name, + plugin = plugin_name, + condition = function() + local file = vim.fn.expand("%") + return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" + end, + }) end M.packer_cmds = { - "PackerSnapshot", - "PackerSnapshotRollback", - "PackerSnapshotDelete", - "PackerInstall", - "PackerUpdate", - "PackerSync", - "PackerClean", - "PackerCompile", - "PackerStatus", - "PackerProfile", - "PackerLoad", + "PackerSnapshot", + "PackerSnapshotRollback", + "PackerSnapshotDelete", + "PackerInstall", + "PackerUpdate", + "PackerSync", + "PackerClean", + "PackerCompile", + "PackerStatus", + "PackerProfile", + "PackerLoad", } M.treesitter_cmds = { - "TSInstall", - "TSBufEnable", - "TSBufDisable", - "TSEnable", - "TSDisable", - "TSModuleInfo", + "TSInstall", + "TSBufEnable", + "TSBufDisable", + "TSEnable", + "TSDisable", + "TSModuleInfo", } M.mason_cmds = { - "Mason", - "MasonInstall", - "MasonInstallAll", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", + "Mason", + "MasonInstall", + "MasonInstallAll", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", } M.gitsigns = function() - autocmd({ "BufRead" }, { - callback = function() - vim.fn.system [[git rev-parse 2>/dev/null]] - if vim.v.shell_error == 0 then - vim.schedule(function() - require("packer").loader "gitsigns.nvim" - end) - end - end, - }) + autocmd({ "BufRead" }, { + callback = function() + vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand("%:p:h")) + if vim.v.shell_error == 0 then + vim.schedule(function() + require("packer").loader("gitsigns.nvim") + end) + end + end, + }) end return M From 66e2904b68de748b603681ac948a7944a59e45a9 Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Mon, 15 Aug 2022 19:42:27 +0900 Subject: [PATCH 05/21] format with stylua --- lua/core/lazy_load.lua | 124 ++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 7f7a6b6..aae71da 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -5,27 +5,27 @@ local autocmd = vim.api.nvim_create_autocmd -- This must be used for plugins that need to be loaded just after a file -- ex : treesitter, lspconfig etc M.lazy_load = function(tb) - autocmd(tb.events, { - group = vim.api.nvim_create_augroup(tb.augroup_name, {}), - callback = function() - if tb.condition() then - vim.api.nvim_del_augroup_by_name(tb.augroup_name) + autocmd(tb.events, { + group = vim.api.nvim_create_augroup(tb.augroup_name, {}), + callback = function() + if tb.condition() then + vim.api.nvim_del_augroup_by_name(tb.augroup_name) - -- dont defer for treesitter as it will show slow highlighting - -- This deferring only happens only when we do "nvim filename" - if tb.plugin ~= "nvim-treesitter" then - vim.defer_fn(function() - require("packer").loader(tb.plugin) - if tb.plugin == "nvim-lspconfig" then - vim.cmd("silent! do FileType") - end - end, 0) - else - require("packer").loader(tb.plugin) - end - end - end, - }) + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if tb.plugin ~= "nvim-treesitter" then + vim.defer_fn(function() + require("packer").loader(tb.plugin) + if tb.plugin == "nvim-lspconfig" then + vim.cmd "silent! do FileType" + end + end, 0) + else + require("packer").loader(tb.plugin) + end + end + end, + }) end -- load certain plugins only when there's a file opened in the buffer @@ -33,60 +33,60 @@ end -- This gives an instant preview of nvim with the file opened M.on_file_open = function(plugin_name) - M.lazy_load({ - events = { "BufRead", "BufWinEnter", "BufNewFile" }, - augroup_name = "BeLazyOnFileOpen" .. plugin_name, - plugin = plugin_name, - condition = function() - local file = vim.fn.expand("%") - return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" - end, - }) + M.lazy_load { + events = { "BufRead", "BufWinEnter", "BufNewFile" }, + augroup_name = "BeLazyOnFileOpen" .. plugin_name, + plugin = plugin_name, + condition = function() + local file = vim.fn.expand "%" + return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" + end, + } end M.packer_cmds = { - "PackerSnapshot", - "PackerSnapshotRollback", - "PackerSnapshotDelete", - "PackerInstall", - "PackerUpdate", - "PackerSync", - "PackerClean", - "PackerCompile", - "PackerStatus", - "PackerProfile", - "PackerLoad", + "PackerSnapshot", + "PackerSnapshotRollback", + "PackerSnapshotDelete", + "PackerInstall", + "PackerUpdate", + "PackerSync", + "PackerClean", + "PackerCompile", + "PackerStatus", + "PackerProfile", + "PackerLoad", } M.treesitter_cmds = { - "TSInstall", - "TSBufEnable", - "TSBufDisable", - "TSEnable", - "TSDisable", - "TSModuleInfo", + "TSInstall", + "TSBufEnable", + "TSBufDisable", + "TSEnable", + "TSDisable", + "TSModuleInfo", } M.mason_cmds = { - "Mason", - "MasonInstall", - "MasonInstallAll", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", + "Mason", + "MasonInstall", + "MasonInstallAll", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", } M.gitsigns = function() - autocmd({ "BufRead" }, { - callback = function() - vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand("%:p:h")) - if vim.v.shell_error == 0 then - vim.schedule(function() - require("packer").loader("gitsigns.nvim") - end) - end - end, - }) + autocmd({ "BufRead" }, { + callback = function() + vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand "%:p:h") + if vim.v.shell_error == 0 then + vim.schedule(function() + require("packer").loader "gitsigns.nvim" + end) + end + end, + }) end return M From d9cd55fc0f3f740806538d81bd89cb55bf5f3d2d Mon Sep 17 00:00:00 2001 From: doubleChu <57394064+doubleChu@users.noreply.github.com> Date: Mon, 15 Aug 2022 22:52:52 +0800 Subject: [PATCH 06/21] make paddings in the layout can be overrided users can adjust the padding between the top and the header, or the header and buttons. --- lua/plugins/configs/alpha.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/plugins/configs/alpha.lua b/lua/plugins/configs/alpha.lua index 1572aa9..e2caab6 100644 --- a/lua/plugins/configs/alpha.lua +++ b/lua/plugins/configs/alpha.lua @@ -34,6 +34,11 @@ local function button(sc, txt, keybind) } end +-- dynamic header padding +local fn = vim.fn +local marginTopPercent = 0.3 +local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) } + local options = { header = { @@ -71,20 +76,18 @@ local options = { spacing = 1, }, }, + + headerPaddingTop = { type = "padding", val = headerPadding }, + headerPaddingBottom = { type = "padding", val = 2 }, } options = require("core.utils").load_override(options, "goolord/alpha-nvim") --- dynamic header padding -local fn = vim.fn -local marginTopPercent = 0.3 -local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) } - alpha.setup { layout = { - { type = "padding", val = headerPadding }, + options.headerPaddingTop, options.header, - { type = "padding", val = 2 }, + options.headerPaddingBottom, options.buttons, }, opts = {}, From ce86597c3d0666a54696221ec0ff55ea3ec9b402 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Wed, 17 Aug 2022 21:13:12 +0530 Subject: [PATCH 07/21] utils: bufilter: Check for nil it will be empty if tabufline is disabled --- lua/core/utils.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/core/utils.lua b/lua/core/utils.lua index ed533f6..243664c 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -175,7 +175,11 @@ M.packer_sync = function(...) end M.bufilter = function() - local bufs = vim.t.bufs + local bufs = vim.t.bufs or nil + + if not bufs then + return {} + end for i = #bufs, 1, -1 do if not vim.api.nvim_buf_is_valid(bufs[i]) then From 5e81ae8379c415ac7c8d4ca8856ac33056ee7585 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Wed, 17 Aug 2022 21:15:23 +0530 Subject: [PATCH 08/21] utils: close_buffer: Ask for confirmation when using on modified files neovim handles this internally so why not use it --- lua/core/utils.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 243664c..7d4fd2c 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -6,12 +6,10 @@ local merge_tb = vim.tbl_deep_extend M.close_buffer = function(bufnr) if vim.bo.buftype == "terminal" then vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide") - elseif vim.bo.modified then - print "save the file bruh" else bufnr = bufnr or api.nvim_get_current_buf() require("core.utils").tabuflinePrev() - vim.cmd("bd" .. bufnr) + vim.cmd("silent! confirm bd" .. bufnr) end end From 130442712bcf0d97c3e7635c582b5d397dabfd7c Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Thu, 18 Aug 2022 00:31:31 +0530 Subject: [PATCH 09/21] Fix some lsp warnings --- lua/core/utils.lua | 2 +- lua/plugins/configs/alpha.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 7d4fd2c..930f816 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -132,7 +132,7 @@ end M.load_override = function(default_table, plugin_name) local user_table = M.load_config().plugins.override[plugin_name] or {} user_table = type(user_table) == "table" and user_table or user_table() - return merge_tb("force", default_table, user_table) + return merge_tb("force", default_table, user_table) or {} end M.packer_sync = function(...) diff --git a/lua/plugins/configs/alpha.lua b/lua/plugins/configs/alpha.lua index e2caab6..6ddb0c2 100644 --- a/lua/plugins/configs/alpha.lua +++ b/lua/plugins/configs/alpha.lua @@ -27,7 +27,7 @@ local function button(sc, txt, keybind) type = "button", val = txt, on_press = function() - local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) + local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) or "" vim.api.nvim_feedkeys(key, "normal", false) end, opts = opts, From a67e19a439b1f8b214d2a471cbe8b0f98cb62ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Elet?= Date: Fri, 19 Aug 2022 18:23:25 +0200 Subject: [PATCH 10/21] feat(init): resize panes when vim window is resized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Elet --- lua/core/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/core/init.lua b/lua/core/init.lua index 0e30564..3179a63 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -85,3 +85,9 @@ autocmd("BufDelete", { end end, }) + +-- Auto resize panes +autocmd("VimResized", { + pattern = "*", + command = "tabdo wincmd =", +}) From 089cbe43f13157c4ab8dc1dbd0927a92468f6d1d Mon Sep 17 00:00:00 2001 From: siduck Date: Sat, 20 Aug 2022 19:05:30 +0530 Subject: [PATCH 11/21] update mason filetype https://github.com/williamboman/mason.nvim/pull/317 --- lua/plugins/configs/mason.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/configs/mason.lua b/lua/plugins/configs/mason.lua index 5546340..b330bda 100644 --- a/lua/plugins/configs/mason.lua +++ b/lua/plugins/configs/mason.lua @@ -6,7 +6,7 @@ end vim.api.nvim_create_augroup("_mason", { clear = true }) vim.api.nvim_create_autocmd("Filetype", { - pattern = "mason.nvim", + pattern = "mason", callback = function() require("base46").load_highlight "mason" end, From 4a5a927de8587c9c42e7a2dcac837956c411eaac Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Sat, 20 Aug 2022 22:30:01 +0900 Subject: [PATCH 12/21] fix: Windows User cannot load gitsigns --- lua/core/lazy_load.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index aae71da..5872cb6 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,7 +79,7 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - vim.fn.system("git rev-parse 2>/dev/null " .. vim.fn.expand "%:p:h") + vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") if vim.v.shell_error == 0 then vim.schedule(function() require("packer").loader "gitsigns.nvim" From a6f2f0e0b92de561053681747c2d537cda1adf42 Mon Sep 17 00:00:00 2001 From: siduck Date: Tue, 23 Aug 2022 18:54:04 +0530 Subject: [PATCH 13/21] Breaking Change: Avoid mapping default keybind related to #1504 #1386, leader + b is the new key for opening new buffers now --- lua/core/lazy_load.lua | 2 +- lua/core/mappings.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 5872cb6..60cc298 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,7 +79,7 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") + vim.fn.system("git rev-parse" .. vim.fn.expand "%:p:h") if vim.v.shell_error == 0 then vim.schedule(function() require("packer").loader "gitsigns.nvim" diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 8ab1757..f5e7b60 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -58,7 +58,7 @@ M.general = { [""] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, -- new buffer - [""] = { " enew ", "new buffer" }, + ["b"] = { " enew ", "new buffer" }, -- close buffer + hide terminal buffer ["x"] = { @@ -383,7 +383,7 @@ M.blankline = { plugin = true, n = { - ["bc"] = { + ["cc"] = { function() local ok, start = require("indent_blankline.utils").get_current_context( vim.g.indent_blankline_context_patterns, From 0f5a96028e7e1a9db534d30e91758c0dd6582298 Mon Sep 17 00:00:00 2001 From: Lucario387 Date: Wed, 24 Aug 2022 09:24:58 +0900 Subject: [PATCH 14/21] fix: gitsigns not loading --- lua/core/lazy_load.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 60cc298..48a8182 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,7 +79,7 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - vim.fn.system("git rev-parse" .. vim.fn.expand "%:p:h") + vim.fn.system("git rev-parse" .. " " .. vim.fn.expand "%:p:h") if vim.v.shell_error == 0 then vim.schedule(function() require("packer").loader "gitsigns.nvim" From 4ac1ece32691c79258324a24c8cd16595699a48a Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2022 08:17:40 +0530 Subject: [PATCH 15/21] Update lazy_load.lua --- lua/core/lazy_load.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 48a8182..5872cb6 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -79,7 +79,7 @@ M.mason_cmds = { M.gitsigns = function() autocmd({ "BufRead" }, { callback = function() - vim.fn.system("git rev-parse" .. " " .. vim.fn.expand "%:p:h") + vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") if vim.v.shell_error == 0 then vim.schedule(function() require("packer").loader "gitsigns.nvim" From 90212894210a134ba44473ace92cd4ed80e1e286 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 21 Aug 2022 14:02:56 +0530 Subject: [PATCH 16/21] core: autocmd: Remove 'tabdo wincmd =' on VimResized this should not be in main config, not every one wants their splits to be of equal size on resize, sometimes i want the split to of smaller size whether the screen is resized or not this should be in used custom dir --- lua/core/init.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index 3179a63..0e30564 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -85,9 +85,3 @@ autocmd("BufDelete", { end end, }) - --- Auto resize panes -autocmd("VimResized", { - pattern = "*", - command = "tabdo wincmd =", -}) From fe9a7b16519b7873b8c7c917c34801d77ec3770c Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 21 Aug 2022 15:06:09 +0530 Subject: [PATCH 17/21] core|options: Add formatoptions in options | Remove unnecessary autocmd --- lua/core/init.lua | 6 ------ lua/core/options.lua | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index 0e30564..95dfd5f 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -42,12 +42,6 @@ autocmd("BufUnload", { end, }) --- Don't auto commenting new lines -autocmd("BufEnter", { - pattern = "*", - command = "set fo-=c fo-=r fo-=o", -}) - -- store listed buffers in tab local var vim.t.bufs = vim.api.nvim_list_bufs() diff --git a/lua/core/options.lua b/lua/core/options.lua index 30ec75e..ee86d75 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -55,6 +55,9 @@ opt.updatetime = 250 -- when cursor reaches end/beginning of line opt.whichwrap:append "<>[]hl" +-- auto-wrap comments, don't auto insert comment on o/O and enter +opt.formatoptions:remove "cro" + g.mapleader = " " -- disable some builtin vim plugins From a23d955656dc4073c255bbcd7d9f47edbdee49ba Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 21 Aug 2022 17:26:34 +0530 Subject: [PATCH 18/21] plugins: alpha: Move alpha related cmd to alpha config this special handling of statusline should only be done if alpha plugin is used --- lua/core/init.lua | 15 --------------- lua/plugins/configs/alpha.lua | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index 95dfd5f..f2ab2be 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -27,21 +27,6 @@ autocmd("VimEnter", { end, }) --- Disable statusline in dashboard -autocmd("FileType", { - pattern = "alpha", - callback = function() - vim.opt.laststatus = 0 - end, -}) - -autocmd("BufUnload", { - buffer = 0, - callback = function() - vim.opt.laststatus = 3 - end, -}) - -- store listed buffers in tab local var vim.t.bufs = vim.api.nvim_list_bufs() diff --git a/lua/plugins/configs/alpha.lua b/lua/plugins/configs/alpha.lua index 6ddb0c2..b91c233 100644 --- a/lua/plugins/configs/alpha.lua +++ b/lua/plugins/configs/alpha.lua @@ -92,3 +92,19 @@ alpha.setup { }, opts = {}, } + +-- Disable statusline in dashboard +vim.api.nvim_create_autocmd("FileType", { + pattern = "alpha", + callback = function() + -- store current statusline value and use that + local old_laststatus = vim.opt.laststatus + vim.api.nvim_create_autocmd("BufUnload", { + buffer = 0, + callback = function() + vim.opt.laststatus = old_laststatus + end, + }) + vim.opt.laststatus = 0 + end, +}) From 2b41bcd3dfd654d265bb7ea1d24866582d6147fd Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 21 Aug 2022 17:39:37 +0530 Subject: [PATCH 19/21] core: Move relavent tabufline code to NvChad/ui repo --- lua/core/init.lua | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/lua/core/init.lua b/lua/core/init.lua index f2ab2be..e96ca1a 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -10,7 +10,6 @@ vim.cmd "silent! command! NvChadSnapshotCheckout lua require('nvchad').snap_chec -- autocmds local autocmd = vim.api.nvim_create_autocmd -local api = vim.api -- dont list quickfix buffers autocmd("FileType", { @@ -26,41 +25,3 @@ autocmd("VimEnter", { vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync()" end, }) - --- store listed buffers in tab local var -vim.t.bufs = vim.api.nvim_list_bufs() - --- autocmds for tabufline -> store bufnrs on bufadd, bufenter events --- thx to https://github.com/ii14 & stores buffer per tab -> table -autocmd({ "BufAdd", "BufEnter" }, { - callback = function(args) - if vim.t.bufs == nil then - vim.t.bufs = { args.buf } - else - local bufs = vim.t.bufs - - -- check for duplicates - if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then - table.insert(bufs, args.buf) - vim.t.bufs = bufs - end - end - end, -}) - -autocmd("BufDelete", { - callback = function(args) - for _, tab in ipairs(api.nvim_list_tabpages()) do - local bufs = vim.t[tab].bufs - if bufs then - for i, bufnr in ipairs(bufs) do - if bufnr == args.buf then - table.remove(bufs, i) - vim.t[tab].bufs = bufs - break - end - end - end - end - end, -}) From 696559863ba8368e3aee953ee7de3561934d4abe Mon Sep 17 00:00:00 2001 From: siduck Date: Thu, 25 Aug 2022 18:01:45 +0530 Subject: [PATCH 20/21] keep ftplugin folder git-ignored | #1510 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index db7df8e..de45666 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ plugin custom spell +ftplugin From bf827e0ebd3ef3c75fd0385fe6d176d5f5fdc4c3 Mon Sep 17 00:00:00 2001 From: siduck Date: Sun, 28 Aug 2022 09:14:09 +0530 Subject: [PATCH 21/21] fix #1516 #1517 an autocmd can be used for formatoptions and avoid using bw, read the convo at https://github.com/NvChad/NvChad/commit/39c42ca2bfb2ce7e2858de959f3b0f19681eea8d#r82388570 --- lua/core/options.lua | 3 --- lua/core/utils.lua | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/core/options.lua b/lua/core/options.lua index ee86d75..30ec75e 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -55,9 +55,6 @@ opt.updatetime = 250 -- when cursor reaches end/beginning of line opt.whichwrap:append "<>[]hl" --- auto-wrap comments, don't auto insert comment on o/O and enter -opt.formatoptions:remove "cro" - g.mapleader = " " -- disable some builtin vim plugins diff --git a/lua/core/utils.lua b/lua/core/utils.lua index 930f816..b89b9d7 100644 --- a/lua/core/utils.lua +++ b/lua/core/utils.lua @@ -9,7 +9,7 @@ M.close_buffer = function(bufnr) else bufnr = bufnr or api.nvim_get_current_buf() require("core.utils").tabuflinePrev() - vim.cmd("silent! confirm bd" .. bufnr) + vim.cmd("confirm bd" .. bufnr) end end