Where is the editor choice kept in ranger?











up vote
0
down vote

favorite












On a fresh ranger install I tried to open neofetch config with ranger and selected ed to see what is it. I am glad Ctrl+D worked to exit the ed, but now ranger opens all files with it. Restarting terminal didn't work. ~/.config/ranger is empty:



$ ls -la .config/ranger/
total 12
drwxr-xr-x 2 techtonik techtonik 4096 ліс 24 23:32 .
drwx------ 24 techtonik techtonik 4096 ліс 24 22:19 ..
-rw-r--r-- 1 techtonik techtonik 35 ліс 24 23:32 bookmarks
-rw-r--r-- 1 techtonik techtonik 0 ліс 24 23:32 history
-rw-r--r-- 1 techtonik techtonik 0 ліс 7 14:03 tagged


How to fix that?



UPD: $EDITOR is empty, rifle still runs the ed.



$ rifle -l ~/.config/neofetch/config.conf 
0:editor::$EDITOR -- "$@"
1:pager::"$PAGER" -- "$@"
$ echo $EDITOR

$ rifle ~/.config/neofetch/config.conf
13949


UPD2: Ubuntu 18.10



UPD3: I don't see that ed is selected by OS



$ update-alternatives --display editor
editor - auto mode
link best version is /bin/nano
link currently points to /bin/nano
link editor is /usr/bin/editor
slave editor.1.gz is /usr/share/man/man1/editor.1.gz
slave editor.fr.1.gz is /usr/share/man/fr/man1/editor.1.gz
slave editor.it.1.gz is /usr/share/man/it/man1/editor.1.gz
slave editor.ja.1.gz is /usr/share/man/ja/man1/editor.1.gz
slave editor.pl.1.gz is /usr/share/man/pl/man1/editor.1.gz
slave editor.ru.1.gz is /usr/share/man/ru/man1/editor.1.gz
/bin/ed - priority -100
slave editor.1.gz: /usr/share/man/man1/ed.1.gz
/bin/nano - priority 40
slave editor.1.gz: /usr/share/man/man1/nano.1.gz
/usr/bin/vim.basic - priority 30
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.tiny - priority 15
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz









share|improve this question




















  • 1




    Ed, man! !man ed
    – dessert
    Nov 24 at 21:23






  • 1




    Did you try running it as e.g. EDITOR=vim ranger?
    – dessert
    Nov 24 at 21:29










  • Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
    – anatoly techtonik
    Nov 24 at 21:31










  • It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
    – Michael Prokopec
    Nov 24 at 21:33












  • @dessert You know your stuff too.
    – Michael Prokopec
    Nov 24 at 21:39















up vote
0
down vote

favorite












On a fresh ranger install I tried to open neofetch config with ranger and selected ed to see what is it. I am glad Ctrl+D worked to exit the ed, but now ranger opens all files with it. Restarting terminal didn't work. ~/.config/ranger is empty:



$ ls -la .config/ranger/
total 12
drwxr-xr-x 2 techtonik techtonik 4096 ліс 24 23:32 .
drwx------ 24 techtonik techtonik 4096 ліс 24 22:19 ..
-rw-r--r-- 1 techtonik techtonik 35 ліс 24 23:32 bookmarks
-rw-r--r-- 1 techtonik techtonik 0 ліс 24 23:32 history
-rw-r--r-- 1 techtonik techtonik 0 ліс 7 14:03 tagged


How to fix that?



UPD: $EDITOR is empty, rifle still runs the ed.



$ rifle -l ~/.config/neofetch/config.conf 
0:editor::$EDITOR -- "$@"
1:pager::"$PAGER" -- "$@"
$ echo $EDITOR

$ rifle ~/.config/neofetch/config.conf
13949


UPD2: Ubuntu 18.10



UPD3: I don't see that ed is selected by OS



$ update-alternatives --display editor
editor - auto mode
link best version is /bin/nano
link currently points to /bin/nano
link editor is /usr/bin/editor
slave editor.1.gz is /usr/share/man/man1/editor.1.gz
slave editor.fr.1.gz is /usr/share/man/fr/man1/editor.1.gz
slave editor.it.1.gz is /usr/share/man/it/man1/editor.1.gz
slave editor.ja.1.gz is /usr/share/man/ja/man1/editor.1.gz
slave editor.pl.1.gz is /usr/share/man/pl/man1/editor.1.gz
slave editor.ru.1.gz is /usr/share/man/ru/man1/editor.1.gz
/bin/ed - priority -100
slave editor.1.gz: /usr/share/man/man1/ed.1.gz
/bin/nano - priority 40
slave editor.1.gz: /usr/share/man/man1/nano.1.gz
/usr/bin/vim.basic - priority 30
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.tiny - priority 15
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz









