Closed TieDyedDevil closed 4 years ago
Thanks for giving it a try! This particular bug should be fixed. I will leave the issue open for other structural regular expression related bugs (the x
and y
commands seem to not always work correctly).
More bug reports welcome ...
Ok some more comments / issues related to the sam integration:
s
(substitute) command should probably be implemented as an internal command instead of with sed(1)
. It should support a count as in s2/abc/def/
the following should also work: s/(argA), (argB)/\2, \1/
X
and Y
commands are currently broken?<Ctrl-v><Enter>
in the command window followed by selecting the lines with V
visual line mode must be used)The last few commits should have improved structural regex support:
,x/[a-zA-Z]+/{
g/Emacs/ v/....../ c/vi/
g/vi/ v/.../ c/Emacs/
}
The x
and y
looping commands now set the registers "&
and "1-"9
with (sub-)expression matches which can be referred to in texts using &
and \1-\9
respectively. As a consequence the substitute command was dropped, it can almost completely be replaced by: x/pattern/ c/replacement
.
The count specifier supported by sam was never implemented in vis. Eventually I would like to generalize the concept and apply it to all looping constructs either by modifying the syntax of x
/y
or g
/v
commands.
Multiple file support is still largely untested:
X
and Y
commands currently operate on windows, not files. Meaning that if a file is being displayed in multiple windows a given command will be executed once for every window. This is desired in certain cases (e.g. :X q
to close all windows without unsaved changes) and unwanted in others (e.g. :X 0i,/* ISC licensed */\n
to add a license template to the top of every file).u
command would at least give the possibility to :X u
undo all changes.It would be nice to get some feedback about the current state of affairs from users familiar with sam/acme or more generally structural regexp.
I'm tagging a few people who reported issues in the past and/or engaged in related discussion on IRC @Screwtapello, @halfwit, @mbucc.
I'm closing this because the basic functionality (including the issue initially reported here) seems to work fine. The limitations regarding multiple file support mentioned in my last comment are still true. The wiki lists some differences in syntax and behavior compared to sam.
I'm still very much interested in feedback, ideas and individual bug reports regarding the structural regex support. A somewhat recent example of that was #774.
The sam command:
should select lines 2 and 3.
Instead, only line 2 is selected.