<?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 Cheat Sheet</title><link>/tags/vim/</link><description>Recent content in Vim on Cheat Sheet</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 26 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="/tags/vim/index.xml" rel="self" type="application/rss+xml"/><item><title>Marks</title><link>/dotfiles/vim/tips/marks/</link><pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/tips/marks/</guid><description>&lt;h1 id="marks"&gt;Marks&lt;a class="anchor" href="#marks"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Based on &lt;em&gt;Practical Vim, 2nd ed.&lt;/em&gt; Tip 54 (Mark Your Place and Snap Back to It.)&lt;/p&gt;
&lt;h3 id="setting-marks"&gt;Setting Marks&lt;a class="anchor" href="#setting-marks"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;m[a-zA-Z]&lt;/code&gt;: Set a mark
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[a-z]&lt;/code&gt;: Local to the current buffer&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[A-Z]&lt;/code&gt;: Global across files&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="jumping-to-marks"&gt;Jumping to Marks&lt;a class="anchor" href="#jumping-to-marks"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;'&amp;lt;mark&amp;gt;&lt;/code&gt;: Move to the line where a mark was set (first non-whitespace character)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;`&amp;lt;mark&amp;gt;&lt;/code&gt;: Move to the exact position (line and column) where a mark was set&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="listing-marks"&gt;Listing Marks&lt;a class="anchor" href="#listing-marks"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:marks&lt;/code&gt;: List all current marks&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:marks &amp;lt;arg&amp;gt;&lt;/code&gt;: List marks specified in &lt;code&gt;&amp;lt;arg&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>auto-pairs</title><link>/dotfiles/vim/plugin/auto-pairs/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/plugin/auto-pairs/</guid><description>&lt;h1 id="auto-pairs"&gt;&lt;code&gt;auto-pairs&lt;/code&gt;&lt;a class="anchor" href="#auto-pairs"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/jiangmiao/auto-pairs"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="description"&gt;Description&lt;a class="anchor" href="#description"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Insert or delete brackets, parens, and quotes in pairs.&lt;/p&gt;
&lt;h3 id="main-usage"&gt;Main Usage&lt;a class="anchor" href="#main-usage"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Insert&lt;/strong&gt;: Type an opening bracket &lt;code&gt;(&lt;/code&gt;, &lt;code&gt;[&lt;/code&gt;, &lt;code&gt;{&lt;/code&gt; or quote &lt;code&gt;&amp;quot;&lt;/code&gt;, &lt;code&gt;'&lt;/code&gt; to automatically insert the closing one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delete&lt;/strong&gt;: Delete an opening bracket to automatically delete the closing one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;New line&lt;/strong&gt;: Press &lt;code&gt;Enter&lt;/code&gt; inside a pair to move the closing bracket to a new line.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>vim-commentary</title><link>/dotfiles/vim/plugin/vim-commentary/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/plugin/vim-commentary/</guid><description>&lt;h1 id="vim-commentary"&gt;&lt;code&gt;vim-commentary&lt;/code&gt;&lt;a class="anchor" href="#vim-commentary"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/tpope/vim-commentary"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="description"&gt;Description&lt;a class="anchor" href="#description"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Comment out code easily using motions.&lt;/p&gt;
&lt;h3 id="main-usage"&gt;Main Usage&lt;a class="anchor" href="#main-usage"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;gcc&lt;/code&gt;&lt;/strong&gt;: Comment or uncomment the current line.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;gc&amp;lt;motion&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Comment or uncomment lines matching a motion (eg. &lt;code&gt;gcap&lt;/code&gt; for a paragraph).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;gc&lt;/code&gt; (Visual Mode)&lt;/strong&gt;: Comment or uncomment the selection.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>vim-easymotion</title><link>/dotfiles/vim/plugin/vim-easymotion/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/plugin/vim-easymotion/</guid><description>&lt;h1 id="vim-easymotion"&gt;&lt;code&gt;vim-easymotion&lt;/code&gt;&lt;a class="anchor" href="#vim-easymotion"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/easymotion/vim-easymotion"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="description"&gt;Description&lt;a class="anchor" href="#description"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Provides a simpler way to use motions by highlighting potential targets.&lt;/p&gt;
&lt;p&gt;The default mapping prefix &lt;code&gt;&amp;lt;leader&amp;gt;&amp;lt;leader&amp;gt;&lt;/code&gt; is changed to &lt;code&gt;&amp;lt;Space&amp;gt;&lt;/code&gt; in &lt;a href="../../dotfiles/vim/vimrc/"&gt;vimrc&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#cf222e"&gt;map&lt;/span&gt; &lt;span style="color:#1f2328"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#1f2328"&gt;Space&lt;/span&gt;&lt;span style="color:#1f2328"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#1f2328"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#1f2328"&gt;Plug&lt;/span&gt;&lt;span style="color:#1f2328"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="color:#1f2328"&gt;easymotion&lt;/span&gt;&lt;span style="color:#1f2328"&gt;-&lt;/span&gt;&lt;span style="color:#1f2328"&gt;prefix&lt;/span&gt;&lt;span style="color:#1f2328"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="main-usage"&gt;Main Usage&lt;a class="anchor" href="#main-usage"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;Space&amp;gt;w&lt;/code&gt;&lt;/strong&gt;: Jump to the beginning of a word forward.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;Space&amp;gt;b&lt;/code&gt;&lt;/strong&gt;: Jump to the beginning of a word backward.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;Space&amp;gt;f&amp;lt;char&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Jump to the specified &lt;code&gt;&amp;lt;char&amp;gt;&lt;/code&gt; forward.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;Space&amp;gt;s&amp;lt;char&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Search and jump to &lt;code&gt;&amp;lt;char&amp;gt;&lt;/code&gt; in the entire window.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>vim-surround</title><link>/dotfiles/vim/plugin/vim-surround/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/plugin/vim-surround/</guid><description>&lt;h1 id="vim-surround"&gt;&lt;code&gt;vim-surround&lt;/code&gt;&lt;a class="anchor" href="#vim-surround"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/tpope/vim-surround"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="description"&gt;Description&lt;a class="anchor" href="#description"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Manage surrounding characters like quotes, brackets, and HTML tags.&lt;/p&gt;
&lt;h3 id="main-usage"&gt;Main Usage&lt;a class="anchor" href="#main-usage"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;cs&amp;lt;old&amp;gt;&amp;lt;new&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Change surrounding &lt;code&gt;&amp;lt;old&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;new&amp;gt;&lt;/code&gt; (eg. &lt;code&gt;cs&amp;quot;'&lt;/code&gt; to change double quotes to single).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ds&amp;lt;char&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Delete surrounding &lt;code&gt;&amp;lt;char&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ys&amp;lt;motion&amp;gt;&amp;lt;char&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Add surrounding &lt;code&gt;&amp;lt;char&amp;gt;&lt;/code&gt; to the target motion (eg. &lt;code&gt;ysiw&amp;quot;&lt;/code&gt; to surround a word with double quotes).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;S&amp;lt;char&amp;gt;&lt;/code&gt; (Visual Mode)&lt;/strong&gt;: Surround selection with &lt;code&gt;&amp;lt;char&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>vimrc</title><link>/dotfiles/vim/vimrc/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/dotfiles/vim/vimrc/</guid><description>&lt;h1 id="vimrc"&gt;~/.vimrc&lt;a class="anchor" href="#vimrc"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/Jssim710/dotfiles/blob/main/2-vim/.vimrc"&gt;GitHub&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="configuration-details"&gt;Configuration Details&lt;a class="anchor" href="#configuration-details"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="general-settings"&gt;General Settings&lt;a class="anchor" href="#general-settings"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Syntax &amp;amp; Indentation:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;syntax on&lt;/code&gt;: Enables syntax highlighting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;filetype plugin indent on&lt;/code&gt;: Loads filetype-specific indent files.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;set expandtab&lt;/code&gt;, &lt;code&gt;set shiftwidth=2&lt;/code&gt;, &lt;code&gt;set tabstop=2&lt;/code&gt;: Standardizes indentation to 2 spaces.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI &amp;amp; Feedback:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;set number&lt;/code&gt;: Displays line numbers for easier navigation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;set showmatch&lt;/code&gt;: Briefly jumps to the matching bracket when one is inserted.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;set list&lt;/code&gt;: Visualizes tabs and trailing spaces using &lt;code&gt;listchars&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;set scrolloff=5&lt;/code&gt;: Ensures context is always visible around the cursor.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Behavior:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;set nohlsearch&lt;/code&gt;: Prevents persistent highlighting after a search.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;set nobackup&lt;/code&gt;: Disables the creation of backup files.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="mappings"&gt;Mappings&lt;a class="anchor" href="#mappings"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nnoremap &amp;lt;C-b&amp;gt; &amp;lt;C-w&amp;gt;&lt;/code&gt;: Maps &lt;code&gt;Ctrl+b&lt;/code&gt; to window commands (&lt;code&gt;Ctrl+w&lt;/code&gt;). This bypasses the browser&amp;rsquo;s default behavior of closing the window when &lt;code&gt;Ctrl+w&lt;/code&gt; is pressed in web-based IDEs like Code-server. This can be commented out if not using a web-based environment.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;map &amp;lt;Space&amp;gt; &amp;lt;Plug&amp;gt;(easymotion-prefix)&lt;/code&gt;: Uses the &lt;code&gt;Space&lt;/code&gt; key as the trigger for EasyMotion.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="plugins"&gt;Plugins&lt;a class="anchor" href="#plugins"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Managed via &lt;strong&gt;vim-plug&lt;/strong&gt;. See &lt;a href="../../dotfiles/vim/plugin/"&gt;Plugin&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>set -o vi</title><link>/linux/shell/bash-vi-mode/</link><pubDate>Sun, 24 May 2026 00:00:00 +0000</pubDate><guid>/linux/shell/bash-vi-mode/</guid><description>&lt;h1 id="set--o-vi"&gt;&lt;code&gt;set -o vi&lt;/code&gt;&lt;a class="anchor" href="#set--o-vi"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;You can use &lt;code&gt;vim&lt;/code&gt; keybindings in Bash to edit commands.&lt;/p&gt;
&lt;h3 id="configuration"&gt;Configuration&lt;a class="anchor" href="#configuration"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Add the following to your &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#6639ba"&gt;set&lt;/span&gt; -o vi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="motivation"&gt;Motivation&lt;a class="anchor" href="#motivation"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For &lt;code&gt;vi&lt;/code&gt; users, leveraging editor muscle memory with commands like &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;dB&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt;, and &lt;code&gt;b&lt;/code&gt; is more intuitive than memorizing shell-native shortcuts like &lt;code&gt;Ctrl+h&lt;/code&gt;, &lt;code&gt;Ctrl+w&lt;/code&gt;, &lt;code&gt;Alt+f&lt;/code&gt;, and &lt;code&gt;Alt+b&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="key-features-and-tips"&gt;Key Features and Tips&lt;a class="anchor" href="#key-features-and-tips"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Movement:&lt;/strong&gt; Supports &lt;code&gt;w&lt;/code&gt;, &lt;code&gt;W&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; (words) and &lt;code&gt;f&lt;/code&gt;, &lt;code&gt;F&lt;/code&gt;, &lt;code&gt;t&lt;/code&gt;, &lt;code&gt;T&lt;/code&gt; (character search).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;History Search:&lt;/strong&gt; In Normal mode, press &lt;code&gt;/&lt;/code&gt; to search your command history.
&lt;ul&gt;
&lt;li&gt;eg. Typing &lt;code&gt;/^kubectl&lt;/code&gt; finds recent &lt;code&gt;kubectl&lt;/code&gt; commands. Use &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;N&lt;/code&gt; to navigate results.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open in Editor (&lt;code&gt;v&lt;/code&gt;):&lt;/strong&gt; Pressing &lt;code&gt;v&lt;/code&gt; in Normal mode opens the current command in the editor defined by &lt;code&gt;&amp;lt;editor&amp;gt;&lt;/code&gt; (eg. &lt;code&gt;vim&lt;/code&gt;). Saving and exiting (&lt;code&gt;:wq&lt;/code&gt;) will execute the command immediately. This is extremely useful for complex multi-line or long commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="limitations"&gt;Limitations&lt;a class="anchor" href="#limitations"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In-line search using &lt;code&gt;/&lt;/code&gt; is not supported (it is mapped to history search); use &lt;code&gt;f&lt;/code&gt;, &lt;code&gt;t&lt;/code&gt;, etc., instead.&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>