Skip to content

Commit

Permalink
adding newtab function to open a new tab in OS X Terminal keeping the…
Browse files Browse the repository at this point in the history
… current directory. This is also bound to control-option-N key combo.
  • Loading branch information
ryanb committed Jul 21, 2008
1 parent 56609fe commit f42b076
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README
Expand Up @@ -42,9 +42,11 @@ To speed things up, the results are cached in local .rake_tasks~ and
.cap_tasks~. It is smart enough to expire the cache automatically in
most cases, but you can simply remove the files to flush the cache.

There are a few key bindings set. Option-left/right arrow will move
cursor by word, and control-left/right will move to beginning and end
of line.
There are a few key bindings set. Many of these require option to be
set as the meta key. Option-left/right arrow will move cursor by word,
and control-left/right will move to beginning and end of line.
Control-option-N will open a new tab with the current directory under
Mac OS X Terminal.

If you're using git, you'll notice the current branch name shows up in
the prompt while in a git repository.
Expand Down
5 changes: 5 additions & 0 deletions zlogin
@@ -0,0 +1,5 @@
# go to saved path if there is one
if [[ -f ~/.current_path~ ]]; then
cd `cat ~/.current_path~`
rm ~/.current_path~
fi
3 changes: 3 additions & 0 deletions zsh/config
Expand Up @@ -30,8 +30,11 @@ setopt INC_APPEND_HISTORY SHARE_HISTORY # adds history incrementally and share
setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history
setopt HIST_REDUCE_BLANKS

zle -N newtab

bindkey '^[^[[D' backward-word
bindkey '^[^[[C' forward-word
bindkey '^[[5D' beginning-of-line
bindkey '^[[5C' end-of-line
bindkey '^[[3~' delete-char
bindkey '^[^N' newtab
6 changes: 6 additions & 0 deletions zsh/functions/newtab
@@ -0,0 +1,6 @@
savepath
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
EOF
1 change: 1 addition & 0 deletions zsh/functions/savepath
@@ -0,0 +1 @@
pwd > ~/.current_path~
2 changes: 1 addition & 1 deletion zshrc
Expand Up @@ -3,4 +3,4 @@
. ~/.zsh/completion

# use .localrc for settings specific to one system
[[ -f ~/.localrc ]] && . ~/.localrc
[[ -f ~/.localrc ]] && . ~/.localrc

0 comments on commit f42b076

Please sign in to comment.