share|improve this question




















  • 1




    Ed, man! !man ed
    – dessert
    Nov 24 at 21:23






  • 1




    Did you try running it as e.g. EDITOR=vim ranger?
    – dessert
    Nov 24 at 21:29










  • Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
    – anatoly techtonik
    Nov 24 at 21:31










  • It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
    – Michael Prokopec
    Nov 24 at 21:33












  • @dessert You know your stuff too.
    – Michael Prokopec
    Nov 24 at 21:39













up vote
0
down vote

favorite









up vote
0
down vote

favorite











On a fresh ranger install I tried to open neofetch config with ranger and selected ed to see what is it. I am glad Ctrl+D worked to exit the ed, but now ranger opens all files with it. Restarting terminal didn't work. ~/.config/ranger is empty:



$ ls -la .config/ranger/
total 12
drwxr-xr-x 2 techtonik techtonik 4096 ліс 24 23:32 .
drwx------ 24 techtonik techtonik 4096 ліс 24 22:19 ..
-rw-r--r-- 1 techtonik techtonik 35 ліс 24 23:32 bookmarks
-rw-r--r-- 1 techtonik techtonik 0 ліс 24 23:32 history
-rw-r--r-- 1 techtonik techtonik 0 ліс 7 14:03 tagged


How to fix that?



UPD: $EDITOR is empty, rifle still runs the ed.



$ rifle -l ~/.config/neofetch/config.conf 
0:editor::$EDITOR -- "$@"
1:pager::"$PAGER" -- "$@"
$ echo $EDITOR

$ rifle ~/.config/neofetch/config.conf
13949


UPD2: Ubuntu 18.10



UPD3: I don't see that ed is selected by OS



$ update-alternatives --display editor
editor - auto mode
link best version is /bin/nano
link currently points to /bin/nano
link editor is /usr/bin/editor
slave editor.1.gz is /usr/share/man/man1/editor.1.gz
slave editor.fr.1.gz is /usr/share/man/fr/man1/editor.1.gz
slave editor.it.1.gz is /usr/share/man/it/man1/editor.1.gz
slave editor.ja.1.gz is /usr/share/man/ja/man1/editor.1.gz
slave editor.pl.1.gz is /usr/share/man/pl/man1/editor.1.gz
slave editor.ru.1.gz is /usr/share/man/ru/man1/editor.1.gz
/bin/ed - priority -100
slave editor.1.gz: /usr/share/man/man1/ed.1.gz
/bin/nano - priority 40
slave editor.1.gz: /usr/share/man/man1/nano.1.gz
/usr/bin/vim.basic - priority 30
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.tiny - priority 15
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz









share|improve this question















On a fresh ranger install I tried to open neofetch config with ranger and selected ed to see what is it. I am glad Ctrl+D worked to exit the ed, but now ranger opens all files with it. Restarting terminal didn't work. ~/.config/ranger is empty:



$ ls -la .config/ranger/
total 12
drwxr-xr-x 2 techtonik techtonik 4096 ліс 24 23:32 .
drwx------ 24 techtonik techtonik 4096 ліс 24 22:19 ..
-rw-r--r-- 1 techtonik techtonik 35 ліс 24 23:32 bookmarks
-rw-r--r-- 1 techtonik techtonik 0 ліс 24 23:32 history
-rw-r--r-- 1 techtonik techtonik 0 ліс 7 14:03 tagged


How to fix that?



UPD: $EDITOR is empty, rifle still runs the ed.



$ rifle -l ~/.config/neofetch/config.conf 
0:editor::$EDITOR -- "$@"
1:pager::"$PAGER" -- "$@"
$ echo $EDITOR

$ rifle ~/.config/neofetch/config.conf
13949


UPD2: Ubuntu 18.10



UPD3: I don't see that ed is selected by OS



$ update-alternatives --display editor
editor - auto mode
link best version is /bin/nano
link currently points to /bin/nano
link editor is /usr/bin/editor
slave editor.1.gz is /usr/share/man/man1/editor.1.gz
slave editor.fr.1.gz is /usr/share/man/fr/man1/editor.1.gz
slave editor.it.1.gz is /usr/share/man/it/man1/editor.1.gz
slave editor.ja.1.gz is /usr/share/man/ja/man1/editor.1.gz
slave editor.pl.1.gz is /usr/share/man/pl/man1/editor.1.gz
slave editor.ru.1.gz is /usr/share/man/ru/man1/editor.1.gz
/bin/ed - priority -100
slave editor.1.gz: /usr/share/man/man1/ed.1.gz
/bin/nano - priority 40
slave editor.1.gz: /usr/share/man/man1/nano.1.gz
/usr/bin/vim.basic - priority 30
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.tiny - priority 15
slave editor.1.gz: /usr/share/man/man1/vim.1.gz
slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz
slave editor.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz






