<?xml version="1.0" encoding="UTF-8"?><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/"
		>
<channel>
	<title>Comments on: useful simple vi commands for DBAs</title>
	<atom:link href="http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/</link>
	<description>Oracle DBA (plus SQL Server)</description>
	<lastBuildDate>Wed, 25 Jan 2012 13:00:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Andrew Fraser</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-26</link>
		<dc:creator>Andrew Fraser</dc:creator>
		<pubDate>Wed, 04 Mar 2009 16:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-26</guid>
		<description>Hi Kedar,

1) :%s changes every line, :$s only changes the last line in the file.
2) $ is end of line rather than new line. ctrl+v ctrl+m is carriage return/line break character.
3) You can include /g if you want, makes no difference to this particular command, since there will be only one end of line marker in each line.
4) Use the &quot;\&quot; character to escape out special vi characters. So this command would change all $ symbols to c:
:%s/\$/c/g

Andrew.</description>
		<content:encoded><![CDATA[<p>Hi Kedar,</p>
<p>1) :%s changes every line, :$s only changes the last line in the file.<br />
2) $ is end of line rather than new line. ctrl+v ctrl+m is carriage return/line break character.<br />
3) You can include /g if you want, makes no difference to this particular command, since there will be only one end of line marker in each line.<br />
4) Use the &#8220;\&#8221; character to escape out special vi characters. So this command would change all $ symbols to c:<br />
:%s/\$/c/g</p>
<p>Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kedarm</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-25</link>
		<dc:creator>kedarm</dc:creator>
		<pubDate>Wed, 04 Mar 2009 07:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-25</guid>
		<description>I&#039;ve got some doubts -

1) Difference between :%s and :$s
:%s/$/ctrl+v ctrl+m - After every instance of $ (end line), insert ctrl+v ctrl+m (new line)?
:$s/$/ctrl+v ctrl+m - Replace every instance of $ (end line) with ctrl+v ctrl+m (new line)
Is the above correct?

2) Why use ctrl+v ctrl+m
Why doesn&#039;t :%s/$/$/g work? This should mean that append after every $ (new line) another $ (new line)?
Why should ctrl+v ctrl+m and not another $ - eg, after every instance of an end-line, put another end-line, something analogous to
if (s[i]==&#039;\n&#039;)   s[i+1]=&#039;\n&#039;;

3) Why not use /g?
Why don&#039;t we use the /g after :%s/$/ctrl+v ctrl+m? Doesn&#039;t it tell the command to do it for every occurrence of $ (end-line)?

4) Escape sequences
If I want to replace the character $ (dollar) by c (cents), is there some escape sequence I can use so that vim doesn&#039;t mistakenly hunt for end-of-line characters instead of the &#039;$&#039; character?

Thanks
Kedar</description>
		<content:encoded><![CDATA[<p>I&#8217;ve got some doubts -</p>
<p>1) Difference between :%s and :$s<br />
:%s/$/ctrl+v ctrl+m &#8211; After every instance of $ (end line), insert ctrl+v ctrl+m (new line)?<br />
:$s/$/ctrl+v ctrl+m &#8211; Replace every instance of $ (end line) with ctrl+v ctrl+m (new line)<br />
Is the above correct?</p>
<p>2) Why use ctrl+v ctrl+m<br />
Why doesn&#8217;t :%s/$/$/g work? This should mean that append after every $ (new line) another $ (new line)?<br />
Why should ctrl+v ctrl+m and not another $ &#8211; eg, after every instance of an end-line, put another end-line, something analogous to<br />
if (s[i]==&#8217;\n&#8217;)   s[i+1]=&#8217;\n&#8217;;</p>
<p>3) Why not use /g?<br />
Why don&#8217;t we use the /g after :%s/$/ctrl+v ctrl+m? Doesn&#8217;t it tell the command to do it for every occurrence of $ (end-line)?</p>
<p>4) Escape sequences<br />
If I want to replace the character $ (dollar) by c (cents), is there some escape sequence I can use so that vim doesn&#8217;t mistakenly hunt for end-of-line characters instead of the &#8216;$&#8217; character?</p>
<p>Thanks<br />
Kedar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Fraser</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-24</link>
		<dc:creator>Andrew Fraser</dc:creator>
		<pubDate>Tue, 03 Mar 2009 14:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-24</guid>
		<description>Hi kedarm.
