Article View: comp.editors
Article #2548Re: Sam (was Re: sam and cursor control)
From: Ed Kubaitis - CCSO
Date: Fri, 18 Dec 1992 19:29
Date: Fri, 18 Dec 1992 19:29
85 lines
5212 bytes
5212 bytes
carlj@muppet.bt.co.uk (Carl) writes:
|weisen@alw.nih.gov (Neil Weisenfeld) writes:
|+Bret Giddings (bret@muppet.bt.co.uk) wrote:
|+:
|+: Is there anyone out there who knows whether sam supports cursor control
|+: (and maybe page-up etc). Seems kinda unusable without.
|+Yes, an editor in which you have no control over the cursor would be
|+bad :-). Actually, if you are referring to controlling cursor movement
|+from the keyboard, then I think the answer is no: you have to use the
|+mouse.
|+
|
|From the documents that come with sam, it suggests that its the editor of
|choice in the plan9 team. Something I find difficult to believe if its
|being used to write code in. I tried using it for a while and gave up as
|its just too slow to use, I have to keep taking my hands off of the
|keyboard to move around the file and it doesnt seem to have tags. Is this
|an old version of sam thats missing functionality? Anyone out there using
|it in anger?
|Opinions/comments/views?
I've been using sam almost exclusively for a few weeks now, after about 5
years with vi. In general, I like sam although I had to add mods to get
around some things that were driving me crazy in the beginning, notably
lack of any sort of autoindent and the need to do a menu and 'sweep'
operation initially even if editing only one file. (I find I almost never
use sam's 'window manager' features.)
While I haven't ruled out going back to vi yet, below are the things that
keep me from giving up despite sam's (to me) shortcomings. Your mileage may
well vary. I am not a touch typist, and despite 5 years of use, I had only
learned perhaps 30% of vi's commands, idioms, and tricks. Also my daily use
of xrn and a six or seven xterm tvtwm environment has raised my mouse
pain-threshold considerably;-)
o It is a pleasure to point with a mouse when I notice a typo 40 lines
away from '.'. When I have to go back to vi (on systems with no ANSI C
and therefore no sam) I find myself unconsciously moving the xterm
cursor and clicking and wondering momentarily why nothing happens;-)
o For yank/delete/etc operations on n lines where n is more than can be
counted at a glance, I find the mouse easier than the equivalent in my
vi repetoire. Similarly, a substitute of more characters than can be
counted at a glance seems easier with the mouse.
o Also nice is double-clicking inside a quote, brace, paren, and setting
. to the whole bracketed string for replacement typing or command
window editing.
o Multi-file functions: I find myself using only one sam session where I
would have had several vi sessions. And the one occasion I used the
"X" command to do some editing on a set of files was a gee-whiz. A
one-liner took the place of many sets of the ':w' ':n' 'n', and
'1,.-1d' vi commands I had used for the same chore.
But even with mods and devising a few tricks to avoid mouse activity, I
still find sam too mouse-intensive. Much could be done with something like
.exrc functionality to map samterm menu items and/or sam commands to
various keys. Things like keyboard cursor control and scrolling all seem
doable with this approach. I've given some thought to how to do this and
may give it a crack during our long semester break. If I'm successful, I'll
annouce the mods here in case other would-be sam users care to give them a
try.
Oh yes, tags. I don't use them myself (no good reason, ran into the feature
when new to unix five years ago but never got into the habit.) Anyway,
attached is a perl script that provides some tags functionality for sam.
Not nearly as nice as 'vi -t tag', but maybe better than nothing at all.
You say '!tag <tag>' in the command window, select the two lines printed
out by the script, and hit the 'send' menu2 item. I used it for about 20
minutes researching what sam modules would have to be modified to provide
the backquote (take stdout of shell command and exceute as sam commands)
feature Neil mentioned. Seems to work ok. (Maybe I *should* have been using
'vi -t' for the last 5 years;-)
----------------------------------
Ed Kubaitis (ejk@ux2.cso.uiuc.edu)
Computing & Communications Services Office - University of Illinois, Urbana
===============================================================================
#! /usr/local/bin/perl
# generate Sam commands from tags file
die "usage: tag tag\n" unless $ARGV[0] && $#ARGV == 0;
($tag, $file, $re) = split(/\t/, `look -d $ARGV[0] tags`);
$re =~ s/([()*[\]])/\\$1/g;
print "B $file\n$re";
Technical Details
Message-ID:
<BzGzGM.1uJ@news.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ux2.cso.uiuc.edu!ejkReferences:
<1992Dec14.133826.7789@alw.nih.gov> <1gpj37INNj6t@nemesis.muppet.bt.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ux2.cso.uiuc.edu!ejk From: ejk@ux2.cso.uiuc.edu (Ed Kubaitis - CCSO) Newsgroups: comp.editors Subject: Re: Sam (was Re: sam and cursor control) Message-ID: <BzGzGM.1uJ@news.cso.uiuc.edu> Date: 18 Dec 92 19:29:07 GMT References: <1992Dec14.133826.7789@alw.nih.gov> <1gpj37INNj6t@nemesis.muppet.bt.co.uk> Sender: usenet@news.cso.uiuc.edu (Net Noise owner) Organization: University of Illinois - Urbana Lines: 85