mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Merge branch 'ksi-bash' of https://github.com/page-down/kitty
This commit is contained in:
@@ -78,7 +78,7 @@ Detailed list of changes
|
|||||||
0.24.3 [future]
|
0.24.3 [future]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- BASH integration: No longer modify :file:`~/.bashrc` to load :ref:`shell integration <shell_integration>`.
|
- Bash integration: No longer modify :file:`~/.bashrc` to load :ref:`shell integration <shell_integration>`.
|
||||||
It is recommended to remove the lines used to load the shell integration from :file:`~/.bashrc` as they are no-ops.
|
It is recommended to remove the lines used to load the shell integration from :file:`~/.bashrc` as they are no-ops.
|
||||||
|
|
||||||
- macOS: Allow kitty to handle various URL types. Can be configured via
|
- macOS: Allow kitty to handle various URL types. Can be configured via
|
||||||
|
|||||||
@@ -20,9 +20,8 @@ _ksi_main() {
|
|||||||
|
|
||||||
_ksi_debug_print() {
|
_ksi_debug_print() {
|
||||||
# print a line to STDOUT of parent kitty process
|
# print a line to STDOUT of parent kitty process
|
||||||
builtin local b=$(command base64 <<< "${@}" | tr -d \\n)
|
builtin local b=$(builtin command base64 <<< "${@}")
|
||||||
builtin printf "\eP@kitty-print|%s\e\\" "$b"
|
builtin printf "\eP@kitty-print|%s\e\\" "${b//\\n}"
|
||||||
# "
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_ksi_safe_source() {
|
_ksi_safe_source() {
|
||||||
@@ -40,8 +39,8 @@ _ksi_main() {
|
|||||||
if [[ "$KITTY_BASH_INJECT" == *"posix"* ]]; then
|
if [[ "$KITTY_BASH_INJECT" == *"posix"* ]]; then
|
||||||
_ksi_safe_source "$KITTY_BASH_POSIX_ENV" && builtin export ENV="$KITTY_BASH_POSIX_ENV";
|
_ksi_safe_source "$KITTY_BASH_POSIX_ENV" && builtin export ENV="$KITTY_BASH_POSIX_ENV";
|
||||||
else
|
else
|
||||||
set +o posix;
|
builtin set +o posix;
|
||||||
# See run_startup_files() in shell.c in the BASH source code
|
# See run_startup_files() in shell.c in the Bash source code
|
||||||
if builtin shopt -q login_shell; then
|
if builtin shopt -q login_shell; then
|
||||||
if [[ "$KITTY_BASH_INJECT" != *"no-profile"* ]]; then
|
if [[ "$KITTY_BASH_INJECT" != *"no-profile"* ]]; then
|
||||||
_ksi_safe_source "$KITTY_BASH_ETC_LOCATION/profile";
|
_ksi_safe_source "$KITTY_BASH_ETC_LOCATION/profile";
|
||||||
@@ -99,7 +98,7 @@ _ksi_main() {
|
|||||||
fi
|
fi
|
||||||
if [[ -n "${_ksi_prompt[ps1]}" ]]; then
|
if [[ -n "${_ksi_prompt[ps1]}" ]]; then
|
||||||
if [[ "${_ksi_prompt[mark]}" == "y" && ( "${PS1}" == *"\n"* || "${PS1}" == *$'\n'* ) ]]; then
|
if [[ "${_ksi_prompt[mark]}" == "y" && ( "${PS1}" == *"\n"* || "${PS1}" == *$'\n'* ) ]]; then
|
||||||
local oldval=$(builtin shopt -p extglob)
|
builtin local oldval=$(builtin shopt -p extglob)
|
||||||
builtin shopt -s extglob
|
builtin shopt -s extglob
|
||||||
# bash does not redraw the leading lines in a multiline prompt so
|
# bash does not redraw the leading lines in a multiline prompt so
|
||||||
# mark the last line as a secondary prompt. Otherwise on resize the
|
# mark the last line as a secondary prompt. Otherwise on resize the
|
||||||
@@ -108,7 +107,7 @@ _ksi_main() {
|
|||||||
# the second part appends a newline with the secondary marking
|
# the second part appends a newline with the secondary marking
|
||||||
# the third part appends everything after the last newline
|
# the third part appends everything after the last newline
|
||||||
PS1=${PS1%@('\n'|$'\n')*}${_ksi_prompt[secondary_prompt]}${PS1##*@('\n'|$'\n')};
|
PS1=${PS1%@('\n'|$'\n')*}${_ksi_prompt[secondary_prompt]}${PS1##*@('\n'|$'\n')};
|
||||||
eval "$oldval"
|
builtin eval "$oldval"
|
||||||
fi
|
fi
|
||||||
PS1="${_ksi_prompt[ps1]}$PS1"
|
PS1="${_ksi_prompt[ps1]}$PS1"
|
||||||
fi
|
fi
|
||||||
@@ -134,7 +133,7 @@ _ksi_main() {
|
|||||||
_ksi_debug_print "ignoreboth or ignorespace present in bash HISTCONTROL setting, showing running command in window title will not be robust"
|
_ksi_debug_print "ignoreboth or ignorespace present in bash HISTCONTROL setting, showing running command in window title will not be robust"
|
||||||
fi
|
fi
|
||||||
_ksi_get_current_command() {
|
_ksi_get_current_command() {
|
||||||
local last_cmd=$(HISTTIMEFORMAT= builtin history 1)
|
builtin local last_cmd=$(HISTTIMEFORMAT= builtin history 1)
|
||||||
last_cmd="${last_cmd#*[[:digit:]]*[[:space:]]}" # remove leading history number
|
last_cmd="${last_cmd#*[[:digit:]]*[[:space:]]}" # remove leading history number
|
||||||
last_cmd="${last_cmd#"${last_cmd%%[![:space:]]*}"}" # remove remaining leading whitespace
|
last_cmd="${last_cmd#"${last_cmd%%[![:space:]]*}"}" # remove remaining leading whitespace
|
||||||
builtin printf "\e]2;%s\a" "${last_cmd}"
|
builtin printf "\e]2;%s\a" "${last_cmd}"
|
||||||
@@ -154,7 +153,7 @@ _ksi_main() {
|
|||||||
builtin local limit
|
builtin local limit
|
||||||
# Send all words up to the word the cursor is currently on
|
# Send all words up to the word the cursor is currently on
|
||||||
builtin let limit=1+$COMP_CWORD
|
builtin let limit=1+$COMP_CWORD
|
||||||
src=$(builtin printf "%s\n" "${COMP_WORDS[@]:0:$limit}" | command kitty +complete bash)
|
src=$(builtin printf "%s\n" "${COMP_WORDS[@]:0:$limit}" | builtin command kitty +complete bash)
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
builtin eval ${src}
|
builtin eval ${src}
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user