 
    
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vim Archives - Complete, Concrete, Concise</title>
	<atom:link href="https://complete-concrete-concise.com/category/vim/feed/" rel="self" type="application/rss+xml" />
	<link>https://complete-concrete-concise.com/category/vim/</link>
	<description>Practical Information Without The Bloat</description>
	<lastBuildDate>Mon, 22 Jan 2018 11:59:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>How to Exit Vim</title>
		<link>https://complete-concrete-concise.com/vim/how-to-exit-vim/</link>
		
		<dc:creator><![CDATA[richardsplanet]]></dc:creator>
		<pubDate>Mon, 22 Jan 2018 11:59:27 +0000</pubDate>
				<category><![CDATA[Vim]]></category>
		<category><![CDATA[exit]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[quit]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[understanding]]></category>
		<category><![CDATA[vim]]></category>
		<guid isPermaLink="false">http://www.complete-concrete-concise.com/?p=3362</guid>

					<description><![CDATA[<p>Simple help on exiting Vim.</p>
<p>The post <a href="https://complete-concrete-concise.com/vim/how-to-exit-vim/">How to Exit Vim</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="preamble">
<p>While Vim has a steep learning curve, you can <a href="//complete-concrete-concise.com/writing/5-minute-vim-tutorial">learn enough Vim in 5 minutes</a> to not be completely lost when you use it.</p>
</div>
<p>To exit Vim you need to be in <span class="mark">Normal Mode</span>.</p>
<p>To get to <span class="mark">Normal Mode</span> press the <span class="kbd">Escape</span> key twice. Your computer may beep at you, but that is OK.</p>
<p>Type <span class="kbd">:q!</span> followed by the <span class="kbd">Enter</span> key to <strong>quit without saving</strong>.</p>
<p>Type <span class="kbd">:x!</span> followed by the <span class="kbd">Enter</span> key to <strong>save changes and exit</strong>.</p>
<div class="hint">
<p>If you see <strong>recording</strong> in the lower left corner of the screen, press <span class="kbd">q</span> to exit recording mode, then proceed as described above.</p>
<pre class="vim"><code>
  &lt;body&gt;
    &lt;!-- page content goes here --&gt;
    &lt;p&gt;This is some dummy content.&lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;
~
~
~
recording @q                            1,1           All</code></pre>
<p>&nbsp;
</p></div>
<p>The post <a href="https://complete-concrete-concise.com/vim/how-to-exit-vim/">How to Exit Vim</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>5 Minute Vim Tutorial</title>
		<link>https://complete-concrete-concise.com/blog/5-minute-vim-tutorial/</link>
		
		<dc:creator><![CDATA[richardsplanet]]></dc:creator>
		<pubDate>Wed, 26 Oct 2016 18:11:54 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[understanding]]></category>
		<category><![CDATA[vim]]></category>
		<guid isPermaLink="false">http://www.complete-concrete-concise.com/?p=3186</guid>

					<description><![CDATA[<p>This tutorial won't turn you into a Vim wizard, but at least you will be able to open, navigate, edit, and save files using Vim.</p>
<p>The post <a href="https://complete-concrete-concise.com/blog/5-minute-vim-tutorial/">5 Minute Vim Tutorial</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="preamble">
Vim works differently from other editors you are used to, but it only takes about 5 minutes to learn the basics you need to edit with Vim. You won’t be a Vim wizard, but you will be able to:</p>
<ul>
<li>Open a file</li>
<li>Move around in a file</li>
<li>Edit text in a file</li>
<li>Save a File</li>
</ul>
<p>The slightly longer <a href="#Extended">Extended 5 Minute Tutorial</a> you will show you how to <strong>search</strong> in a file, get <strong>help</strong>, and <strong>access</strong> Vim’s own built-in tutorial.
</div>
<h2 id="contents">Contents</h2>
<ol type="1">
<li><a href="#Vim-in-5">Vim in 5 Minutes (or less)</a></li>
<li><a href="#Extended">The Extended 5+ Minute Tutorial</a>
<ol type="1">
<li><a href="#Normal">Normal Mode</a></li>
<li><a href="#Opening">Opening a File</a></li>
<li><a href="#Saving">Saving a File</a></li>
<li><a href="#Exiting">Exiting Vim</a></li>
<li><a href="#Navigating">Navigating a File</a></li>
<li><a href="#Inserting">Inserting and Deleting Text</a></li>
<li><a href="#Searching">Searching</a></li>
<li><a href="#Help">Getting Help</a></li>
</ol>
</li>
<li><a href="#Final">Final Words</a></li>
</ol>
<h2 id="Vim-in-5">Vim in 5 Minutes (or less)</h2>
<ul>
<li>Vim operates in <span class="mark">Modes</span>. Vim always starts in <span class="mark">Normal Mode</span>.</li>
<li><span class="mark">Normal Mode</span> is your base mode and you should always return to it.</li>
<li>All command / control keys are <strong>case sensitive</strong>.</li>
<li>If you are not in <span class="mark">Normal Mode</span>, you (usually) get back to <span class="mark">Normal Mode</span> by pressing the <span class="kbd">Escape</span> key twice.</li>
<li>If you see <span class="mark">recording</span> in the lower left corner of the screen, press the <span class="kbd">q</span> key to return to <span class="mark">Normal Mode</span>.</li>
<li>If you’ve messed stuff up, return to <span class="mark">Normal Mode</span> and type <span class="kbd">:q!</span> followed by the <span class="kbd">Enter</span> key to exit Vim <strong>without</strong> saving the file.</li>
<li>In <span class="mark">Normal Mode</span> you can navigate the file using the <span class="kbd">h</span>, <span class="kbd">j</span>, <span class="kbd">k</span>, <span class="kbd">l</span> keys (left, down, up, right). You might also be able to use the arrow keys on the keyboard<a id="fnref1" class="footnote-ref" href="#fn1"><sup>1</sup></a>.</li>
<li>When you have navigated to where you want to edit the file (inserting or deleting text), press the <span class="kbd">i</span> key to enter <span class="mark">Insert Mode</span>.</li>
<li>In <span class="mark">Insert Mode</span> you can <strong>only</strong> enter or delete text from the current cursor position &#8211; you <strong>cannot</strong> navigate. To navigate, press the <span class="kbd">Escape</span> key to return to <span class="mark">Normal Mode</span>.</li>
<li>To save (write) the file, return to <span class="mark">Normal Mode</span> and type <span class="kbd">:w</span> followed by the <span class="kbd">Enter</span> key.</li>
<li>To exit (quit) Vim, return to <span class="mark">Normal Mode</span> and type <span class="kbd">:q</span> followed by the <span class="kbd">Enter</span> key.</li>
</ul>
<h2 id="Extended">The Extended 5 Minute Tutorial</h2>
<p>This adds <span class="mark">searching</span> and <span class="mark">help</span> to the 5 Minute Tutorial, but, otherwise, keeps the information to the bare minimum so you can quickly be functional in Vim instead of frustrated.<br />
All command / control keys are <strong>case sensitive</strong>: <span class="kbd">h</span> is not the same as <span class="kbd">H</span>!</p>
<h3 id="Normal">Normal Mode</h3>
<p><span class="mark">Normal Mode</span> is the default mode and it should be the mode you always go back to.<br />
Most times, you press the <span class="kbd">Escape</span> key once or twice<a id="fnref2" class="footnote-ref" href="#fn2"><sup>2</sup></a> to return to <span class="mark">Normal Mode</span>.<br />
If you see <span class="mark">recording</span> in the lower left corner of the screen, press the lowercase <span class="kbd">q</span> key to return to <span class="mark">Normal Mode</span>.</p>
<h3 id="Opening">Opening a File</h3>
<p>The simplest way to open a file is to type <span class="kbd">vim</span> at the command line followed by the name of the file:</p>
<div id="cb1" class="sourceCode">
<pre class="sourceCode bash"><code><a id="cb1-1" class="sourceLine" data-line-number="1"></a><span class="ex">user@COMPUTER</span>:~$ vim file.txt</code></pre>
</div>
<p>If it is a <strong>new</strong> file you should see something like this:</p>
<pre class="vim"><code>
~
~
~
~
~
"file.txt" [New File]                       0,0-1          All</code></pre>
<p>If it is an <strong>existing</strong> file, you should see something like <span class="note" data-note="The actual contents will depend on the file you opened.">this</span>:</p>
<pre class="vim"><code>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Basic HTML5 Template&lt;/title&gt;
    &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;!-- page content goes here --&gt;
    &lt;p&gt;This is some dummy content that is not lorem ipsum.&lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;
~
~
~
"basic.html" 12L, 290C                      1,1           All</code></pre>
<p>The status line<a id="fnref3" class="footnote-ref" href="#fn3"><sup>3</sup></a> (at the bottom of the screen) displays the following information:</p>
<ul>
<li>file name</li>
<li>total number of lines in the file</li>
<li>total number of characters in the file</li>
<li>current line the cursor is on</li>
<li>current column the cursor is in</li>
<li>percentage showing the position in the file (if <span class="mark">All</span> : the entire file is visible, <span class="mark">Bot</span> : at the bottom (end) of the file, <span class="mark">Top</span> : at the top of the file)</li>
</ul>
<p>In <span class="mark">Normal Mode</span> load a file by typing <span class="kbd">:edit</span> followed by the filename and then pressing the <span class="kbd">Enter</span> key.:</p>
<pre class="vim"><code>:edit basic.html</code></pre>
<p>This discards the current file (if any) and loads the specified file.<br />
If the file to be discarded has been modified, but not saved, you will see the following warning in the status line:</p>
<pre class="vim"><code>E37: No write since last change (add ! to override)</code></pre>
<p>If you don’t care about saving the file, simply append <span class="kbd">!</span> to the <span class="kbd">:edit</span> command:</p>
<pre class="vim"><code>:edit! basic.html</code></pre>
<p>The <span class="kbd">!</span> tells Vim to “just do it!” and ignore any warnings.</p>
<h3 id="Saving">Saving a File</h3>
<p>You need to be in <span class="mark">Normal Mode</span> to save a file.<br />
Save a file by typing <span class="kbd">:w</span> followed by the <span class="kbd">Enter</span> key.<br />
If you want to save the file with a different name, type <span class="kbd">:w</span> followed by the new file name and then press the <span class="kbd">Enter</span> key:</p>
<pre class="vim"><code>:w new-filename.txt</code></pre>
<h3 id="Exiting">Exiting Vim</h3>
<p>You need to be in <span class="mark">Normal Mode</span> to exit Vim.<br />
Type <span class="kbd">:q</span> followed by the <span class="kbd">Enter</span> key to exit Vim.<br />
If Vim warns you that the file has been modified, you can choose to <a href="#Saving">save it</a> or you can force Vim to exit without saving the file by typing <span class="kbd">:q!</span> followed by the <span class="kbd">Enter</span> key. The <span class="kbd">!</span> tells Vim to “just do it” and exit without saving the file.</p>
<h3 id="navigating-a-file-navigating">Navigating a File {Navigating}</h3>
<p>You need to be in <span class="mark">Normal Mode</span> to navigate a file.<br />
The letters <span class="kbd">h</span>, <span class="kbd">j</span>, <span class="kbd">k</span>, <span class="kbd">l</span> navigate the cursor through the file. (You may also be able to use the arrow keys present on most keyboards.)<br />
They act like arrow keys and are conceptually laid out like this:</p>
<table style="font-size: 2em; text-align: centered; font-family: inconsolata,monospace; border-collapse: collapse;">
<tbody>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">h<br />
←</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">j<br />
↓</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">k<br />
↑</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">l<br />
→</td>
</tr>
</tbody>
</table>
<p>When you navigate left (<span class="kbd">h</span>) to the beginning of a line, the cursor will stop. It will <strong>not</strong> wrap around and up to the previous line.<br />
When you navigate right (<span class="kbd">l</span>) to the end of a line, the cursor will stop. It will <strong>not</strong> wrap around and down to the next line.<br />
If you type a <strong>positive</strong> integer (which will not be displayed), followed by one of the navigation keys, the cursor will move that many characters / lines.<br />
For example, in <span class="mark">Normal Mode</span>, if you type <span class="kbd">10j</span>, the cursor will move down 10 lines.</p>
<h3 id="Inserting">Inserting and Deleting Text</h3>
<p>In <span class="mark">Insert Mode</span> the only thing you can do is insert or delete text. (You <strong>may</strong> be able to use the arrow keys on your keyboard to navigate the text while in this mode, but there is no guarantee, navigating is supposed to be done in <span class="mark">Normal Mode</span>)<br />
Enter <span class="mark">Insert Mode</span> by pressing the <span class="kbd">i</span>, <span class="kbd">a</span>, <span class="kbd">I</span>, or <span class="kbd">A</span> key.</p>
<ul>
<li><span class="kbd">i</span> insert / delete before the cursor (what you would intuitively expect when entering or deleting text).</li>
<li><span class="kbd">a</span> append / delete after the current cursor position.</li>
<li><span class="kbd">I</span> insert / delete at the beginning of the line.</li>
<li><span class="kbd">A</span> append / delete at the end of the line.</li>
</ul>
<p>You will (probably) be using <span class="kbd">i</span> most frequently.<br />
When you enter <span class="mark">Insert Mode</span> you will see <span class="mark">– INSERT –</span> displayed in the lower left corner:</p>
<pre class="vim"><code>The navigation keys are h, j, k, l.
h moves the̲ cursor one character left
l moves the cursor one character right
j moves the cursor one line down
k moves the cursor one line up
~
~
~
~
-- INSERT --                       3,11      All</code></pre>
<p>Press the <span class="kbd">Escape</span> key to return to <span class="mark">Normal Mode</span>.</p>
<h3 id="Searching">Searching</h3>
<p>You must be in <span class="mark">Normal Mode</span> to search.<br />
In a large file, it is useful to locate items of interest by searching for them.<br />
To search, type <span class="kbd">/</span> followed by the text you want to find, followed by the <span class="kbd">Enter</span> key.<br />
Vim treats the search string as a regular expression &#8211; which means some characters have a special meaning. If you need to search for the following characters, you will need to type them as follows:</p>
<table style="border-collapse: collapse;">
<tbody>
<tr style="font-weight: bold;">
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Name</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Character</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Need to Type</td>
</tr>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Period</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">.</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">.</td>
</tr>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Asterisk</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">*</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">\*</td>
</tr>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Backslash</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">&lt;/td&gt;</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">\</td>
</tr>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Dollar Sign</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">$</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">$</td>
</tr>
<tr>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black;">Forward Slash</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">/</td>
<td style="padding: 0.2em 1em 0 1em; border: 1px solid black; text-align: center;">/</td>
</tr>
</tbody>
</table>
<p>Searches are case sensitive.<br />
You can navigate between search results by pressing <span class="kbd">n</span> (next) or <span class="kbd">N</span> (previous).</p>
<h3 id="Help">Getting Help</h3>
<p>You need to be in <span class="mark">Normal Mode</span> to use help.<br />
To get help on something in Vim, simply type <span class="kbd">:help</span> followed by the thing you want help on.<br />
For example, to get help on the navigation key <span class="kbd">h</span>, type <span class="kbd">:help h</span> followed by the <span class="kbd">Enter</span> key.<br />
You should see something similar to the following:</p>
<pre class="vim"><code>h         or          *h*
&lt;Left&gt;    or          *&lt;Left&gt;*
CTRL-H    or          *CTRL-H* *&lt;BS&gt;*
&lt;BS&gt;      [count] characters to the left.  |exclusive| motion.
          Note: If you prefer &lt;BS&gt; to delete a character, use
          the mapping:
             :map CTRL-V&lt;BS&gt;    X
          (to enter "CTRL-V&lt;BS&gt;" type the CTRL-V key, followed
          by the &lt;BS&gt; key)
          See |:fixdel| if the &lt;BS&gt; key does not do what you
          want.
m̲o̲t̲i̲o̲n̲.̲t̲x̲t̲ ̲[̲H̲e̲l̲p̲]̲[̲R̲O̲]̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲1̲7̲2̲,̲1̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲1̲2̲%̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲
Vim will split the display into two panes. In the upper pane
you will see the help text. In the lower pane you will see your
current editing buffer.
Now you know that Vim supports multiple editing buffers - but
that is not the point of this tutorial.
~
~
~
~
a-file.txt                     4,5              All
</code></pre>
<p>The help can be pretty dense and not user friendly, but it <em>may</em> be helpful.<br />
To close the help window, type <span class="kbd">:q</span> followed by the <span class="kbd">Enter</span> key.<br />
If you type <span class="kbd">:help</span>, it will bring up the general help file. You can navigate through it for topics of interest.<br />
You might also try <span class="kbd">:help tutor</span> for instructions on accessing the Vim tutor which is included with every Vim installation.</p>
<h3 id="Final">Final Words</h3>
<p>Vim may not be the easiest or most intuitive editor you will come across. However, it (or its ancestor Vi) is quite ubiquitous and this tutorial gives you the basics you need so you are minimally functional with it.<br />
The basics are simple:</p>
<ol type="1">
<li>Vim operates in <span class="mark">Modes</span>.</li>
<li>All command / control keys are <strong>case sensitive</strong> : <span class="kbd">k</span> is not the same as <span class="kbd">K</span>.</li>
<li>The base mode is <span class="mark">Normal Mode</span>. You (usually) get back to it by pressing the <span class="kbd">Escape</span> key once or twice.</li>
<li>Navigating a file is done in <span class="mark">Normal Mode</span> using the <span class="kbd">h</span>, <span class="kbd">j</span>, <span class="kbd">k</span>, <span class="kbd">l</span> keys.</li>
<li>When the cursor is where you want to insert or delete text, you press the <span class="kbd">i</span> key to enter <span class="mark">Insert Mode</span>.</li>
<li>Search in <span class="mark">Normal Mode</span> by typing <span class="kbd">/</span> followed by the string you want to find and then the <span class="kbd">Enter</span> key. Navigate the search results using the <span class="kbd">n</span> and <span class="kbd">N</span> keys.</li>
<li>Save a file by typing <span class="kbd">:w</span> in <span class="mark">Normal Mode</span>.</li>
<li>Exit Vim by typing <span class="kbd">:q</span> in <span class="mark">Normal Mode</span>.</li>
<li>In <span class="mark">Normal Mode</span> you can get help by typing <span class="kbd">:help</span></li>
</ol>
<section class="footnotes">
<hr />
<ol>
<li id="fn1">Vi (the precursor to Vim) was developed in 1976. Arrow keys were not commonly found on keyboards, so <span class="kbd">h</span>, <span class="kbd">j</span>, <span class="kbd">k</span>, <span class="kbd">l</span> were used.<a class="footnote-back" href="#fnref1">↩</a></li>
<li id="fn2">Some modes require one key press, others require two. If you press it too many times, the computer will just beep at you. Vim newbies often repeatedly press the <span class="kbd">Escape</span> key in the hopes of returning to <span class="mark">Normal Mode</span><a class="footnote-back" href="#fnref2">↩</a></li>
<li id="fn3">This is true for the default Status Line. It is always possible that someone has modified the Status Line to display different information, or in a different arrangement.<a class="footnote-back" href="#fnref3">↩</a></li>
</ol>
</section>
<p>The post <a href="https://complete-concrete-concise.com/blog/5-minute-vim-tutorial/">5 Minute Vim Tutorial</a> appeared first on <a href="https://complete-concrete-concise.com">Complete, Concrete, Concise</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
