Benches macOS

5

How to change primary text editor (termin…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

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.

5 replies

Sign in or join Beachball Help to reply.

  1. 0

    Cole Tierney

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I use the following statement in my .bash_profile file:

    export EDITOR="vim"

    --

    Cole

  2. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    vi *is* Vim.


    ls -l /usr/bin/vi
    lrwxr-xr-x 1 root wheel 3 Apr 12 2008 /usr/bin/vi -> vim

    If you have a *$HOME/.vimrc* file, Vim mode will automatically be enabled even if you specify *vi* to invoke your editor.

  3. 0

    bfarman

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Well, vi or vim, the point was really to change it to be just about anything but vi. The second post seems to fix things, I was just looking for some sort of system wide, single file I could edit like rc.conf where I could set the editor env var to /usr/bin/emacs.

  4. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I was just looking for some sort of system wide, single file I could edit like rc.conf where I could set the editor env var to /usr/bin/emacs.

    How about


    /etc/profile # sh, bash, zsh
    /etc/csh.login # csh, tcsh

    This would handle all terminal sessions.

    If for some reason you expect to be able to launch emacs from a GUI, then you can add environment variables to a GUI login session via


    $HOME/.macosx/environment.plist

    There is a nice free 3rd party System Preference (RCEnvironment) you can download and use for maintaining the
    environment.plist

    <http://www.versiontracker.com/dyn/moreinfo/macosx/15073&gt;

    This would make sure that your GUI login processes always had
    EDITOR=/usr/bin/emacs

    If you have multiple GUI logins you would have to apply the
    environment.plist change to each account (which is different from the /etc/profile and /etc/csh.login which is global for all Terminal sessions).

  5. 0

    bfarman

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    marking resolved