Discussion:
ksh history completion
Joel Andersson
2005-03-25 17:45:59 UTC
Permalink
Hey guys

Im currently using zsh instead of ksh.
This is for one reason only; the history completion.
That is, when i type the first, or first two, letters and
then press the 'up arrow' is completes amongst the commands in history
starting with those letters. Im not a very advanced user and ksh shell
is just fine except for this feature. Now to my question.. Is it
possible to use such completion in OpenBSD ksh? I read the changelog
about ksh in 3.7 now includes a new type of history completion
"csh-style" but Im not familiar with csh and do not know exactly how
this works.

Regards

/Joel
Jet Nul
2005-03-25 18:12:19 UTC
Permalink
Hi Joel,
Running /bin/sh (of Jan 18 snap), pressing <TAB>
effects completions. In csh, it's <ESC>, so unless
there's a change in sh or csh in 3.7, they're not
*quite* the same style... [pressing <ESC> in sh
can poison the current command line].
-Jet
Rick Pettit
2005-03-25 18:40:57 UTC
Permalink
Post by Jet Nul
Hi Joel,
Running /bin/sh (of Jan 18 snap), pressing <TAB>
effects completions. In csh, it's <ESC>, so unless
there's a change in sh or csh in 3.7, they're not
*quite* the same style... [pressing <ESC> in sh
can poison the current command line].
man ksh, search for the word "completion" is where I might begin...

-Rick
Stephan Tesch
2005-03-25 18:35:53 UTC
Permalink
On Friday 25 March 2005 18:45, Joel Andersson wrote:

Hi,
Post by Joel Andersson
is just fine except for this feature. Now to my question.. Is it
possible to use such completion in OpenBSD ksh? I read the changelog
about ksh in 3.7 now includes a new type of history completion
"csh-style" but Im not familiar with csh and do not know exactly how
this works.
Try pressing CTRL-R and type the first letters. This is a backwards search
within your shell history and I guess the thing you're looking for.

Look for search-history in ksh(1).

Stephan
--
PGP key: http://www.tesch.cx/stephan.asc
Fingerprint: 9CF9 0D64 2957 B44D A0C8
35FE 0382 AE49 DFAB 9CAF
Jet Nul
2005-03-25 19:05:16 UTC
Permalink
Oh, *history* completion; sorry. I was
talking pathname completion obv.
Rick Barter
2005-03-25 19:25:05 UTC
Permalink
Post by Joel Andersson
Hey guys
Im currently using zsh instead of ksh.
This is for one reason only; the history completion.
That is, when i type the first, or first two, letters and
then press the 'up arrow' is completes amongst the commands in history
starting with those letters. Im not a very advanced user and ksh shell
is just fine except for this feature. Now to my question.. Is it
possible to use such completion in OpenBSD ksh?
Are you saying you want to be able to use the "up" arrow for command
completion or that you just want to how to do command completion on ksh?

If it's the former, I don't think it's possible. If it's the latter,
try using vi-esccomplete as your editor (man ksh and search for vi-esc
and you should find the documentation). Then hitting ESC ESC does the
completion. I find this to be the best for me. Very handy and the
ESC key is easy to reach. There is an unfortunate side effect though;
I find myself trying to use this on my windows machine, while talking,
etc. :) Maybe it's a bit too handy.

I've also found that the navigation keys are broken in windows too.
When I try to go up or down line by line, I only get a bunch of "Js"
and "Ks". Strange behaviour to be sure. ;)

rvb
Rick Barter
2005-03-25 21:45:31 UTC
Permalink
Post by Joel Andersson
Hey guys
Im currently using zsh instead of ksh.
This is for one reason only; the history completion.
That is, when i type the first, or first two, letters and
then press the 'up arrow' is completes amongst the commands in history
starting with those letters. Im not a very advanced user and ksh shell
is just fine except for this feature. Now to my question.. Is it
possible to use such completion in OpenBSD ksh?
Bah! I just re-read your post and realized you said 'history
completion' not command-line completion. If you use the vi editor for
command-line editing, you can use the vi search keys to search through
the .history file while on the command line.

Use / to search from the beginning of the .history file and ? to
search from the end of the .history file (last commands first).

I hope this helps,

rvb

Loading...