You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
It is impossible to get the positions of all search matches without calling searchpos() in a loop. searchcount() counts all the matches, so it must have the position information of the matches, so it would be natural if it included that information in the result.
Describe the solution you'd like
Proposal 1: searchcount() would include a new 'pos' key in the result Dictionary that would be a List of Lists with the line and column position of the matches.
Proposal 2:
New function searchposlist() that would be the same as searchpos(), but returning a List of Lists with the line and column position of the matches:
Proposal 1 is the preferred one, because searchcount() would be providing more useful information than searchposlist().
Describe alternatives you've considered
This is the shortest snippet I came up with to obtain the positions:
let positions = []
let lnum =1letcol=0whilev:truecallsetpos('.', [0, lnum, col+1, 0])
let [lnum, col] =searchpos('hello', 'cW')
let positions += [[lnum, col]]
if lnum ==0||col==0breakendifendwhile
The text was updated successfully, but these errors were encountered:
Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
It is impossible to get the positions of all search matches without calling
searchpos()
in a loop.searchcount()
counts all the matches, so it must have the position information of the matches, so it would be natural if it included that information in the result.Describe the solution you'd like
Proposal 1:
searchcount()
would include a new'pos'
key in the result Dictionary that would be a List of Lists with the line and column position of the matches.Proposal 2:
New function
searchposlist()
that would be the same assearchpos()
, but returning a List of Lists with the line and column position of the matches:Proposal 1 is the preferred one, because
searchcount()
would be providing more useful information thansearchposlist()
.Describe alternatives you've considered
This is the shortest snippet I came up with to obtain the positions:
The text was updated successfully, but these errors were encountered: