Introduction
Introduction Statistics Contact Development Disclaimer Help
2018-03-09
__E_d_i_t_i_n_g__g_o_p_h_e_r__p_o_s_t_s__w_i_t_h__s_a_m_____________
s I have written yesterday[0], I like to use the sam editor for
diting files on my machines. Sam is really an ed(1) instance on
teroids as it features a powerful command language while providing a
raphical interface and it is really really fast with a lot of open
iles.
ntil today I have totally neglected another neat feature of sam:
emote editing. This works like this: sam is split between an editor
art (sam) and a terminal frontend (samterm). Both communicate via a
imple unix domain socket. This socket can be created by a small
rapper program forwarding everything through ssh(1) to a sam
nstance running on another host.
nd that's how I edit this post now. It also enables me to run shell
ommands etc completely within this simple editor. So I have fired
p my script for creating a new file template, edit, save and then I
all the publishing script.
hat the terminal is separate from the instance doing all the file
/O is convenient for laggy connections too. I have to have a deeper
ook into the source code to understand the wire protocol!
ote that there are incompatibilities within sam versions around, so
f you want to try this for yourself make sure that the sam versions
n both sides match. Also make sure that sam is in your path...
quick primer to sam:
he white window is the command window. You can open files there with
B filename', write with 'w', undo with 'u' (unlimited undo!) and
uit with 'q'.
n deadpixie's fork CTRL-K switches focus from the command window to
he text window so that saves you reaching for the mouse for simple
ommands.
or advanced editing (I am still getting comfortable with it myself)
ee the sam cheatsheet[1].
he entries get formatted with selecting the text body and issuing
he command '|fmt -w 69' in the command window. That pipes the
election to the external command and replaces the connection with
he output of said command.
here is so much more to be said about sam. But there are better
escriptions around: The paper[2] and a tutorial[3].
__References________________________________________________________
0]: gopher://vernunftzentrum.de/0/ckeen/phlog/2018-03-08-A-mixed-bag-of-random-…
1]: http://sam.cat-v.org/cheatsheet/sam-refcard.pdf
2]: http://doc.cat-v.org/plan_9/4th_edition/papers/sam/
3]: http://doc.cat-v.org/bell_labs/sam_lang_tutorial/sam_tut.pdf
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.