uses non-breaking space as a separator and assumes that first numeric token (starting from second one) is the line number (i.e., assumes that the searched token does not contain space delimited number)
11 lines
291 B
Awk
11 lines
291 B
Awk
BEGIN {
|
|
n = split(ENVIRON["kak_text"], a, "\u00a0")
|
|
line = a[3]
|
|
if (n == 3 && line ~ /^[0-9]+/) {
|
|
pat = a[1]
|
|
gsub(/'/, "''", pat)
|
|
gsub(/\\/, "\\\\", pat)
|
|
print "execute-keys " line " g vv x s '/\\b\\Q" pat "\\E\\b|\\Q" pat "<ret>' <a-)>,"
|
|
}
|
|
}
|