2018-06-02 20:32:52 +02:00
|
|
|
;;; completion/helm/autoload/helm.el -*- lexical-binding: t; -*-
|
|
|
|
|
2018-08-04 16:00:11 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun +helm/projectile-find-file ()
|
|
|
|
"Call `helm-find-files' if called from HOME, otherwise
|
|
|
|
`helm-projectile-find-file'."
|
|
|
|
(interactive)
|
|
|
|
(call-interactively
|
|
|
|
(if (or (file-equal-p default-directory "~")
|
2018-12-05 14:16:42 -05:00
|
|
|
(if-let* ((proot (doom-project-root)))
|
|
|
|
(file-equal-p proot "~")
|
|
|
|
t))
|
2018-08-04 16:00:11 +02:00
|
|
|
#'helm-find-files
|
|
|
|
#'helm-projectile-find-file)))
|
|
|
|
|
2018-08-05 23:42:27 +02:00
|
|
|
;;;###autoload
|
2018-08-13 01:51:34 +02:00
|
|
|
(defun +helm/workspace-buffer-list ()
|
|
|
|
"A version of `helm-buffers-list' with its buffer list restricted to the
|
2018-08-05 23:42:27 +02:00
|
|
|
current workspace."
|
|
|
|
(interactive)
|
2019-04-21 19:59:44 -04:00
|
|
|
(unless (featurep! :ui workspaces)
|
|
|
|
(user-error "This command requires the :ui workspaces module"))
|
2018-08-13 01:51:34 +02:00
|
|
|
(with-no-warnings
|
|
|
|
(with-persp-buffer-list nil (helm-buffers-list))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +helm/workspace-mini ()
|
|
|
|
"A version of `helm-mini' with its buffer list restricted to the current
|
|
|
|
workspace."
|
|
|
|
(interactive)
|
2019-04-21 19:59:44 -04:00
|
|
|
(unless (featurep! :ui workspaces)
|
|
|
|
(user-error "This command requires the :ui workspaces module"))
|
2018-08-13 01:51:34 +02:00
|
|
|
(with-no-warnings
|
|
|
|
(with-persp-buffer-list nil (helm-mini))))
|
2018-08-05 23:42:27 +02:00
|
|
|
|
2018-06-02 20:32:52 +02:00
|
|
|
|
|
|
|
;;
|
2019-11-15 22:16:09 -05:00
|
|
|
;;; Project search
|
2018-06-02 20:32:52 +02:00
|
|
|
|
2018-06-20 15:37:31 +02:00
|
|
|
;;;###autoload
|
2019-12-23 01:51:43 -05:00
|
|
|
(cl-defun +helm-file-search (&key query in all-files (recursive t) _prompt args)
|
2019-11-17 01:19:59 -05:00
|
|
|
"Conduct a file search using ripgrep.
|
2018-06-20 15:37:31 +02:00
|
|
|
|
|
|
|
:query STRING
|
|
|
|
Determines the initial input to search for.
|
|
|
|
:in PATH
|
|
|
|
Sets what directory to base the search out of. Defaults to the current
|
|
|
|
project's root.
|
|
|
|
:recursive BOOL
|
|
|
|
Whether or not to search files recursively from the base directory."
|
|
|
|
(declare (indent defun))
|
2019-11-17 01:19:59 -05:00
|
|
|
(unless (executable-find "rg")
|
|
|
|
(user-error "Couldn't find ripgrep in your PATH"))
|
2019-12-05 16:10:46 -05:00
|
|
|
(require 'helm-rg)
|
2019-12-17 23:31:10 -05:00
|
|
|
(let ((this-command 'helm-rg)
|
|
|
|
(helm-rg-default-directory (or in (doom-project-root) default-directory))
|
2019-12-05 16:10:46 -05:00
|
|
|
(helm-rg-default-extra-args
|
2019-12-23 01:51:43 -05:00
|
|
|
(delq nil (append (list (when all-files "-z -uu")
|
|
|
|
(unless recursive "--maxdepth 1"))
|
|
|
|
args))))
|
2019-12-05 16:10:46 -05:00
|
|
|
(helm-rg (or query
|
|
|
|
(when (use-region-p)
|
|
|
|
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
|
|
|
|
(end (or (bound-and-true-p evil-visual-end) (region-end))))
|
|
|
|
(when (> (abs (- end beg)) 1)
|
|
|
|
(buffer-substring-no-properties beg end))))
|
|
|
|
""))))
|
2018-06-02 20:32:52 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-04-14 13:36:56 -04:00
|
|
|
(defun +helm/project-search (&optional arg initial-query directory)
|
2019-11-17 01:19:59 -05:00
|
|
|
"Performs a project search from the project root with ripgrep.
|
2018-06-02 20:32:52 +02:00
|
|
|
|
2019-04-14 13:36:56 -04:00
|
|
|
ARG (universal argument), include all files, even hidden or compressed ones, in
|
|
|
|
the search."
|
2018-06-02 20:32:52 +02:00
|
|
|
(interactive "P")
|
2019-11-17 01:19:59 -05:00
|
|
|
(+helm-file-search
|
|
|
|
:query initial-query
|
|
|
|
:in directory
|
|
|
|
:all-files (and (not (null arg))
|
|
|
|
(listp arg))))
|
2018-06-02 20:32:52 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-04-16 23:31:23 +10:00
|
|
|
(defun +helm/project-search-from-cwd (&optional arg initial-query)
|
2018-08-13 01:59:25 +02:00
|
|
|
"Performs a project search recursively from the current directory.
|
2018-06-02 20:32:52 +02:00
|
|
|
|
2019-11-17 01:19:59 -05:00
|
|
|
If ARG (universal argument), include all files, even hidden or compressed ones."
|
2018-06-02 20:32:52 +02:00
|
|
|
(interactive "P")
|
2019-11-17 01:19:59 -05:00
|
|
|
(+helm-file-search
|
|
|
|
:query initial-query
|
|
|
|
:in default-directory
|
|
|
|
:all-files (and (not (null arg))
|
|
|
|
(listp arg))))
|
2018-08-13 01:59:25 +02:00
|
|
|
|
2019-11-17 01:19:59 -05:00
|
|
|
;;;###autoload
|
|
|
|
(defun +helm/jump-list ()
|
|
|
|
"TODO"
|
|
|
|
(interactive)
|
|
|
|
(error "not implemented yet"))
|