feat(lua): add smart column auto, macro notifications, auto‑save debounce, and TSInstallAll command

New Features
- Smart column auto‑command that activates only when needed, respecting disabled filetypes
- Macro recording notifications with short INFO‑level messages
- Auto‑save with 3‑second debounce triggered on TextChanged, InsertLeave, BufLeave, FocusLost
- TSInstallAll user command to install all configured Tree‑sitter parsers

Enhancements- Cleanup of unused autocmds and simplification of pack_helper registration

Bug Fixes
-Removed legacy secure .env masking code that caused conceal issues
This commit is contained in:
sankalp committed 2026-05-07 21:06:40 +05:45
1 parent 0f608510b5
commit 479a448da6
2 files changed
+24 -31

No files matched your search

+23 -17
View File
@@ -2,9 +2,27 @@ local function augroup(name)
return vim.api.nvim_create_augroup("nvim_" .. name, { clear = true })
end
-- -----------------------------------------------------------------------------
-- General UI & Behavior
-- -----------------------------------------------------------------------------
-- smart column only when needed
local smart_column_group = vim.api.nvim_create_augroup('SmartColumn', { clear = true })
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI', 'BufEnter' }, {
group = smart_column_group,
callback = function()
local limit = 120
local disabled_fts = { 'help', 'text', 'markdown', 'oil', 'snacks_dashboard', 'dashboard' }
if vim.tbl_contains(disabled_fts, vim.bo.filetype) then
vim.wo.colorcolumn = ''
return
end
local curr_line = vim.api.nvim_get_current_line()
if vim.fn.strdisplaywidth(curr_line) > limit then
vim.wo.colorcolumn = tostring(limit)
else
vim.wo.colorcolumn = ''
end
end,
})
-- Secure .env Masking (Conceal method)
local function toggle_env_mask()
@@ -98,10 +116,6 @@ vim.api.nvim_create_autocmd("BufWritePre", {
end,
})
-- -----------------------------------------------------------------------------
-- LSP Related
-- -----------------------------------------------------------------------------
-- Document Highlight on CursorHold
vim.api.nvim_create_autocmd("LspAttach", {
group = augroup("lsp_attach_autocmds"),
@@ -120,10 +134,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
end,
})
-- -----------------------------------------------------------------------------
-- Filetype Specific
-- -----------------------------------------------------------------------------
-- Wrap and spellcheck in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"),
@@ -150,10 +160,8 @@ vim.api.nvim_create_user_command("TSInstallAll", function()
require("nvim-treesitter.install").install(parsers)
end, { desc = "Install all configured Tree-sitter parsers" })
-- -----------------------------------------------------------------------------
-- Macro Notifications
-- -----------------------------------------------------------------------------
-- Macro Notifications
vim.api.nvim_create_autocmd("RecordingEnter", {
callback = function()
vim.notify("Recording macro...", vim.log.levels.INFO, { title = "Macro", timeout = 1000 })
@@ -167,10 +175,8 @@ vim.api.nvim_create_autocmd("RecordingLeave", {
end,
})
-- -----------------------------------------------------------------------------
-- Auto-Save (3s Debounce)
-- -----------------------------------------------------------------------------
-- Auto-Save (3s Debounce)
local save_timer = nil
vim.api.nvim_create_autocmd({ "TextChanged", "InsertLeave", "BufLeave", "FocusLost" }, {
group = augroup("autosave"),
+1 -14
View File
@@ -1,5 +1,5 @@
--- @class PackHelper
local M = { registered = {} }
local M = {}
-- Shorthands: gh (default), gl: (GitLab), cb: (Codeberg)
local SOURCES = setmetatable({
@@ -26,21 +26,8 @@ _G.add = function(specs)
return s
end)() or s)
table.insert(res, n)
M.registered[type(n) == "table" and n.src or n] = true
end
if #res > 0 then pcall(vim.pack.add, res) end
end
M.clean = function()
local del = {}
for url in pairs(vim.pack.get()) do
if not M.registered[url] then table.insert(del, url) end
end
if #del == 0 then return vim.notify("Plugins up to date", 2) end
if vim.fn.input("Delete " .. #del .. " plugins? (y/n): "):lower() == "y" then
for _, u in ipairs(del) do vim.pack.del(u) end
vim.notify("Cleaned " .. #del, 2)
end
end
return M