Hello world!

For my first blog post, I think it is only appropriate that I am to blog about vim, the greatest text editor ever created and the reason that I am in this program today. I first started learning vim in about 2017 when I saw a guy on YouTube editing $\LaTeX$ very fast. He was showing off his set up and I knew that I had to have that.

It has been five years and I can say that I am a professional vim user, but I still learn new things all the time, even some features that are quite basic. Over the course of the last five years, I have developed muscle memory for accomplishing routine text editing tasks. It was not until watching another vim user that I realized that there are other, possibly more efficient ways, to accomplish the same task in vim. While watching The Primeagen on YouTube in this video https://www.youtube.com/watch?v=uL9oOZStezw, I caught on to two different ways in that he does the same task as I do.

I will share with you here the first task as it is easy to explain in text. Given a few lines of code like the following:

| Header 1 | Header 2
| ---      | ---
| thing 1  | thing 2
| thing 3  | thing 3

one may want to add a | character after each line to complete the markdown table. Normally, I would perform this series of steps

  1. Move the cursor to the end of the first line (where the “2” is)
  2. Hit “ctrl-v” to go into visual block mode
  3. Navigate the cursor to the “3” on the last line by using a series of movements
  4. Then use the command '<,'>norm A | to append a | character to the end of each line
  5. Use a vim plugin to align all text at the | character so my code looks good

I have found that The Primeagen does something different which uses less key strokes.

  1. Hit vip to visual select the paragraph.
  2. Use the command '<,'>s/$/ |/ to substitute the end of each line in the visually selected area with a space and a | character.
  3. Use a vim plugin to align all text at the | character

Now that I have broken down the steps, I realize that in my first approach I could have also avoided visual block mode and used vip and the norm command works just the same. Now, spending the time to improve this tiny text editing habit that I have to perform at least once a day, I will shave off many seconds in my life!

Print Friendly, PDF & Email

One Reply to “Hello world!”

Leave a Reply

Your email address will not be published. Required fields are marked *