'Is it possible to create a macro / script in iTerm2 that insert text automatically selected from a list?

I use iTerm2 as my default terminal app in OSX. A would like to ask if is possible to insert text automatically with a hotkey (or selecting it from a menu), with iTerm, like the old macros of some word processing packages. My idea is, for example, if I press cmd + ctrl s , iTerm insert automatically "sftp -i"

I know that iTerm has support for scripting with AppleScript and Python but I'm not sure how I do this



Solution 1:[1]

You can also use Keyboard shortcuts.

From Preferences -> Keys Define a new shortcut and use the "Action" "Send Text"

This works on iTerm2 build 3.4.15

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 karlacio