Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

indent lines after moving #23

Open
gilligan opened this Issue Nov 10, 2012 · 1 comment

Comments

Projects
None yet
2 participants

It would be nice if lines would be indented (=) after moving. For single lines it should(?) be as trivial as:

function! s:Move(cmd, count, map) abort
  normal! m`
  exe 'move'.a:cmd.a:count
  norm! ``
  normal! =$
  silent! call repeat#set("\<Plug>unimpairedMove".a:map, a:count)
endfunction

For the xnoremap up movement it would need something like

exe = . v:count1 . j

but i don't quite grasp the mapping as it is. In either case: i think it would be very useful and there's little chance of this having a negative impact for anyone unless i'm missing something right now.

Owner

tpope commented Nov 11, 2012

You can't really count on =. It'll fuck shit up bad in a whitespace sensitive language like Python or Haml, and even in normal languages, indenting algorithms have bugs. The right solution would be to shift the entire block left or right based on the first line, like ]p does, but that's more than a bit harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment