It does work for me. Are you sure your
.zshrc has the
osx plugin loaded? Check for the existence of the function with:
$ type tab
tab is a shell function
Then, in your terminal, simply run the command
This will execute the appropriate line in the
tab() function defined by the
osx plugin. If it works for Terminal.app, it should also work for iTerm2.
In order to map this command to a custom keyboard shortcut like CmdShiftR, do the following. Open up Automator.app and create a new Service. Set it to receive No Input from iTerm.app and drag Run AppleScript from the left to the editing pane.
tell application "iTerm"
tell current terminal
tell current session
write text "tab"
That should look like this:
Save it under Open new Tab with zsh or similar. Now, under System Preferences » Keyboard » Keyboard Shortcuts, under Services, assign a keyboard shortcut.
Note that not all keyboard shortcuts are available, and you can't just override CmdT since this is a built-in one.