<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vim on Pratham Dupare</title><link>https://heypratham.in/tags/vim/</link><description>Recent content in Vim on Pratham Dupare</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 08 Dec 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://heypratham.in/tags/vim/index.xml" rel="self" type="application/rss+xml"/><item><title>Top 10 essential Vim Tricks</title><link>https://heypratham.in/write/top-10-vim-tricks/</link><pubDate>Sun, 08 Dec 2024 00:00:00 +0000</pubDate><guid>https://heypratham.in/write/top-10-vim-tricks/</guid><description>&lt;h3 id="1-jump-to-matching-parentheses-or-braces"&gt;1. Jump to Matching Parentheses or Braces&lt;/h3&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;function matchingBraces() {&#10; if (true) {&#10; console.log(&amp;#34;Jump between these braces using %&amp;#34;);&#10; }&#10;}&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="2-visual-block-editing"&gt;2. Visual Block Editing&lt;/h3&gt;&#10;&lt;h4 id="use-c-v-to-select-a-block-of-text-and-edit-all-rows-simultaneously"&gt;Use &lt;code&gt;&amp;lt;C-v&amp;gt;&lt;/code&gt; to select a block of text and edit all rows simultaneously.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const ock1 = &amp;#34;Edit me!&amp;#34;;&#10;const ock2 = &amp;#34;Edit me!&amp;#34;;&#10;const ock3 = &amp;#34;Edit me!&amp;#34;;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="3-move-by-search-history"&gt;3. Move by Search History&lt;/h3&gt;&#10;&lt;h4 id="use-log-to-search-for-log-then-press-n-to-move-to-the-next-match-and-n-for-the-previous-match"&gt;Use &lt;code&gt;/log&lt;/code&gt; to search for &amp;ldquo;log&amp;rdquo;, then press &lt;code&gt;n&lt;/code&gt; to move to the next match and &lt;code&gt;N&lt;/code&gt; for the previous match.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;console.log(&amp;#34;Search for this log statement.&amp;#34;);&#10;console.log(&amp;#34;Another log statement.&amp;#34;);&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="4-try-ci-or-di-to-modify-or-delete-the-text-inside-these-quotes"&gt;4. Try &lt;code&gt;ci&amp;quot;&lt;/code&gt; or &lt;code&gt;di&amp;quot;&lt;/code&gt; to modify or delete the text inside these quotes.&lt;/h3&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const greeting = &amp;#34;Change or delete this text.&amp;#34;;&#10;const foo = () =&amp;gt; {&#10;console.log(&amp;#34;Vim is awesome&amp;#34;);&#10;};&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="5-repeat-the-last-command"&gt;5. Repeat the Last Command&lt;/h3&gt;&#10;&lt;h4 id="delete-this-line-using-dd-then-press--on-the-next-line-to-repeat-the-delete"&gt;Delete this line using &lt;code&gt;dd&lt;/code&gt;, then press &lt;code&gt;.&lt;/code&gt; on the next line to repeat the delete.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const repeatCommand = &amp;#34;Repeat this delete.&amp;#34;;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="6-replace-text-globally"&gt;6. Replace Text Globally&lt;/h3&gt;&#10;&lt;h4 id="use-soldnewg-to-replace-all-instances-of-old-with-new"&gt;Use &lt;code&gt;:%s/old/new/g&lt;/code&gt; to replace all instances of &amp;ldquo;old&amp;rdquo; with &amp;ldquo;new&amp;rdquo;.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const oldVariable = &amp;#34;Replace all &amp;#39;old&amp;#39; instances.&amp;#34;;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="7-swap-two-lines"&gt;7. Swap Two Lines&lt;/h3&gt;&#10;&lt;h4 id="use-ddp-to-swap-this-line"&gt;Use &lt;code&gt;ddp&lt;/code&gt; to swap this line&amp;hellip;&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;console.log(&amp;#34;This line should be swapped below...&amp;#34;);&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="8-incrementdecrement-numbers"&gt;8. Increment/Decrement Numbers&lt;/h3&gt;&#10;&lt;h4 id="place-your-cursor-on-the-numbers-below-and-press-c-a-to-increment-or-c-x-to-decrement"&gt;Place your cursor on the numbers below and press &lt;code&gt;&amp;lt;C-a&amp;gt;&lt;/code&gt; to increment or &lt;code&gt;&amp;lt;C-x&amp;gt;&lt;/code&gt; to decrement.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;let number = 40; // Increment or decrement this number.&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="9-reformat-code"&gt;9. Reformat Code&lt;/h3&gt;&#10;&lt;h4 id="select-this-block-of-code-and-press--to-auto-indent-it"&gt;Select this block of code and press &lt;code&gt;=&lt;/code&gt; to auto-indent it.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;function messyCode() {&#10;const foo = &amp;#34;fjkdj&amp;#34;;&#10;}&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="10-toggle-case"&gt;10. Toggle Case&lt;/h3&gt;&#10;&lt;h4 id="place-your-cursor-on-the-text-below-and-press--to-toggle-its-case"&gt;Place your cursor on the text below and press &lt;code&gt;~&lt;/code&gt; to toggle its case.&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;const caseToggle = &amp;#34;Toggle This Case.&amp;#34;;&#10;&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>