sam
sam copied to clipboard
unifying ˆ and ^
ˆ is a non-ascii character that's hard to type with a standard 104 us keyboard - it would be nice if ^ can be used in its place
^ (code 94 in ascii) is indeed used in Sam's regex for bol or reverse. Not sure what you mean by ˆ.
ˆ is used as the address qualifier for start of line. It would be good if ^ can be used in its place in the address qualifier as well.
@solarsea Where is ˆ mentioned? ^ should be correct.
See the reference card at http://sam.cat-v.org/cheatsheet/sam-refcard.pdf
Test it, using ^ as a start of line address does not work, while using ˆ works alright.
- Stanislav Paskalev [email protected] [180312 13:33]:
See the reference card at http://sam.cat-v.org/cheatsheet/sam-refcard.pdf
Test it, using ^ as a start of line address does not work, while using ?? works alright.
Can you give me an example?
If I do this is sam:
a One line is good Two lines are better Three lines are best . s/^/ -> /g
I get
-> One line is good -> Two lines are better -> Three lines are best
as expected. So I must be missing something.
-- May you be peaceful, may you live in safety, may you be free from suffering, and may you live with ease.
I want to select from dot to the start of the line - or select the whole line. In sam's graphical terminal I create a new file with a single line, 'testing' and click in the middle of it.
Then in the command window typing ^
I want to be able to use ^ in dot's address range, not just in regexp address.
- Stanislav Paskalev [email protected] [180312 14:26]:
I want to select from dot to the start of the line - or select the whole line. In sam's graphical terminal I create a new file with a single line, 'testing' and click in the middle of it.
Then in the command window typing ^
replies with ?unknown command `^'. Typing ?? seems to select the whole line. I want to be able to use ^ in dot's address range, not just in regexp address.
Ah I see. Now, which version is this? I cannot reproduce this on master here. Also I don't see any code handling that so far. The command tab and the address loop do not contain support for this AFAICS.
I must be missing something....
-- May you be peaceful, may you live in safety, may you be free from suffering, and may you live with ease.
Weird, I think I have this particular sam installed, commit 51693780fb1457913389db6634163998f9b775b8 I'll check if I'm not running something else.
Still, is there a way to select up to the start of the current line in this version ? I was trying to make a shortcut for that, e.g. home and end buttons
- Stanislav Paskalev [email protected] [180312 15:07]:
Weird, I think I have this particular sam installed, commit 51693780fb1457913389db6634163998f9b775b8 I'll check if I'm not running something else.
Still, is there a way to select up to the start of the current line in this version ? I was trying to make a shortcut for that, e.g. home and end buttons
If you want to move the cursor to those there are commands 'bol' and 'eol' as in:
bind C a command bol bind C e command eol
But I am not sure how to set the selection with any command, since that's not part of the command set. If you are really running this, I'd like to know what exactly I need to enter here to be able to reproduce the behaviour you see.
I am sorry that I don't know of an easy solution, mabye someone else does?
-- May you be peaceful, may you live in safety, may you be free from suffering, and may you live with ease.
I have hacked a POC for a ^ address command, however I am unsure on how to deal with $: When should it mean end of line and when end of file?
You can test the ^ command here: https://github.com/ckeen/sam.git
The plan 9 man page also does not mention it, it does mention ^ meaning beginning of line in the context of regular expressions: http://man.cat-v.org/plan_9/1/sam
Thanks a lot, I'll give it a try. $ means end of line (up to next new line) and end of file (if on last line and the file does not end with a new line)
Well in the current implementation $ means 'end of file' unless used in a regular expression. So 5,$ will select everything from line 5 until end of file.