Global indent

Joshua Landau joshua at landau.ws
Sat Aug 23 10:19:30 EDT 2014


(Since this is already an editor war...)

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.

For example, to make a numbered list in (my) Sublime Text (fully
custom shortcuts ahead):

Alt-1 Alt-0 Alt-0   to repeat the next command 100 times
Enter               to insert 100 new lines, so 101 in total
Ctrl-A              to select all text (can be done more fancily, but
keep this simple for now)
Ctrl-l              to select lines (creates multiple selections),
ignoring the blank end of selection
$:                  to write some text
Ctrl-Shift-Home     to select to beginning of line
Ctrl-e              to replace $ with consecutive numbers (also
supports using Python's {} with all of its formatting options)

With an increment function and macros:

1:                  to write some text
Ctrl-q              to start macro recording
Ctrl-d              to duplicate line (and select it)
Left                to go to start of selection
INCREMENT           to increment number (emulated by evaluating
"1+number" with Python [1, +, Ctrl-left, Shift-Home, Ctrl-Shift-e])
Ctrl-q              to finish macro recording
Alt-1 Alt-0 Alt-0   to repeat the next command 100 times
Ctrl-Shift-q        to repeat macro

Compare with Vim:
http://stackoverflow.com/questions/4224410/macro-for-making-numbered-lists-in-vim



More information about the Python-list mailing list