Global indent

Tim Chase python.list at tim.thechases.com
Sat Aug 23 16:09:21 EDT 2014


On 2014-08-23 19:31, Steven D'Aprano wrote:
> Sorry, but I have no idea what you mean by "orthogonal set of verbs
> and nouns in an editing language". Can you explain?

In the context of vi/vim, an "orthogonal set of verbs and nouns in an
editing language" mean that you have a collection of verbs
(such as d=delete, v=visual/highlight, y=yank/copy, c=change, zf=fold,
gU=transform-to-uppercase, gu=transform-to-lowercase, g~=swap-case,
g?=ROT13, "="=reformat, etc) and nouns (often called "motions" as most
of them can be used to move the cursor in normal-mode) such as
b=back, }=next-paragraph-boundary, {=previous-paragraph-boundary,
"*"=next-match-of-the-word-under-the-cursor, etc.

They're orthogonal because learning a new verb allows you to apply it
to all of the nouns/motions you already know; and learning a new
noun/motion lets you use it with any of the verbs you know.  And you
can prefix any command (verb+noun) with a count which increases the
power further.

Thus, learning one new thing has a multiplying effect.

> I find that between find/replace and Block Selection editing, I
> can't really say I've missed either the lack of editing macros or
> these orthogonal verbs, whatever they are. Occasionally I move a
> large editing job into Python, but I wouldn't want to learn a
> separate language for that.

Much of the power comes in the repeatability of last action.  Once
the editor understands that your last action meant
"transform-to-uppercase from the cursor to the end of the line", you
can move anywhere else in the document and instruct the editor to do
the same thing with a single command (in vi/vim, that's the period).
Drew Neil's _Practical Vim_ spends quite a bit of ink covering the
implications of repeatability.

[from another message from Steven]
> When I'm programming, actual fingers on keys is just a small
> proportion of the time spent. Most of my time is reading, thinking
> and planning, with typing and editing a distant fourth, and I not
> only don't mind moving off the keyboard onto the mouse, but
> actually think that's a good thing to shift my hands off the
> keyboard and use a different set of muscles. So I'm not especially
> receptive to arguments that Vim or Emacs will make me more
> productive.

I agree that a much smaller percentage of my time is spent actually
entering text and a far greater amount of time is spent navigating
(reading/thinking/planning) the document.  Most vi/vim users spend
their time in normal mode where that navigation is quick and can all
be done from a keyboard.  I find that 


[and from yet another message from Steven]
> You need a tutorial for a text editor???
> 
> If that's supposed to prove how easy Emacs is, you have failed
> miserably.

Indeed, both vim and emacs provide tutorials precisely because they
are NOT so easy to get started with.  But while I might not need
instruction for a hand-saw to remove a small tree, if I had multiple
trees to cut down, I might want a chainsaw and seek to read the
instructions to get the most out of my investment.  And if I had a
LOT of trees to cut down, I might make a major investment
https://www.youtube.com/watch?v=LYKg0gbRFns and read the heck out of
the instructions.

I happen to use vi/vim because it works just about everywhere (and
even comes installed from the factory on most *nix-likes), but as long
as people are using an editor that is sufficient to meet their needs,
I'm content to live in amicable harmony.  It's when your needs exceed
what your editor can provide that I start to recommend
editor-shopping.  I can't help you if you choose something other than
Vim, but I can encourage complainers to use a more powerful editor.

[and yet one other message from Steven]
> Besides, the standard text editor is ed:

THERE is the truth ;-)  (and...it's far more powerful than Notepad)

-tkc









More information about the Python-list mailing list