Enable prelude-global-helm-global-mode by default
Since Helm is another option to Ido, users who want to use it fully should benefit from the default Prelude setup. If some users don't like, they can always disable global Helm mode according to the instructions in the homepage. User can enable Helm everywhere with prelude-helm-everywhere. This change also enables Helm version of command history in shell and eshell. It also adds minibuffer history without overrides any key binding in minibuffer-local-map.
This commit is contained in:
parent
0cccfb8487
commit
72d0e6f159
4 changed files with 76 additions and 57 deletions
64
modules/prelude-helm-everywhere.el
Normal file
64
modules/prelude-helm-everywhere.el
Normal file
|
@ -0,0 +1,64 @@
|
|||
;;; prelude-helm-everywhere.el --- Enable Helm everywhere
|
||||
;;
|
||||
;; Copyright © 2014 Tu, Do Hoang
|
||||
;;
|
||||
;; Author: Tu, Do Hoang (tuhdo1710@gmail.com)
|
||||
;; URL: https://github.com/bbatsov/prelude
|
||||
;; Version: 1.0.0
|
||||
;; Keywords: convenience
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Enable Helm everywhere with global key bindings to replace common
|
||||
;; global bindings and `helm-mode' is activated to replace `completing-read'
|
||||
;; with `helm-completing-read-default', so users can use Helm with every prompt.
|
||||
|
||||
;;; License:
|
||||
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License
|
||||
;; as published by the Free Software Foundation; either version 3
|
||||
;; of the License, or (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;; Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Code:
|
||||
(require 'prelude-helm)
|
||||
(require 'helm-descbinds)
|
||||
|
||||
(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 f") 'helm-apropos)
|
||||
(global-set-key (kbd "C-h r") 'helm-info-emacs)
|
||||
(global-set-key (kbd "C-h C-l") 'helm-locate-library)
|
||||
(define-key prelude-mode-map (kbd "C-c f") 'helm-recentf)
|
||||
|
||||
(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
|
||||
|
||||
;; shell history.
|
||||
(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
|
||||
|
||||
;; use helm to list eshell history
|
||||
(add-hook 'eshell-mode-hook
|
||||
#'(lambda ()
|
||||
(substitute-key-definition 'eshell-list-history 'helm-eshell-history eshell-mode-map)))
|
||||
|
||||
(substitute-key-definition 'find-tag 'helm-etags-select global-map)
|
||||
(setq projectile-completion-system 'helm)
|
||||
(helm-descbinds-mode)
|
||||
(helm-mode 1)
|
||||
|
||||
(provide 'prelude-helm-everywhere)
|
||||
;; prelude-helm-everywhere.el ends here.
|
|
@ -84,59 +84,10 @@
|
|||
;;; Save current position to mark ring
|
||||
(add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
|
||||
|
||||
(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-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)
|
||||
|
||||
;; 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
|
||||
(require 'helm-descbinds)
|
||||
(helm-descbinds-mode)
|
||||
|
||||
(provide 'prelude-helm)
|
||||
|
||||
;;; prelude-helm.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue