Search code examples
vimmarkdown

Command for putting backticks around the current word


I have to format a lot of files in markdown manually, and I often have to wrap some isolated words in backticks to get them in a code span, i.e.: object.method to `object.method`

I'm using Vim and I was wondering how I could write and map to some key a command which would put backticks around the word under cursor, by just pressing F1 for instance?


Solution

  • The canonical answer is to use surround plugin by Tim Pope that allows to surround easily a selection.(Unless you don't want to install any plugin)