mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 05:03:03 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2329611a41
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
elpa
|
elpa
|
||||||
*.elc
|
*.elc
|
||||||
|
/.ecukes-failing-scenarios
|
||||||
|
@ -8,8 +8,7 @@ great success and much merriment.
|
|||||||
|
|
||||||
I highly recommend installing multiple-cursors through `package.el`.
|
I highly recommend installing multiple-cursors through `package.el`.
|
||||||
|
|
||||||
It's available on [marmalade](http://marmalade-repo.org/) and
|
It's available on [MELPA](http://melpa.org/) and [MELPA Stable](http://stable.melpa.org):
|
||||||
[melpa](http://melpa.milkbox.net/):
|
|
||||||
|
|
||||||
M-x package-install multiple-cursors
|
M-x package-install multiple-cursors
|
||||||
|
|
||||||
@ -204,7 +203,7 @@ Thanks!
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (C) 2012 Magnar Sveen
|
Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
Author: Magnar Sveen <magnars@gmail.com>
|
Author: Magnar Sveen <magnars@gmail.com>
|
||||||
Keywords: editing cursors
|
Keywords: editing cursors
|
||||||
|
@ -17,3 +17,24 @@ Feature: Insert increasing numbers
|
|||||||
When I press "C-u H-0"
|
When I press "C-u H-0"
|
||||||
And I press "SPC"
|
And I press "SPC"
|
||||||
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
|
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
|
||||||
|
|
||||||
|
Scenario: Three cursors, 0-1-2, default
|
||||||
|
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||||
|
When I set mc/insert-numbers-default to 1
|
||||||
|
And I press "H-0"
|
||||||
|
And I press "SPC"
|
||||||
|
Then I should see "This 1 text contains the word 2 text thrice (3 text)"
|
||||||
|
|
||||||
|
Scenario: Three cursors, 9-10-11, default
|
||||||
|
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||||
|
When I set mc/insert-numbers-default to 1
|
||||||
|
And I press "C-9 H-0"
|
||||||
|
And I press "SPC"
|
||||||
|
Then I should see "This 9 text contains the word 10 text thrice (11 text)"
|
||||||
|
|
||||||
|
Scenario: Three cursors, 9-10-11, default
|
||||||
|
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||||
|
When I set mc/insert-numbers-default to 1
|
||||||
|
And I press "C-u H-0"
|
||||||
|
And I press "SPC"
|
||||||
|
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; mc-cycle-cursors.el
|
;;; mc-cycle-cursors.el
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; mc-edit-lines.el
|
;;; mc-edit-lines.el
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; mc-mark-more.el
|
;;; mc-mark-more.el
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
@ -188,12 +188,22 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-next-word-like-this (arg)
|
(defun mc/mark-next-word-like-this (arg)
|
||||||
|
"Find and mark the next word of the buffer matching the currently active region
|
||||||
|
The matching region must be a whole word to be a match
|
||||||
|
If no region is active, mark the symbol at the point and find the next match
|
||||||
|
With negative ARG, delete the last one instead.
|
||||||
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'words))
|
(let ((mc/enclose-search-term 'words))
|
||||||
(mc/mark-next-like-this arg)))
|
(mc/mark-next-like-this arg)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-next-symbol-like-this (arg)
|
(defun mc/mark-next-symbol-like-this (arg)
|
||||||
|
"Find and mark the next symbol of the buffer matching the currently active region
|
||||||
|
The matching region must be a whole symbol to be a match
|
||||||
|
If no region is active, mark the symbol at the point and find the next match
|
||||||
|
With negative ARG, delete the last one instead.
|
||||||
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'symbols))
|
(let ((mc/enclose-search-term 'symbols))
|
||||||
(mc/mark-next-like-this arg)))
|
(mc/mark-next-like-this arg)))
|
||||||
@ -201,6 +211,7 @@ With zero ARG, skip the last one and mark next."
|
|||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-like-this (arg)
|
(defun mc/mark-previous-like-this (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching the currently active region
|
||||||
|
If no region is active add a cursor on the previous line
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
With zero ARG, skip the last one and mark next."
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
@ -216,24 +227,36 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-word-like-this (arg)
|
(defun mc/mark-previous-word-like-this (arg)
|
||||||
|
"Find and mark the previous part of the buffer matching the currently active region
|
||||||
|
The matching region must be a whole word to be a match
|
||||||
|
If no region is active add a cursor on the previous line
|
||||||
|
With negative ARG, delete the last one instead.
|
||||||
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'words))
|
(let ((mc/enclose-search-term 'words))
|
||||||
(mc/mark-previous-like-this arg)))
|
(mc/mark-previous-like-this arg)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-symbol-like-this (arg)
|
(defun mc/mark-previous-symbol-like-this (arg)
|
||||||
|
"Find and mark the previous part of the buffer matching the currently active region
|
||||||
|
The matching region must be a whole symbol to be a match
|
||||||
|
If no region is active add a cursor on the previous line
|
||||||
|
With negative ARG, delete the last one instead.
|
||||||
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'symbols))
|
(let ((mc/enclose-search-term 'symbols))
|
||||||
(mc/mark-previous-like-this arg)))
|
(mc/mark-previous-like-this arg)))
|
||||||
|
|
||||||
(defun mc/mark-lines (num-lines direction)
|
(defun mc/mark-lines (num-lines direction)
|
||||||
(dotimes (i num-lines)
|
(dotimes (i (if (= num-lines 0) 1 num-lines))
|
||||||
(mc/save-excursion
|
(mc/save-excursion
|
||||||
(let ((furthest-cursor (cl-ecase direction
|
(let ((furthest-cursor (cl-ecase direction
|
||||||
(forwards (mc/furthest-cursor-after-point))
|
(forwards (mc/furthest-cursor-after-point))
|
||||||
(backwards (mc/furthest-cursor-before-point)))))
|
(backwards (mc/furthest-cursor-before-point)))))
|
||||||
(if (overlayp furthest-cursor)
|
(when (overlayp furthest-cursor)
|
||||||
(goto-char (overlay-get furthest-cursor 'point))))
|
(goto-char (overlay-get furthest-cursor 'point))
|
||||||
|
(when (= num-lines 0)
|
||||||
|
(mc/remove-fake-cursor furthest-cursor))))
|
||||||
(cl-ecase direction
|
(cl-ecase direction
|
||||||
(forwards (next-logical-line 1 nil))
|
(forwards (next-logical-line 1 nil))
|
||||||
(backwards (previous-logical-line 1 nil)))
|
(backwards (previous-logical-line 1 nil)))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; mc-separate-operations.el - functions that work differently on each cursor
|
;;; mc-separate-operations.el - functions that work differently on each cursor
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
@ -31,13 +31,20 @@
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/insert-numbers (arg)
|
(defun mc/insert-numbers (arg)
|
||||||
"Insert increasing numbers for each cursor, starting at 0 or ARG."
|
"Insert increasing numbers for each cursor, starting at
|
||||||
|
`mc/insert-numbers-default' or ARG."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(setq mc--insert-numbers-number (or (and arg (prefix-numeric-value arg))
|
(setq mc--insert-numbers-number (or (and arg (prefix-numeric-value arg))
|
||||||
0))
|
mc/insert-numbers-default))
|
||||||
(mc/for-each-cursor-ordered
|
(mc/for-each-cursor-ordered
|
||||||
(mc/execute-command-for-fake-cursor 'mc--insert-number-and-increase cursor)))
|
(mc/execute-command-for-fake-cursor 'mc--insert-number-and-increase cursor)))
|
||||||
|
|
||||||
|
(defcustom mc/insert-numbers-default 0
|
||||||
|
"The default number at which to start counting for
|
||||||
|
`mc/insert-numbers'"
|
||||||
|
:type 'integer
|
||||||
|
:group 'multiple-cursors)
|
||||||
|
|
||||||
(defvar mc--insert-numbers-number 0)
|
(defvar mc--insert-numbers-number 0)
|
||||||
|
|
||||||
(defun mc--insert-number-and-increase ()
|
(defun mc--insert-number-and-increase ()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; multiple-cursors-core.el --- An experiment in multiple cursors for emacs.
|
;;; multiple-cursors-core.el --- An experiment in multiple cursors for emacs.
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
;;; multiple-cursors.el --- Multiple cursors for emacs.
|
;;; multiple-cursors.el --- Multiple cursors for emacs.
|
||||||
|
|
||||||
;; Copyright (C) 2012-2013 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Version: 1.2.2
|
;; Version: 1.4.0
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; rectangular-region-mode.el
|
;;; rectangular-region-mode.el
|
||||||
|
|
||||||
;; Copyright (C) 2012 Magnar Sveen
|
;; Copyright (C) 2012-2016 Magnar Sveen
|
||||||
|
|
||||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||||
;; Keywords: editing cursors
|
;; Keywords: editing cursors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user