matze/vim-move

Plugin to move lines and selections up and down

Vim Script

1,268

130 commits

updated Feb 1, 2026

See the code

README

move

It's annoying to delete and paste parts of a text just to move it up/down or left/right a bit. There is the :m[ove] command but it is quite awkward to use by todays standards. vim-move is a Vim plugin that moves lines and selections in a more visual manner. Out of the box, the following keys are mapped in visual and normal mode:

<A-k>   Move current line/selection up
<A-j>   Move current line/selection down
<A-h>   Move current character/selection left
<A-l>   Move current character/selection right

The mappings can be prefixed with a count, e.g. 5<A-k> will move the selection up by 5 lines.

Features:

  • vertical motions
  • horizontal motions
  • automatic indentation
  • undo multiple moves with single :undo

See this short demo for a first impression:

vim-vertical-move demo

vim-horizontal-move_demo

Installation

vim-move is compatible with all major plugin managers. To install it using Vundle, add

Bundle 'matze/vim-move'

to your .vimrc.

To install it using vim-plug, add

Plug 'matze/vim-move'

to your .vimrc.

Customization

Use g:move_key_modifier to set a custom modifier for key bindings in normal mode. For example,

let g:move_key_modifier = 'C'

which will create the following key bindings:

<C-k>   Move current line/selections up
<C-j>   Move current line/selections down

Use g:move_key_modifier_visualmode to set a custom modifier for key bindings in visual mode. For example,

let g:move_key_modifier_visualmode = 'S'

which will create the following key bindings:

<S-k>   Move currently selected block up
<S-j>   Move currently selected block down

And so on...

NOTE

Both g:move_key_modifier and g:move_key_modifier_visualmode default to 'A' for backwards compatibility with previous versions of vim-move.

If the default mappings do not work, see the move_normal_option option in the help doc.

License

This plugin is licensed under MIT license.

vim
vim-plugin

matze/vim-move

Plugin to move lines and selections up and down

Vim Script

1,268

130 commits

updated Feb 1, 2026

See the code

README

move

It's annoying to delete and paste parts of a text just to move it up/down or left/right a bit. There is the :m[ove] command but it is quite awkward to use by todays standards. vim-move is a Vim plugin that moves lines and selections in a more visual manner. Out of the box, the following keys are mapped in visual and normal mode:

<A-k>   Move current line/selection up
<A-j>   Move current line/selection down
<A-h>   Move current character/selection left
<A-l>   Move current character/selection right

The mappings can be prefixed with a count, e.g. 5<A-k> will move the selection up by 5 lines.

Features:

  • vertical motions
  • horizontal motions
  • automatic indentation
  • undo multiple moves with single :undo

See this short demo for a first impression:

vim-vertical-move demo

vim-horizontal-move_demo

Installation

vim-move is compatible with all major plugin managers. To install it using Vundle, add

Bundle 'matze/vim-move'

to your .vimrc.

To install it using vim-plug, add

Plug 'matze/vim-move'

to your .vimrc.

Customization

Use g:move_key_modifier to set a custom modifier for key bindings in normal mode. For example,

let g:move_key_modifier = 'C'

which will create the following key bindings:

<C-k>   Move current line/selections up
<C-j>   Move current line/selections down

Use g:move_key_modifier_visualmode to set a custom modifier for key bindings in visual mode. For example,

let g:move_key_modifier_visualmode = 'S'

which will create the following key bindings:

<S-k>   Move currently selected block up
<S-j>   Move currently selected block down

And so on...

NOTE

Both g:move_key_modifier and g:move_key_modifier_visualmode default to 'A' for backwards compatibility with previous versions of vim-move.

If the default mappings do not work, see the move_normal_option option in the help doc.

License

This plugin is licensed under MIT license.

vim
vim-plugin

Project health

Overall

3.5/10

Maintained

0/10

Code review

10/10
OpenSSF Scorecard

Significant stargazers

William Boman

1,021 followers · starred Jan 2021

Pablo Galindo Salgado

1,197 followers · starred Sep 2016

Aaron Lichtman

515 followers · starred Jun 2023

Matt Perpick

121 followers · starred Feb 2014