<?xml version="1.0" encoding="UTF-8"?>
<article>
  <body>&lt;p&gt;If you have ssh access enabled on your web hosting server (ask &lt;a href=&quot;/support&quot;&gt;support&lt;/a&gt; if you want it turned on), you can use the vi editor to make quick changes to files.&lt;/p&gt;

&lt;p&gt;For example, if you get a PHP error that says something like &quot;error on line 42&quot;, you can use vi to go directly to that line. &lt;/p&gt;

&lt;p&gt;To make vi start at a that line in a file, add +linenumber to the command you use to start vi. Replace linenumber with the actual line number, for example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vi +42 index.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you're already opened up the file in vi, use the goto command. To use goto, press Esc, type the line number, and then press Shift-g . If you press Esc and then Shift-g without entering a line number, it will take you to the last line in the file.&lt;/p&gt;

&lt;p&gt;The ex command line can be used to go to a line. For example, if you wanted to go to line 108, you could press Esc and then enter:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;  :108 &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To search forward for some text, use the  /  (forward slash) command. Press Esc and then enter /pattern , replacing pattern with the text for which you want to search forward. For example, to find every instance of the word &quot;namaste&quot;, enter:&lt;/p&gt;
  &lt;p&gt;/namaste&lt;/p&gt;
&lt;p&gt;To look for the next occurrence after the first, either press  n  or press  /  again and then press Enter. To go back to a previous occurrence, press Shift-n . To search backwards in a file, use the  ?  command. &lt;/p&gt;

&lt;p&gt;To see what line you're on at any time, press Ctrl-Shift-g . To number all lines, press Esc and enter:&lt;/p&gt;
  &lt;p&gt;:set number&lt;/p&gt;
 &lt;p&gt; &lt;/p&gt;
&lt;p&gt;To go to the end of a file use, G (capital G)&lt;/p&gt;

&lt;p&gt;To delete to the end of a line, use D (capital D)&lt;/p&gt;

&lt;p&gt;To delete a whole line, use dd (two d)&lt;/p&gt;

&lt;p&gt;To repeat the last command, use . (period)&lt;/p&gt;</body>
  <cached-tag-list>vi, command line</cached-tag-list>
  <category-id type="integer">2</category-id>
  <comments-enabled type="boolean">true</comments-enabled>
  <created-at type="datetime">2009-06-19T19:35:28Z</created-at>
  <id type="integer">86</id>
  <permalink>cool-vi-tips</permalink>
  <published type="boolean">true</published>
  <published-at type="datetime">2009-06-19T19:35:28Z</published-at>
  <synopsis>vi is a venerable text editor that is great for making quick fixes to files when you are in the command line on the server. </synopsis>
  <title>Cool vi Tips</title>
  <updated-at type="datetime">2009-06-19T19:35:28Z</updated-at>
  <user-id type="integer">1</user-id>
</article>
