{"id":355,"date":"2011-03-16T11:20:35","date_gmt":"2011-03-16T17:20:35","guid":{"rendered":"http:\/\/www.cavanaugh.pro\/sean\/?p=355"},"modified":"2011-03-16T11:22:35","modified_gmt":"2011-03-16T17:22:35","slug":"how-to-add-line-numbers-to-vi-by-default","status":"publish","type":"post","link":"https:\/\/www.cavanaugh.pro\/sean\/how-to-add-line-numbers-to-vi-by-default\/","title":{"rendered":"How to add line numbers to VI by default"},"content":{"rendered":"<p>I am running on Snow\u00a0Leopard\u00a010.6.6. at the time of this post. \u00a0VI is a handy tool to use because it is installed on every single non-windows box I have ever seen. \u00a0I originally only used nano and I have found out that nano is not everywhere.<\/p>\n<p>1) you need to locate your .vimrc file, on osx I just did a locate vimrc and got this<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nbash-3.2# locate vimrc\r\n\/opt\/local\/var\/macports\/sources\/rsync.macports.org\/release\/ports\/editors\/vim-app\/files\/gvimrc\r\n\/opt\/local\/var\/macports\/sources\/rsync.macports.org\/release\/ports\/editors\/vim-app\/files\/vimrc\r\n\/usr\/share\/vim\/vim72\/gvimrc_example.vim\r\n\/usr\/share\/vim\/vim72\/vimrc_example.vim\r\n\/usr\/share\/vim\/vimrc\r\n<\/pre>\n<p>2) now just vi open that file<\/p>\n<p>I did a vi \/usr\/share\/vim\/vimrc and then added the line set number to the end here is how my file looks-><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&quot; Configuration file for vim \r\nset modelines=0         &quot; CVE-2007-2438\r\n\r\n&quot; Normally we use vim-extensions. If you want true vi-compatibility\r\n&quot; remove change the following statements\r\nset nocompatible        &quot; Use Vim defaults instead of 100% vi compatibility\r\nset backspace=2         &quot; more powerful backspacing\r\n\r\n&quot; Don't write backup file if vim is being called by &quot;crontab -e&quot; \r\nau BufWrite \/private\/tmp\/crontab.* set nowritebackup\r\n&quot; Don't write backup file if vim is being called by &quot;chpass&quot;\r\nau BufWrite \/private\/etc\/pw.* set nowritebackup\r\n\r\nset number\r\n<\/pre>\n<p>3) now quit and save, everytime you open vi it will show line numbers, to turn them off you can do a :set nonumber<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am running on Snow\u00a0Leopard\u00a010.6.6. at the time of this post. \u00a0VI is a handy tool to use because it is installed on every single non-windows box I have ever seen. \u00a0I originally only used nano and I have found out that nano is not everywhere. 1) you need to locate your .vimrc file, on &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.cavanaugh.pro\/sean\/how-to-add-line-numbers-to-vi-by-default\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to add line numbers to VI by default&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-355","post","type-post","status-publish","format-standard","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/posts\/355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/comments?post=355"}],"version-history":[{"count":4,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/posts\/355\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/posts\/355\/revisions\/362"}],"wp:attachment":[{"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/media?parent=355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/categories?post=355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cavanaugh.pro\/sean\/wp-json\/wp\/v2\/tags?post=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}