mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-26 18:52:01 +00:00
Merge and fix conflict on README
This commit is contained in:
@@ -83,12 +83,14 @@ from the `zsh` directory. The existing `ZDOTDIR` is retained so that
|
||||
after loading the Ghostty shell integration the normal Zsh loading
|
||||
sequence occurs.
|
||||
|
||||
```bash
|
||||
```zsh
|
||||
if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
|
||||
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
|
||||
fi
|
||||
```
|
||||
|
||||
Shell integration requires Zsh 5.1+.
|
||||
|
||||
### Nushell
|
||||
|
||||
For `nushell` Ghostty prepends to the `XDG_DATA_DIRS` directory. Nushell automatically
|
||||
|
||||
@@ -15,11 +15,16 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This script is sourced automatically by zsh when ZDOTDIR is set to this
|
||||
# directory. It therefore assumes it's running within our shell integration
|
||||
# environment and should not be sourced manually (unlike ghostty-integration).
|
||||
#
|
||||
# This file can get sourced with aliases enabled. To avoid alias expansion
|
||||
# we quote everything that can be quoted. Some aliases will still break us
|
||||
# though.
|
||||
|
||||
# Restore the original ZDOTDIR value.
|
||||
# Restore the original ZDOTDIR value if GHOSTTY_ZSH_ZDOTDIR is set.
|
||||
# Otherwise, unset the ZDOTDIR that was set during shell injection.
|
||||
if [[ -n "${GHOSTTY_ZSH_ZDOTDIR+X}" ]]; then
|
||||
'builtin' 'export' ZDOTDIR="$GHOSTTY_ZSH_ZDOTDIR"
|
||||
'builtin' 'unset' 'GHOSTTY_ZSH_ZDOTDIR'
|
||||
@@ -43,12 +48,6 @@ fi
|
||||
[[ ! -r "$_ghostty_file" ]] || 'builtin' 'source' '--' "$_ghostty_file"
|
||||
} always {
|
||||
if [[ -o 'interactive' ]]; then
|
||||
'builtin' 'autoload' '--' 'is-at-least'
|
||||
'is-at-least' "5.1" || {
|
||||
builtin echo "ZSH ${ZSH_VERSION} is too old for ghostty shell integration" > /dev/stderr
|
||||
'builtin' 'unset' '_ghostty_file'
|
||||
return
|
||||
}
|
||||
# ${(%):-%x} is the path to the current file.
|
||||
# On top of it we add :A:h to get the directory.
|
||||
'builtin' 'typeset' _ghostty_file="${${(%):-%x}:A:h}"/ghostty-integration
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# vim:ft=zsh
|
||||
#
|
||||
# Based on (started as) a copy of Kitty's zsh integration. Kitty is
|
||||
# distributed under GPLv3, so this file is also distributed under GPLv3.
|
||||
# The license header is reproduced below:
|
||||
@@ -41,6 +43,13 @@ _entrypoint() {
|
||||
[[ -o interactive ]] || builtin return 0 # non-interactive shell
|
||||
(( ! $+_ghostty_state )) || builtin return 0 # already initialized
|
||||
|
||||
# We require zsh 5.1+ (released Sept 2015) for features like functions_source,
|
||||
# introspection arrays, and array pattern substitution.
|
||||
if ! { builtin autoload -- is-at-least 2>/dev/null && is-at-least 5.1; }; then
|
||||
builtin echo "Zsh ${ZSH_VERSION} is too old for ghostty shell integration (5.1+ required)" >&2
|
||||
builtin return 1
|
||||
fi
|
||||
|
||||
# 0: no OSC 133 [AC] marks have been written yet.
|
||||
# 1: the last written OSC 133 C has not been closed with D yet.
|
||||
# 2: none of the above.
|
||||
|
||||
Reference in New Issue
Block a user