Sam (text editor): Difference between revisions
Cyberbot II (talk | contribs) Rescuing 1 sources. #IABot |
|||
Line 44: | Line 44: | ||
==Endorsers== |
==Endorsers== |
||
Sam is the preferred text editor of many eminent computer scientists; it replaced ed as [[Ken Thompson (computer programmer)|Ken Thompson]]'s favorite text editor, and he still uses it to this day. Sam is the text editor used by [[Bjarne Stroustrup]]<ref>{{cite interview |
Sam is the preferred text editor of many eminent computer scientists; it replaced ed as [[Ken Thompson (computer programmer)|Ken Thompson]]'s favorite text editor, and he still uses it to this day. Sam is the text editor used by [[Bjarne Stroustrup]]<ref>{{cite interview|first=Jarosław |last=Rzeszótko |title=Stiff asks, great programmers answer |program=[https://web.archive.org/web/20111006202821/http://www.stifflog.com/ Stifflog] |date=2006-10-16 |url=http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer |accessdate=2008-11-01 |deadurl=yes |archiveurl=https://web.archive.org/web/20111005145715/http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer |archivedate=October 5, 2011 }}</ref> and [[Brian Kernighan]].<ref>{{cite interview |first=Brian |last=Kernighan |title=An Interview with Brian Kernighan |interviewer=Budiu, Mihai |date=July 2000 |url=http://www.cs.cmu.edu/~mihaib/kernighan-interview/ |accessdate=2008-11-01}}</ref> Others, like [[Dennis Ritchie]], had moved on to use [[acme (text editor)|acme]] instead. |
||
The latest incarnation of sam was written as part of the Plan 9 operating system, but there are [[Microsoft Windows]], [[Mac OS X]] and [[X Window System]] ports available. |
The latest incarnation of sam was written as part of the Plan 9 operating system, but there are [[Microsoft Windows]], [[Mac OS X]] and [[X Window System]] ports available. |
Revision as of 11:01, 31 March 2016
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Original author(s) | Rob Pike |
---|---|
Developer(s) | Bell Labs |
Initial release | early 1980s |
Written in | C |
Operating system | Unix, Plan 9, Win32 |
Available in | English |
Type | Text editor |
License | Lucent Public License |
Website | swtch |
Sam is a multi-file text editor based on structural regular expressions. It was originally designed in the early 1980s at Bell Labs by Rob Pike with the help of Ken Thompson and other Unix developers for the Blit windowing terminal running on Unix; it was later ported to other systems. Sam follows a classical modular Unix aesthetic. It is internally simple, its power leveraged by the composability of a small command language and extensibility through shell integration.
Design and features
Sam is designed as two synchronous programs: a command interpreter and a mouse-oriented bitmap windowing interface. The interpreter's command set is modeled after the UNIX editor ed and may be used to operate the editor from a standard text terminal. By default, however, Sam presents its own graphical user interface (GUI) window, samterm, which additionally allows point-and-click operations through Smalltalk-80-style pop-up context menus. This two-process structure allowed sam to access files on networked host systems through remote execution of the file-access process while running the windowing interface locally, thereby bypassing latency over slow connections.
Samterm presents windows to files being edited and to a persistent command window which accepts input as sam commands. Most common editing operations are quickly and naturally accomplished with the point-and-click interface, which also functions inside the command window. This latter fact allows commands to be edited (and resubmitted) just as any other text, a function inherited from the DMD 5620 terminal interface.
Command Syntax
Sam's command syntax is formally similar to ed's or ex's, containing (structural-) regular expression based conditional and loop functions and scope addressing, even sharing some of ed's syntax for such functions. But while ed's commands are line-oriented, sam's are selection-oriented. Selections are contiguous strings of text (which may span multiple lines), and are specified either with the mouse (by sweeping it over a region of text) or by a pattern match. Sam's commands take such selections as basic—more or less as other Unix tools treat lines; thus, multi-line and sub-line patterns are as naturally handled by Sam as whole-line patterns are by ed, vi, AWK, Perl, etc. This is implemented through a model called structural regular expressions, which can recursively apply regular-expression matching to obtain other (sub)selections within a given selection. In this way, sam's command set can be applied to substrings that are identified by arbitrarily complex context.
Sam extends its basic text-editing command set to handling of multiple files, providing similar pattern-based conditional and loop commands for filename specification. Any sequence of text-editing commands may be applied as a unit to each such specification.
Infinite Undos
Sam was one of the first text editors to support "infinite" undo to revert any number of editing errors. This feature, combined with Sam's facility to easily edit its own commands and, fundamentally, its small, orthogonal command set (containing only 33 commands), represent the program's bias toward a low learning threshold over other more expressive "power editors."
Endorsers
Sam is the preferred text editor of many eminent computer scientists; it replaced ed as Ken Thompson's favorite text editor, and he still uses it to this day. Sam is the text editor used by Bjarne Stroustrup[1] and Brian Kernighan.[2] Others, like Dennis Ritchie, had moved on to use acme instead.
The latest incarnation of sam was written as part of the Plan 9 operating system, but there are Microsoft Windows, Mac OS X and X Window System ports available.
Notes
- ^ Rzeszótko, Jarosław (2006-10-16). "Stiff asks, great programmers answer" (Interview). Archived from the original on October 5, 2011. Retrieved 2008-11-01.
{{cite interview}}
: Unknown parameter|deadurl=
ignored (|url-status=
suggested) (help); Unknown parameter|program=
ignored (help) - ^ Kernighan, Brian (July 2000). "An Interview with Brian Kernighan" (Interview). Interviewed by Budiu, Mihai. Retrieved 2008-11-01.
See also
- acme (text editor) — Rob Pike's other popular text editor and successor of sam.
- ed (text editor) — The original Unix text editor by Ken Thompson
- Plan 9 from Bell Labs
- List of Unix programs
References
- Pike, Rob (October 1987). "The Text Editor sam". Software—Practice and Experience. 17 (11): 813–845. doi:10.1002/spe.4380171105. Retrieved 2008-11-01.
{{cite journal}}
: Cite has empty unknown parameter:|coauthors=
(help) - Pike, Rob. "Structural Regular Expressions". Retrieved 2008-11-01.
{{cite journal}}
: Cite journal requires|journal=
(help) - Pike, Rob. "A tutorial for the sam command language". Retrieved 2008-11-01.
{{cite journal}}
: Cite journal requires|journal=
(help)
External links
- ssam(1): stream interface to sam
- Sam Resources
- sam(1): screen editor with structural regular expressions
- A Win32 version of sam
- Another Win32 version of sam (and other Plan 9 utilities)
- A new Win32 version of sam and other plan9 utilities based on plan9port
- A new Unix version of sam as part of Plan 9 from User Space
- Another version of sam for Unix, without any Plan 9 from User Space dependencies and with scalable font support
- A sam quick reference card