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

Accept counts for python assignments #140

Open
urbainvaes opened this issue Jul 20, 2018 · 1 comment
Open

Accept counts for python assignments #140

urbainvaes opened this issue Jul 20, 2018 · 1 comment

Comments

@urbainvaes
Copy link

urbainvaes commented Jul 20, 2018

At the moment, gJ from the beginning of the first line of

a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
g = 7
h = 8

gives

a, b, c, d, e, f, g, h = 1, 2, 3, 4, 5, 6, 7, 8

It would be nice if the mapping gJ would accept a count, to allow joining a given number of lines.

@AndrewRadev
Copy link
Owner

An interesting idea. It feels like most operations that take a count work on a single line by default, and the count "increases" their effect. In this case, it'd be the opposite, a count would limit their effect area. So it feels wrong to me in that regard, but then I don't use counts much anyway, so who knows.

I've implemented the functionality -- it turns out it's not particularly difficult -- but there's a bit of a rub. The plugin uses a clever setup to use gJ as an override, but, if you give it a count, falls back to the built-in gJ.

Currently, you could use the functionality by setting the mapping yourself:

nmap <silent> gJ <Plug>SplitjoinJoin

But I'll think about what I could do to make it available. Maybe a setting to disable the fancy fallback behaviour...

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