diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/init.el | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/emacs/init.el b/emacs/init.el index 8b77b4d..2d81756 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -722,14 +722,42 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;;; Search in buffer ;; Isearch is good, but it has some rough edges. The easiest way forward was just to use ctrlf, which fixes most of them. -(use-package ctrlf :ensure t) -(global-set-key [remap isearch-forward] #'ctrlf-forward-default) -(global-set-key [remap isearch-backward] #'ctrlf-backward-default) -(global-set-key [remap isearch-forward-regexp] #'ctrlf-forward-alternate) -(global-set-key [remap isearch-backward-regexp] #'ctrlf-backward-alternate) +;; (use-package ctrlf :ensure t) +;; (global-set-key [remap isearch-forward] #'ctrlf-forward-default) +;; n(global-set-key [remap isearch-backward] #'ctrlf-backward-default) +;; (global-set-key [remap isearch-forward-regexp] #'ctrlf-forward-alternate) +;; (global-set-key [remap isearch-backward-regexp] #'ctrlf-backward-alternate) + +;; (use-package casual-isearch :ensure t) +;; (define-key isearch-mode-map (kbd "<f2>") #'casual-isearch-tmenu) +(define-key isearch-mode-map (kbd "<f2>") #'cc-isearch-menu-transient) ;; It makes more sense to go to the start of the match, because i start searching where i want to be. -(setopt ctrlf-go-to-end-of-match nil ) +(defun isearch-exit-at-front () + "always exit isearch, at the front of search match." + (interactive) + (isearch-exit) + (when isearch-forward + (goto-char isearch-other-end))) +(defun isearch-exit-at-end () + "Always exit isearch, at the end of search match." + (interactive) + (isearch-exit) + (when (not isearch-forward) + (goto-char isearch-other-end))) + +(define-key isearch-mode-map (kbd "<return>") #'isearch-exit-at-front) +(define-key isearch-mode-map (kbd "C-<return>") #'isearch-exit-at-end) +(define-key isearch-mode-map (kbd "M-<") #'isearch-beginning-of-buffer) +(define-key isearch-mode-map (kbd "M->") #'isearch-end-of-buffer) +;; Make isearch always quit on C-g +(define-key isearch-mode-map (kbd "C-g") #'isearch-cancel) +(define-key isearch-mode-map (kbd "C-o") #'isearch-occur) +(setopt search-whitespace-regexp ".*?") +(setopt isearch-lax-whitespace t) +(setopt isearch-lazy-count t) + +;; (add-hook 'occur-mode-hook #'hl-line-mode) (global-set-key (kbd "M-o") 'other-window) (global-set-key (kbd "C-x k") 'kill-this-buffer) |