(Emacs/elisp)~search/find-file can now open swiper in new buffer
If some universal argument is given to +search/find-file then after opening the file it'll open swiper. This reduces keystrokes and makes it easier to get to somewhere.
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(autoload #'swiper "swiper")
|
||||||
|
|
||||||
(defvar +search/directories
|
(defvar +search/directories
|
||||||
'("~/Dotfiles/" "~/Text/" "~/.local/src/dwm/" "~/.local/src/dwmblocks/" "~/.local/src/st/" "~/Website/")
|
'("~/Dotfiles/" "~/Text/" "~/.local/src/dwm/" "~/.local/src/dwmblocks/" "~/.local/src/st/" "~/Website/")
|
||||||
"List of directories to get candidates from.")
|
"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/get-candidates (expand-file-name directory)))
|
||||||
+search/directories)))
|
+search/directories)))
|
||||||
|
|
||||||
(defun +search/find-file ()
|
(defun +search/find-file (&optional arg)
|
||||||
(interactive)
|
(interactive "P")
|
||||||
(find-file
|
(let ((file-name (completing-read "Find file: " (+search/get-all-candidates) nil t)))
|
||||||
(completing-read "Find file: "
|
(with-current-buffer (find-file file-name)
|
||||||
(+search/get-all-candidates)
|
(if arg
|
||||||
nil
|
(swiper)))))
|
||||||
t)))
|
|
||||||
|
|
||||||
(defun +search/search-all ()
|
(defun +search/search-all ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|||||||
Reference in New Issue
Block a user