MC – How to Set Default Editor/Viewer for Midnight Commander to Sublime

mc

The question is quite straightforward, so no further description is needed according to me.

I just add that I am running Ubuntu 13.04.

Any help is welcomed.

Best Answer

In Midnight Commander go to Options menu / Configuration... command / Use internal edit checkbox and uncheck it. (Don't forget to execute the Save setup command if the Auto save setup option is off.)

Then set the EDITOR environment variable to Sublime. You may prefer to add one of these to your shell's resource file:

  • Global setting for all programs that use EDITOR (not recommended):

    EDITOR=sublime
    export EDITOR
    
  • Temporary setting for the given Midnight Commander session only:

    alias mc='EDITOR=sublime mc'
    

Same for the viewer, just you uncheck the Use internal view option and set the VIEWER environment variable instead.

Related Question