Global indent

Joshua Landau joshua at landau.ws
Sat Aug 23 16:57:56 EDT 2014


On 23 August 2014 17:17, Christian Gollwitzer <auriocus at gmx.de> wrote:
> Am 23.08.14 16:19, schrieb Joshua Landau:
>>
>> On 23 August 2014 10:41, Christian Gollwitzer <auriocus at gmx.de> wrote:
>>>
>>> Sometimes I impress my colleagues with what they call "magic", i.e.
>>> creating
>>> special repeated lists of numbers by a few keystrokes in gvim, and that
>>> has
>>> triggered the request from them to learn a bit of (g)vim.
>>
>>
>> I have yet to be truly impressed by Vim, in that Sublime Text with a
>> few extensions seems to do the same things just as easily. I find that
>> Vim and Emacs users consistently underrate the powers of these
>> editors, presumably because they've never put nearly as much effort
>> into them as they have into their Vim or Emacs.
>
>
> I never looked into Sublime, because it costs money. But no doubt it is a
> powerful editor, judging from comments of other people.

Ay, so is any editor with an API. I use Sublime mostly because it's
pretty, fast and has a Python-based API. The only actual feature it
has that some others don't is multiple selections, and even then a lot
do.

My point is more about how using Emacs or Vim and having a powerful
editor is mostly the symptom of the same thing, not a causal relation.

>> For example, to make a numbered list in (my) Sublime Text (fully
>> custom shortcuts ahead):
>>
>> [ ... some keystrokes ...]
>
> I'd actually do this in gvim to put numbers at each line:
>
> - Select text (by mouse, or v + cursor movements)
> - ! awk '{print NR ". " $0}'
>
> Yes, it is cheating, it pipes the selected text through an external tool.
> But why should I do the tedious exercise of constructing an editor macro,
> when an external tool like awk can do the same so much easier?

Because it normally happens more like this:

Move to copy something that I wish to postfix with a number
Ctrl-d a few times to select copies of that fragment
Write $ and select it
Press Ctrl-e to turn "$"s into numbers

Luckily that one doesn't happen too often either because numbering
things sequentially is better left to loops. The key binding is
primarily used for evaluating snippets of code inline.



More information about the Python-list mailing list