How to Surround Text With an HTML Element With Vim
If you're working with VS Code and the VsCode Vim extension, you can use Vim commands to quickly wrap a line of text in an HTML element. Here's how to do it:
Enter visual mode by pressing the
- Highlight the text you want to wrap.
Enter the HTML element you want to wrap the selected text with, like this for
This will wrap the selected text in the specified HTML element. For example, if you had the following line of text:
And you wanted to wrap it in a div, you would highlight the text and press S
<div> to get:
Thanks for reading. If you enjoyed this post, I invite you to explore more of my site. I write about web development, programming, and other fun stuff.