2

EDIT: I just noticed that when I hit Enter on the ranger (if it is executed with terminator -e ranger) then nano opens while with e it uses my main editor. In contrast, when I use a normal shell to execute ranger and then I hit Enter, my main editor shows up. By normal, I mean if I launch firstly the terminator and then the ranger.

Why is it different?

6
  • GNOME? I'm not GNOME user but isn't there possible to define somewhere in GNOME session variables? I'm putting some variable in my $HOME/.xinitrc ...
    – jirib
    Commented Jun 1, 2012 at 8:52
  • I use awesome as window manager. Commented Jun 1, 2012 at 9:07
  • So what about $HOME/.xsession ?
    – jirib
    Commented Jun 1, 2012 at 9:32
  • How are you launching them? From the same terminal? From different terminals? From the menu?
    – Mikel
    Commented Jun 1, 2012 at 14:41
  • The equivalent of pressing Alt+F2 in Gnome/KDE. You could say from the launcher. Commented Jun 1, 2012 at 16:44

2 Answers 2

2

I saw your previous question , if you want some environment variable to be set before executing any programs , edit /etc/profile (provided you're using bash) , add everything you need. e.g export EDITOR=nano

11
  • Thanks, I am not sure what is the problem, that is why I changed the question. Nevertheless, I have already in the ~/.bashrc file that EDITOR=subl. Should I export it? Commented Jun 1, 2012 at 10:06
  • @DimitrisLeventeas yes , and you really should put this line in /etc/profile , if you insist to put this in ~/.bashrc , make sure it's the first line , depends on your bashrc , it might not be executed
    – daisy
    Commented Jun 1, 2012 at 11:57
  • /etc/profile is for all users. ~/.bashrc is the right location to change settings for a single user.
    – Mikel
    Commented Jun 1, 2012 at 14:41
  • @DimitrisLeventeas Remove the environment variable setting from .bashrc, put it in ~/.profile. Commented Jun 2, 2012 at 0:32
  • @warl0ck Why /etc/profile? Everything that reads it also reads ~/.profile. In .bashrc, it wouldn't make any difference whether it's the first line or not. Commented Jun 2, 2012 at 0:33
1

When you run terminator -e ranger, the terminal emulator starts the program ranger directly inside it. When you run terminator and then start ranger in the shell, the terminal emulator runs a shell which runs ranger. The main difference is that your shell's interactive initialization file is sourced (e.g. ~/.bashrc for bash, ~/.zshrc for zsh). If your shell rc file sets some environment variables, you'll get different results depending on whether a program was started through an interactive shell or not. Here, it looks like you're setting EDITOR or VISUAL in your .bashrc. If you don't, you get your system's default, which is nano.

The fix is to set environments variable where they should be set, i.e., in your session initialization file. On most setups, this is ~/.profile. Do not set environment variables in .bashrc, .zshrc or the like. See
Which setup files should be used for setting up environment variables with bash?
Difference between .bashrc and .bash_profile
Correctly setting environment

3
  • Why not? .bashrc, etc are equally valid IMHO. That's how I do it anyway. If you run with the defaults of many terminal emulators, .bash_profile, etc are only for things you do once per login session, e.g. start ssh-agent, run ssh-add. My point is not to claim I know the One True Way, but to observe that blanket statements saying use .profile don't acknowledge that the alternative is also fine.
    – Mikel
    Commented Jun 2, 2012 at 3:07
  • @Mikel Please read the threads I link to in my answer. Setting environment variables is one of those once-per-session things, done in .profile (or .bash_profile or .zprofile or .login). Saying that .bashrc is equally valid doesn't acknowledge the numerous problems that it causes, one of which was the very source of this question. Commented Jun 2, 2012 at 13:38
  • Oh, I see the point you're making. If your distribution's graphical login session ignores .profile and .bashrc, then putting environment variables in .bashrc can make a mismatched environment more likely. I'm coming from a different angle: I assume the graphical login session sources .profile (roughly speaking), and that .profile sources .bashrc (or similar). Neither of us has actually established that our assumptions hold in this case AFAICT.
    – Mikel
    Commented Jun 2, 2012 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .