To change your default text editor, you can use git config (if git is installed on your computer already). Open the terminal and use the table below to change your default text editor. IMPORTANT: in order to change your default text editor, the text editor of your choice needs to be already installed on your computer!
For any particular file, right-click, select "More Info", and click on the "Open with" tab. You can select what text-editor you want here, and use "Change-all" to use the editor for all files of this type.
In the Terminal app on your Mac, invoke a command-line editor by typing the name of the editor, followed by a space and then the name of the file you want to open. If you want to create a new file, type the editor name, followed by a space and the pathname of the file.
Most programs will check the $EDITOR
environment variable, so you can set that to the path of TextEdit in your bashrc. Git will use this as well.
~/.bashrc
file:export EDITOR="/Applications/TextEdit.app/Contents/MacOS/TextEdit"
echo "export EDITOR=\"/Applications/TextEdit.app/Contents/MacOS/TextEdit\"" >> ~/.bashrc
If you are using zsh, use ~/.zshrc
instead of ~/.bashrc
.
Use git config --global core.editor mate -w
or git config --global core.editor open
as @dmckee suggests in the comments.
Reference: http://git-scm.com/docs/git-config
For anyone coming here in 2018:
Make subl
available.
Put this in ~/.bash_profile
[[ -s ~/.bashrc ]] && source ~/.bashrc
Put this in ~/.bashrc
export EDITOR=subl
Set your editor to point to this program:
/Applications/TextEdit.app/Contents/MacOS/TextEdit
With SVN, you should set SVN_EDITOR
environment variable to:
$ export SVN_EDITOR=/Applications/TextEdit.app/Contents/MacOS/TextEdit
And then, when you try committing something, TextEdit will launch.
For Sublime Text 3:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
See Set TextMate as the default text editor on Mac OS X for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With