Skip to content

Instantly share code, notes, and snippets.

@sirthias
Last active October 9, 2018 11:17
Show Gist options
  • Save sirthias/54edae02aea2d7b0cbeb1c2faf0b3819 to your computer and use it in GitHub Desktop.
Save sirthias/54edae02aea2d7b0cbeb1c2faf0b3819 to your computer and use it in GitHub Desktop.
iterm_open_with.sh
Iterm2 / Preferences / Profiles / Advanced / Semantic History
"Run command ..." with
~/bin/iterm_open_with.sh \5 \1 \2
#!/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