<?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>VI/VIM editor Read/Write files command Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/vi-vim-editor-read-write-files-command/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/vi-vim-editor-read-write-files-command/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:55:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>VI/VIM editor Commands &#124; VI/VIM editor commands reference &#124; Cheat Sheet</title>
		<link>https://www.scmgalaxy.com/tutorials/vi-vim-editor-commands/</link>
					<comments>https://www.scmgalaxy.com/tutorials/vi-vim-editor-commands/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 06 Apr 2009 07:46:57 +0000</pubDate>
				<category><![CDATA[IDEs and Editor]]></category>
		<category><![CDATA[All Features commands in VI/VIM editor]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[Editor]]></category>
		<category><![CDATA[Vi]]></category>
		<category><![CDATA[VI and VIM Tutorial]]></category>
		<category><![CDATA[VI/VIM editor]]></category>
		<category><![CDATA[VI/VIM editor Advantages]]></category>
		<category><![CDATA[VI/VIM editor Alignment command]]></category>
		<category><![CDATA[VI/VIM editor Auto-completion command]]></category>
		<category><![CDATA[VI/VIM editor Commands]]></category>
		<category><![CDATA[VI/VIM editor Commands CheatSheet]]></category>
		<category><![CDATA[VI/VIM editor commands guide]]></category>
		<category><![CDATA[VI/VIM editor commands reference]]></category>
		<category><![CDATA[VI/VIM editor commands tutorial]]></category>
		<category><![CDATA[VI/VIM editor Features]]></category>
		<category><![CDATA[VI/VIM editor File editing command]]></category>
		<category><![CDATA[VI/VIM editor File explorer command]]></category>
		<category><![CDATA[VI/VIM editor File inserting command]]></category>
		<category><![CDATA[VI/VIM editor Marks command]]></category>
		<category><![CDATA[VI/VIM editor Read/Write files command]]></category>
		<category><![CDATA[VI/VIM editor Replace command]]></category>
		<category><![CDATA[VI/VIM editor search command]]></category>
		<category><![CDATA[VI/VIM editor Syntax highlighting command]]></category>
		<category><![CDATA[VI/VIM editor Tabs command]]></category>
		<category><![CDATA[VI/VIM editor Text indent command]]></category>
		<category><![CDATA[VI/VIM editor Text inserting command]]></category>
		<category><![CDATA[VI/VIM editor Unix Interaction command]]></category>
		<category><![CDATA[VI/VIM editor Window spliting command]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[What is VI-editor]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2009/04/06/vi-vim-editor-commands/</guid>

					<description><![CDATA[<p>what will happen ? &#8220;man ls &#124;col -b &#62; &#8221; will give the text file same as man ls. what [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/vi-vim-editor-commands/">VI/VIM editor Commands | VI/VIM editor commands reference | Cheat Sheet</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4018 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/04/vi-vim-editor-commands.png" alt="vi-vim-editor-commands" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/04/vi-vim-editor-commands.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2009/04/vi-vim-editor-commands-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<ul>
<li><span style="color: #0000ff;"><b>what will happen ?</b></span></li>
</ul>
<p>&#8220;man ls |col -b &gt; &#8221; will give the text file same as man ls.</p>
<ul>
<li><span style="color: #0000ff;"><b>what is VI-editor ?</b></span></li>
</ul>
<p>While in vi you can run AIX commands without exiting the editing session. The! creates a<br />
shell to execute the command that follows.<br />
1. :!ls will create a shell<br />
2. All files in the current directory are listed. Press return to exit the shell and return to the<br />
vi session or&#8230;<br />
3. While still in command mode, issue the :r snacks command<br />
4. The contents of snacks, in this case, are read into the vi file. By default, it will appear<br />
after the current line.<br />
If you need to run a series of commands without returning to vi after the first command is<br />
executed, enter :sh. When you have run all the commands, press to exit the shell<br />
and return to vi.</p>
<ul>
<li><span style="color: #0000ff;"><b>VI Options:-</b></span></li>
</ul>
<p>vi has many modes of operation. Some of these will affect the way text is presented, while<br />
others will make editing easier for novice users.<br />
:set all display all settings<br />
:set display settings different than the default<br />
:set ai sets autoindent on<br />
:set noai turns autoindent mode off<br />
:set nu enables line numbers<br />
:set nonu turns line numbers off<br />
:set list displays non-printable characters<br />
:set nolist hides non-printable characters<br />
:set showmode shows the current mode of operation<br />
:set noshowmode hides mode of operation<br />
:set ts=4 sets tabs to 4-character jumps<br />
:set ic ignores case sensitivity<br />
:set noic case sensitive</p>
<ul>
<li><span style="color: #0000ff;"><b> Search</b></span></li>
</ul>
<p>/word     Search “word” from top to bottom<br />
?word     Search “word” from bottom to top<br />
/jo[ha]n     Search “john” or “joan”<br />
/\&lt; the     Search “the”, “theatre” or “then”<br />
/the\&gt;     Search “the” or “breathe”<br />
/\     Search “the”<br />
/\     Search all words of 4 letters<br />
/\/     Search “fred” but not “alfred” or “frederick”<br />
/fred\|joe     Search “fred” or “joe”<br />
/\     Search exactly 4 digits<br />
/^\n\{3}     Find 3 empty lines<br />
:bufdo /searchstr/     Search in all open files</p>
<ul>
<li><span style="color: #0000ff;"><b>Replace</b></span></li>
</ul>
<p>:%s/old/new/g     Replace all occurences of “old” by “new” in file<br />
:%s/old/new/gw     Replace all occurences with confirmation<br />
:2,35s/old/new/g     Replace all occurences between lines 2 and 35<br />
:5,$s/old/new/g     Replace all occurences from line 5 to EOF<br />
:%s/^/hello/g     Replace the begining of each line by “hello”<br />
:%s/$/Harry/g     Replace the end of each line by “Harry”<br />
:%s/onward/forward/gi     Replace “onward” by “forward” , case unsensitive<br />
:%s/ *$//g     Delete all white spaces<br />
:g/string/d     Delete all lines containing “string”<br />
:v/string/d     Delete all lines containing which didn&#8217;t contain “string”<br />
:s/Bill/Steve/     Replace the first occurence of “Bill” by “Steve” in current line<br />
:s/Bill/Steve/g     Replace “Bill” by “Steve” in current line<br />
:%s/Bill/Steve/g     Replace “Bill” by “Steve” in all the file<br />
:%s/\r//g     Delete DOS carriage returns (^M)<br />
:%s/\r/\r/g     Transform DOS carriage returns in returns<br />
:%s#]\+&gt;##g     Delete HTML tags but keeps text<br />
:%s/^\(.*\)\n\1$/\1/     Delete lines which appears twice<br />
Ctrl+a     Increment number under the cursor<br />
Ctrl+x     Decrement number under cursor<br />
ggVGg?     Change text to Rot13</p>
<p>&nbsp;</p>
<ul>
<li><span style="color: #0000ff;"><b>Case</b></span></li>
</ul>
<p>Vu     Lowercase line<br />
VU     Uppercase line<br />
g~~     Invert case<br />
vEU     Switch word to uppercase<br />
vE~     Modify word case<br />
ggguG     Set all text to lowercase<br />
:set ignorecase     Ignore case in searches<br />
:set smartcase     Ignore case in searches excepted if an uppercase letter is used<br />
:%s/\&lt;./\u&amp;/g     Sets first letter of each word to uppercase<br />
:%s/\&lt;./\l&amp;/g     Sets first letter of each word to lowercase<br />
:%s/.*/\u&amp;     Sets first letter of each line to uppercase<br />
:%s/.*/\l&amp;     Sets first letter of each line to lowercase</p>
<ul>
<li><span style="color: #0000ff;"><b>Read/Write files</b></span></li>
</ul>
<p>:1,10 w outfile     Saves lines 1 to 10 in outfile<br />
:1,10 w &gt;&gt; outfile     Appends lines 1 to 10 to outfile<br />
:r infile     Insert the content of infile<br />
:23r infile     Insert the content of infile under line 23</p>
<ul>
<li><span style="color: #0000ff;"><b>File explorer</b></span></li>
</ul>
<p>:e .     Open integrated file explorer<br />
:Sex     Split window and open integrated file explorer<br />
:browse e     Graphical file explorer<br />
:ls     List buffers<br />
:cd ..     Move to parent directory<br />
:args     List files<br />
:args *.php     Open file list<br />
:grep expression *.php     Returns a list of .php files contening expression<br />
gf     Open file name under cursor</p>
<ul>
<li><span style="color: #0000ff;"><b>Interact with Unix</b></span></li>
</ul>
<p>:!pwd     Execute the “pwd” unix command, then returns to Vi<br />
!!pwd     Execute the “pwd” unix command and insert output in file<br />
:sh     Temporary returns to Unix<br />
$exit     Retourns to Vi</p>
<ul>
<li><span style="color: #0000ff;"><b>Alignment</b></span></li>
</ul>
<p>:%!fmt     Align all lines<br />
!}fmt     Align all lines at the current position<br />
5!!fmt     Align the next 5 lines</p>
<ul>
<li><span style="color: #0000ff;"><b>Tabs</b></span></li>
</ul>
<p>:tabnew     Creates a new tab<br />
gt     Show next tab<br />
:tabfirst     Show first tab<br />
:tablast     Show last tab<br />
:tabm n(position)     Rearrange tabs<br />
:tabdo %s/foo/bar/g     Execute a command in all tabs<br />
:tab ball     Puts all open files in tabs</p>
<ul>
<li><span style="color: #0000ff;"><b>Window spliting</b></span></li>
</ul>
<p>:e filename     Edit filename in current window<br />
:split filename     Split the window and open filename<br />
ctrl-w up arrow     Puts cursor in top window<br />
ctrl-w ctrl-w     Puts cursor in next window<br />
ctrl-w_     Maximise current window<br />
ctrl-w=     Gives the same size to all windows<br />
10 ctrl-w+     Add 10 lines to current window<br />
:vsplit file     Split window vertically<br />
:sview file     Same as :split in readonly mode<br />
:hide     Close current window<br />
:only     Close all windows, excepted current<br />
:b 2     Open #2 in this window</p>
<ul>
<li><span style="color: #0000ff;"><b>Auto-completion</b></span></li>
</ul>
<p>Ctrl+n Ctrl+p (in insert mode)     Complete word<br />
Ctrl+x Ctrl+l     Complete line<br />
:set dictionary=dict     Define dict as a dictionnary<br />
Ctrl+x Ctrl+k     Complete with dictionnary</p>
<ul>
<li><span style="color: #0000ff;"><b>Marks</b></span></li>
</ul>
<p>mk     Marks current position as k<br />
‘k     Moves cursor to mark k<br />
d’k     Delete all until mark k<br />
Abbreviations<br />
:ab pr printf(&#8220;This is a Demo Ver \n&#8221;);    Define pr as abbreviation of printf(&#8220;This is a Demo Ver \n&#8221;);</p>
<ul>
<li><span style="color: #0000ff;"><b>Text indent</b></span></li>
</ul>
<p>:set autoindent     Turn on auto-indent<br />
:set smartindent     Turn on intelligent auto-indent<br />
:set shiftwidth=4     Defines 4 spaces as indent size<br />
ctrl-t, ctrl-d     Indent/un-indent in insert mode<br />
&gt;&gt;     Indent<br />
&lt;&lt;     Un-indent</p>
<ul>
<li><span style="color: #0000ff;"><b>Syntax highlighting</b></span></li>
</ul>
<p>:syntax on     Turn on syntax highlighting<br />
:syntax off     Turn off syntax highlighting<br />
:set syntax=perl     Force syntax highlighting</p>
<ul>
<li><span style="color: #0000ff;"><b>How to Exit</b></span></li>
</ul>
<p>:q[uit]     Quit Vim. This fails when changes have been made.<br />
:q[uit]!     Quit without writing.<br />
:cq[uit]     Quit always, without writing.<br />
:wq     Write the current file and exit.<br />
:wq!     Write the current file and exit always.<br />
:wq {file}     Write to {file}. Exit if not editing the last<br />
:wq! {file}     Write to {file} and exit always.<br />
:[range]wq[!]     [file] Same as above, but only write the lines in [range].<br />
ZZ     Write current file, if modified, and exit.<br />
ZQ     Quit current file and exit (same as &#8220;:q!&#8221;).</p>
<ul>
<li><span style="color: #0000ff;"><b>Editing a File</b></span></li>
</ul>
<p>:e[dit]     Edit the current file. This is useful to re-edit the current file, when it has been changed outside                 of Vim.<br />
:e[dit]!     Edit the current file always. Discard any changes to the current buffer. This is useful if you want                 to start all over again.<br />
:e[dit] {file}     Edit {file}.<br />
:e[dit]! {file}     Edit {file} always. Discard any changes to the current buffer.<br />
gf     Edit the file whose name is under or after the cursor. Mnemonic: &#8220;goto file&#8221;.</p>
<ul>
<li><span style="color: #0000ff;"><b>Inserting Text</b></span></li>
</ul>
<p>a     Append text after the cursor [count] times.<br />
A     Append text at the end of the line [count] times.<br />
i     Insert text before the cursor [count] times.<br />
I     Insert text before the first non-blank in the line [count] times.<br />
gI     Insert text in column 1 [count] times.<br />
o     Begin a new line below the cursor and insert text, repeat [count] times.<br />
O     Begin a new line above the cursor and insert text, repeat [count] times.</p>
<ul>
<li><span style="color: #0000ff;"><b>Inserting a file</b></span></li>
</ul>
<p>:r[ead] [name]     Insert the file [name] below the cursor.<br />
:r[ead] !{cmd}     Execute {cmd} and insert its standard output below the cursor.<br />
<del> </del></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/vi-vim-editor-commands/">VI/VIM editor Commands | VI/VIM editor commands reference | Cheat Sheet</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/vi-vim-editor-commands/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
