Emacs personal configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

100 行
3.9KB

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