New to python, do I need an IDE or is vim still good enough?
msirenef at lightbird.net
Tue Jan 1 19:43:36 CET 2013
On 12/31/2012 10:46 PM, Steven D'Aprano wrote:
> On Sat, 29 Dec 2012 14:00:23 -0500, Mitya Sirenef wrote:
>> I think the general idea is that with editors like Vim you don't get
>> distracted by having to do some kind of an editor task, letting you keep
>> your full attention on the code logic. For instance, if I need to change
>> a block inside parens, I type ci) (stands for change inside parens),
>> while with a regular editor I'd have to do it manually and by the time
>> I'm done, I'd forget the bigger picture of what I'm doing with the code.
> See, by the time I remembered what obscure (to me) command to type, or
> searched the help files and the Internet, I'd have forgotten what the
> hell it was I was trying to do. Well, almost. My memory is not quite that
> bad, but it would certainly be a much bigger disruption to my coding than
> just doing the edit by hand.
I would agree with you if I had to look up a command every time I use
it. The way it really works for me is that either I use a command often
enough that I remember it from the first time I looked it up, and the
memory is reinforced every time I use it, OR it's such a rare command
that looking it up is not a problem (obviously if it's faster to do it
by hand than to look it up, I can do that, as well, which in Vim means
using lower level commands that still don't require you leaving the home
> I do love the power of command line tools, but I think that for rich
> applications like editors, the interface is so clunky that I'd rather use
> a less-powerful editor, and do more editing manually, than try to
> memorize "hundreds" of commands.
Clunky is the last word I'd use to describe it (ok maybe for Emacs :-)
I probably remember about 200 commands, plus or minus, but a lot of them
fit into a consistent scheme which makes them much easier to remember:
there's (change delete yank vis-select)*(inner outer)*(letter word WORD
paragraph )]} )
(Where word includes 'keyword' characters and WORD is separated by spaces).
So, these correspond to commands (cdyv)(ia)(lwWp)]}).
Therefore, deleting 3 WORDs is 3daW (mnemonic: del a WORD 3 times).
I think I have a pretty bad memory but I remembered all of these
commands a few at a time without too much trouble. And they're extremely
useful even now as I'm editing this email.
> With a GUI app, I can run the mouse over the menus and see a high-level
> overview of everything the app can do in a matter of a second or two.
> (Perhaps three or five seconds if the app over-uses hierarchical menus.)
> But with a text interface, commands are much less discoverable. I can
> also use *spacial* memory to zero in on commands much more easily than
> verbal memory -- I have no idea whether the command I want is called
> "Spam" or "Ham" or "Tinned Bully Beef", but I know it's in the top
> quarter of the "Lunch" menu, and I will recognise it when I see it.
It's not a binary choice, GVim has a customizable menu system with a
simple text format for adding menus (from Vim manual):
To create a new menu item, use the ":menu" commands. They are
the ":map" set of commands but the first argument is a menu item
as a path of menus and submenus with a '.' between them. eg:
:menu File.Save :w<CR>
:inoremenu File.Save <C-O>:w<CR>
:menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g<CR>
> On the other hand, it's a lot harder to use a GUI app over a slow SSH
> connection to a remote machine in a foreign country over a flaky link
> than it is to use a command line or text-interface app.
With GVim, you can use gui menus just as easily when you open a file
>> Another example: >ap stands for "indent a paragraph (separated by blank
>> lines)". And there are many dozens if not hundreds such commands that
>> let you stay focused on the logic of your code.
> Ah yes, the famous "a for indent" mnemonic. *wink*
Well, 'a' is mnemonic for 'a', fittingly ;-). > is for indent, just as <
is for dedent. 'a' is to distinguish from inner paragraph command,
which omits blank lines after the paragraph (which matter for other
commands, but not for indent/dedent.): >ip .
Lark's Tongue Guide to Python: http://lightbird.net/larks/
More information about the Python-list