Vim Movements: A Journey Through Time and Text

Vim Movements: A Journey Through Time and Text

Published on Friday, October 20, 2023

Vim Movements: A Journey Through Time and Text

What are Vim Movements?

Vim is a highly configurable text editor built for efficiently creating and changing any text, most often code. Unlike standard text editors, Vim has several operational modes like normal, insert, and visual. This approach allows proficient Vim users to edit text, using variously advanced quick 'movements' with different key combinations, without moving hands from asdf and jkl;. With traditional editors and keyboard, more advanced commands like selecting an entire line, selecting a word, and other requires moving the right hand to arrow keys and home/end (and what's even worse, laptop and smaller keyboards often don't even have those keys, or have them on the weird places like next to F Keys, or stacked vertically). These commands are much faster with Vim Movements, at least in theory.

Vim Plugins

Most modern IDEs and editors have Vim plugins. I'm using the IdeaVim plugin for JetBrains Rider most often.

Vim Movements

Navigating within a document efficiently is one of the keystones of text editing.

  • Characters:
    • h: move left
    • j: move down
    • k: move up
    • l: move right
  • Words:
    • w: move to the start of the next word
    • b: move to the start of the previous word
    • e: move to the end of the word

However, for someone who is a passionate 80% (or 100%) keyboard user, who uses ins, del, home, end, page up, page down, and arrow keys and even has an additional 'micro' keyboard for shortcuts, this is a pain.

  • Sentences and Paragraphs
    • Start of the next sentence: )
    • Start of the previous sentence: (
    • Next paragraph or block: }
    • Previous paragraph or block: {
  • Going to Line Ends and Starts
    • Start of the line: 0
    • End of the line: $
  • Specific Line Numbers
    • Jump to a particular line number**: :123 (Replace 123 with the desired line number)
    • Jump to the last line**: G
    • Jump to the first line: gg
  • Screen Movement
    • Top of the screen: H
    • Middle of the screen: M
    • Bottom of the screen: L
  • Search to Navigate
    • Search forward for a word: /word (Replace "word" with your target)
    • Search backward for a word: ?word
    • Repeat the search in the same direction: n
    • Repeat the search in the opposite direction: N
  • Matching Parenthesis or Brackets
    • Find the matching bracket/parenthesis: %

My Vim (movements) Journey

I have started practicing with Vimified. There are many similar services, but I liked the Vimified interface the best.

Do you mean you liked the one interface that looks the least like Vim?

...

At the moment, learning Vim is "fun". I'm practicing daily, and I'm getting better. The last time I had so much "fun" while learning something, I was working with JavaScript and was questioning life decisions with a psychiatrist.

I'm not sure if I will ever be able to use Vim as my primary editor, but I'm open to the possibility of using Vim Movements in my daily work.

However, old habits die hard. Ironically, I often turn it off IdeaVim in Rider when I have to do something quickly.

Can an old dog learn new tricks?

I hope so!