{"id":292,"date":"2007-11-08T22:54:56","date_gmt":"2007-11-09T03:54:56","guid":{"rendered":"http:\/\/blogs.n1zyy.com\/n1zyy\/2007\/11\/08\/vim-tricks\/"},"modified":"2007-11-08T22:54:56","modified_gmt":"2007-11-09T03:54:56","slug":"vim-tricks","status":"publish","type":"post","link":"https:\/\/blogs.n1zyy.com\/n1zyy\/2007\/11\/08\/vim-tricks\/","title":{"rendered":"vim tricks"},"content":{"rendered":"<p>If you&#8217;re cool like me, you spend a decent amount of time in vi editing files. Despite all the fancy IDEs and the like, nothing beats uploading your PHP script to the webserver and editing in place.  I don&#8217;t profess to be a vi expert. I&#8217;m far from it, in fact. But for those that are like me&#8211;comfortable working in it but far from being a master&#8211;here are a few tips:<\/p>\n<ul>\n    <li>Typing &#8220;G&#8221; (in command mode, but <em>not<\/em> as a : command!) takes you to the last line of the file.<\/li>\n    <li>m<em>a<\/em>, where <em>a<\/em> is a letter <em>a-z<\/em>, sets <em>a<\/em> as a &#8216;mark&#8217;. You can then issue commands reflecting that mark. For example, I wanted to delete about 500 lines from a file. But I didn&#8217;t know how many lines there were, so &#8220;500dd&#8221; wasn&#8217;t a viable option. In my case, I marked the last line I wanted to delete with <em>a<\/em>, went up to the first line I wanted to delete, and then typed d&#8217;a to delete from the current line to mark <em>a<\/em>. Note that, as you&#8217;re doing this, there&#8217;s <em>no<\/em> indication of it.<\/li>\n    <li>. (a single period) runs the last command again. Handy way more often than I&#8217;d expect!<\/li>\n    <li>:wq is probably the most well-known command. But ZZ (not :ZZ) is easier and does the same thing!<\/li>\n<\/ul>\n<p><a href=\"http:\/\/sparky.rice.edu\/~hartigan\/vi.html\">This<\/a> is a handy reference, by the way. So isn&#8217;t the O&#8217;Reilly book, but you can&#8217;t Google your way through that.<\/p>","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re cool like me, you spend a decent amount of time in vi editing files. Despite all the fancy IDEs and the like, nothing beats uploading your PHP script to the webserver and editing in place. I don&#8217;t profess &hellip; <a href=\"https:\/\/blogs.n1zyy.com\/n1zyy\/2007\/11\/08\/vim-tricks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13,14,22],"tags":[],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-computers","category-linux-tips","category-lists","category-programming"],"_links":{"self":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":0,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}