Skip to content

Instantly share code, notes, and snippets.

View bsharpe's full-sized avatar

Ben Sharpe bsharpe

View GitHub Profile
@bsharpe
bsharpe / iterm_open_with
Last active May 21, 2021 13:32 — forked from paresharma/iterm_open_with
Semantic history command for iTerm2 and Visual Studio Code Insiders 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