Re: [9fans] Deleting lines in sam - d
revcomni...@gmail.com wrote: > Many thanks. I will apply your solutions and revert back. It just seems a > little counter intuitive not to be able to show the line numbers as ed > does,especially if one is viewing a large body of text. You can also try: unix: ,>nl plan9: ,x { p } (or write your own nl) That might do it for larger bodies. Although you have to prepare a more dedicated script for a clean nl approach. I like that sam doesn't offer that feature (especially because it doesn't really need it). It makes you think more about your environment scripts and how to use/prepare the utilities inside the sam env. I'm always trying to prepare some sam specific shell/rc scripts and get my 'missing' features that way. I would appreciate a more clean nl solution if anyone got something to offer. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-Madd47ff7eed5de28fbce700a Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Deleting lines in sam - d
Many thanks. I will apply your solutions and revert back. It just seems a little counter intuitive not to be able to show the line numbers as ed does,especially if one is viewing a large body of text. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-M2a8d78f0b893ede1f6ec5cb3 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] acme & sam text selection and delete deletes extra character
Don't forget Esc cuts a selection. umbraticus -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06d3bdd208f5a90b-Maa4736ab2beb35086413d070 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Deleting lines in sam - d
= prints line number 3,7d deletes some lines Setting and working with the mark may also suit your problem find a place, press k, find another place, then ',.d or .,' deletes everything in between. Multiple marks à la ed would be a nice addition to sam. umbraticus P.S. Here's a patch to make = more sensible (ie. plumbable): --- a/sys/man/1/sam Wed Apr 27 19:24:07 2022 +++ b/sys/man/1/sam Sat Apr 16 02:53:35 2022 @@ -403,10 +403,10 @@ Set dot. .TP .B = -Print the line address and character address of the range. +Print the file name and line address of the range. .TP .B =# -Print just the character address of the range. +Print the file name and character address of the range. .PD .SS File commands .PD 0 --- a/sys/src/cmd/sam/sam.c Wed Apr 27 19:24:07 2022 +++ b/sys/src/cmd/sam/sam.c Sat Apr 16 02:53:35 2022 @@ -688,11 +688,27 @@ } void -printposn(File *f, int charsonly) +printposn(File *f, int chars) { Posn l1, l2; + char *s; - if(!charsonly){ + if(f->name.s[0]){ + if(f->name.s[0]!='/'){ + getcurwd(); + s = Strtoc(); + dprint("%s", s); + free(s); + } + s = Strtoc(>name); + dprint("%s:", s); + free(s); + } + if(chars){ + dprint("#%lud", addr.r.p1); + if(addr.r.p2 != addr.r.p1) + dprint(",#%lud", addr.r.p2); + }else{ l1 = 1+nlcount(f, (Posn)0, addr.r.p1); l2 = l1+nlcount(f, addr.r.p1, addr.r.p2); /* check if addr ends with '\n' */ @@ -701,11 +717,7 @@ dprint("%lud", l1); if(l2 != l1) dprint(",%lud", l2); - dprint("; "); } - dprint("#%lud", addr.r.p1); - if(addr.r.p2 != addr.r.p1) - dprint(",#%lud", addr.r.p2); dprint("\n"); } -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-M738ed39a9ebb9a95372a4aad Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] Deleting lines in sam - d
In ed one can show line numbers using n. To delete line nubers is thus easy. In sam - d it appears this is not possible. I understand sam is not a line editor. What the would be the best way to delete a range of lines? -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-M54374be671082c4e329d2aeb Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] acme & sam text selection and delete deletes extra character
Thank you Mark. That was exactly what I was looking for. -Ben From: Mark van Atten Sent: Wednesday, May 11, 2022 8:57 AM To: 9fans <9fans@9fans.net> Subject: Re: [9fans] acme & sam text selection and delete deletes extra character >Just curious, is this by design, or is this a bug? I'm inclined to think > it's by design as it occurs within sam as well. https://9fans.topicbox.com/groups/9fans/Tf778565df277dd77-M396229d3fd3befcd0bcc95df/re2-9fans-home-end-hjkl Mark. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06d3bdd208f5a90b-M0fa8bcaa4344f3533e471d28 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] Re: Making multiple changes to dot using sam -d
Thank you! I was erring in that I failed to repeat x. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06c9db1e30f71346-Mdb19a92f81130bed1063af3c Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] acme & sam text selection and delete deletes extra character
The world is a little less interesting without Boyd. Ian -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06d3bdd208f5a90b-M678c6793049db2d0dbec0bb4 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] acme & sam text selection and delete deletes extra character
Hi there- Please pardon the dumb question if this has been covered before. I did some brief searches of the archive and couldn't find it... I'm running plan9port on macOS. I noticed that in acme, (and also sam) if I select part of a string and p delete, the selection gets deleted and also one additional character in front of the selection. For example, if I type "/path/to/file" and double-click file, file gets highlighted, and if I press delete, "/file" gets deleted leaving me with "path/to". This seems counter-intuitive as I expected only what I had highlighted to be deleted. There is a GitHub issue (#424) https://github.com/9fans/plan9port/issues/424 filed for this as well. Just curious, is this by design, or is this a bug? I'm inclined to think it's by design as it occurs within sam as well. As always, thanks!! -Ben -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tf6b94eeff34dd2d7-M674a970ef824d9c5094cb3d7 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] acme & sam text selection and delete deletes extra character
>Just curious, is this by design, or is this a bug? I'm inclined to think > it's by design as it occurs within sam as well. https://9fans.topicbox.com/groups/9fans/Tf778565df277dd77-M396229d3fd3befcd0bcc95df/re2-9fans-home-end-hjkl Mark. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06d3bdd208f5a90b-Ma87ed015ed75722f36cb8ba9 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] acme & sam text selection and delete deletes extra character
Hi there- Please pardon the dumb question if this has been covered before. I did some brief searches of the archive and couldn't find it... I'm running plan9port on macOS. I noticed that in acme, (and also sam) if I select part of a string and press delete, the selection gets deleted and also one additional character in front of the selection. For example, if I type "/path/to/file" and double-click file, file gets highlighted, and if I press delete, "/file" gets deleted leaving me with "path/to". This seems counter-intuitive as I expected only what I had highlighted to be deleted. There is a GitHub issue (#424) https://github.com/9fans/plan9port/issues/424 filed for this as well. Just curious, is this by design, or is this a bug? I'm inclined to think it's by design as it occurs within sam as well. As always, thanks!! -Ben -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06d3bdd208f5a90b-M97206433039ca2198ba50801 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] Re: Making multiple changes to dot using sam -d
Hi, Yep, seems you can combine changes with ,x { x/sam/c/sam -d/ x/teh/c/the/ } Adding an optional guard before the opening brace. Note the changes must be correct way round otherwise you get the error "?changes not in sequence" Silas -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06c9db1e30f71346-M9ed1425bee373a09dc2b0985 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] Making multiple changes to dot using sam -d
I am running sam -d in a Debian Linux Subsystem on Windows. I am editing a series of documents that require several changes per line(s). I can for instance change: I love working in sam in teh terminal to I love working in sam -d in the terminal using: .x/sam/c/sam -d/ .x/teh/c/the Is it possible to combine multiple changes into a single expression? If so, can you provide an example for me. I have tried a few things without success. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T06c9db1e30f71346-M973a02ff3b9e185458fc3d18 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription