vim for people who would rather not use vim

Eric Wald eswald at brainshell.org
Mon Jan 28 15:19:19 MST 2013


On Sat, Jan 26, Dave Smith wrote:
> On Jan 26, 2013, at 7:13 AM, Stuart Jansen wrote:
>
>> I would argue that true vim enlightenment is not achieved until you're
>> rarely using hjkl for movement. Instead search to move (/ or ? followed
>> by n or N) then take bigger steps using non-character-based movement. By
>> that I mean mostly: wb0^% but if you're editing prose it can also be
>> handy to use: (){}. And that just the basics, I still haven't trained
>> myself to use awesome movement commands like %.

I find myself using * or [d to search as often as /.  Granted, I've
mapped [d to find function definitions, and there are plenty of other
movement commands I've yet to learn.  [^I, anyone?

> I am a huge fan of % movement, which I use for languages that make
> heavy use of braces and parens, presently JavaScript. But then I
> started writing Python code full time. Now I'm stuck. I suspect Ruby
> poses the same problem for Vimmers.
>
> Help us, Vim masters of the world: How to jump to the end of a Python
> block?

There are ways, but despite using Vim to edit Python almost daily, I
don't use them.  Instead, I rely mostly on fdm=indent with the spacebar
mapped to za, and strategic placement of blank lines.

Call it heresy, but I have a habit of using whitespace-only lines in my
code, with the indentation level of the following line.  That lets me
skip over whole top-level blocks with { and }.  For nested blocks, I
have the following in .vim/ftplugin/python.vim:

nnoremap <silent> <buffer> ) /^\s*\zs$<CR>
nnoremap <silent> <buffer> ( ?^\s*\zs$<CR>

Sometime, I might change those to consider the indentation of the
current line, but it hasn't bugged me enough yet.

- Eric


More information about the PLUG mailing list