Last active
November 14, 2020 10:21
-
-
Save jaredyam/c4639a8094bb2183135a5703fd056c48 to your computer and use it in GitHub Desktop.
Fix the issue that [project-name].sublime-project setting file not works when open sublime project with the terminal command [subl project-directory]
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
# Wrap up the [subl] command with the ability that auto-activate the .sublime-project setting file under project directory. | |
# | |
# relative issue / solution | |
# ------------------------- | |
# 1. https://stackoverflow.com/questions/14203944/sublime-text-folder-exclude-patterns-stopped-working | |
# 2. https://forum.sublimetext.com/t/project-settings-when-opened-with-subl/11419 | |
# 3. https://gist.github.com/imjared/7010577 | |
function subl() { | |
sublime_project_file="${1##*/}.sublime-project" | |
if [ "$1" = "." ] && [ -f "${PWD##*/}.sublime-project" ]; then | |
command subl "${PWD##*/}.sublime-project" | |
elif [ "$1" = ".." ] && [ -f "../$(pwd | awk -F'/' '{print $(NF-1)}').sublime-project" ]; then | |
command subl "../$(pwd | awk -F'/' '{print $(NF-1)}').sublime-project" | |
elif [ -f "$1/$sublime_project_file" ]; then | |
command subl "$1/$sublime_project_file" | |
else | |
command subl "$1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment