add abbreviations for "help" prefixes

This commit is contained in:
Dietrich Rink
2023-06-10 14:34:28 +02:00
parent dd67e62569
commit e68a50f0ff

View File

@@ -60,10 +60,13 @@ vim.api.nvim_create_user_command('Help', function(a)
if vim.fn.bufnr('%') ~= buf then vim.cmd.bwipeout(buf) end if vim.fn.bufnr('%') ~= buf then vim.cmd.bwipeout(buf) end
end, { nargs = '?', bar = true, complete = 'help' }) end, { nargs = '?', bar = true, complete = 'help' })
-- Add command line abbreviation if at start of line -- Add command line abbreviations if at start of line
vim.cmd.cabbrev { 'help', for i, word in ipairs { 'h', 'he', 'hel', 'help' } do
'<c-r>=(getcmdtype() == ":" && getcmdpos() == 1) ? "Help" : "help"<cr>' vim.cmd.cabbrev { word, string.format(
} '<c-r>=(getcmdtype() == ":" && getcmdpos() == 1) ? "Help" : "%s"<cr>',
word
)}
end
-- Source init directory -- Source init directory
vim.cmd 'runtime! init/*.lua' vim.cmd 'runtime! init/*.lua'