<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Vim on Jake Worth</title><link>https://jakeworth.com/tags/vim/</link><description>Recent content in Vim on Jake Worth</description><image><title>Jake Worth</title><url>https://jakeworth.com/twittercard.png</url><link>https://jakeworth.com/twittercard.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 30 Jun 2026 15:17:23 -0400</lastBuildDate><atom:link href="https://jakeworth.com/tags/vim/index.xml" rel="self" type="application/rss+xml"/><item><title>Vim Scriptout and Scriptin</title><link>https://jakeworth.com/tils/vim-scriptout-and-scriptin/</link><pubDate>Tue, 30 Jun 2026 15:17:23 -0400</pubDate><guid>https://jakeworth.com/tils/vim-scriptout-and-scriptin/</guid><description>&lt;p&gt;Today I discovered these two Vim flags:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim -w log.txt file
vim -s log.txt file
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;-w&lt;/code&gt; flag sends all keystrokes in your session to &lt;code&gt;log.txt&lt;/code&gt;. The &lt;code&gt;-s&lt;/code&gt; loads
Vim and replays all the keystroke back onto that file.&lt;/p&gt;</description></item><item><title>Vim :Tutor Command</title><link>https://jakeworth.com/tils/vim-tutor-command/</link><pubDate>Wed, 29 Apr 2026 12:25:53 -0400</pubDate><guid>https://jakeworth.com/tils/vim-tutor-command/</guid><description>&lt;p&gt;Longtime Vim users know the &lt;code&gt;vimtutor&lt;/code&gt; program, which teaches you Vim &lt;em&gt;in&lt;/em&gt; Vim. Vim 9.2 shipped with a new &lt;code&gt;:Tutor&lt;/code&gt; command that improves on this.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:&lt;span style="color:#a6e22e"&gt;Tutor&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Installing Vim on a Remote Server</title><link>https://jakeworth.com/tils/installing-vim-on-a-remote-server/</link><pubDate>Fri, 13 Feb 2026 16:46:12 -0500</pubDate><guid>https://jakeworth.com/tils/installing-vim-on-a-remote-server/</guid><description>&lt;p&gt;Vim-tiny is a great choice for remote server work.&lt;/p&gt;</description></item><item><title>Vim Mappings Verbose</title><link>https://jakeworth.com/tils/vim-mappings-verbose/</link><pubDate>Tue, 22 Jul 2025 16:31:22 -0400</pubDate><guid>https://jakeworth.com/tils/vim-mappings-verbose/</guid><description>&lt;p&gt;I have a Vim normal mode mapping, and I don&amp;rsquo;t know where it comes from. My Vim config, a plugin, somewhere else? nmap shows me the mapping:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:nmap gsp
n gsp * 1z=
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And verbose nmap shows me where it comes from:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:verbose nmap gsp
n gsp * 1z=
Last set from ~/.vimrc line 111
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The setting is coming from inside the &lt;code&gt;.vimrc&lt;/code&gt;!&lt;/p&gt;</description></item><item><title>Vim Jump to Previous Occurrence</title><link>https://jakeworth.com/tils/vim-jump-to-previous-occurrence/</link><pubDate>Tue, 20 May 2025 19:08:16 -0400</pubDate><guid>https://jakeworth.com/tils/vim-jump-to-previous-occurrence/</guid><description>&lt;p&gt;In Vim Normal mode, &lt;code&gt;*&lt;/code&gt; searches forward for the next occurrence of word. But what goes back?&lt;/p&gt;</description></item><item><title>Vim Scratchpad Part 2</title><link>https://jakeworth.com/posts/vim-scratchpad-part-2/</link><pubDate>Wed, 26 Oct 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/vim-scratchpad-part-2/</guid><description>&lt;p&gt;Today, I&amp;rsquo;d like to dive deeper into a part of my practice: using a persisted
text file for jotting things down. In this post, I&amp;rsquo;ll explain the &amp;lsquo;why&amp;rsquo; behind this technique, and provide an
updated version of it.&lt;/p&gt;</description></item><item><title>Vim Scratchpad</title><link>https://jakeworth.com/posts/vim-scratchpad/</link><pubDate>Thu, 25 Aug 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/vim-scratchpad/</guid><description>&lt;p&gt;Today I&amp;rsquo;d like to share a small part of my practice: using a persisted
scratchpad text file for jotting things down.&lt;/p&gt;</description></item><item><title>Tmux Application Startup Script</title><link>https://jakeworth.com/posts/tmux-application-startup-script/</link><pubDate>Thu, 28 Jul 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/tmux-application-startup-script/</guid><description>&lt;p&gt;My development environment depends on several processes running. Here&amp;rsquo;s how
I&amp;rsquo;ve scripted this setup.&lt;/p&gt;</description></item><item><title>Spell Checking with Vim: Tutorial and Best Practices</title><link>https://jakeworth.com/posts/spell-check-with-vim/</link><pubDate>Wed, 15 Jun 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/spell-check-with-vim/</guid><description>&lt;p&gt;I write each post for this blog in Vim. Writing in the terminal makes me feel
like a programmer, even when I&amp;rsquo;m not specifically programming. In this post, I&amp;rsquo;ll share how I spellcheck in Vim.&lt;/p&gt;</description></item><item><title>Select First Spell Suggestion</title><link>https://jakeworth.com/tils/select-first-spell-suggestion/</link><pubDate>Tue, 14 Jun 2022 11:58:15 -0400</pubDate><guid>https://jakeworth.com/tils/select-first-spell-suggestion/</guid><description>&lt;p&gt;I use Vim&amp;rsquo;s spell feature when writing blog posts. Very often, the first
suggestion it makes is the one that I choose. Consider a word like &amp;lsquo;Rubysit.&amp;rsquo;
My dictionary contains the word &amp;lsquo;Rubyist&amp;rsquo; (naturally) and that&amp;rsquo;s what Vim spell
is going to suggest to me first. For transposition errors like this I&amp;rsquo;d like to
skip the word picker when possible.&lt;/p&gt;
&lt;p&gt;To automatically choose the first suggestion, in normal mode put your cursor
over the word and type &lt;code&gt;1z=&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>My psql Config</title><link>https://jakeworth.com/posts/my-psql-config/</link><pubDate>Tue, 12 Apr 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/my-psql-config/</guid><description>&lt;p&gt;RC files, thought to stand for &amp;ldquo;run command&amp;rdquo; files, are read by a program
during startup. The file that configures the PostgreSQL REPL psql is called
&lt;code&gt;.psqlrc&lt;/code&gt;. In this post I&amp;rsquo;ll share my personal psql configuration.&lt;/p&gt;</description></item><item><title>Solved! How to Exit Vim "Ex" Mode</title><link>https://jakeworth.com/posts/exit-vim-ex-mode/</link><pubDate>Wed, 06 Apr 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/exit-vim-ex-mode/</guid><description>&lt;p&gt;How does one exit Vim &amp;ldquo;Ex&amp;rdquo; mode? But first&amp;hellip; how did you even get into &amp;ldquo;Ex&amp;rdquo; mode?&lt;/p&gt;</description></item><item><title>Autoformat Your Code</title><link>https://jakeworth.com/posts/autoformat-your-code/</link><pubDate>Thu, 10 Mar 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/autoformat-your-code/</guid><description>&lt;p&gt;Auto-formatting code is good, and you should be doing it all the time. Why? It
helps you write better code in real-time, preempt trivial discussions, and maybe even democratize programming.&lt;/p&gt;</description></item><item><title>Why Vim</title><link>https://jakeworth.com/posts/why-vim/</link><pubDate>Wed, 23 Feb 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/why-vim/</guid><description>&lt;p&gt;I&amp;rsquo;ve been using, teaching, and stanning &lt;a href="https://www.vim.org/"&gt;Vim&lt;/a&gt; since almost the beginning of my
programming career. Yet, when asked to explain this preference, I stumble. In
this post, I&amp;rsquo;d like to explore why I love Vim.&lt;/p&gt;</description></item><item><title>Refining Your Terminal Aliases</title><link>https://jakeworth.com/posts/alias-terminal-commands/</link><pubDate>Thu, 10 Feb 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/alias-terminal-commands/</guid><description>&lt;p&gt;Any command you type out manually, or even tab-complete a few times, can be
shortened. A common shortening technique is the terminal alias. Here are some tips that help me write better aliases and cut my terminal keystrokes.&lt;/p&gt;</description></item><item><title>Jump to N Percent of a File</title><link>https://jakeworth.com/tils/jump-to-n-percent-of-a-file/</link><pubDate>Sun, 23 Jan 2022 16:54:36 -0500</pubDate><guid>https://jakeworth.com/tils/jump-to-n-percent-of-a-file/</guid><description>&lt;p&gt;From normal mode, &lt;code&gt;N%&lt;/code&gt; will jump you to that percentage of the file. So &lt;code&gt;50%&lt;/code&gt;
jumps to halfway through the file.&lt;/p&gt;</description></item><item><title>Man pages in Vim</title><link>https://jakeworth.com/tils/man-pages-in-vim/</link><pubDate>Thu, 11 Nov 2021 16:47:07 -0500</pubDate><guid>https://jakeworth.com/tils/man-pages-in-vim/</guid><description>&lt;p&gt;Hit &lt;code&gt;K&lt;/code&gt; on a keyword, and Vim looks up the program under the keyword. It&amp;rsquo;s a
bit jarring because Vim appears to shell out from your buffer to show the
definition.&lt;/p&gt;
&lt;p&gt;To see that man page &lt;em&gt;in&lt;/em&gt; Vim, load the &lt;code&gt;man.vim&lt;/code&gt; plugin from command mode or
in your &lt;code&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:runtime! ftplugin/man.vim
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now, you can read man pages as a Vim buffer:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:Man curl
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>How to Organize JavaScript Imports</title><link>https://jakeworth.com/posts/javascript-import-opinions/</link><pubDate>Mon, 30 Aug 2021 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/javascript-import-opinions/</guid><description>&lt;p&gt;The &lt;code&gt;import&lt;/code&gt; statements at the top of a JavaScript component file can be a
confusing, duplicative, churning mess. Is there a way to organize them that
makes sense and scales? In this post, I&amp;rsquo;d like to share the way I handle this detail.&lt;/p&gt;</description></item><item><title>Override Vim's Filetype</title><link>https://jakeworth.com/tils/override-vims-filetype/</link><pubDate>Thu, 22 Apr 2021 13:30:27 -0400</pubDate><guid>https://jakeworth.com/tils/override-vims-filetype/</guid><description>&lt;p&gt;Vim&amp;rsquo;s filetype auto-detection is great for effortless syntax highlighting, but
what if a certain kind of file (i.e. Ruby) contains lots of another kind of
code (i.e. SQL)? The Ruby code will be highlighted and readable, the SQL a
large monochrome blob. Hard to read and reason about. We can do better!&lt;/p&gt;
&lt;p&gt;Override the automatic assignment with:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:set ft=sql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This command with no assignment returns the current setting:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:set ft
filetype=lua
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We can easily revert to the auto-detected extension as needed.&lt;/p&gt;</description></item><item><title>My Annotated Vim Configuration File</title><link>https://jakeworth.com/posts/my-annotated-vimrc/</link><pubDate>Thu, 26 Nov 2020 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/my-annotated-vimrc/</guid><description>&lt;p&gt;I love Vim. Folks who&amp;rsquo;ve programmed with me, or attended a Vim Meetup when I
was an organizer, can attest. When I was learning to code, &lt;a href="https://jakeworth.com/posts/be-fast/"&gt;getting
fast&lt;/a&gt; at Vim changed everything for me. After almost a decade using this editor, here are my personal configurations.&lt;/p&gt;</description></item><item><title>Vim Nonrecursive Mappings</title><link>https://jakeworth.com/posts/vim-nonrecursive-mappings/</link><pubDate>Sat, 17 Dec 2016 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/vim-nonrecursive-mappings/</guid><description>&lt;p&gt;My first PR to a new Vim plugin was merged this week, &lt;a href="https://github.com/dillonhafer/vim-termbux/pull/1"&gt;check it
out&lt;/a&gt;, adding non-recursive
Vim mappings to vim-termbux.&lt;/p&gt;</description></item><item><title>Vim Regex Word Boundaries</title><link>https://jakeworth.com/tils/vim-regex-word-boundaries/</link><pubDate>Tue, 20 Sep 2016 07:46:37 -0500</pubDate><guid>https://jakeworth.com/tils/vim-regex-word-boundaries/</guid><description>&lt;p&gt;Today while writing a Vim regex to change every instance of &lt;code&gt;it&lt;/code&gt; (ignoring larger matches like &lt;code&gt;itemized&lt;/code&gt;), we stumbled upon Vim regex word boundary matching.&lt;/p&gt;
&lt;p&gt;Given this file:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;foo
foobar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following Vim regex will match on both the first and second line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:%&lt;span style="color:#a6e22e"&gt;s&lt;/span&gt;&lt;span style="color:#e6db74"&gt;/foo/&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;baz&lt;/span&gt;/&lt;span style="color:#a6e22e"&gt;g&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But with word boundaries, we&amp;rsquo;ll only match (and change) the first line, because only the first &lt;code&gt;foo&lt;/code&gt; is a standalone word:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:%&lt;span style="color:#a6e22e"&gt;s&lt;/span&gt;&lt;span style="color:#e6db74"&gt;/\&amp;lt;foo\&amp;gt;/&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;baz&lt;/span&gt;/&lt;span style="color:#a6e22e"&gt;g&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Keyword, Match, and Region in VimScript</title><link>https://jakeworth.com/posts/keyword-match-and-region-in-vimscript/</link><pubDate>Wed, 20 Apr 2016 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/keyword-match-and-region-in-vimscript/</guid><description>&lt;p&gt;After a recent talk I gave that included VimScript, an attendee asked a
question about the differences between &lt;code&gt;keyword&lt;/code&gt;, &lt;code&gt;match&lt;/code&gt;, and &lt;code&gt;region&lt;/code&gt;
following &lt;code&gt;syn&lt;/code&gt; in a Vim syntax highlighting file. Here&amp;rsquo;s my answer.&lt;/p&gt;</description></item><item><title>Vim Buffer Problem</title><link>https://jakeworth.com/posts/vim-buffer-problem/</link><pubDate>Sun, 06 Mar 2016 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/vim-buffer-problem/</guid><description>&lt;p&gt;A few weeks back I tackled the following programming challenge from my colleague Josh Branchaud:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Vim Buffer&lt;/p&gt;
&lt;p&gt;I open up a new Vim buffer and type all the numbers 1 to 10,000,
separated by spaces. Then, my cat walks on the keyboard and somehow activates
a substitution command that replaces all the &amp;lsquo;0’ digits (zeros) with spaces.
If I now sum up all the numbers in the buffer, as delineated by spaces, what
is the total?&lt;/p&gt;
&lt;/blockquote&gt;</description></item><item><title>Count Links in a Markdown File</title><link>https://jakeworth.com/tils/count-links-in-a-markdown-file/</link><pubDate>Sun, 14 Feb 2016 17:43:36 -0600</pubDate><guid>https://jakeworth.com/tils/count-links-in-a-markdown-file/</guid><description>&lt;p&gt;Today I learned a great way to count the links in a README or link collection. Vim Regex!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:%&lt;span style="color:#a6e22e"&gt;s&lt;/span&gt;&lt;span style="color:#e6db74"&gt;/- \[/&lt;/span&gt;/&lt;span style="color:#a6e22e"&gt;n&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In Vimspeak:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;On every line, find all of the times where &lt;code&gt;- [&lt;/code&gt; (the beginning of a Markdown
bulleted hyperlink) occurs, count them, and report the number of matches.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;See &lt;code&gt;:help substitute&lt;/code&gt; in Vim for more information.&lt;/p&gt;
&lt;p&gt;h/t Josh Branchaud&lt;/p&gt;</description></item><item><title>Get help with Pathogen</title><link>https://jakeworth.com/tils/get-help-with-pathogen/</link><pubDate>Wed, 13 Jan 2016 19:56:33 -0600</pubDate><guid>https://jakeworth.com/tils/get-help-with-pathogen/</guid><description>&lt;p&gt;Today I found a great command in Pathogen.vim, &lt;code&gt;:Helptags&lt;/code&gt;. This is a riff off &lt;code&gt;:helptags {dir}&lt;/code&gt;, a Vim feature that builds helptags for directory &lt;code&gt;{dir}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:Helptags&lt;/code&gt; does the same for all the directories in your &lt;code&gt;runtimepath&lt;/code&gt;, which defaults on Unix and Mac OS X to:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;#34;$HOME/.vim,
$VIM/vimfiles,
$VIMRUNTIME,
$VIM/vimfiles/after,
$HOME/.vim/after&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The use case here is when you&amp;rsquo;ve just loaded a new plugin into your Vim bundle, you open up Vim, and &lt;code&gt;:h {my_new_plugin}&lt;/code&gt; isn&amp;rsquo;t &amp;lsquo;helping&amp;rsquo; you out.&lt;/p&gt;</description></item><item><title>Change Inner Tag Block</title><link>https://jakeworth.com/tils/change-inner-tag-block/</link><pubDate>Thu, 07 Jan 2016 18:40:11 -0600</pubDate><guid>https://jakeworth.com/tils/change-inner-tag-block/</guid><description>&lt;p&gt;Vim has excellent commands for changing the contents of parentheses (&lt;code&gt;ci(&lt;/code&gt;), brackets (&lt;code&gt;ci[&lt;/code&gt;), and squiggly braces (&lt;code&gt;ci{&lt;/code&gt;) (as well as single quotes, double quotes, backticks, etc.). But what about tags?&lt;/p&gt;
&lt;p&gt;Place your cursor anywhere inside the tags, type &lt;code&gt;cit&lt;/code&gt; in Visual mode, and this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-haml" data-lang="haml"&gt;&amp;lt;div&amp;gt;Begone&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Becomes:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-haml" data-lang="haml"&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;d&lt;/code&gt; works too, but I prefer &lt;code&gt;c&lt;/code&gt; because it puts you in Insert mode at the end of the opening tag, ready to type.&lt;/p&gt;</description></item><item><title>Increment and Decrement Numbers</title><link>https://jakeworth.com/tils/increment-and-decrement-numbers/</link><pubDate>Wed, 06 Jan 2016 17:28:17 -0600</pubDate><guid>https://jakeworth.com/tils/increment-and-decrement-numbers/</guid><description>&lt;p&gt;Vim has commands built-in to increment and decrement numbers: &lt;code&gt;CTRL-A&lt;/code&gt; and &lt;code&gt;CTRL-X&lt;/code&gt;, respectively.&lt;/p&gt;
&lt;p&gt;Combining this with a macro was a technique we tried today to build a large database migration. We ended up finding a more efficient solution, but it&amp;rsquo;s still a very magical key combination.&lt;/p&gt;
&lt;p&gt;Check out &lt;code&gt;:help CTRL-A&lt;/code&gt; for more info.&lt;/p&gt;
&lt;p&gt;h/t Josh Branchaud&lt;/p&gt;</description></item><item><title>Delete a Line From Another Line</title><link>https://jakeworth.com/tils/delete-a-line-from-another-line/</link><pubDate>Mon, 09 Nov 2015 18:50:37 -0600</pubDate><guid>https://jakeworth.com/tils/delete-a-line-from-another-line/</guid><description>&lt;p&gt;Today I was cleaning up a test with an extra empty line at the top of the file, away from my Vim cursor. I wanted to delete it&amp;hellip; without moving the cursor.&lt;/p&gt;
&lt;p&gt;It seems like Vim almost lets you do this, with &lt;code&gt;:[range]d&lt;/code&gt;. But it leaves the cursor on the deleted line, which isn&amp;rsquo;t very magical.&lt;/p&gt;
&lt;p&gt;This is the hack we found:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:[range]d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;#39;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;''&lt;/code&gt; returns the cursor to the last jump point.&lt;/p&gt;</description></item><item><title>Explore Buffers with BufExplorer</title><link>https://jakeworth.com/tils/explore-buffers-with-bufexplorer/</link><pubDate>Mon, 12 Oct 2015 17:38:15 -0500</pubDate><guid>https://jakeworth.com/tils/explore-buffers-with-bufexplorer/</guid><description>&lt;p&gt;I&amp;rsquo;m a huge fan of Vim buffers. I try to have my buffer list roughly mirror the files I am currently holding in my brain.&lt;/p&gt;
&lt;p&gt;The BufExplorer Vim plugin helps, and is included in the Hashrocket Dotmatrix. Today I learned to use the command &lt;code&gt;\bs&lt;/code&gt;, which opens a colorful buffer list that you can navigate with Vim directions.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/jlanzarotta/bufexplorer"&gt;https://github.com/jlanzarotta/bufexplorer&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Edit the Current File Always</title><link>https://jakeworth.com/tils/edit-the-current-file-always/</link><pubDate>Fri, 29 May 2015 00:25:49 -0500</pubDate><guid>https://jakeworth.com/tils/edit-the-current-file-always/</guid><description>&lt;p&gt;The Vim command &lt;code&gt;:e&lt;/code&gt; edits a file. Add a bang, &lt;code&gt;:e!&lt;/code&gt;, to edit the current file &amp;lsquo;always&amp;rsquo;, discarding any changes to the current buffer.&lt;/p&gt;
&lt;p&gt;This is useful if you rename a file with a new file extension (i.e. &lt;code&gt;.txt&lt;/code&gt; to &lt;code&gt;.rb&lt;/code&gt;). &lt;code&gt;:e!&lt;/code&gt; reloads the file in Vim, picking up any customizations you have in your configuration files such as syntax highlighting.&lt;/p&gt;</description></item><item><title>Find and Replace Across Files</title><link>https://jakeworth.com/tils/find-and-replace-across-files/</link><pubDate>Thu, 21 May 2015 09:47:13 -0500</pubDate><guid>https://jakeworth.com/tils/find-and-replace-across-files/</guid><description>&lt;p&gt;Vim can find and replace strings across files, just like other text editors. It&amp;rsquo;s really (sort of) easy.&lt;/p&gt;
&lt;p&gt;First load all the files you want to change into the buffer with a splatted directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:args path/to/files/*/*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, execute the substitution.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:argdo %s/old_string/new_string/ge | update
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;e&lt;/code&gt; flag is important; it tells Vim not to issue an error if the search pattern fails. This will prevent &lt;code&gt;No Match&lt;/code&gt; errors from breaking the chain.&lt;/p&gt;</description></item><item><title>Call a Vimscript Method in Vim</title><link>https://jakeworth.com/tils/call-a-vimscript-method-in-vim/</link><pubDate>Sun, 17 May 2015 17:00:04 -0500</pubDate><guid>https://jakeworth.com/tils/call-a-vimscript-method-in-vim/</guid><description>&lt;p&gt;To call a Vimscript method in Vim, first source the file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:&lt;span style="color:#a6e22e"&gt;source&lt;/span&gt; ~&lt;span style="color:#e6db74"&gt;/path/&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;to&lt;/span&gt;/&lt;span style="color:#a6e22e"&gt;vimscript&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;vim&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, put the cursor over the method call, and run that line.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-vim" data-lang="vim"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:&lt;span style="color:#a6e22e"&gt;exec&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;getline&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;.&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Current Value of a Setting</title><link>https://jakeworth.com/tils/current-value-of-a-setting/</link><pubDate>Thu, 14 May 2015 11:00:00 -0500</pubDate><guid>https://jakeworth.com/tils/current-value-of-a-setting/</guid><description>&lt;p&gt;Check the value of any Vim setting by adding a &lt;code&gt;?&lt;/code&gt; to the end of its name.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Validate spelling is turned off
:set spell?
=&amp;gt; nospell
# Validate incremental search is turned on
:set incsearch?
=&amp;gt; :incsearch
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Jump to the First Non-Blank Character</title><link>https://jakeworth.com/tils/jump-to-the-first-non-blank-character/</link><pubDate>Tue, 12 May 2015 18:45:11 -0500</pubDate><guid>https://jakeworth.com/tils/jump-to-the-first-non-blank-character/</guid><description>&lt;p&gt;With Vim you can jump down any &lt;em&gt;n&lt;/em&gt; amount of lines with &lt;code&gt;n + j&lt;/code&gt;, and back up with &lt;code&gt;n + k&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;An alternate command is &lt;code&gt;n + +&lt;/code&gt;, which jumps down to the first non-blank character, and &lt;code&gt;n + -&lt;/code&gt;, which jumps back up to the first non-blank character.&lt;/p&gt;</description></item><item><title>Close a File</title><link>https://jakeworth.com/tils/close-a-file/</link><pubDate>Fri, 08 May 2015 09:19:58 -0500</pubDate><guid>https://jakeworth.com/tils/close-a-file/</guid><description>&lt;p&gt;In Vim there are many ways to close a file. One of the best is &lt;code&gt;:x&lt;/code&gt;, also know as &lt;code&gt;:xit&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:x&lt;/code&gt; writes and quits a file when changes have been made, like &lt;code&gt;:wq&lt;/code&gt;, but with one less keystroke.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;An important distinction:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;:x&lt;/code&gt; and &lt;code&gt;:wq&lt;/code&gt; are similar, but not identical commands.&lt;/p&gt;
&lt;p&gt;The difference is that &lt;code&gt;:wq&lt;/code&gt; writes the current file and quits, as long as the file is not read-only and has a name, while &lt;code&gt;:x&lt;/code&gt; only writes if changes have been made. So, if you were to generate a file with Vim, make no changes, and try to write and quit with &lt;code&gt;:x&lt;/code&gt;, the file would not be written. Doing the same thing with &lt;code&gt;:wq&lt;/code&gt; would write the file.&lt;/p&gt;</description></item><item><title>Sort Alphabetically</title><link>https://jakeworth.com/tils/sort-alphabetically/</link><pubDate>Wed, 06 May 2015 20:05:31 -0500</pubDate><guid>https://jakeworth.com/tils/sort-alphabetically/</guid><description>&lt;p&gt;One way to make a list nicer to read is to sort it. Vim comes with a command built in for just this purpose.&lt;/p&gt;
&lt;p&gt;Here is a snippet from a Gemfile:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gem &amp;#39;coffee-rails&amp;#39;, &amp;#39;~&amp;gt; 4.1.0&amp;#39;
gem &amp;#39;uglifier&amp;#39;, &amp;#39;&amp;gt;= 1.3.0&amp;#39;
gem &amp;#39;sass-rails&amp;#39;, &amp;#39;~&amp;gt; 5.0&amp;#39;
gem &amp;#39;puma&amp;#39;
gem &amp;#39;gravatar_image_tag&amp;#39;
gem &amp;#39;authem&amp;#39;
gem &amp;#39;jquery-rails&amp;#39;
gem &amp;#39;pg&amp;#39;
gem &amp;#39;redcarpet&amp;#39;
gem &amp;#39;rails_12factor&amp;#39;, group: :production
gem &amp;#39;sdoc&amp;#39;, &amp;#39;~&amp;gt; 0.4.0&amp;#39;, group: :doc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;These gems might have been added during the development process. To sort them, enter visual mode, highlight the desired range, and enter &lt;code&gt;:sort&lt;/code&gt;. Here&amp;rsquo;s the result:&lt;/p&gt;</description></item><item><title>Delete Comments</title><link>https://jakeworth.com/tils/delete-comments/</link><pubDate>Sat, 18 Apr 2015 14:05:39 -0500</pubDate><guid>https://jakeworth.com/tils/delete-comments/</guid><description>&lt;p&gt;&lt;code&gt;:g/^\s*#/d&lt;/code&gt; will remove comment lines from a file with Vim.&lt;/p&gt;</description></item></channel></rss>