0
votes

I want an emacs binding (in evil mode) to take the selection and move it over one space at a time to the right, or to the left. For example, highlight five line, hit [some-key] and all five lines slide one space to the right, and hit [shift some-key] and all lines slide one space to the left.

1

1 Answers

0
votes

This might be a better approach than the one I had originally posted.

(defun jg-indent (start end count)
  (interactive "r\np")
  (save-excursion
    (let ((start (if (use-region-p)
                     start
                   (beginning-of-line)
                   (point)))
          (end (if (use-region-p)
                   end
                 (end-of-line)
                 (point))))
      (indent-rigidly start end count))))

(defun jg-unindent (start end)
  (interactive "r")
  (jg-indent start end -1))

(global-set-key "\C-c=" 'jg-indent)
(global-set-key "\C-c+" 'jg-unindent)