IndentWise: A Vim Plugin for Indent-Depth (and -Level) Based Motion

They're very awkward to me. I'm not good with that upper-right area of the keyboard. I can hit any of them pretty well, coming from home position, or while typing, but hitting two of them in a row feels too hard, especially for potentially commonly-used movement keys.

As these are about indents, I like to use the indent keys (< and >). Here's my take on things:

nnoremap <silent> <, :<C-U>call <SID>move_to_indent_level(0, 0, -1, 1, 0, 0)<CR>
nnoremap <silent> >, :C-U>call <SID>move_to_indent_level(0, 1, -1, 1, 0, 0)<CR>
nnoremap <silent> <> :<C-U>call <SID>move_to_indent_level(0, 0,  0, 1, 0, 0)<CR>
nnoremap <silent> >< :<C-U>call <SID>move_to_indent_level(0, 1,  0, 1, 0, 0)<CR>
nnoremap <silent> <. :<C-U>call <SID>move_to_indent_level(0, 0, +1, 1, 0, 0)<CR>
nnoremap <silent> >. :<C-U>call <SID>move_to_indent_level(0, 1, +1, 1, 0, 0)<CR>
nnoremap <silent> <: :<C-U>call <SID>move_to_absolute_indent_level(0, 0, 1, 0, 0)<CR>
nnoremap <silent> >: :<C-U>call <SID>move_to_absolute_indent_level(0, 1, 1, 0, 0)<CR>

I don't know if you'll like these, but the thinking is that the first key is < to mean move left/up in the file, or > to mean move right/down in the file, and the next key is the unshifted version of either of the same two keys, to mean outdent or indent. If instead you hold shift and arpeggio-roll to the opposite of whatever your initial choice is, it moves in the direction of the first key to the next matching line - that's basically a single keypress to me. I just favor the direction key as the first to actually strike. I tried several thoughts for these, including things like <i and >o (back to the previous indent and forward to the next outdent), but I really liked just using the < and > only, as they mean 'earlier' and 'later' in lines and the whole buffer in my head. In a few seconds I'm already using these without thinking.

I tried several things for the absolute mappings, like <= and </, but then realized that my pinky is always sitting on ; when I strike < or >, and as I'm already holding shift when striking either, I can immediately roll onto :. Something like 3<: is really easy and comfortable. Note: I don't like my mappings as much as yours in theory; the [ and ] pairings are well-defined in Vim, and I really love the -/=/+ trio for this idea. In practice, though, I wouldn't use these. They hurt the outside of my hand pretty quickly.

Anyway, just thought I'd share my solution for the mappings, in case you find it interesting. I think I'm going to keep this plugin (and my mappings ;) around. It's pretty cool. Thanks!

/r/vim Thread