Coder Social home page Coder Social logo

evil-mc's People

Contributors

0x28 avatar dickby avatar duianto avatar gabesoft avatar geza-herman avatar gilbertw1 avatar halbtuerke avatar jojojames avatar korayal avatar lalohao avatar lemonbreezes avatar leungbk avatar liu233w avatar ml729 avatar nbfalcon avatar sei40kr avatar silex avatar syohex avatar tarsius avatar thanhvg avatar walseb avatar yuhan0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evil-mc's Issues

Allow running arbitrary commands for all cursors

In magnars' multiple-cursors package one can do that like this:

(mc/for-each-cursor-ordered (mc/execute-command-for-fake-cursor 'insert-magic-number cursor))

(defun insert-magic-number ()
(interactive)
(insert (number-to-string 42))

Or something like this:

(defun mc/sort-regions ()
(interactive)
(unless (use-region-p)
(mc/execute-command-for-all-cursors 'mark-sexp))
(setq mc--strings-to-replace (sort (mc--ordered-region-strings) 'string<))
(mc--replace-region-strings))

Repeating evil-mc-make-and-goto-next-match does not work

I was trying to use . (which is bound to evil-repeat) to repeat the last multiple cursors action, however it does not work:

evil-mc Failed to execute evil-repeat with error: Accessing an empty ring

I think I will just bind the mc functions to more convenient keys to fix it for my purposes, but I thought it might be worthwhile to report it.

what's `evil--jump-hook`?

Looks it does not in latest stable evil v1.2.12 yet. Can't you support both stable and unstable evil?

Variable, if single cursor, hide mode line "emc" text

Description

In Spacemacs there's a reassignment of the evil-mc-mode-line variable, without the emc text, when evil-mc-mode is enabled and there's only one cursor.
https://github.com/syl20bnr/spacemacs/blob/df408fcd2626883b942fd6204fe00e780582d9f8/layers/%2Bspacemacs/spacemacs-evil/packages.el#L114

Issue

But anyone that wants to show the emc text, when there's only one cursor, needs to add several lines to the dotspacemacs/user-config section of their .spacemacs file.

A possible solution

This could be simplified to a single line, if evil-mc had a variable that shows or hides the emc text when there's only one cursor.

Maybe it could be called something like this:
evil-mc-single-cursor-mode-line-text
or
evil-mc-mode-line-text-single-cursor
or something better.

support multi-select in visual mode

I think this package is useful to multi-select and edit in visual mode
so I try to sort thing out

1. enable visual mode and select define-key first line

2016-12-12 9 53 13 3

2. the error happened when I use evil-mc-make-all-cursors(or evil-mc-make-and-goo-next-match) next step

2016-12-12 9 57 46

it will much more convenient to select two lines of codes directly

2016-12-12 10 05 26 4

sorry for my lack programming experience

Support for AUCTeX commands?

I'm wondering what is in the way of supporting for example simply inserting a backslash (the AUCTeX TeX-insert-backslash command). What does need to be done to add support for it?

Creating cursors via search

I couldn't find a way to add a cursor to each result when I search stuff in (spac)emacs. Sublime Text has this extremely useful feature where you can search stuff (via RegExp) and press

Is this possible in evil-mc?

escape insert-state has a trouble with evil-escape

I use evil-escape to quit insert-state,but I find a trouble with this.

evil
evil
evil

I edit (insert)

helloedit
helloedit
helloedit

when I press escape,it quit insert-state well.But I use 'jj' to quit insert-state.The content would look like this(normal-state)

hellojedit
hellojedit
helloedit

How can I resolve this problem?
and I suggest use 'escape' instead of 'g r u' for evil-mc-undo-all-cursors.
Sorry abot my English.Thank you.

Can we have a evil-mc-edit-lines just like mc/edit-lines?

I found this feature very handy in the multiple-cursors package, and it would great if it would also work with visual block to insert the cursors at a particular column. If you provide me some ideas how to do it and if it is not so hard to do, I can maybe write a patch myself.

FR: a way to add new cursors by clicking

I have been pausing mc, then moving to different positions to add a new cursor, but I find this to be tedious.

it would be nice to have a way to add cursors by clicking. the normal multiple-cursors has an add-cursor-on-click function that does this.

i will see if I can look into it but time always.

Change all cursor types with state change

Currently, when multiple cursors are enabled and you switch to insert state, only the real cursor changes to the cursor style set up for the insert state. It would be cool if all of the cursors mirrored the shape of the real one.

Evil-Escape compatibility

I am trying to fix #27 by making some changes to evil-escape. I have got it mostly working with one minor issue that I hope I could get some help with. When you use evil-escape you have a two-key escape sequence. The problem in #27 was that the first key was being left. I got that cleaned up but when you try and undo it shows the insertion of the first-key as the top of the stack (f by default). This causes problems because only the fake cursors have this item in their undo stack so now the real cursor and the fake cursors are out of sync. Is there a way to change the undo stack for the fake cursors so this doesn't show up in their undo stack?

and just for reference here are the changes I made. I couldn't find anyway to acomplish this by changing evil-mc, I had to change evil-escape. I changed one function called evil-escape-pre-command-hook

(defun evil-escape-pre-command-hook ()
  "evil-escape pre-command hook."
  (with-demoted-errors "evil-escape: Error %S"
    (when (evil-escape-p)
      (let* ((modified (buffer-modified-p))
             (inserted (evil-escape--insert))
             (fkey (elt evil-escape-key-sequence 0))
             (skey (elt evil-escape-key-sequence 1))
             (evt (read-event nil nil evil-escape-delay)))
        (when inserted (evil-escape--delete))
        (set-buffer-modified-p modified)
        (cond
         ((and (characterp evt)
               (or (and (equal (this-command-keys) (evil-escape--first-key))
                        (char-equal evt skey))
                   (and evil-escape-unordered-key-sequence
                        (equal (this-command-keys) (evil-escape--second-key))
                        (char-equal evt fkey))))
          (evil-repeat-stop)
          (when (evil-escape-func)
            (progn
              (run-at-time "0.05 sec" nil
                           (lambda ()
                             (evil-mc-execute-for-all-fake-cursors
                              (lambda (cursor)
                                (let ((undo-inhibit-record-point t))
                                  (delete-char -1)
                                  (unless (or (bolp) (eolp))
                                    (evil-backward-char)))))))
              (setq this-command (evil-escape-func)))))
         ((null evt))
         (t (setq unread-command-events
                  (append unread-command-events (list evt)))))))))

I am sure @syl20bnr could come up with a much better solution. But this seems to working for me. Any help would be appreciated.

evil-exchange mapping with general.el breaks change with multiple cursors

I have a general.el-mapping for evil-exchange which allows me to use cx to do use exchange and still have all the other evil-change commands working with c ...:

  (general-nmap "c"
    (general-key-dispatch 'evil-change
      "x" 'evil-exchange
      "X" 'evil-exchange-cancel))

The problem is that this seems to break when I have multiple evil-mc cursors active. I'm guessing evil-mc does no longer recognize the evil-change command because now there's general-key-dispatch sitting there. When I change the mapping manually back to

(general-nmap "c" 'evil-change)

evil-mc is working nicely again. Do you have any idea how I could somehow make these three (general.el, evil-exchange and evil-mc) coexist peacefully (I would be fine with evil-exchange not working when multiple cursors are active)?

Backspace in insert-mode seems to not be working

I visually select a block of text, then narrow it. I do grm to mark the strings. When I type some characters, the typed characters are reflected in all cursors as expected. However, if I backspace to delete a character, it only deletes the character from the current line (the line with the real cursor).

If I use vim/evil's X to delete the character in visual mode, it deletes it in all lines (so is working properly). So just backspace in insert mode is not working.

`evil-delete-backward-char` not working

when I try to run evil-delete-backward-char I get the following message:

evil-mc Execute evil-delete-backward-char for all cursors
evil-mc Execute evil-delete-backward-char with evil-mc-execute-default-call-with-count
evil-mc Failed to execute evil-delete-backward-char with error: Wrong number of arguments: #[(beg end &optional type register) "\306\216�\211�\205�
�
$*\207" [evil-inhibit-operator-value evil-inhibit-operator beg end type register #[nil "\301\211�\207" [evil-inhibit-operator-value nil] 2] called-interactively-p any evil-delete] 6 ("/home/gkraemer/.emacs.d/elpa/evil-20160827.1510/evil-commands.elc" . 112587) (byte-code "\306\307\310\"\205�
b\210\202^
b\210.�\207" [evil-operator-range-motion evil-operator-range-type orig evil-operator-range-beginning evil-operator-range-end evil-inhibit-operator evil-has-command-property-p evil-delete-backward-char :motion evil-get-command-property undefined :type nil append evil-operator-range t evil-visual-state-p region-active-p evil-visual-rotate upper-left :move-point evil-inhibit-operator-value this-command evil-this-operator evil-this-register deactivate-mark] 5)], 1
evil-mc Failed to execute all evil-delete-backward-char with error: Wrong type argument: listp, t

key-chords do not work

Given the following:

(key-chord-define evil-insert-state-map "jj" #'evil-normal-state)

When I execute jj to enter normal state, I get misaligned cursors and the following error:

Error in pre-command-hook (evil-mc-begin-command-save): (user-error "Key sequence contains no complete binding")
evil-mc Failed to execute nil with error: Keyboard macro terminated by a command ringing the bell

This is due to the way key-chord handles keyboard macros.

From the docs:

When recording keyboard macros, the time between keyboard inputs are not recorded. Thus, the key-chord-input-method cannot know for sure if two keys in a macro was a chord or not. The current solution remembers the first key of the chords typed during macro recording, and keys that match those (and are defined as chords) are considered key-chords during macro execution. This knowledge is not saved with name-last-kbd-macro, so they may execute wrong if they contain pair of keys that match defined chords.

Failed to execute all ... with error: Wrong type argument: number-or-marker-p, nil

evil-mc-20160222.1452 from MELPA

Steps to reproduce:
In the *scratch* buffer, with 10 lines containing "asdf", after a couple of evil-mc-make-and-goto-next-match and then an evil-backward-word-begin, only the last cursor moves backward one word.

Debug log is

evil-mc There are 2 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 3 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 4 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 5 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 6 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 7 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 8 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 9 cursors matching "\_<asdf\_>"
evil-mc Command evil-mc-make-and-goto-next-match 
evil-mc There are 10 cursors matching "\_<asdf\_>"
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (k . -210) (k . -211) (210 . 212) undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (k . -210) (k . -211) (210 . 212) undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (k . -210) (k . -211) (210 . 212) undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Failed to execute all evil-backward-word-begin with error: Wrong type argument: number-or-marker-p, nil

mc-make-all-cursors and visual-mode

Not sure if I'm doing it incorrectly, but when I visually select lines (for example, this block of code with the my cursor on the last line at the s character and do mc-make-all-cursors, I get the result show in the image--the fake cursor is at the end of the last line.

Instead, I expected the fake cursors to be created at the s character in the same position on the other lines, which is exactly what multi-cursors package does (but for some reason it includes an extra fake cursor after the visually-selected lines).

Is this a bug? Currently I have to narrow the region of interest and then do a grm. This is of course less efficient and also a significant limitation because I can't look at the rest of the text in the buffer. Of course I can do grj instead of narrow region for each line, but that's a lot of typing.

Or is there a way to accomplish this simple task that I don't know about?

Thanks.

function definition is void: advice-add

I'm using evil-mc on spacemacs using emacs 24.3.1 on Ubuntu 14.04 . Whenever I trigger the evil-mc-make-cursor-here command (using g r h), nothing happens and the following error appears in messages:

evil-mc-initialize-active-state: Symbol's function definition is void: advice-add

Change motion adds one letter on the active cursor

Let it be that I have 4 cursors active as follows:

set[q]
set[q]
set[q]
set[q] <- active cursor

After running cb I get:
[]
[]
[]
[q]

The q gets left behind on the active cursor. This behavior occurs about 99% of the time, sometimes it just works, most of the time it fails. It is the same case with other motions: e, E, b, B, w, W, f, F, t, T. However, any command, be it: change,delete or even surround command work absolutely perfectly when used from visual state.

Is this a problem for anyone else?
Apart from this little issue the package is excellent!

Cursors stop moving

Hi,

I just installed evil-mc and it's not working as expected. When I move the cursor the other cursors don't follow (see GIF animation). Anything I have to configure to make this work?

evil-mc-not-working

I'm using GNU Emacs 25.0.50.1 2015-08-15 on OS X.

Here's the debug log:

evil-mc Created 3 cursors matching "\_<some\_>"
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-forward-word-begin w
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [119]) (:keys-post . [119]) (:last-input . 119) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-forward-word-begin [119] nil) (:keys-pre . [119]) (:name . evil-forward-word-begin)) evil-forward-word-begin
evil-mc Record-done evil-forward-word-begin pre w post w keys-motion  keys-operator  count nil keys w
evil-mc Execute evil-forward-word-begin for all cursors
evil-mc Execute evil-forward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]
evil-mc Command evil-backward-word-begin b
evil-mc Record-begin ((:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin))
evil-mc Record-finish ((:undo-list-pointer-post nil (1 . 78) (t . 0) nil undo-tree-canary) (:keys-post-raw . [98]) (:keys-post . [98]) (:last-input . 98) (:evil-state-end . normal) (:undo-list-pointer-pre nil (1 . 78) (t . 0) nil undo-tree-canary) (:evil-state-begin . normal) (:keys-pre-with-count nil evil-backward-word-begin [98] nil) (:keys-pre . [98]) (:name . evil-backward-word-begin)) evil-backward-word-begin
evil-mc Record-done evil-backward-word-begin pre b post b keys-motion  keys-operator  count nil keys b
evil-mc Execute evil-backward-word-begin for all cursors
evil-mc Execute evil-backward-word-begin with evil-mc-execute-default-call-with-count [2 times]

Is it possible to unbind C-p and C-n?

Hi,

I would like to unbind C-p and C-n. I tried the following but it did not work:

(define-key evil-mc-key-map (kbd "C-p") 'nil)

Could you please let me know how to do this? Thanks a lot.

evil-mc does not working perfect with paredit-mode

Hi Gabriel,

I am using paredit-mode and evil-mc-mode at the same time, when working with multiple cursors in insert-state, backspace does not working as expected.

evil-mc-mode_
evil-mc-mode_
evil-mc-mode_|

backspace:

evil-mc-mode_
evil-mc-mode_
evil-mc-mod_|

I found that backspace is binded to paredit-backward-delete. Is there a way to fix this?

Thanks!

Support for hybrid mode commands?

I use spacemacs w/ hybrid mode, as such, I often use kill-word, delete-char and probably other non-evil commands. Would you be opposed to adding support for them? I can probably submit some pulls if you're interested. Thanks!

Add Virtual white space forms edit

I am trying to understand the state of virtual white space. Sometimes called virtual space.

Examples of this block access technique can be seen in eclipse, visual studio, notepad++, textmate and eclipse. It works by appending virtual space characters when navigating and adding text.

This becomes extremely useful in multicolumn block edits as the cursor no longer tracks to the smallest line. You can now append to multiple lines as a replicated cursor. For example of why this is a problem take a look at the multiple-select video where you can see the additional steps he goes through to maintain the alignment.

Further benefits come in the form of block yanks and puts. You can select text as a column when there might not be intermediate space on all lines. Further trickery can be added to paste single line text to multiples and so forth.

Happy to assist or explain further.

Indicate when the cursors are paused

Description

It would be helpful, if it was easier to see when the cursors are paused. The current method seems to be, that one moves the cursor, and checks if the other cursors also move.

Multiple cursor(s) appearance

A more user-friendly solution, could be to change the appearance of the multiple cursors when they are paused. Then their current state would be visible near the main cursor.

A possible "paused" cursor shape could be the hollow cursor-type.

But this solution leaves at least two cases where it still would be difficult to see the paused/resumed state.

  • When the main cursor is on top of the new cursor. This happens when the first multi cursor is created, by pressing: g r h.
  • When the other cursors are located above and/or below the current window.

Additional mode-line text

Another or an additional option could be to change the mode-line text. Here are some examples:
emc:p:3, emc:P:3,
emc(p):3, emc(P):3,
emc:paused:3, emc:PAUSED:3,
emc(paused):3, emc(PAUSED):3,
(emc:3), {emc:3}, [emc:3], <emc:3>

Inverted mode-line colors

The mode-line texts colors could (also) be inverted:

	(if evil-mc-frozen
		(propertize "%s:%d" 'face '(:inverse-video t))
	  "%s:%d")

If a specific color is picked then it might run into issues with some themes.

Currently (when this was written) the mode-line text uses the cursors current color as the background (there's an open issue about it here: Modeline indicator, background color, readability #57). If that's changed so that the mode-line text uses the default colors. Then the default and the inverted (paused) mode-line text colors would look like this (with the Spacemacs-dark theme):

paused-cursors_mode-line-text-inverted

Minibuffer messages

Maybe it would be useful to show a message in the minibuffer, when the cursors are paused and resumed. The messages could say something like this:

evil-mc Cursors Paused
evil-mc Cursors Resumed

Variable(s)

Variables for the options above, would make it easier to (en/dis)abled them.

Add command to make a cursor, select the word below the cursor and goto next

In vim-easymotion, when pressing C-n, it will select the word below the cursor, pressing it again will find the next occurrence, selects it and create another cursor. It would be nice to have a command which replicate this behaviour. Below is a screenshot of what to expect when pressing C-n twice on the word dotspacemacs

image

Is this released under a license?

Hi, I'm working with a company that doesn't allow unlicensed software but I'd really like to try this out. Is this code released under a specific license?

Thanks in advance!
Bobby

Misaligned cursors in insert mode

Spawning some cursors in normal mode using C-n:
1
All good for now.

But when entering insert mode:
2

Any idea of what's going on?
It looks like the "fake bar" that should act as cursor is taking up an entire character's space.

Modeline indicator, background color, readability

The evil-mc modeline indicator, can (depending on the theme) make it impossible or very hard to read.

It looks like this:

  • Top: Emacs with evil-mc installed
  • Middle: Spacemacs with the spacemacs-dark theme (default)
  • Bottom: Spacemacs with the spacemacs-light theme

evil-mc-modeline-indicator-colors

The background color is the same as the cursors current state color.

In Spacemacs:

  • insert state changes the background to Strong green (#66CD00):
    evil-mc-modeline-indicator-insert-state

  • visual state changes the background to Gray (#BEBEBE):
    evil-mc-modeline-indicator-visual-state

System info:

evil-mc 0.0.3
Spacemacs 0.200.9

  • System 1:
    Emacs 25.1.1
    Windows 10

  • System 2: (Virtual box on System 1)
    Emacs 26.0.50
    Ubuntu 16.10

ess-smart-comma not working

ess-smart-comma does not work, gives a very similar error as #47

evil-mc Failed to execute ess-smart-comma with error: Wrong number of arguments: #[nil "\303p!\211�\203�
[proc ess-smart-operators major-mode get-buffer-process marker-position process-mark ess-handy-commands delete-horizontal-space ", " inferior-ess-mode indent-according-to-mode ","] 5 ("/home/gkraemer/.emacs.d/elpa/ess-20170118.232/lisp/ess-inf.elc" . 90382) nil], 1

Visual mode quirk

this is a test
this is a test

Here, there is one cursor on the beginning of each line.

$ b v e d produces mis-aligned cursors.

evil-shift-left: Wrong type argument: commandp, (keymap...

Description

With 2 or more unfrozen multiple cursors. If one starts the evil-shift-left or ...-right command by pressing the key binding: < (press S-,) or > (press S-.), and then cancels the command by pressing Esc or C-g. Then the messages buffer outputs 10's of thousands of characters. Here are the first 400:

evil-mc Failed to execute evil-shift-left with error: Wrong type argument: commandp, (keymap (keymap (60 . evil-line)) (keymap) (keymap "Auxiliary keymap for Operator-Pending state" (83 . evil-Surround-edit) (115 . evil-surround-edit)) (keymap (105 keymap (59 . evil-inner-elisp-comment) (74 . evil-indent-plus-i-indent-up-down) (73 . evil-indent-plus-i-indent-up) (105 . evil-indent-plus-i-indent)

System info

Emacs with the evil-mc package installed.
or
Spacemacs 0.200.9

System 1

Emacs 25.1.1
Windows 10

System 2 (Virtual box with Windows 10 as host)

Emacs 26.0.50
Ubuntu 16.10

Disabling spacemacs' "paste-transient-state" temporarily

So that we can use the paste mode that 'is' supported when evil-mc-mode is active. But when it's not in use, there isn't any reason to abandon the nice features of the paste-transient-state.

I wanted to know if I did this correctly. I'm not so good at writing elisp code (except setting up my config file I guess :) ) so below was my take on this issue:

  (defun evil-mc-set-paste (state)
    (if state
      (progn
        (define-key evil-normal-state-map "p" 'spacemacs/paste-transient-state/evil-paste-after)
        (define-key evil-normal-state-map "P" 'spacemacs/paste-transient-state/evil-paste-before))
      (progn
        (define-key evil-normal-state-map "p" 'evil-paste-after)
        (define-key evil-normal-state-map "P" 'evil-paste-before))))

  (add-hook 'evil-mc-mode-hook (lambda ()
    (when dotspacemacs-enable-paste-transient-state
      (add-hook 'evil-mc-before-cursors-created (lambda () (evil-mc-set-paste nil)))
      (add-hook 'evil-mc-after-cursors-deleted (lambda () (evil-mc-set-paste t))))))

Only issue I can think of is when dotspacemacs-enable-paste-transient-state changes (from t to nil) after cursors are created. in that case we would probably get a state where transient-state is enabled (when the desired state was it being disabled). But since the only place I have seen this variable being used is 'at the boot of spacemacs', I don't think it's currently possible to toggle this afterwards anyway.

Conflicts with evil-smartparens

evil-smartparens doesn't work when using evil-mc.
It could be useful to make them work together.
Simple, temporary, solution is to disable evil-smartparens when working with multiple cursors.
My code:

(defun disable-evil-smartparens ()
  (interactive)
  (evil-smartparens-mode -1))

(defun enable-evil-smartparens ()
  (interactive)
  (evil-smartparens-mode 1))

(advice-add 'evil-mc-resume-cursors :after #'disable-evil-smartparens)
(advice-add 'evil-mc-undo-all-cursors :after #'enable-evil-smartparens)

Is it possible to create new cursors based on arbitary strings instead of symbols?

With multiple-cursors it is possible to mark some characters, for example the first <a href in this text:

<a href="http://www.example.com"></a>
<a href="http://www.example.com"></a>

then call mc/mark-next-like-this and it would then create a new cursor at the next occurrence of <a href. This is very when editing repeating syntactical structures which are not necessarily matched by symbols (or words, not sure which one evil-mc uses).

prefix argument for evil-mc-make-cursor-move-next-line

Since evil-mc-make-cursor-move-next-line is by default on the key g r j and it's not repeatable by . it takes lots of key strokes to make more than one new cursor on the next lines.
It would be nice to use the prefix argument for making more cursors.
Thanks.

Arbitrary commands?

From my understanding, only the limited set of evil-mc-known-commands.el is available, anything else will apply to one cursor only.
I miss features, such as evil-search-forward, capitalize-word, just-one-space and many more.
Reimplementating all of Emacs' editing features just for this mode does not seem like a viable option.

Is it a limitation due to evil-mode? github.com/magnars/multiple-cursors.el is able to run arbitrary Emacs commands, only some Evil commands fail somehow.

Any take on this?

Insert state changes line height

Description

In windows the line height changes when one enters and exits insert state.
It happens on any line with a multi cursor.

Windows 10

evil-mc-windows-emacs-normal-vs-insert-line-height
evil-mc-windows-spacemacs-normal-vs-insert-line-height

Ubuntu 16.10

It works as expected in Ubuntu.

evil-mc-ubuntu-emacs-normal-vs-insert-line-height
evil-mc-ubuntu-spacemacs-normal-vs-insert-line-height

System Info

The first animation for each OS shows: Emacs with the evil-mc package installed.
The second animation shows: Spacemacs 0.200.9 (develop branch).

System 1:

Emacs 25.1.1
Windows 10

System 2 (Windows 10, Virtual box host OS):

Emacs 26.0.50
Ubuntu 16.10

"undo branch point" message on redo

Hi, just testing this via spacemacs.

When I make an edit via mc insert mode, then undo u , then redo Ctrl-R , I see the message

Undo branch point!

On second redo, the inserts are redone. So not fatal. Any idea why that's happening?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.