ajeetdsouza/zoxide

Add support for kornshell

Closed this issue · 7 comments

I use this in zsh, but would like it in kornshell as the

eval "$(zoxide init posix --hook prompt)"

is a little janky

What's janky about it?

It doesn't always work and kornshell has more features than a generic posix shell. We could use these features to improve performance of zoxide in kornshell. Here is the kornshell I use : https://github.com/ksh93/ksh

It doesn't always work

Could you elaborate? If there's a bug in the generic POSIX implementation, we should fix that.

kornshell has more features than a generic posix shell. We could use these features to improve performance of zoxide in kornshell.

What Korn-specific features do you think zoxide should be utilising? Is there any part of zoxide that's running slow on your system?

It doesn't always work

Could you elaborate? If there's a bug in the generic POSIX implementation, we should fix that.

kornshell has more features than a generic posix shell. We could use these features to improve performance of zoxide in kornshell.

What Korn-specific features do you think zoxide should be utilising? Is there any part of zoxide that's running slow on your system?

The execution time in kornshell is slow. My systtem has 4 cores and 8 threads. (2017 macbook pro 15 inch)

There's not much to do here, unfortunately:

  • zoxide does most of its work in Rust - the shell plugin for POSIX is around 37 lines of code
  • There are no features specific to Korn that would cause a speedup for zoxide (at least, not that I'm aware of)

zoxide is a very light binary, a 2017 MacBook is more than sufficient for it. There may be a one-off slowdown because macOS checks binaries before executing them the first time, but that should not persist. What exactly takes long to execute on your system?

(Did some work in ksh a while back.)

Briefly tested on OpenSUSE tumbleweed. Unable to replicate the problem. I looked through the man page and didn't find any additional hooks other than $PS1 that could be used for this, but I could be wrong.

~ ksh --version
  version         sh (AT&T Research) 93u+ 2012-08-01

➜  ~ uname -a
Linux localhost.localdomain 6.8.1-1-default #1 SMP PREEMPT_DYNAMIC Tue Mar 19 07:32:20 UTC 2024 (d922afa) x86_64 x86_64 x86_64 GNU/Linux

CPU Info model name : Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz

~/.kshrc

echo "Hello world"
eval "$(zoxide init posix --hook prompt)"

Agreed, I don't think this issue is actionable.