micro-editor / micro-editor/micro

[RFE] Setting a file name for buffer that is read from stdin

Open
#2,002 1 comment 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

(I've asked this is the gitter chat already, but got no answer so far, hence creating this issue to gain some attention)

Is it possible to set a file name in the command line if the buffer is read from stdin? Consider I'm doing this:

$ git show v5.10:fs/eventpoll.c | micro -filetype c -readonly on +100

It works fine, but the file name is shown as "No name" which is not very convenient.

What I want probably is something like this:

$ git show v5.10:fs/eventpoll.c | micro -filename 'fs/eventpoll.c' -readonly on +100

or similar. If this feature already exists (but I couldn't find it in this case), please let me know how to do it, otherwise consider this to be an RFE.

Similar feature that works in neovim is achieved like this:

$ git show v5.10:fs/eventpoll.c | nvim -R -c "file fs/eventpoll.c" -c "set ft=c" +100

Thanks!

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 by tracing micro's command-line argument parsing and the path that creates a buffer from stdin. Check how the existing -filetype and -readonly options are handled; done means a stdin buffer can receive a user-provided filename while preserving the existing behavior.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.