Last active
November 6, 2022 20:28
-
-
Save kabouzeid/63c704e92943b690507af074d9067701 to your computer and use it in GitHub Desktop.
Set the default text editor on macOS for all types of source code files. Credits go to https://alexpeattie.com/blog/associate-source-code-files-with-editor-in-macos-using-duti/
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
#!/usr/bin/env bash | |
# USAGE: ./set_default_editor.sh "visual studio code" | |
APP_ID=$(osascript -e "id of app \"$*\"") # eg com.microsoft.VSCode | |
curl "https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml" \ | |
| yq -r "to_entries | (map(.value.extensions) | flatten) - [null] | unique | .[]" \ | |
| xargs -L 1 -I "{}" duti -s "${APP_ID}" {} all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment