Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Hi i just installed iTerm2 and tried to open a tab with the same directory as the tab that open it.

I tried Zsh: Open a new tab in the same directory answer but still can't get the directory working.

It worked fine in terminal.app but when im using iTerm it's not work anymore

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

tab

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"
        end tell
    end tell
end tell

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.

share|improve this answer
    
Note: You need to actually type tab into the terminal to create a new tab. Not through Shell » New Tab or ⌘T –  slhck May 30 '12 at 10:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.