Notes about how I am internalizing VIM key bindings ☕

PUBLISHED ON MAY 11, 2022 / 1 MIN READ — CLI, VIM, WORKFLOW

Wed, May 12th, 2022

To my future self:

My learning process using VIM key bindings was stuck on move commands; even though I realized the power of moving freely and accurately around the editor, I haven’t a reason to waste my life with key bindings. This post is a never-ending excuse to continue developing my VIM workflow. If I am reading this now, I am sure I forgot something.

Repeating a char or a seq of chars n times

Sequence: ESC-n-i-char/seq-ESC-ESC

  • n: number of times
  • i: insert mode
  • char/seq: char or sequence of chars

Usage: Create a header for a file or when I need to repeat an arbitrary sequence of characters.

Basic replacing in the current line :s or in all llines :%s

Sequence: :s/this/for that/g or :%s/this/for that/g

  • :s: is short for “substitute” on the current line
  • :%s: is short for “substitute” on the whole document
  • this: is the pattern you want to replace
  • for that: you want instead
  • g: is short for “global” and refers to replacing more than the first occurrence

Usage: guess what!

Change upper-to-lower case and viceversa

Sequence: guu (upper-to-lower) or gUU (lower-to-upper) the current line

  • U: Change lower-to-upper case
  • u: Change upper-to-lower case
  • VIM selection + {u or U}: change the selection given u or U behavior




                         That’s the way computer talks to each other.

TAGS: CLI, VIM, WORKFLOW
comments powered by Disqus