Created
December 31, 2018 10:30
-
-
Save romainl/6351afff54003b3d58c5d9c56f9960e5 to your computer and use it in GitHub Desktop.
Sort operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Sort(type, ...) | |
'[,']sort | |
endfunction | |
nmap <silent> <key> :set opfunc=Sort<CR>g@ | |
" usage: | |
" <key>ip | |
" <key>G |
Indeed but :help :sort
has a few tricks up its sleeve that GNU sort or BSD sort don't, and it's built-in so it can be used anywhere.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively:
!<motion/textobject>sort<enter>
to leverage GNU coreutils sort. For example:!ipsort<CR>
.