I've used vi, Vim, and now NeoVim for approximately 20 years. When I started using it, I hated it. Passionately. But at the time, I knew vi was essential to being a System Administrator: it was always installed on Unix systems, and a lot of the time it was the only editor you could count on being available. So I gritted my teeth and made myself use it (and nothing else) for a month (yes, it takes that long to start forming the muscle memory that makes it possible to use vi with any fluency). At the end of the month I still didn't like it - but I'd come to realize that there was an insane amount of power hiding behind that obnoxious and counter-intuitive facade.
I'm not the first to offer a series of Vim tips, nor will I be the last. And this won't even be the best of them. But writing them will help me remember what I know and learn new stuff - and may even help people learn more about what is now my favourite editor.
I use - and very strongly recommend - NeoVim. 30% less code than Vim, totally feature- and script-compatible, and we finally have a fully functional terminal emulator. And it's available as a package for almost all Linux distros and Mac (through brew
).
If a tip interests you, read it carefully ... and then use it. A lot. (Neo)Vim is all about muscle memory: doing something until it becomes second nature to your fingers.
Categories
For the unsure:
- "Flow" and the Paradox of the Complex Tool: Vim is tough to learn but incredibly powerful and an enabler of "flow" (one of my best blog entries)
- 7 reasons to love Vim: an article (by me) at opensource.com
Beginner: you've been using Vim less than a month and/or can't automatically use 'hjkl' for movement.
- START HERE: how to start and exit vim, and basic movement
- Basic yank (copy), delete, paste, and move
- More Basic Movement - move by words, sentences, and paragraphs
- Undo, Redo, and Repeat
Beginning Intermediate: you've passed your first month, but that config file still looks damn confusing.
- Selecting, Changing, and Deleting Blocks of Text with Vim
- Vim Settings
- Paste and Correct Indentation
- First Look at Neovim
- Getting Neovim Installed on Debian, Ubuntu and Mac: may be outdated, use with caution
- Basic Tabs
- Indentation and White Space
- Tab Completion
- A Terminal Inside (Neo)Vim
- Spelling
- Command Line (ex Mode) History
- Vim Colours and Syntax Highlighting
- Search and Replace
- Map Leader and Normal mode mappings
- Toggle Line Numbers on and off
- Completion - Much More Than Ctrl-P
Advanced Intermediate: your ~/.vimrc exceeds 100 lines.
- Repetition on a Range
- Movement for Programmers
- ex Mode
- Vim 'path' and 'find'
- Vim :compiler and :make
- Vim Modelines
- The Scratch Buffer - a great place to store temporary notes
- Examining Vim Start-up
- Remote Editing Files via SCP
- Flying Vim Airline - a status line for Vim
- Vifm - text-based file manager with Vi key-bindings
- Finding, Selecting, and Managing TTF Programmer Fonts for X: not strictly about Vim, but Linux Vim fans should read this
- Command History
- Vim Sessions
- Vim and the ftplugin folder
- gitgutter and Friends
- Working With ex Scripts
- Lint, Linting, and Linters (and Vim)
Advanced: you write VimScript.
- Basic Functions
- Vimscript Variable Scoping and Pseudovariables
- Status Line
- Status Line: Mode Display
- Vim Colour Scheme Automatic Look-up
- Updating a "Last Modified" Tag
- Working with Syntax Selection Strings
- Numbering Your Tabs
- Ansible go-to-role
- The Vim and Neovim Debugger
Very Advanced: you put in (Neo)Vim pull requests. I'm not at this level and won't be writing in this category.
As Published
- Tip #1: Basic Tabs - rating: Beginning Intermediate
- Tip #2: Tab Completion - rating: Beginning Intermediate
- Tip #3: THE FIRST TIP / START HERE - rating: Beginner
- Tip #4: Basic yank, delete, paste, and move - rating: Beginner
- Tip #5: ex Mode - rating: Advanced Intermediate
- Tip #6: Map Leader and Normal mode mappings - rating: Beginning Intermediate
- Tip #7: Vifm - rating: Advanced Intermediate
- Tip #8: Command History - rating: Advanced Intermediate
- Tip #9: More Basic Movement - rating: Beginner
- Tip #10: Working With ex Scripts - rating: Advanced Intermediate
- Tip #11: Spelling - rating: Beginning Intermediate
- Tip #12: Search and Replace - rating: Beginning Intermediate
- Tip #13: Movement for Programmers - rating: Advanced Intermediate
- Tip #14: Undo, Redo, and Repeat - rating: Beginner
- Tip #15: Remote Editing Files via SCP - rating: Advanced Intermediate
- Tip #16: A Terminal Inside (Neo)Vim - rating: Beginning Intermediate
- Tip #17: Flying Vim Airline - rating: Advanced Intermediate
- Tip #18: Basic Functions - rating: Advanced
- Tip #19: gitgutter and Friends - rating: Advanced Intermediate
- Tip #20: Indentation and White Space - rating: Beginning Intermediate
- Tip #21: Examining Vim Start-up - rating: Advanced Intermediate
- Tip #22: Vim Modelines - rating: Advanced Intermediate
- Tip #23: The Scratch Buffer - rating: Advanced Intermediate
- Tip #24: Vim 'path' and 'find' - rating: Advanced Intermediate
- Tip #25: Paste and Correct Indentation - rating: Beginning Intermediate
- Tip #26: Command Line (ex Mode) History - rating: Beginning Intermediate
- Tip #27: Repetition on a Range - rating: Advanced Intermediate
- Tip #28: Toggle Line Numbers on and off - rating: Beginning Intermediate
- Tip #29: Working with Syntax Selection Strings - rating: Advanced
- Tip #30: Numbering Your Tabs - rating: Advanced
- Tip #31: Completion - Much More Than Ctrl-P - rating: Beginning Intermediate
- Tip #32: Vim Settings - rating: Beginning Intermediate
- Tip #33: Vim :compiler and :make - rating: Advanced Intermediate
- Tip #34: Status Line - rating: Advanced
- Tip #35: Status Line: Mode Display - rating: Advanced