3

Reading the less and lesskeys manpages, I have created a file containing:

^B shell touch ~/testfile

and run it through lesskey to generate .less-test, then executed less -k .less-test file. This all works fine and does what I hope, except that I need to hit enter twice to actually execute the shell command and return to the file. Changing the command to touch ~/testfile\n removes the need for one of those enter presses, but touch ~/testfile\n\n doesn't work to get rid of them both. Is there a way to bypass hitting enter at all here?

As a follow-up question (and to explain why I'm asking in the first place)--I am doing this as a process of file tagging, where I inspect the file using less and want to use these hotkeys to write out to another file with one of two tags (which I plan to bind to two different key sequences). So in addition to not having to press enter twice as above, I'd also like to know if there's a way to immediately move to the next file (as with the next-file lesskey command) also (that is, press no other keys besides the tagging key sequence).

1 Answer 1

2

It will always display the "!done" message.

If you want, you could change "!done" to NULL in command.c (row 272 and 274) to get rid of this behavior.

To get it to execute next-file after the touch command for instance, you could add the following binding:

^B shell touch ~/testfile\n:n\n

(:n is the default binding for next-file)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .