Closed zegervdv closed 2 years ago
Hello! Right now I prefer to keep the trim
option simple so it should only trim whitespaces at the start and end of the string. But I've realized that there's no reason it should be the default, especially when there are tricky cases like yours. I've set it to false by default in the latest commit. It makes the plugin behaves the same way as normal yanking, which makes more sense I think.
I like your solution though and I agree this looks better. I'll think about improving the option.
I've modified the trim option so that it removes common indent on all lines, like you described. You only need to set trim
to true now.
Nice! Thanks for that.
When copying multiple lines with the trim option enabled, only the first whitespace is trimmed. E.g. when copying:
You will get:
This is of course because the copy function takes the full string, so it cannot know the lines (except if it would split them again, which will end up in concatting, splitting and concatting again in many cases).
I've created a small function that strips the common indent of the copied lines:
I wonder if this would be something worth integrating? Or mentioning in the README?
I still need to handle cases where the first line(s) are empty, probably could be done in a better way.