Polish helm support + add in! macro

This commit is contained in:
Henrik Lissner 2015-10-23 04:42:34 -04:00
parent 2bfe7670c2
commit 66abf1522c
3 changed files with 52 additions and 41 deletions

View file

@ -28,6 +28,11 @@ during compilation."
'with-no-warnings)
(with-eval-after-load ',feature ,@forms)))
(defmacro in! (dir &rest forms)
(declare (indent defun))
`(let ((default-directory ,dir))
,@forms))
(defmacro add-hook! (hook &rest func-or-forms)
"A convenience macro for `add-hook'.

View file

@ -3,24 +3,27 @@
(use-package helm
:init
(defvar helm-global-prompt ">>> ")
(setq helm-quick-update t
helm-reuse-last-window-split-state t
(setq-default
helm-quick-update t
helm-reuse-last-window-split-state t
helm-buffers-fuzzy-matching t
helm-buffers-fuzzy-matching t
helm-apropos-fuzzy-match t
helm-M-x-fuzzy-match t
helm-recentf-fuzzy-match t
;; helm-mode-fuzzy-match t
helm-ff-auto-update-initial-value t
helm-find-files-doc-header nil
helm-ff-auto-update-initial-value nil
helm-find-files-doc-header nil
helm-candidate-number-limit 30
helm-bookmark-show-location t
;; let popwin handle this
helm-split-window-default-side 'other
helm-split-window-preferred-function 'narf/helm-split-window)
helm-candidate-number-limit 30
helm-bookmark-show-location t
;; let popwin handle this
helm-split-window-default-side 'other
helm-split-window-preferred-function 'narf/helm-split-window)
:config
(evil-set-initial-state 'helm-mode 'emacs)
(helm-adaptive-mode 1)
;; Rewrite prompt for all helm windows
(defun helm (&rest plist)
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest))
@ -59,10 +62,14 @@
"*Helm Swoop*"))
(push bufname winner-boring-buffers)))
(bind! (:map (helm-map helm-find-files-map)
(bind! (:map (helm-map helm-generic-files-map helm-find-files-map)
"C-w" 'evil-delete-backward-word
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
[escape] 'helm-keyboard-quit)
(:map helm-find-files-map
"C-w" 'helm-find-files-up-one-level
"TAB" 'helm-execute-persistent-action
"/" 'helm-execute-persistent-action)
(:map helm-ag-map
"<backtab>" 'helm-ag-edit)
(:map helm-ag-edit-map
@ -76,6 +83,12 @@
(use-package projectile
:diminish projectile-mode
;; :commands (helm-projectile-find-file
;; helm-projectile-find-file-in-known-projects
;; helm-projectile-find-other-file
;; helm-projectile-switch-to-buffer
;; helm-projectile-switch-project
;; helm-projectile-recentf)
:config
(add-hook! kill-emacs 'narf|projectile-invalidate-cache-maybe)
@ -167,15 +180,7 @@
(use-package helm-files
:commands (helm-recentf
helm-buffers
helm-buffers-list)
:config
(defun helm-recentf ()
"Reconfigured `helm-recentf' to use `helm', instead of `helm-other-buffer'"
(interactive)
(let ((helm-ff-transformer-show-only-basename nil))
(helm :sources '(helm-source-recentf)
:buffer "*helm recentf*"
:prompt helm-global-prompt))))
helm-buffers-list))
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
:commands (helm-css-scss
@ -197,6 +202,7 @@
(use-package helm-semantic :commands helm-semantic-or-imenu)
(use-package helm-elisp :commands helm-apropos)
(use-package helm-command :commands helm-M-x)
(use-package helm-descbinds :config (helm-descbinds-mode 1))
(provide 'core-helm)
;;; core-helm.el ends here

View file

@ -77,27 +77,27 @@
;; <leader>
(:prefix ","
:n "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
:n "<" 'helm-buffers-list
:n "." 'narf/ido-find-file
:n ">" 'narf/ido-find-file-other-window
:n "/" 'helm-projectile-find-file
:n ";" 'helm-semantic-or-imenu
:nv "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
:nv "<" 'helm-mini
:nv "." 'helm-find-files
:nv ">" 'helm-projectile-find-file-in-known-projects
:nv "/" 'helm-projectile-find-file
:nv ";" 'helm-semantic-or-imenu
:nv ":" 'helm-imenu-in-all-buffers
:n "]" 'helm-etags-select
:n "a" 'helm-projectile-find-other-file
:n "E" 'narf:ido-find-file-in-emacsd
:n "h" 'helm-apropos
;; :n "n" 'narf/ido-find-org-file
;; :n "N" 'narf:org-search-files-or-headers
:n "m" 'narf/ido-recentf
:n "M" 'helm-projectile-recentf ; recent PROJECT files
:n "p" 'helm-projectile-switch-project
:v "=" 'align-regexp
:nv "r" 'emr-show-refactor-menu
:nv "]" 'helm-etags-select
:nv "a" 'helm-projectile-find-other-file
:nv "E" (λ (in! narf-emacs-dir (helm-projectile-find-file)))
:nv "n" 'narf/ido-find-org-file
:nv "N" 'narf:org-search-files-or-headers
:nv "m" 'helm-recentf
:nv "M" 'helm-projectile-recentf ; recent PROJECT files
:nv "p" 'helm-projectile-switch-project
:v "=" 'align-regexp
:nv "r" 'emr-show-refactor-menu
:n "qq" 'evil-save-and-quit
:n "QQ" 'narf/kill-all-buffers-do-not-remember
:nv "qq" 'evil-save-and-quit
:nv "QQ" 'narf/kill-all-buffers-do-not-remember
:n "oo" 'narf-open-with
:n "ob" (λ (narf-open-with "Google Chrome"))