emacs helm

Helm has been released a long time, but I am always get used to ido.

But based on some article recently, and I am really like new things, so I decided to use the this helm package.

So, let’s start.

Install Helm

Helm Github already tell many things about the install, here I want to memo down what I do.

I always use the subtree to manage the package by myself, so

> git subtree add –prefix .emacs.d/plugins-subtree/helm-suite/helm –squash https://github.com/emacs-helm/helm.git master

> git subtree add –prefix .emacs.d/plugins-subtree/helm-suite/emacs-async –squash https://github.com/jwiegley/emacs-async.git master

go the helm folder:

> make

Before the config step, you can simply use the following command to have a test:

> ./emacs-helm.sh

This would be a simple test environment, and it’s very handy.
helm-preview.jpg

Basic Config Helm

Add the package to load path and active the helm

1
2
3
4
;; -*- coding: utf-8 -*-
(wttr/plugin:prepend-to-load-path "helm-suite/emacs-async")
(wttr/plugin:prepend-to-load-path "helm-suite/helm")
(require 'helm-config)

Some handy config

Enable global M-x

1
(global-set-key (kbd "M-x") 'helm-M-x)

The default behavior of Tab key is not handy enough, so change it:

1
2
3
(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

Some issue

Still, grep under windows, here is my solution, please not that, your grep under windows may not support --include well, so remove %e will fix it.

1
2
3
4
5
(if (executable-find "perl")
(setq helm-grep-default-command "perl ~/.emacs.d/extra-bin/ack/ack-standalone.pl -Hn --no-group --no-color %p %f"
helm-grep-default-recurse-command "perl ~/.emacs.d/extra-bin/ack/ack-standalone.pl -H --no-group --no-color %p %f")
(setq helm-grep-default-command "grep -a -d skip -n -e %p %f"
helm-grep-default-recurse-command "grep -a -d recurse -n -e %p %f"))

Some handy key

  • You can insert marked candidates into current buffer with C-c C-i
  • you can always switch it to vertical window with C-t. Running C-t again returns the Helm window back to horizontal and so on
  • You can mark candidates with C-SPC; this is useful when you need to perform an action on many candidates of your choice. M-a to select all.

further more

Read this article helm-intro


References:

And also:


坚持原创技术分享,您的支持将鼓励我继续创作!
0%