From 97c969d46c24fa2c60101f01b246c51612222952 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sat, 23 Nov 2024 14:18:13 -0500 Subject: [PATCH] feat: implement command-line abbreviation for lazy commands --- lua/config/autocmds.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index e8d6b53..ec84048 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -76,10 +76,22 @@ local function execute_nvim_exec() end end --- Define an autogroup for the autocmd +-- Define an autogroup for the NvimExec autocmd autogrp('NvimExec', { clear = true }) -- Define an autocmd to run the function at startup autocmd('VimEnter', { group = 'NvimExec', callback = execute_nvim_exec, }) + +-- Create an autogroup for managing command-line abbreviations +local abbrev_group = autogrp('LazyAbbreviationGroup', { clear = true }) +-- Create an autocmd for unwrapping the 'lazy' abbreviation +autocmd('CmdlineEnter', { + group = abbrev_group, + callback = function() + vim.cmd([[ +cnoreabbrev lazy ((getcmdtype() == ':' && getcmdline() == 'lazy') ? 'Lazy' : 'lazy') + ]]) + end, +})