-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
NOTE from BurntSushi: This issue has been re-classified as a bug that was discovered in the course of discussion. There's too much context here to split it apart, which GitHub doesn't really make easy to do anyway. So I've re-purposed this issue for the bug described in the title. The main details of the bug are described here: #1866 (comment)
Below is the original issue.
Describe your feature request
Vim recently added a new feature called "text properties" that can be used to highlight text. All it needs to know to highlight is:
- lnum : line number where match begins
- col : column (counted in bytes) where match begins
- end_lnum : line number where match ends
- end_col : column (counted in bytes) where match ends
Ideally there would be an option like --json-pos
that just prints positions of matches for each file, perhaps in json format like following. If that is not possible or two cumbersome, is there a way I can already do this in a performance efficient way using ripgrep?
{
{
"file": "fileA.txt",
"positions": [
{
"lnum": 10,
"col": 4,
"end_lnum": 12,
"end_col": 7
},
{
"lnum": 15,
"col": 3,
"end_lnum": 15,
"end_col": 5
},
{
"lnum": 17,
"col": 12,
"end_lnum": 20,
"end_col": 10
}
]
},
{
"file": "fileB.txt",
"positions": [
{
"lnum": 1,
"col": 4,
"end_lnum": 1,
"end_col": 7
},
{
"lnum": 30,
"col": 3,
"end_lnum": 31,
"end_col": 5
}
]
}
}