1

I want to cut/copy some code with this method:

  • setting a mark with C-SPC,
  • searching with C-s,
  • then cutting/copying the selection.

Check the following image:

enter image description here

I can copy selected code with M-w or cut (kill) it with S-Del.

But since I am using CUA-mode, I would prefer to use its keybindings.
Copying with C-c works but cutting with C-x fails.
Is it possible to tweak C-x to make it work in this situation?

  • I don't see how even M-w or S-<delete> or S-DEL works. The current search hit is not in any way selected (as in the region). But if all you want to do is free up C-x during Isearch then this will do that: (define-key isearch-mode-map (kbd "C-x") nil). That makes your normal binding of C-x usable. But it will not cut the highlighted search hit. It will cut the region from the mark to point (end of search hit, if forward). – Drew May 30 '16 at 2:37
  • 1
    Oh, I see that you mentioned C-SPC to mark. In that case, what I suggested should do what you want: (define-key isearch-mode-map (kbd "C-x") nil). – Drew May 30 '16 at 2:40
1

It seems @Drew already answered in the comments of the question.

This makes it:

(define-key isearch-mode-map (kbd "C-x") nil)

He deserves the merit. I just copy the solution here for better reading ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.