make find/replace work more like common gui editors

This commit is contained in:
KemoNine 2022-04-23 11:49:04 -04:00
parent e134aee2c8
commit ab75add52f
1 changed files with 21 additions and 0 deletions

View File

@ -146,6 +146,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Setup global keys
(cua-mode 1)
(global-set-key (kbd "C-g") 'goto-line)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(global-set-key (kbd "C-c m") 'menu-bar-open)
(global-set-key (kbd "C-c .") 'rotate-frame-clockwise)
@ -165,6 +166,26 @@
;; for this in lisp modes.
(global-set-key (kbd "C-c C-d") #'helpful-at-point)
; more vscode/gui styled find/replace
(defun query-replace-region-or-from-top ()
"If marked, query-replace for the region, else for the whole buffer (start from the top)"
(interactive)
(progn
(let ((orig-point (point)))
(if (use-region-p)
(call-interactively 'query-replace)
(save-excursion
(goto-char (point-min))
(call-interactively 'query-replace)))
(message "Back to old point.")
(goto-char orig-point))))
(bind-key* "M-%" 'query-replace-region-or-from-top)
(global-set-key (kbd "C-h") 'query-replace-region-or-from-top)
; more vscode/gui styled find/replace
(global-set-key (kbd "C-s") 'isearch-forward)
(global-set-key (kbd "C-f") 'isearch-forward)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Set some global config
(setq inhibit-splash-screen t) ; why do you need to tell me things i know by default