Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Change the default UNIX editor UNIX
Although this is a UNIX hint, it applies to Mac OS X as well. A previous hint, Remove insecure root 'grace period' from sudo, had a comment about not knowing vi, and that any editor could be used since visudo is just a wrapper that does some sanity checking before writing to disk. To stay on the safe side, it's best to change the default command line editor with the $EDITOR variable. An added benefit is that any command line tools that take advantage of the $EDITOR variable will also use your editor of choice.

The $EDITOR variable can be set from the command line by executing export EDITOR=youreditor for the bash shell, or setenv EDITOR youreditor for the tcsh shell.

To make the variable persistent, add the export statement to your .bashrc or .bash_profile, or the setenv statement to your .cshrc or .tcshrc file.
    •    
  • Currently 3.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[14,660 views]  

Change the default UNIX editor | 6 comments | Create New Account
Click here to return to the 'Change the default UNIX editor' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change the default UNIX editor
Authored by: juggularity on Jun 17, '05 11:12:05AM

Try using the great freeware from BareBones Software, TextWrangler. Install the command line tool 'edit' and then set your $EDITOR to "edit -w". Now the shell will wait for you to close the file before it continues. Combine it with sudo to edit protected files.



[ Reply to This | # ]
Change the default UNIX editor
Authored by: adrianm on Jun 20, '05 06:07:46AM
Not good if you are connecting to your mac remotely though.

As an aside, SubEthaEdit fans will appreciate see as a commine-line starter.

[ Reply to This | # ]

Change the default UNIX editor
Authored by: encro on Jun 17, '05 11:20:41AM

Isn't it funny when you have been doing this for such a long time that it never actually occured that others might be interested in this being posted as a hint :)



[ Reply to This | # ]
Change the default UNIX editor
Authored by: Trunkmonkey on Jun 17, '05 08:23:06PM

juggularity: Sweet! I've always seen BBEdit ask me about installing the CLI tools but never bothered to look into them.

encro: Yup...precisely why I wrote up the hint. It was one of those UNIX 101 things I learned back in the late-eighties that newbies really won't find on their own. :)



[ Reply to This | # ]
Change the default UNIX editor
Authored by: Jsnjabber on Jun 17, '05 08:53:56PM
Try
 see -w 
to use SubEthaEdit as editor..

[ Reply to This | # ]
Put your changes here
Authored by: matx on Jun 19, '05 10:43:09AM

As a former tcsh user I've had to learn some of the ways of bash, so I pass along this hint about where to put those changes you make, especially for all users of one computer.

For bash users (default shell now in Tiger) you can set a variable, for example, for individual users in the "~/.bash_profile" hidden file in their home directoy, or for all users of the same computer in "/etc/profile".

If you have a lot of users for each computer at your workplace or computer lab, then the /etc/profile save time.

Three examples of how add directories to your command path, and one plain ol' set variable:

export PATH=$PATH:/opt/local/bin
export PATH=/usr/local/mysql/bin:$PATH
PATH="${PATH}:/usr/local/rush/bin"; export PATH

export NR_FONT_PATH="/Volumes/VFX/Shake/nreal/fonts/"


---
Mat X -- VFX Mac Tech



[ Reply to This | # ]