ubuntu alternatives ranger ed






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Rui F Ribeiro

38.3k1475126




38.3k1475126










asked Nov 24 at 20:44









anatoly techtonik

862825




862825








  • 1




    Ed, man! !man ed
    – dessert
    Nov 24 at 21:23






  • 1




    Did you try running it as e.g. EDITOR=vim ranger?
    – dessert
    Nov 24 at 21:29










  • Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
    – anatoly techtonik
    Nov 24 at 21:31










  • It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
    – Michael Prokopec
    Nov 24 at 21:33












  • @dessert You know your stuff too.
    – Michael Prokopec
    Nov 24 at 21:39














  • 1




    Ed, man! !man ed
    – dessert
    Nov 24 at 21:23






  • 1




    Did you try running it as e.g. EDITOR=vim ranger?
    – dessert
    Nov 24 at 21:29










  • Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
    – anatoly techtonik
    Nov 24 at 21:31










  • It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
    – Michael Prokopec
    Nov 24 at 21:33












  • @dessert You know your stuff too.
    – Michael Prokopec
    Nov 24 at 21:39








1




1




Ed, man! !man ed
– dessert
Nov 24 at 21:23




Ed, man! !man ed
– dessert
Nov 24 at 21:23




1




1




Did you try running it as e.g. EDITOR=vim ranger?
– dessert
Nov 24 at 21:29




Did you try running it as e.g. EDITOR=vim ranger?
– dessert
Nov 24 at 21:29












Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
– anatoly techtonik
Nov 24 at 21:31




Oh, I am sure it will invoke vim as expected. However, I want to know where ranger stores the ed setting.
– anatoly techtonik
Nov 24 at 21:31












It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
– Michael Prokopec
Nov 24 at 21:33






It is an enviromental VAR set in the OS/SHELL/WHATEVER other than in ranger itself. global
– Michael Prokopec
Nov 24 at 21:33














@dessert You know your stuff too.
– Michael Prokopec
Nov 24 at 21:39




@dessert You know your stuff too.
– Michael Prokopec
Nov 24 at 21:39










2 Answers
2






active

oldest

votes

















up vote
0
down vote













Check what editor, the os itself is pointing at. I think, ranger is looking at the now default for the os. Change the os's perfered editor, and I think it will change rangers.



sudo update-alternatives --config editor



Type the number of the one you want and hit enter.



In your case




auto mode




/bin/ed - priority -100


Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.



Set priority to 10



Change that and you should be good.






share|improve this answer























  • I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
    – anatoly techtonik
    Nov 24 at 21:01










  • Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
    – anatoly techtonik
    Nov 24 at 21:11










  • /bin/ed - priority -100
    – Michael Prokopec
    Nov 24 at 21:16










  • -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
    – anatoly techtonik
    Nov 24 at 21:18










  • Ok, humor me and change it to 10. Tell me what happens.
    – Michael Prokopec
    Nov 24 at 21:23




















up vote
0
down vote



accepted










As pointed out by @toon in ranger tracker, ranger doesn't provide any editor selection dialogs if EDITOR is not set. It resorts to hardcoded vim, but Debian/Ubuntu hackers patch ranger to use sensible-editor, which is a bash script that is not connected with updates-alternatives in any way, and stores editor choice in ~/.selected_editor:



$ cat ~/.selected_editor 
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/bin/ed"


