Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using vim-surround for markdown

Is it possible to use vim plugin vim-surround to wrap markdown?

For example I have code I would like to wrap

# ruby code here

with

```Ruby
# ruby code here
```
like image 722
zhon Avatar asked Sep 02 '25 10:09

zhon


1 Answers

Add the following to your ~/.vim/after/ftplugin/markdown.vim file:

let b:surround_{char2nr('r')} = "```Ruby\r```"

Select your lines of code via V then surround via Sr.

like image 161
Peter Rincker Avatar answered Sep 05 '25 04:09

Peter Rincker