Setup CtrlP to use ripgrep in Vim

A few weeks ago I wrote about switching from CtrlP and The Silver Searcher to fzf and ripgrep. I have since returned to CtrlP and thought I’d share how to set that up with ripgrep too.

From my time with fzf, I can attest to the fact that it is indeed faster than CtrlP when the time comes to search for something. Having said that, I later discovered via a quick process of elimination that it also drags down Vim’s general performance.

Read on, there’s more »

Sorting lines in Vim

Amongst Vim’s many commands, there’s the humble yet powerful :sort. As you’d expect, it takes a selection or a range and sorts it. By default, that sort is numerical (0 through 9), then alphabetical (A through Z followed by a through z).

All that to say that running a generic :sort on the characters to the left in the following example would result in them being reordered to how you see them on the right.

Read on, there’s more »

The ancient time

In 1949 George Orwell published a novel recounting his dystopian vision of what the world would have become within some thirty-odd years. It’s title: 1984.

I started reading it last night. It seemed like a somewhat topical choice from my books-to-read list, given the global political climate we’re currently in the midst of. Having read the first few chapters, it seems to me that in these troubled times the book can either be seen as uplifting—“at least things aren’t as bad as this”—or as a late-to-the-game prophecy—“this is what we’re heading towards”.

The immersive yet bleak world Orwell envisioned in 1984 is still largely un-relatable, however sparks of warning can still be caught in it’s pages. These two sentences, about 9% of the way into the book are one such warning, and one I haven’t been able to shake since reading.

The thing that now suddenly struck Winston was that his mother’s death, nearly thirty years ago, had been tragic and sorrowful in a way that was no longer possible. Tragedy, he perceived, belonged to the ancient time, to a time when there was still privacy, love, and friendship, and when the members of a family stood by one another without needing to know the reason.

jQuery to pure JS: Event listeners on dynamically created elements

The following HTML will serve as the example markup for this post. It’s an example of how you might structure a feed that receives updates without the page reloading (dynamically created content). Our goal is to add a click event listener to each new .feed-item that is dynamically created.

<div class="feed">
  <div class="feed-item" data-id="3">
    <div class="item-content">
    ...
    </div>

    <div class="item-controls">
    ...
    </div>
  </div>

  <div class="feed-item" data-id="2">
  ...
  </div>

  <div class="feed-item" data-id="1">
  ...
  </div>
</div>

Read on, there’s more »

Search through a full text index of your browsing history with Falcon

I have tried and failed to find a specific previously-visited page via Chrome’s history search an innumerable amount of times. There’ll be a certain piece of content that I remember and want to go back to, but Chrome’s history search only looks at the page title and URL. If I can’t remember either of those precisely enough then I’m left to either abandon the search or go digging by hand. Enter Falcon.

Read on, there’s more »