I guess this sensible-editor bash script was implemented as a hack, because update-alternatives works on a system level, and users without root needed to edit bash config to select their EDITOR (which doesn't work for everyone).



Instead of implicitly patching ranger, the Debian folks could explicitly set EDITOR=sensible-editor for user level sessions. "Explicit is better than implicit". At least this way we won't spend so much time here. Digging man I found that sensible-editor is explained in this policy page:




If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor and /usr/bin/sensible-pager as the editor or pager program respectively.




And according to this text, ranger should not be patched, because it is already aware and makes use of EDITOR.





Closing this with final rants, why the ed is given as the user-level choice of Linux editor in 2018 ???..






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483921%2fwhere-is-the-editor-choice-kept-in-ranger%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Check what editor, the os itself is pointing at. I think, ranger is looking at the now default for the os. Change the os's perfered editor, and I think it will change rangers.



    sudo update-alternatives --config editor



    Type the number of the one you want and hit enter.



    In your case




    auto mode




    /bin/ed - priority -100


    Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.



    Set priority to 10



    Change that and you should be good.






    share|improve this answer























    • I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
      – anatoly techtonik
      Nov 24 at 21:01










    • Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
      – anatoly techtonik
      Nov 24 at 21:11










    • /bin/ed - priority -100
      – Michael Prokopec
      Nov 24 at 21:16










    • -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
      – anatoly techtonik
      Nov 24 at 21:18










    • Ok, humor me and change it to 10. Tell me what happens.
      – Michael Prokopec
      Nov 24 at 21:23

















    up vote
    0
    down vote













    Check what editor, the os itself is pointing at. I think, ranger is looking at the now default for the os. Change the os's perfered editor, and I think it will change rangers.



    sudo update-alternatives --config editor



    Type the number of the one you want and hit enter.



    In your case




    auto mode




    /bin/ed - priority -100


    Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.



    Set priority to 10



    Change that and you should be good.






    share|improve this answer























    • I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
      – anatoly techtonik
      Nov 24 at 21:01










    • Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
      – anatoly techtonik
      Nov 24 at 21:11










    • /bin/ed - priority -100
      – Michael Prokopec
      Nov 24 at 21:16










    • -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
      – anatoly techtonik
      Nov 24 at 21:18










    • Ok, humor me and change it to 10. Tell me what happens.
      – Michael Prokopec
      Nov 24 at 21:23















    up vote
    0
    down vote










    up vote
    0
    down vote









    Check what editor, the os itself is pointing at. I think, ranger is looking at the now default for the os. Change the os's perfered editor, and I think it will change rangers.



    sudo update-alternatives --config editor



    Type the number of the one you want and hit enter.



    In your case




    auto mode




    /bin/ed - priority -100


    Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.



    Set priority to 10



    Change that and you should be good.






    share|improve this answer














    Check what editor, the os itself is pointing at. I think, ranger is looking at the now default for the os. Change the os's perfered editor, and I think it will change rangers.



    sudo update-alternatives --config editor



    Type the number of the one you want and hit enter.



    In your case




    auto mode




    /bin/ed - priority -100


    Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.



    Set priority to 10



    Change that and you should be good.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 24 at 21:31

























    answered Nov 24 at 20:57









    Michael Prokopec

    59915




    59915












    • I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
      – anatoly techtonik
      Nov 24 at 21:01










    • Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
      – anatoly techtonik
      Nov 24 at 21:11










    • /bin/ed - priority -100
      – Michael Prokopec
      Nov 24 at 21:16










    • -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
      – anatoly techtonik
      Nov 24 at 21:18










    • Ok, humor me and change it to 10. Tell me what happens.
      – Michael Prokopec
      Nov 24 at 21:23




















    • I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
      – anatoly techtonik
      Nov 24 at 21:01










    • Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
      – anatoly techtonik
      Nov 24 at 21:11










    • /bin/ed - priority -100
      – Michael Prokopec
      Nov 24 at 21:16










    • -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
      – anatoly techtonik
      Nov 24 at 21:18










    • Ok, humor me and change it to 10. Tell me what happens.
      – Michael Prokopec
      Nov 24 at 21:23


















    I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
    – anatoly techtonik
    Nov 24 at 21:01




    I updated the question that I am using Ubuntu 18.10. I have no idea how to check what editor Ubuntu is pointing at.
    – anatoly techtonik
    Nov 24 at 21:01












    Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
    – anatoly techtonik
    Nov 24 at 21:11




    Updated the question to show that ed is probably not selected as default OS editor by update-alternatives.
    – anatoly techtonik
    Nov 24 at 21:11












    /bin/ed - priority -100
    – Michael Prokopec
    Nov 24 at 21:16




    /bin/ed - priority -100
    – Michael Prokopec
    Nov 24 at 21:16












    -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
    – anatoly techtonik
    Nov 24 at 21:18




    -100 means it should be selected last, after nano (40) and vim (30). If I run editor ~/.config/neofetch/config.conf the nano is opened.
    – anatoly techtonik
    Nov 24 at 21:18












    Ok, humor me and change it to 10. Tell me what happens.
    – Michael Prokopec
    Nov 24 at 21:23






    Ok, humor me and change it to 10. Tell me what happens.
    – Michael Prokopec
    Nov 24 at 21:23














    up vote
    0
    down vote



    accepted










    As pointed out by @toon in ranger tracker, ranger doesn't provide any editor selection dialogs if EDITOR is not set. It resorts to hardcoded vim, but Debian/Ubuntu hackers patch ranger to use sensible-editor, which is a bash script that is not connected with updates-alternatives in any way, and stores editor choice in ~/.selected_editor:



    $ cat ~/.selected_editor 
    # Generated by /usr/bin/select-editor
    SELECTED_EDITOR="/bin/ed"


    I guess this sensible-editor bash script was implemented as a hack, because update-alternatives works on a system level, and users without root needed to edit bash config to select their EDITOR (which doesn't work for everyone).



    Instead of implicitly patching ranger, the Debian folks could explicitly set EDITOR=sensible-editor for user level sessions. "Explicit is better than implicit". At least this way we won't spend so much time here. Digging man I found that sensible-editor is explained in this policy page:




    If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor and /usr/bin/sensible-pager as the editor or pager program respectively.




    And according to this text, ranger should not be patched, because it is already aware and makes use of EDITOR.





    Closing this with final rants, why the ed is given as the user-level choice of Linux editor in 2018 ???..






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      As pointed out by @toon in ranger tracker, ranger doesn't provide any editor selection dialogs if EDITOR is not set. It resorts to hardcoded vim, but Debian/Ubuntu hackers patch ranger to use sensible-editor, which is a bash script that is not connected with updates-alternatives in any way, and stores editor choice in ~/.selected_editor:



      $ cat ~/.selected_editor 
      # Generated by /usr/bin/select-editor
      SELECTED_EDITOR="/bin/ed"


      I guess this sensible-editor bash script was implemented as a hack, because update-alternatives works on a system level, and users without root needed to edit bash config to select their EDITOR (which doesn't work for everyone).



      Instead of implicitly patching ranger, the Debian folks could explicitly set EDITOR=sensible-editor for user level sessions. "Explicit is better than implicit". At least this way we won't spend so much time here. Digging man I found that sensible-editor is explained in this policy page:




      If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor and /usr/bin/sensible-pager as the editor or pager program respectively.




      And according to this text, ranger should not be patched, because it is already aware and makes use of EDITOR.





      Closing this with final rants, why the ed is given as the user-level choice of Linux editor in 2018 ???..






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        As pointed out by @toon in ranger tracker, ranger doesn't provide any editor selection dialogs if EDITOR is not set. It resorts to hardcoded vim, but Debian/Ubuntu hackers patch ranger to use sensible-editor, which is a bash script that is not connected with updates-alternatives in any way, and stores editor choice in ~/.selected_editor:



        $ cat ~/.selected_editor 
        # Generated by /usr/bin/select-editor
        SELECTED_EDITOR="/bin/ed"


        I guess this sensible-editor bash script was implemented as a hack, because update-alternatives works on a system level, and users without root needed to edit bash config to select their EDITOR (which doesn't work for everyone).



        Instead of implicitly patching ranger, the Debian folks could explicitly set EDITOR=sensible-editor for user level sessions. "Explicit is better than implicit". At least this way we won't spend so much time here. Digging man I found that sensible-editor is explained in this policy page:




        If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor and /usr/bin/sensible-pager as the editor or pager program respectively.




        And according to this text, ranger should not be patched, because it is already aware and makes use of EDITOR.





        Closing this with final rants, why the ed is given as the user-level choice of Linux editor in 2018 ???..






        share|improve this answer












        As pointed out by @toon in ranger tracker, ranger doesn't provide any editor selection dialogs if EDITOR is not set. It resorts to hardcoded vim, but Debian/Ubuntu hackers patch ranger to use sensible-editor, which is a bash script that is not connected with updates-alternatives in any way, and stores editor choice in ~/.selected_editor:



        $ cat ~/.selected_editor 
        # Generated by /usr/bin/select-editor
        SELECTED_EDITOR="/bin/ed"


        I guess this sensible-editor bash script was implemented as a hack, because update-alternatives works on a system level, and users without root needed to edit bash config to select their EDITOR (which doesn't work for everyone).



        Instead of implicitly patching ranger, the Debian folks could explicitly set EDITOR=sensible-editor for user level sessions. "Explicit is better than implicit". At least this way we won't spend so much time here. Digging man I found that sensible-editor is explained in this policy page:




        If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor and /usr/bin/sensible-pager as the editor or pager program respectively.




        And according to this text, ranger should not be patched, because it is already aware and makes use of EDITOR.





        Closing this with final rants, why the ed is given as the user-level choice of Linux editor in 2018 ???..







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        anatoly techtonik

        862825




        862825






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483921%2fwhere-is-the-editor-choice-kept-in-ranger%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt