 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://Robo.Fish/wiki/index.php?action=history&amp;feed=atom&amp;title=VIM</id>
	<title>VIM - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://Robo.Fish/wiki/index.php?action=history&amp;feed=atom&amp;title=VIM"/>
	<link rel="alternate" type="text/html" href="https://Robo.Fish/wiki/index.php?title=VIM&amp;action=history"/>
	<updated>2026-04-19T04:58:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://Robo.Fish/wiki/index.php?title=VIM&amp;diff=2802&amp;oldid=prev</id>
		<title>Kai at 2018-04-10T21:22:50</title>
		<link rel="alternate" type="text/html" href="https://Robo.Fish/wiki/index.php?title=VIM&amp;diff=2802&amp;oldid=prev"/>
		<updated>2018-04-10T21:22:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
=== &amp;lt;br /&amp;gt;Introduction ===&lt;br /&gt;
VIM (http://www.vim.org) is an enhanced version of the terminal-based text editor &amp;#039;&amp;#039;vi&amp;#039;&amp;#039;. VIM is especially useful when you are logged into a remote device via a terminal session and want to edit source code. The user interface is geared toward key combinations, which the user needs to memorize.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== Basic Usage ===&lt;br /&gt;
You start VIM with the &amp;#039;&amp;#039;vi&amp;#039;&amp;#039; or &amp;#039;&amp;#039;vim&amp;#039;&amp;#039; command. To edit an existing file simply pass the path of the file as argument. A short interactive tutorial at http://www.openvim.com&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Useful shortcuts ===&lt;br /&gt;
{|&lt;br /&gt;
! Key(s)&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| :help  || Open help.&lt;br /&gt;
|-&lt;br /&gt;
| :shell  || (also :sh) opens a shell (or drops you into the terminal session from which vim was started) from which you return via Ctrl+D&lt;br /&gt;
|-&lt;br /&gt;
| :q || quits VIM if there are no unsaved changes&lt;br /&gt;
|-&lt;br /&gt;
| :q! || quits VIM without saving changes&lt;br /&gt;
|-&lt;br /&gt;
| :w || writes changes to file.&lt;br /&gt;
|-&lt;br /&gt;
| ZZ || saves file and quit, same as &amp;#039;&amp;#039;:wq&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| i || switches to insert mode where text is inserted before the character under the cursor (type a number before pressing &amp;#039;&amp;#039;i&amp;#039;&amp;#039;, then type the string, then exit insert mode with ESC to insert the string multiple times)&lt;br /&gt;
|-&lt;br /&gt;
| a || switches to insert mode where text is appended after the character under the cursor&lt;br /&gt;
|-&lt;br /&gt;
| ESC || returns from insert mode to normal mode&lt;br /&gt;
|-&lt;br /&gt;
| h, j, k, l || moves the cursor left, down, up, right.&lt;br /&gt;
|-&lt;br /&gt;
| e || moves cursor to the end of word&lt;br /&gt;
|-&lt;br /&gt;
| b || moves cursor to the beginning of the word&lt;br /&gt;
|-&lt;br /&gt;
| w || moves cursor to first character of next word (type a number before &amp;#039;&amp;#039;w&amp;#039;&amp;#039; to apply multiple times)&lt;br /&gt;
|-&lt;br /&gt;
| f || finds the next occurrence of the string that is entered after &amp;#039;&amp;#039;f&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| * || finds the next occurrence of the word under the cursor&lt;br /&gt;
|-&lt;br /&gt;
| # || finds the previous occurrence of the word under the cursor&lt;br /&gt;
|-&lt;br /&gt;
| / || finds next occurrence of string that matches the given string or regular expression&lt;br /&gt;
|-&lt;br /&gt;
| n || finds the next occurrence of the string searched with &amp;#039;&amp;#039;/&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| N || finds the previous occurrence of the string searched with &amp;#039;&amp;#039;/&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| % || jumps to matching parenthesis (the cursor needs to be over a &amp;#039;&amp;#039;(&amp;#039;&amp;#039;, &amp;#039;&amp;#039;{&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;[&amp;#039;&amp;#039; character)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || moves the cursor to the beginning of the current line&lt;br /&gt;
|-&lt;br /&gt;
| $ || moves the cursor to the end of the current line&lt;br /&gt;
|-&lt;br /&gt;
| gg || moves the cursor to the beginning of the file&lt;br /&gt;
|-&lt;br /&gt;
| G || moves the cursor to the end of the file&lt;br /&gt;
|-&lt;br /&gt;
| :&amp;#039;&amp;#039;n&amp;#039;&amp;#039;  || moves the cursor to the line number &amp;#039;&amp;#039;n&amp;#039;&amp;#039; (entering &amp;#039;&amp;#039;n&amp;#039;&amp;#039;G or &amp;#039;&amp;#039;n&amp;#039;&amp;#039;g works, too)&lt;br /&gt;
|-&lt;br /&gt;
| o || inserts a new line before the current line&lt;br /&gt;
|-&lt;br /&gt;
| O || inserts a new line after the current line&lt;br /&gt;
|-&lt;br /&gt;
| x || deletes the character under the cursor&lt;br /&gt;
|-&lt;br /&gt;
| X || deletes the character left of the cursor&lt;br /&gt;
|-&lt;br /&gt;
| r || replaces the character under the cursor&lt;br /&gt;
|-&lt;br /&gt;
| d || Generic &amp;#039;&amp;#039;&amp;#039;delete&amp;#039;&amp;#039;&amp;#039;. Combine with movement commands to delete desired text. Deleted strings are copied to the pasteboard. &amp;#039;&amp;#039;dw&amp;#039;&amp;#039; deletes the current word, &amp;#039;&amp;#039;d0&amp;#039;&amp;#039; deletes to the beginning of the line, &amp;#039;&amp;#039;d$&amp;#039;&amp;#039; deletes to the end of the line, &amp;#039;&amp;#039;dgg&amp;#039;&amp;#039; deletes to the beginning of the file, &amp;#039;&amp;#039;dG&amp;#039;&amp;#039; deletes to the end of the file.&lt;br /&gt;
|-&lt;br /&gt;
| y || copies selection (&amp;#039;&amp;#039;yy&amp;#039;&amp;#039; or &amp;#039;&amp;#039;Y&amp;#039;&amp;#039; for copying the whole line, &amp;#039;&amp;#039;y&amp;lt;n&amp;gt;y&amp;#039;&amp;#039; for copying n lines) &lt;br /&gt;
|-&lt;br /&gt;
| p || &amp;#039;&amp;#039;&amp;#039;pastes&amp;#039;&amp;#039;&amp;#039; string from pasteboard&lt;br /&gt;
|-&lt;br /&gt;
| . || repeats the previous command&lt;br /&gt;
|-&lt;br /&gt;
| v  || enters &amp;#039;&amp;#039;selection&amp;#039;&amp;#039; (visual) mode, which highlights the selected text (finish by pressing &amp;#039;&amp;#039;d&amp;#039;&amp;#039; to delete, &amp;quot;y&amp;quot; to copy)&lt;br /&gt;
|-&lt;br /&gt;
| u  || undo&lt;br /&gt;
|-&lt;br /&gt;
| CTRL-r  || redo&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Multiview Editing Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| :e &amp;#039;&amp;#039;filename&amp;#039;&amp;#039;  || (also &amp;#039;&amp;#039;:o&amp;#039;&amp;#039;) opens the given file for editing&lt;br /&gt;
|-&lt;br /&gt;
| :split &amp;#039;&amp;#039;filename&amp;#039;&amp;#039;  || splits the screen horizontally and open the given file in the new window.&lt;br /&gt;
|-&lt;br /&gt;
| :sview &amp;#039;&amp;#039;filename&amp;#039;&amp;#039;  || same as &amp;#039;&amp;#039;:split&amp;#039;&amp;#039; but file is read-only.&lt;br /&gt;
|-&lt;br /&gt;
| :vsplit &amp;#039;&amp;#039;filename&amp;#039;  || splits the screen vertically and open the given file in the new window&lt;br /&gt;
|-&lt;br /&gt;
| CTRL-w CTRL-w  || moves cursor to next window.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;n&amp;#039;&amp;#039; CTRL-w+  || increases the vertical size of the current window by &amp;#039;&amp;#039;n&amp;#039;&amp;#039; lines.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;n&amp;#039;&amp;#039; CTRL-w-  || reduces the vertical size of the current window by &amp;#039;&amp;#039;n&amp;#039;&amp;#039; lines.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;n&amp;#039;&amp;#039; CTRL-w&amp;gt;  || increases the horizontal size of the current window by &amp;#039;&amp;#039;n&amp;#039;&amp;#039; lines.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;#039;&amp;#039;n&amp;#039;&amp;#039; CTRL-w&amp;lt;  || reduces the horizontal size of the current window by &amp;#039;&amp;#039;n&amp;#039;&amp;#039; lines.&lt;br /&gt;
|-&lt;br /&gt;
| CTRL-w=  || makes all windows equal size&lt;br /&gt;
|-&lt;br /&gt;
| :hide  || closes the current window.&lt;br /&gt;
|-&lt;br /&gt;
| :only  || closes all windows except the current one.&lt;br /&gt;
|}&lt;br /&gt;
Additional shortcuts are listed at [http://vim.rtorr.com/ vim.rtorr.com].&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== Search &amp;amp; Replace ===&lt;br /&gt;
Type&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:%s/old/new/g&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to search for the string &amp;#039;&amp;#039;old&amp;#039;&amp;#039; in file scope (because of %) and replace occurrences with &amp;#039;&amp;#039;new&amp;#039;&amp;#039;. See [https://www.linux.com/learn/vim-tips-basics-search-and-replace this article] for more options.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syntax Highlighting ===&lt;br /&gt;
In normal mode, you can type&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:syntax on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to enable syntax highlighting and&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:syntax off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to disable it. For permanent syntax highlighting you can add the following line to &amp;#039;&amp;#039;&amp;#039;.vimrc&amp;#039;&amp;#039;&amp;#039; in your home directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
syntax on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== Line Numbers ===&lt;br /&gt;
Turn line numbering on with the command&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:set number&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and off with&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:set nonumber&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make line numbering turned on by default by adding&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
set number&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to &amp;#039;&amp;#039;.vimrc&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
=== Recovery ===&lt;br /&gt;
For each file that is being edited, VIM maintains a recovery file with the extension &amp;#039;&amp;#039;swp&amp;#039;&amp;#039;. If the VIM process dies unexpectedly before the edited file could be saved, editing can be continued from the recovery file. You can instruct VIM to continue editing from the recovery file by starting VIM with the &amp;#039;&amp;#039;-r&amp;#039;&amp;#039; option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;terminal&amp;quot;&amp;gt;&lt;br /&gt;
vim -r MyLastEditedFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Alternatively, when confronted with the message that a recovery file exists for the file that you opened for editing, you can open the file with the command&lt;br /&gt;
&amp;lt;pre class=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
:recover&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or the shorter &amp;#039;&amp;#039;:rec&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kai</name></author>
	</entry>
</feed>