Skip to content

Commit

Permalink
added iterm section
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-funderburg committed Feb 16, 2020
1 parent 2ff2016 commit 7850723
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Markdown/Insert-Markdown-Style-Buttons.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ try
set {boldLabel, theTop} to create label "Insert Markdown style buttons" bottom theTop + 8 max width accViewWidth control size regular size with bold type
-- make list of cotronls and pass to display command
set allControls to {keyField, keyLabel, hyperkey, shft, ctrl, opt, cmd, boldLabel, messageLabel}

--set {buttonName, suppressedState, controlsResults} to display enhanced alert "Send for output" message "More text goes in here" as informational alert buttons {"Cancel", "OK"} giving up after 120 acc view width 250 acc view height theTop acc view controls allControls without suppression

-- controlResults will in the same order as allControls
set {buttonName, controlsResults} to display enhanced window "Markdown Style Buttons" acc view width accViewWidth acc view height theTop acc view controls allControls buttons theButtons initial position {100, 30} giving up after 50 with align cancel button

set {_key, unused, hyperkey, shft, ctrl, opt, cmd, unused, unused} to controlsResults

if buttonName = "Cancel" then return

set str to ""
if cmd then set str to str & "<kbd>⌘</kbd>"
if opt then set str to str & "<kbd>⌥</kbd>"
if ctrl then set str to str & "<kbd>⌃</kbd>"
if shft then set str to str & "<kbd>⇧</kbd>"
if hyperkey then set str to str & "<kbd>hyperkey</kbd>"
set str to str & "<kbd>" & _key & "</kbd>"

set the clipboard to str

tell application "System Events"
--set frontapp to bundle identifier of (first application whose frontmost is true)
--activate application id frontapp
Expand All @@ -58,4 +58,3 @@ on error errMsg number errNum
default button "OK" with icon caution
end if
end try

7 changes: 7 additions & 0 deletions iTerm/Copy-Text-and-Send-To-iTerm.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tell application "System Events" to keystroke "c" using {command down}
delay 0.1
tell application "iTerm"
set w to current window
tell w's current session to write text (the clipboard)
activate
end tell
24 changes: 24 additions & 0 deletions iTerm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<p align="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/5/57/ITerm2_v3_icon.png"
width="256" height="256">
</p>

# iTerm Scripts

Scripts for use while working in [iTerm][iterm].
> Although not needed, the shortcut keys I use to execute these via [Keyboard Maestro][kmapp] or [Alfred][alfredapp] are included in case you're interested
## Contents

- [Copy Text and Send to iTerm][9badd7b8]&emsp;:earth_americas:&emsp;<kbd>⌘</kbd><kbd>⌥</kbd><kbd>⌃</kbd><kbd>T</kbd>
- Great when you are copying commands from websites or manuals to paste into the terminal.
- [Open Finder Selection in iTerm](../Finder/Open-Selection-in-iTerm.applescript)&emsp;<kbd>⌥</kbd><kbd>⇧</kbd><kbd>T</kbd>
- Open [iTerm][iterm] and change directory to the current location in Finder. Super useful if you are on the command-line a lot.
![demo](../imgs/finder-iterm.gif)


[9badd7b8]: ./Copy-Text-and-Send-To-iTerm.applescript
<!-- links -->
[iterm]: https://www.iterm2.com/
[kmapp]: https://www.keyboardmaestro.com/
[alfredapp]: https://www.alfredapp.com/

0 comments on commit 7850723

Please sign in to comment.