Default editor, switching from vi

Discussion in 'Mac Apps and Mac App Store' started by 5300cs, Dec 10, 2003.

  1. 5300cs macrumors 68000

    5300cs

    Joined:
    Nov 24, 2002
    Location:
    japan
    #1
    To everyone who loves vi, sorry.

    I want to change my default editor to something else, like pico or emacs. Does anyone know how to do this?
     
  2. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #2
    Re: Default editor, switching from vi

    You mean other than by typing "emacs" at the command line intead of "vi"? :D
     
  3. 5300cs thread starter macrumors 68000

    5300cs

    Joined:
    Nov 24, 2002
    Location:
    japan
    #3
    Re: Re: Default editor, switching from vi

    I mean like when I type 'chfn' it opens the file in vi, which I don't like. I want to change my default editor.
     
  4. colocolo macrumors 6502

    Joined:
    Jan 17, 2002
    Location:
    Santiago, Chile
    #4
    Simply type "setenv EDITOR <editor>", replacing <editor> with emacs, for example.

    edit: my reply was incorrect, as the changes woold only affect the current terminal window. In order for the changes to be permanent, create a file in your home directory named .tschrc , and enter the line mentioned above. Any commands you enter in this file will be automatically executed every time you open a new terminal session.
     
  5. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #5
    colocolo

    Well, it depends on which shell he's using, doesn't it? You're correct for tsch. For bash you'd edit .bash_profile in your home directory and add the following line:

    export EDITOR=<full_path_of_editor>
     
  6. colocolo macrumors 6502

    Joined:
    Jan 17, 2002
    Location:
    Santiago, Chile
    #6
    You are right, I just assumed he was using the Terminal.
     
  7. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #7
    Using Terminal doesn't == tsch. In fact, bash is the default shell when you use Terminal under Panther, and you could always change Terminal to start a bash shell under Jaguar.
     
  8. 5300cs thread starter macrumors 68000

    5300cs

    Joined:
    Nov 24, 2002
    Location:
    japan
    #8
    hmmm... under Jaguar I was able to switch to bash no problem. Panther for some reason, has made it more difficult.
     

    Attached Files:

  9. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #9
    Are you looking to change your default shell or just on an as needed basis? If you want to change your default shell, go to Utilities and start up Netinfo Manager, select "users", then your login name, unlock the panel, then scroll down to the "shell" property and change it to the shell you want. After you apply the change, all your Terminal sessions will use the selected shell.

    If you just want a temporary shell change, I use "exec bash" (substitute your desired shell for "bash"). When you exit that shell, you'll normally exit the Terminal.

    HTH
     
  10. 5300cs thread starter macrumors 68000

    5300cs

    Joined:
    Nov 24, 2002
    Location:
    japan
    #10
    Well, that answered my next question :) Thanks! ( I knew how to do it in Server...)
     
  11. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #11
    vi? emacs? joe? pico?

    Actually I've got $EDITOR set to nedit. (I'm not kidding)
     

Share This Page