Last active
November 17, 2024 04:45
-
-
Save Hazer/d5c0c2fb65ec5891d61a010fe7724b95 to your computer and use it in GitHub Desktop.
Set default editor macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Zed | |
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=dev.zed.Zed;}' | |
# Sublime Text 4 | |
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.4;}' | |
# Sublime Text 3 | |
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}' | |
# VS Code | |
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.microsoft.VSCode;}' | |
#### === | |
# Can also set default editor for terminal, with the following: | |
# Set Zed for preferred editor for local and nano for remote sessions | |
if [[ -n $SSH_CONNECTION ]]; then | |
# If remote, we use nano | |
export EDITOR='nano' | |
else | |
export EDITOR='zed' # must have zed cli installed | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment