I wrote a Vim Reference Guide (beginner-intermediate level)



"Vim Reference Guide" is intended as a concise learning resource for beginner to intermediate level Vim users. I hope this guide would make it much easier for you to discover Vim features and learning resources than my own blundering experience.

To celebrate the release, ebook (PDF+EPUB) version is free to download till 31-Mar-2022:

Online version of the book: https://learnbyexample.github.io/vim_reference/Introduction.html

Visit GitHub repo https://github.com/learnbyexample/vim_reference for markdown source.

Table of Contents

  • Preface
  • Introduction
  • Insert mode
  • Normal mode
  • Command-line mode
  • Visual mode
  • Regular Expressions
  • Macro
  • Customizing Vim
  • CLI options

Here's a small list of the things/features I learned from the built-in manuals while writing this guide:

  • 0 followed by Ctrl+d deletes all indentation in the current line (Insert mode)
  • Ctrl+r followed by = allows you to insert the result of an expression
    • ex: Ctrl+r followed by =strftime("%Y/%m/%d")
  • ]p and [p behaves like p and P commands, but adapts to the indentation level of the current line
  • 50% move to file location based on the given percentage
  • Ctrl+e and Ctrl+y to scroll up/down by a line
  • ga shows codepoint value of the character under the cursor in decimal, octal and hexadecimal formats
  • :w >> filename append to an existing file
    • :nnoremap x V:w >> ignore.txt <CR>dd I use this temporary mapping to move a line from typos log file to an ignore file
  • :$tabe file open file as the last tab
  • splitbelow and splitright settings to change how the splits open
  • :/pattern/;+1d delete the line matching pat1 as well as the line after (note the use of ; instead of ,)
  • :terminal terminal mode and various Ctrl+w commands
  • g followed by Ctrl+a in Visual mode (arithmentic progression increment for list items, etc)
  • various forms of \_ in regexp to include end-of-line characters
  • \%[set] match zero or more of these characters in the same order, as much as possible
    • ex: spa\%[red] matches spa or spar or spare or spared (longest match wins)

Hope you find these resources useful. Let me know your feedback. Happy learning ๐Ÿ™‚

PS: Some of my other ebooks (CLI one-liners, Python, etc) and bundles are on sale as well. Also, I'm currently creating short 1-10 minute videos based on the Vim guide. You can find these details in the above links.

submitted by /u/ASIC_SP
[link] [comments]