Douglas Drumond Kayama

  • pt
  • About

Posts

April 19, 2025

Reading Sherlock Holmes

The first Sherlock Holmes book I read was A Study in Scarlet. I was ten at the time; my mom gave me a copy of Um Estudo em Vermelho, the Brazilian Portuguese translation of A Study in Scarlet. It was 1993. The word “Amazon” only referred to our largest forest or river, not the bookshop that has since become a behemoth. I didn’t even have a computer at home. My first contact with the language of Albion would not occur until the following year; I barely knew how to pronounce the names. Anyway, I was hooked. I loved Holmes’ intelligence and perception, and that sparked the imagination of my younger self, wondering if it would really be possible to deduce facts from small evidence such as mud on a boot (or trainers, I was just a kid). Later, I went to the library and borrowed the remaining books – at least the ones I could find.

read more
April 10, 2025

English learning YouTube channels

I was talking to a few friends about my current English learning situation and shared with them some of the sources I’m using to study. I’m trying to improve my English pronunciation and the accent I chose to learn is the RP accent1. Sometimes, I take private classes with a teacher using the platform italki [sic], but I also like to watch YouTube videos and that is the reason of this text.

read more
November 17, 2024

Checking spelling

Vim has a built-in spell check that you can enable with :set spell. You can also set the language with :set spelllang= followed by the two-letter code of the language and optionally a dash and the region (e.g., :set spelllang=en or :set spelllang=en-GB).

After enabling the spell checker, you can move between different mistakes with ]s and [s.

I knew about the spell check, I knew Vim highlighted spelling mistakes, and I knew how to move between the mistakes. I usually fix them manually and I never bothered to learn how to make Vim fix them for me. Until today.

read more
November 16, 2024

`:read` the output of a command into the current buffer

If you want to use the output of a command inside your file, you don’t need to exit Vim, run the command, copy the output, return to Vim and paste the contents. You can use :read (or abbreviated to :r) and run a command with !. For example, :r !ls -a will insert the output of ls -a at the current cursor position.

You can also insert the content of another file with :r, except this time you don’t use !, just the file name. For example, :r second_file will insert the content of second_file at the current cursor position.

read more
November 4, 2024

Changing capitalisation of words

In Vim, while in normal mode, if you type ~, the capitalisation of the letter under the cursor changes and the cursor is advanced to the right.

You can also change the capitalisation of multiple letters at the same time with g command. Type gU and a movement to make every letter corresponding to the movement to become uppercase. gu makes it lowercase and g~ toggles the case. You can repeat the last character to affect the whole line (guu, gUU, g~~).

read more
November 4, 2024

Counting with `g` followed by increment/decrement

In Vim, you can type ctrl-a or ctrl-x to increment or decrement the next number in the line. For example, suppose you have the following line:

1. Do something

If you put the cursor on number one and type ctrl-a repeated times, you notice the number will increase to 2, 3, etc. Similarly, if you type ctrl-x, it will decrease going into negative numbers if you do it enough times.

Let’s say you want to create a numbered list. You have a list of people:

read more
November 4, 2024

Line movement with `g`

If you have a long line in Vim, Vim wraps that line visually at window length. It’s not a hard wrap, no newline character is inserted. Since it’s only one line, if you try moving up or down with j and k, you’ll notice that the cursor moves up or down the group of lines (visually) corresponding to one line in the file. The same happens when you type 0 or ^ to go to the beginning of the line and $ to go to the end.

read more
November 4, 2024

The `:normal` command in Vim

You can use :normal (or the abbreviated form, :norm) in Vim to execute a normal command on a range of lines.

Example:

:%norm I1. <cr>

Here, <cr> means ‘press enter key’. Also, notice the space after the dot.

That command will act on all line (%) and insert at the beginning of the line (I) the number 1 followed by a dot, followed by a space.

After pressing enter, the command is executed and Vim returns to normal mode.

read more
November 4, 2024

Use `gv` to reselect

If you selected part of the text, then did something else, then decided to select the same text again, instead of using v or V and redoing the selection, you can type gv in normal mode to reselect the previous text.

Photo by the author

read more
November 4, 2024

Using `ctrl-v` to type control characters

When in command-line mode in Vim, for example, when typing Ex commands, you can use ctrl-v to type control characters. Usually, if you type the control character, Vim will execute it. For example, if you simply press enter, you’re going to execute whatever you have typed so far in command-line mode. But if you type ctrl-v followed by enter, you will see a ^M inserted and Vim will treat it as if you typed the enter character instead.

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