home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / editors / 3076 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  5.0 KB

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