emacs/elisp/init-search.el
2024-05-25 22:49:04 +02:00

92 lines
2.7 KiB
EmacsLisp

;;; init-search.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-search.el
;; Description: Initialize Packages for Searching
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Thu Mar 14 11:01:43 2019 (-0400)
;; Version: 3.0
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: M-EMACS .emacs.d color-rg rg
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes ivy swiper counsel color-rg
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-global-config))
;; IvyPac
(use-package ivy
:diminish
:init
(use-package amx :defer t)
(use-package counsel :diminish :config (counsel-mode 1))
(use-package swiper :defer t)
(ivy-mode 1)
:bind
(("C-s" . swiper-isearch)
("C-z s" . counsel-rg)
("C-z b" . counsel-buffer-or-recentf)
("C-z C-b" . counsel-ibuffer)
(:map ivy-minibuffer-map
("M-RET" . ivy-immediate-done))
(:map counsel-find-file-map
("C-~" . counsel-goto-local-home)))
:custom
(ivy-use-virtual-buffers t)
(ivy-height 10)
(ivy-on-del-error-function nil)
(ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-create)
(ivy-count-format "【%d/%d】")
(ivy-wrap t)
:config
(defun counsel-goto-local-home ()
"Go to the $HOME of the local machine."
(interactive)
(ivy--cd "~/")))
;; -IvyPac
;; ColorRGPac
(use-package color-rg
:load-path (lambda () (expand-file-name "site-elisp/color-rg" user-emacs-directory))
:if (executable-find "rg")
:bind ("C-M-s" . color-rg-search-input))
;; -ColorRGPac
;; FFIPPac
(use-package find-file-in-project
:if (executable-find "find")
:init
(when (executable-find "fd")
(setq ffip-use-rust-fd t))
:bind (("C-z o" . ffap)
("C-z p" . ffip)))
;; -FFIPPac
(provide 'init-search)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-search.el ends here