{"id":1185,"date":"2013-01-31T10:04:44","date_gmt":"2013-01-31T09:04:44","guid":{"rendered":"http:\/\/www.stenyak.com\/?p=1185"},"modified":"2013-01-31T10:04:44","modified_gmt":"2013-01-31T09:04:44","slug":"helpful-vim-highlighting","status":"publish","type":"post","link":"https:\/\/www.stenyak.com\/?p=1185","title":{"rendered":"Helpful VIM highlighting"},"content":{"rendered":"<p>Here&#8217;s a quick snippet that you can add to your <strong>.vimrc<\/strong> in order to get:<\/p>\n<ul>\n<li>MS Visual Studio-like &#8216;<em>current word<\/em>&#8216; highlighting.<\/li>\n<li>Trailing space highlighting.<\/li>\n<\/ul>\n<p>The result looks like this:<\/p>\n<p><a href=\"http:\/\/www.stenyak.com\/wp-content\/uploads\/2013\/01\/vim_hl.gif\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1186\" alt=\"vim_hl\" src=\"http:\/\/www.stenyak.com\/wp-content\/uploads\/2013\/01\/vim_hl.gif\" width=\"560\" height=\"575\" \/><\/a><\/p>\n<p>And the code is:<\/p>\n<pre lang=\"bash\" line=\"1\">function Matches()\n    highlight curword ctermbg=white ctermfg=black cterm=bold gui=bold guibg=darkgrey\n    try\n        call matchdelete(w:lastmatch)\n        unlet w:lastmatch\n    catch\n    endtry\n    silent! let w:lastmatch=matchadd ('curword', printf('\\V\\&lt;%s\\&gt;', escape(expand(''), '\/\\')), -1)\n    highlight eolspace ctermbg=red guibg=red\n    2match eolspace \/\\s\\+$\/\nendfunction\nau CursorMoved * exe 'call Matches()'<\/pre>\n<p>Yes, one day I might convert it to a vim plugin, meanwhile just copy-paste to your <strong>.vimrc<\/strong>.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a quick snippet that you can add to your .vimrc in order to get: MS Visual Studio-like &#8216;current word&#8216; highlighting. Trailing space highlighting. The result looks like this: And the code is: function Matches() highlight curword ctermbg=white ctermfg=black cterm=bold gui=bold guibg=darkgrey try call matchdelete(w:lastmatch) unlet w:lastmatch catch endtry silent! let w:lastmatch=matchadd (&#8216;curword&#8217;, printf(&#8216;\\V\\&lt;%s\\&gt;&#8217;, escape(expand(&#8221;), [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[13],"_links":{"self":[{"href":"https:\/\/www.stenyak.com\/index.php?rest_route=\/wp\/v2\/posts\/1185"}],"collection":[{"href":"https:\/\/www.stenyak.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stenyak.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stenyak.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stenyak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1185"}],"version-history":[{"count":0,"href":"https:\/\/www.stenyak.com\/index.php?rest_route=\/wp\/v2\/posts\/1185\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.stenyak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stenyak.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stenyak.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}