Allow enable/disable global helm key bindings
Since some users prefer using default Prelude commands, a new global mode is defined: prelude-global-helm-mode. When activate, Helm binds some global key bindings to its own commands. When deactivate, Helm removes the bindings and Prelude uses the default bindings.
This commit is contained in:
parent
d74147f618
commit
10b045c29a
2 changed files with 77 additions and 33 deletions
modules
|
@ -1,6 +1,6 @@
|
|||
;;; prelude-helm.el --- Helm setup
|
||||
;;
|
||||
;; Copyright © 2011-2013 Bozhidar Batsov
|
||||
;; Copyright © 2011-2014 Bozhidar Batsov
|
||||
;;
|
||||
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
||||
;; URL: https://github.com/bbatsov/prelude
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; Some config for Helm.
|
||||
;; Some config for Helm that follows thiks guide: http://tuhdo.github.io/helm-intro.html
|
||||
|
||||
;;; License:
|
||||
|
||||
|
@ -64,58 +64,76 @@
|
|||
helm-split-window-default-side 'other ;; open helm buffer in another window
|
||||
helm-split-window-in-side-p t ;; open helm buffer inside current window, not occupy whole other window
|
||||
helm-buffers-favorite-modes (append helm-buffers-favorite-modes
|
||||
'(picture-mode artist-mode))
|
||||
'(picture-mode artist-mode))
|
||||
helm-candidate-number-limit 500 ; limit the number of displayed canidates
|
||||
helm-M-x-requires-pattern 0 ; show all candidates when set to 0
|
||||
helm-M-x-requires-pattern 0 ; show all candidates when set to 0
|
||||
helm-ff-file-name-history-use-recentf t
|
||||
helm-move-to-line-cycle-in-source t ; move to end or beginning of source
|
||||
; when reaching top or bottom of source.
|
||||
ido-use-virtual-buffers t ; Needed in helm-buffers-list
|
||||
ido-use-virtual-buffers t ; Needed in helm-buffers-list
|
||||
helm-buffers-fuzzy-matching t ; fuzzy matching buffer names when non-nil
|
||||
; useful in helm-mini that lists buffers
|
||||
)
|
||||
|
||||
(global-set-key (kbd "M-x") 'helm-M-x)
|
||||
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
|
||||
(global-set-key (kbd "C-x b") 'helm-mini)
|
||||
(global-set-key (kbd "C-x C-f") 'helm-find-files)
|
||||
(global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
|
||||
(global-set-key (kbd "C-c h o") 'helm-occur)
|
||||
(global-set-key (kbd "C-c h g") 'helm-do-grep)
|
||||
(global-set-key (kbd "C-c h C-c w") 'helm-wikipedia-suggest)
|
||||
(global-set-key (kbd "C-c h x") 'helm-register)
|
||||
|
||||
(define-key 'help-command (kbd "C-f") 'helm-apropos)
|
||||
(define-key 'help-command (kbd "r") 'helm-info-emacs)
|
||||
(define-key 'help-command (kbd "C-l") 'helm-locate-library)
|
||||
|
||||
;; use helm to list eshell history
|
||||
(add-hook 'eshell-mode-hook
|
||||
#'(lambda ()
|
||||
(define-key eshell-mode-map (kbd "M-l") 'helm-eshell-history)))
|
||||
(global-set-key (kbd "C-c h SPC") 'helm-all-mark-rings)
|
||||
|
||||
;;; Save current position to mark ring
|
||||
(add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
|
||||
|
||||
;; show minibuffer history with Helm
|
||||
(define-key minibuffer-local-map (kbd "M-p") 'helm-minibuffer-history)
|
||||
(define-key minibuffer-local-map (kbd "M-n") 'helm-minibuffer-history)
|
||||
(defvar prelude-global-helm-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (kbd "M-x") 'helm-M-x)
|
||||
(define-key map (kbd "M-y") 'helm-show-kill-ring)
|
||||
(define-key map (kbd "C-x b") 'helm-mini)
|
||||
(define-key map (kbd "C-x C-f") 'helm-find-files)
|
||||
(define-key map (kbd "C-h C-f") 'helm-apropos)
|
||||
(define-key map (kbd "C-h r") 'helm-info-emacs)
|
||||
(define-key map (kbd "C-h C-l") 'helm-locate-library)
|
||||
map)
|
||||
"Keymap for Helm to replace standard Prelude's commands")
|
||||
|
||||
(define-key global-map [remap find-tag] 'helm-etags-select)
|
||||
(define-key global-map [remap list-buffers] 'helm-buffers-list)
|
||||
(define-minor-mode prelude-global-helm-minor-mode
|
||||
"Minor mode to replace Prelude default commands with \\{prelude-global-helm-map}"
|
||||
:keymap prelude-global-helm-mode-map
|
||||
(progn
|
||||
;; show minibuffer history with Helm
|
||||
(define-key minibuffer-local-map (kbd "M-l") 'helm-minibuffer-history)
|
||||
(define-key global-map [remap find-tag] 'helm-etags-select)
|
||||
(define-key global-map [remap list-buffers] 'helm-mini)
|
||||
|
||||
(define-key shell-mode-map (kbd "M-p") 'helm-comint-input-ring) ; shell history.
|
||||
;; shell history.
|
||||
(define-key shell-mode-map (kbd "M-l") 'helm-comint-input-ring)
|
||||
|
||||
;; use helm to list eshell history
|
||||
(add-hook 'eshell-mode-hook
|
||||
#'(lambda ()
|
||||
(define-key eshell-mode-map (kbd "M-l") 'helm-eshell-history)))))
|
||||
|
||||
(define-globalized-minor-mode prelude-global-helm-global-mode prelude-global-helm-minor-mode prelude-global-helm-global-mode-on)
|
||||
|
||||
(defun prelude-global-helm-global-mode-on ()
|
||||
"Turn on `prelude-global-helm-minor-mode'"
|
||||
(prelude-global-helm-minor-mode +1)
|
||||
)
|
||||
|
||||
(defun prelude-global-helm-global-mode-off ()
|
||||
"Turn off `prelude-global-helm-minor-mode'"
|
||||
(prelude-global-helm-minor-mode -1))
|
||||
|
||||
(helm-mode 1)
|
||||
|
||||
;; PACKAGE: helm-projectile
|
||||
|
||||
(require 'helm-projectile)
|
||||
(setq projectile-completion-system 'helm)
|
||||
|
||||
(push "Press <C-c p h> to navigate a project in Helm." prelude-tips)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; PACKAGE: helm-descbinds ;;
|
||||
;; ;;
|
||||
;; GROUP: Convenience -> Helm -> Helm Descbinds ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; PACKAGE: helm-descbinds
|
||||
(require 'helm-descbinds)
|
||||
(helm-descbinds-mode)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue