feat: implement command-line abbreviation for lazy commands
This commit is contained in:
+13
-1
@@ -76,10 +76,22 @@ local function execute_nvim_exec()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Define an autogroup for the autocmd
|
-- Define an autogroup for the NvimExec autocmd
|
||||||
autogrp('NvimExec', { clear = true })
|
autogrp('NvimExec', { clear = true })
|
||||||
-- Define an autocmd to run the function at startup
|
-- Define an autocmd to run the function at startup
|
||||||
autocmd('VimEnter', {
|
autocmd('VimEnter', {
|
||||||
group = 'NvimExec',
|
group = 'NvimExec',
|
||||||
callback = execute_nvim_exec,
|
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 <expr> lazy ((getcmdtype() == ':' && getcmdline() == 'lazy') ? 'Lazy' : 'lazy')
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user