I often edit essays in Vim, and I would like to write a macro to insert <p> tags at the beginning and ends of paragraphs (defined as any chunk of text separated from other chunks of text by two or more line breaks). How can I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s one option:
I would recommend looking into markdown and pandoc if you do a lot of plain text essay writing. Also, the surround.vim plugin by Tim Pope allows for this kind of tag surrounding. For instance, I can do
ysiptp<CR>with the surround.vim plugin to surround a paragraph with<p>tags.