Sorting folds is way too tedious in vanilla vim... We're forced to:
- Join the lines of each individual fold into one
- Run
:sort
on them - Split the lines back up
vim-sort-folds
aims to help by introducing a function, sortfolds#SortFolds
, to sort the folds of
a visual selection all at once.
Since folds can be created in a variety of ways, this can be especially handy for sorting arbitrary groups of content based on their first line.
- Visually select the folds you'd like to sort
:call sortfolds#SortFolds()
If you find yourself doing this frequently enough, you can bind it to a command and speed things up even further!
vim-sort-folds
is compatible with most plugin managers. Just drop something like the following
into your .vimrc
:
NOTE: This plugin (unapologetically) requires +python3
.