*move.txt* Moving lines and selections up and even down

Author: Matthias Vogelgesang <github.com/matze>
License: MIT (see |move-license|)

===============================================================================
Contents                                                        *move-contents*

    1. Usage..................................|move-usage|
    2. Mappings...............................|move-mappings|
    3. License................................|move-license|
    4. Changelog..............................|move-changelog|

===============================================================================
1. Usage                                                           *move-usage*

The move plugin is used to move lines and visual selections up and down by
wrapping the :move command.

===============================================================================
2. Mappings                                                     *move-mappings*

To enable custom key maps you must disable the automatic key maps with >

    let g:move_map_keys = 0

The plugin provide finger-friendly mappings to move text around by using <jk>
keys. You can specify the key modifier that is used in key bindings with >

    let g:move_key_modifier = 'M'

Mapping the meta ("alt") key may not work on certain terminals, in this case
you have to map each key directly and may have to use an escape sequence using
<C-v>. On Mac you may also have to change the interpretation of the meta key
in the options (Terminal: "Use Option as Meta key", iTerm: "Left option key
acts as +Esc").

All mappings can be prefixed with a {count} and will move {count} steps
instead of one.

By default the plugin indents the buffer after every up/down move operation.
Can be disabled with >

    let g:move_auto_indent = 0

By default the left/right move operations can move text beyond the limit of
the line. Can be disabled with >

    let g:move_past_end_of_line = 0

By default subsequent move operations in the same direction use |:undojoin| so
that all of them are undone after hitting |:undo| once. Can be disabled with >

    let g:move_undo_join = 0

It is also possible to uses |:undojoin| for all moves, regardless of motion
direction with >

    let g:move_undo_join_same_dir_only = 0

Move block vertically can work in two different ways:
- Default: MoveBlockCountLines. It moves a block count lines above or below.
  Default count is 1. Examples:
  - Vjj<A-k>  selects current line and next two and moves block 1 line above.
  - Vjj4<A-k> selects current line and next two and moves block 4 lines above.
              Top of block will reach 6 lines above cursor position.
- Opt-in: MoveBlockRelativeLines. If count is absent, it moves one line up or
  down (same as default mode). If count is present, it determines the
  destination line for moving block, considering relative line numbers. That
  line number must be outside the block, or else nothing will happen.
  Examples:
  - Vjj<A-k>  selects current line and next two and moves block 1 line above.
  - Vjj4<A-k> selects current line and next two and moves block so that its top
              reaches 4 lines above the cursor. The distance will be 2 lines up.
  - Vjj2<A-k> selects current line and next two. 2 lines above is still inside
              selected block, so nothing will happen.

To enable behavior MoveBlockRelativeLines, add setting >

    let g:move_block_relative_lines = 1

If default bindings are not working with vim-move, try setting >

    let g:move_normal_option = 1

-------------------------------------------------------------------------------
2.1 <Plug>MoveBlockCountLinesDown

Move selected block down by one line.

Default: vmap <A-j> <Plug>MoveBlockCountLinesDown

-------------------------------------------------------------------------------
2.2 <Plug>MoveBlockCountLinesUp

Move selected block up by one line.

Default: vmap <A-k> <Plug>MoveBlockCountLinesUp

-------------------------------------------------------------------------------
2.3 <Plug>MoveBlockRelativeLinesDown

Move selected block until it reaches line "count" below current line, or, if no
count is supplied, down by one line.

-------------------------------------------------------------------------------
2.4 <Plug>MoveBlockRelativeLinesUp

Move selected block until it reaches line "count" above current line, or, if no
count is supplied, up by one line.

-------------------------------------------------------------------------------
2.5 <Plug>MoveBlockLeft

Move selected block left by one column.

Default: vmap <A-h> <Plug>MoveBlockLeft

-------------------------------------------------------------------------------
2.6 <Plug>MoveBlockRight

Move selected block right by one column.

Default: vmap <A-l> <Plug>MoveBlockRight

-------------------------------------------------------------------------------
2.7 <Plug>MoveLineDown

Move current line down by one.

Default: nmap <A-j> <Plug>MoveLineDown

-------------------------------------------------------------------------------
2.8 <Plug>MoveLineUp

Move current line up by one.

Default: nmap <A-k> <Plug>MoveLineUp

-------------------------------------------------------------------------------
2.9 <Plug>MoveCharLeft

Move current line left by one.

Default: nmap <A-h> <Plug>MoveCharLeft

-------------------------------------------------------------------------------
2.10 <Plug>MoveCharRight

Move current line right by one.

Default: nmap <A-l> <Plug>MoveCharRight

-------------------------------------------------------------------------------
2.11 <Plug>MoveBlockHalfPageDown

Move selected block down by half a page size.

Default: not mapped

-------------------------------------------------------------------------------
2.12 <Plug>MoveBlockHalfPageUp

Move selected block up by half a page size.

Default: not mapped

-------------------------------------------------------------------------------
2.13 <Plug>MoveLineHalfPageDown

Move current line down by half a page size.

Default: not mapped

-------------------------------------------------------------------------------
2.14 <Plug>MoveLineHalfPageUp

Move current line up by half a page size.

Default: not mapped

===============================================================================
3. License                                                       *move-license*

This plugin is copyright by Matthias Vogelgesang and licensed under the MIT
license.

===============================================================================
3. Changelog                                                   *move-changelog*

v1.4
    * Released on 08/19/18
    * New functionality for moving horizontally
    * Add g:move_past_end_of_line to control the move to the right.

v1.3
    * Released on 03/18/14
    * Add g:move_auto_indent option to en-/disable auto indentation
    * Do not modify readonly buffers
    * Silence :move commands to avoid first-time errors on read-only files.

v1.2
    * Released on 08/14/13
    * Add key modifier for bindings (@vitalk)
    * Use <A-j> and <A-k> in normal and visual mode (@vitalk)
    * Add <Plug>Move{Block,Line}HalfPage{Up,Down} to move text in larger
      increments.
v1.1
    * Released on 08/10/13
    * Minor bug fixes (helptags, mapping, docs)
v1.0
    * Released on 08/10/13

vim:ft=help:
