从IDO迁移到Helm时应如何更改工作流程


44

作为Emacs的新手,我发现IDO并喜欢它,因为它使搜索文件的速度变得如此之快。在此站点上花费了一些时间后,我阅读了有关Helm的越来越多的内容,并且我打算进行切换。我的一些问题是:

  1. 最大的区别是什么?
  2. 具体来说,查找文件,切换缓冲区或调用新命令时,我的工作流程应如何更改?

我使用这篇文章来设置Helm,但是我的文件搜索(C-x C-f)和缓冲开关(C-x b)看起来和以前几乎一样。

这是我的配置:

(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)

1
正如您已经意识到的那样,您忘记绑定Helm特定的命令来替换现有的Emacs命令。如果您继续阅读有关每个特定Helm命令的指南,则会看到我在每个部分中都放置了键绑定(如果可能)和设置。不过,请尽情享受Helm :)
Tu Do

Answers:


29

更新(头盔更改,个人配置更改和Tu Do注释)。

几年前,我从IDO转到Helm,从此再也没有回头。

  • 我发现演示文稿比例如ido-vertical-mode更干净。
  • Helm没有弹性匹配。
  • 您不需要smex等。Helm可以完成所有工作。
  • Tu do文章很好,因为它提供了Helm可以做的一些漂亮的动画屏幕截图。

我使用Helm弹丸,Helm俯冲,Helm语义,Helm ag和一些Helm交互式命令。在Melpa页面上查看可能与您感兴趣的Helm相关软件包。

这是我与头盔相关的一些设置:

(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)

@Ryan请注意,默认值helm-boring-file-regexp-list包含的内容远远超出此处提供的内容。如果使用remiro的设置,请注意这一点。可能这是他的偏爱。helm-input-idle-delay并且helm-idle-delay default在0.01个月前做出最快的反应。总体而言,设置很好。
Tu Do

您的定位真的很好!您如何设置?
fommil '16

感谢@fommil,我只是将'align-regexp'与'#'用作参数,偶尔使用multiple-cursors
rimero

你的回答很好。但是,我有一个问题–使用Projectile + Ido,并且projectile-find-file只会在屏幕底部弹出一行,但是Helm + Projectile会弹出整个窗口。是否可以更改此行为?
Ven

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.