<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" 
  xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  xmlns:dc="http://purl.org/dc/elements/1.1/" 
  xmlns:atom="http://www.w3.org/2005/Atom" 
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
  xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>vi on Ben&#39;s ideas and projects</title>
    <link>https://ben.the-collective.net/tags/vi/</link>
    <description>Recent content in vi on Ben&#39;s ideas and projects</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>locutus@the-collective.net (Ben Mason)</managingEditor>
    <webMaster>locutus@the-collective.net (Ben Mason)</webMaster>
    <copyright>©2022, All Rights Reserved</copyright>
    <lastBuildDate>Sun, 08 Jul 2018 12:06:18 -0400</lastBuildDate>
    <sy:updatePeriod>daily</sy:updatePeriod>
    
        <atom:link href="https://ben.the-collective.net/tags/vi/index.xml" rel="self" type="application/rss+xml" />
    

      
      <item>
        <title>VI Notes</title>
        <link>https://ben.the-collective.net/my-notes/vi-notes/</link>
        <pubDate>Sun, 08 Jul 2018 12:06:18 -0400</pubDate>
        <author>locutus@the-collective.net (Ben Mason)</author>
        <atom:modified>Sun, 08 Jul 2018 12:06:18 -0400</atom:modified>
        <guid>https://ben.the-collective.net/my-notes/vi-notes/</guid>
        <description>vi notes Searching and Replacing in vi
Edit Modes i – activates text insert mode, inserting text immediately under the current position of the cursor R – Replace / Overwrite a – append text, after the cursor A – append text, after end of line I – insert text, before first non-whitespace character o – open new line below cursor in Insert Mode O – open new line above cursor in Insert Mode Movement l – moves the cursor one character to the right h – moves the cursor one character to the left (2h moves the cursor two characters to the left) j – moves the cursor one line down (3j moves the cursor three lines down) k – moves the cursor one line up G – moves the cursor to the last line of text if not preceded by a modifying integer nG – moves the cursor to the desired line (5G moves the cursor to the fifth line) w – moves to next word $ – end of line 0 – begining of line % – Navigate to matching brace or parenthis &amp;gt;% – indent between selected braces &amp;gt;&amp;gt; – indent line Deletion x – deletes the character immediately under the cursor X – deletes a single character to the left of cursor D – removes the text on the current line from the character under the cursor to the end of the line dw – deletes the character immediately under the cursor and the remaining characters to the right of it in the same word dd – deletes the entire line containing the cursor, and the cursor then moves to the next line cw – deletes the character under the cursor and to its right in the same word and allows new characters to be typed in to replace them cc – erases the current line and allows replacement text to be typed in cb – deletes the characters to the left of the cursor in the current word and allows replacement characters to be typed in Search /string – search ?</description>
        <content:encoded>&lt;h1 id=&#34;vi-notes&#34;&gt;vi notes&lt;/h1&gt;
