mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Merge pull request #3582 from apjanke/fold-terminalapp-plugin-into-termsupport
Fold terminalapp plugin in to lib/termsupport
This commit is contained in:
commit
3c782f78f1
4 changed files with 169 additions and 55 deletions
|
|
@ -1,16 +1,17 @@
|
|||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
#
|
||||
function svn_prompt_info() {
|
||||
local _DISPLAY
|
||||
if in_svn; then
|
||||
if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
|
||||
unset SVN_SHOW_BRANCH
|
||||
_DISPLAY=$(svn_get_branch_name)
|
||||
else
|
||||
_DISPLAY=$(svn_get_repo_name)
|
||||
_DISPLAY=$(omz_urldecode "${_DISPLAY}")
|
||||
fi
|
||||
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
|
||||
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$(svn_dirty_pwd)$ZSH_PROMPT_BASE_COLOR"
|
||||
unset _DISPLAY
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ function svn_get_repo_name() {
|
|||
}
|
||||
|
||||
function svn_get_branch_name() {
|
||||
_DISPLAY=$(
|
||||
local _DISPLAY=$(
|
||||
svn info 2> /dev/null | \
|
||||
awk -F/ \
|
||||
'/^URL:/ { \
|
||||
|
|
@ -49,7 +50,6 @@ function svn_get_branch_name() {
|
|||
else
|
||||
echo $_DISPLAY
|
||||
fi
|
||||
unset _DISPLAY
|
||||
}
|
||||
|
||||
function svn_get_rev_nr() {
|
||||
|
|
@ -60,7 +60,7 @@ function svn_get_rev_nr() {
|
|||
|
||||
function svn_dirty_choose() {
|
||||
if in_svn; then
|
||||
root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
|
||||
local root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
|
||||
if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
|
||||
# Grep exits with 0 when "One or more lines were selected", return "dirty".
|
||||
echo $1
|
||||
|
|
@ -77,7 +77,7 @@ function svn_dirty() {
|
|||
|
||||
function svn_dirty_choose_pwd () {
|
||||
if in_svn; then
|
||||
root=$PWD
|
||||
local root=$PWD
|
||||
if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
|
||||
# Grep exits with 0 when "One or more lines were selected", return "dirty".
|
||||
echo $1
|
||||
|
|
|
|||
|
|
@ -1,39 +1,6 @@
|
|||
# Set Apple Terminal.app resume directory
|
||||
# based on this answer: http://superuser.com/a/315029
|
||||
# 2012-10-26: (javageek) Changed code using the updated answer
|
||||
|
||||
# Tell the terminal about the working directory whenever it changes.
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
update_terminal_cwd() {
|
||||
# Identify the directory using a "file:" scheme URL, including
|
||||
# the host name to disambiguate local vs. remote paths.
|
||||
|
||||
# Percent-encode the pathname.
|
||||
local URL_PATH=''
|
||||
{
|
||||
# Use LANG=C to process text byte-by-byte.
|
||||
local i ch hexch LANG=C
|
||||
for ((i = 1; i <= ${#PWD}; ++i)); do
|
||||
ch="$PWD[i]"
|
||||
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
|
||||
URL_PATH+="$ch"
|
||||
else
|
||||
hexch=$(printf "%02X" "'$ch")
|
||||
URL_PATH+="%$hexch"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
local PWD_URL="file://$HOST$URL_PATH"
|
||||
#echo "$PWD_URL" # testing
|
||||
printf '\e]7;%s\a' "$PWD_URL"
|
||||
}
|
||||
|
||||
# Register the function so it is called whenever the working
|
||||
# directory changes.
|
||||
autoload add-zsh-hook
|
||||
add-zsh-hook precmd update_terminal_cwd
|
||||
|
||||
# Tell the terminal about the initial directory.
|
||||
update_terminal_cwd
|
||||
fi
|
||||
# This file is intentionally empty.
|
||||
#
|
||||
# The terminalapp plugin is deprecated and may be removed in a future release.
|
||||
# Its functionality has been folded in to the core lib/termsupport.zsh, which
|
||||
# is loaded for all users. You can remove terminalapp from your $plugins list
|
||||
# once all your systems are updated to the current version of Oh My Zsh.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue