<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet type="text/xsl" href="https://perrotta.dev/rss.xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vim on ¬ just serendipity 🍀</title>
    <link>https://perrotta.dev/</link>
    <description>Recent content in Vim on ¬ just serendipity 🍀</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <managingEditor>serendipity@perrotta.dev (Thiago Perrotta)</managingEditor>
    <webMaster>serendipity@perrotta.dev (Thiago Perrotta)</webMaster>
    <copyright>© 2013 - 2026 Thiago Perrotta ·
  a fork of [hugo ʕ•ᴥ•ʔ bear](https://github.com/janraasch/hugo-bearblog/)
</copyright>
    <lastBuildDate>Sun, 22 Feb 2026 00:17:24 +0100</lastBuildDate>
    <atom:link href="https://perrotta.dev/tags/vim/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>★ neovim: inline git hunk control
      </title>
      <link>https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/</link>
      <pubDate>Sat, 03 Jan 2026 15:41:21 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>bestof</category>
      <category>dev</category>
      <category>git</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/</guid>
      <description>&lt;p&gt;♠ What is a&#xA;&lt;a href=&#34;https://stackoverflow.com/questions/37620729/in-the-context-of-git-and-diff-what-is-a-hunk&#34;&gt;hunk&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When comparing two files, diff finds sequences of lines common to both files,&#xA;interspersed with groups of differing lines called hunks&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There are various ways to treat git hunks as first-class citizens, manipulating&#xA;them one at a time – staging, unstaging, or reverting them.&lt;/p&gt;&#xA;&lt;p&gt;The classic one is &lt;a href=&#34;https://millerb.co.uk/2021/11/16/git-add-patch.html&#34;&gt;&lt;code&gt;git add [-p | --patch]&lt;/code&gt;&lt;/a&gt;. Hit yes or no&#xA;for each hunk, one by one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;% git add -p&#xA;diff --git a/Justfile b/Justfile&#xA;index bbb3779a9..70840a008 100755&#xA;--- a/Justfile&#xA;&amp;#43;&amp;#43;&amp;#43; b/Justfile&#xA;@@ -175,3 &amp;#43;175,6 @@ update-pre-commit:&#xA; # Update JSON schemas&#xA; update-json-schemas:&#xA;     pre-commit run -a update-json-schemas --hook-stage manual&#xA;&amp;#43;&#xA;&amp;#43;hello:&#xA;&amp;#43;    echo world&#xA;(1/1) Stage this hunk [y,n,q,a,d,e,p,P,?]?&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There&amp;rsquo;s also &lt;a href=&#34;https://nuclearsquid.com/writings/git-add/&#34;&gt;&lt;code&gt;git add [-i | --interactive]&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;% git add -i&#xA;&#xA;*** Commands ***&#xA;  1: status       2: update       3: revert       4: add untracked&#xA;  5: patch        6: diff         7: quit         8: help&#xA;What now&amp;gt;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It&amp;rsquo;s also possible to manage hunks via git TUIs (=from the terminal) such as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/gitui-org/gitui&#34;&gt;gitui&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/jonas/tig&#34;&gt;tig&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/jesseduffield/lazygit&#34;&gt;lazygit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&amp;hellip;or graphically with IDEs with as VSCode.&lt;/p&gt;&#xA;&lt;p&gt;An honorable mention also goes to&#xA;&lt;a href=&#34;https://github.com/andrewshadura/git-crecord&#34;&gt;&lt;code&gt;git-crecord&lt;/code&gt;&lt;/a&gt;, which I&#xA;originally discovered by looking for an open source alternative to Google&amp;rsquo;s&#xA;Fig&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt; interactive commit and split commands.&lt;/p&gt;&#xA;&lt;p&gt;Now that you see how my mind is overloaded with many possibilities to manipulate&#xA;git hunks, the natural follow-up question is: how to do so right from within our&#xA;favorite text editor (&lt;code&gt;vim&lt;/code&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;With classic &lt;code&gt;vim&lt;/code&gt;, Tim Pope&amp;rsquo;s&#xA;&lt;a href=&#34;https://github.com/tpope/vim-fugitive&#34;&gt;&lt;code&gt;vim-fugitive&lt;/code&gt;&lt;/a&gt; is often touted as&#xA;best-in-class (paired with&#xA;&lt;a href=&#34;https://github.com/airblade/vim-gitgutter&#34;&gt;&lt;code&gt;vim-gitgutter&lt;/code&gt;&lt;/a&gt;). I use it&#xA;occasionally. The workflow is as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;From an open file with modifications, run &lt;code&gt;:GDiff&lt;/code&gt; (&lt;code&gt;:GDiffsplit&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Proceed as you normally would in &lt;code&gt;vimdiff&lt;/code&gt;. Use &lt;code&gt;:diffget&lt;/code&gt; (&lt;code&gt;do&lt;/code&gt;) and&#xA;&lt;code&gt;:diffput&lt;/code&gt; (&lt;code&gt;dp&lt;/code&gt;) for each hunk. Use &lt;code&gt;[c&lt;/code&gt; and &lt;code&gt;]c&lt;/code&gt; to navigate to the previous&#xA;/ next hunk.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Finally, we get to the meat of the post. Is there any workflow&#xA;improvement in &lt;code&gt;neovim&lt;/code&gt;, which I have recently &lt;a href=&#34;https://perrotta.dev/2025/12/vim-nvim/&#34;&gt;switched to&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;First of all, the familiar vim-fugitive workflow still works there.&lt;/p&gt;&#xA;&lt;p&gt;Its evolution is &lt;a href=&#34;https://github.com/lewis6991/gitsigns.nvim&#34;&gt;gitsigns.nvim&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Git integration for buffers&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Given the config below, the following becomes possible:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-lua&#34;&gt;-- Git integration&#xA;{&#xA;&amp;#39;lewis6991/gitsigns.nvim&amp;#39;,&#xA;config = function()&#xA;  require(&amp;#39;gitsigns&amp;#39;).setup({&#xA;    on_attach = function(bufnr)&#xA;      local gs = require(&amp;#39;gitsigns&amp;#39;)&#xA;      -- ]c / [c: next/prev hunk (falls back to default in diff mode)&#xA;      -- like git-gutter in vim&#xA;      vim.keymap.set(&amp;#39;n&amp;#39;, &amp;#39;]c&amp;#39;, function()&#xA;        if vim.wo.diff then return &amp;#39;]c&amp;#39; end&#xA;        vim.schedule(function() gs.nav_hunk(&amp;#39;next&amp;#39;) end)&#xA;        return &amp;#39;&amp;lt;Ignore&amp;gt;&amp;#39;&#xA;      end, { expr = true, buffer = bufnr, desc = &amp;#39;Next hunk&amp;#39; })&#xA;      vim.keymap.set(&amp;#39;n&amp;#39;, &amp;#39;[c&amp;#39;, function()&#xA;        if vim.wo.diff then return &amp;#39;[c&amp;#39; end&#xA;        vim.schedule(function() gs.nav_hunk(&amp;#39;prev&amp;#39;) end)&#xA;        return &amp;#39;&amp;lt;Ignore&amp;gt;&amp;#39;&#xA;      end, { expr = true, buffer = bufnr, desc = &amp;#39;Prev hunk&amp;#39; })&#xA;      vim.keymap.set(&amp;#39;n&amp;#39;, &amp;#39;&amp;lt;leader&amp;gt;s&amp;#39;, gs.stage_hunk, { buffer = bufnr, desc = &amp;#39;Stage hunk&amp;#39; })&#xA;      vim.keymap.set(&amp;#39;n&amp;#39;, &amp;#39;&amp;lt;leader&amp;gt;u&amp;#39;, gs.reset_hunk, { buffer = bufnr, desc = &amp;#39;Reset hunk&amp;#39; })&#xA;    end,&#xA;  })&#xA;end,&#xA;},&#xA;&amp;#39;tpope/vim-fugitive&amp;#39;,&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use &lt;code&gt;]c&lt;/code&gt; and &lt;code&gt;[c&lt;/code&gt; to navigate hunks (compatible with vim-gitgutter)&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;&amp;lt;leader&amp;gt;s&lt;/code&gt; (comma + s in my setup) to toggle staging/unstaging hunks.&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;&amp;lt;leader&amp;gt;u&lt;/code&gt; to do the equivalent of &lt;code&gt;git checkout -- file&lt;/code&gt; for a single&#xA;hunk.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The last two shortcuts are wherein the magic lives.&lt;/p&gt;&#xA;&lt;p&gt;It is VERY convenient to choose what to stage/unstage/revert right from the&#xA;&lt;code&gt;nvim&lt;/code&gt; buffer I am currently editing. For fine-grained control, I can always use&#xA;&lt;code&gt;:Gdiff&lt;/code&gt; to perform hunk microsurgery.&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;Not to confound with &lt;em&gt;hook&lt;/em&gt;.&amp;#160;&lt;a href=&#34;https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li id=&#34;fn:2&#34;&gt;&#xA;&lt;p&gt;Internal mercurial VCS porcelain on top of Piper / google3.&amp;#160;&lt;a href=&#34;https://perrotta.dev/2026/01/neovim-inline-git-hunk-control/#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: neovim: inline git hunk control&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/bestof/&#34;&gt;#bestof&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/git/&#34;&gt;#git&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>★ vim → nvim
      </title>
      <link>https://perrotta.dev/2025/12/vim-nvim/</link>
      <pubDate>Tue, 23 Dec 2025 12:14:33 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>bestof</category>
      <category>dev</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/12/vim-nvim/</guid>
      <description>&lt;p&gt;♠ I am piloting a transition from &lt;code&gt;vim&lt;/code&gt; to &lt;code&gt;nvim&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the least disruptive way I found to accomplish that.&lt;/p&gt;&#xA;&lt;p&gt;First, install &lt;code&gt;neovim&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;brew install neovim&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, create &lt;code&gt;~/.config/nvim/init.lua&lt;/code&gt;. I decided to populate it based on my&#xA;original&#xA;&lt;a href=&#34;https://github.com/thiagowfx/.dotfiles/blob/master/vim/.vim/vimrc&#34;&gt;&lt;code&gt;~/.vimrc&lt;/code&gt;&lt;/a&gt;,&#xA;without attempting to share configuration settings between the two.&lt;/p&gt;&#xA;&lt;p&gt;Multiple iterations with a LLM agent helped it achieve a decent shape, removing&#xA;redundant settings and replacing some native VimL plugins with Lua ones.&lt;/p&gt;&#xA;&lt;p&gt;The result:&#xA;&lt;a href=&#34;https://github.com/thiagowfx/.dotfiles/blob/master/nvim/.config/nvim/init.lua&#34;&gt;&lt;code&gt;init.lua&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Some notable changes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;switch the package manager from vim-plug to lazy.nvim&lt;/li&gt;&#xA;&lt;li&gt;remove vim-sensible&lt;/li&gt;&#xA;&lt;li&gt;rewrite &lt;code&gt;just_one_space&lt;/code&gt; in Lua&lt;/li&gt;&#xA;&lt;li&gt;use nvim native OSC52 for yanking text&lt;/li&gt;&#xA;&lt;li&gt;vim-signify -&amp;gt; gitsigns&lt;/li&gt;&#xA;&lt;li&gt;add autopairs&lt;/li&gt;&#xA;&lt;li&gt;add telescope (fuzzy finder), replace fzf&lt;/li&gt;&#xA;&lt;li&gt;add oil (file manager), incorporates some functionality of &lt;code&gt;vidir&lt;/code&gt; from&#xA;&lt;code&gt;moreutils&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;remove vim-commentary, given native support for &lt;code&gt;gc&lt;/code&gt; in neovim&lt;/li&gt;&#xA;&lt;li&gt;lightline -&amp;gt; lualine&lt;/li&gt;&#xA;&lt;li&gt;highlight yanked text natively, replace vim-highlightedyank&lt;/li&gt;&#xA;&lt;li&gt;automkdir upon saving a file whose parent directory does not exist, replace&#xA;vim-mkdir&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now make it frictionless to use &lt;code&gt;nvim&lt;/code&gt; instead of &lt;code&gt;vim&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-diff&#34;&gt;commit 058433b9503477c8c162cac5eba191c704cb9361&#xA;Author: Thiago Perrotta &amp;lt;{redacted}&amp;gt;&#xA;Date:   Tue Dec 23 12:13:54 2025 -0300&#xA;&#xA;    nvim&#xA;&#xA;diff --git profile/.profile.d/env.sh profile/.profile.d/env.sh&#xA;index 1c6507e..c6117a9 100644&#xA;--- profile/.profile.d/env.sh&#xA;&amp;#43;&amp;#43;&amp;#43; profile/.profile.d/env.sh&#xA;@@ -10,4 &amp;#43;10,6 @@ path_munge &amp;#34;$HOME/.bin&amp;#34; &amp;#34;$HOME/bin&amp;#34; &amp;#34;$HOME/.local/bin&amp;#34;&#xA; export CLICOLOR=1&#xA;&#xA; # Set preferred text editor.&#xA;&amp;#43;# nvim should be preferred to vim if it is installed.&#xA; hash vim &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; export EDITOR=&amp;#34;vim&amp;#34; VISUAL=&amp;#34;vim&amp;#34;&#xA;&amp;#43;hash nvim &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; export EDITOR=&amp;#34;nvim&amp;#34; VISUAL=&amp;#34;nvim&amp;#34; &amp;amp;&amp;amp; alias vim=nvim&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can still access &lt;code&gt;vim&lt;/code&gt; with &lt;code&gt;\vim&lt;/code&gt; (or &lt;code&gt;unalias vim&lt;/code&gt; if needed).&lt;/p&gt;&#xA;&lt;p&gt;Now let&amp;rsquo;s evaluate whether the &lt;code&gt;nvim&lt;/code&gt; switch is worth it.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim → nvim&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/bestof/&#34;&gt;#bestof&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>j,k for navigation
      </title>
      <link>https://perrotta.dev/2025/12/jk-for-navigation/</link>
      <pubDate>Sun, 21 Dec 2025 02:31:10 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>meta</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/12/jk-for-navigation/</guid>
      <description>&lt;p&gt;♠ I just added vim-style keybindings to this site.&lt;/p&gt;&#xA;&lt;p&gt;Press &lt;strong&gt;j&lt;/strong&gt; to go to the previous post (chronologically, going down the list ⬇️)&#xA;and &lt;strong&gt;k&lt;/strong&gt; to go to the next post (going up the list ⬆️)&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://perrotta.dev/2025/12/jk-for-navigation/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The boundary between &lt;em&gt;general&lt;/em&gt; vs &lt;em&gt;coding&lt;/em&gt; posts is respected.&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;I also added arrow keys (⬅️ for the previous post and ➡️ right for the next&#xA;one).&amp;#160;&lt;a href=&#34;https://perrotta.dev/2025/12/jk-for-navigation/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: j,k for navigation&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/meta/&#34;&gt;#meta&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>vim: spellchecker suggestions
      </title>
      <link>https://perrotta.dev/2025/11/vim-spellchecker-suggestions/</link>
      <pubDate>Sun, 02 Nov 2025 11:37:57 +0100</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/11/vim-spellchecker-suggestions/</guid>
      <description>&lt;p&gt;♠ &lt;a href=&#34;https://perrotta.dev/2025/07/vim-add-word-to-spellchecker/&#34;&gt;Previously&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When you have the spellchecker from &lt;code&gt;vim&lt;/code&gt; turned on (&lt;code&gt;:set spell&lt;/code&gt;), it&#xA;highlights words that are not in the dictionary.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It turns out &lt;code&gt;vim&lt;/code&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://perrotta.dev/2025/11/vim-spellchecker-suggestions/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; can also suggest corrections to these words.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;:h z=&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;z=   For the word under/after the cursor suggest correctly&#xA;     spelled words.  This also works to find alternatives&#xA;     for a word that is not highlighted as a bad word,&#xA;     e.g., when the word after it is bad.&#xA;     In Visual mode the highlighted text is taken as the&#xA;     word to be replaced.&#xA;     The results are sorted on similarity to the word being&#xA;     replaced.&#xA;     This may take a long time.  Hit CTRL-C when you get&#xA;     bored.&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For example: take the word &lt;code&gt;exampl&lt;/code&gt;. When pressing &lt;code&gt;z=&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;Change &amp;#34;exampl&amp;#34; to:&#xA; 1 &amp;#34;example&amp;#34;&#xA; 2 &amp;#34;example&amp;#34; &amp;lt; &amp;#34;exampl.&amp;#34;&#xA; 3 &amp;#34;exam pl&amp;#34;&#xA; 4 &amp;#34;exempt&amp;#34;&#xA; 5 &amp;#34;exam Pl&amp;#34;&#xA; 6 &amp;#34;exam&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Upon pressing &lt;code&gt;1&amp;lt;Enter&amp;gt;&lt;/code&gt; it is automatically replaced.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively we can skip the suggestions and simply &lt;a href=&#34;https://www.jakeworth.com/tils/select-first-spell-suggestion/&#34;&gt;pick the first&#xA;one&lt;/a&gt; right away&#xA;with &lt;code&gt;1z=&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;&lt;code&gt;vim&lt;/code&gt; never ceases to amaze me.&amp;#160;&lt;a href=&#34;https://perrotta.dev/2025/11/vim-spellchecker-suggestions/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim: spellchecker suggestions&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>vim: reflow current paragraph
      </title>
      <link>https://perrotta.dev/2025/10/vim-reflow-current-paragraph/</link>
      <pubDate>Wed, 08 Oct 2025 18:03:57 +0200</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/10/vim-reflow-current-paragraph/</guid>
      <description>&lt;p&gt;♠ &lt;strong&gt;Problem statement&lt;/strong&gt;: Given a paragraph (&lt;code&gt;lorem_ipsum.txt&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;&amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Reflow it in such a way each line does not exceed a certain number of&#xA;characters, say, in the 72-80 range. The number is not important, so&#xA;long as it is applied consistently and uniformly within a single file.&lt;/p&gt;&#xA;&lt;p&gt;In the terminal we can achieve that with &lt;a href=&#34;https://man.archlinux.org/man/fmt.1&#34;&gt;&lt;code&gt;fmt(1)&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;% cat lorem_ipsum.txt&#xA;&amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&amp;#34;&#xA;thiago@thiagoperrotta-MacBook-Pro /tmp/thiago.perrotta-2025-10-08-eOaLRg&#xA;% fmt lorem_ipsum.txt&#xA;&amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod&#xA;tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim&#xA;veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea&#xA;commodo consequat. Duis aute irure dolor in reprehenderit in voluptate&#xA;velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat&#xA;cupidatat non proident, sunt in culpa qui officia deserunt mollit anim&#xA;id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can also do it in-place (&lt;a href=&#34;https://man.archlinux.org/man/sponge.1&#34;&gt;sponge(1)&lt;/a&gt; from &lt;a href=&#34;https://perrotta.dev/2022/05/tools-you-should-know-about-moreutils/&#34;&gt;moreutils&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;% fmt lorem_ipsum.txt | sponge lorem_ipsum.txt&#xA;% cat lorem_ipsum.txt&#xA;&amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod&#xA;tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim&#xA;veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea&#xA;commodo consequat. Duis aute irure dolor in reprehenderit in voluptate&#xA;velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat&#xA;cupidatat non proident, sunt in culpa qui officia deserunt mollit anim&#xA;id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can we do it within &lt;code&gt;vim&lt;/code&gt;? Yes, with the following mapping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;nnoremap &amp;lt;silent&amp;gt; W &amp;lt;Esc&amp;gt;!ipfmt&amp;lt;Enter&amp;gt;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Translation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;silent&amp;gt;&lt;/code&gt;: does not echo the mapping in the vim command line&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;Esc&amp;gt;&lt;/code&gt;: switch to normal mode&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;!&lt;/code&gt;: &lt;code&gt;!{motion}{filter} Filter {motion} text lines through the external program {filter}.&lt;/code&gt; (via &lt;code&gt;:h !&lt;/code&gt;).&#xA;— Not to confound this with &lt;code&gt;:!&lt;/code&gt;: &lt;code&gt;:!{cmd} Execute {cmd} with the shell. See also the &#39;shell&#39; and &#39;shelltype&#39; option.  For the filter command, see |:range!|.&lt;/code&gt; (via &lt;code&gt;:h :!&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ip&lt;/code&gt;: &amp;ldquo;inner paragraph&amp;rdquo; motion&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;fmt&lt;/code&gt;: the filter command&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;&amp;lt;Enter&amp;gt;&lt;/code&gt;: execute the command&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Alternatively:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;nnoremap &amp;lt;silent&amp;gt; Q gwip&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Wherein &lt;code&gt;:h gw&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;gw{motion}&#x9;Format the lines that {motion} moves over.  Similar to&#xA;&#x9;&#x9;&#x9;|gq| but puts the cursor back at the same position in&#xA;&#x9;&#x9;&#x9;the text.  However, &amp;#39;formatprg&amp;#39; and &amp;#39;formatexpr&amp;#39; are&#xA;&#x9;&#x9;&#x9;not used.&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;One difference is that &lt;code&gt;gw&lt;/code&gt; accounts for comment characters, whereas &lt;code&gt;fmt&lt;/code&gt; does&#xA;not. Example, given a &lt;code&gt;.py&lt;/code&gt; (python) file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;# &amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;gw&lt;/code&gt; does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;# &amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod&#xA;# tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,&#xA;# quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo&#xA;# consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse&#xA;# cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non&#xA;# proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Whereas &lt;code&gt;fmt&lt;/code&gt; does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;# &amp;#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do&#xA;eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad&#xA;minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip&#xA;ex ea commodo consequat. Duis aute irure dolor in reprehenderit in&#xA;voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur&#xA;sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt&#xA;mollit anim id est laborum.&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim: reflow current paragraph&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>vim: remove trailing whitespace
      </title>
      <link>https://perrotta.dev/2025/09/vim-remove-trailing-whitespace/</link>
      <pubDate>Tue, 16 Sep 2025 14:27:55 +0200</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/09/vim-remove-trailing-whitespace/</guid>
      <description>&lt;p&gt;♠ A simple addition to remove all trailing whitespace from the current buffer by&#xA;pressing &lt;code&gt;,t&lt;/code&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;https://perrotta.dev/2025/09/vim-remove-trailing-whitespace/#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&#xA;(&lt;a href=&#34;https://vi.stackexchange.com/questions/454/whats-the-simplest-way-to-strip-trailing-whitespace-from-all-lines-in-a-file&#34;&gt;via&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;% GIT_PAGER=cat git show&#xA;commit 1c22fcbc12ffd2cb3c40152d152d099c9a9b7f85 (HEAD -&amp;gt; master, origin/master, origin/HEAD)&#xA;Author: Thiago Perrotta &amp;lt;{redacted}&amp;gt;&#xA;Date:   Tue Sep 16 14:26:46 2025 &amp;#43;0200&#xA;&#xA;    vim: remove trailing whitespace&#xA;&#xA;diff --git vim/.vim/vimrc vim/.vim/vimrc&#xA;index 8cf33d8..004beda 100644&#xA;--- vim/.vim/vimrc&#xA;&amp;#43;&amp;#43;&amp;#43; vim/.vim/vimrc&#xA;@@ -60,6 &amp;#43;60,9 @@ nnoremap J gJ&#xA; &amp;#34; Reflow current paragraph&#xA; nnoremap &amp;lt;silent&amp;gt; Q gwip&#xA;&#xA;&amp;#43;&amp;#34; Remove all trailing whitespace&#xA;&amp;#43;nnoremap &amp;lt;leader&amp;gt;t :let _s=@/&amp;lt;Bar&amp;gt;:%s/\s\&amp;#43;$//e&amp;lt;Bar&amp;gt;:let @/=_s&amp;lt;Bar&amp;gt;&amp;lt;CR&amp;gt;&#xA;&amp;#43;&#xA; &amp;#34; Always use vertical diff splits.&#xA; set diffopt&amp;#43;=vertical&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;My &lt;a href=&#34;https://stackoverflow.com/questions/1764263/what-is-the-leader-in-a-vimrc-file&#34;&gt;leader&lt;/a&gt; key is mapped to &lt;code&gt;,&lt;/code&gt;.&amp;#160;&lt;a href=&#34;https://perrotta.dev/2025/09/vim-remove-trailing-whitespace/#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim: remove trailing whitespace&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>vim: add word to spellchecker
      </title>
      <link>https://perrotta.dev/2025/07/vim-add-word-to-spellchecker/</link>
      <pubDate>Sat, 26 Jul 2025 12:13:42 +0200</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>serenity</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/07/vim-add-word-to-spellchecker/</guid>
      <description>&lt;p&gt;♠ When you have the spellchecker from &lt;code&gt;vim&lt;/code&gt; turned on (&lt;code&gt;:set spell&lt;/code&gt;), it&#xA;highlights words that are not in the dictionary.&lt;/p&gt;&#xA;&lt;p&gt;False positives will occasionally be flagged.&lt;/p&gt;&#xA;&lt;p&gt;To&#xA;&lt;a href=&#34;https://superuser.com/questions/133208/how-to-make-vim-spellcheck-remember-a-new-word&#34;&gt;add&lt;/a&gt;&#xA;the current word under the cursor to the dictionary, hit &lt;code&gt;zg&lt;/code&gt;. From the &lt;code&gt;vim&lt;/code&gt;&#xA;manual:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To add words to your own word list:&lt;/p&gt;&#xA;&lt;p&gt;zg&lt;/p&gt;&#xA;&lt;p&gt;Add word under the cursor as a good word to the first&#xA;name in &amp;lsquo;spellfile&amp;rsquo;.  A count may precede the command&#xA;to indicate the entry in &amp;lsquo;spellfile&amp;rsquo; to be used.  A&#xA;count of two uses the second entry.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Once you do so, you&amp;rsquo;ll see feedback text in the status bar:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;Word &amp;#39;hacky&amp;#39; added to ~/.vim/spell/en.utf-8.add&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This file can be easily tracked in your dotfiles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;Word &amp;#39;dotfiles&amp;#39; added to ~/.vim/spell/en.utf-8.add&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim: add word to spellchecker&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/serenity/&#34;&gt;#serenity&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>vim: join lines without producing a space
      </title>
      <link>https://perrotta.dev/2025/07/vim-join-lines-without-producing-a-space/</link>
      <pubDate>Tue, 22 Jul 2025 11:50:28 +0200</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/07/vim-join-lines-without-producing-a-space/</guid>
      <description>&lt;p&gt;♠ Here&amp;rsquo;s a common issue I have when blogging, when inserting a markdown link with&#xA;&lt;code&gt;vim&lt;/code&gt;. The edit progression is as follows, wherein &lt;code&gt;|&lt;/code&gt; represents the cursor:&lt;/p&gt;&#xA;&lt;p&gt;First, blank:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;|&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, type out the hyperlink label and prepare to insert the link:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;[example](|&#xA;)&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now go to another buffer (window) and copy the link (with &lt;code&gt;y&lt;/code&gt; + motion).&lt;/p&gt;&#xA;&lt;p&gt;Go back to the original buffer and paste it with &lt;code&gt;p&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;[example](&#xA;|https://example.com/&#xA;)&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Press &lt;code&gt;kJ&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;[example](| https://example.com/&#xA;)&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Press &lt;code&gt;J&lt;/code&gt; again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;[example](| https://example.com/)&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;J&lt;/code&gt; is for &amp;ldquo;join lines&amp;rdquo; (&lt;code&gt;:help J&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Do you see the issue above? The first &lt;code&gt;J&lt;/code&gt; inserts a space, the second one does&#xA;not. This inconsistency is frustrating.&lt;/p&gt;&#xA;&lt;p&gt;This &lt;a href=&#34;https://vi.stackexchange.com/questions/439/how-to-join-lines-without-producing-a-space&#34;&gt;vi stack&#xA;exchange&lt;/a&gt;&#xA;question seeks to address it:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The standard J command for joining lines replaces the newline character(s)&#xA;with a space. It&amp;rsquo;s useful when editing &amp;rsquo;literature&amp;rsquo; but can be troublesome if&#xA;I, say, edit a hex dump by hand if I forget to remove the superfluous space.&lt;/p&gt;&#xA;&lt;p&gt;Is there a quick &amp;amp; easy method to join two lines without producing a space&#xA;between them?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The standard recommendation is to use &lt;code&gt;gJ&lt;/code&gt; to do so. From &lt;code&gt;:help gJ&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Join [count] lines, with a minimum of two lines. Don&amp;rsquo;t insert or remove any&#xA;spaces.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;But it&amp;rsquo;s harder to memorize than simply &lt;code&gt;J&lt;/code&gt;. Plus, it&amp;rsquo;s an extra keystroke. I&amp;rsquo;d&#xA;rather unconditionally use &lt;code&gt;J&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It turns out it&amp;rsquo;s possible to do so with a simple config setting, added to&#xA;&lt;code&gt;~/.vimrc&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;nnoremap J gJ&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When repeating the original link insertion sequence, it yields the following&#xA;result, as desired (no spaces anywhere!):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-md&#34;&gt;[example](|https://example.com/)&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: vim: join lines without producing a space&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>pre-commit &#43; vim integration
      </title>
      <link>https://perrotta.dev/2025/01/pre-commit--vim-integration/</link>
      <pubDate>Sun, 05 Jan 2025 01:46:06 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>pre-commit</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2025/01/pre-commit--vim-integration/</guid>
      <description>&lt;p&gt;♠ Is it possible to transparently invoke &lt;code&gt;pre-commit&lt;/code&gt; in the background upon saving in &lt;code&gt;vim&lt;/code&gt; (&lt;code&gt;:w&lt;/code&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;Initially I found this &lt;a href=&#34;https://stackoverflow.com/questions/70713450/pre-commit-results-in-vim&#34;&gt;Stack&#xA;Overflow&lt;/a&gt;&#xA;question, but it had no answer.&lt;/p&gt;&#xA;&lt;p&gt;Digging a bit deeper I realized that I could do it with an &lt;code&gt;autocmd&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;autocmd BufWritePost * execute &amp;#39;! if [ -e $(git root)/.pre-commit-config.yaml &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ]; then pre-commit run; fi&amp;#39;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That trashes the screen upon completion. This can be resolved by invoking&#xA;&lt;code&gt;:redraw!&lt;/code&gt; afterwards:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;autocmd BufWritePost * execute &amp;#39;! if [ -e $(git root)/.pre-commit-config.yaml &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ]; then pre-commit run; fi&amp;#39; | redraw!&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can be less intrusive by prepending &lt;code&gt;silent!&lt;/code&gt; so that, even if the command&#xA;fails, it doesn&amp;rsquo;t get in the way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;autocmd BufWritePost * silent! execute &amp;#39;! if [ -e $(git root)/.pre-commit-config.yaml &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ]; then pre-commit run; fi&amp;#39; | redraw!&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And last but not least, ideally &lt;code&gt;pre-commit&lt;/code&gt; should run only on the file&#xA;associated with the current buffer. Pass &lt;code&gt;--files&lt;/code&gt; to pre-commit with the &lt;code&gt;%&lt;/code&gt;&#xA;argument:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;autocmd BufWritePost * silent! execute &amp;#39;! if [ -e $(git root)/.pre-commit-config.yaml &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ]; then pre-commit run --files %; fi&amp;#39; | redraw!&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This approach works as intended.&#xA;There&amp;rsquo;s a brief period in which you can see &lt;code&gt;pre-commit&lt;/code&gt; running in the&#xA;background. It&amp;rsquo;s arguable whether that&amp;rsquo;s a feature or a bug.&lt;/p&gt;&#xA;&lt;p&gt;Ah, and &lt;code&gt;git root&lt;/code&gt; is simply an alias in my &lt;code&gt;~/.gitconfig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-plaintext&#34;&gt;root = rev-parse --show-toplevel&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Whenever there are pre-commit violations (e.g. &lt;code&gt;end-of-file-fixer&lt;/code&gt;) they are&#xA;applied inplace. There&amp;rsquo;s no need to run &lt;code&gt;:e!&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is bare, but I am happy.&lt;/p&gt;&#xA;&lt;p&gt;Perhaps the only missing piece is to extend it in such a way it&amp;rsquo;s only executed&#xA;in the repositories I opt into.&lt;/p&gt;&#xA;&lt;p&gt;If this turns out to be too intrusive, I am thinking to switch to using a vim&#xA;keymap e.g. &lt;code&gt;&amp;lt;leader&amp;gt;p&lt;/code&gt; instead of an &lt;code&gt;autocmd&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: pre-commit + vim integration&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/pre-commit/&#34;&gt;#pre-commit&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Vim shortcuts everywhere
      </title>
      <link>https://perrotta.dev/2014/11/vim-shortcuts-everywhere/</link>
      <pubDate>Thu, 13 Nov 2014 12:03:07 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>legacy</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2014/11/vim-shortcuts-everywhere/</guid>
      <description>&lt;p&gt;♠ Recently I&amp;rsquo;ve been switching my mind and workflow from emacs keybindings to vim&#xA;ones, so there is nothing better than being able to use those shortcut keys on&#xA;as many applications as possible. Currently ones I&amp;rsquo;m trying include:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;vim itself&lt;/li&gt;&#xA;&lt;li&gt;emacs with evil-mode&lt;/li&gt;&#xA;&lt;li&gt;firefox with vimperator (there&amp;rsquo;s an Arch package for it)&lt;/li&gt;&#xA;&lt;li&gt;chromium with vimium&lt;/li&gt;&#xA;&lt;li&gt;luakit (KISS web browsing)&lt;/li&gt;&#xA;&lt;li&gt;tmux&lt;/li&gt;&#xA;&lt;li&gt;i3 window manager&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Edit: forgot this one:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;zathura (PDF/PS/DJVU viewer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;And I&amp;rsquo;m pretty sure there is plenty more to find out.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: Vim shortcuts everywhere&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/legacy/&#34;&gt;#legacy&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>From Emacs to Vim – Chapter #2 – Philosophy
      </title>
      <link>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/</link>
      <pubDate>Sat, 18 Oct 2014 23:47:21 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>legacy</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/</guid>
      <description>&lt;p&gt;♠ Previous post. Oh man, up to this point I am slightly disoriented about emacs shortcuts. It has been probably one month since I am using vim almost exclusively. I just use emacs to blog here and to use orgmode. Yes, I still know so many of Emacs shortcuts and keybindings that I can even recite them to you while I am dream. However, I am not practicing them so much as before, so they will probably fade away some time.&lt;/p&gt;&#xA;&lt;p&gt;But I have used emacs for two years, so I won&amp;rsquo;t forget the basic commands, terminologies, functions and shortcuts, so no problem at all. Okay, so I&amp;rsquo;ve just finished reading Practical Vim. I super encourage you to buy the book and support its author, because this was (is!) a fantastic book! I also thanks Jason Ryan, forums and wiki admin from the Arch Linux community, for recommending the book. It is one of the reasons that made me commit myself to learn (and stick to) vim.&lt;/p&gt;&#xA;&lt;p&gt;Now, in this post I&amp;rsquo;ll talk a little about the differences between emacs and vim. This is supposed to be an informal post, with information coming out of my head on-the-fly, so don&amp;rsquo;t expect much consistency or formality here. I&amp;rsquo;ll list a couple of topics/categories and tell you what text editor I most like in each of them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;ide-vs-text-editor&#34;&gt;&#xA;  IDE vs text editor&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#ide-vs-text-editor&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Vim is not an IDE. I&amp;rsquo;ll repeat that. &lt;strong&gt;Vim is not an IDE&lt;/strong&gt;. Vim is just a text editor. Don&amp;rsquo;t even try to make it a IDE. If you want a solid text editor to behave like an IDE, use and stick to Emacs. Emacs is not &lt;strong&gt;just&lt;/strong&gt; a text editor; it is a &lt;strong&gt;full-featured&lt;/strong&gt; text editor. Theoretically, it might be anything you want. There are no limits about the customizations you can do to extend emacs. The limit is the sky (actually, the memory of your current hardware).&lt;/p&gt;&#xA;&lt;p&gt;I prefer &lt;strong&gt;vim&lt;/strong&gt; here. For two years I tried to make emacs the perfect IDE. You can achieve good results with it (yeah, &lt;strong&gt;good&lt;/strong&gt; ones!), however, it is best when you keep it simple. I like this aspect in vim, and now I understand why almost everyone of the Arch Linux community that I know prefer vim rather than emacs.&lt;/p&gt;&#xA;&lt;p&gt;Vim is KISS. It is kiss in text editing. For example, vim defaults are very good; I can survive without a .vimrc. However, emacs defaults are terrible (from my point of view, and considering that I know it can be better). I simply cannot use emacs for much time without my .emacs file.&lt;/p&gt;&#xA;&lt;h2 id=&#34;shortcuts--keystrokes--chords--modal-text-editor&#34;&gt;&#xA;  Shortcuts / keystrokes / chords / modal text editor&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#shortcuts--keystrokes--chords--modal-text-editor&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Emacs shortcuts mostly involve pressing &lt;code&gt;&amp;lt;Control&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;Meta&amp;gt;&lt;/code&gt;, plus a letter or number key. Sometimes you have to do this (which I&amp;rsquo;ll call a &lt;strong&gt;chord&lt;/strong&gt;) two or three times. For example, to quit emacs you press &lt;code&gt;&amp;lt;C-x C-c&amp;gt;&lt;/code&gt;. Vim shortcuts usually involve only a few chars, but you have to switch to normal mode to activate them (most of the time, at least).&lt;/p&gt;&#xA;&lt;p&gt;Now, which is better? That depends. From my point of view, emacs win in respect to speed. I usually issue a command faster in emacs than in vim. However, vim commands are better to navigate through text than emacs ones, because they are well integrated.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, an extensive use of Emacs can lead to RSI (repetitive strain injury). Even Richard Stallman had it once. Vim commands are slightly less aggressive (in respect to the keyboard), so the health of your hands and fingers will benefit from them.&lt;/p&gt;&#xA;&lt;p&gt;Some people also recommend the mapping of the caps lock key to &lt;code&gt;&amp;lt;Esc&amp;gt;&lt;/code&gt; in vim, or to &lt;code&gt;&amp;lt;Control&amp;gt;&lt;/code&gt; in Emacs. They claim that the caps lock key is not much used, so it is more useful when mapped to &lt;code&gt;&amp;lt;Esc&amp;gt;&lt;/code&gt;/&lt;code&gt;&amp;lt;Ctrl&amp;gt;&lt;/code&gt;. Well, I personally never accustomed myself to this convention. It has a natural problem of compatibility: every new computer you use won&amp;rsquo;t be configured this way. So I don&amp;rsquo;t find this very portable, and I don&amp;rsquo;t want to bring a .Xmodmap file everywhere.&lt;/p&gt;&#xA;&lt;p&gt;So, who wins here? &lt;strong&gt;Emacs&lt;/strong&gt;. However, remember what I&amp;rsquo;ve said: Emacs is faster, but it will hurt your fingers if you use it for prolonged hours.&lt;/p&gt;&#xA;&lt;h2 id=&#34;command-line&#34;&gt;&#xA;  Command-line&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#command-line&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Emacs&lt;/strong&gt; command line wins. Sorry vim, that&amp;rsquo;s it. Short and clear. It is even more powerful with smex, ido and icomplete. At this point I don&amp;rsquo;t know any enhancement for the vim command line, but I have to say it is pretty good also. For now, I&amp;rsquo;m only using &lt;code&gt;wildmenu&lt;/code&gt;. But emacs wins, period.&lt;/p&gt;&#xA;&lt;h2 id=&#34;movement-of-the-cursor-through-a-buffer&#34;&gt;&#xA;  Movement of the cursor through a buffer&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#movement-of-the-cursor-through-a-buffer&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Vim&lt;/strong&gt; is better. Period. Like I&amp;rsquo;ve said before, it is very well integrated in this respect. You can switch your cursor to almost anywhere in your buffer with just a couple of keystrokes.&lt;/p&gt;&#xA;&lt;p&gt;Now, in Emacs I am usually mechanical, and keep repeating myself. For example, if I want to go a few lines above, I&amp;rsquo;ll probably hit &lt;code&gt;&amp;lt;C-u C-p&amp;gt;&lt;/code&gt; a couple of times. In vim, currently I press &lt;code&gt;k&lt;/code&gt; a few times too, but this is due to lack of practice. There are faster ways of moving in vim than I am used to.&lt;/p&gt;&#xA;&lt;h2 id=&#34;buffer-management&#34;&gt;&#xA;  Buffer management&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#buffer-management&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;The two editors are very decent in this regard. Since I am more used to Emacs, nowadays I find easier to manage emacs buffers; however, the vim way of navigating through them is pretty decent, so I won&amp;rsquo;t declare a winner in this category.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-graphical-user-interface&#34;&gt;&#xA;  GUI (graphical user interface)&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#gui-graphical-user-interface&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;It is almost impossible to use emacs for a couple of minutes if you are not using its X version. Its console version is just awful. In contrast, vim is perfect on the console, but I find gvim pretty bad (well, at least, I feel like I am editing the console when I used it: no relevant differences).&lt;/p&gt;&#xA;&lt;p&gt;So the &lt;strong&gt;emacs&lt;/strong&gt; GUI is better. It is probably even better on OS X, however I cannot confirm that right now.&lt;/p&gt;&#xA;&lt;h2 id=&#34;books&#34;&gt;&#xA;  Books&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#books&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Emacs books will usually teach you emacs lisp. It is very hard to learn about emacs without learning what is actually happening under its hood. When you realize that everything you do in emacs is just Emacs Lisp, you really find that very beautiful. A functional language being used for the greater good.&lt;/p&gt;&#xA;&lt;p&gt;But this is also a problem: if you don&amp;rsquo;t care about elisp, you will probably get bored. Fast. Very fast.&lt;/p&gt;&#xA;&lt;p&gt;Now, vim books usually teach you how vim commands are integrated with themselves and with vim itself. At least the books I&amp;rsquo;ve read up to today. This is better on a practical basis, when you want to quickly become good with it (you see, I already feel fluent in vim with just one month usage – I felt fluent in emacs only about a couple of months, and part of this reason was bad out-of-the-box defaults).&lt;/p&gt;&#xA;&lt;p&gt;The point is: you don&amp;rsquo;t need to know about vimscript to actually get work done on vim. Therefore, &lt;strong&gt;vim&lt;/strong&gt; books are better in respect to being pragmatic; buuuuut &lt;strong&gt;emacs&lt;/strong&gt; books are better regarding teaching the inner workings of the editor, and how to program and extend it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;out-of-the-box-better-defaults&#34;&gt;&#xA;  Out-of-the-box, better defaults&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#out-of-the-box-better-defaults&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Vim. vim. vim.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;ubiquity&#34;&gt;&#xA;  Ubiquity&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#ubiquity&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Vim. vim. vim.&lt;/strong&gt; And vi. However, &amp;ldquo;micro emacses&amp;rdquo; such as mg (the program that Linus Torvalds uses) and zile are very good. But they are very basic, they are just micro text editors with emacs keystrokes; not much features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;one-line-answers&#34;&gt;&#xA;  One-line answers&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#one-line-answers&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;color-themes--colorschemes&#34;&gt;&#xA;  Color themes / colorschemes&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#color-themes--colorschemes&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Emacs!&lt;/p&gt;&#xA;&lt;h3 id=&#34;plug-ins-and-extensibility&#34;&gt;&#xA;  Plug-ins and extensibility&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#plug-ins-and-extensibility&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Emacs is more extensible, but vim plug-ins give you less headache.&lt;/p&gt;&#xA;&lt;h3 id=&#34;communities&#34;&gt;&#xA;  Communities&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%232-philosophy/#communities&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;There are more people using vim than emacs, but the emacs community is still good today. …and my creativity ran away now. Which additional topics do you believe that vim or emacs is better than its counterpart in? Comment.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: From Emacs to Vim – Chapter #2 – Philosophy&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/legacy/&#34;&gt;#legacy&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>From Emacs to Vim - Chapter #1 - Vim plug-ins
      </title>
      <link>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%231-vim-plug-ins/</link>
      <pubDate>Mon, 06 Oct 2014 01:50:00 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>legacy</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%231-vim-plug-ins/</guid>
      <description>&lt;p&gt;♠ This is the continuation of the first post. As you get the feeling and overview&#xA;of &lt;strong&gt;vim&lt;/strong&gt;, the first thing you&amp;rsquo;ll probably miss as a&#xA;probable-soon-to-be-emacs-orphan (actually, not really, I&amp;rsquo;ve already told you&#xA;I&amp;rsquo;m not going to abandon emacs – for example, this post is being written within&#xA;it, with org2blog – (too many level of parenthesis, please help me!!)) are your&#xA;customizations and custom plug-ins and extensions. A couple of google searches&#xA;would bring me to projects like janus and vim bootstrap. Those look nice and I&#xA;would probably appreciate them if I were a beginner. However, as a super user –&#xA;if you read this statement as bragging, then you are probably not understanding&#xA;the purpose of this mini series –, I like to be in control of the&#xA;personalization and settings of my text editor. Right? So, I&amp;rsquo;ve chosen to&#xA;control my own plug-ins. In other words: bottom-up instead of top-down. Now,&#xA;the two state-of-the-art plug-in managers you&amp;rsquo;ll find out there to manage&#xA;your vimscripts are vundle and pathogen. I began using Vundle, but after a&#xA;few hours I realized that pathogen was KISS and superior. Period. Not that&#xA;Vundle is bad. It looks (works) okay too; in this case it was simply a&#xA;matter of personal choice. The way Vundle works is as follows: your &lt;code&gt;.vimrc&lt;/code&gt;&#xA;will be populated with several lines such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;Plugin &amp;#39;tpope/vim-surround&amp;#39;&#xA;Plugin &amp;#39;username-from-github/repository-name&amp;#39;&#xA;Plugin &amp;#39;matchit&amp;#39;&#xA;Plugin &amp;#39;vimscript-name-from-vim-dot-org&amp;#39;&#xA;Plugin &amp;#39;git://www.absolute-path-to-my-site-here.com/repository-name.git&amp;#39;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, you just have to install those plug-ins with a simple command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vim&#34;&gt;:Plugin Install&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Done. It is simple, yes, but I liked more the approach of &lt;strong&gt;pathogen&lt;/strong&gt;: you maintain a git repository with your plug-ins. Each new plug-in is a git submodule within your repository. Yay, this means it is super-easy to set up and share your plug-ins with other people. This is exactly what I&amp;rsquo;ve done: you can peek out my vim repository here. Now, there is one super good advantage here over emacs. The cost of adding a new plug-in is practically zero. This has two meanings, actually:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;vim start-up time is ridiculously fast. Even with a dozen plug-ins, I still&#xA;don&amp;rsquo;t notice it. With emacs, if I don&amp;rsquo;t run it as a daemon, it is a&#xA;nightmare: a couple of seconds (yeah, a couple of seconds is really a&#xA;nightmare, not kidding) of start-up time.&lt;/li&gt;&#xA;&lt;li&gt;I don&amp;rsquo;t even have to touch my &lt;code&gt;.vimrc&lt;/code&gt; to add a new plug-in. I just have to&#xA;clone a new repository into my &lt;code&gt;$HOME/.vim/bundle&lt;/code&gt; folder. Period. With&#xA;emacs, I have to continuously poke my &lt;code&gt;.emacs&lt;/code&gt; file to add, remove and&#xA;constantly tweak my extensions. Yeah, I&amp;rsquo;ve been doing that for a while, and&#xA;it &lt;strong&gt;does&lt;/strong&gt; provoke a lot of stress and anxiety. You already have to tolerate&#xA;a little bit of RSI with emacs, so you don&amp;rsquo;t need more problems.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now, don&amp;rsquo;t undermine my (our) dear Emacs! Emacs Lisp will (and will always be)&#xA;superior to vimscript. I have no doubt of this fact and therefore I won&amp;rsquo;t even&#xA;discuss it here. Emacs is much more extensible than vim. Okay, then what? You&#xA;have to find a few plug-ins, right? In Emacs, most plug-ins with decent quality&#xA;you might find will be available either on MELPA or Marmalade and, of course, on&#xA;GitHub too. In vim, it looks like the home of scripts is the vim website itself&#xA;((1) and (2)) &lt;strong&gt;and&lt;/strong&gt; GitHub. I couldn&amp;rsquo;t find a central repo or website hosting&#xA;the majority of its plug-ins, as with emacs. However, there is vim-awesome,&#xA;which indexes existing ones (this concept is like the ruby toolbox, godoc.org&#xA;and Emacs paradox extension by Bruce Connor. I won&amp;rsquo;t discuss the plug-ins I&amp;rsquo;m&#xA;using right now, however here is a snapshot of my &lt;code&gt;$HOME/.vim/bundle&lt;/code&gt; directory&#xA;at the time of this post (19 plug-ins, yay):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You Complete Me&lt;/li&gt;&#xA;&lt;li&gt;ack.vim&lt;/li&gt;&#xA;&lt;li&gt;ag.vim&lt;/li&gt;&#xA;&lt;li&gt;ctrlp.vim&lt;/li&gt;&#xA;&lt;li&gt;delimit Mate&lt;/li&gt;&#xA;&lt;li&gt;nerdtree&lt;/li&gt;&#xA;&lt;li&gt;syntastic&lt;/li&gt;&#xA;&lt;li&gt;tagbar&lt;/li&gt;&#xA;&lt;li&gt;vim-airline&lt;/li&gt;&#xA;&lt;li&gt;vim-bufferline&lt;/li&gt;&#xA;&lt;li&gt;vim-commentary&lt;/li&gt;&#xA;&lt;li&gt;vim-easytags&lt;/li&gt;&#xA;&lt;li&gt;vim-fugitive&lt;/li&gt;&#xA;&lt;li&gt;vim-gitgutter&lt;/li&gt;&#xA;&lt;li&gt;vim-markdown&lt;/li&gt;&#xA;&lt;li&gt;vim-misc&lt;/li&gt;&#xA;&lt;li&gt;vim-repeat&lt;/li&gt;&#xA;&lt;li&gt;vim-sensible&lt;/li&gt;&#xA;&lt;li&gt;vim-surround&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Most of those have an emacs equivalent. Okay, I&amp;rsquo;m stopping here for now, until the next post :) Update: next post.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: From Emacs to Vim - Chapter #1 - Vim plug-ins&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/legacy/&#34;&gt;#legacy&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>From Emacs to Vim - Chapter #0
      </title>
      <link>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%230/</link>
      <pubDate>Sat, 04 Oct 2014 15:55:56 -0300</pubDate><author>serendipity@perrotta.dev (Thiago Perrotta)</author>
      <category>dev</category>
      <category>legacy</category>
      <category>vim</category>
      <guid>https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%230/</guid>
      <description>&lt;p&gt;♠ Hi there. This will probably become a new mini series. I begin by quoting&#xA;Vanessa Da Mata:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;É só isso&#xA;Não tem mais jeito&#xA;Acabou, boa sorte&#xA;Não tenho o que dizer&#xA;São só palavras&#xA;E o que eu sinto&#xA;Não mudará&#xA;Tudo o que quer me dar&#xA;É demais&#xA;É pesado&#xA;Não há paz&#xA;Tudo o que quer de mim&#xA;Irreais&#xA;Expectativas&#xA;Desleais&lt;/p&gt;&#xA;&lt;p&gt;That&amp;rsquo;s it&#xA;There&amp;rsquo;s no way&#xA;It&amp;rsquo;s over, good luck&#xA;I&amp;rsquo;ve nothing left to say&#xA;It&amp;rsquo;s only words&#xA;And what I feel&#xA;Won&amp;rsquo;t change&lt;/p&gt;&#xA;&lt;p&gt;[&amp;hellip;]&lt;/p&gt;&#xA;&lt;p&gt;Tudo o que quer me dar / Everything you want to give me&#xA;É demais / It&amp;rsquo;s too much&#xA;É pesado / It&amp;rsquo;s heavy&#xA;Não há paz / There&amp;rsquo;s no peace&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Upstream URL with lyrics. Now, a little bit of context. Two or three weeks ago I&#xA;began learning &lt;strong&gt;vim&lt;/strong&gt;. This is due to a lot of reasons: one of them is that vim&#xA;is actively used by a lot of members of the &lt;strong&gt;Arch Linux community&lt;/strong&gt;, and I&#xA;usually am influenced about their tastes — what doesn&amp;rsquo;t mean that I will comply&#xA;with everything, it is just a matter of trying new things.&lt;/p&gt;&#xA;&lt;p&gt;Another reason is that I am actively learning new &lt;strong&gt;open source tools&lt;/strong&gt;, and vim&#xA;is definitely one of the most widespread and &lt;strong&gt;ubiquitous&lt;/strong&gt; ones. I don&amp;rsquo;t need to&#xA;provide statistical sources for that, do you agree? &lt;strong&gt;Vi&lt;/strong&gt; is present everywhere,&#xA;even on my Android. (Now, almost nobody uses vi anymore, however vi and vim are&#xA;too much similar that for simple and rapid tasks usually annoying differences&#xA;won&amp;rsquo;t even be noticed).&lt;/p&gt;&#xA;&lt;p&gt;Another reason is that I never became 100% satisfied with &lt;strong&gt;Emacs&lt;/strong&gt;. Hey, I like&#xA;emacs very much, don&amp;rsquo;t get me wrong, however there were always some piece of&#xA;completeness missing in it, so this puzzle never got finished. In particular,&#xA;orgmode (an emacs task-manager-note-taker-and-everything mode) is a tool that I&#xA;felt in loved with, and thanks to it I won&amp;rsquo;t completely remove emacs from my&#xA;system; you should notice that orgmode is something very specific to emacs.&lt;/p&gt;&#xA;&lt;p&gt;Although there are some tentatives on vim implementations, as far as I read, they&#xA;are not very good (at least not compared to a vanilla, emacs orgmode). Okay,&#xA;those are sufficient for now, but there are more reasons that will reveal&#xA;themselves along the next posts.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://sslimgs.xkcd.com/comics/real_programmers.png&#34; alt=&#34;Real Programmers Comic&#34;&#xA;  loading=&#34;lazy&#34; decoding=&#34;async&#34; /&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now, we should go back to the lyrics. I really love how this music is related to&#xA;emacs; in particular:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Tudo o que quer me dar / Everything you want to give me&#xA;É demais / It&amp;rsquo;s too much&#xA;É pesado / It&amp;rsquo;s heavy&#xA;Não há paz / There&amp;rsquo;s no peace&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That&amp;rsquo;s is right. Emacs always was regarded to as the dinosaur, as the operating&#xA;system of your computer, as the I-want-to-rule-all-your-workstation program.&#xA;This has both its advantages and disadvantages, of course. The point with vim is&#xA;that is tries to Keep it Simple. It will &lt;strong&gt;never&lt;/strong&gt; be everything: it is only&#xA;your text editor. Nothing more.&lt;/p&gt;&#xA;&lt;p&gt;Well, although people will always try to write a Twitter Client for it and&#xA;similar things, I feel it is not natural. No, &lt;strong&gt;IT IS NOT&lt;/strong&gt;!! Now, with emacs,&#xA;those things are pretty natural. It was created to be extended! (Emacs is&#xA;described as the extensible text editor.)&lt;/p&gt;&#xA;&lt;p&gt;Along the last two years, I&amp;rsquo;ve tested more than a hundred of add-ons and&#xA;customizable pieces and bits for it: it is so cool how a functional language&#xA;(&lt;strong&gt;Emacs Lisp&lt;/strong&gt;) can improve a text editor. 2048 game, flappymacs, twitter&#xA;client, mediawiki client, xkcd browser, RSS reader, calendar application&#xA;(built-in), calculator (built-in), mail client … Yeah, emacs is everything!&#xA;Maybe &lt;strong&gt;too much&lt;/strong&gt; for me.&lt;/p&gt;&#xA;&lt;p&gt;Now, this is the part that makes me feel a little sad: &lt;strong&gt;&lt;em&gt;There&amp;rsquo;s no peace&lt;/em&gt;&lt;/strong&gt;.&#xA;Yeah, this is a problem. If you browse through my dotfiles repository on Github,&#xA;more specifically, through its commit history, you&amp;rsquo;ll see that my &lt;code&gt;_.emacs_&lt;/code&gt; file&#xA;is one of the files that &lt;strong&gt;most&lt;/strong&gt; changed through the days. I am always editing&#xA;something of it, and I am never completely 100% satisfied with the outcome.&lt;/p&gt;&#xA;&lt;p&gt;Because it is to easy to &lt;strong&gt;tweak&lt;/strong&gt; and &lt;strong&gt;customize&lt;/strong&gt; &lt;strong&gt;almost every aspect&lt;/strong&gt; of&#xA;Emacs, this means it is also possible to customize some aspects that I should&#xA;probably not even be bothering to (and I should probably not touch those ones).&#xA;Now, this proved to be a problem&amp;hellip;&lt;/p&gt;&#xA;&lt;h2 id=&#34;planned-topics&#34;&gt;&#xA;  Planned topics&#xA;  &lt;a class=&#34;heading-anchor&#34; href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%230/#planned-topics&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;PROGRESS Emacs&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;PROGRESS introduction, motivations, and so on&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO org2blog&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO functional programming, REPL and Emacs Lisp&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO keybindings, keystrokes and hotkeys paradise (or nightmare)&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO more org-mode goodness&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO lessons and overall learned discipline&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO about the awesome emacs community&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO emacs blogs and RSS out there?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO evil-mode&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO Emacs on X vs Emacs on Console&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO Books and study sources on Emacs&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO Vim&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO how a emacs user feels after being introduced to a modal text editor&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO keybindings and maps in different modes&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO gvim vs vim&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO vim community and resources?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO editing text at the speed of thought, really?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO books and study sources on vim&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO Conclusions&lt;/strong&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;TODO Are text editors still relevant today, in a world of full-featured IDEs?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Whoa. I hope you might like this mini series and want to see some (or all!) of&#xA;the above topics discussed. During it (please notice this comment won&amp;rsquo;t be&#xA;repeated further on), feel free to leave out any comments about your specific&#xA;experiences about vim or emacs. Also, you are encouraged to suggest me&#xA;additional topics about my experience with emacs (and my soon-to-be-born&#xA;experience with vim too), and even choose one of the above topics to I write&#xA;about next. Until the next post! (For now, read this.) &lt;strong&gt;Update&lt;/strong&gt;: &lt;a href=&#34;https://perrotta.dev/2014/10/from-emacs-to-vim-chapter-%231-vim-plug-ins/&#34; title=&#34;From Emacs to Vim – Chapter #1 – Vim plug-ins&#34;&gt;next post&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;— § —&lt;/p&gt;&lt;p&gt;Reply via &lt;a href=&#34;mailto:serendipity@perrotta.dev?subject=Reply to: From Emacs to Vim - Chapter #0&#34;&gt;email&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&#34;https://perrotta.dev/tags/dev/&#34;&gt;#dev&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/legacy/&#34;&gt;#legacy&lt;/a&gt; &lt;a href=&#34;https://perrotta.dev/tags/vim/&#34;&gt;#vim&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
