vim-cljfmt icon indicating copy to clipboard operation
vim-cljfmt copied to clipboard

ranges?

Open bhurlow opened this issue 10 years ago • 12 comments

possible to add support to only format a selected range?

bhurlow avatar Feb 11 '15 14:02 bhurlow

Hmm, interesting request. It's definitely possible but it's not a use case I had particularly considered before. How do you see the interface for this looking?

venantius avatar Feb 11 '15 17:02 venantius

I would want to map Cljfmt to = to be able to format only a specific closure. Just a thought!

bhurlow avatar Feb 11 '15 18:02 bhurlow

seems like this is more per file which is fine

bhurlow avatar Feb 11 '15 18:02 bhurlow

@venantius in agreement here – most plugins of this nature will allow you to select a range and then apply the transformation ie: :'<,'>Cljfmt

I think you'd be able to do this in terms of :[range]substitute

CurrentBufferContents would have to grab this range, and then line 69 where the actual substitution changes would have to run over that range as well.

You can also make it default to the whole file pretty easily as well, so it wouldn't break current behavior.

see http://stackoverflow.com/a/16164585 for more info. I might try to cook up a PR, but VimL isn't exactly my forte.

Cheers!

rbxbx avatar Feb 17 '15 15:02 rbxbx

I'm fairly new to vimL myself, so if you wanted to take a stab at a PR I'd certainly welcome it ;D

Otherwise I do think this'd be a neat feature, but it's going to be a secondary consideration until I get rid of all of the bugs first :bear:

venantius avatar Feb 18 '15 01:02 venantius

@venantius fair enough. I suspected a similar response :p

May take a stab at it one of these days. Until then, my code shall remain ugly // to my personal preferences.

Thanks for getting back!

rbxbx avatar Feb 24 '15 18:02 rbxbx

It's starting to percolate up to the shortlist; I've been doing a lot of bug fixing over the last few weeks. Don't write it off yet ;)

venantius avatar Feb 24 '15 18:02 venantius

Sorry to advertise my own project, but I just created alternative plugin which implements this: https://github.com/Deraen/vim-cider Edit: It doesn't support ranges but it supports motions

Deraen avatar May 17 '15 15:05 Deraen

@Deraen neat – I'll take a look at this :)

Realize movements/selections aren't huge for everyone, but they're pretty integral to my workflow.

Cheers!

ps: don't worry @venantius, still lots of love for ultra :)

rbxbx avatar May 18 '15 19:05 rbxbx

Haha, thanks @rbxbx !

If either you or @Deraen felt like submitting a PR here to add motions (which I'm sad to say I'm not familiar with), I'd love it :smile:

venantius avatar May 19 '15 03:05 venantius

Is there gonna be a release with ranges support

sushovannits avatar Feb 06 '20 04:02 sushovannits

Is all we're waiting for a formal release? I haven't been writing a lot of code lately :(

venantius avatar Feb 06 '20 09:02 venantius