43

As an Emacs newbie, I found IDO and loved it since it made searching for files so much quicker. After spending some time on this site, I've read more and more about Helm and I'm planning on making the switch. Some of my questions are:

  1. What are the biggest differences?
  2. Specifically, how should my workflow change when finding files, switching buffers, or calling new commands?

I used this post to set up Helm, but my file searches (C-x C-f) and buffer switches (C-x b) look pretty much the same as they did before.

Here is my config:

(require 'helm)
(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) ; rebihnd tab to do 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

(when (executable-find "curl")
  (setq helm-google-suggest-use-curl-p t))

(setq helm-quick-update                     t ; do not display invisible candidates
      helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
      helm-buffers-fuzzy-matching           t ; fuzzy matching buffer names when non--nil
      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
      helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
      helm-ff-file-name-history-use-recentf t)

(helm-mode 1)
programking
  • 7,064
  • 9
  • 41
  • 62
Ryan
  • 3,989
  • 1
  • 26
  • 49
  • 1
    As you already realized, you forgot to bind Helm specific commands to replace the stock Emacs commands. If you keep reading the guides for each specific Helm command, you will see that I put key bindings (if possible) and setup in each section. Nevertheless, enjoy Helm :) – Tu Do Oct 31 '14 at 09:49

1 Answers1

29

UPDATED (Helm changes, personal config changes, and Tu Do comments).

I switched from IDO to Helm few years ago and I never looked back.

  • I find the presentation cleaner than let's say ido-vertical-mode for example.
  • Helm doesn't have flex matching though.
  • You don't need smex, etc. Helm does it all.
  • The Tu do article is good as it provides some nice animated screenshots of what Helm can do.

I use Helm projectile, Helm swoop, Helm semantic, Helm ag and some of the Helm interactive commands. Checkout the Melpa page for Helm related packages that might interest you.

Here's some of my Helm related setup :

(setq helm-ff-transformer-show-only-basename nil
      helm-adaptive-history-file             "~/.emacs.d/data/helm-history"
      helm-yank-symbol-first                 t
      helm-move-to-line-cycle-in-source      t
      helm-buffers-fuzzy-matching            t
      helm-ff-auto-update-initial-value      t)

(autoload 'helm-descbinds      "helm-descbinds" t)
(autoload 'helm-eshell-history "helm-eshell"    t)
(autoload 'helm-esh-pcomplete  "helm-eshell"    t)

(global-set-key (kbd "C-h a")    #'helm-apropos)
(global-set-key (kbd "C-h i")    #'helm-info-emacs)
(global-set-key (kbd "C-h b")    #'helm-descbinds)

(add-hook 'eshell-mode-hook
          #'(lambda ()
              (define-key eshell-mode-map (kbd "TAB")     #'helm-esh-pcomplete)
              (define-key eshell-mode-map (kbd "C-c C-l") #'helm-eshell-history)))

(global-set-key (kbd "C-x b")   #'helm-mini)
(global-set-key (kbd "C-x C-b") #'helm-buffers-list)
(global-set-key (kbd "C-x C-m") #'helm-M-x)
(global-set-key (kbd "C-x C-f") #'helm-find-files)
(global-set-key (kbd "C-x C-r") #'helm-recentf)
(global-set-key (kbd "C-x r l") #'helm-filtered-bookmarks)
(global-set-key (kbd "M-y")     #'helm-show-kill-ring)
(global-set-key (kbd "M-s o")   #'helm-swoop)
(global-set-key (kbd "M-s /")   #'helm-multi-swoop)

(require 'helm-config)
(helm-mode t)
(helm-adaptative-mode t)

(global-set-key (kbd "C-x c!")   #'helm-calcul-expression)
(global-set-key (kbd "C-x c:")   #'helm-eval-expression-with-eldoc)
(define-key helm-map (kbd "M-o") #'helm-previous-source)

(global-set-key (kbd "M-s s")   #'helm-ag)

(require 'helm-projectile)
(setq helm-projectile-sources-list (cons 'helm-source-projectile-files-list
                                         (remove 'helm-source-projectile-files-list 
                                              helm-projectile-sources-list)))
(helm-projectile-on)

(define-key projectile-mode-map (kbd "C-c p /")
  #'(lambda ()
      (interactive)
      (helm-ag (projectile-project-root))))

(define-key org-mode-map (kbd "C-x c o h") #'helm-org-headlines)
rimero
  • 634
  • 5
  • 6
  • @Ryan Notice that the default `helm-boring-file-regexp-list` contains much more than presented here. If you use remiro's setup, notice this point. Probably this is his preference. `helm-input-idle-delay` and `helm-idle-delay default` were 0.01 months ago, to make the fastest possible response. Overall, the setup is fine. – Tu Do Oct 31 '14 at 09:54
  • Your alignment is really nice! How do you set that up? – fommil Jan 14 '16 at 13:26
  • Thanks @fommil, I just use 'align-regexp' with '#' as parameter and occasionally `multiple-cursors`. – rimero Jan 16 '16 at 19:07
  • Your answer is very nice. I however have a question – using Projectile+Ido and `projectile-find-file` will only pop a single line at the bottom of the screen, Helm+Projectile will however a whole popup. Is there an option to change this behavior? – Ven May 19 '16 at 15:22
  • @Ven, there are couple of options for displaying IDO completions vertically such as https://www.emacswiki.org/emacs/InteractivelyDoThings#toc24, https://github.com/creichert/ido-vertical-mode.el, https://github.com/larkery/ido-grid-mode.el. – rimero Aug 04 '16 at 01:01