micro-editor / micro-editor/micro

Support +/$text command line argument

Open
#3,756 9 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

This is a feature found in vim and for example used by Linux kernel test robots to give context about warnings and/or failures.

e.g. vim +/imem_size +623 drivers/net/ipa/ipa_mem.c

Means to search for imem_size and move cursor to line 623.

The behavior found in VIM is as follows:

  • If line:col is specified before the search starts from that position and if a match is found the cursor jumps to the match (also wrapping around the buffer).
  • If the search if specified before and a match is found it highlights the search field and then moves the cursor as specified in line:col.

As for multi-file handling it applies the last rule in command line takes over.

Not sure if that's something you'd be interesting to support but it's quite handy.

There's a crude implementation here https://github.com/luca020400/micro/commit/894043ae3f9704d2d6bb91c082be618f385ddb58 that implements it in an hacky way via .Search (couldn't find a proper API for now)

Ty.

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 reviewing the crude implementation in commit 894043ae3f9704d2d6bb91c082be618f385ddb58 and trace the command-line argument handling it uses. Compare the implementation with the requested Vim behavior for search, line:col positions, wrapping, highlighting, and multiple files. Done means the +/$text argument works consistently for those cases with appropriate tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.