How to change primary text editor

I just got my first mac (I decided to switch over from gentoo linux), and I can't seem to figure out how to set my default text editor. I've been looking for rc.conf or something similar, but can't seem to figure out how to change my default editor from vi. If anyone could point me in the right direction, I'd be eternally grateful. Thanks in advance.

MacBook Pro, Mac OS X (10.5.7)

Posted on Jun 26, 2009 11:19 AM

Reply
6 replies

Jun 26, 2009 11:29 AM in response to bfarman

Welcome to Apple Discussions:
If you are referring to the terminal, there is no "default" editor.
Do mean you are looking for an alias for "edit" or something like that?
I use TextWrangler in both the GUI and terminal as the default for most editing, but it's not a default.

If you wish to change the default in the GUI, right click the file in question and select "Get Info"
In the Get Info window under open with, choose your editor and then press the Change all button.

Also these questions and future ones of this kind should be posted in the Unix forum here:
http://discussions.apple.com/forum.jspa?forumID=735

Message was edited by: nerowolfe

Jun 26, 2009 12:28 PM in response to nerowolfe

There must be a way to set the default editor in the terminal. For instance, when I call chpass it pulls up vi as the editor. On gentoo, and if I remember correctly FreeBSD as well although it has been quite a while since I've used it, I know you can change the editor by modifying rc.conf. I'm not entirely sure of the internals, but I assume it's just setting something like editor in the env, so programs such as chpass (which undoubtedly calls something similar to $EDITOR ) default to using your preferred editor. I just can't seem to find where.

Jun 26, 2009 1:16 PM in response to bfarman

bfarman wrote:
There must be a way to set the default editor in the terminal. For instance, when I call chpass it pulls up vi as the editor.


As Tom and I have both noted, you should be asking in the Unix forum.
BTW, I have no idea what you mean by "call" or "pulls up" and I have been using Linux from the day it was born.
Again, please use the Unix forum where we all speak grep and make dep. 🙂

Jun 26, 2009 3:03 PM in response to bfarman

For instance, when I call chpass it pulls up vi as the editor


If you read the man page for chpass, it will default to vi unless you set the $EDITOR environmental variable. $EDITOR is not set by default. Set the variable in the appropriate shell config file.
For tcsh and csh->
setenv VISUAL /path/to/your/favorite/editor
setenv EDITOR /path/to/your/favorite/editor
in your .login file.
For sh,ksh,bash,and zsh->
export VISUAL="/path/to/your/favorite/editor"
export EDITOR="/path/to/your/favorite/editor"
In sh and ksh in your .profile file. In bash your .bash_profile or .bashrc file. In zsh in your .zprofile file.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to change primary text editor

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.