Sam (text editor)
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template 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 | 2021: MIT 2014: GPL-2.0-only 2002: LPL-1.02 |
Website | sam |
Sam is a multi-file
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
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
, 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 several eminent programmers. It was the first full screen editor
The latest version of sam was written as part of the Plan 9 operating system, but there are Microsoft Windows, macOS and X Window System[5] ports available.
See also
- acme (text editor) — Rob Pike's other popular text editor and successor of sam.
- Ken Thompson
- Plan 9 from Bell Labs
- List of Unix commands
Notes
- ^ Interview:Rob Pike Responds, Posted by Roblimo on Monday October 18, 2004, Slashdot
- ^ Rzeszótko, Jarosław (2006-10-16). "Stiff asks, great programmers answer". Stifflog (Interview). Archived from the original on October 5, 2011. Retrieved 2008-11-01.
- ^ Kernighan, Brian (July 2000). "An Interview with Brian Kernighan" (Interview). Interviewed by Budiu, Mihai. Retrieved 2008-11-01.
- ^ Fridman, Lex (19 July 2020). Brian Kernighan's Programming Setup | Lex Fridman. YouTube. Event occurs at 44 seconds. Archived from the original on 2021-12-12. Retrieved 2020-10-03.
- ^ "Deadpixi/Sam". GitHub. 17 May 2022.
References
- Pike, Rob (October 1987). "The Text Editor sam". Software: Practice and Experience. 17 (11): 813–845. S2CID 36076160. Retrieved 2008-11-01.
- 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