Douglas Drumond Kayama

  • pt
  • About

Posts

November 4, 2024

Using `gq` or `gw` to format text

If you type a really long line in Vim, Vim soft-wraps it at the end of the window, but in the file it’s still one line. If you type gq or gw followed by a movement, Vim formats the text based on the movement you selected. For instance, gwip will format the paragraph under the cursor (gw inside i paragraph p), gwG will format from the cursor to the end of the file (G).

read more
November 4, 2024

Using `o` in visual mode to change direction of selection

If you select some lines or characters with V or v and want to change the direction of expansion of the selection, type o.

For example, suppose you have the following text:

Holmes was certainly not a difficult man to live with. He was quiet in his
ways, and his habits were regular.
It was rare for him to be up after ten at night, and he had invariably
breakfasted and gone out before I rose in the morning.
Sometimes he spent his day at the chemical laboratory, sometimes in the
dissecting-rooms, and occasionally in long walks, which appeared to take him
into the lowest portions of the City.
Nothing could exceed his energy when the working fit was upon him; but now and
again a reaction would seize him, and for days on end he would lie upon the
sofa in the sitting-room, hardly uttering a word or moving a muscle from
morning to night.
On these occasions I have noticed such a dreamy, vacant expression in his eyes,
that I might have suspected him of being addicted to the use of some narcotic,
had not the temperance and cleanliness of his whole life forbidden such a
notion.

Suppose your cursor is in the line starting with Sometimes. You pressed V and started selecting down with j. Then you realised you should have started from the line It was rare two lines above your initial choice. If you press k to move up, you deselect what you had selected. However, you can type o, the cursor changes to the beginning of selection and now when you type k, you expand the selection upwards.

read more
November 4, 2024

Vim `:g` and :`v`

If you want to execute a command on all lines matching a pattern, you can use the Ex command :g. For example, if you want to delete all blank lines, you can do

:g/^\s*$/d

It will get all lines that matches this: from the beginning (^), it may contain 0 or more whitespace (\s*) until the end of line ($). In other words, if the line is empty or contain only whitespace.

read more
November 4, 2024

Some Vim tips

I decided to compile a list of Vim tips as TIL (Today I learnt), although most of these tips I already knew. The following posts will follow a TIL format.

Photo by the author

read more
June 7, 2024

Zettelkasten

Do you struggle to learn different topics or keep different subjects in your head while you are working on some project? Well, me too. I have ADHD. I have multiple interests. When I hyperfocus on one of my interests, time flies. But usually, I need to learn different subjects and make them work together on a project. And I bet you need that, too. How can you solve it? One technique I use for studying different topics and making them work together is the Zettelkasten method. And you will learn how to leverage it to improve your learning.

read more
August 20, 2023

Vim was a big part of my life

:e a-sad-email.md

I opened MacVim to tell a personal story.

The year was 1998, I was 15. I told my dad I wanted to go to a certification program. It’s something familiar in Brazil; you have high school courses and earn a certificate in parallel. I was inclined to study Chemistry (I really enjoyed the subject back then), but someone had suggested Informatics, and it looked promising. One problem: I didn’t have a computer and had no money to buy one. My dad said: “choose that one; we’ll figure it out.”

read more
December 28, 2022

iPad Incompatibilities: Unintuitive Volume Buttons

The iPad is a useful tool. I have two, the ginormous 12.9” iPad Pro and an iPad mini, and I enjoy both. Each has its use case.

The Pro is used for consuming videos, photo editing, reading photography magazines and books, writing, and other activities that benefit from a large screen and, sometimes, a calibrated screen, such as when you enable the reference mode in settings.

The mini is used for quick consumption here and there. I occasionally watch videos on it, read books on Apple Books or even on the Kindle app, browse news, read my feeds, etc.

read more
February 7, 2022

How to boost your creativity

A friend of mine shared with me two talks on different processes leading to creativity. A 2016 TEDx talk by futurist Stephan Schwartz and a 2019 TED talk by author Tim Harford. While Stephan Schwartz presents a process divided into six steps to induce creativity, Tim Harford shows a different method, much more diverse in approach. Comparing both processes, they seem conflicting; however, when analysing more closely, they complement each other.

Schwartz argues that by looking at the diaries of other creative genii from the past, such as Leonardo da Vinci, Michelangelo, Picasso, Einstein, Pauli, Planck, etc., to understand how they managed to produce so much stuff, we can distil it to a six-step process:

read more
January 13, 2022

Opportunity Solution Tree

Have you ever tried to brainstorm ideas to find what to work on next? And you ended up with too many ideas that you had to aggressively trim down or, worse, you solved the wrong problem? Opportunity Solution Tree may help you avoid that.

Opportunity Solution Tree (let’s shorten it to OST) is a visual way to represent how the solutions connect to the desired outcome in a way that helps you focus on solving the right problem.

read more
January 12, 2022

Extreme Ownership

When I first got a leadership role, I asked a friend for tips to learn and do my job better. He referred me to a book, Extreme Ownership, by Jocko Willink and Leif Babin.

The book’s main idea is to take ownership of everything you do (or don’t do), especially for a leader. If a team fails, the leader should step up and assume the failure instead of blaming the team.

read more
  • ««
  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • »
  • »»
© Douglas Drumond Kayama 2025