DEV Community


Reverting your default editor to Vim in Fedora 33

tylerauerbeck profile image Tyler Auerbeck ・2 min read

TLDR; Starting with Fedora 33 the default editor is nano. If you're expecting vi(m) then there's a simple package you can install to get back into good shape.

I recently made the switch over to Fedora 33 and was a bit shocked when I began setting up my machine. I had gone to run visudo and the unexpected happened:

sudoers screenshot in nano

I feel like I had already stumbled across this change at some point in the past. But there it was right in front of my face. NANO! Where was my precious vim?

Simpsons Rioting

How do we fix this injustice inconvenience?

All jokes aside, this wasn't a huge deal. But it was definitely something that was going to throw a wrench into my usual workflow. So I set off to figure out what the best way to get things back in working order was going to be. Luckily for anybody looking to make this change as well, it's already been wrapped up into a package and you just need to run a single command to get back into working order.

dnf install -y vim-default-editor

This was great because although you can likely just set some environment variables, there are also some other defaults and configurations that may not rely on the EDITOR environment variable that you don't want to manually go hunting for.

One important thing to call out here though is after you install this package, make sure to reboot your machine (or maybe at least restart your shell ?). One problem that I ran into was that although I had installed this package and most things were functioning as expected, the EDITOR variable wasn't immediately changed. So when I went to run things like kubectl edit <something>, it still popped me into nano. This likely isn't the only tool that will do something like that, so hopefully this helps prevent some strife for someone else in the future.

Discussion (1)

Editor guide
neekfenwick profile image

Thanks for the post! Just for the record, I had to dnf remove nano-default-editor first, because installing vim-default-editor gave me transaction resolution conflicts. Weirdly, beforehand I found visudo did use vim .. but EDITOR was nano and e.g. less <file> and pressing v to edit the file dropped me into nano. I also had to reboot to make the change take effect, logging out and in again wasn't enough.