Dear all,

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

Maxim Abalenkov \\ [email protected]
+44 7 486 486 505 \\ http://mabalenk.gitlab.io

> On 26 Aug 2021, at 13:46, Maxim Abalenkov <[email protected]> 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)) 
> <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,
> Maxim
> 
> Maxim Abalenkov \\ [email protected] 
> <mailto:[email protected]>
> +44 7 486 486 505 \\ http://mabalenk.gitlab.io <http://mabalenk.gitlab.io/>
> 
>> On 26 Aug 2021, at 13:17, Maxim Abalenkov <[email protected] 
>> <mailto:[email protected]>> 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
>> 
>> Maxim Abalenkov \\ [email protected] 
>> <mailto:[email protected]>
>> +44 7 486 486 505 \\ http://mabalenk.gitlab.io <http://mabalenk.gitlab.io/>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/EC18895A-9B88-4863-B2B6-7304BF74C29E%40gmail.com.

Reply via email to