No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
}} |
}} |
||
To sort lines based on a visually-selected column: |
To sort lines based on a visually-selected column: |
||
− | http://mysite.verizon.net/astronaut/vim/index.html# |
+ | http://mysite.verizon.net/astronaut/vim/index.html#VISSORT |
Look under "Visual Block Sorting". It uses Piet Delport's vim-based binary insertion sort and some vim-glue to provide visual-block sorts! |
Look under "Visual Block Sorting". It uses Piet Delport's vim-based binary insertion sort and some vim-glue to provide visual-block sorts! |
||
Line 16: | Line 16: | ||
To enable it, put <bisort.vim> into your <.vim/plugin> directory. |
To enable it, put <bisort.vim> into your <.vim/plugin> directory. |
||
− | To |
+ | To perform sorting with Vissort, based on a visual-block selection (ctrl-v): |
:'<,'>Vissort |
:'<,'>Vissort |
||
+ | |||
+ | If you're using vim 7.0 or later, vissort.vim will use vim's internal sort command rather than the binary insertion sort script. |
||
To sort a visually-selected block (and leave the text outside the block in place): |
To sort a visually-selected block (and leave the text outside the block in place): |
||
Line 29: | Line 31: | ||
Or, using Piet Delport's binary insertion sort: |
Or, using Piet Delport's binary insertion sort: |
||
:'<,'>B Bisort |
:'<,'>B Bisort |
||
+ | |||
+ | Of course, you can use vim's internal sort if you're using vim 7.0 or later, too: |
||
+ | :'<,'>B sort |
||
Examples: Original, visual-block select the central column |
Examples: Original, visual-block select the central column |
Revision as of 22:18, 13 November 2007
created October 16, 2003 · complexity basic · author Charles E. Campbell · version 6.0
To sort lines based on a visually-selected column: http://mysite.verizon.net/astronaut/vim/index.html#VISSORT
Look under "Visual Block Sorting". It uses Piet Delport's vim-based binary insertion sort and some vim-glue to provide visual-block sorts!
To enable it, put <bisort.vim> into your <.vim/plugin> directory.
To perform sorting with Vissort, based on a visual-block selection (ctrl-v):
:'<,'>Vissort
If you're using vim 7.0 or later, vissort.vim will use vim's internal sort command rather than the binary insertion sort script.
To sort a visually-selected block (and leave the text outside the block in place): http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
Look under "Visual Block Commands". The <vis.vim> plugin provides a command which allows other commands to be applied only to the visually selected block.
To then perform sorting of just a visual-block (ctrl-v):
:'<,'>B !sort
Or, using Piet Delport's binary insertion sort:
:'<,'>B Bisort
Of course, you can use vim's internal sort if you're using vim 7.0 or later, too:
:'<,'>B sort
Examples: Original, visual-block select the central column
one two three four five six seven eight nine ten eleven twelve
:'<,'>Vissort seven eight nine ten eleven twelve four five six one two three
:'<,'>B !sort one eight three four eleven six seven five nine ten two twelve
:'<,'>B Bisort one eight three four eleven six seven five nine ten two twelve
Comments
vissort has been updated to version 3: it now has BlockSort() which permits one to sort blocks of text based on tags contained within them.
For Windows users only: Visual blocking is done with Ctrl-q. Do not use the arrow key to make the block, use only h-j-k-l.