2

While using the command sudo apt edit-sources, accidentally chose vim instead of nano and don't know how to change it. I used sudo update-alternatives --config editor but it doesn't change the editor I use in the sudo apt edit-sources command.

AEM
  • 1,166
  • 5
  • 1
    apt uses /usr/bin/select-editor (it creates a file in HOME .selected_editor, if you delete it you will get to choose again) –  Jul 11 '21 at 09:57
  • I can't find HOME.selected_editor so I deleted select-editor in /usr/bin/select-editor but even that dosent seem to work. – LyingAmigo Jul 11 '21 at 11:37
  • apt-get --reinstall install sensible-utils will give you select-editor back, run it to get the menu. –  Jul 11 '21 at 12:28
  • In short, apt edit-sources uses Dir::Bin::Editor as default editor, which defaults to sensible-editor, this is a shell wrapper trying to make sense of which editor to use if neither EDITOR nor SELECTED_EDITOR is set sensible-editor will try to start select-editor which creates and sources the file ~/.selected_editor before calling the selected editor, I think the order is $VISUAL, $EDITOR, $SELECTED_EDITOR and last editor. –  Jul 11 '21 at 12:49
  • sorry nano is last –  Jul 11 '21 at 12:55
  • I really appreciate all the information about the order of completion and that command did bring back 'select-editor' and when I ran it I got to choose again but the problem is still there. When I run 'sudo apt edit-sources' vim opens. I am not that familiar with vim so I am kinda stuck and I think I will reinstall the OS if can't fix it. – LyingAmigo Jul 11 '21 at 23:41
  • If you ran this with sudo, look for the file in root's home directory not your own. – muru Jul 19 '21 at 05:45

0 Answers0