Skip to content

Instantly share code, notes, and snippets.

@notetiene
Created May 3, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notetiene/5e44a48cde15d1d4f4af5c40b614f885 to your computer and use it in GitHub Desktop.
Save notetiene/5e44a48cde15d1d4f4af5c40b614f885 to your computer and use it in GitHub Desktop.
;;; setup-help --- Helm
;;; Commentary:
;;; Code:
(require 'helm-config)
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
(define-key helm-grep-mode-map (kbd "<return>") 'helm-grep-mode-jump-other-window)
(define-key helm-grep-mode-map (kbd "n") 'helm-grep-mode-jump-other-window-forward)
(define-key helm-grep-mode-map (kbd "p") 'helm-grep-mode-jump-other-window-backward)
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-scroll-amount 4 ;; scroll 4 lines other window using M-<next>/M-<prior>
helm-quick-update t ;; do not display invisible candidates
helm-ff-search-library-in-sexp t ;; search for library in `require' and `declare-function' sexp.
helm-split-window-in-side-p t ;; open helm buffer inside current window, not occupy whole other window
helm-candidate-number-limit 100 ;; limit the number of displayed canidates
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
helm-buffers-fuzzy-matching t ;; fuzzy matching buffer names when non-nil
;; useful in helm-mini that lists buffers
helm-M-x-fuzzy-match t
helm-bookmark-show-location t
helm-buffers-fuzzy-matching t
helm-completion-in-region-fuzzy-match t
helm-file-cache-fuzzy-match t
helm-imenu-fuzzy-match t
helm-mode-fuzzy-match t
helm-locate-fuzzy-match t
helm-quick-update t
helm-recentf-fuzzy-match t
helm-semantic-fuzzy-match t
)
(add-to-list 'helm-sources-using-default-as-input 'helm-source-man-pages)
(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 C-c w") 'helm-wikipedia-suggest)
(global-set-key (kbd "C-c h x") 'helm-register)
;; (global-set-key (kbd "C-x r j") 'jump-to-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)))
;;; 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)
(define-key global-map [remap find-tag] 'helm-etags-select)
(define-key global-map [remap list-buffers] 'helm-buffers-list)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PACKAGE: helm-swoop ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Locate the helm-swoop folder to your path
(require 'helm-swoop)
;; Change the keybinds to whatever you like :)
(global-set-key (kbd "C-c h o") 'helm-swoop)
(global-set-key (kbd "C-c s") 'helm-multi-swoop-all)
;; When doing isearch, hand the word over to helm-swoop
(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
;; From helm-swoop to helm-multi-swoop-all
(define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
;; Save buffer when helm-multi-swoop-edit complete
(setq helm-multi-swoop-edit-save t)
;; If this value is t, split window inside the current window
(setq helm-swoop-split-with-multiple-windows t)
;; Split direcion. 'split-window-vertically or 'split-window-horizontally
(setq helm-swoop-split-direction 'split-window-vertically)
;; If nil, you can slightly boost invoke speed in exchange for text color
(setq helm-swoop-speed-or-color t)
;; Locate unix command used
(setq helm-locate-command "locate %s -e -A --regex %s")
(helm-mode 1)
(provide 'setup-helm)
;;; setup-helm ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment