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.
This commit is contained in:
Nils Winkler
2015-06-25 12:23:37 +02:00
parent 5e61b73a87
commit 5d00373359

View File

@@ -1,6 +1,15 @@
cite about-plugin
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() {
about 'opens a new terminal tab'
group 'osx'