> Is there a way to customise the starting layout of sam?
I have this patch, which changes the starting geometry of
cmd window and opens files fullscreen immediately instead of
having to sweep a rect:
diff -u /sys/src/cmd/samterm/main.c ./main.c
--- /sys/src/cmd/samterm/main.c Thu Apr 30 10:24:09 2020
+++ ./main.c Sat Jan 16 16:08:33 2021
@@ -43,7 +43,7 @@
scratch = alloc(100*RUNESIZE);
nscralloc = 100;
r = screen->r;
- r.max.y = r.min.y+Dy(r)/5;
+ r.min.x = r.max.x-Dx(r)/4;
flstart(screen->clipr);
rinit(&cmd.rasp);
flnew(&cmd.l[0], gettext, 1, &cmd);
diff -u /sys/src/cmd/samterm/menu.c ./menu.c
--- /sys/src/cmd/samterm/menu.c Wed Jan 18 13:12:54 2012
+++ ./menu.c Mon Jun 21 21:53:12 2021
@@ -205,7 +205,8 @@
Rectangle r;
Text *t;
- if(getr(&r) && (t = malloc(sizeof(Text)))){
+ r = screen->r;
+ if(t = malloc(sizeof(Text))){
memset((void*)t, 0, sizeof(Text));
current((Flayer *)0);
flnew(&t->l[0], gettext, 0, (char *)t);
kvik also has some window placement hacks:
https://git.sr.ht/~kvik/ham
There was a video demo somewhere.
To understand sam's automatic window placement around the
cmd window, resize cmd to a square in the centre and
experiment with creating new windows by clicking in various
regions around the square. There is afaik no way to save &
reproduce window geometry; as mentioned above, I just open
everything fullscreen.
> http://runjimmyrunrunyoufuckerrun.com/rc/s
I wrote this (improvements welcomed) but it relies on the ^
command and $% and $%dot variables which may not exist in
your version of sam. I believe it was brought to your attention
for these functions, which load a previous editing session:
# ^d [file] # save unwritten changes and dump sam state to file
fn d{
rfork e
switch($#*){
case 0
dump = /tmp/sam.dump
case 1
dump = $1
case *
echo !u d
exit
}
d = `{pwd}
echo 'X/^''/w'
echo !rm -f $dump
echo 'Y/^..\./!echo `{cleanname -d' $d
'$%}^'':#''^$%dot(2)^'',#''^$%dot(3) >>' $dump
echo 'X/^..\./!echo `{cleanname -d' $d
'$%}^'':#''^$%dot(2)^'',#''^$%dot(3) >>' $dump
}
# !l [file] # load dump file
fn l{
switch($#*){
case 0
xargs -n1 plumb </tmp/sam.dump
case 1
xargs -n1 plumb <$1
case *
u l
}
}
> Can someone point me to a specific resource that explains
> these expressions in more detail than does the sam man and
> sam tut?
http://sam.cat-v.org/ has a cheat sheet & some other
resources. What is sam_tut.pdf missing that you would like
to understand?
umbraticus
------------------------------------------
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/T3107cd3bc536dc63-M51c4690187627a0d4fc416e0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription