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
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.
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
- 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
- Vim Colours and Syntax Highlighting
- Search and Replace
- Map Leader and Normal mode mappings
Advanced Intermediate: your ~/.vimrc exceeds 100 lines.
- Movement for Programmers
- ex Mode
- 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
- Vim Colour Scheme Automatic Look-up
- Updating a "Last Modified" Tag
- 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.
- 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