Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

shift-text.el — Shift Text Up/Down DWIM for Emacs

shift-text.el provides commands to move the current line or active region up or down, often referred to as “dragging” lines. It “Does What I Mean” by automatically detecting whether to move a single line or the selected region.

Features

  • Move current line or active region up/down with shift-text-up and shift-text-down
  • Automatically re-indents the moved text in supported major modes (see shift-text-indent-modes).

Installation

(add-to-list 'load-path "/path/to/shift-text.el")
(require 'shift-text)

Usage

Bind the commands to your preferred keys, for example:

(global-set-key (kbd "M-<up>") #'shift-text-up)
(global-set-key (kbd "M-<down>") #'shift-text-down)

You can also provide a prefix argument to move by multiple lines: C-u 5 M-<up> will move the text 5 lines up.

Testing

emacs -batch -l ert -l shift-text-tests.el -f ert-run-tests-batch-and-exit

License

GPL-3.0-or-later

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages