One hotkey: Execute selected file, cd to selected folder, and run selected text as command in Terminal.
Dedicated to my girlfriend 😘 @YangYang
An Alfred Workflow to execute selected file, cd to selected folder, and run selected text in Terminal with one hotkey.
Run in Terminal.alfredworkflow
to install.Import
Button.Hotkey
and set your shortcut.(I’m using hyper + t).cd
if it is.~
will be auto expanded to /Users/$(whoami)
for checking the filepath.cd
.Output:
~/Library/Application Support/
cd "/Users/$(whoami)/Library/Application Support/"
Auto remove the solo $
in the beginning of lines.
$
, it’s annoying when copy and running them.$
with space will be removed, regex: /^\s*\$\s+/
Input:
$ temp=$(mktemp)
$ echo "$temp"
$ rm "$temp"
$(whoami)
Output:
temp=$(mktemp)
echo "$temp"
rm "$temp"
$(whoami)
zsh
, bash
and fish
.It won’t mess up with escaping characters even though this extension uses ruby
, applescript
and shell script
together.
Input:
variable="This is a \$10 \"quote\""
echo $variable
Output:
variable="This is a \$10 \"quote\""
echo $variable
Only Terminal.app is supported, the AppleScript that Terminal.app uses is not compatible with iTerm.app, pull requests are welcome for iTerm.app or other terminal emulators.
AGPL-3.0