<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vishwa Mittar</title>
    <description>The latest articles on DEV Community by Vishwa Mittar (@vishwasluhana).</description>
    <link>https://dev.to/vishwasluhana</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F718116%2Ffe4eba90-1260-4bc4-bc93-d2f06f6f26a3.jpg</url>
      <title>DEV Community: Vishwa Mittar</title>
      <link>https://dev.to/vishwasluhana</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishwasluhana"/>
    <language>en</language>
    <item>
      <title>VIM - Beginners Guide</title>
      <dc:creator>Vishwa Mittar</dc:creator>
      <pubDate>Sun, 03 Oct 2021 10:58:54 +0000</pubDate>
      <link>https://dev.to/vishwasluhana/vim-beginners-guide-274m</link>
      <guid>https://dev.to/vishwasluhana/vim-beginners-guide-274m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;VIM is a text editor for writing code, where you navigate around the screen with the &lt;strong&gt;Keyboard&lt;/strong&gt; instead of a &lt;strong&gt;Mouse&lt;/strong&gt;.&lt;br&gt;
It is based on original UNIX text editor named &lt;strong&gt;VI&lt;/strong&gt; which came about in 1976 by &lt;em&gt;Bill Joy&lt;/em&gt;. It was later improved by &lt;em&gt;Bram Mooleenar&lt;/em&gt; in 1991 with bunch of improvements and named &lt;strong&gt;VIM&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why VIM?
&lt;/h2&gt;

&lt;p&gt;Why would you use VIM when we have modern IDEs? The answer is, when you write code, your fingers should be bound to keyboard all the time. Every time you touch mouse your work rate is interrupted.&lt;br&gt;
Learning to code with VIM is same as learning something new from scratch, it will be painful at first but that pain will lead you to more precise and productive code editing in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Linux&lt;/strong&gt;/&lt;strong&gt;MacOS&lt;/strong&gt;: VIM comes preinstalled.&lt;br&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: &lt;a href="https://www.vim.org/download.php" rel="noopener noreferrer"&gt;Download VIM&lt;/a&gt;, Download the installer and install it. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Linux&lt;/strong&gt;/&lt;strong&gt;MacOS&lt;/strong&gt;: Type "vim filename.txt" in terminal (without quotations)&lt;br&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: Open "gVim8.1" from desktop or search in start menu.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vim Modes
&lt;/h2&gt;

&lt;p&gt;VIM has many modes, but these four are commonly used:&lt;/p&gt;

&lt;h3&gt;
  
  
  Normal mode
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;If you see cursor thicker or little wide, means you're in normal mode.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Normal mode is Vim's default mode and you'll be using it most of the time. When you are in normal mode you can navigate and perform operations throughout the file.&lt;/p&gt;

&lt;p&gt;You can move cursor between characters, words, lines, sentences, paragraphs. code blocks and more.&lt;/p&gt;

&lt;h4&gt;
  
  
  Characters
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;"h"&lt;/strong&gt; (move left to character)&lt;br&gt;
&lt;strong&gt;"l"&lt;/strong&gt; (move right to character)&lt;/p&gt;

&lt;h4&gt;
  
  
  Words
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;"w"&lt;/strong&gt; (move to next word)&lt;br&gt;
&lt;strong&gt;"e"&lt;/strong&gt; (move the end of current word)&lt;br&gt;
&lt;strong&gt;"b"&lt;/strong&gt; (move back to the previous word)&lt;/p&gt;

&lt;h4&gt;
  
  
  Lines
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;"j"&lt;/strong&gt; (previous line)&lt;br&gt;
&lt;strong&gt;"k"&lt;/strong&gt; (next line)&lt;/p&gt;

&lt;h4&gt;
  
  
  Sentences
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;"("&lt;/strong&gt; (previous sentence)&lt;br&gt;
&lt;strong&gt;")"&lt;/strong&gt; (next sentence)&lt;/p&gt;

&lt;h4&gt;
  
  
  Paragraphs
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;"{"&lt;/strong&gt; (previous Paragraph)&lt;br&gt;
&lt;strong&gt;"}"&lt;/strong&gt; (next Paragraph)&lt;/p&gt;

&lt;p&gt;For simplification:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2g9sh1mf3rotebof7yo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2g9sh1mf3rotebof7yo.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;k&lt;/strong&gt; (up)&lt;br&gt;
&lt;strong&gt;j&lt;/strong&gt; (down)&lt;br&gt;
&lt;strong&gt;h&lt;/strong&gt; (left)&lt;br&gt;
&lt;strong&gt;l&lt;/strong&gt; (right)&lt;br&gt;
You can also use arrow keys to navigate but for best practice you must use (k,j,h,l).&lt;/p&gt;

&lt;h3&gt;
  
  
  Insert mode
&lt;/h3&gt;

&lt;p&gt;Press &lt;strong&gt;i&lt;/strong&gt; key in the normal mode to get into &lt;strong&gt;insert&lt;/strong&gt; mode. &lt;em&gt;The word INSERT will appear at the bottom of the screen.&lt;/em&gt;&lt;br&gt;
You can think of it like &lt;em&gt;edit&lt;/em&gt; mode, because now you can write/delete inside the file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Keys to get into &lt;em&gt;insert&lt;/em&gt; mode:
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Make sure you're in normal mode then press,&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;i&lt;/strong&gt; (insert from the right of the character)&lt;br&gt;
&lt;strong&gt;a&lt;/strong&gt; (insert from the left of the character)&lt;br&gt;
&lt;strong&gt;I&lt;/strong&gt; (insert from the start of the line)&lt;br&gt;
&lt;strong&gt;A&lt;/strong&gt; (insert from the end of the line)&lt;/p&gt;

&lt;p&gt;Once you are done with editing your file, press &lt;strong&gt;Esc&lt;/strong&gt; key to go back to the normal mode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Command mode
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Commands can only be typed in **Normal&lt;/em&gt;* mode.*&lt;br&gt;
When you're in normal mode, you can write commands. Every command starts with &lt;strong&gt;":"&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Basic commands:
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;:w&lt;/strong&gt; (save file)&lt;br&gt;
&lt;strong&gt;:q&lt;/strong&gt; (quit file. &lt;em&gt;but the file must be saved first&lt;/em&gt;)&lt;br&gt;
&lt;strong&gt;:wq&lt;/strong&gt; (save and quit)&lt;br&gt;
&lt;strong&gt;:q!&lt;/strong&gt; (quit without saving)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;There are many more commands, but these are the common and you'll need these all the time.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Visual mode
&lt;/h3&gt;

&lt;p&gt;When editing text with Vim, visual mode can be extremely useful for identifying chunks of text to be manipulated.&lt;/p&gt;

&lt;p&gt;Press the &lt;strong&gt;v&lt;/strong&gt; key to enter &lt;strong&gt;visual&lt;/strong&gt; mode. &lt;em&gt;The word VISUAL will appear at the bottom of the screen.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Use the Arrow keys to highlight the desired text. You can use other navigation commands, such as &lt;strong&gt;w&lt;/strong&gt; to highlight to the beginning of the next word or &lt;strong&gt;$&lt;/strong&gt; to include the rest of the line.&lt;br&gt;
Once the text is highlighted, press the &lt;strong&gt;d&lt;/strong&gt; key to delete/cut the text.&lt;br&gt;
If you deleted too much or not enough, press &lt;strong&gt;u&lt;/strong&gt; to undo and start again.&lt;br&gt;
Move your cursor to the new location and press &lt;strong&gt;p&lt;/strong&gt; to paste the text.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tips and tricks
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;To go forward 3 words, instead of &lt;strong&gt;www&lt;/strong&gt;, we can do &lt;strong&gt;3w&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To go down 10 lines, instead of &lt;strong&gt;jjjjjjjjjj&lt;/strong&gt;, we can do &lt;em&gt;10j&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;dw&lt;/strong&gt; to delete a word.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;dd&lt;/strong&gt; to delete the entire line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;x&lt;/strong&gt; to delete a character.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;r&lt;/strong&gt; followed by new character to replace a character.&lt;/li&gt;
&lt;li&gt;To switch back to normal mode from any mode, press &lt;strong&gt;Esc&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There's still a lot to learn. Keep exploring. Happy coding.&lt;/p&gt;

&lt;p&gt;If you learnt something from this article, please like, comment and share.&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://www.instagram.com/vishwas_luhana" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;.&lt;br&gt;
Follow me on &lt;a href="https://www.facebook.com/luhanavishwas" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;.&lt;br&gt;
Follow me on &lt;a href="https://twitter.com/vixvos" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>vim</category>
      <category>programming</category>
      <category>linux</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
