Re: [dev] structural regular expression support for vis

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Wed, 13 Apr 2016 20:15:54 +0200

On Wed, Apr 06, 2016 at 06:40:44PM -0500, Joshua Haase wrote:
>
> - `!` operator only works when visual selection is active (visual mode).

It can be used like any other operator. It will create a selection for
the range it was applied to, switch to visual mode and open a command
prompt defaulting to :|

> They also can be represented in complete form to avoid misunderstandings.
>
> > I think the latest commit should fix the vi operators `!` and `=`.
> >
> >> Otherwise, `!` only works on primary cursor, even when using multiple
> >> cursors.
> >
> > Here you are referring to the sam command `!` which redirects stdin to
> > the program being launched. This is for example used for the file
> > open dialog (based on the vis-open shell script) invoked by `:e .`
> > I believe doing it only for the primary cursor makes sense in this
> > case.
>
> I used the sam `:!` command without a selection to insert information
> from commands at the cursor position.
>
> The intended behavior is not "filter my char trough command" (as I have
> not selected the char) but rather:
>
> "insert the result from command before cursor position".
>
> The behavior I expected from multiple cursors and without a selection
> was in the same vein:
>
> "insert the result from command before every cursor position."

This should again be the case now? Though in the meantime a few other things
have been broken ...

> >> Also, if we are to keep `! cmd`, it could be an alias for `:. | cmd`.
> >> This will also fix `!` on multiple cursors.
> >
> > See explanation above for the purpose of the `!` sam command.
>
> Can you elaborate on use cases?
>
> I can see that `:!` is needed when input from the user is expected,
> but the the output is added to the current position on the file,
> just as expected from the other commands.
>
> It may also be the case that some filter require user interaction and
> fails because of user not being able to provide it.
>
> So I fail to see why there is a need to differenciate `:. |` and `:!`
> behavior.

The current modus operandi is roughly:

 for all selections:
    do something e.g. execute command

Because the ! command is for interactive applications, keyboard input
(stdin) is redirected to the forked process. With the above scheme the
command would be executed once for every selection, and you would have to
individually provide user input for every instance. This is impractical,
hence the command is only executed once for the primary cursor/selection.

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: 10C93617
Received on Wed Apr 13 2016 - 20:15:54 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 13 2016 - 20:24:12 CEST