From e68a50f0ff7de0e99ace3a7b359a9c6d4e520002 Mon Sep 17 00:00:00 2001 From: Dietrich Rink Date: Sat, 10 Jun 2023 14:34:28 +0200 Subject: [PATCH] add abbreviations for "help" prefixes --- core/nvim/init.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/nvim/init.lua b/core/nvim/init.lua index 7fe7229..a9c117c 100644 --- a/core/nvim/init.lua +++ b/core/nvim/init.lua @@ -60,10 +60,13 @@ vim.api.nvim_create_user_command('Help', function(a) if vim.fn.bufnr('%') ~= buf then vim.cmd.bwipeout(buf) end end, { nargs = '?', bar = true, complete = 'help' }) --- Add command line abbreviation if at start of line -vim.cmd.cabbrev { 'help', - '=(getcmdtype() == ":" && getcmdpos() == 1) ? "Help" : "help"' -} +-- Add command line abbreviations if at start of line +for i, word in ipairs { 'h', 'he', 'hel', 'help' } do + vim.cmd.cabbrev { word, string.format( + '=(getcmdtype() == ":" && getcmdpos() == 1) ? "Help" : "%s"', + word + )} +end -- Source init directory vim.cmd 'runtime! init/*.lua'