diff options
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r-- | Emacs/.config/emacs/elisp/search.el | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Emacs/.config/emacs/elisp/search.el b/Emacs/.config/emacs/elisp/search.el index 1184c20..6336540 100644 --- a/Emacs/.config/emacs/elisp/search.el +++ b/Emacs/.config/emacs/elisp/search.el @@ -24,6 +24,8 @@ ;;; Code: +(autoload #'swiper "swiper") + (defvar +search/directories '("~/Dotfiles/" "~/Text/" "~/.local/src/dwm/" "~/.local/src/dwmblocks/" "~/.local/src/st/" "~/Website/") "List of directories to get candidates from.") @@ -46,13 +48,12 @@ Returns a list of files with the directory preprended to them." (+search/get-candidates (expand-file-name directory))) +search/directories))) -(defun +search/find-file () - (interactive) - (find-file - (completing-read "Find file: " - (+search/get-all-candidates) - nil - t))) +(defun +search/find-file (&optional arg) + (interactive "P") + (let ((file-name (completing-read "Find file: " (+search/get-all-candidates) nil t))) + (with-current-buffer (find-file file-name) + (if arg + (swiper))))) (defun +search/search-all () (interactive) |