2015-06-15 09:05:52 +02:00
|
|
|
;;; core-helm.el
|
|
|
|
|
|
|
|
(use-package helm
|
|
|
|
:init
|
|
|
|
(defvar helm-global-prompt ">>> ")
|
2015-10-23 04:42:34 -04:00
|
|
|
(setq-default
|
|
|
|
helm-quick-update t
|
|
|
|
helm-reuse-last-window-split-state 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 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)
|
2015-06-15 09:05:52 +02:00
|
|
|
:config
|
|
|
|
(evil-set-initial-state 'helm-mode 'emacs)
|
|
|
|
|
2015-10-18 02:27:59 -04:00
|
|
|
;; Rewrite prompt for all helm windows
|
|
|
|
(defun helm (&rest plist)
|
|
|
|
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest))
|
|
|
|
(and helm-alive-p (memq 'allow-nest plist)))
|
|
|
|
#'helm-nest)
|
|
|
|
((keywordp (car plist))
|
|
|
|
#'helm)
|
|
|
|
(t #'helm-internal))))
|
|
|
|
(if (and helm-alive-p (eq fn #'helm))
|
|
|
|
(if (helm-alive-p)
|
|
|
|
(error "Error: Trying to run helm within a running helm session")
|
|
|
|
(with-helm-buffer
|
|
|
|
(prog1
|
|
|
|
(message "Aborting an helm session running in background")
|
|
|
|
;; `helm-alive-p' will be reset in unwind-protect forms.
|
|
|
|
(helm-keyboard-quit))))
|
|
|
|
(if (keywordp (car plist))
|
|
|
|
(progn
|
|
|
|
(setq helm--local-variables
|
|
|
|
(append helm--local-variables
|
|
|
|
(helm-parse-keys plist)))
|
|
|
|
(apply fn (mapcar (lambda (key) (if (eq key :prompt) helm-global-prompt (plist-get plist key)))
|
|
|
|
helm-argument-keys)))
|
|
|
|
(apply fn plist)))))
|
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(after! winner
|
|
|
|
(dolist (bufname '("*helm recentf*"
|
|
|
|
"*helm projectile*"
|
|
|
|
"*helm imenu*"
|
|
|
|
"*helm company*"
|
|
|
|
"*helm buffers*"
|
2015-07-23 01:34:36 +02:00
|
|
|
"*helm "
|
|
|
|
"*Helm Css SCSS*"
|
2015-06-15 09:05:52 +02:00
|
|
|
"*helm-ag*"
|
2015-10-08 01:47:21 -04:00
|
|
|
"*helm-ag-edit*"
|
2015-06-15 09:05:52 +02:00
|
|
|
"*Helm Swoop*"))
|
2015-10-08 01:47:21 -04:00
|
|
|
(push bufname winner-boring-buffers)))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2015-10-23 04:42:34 -04:00
|
|
|
(bind! (:map (helm-map helm-generic-files-map helm-find-files-map)
|
2015-10-18 02:27:59 -04:00
|
|
|
"C-w" 'evil-delete-backward-word
|
|
|
|
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
|
|
|
|
[escape] 'helm-keyboard-quit)
|
2015-10-23 04:42:34 -04:00
|
|
|
(:map helm-find-files-map
|
|
|
|
"C-w" 'helm-find-files-up-one-level
|
|
|
|
"TAB" 'helm-execute-persistent-action
|
|
|
|
"/" 'helm-execute-persistent-action)
|
2015-10-18 02:27:59 -04:00
|
|
|
(:map helm-ag-map
|
|
|
|
"<backtab>" 'helm-ag-edit)
|
|
|
|
(:map helm-ag-edit-map
|
|
|
|
"<escape>" 'helm-ag--edit-abort
|
|
|
|
:n "zx" 'helm-ag--edit-abort)
|
|
|
|
(:map helm-map
|
|
|
|
"C-u" 'helm-delete-minibuffer-contents))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2015-07-23 01:34:36 +02:00
|
|
|
;; Hide mode-line in helm windows
|
2015-06-15 09:05:52 +02:00
|
|
|
(advice-add 'helm-display-mode-line :override 'narf*helm-hide-modeline))
|
|
|
|
|
2015-10-18 02:27:59 -04:00
|
|
|
(use-package projectile
|
|
|
|
:diminish projectile-mode
|
|
|
|
:config
|
|
|
|
(add-hook! kill-emacs 'narf|projectile-invalidate-cache-maybe)
|
|
|
|
|
|
|
|
(setq-default projectile-enable-caching t)
|
|
|
|
(setq projectile-sort-order 'recentf
|
2015-10-26 01:38:00 -04:00
|
|
|
projectile-require-project-root nil
|
2015-10-18 02:27:59 -04:00
|
|
|
projectile-cache-file (concat narf-temp-dir "projectile.cache")
|
|
|
|
projectile-known-projects-file (concat narf-temp-dir "projectile.projects")
|
|
|
|
projectile-indexing-method 'alien
|
|
|
|
projectile-project-root-files narf-project-root-files)
|
|
|
|
|
|
|
|
(add-to-list 'projectile-globally-ignored-files "ido.last")
|
|
|
|
(add-to-list 'projectile-globally-ignored-directories "assets")
|
|
|
|
(add-to-list 'projectile-other-file-alist '("scss" "css"))
|
|
|
|
(add-to-list 'projectile-other-file-alist '("css" "scss"))
|
|
|
|
|
|
|
|
(projectile-global-mode +1)
|
|
|
|
|
|
|
|
(advice-add 'projectile-prepend-project-name :override 'narf*projectile-replace-prompt)
|
|
|
|
|
|
|
|
(require 'helm-projectile))
|
|
|
|
|
2015-06-24 15:39:13 +02:00
|
|
|
(use-package helm-ag
|
|
|
|
:commands (helm-ag
|
|
|
|
helm-ag-mode
|
|
|
|
helm-do-ag
|
|
|
|
helm-do-ag-this-file
|
|
|
|
helm-do-ag-project-root
|
|
|
|
helm-do-ag-buffers
|
|
|
|
helm-ag-project-root
|
|
|
|
helm-ag-pop-stack
|
|
|
|
helm-ag-buffers
|
2015-10-08 01:47:21 -04:00
|
|
|
helm-ag-clear-stack)
|
|
|
|
:config
|
|
|
|
(defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popwin-compat activate)
|
|
|
|
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it))
|
|
|
|
(defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popwin-compat activate)
|
|
|
|
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it))
|
|
|
|
|
|
|
|
;; I remove any attempt to kill the helm-ag window, because popwin handles it.
|
|
|
|
(defun helm-ag--edit (_candidate)
|
|
|
|
(let ((default-directory helm-ag--default-directory))
|
|
|
|
(with-current-buffer (get-buffer-create "*helm-ag-edit*")
|
|
|
|
(erase-buffer)
|
|
|
|
(setq-local helm-ag--default-directory helm-ag--default-directory)
|
|
|
|
(let (buf-content)
|
|
|
|
(with-current-buffer (get-buffer "*helm-ag*")
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line 1)
|
|
|
|
(let* ((body-start (point))
|
|
|
|
(marked-lines (cl-loop for ov in (overlays-in body-start (point-max))
|
|
|
|
when (eq 'helm-visible-mark (overlay-get ov 'face))
|
|
|
|
return (helm-marked-candidates))))
|
|
|
|
(if (not marked-lines)
|
|
|
|
(setq buf-content (buffer-substring-no-properties
|
|
|
|
body-start (point-max)))
|
|
|
|
(setq buf-content (concat (mapconcat 'identity marked-lines "\n") "\n")))))
|
|
|
|
(insert buf-content)
|
|
|
|
(add-text-properties (point-min) (point-max)
|
|
|
|
'(read-only t rear-nonsticky t front-sticky t))
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(setq header-line-format
|
|
|
|
(format "[%s] C-c C-c: Commit, C-c C-k: Abort"
|
|
|
|
(abbreviate-file-name helm-ag--default-directory)))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "^\\(\\(?:[^:]+:\\)\\{1,2\\}\\)\\(.*\\)$" nil t)
|
|
|
|
(let ((file-line-begin (match-beginning 1))
|
|
|
|
(file-line-end (match-end 1))
|
|
|
|
(body-begin (match-beginning 2))
|
|
|
|
(body-end (match-end 2)))
|
|
|
|
(add-text-properties file-line-begin file-line-end
|
|
|
|
'(face font-lock-function-name-face
|
|
|
|
intangible t))
|
|
|
|
(remove-text-properties body-begin body-end '(read-only t))
|
|
|
|
(set-text-properties body-end (1+ body-end)
|
|
|
|
'(read-only t rear-nonsticky t))))))))
|
|
|
|
(popwin:display-buffer (get-buffer "*helm-ag-edit*"))
|
|
|
|
;; (other-window 1)
|
|
|
|
;; (switch-to-buffer (get-buffer "*helm-ag-edit*"))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(setq next-error-function 'compilation-next-error-function)
|
|
|
|
(setq-local compilation-locs (make-hash-table :test 'equal :weakness 'value))
|
|
|
|
(use-local-map helm-ag-edit-map)))
|
2015-06-24 15:39:13 +02:00
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(use-package helm-org
|
|
|
|
:commands (helm-org-in-buffer-headings
|
|
|
|
helm-org-agenda-files-headings
|
|
|
|
helm-org-capture-templates))
|
|
|
|
|
|
|
|
(use-package helm-files
|
2015-07-03 00:26:18 +02:00
|
|
|
:commands (helm-recentf
|
|
|
|
helm-buffers
|
2015-10-23 04:42:34 -04:00
|
|
|
helm-buffers-list))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
|
|
|
|
:commands (helm-css-scss
|
|
|
|
helm-css-scss-multi
|
2015-07-23 01:34:36 +02:00
|
|
|
helm-css-scss-insert-close-comment)
|
|
|
|
:config
|
|
|
|
(setq helm-css-scss-split-direction 'split-window-vertically
|
|
|
|
helm-css-scss-split-with-multiple-windows t))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
(use-package helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
|
|
|
|
:defines (helm-swoop-last-prefix-number)
|
|
|
|
:commands (helm-swoop helm-multi-swoop helm-multi-swoop-all)
|
|
|
|
:config
|
|
|
|
(setq helm-swoop-use-line-number-face t
|
|
|
|
helm-swoop-split-with-multiple-windows t
|
|
|
|
helm-swoop-speed-or-color t))
|
|
|
|
|
|
|
|
;; (use-package helm-c-yasnippet :commands helm-yas-visit-snippet-file)
|
2015-07-23 01:34:36 +02:00
|
|
|
(use-package helm-semantic :commands helm-semantic-or-imenu)
|
|
|
|
(use-package helm-elisp :commands helm-apropos)
|
|
|
|
(use-package helm-command :commands helm-M-x)
|
2015-10-26 01:38:00 -04:00
|
|
|
(use-package helm-descbinds :command helm-descbinds)
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
(provide 'core-helm)
|
|
|
|
;;; core-helm.el ends here
|