sponsor Vim development Vim logo Vim Book Ad

flipwords.vim : Provides the command Flip that changes the order of two delimited words

 script karma  Rating 0/0, Downloaded by 1026  Comments, bugs, improvements  Vim wiki

created by
Marko Mahnič
 
script type
utility
 
description
Flipwords

The plugin Flipwords provides the command Flip that changes the order of two delimited words on a single line.

Examples

    Flip - flip two white-space delimited words
    Flip , - flip two items in a comma-delimited list
    Flip , ) - flip last two parameters (nested parens are not handled)
    Flip = ; - flip two words delimited by '=' and ';' (c assignment)
    Flip = )\zs - flip two words delimited by '=' where the second word ends with and includes ')'

Some effects of the Flip command (the coursor is at the character following '|'):

    ~~ let |b = a
    :Flip =
    ~~ let |a = b

    ~~ call doThis(|"one", "two", "three")
    :Flip ,
    ~~ call doThis(|"two", "one", "three")

    ~~ call doThis("one", |"two", "three")
    :Flip ,
    ~~ call doThis("one", |"three"), "two"

    ~~ call doThis("one", |"two", "three")
    :Flip , )
    ~~ call doThis("one", |"three", "two")

    ~~ if |result == getValue() " some comment
    :Flip == )\zs
    ~~ if |getValue() == result " some comment

Repository: https://github.com/mmahnic/vim-flipwords
Similar plugin: vimscript #2843 (FlipLR)
 
install details
Unpack into Vim runtime directory (eg. ~/.vim/) or use pathogen.
 

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
flipwords-0.1.zip 0.1 2012-04-17 7.0 Marko Mahnič Initial upload
ip used for rating: 18.97.14.83

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