<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan Osipov - Vim</title>
    <description>Recent posts in Vim category on Ruslan Osipov.</description>
    <link>https://rosipov.com/</link>
    <atom:link href="https://rosipov.com/blog/categories/vim.xml" rel="self" type="application/rss+xml" />
    <pubDate>Mon, 09 Mar 2026 16:08:44 +0000</pubDate>
    <lastBuildDate>Mon, 09 Mar 2026 16:08:44 +0000</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>Vimwiki: 11 years later</title>
        <description>&lt;p&gt;Vimwiki is a personal wiki plugin for Vim. Using Vim has been a second nature for me for well over a decade (&lt;a href=&quot;https://amzn.to/4pvFx62&quot;&gt;buy my book&lt;/a&gt;), and keeping my notes organized using Vim continues to be the best approach. It’s been 11 years of using Vimwiki, here are some reflections.&lt;/p&gt;

&lt;p&gt;If you’re instead looking for a tutorial on how to set up and use Vimwiki in Vim, &lt;a href=&quot;/blog/personal-wiki-with-vimwiki/&quot;&gt;my tutorial from 2014 is up-to-date&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, what do I use Vimwiki for?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimwiki-technology.png&quot; alt=&quot;Vimwiki: A page listing various technologies.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A little bit of everything. Occasional journaling, when I don’t want to pull out a journal and a pen. Notes about technology and any projects I might be working on. Reflections on video games I’ve played. Ideas I find interesting. Topic research notes, like when I try to understand a messy and complex personal finance or tax subjects. Writing drafts (&lt;a href=&quot;/blog/writing-cadence-quality-and-the-act-of-caring/&quot;&gt;my notes on writing cadence&lt;/a&gt; could be of interest here).&lt;/p&gt;

&lt;p&gt;Hands down the best thing about Vimwiki for me, is that it’s something I’ve kept up for 11 years now, and it’s fully open source and doesn’t rely on external services. I’ve changed storage from Dropbox to Google Drive to hosting the wiki myself, and I’m glad that I get to use the same technology.&lt;/p&gt;

&lt;p&gt;Having uninterrupted access to knowledge I deemed noteworthy is useful. It helps me keep my head organized, if only to know that all the thoughts swooshing in my head are neatly organized somewhere on paper. On digital paper, you know what I mean. It’s freeing.&lt;/p&gt;

&lt;p&gt;It’s also lovely that under the hood this is just a set of plain text files. I can always manipulate these files using thousands of text manipulation programs, or write my own utility with ease. I’ve leveraged that in rare cases when Vimwiki capabilities were insufficient.&lt;/p&gt;

&lt;p&gt;But there are a few notable downsides, too. With the benefits of hindsight and some wisdom over the years.&lt;/p&gt;

&lt;p&gt;First and foremost, portability. Vim never graduated into the mobile first world. Yeah, I used to eye roll at Google’s mobile first push of mid-2010s, but the truth of the matter is - I often find myself taking notes on my phone, and then moving those notes to Vimwiki when I have the time (or forgetting those notes exist altogether).&lt;/p&gt;

&lt;p&gt;Even on supported platforms - Windows, Mac, Linux, ChromeOS - there’s always some fiddling involved in the setup. It’s not a set-it-and-forget-it solution. There’s always tinkering involved, and there’s a reason my blog has a number of entries titled “how to to use Vimwiki on System X” over the past decade (like &lt;a href=&quot;/blog/how-i-use-vimwiki/&quot;&gt;how I use Vimwiki&lt;/a&gt; for instance). It’s a tinkerer’s choice.&lt;/p&gt;

&lt;p&gt;Unfortunately, I can’t think of a significantly simpler solution (outside of plain-text system of notes) that doesn’t lock me into an ecosystem or puts me at a mercy of a company which will shut down the servers once they go out of business.&lt;/p&gt;

&lt;p&gt;I’ve looked at simple solutions like &lt;a href=&quot;https://tiddlywiki.com/&quot;&gt;TiddlyWiki&lt;/a&gt; more than once before, but I keep coming back to using Vim as a primary interface for engaging with all the information I’ve collected over the years.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimwiki-financial-life.png&quot; alt=&quot;Vimwiki: HTML rendering of the finance page.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I solved some aspects of portability through serving my instance of Vimwiki via web. Yeah, Vimwiki can render your files to glorious interlinked HTML (which works out of the box by invoking &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiAll2HTML&lt;/code&gt;). It’s read-only, however, and requires you to figure out how to host your own web server. Which isn’t hard if you already host other things on your local network (which I do), but can be a pain in the butt if you don’t. And you’d be setting yourself up for a security mess on your hands if you’re standing up a web server in the cloud without knowing what you’re doing.&lt;/p&gt;

&lt;p&gt;For its entries, Vimwiki supports either its own VimWiki syntax (which is based on MediaWiki) or Markdown syntax. I use the VimWiki syntax, and while it makes it harder to migrate away from Vimwiki, I think it’s a better fit for the Vim editing. I’m glad I stuck with the VimWiki syntax, since I find &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[[link]]&lt;/code&gt; to be easier to parse than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[link](link.markdown)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Can I see myself moving to a different solution in the future? Possibly. If a fully open source, Vim-friendly, truly portable solution presents itself - sure, I’ll put together some scripts to migrate (or more likely, use AI to help me write one - AIs seem to be good at writing low-risk one-off migration scripts). Do I regret using Vimwiki? Absolutely not, it’s been an amazing companion to me over a decade, and given that the data’s stored in plain text - I’m not worried about losing my data if I ever change my mind.&lt;/p&gt;
</description>
        <pubDate>Mon, 22 Sep 2025 14:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/vimwiki-11-years-later/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/vimwiki-11-years-later/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Seven years of Mastering Vim</title>
        <description>&lt;p&gt;Oh, how the time flies. I published the first edition of Mastering Vim in 2018. Since then, it has been translated to Japanese and received its second edition.&lt;/p&gt;

&lt;div&gt;
  &lt;a href=&quot;https://amzn.to/2EfGaN5&quot; target=&quot;blank&quot;&gt;
    &lt;img alt=&quot;A picture of Mastering Vim, second edition book cover.&quot; src=&quot;/images/mastering-vim-2e.jpg&quot; title=&quot;Mastering Vim, second edition.&quot; class=&quot;book-cover&quot; style=&quot;margin-right: 1em; margin-bottom: 1em;&quot; /&gt;
  &lt;/a&gt;
  &lt;a href=&quot;https://amzn.to/4ipuuYj&quot; target=&quot;blank&quot;&gt;
    &lt;img alt=&quot;A book cover of Mastering Vim in Japanese.&quot; src=&quot;/images/mastering-vim-jp.jpg&quot; title=&quot;Mastering Vim, Japanese translation.&quot; class=&quot;book-cover&quot; style=&quot;margin-right: 1em; margin-bottom: 1em;&quot; /&gt;
  &lt;/a&gt;
  &lt;a href=&quot;https://amzn.to/2EfGaN5&quot; target=&quot;blank&quot;&gt;
     &lt;img alt=&quot;A picture of Mastering Vim book cover.&quot; src=&quot;/images/mastering-vim.jpg&quot; title=&quot;Mastering Vim, first edition.&quot; class=&quot;book-cover&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;In 2021, I wrote about &lt;a href=&quot;/blog/how-much-does-writing-a-book-earn/&quot;&gt;how much money publishing Mastering Vim has earned&lt;/a&gt;, and I think now’s the perfect time to get an update.&lt;/p&gt;

&lt;p&gt;Mastering Vim was never meant to become a bestseller, but it did fairly well given the fact that I haven’t done much promotional work and haven’t been particularly active in Vim space since then.&lt;/p&gt;

&lt;p&gt;For the first edition of the book, I receive 16% royalties. For the second edition, I negotiated a step-up based on publisher’s net receipts (over the lifetime of the book): it starts as low as 16% and climbs as high as 25% once the publisher nets £40,000 from my book.&lt;/p&gt;

&lt;p&gt;Here’s year over year sales and revenue data, you can see it to be predictable and steady:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Year&lt;/th&gt;
      &lt;th&gt;Copies&lt;/th&gt;
      &lt;th&gt;Revenue&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;2018&lt;/td&gt;
      &lt;td&gt;284*&lt;/td&gt;
      &lt;td&gt;$363*&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2019&lt;/td&gt;
      &lt;td&gt;533&lt;/td&gt;
      &lt;td&gt;$1,433&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2020&lt;/td&gt;
      &lt;td&gt;548&lt;/td&gt;
      &lt;td&gt;$1,533&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2021&lt;/td&gt;
      &lt;td&gt;458&lt;/td&gt;
      &lt;td&gt;$1,752&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2022&lt;/td&gt;
      &lt;td&gt;386&lt;/td&gt;
      &lt;td&gt;$1,403&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2023&lt;/td&gt;
      &lt;td&gt;279&lt;/td&gt;
      &lt;td&gt;$1,112&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2024&lt;/td&gt;
      &lt;td&gt;381&lt;/td&gt;
      &lt;td&gt;$1,206&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;* Mastering Vim was published in Q4 2018.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/mastering-vim-copies-sold-2018-to-2024.png&quot; alt=&quot;Quarter-over-quarter graph of print vs ebook sale numbers.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On average, I earn about $5 for every print book sold, and a bit over $2 for every ebook sold.&lt;/p&gt;

&lt;p&gt;In addition to book sales, I also receive a portion of translation fees (for the Japanese translation), as well as subscriptions to the publisher’s service (something I do not promote nor care about).&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Book sales&lt;/th&gt;
      &lt;th&gt;Translation fees&lt;/th&gt;
      &lt;th&gt;Subscriptions&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;$8,803&lt;/td&gt;
      &lt;td&gt;$1,669&lt;/td&gt;
      &lt;td&gt;$572&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;In the past seven years, Mastering Vim has sold close to 3,000 copies (not including the Japanese edition, which I have no visibility into). This has grossed slightly over $11,000 in total revenue. While this amount is definitely not enough to live off the royalty income, I have truly enjoyed learning more about the domain and becoming a subject matter expert throughout the writing process. Having a published book feels like a legacy artifact that I can be proud of. Of course, the quarterly royalty statements are a nice bonus as well.&lt;/p&gt;

&lt;p&gt;If you’d like to see the book for yourself, &lt;a href=&quot;https://amzn.to/2EfGaN5&quot;&gt;Mastering Vim can be picked up on Amazon&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Tue, 01 Apr 2025 18:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/seven-years-of-mastering-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/seven-years-of-mastering-vim/</guid>
        
        
        <category>Writing</category>
        
        <category>Vim</category>
        
        <category>Finance</category>
        
      </item>
    
      <item>
        <title>Second Edition of Mastering Vim</title>
        <description>&lt;p&gt;I haven’t posted on my blog in a while. Besides life getting in the way, most of the stack the site was built on has become obsolete and out of date. I couldn’t really do much without a major refresh, which I finally managed to complete a few days ago.&lt;/p&gt;

&lt;p&gt;Now, for a belated announcement: I published the second edition of &lt;strong&gt;Mastering Vim&lt;/strong&gt; (a little over 9 months ago)!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://amzn.to/2EfGaN5&quot; target=&quot;blank&quot;&gt;
    &lt;img alt=&quot;A picture of Mastering Vim, second edition book cover.&quot; src=&quot;/images/mastering-vim-2e.jpg&quot; title=&quot;Mastering Vim, second edition.&quot; class=&quot;book-cover&quot; /&gt;
  &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This edition features new (charming) illustrations, updated and improved code examples, and teaches you how to use Vim9script. I’ve also removed about 30 pages of unnecessary content from the first edition—I’m getting better at writing, after all! I believe the second edition of Mastering Vim is a fantastic introduction to Vim.&lt;/p&gt;

&lt;p&gt;I’m also pleased to mention that this edition has been thoroughly edited by Christian Brabandt, a fitting successor as the lead of the Vim project after the passing of Bram Moolenaar, the original creator of Vim, in 2023.&lt;/p&gt;

&lt;p&gt;If that sounds interesting, consider picking it up on &lt;a href=&quot;https://amzn.to/41JSqi1&quot;&gt;Amazon&lt;/a&gt; (unfortunately your local bookstore is unlikely to stock one).&lt;/p&gt;
</description>
        <pubDate>Fri, 21 Mar 2025 20:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/second-edition-of-mastering-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/second-edition-of-mastering-vim/</guid>
        
        
        <category>Writing</category>
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Vimwiki with Google Drive on ChromeOS</title>
        <description>&lt;p&gt;In the past few years my work heavily shifted towards being mostly done in a web browser. Much of what I use today is email and documents, and I’m able to SSH into a dedicated Linux machine for rare instances of coding or running some scripts. Because of that my primary machine these days is a trusty Chromebook - really just a web browser with an OS stapled on top of it.&lt;/p&gt;

&lt;p&gt;I’ve &lt;a href=&quot;https://rosipov.com/blog/personal-wiki-with-vimwiki/&quot;&gt;used Vimwiki&lt;/a&gt; extensively for nearly 10 years now: it’s a fantastic way to organize my thoughts and everything I learn about the world, and it works with the tool I know and love - Vim. My Vimwiki followed me across machines, and I use Google Drive to keep it in sync regardless of the environment I use the Vimwiki in.&lt;/p&gt;

&lt;p&gt;It took me way longer than I would like to admit to get Vimwiki working on my Chromebook: here lies the journey of getting the Vimwiki to work on a ChromeOS. There are three major hurdles I had to jump over:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Getting Vim to run on ChromeOS.&lt;/li&gt;
  &lt;li&gt;Getting Vimwiki, Google Drive, and ChromeOS to play together nicely.&lt;/li&gt;
  &lt;li&gt;Getting the web view to work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good news is that ChromeOS allows you to run a Linux environment. Bad news, is that things can’t get a tiny bit finnicky.&lt;/p&gt;

&lt;p&gt;First, set up Linux to run on ChromeOS via “Settings &amp;gt; Advanced &amp;gt; Developers &amp;gt; Linux Development Environment &amp;gt; Turn on”. After a few prompts and a freshly brewed cup of coffee, you’ll have a Debian Linux environment running on your Chromebook.&lt;/p&gt;

&lt;p&gt;Newly installed Linux is accessible from the terminal:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/chromeos-linux-terminal.png&quot; alt=&quot;Screenshot of a Linux terminal available from ChromeOS.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Pop open the terminal and update Vim and get the latest version of Python:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt install python3 vim
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Download and install Vimwiki however you’d like: there are extensive instructions on &lt;a href=&quot;https://github.com/vimwiki/vimwiki&quot;&gt;GitHub&lt;/a&gt;. If you’re anything like me, you might have a &lt;a href=&quot;https://rosipov.com/blog/cross-platform-vim-plug-setup/&quot;&gt;self-installing vim-plug&lt;/a&gt;, and all you need is just plop your existing .vimrc into your Chromebook Linux instance.&lt;/p&gt;

&lt;p&gt;Now, for getting Google Drive, Vim, and ChromeOS to play together. ChromeOS and Linux are integrated well enough, and you can access your home directory through ChromeOS native file manager:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/chromeos-linux-files.png&quot; alt=&quot;Screenshot of Linux home directory available in ChromeOS file manager.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To share files in another direction, there’s a handy “Share with Linux” option for files:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/chromeos-share-with-linux.png&quot; alt=&quot;Screenshot of &amp;quot;Share with Linux&amp;quot; option in ChromeOS file manager.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This option shares files with Linux via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/chromeos&lt;/code&gt;. In Google Drive, I have a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki/&lt;/code&gt; folder which contains &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wiki/&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wiki_html/&lt;/code&gt;. I’m able to share that folder, and update Vimwiki configuration accordingly:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let g:vimwiki_list = [{
  \ &apos;path&apos;: &apos;/mnt/chromeos/GoogleDrive/MyDrive/vimwiki/wiki/&apos;,
  \ &apos;template_path&apos;: &apos;/mnt/chromeos/GoogleDrive/MyDrive/vimwiki/wiki/templates&apos;,
  \ &apos;template_default&apos;: &apos;default&apos;,
  \ &apos;template_ext&apos;: &apos;.html&apos;}]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now there’s a corner case I ran into when I had Vimwiki set up on a different account than the one I use to log into the Chromebook. Only the primary account’s Google Drive shows up in ChromeOS file manager. To work around that, I had to share my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki/&lt;/code&gt; folder with the primary account, and then share that with Linux. The resulting directory was available through a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/chormeos/GoogleDrive/ShortcutsSharedWithMe/...&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/chromeos-linux-shared-folders.png&quot; alt=&quot;Screenshot of Linux folders shared with ChromeOS.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At this point Vimwiki works just fine: working with the wiki and generating HTML is functional. All that’s left is getting the generated Vimwiki to show up in the web browser. Ever since Chrome disabled local file access, I (expectedly) haven’t been able to get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:Vimwiki2HTMLBrowse&lt;/code&gt; to function, since simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;file:///&lt;/code&gt; URLs aren’t accessible for security reasons.&lt;/p&gt;

&lt;p&gt;That’s where Python comes in, with it’s native web server module. I made a small alias in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.bashrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;alias vimwiki=&quot;cd /mnt/chromeos/GoogleDrive/MyDrive/vimwiki/ &amp;amp;&amp;amp; python3 -m http.server&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next thing you know, I’m finally able to access the generated web version of my Vimwiki via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8000/wiki_html&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimwiki-web-view.png&quot; alt=&quot;Screenshot of an HTML version of Vimwiki.&quot; /&gt;&lt;/p&gt;

</description>
        <pubDate>Mon, 17 Jul 2023 15:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/vimwiki-with-google-drive-on-chromeos/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/vimwiki-with-google-drive-on-chromeos/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>How I use Vimwiki</title>
        <description>&lt;p&gt;I’ve been &lt;a href=&quot;https://rosipov.com/blog/personal-wiki-with-vimwiki/&quot;&gt;using Vimwiki for 5 years&lt;/a&gt;, on and off. There’s a multi year gap in between, some entries are back to back for months on end, while some notes are quarters apart.&lt;/p&gt;

&lt;p&gt;Over those 5 years I’ve tried a few different lightweight personal wiki solutions, but kept coming back to Vimwiki due to my excessive familiarity with Vim and the simplicity of the underlying format (plain text FTW).&lt;/p&gt;

&lt;p&gt;I used to store my Vimwiki in Dropbox, but after Dropbox imposed a three device free tier limit, I &lt;a href=&quot;https://rosipov.com/blog/google-drive-on-linux-with-rclone/&quot;&gt;migrated to Google Drive&lt;/a&gt; for all my storage needs (and haven’t looked back!). I’m able to view my notes on any platform (including previewing the HTML pages on mobile).&lt;/p&gt;

&lt;p&gt;I love seeing how other people organize their Wiki homepage, so it’s only fair to share mine:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimwiki-homepage-screenshot.png&quot; alt=&quot;Screenshot of my wiki homepage.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I use Vimwiki as a combination of a knowledge repository and a daily project/work journal (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&amp;gt;wi&lt;/code&gt;). I love being able to interlink pages, and I find it extremely helpful to write entries journal-style, without having to think of a particular topic or a page to place my notes in.&lt;/p&gt;

&lt;p&gt;Whenever I have a specific topic in mind, I create a page for it, or contribute to an existing page. If I don’t - I create a diary entry (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&amp;gt;w&amp;lt;Leader&amp;gt;w&lt;/code&gt;), and move any developed topics into their own pages.&lt;/p&gt;

&lt;p&gt;I use folders (I keep wanting to call them namespaces) for disconnected topics which I don’t usually connect with the rest of the wiki: like video games, financial research, and so on. I’m not sure I’m getting enough value out of namespaces though, and I might revisit using those in the future: too many files in a single directory is not a problem since I don’t interract with the files directly.&lt;/p&gt;

&lt;p&gt;Most importantly, every once in a while I go back and revisit the organizational structure of the wiki: move pages into folders where needed (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiRenameLink&lt;/code&gt; makes this much less painful), add missing links for recently added but commonly mentioned topics (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiSearch&lt;/code&gt; helps here), and generally tidy up.&lt;/p&gt;

&lt;p&gt;I use images liberally (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{{local:images/nyan.gif|Nyan.}}&lt;/code&gt;), and I occasionally access the HTML version of the wiki (generated by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiAll2HTML&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;I’ve found useful to keep a running todo list with a set of things I need to accomplish for work or my projects, and I move those into corresponding diary pages once the tasks are ticked off.&lt;/p&gt;

&lt;p&gt;At the end of each week I try to have a mini-retrospective to validate if my week was productive, and if there’s anything I can do to improve upon what I’m doing.&lt;/p&gt;

&lt;p&gt;I also really like creating in-depth documentation on topics when researching something: the act of writing down and organizing information it helps me understand it better (that’s why, for instance, I have a beefy “financial/” folder, with a ton of research into somewhat dry, but important topics - portfolio rebalancing, health and auto insurance, home ownership, and so on).&lt;/p&gt;

&lt;p&gt;Incoherent rambling aside, I’m hoping this post will spark some ideas about how to set up and use your own personal wiki.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;September 2025 update: 6 years later, I’m still using Vimwiki. See &lt;a href=&quot;/blog/vimwiki-11-years-later/&quot;&gt;Vimwiki: 11 years later&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
        <pubDate>Mon, 24 Jun 2019 01:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/how-i-use-vimwiki/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/how-i-use-vimwiki/</guid>
        
        
        <category>Vim</category>
        
        <category>Technology</category>
        
      </item>
    
      <item>
        <title>Sane Vim defaults (from Neovim)</title>
        <description>&lt;p&gt;Vim comes with a set of often outdated and counter-intuitive defaults. Vim has been around for around 30 years, and it only makes sense that many defaults did not age well.&lt;/p&gt;

&lt;p&gt;Neovim addresses this issue by being shipped with many default options tweaked for modern editing experience. If you can’t or don’t want to use Neovim - I highly recommend setting some these defaults in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if !has(&apos;nvim&apos;)
  set nocompatible
  syntax on

  set autoindent
  set autoread
  set backspace=indent,eol,start
  set belloff=all
  set complete-=i
  set display=lastline
  set formatoptions=tcqj
  set history=10000
  set incsearch
  set laststatus=2
  set ruler
  set sessionoptions-=options
  set showcmd
  set sidescroll=1
  set smarttab
  set ttimeoutlen=50
  set ttyfast
  set viminfo+=!
  set wildmenu
endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The defaults above enable some of the nicer editor features, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;autoindent&lt;/code&gt; (respecting existing indentation), &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;incsearch&lt;/code&gt; (search as you type), or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wildmenu&lt;/code&gt; (enhanced command-line completion). The defaults also smooth out some historical artifacts, like unintuitive backspace behavior. Keep in mind, this breaks compatibility with some older Vim versions (but it’s unlikely to be a problem for most if not all users).&lt;/p&gt;
</description>
        <pubDate>Thu, 27 Dec 2018 23:28:37 +0000</pubDate>
        <link>https://rosipov.com/blog/sane-vim-defaults-from-neovim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/sane-vim-defaults-from-neovim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Status bar color in Vim terminal mode</title>
        <description>&lt;p&gt;If you’re using a custom color scheme (why wouldn’t you?) in conjunction with a terminal mode in Vim (again, why wouldn’t you?), you may have noticed that the terminal status bar has no respect for your color scheme.&lt;/p&gt;

&lt;p&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:term&lt;/code&gt;, and you’ll be greeted to the default status bar:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vim-terminal-mode-default-colors.png&quot; alt=&quot;Screenshot of the default terminal mode status line.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Since terminal mode is still in beta in Vim 8.1, we have to manually set the highlighting groups. It’ll require a bit of digging.&lt;/p&gt;

&lt;p&gt;Navigate to the directory containing your current color scheme. Depending on the plugin manager, the color schemes are located in different places. On Linux, default color schemes often live in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/share/vim/vimcurrent/colors&lt;/code&gt;. In this example, I’m using PaperColor scheme, and I have it installed using vim-plug in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vim/plugged/papercolor-theme&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;colors/PaperColor.vim&lt;/code&gt; is the file we’re looking for.&lt;/p&gt;

&lt;p&gt;Search for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLine&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineNC&lt;/code&gt; (tip: you can do a whole word search in Vim by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/\&amp;lt;StatusLine\&amp;gt;&lt;/code&gt;), and note the values used (you might have to jump through a few variables if the color scheme author decided to be fancy). You’re interested in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermbg&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermfg&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guibg&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guifg&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You might find something like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;hi StatusLine ctermbg=24 ctermfg=254 guibg=#004f87 guifg=#e4e4e4
hi StatusLineNC ctermbg=252 ctermfg=238 guibg=#d0d0d0 guifg=#444444
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Copy those lines to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt;. Change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLine&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineTerm&lt;/code&gt;, and change &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineNC&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineTermNC&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; Manually set the status line color.
hi StatusLineTerm ctermbg=24 ctermfg=254 guibg=#004f87 guifg=#e4e4e4
hi StatusLineTermNC ctermbg=252 ctermfg=238 guibg=#d0d0d0 guifg=#444444
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Reload &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:w | so %&lt;/code&gt;), and the terminal mode status line should have the same colors as your color scheme:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vim-terminal-mode-correct-colors.png&quot; alt=&quot;Screenshot of the terminal mode status line with corrected colors.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Above, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hi&lt;/code&gt; is a shorthand for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;highlight&lt;/code&gt;, which is used to define highlight group colors. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineTerm&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StatusLineTermNC&lt;/code&gt; define the highlight groups for terminal mode status line (in active and inactive windows respectively). Options &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermbg&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guibg&lt;/code&gt; define the background color, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctermfg&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;guifg&lt;/code&gt; are responsible for the foreground (text) color.&lt;/p&gt;
</description>
        <pubDate>Wed, 26 Dec 2018 21:02:24 +0000</pubDate>
        <link>https://rosipov.com/blog/status-bar-color-in-vim-terminal-mode/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/status-bar-color-in-vim-terminal-mode/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>My book has been published!</title>
        <description>&lt;p&gt;Over the past six to nine months I’ve been working on a book - &lt;a href=&quot;https://amzn.to/2EfGaN5&quot;&gt;Mastering Vim&lt;/a&gt;. Mastering Vim is a passion project which is meant to take the reader (you) from zero to a hero (future you): from knowing nothing about Vim, to becoming a power user. I cover many of Vim’s mysterious commands, philosophy behind the beloved editor, configuration tips, a plethora of community created plugins, as well as creating your own plugins.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://amzn.to/2EfGaN5&quot; style=&quot;margin-right: 1em;&quot; target=&quot;blank&quot;&gt;
 &lt;img alt=&quot;A picture of Mastering Vim book cover.&quot; src=&quot;/images/mastering-vim.jpg&quot; title=&quot;Mastering Vim.&quot; class=&quot;book-cover&quot; /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mastering Vim was written with support from Packt Publishing and was kindly reviewed by Bram Moolenaar (&lt;a href=&quot;https://moolenaar.net&quot;&gt;website&lt;/a&gt;) - the creator of Vim. Many people made this book possible, including &lt;a href=&quot;https://vimconf.org&quot;&gt;VimConf Japan&lt;/a&gt; crew, who kindly hosted me earlier this year. Thank you to everyone for making Mastering Vim happen!&lt;/p&gt;

&lt;p&gt;Give it a read and let me know what you think, &lt;a href=&quot;https://amzn.to/2EfGaN5&quot;&gt;Mastering Vim is available on Amazon&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;P.S: This post, like many others, is written in Vim.&lt;/p&gt;
</description>
        <pubDate>Tue, 25 Dec 2018 04:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/my-book-has-been-published/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/my-book-has-been-published/</guid>
        
        
        <category>Writing</category>
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Cross-platform vim-plug setup</title>
        <description>&lt;p&gt;I’ve recently switch to &lt;a href=&quot;https://github.com/junegunn/vim-plug&quot;&gt;vim-plug&lt;/a&gt;, a lightweight Vim plugin manager.&lt;/p&gt;

&lt;p&gt;It comes with a little &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; snippet which downloads the plugin, but it only works for Unix. I use Vim across all three platforms regularly, so I updated the snippet:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; Download and install vim-plug (cross platform).
if empty(glob(
    \ &apos;$HOME/&apos; . (has(&apos;win32&apos;) ? &apos;vimfiles&apos; : &apos;.vim&apos;) . &apos;/autoload/plug.vim&apos;))
  execute &apos;!curl -fLo &apos; .
    \ (has(&apos;win32&apos;) ? &apos;\%USERPROFILE\%/vimfiles&apos; : &apos;$HOME/.vim&apos;) . 
    \ &apos;/autoload/plug.vim --create-dirs &apos; .
    \ &apos;https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim&apos;
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above should work across all three major OSes, since Windows 10 recently received &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt; support.&lt;/p&gt;

</description>
        <pubDate>Sun, 23 Sep 2018 07:02:42 +0000</pubDate>
        <link>https://rosipov.com/blog/cross-platform-vim-plug-setup/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/cross-platform-vim-plug-setup/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>My .vimrc, annotated</title>
        <description>
&lt;p&gt;I’ve been using Vim for anywhere between 5 and 10 years, and my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; is all grown up.  I use  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{{{1&lt;/code&gt; to annotate folds in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;, and use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zM&lt;/code&gt; to close all folds and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zR&lt;/code&gt; to open all folds (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zc&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zo&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;za&lt;/code&gt; respectively close, open, and toggle individual folds). The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;---&lt;/code&gt; lines are simply cosmetic.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; =&amp;gt; Pre-load ------------------------------------------------------------- {{{1

set nocompatible  &quot; Required for many plugins, ensures it&apos;s not compatible with 
                  &quot; Vi, which nobody uses at this point.
filetype plugin indent on  &quot; Great answer: https://vi.stackexchange.com/a/10125
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/VundleVim/Vundle.vim&quot;&gt;Vundle&lt;/a&gt; is downright fantastic plugin manager. It allows one to install plugins with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:PluginInstall&lt;/code&gt; and upgrade plugins with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:PluginUpdate&lt;/code&gt;. Simple, easy, reliable. Of course you’ll need to &lt;a href=&quot;https://github.com/VundleVim/Vundle.vim#quick-start&quot;&gt;have Vundle installed&lt;/a&gt;, which I normally have as a git submodule.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; Required Vundle setup.
set runtimepath+=~/.vim/bundle/vundle
set runtimepath+=$GOROOT/misc/vim
call vundle#rc()

&quot; =&amp;gt; Vundle plugins ------------------------------------------------------- {{{1

Plugin &apos;gmarik/vundle&apos; &quot; The Vundle itself, to keep itself updated.

&quot; Colorschemes:
Plugin &apos;NLKNguyen/papercolor-theme&apos;
Plugin &apos;ajh17/Spacegray.vim.git&apos;
Plugin &apos;altercation/vim-colors-solarized&apos;
Plugin &apos;squarefrog/tomorrow-night.vim&apos;
Plugin &apos;vim-scripts/ScrollColors&apos;  &quot; Allows scrolling through colorschemes.

&quot; Language/tool integration and support:
Plugin &apos;burnettk/vim-angular&apos;
Plugin &apos;fatih/vim-go&apos;
Plugin &apos;christoomey/vim-tmux-navigator&apos;
Plugin &apos;mileszs/ack.vim&apos;
Plugin &apos;motemen/git-vim&apos;
Plugin &apos;nvie/vim-flake8&apos;
Plugin &apos;pangloss/vim-javascript&apos;
Plugin &apos;scrooloose/syntastic.git&apos;  &quot; Syntax checker.
Plugin &apos;tpope/vim-fugitive.git&apos;    &quot; Even better Git support.

&quot; Quality of life:
Plugin &apos;EinfachToll/DidYouMean&apos;    &quot; For typos during opening files.
Plugin &apos;ciaranm/detectindent&apos;      &quot; Automatically detect indent.
Plugin &apos;ervandew/supertab&apos;         &quot; Smarter autocompletion.
Plugin &apos;junegunn/goyo.vim&apos;         &quot; A plugin for writing prose.
Plugin &apos;majutsushi/tagbar&apos;         &quot; List tags in a sidebar.
Plugin &apos;scrooloose/nerdtree&apos;       &quot; A directory tree in a sidebar.
Plugin &apos;tomtom/tcomment_vim&apos;       &quot; Easy comment blocks with &amp;lt;Leader&amp;gt;cc.
Plugin &apos;tpope/vim-abolish&apos;         &quot; Extended abbreviation/substition.
Plugin &apos;tpope/vim-repeat&apos;          &quot; Intelligent repeat with &apos;.&apos;
Plugin &apos;tpope/vim-surround&apos;        &quot; Work with pairs of quotes/anything.
Plugin &apos;tpope/vim-unimpaired.git&apos;  &quot; Handy bracket mappings.
Plugin &apos;tpope/vim-vinegar&apos;         &quot; Enhanced directory browser.
Plugin &apos;vim-scripts/DirDiff.vim&apos;   &quot; Directory level diff.

&quot; New features:
Plugin &apos;Lokaltog/vim-easymotion&apos;   &quot; Easy navigation with &amp;lt;Leader&amp;gt;&amp;lt;Leader&amp;gt;w.
Plugin &apos;kien/ctrlp.vim&apos;			   &quot; Hit &amp;lt;C&amp;gt;p for a list of files/buffers.
Plugin &apos;vim-scripts/Gundo.git&apos;     &quot; Intelligent undo tree.
Plugin &apos;vim-scripts/vimwiki&apos;       &quot; A personal local Wiki.

if v:version &amp;gt; 703
  Plugin &apos;SirVer/ultisnips&apos;        &quot; Intricate snippets.
  Plugin &apos;chrisbra/vim-diff-enhanced&apos;
endif

&quot; =&amp;gt; Plugins configuration ------------------------------------------------ {{{1

&quot; NERDTree: auto close if last window.
function! s:CloseIfOnlyNerdTreeLeft()
  if exists(&quot;t:NERDTreeBufName&quot;)
    if bufwinnr(t:NERDTreeBufName) != -1
      if winnr(&quot;$&quot;) == 1
        q
      endif
    endif
  endif
endfunction

&quot; Force Gundo preview to the bottom.
let g:gundo_preview_bottom = 1

&quot; Map Gundo.
nnoremap &amp;lt;F5&amp;gt; :GundoToggle&amp;lt;cr&amp;gt;

&quot; DetectIndent: Enable and configure.
augroup detectindent
  autocmd!
  autocmd BufReadPost * :DetectIndent
augroup END
let g:detectindent_preferred_expandtab = 1
let g:detectindent_preferred_indent = 2

&quot; UltiSnips: Compatibility with YouCompleteMe via SuperTab.
let g:ycm_key_list_select_completion = [&apos;&amp;lt;C-n&amp;gt;&apos;, &apos;&amp;lt;Down&amp;gt;&apos;]
let g:ycm_key_list_previous_completion = [&apos;&amp;lt;C-p&amp;gt;&apos;, &apos;&amp;lt;Up&amp;gt;&apos;]
let g:SuperTabDefaultCompletionType = &apos;&amp;lt;C-n&amp;gt;&apos;
let g:UltiSnipsExpandTrigger = &quot;&amp;lt;tab&amp;gt;&quot;
let g:UltiSnipsJumpForwardTrigger = &quot;&amp;lt;tab&amp;gt;&quot;
let g:UltiSnipsJumpBackwardTrigger = &quot;&amp;lt;s-tab&amp;gt;&quot;

&quot; VimWiki: default location.
let g:vimwiki_list = [{
  \ &apos;path&apos;: &apos;$HOME/Dropbox/wiki&apos;,
  \ &apos;template_path&apos;: &apos;$HOME/Dropbox/wiki/templates&apos;,
  \ &apos;template_default&apos;: &apos;default&apos;,
  \ &apos;template_ext&apos;: &apos;.html&apos;}]

&quot; Map Tagbar.
nnoremap &amp;lt;F8&amp;gt; :TagbarToggle&amp;lt;cr&amp;gt;

&quot; Synastic configuration.
let g:syntastic_always_populate_loc_list = 1  &quot; Make :lnext work.
let g:syntastic_html_checkers = [&apos;&apos;]
let g:syntastic_javascript_checkers = [&apos;gjslint&apos;, &apos;jshint&apos;]
let g:syntastic_javascript_gjslint_args = &apos;--strict&apos;
let g:syntastic_python_checkers = [&apos;gpylint&apos;]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most plugins above change slightly change daily Vim workflow: the way one navigates files, replaying actions, working with snippets, minor tweaks to editing - and I highly recommend at least skimming through README of plugins you’re interested in so you can incorporate the changes in your workflow.&lt;/p&gt;

&lt;p&gt;I have a set of simple defaults I use everywhere, major changes being changing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;;&lt;/code&gt; and moving my leader key to a spacebar. Everything else are tiny quality of life tweaks.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; =&amp;gt; Editing -------------------------------------------------------------- {{{1

syntax on

&quot; Indentation settings.
set autoindent
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4

&quot; Disable backups and .swp files.
set nobackup
set noswapfile
set nowritebackup

&quot; Semicolon is too long to type.
nnoremap ; :
vnoremap ; :

&quot; Map leader key.
let mapleader = &quot;\&amp;lt;Space&amp;gt;&quot;

&quot; Use system clipboard.
set clipboard=unnamedplus

&quot; Enable wild menu (tab command autocompletion).
set wildmenu
set wildmode=list:longest,full

&quot; Don&apos;t complain about unsaved files when switching buffers.
set hidden

&quot; Make soft line breaks much better looking.
if v:version &amp;gt; 703
  set breakindent
endif

&quot; Pretty soft break character.
let &amp;amp;showbreak=&apos;↳ &apos;

&quot; =&amp;gt; Looks ---------------------------------------------------------------- {{{1

set background=dark
colorscheme spacegray

&quot; Set terminal window title and set it back on exit.
set title
let &amp;amp;titleold = getcwd()

&quot; Shorten press ENTER to continue messages.
set shortmess=atI

&quot; Show last command.
set showcmd

&quot; Highlight cursor line.
set cursorline

&quot; Ruler (line, column and % at the right bottom).
set ruler

&quot; Display line numbers if terminal is wide enough.
if &amp;amp;co &amp;gt; 80
  set number
endif

&quot; Soft word wrap.
set linebreak

&quot; Prettier display of long lines of text.
set display+=lastline

&quot; Always show statusline.
set laststatus=2

&quot; =&amp;gt; Movement and search -------------------------------------------------- {{{1

&quot; Ignore case when searching.
set ignorecase
set smartcase

&quot; Fast split navigation.
nnoremap &amp;lt;C-j&amp;gt; &amp;lt;C-W&amp;gt;&amp;lt;C-J&amp;gt;
nnoremap &amp;lt;C-k&amp;gt; &amp;lt;C-W&amp;gt;&amp;lt;C-K&amp;gt;
nnoremap &amp;lt;C-l&amp;gt; &amp;lt;C-W&amp;gt;&amp;lt;C-L&amp;gt;
nnoremap &amp;lt;C-h&amp;gt; &amp;lt;C-W&amp;gt;&amp;lt;C-H&amp;gt;

&quot; Absolute movement for word-wrapped lines.
nnoremap j gj
nnoremap k gk

&quot; =&amp;gt; Misc ----------------------------------------------------------------- {{{1

&quot; Use Unix as the standart file type.
set ffs=unix,dos,mac

&quot; Ignore compiled files.
set wildignore=*.o,*~,*.pyc,*.pyo

&quot; Ignore virtualenv directory.
set wildignore+=env

&quot; Fold using {{{n, where n is fold level
set foldmethod=marker

&quot; =&amp;gt; Fixes and hacks ------------------------------------------------------ {{{1

&quot; Ignore mouse (in GVIM).
set mouse=c

&quot; Fix backspace behavior in GVIM.
set bs=2

&quot; NERDTree arrows in Windows.
if has(&quot;win32&quot;) || has(&quot;win64&quot;) || has(&quot;win32unix&quot;)
  let g:NERDTreeDirArrows = 0
endif

&quot; Increase lower status bar height in diff mode.
if &amp;amp;diff
  set cmdheight=2
endif

&quot; Unfold all files by default.
au BufRead * normal zR
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I have some custom commands and shortcuts I’m using, but not too many. I find that I mostly just forget to use shortcuts I make, and I end up deleting lines from this section regularly.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; =&amp;gt; Custom commands ------------------------------------------------------ {{{1

&quot; Trim trailing whitespace in the file.
command TrimWhitespace %s/\s\+$//e

&quot; Command to close current buffer without closing the window.
command Bd :bp | :sp | :bn | :bd

&quot; =&amp;gt; Leader shortcuts ----------------------------------------------------- {{{1

nnoremap &amp;lt;Leader&amp;gt;] &amp;lt;C-]&amp;gt;          &quot; Jump to ctags tag definition.
nnoremap &amp;lt;Leader&amp;gt;p :CtrlP&amp;lt;cr&amp;gt;     &quot; Fuzzy complete for files.
nnoremap &amp;lt;Leader&amp;gt;t :CtrlPTag&amp;lt;cr&amp;gt;  &quot; Fuzzy complete for tags.
nnoremap &amp;lt;Leader&amp;gt;r :redraw!&amp;lt;cr&amp;gt;   &quot; Redraw the screen (for visual glitches).
nnoremap &amp;lt;Leader&amp;gt;w :w&amp;lt;cr&amp;gt;         &quot; Write a file.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hope you find this useful and take away a few bits and pieces for your own workflow.&lt;/p&gt;

</description>
        <pubDate>Wed, 21 Feb 2018 15:00:00 +0000</pubDate>
        <link>https://rosipov.com/blog/my-vimrc-annotated/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/my-vimrc-annotated/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>DidYouMean plugin for Vim</title>
        <description>&lt;p&gt;&lt;a href=&quot;https://github.com/EinfachToll/DidYouMean&quot;&gt;DidYouMean&lt;/a&gt; Vim plugin is very simple: it asks you if the file you are
trying to open is indeed the right file. How is this useful? Here’s how:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vim-plugin-didyoumean.png&quot; alt=&quot;DidYouMean plugin in action.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Say you have two files with a similarly starting names: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model.py&lt;/code&gt; and
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model_test.py&lt;/code&gt;. You type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim mo&lt;/code&gt;, you hit tab to autocomplete the name, you
hit enter. In vanilla Vim, you’d be opening a new file: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model&lt;/code&gt;, since that’s
where shell’s tab-completion stopped. DidYouMean detects such a nuance and asks
you if you wanted to open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model.py&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model_test.py&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Simple idea, and instantly after trying this out, I would really expect this
feature to be included in vanilla Vim.&lt;/p&gt;

</description>
        <pubDate>Wed, 10 Jun 2015 20:02:00 +0000</pubDate>
        <link>https://rosipov.com/blog/didyoumean-plugin-for-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/didyoumean-plugin-for-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Gundo tree for Vim</title>
        <description>&lt;p&gt;One of the obscure, but tremendously useful features of Vim is an undo tree.
You would expect Vim to have a simple stack for undo and redo actions, but it’s
much more complex than that: Vim keeps track of every change you made in the
current session, making it possible to access change history beyond basic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;u&lt;/code&gt;
and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C-r&lt;/code&gt; commands.&lt;/p&gt;

&lt;p&gt;Default interface for accessing far out branches of the undo tree leaves to be
desired, but that’s where &lt;a href=&quot;http://sjl.bitbucket.org/gundo.vim/&quot;&gt;Gundo&lt;/a&gt; comes in.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vim-gundo-tree.png&quot; alt=&quot;Gundo tree in Vim.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Gundo provides an easy to use interface for navigating history branches. In the
screenshot above, I am previewing a diff in one of the undo tree branches
inaccessible via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;u&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;As per author’s recommendation, I mapped the plugin to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F5&lt;/code&gt;, which seems quite
convenient to me:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nnoremap &amp;lt;F5&amp;gt; :GundoToggle&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Usage is quite easy. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F5&lt;/code&gt; opens or closes the undo tree, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; are used
to travel through changes. Enter key applies the changes.&lt;/p&gt;

</description>
        <pubDate>Sun, 07 Jun 2015 20:10:15 +0000</pubDate>
        <link>https://rosipov.com/blog/gundo-tree-for-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/gundo-tree-for-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>My experience switching to buffers</title>
        <description>&lt;p&gt;About a year ago I stumbled upon an article explaining the difference between
Vim tabs and buffers. The author emphasized that tabs are merely window
layouts, and therefore one-file-per-tab idea I was used to at the moment just
wasn’t proper. Instead, author suggested the use of buffer commands to switch
between multiple files. I decided to give it a shot, and here are some ideas I
would like to share after switching to the use of buffers.&lt;/p&gt;

&lt;p&gt;Buffers are open files (they also may not be associated with any files), but
they’re not necessarily visible at any given moment. In Vim, windows are not
linked to any particular buffer, so you can easily cycle through buffers from
within any window.&lt;/p&gt;

&lt;p&gt;First and foremost, you probably want to add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set hidden&lt;/code&gt; to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;.
This option lets you switch between buffers without having to save files.&lt;/p&gt;

&lt;p&gt;At it’s basics, you only need few commands for operating buffers:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:ls&lt;/code&gt; to list all buffers for this session.&lt;/li&gt;
  &lt;li&gt;To move between next and previous buffers use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bn&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bp&lt;/code&gt; respectively.&lt;/li&gt;
  &lt;li&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:b partial_buffer_name&lt;/code&gt; for navigating to the buffer of your choice.
Buffer name auto-complete is supported.&lt;/li&gt;
  &lt;li&gt;You can also use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bN&lt;/code&gt;, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N&lt;/code&gt; is a buffer number to jump to a specific
buffer.&lt;/li&gt;
  &lt;li&gt;Get in a habit of closing buffers you will not use with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:bd&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vim-list-buffers.png&quot; alt=&quot;A list of open buffers in Vim.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The hardest thing about stopping to use tabs and switching to buffers instead
is not having the visual aid: I was used to having a list of files always
available at a glance, at the top of my screen. To check what files I’m working
on now - I have to hit four keys: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:ls&lt;/code&gt; (fourth being “Enter”).&lt;/p&gt;

&lt;p&gt;Not surprisingly, this taught me to be more mindful about my editing
experience. I usually have a clear structure of the files I’m working on in my
head. And if the list is getting to long to easily remember, then I’m probably
doing something wrong: time to take a break and reset my Vim session.&lt;/p&gt;

&lt;p&gt;The experience overall reminded me of my recent switch to blank keyboard key
caps: with no inscriptions to aid you, I first felt a bit at loss, especially
with they keys I couldn’t find without looking: like function keys or special
symbols. But after some time with the blank key caps, I improved my typing
skill, and know where even the most obscure characters hide. The switch helped
me to improve my typing experience overall.&lt;/p&gt;

&lt;p&gt;With Vim, it’s a similar story. After getting past the initial confusion, I
achieved high level of awareness about my editing sessions. It didn’t make the
editing process any faster, but instead much more satisfying.&lt;/p&gt;

&lt;p&gt;But you already new that, since Vim isn’t really about speed.&lt;/p&gt;

&lt;p&gt;UPDATE: Made a few corrections and added a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:b partial_buffer_name&lt;/code&gt; command
thanks to &lt;a href=&quot;http://www.reddit.com/user/___violet___&quot;&gt;/u/___violet___&lt;/a&gt;’s &lt;a href=&quot;http://www.reddit.com/r/vim/comments/382v6q/my_experience_switching_to_buffers/crrunni&quot;&gt;Reddit comment&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Mon, 01 Jun 2015 13:28:42 +0000</pubDate>
        <link>https://rosipov.com/blog/my-experience-switching-to-buffers/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/my-experience-switching-to-buffers/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Custom templates in vimwiki</title>
        <description>&lt;p&gt;I got myself into a habit of using vimwiki for the past year: it helps me to
keep track of random bits of information, work and project notes, as well as
daily goals and achievements. You can read more about vimwiki in an article I
wrote a while back: “&lt;a href=&quot;https://rosipov.com/blog/personal-wiki-with-vimwiki/&quot;&gt;Personal wiki with vimwiki&lt;/a&gt;”.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimwiki-workflow-habits.png&quot; alt=&quot;HTML page generated by vimwiki with a custom navigation bar.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One of vimwiki’s features I really like is an ability to convert whole wiki to
HTML with a single command: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiAll2HTML&lt;/code&gt;. There is one annoyance though:
HTML vimwiki pages don’t have any navigation elements: the only way to navigate
between pages is by clicking through links within a page or using browser’s
“back” button.&lt;/p&gt;

&lt;p&gt;Luckily, vimwiki has a setting which allows using custom templates for
generating HTML. Assuming your wiki is in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/Dropbox/wiki&lt;/code&gt; (can be anywhere
else though), make following changes to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let g:vimwiki_list = [{
  \ &apos;path&apos;: &apos;$HOME/Dropbox/wiki&apos;,
  \ &apos;template_path&apos;: &apos;$HOME/Dropbox/wiki/templates&apos;,
  \ &apos;template_default&apos;: &apos;default&apos;,
  \ &apos;template_ext&apos;: &apos;.html&apos;}]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After that, create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/Dropbox/wiki/templates/default.html&lt;/code&gt; using
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki/autoload/vimwiki/default.tpl&lt;/code&gt; as a base. I added simple navigation bar
to my default template:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
	&amp;lt;link rel=&quot;Stylesheet&quot; type=&quot;text/css&quot; href=&quot;%root_path%style.css&quot; /&amp;gt;
	&amp;lt;title&amp;gt;%title%&amp;lt;/title&amp;gt;
	&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;a href=&quot;%root_path%index.html&quot;&amp;gt;Index&amp;lt;/a&amp;gt; |
	&amp;lt;a href=&quot;%root_path%diary/diary.html&quot;&amp;gt;Diary&amp;lt;/a&amp;gt;
	&amp;lt;hr&amp;gt;
	&amp;lt;div class=&quot;content&quot;&amp;gt;
	%content%
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now it’s much easier to jump between wiki entries. Of course, customization
doesn’t end there: you can change styles, add JavaScript and make your wiki all
fancy and advanced.&lt;/p&gt;

&lt;p&gt;If you’d like to get even better about using Vim, I wrote a book about it:
&lt;a href=&quot;https://amzn.to/3rne4dk&quot;&gt;Mastering Vim&lt;/a&gt;. I’m pretty proud of how it turned out, and I hope you like
it too.&lt;/p&gt;

</description>
        <pubDate>Thu, 05 Feb 2015 18:40:33 +0000</pubDate>
        <link>https://rosipov.com/blog/custom-templates-in-vimwiki/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/custom-templates-in-vimwiki/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Distraction-free writing with VimRoom</title>
        <description>&lt;p&gt;Recently I’ve been writing much more than I used to: long emails, software
documentation, personal Wiki, keeping work journal, blogging, writing
challenges… Luckily enough, I do all of this writing in Vim. But sometimes
writing prose in Vim might feel a bit unnatural, especially if you have a wide
screen: text will be on the very left side of the screen, or (if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;textwrap&lt;/code&gt; is
not enabled) you’ll end up with lines hundreds of characters long. And overall,
editing text in Vim sometimes might feel a bit clunky - with all the extra
information and high-tech (or low-tech, depending on your perspective) look.&lt;/p&gt;

&lt;p&gt;I found a simple, yet sufficient solution for this issue: &lt;a href=&quot;http://projects.mikewest.org/vimroom/&quot;&gt;VimRoom&lt;/a&gt;. It’s a
Vim plugin which enters distraction-free writing mode, by centering the
80-character block of text on your screen. It’s highly configurable, and I
found it to look especially pleasing on vertical monitors (which I prefer to
use for writing). It looks presentable even on smaller screens though, here’s a
screenshot:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/vimroom-screenshot.png&quot; alt=&quot;VimRoom plugin in use.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Install the plugin (use a package manager like Vundle or &lt;a href=&quot;https://rosipov.com/blog/vim-pathogen-and-git-submodules/&quot;&gt;Pathogen&lt;/a&gt; to
simplify the task) and add a following line to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nnoremap &amp;lt;Leader&amp;gt;vr :VimroomToggle&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&amp;gt;vr&lt;/code&gt; to drop in/out of the VimRoom mode (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&lt;/code&gt; is a
backslash &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\&lt;/code&gt; character by default).&lt;/p&gt;

&lt;p&gt;GitHub link: &lt;a href=&quot;https://github.com/mikewest/vimroom&quot;&gt;https://github.com/mikewest/vimroom&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Wed, 23 Jul 2014 21:46:20 +0000</pubDate>
        <link>https://rosipov.com/blog/distraction-free-writing-with-vimroom/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/distraction-free-writing-with-vimroom/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Personal wiki with vimwiki</title>
        <description>&lt;p&gt;I recently found an interesting way to organize random bits of information: a
personal Wiki. It’s a great idea to have data repository shared between your
machines: important notes about people, conversations, events, tasks you’ve
accomplished, thoughts, and a hundred of little pieces of knowledge which don’t
belong anywhere else. There is plenty of software out there which lets you set
up a personal Wiki, and some of it is very lightweight and well polished.
However, I prefer to do most of my editing and writing in Vim. As tip #22 from
“The Pragmatic Programmer” states:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Use a single editor well&lt;/p&gt;

  &lt;p&gt;We think it is better to know one editor very well, and use it for all
editing tasks: code, documentation, memos, system administration, and so
on. Without a single editor, you face a potential modern day Babel of
confusion.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I fully agree with the above statement and I try to use one editor for the
majority of tasks which require typing, without having to remember which editor
contains certain features, and which doesn’t. That’s one of the main reasons I
went with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki&lt;/code&gt; - a lightweight and clean personal Wiki with it’s own
Wiki-style markdown. Oh, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki&lt;/code&gt; also subscribes to another tip from “The
Pragmatic Programmer”:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Keep knowledge in plain text&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki&lt;/code&gt; plugin has a number of interesting and useful features:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Memorable mappings for moving in and out of Wikis. Hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;leader&amp;gt;ww&lt;/code&gt; and you
are on the home page of your Wiki. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;leader&amp;gt;wt&lt;/code&gt; will open the Wiki in a
new tab: the rest of the mappings are as intuitive.&lt;/li&gt;
  &lt;li&gt;Multiple Wikis support: really handy if you have a number of separate
projects for which you want to keep separate entries.&lt;/li&gt;
  &lt;li&gt;Diary-like quick notes. You can create an instant page for today by hitting
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;leader&amp;gt;w&amp;lt;leader&amp;gt;w&lt;/code&gt;. Combination &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;leader&amp;gt;wi&lt;/code&gt; brings you to a diary home
page, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;leader&amp;gt;w&amp;lt;leader&amp;gt;i&lt;/code&gt; re-indexes the diary entries.&lt;/li&gt;
  &lt;li&gt;Easy link creation: hit enter on a word and it will turn into a link to
another page. Hitting enter on a link will transport you to the destination
page. Simply surrounding text with double square brackets (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[[]]&lt;/code&gt;) works as
well.&lt;/li&gt;
  &lt;li&gt;Navigation: enter to follow a link, backspace to go back.&lt;/li&gt;
  &lt;li&gt;You can convert all your records into html by executing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:VimwikiAll2HTML&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Extensive and well written help file. Just run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:help vimwiki&lt;/code&gt; and start
reading.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The list can go on forever, but these are the features I found to be the most
useful.&lt;/p&gt;

&lt;p&gt;In order to enjoy synchronization between all my machines, I hosted my Wiki in
a Dropbox folder - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vimwiki&lt;/code&gt; lets you specify locations from each one of your
Wikis.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let g:vimwiki_list = [{&apos;path&apos;: &apos;$HOME/Dropbox/wiki&apos;}]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Download it from the GitHub: &lt;a href=&quot;https://github.com/vimwiki/vimwiki&quot;&gt;https://github.com/vimwiki/vimwiki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;September 2025 update: 11 years later, I’m still using Vimwiki. See &lt;a href=&quot;/blog/vimwiki-11-years-later/&quot;&gt;Vimwiki: 11 years later&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 08 Jul 2014 04:14:21 +0000</pubDate>
        <link>https://rosipov.com/blog/personal-wiki-with-vimwiki/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/personal-wiki-with-vimwiki/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Easy commenting with tcomment.vim</title>
        <description>&lt;p&gt;This plugin has been in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vim&lt;/code&gt; directory for a few years, and I sometimes
forget that it’s not a built-in Vim feature.&lt;/p&gt;

&lt;p&gt;Link to a GitHub repository: &lt;a href=&quot;https://github.com/tomtom/tcomment_vim&quot;&gt;https://github.com/tomtom/tcomment_vim&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Tue, 08 Jul 2014 03:22:08 +0000</pubDate>
        <link>https://rosipov.com/blog/easy-commenting-with-tcomment-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/easy-commenting-with-tcomment-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Navigate files easily with ctrlp.vim</title>
        <description>&lt;p&gt;Few years ago I used a lightweight IDE called “Sublime Text 2”. And one of the
most compelling features of it was an ability to switch between files by
hitting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;P&lt;/code&gt; and typing in a part of the file name.&lt;/p&gt;

&lt;p&gt;This is exactly what &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ctrlp.vim&lt;/code&gt; implements in vim. Usage is extremely simple:
install the plugin, hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;P&lt;/code&gt;, type a part of the file name, select a
desired file and hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Enter&lt;/code&gt;. You can use arrow keys or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;J&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;K&lt;/code&gt; to navigate between suggested file list.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Source: &lt;a href=&quot;https://github.com/kien/ctrlp.vim&quot;&gt;https://github.com/kien/ctrlp.vim&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Mon, 13 Jan 2014 01:10:34 +0000</pubDate>
        <link>https://rosipov.com/blog/navigate-files-easily-with-ctrlp-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/navigate-files-easily-with-ctrlp-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Open previously edited file in vim</title>
        <description>&lt;p&gt;You can open previous location by hitting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl-O&lt;/code&gt;. You can prefix the command
with a number to go multiple files back. You can also travel forward in “file
history” by using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl-I&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There’s a nice article on &lt;a href=&quot;http://vim.wikia.com/wiki/Jumping_to_previously_visited_locations&quot;&gt;Vim Wikia&lt;/a&gt; with more details on a subject.&lt;/p&gt;

</description>
        <pubDate>Mon, 25 Nov 2013 00:39:34 +0000</pubDate>
        <link>https://rosipov.com/blog/open-previously-edited-file-in-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/open-previously-edited-file-in-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Old file version in split with vim</title>
        <description>&lt;p&gt;If you use git VCS, you can view previous version of the file you are currently
editing in a split window by executing following command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:vsp tmp | read !git show HEAD^:path/from/working/directory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For the instant syntax highlighting, you can specify temporary file’s
extension, like following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:vsp tmp.py | read !git show HEAD^:lib/module.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can also cycle back by few versions by replacing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HEAD^&lt;/code&gt; (which points to
the previous commit) with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HEAD~N&lt;/code&gt;, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N&lt;/code&gt; is the number of commits you
would like to go back in history by. For example, if you would like to get a
version of the file 4 commits ago - you can do so by executing following
command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:vsp tmp | read !git show HEAD~4:path/from/working/directory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s a pretty nice hack when you need to quickly view previous version of the
file you are working on.&lt;/p&gt;
</description>
        <pubDate>Sun, 24 Nov 2013 04:14:19 +0000</pubDate>
        <link>https://rosipov.com/blog/old-file-version-in-split-with-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/old-file-version-in-split-with-vim/</guid>
        
        <category>git</category>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Pasting with vim and indentation issues</title>
        <description>&lt;p&gt;If you use vim often - you probably had to paste something into vim from the
outside source. And, if you have corresponding indentation rules, they will get
applied, turning your nice block of code into something that looks more like a
case of stairs:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def foo(a, b):
        a, b = b, a
            print &quot;I am doing something important.&quot;
                return a - b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Quite nasty, isn’t it? But that’s where vim’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;paste&lt;/code&gt; option comes in.  Before
pasting, execute &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set paste&lt;/code&gt;. If you go into insert mode, you’ll see the usual
mode indicator switch to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-- INSERT (paste) --&lt;/code&gt;. Try pasting the same block of
code now:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def foo(a, b):
    a, b = b, a
    print &quot;I am doing something important.&quot;
    return a - b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Beautiful. Don’t forget to switch back to a regular mode by executing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set
nopaste&lt;/code&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 17 Nov 2013 01:02:30 +0000</pubDate>
        <link>https://rosipov.com/blog/pasting-with-vim-and-indentation-issues/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/pasting-with-vim-and-indentation-issues/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Use vimdiff as git mergetool</title>
        <description>&lt;p&gt;Using vimdiff as a git mergetool can be pretty confusing - multiple windows and
little explanation. This is a short tutorial which explains basic usage, and
what the LOCAL, BASE, and REMOTE keywords mean. This implies that you have at
least a little bit of basic vim knowledge (how to move, save, and switch
between split windows). If you don’t, there’s a short article for you:
&lt;a href=&quot;https://rosipov.com/blog/using-vim-for-writing-code/&quot;&gt;Using vim for writing code&lt;/a&gt;. Some basic understanding of git and branching
is required as well, obviously.&lt;/p&gt;

&lt;h2 id=&quot;git-config&quot;&gt;Git config&lt;/h2&gt;

&lt;p&gt;Prior to doing anything, you need to know how to set vimdiff as a git
mergetool. That being said:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will set git as the default merge tool, will display a common ancestor
while merging, and will disable the prompt to open the vimdiff.&lt;/p&gt;

&lt;h2 id=&quot;creating-merge-conflict&quot;&gt;Creating merge conflict&lt;/h2&gt;

&lt;p&gt;Let’s create a test situation. You are free to skip this part or you can work
along with the tutorial.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir zoo
cd zoo
git init
vi animals.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s add some animals:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat
dog
octopus
octocat
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Save the file.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git add animals.txt
git commit -m &quot;Initial commit&quot;
git branch octodog
git checkout octodog
vi animals.txt  # let&apos;s change octopus to octodog
git add animals.txt
git commit -m &quot;Replace octopus with an octodog&quot;
git checkout master
vi animals.txt  # let&apos;s change octopus to octoman
git add animals.txt
git commit -m &quot;Replace octopus with an octoman&quot;
git merge octodog  # merge octodog into master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s where we get a merge error:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Auto-merging animals.txt
CONFLICT (content): Merge conflict in animals.txt
Automatic merge failed; fix conflicts and then commit the result.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;resolving-merge-conflict-with-vimdiff&quot;&gt;Resolving merge conflict with vimdiff&lt;/h2&gt;

&lt;p&gt;Let’s resolve the conflict:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git mergetool
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/three-way-merge-with-vimdiff.png&quot; alt=&quot;Three-way merge using vimdiff. Local changes are in top left, followed by a common ancestor, and branch `octodog` in the top right corner. Resulting file is at the bottom.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This looks terrifying at first, but let me explain what is going on.&lt;/p&gt;

&lt;p&gt;From left to right, top to the bottom:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LOCAL&lt;/code&gt; – this is file from the current branch
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BASE&lt;/code&gt; – common ancestor, how file looked before both changes
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;REMOTE&lt;/code&gt; – file you are merging into your branch
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MERGED&lt;/code&gt; – merge result, this is what gets saved in the repo&lt;/p&gt;

&lt;p&gt;Let’s assume that we want to keep the “octodog” change (from REMOTE). For that,
move to the MERGED file (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl + w, j&lt;/code&gt;), move your cursor to a merge conflict
area and then:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:diffget RE
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This gets the corresponding change from REMOTE and puts it in MERGED file. You
can also:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:diffg RE  &quot; get from REMOTE
:diffg BA  &quot; get from BASE
:diffg LO  &quot; get from LOCAL
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Save the file and quit (a fast way to write and quit multiple files is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:wqa&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git commit&lt;/code&gt; and you are all set!&lt;/p&gt;

&lt;p&gt;If you’d like to get even better about using Vim, I wrote a book about it:
&lt;a href=&quot;https://amzn.to/3rne4dk&quot;&gt;Mastering Vim&lt;/a&gt;. I’m pretty proud of how it turned out, and I hope you like
it too.&lt;/p&gt;

</description>
        <pubDate>Fri, 14 Jun 2013 02:18:16 +0000</pubDate>
        <link>https://rosipov.com/blog/use-vimdiff-as-git-mergetool/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/use-vimdiff-as-git-mergetool/</guid>
        
        <category>git</category>
        
        <category>vimdiff</category>
        
        
        <category>Vim</category>
        
        <category>CLI</category>
        
      </item>
    
      <item>
        <title>Colorless week results</title>
        <description>&lt;p&gt;A round-up of &lt;a href=&quot;https://rosipov.com/blog/a-week-without-colorful-prompt/&quot;&gt;The Week Without Colorful Prompt&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I worked with the colors disabled in bash, git, and vim for a week. So how did
it go? It is definitely an interesting experience, but such a harsh change that
it doesn’t really work out with everything.&lt;/p&gt;

&lt;h2 id=&quot;bash&quot;&gt;Bash&lt;/h2&gt;

&lt;p&gt;Disabling colorful PS1 and removing color output for ls commands forced me to
concentrate more on the actual text, changing the perception of the general
bash workflow. I was more concentrated on the task, missed less details, and
generally paid more attention to the output.&lt;/p&gt;

&lt;h2 id=&quot;git&quot;&gt;Git&lt;/h2&gt;

&lt;p&gt;Never repeat my mistake by disabling colors for git diff. Log and status are
fairly easy to read, but the disabling of colors noticeably slows down the
workflow.&lt;/p&gt;

&lt;h2 id=&quot;vim&quot;&gt;Vim&lt;/h2&gt;

&lt;p&gt;Vim without code highlight forces you to remember your code structure more
effectively, which is a great thing. Not having a need to rely on color can
hint that a programmer has better understanding of the code he/she is writing.&lt;/p&gt;

&lt;p&gt;Now that the experiment is over I have mostly returned to using colorful
prompt. But I do turn syntax highlight off once in a while - it allows you to
see problems from new angle and work more efficiently at finding a solution.
Try it and see for yourself!&lt;/p&gt;

</description>
        <pubDate>Wed, 17 Apr 2013 18:32:46 +0000</pubDate>
        <link>https://rosipov.com/blog/colorless-week-results/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/colorless-week-results/</guid>
        
        <category>bash</category>
        
        <category>git</category>
        
        
        <category>Vim</category>
        
        <category>CLI</category>
        
      </item>
    
      <item>
        <title>A week without colorful prompt</title>
        <description>&lt;p&gt;I noticed that I rely on colors in the bash terminal a lot, as in git output,
diffs, directory and file listings… It gets worse when using vim - I feel
lost without the cozy syntax highlight guidance.&lt;/p&gt;

&lt;p&gt;Time to stop using output colors for a week whether in shell, git, or vim, and
use only plain text with no fancy colors. Set git config –global color.ui
false and don’t use –color flags in shell. Also, set syntax off and set a
simple color scheme for vim.&lt;/p&gt;

&lt;p&gt;What can I gain from all this? It will definitely reduce my productivity for a
few days. However, I have a hint of an idea that changing the visual code
representation will give me new insight on what I am currently writing.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ruslanosipov/dotfiles/commit/b2b592e4f5b4b2f5bb962651a03f9d83b3ab53b7&quot;&gt;Link to related commit on GutHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Check back in a week to see how it went!&lt;/p&gt;
</description>
        <pubDate>Mon, 01 Apr 2013 18:10:31 +0000</pubDate>
        <link>https://rosipov.com/blog/a-week-without-colorful-prompt/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/a-week-without-colorful-prompt/</guid>
        
        <category>bash</category>
        
        <category>git</category>
        
        
        <category>Vim</category>
        
        <category>CLI</category>
        
      </item>
    
      <item>
        <title>Editing bash command in vim</title>
        <description>&lt;p&gt;You can open the current command you are typing for editing in your default
text editor by pressing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl + x + e&lt;/code&gt;. It will be executed after you write and
quit the file. This is perfect for editing long/multi-line commands where typos
are likely to occur. Consider something like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;for run in {1..10}
do
    echo &quot;Print me ten times&quot;
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Editing this in vim is much more satisfying, isn’t it?&lt;/p&gt;

&lt;p&gt;You can also open the last executed command for editing if you execute the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fc&lt;/code&gt;
command. You can also edit the last command starting with a certain pattern
using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fc [pattern]&lt;/code&gt; (you can skip the editor and execute the output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fc&lt;/code&gt; by
adding the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-s&lt;/code&gt; option, and a useful tip is to have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alias r=&quot;fc -s&quot;&lt;/code&gt;, which
would allow you to execute the last command starting with “cc” by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;r
cc&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;P.S: In order for this trick to open &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim&lt;/code&gt; and not any other editor, make sure
you have the line &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EDITOR=vim&lt;/code&gt; in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;. Obviously this works with
any text editor.&lt;/p&gt;
</description>
        <pubDate>Mon, 01 Apr 2013 07:34:28 +0000</pubDate>
        <link>https://rosipov.com/blog/editing-bash-command-in-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/editing-bash-command-in-vim/</guid>
        
        <category>bash</category>
        
        
        <category>Vim</category>
        
        <category>CLI</category>
        
      </item>
    
      <item>
        <title>Vim, pathogen and git submodules</title>
        <description>&lt;p&gt;This is a step by step tutorial on how to organize your vim config files using
git, pathogen, and git submodules. This tutorial assumes that you are familiar
with git basics, but you don’t really need to understand every step in order to
follow it. For simplicity, only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vim&lt;/code&gt; directory is a repository in this
example. You may want to have all your dotfiles under version control and use a
script to symlink files to the home directory. For example see
&lt;a href=&quot;https://github.com/ruslanosipov/dotfiles&quot;&gt;https://github.com/ruslanosipov/dotfiles&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;setting-up&quot;&gt;Setting up&lt;/h2&gt;

&lt;p&gt;Let’s assume your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vim&lt;/code&gt; directory is a mess and is not under revision control.
Let’s initialize a repository.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~/.vim
git init
git remote add origin git@github.com:user/project.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now let’s create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vim/bundle&lt;/code&gt; directory and clone &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pathogen&lt;/code&gt; plugin as a
submodule.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir bundle
cd bundle
git submodule add git@github.cfm:tpope/vim-pathogen.git
bundle/vim-pathogen
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pre-pend the following code to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt; to load pathogen from
non-default directory:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s add some more plugins as git submodules, for example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git submodule add git@github.com:Lokaltog/vim-easymotion.git
bundle/vim-easymotion
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now we can add and commit everything and push it to a repository.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git add .
git commit -m &quot;Use pathogen to keep track of vim plugins&quot;
git push origin master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;deploying&quot;&gt;Deploying&lt;/h2&gt;

&lt;p&gt;Assuming that your repository is located at &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git@github.com:user/project.git&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~
git clone git@github.com:user/project.git .vim
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And you are done, all plugins are downloaded from their repositories now.&lt;/p&gt;

&lt;h2 id=&quot;maintaining&quot;&gt;Maintaining&lt;/h2&gt;

&lt;p&gt;Git submodules keep track of specific commits and are not being automatically
updated when target repositories have new commits. In order to update plugins
you have:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~/.vim
git submodule foreach git pull
git add bundle
git commit -m &quot;Updated all the plugins in a bundle&quot;
git push origin master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You probably want to make sure that new versions of plugins are compatible with
each other before committing, however.&lt;/p&gt;
</description>
        <pubDate>Wed, 27 Mar 2013 21:35:46 +0000</pubDate>
        <link>https://rosipov.com/blog/vim-pathogen-and-git-submodules/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/vim-pathogen-and-git-submodules/</guid>
        
        <category>git</category>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Vim movement cheatsheet</title>
        <description>&lt;p&gt;&lt;img src=&quot;/images/posts/vim-movement-commands-cheatsheet.png&quot; alt=&quot;A great cheat sheet for Vim movement commands.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I had this lying around for a while now. This is great vim movement commands
cheat sheet made by &lt;a href=&quot;http://naleid.com/blog/&quot;&gt;Ted Naleid&lt;/a&gt; (&lt;a href=&quot;http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/&quot;&gt;link to the original post&lt;/a&gt;). It does
an amazing job aiding in the memorization of essential vim movement shortcuts.&lt;/p&gt;

</description>
        <pubDate>Thu, 21 Mar 2013 21:57:37 +0000</pubDate>
        <link>https://rosipov.com/blog/vim-movement-cheatsheet/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/vim-movement-cheatsheet/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Read man pages from vim</title>
        <description>&lt;p&gt;I recently discovered an incredibly useful function - you can look up man pages
for keywords by pressing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;K&lt;/code&gt; (read: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shift + k&lt;/code&gt;) in normal mode when cursor is
over the word you need to look up.&lt;/p&gt;

&lt;p&gt;It works with any shell or programming language keywords, as long as vim
recognizes the filetype.&lt;/p&gt;
</description>
        <pubDate>Wed, 13 Mar 2013 23:50:56 +0000</pubDate>
        <link>https://rosipov.com/blog/read-man-pages-from-vim/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/read-man-pages-from-vim/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Use vim commands in a browser</title>
        <description>&lt;p&gt;I’ve been giving preference to a keyboard over mouse since I discovered vim for
myself, as it’s a faster and more convenient way to go. I am a Chrome user and
recently I found an amazing plugin: &lt;a href=&quot;http://vimium.github.com&quot;&gt;Vimium&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It does exactly what the name suggests, allowing you to use vim-like commands
in your browser. You can freely move, switch between tabs, work with forms and
click links using familiar vim key bindings.&lt;/p&gt;

&lt;p&gt;A two minute long introductory video explains basic commands and you’re all
set! I’ve been using Vimium for over a week now, an amusing experience which
allows you to throw your mouse in a dark corner (well, not exactly: Vimium
still has some issues with over-bloated ajax pages, not to mention Flash and
other nasty stuff).&lt;/p&gt;

&lt;p&gt;Check it out: &lt;a href=&quot;http://vimium.github.com&quot;&gt;http://vimium.github.com/&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Sun, 24 Feb 2013 05:35:27 +0000</pubDate>
        <link>https://rosipov.com/blog/use-vim-commands-in-a-browser/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/use-vim-commands-in-a-browser/</guid>
        
        <category>vimium</category>
        
        
        <category>Vim</category>
        
        <category>Productivity</category>
        
      </item>
    
      <item>
        <title>Extendedly basic vim setup</title>
        <description>&lt;p&gt;Ahoy Internet, here’s a neat and fairly simple vim configuration for
programming. Feel free to copy over settings/plugins you find useful, or just
download a repository from &lt;a href=&quot;https://github.com/ruslanosipov/dotfiles&quot;&gt;GitHub&lt;/a&gt; with settings and plugins.&lt;/p&gt;

&lt;h2 id=&quot;the-vimrc-file&quot;&gt;The .vimrc file&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; =&amp;gt; Editing
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

syntax on

&quot; Indentation settings
set tabstop=4
set shiftwidth=4
set smartindent
set autoindent
set expandtab

&quot; Disable backups and .swp files
set nobackup
set nowritebackup
set noswapfile

&quot; Ignore case when searching
set ignorecase
set smartcase

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; =&amp;gt; Looks
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

colorscheme darkburn
set background=dark

&quot; Set terminal window title
set title

&quot; Shorten press ENTER to continue messages
set shortmess=atI

&quot; Show last command
set showcmd

&quot; Highlight cursor line
set cursorline

&quot; Ruler (line, column and % at the right bottom)
set ruler

&quot; Enable wild menu (tab command autocompletion)
set wildmenu
set wildmode=list:longest,full

&quot; Warn if exceed 80 columns limit
if (&amp;amp;ft == &apos;python&apos;)
    highlight OverLength ctermbg=red ctermfg=white guibg=#592929
    match OverLength /%81v.+/
endif

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; =&amp;gt; Misc
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

&quot; Use Unix as the standart file type
set ffs=unix,dos,mac

&quot; Enable filetype plugins
filetype plugin on
filetype indent on

&quot; Ignore compiled files
set wildignore=*.o,*~,*.pyc,*.pyo

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; =&amp;gt; Plugins
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

&quot; EasyMotion: one leader key instead of two
let g:EasyMotion_leader_key = &apos;&amp;lt;Leader&amp;gt;&apos;

&quot; NERDTree: auto open and close
autocmd VimEnter * NERDTree
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()

&quot; NERDTree: focus on text window (left)
autocmd VimEnter * wincmd l
autocmd BufNew * wincmd l

&quot; NERDTree: auto close if last window
function! s:CloseIfOnlyNerdTreeLeft()
    if exists(&quot;t:NERDTreeBufName&quot;)
        if bufwinnr(t:NERDTreeBufName) != -1
            if winnr(&quot;$&quot;) == 1
                q
            endif
        endif
    endif
endfunction

&quot; Exuberant Ctags: autogenerate on py file write
au BufWritePost *.py silent! !ctags -R &amp;amp;

&quot; Pydoc: open in new tab instead of split
let g:pydoc_open_cmd = &apos;tabnew&apos;

&quot; Pydoc: disable search term highlight
let g:pydoc_highlight=0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;plugins&quot;&gt;Plugins&lt;/h2&gt;

&lt;p&gt;If you are not planning to use some of the plugins, make sure to remove
plugin-specific rules from .vimrc =&amp;gt; Plugins.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://ctags.sourceforge.net/&quot;&gt;Exuberant Ctags&lt;/a&gt;: allows you to generate index of variables, functions
and classes to freely move between them. A bit more info on how to use these
in article &lt;a href=&quot;https://rosipov.com/blog/using-vim-for-writing-code/&quot;&gt;Using vim for writing code&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=625&quot;&gt;Colo(u)r Sampler Pack&lt;/a&gt; is not really a plugin, but a collection of color
shemes. 100 of them, to be precise. Feel free to choose whatever you like.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=1488&quot;&gt;ScrollColors&lt;/a&gt; allows you to try out every theme in visual mode. Just type
in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:SCROLL&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=3526&quot;&gt;EasyMotion&lt;/a&gt; allows you to move between words, lines and sentences with a
lightning speed. Just hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&amp;gt; + w&lt;/code&gt; to jump to one of the words forward
or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;Leader&amp;gt; + b&lt;/code&gt; backward (leader key is a backslash by default). It can
do more neat things, documentation is pretty self-explanatory.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=1658&quot;&gt;NERDTree&lt;/a&gt; is a directory tree, like in all modern IDEs (but of course
better).&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.vim.org/scripts/script.php?script_id=1173&quot;&gt;tComment&lt;/a&gt; allows you to easily comment out blocks of code. Hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gcc&lt;/code&gt; to
comment a line or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gc&lt;/code&gt; while selecting a block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;V&lt;/code&gt;isual mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;source&quot;&gt;Source&lt;/h2&gt;

&lt;p&gt;You may want to head over to GitHub and grab a version from here:
&lt;a href=&quot;https://github.com/ruslanosipov/dotfiles&quot;&gt;https://github.com/ruslanosipov/dotfiles&lt;/a&gt;.&lt;/p&gt;

</description>
        <pubDate>Thu, 15 Nov 2012 19:06:33 +0000</pubDate>
        <link>https://rosipov.com/blog/extendedly-basic-vim-setup/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/extendedly-basic-vim-setup/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
      <item>
        <title>Using vim for writing code</title>
        <description>&lt;p&gt;Vim is a great text editor which can be much more powerful then any GUI editor
or IDE. It has its learning curve, but once you are used to it you’ll never
want to switch to anything else. Here’s a quick tutorial on how to use and
customize vim for working with code.&lt;/p&gt;

&lt;h2 id=&quot;basics&quot;&gt;Basics&lt;/h2&gt;

&lt;p&gt;Feel free to skip this first part if you are familiar with vim already.&lt;/p&gt;

&lt;p&gt;First, let’s get the hang of moving around. You can use arrow keys or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j&lt;/code&gt;,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l&lt;/code&gt; to move around. Holding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl&lt;/code&gt; while moving will allow you to move
between words (separated by spaces, tabulation, or line breaks), holding
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shift&lt;/code&gt; allows you to do so with all punctuation characters including spaces
and line breaks.&lt;/p&gt;

&lt;p&gt;Typing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:147&lt;/code&gt; will get you to the line 147, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/foo&lt;/code&gt; will get you to the first
occurrence of foo, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; will repeat the last search.&lt;/p&gt;

&lt;p&gt;Hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; to enter insert mode and type in text. Hit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Esc&lt;/code&gt; to go back. Key &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a&lt;/code&gt;
does the same thing, but sets the cursor after the selected character. Hit
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Insert&lt;/code&gt; to switch between insert and replace modes.&lt;/p&gt;

&lt;p&gt;Typing in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:w&lt;/code&gt; will write changes to a file, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:q&lt;/code&gt; exits the editor, `:e&lt;/p&gt;
&lt;filename&gt;` opens another file.

Sometimes you need to do some copy-pasting: copy (yank) line with `Y` and paste
it with `p`. You should know that vim allows you to prefix the majority of
commands with a number: typing in `13Y` will yank 13 lines, `40j` will take you
40 lines down, etc.

Command `x` will delete a character, `dd` will delete a whole line. Of course,
you can prefix it with a number if you need to delete more then one line.

`:%s/foo/bar` will find and replace the first occurrence of foo with bar,
`:%s/foo/bar/g` will do so within the whole file.

Splitting windows is very helpful tool: `:split &lt;filename&gt;` will split the
window horizontally, `:vsplit &lt;filename&gt;` will do so vertically. Hit `Ctrl +
w`, and then arrow key will select an active view, `Ctrl + w, r` will swap the
views. Simply type `:q` to close the window.

## Customizing

Here&apos;s example of a `~/.vimrc` file, and the basic options necessary for
editing code with vim.

    syntax on

    set tabstop=4
    set shiftwidth=4
    set smartindent
    set autoindent
    set expandtab

Option `syntax on` enables syntax highlight, `tabstop` sets tab width,
`shiftwidth` sets tab width for auto indentation, `smartindent`, `autoindent`
enables indentation (smart indentation implies adding an extra indentation
level after defining function, starting a loop, etc.), optional is `expandtab`,
which tells vim to treat all tabs as spaces.

If you are fan of limiting line width with n columns - add option
`colorcolumn=80`, or (if your vim version is below 7.3) add the following
lines:

    highlight OverLength ctermbg=red ctermfg=white guibg=#592929
    match OverLength /%80v.+/

That should highlight all text exceeding the 80 columns limit.

Feel free to experiment with the options and start building up your own
`.vimrc`.

## Using ctags with vim

[Exuberant Ctags](http://ctags.sourceforge.net/) allows you to create &quot;tags&quot;
for all your classes, functions, and variables to allow easily jumping between
them. After installing ctags (package is also available in major repositories
named `ctags`) generate tags:

    $ cd project/
    $ ctags -R *

Open the main project file and move your cursor over to some function call. Hit
`Ctrl + ]` to move to function definition, `:tn` will move you to the next
definition for the function. Hitting `Ctrl + t` will return you back.

Auto completion allows you not to bother with finishing words, variable or
function names, and pretty much anything. That being said, `Ctrl + n` will
finish the word for you or allow you to select the desired word from the list.

This is just a basic example of what you can do with vim, for further info you
can read [vim documentation](http://www.vim.org/docs.php). I may be posting
some more tips and tricks on using vim in future.
&lt;/filename&gt;&lt;/filename&gt;&lt;/filename&gt;
</description>
        <pubDate>Wed, 10 Oct 2012 04:16:52 +0000</pubDate>
        <link>https://rosipov.com/blog/using-vim-for-writing-code/</link>
        <guid isPermaLink="true">https://rosipov.com/blog/using-vim-for-writing-code/</guid>
        
        
        <category>Vim</category>
        
      </item>
    
  </channel>
</rss>
