Skip to content

Instantly share code, notes, and snippets.

@paresharma
Forked from sos4nt/iterm_open_with
Last active May 21, 2021 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paresharma/9f6f206d90f127043f71 to your computer and use it in GitHub Desktop.
Save paresharma/9f6f206d90f127043f71 to your computer and use it in GitHub Desktop.
Semantic history command for iTerm2 and Atom editor. In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, choose "Run command..." and enter "/your/path/to/iterm_open_with \1 \2".
#!/bin/sh
file "$1" | grep -q "text"
if [ $? -ne 0 ]; then
/usr/bin/open $1
else
if [[ -z "$2" ]]; then
FILE_PATH="$1"
else
FILE_PATH="$1:$2"
fi
/usr/local/bin/atom $FILE_PATH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment