A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/emacsfodder/move-text below:

emacsfodder/move-text: move current line or region up or down

Hi all, Please consider donating to this or any of my many of opensource projects.

MoveText allows you to move the current line using M-up / M-down (or any other bindings you choose) if a region is marked, it will move the region instead.

Using the prefix arg (C-u number or META number) will predetermine how many lines to move.

Install from MELPA (or MELPA stable)

M-x package-install move-text <RETURN>

If you want to use the default bindings, add the following to .emacs anywhere after (package-initialize):

(move-text-default-bindings)

This sets the keyboard shortcuts:

@jbreeden gave us this useful function advice to have Emacs re-indent the text in-and-around a text move.

(defun indent-region-advice (&rest ignored)
  (let ((deactivate deactivate-mark))
    (if (region-active-p)
        (indent-region (region-beginning) (region-end))
      (indent-region (line-beginning-position) (line-end-position)))
    (setq deactivate-mark deactivate)))

(advice-add 'move-text-up :after 'indent-region-advice)
(advice-add 'move-text-down :after 'indent-region-advice)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4