Only Change Buffer When Necessary
sbdchd opened this issue · 1 comments
Currently, when using vim-sort-motion on a portion of already sorted text, the buffer will be changed and a step will be added to the undo history.
Ideally, vim-sort-motion would only update and change the buffer when necessary.
Hey @sbdchd, thanks for writing in. I agree this would be better, but unfortunately I'm limited by the functionality provided by Vim. Specifically, the current implementation simply wraps operator-pending mappings around Vim's built in :sort
command. An alternate approach would be to shell out via :!sort
or similar, but both of these options will updated the buffer even if the text is unchanged.
If I'm not mistaken, then only way to do this would be to wrap and or implement the sorting in Vimscript, and that's more than I want to take on.
I'm going to close this issue now based on the thinking above, but please feel free to reopen or comment if you think I've missed something (or if you want to take a stab at an implementation).