micro-editor / micro-editor/micro

"=" as a command synonym for "textfilter "

Open
#3,820 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description

Make "=" (without a space) be a synonym for "textfilter " (with a trailing space) in the command entry box.

Benefits
  1. Reduce typing a very command command (for me). "textfilter" is really powerful, and I use it a lot.
  2. Avoid a shift sequence (by using "=" rather than "!" as vi does). [This is a keyboard specific consideration, as pointed out in comments below. It would work well for US keyboards, but is (unfortunately) not universal.]

Although no character is likely to be "guaranteed" to work unmodified across keyboards, "." or "," or ";" may be more likely candidates, and any such would be fine.

Example
Current

ctrl-e textfilter right 70 s Right Aligned Header

Proposed

ctrl-e =right 70 s Right Aligned Header

(The intent is that this is a synonym, so "textfilter " would still work.)

For the curious, this does the following...

Right align text, based on a width of 70, use a space (s) to do the alignment, and the text to align is "Right Aligned Header"

Environment
  • OS: Anywhere micro runs
General Comments

I use these types of textfilters (typically written in Perl, sometimes in Lua, Python, Bash, or Ruby) to format text for text documents, or do other functions, sometimes within code.

"textfilter" is as powerful as you want to make it.

Note, I'm using Micro 2.0.10. And if no text is marked (or perhaps since the "filter" doesn't read anything, or both), it just inserts the string, which is GOOD (please don't change this behavior!) I also have filters that reflow text, which is the more typical/intended use of "TEXTFILTER". That would look something like "=flow 70" under my proposal, with text marked! Please note that this is not a request for a specific filter, I have many of them already. I just want to make them take a bit less typing to access.

I considered "!" from vi[m], but I don't see any real convention in other editors for how this is done, and "=" wouldn't required a shift.

I've been using Micro for over a year (maybe more), I think, and it is now my favorite editor. The above, however, is a frequent "paper cut" for me.

Whether this is accepted/implemented or not, thanks for a great editor!

Whether "built in" or done with a plug-in is irrelevant to me, although I couldn't quite see (from various examples) how to do the above with a plug-in (though I suspect is is possible, and I'm just missing something). I think it would be a good feature built in, but it certainly doesn't have to be implemented that way.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the command entry box handling for the existing "textfilter " command and trace how command names are recognized. Verify that "=" invokes the same behavior while "textfilter " continues to work, including with marked and unmarked text; manually exercise the proposed examples in Micro.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.