Suppose my cursor is within the word word
. Using vim-surround, typing the sequence ysiw*
will replace word
with *word*
.
Question: Is there a single sequence I can type to instead produce **word**
(i.e., the common markdown method for word bolding)? This opposed to typing ysiw*
twice, which feels cumbersome.
@Dan Lowe's answer about using repeat.vim and .
is spot on. However you can also create custom surrounding to make common actions a bit quicker.
Add the following to your ~/.vim/after/ftplugin/markdown.vim
file:
let b:surround_{char2nr('b')} = "**\r**"
Now you can do ysiwb
to surround with double *
's (b
for bold).
For more help customizing surroundings see :h surround-customizing
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With