[TUHS] basic tools / Universal Unix
bakul at bitblocks.com
Mon Oct 30 12:54:28 AEST 2017
On Mon, 30 Oct 2017 00:55:07 -0000 Ralph Corderoy <ralph at inputplus.co.uk> wrote:
Ralph Corderoy writes:
> Hi Bakul,
> Regarding vi:
> > As an example, you can map a key to do a sequence of operations but
> > you you can't then use it in conjunction with search to repeat them
> > over a range of lines.
> You can use tail recursion in the macro because a failed search causes
> it to stop. So `qqq' to start recording to register `q', and then
> instantly stop recording, clearing it. Then the real definition, ending
> in an execution of the empty `q'.
> And finally an `@q' to kick off the recursion.
Thanks, didn't know about q. However, nvi doesn't have q. vim
does (but I rarely ever use it so when I tried the above it
failed). What I was getting at is being able to define
commands that can take one or two arguments like the bulitins,
separate from any key mapping. You need an ability to pass and
refer to arguments as well as refer to the current context.
And to be able to operate on char/word/line/para/sections. If
this machinery was accessible, may be even many of vi's
builtins can be implemented this way. E.g "d}" maps to
(delete 1para), "3dd" maps to (delete 3line) and so on.
More information about the TUHS