In csh is there an equivalent to ksh's ability to issue:
set -o vi
or
set -o emacs
to have a vi or emacs-like command line editor? If not,
is there ANY way to scroll back through previous commands?
Thanks.
Dan
set -o vi
or
set -o emacs
to have a vi or emacs-like command line editor? If not,
is there ANY way to scroll back through previous commands?
Thanks.
Dan
: set -o vi
: or
: set -o emacs
: to have a vi or emacs-like command line editor? If not,
: is there ANY way to scroll back through previous commands?
Not easily. You will probably be better off with tcsh.
csh does give you some editing capabilitiles, but exactly the way
you would want them (if you're used to ksh). A combination of the
history command, and judicious use of the ^string^new_string combination
will allow you to edit a line...
: Thanks.
: Dan
jerry
--
Tactical Simulation Division | http://www.arlut.utexas.edu/~jerry/main.html
Applied Research Laboratories of UT Austin | "Software is the difference
P.O. Box 8029, Austin, TX 78713-8029 | between hardware and reality"
I agree with the stated opinions of the previous respondents: get tcsh
or use the features of csh that you do not know yet to their best avail.
But for what it's worth, this code comes from "Unix Power Tools" (highly
recommended). I have never used it, thinking csh the "spawn from hell" ;-)
Best of luck!
-brian
# (The name of the author of the script below, which apparently was obtained
# from Usenet years ago, has been lost.)
#
# This script gives csh users the capability of command line editing by
# invoking the open mode of ex on a file containing a history list, and then
# sourcing the edited version of the desired command.
#
# 1) install it in /usr/local/bin/redo (or wherever else you'd like) with
# read-only-for-world permissions (i.e., do *not* make it executable);
#
# 2) do
# alias r source /usr/local/bin/redo
# (or whatever, corresponding to where you installed it), and also put this
# alias in your favorite "dot" file;
#
# 3) type "r" to invoke it; use the "hjkl" keys to get to the line you want to
# edit; edit the line (remember that you're in the open mode of ex); and,
# when you're done, hit <CR> (*not* ZZ).
#
# Get up to 22 most recent commands.
history -h 22 >! /tmp/redo.$$
# Put CR in $c[1] and ESC in $c[2]:
set c=(`echo "m e" | tr me '\015\033'`)
# Make CR map to :wq! and start ex quietly at 2nd to last line in open mode.
(setenv EXINIT "map $c[1] :.wq\!$c[2]|map! $c[1] ${c[2]}:.wq\!$c[2]";\
ex '+$-1 open' /tmp/redo.$$)
tail -1 /tmp/redo.$$ >! /tmp/cmd.$$
# Insert into history without executing.
source -h /tmp/cmd.$$
# Clear out temporaries.
/bin/rm -f /tmp/{cmd,redo}.$$
unset c
# If thing chosen to redo is the redo alias itself then DON'T redo it.
if (!-2:0 != !!:0) !!
--
,---. ,---. ,---. ,---. ,---. ,---. ,---.
/ _ \ / _ \ / _ \ / _ \ / _ \ / _ \ / _ \
__,' `.___,' `.___,' `.___,' `.___,' `.___,' `.___,' `.__
> In csh is there an equivalent to ksh's ability to issue:
> set -o vi
> or
> set -o emacs
> to have a vi or emacs-like command line editor? If not,
> is there ANY way to scroll back through previous commands?
> Thanks.
> Dan
Dave.
--
-----------------------------------------------------------------------
David Grierson
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.3a
mQCNAjEFLYEAAAEEAMcDL1uiUSzNEhXtg4sQ1pVxTMBz43wZPuMAokrJAQg0UeLj
dc9cjTIXu/MXRu2E/PsD4xFlv4bBWC2Zjenj28HBt/hgQJhyUiZTJ9naft476dSA
+drT+Lx5S2Y/HpfJMJ7KbHtJE3OKiW0HDY3q29zCyBpyInMhkXXewNCSN8iVAAUR
tCNEYXZpZCBHcmllcnNvbiA8bW0yMzZAbmFwaWVyLmFjLnVrPg==
=C45G
-----END PGP PUBLIC KEY BLOCK-----
1. setting command line editor to vi...
Hi!
How do you set your command line editor to vi???
I have used "set -o vi" in ksh but do not know how to achive the same in csh.
Please email responses if possible.
Thanx!
---Michael
2. solaris virtual memory and io cache
3. setting vi to always start as command line editor
5. Q:command line editor with csh
7. Q: Any Command Line Editor for csh?
8. Microchannel patch for kernel 2.0.30?
10. tcsh's command line editor & vi
11. Using vi as command line editor
12. function key to go up to 1st line & down to last line in vi editor