Emacs personal configuration
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

101 lines
4.0KB

  1. (require-package 'helm)
  2. ;; https://github.com/emacs-helm/helm/commit/e81fbbc687705595ab65ae5cd3bdf93c17a90743
  3. ;;(require 'helm-config)
  4. (require 'helm-grep)
  5. ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
  6. ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
  7. ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
  8. (global-set-key (kbd "C-c h") 'helm-command-prefix)
  9. (global-unset-key (kbd "C-x c"))
  10. (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebihnd tab to do persistent action
  11. (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
  12. (define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
  13. (define-key helm-grep-mode-map (kbd "<return>") 'helm-grep-mode-jump-other-window)
  14. (define-key helm-grep-mode-map (kbd "n") 'helm-grep-mode-jump-other-window-forward)
  15. (define-key helm-grep-mode-map (kbd "p") 'helm-grep-mode-jump-other-window-backward)
  16. (when (executable-find "curl")
  17. (setq helm-google-suggest-use-curl-p t))
  18. (setq
  19. helm-scroll-amount 4 ; scroll 4 lines other window using M-<next>/M-<prior>
  20. helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
  21. helm-split-window-in-side-p t ;; open helm buffer inside current window, not occupy whole other window
  22. helm-candidate-number-limit 500 ; limit the number of displayed canidates
  23. helm-ff-file-name-history-use-recentf t
  24. helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source.
  25. helm-buffers-fuzzy-matching t ; fuzzy matching buffer names when non-nil
  26. ; useful in helm-mini that lists buffers
  27. )
  28. (add-to-list 'helm-sources-using-default-as-input 'helm-source-man-pages)
  29. (global-set-key (kbd "M-x") 'helm-M-x)
  30. (global-set-key (kbd "M-y") 'helm-show-kill-ring)
  31. (global-set-key (kbd "C-x b") 'helm-mini)
  32. (global-set-key (kbd "C-x C-f") 'helm-find-files)
  33. (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
  34. (global-set-key (kbd "C-c h o") 'helm-occur)
  35. (global-set-key (kbd "C-c h C-c w") 'helm-wikipedia-suggest)
  36. (global-set-key (kbd "C-c h x") 'helm-register)
  37. ;; (global-set-key (kbd "C-x r j") 'jump-to-register)
  38. (define-key 'help-command (kbd "C-f") 'helm-apropos)
  39. (define-key 'help-command (kbd "r") 'helm-info-emacs)
  40. (define-key 'help-command (kbd "C-l") 'helm-locate-library)
  41. ;; use helm to list eshell history
  42. (add-hook 'eshell-mode-hook
  43. #'(lambda ()
  44. (define-key eshell-mode-map (kbd "M-l") 'helm-eshell-history)))
  45. ;;; Save current position to mark ring
  46. (add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
  47. ;; show minibuffer history with Helm
  48. (define-key minibuffer-local-map (kbd "M-p") 'helm-minibuffer-history)
  49. (define-key minibuffer-local-map (kbd "M-n") 'helm-minibuffer-history)
  50. (define-key global-map [remap find-tag] 'helm-etags-select)
  51. (define-key global-map [remap list-buffers] 'helm-buffers-list)
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53. ;; PACKAGE: helm-swoop ;;
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. (require-package 'helm-swoop)
  56. ;; Locate the helm-swoop folder to your path
  57. (require 'helm-swoop)
  58. ;; Change the keybinds to whatever you like :)
  59. (global-set-key (kbd "C-c h o") 'helm-swoop)
  60. (global-set-key (kbd "C-c s") 'helm-multi-swoop-all)
  61. ;; When doing isearch, hand the word over to helm-swoop
  62. (define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
  63. ;; From helm-swoop to helm-multi-swoop-all
  64. (define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
  65. ;; Save buffer when helm-multi-swoop-edit complete
  66. (setq helm-multi-swoop-edit-save t)
  67. ;; If this value is t, split window inside the current window
  68. (setq helm-swoop-split-with-multiple-windows t)
  69. ;; Split direcion. 'split-window-vertically or 'split-window-horizontally
  70. (setq helm-swoop-split-direction 'split-window-vertically)
  71. ;; If nil, you can slightly boost invoke speed in exchange for text color
  72. (setq helm-swoop-speed-or-color t)
  73. (helm-mode 1)
  74. (provide 'setup-helm)