DEV Community

Tyler Auerbeck
Tyler Auerbeck

Posted on • Edited on

Reverting your default editor to Vim in Fedora 33

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.

Top comments (5)

Collapse
 
neekfenwick profile image
neekfenwick

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.

Collapse
 
klohto profile image
Tomas Klohna

Run with sudo dnf install --allowerasing vim-default-editor to replace in-place

Collapse
 
averyfreeman profile image
Avery Freeman • Edited

Well, this is garbage. I just ripped out nano-default-editor with dnf remove -y, and look at everything it removed:

  bc-1.07.1-15.fc36.x86_64                                                      
  fpaste-0.4.2.0-3.fc36.noarch                                                  
  git-2.36.0-1.fc36.x86_64                                                      
  git-core-doc-2.36.0-1.fc36.noarch                                             
  jwhois-4.0-67.fc36.x86_64                                                     
  mtr-2:0.95-2.fc36.x86_64                                                      
  nano-default-editor-6.0-2.fc36.noarch                                         
  perl-Error-1:0.17029-8.fc36.noarch                                            
  perl-Git-2.36.0-1.fc36.noarch                                                 
  tcpdump-14:4.99.1-5.fc36.x86_64                                               
  time-1.9-18.fc36.x86_64                                                       
  toolbox-experience-0.0.99.3-4.fc36.x86_64                                     
  toolbox-support-0.0.99.3-4.fc36.x86_64                                        
  traceroute-3:2.1.0-15.fc36.x86_64                                             
  tree-2.0.1-2.fc36.x86_64                                                      
  words-3.0-39.fc36.noarch                                                      
Enter fullscreen mode Exit fullscreen mode

Then, I installed vim-default-editor by itself, and afterward separately tried to install toolbox-{experience,support}, and it said it required --allowerasing

And look what that does:

Downgraded:
  git-core-2.35.1-1.fc36.x86_64                                                 
Installed:
  bc-1.07.1-15.fc36.x86_64                                                      
  fpaste-0.4.2.0-3.fc36.noarch                                                  
  git-2.35.1-1.fc36.x86_64                                                      
  git-core-doc-2.35.1-1.fc36.noarch                                             
  jwhois-4.0-67.fc36.x86_64                                                     
  mtr-2:0.95-2.fc36.x86_64                                                      
  nano-default-editor-6.0-2.fc36.noarch                                         
  perl-Error-1:0.17029-8.fc36.noarch                                            
  perl-Git-2.35.1-1.fc36.noarch                                                 
  tcpdump-14:4.99.1-5.fc36.x86_64                                               
  time-1.9-18.fc36.x86_64                                                       
  toolbox-experience-0.0.99.3-4.fc36.x86_64                                     
  toolbox-support-0.0.99.3-4.fc36.x86_64                                        
  traceroute-3:2.1.0-15.fc36.x86_64                                             
  tree-2.0.1-2.fc36.x86_64                                                      
  words-3.0-39.fc36.noarch                                                      
Removed:
  vim-default-editor-2:8.2.4621-1.fc36.noarch 
Enter fullscreen mode Exit fullscreen mode

So I guess you can't use vim by default and toolbox at the same time in F36? That's beyond ridiculous.

Thread Thread
 
mauriziomarini profile image
Maurizio Marini

dnf install -y vim-default-editor --allowerasing
Last metadata expiration check: 3:10:41 ago on Sun 17 Jul 2022 06:14:27 PM CEST.

Dependencies resolved.

Package Architecture Version Repository Size

Installing:
vim-default-editor noarch 2:9.0.049-1.fc36 updates 20 k
Removing dependent packages:
nano-default-editor noarch 6.0-2.fc36 @fedora 514

Transaction Summary

Install 1 Package
Remove 1 Package

Total download size: 20 k
Downloading Packages:

vim-default-editor-9.0.049-1.fc36.noarch.rpm 88 kB/s | 20 kB 00:00

Total 33 kB/s | 20 kB 00:00

Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : vim-default-editor-2:9.0.049-1.fc36.noarch 1/2
Erasing : nano-default-editor-6.0-2.fc36.noarch 2/2
Verifying : vim-default-editor-2:9.0.049-1.fc36.noarch 1/2
Verifying : nano-default-editor-6.0-2.fc36.noarch 2/2

Installed:
vim-default-editor-2:9.0.049-1.fc36.noarch

Removed:
nano-default-editor-6.0-2.fc36.noarch

Complete!

Collapse
 
mauriziomarini profile image
Maurizio Marini

No, no reboot...neither logout
it's a profile subdir file, here it is:
cshell:
/etc/profile.d/vim-default-editor.csh

bash:
/etc/profile.d/vim-default-editor.sh

it's enough to su -
and... voila'