Saturday, April 9, 2011

Re: Questions about: ! and . and lower case and upper case

On 04/09/2011 12:58 AM, Tony Mechelynck wrote:
> On 09/04/11 05:01, Rostyslaw Lewyckyj wrote:
>> 1) Does ! have a single general meaning, when it is added
>> to a command? i.e. Can one make any prediction as to where
>> a ! may show up and how it may change the behaviour of
>> the base command?
>
> For a command which writes to disk, adding ! usually forces a write. For
> a command which unloads a buffer, ! usually forces changes to be lost

I read the "!" as "and I mean it!" or "really, because I know
what I'm doing".

"w!" means "write the file, I mean it, even if it already exists"

"q!" means "quit the file, and I mean it, even if there are changes"

"function! Foobar(...)" means "create function Foobar as follows,
and I mean it, even if one already exists"

same with "command!"

>> 3) Are there any rules about the relationship of lower case
>> commands and upper case commands, such as: i vs I, d vs D,
>> visual vs Visual, etc.
>
> They often have a relationship, but not always and not one that could be
> taught to a machine by one simple rule.

A common pattern is that the uppercase version tweaks the
before/after nature of the command (e.g. "o/O" and "p/P") or
operates on the whole line (e.g. "v/V", "y/Y", "c/C", "s/S"; note
the odd exception in "d/D"). The outliers from those patterns
just take memorization.

> Similarly Ctrl-letter and g followed by letter. Here also,
> when in doubt, look up the help.
>
> Examples:
> q start/stop recording
> Q start Ex mode
> ^Q start block-visual (same as ^V)

gq A men's fashion & style magazine :) (okay, for reformatting
paragraphs...)

-tim

--
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

No comments: