<?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: Working efficiently with VI / VIM</title>
	<atom:link href="http://blog.anantshri.info/working-efficiently-with-vi-vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.anantshri.info/working-efficiently-with-vi-vim/</link>
	<description>My journey into the world of virtual reality.</description>
	<lastBuildDate>Sun, 04 Jul 2010 06:12:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: JimD</title>
		<link>http://blog.anantshri.info/working-efficiently-with-vi-vim/#comment-565</link>
		<dc:creator>JimD</dc:creator>
		<pubDate>Fri, 19 Dec 2008 04:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.anantshri.info/?p=117#comment-565</guid>
		<description>:r!COMMAND --- read output from command into document. (Example: :r!ls /etc --- import a list of the files from the /etc directory into the document at the current cursor location)

!MOVEMENT COMMAND --- replace lines enclosed by movement by filtering them through a command. (Example: {!}sort ... move to beginning of a &quot;paragraph&quot; ({ command) ... start the &quot;bang&quot; command (!), enclosing through the end of the &quot;paragraph (} command) [at this point vi prompts you for the command using a bang sign at the bottom of the screen, similar to the : prompt).  This example is handy for sorting a list of lines separated from the surrounding text by blank lines --- which count at paragraph separators by default.  Another example would be !}fmt --- reformat from the cursor to the end of the current paragraph). (Another example: 1GyGGp!Gwc --- append the output that wc would give on the current file at the end of the file.  1GyGGp --- copies the whole document, appending the copy to the end and leaving the cursor between the two copies.  Then the !Gwc simple filters the copy through the wc command).

mLETTER --- mark a place (valid marks are any single letter)
&#039;LETTER --- move/return cursor to marked line
`LETTER --- move/return cursor to specific character at which the mark was made (same line *and* same place within that line)

&quot;LETTERyMOVEMENT --- yank a copy of some text into a named register (each letter is a valid named register).  (Example: &quot;xy/foo --- copy text from cursor to the first line matching the search for &quot;foo&quot; into the register named &quot;x&quot;) (NOTE: d can cut text into the register, y copies it).
&quot;LETTERp --- paste contents of named register into the document. (Example: &quot;xyyG&quot;xp ... yank a line into the &quot;x&quot; register, go to end of the document, paste a copy there.  That&#039;s the same as yyGp except that it leaves a copy of the line in the x register for later use)

@LETTER --- execute the contents of the register as if they were vi commands. (Example: :r!locate somefile[Enter]I:r [Esc]&quot;cyy@c --- read in the results of a locate command on &quot;somefile, insert the :r command at the beginning of the resulting full path to that file, yank this line into the &quot;c&quot; register, then execute the contents of that register into the file at the current cursor location.

As shown in the last example, you can combine a few of these into a very efficient way to locate a file on your system, and insert its contents into a file that you&#039;re editing.

When I teach Linux sysadmin classes I normally present a brief section on these features.  Normally my students are advanced UNIX admins who have been using vi on a daily basis for several years (the classes are for teams who are migrating to the new platform).  Almost all of my students have learned at least one new trick from that 20 minute &quot;power tips&quot; session.

None of these are vim specific ... they all work on any reasonably good copy of vi.</description>
		<content:encoded><![CDATA[<p>:r!COMMAND &#8212; read output from command into document. (Example: :r!ls /etc &#8212; import a list of the files from the /etc directory into the document at the current cursor location)</p>
<p>!MOVEMENT COMMAND &#8212; replace lines enclosed by movement by filtering them through a command. (Example: {!}sort &#8230; move to beginning of a &#8220;paragraph&#8221; ({ command) &#8230; start the &#8220;bang&#8221; command (!), enclosing through the end of the &#8220;paragraph (} command) [at this point vi prompts you for the command using a bang sign at the bottom of the screen, similar to the : prompt).  This example is handy for sorting a list of lines separated from the surrounding text by blank lines --- which count at paragraph separators by default.  Another example would be !}fmt --- reformat from the cursor to the end of the current paragraph). (Another example: 1GyGGp!Gwc --- append the output that wc would give on the current file at the end of the file.  1GyGGp --- copies the whole document, appending the copy to the end and leaving the cursor between the two copies.  Then the !Gwc simple filters the copy through the wc command).</p>
<p>mLETTER --- mark a place (valid marks are any single letter)<br />
'LETTER --- move/return cursor to marked line<br />
`LETTER --- move/return cursor to specific character at which the mark was made (same line *and* same place within that line)</p>
<p>"LETTERyMOVEMENT --- yank a copy of some text into a named register (each letter is a valid named register).  (Example: "xy/foo --- copy text from cursor to the first line matching the search for "foo" into the register named "x") (NOTE: d can cut text into the register, y copies it).<br />
"LETTERp --- paste contents of named register into the document. (Example: "xyyG"xp ... yank a line into the "x" register, go to end of the document, paste a copy there.  That's the same as yyGp except that it leaves a copy of the line in the x register for later use)</p>
<p>@LETTER --- execute the contents of the register as if they were vi commands. (Example: :r!locate somefile[Enter]I:r [Esc]&#8220;cyy@c &#8212; read in the results of a locate command on &#8220;somefile, insert the :r command at the beginning of the resulting full path to that file, yank this line into the &#8220;c&#8221; register, then execute the contents of that register into the file at the current cursor location.</p>
<p>As shown in the last example, you can combine a few of these into a very efficient way to locate a file on your system, and insert its contents into a file that you&#8217;re editing.</p>
<p>When I teach Linux sysadmin classes I normally present a brief section on these features.  Normally my students are advanced UNIX admins who have been using vi on a daily basis for several years (the classes are for teams who are migrating to the new platform).  Almost all of my students have learned at least one new trick from that 20 minute &#8220;power tips&#8221; session.</p>
<p>None of these are vim specific &#8230; they all work on any reasonably good copy of vi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: akhil887</title>
		<link>http://blog.anantshri.info/working-efficiently-with-vi-vim/#comment-566</link>
		<dc:creator>akhil887</dc:creator>
		<pubDate>Tue, 09 Dec 2008 04:27:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.anantshri.info/?p=117#comment-566</guid>
		<description>yup u r so correct these commands helps a lot ........................and please these commands are usefull not for someday it can be used in day today basis , for making vi easy
but its good that u r giving these commands in public to help person understand more about linux vi.

carry on ....</description>
		<content:encoded><![CDATA[<p>yup u r so correct these commands helps a lot &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;and please these commands are usefull not for someday it can be used in day today basis , for making vi easy<br />
but its good that u r giving these commands in public to help person understand more about linux vi.</p>
<p>carry on &#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