:%s/$/ctrl+v ctrl+m
Does that. That&#039;s how you type it, but it appears as
:%s/$/^M
On the vi screen.
Works because $ is the end of line character in vi. ^ is the equivalent beginning of line character, I sometimes use that instead.
Andrew.</description>
		<content:encoded><![CDATA[<p>Hi kedarm.<br />
:%s/$/ctrl+v ctrl+m<br />
Does that. That&#8217;s how you type it, but it appears as<br />
:%s/$/^M<br />
On the vi screen.<br />
Works because $ is the end of line character in vi. ^ is the equivalent beginning of line character, I sometimes use that instead.<br />
Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kedarm</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-23</link>
		<dc:creator>kedarm</dc:creator>
		<pubDate>Sun, 01 Mar 2009 05:55:15 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-23</guid>
		<description>Hey,

How does one insert a new line?

For instance, if my file is -
test 1
test 2
test 3

and I want to make it,
test 1

test 2

test 3

Will a simple &#039;:s/test/\n test&#039; work?</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>How does one insert a new line?</p>
<p>For instance, if my file is -<br />
test 1<br />
test 2<br />
test 3</p>
<p>and I want to make it,<br />
test 1</p>
<p>test 2</p>
<p>test 3</p>
<p>Will a simple &#8216;:s/test/\n test&#8217; work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SteveC</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-22</link>
		<dc:creator>SteveC</dc:creator>
		<pubDate>Fri, 06 Feb 2009 14:24:48 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-22</guid>
		<description>Andrew

Many thanks for this page. It&#039;s the only place on the web where I could find the commands I needed quickly.

Star!</description>
		<content:encoded><![CDATA[<p>Andrew</p>
<p>Many thanks for this page. It&#8217;s the only place on the web where I could find the commands I needed quickly.</p>
<p>Star!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-21</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Sat, 19 Jan 2008 08:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-21</guid>
		<description>Hi,

Thanks a ton for this which i really need these commands.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks a ton for this which i really need these commands.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Fraser</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-20</link>
		<dc:creator>Andrew Fraser</dc:creator>
		<pubDate>Mon, 29 Jan 2007 17:55:46 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-20</guid>
		<description>Thanks d., I&#039;ve updated original post with that. Means I think that it is better practice to use shift-z-z.</description>
		<content:encoded><![CDATA[<p>Thanks d., I&#8217;ve updated original post with that. Means I think that it is better practice to use shift-z-z.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: d</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-19</link>
		<dc:creator>d</dc:creator>
		<pubDate>Fri, 19 Jan 2007 18:46:53 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-19</guid>
		<description>shift z  is not equivalent to :wq in that it does not save (write) the file if there are no unsaved changes.</description>
		<content:encoded><![CDATA[<p>shift z  is not equivalent to :wq in that it does not save (write) the file if there are no unsaved changes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-18</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Fri, 19 Jan 2007 14:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-18</guid>
		<description>A couple of other useful-sh things:

% (i.e. shift-5) - takes you to the matching bracket, if you&#039;re on a bracket

qx,q,@x - to start recording, stop recording and execute a macro (called x). Probably vim only</description>
		<content:encoded><![CDATA[<p>A couple of other useful-sh things:</p>
<p>% (i.e. shift-5) &#8211; takes you to the matching bracket, if you&#8217;re on a bracket</p>
<p>qx,q,@x &#8211; to start recording, stop recording and execute a macro (called x). Probably vim only</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Todd</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-17</link>
		<dc:creator>Andy Todd</dc:creator>
		<pubDate>Thu, 18 Jan 2007 09:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comment-17</guid>
		<description>Oh, and the ultimate list of vi/vim links;

http://thomer.com/vi/vi.html</description>
		<content:encoded><![CDATA[<p>Oh, and the ultimate list of vi/vim links;</p>
<p><a href="http://thomer.com/vi/vi.html" rel="nofollow">http://thomer.com/vi/vi.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

