hrmnjt's secure thought transfer protocol

vim-motion cheatsheet

2024-04-08 . 429 words . 3 min

Right now, my coding workflow can be summarized as furious alt-tab between Firefox, Sublime Text and iterm2 and maxing out on keyboard shortcuts for all three of them. I always had the urge to ditch Sublime as well and move to my own personalized development environment but setting up neovim and leaving the comfort of Sublime felt like unnecessary pressure for me. In order to get hooked on Vim motions I switched to vim-bindings on Sublime Text and found myself using them a lot instead of Sublime shortcuts which don't feel very natural and intuitive anymore. But my range was very little; I'm not using a lot of what is possible; a lot of what can be good and intuitive.

So... I went online and searched for a cheatsheet - a reference which I would keep open and alt-tab to it when I need to look into a handy way of doing something in neovim. I found and recommend Advanced Vim Cheatsheet which is not free but amazing. But this approach was counter productive because now I have Sublime + Firefox + iterm2 + Preview open on my laptop which is 2 more applications I want to have open when coding.

So... I created a terminal reference for most important keymaps that I want to worry about with space for some more that I can add later.

 +---------------------------------+   ▲        +---------+---------+---------+
 |[operator]        [count][motion]|   |        |p  paste |P  paste |^w  del  |
 +---------+--------+--------------+   gg 1st   |   after |   before|    word |
 |d delete |w  word |(, )  ()block |   |  line  +---------+---------+---------+
 +---------+W  WORD |[, ]  []block |   |        |u  undo  |^r redo  |.  repeat|
 |y yank   |s  sntnc|{, }  ()block |   ^b up 1  |         |         |         |
 +---------+--------+--------------+   |  page  +---------+---------+---------+
 |c change |  (use text-objects)   |   |        |nG jump  |^o jump  |^i jump  |
 +---------+  ||   +iw+       ||   |   ^u up 0.5|   line N|   back  |   frwrd |
 |~ case   |  ||   +----iW----+|   |   |  page  +---------+---------+---------+
 +---------+  |+------i(------+|   |   |        |== auto  |>> shift |^u del   |
 |= indent |  +-------a(-------+   |   k  up    |   indent|<< shift |   line  |
 +---------+-----------------------+   |  line  +---------+---------+---------+
                                       |
◀--0------^------------B-----b------h--+--l------e------w-----E-----W------$---▶
 strt    1st         prev  prev   prev | next   end    next  end   next   end
 line   char         WORD  word   char | char   word   word  WORD  WORD   line
                                       |           +--------------------------+
                                       j  down     |:h  left-right-motions    |
                                       |  line     |:h  up-down-motions       |
                                       |           |:h  operator              |
                                       ^d down 0.5 |:h  navigation            |
                                       |  page     |:h  pattern-searches      |
                                       |           |:h  jump-motions          |
                                       ^d down 1   +--------------------------+
                                       |  page     |:e  open file to edit     |
                                       |           |:ls list open files       |
                                       G  last     |:bn jump to next file     |
                                       |  line     |:bp jump to prev file     |
                                       ▼           +--------------------------+

and here is the Github repository which has has the source code for the cheatsheet. To open the monopic file, you might need Monodraw which is what I used to create the cheatsheet.