Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make :SidewaysRight (etc) take a count? #8

Open
calmofthestorm opened this issue Apr 27, 2014 · 7 comments
Open

Make :SidewaysRight (etc) take a count? #8

calmofthestorm opened this issue Apr 27, 2014 · 7 comments

Comments

@calmofthestorm
Copy link

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!

@AndrewRadev
Copy link
Owner

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 :).

@calmofthestorm
Copy link
Author

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.

@AndrewRadev
Copy link
Owner

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.

@calmofthestorm
Copy link
Author

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

@calmofthestorm
Copy link
Author

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

@calmofthestorm
Copy link
Author

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.

@AndrewRadev
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants