Skip to content

Instantly share code, notes, and snippets.

@ktym
Last active December 20, 2015 02:09
Show Gist options
  • Save ktym/6054527 to your computer and use it in GitHub Desktop.
Save ktym/6054527 to your computer and use it in GitHub Desktop.
Configuration for multi-line editing mode in Emacs 24.
;;; library
(let ((default-directory "~/lib/lisp"))
(normal-top-level-add-subdirs-to-load-path))
;; multiple-cursors
; % git clone https://github.com/magnars/multiple-cursors.el.git
; % mv multiple-cursors.el lib/lisp/multiple-cursors
(require 'multiple-cursors)
(global-set-key (kbd "C-c l") 'mc/edit-lines)
(global-set-key (kbd "C-c ^") 'mc/edit-beginnings-of-lines)
(global-set-key (kbd "C-c $") 'mc/edit-ends-of-lines)
(global-set-key (kbd "C-c .") 'mc/mark-all-like-this)
(global-set-key (kbd "C-c >") 'mc/mark-next-like-this)
(global-set-key (kbd "C-c <") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c #") 'mc/insert-numbers)
(global-set-key (kbd "C-c s") 'mc/sort-regions)
(global-set-key (kbd "C-c r") 'mc/reverse-regions)
@ktym
Copy link
Author

ktym commented Jul 22, 2013

You can watch a really cool movie on this at http://emacsrocks.com/e13.html and the Mac version of Emacs 24.3 can be downloaded from http://emacsformacosx.com/ then create an alias to point this emacs as alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'

@ktym
Copy link
Author

ktym commented Aug 22, 2013

As the function string-prefix-p is only available for Emacs 23.3 or above, if you are still using older emacs (e.g., Emacs 23.1) you need to add the following code to your .emacs file:

(unless (fboundp 'string-prefix-p)
  (defun string-prefix-p (shorter longer)
    (let ((n (mismatch shorter longer))
         (l (length shorter)))
      (if (or (not n) (= n l)) l nil))))

purcell/emacs.d@26cb6ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment