Last active
October 9, 2018 11:17
-
-
Save sirthias/54edae02aea2d7b0cbeb1c2faf0b3819 to your computer and use it in GitHub Desktop.
iterm_open_with.sh
This file contains hidden or 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
Iterm2 / Preferences / Profiles / Advanced / Semantic History | |
"Run command ..." with | |
~/bin/iterm_open_with.sh \5 \1 \2 |
This file contains hidden or 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 | |
file "$2" | grep -q "text" | |
if [ $? -ne 0 ]; then | |
/usr/bin/open $2 | |
elif [[ ${2: -6} == ".scala" ]] || [[ ${2: -5} == ".java" ]] || [[ ${2: -4} == ".sbt" ]]; then | |
/Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea $1 --line $3 $2 | |
else | |
st $2:$3 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment