mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2026-02-04 06:12:25 +00:00
Add alternative to mc/mark-next-like-this
* README.md: Add mc/mark-next-like-this-word tidbits to readme. * features/step-definitions/multiple-cursors-steps.el: Add mc/mark-next-like-this-word call. * features/support/env.el: Add shortcut for mc/mark-next-like-this-word as "C-S-c C->". * mc-mark-more.el: Add to mc/mark-next-like-this description to explain what happens when no region is selected. Add mc/mark-next-like-this-word function. * multiple-cursors-core.el: Add mc/mark-next-like-this-word to commands to run once. * multiple-cursors.el: Add information about mc/mark-next-like-this-word.
This commit is contained in:
@@ -124,6 +124,7 @@ Use like case-fold-search, don't recommend setting it globally.")
|
||||
;;;###autoload
|
||||
(defun mc/mark-next-like-this (arg)
|
||||
"Find and mark the next part of the buffer matching the currently active region
|
||||
If no region is active add a cursor on the next line
|
||||
With negative ARG, delete the last one instead.
|
||||
With zero ARG, skip the last one and mark next."
|
||||
(interactive "p")
|
||||
@@ -137,6 +138,25 @@ With zero ARG, skip the last one and mark next."
|
||||
(mc/mark-lines arg 'forwards)))
|
||||
(mc/maybe-multiple-cursors-mode))
|
||||
|
||||
;;;###autoload
|
||||
(defun mc/mark-next-like-this-word (arg)
|
||||
"Find and mark the next part of the buffer matching the currently active region
|
||||
If no region is active, mark the word 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")
|
||||
(if (< arg 0)
|
||||
(let ((cursor (mc/furthest-cursor-after-point)))
|
||||
(if cursor
|
||||
(mc/remove-fake-cursor cursor)
|
||||
(error "No cursors to be unmarked")))
|
||||
(if (region-active-p)
|
||||
(mc/mark-more-like-this (= arg 0) 'forwards)
|
||||
(mark-word)
|
||||
(mc/mark-more-like-this (= arg 0) 'forwards)))
|
||||
(mc/maybe-multiple-cursors-mode))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun mc/mark-next-word-like-this (arg)
|
||||
(interactive "p")
|
||||
@@ -461,7 +481,7 @@ If the region is active and spans multiple lines, it will behave
|
||||
as if `mc/mark-all-in-region'. With the prefix ARG, it will call
|
||||
`mc/edit-lines' instead.
|
||||
|
||||
If the region is inactive or on a single line, it will behave like
|
||||
If the region is inactive or on a single line, it will behave like
|
||||
`mc/mark-all-like-this-dwim'."
|
||||
(interactive "P")
|
||||
(if (and (use-region-p)
|
||||
|
||||
Reference in New Issue
Block a user