On Thu, Aug 26, 2021 at 04:08:49PM +0300, Maxim Abalenkov wrote:
>After further investigation I came up with the following solution:
>
>:imap <C-h> {% highlight perl %}<Enter><Enter>{% endhighlight %}<Up>
>
>Please correct me, if there are any obvious mistakes. Thank you!
Just one: you should use inoremap instead of imap. inoremap will prevent the expansion of further maps taking place on the right-hand side. For example, if you had mapped "e" to "X" (":inoremap e X"), you'd have ended up with
{% highlight pXrl %}
{% Xndhighlight %}
Also, bear in mind that in terminal vim, <c-h> is the same as control-backspace, so either one of those keystrokes would trigger your mapping.