{"id":244,"date":"2010-07-12T19:03:20","date_gmt":"2010-07-12T19:03:20","guid":{"rendered":"http:\/\/poojanwagh.opalstacked.com\/techblog\/?p=244"},"modified":"2010-07-12T19:03:20","modified_gmt":"2010-07-12T19:03:20","slug":"getting-vim-to-match-beginend","status":"publish","type":"post","link":"https:\/\/tech.poojanblog.com\/blog\/un\/getting-vim-to-match-beginend\/","title":{"rendered":"Getting vim to match begin\/end"},"content":{"rendered":"<p>The default vim has a <a title=\"vimdoc: matchpairs\" href=\"http:\/\/vimdoc.sourceforge.net\/htmldoc\/options.html#%27matchpairs%27\">matchpairs<\/a> option which matches pairs of single bytes.<\/p>\n<p>However, I have a file which has a lot of nested conditions, and the language requires begin\/end pairs for multi-line conditionals. I know I have more begin statements than end statements. So, I need help from vim in matching these up.<\/p>\n<p>As it turns out, there&#8217;s a matchit macro in $VIMRUNTIME\/macros that lets you extend the % command to match more complex expressions (including regular expressions). It also exists <a title=\"matchit.zip at vim.org\" href=\"http:\/\/www.vim.org\/scripts\/script.php?script_id=39\">here<\/a>. Install instructions are included on the vim.org page. Basically, you unzip in your ~\/.vim directory and then and run a helptags command.<\/p>\n<pre>\r\n<\/pre>\n<\/p>\n<div class='wp_likes' id='wp_likes_post-244'><a class='like' href=\"javascript:wp_likes.like(244);\" title='' ><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/tech.poojanblog.com\/blog\/wp-content\/plugins\/wp-likes\/images\/like.png\" alt='' border='0'\/><\/a><span class='text'>Be the first to like.<\/span><\/p>\n<div class='like' ><a href=\"javascript:wp_likes.like(244);\">Like<\/a><\/div>\n<div class='unlike' ><a href=\"javascript:wp_likes.unlike(244);\">Unlike<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The default vim has a matchpairs option which matches pairs of single bytes. However, I have a file which has a lot of nested conditions, and the language requires begin\/end pairs for multi-line conditionals. I know I have more begin statements than end statements. So, I need help from vim in matching these up. As [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-244","post","type-post","status-publish","format-standard","hentry","category-un"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/comments?post=244"}],"version-history":[{"count":1,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/244\/revisions"}],"predecessor-version":[{"id":245,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/244\/revisions\/245"}],"wp:attachment":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/media?parent=244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/categories?post=244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/tags?post=244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}