Skip to content

Conversation

@hemmingsv
Copy link

Background:
The textfilter command is great for running a single shell command on a selection (or multiple) from the buffer as stdin. The selection is replaced by the command output, but the output is not selected afterward.

Expected changes:

  • Let the user set textfiltermode=keep-selection to keep the output selected. This is great for chaining commands and in line with what I would expect textfilter to do.
  • Current behavior is still default (ie textfiltermode=drop-selection)

demo2

Personal note: I am new to the code base and never written Go. I find the repo very easy to work with. I might have implemented this in a completely stupid way though. Harsh feedback is welcome. I could have made this into a plugin, but I found it hard to implement the textfilter command in Lua, so went with this native approach instead. If this approach is approved, then I will oversee the documentation as well.

Copy link
Contributor

@Andriamanitra Andriamanitra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be the default behavior. Losing the selection always felt more like a bug than an intentional design choice. Maybe we don't even need the setting?

The implementation seems reasonable to me. I tested it a bit and everything seemed to work alright. There is a bug that causes selections to get messed up when undoing multicursor edits (including the ones done with textfilter), but it already existed before these changes.

I'm on the fence about whether or not it should select the text when you do textfilter without having a selection. On one hand it's nice to see exactly what was inserted but it feels a bit weird for the inserted text to be selected by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants