Thread View: comp.unix.shell
2 messages
2 total messages
Started by Robert D. Kaminsky
Mon, 17 Dec 1990 14:29
Aliases for csh command line editing
Author: Robert D. Kaminsky
Date: Mon, 17 Dec 1990 14:29
Date: Mon, 17 Dec 1990 14:29
26 lines
1681 bytes
1681 bytes
I find the following aliases useful. Possibly you will too... The first two aliases allow for command line editing from the history. They are meant to be used only in the csh. The next two aliases print the history in 2 and 3 column format. Just source (i.e source filename) the stuff below "CUT HERE". --------------------------------- CUT HERE ------------------------------- # The following aliases allow for editing commands given in the csh. # # e n - visual edits command n (as numbered by history) # ee - visual edits last command # # Note: Both use an invisible work file called ".e_cmd" in the home directory. # # By Robert Kaminsky 11/19/90 alias e '( history | sed -n "/^ *\!*[^0-9]/p" | sed 's/.......//' ) >&! ~/.e_cmd ; \vi -w002 ~/.e_cmd ; source -h ~/.e_cmd ; source ~/.e_cmd' alias ee '( history | tail -2 | sed -n "1p" | sed "s/.......//" ) >&! ~/.e_cmd ; \vi -w002 ~/.e_cmd ; source -h ~/.e_cmd ; source ~/.e_cmd' # --------------------------------------------------------------------------- # The following alias print out the command history in 2 and 3 column format. alias his3 'history 45 | pr -3 -l15 -t | expand | cut -c1-71,72' alias his2 'history 30 | pr -2 -l15 -t | expand | cut -c1-71,72'
Re: Aliases for csh command line editing
Author: Tom Christiansen
Date: Tue, 18 Dec 1990 16:20
Date: Tue, 18 Dec 1990 16:20
31 lines
1502 bytes
1502 bytes
[too busy to leave much comment. just play.]
% alias e 'source ~/scripts/redo.csh'
% cat ~/scripts/redo.csh
# Edit history list at line containing last command (open mode).
# To work properly, put in .login: alias r source ~/redo
# Origianl uthor unknown. Mods by tchrist.
history -h >! /tmp/redo.$$
# Make CR map to :wq! and start ex quietly at 2nd to last line in open mode.
# map Q to quit and not execute
ex - '+map
tail -1 /tmp/redo.$$ >! /tmp/cmd.$$
# Insert into history without executing.
source -h /tmp/cmd.$$
# Clear out temporaries.
/bin/rm -f /tmp/{cmd,redo}.$$
# If thing chosen to redo is the redo alias itself then DON'T redo it.
if ("!-2:0" != "!!:0") then
!!
endif
--
Tom Christiansen tchrist@convex.com convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
to look at yourself in the mirror the next morning." -me
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads