sponsor Vim development Vim logo Vim Book Ad

reorder-columns : reorder columns.

 script karma  Rating 7/3, Downloaded by 801  Comments, bugs, improvements  Vim wiki

created by
omi taku
 
script type
utility
 
description
reorder columns.
https://github.com/taku-o/vim-reorder-columns

command format.
    :[range]ReOrder {split_pattern} {order} [{delimiter}]

        {split_pattern}         split line with {split_pattern}.
        {order}                 column order.
        {delimiter}             string for join column. if none, use {split_pattern} instead.

command example.
    :%ReOrder , 32451 |
        split line with ','
        order columns, column[3] column[2] column[4] column[5] column[1]
        join columns with delimiter '|'

        example
            text data.
                one,two,three,four,five
                six,seven,eight,nine,ten
                eleven,twelve,thirteen,fourteen,fifteen

            command
                :%ReOrder , 32451 |

            result
                three|two|five|four|one
                eight|seven|ten|nine|six
                thirteen|twelve|fifteen|fourteen|eleven

usage example.
    --------------------------------------------
    example text data 1.
        one,two,three,four,five
        six,seven,eight,nine,ten
        eleven,twelve,thirteen,fourteen,fifteen

    usage example 1. re order columns.
        :%ReOrder , 32451

        three,two,four,five,one
        eight,seven,nine,ten,six
        thirteen,twelve,fourteen,fifteen,eleven

    usage example 2. remove some columns.
        :%ReOrder , 32

        three,two
        eight,seven
        thirteen,twelve

    usage example 3. repeat some columns.
        :%ReOrder , 3233

        three,two,three,three
        eight,seven,eight,eight
        thirteen,twelve,thirteen,thirteen

    --------------------------------------------
    example text data 2.
        one two three four five
        six seven eight nine ten
        eleven twelve thirteen fourteen fifteen

    usage example 4. split with whitespace. sorry, join with whitespace is not supported.
        :%ReOrder \s\+ 32451 ,

        three,two,four,five,one
        eight,seven,nine,ten,six
        thirteen,twelve,fourteen,fifteen,eleven
 
install details
copy reorder-columns.vim into your plugin directory.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-reorder-columns.zip 0.1 2011-05-25 7.0 omi taku Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github