X
xDog Walker
“I bought some powdered water, but I don't know what to add.â€
Suggest to Stephen Wright to add hot coffee.
“I bought some powdered water, but I don't know what to add.â€
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.
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.
The trade-off, of course, is that you have to remember all (or most) of
the commands, but I figured if I spend the next 20-30+ years programming
in some version of Vim, it's well worth the initial investment.
By the way, to help me remember the commands, I wrote a small script
that lets me type in a few characters of a command or its description
and filters out the list of matching commands. It really helps,
especially when I change a lot of my mappings.
Absolutely! Though it's roughly as good to have the current cursor
position shown in a status line somewhere, and takes up less real
estate. But yes, vital to be able to see that. Even when I'm sitting
*right next to* my boss and communicating verbally, I'll talk about the
code by quoting line numbers. "Let me explain. (No, there is too much.
Let me sum up.) Pull up foobar dot jay ess and go to line 254-ish - see
how the frobnosticator always gets called with a quuxed argument?"
I call shenanigans
I don't expect that you keep in your head the line numbers (even the line
numbers-ish) of interesting or pertinent features of your code,
*especially* while the code is in active development and the line numbers
are rapidly changing. I think it is far more likely that you keep
function, class or method names in your head (after all, you are
presumably reading and writing those names very often), and when you want
to demonstrate some feature, you *first* look it up by higher-level
object ("let's see the frob_quux function") to get the line number.
Assuming that your functions and methods are not obnoxiously huge, I
think having a good class browser which lets you jump directly to
functions or methods is *far* more useful than line numbers, in this
context.
I must admit I find Apple's "help" search box neat this way - you
can type a keyword is it will actually find the menu item for
you. Not that I use this for vi, of course...
No, ">" is indent: it means shift-right. For Python you'd set
the shiftwidth to 4
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 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.
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.
:menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g said: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.
Ah yes, the famous "a for indent" mnemonic. *wink*
Mitya Sirenef said: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
At some point, it becomes muscle memory, which means you don't even
consciously know what you're typing. Your brain just says, "delete the
next three words" and your fingers move in some way which causes that to
happen. This is certainly true with emacs, and I imagine it's just as
true with people who use inferior editors
I used to do a bunch of pair programming with another emacs power user.
Every once in a while, one of us would say something like, "What did you
just do?", when the other performed some emacs technique one of us was
not familiar with. Invariably, the answer would be, "I don't know", and
you would have to back up and recreate the key sequence. Or, just run
C-? l, which tells you the last 100 characters you typed.
Case in point. I use C-? l moderately often, when I make some typo and
I'm not sure what I did wrong. But, despite the fact that my fingers
now how to perform "show me the last stuff I typed", I had to go hunting
to find the actual keystrokes which does that when typing the above
paragraph
'Aloha!
I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim.
Now it's python, and currently mainly on my kubuntu desktop.
Do I really need a real IDE, as the windows guys around me say I do, or will vim, git, make and other standalone tools make it the next 20 years too for me?
Oh, by the way, after 7 days I'm completely in love with this python thing. I should have made the switch much earlier!
/mogul %-)
Stick with what you've been using for the last couple of
decades. These tools have stood the test of time for a good
reason: they're powerful, efficient and made for the task of
programming.
emacs will parse that, highlight the filenames and line numbers
and if I type M-`, it'll take me to the line of the next error
(including opening the file if it's not already open).
I assume other smart editors have similar capabilities.
Different tools have different combinations of these, or
slightly different implementations. Find one you like and
learn all of it's capabilities. It makes a huge difference in
how productive you are.
Therefore, deleting 3 WORDs is 3daW (mnemonic: del a WORD 3 times).
Interesting. I typically use just d3w. 3daW seems to delete 3 lines
for me, the same result as d3<enter>. Another favorite command is d or
c followed by a number and then the right arrow key, for manipulating
letters instead of words.
In any case, I can be way more productive with just a few commands
(maybe 3 or 4 commands or concepts) in Vim than in almost any GUI
editor. In my experience, Vim users almost always find this to be true
for them as well. Vim really hits the sweet spot for productivity and
usability. The only thing about Vim that I find clunky is how code
folding macros work, and also code completion hacks (which I have never
needed anyway).
Interesting. I typically use just d3w. 3daW seems to delete 3 lines
for me, the same result as d3<enter>. Another favorite command is d or
c followed by a number and then the right arrow key, for manipulating
letters instead of words.
In any case, I can be way more productive with just a few commands
(maybe 3 or 4 commands or concepts) in Vim than in almost any GUI
editor. In my experience, Vim users almost always find this to be true
for them as well. Vim really hits the sweet spot for productivity and
usability. The only thing about Vim that I find clunky is how code
folding macros work, and also code completion hacks (which I have never
needed anyway).
On 01/01/2013 02:02 PM, Roy Smith wrote:
That's true with Vim, as well, especially when I'm making a custom
mapping and I can NEVER remember what some combination does, even though
if I actually needed to use it, it pops right out, so to find out, I
have to try it and then I say, "of course, dammit, I use this command 50
times every single day!"; so it's a curious case of one-directional
memory.
I use Eclipse only because it has PEP 8 and Pylint integration.
Ezio Melotti, core Python developer, said in personal chat, that he uses Kate.
IDEs aren't that useful when coding in Python.
I've found writing macros helps me a lot in this regard. I do
qa<stuff>q"aP
fairly frequently.
-W
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.