Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This was a really nice refresher and I learned a few new cool tricks (like gx).

I'm a bit surprised that the 'u' flag for sort wasn't mentioned. That's the most useful one in my mind and I use it almost every time.



... I forgot it :D

I'll fix that. Thanks to point it out :)


Thank you for reading the comments and updating the article.


My thoughts exactly about ':sort u'


The u option making it keep only unique lines, for anyone else left wondering.

Personally, instead of re-learning how to do stuff with vim-sepecific commands, I just use the existing command line tool, especially since I don't do this on a daily/weekly basis (but I use sort in command line pipes at least weekly). The command is literally "sort" and for unique you just pass the -u flag, e.g. select something in Vim and type :!sort -u


Vim's sort is handy on Windows where the option to shell out usually doesn't exist. Additionally you have the full power of Vim regex to sort on subsets of lines.


On the other hand, the :! and ! commands are Vi compatible (though, as you say, you wouldn't get the additional features of :sort). So you get to pick who you're going to be compatible with: vi or Windows?


I can also do a subset of lines in the way I described, actually




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: