fix(shell): use Windows PID as POSH_PID in a Cygwin environment
Some checks failed
Code QL / code-ql (push) Has been cancelled
Azure Static Web Apps CI/CD / Build and Deploy (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled

This commit is contained in:
L. Yeung 2024-08-24 12:18:20 +08:00 committed by Jan De Dobbeleer
parent e28d91b854
commit 23d200b56c
4 changed files with 22 additions and 4 deletions

View file

@ -5,6 +5,10 @@ export POSH_PID=$$
export CONDA_PROMPT_MODIFIER=false
export OSTYPE=$OSTYPE
if [[ $OSTYPE =~ ^(msys|cygwin) ]]; then
export POSH_PID=$(command cat /proc/$$/winpid)
fi
# global variables
_omp_start_time=""
_omp_stack_count=0

View file

@ -7,6 +7,10 @@ set --global _omp_tooltip_command ''
set --global _omp_current_rprompt ''
set --global _omp_transient 0
if command uname -s | string match -qr '^(CYGWIN|MSYS|MINGW)'
set --export POSH_PID (command cat /proc/$fish_pid/winpid)
end
set --global _omp_executable ::OMP::
set --global _omp_ftcs_marks 0
set --global _omp_transient_prompt 0
@ -112,25 +116,25 @@ function _omp_preexec --on-event fish_preexec
end
# perform cleanup so a new initialization in current session works
if bind \r --user 2>/dev/null | string match -q -e _omp_enter_key_handler
if bind \r --user 2>/dev/null | string match -qe _omp_enter_key_handler
bind -e \r -M default
bind -e \r -M insert
bind -e \r -M visual
end
if bind \n --user 2>/dev/null | string match -q -e _omp_enter_key_handler
if bind \n --user 2>/dev/null | string match -qe _omp_enter_key_handler
bind -e \n -M default
bind -e \n -M insert
bind -e \n -M visual
end
if bind \cc --user 2>/dev/null | string match -q -e _omp_ctrl_c_key_handler
if bind \cc --user 2>/dev/null | string match -qe _omp_ctrl_c_key_handler
bind -e \cc -M default
bind -e \cc -M insert
bind -e \cc -M visual
end
if bind \x20 --user 2>/dev/null | string match -q -e _omp_space_key_handler
if bind \x20 --user 2>/dev/null | string match -qe _omp_space_key_handler
bind -e \x20 -M default
bind -e \x20 -M insert
end

View file

@ -2,6 +2,11 @@ setenv POWERLINE_COMMAND "oh-my-posh";
setenv POSH_THEME ::CONFIG::;
setenv POSH_SHELL_VERSION "";
setenv POSH_PID $$;
setenv OSTYPE "$OSTYPE";
if ("$OSTYPE" =~ {msys,cygwin}*) then
setenv POSH_PID "`cat /proc/$$/winpid`";
endif
set POSH_COMMAND = ::OMP::;
set USER_PRECMD = "`alias precmd`";

View file

@ -5,6 +5,11 @@ export POWERLINE_COMMAND="oh-my-posh"
export CONDA_PROMPT_MODIFIER=false
export POSH_PROMPT_COUNT=0
export ZLE_RPROMPT_INDENT=0
export OSTYPE=$OSTYPE
if [[ $OSTYPE =~ ^(msys|cygwin) ]]; then
export POSH_PID=$(command cat /proc/$$/winpid)
fi
_omp_executable=::OMP::