<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.paskvil.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.paskvil.com/index.php?action=history&amp;feed=atom&amp;title=Short_Notes_on_ViM</id>
		<title>Short Notes on ViM - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.paskvil.com/index.php?action=history&amp;feed=atom&amp;title=Short_Notes_on_ViM"/>
		<link rel="alternate" type="text/html" href="https://wiki.paskvil.com/index.php?title=Short_Notes_on_ViM&amp;action=history"/>
		<updated>2026-04-10T18:52:31Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.22.0</generator>

	<entry>
		<id>https://wiki.paskvil.com/index.php?title=Short_Notes_on_ViM&amp;diff=205&amp;oldid=prev</id>
		<title>Admin: /* Directly type HTML entities */</title>
		<link rel="alternate" type="text/html" href="https://wiki.paskvil.com/index.php?title=Short_Notes_on_ViM&amp;diff=205&amp;oldid=prev"/>
				<updated>2013-08-30T15:11:27Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Directly type HTML entities&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:11, 30 August 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 15:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 15:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To have accented characters directly translated to HTML entities, you can just add mappings like this to ''~/.vimrc'' (or define them on when needed using &amp;lt;tt&amp;gt;:imap&amp;lt;/tt&amp;gt; command):&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To have accented characters directly translated to HTML entities, you can just add mappings like this to ''~/.vimrc'' (or define them on when needed using &amp;lt;tt&amp;gt;:imap&amp;lt;/tt&amp;gt; command):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;imap Č &amp;amp;#268;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;imap Č &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#268;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap č &amp;amp;#269;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap č &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#269;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap Š &amp;amp;#352;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap Š &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#352;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap š &amp;amp;#353;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap š &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#353;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap Ž &amp;amp;#381;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap Ž &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#381;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap ž &amp;amp;#382;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;imap ž &amp;amp;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;amp;&lt;/ins&gt;#382;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot; ... and so on ...&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;quot; ... and so on ...&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Then, when you type ''Č'', ViM will automatically insert &amp;lt;tt&amp;gt;&amp;amp;amp;#268;&amp;lt;/tt&amp;gt; instead.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Then, when you type ''Č'', ViM will automatically insert &amp;lt;tt&amp;gt;&amp;amp;amp;#268;&amp;lt;/tt&amp;gt; instead.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>https://wiki.paskvil.com/index.php?title=Short_Notes_on_ViM&amp;diff=95&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;== Delete all lines matching a pattern ==  Delete all empty lines: &lt;pre&gt;:g/^\s*$/d&lt;/pre&gt;  Delete all single-line comments in a C++ file: &lt;pre&gt;:g/^\s*\/\//d&lt;/pre&gt;  Delete all line...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.paskvil.com/index.php?title=Short_Notes_on_ViM&amp;diff=95&amp;oldid=prev"/>
				<updated>2012-06-01T21:40:15Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Delete all lines matching a pattern ==  Delete all empty lines: &amp;lt;pre&amp;gt;:g/^\s*$/d&amp;lt;/pre&amp;gt;  Delete all single-line comments in a C++ file: &amp;lt;pre&amp;gt;:g/^\s*\/\//d&amp;lt;/pre&amp;gt;  Delete all line...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Delete all lines matching a pattern ==&lt;br /&gt;
&lt;br /&gt;
Delete all empty lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;:g/^\s*$/d&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete all single-line comments in a C++ file:&lt;br /&gt;
&amp;lt;pre&amp;gt;:g/^\s*\/\//d&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete all lines that do ''not'' match given pattern (&amp;lt;tt&amp;gt;:g!&amp;lt;/tt&amp;gt; is equivalent to &amp;lt;tt&amp;gt;:v&amp;lt;/tt&amp;gt;):&lt;br /&gt;
&amp;lt;pre&amp;gt;:g!/pattern/d&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Directly type HTML entities ==&lt;br /&gt;
&lt;br /&gt;
Main power of ViM is that all of it's commands and macros are represented by the &amp;quot;normal&amp;quot; keystrokes. That way, you can map certain characters to direct input (or to commands, etc).&lt;br /&gt;
&lt;br /&gt;
To have accented characters directly translated to HTML entities, you can just add mappings like this to ''~/.vimrc'' (or define them on when needed using &amp;lt;tt&amp;gt;:imap&amp;lt;/tt&amp;gt; command):&lt;br /&gt;
&amp;lt;pre&amp;gt;imap Č &amp;amp;#268;&lt;br /&gt;
imap č &amp;amp;#269;&lt;br /&gt;
imap Š &amp;amp;#352;&lt;br /&gt;
imap š &amp;amp;#353;&lt;br /&gt;
imap Ž &amp;amp;#381;&lt;br /&gt;
imap ž &amp;amp;#382;&lt;br /&gt;
&amp;quot; ... and so on ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, when you type ''Č'', ViM will automatically insert &amp;lt;tt&amp;gt;&amp;amp;amp;#268;&amp;lt;/tt&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
== Reformat a plain text paragraph ==&lt;br /&gt;
&lt;br /&gt;
ViM includes full support of plain text editing tools.&lt;br /&gt;
&lt;br /&gt;
One of the most helpful ones is ''textwidth'' variable, that tells ViM how long the lines should be, and while typing it automatically breaks lines to the given width (of course, preserving full words).&lt;br /&gt;
&lt;br /&gt;
But when you edit text within already formatted paragraph, or if you have existing paragraphs and want to reformat them, you have to do this yourself. Fortunately, ViM helps you with this also - simply place cursor within the paragraph, and in '''normal''' mode (press ''Esc'' if you're in '''insert''' mode) press&lt;br /&gt;
&amp;lt;pre&amp;gt;vipgq&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;tt&amp;gt;vip&amp;lt;/tt&amp;gt; combination simply selects the paragraph (visual inner paragraph), and &amp;lt;tt&amp;gt;gq&amp;lt;/tt&amp;gt; reformats it.&lt;br /&gt;
&lt;br /&gt;
For ease of use, you can define a shortcut for use from '''insert''' mode:&lt;br /&gt;
&amp;lt;pre&amp;gt;imap &amp;lt;C-v&amp;gt;r &amp;lt;Esc&amp;gt;vipgqi&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now, pressing ''Ctrl-v'' and ''r'' in '''insert''' mode will reformat current paragraph, and return to '''insert''' mode.&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>