{"id":19,"date":"2009-12-31T16:50:40","date_gmt":"2009-12-31T13:50:40","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=19"},"modified":"2009-12-31T17:05:17","modified_gmt":"2009-12-31T14:05:17","slug":"fixing-vim-to-allow-smart-match-finding-using-the-percent-key","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=19","title":{"rendered":"Fixing VIM to allow smart match finding using the percent key"},"content":{"rendered":"<p>Edited the file<\/p>\n<p><strong>\/usr\/share\/vim\/vim70\/syntax\/smarty.vim<\/strong><\/p>\n<p>Added the following code:<\/p>\n<blockquote>\n<pre><strong><em>\" HTML:\u00a0 thanks to Johannes Zellner and Benji Fisher.<\/em><\/strong><strong><em>\r\nif exists(\"loaded_matchit\")<\/em><\/strong><strong><em>\r\nlet b:match_ignorecase = 1<\/em><\/strong><strong><em>\r\nlet b:match_skip = 's:Comment'<\/em><\/strong><strong><em>\r\nlet b:match_words = '<:>,' .<\/em><\/strong><strong><em>\r\n\\ '<\\@<=[ou]l\\>[^>]*\\%(>\\|$\\):<\\@<=li\\>:<\\@<=\/[ou]l>,' .<\/em><\/strong><strong><em>\r\n\\ '<\\@<=dl\\>[^>]*\\%(>\\|$\\):<\\@<=d[td]\\>:<\\@<=\/dl>,' .<\/em><\/strong><strong><em>\r\n\\ '<\\@<=\\([^\/][^ \\t>]*\\)[^>]*\\%(>\\|$\\):<\\@<=\/\\1>'<\/em><\/strong><strong><em>\r\nendif<\/em><\/strong><\/pre>\n<\/blockquote>\n<p>This sets the HTML tag matching words for the matchit plug in when the filetype of Smarty is identified.<\/p>\n<p>Then I edited the <strong>\/etc\/vimrc<\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p>Adding these lines to the bottom:<\/p>\n<p><strong> <\/strong><\/p>\n<blockquote>\n<pre><strong><em>\" CODE added to universally turn on the matchit plugin.\r\n\" added K. Meek 9\/09\r\n:source \/usr\/share\/vim\/vim70\/macros\/matchit.vim\r\n:filetype plugin on<\/em><\/strong><\/pre>\n<\/blockquote>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong>Now when you are editing a .tpl file the syntax is \u201cSMARTY\u201d for color coding, but the match words will match HTML tags <\/strong><\/p>\n<p><strong><br \/>\nSo you can position your cursor over say a <tr> tag and hit the % key and it will move cursor to the matching <\/tr> tag.\u00a0 Same with <div> will find matching <\/div><\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> VERY COOL!<\/strong><\/p>\n<p><strong>You may need the matchit.vim plugin.\u00a0 You can download it here.<\/strong><\/p>\n<p><a href=\"http:\/\/www.vim.org\/scripts\/script.php?script_id=39\" target=\"_blank\">http:\/\/www.vim.org\/scripts\/script.php?script_id=39<\/a><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Edited the file \/usr\/share\/vim\/vim70\/syntax\/smarty.vim Added the following code: &#8221; HTML:\u00a0 thanks to Johannes Zellner and Benji Fisher. if exists(&#8220;loaded_matchit&#8221;) let b:match_ignorecase = 1 let b:match_skip = &#8216;s:Comment&#8217; let b:match_words = &#8216;,&#8217; . \\ &#8216;]*\\%(>\\|$\\):\\|$\\):\\|$\\):<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":5,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}