&lt;p&gt;&lt;a href=&#34;http://www.linfo.org/vi/search.html&#34;&gt;Searching and Replacing in vi&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;edit-modes&#34;&gt;Edit Modes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;i&lt;/code&gt; – activates text insert mode, inserting text immediately under the current position of the cursor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;R&lt;/code&gt; – Replace / Overwrite&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a&lt;/code&gt; – append text, after the cursor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;A&lt;/code&gt; – append text, after end of line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;I&lt;/code&gt; – insert text, before first non-whitespace character&lt;/li&gt;
&lt;li&gt;&lt;code&gt;o&lt;/code&gt; – open new line below cursor in Insert Mode&lt;/li&gt;
&lt;li&gt;&lt;code&gt;O&lt;/code&gt; – open new line above cursor in Insert Mode&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;movement&#34;&gt;Movement&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;l&lt;/code&gt; – moves the cursor one character to the right&lt;/li&gt;
&lt;li&gt;&lt;code&gt;h&lt;/code&gt; – moves the cursor one character to the left (&lt;code&gt;2h&lt;/code&gt; moves the cursor two characters to the left)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;j&lt;/code&gt; – moves the cursor one line down (&lt;code&gt;3j&lt;/code&gt; moves the cursor three lines down)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k&lt;/code&gt; – moves the cursor one line up&lt;/li&gt;
&lt;li&gt;&lt;code&gt;G&lt;/code&gt; – moves the cursor to the last line of text if not preceded by a modifying integer&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nG&lt;/code&gt; – moves the cursor to the desired line (&lt;code&gt;5G&lt;/code&gt; moves the cursor to the fifth line)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;w&lt;/code&gt; – moves to next word&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$&lt;/code&gt; – end of line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt; – begining of line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;%&lt;/code&gt; – Navigate to matching brace or parenthis&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;gt;%&lt;/code&gt; – indent between selected braces&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; – indent line&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;deletion&#34;&gt;Deletion&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;x&lt;/code&gt; – deletes the character immediately under the cursor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;X&lt;/code&gt; – deletes a single character to the left of cursor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;D&lt;/code&gt; – removes the text on the current line from the character under the cursor to the end of the line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dw&lt;/code&gt; – deletes the character immediately under the cursor and the remaining characters to the right of it in the same word&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dd&lt;/code&gt; – deletes the entire line containing the cursor, and the cursor then moves to the next line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cw&lt;/code&gt; – deletes the character under the cursor and to its right in the same word and allows new characters to be typed in to replace them&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cc&lt;/code&gt; – erases the current line and allows replacement text to be typed in&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cb&lt;/code&gt; – deletes the characters to the left of the cursor in the current word and allows replacement characters to be typed in&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;search&#34;&gt;Search&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/string&lt;/code&gt; – search&lt;/li&gt;
&lt;li&gt;&lt;code&gt;?&lt;/code&gt; – Search backwards&lt;/li&gt;
&lt;li&gt;&lt;code&gt;n&lt;/code&gt; – Next forward results&lt;/li&gt;
&lt;li&gt;&lt;code&gt;N&lt;/code&gt; – Previous backwards result&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:%s/pattern/replace/g&lt;/code&gt; – Global Search and replace&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;sort&#34;&gt;Sort&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;http://vim.wikia.com/wiki/Sort_lines&#34;&gt;Sort lines | Vim Tips Wiki | FANDOM powered by Wikia&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:%sort!&lt;/code&gt; – Sort in reverse&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:%sort u&lt;/code&gt; – Sort, removing duplicate lines&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:%!sort -M&lt;/code&gt; – Sort using the external Unix sort utility, respecting month-name order (&amp;ldquo;respecting month-name order&amp;rdquo; means January &amp;lt; February &amp;lt; … &amp;lt; December)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:sort n&lt;/code&gt; – Numeric sort (this way, 100 doesn’t precede 20 in the sort)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:g/start/+1,/end/-1 sort n&lt;/code&gt; – Sort subsections independently, in this example sort numbers between &amp;ldquo;start&amp;rdquo; and &amp;ldquo;end&amp;rdquo; markers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:296,349sort&lt;/code&gt; Sort only specific lines using ranges (sort lines 296 to 349, inclusive)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;make&#34;&gt;make&lt;/h2&gt;
&lt;p&gt;Using makefiles can save time when compiling lots of source files into one program. vim can run the makefile without leaving the editing session:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:map &amp;lt;f9&amp;gt; :make&lt;/code&gt; – map the F9 key to run make&lt;br /&gt;
&lt;code&gt;:set makeprg&lt;/code&gt; – change what :make does&lt;/p&gt;
&lt;p&gt;:make will compile if you are using a Makefile. Use these to examine the compile errors:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:copen&lt;/code&gt; – open a mini-window with make output, hit enter on an error to jump to line&lt;br /&gt;
&lt;code&gt;:cclose&lt;/code&gt; – closes the mini-window&lt;br /&gt;
&lt;code&gt;:cw&lt;/code&gt; – toggles the mini-window (if errors exist)&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;syntax&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;:set syntax=....&lt;/code&gt; – set value&lt;br /&gt;
&lt;code&gt;:set option&lt;/code&gt; – set a bool option&lt;br /&gt;
&lt;code&gt;:set nooption&lt;/code&gt; – disable option&lt;br /&gt;
can add &lt;code&gt;!&lt;/code&gt; to the end of a option it toggle&lt;/p&gt;
&lt;h2 id=&#34;line-numbers&#34;&gt;line numbers&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;:set nonumber&lt;/code&gt; – disable line numbers&lt;br /&gt;
&lt;code&gt;:set number&lt;/code&gt; – enable line numbers&lt;/p&gt;
&lt;h2 id=&#34;paste-mode&#34;&gt;paste mode&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;do not auto endent when pasting&lt;br /&gt;
&lt;code&gt;:set paste&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;:set nopaste&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;invisable-characters&#34;&gt;invisable characters&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;:set list&lt;/code&gt; – show invisable characters&lt;br /&gt;
&lt;code&gt;:set nolist&lt;/code&gt; – disable show invisable chars&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:set listchars+=space:␣&lt;/code&gt; – Show white space when &lt;code&gt;list&lt;/code&gt; enabled&lt;br /&gt;
&lt;code&gt;:set listchars=eol:¬,tab:&amp;gt;·,trail:~,extends:&amp;gt;,precedes:&amp;lt;,space:␣&lt;/code&gt; – set other chars in &lt;code&gt;list&lt;/code&gt; view&lt;/p&gt;
&lt;h2 id=&#34;file-management&#34;&gt;file management&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:enew&lt;/code&gt; – Create new blank file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:q&lt;/code&gt; – closes (quits) a file to which no changes have been made&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:q!&lt;/code&gt; – quits without saving any changes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:w&lt;/code&gt; – writes (i.e., saves) the current file to disk&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:wq&lt;/code&gt; – writes the buffer contents to disk (i.e., saves changes) and quits&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:r&lt;/code&gt; – inserts text into the currently open file from another file (&lt;code&gt;:r lettuce.txt&lt;/code&gt; inserts text into the currently open file from the file named &amp;ldquo;lettuce.txt&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:w&amp;gt;&amp;gt;&lt;/code&gt; – appends the text from the currently open file into another file (&lt;code&gt;:w&amp;gt;&amp;gt;&lt;/code&gt; cabbage appends the text from the currently open file into the file named &amp;ldquo;cabbage&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ZZ&lt;/code&gt; – same as :wq&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;others&#34;&gt;others&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://hea-www.harvard.edu/~fine/Tech/vi.html&#34;&gt;vi Complete Key Binding List&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#34;https://www.cs.oberlin.edu/~kuperman/help/vim/indenting.html&#34;&gt;vim tips and tricks: indenting&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#34;http://www.linfo.org/vi/summary.html&#34;&gt;Summary of Commands in vi&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ctl-w w&lt;/code&gt; – switch between split pains&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctl-n&lt;/code&gt; – complete text&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.&lt;/code&gt; – repeat last command
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;xp&lt;/code&gt; – transposes two adjacent characters&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;deep&lt;/code&gt; – transposes two adjacent words&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ddp&lt;/code&gt; transposes two adjacent lines&lt;/li&gt;
&lt;li&gt;&lt;code&gt;~&lt;/code&gt; – changes case of the character under the cursor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;J&lt;/code&gt; – joins the current line with the next line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;u&lt;/code&gt; – undo reverses the effects of the most recent command that has changed the buffer&lt;/li&gt;
&lt;li&gt;&lt;code&gt;U&lt;/code&gt; – undoes all changes made to the current line during the current visit to it&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ggVGu&lt;/code&gt; change whole file to lower case
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gg&lt;/code&gt; – goes to first line of text&lt;/li&gt;
&lt;li&gt;&lt;code&gt;V&lt;/code&gt; – turns on Visual selection, in line mode&lt;/li&gt;
&lt;li&gt;&lt;code&gt;G&lt;/code&gt; – goes to end of file (at the moment you have whole text selected)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;u&lt;/code&gt; – lowercase selected area&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;plugins&#34;&gt;Plugins&lt;/h2&gt;
&lt;h3 id=&#34;drawit&#34;&gt;DrawIt&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;ASCII diagraming&lt;br /&gt;
&lt;a href=&#34;https://www.vim.org/scripts/script.php?script_id=40&#34;&gt;https://www.vim.org/scripts/script.php?script_id=40&lt;/a&gt;```&lt;br /&gt;
wget -O DrawIt.vba.gz &lt;a href=&#34;http://www.vim.org/scripts/download_script.php?src_id=8798&#34;&gt;http://www.vim.org/scripts/download_script.php?src_id=8798&lt;/a&gt;&lt;br /&gt;
vim DrawIt.vba.gz&lt;br /&gt;
:so %&lt;br /&gt;
:q
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\di&lt;/code&gt; will turn on the Drawit! plugin&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\ds&lt;/code&gt; will turn off the Drawit! plugin&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
        <dc:creator>Ben Mason</dc:creator>
        
        
        
        
          
            
              <category>vi</category>
            
          
            
              <category>notes</category>
            
          
        
        
        
      </item>
      

    
  </channel>
</rss>
