ido에서 helm으로 넘어오다
거의 이맥스를 사용하기 시작하면서부터 줄곧 ido와 smex를 사용하고 있었는 데, 며칠 전 helm-cmd-t에 혹해서, 사실 더 정확히는 VIM의 command-t에 혹했다는게 맞겠지만, 어쨌건 helm으로 넘어가 보기로 했다. 아직 초기라 거의 튜토리얼 보고 나름 필수 패키지라는 것들만 사용해보고 있기는 한데, 뭐 ido 시절에 비해 확실히 편리한 점이 있기는 있네. 일단은 약간의 시행 착오 끝에 아래의 패키지를 추가해서 쓰고 있다:
- helm : helm 메인 패키지
- ac-helm : auto-complete를 helm 인터페이스를 사용하도록 하는 패키지
- helm-projectile : projectile과 helm을 연동해 주는 패키지
- helm-ls-git : git 파일이나 버퍼를 helm 인터페이스로 검색하는 패키지
정작 원래 사용하려고 했던 helm-cmd-t는 기능이 helm-ls-git나 helm-projectile과 거의 겹치지만 실제로 사용해 보니 위의 둘 보다 별로라서 사용하지 않게 되었다. flx를 helm에 연동한 helm-flx도 써보긴 했는데 이걸 쓰니 helm-M-x의 응답시간이 현저하게 느려지는 것 같아서 이것도 조금 쓰다가 폐기해 버렸다.
;; utils-helm.el
;; Written by Yunsik Jang <doomsday@kldp.org>
;; You can use/modify/redistribute this freely.
(require 'helm)
(require 'helm-config)
(require 'helm-projectile)
(let ((map helm-map))
(define-key map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
(define-key map (kbd "C-z") 'helm-select-action)
(define-key map (kbd "M-f") 'helm-next-source)
(define-key map (kbd "M-b") 'helm-previous-source))
(setq helm-split-window-preferred-function 'helm-split-window-default-fn
helm-move-to-line-cycle-in-source t
helm-ff-search-library-in-sexp t
helm-scroll-amount 8
helm-ff-file-name-history-use-recentf t
helm-M-x-fuzzy-match t
;; projectile
projectile-enable-caching t
projectile-file-exists-remote-cache-expire (* 10 60)
projectile-completion-system 'helm
projectile-switch-project 'helm-projectile)
;; replace projectile prefix key
(let ((map projectile-mode-map))
(define-key map projectile-keymap-prefix nil)
(define-key map (kbd "C-x p") 'projectile-command-map))
(projectile-global-mode)
(helm-autoresize-mode 1)
(helm-projectile-on)
;; http://emacs.stackexchange.com/questions/2563/helm-search-within-buffer-feature
(defconst my:helm-follow-sources
'(helm-source-occur)
"List of sources for which helm-follow-mode should be enabled")
(defun my:helm-set-follow ()
"Enable helm-follow-mode for the sources specified in the list
variable `my-helm-follow-sources'. This function is meant to
be run during `helm-initialize' and should be added to the hook
`helm-before-initialize-hook'."
(mapc (lambda (source)
(when (memq source my:helm-follow-sources)
(helm-attrset 'follow 1 (symbol-value source))))
helm-sources))
;; Add hook to enable helm-follow mode for specified helm
(add-hook 'helm-before-initialize-hook 'my:helm-set-follow)
(provide 'utils-helm)
위는 helm 설정 파일인데, 아직 거의 처음 사용하는 것이라 사실 거의 튜토리얼 기본 셋 정도이다. 다만 마지막의 my:helm-set-follow 함수는 stackoverflow에서 주워 온 건데 helm-occur에서 선택한 항목의 위치를 원래 버퍼에서 추적해 주도록 하는 것으로, 이건 정말 쓸만하다. 보통은 버퍼 내의 정규 표현 검색을 위해서 helm-swoop을 많이 사용하지만 아직까지는 my:helm-set-follow과 helm-occur 조합만으로도 쓸만해서 helm-swoop은 설치하고 있지 않다.
오늘로써 helm으로 넘어 온 지 3일 정도 된 것 같은데, 현재 시점에서 helm에 대한 감상은... 뭐 일단 쓸만한 게 좀 있어서 좋긴 하지만 가끔 의도한 대로 동작하지 않는 경우가 종종 있어서 계속 쓰게 될 지는 아직 좀 고민해봐야 할 것 같다. candidates source도 auto-complete처럼 그냥 ac-sources에 등록만 해놓으면 엔진에서 알아서 가져다 보여주거나 쓰는 게 아니라, 이건 좀 목적에 따른 source를 helm이라는 공용 인터페이스를 사용해서 선택할 수 있게 하는 형태라 키 바인딩이 좀 더 번잡해 진 것 같기도 하고...
'Emacs' 카테고리의 다른 글
| rfcview.el : Emacs RFC Viewer (0) | 2016.10.31 |
|---|---|
| framemove.el : Emacs frame간 이동 (0) | 2016.06.25 |
| Emacs에서 End of Line 타입 변경을 간편하게! (0) | 2016.05.11 |
| Emacs 읽기 전용 버퍼에서 모드 키 조합 없이 이동하기 (0) | 2016.04.07 |
| Emacs의 자동 저장 및 복구 기능을 좀 더 잘 활용하자 (0) | 2016.04.04 |