From 7da680e15f4e6e29571540b54a7a3f95700f405e Mon Sep 17 00:00:00 2001
From: Liu Miao <liumiaogemini@foxmail.com>
Date: Mon, 19 Oct 2020 13:46:50 +0000
Subject: [PATCH] add function user/counsel-search-rg

---
 lisp/functions.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lisp/functions.el b/lisp/functions.el
index 31a4080..c4dbb9d 100644
--- a/lisp/functions.el
+++ b/lisp/functions.el
@@ -19,5 +19,16 @@
   (interactive)
   (find-file user/userconfig-file))
 
+(defun user/counsel-search-rg (&optional initial-directory)
+  "Searching with rg in Emacs.  If INITIAL-DIRECTORY is non nil
+start in that directory."
+  (interactive)
+  (require 'counsel)
+  (let* ((default-directory
+	   (or initial-directory (read-directory-name "Start from directory: ")))
+	 )
+    (counsel-rg "" default-directory nil "Searching with rg: "))
+  )
+
 (provide 'functions)
 ;;; functions.el ends here
-- 
GitLab