3 ms·
Wrote a post about sorting lines in Neovim, almost wrote an intro to Vim instead
- gigatexal 4y agoI just think it’s funny how my usage of vim is a borderline religion. I’m just so happy with it that I wanna share how to use it with everyone!
- stjohnswarts 4y agosort is one of those things I use fairly rarely (cli or nvim) but man when I need it, it is invaluable. Thanks for sharing.
- bheadmaster 4y agoI've been using Neovim for years now, and I didn't know about the sort command. Cool trick. I still don’t yet know how to list all the available commands (if you know, email me how to do this!) This command opens the command list in the reference manual: :help :ex-cmd-index<return>
- gigatexal 4y agoBeautiful! Thank you!!
- gigatexal 4y agoFor whatever reason in vim 9 and my astro nvim I can’t get the above command to work :shrug:
- bheadmaster 4y agoAh, I somehow added an extra ':', sorry. This should work: :help ex-cmd-index<return>
- gigatexal 3y agogave you a shoutout on the article, thanks again for the feedback. I love learning new things! https://gigatexal.blog/pages/how-to-sort-text-in-place-using-vim/how-to-sort-text-in-place-using-vim.html https://gigatexal.blog/pages/how-to-sort-text-in-place-using... I don't yet have #anchors to easily navigate but that's a task for another day :sweat_smile:
- gigatexal 4y agoThank you!
- comex 4y agoAnother tip: You can pipe text through shell commands with :! followed by the command. For example, I always used to use :!sort, until I accidentally dropped the ! once and noticed that it still worked. Most useful text-processing commands have some native way to do them in Vim, but I often haven't bothered to memorize them, when a shell command is just as easy to type and works in more contexts.