Friday, May 9, 2014

Re: What does ! do to map? [Was: When is map useful (as apposed to noremap)]

On 08.05.14 14:10, Elijah Griffin wrote:
> I see this in map.txt:
> ------ cut 8<------
> Some commands work both in Insert mode and Command-line mode, some not:
>
> commands: modes:
> Insert Command-line Lang-Arg
> :map! :noremap! :unmap! :mapclear! yes yes -
> ------ cut 8<------
>
> The ! addon to map comes from original vi, where the distinction is
> "map" works during vi expects commands, and "map!" works when vi is
> not expecting commands (including the ex ":" line).

Elijah, thank you for the explanation, especially that map! exists for
hysterical raisins. Lacking any direct comparison in the help, the two
replies and scrolling up and down and around in the help has led me to
form the tentative view that the various disjoint tables do not offer an
integrated view of mapping, and the real Overview lies in *map-listing*.
If <Space> == " map" in that list, then all the other tables serve only
to confuse by needlessly fragmenting the picture, AFAICT.

FWIW, I think that it would be possible to respect the holy 80 column
limit, yet present one table providing a complete Overview at
*map-overview*, not just the present partial thing, if the "modes:"
headings were changed to "I C L N V S O P", with preceding expansions of
same. Entries need only be "y" or "-".

...

> Another way to think about map! is that in runs in the same context as
> abbreviations, but without all the weirdness of abbreviations: maps
> with multicharacter left-hand-sides (lhs) run when the sequence is
> entered fast enough; abbreviations have no timeout, but wait for an
> additional character that indicates a break has been reached. Maps
> will recurse, abbreviations will not. The rhs of an abbreviation will
> be checked for maps, however.

Not being a table-driven state machine, I find that such descriptions of
_what_ should happen foster easy adoption of a simple abstract view,
whereas a sprinkling of discontiguous tables showing partial views of
_how_ stuff behaves to be the string of pearls broken and rolling on the
floor.

But taking the list at *map-listing* to be the true Overview, I can save
a week of scrolling about various tables, and immediately see:

map = nmap + vmap + smap + omap
map! = imap + cmap

If a LHS column were added to that list, adding the corresponding ?map
on each line, then it would be a much better Overview for the Vim help
than is currently present. It would then also be explicit that <Space>
means "map".

Erik


--
Rising levels of CO2 around the world will significantly impact the nutrient
content of crops according to a new study. Experiments show levels of zinc, iron
and protein are likely to be reduced by up to 10% in wheat and rice by 2050.
- http://www.bbc.com/news/science-environment-27308720

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: