Vim has an inbuilt
:sort function that can be used to sort lines. However, I recently had to sort words in a line. I could have broken the line and put each word on one line, sort them and put the results back as a line. Thankfully, I found the AdvancedSorters plugin for Vim that does this job easily in one command.
Install it from this URL:
To sort the words in a line, I just visually block the line and press
: (colon) and then type the command
Tried with: Vim 7.4 and Ubuntu 16.04