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)
12 lines
317 B
Awk
12 lines
317 B
Awk
BEGIN {
|
|
n = split(ENVIRON["kak_text"], a, "\u00a0")
|
|
line = a[3]
|
|
if (n == 4 && line ~ /^[0-9]+/) {
|
|
pat = a[1]
|
|
gsub(/'/, "''", pat)
|
|
gsub(/\\/, "\\\\", pat)
|
|
print "edit --", a[4], line
|
|
print "execute-keys vv x s %{/\\b\\Q" pat "\\E\\b|\\Q" pat "<ret>} <a-)>,"
|
|
}
|
|
}
|