sponsor Vim development Vim logo Vim Book Ad

LineJugglerCommands : Commands to duplicate and move around lines.

 script karma  Rating 2/2, Downloaded by 174    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
Most of the line manipulation mappings of the LineJuggler.vim plugin can
also be done with built-in Ex commands like :move, :put, etc. This plugin
adds those commands that do not exist (in a simple form) as built-in commands.
Sometimes, a command is just more practical (e.g. in a script), more
repeatable (from the command-line history), or offers different line
addressing.
Namely, this plugin provides a :Swap command to exchange two ranges of
lines (or with a register), and a similar :Replace command.

SOURCE
Inspired by the following Stack Overflow question:
    http://stackoverflow.com/questions/15296393/line-swapping-in-vim/15298132

SEE ALSO
- This plugin is based on the functionality of the (required) LineJugger.vim
  plugin (vimscript #4140), which offers many mappings to quickly duplicate
  and move lines to above / below the current line.
- ReplaceWithRegister.vim (vimscript #2703) provides normal and visual mode
  gr commands that are similar to the :Replace Ex command.

USAGE
:[range]Swap {range}    Exchange the current line / line(s) given by [range]
                        with the lines in {range}.
:[range]Swap [["]x]     Exchange the current line / line(s) given by [range]
                        with the text from register [x]. This always works
                        linewise, like a combination of :delete [x] and
                        :put.

:[range]Replace {range} Replace the current line / line(s) given by [range]
                        with the lines in {range}.
:[range]Replace [["]x]
                        Replace the current line / line(s) given by [range]
                        with the text from register [x]. This always works
                        linewise, like a combination of :delete and
                        :put.

                        Note: To use one of the numbered registers 1-9, you
                        need to prepend the optional double quotes ("1 - "9),
                        in order to disambiguate them from the absolute lines
                        1 - 9.
 
install details
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim LineJugglerCommands*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.002 or
  higher.
- Requires the LineJuggler.vim plugin (vimscript #4140), version 2.10 or
  higher.
 

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
LineJugglerCommands-1.20.vmb.gz 1.20 2014-06-19 7.0 Ingo Karkat - ENH: Also allow to pass a [x] register to the :Replace command, and replace the range with its contents.
- ENH: Also allow to pass a [x] register to the :Swap command, and put the range into the register and vice versa.
LineJugglerCommands-1.10.vmb.gz 1.10 2014-06-11 7.0 Ingo Karkat - Add :Replace command. *** You need to update to LineJuggler.vim (vimscript #4140) version 2.10! ***
LineJugglerCommands-1.00.vmb.gz 1.00 2013-03-08 7.0 Ingo Karkat Initial upload
ip used for rating: 50.16.139.138

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.
   
SourceForge.net Logo