mirror of
https://github.com/artizirk/dotfiles.git
synced 2024-11-01 00:30:58 +02:00
Add skeleton zsh sematntic prompt code
This commit is contained in:
parent
67ed4c20c9
commit
94e8abf192
25
.config/zsh/functions/semantic-prompt.zsh
Normal file
25
.config/zsh/functions/semantic-prompt.zsh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
_prompt_executing=""
|
||||||
|
function __prompt_precmd() {
|
||||||
|
local ret="$?"
|
||||||
|
if test "$_prompt_executing" != "0"
|
||||||
|
then
|
||||||
|
_PROMPT_SAVE_PS1="$PS1"
|
||||||
|
_PROMPT_SAVE_PS2="$PS2"
|
||||||
|
PS1=$'%{\e]133;P;k=i\a%}'$PS1$'%{\e]133;B\a\e]122;> \a%}'
|
||||||
|
PS2=$'%{\e]133;P;k=s\a%}'$PS2$'%{\e]133;B\a%}'
|
||||||
|
fi
|
||||||
|
if test "$_prompt_executing" != ""
|
||||||
|
then
|
||||||
|
printf "\033]133;D;%s;aid=%s\007" "$ret" "$$"
|
||||||
|
fi
|
||||||
|
printf "\033]133;A;cl=m;aid=%s\007" "$$"
|
||||||
|
_prompt_executing=0
|
||||||
|
}
|
||||||
|
function __prompt_preexec() {
|
||||||
|
PS1="$_PROMPT_SAVE_PS1"
|
||||||
|
PS2="$_PROMPT_SAVE_PS2"
|
||||||
|
printf "\033]133;C;\007"
|
||||||
|
_prompt_executing=1
|
||||||
|
}
|
||||||
|
preexec_functions+=(__prompt_preexec)
|
||||||
|
precmd_functions+=(__prompt_precmd)
|
4
.zshrc
4
.zshrc
@ -53,6 +53,10 @@ zstyle ':prompt:grml:right:setup' use-rprompt false
|
|||||||
# https://unix.stackexchange.com/a/302710
|
# https://unix.stackexchange.com/a/302710
|
||||||
#set +o prompt_cr +o prompt_sp
|
#set +o prompt_cr +o prompt_sp
|
||||||
|
|
||||||
|
# enable OSC 133 shell prompt start/end reporting
|
||||||
|
# so that the terminal can scroll jump between prompts
|
||||||
|
#xsource ~/.config/zsh/functions/semantic-prompt.zsh
|
||||||
|
|
||||||
# Git based dotfiles setup start
|
# Git based dotfiles setup start
|
||||||
function _config_activate {
|
function _config_activate {
|
||||||
export GIT_DIR=$HOME/.cfg/
|
export GIT_DIR=$HOME/.cfg/
|
||||||
|
Loading…
Reference in New Issue
Block a user