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!
—
Best wishes,
Maxim
On 26 Aug 2021, at 13:46, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,I found out that this functionality is called "mapping". I followed this tutorial (https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)) to create a basic map in the insert mode::map ,h {% highlight perl %}{% endhighlight %}What I would like to do, is to place a newline in between the curly braces symbols "}{" and have my cursor there, such that I can start typing the source code directly. Finally, I'm sure the ",h" key combination is not the best. Would you be able to recommend me some best practices on choosing a good key combination? Thank you and have a good day ahead!—Best wishes,MaximOn 26 Aug 2021, at 13:17, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,How are you? I hope all is well with you. I have a rather basic question. Recently I find myself typing a lot of text in markdown. Frequently I need to input highlighted Perl or bash source code into my markdown. To do that I use the{% highlight perl %}{% endhighlight %}macro. I'm certain it would be possible to create a "key shortcut" in Vim, such that when I press a certain key combination, Vim would automatically insert the above macro. Would you please direct me: how is this functionality called in Vim and where can I read more about it and see some basic examples? Thank you and have a good day ahead!—Best wishes,Maxim
No comments:
Post a Comment