conf-multiple-cursors.el 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ;;; Code:
  2. (require 'multiple-cursors)
  3. (require 'region-bindings-mode)
  4. (require 'expand-region)
  5. (require 'smart-forward)
  6. (require 'change-inner)
  7. ;; Set th cache
  8. (setq mc/list-file (in-emacs-d ".cache/mc-lists.el"))
  9. ;; Set as unsupported custom commands defined in msic-defuns.el
  10. (unsupported-cmd isearch-forward-use-region ".")
  11. (unsupported-cmd isearch-backward-use-region ".")
  12. ;; smart-forward
  13. (global-set-key (kbd "C-s-<up>") 'smart-up)
  14. (global-set-key (kbd "C-s-<down>") 'smart-down)
  15. (global-set-key (kbd "C-s-<left>") 'smart-backward)
  16. (global-set-key (kbd "C-s-<right>") 'smart-forward)
  17. ;; Change inner/outer
  18. (global-set-key (kbd "s--") 'change-inner)
  19. (global-set-key (kbd "s-.") 'change-outer)
  20. ;; Expand region
  21. (global-set-key (kbd "C-=") 'er/expand-region)
  22. (global-set-key (kbd "C-c <next>") 'er/expand-region)
  23. (global-set-key (kbd "C-c e <left>") 'er/expand-region)
  24. (global-set-key (kbd "C-c e w") 'er/mark-word)
  25. (global-set-key (kbd "C-c e c") 'er/mark-comment)
  26. (global-set-key (kbd "C-c e s") 'er/mark-symbol)
  27. ;; Experimental multiple-cursors
  28. (global-set-key (kbd "C-c m l") 'mc/edit-lines)
  29. (global-set-key (kbd "C-c m e") 'mc/edit-ends-of-lines)
  30. (global-set-key (kbd "C-c m b") 'mc/edit-beginnings-of-lines)
  31. (global-set-key (kbd "C-c m p") 'mc/mark-sgml-tag-pair)
  32. ;; Extra multiple cursors stuff
  33. (global-set-key (kbd "C-s-<mouse-1>") 'mc/add-cursor-on-click)
  34. ;; Set anchor to start rectangular-region-mode
  35. (global-set-key (kbd "S-SPC") 'set-rectangular-region-anchor)
  36. ;; Mark additional regions matching current region
  37. (global-set-key (kbd "C->") 'mc/mark-next-like-this)
  38. (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
  39. (global-set-key (kbd "C-c m d") 'mc/mark-all-dwim)
  40. (global-set-key (kbd "C-c m a") 'mc/mark-all-like-this)
  41. (global-set-key (kbd "C-c m-<") 'mc/mark-all-like-this)
  42. (global-set-key (kbd "C-c m m") 'mc/mark-more-like-this-extended)
  43. (global-set-key (kbd "C-c m r") 'mc/mark-all-in-region)
  44. ;; Juggle around with the current cursors
  45. (global-set-key (kbd "C-c m u") 'mc/unmark-next-like-this)
  46. (global-set-key (kbd "C-c m U") 'mc/unmark-previous-like-this)
  47. (global-set-key (kbd "C-c m j") 'mc/skip-to-next-like-this)
  48. (global-set-key (kbd "C-c m J") 'mc/skip-to-previous-like-this)
  49. ;; Symbol and word specific mark-more
  50. (global-set-key (kbd "s->") 'mc/mark-next-word-like-this)
  51. (global-set-key (kbd "s-<") 'mc/mark-previous-word-like-this)
  52. (global-set-key (kbd "C-c m w") 'mc/mark-all-words-like-this)
  53. (global-set-key (kbd "C-c m S") 'mc/sort-regions)
  54. (global-set-key (kbd "C-s->") 'mc/mark-next-symbol-like-this)
  55. (global-set-key (kbd "C-s-<") 'mc/mark-previous-symbol-like-this)
  56. (global-set-key (kbd "C-c m s") 'mc/mark-all-symbols-like-this)
  57. ;; keys when region is active
  58. (define-key region-bindings-mode-map (kbd "C-a") 'mark-all-like-this)
  59. (define-key region-bindings-mode-map (kbd "<C-left>") 'mc/mark-previous-like-this)
  60. (define-key region-bindings-mode-map (kbd "<C-right>") 'mc/mark-next-like-this)
  61. (define-key region-bindings-mode-map (kbd "<C-up>") 'mc/mark-more-like-this-extended)
  62. (define-key region-bindings-mode-map (kbd "<C-down>") 'mc/mark-more-like-this-extended)
  63. (define-key region-bindings-mode-map (kbd "<C-home>") 'mc/edit-beginnings-of-lines)
  64. (define-key region-bindings-mode-map (kbd "<C-end>") 'mc/edit-ends-of-lines)
  65. (define-key region-bindings-mode-map (kbd "<C-prior>") 'mc/edit-lines)
  66. (define-key region-bindings-mode-map (kbd "<C-next>") 'mc/edit-lines)
  67. (provide 'conf-multiple-cursors)