AndrewRadev/sideways.vim

Make :SidewaysRight (etc) take a count?

calmofthestorm opened this issue · 7 comments

Thanks for writing this, it's a huge timesaver already!

Is there a way for me to make Sideways bindings take a count? eg, if I bind gs to :SidewaysRight, using 2gs to do:

(hello, world, today) -> (world, today, hello)

It would also be awesome if it could support repeat.vim (https://github.com/tpope/vim-repeat), so you can use . to repeat swaps.

Thanks again!

Is there a way for me to make Sideways bindings take a count?

I'm in the middle of implementing something similar for the text objects, in issue #7. It makes sense to also add counts to the left and right motions, but I'd like to finish that issue first, so I can have a clean slate to work with.

How do you think that the counts should work in terms of looping? If you have 3 items and you type 4gs, should the argument loop around, or should it just go to the end?

It would also be awesome if it could support repeat.vim

Technically, it does, you can press . right now to perform another swap. Do you have a problem with the current implementation or did you just not know about it (I should check if I have it written down in the docs, I'm not sure)?

Thanks for writing this, it's a huge timesaver already!

Thank you for the kind words, I'm glad to hear it helps :).

Personally I'd have it loop around but I don't feel strongly. Another option is ala vim-outliner's levels -- 1-8 are the count, 9 is "all the way"

As to ., perhaps it's something about my bindings? I bind like:
nnoremap gs :SidewaysRight
nnoremap gS :SidewaysLeft

Works fine without ., but using . results in SidewaysRight being inserted as text.

I think github may have stripped some code, I guess the mappings you have are like this:

nnoremap gs :SidewaysRight<cr>
nnoremap gS :SidewaysLeft<cr>

Is this correct?

Also, could you double-check that you have vim-repeat installed, just so we're sure it's not that.

Yes, the CR is there in my config. It looks exactly like what you posted. I verified that vim-repeat is installed. Thanks!

(I can do a clean config in the morning if nothing is coming to mind; to rule out other plugins interfering)

I figured out my issue was due to hacking Dvorak keybindings. (Still not sure why, but removing them makes . work correctly). Specifically, 'noremap : s' is the cause of the problem. Anyway, thanks for the thoughts! Leaving issue open because it's mostly about counts.

That's good news, I guess. And yeah, I need to get to the counts, but I've been a bit busy for a while. I'll see what I can do about it.