kitty.zsh 774 B

12345678910111213141516171819202122
  1. #!/bin/zsh
  2. #
  3. # This file can get sourced with aliases enabled. Moreover, it be sourced from
  4. # zshrc, so the chance of having some aliases already defined is high. To avoid
  5. # alias expansion we quote everything that can be quoted. Some aliases will
  6. # still break us. For example:
  7. #
  8. # alias -g -- -r='$RANDOM'
  9. #
  10. # For this reason users are discouraged from sourcing kitty.zsh in favor of
  11. # invoking kitty-integration directly.
  12. # ${(%):-%x} is the path to the current file.
  13. # On top of it we add :A:h to get the directory.
  14. 'builtin' 'typeset' _ksi_file="${${(%):-%x}:A:h}"/kitty-integration
  15. if [[ -r "$_ksi_file" ]]; then
  16. 'builtin' 'autoload' '-Uz' '--' "$_ksi_file"
  17. "${_ksi_file:t}"
  18. 'builtin' 'unfunction' '--' "${_ksi_file:t}"
  19. fi
  20. 'builtin' 'unset' '_ksi_file'