doomemacs/core/defuns/defuns-helm.el

91 lines
3.4 KiB
EmacsLisp
Raw Normal View History

2015-06-15 09:05:52 +02:00
;;; defuns-helm.el
2016-05-20 22:37:30 -04:00
;;;###autoload (autoload 'doom:helm-recentf "defuns-helm" nil t)
(evil-define-command doom:helm-recentf (&optional bang)
2016-06-05 00:11:46 -04:00
"Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'."
2015-06-15 09:05:52 +02:00
:repeat nil
(interactive "<!>")
(if bang (helm-recentf) (helm-projectile-recentf)))
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp.
2016-05-20 22:37:30 -04:00
;;;###autoload (autoload 'doom:helm-ag-search "defuns-helm" nil t)
(evil-define-operator doom:helm-ag-search (beg end search regex-p &optional dir)
2016-03-31 03:19:30 -04:00
"Preform an helm-ag search with SEARCH. If SEARCH is nil and in visual mode, use the
selection, otherwise activate live ag searching in helm.
If REGEX-P is non-nil, SEARCH will be treated as a regular expression.
DIR specifies the default-directory from which ag is run."
2015-06-15 09:05:52 +02:00
:type inclusive
:repeat nil
(interactive "<r><a><!>")
(require 'helm-ag)
2016-05-20 22:37:30 -04:00
(let* ((helm-ag--default-directory (or dir (f-slash (doom/project-root))))
2016-03-11 19:30:38 -05:00
(helm-ag-command-option (unless regex-p "-Q "))
2015-06-15 09:05:52 +02:00
(input "")
(header-name (format "Search in %s" helm-ag--default-directory)))
(if search
(progn
(helm-attrset 'search-this-file nil helm-ag-source)
(setq helm-ag--last-query search))
(if (and beg end (/= beg (1- end)))
(setq input (buffer-substring-no-properties beg end))))
(helm-attrset 'name header-name helm-ag-source)
(helm :sources (if search helm-ag-source '(helm-source-do-ag))
2015-06-15 09:05:52 +02:00
:buffer "*helm-ag*"
2015-10-18 02:28:16 -04:00
:keymap helm-ag-map
2015-11-21 16:22:40 -05:00
:input input)))
2015-06-15 09:05:52 +02:00
2016-03-11 19:30:38 -05:00
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
;; as regexp
2016-05-20 22:37:30 -04:00
;;;###autoload (autoload 'doom:helm-ag-search-cwd "defuns-helm" nil t)
(evil-define-operator doom:helm-ag-search-cwd (beg end &optional search bang)
2015-06-15 09:05:52 +02:00
:type inclusive :repeat nil
(interactive "<r><a><!>")
2016-05-20 22:37:30 -04:00
(doom:helm-ag-search beg end search bang default-directory))
2015-06-15 09:05:52 +02:00
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
;; `scss-mode'
2016-05-20 22:37:30 -04:00
;;;###autoload (autoload 'doom:helm-swoop "defuns-helm" nil t)
(evil-define-command doom:helm-swoop (&optional search bang)
2015-06-15 09:05:52 +02:00
:repeat nil
(interactive "<a><!>")
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search)))
2015-06-15 09:05:52 +02:00
2015-12-09 17:10:12 -05:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/helm-buffers-dwim (&optional all-p)
2015-12-09 17:10:12 -05:00
"Displays open buffers in current project. If ALL-P, then show all open
buffers."
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-11 16:51:04 -05:00
(interactive)
2016-05-20 22:37:30 -04:00
(let ((doom-helm-force-project-buffers (and (not all-p) (doom/project-p))))
2015-12-09 17:10:12 -05:00
(helm-buffers-list)))
2016-05-20 19:08:02 -04:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom*helm-replace-prompt (plist)
2016-05-20 19:08:02 -04:00
(if (keywordp (car plist))
(setq plist (plist-put plist :prompt helm-global-prompt))
(setcar (nthcdr 2 plist) helm-global-prompt))
plist)
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom*helm-hide-header (source &optional force)
(doom-hide-mode-line-mode +1))
2016-05-20 19:08:02 -04:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom*helm-hide-source-header-maybe ()
2016-05-20 19:08:02 -04:00
(if (<= (length helm-sources) 1)
(set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111")
2016-05-20 22:37:30 -04:00
(set-face-attribute 'helm-source-header nil :height 1.0 :foreground doom-helm-header-fg)))
2016-05-20 19:08:02 -04:00
2016-05-30 21:19:10 -04:00
(defvar doom-helm-force-project-buffers nil
"If non-nil, helm-buffers-list will only show project buffers.")
;;;###autoload
(defun helm*buffer-list (&rest _)
(append (doom/get-buffer-names doom-helm-force-project-buffers)
(list doom-buffer-name)))
2015-06-15 09:05:52 +02:00
(provide 'defuns-helm)
;;; defuns-helm.el ends here