Skip to content

Instantly share code, notes, and snippets.

@phoenisx
Last active August 9, 2022 08:16
Show Gist options
  • Save phoenisx/f8c866b7c66f3af05b00d4db9c676fcc to your computer and use it in GitHub Desktop.
Save phoenisx/f8c866b7c66f3af05b00d4db9c676fcc to your computer and use it in GitHub Desktop.
Sublime Text 3 CPP Basic Setup (on Mac).
{
"cmd": ["g++", "-Wall", "-ansi", "$file_name", "-o", "${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++, source.cxx, source.cpp",
"shell": false,
"variants": [
{
"name": "Run",
"shell": false,
"cmd": ["/[PATH_TO]/run_iterm.sh", "${file_path}/${file_base_name}"]
}
]
}
#!/bin/bash
################################################
# https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
# https://www.iterm2.com/documentation-scripting.html
# Better Examples @ https://gitlab.com/gnachman/iterm2/wikis/Applescript
################################################
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment