1

I want to setup micro as the default editor in Midnight Commander (I was using the default nano). I've installed micro as a snap.

I deleted the file .selected_editor in my home user folder so now it gives me a list of editors each time that I press F4, but micro does not appear in this list.

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/mcedit
  4. /usr/bin/vim.tiny
  5. /usr/bin/code
  6. /bin/ed

Choose 1-6 [1]: 

What can I do to make micro my default editor?

I'm using Ubuntu MATE 18.04 LTS, my terminal is Terminator and my Micro version is 2.0.6.

  • Have you tried instead of removing `.selected_editor` to put the binary of your editor in it manually? – Sebastian Aug 14 '20 at 09:22
  • @Sebastian Yes, I tried to put `SELECTED EDITOR="/var/lib/snapd/snaps/micro_2596.snap"` in the file; but it gives me an error`/usr/bin/sensible-editor: 25: /usr/bin/sensible-editor: /var/lib/snapd/snaps/micro_2596.snap: Permission denied`. Then sets the default editor back to nano. – Xavizard Knight Aug 14 '20 at 11:25
  • I'm not sure that is the correct way to launch a snap, but I don't use snaps. You would have to put the same command line you would use in a terminal to start it. – Sebastian Aug 14 '20 at 12:47
  • I got it working by typing the `micro` command in the path of the editor. Thank you for your help! – Xavizard Knight Aug 15 '20 at 18:55
  • Great. I will post it as an answer so it is more visible. – Sebastian Aug 15 '20 at 19:57

2 Answers2

1

To use another editor than those proposed by mc, just choose any of the options so mc creates the ~/.selected_editor file.

Then edit that file and replace the path to the executable in it to the editor you want to use. You need to use a command line that would also work in a terminal.

Sebastian
  • 1,218
  • 1
  • 7
  • 14
0
  1. Install micro (for e.g., with brew).
  2. Disable mc internal editor.
  3. Use select-editor command (already there, from sensible-utils package; instead of editing any file directly).
Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117