7

I'm editing this code:

callFunction({
    x: somearray,
});

Then I want to extract somearray to be a variable with a copy. I cut somearray and delete the colon, then enter (_ is the cursor):

const x = [..._
callFunction({
    x
});

Then yank, and the super helpful web-mode screws up my code:

const x = [...somearray_
    callFunction({
        x
    });

Then I close the bracket and have to reindent the function call expression.

How to disable this autoindenting after yank?

Disabling electric-indent-local-mode does not help. Neither does setting electric-indent-inhibit to t. Searching for "web-mode disable auto-indent" does not lead to a solution.

Arry
  • 203
  • 1
  • 3

1 Answers1

8

You might want to try setting web-mode-enable-auto-indentation to nil:

(setq web-mode-enable-auto-indentation nil)

An issue was filled about this a while ago (and there were probably other ones, it's not worth searching for these). It doesn't seem to be documented well, so it's not easy to find the option.

  • Such an obvious thing. Thank you. – Arry Jun 16 '19 at 12:40
  • 3
    Thanks - how the `web-mode` author him/herself didn't go crazy yanking some data on an incomplete line... (to then do something about it, like have this "feature" disabled by default!) – Déjà vu Oct 09 '19 at 02:16