• 0 Posts
  • 11 Comments
Joined 2 years ago
cake
Cake day: June 17th, 2023

help-circle
  • Very useful for renaming a variable: * to search “word” under cursor. Try this with hlsearch on::set hlsearch. Then cw to change a match. Alternate n and . to quickly rename more occurrences of the word. Do a :noh to get rid of the highlighting. Maybe try :set noinc, some people prefer the traditional “non-incremental” search.

    Do all this in normal mode. Vim experts leave insert mode as soon as possible. Almost forgot: Pressing C-c takes you back to normal mode without leaving home row.

    Most important advice: Never touch arrow keys. Keep your fingers on the home row. Learn hjkl movement (focus on j and k, they are more important). Then get faster by using b, w, f, o, O, A, I, C-d and all the rest. Learn about J, it’s cool. You won’t get far without u and C-r though.

    Critically important advice for fellow Europeans: If you care about vim, consider learning the US keyboard layout. Default bindings are not convenient in other layouts like qwertz (where is forward slash on qwertz? Hello?), and learning US layout might be easier than learning to customize vim. On a typical modern Linux system, there are US layout variants that still allow typing Umlauts, like EurKey or “DE-US”, where you type ä by pressing RightAlt+a, for example.