50 useful Vim commands
From VimTricks:
Here are 50 useful Vim commands that work in normal mode. Many of these can be combined and modified to produce dozens more. Use these as inspiration for your own repeatable workflows.
From VimTricks:
Here are 50 useful Vim commands that work in normal mode. Many of these can be combined and modified to produce dozens more. Use these as inspiration for your own repeatable workflows.
After many years of gradual improvement Vim now takes a big step with a major release. Besides many small additions the spotlight is on a new incarnation of the Vim script language: Vim9 script.
One of Neovim’s major draws is that you can avoid Vim script altogether and use Lua instead. It looks like the Vim team is addressing the two major complaints folks have with Vim script: performance and its obscure syntax:
The main goal of Vim9 script is to drastically improve performance. This is accomplished by compiling commands into instructions that can be efficiently executed. An increase in execution speed of 10 to 100 times can be expected.
A secondary goal is to avoid Vim-specific constructs and get closer to commonly used programming languages, such as JavaScript, TypeScript and Java.
Legacy scripts will continue to work, of course. The Vim team has no plans to drop legacy support in the foreseeable future. Learn more about Vim9 script here or with :help vim9
inside Vim itself.
When you start Vim with the
--clean
option, it shows up in “vanilla” mode. No plugins, no configuration, just back to the roots. I have collected a ton of configuration statements over the years, some of them dating from MS-DOS or Windows 3.1. Here is the deal: I will start from scratch to find a good starting-point configuration with just the plugins available in Fedora 35. Will I survive a week of coding? I’ll find out!
How Lukáš Zapletal dropped from 35 Vim plugins to just six.
We had a lot of fun recording the Vim with me series alongside episode 450, so I thought, “Hey, let’s keep it going!” We have Nick Nisi for you today. Nick is a regular panelist on JS Party, co-hosted our upcoming Neovim episode of The Changelog, and is personally responsible for the #vimparty
channel of Changelog’s community Slack.
(If you have any requests of people you’d like to see Vimming with me, let us know in the comments!)
Julia stuck around after our Vim interview to share some of her Vim setup with me. She shows off the Visual Mode feature that I learned on the pod and shared her love of macros as well!
Gary stuck around after our Vim interview to share some of his Vim setup with me. If you’ve never seen Gary use Vim, this is a must-watch. The guy moves at the speed of thought. 🏃♂️
Suz stuck around after our Vim interview to share some of her Vim setup with me. She created an epic plugin that lets her Twitch audience comment on specific lines while she’s editing. Definitely worth a 👀!
This is such a cool idea (inspired by Limelight), written in Lua, and using TreeSitter for better dimming. Will plugins like this start pulling normal Vim users over to Neovim?
Here’s a sneak peek of our upcoming episode of The Changelog (plus bonus videos) starring Julia Evans, Drew Neil, Suz Hinton, and Gary Bernhardt!
Did you know that this fuzzy finder - fzf, can do a lot more than you thought? Oh yeah, the fuzzy search is just the tip of the iceberg here. It is like wine; the more you leave it on your computer, the more flavor and sweetness it accumulates from that command-line. Let’s dive in and find out how you can increase your productivity with fzf inside Vim.
“Thank you! But our princess is in another buffer!”
Command (line? I’ve never called it that) mode is indeed where much of Vim’s power lies. In this post on Thoughtbot’s blog, German Velasco explains search and replace, command repetition, ranges, and more.
Vimpeccable is a plugin for Neovim that allows you to easily replace your vimscript-based
.vimrc
with a lua-based one instead. Vimpeccable adds to the existing Neovim lua API by adding new lua commands to easily map keys directly to lua.
All of the power and customization of Vim without the inscrutable and othewise compulsory Vimscript? Sign me up! (metaphorically… I’m far too lazy to customize Vim anymore than I already have.)
If you use Vimium (a Chrome extension which provides keyboard shortcuts for navigation and control in the spirit of the Vim editor) and you’re on macOS, Vimac is a no-brainer. You can scroll windows with HJKL
keys, perform clicks using hint letters, and even perform right (and double) clicks with your keyboard.
Learn the good parts of Vim.
This book from Igor Irianto is in progress with 11 of 20 chapters are ready to read as of right now.
Nikola Đuza makes a compelling case for the powerful text editor that developers love (or love to hate):
What Vim is excellent at is navigating, making some changes, and repeating the process. The process most call editing (not to be confused with writing). Most developers tend to overlook this fact, but this is one of the strong selling points of Vim. Developers are more prone to reading code, jumping from file to file, making small incisions in the code, and writing code all the time.
A nice history of Vim and what it got right:
To better understand why and how Vim got (and is) so popular, it is best to look into the roots of how it all started. Before
vim
, there wasvi
, beforevi
there wased
. What are all these two or three letter words, and what is the story behind it? Let us dive in and figure out.
With VimWiki, you can organize notes and ideas, manage to-do lists, write documentation, maintain a diary, and more. Everything is exportable to HTML.
If you’re setting out to win friends and influence people with your vim
skills, you might as well do it in 3D…
Yaron Wittenstein recaps the editor holy wars then tells his personal journey with the two editors and how he found a happy place somewhere in-between:
emacs has a very popular vim emulation named evil (branded as The extensible vi layer for Emacs). I was skeptical at first but gave it a try, and surprisingly things went smooth.
Vim-clap is different than previous finders because it uses the new floating_win
(NeoVim) and popup
(Vim) interface. File lookup and switching have long been what keep me out of Vim as my daily driver (clunky UIs, slow results). Nothing beats Sublime Text in this category, in my opinion.
But this looks pretty awesome. I might have to give this a test drive and see if it wins me back.
This “Conquer[er] of Completion” is an intellisense engine for Vim 8 and Neovim which supports extension features of VS Code. I haven’t tried it yet, but the folks in our #vimparty Slack channel are pretty in to it.
Chris Thorn writing for Thoughtbot:
Lately, I’ve noticed that opening Markdown files in Vim is slow. I don’t know exactly how slow, but slow enough that I notice a pause after opening the file before I can edit it. I’m not sure why or when it started, but it’s painful enough that I want to track down and alleviate it.
I, too, have felt this pain, which is one of the reasons I no longer use Vim as my full-time coding editor. I still use it enough for its sluggishness to bug me, but not quite enough to go chasing down why it’s sluggish. This article might change my calculus on that decision.
Clearly it takes years to truly master Vim, but it takes just 9 minutes, or less depending on the speed you read at, to hear someone else’s journey with Vim. Omer Hamerman shared the “why” and “how” of Vim — plus the recipe and resources he used to learn Vim.
How did I do it? After a few brutal fights, having my fallback IDE to run back to crying with the tail between my legs, I made a decision. Here’s how I did it:
- Got a nice small notebook I could carry around
- I bought the awesome Practical Vim by Drew Neil both in hardcover and for my iPad to read on the move
- Every night before going to bed, I read one tip — the book is very intelligently built like that for easy, slow studying…
I’ve been using Vim for eight years and am still discovering new things. This is usually seen as a Good Thing About Vim. In my head, though, it’s a failing of discoverability: I keep discovering new things because Vim makes it so hard to know what’s available.
Vim definitely has a discoverability problem, which is why posts like this one are so valuable and get shared around by people like us.