Editor Change

Discussion in 'Installation/Configuration' started by Yabadoo, Feb 3, 2007.

  1. Yabadoo

    Yabadoo Member

    How can i change which editor is the default on opensuse 10.2.
    I want to use nano instead of vi (vim). :)

    Thanks in Advance.
     
  2. martinfst

    martinfst Member Moderator

    In the bash shell you can set the default editor by
    Code:
    export VISUAL=/bin/nano
    . If you want this to be automatic, add this line to the login script in your home directory
    Code:
    ~/.bashrc
     
  3. Yabadoo

    Yabadoo Member


    With the above mentioned solution you can set the editor for every seperate user, but what do you need to do, to set nano as the default editor for every user ??
     
  4. martinfst

    martinfst Member Moderator

    How do you invoke the "default" editor?
     
  5. Yabadoo

    Yabadoo Member

    On openSuse 10.2 the default editor is vim (i believe), but i als0 want to use as root the nano editor.
     
  6. martinfst

    martinfst Member Moderator

    But you can. Just type
    Code:
    nano <filename>
    Or am I mis-understanding you? Sorry.
     
  7. Yabadoo

    Yabadoo Member

    The problem I have is, when i want to edit a cronjob for a user (crontab -u user -e) then you don't have the control over the editor you want to use. Suse then opens the cronjob in Vim.
     
  8. martinfst

    martinfst Member Moderator

    For
    Code:
    crontab -e 
    you need to set the VISUAL environment variable as mentioned before. Works on my Ubuntu/Debian systems.
     
  9. Yabadoo

    Yabadoo Member

    Oke, I agree with you, but now i need to put the
    Code:
    EXPORT VISUAL=/bin/nano
    in the ~/.bashrc for the root user, but where can i find this for the root user ??
     
  10. martinfst

    martinfst Member Moderator

    When you are on the system as root (either by logging in directly or by 'su -' or similar), use the command
    Code:
    cd ~
    . It will take you to the home dir of the effective user. Then
    Code:
    nano .bashrc
    edit and you're done.

    If you login as a regular user 1st and the 'upgrade' yourself, you can also edit the .bashrc file of the regular user. Environment variables are promoted to sub-shells.
     
  11. Yabadoo

    Yabadoo Member

    Thanks Martin,

    I had to change a little bit to get it working under opensuse 10.2
    Code:
    export VISUAL=/usr/bin/nano
    Log off and on and it works :)
     
  12. martinfst

    martinfst Member Moderator

    Distribution peculiarities. :p
     

Share This Page