Home

Awesome

VIM-Schlepp

Schlepp in action

Vim plugin to allow the movement of lines (or blocks) of text around easily. Inspired by Damian Conway's DragVisuals from his More Instantly Better Vim

The big difference between this and dragvisuals is that schlepp is much faster when working over large selections of text, has more features, more configurable, and hopefully has fewer gotchas.

What it Does

Schlepp lets you move a highlighted (visual mode) section of text around, respecting other text around it.

Block and Line Selections work now.

Schlepp also lets you duplicate selections of text

Additionally run for more info

:help schlepp

Setup

Installation

Movement

Add the following mappings to your vimrc, feel free to change from using the arrows to something more to your vim usage.

vmap <unique> <up>    <Plug>SchleppUp
vmap <unique> <down>  <Plug>SchleppDown
vmap <unique> <left>  <Plug>SchleppLeft
vmap <unique> <right> <Plug>SchleppRight

When moving text left, Schlepp by default does not allow you to move left if any text is all the way left. To allow the 'Squishing' of text add this line to your vimrc

let g:Schlepp#allowSquishingLines = 1
let g:Schlepp#allowSquishingBlock = 1

To disable trailing whitespace removal on block move

let g:Schlepp#trimWS = 0

Schlepp can also reindent code as it moves. Any of these work

vmap <unique> i <Plug>SchleppToggleReindent

And if you have GVIM (or a fancy terminal?) this should work well.

vmap <unique> <S-up>   <Plug>SchleppIndentUp
vmap <unique> <S-down> <Plug>SchleppIndentDown

Duplication

Some suggested mappings

vmap <unique> D <Plug>SchleppDup

or if you want fine grained control

vmap <unique> Dk <Plug>SchleppDupUp
vmap <unique> Dj <Plug>SchleppDupDown
vmap <unique> Dh <Plug>SchleppDupLeft
vmap <unique> Dl <Plug>SchleppDupRight

or set the default direction for SchleppDup

let g:Schlepp#dupLinesDir = "down"
let g:Schlepp#dupBlockDir = "right"

To enable trailing whitespace removal on block duplication

let g:Schlepp#dupTrimWS = 1

Known Issues