Added check for OS X update_terminal_cwd

This will allow to open new terminal tabs in the same directory as the
current terminal. Uses the fact that plugins are loaded after the
selected theme. Themes often manipulate the $PROMPT_COMMAND variable.

Implementation inspired by the pathmunge function.
pull/514/head
Nils Winkler 2015-06-25 12:23:37 +02:00
parent 5e61b73a87
commit 5d00373359
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,15 @@
cite about-plugin cite about-plugin
about-plugin 'osx-specific functions' about-plugin 'osx-specific functions'
# OS X: Open new tabs in same directory
if [ $(uname) = "Darwin" ]; then
if type update_terminal_cwd > /dev/null 2>&1 ; then
if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then
export PROMPT_COMMAND="update_terminal_cwd;$PROMPT_COMMAND"
fi
fi
fi
function tab() { function tab() {
about 'opens a new terminal tab' about 'opens a new terminal tab'
group 'osx' group 'osx'