few chages for page-up/page-down

This commit is contained in:
Alexey Norets 2026-05-02 10:08:58 +03:00
parent bcaa2a1ae1
commit 6784039531

110
init.el
View File

@ -106,17 +106,17 @@
((eq evil-state 'normal) "<N>") ((eq evil-state 'normal) "<N>")
((eq evil-state 'emacs) "<E>") ((eq evil-state 'emacs) "<E>")
(t " * "))) (t " * ")))
(setq-default mode-line-format '("%e " mode-line-modified " " ;; (setq-default mode-line-format '("%e " mode-line-modified " "
(:eval (propertize (buffer-name)) 'face 'font-lock-constant-face) ;; (:eval (propertize (buffer-name)) 'face 'font-lock-constant-face)
"%6l:%c (%o) " ;; "%6l:%c (%o) "
(:eval ;; (:eval
(if (and (mode-line-window-selected-p) (bound-and-true-p evil-mode)) ;; (if (and (mode-line-window-selected-p) (bound-and-true-p evil-mode))
(my-evil-mode-indicator)) ;; (my-evil-mode-indicator))
" ") ;; " ")
(:eval (unless (not vc-mode) (concat " | Git:" (substring-no-properties vc-mode 5)))) ;; (:eval (unless (not vc-mode) (concat " | Git:" (substring-no-properties vc-mode 5))))
mode-line-format-right-align ;; mode-line-format-right-align
(:eval (concat " " (symbol-name major-mode))) ;; (:eval (concat " " (symbol-name major-mode)))
" " mode-line-misc-info)) ;; " " mode-line-misc-info))
(use-package emacs (use-package emacs
:init :init
@ -203,18 +203,18 @@
:ensure t :ensure t
:init :init
:custom :custom
(denote-directory "~/Nextcloud/DenoteNotes/") (denote-directory "~/NCKlinsoft/DenoteNotes/")
:hook :hook
(dired-mode . denote-dired-mode) (dired-mode . denote-dired-mode)
:custom-face :custom-face
(denote-faces-link ((t (:slant italic))))) (denote-faces-link ((t (:slant italic)))))
(global-set-key (kbd "C-c n n") 'denote-open-or-create) (global-set-key (kbd "C-c n n") 'denote-open-or-create)
(use-package consult-denote ;; (use-package consult-denote
:ensure t ;; :ensure t
:config ;; :config
(define-key global-map (kbd "C-c n f") #'consult-denote-find) ;; (define-key global-map (kbd "C-c n f") #'consult-denote-find)
(define-key global-map (kbd "C-c n g") #'consult-denote-grep)) ;; (define-key global-map (kbd "C-c n g") #'consult-denote-grep))
(use-package vertico (use-package vertico
:ensure t :ensure t
@ -316,6 +316,12 @@
:bind :bind
(:map isearch-mode-map (:map isearch-mode-map
("C-f" . my-project-search-from-isearch))) ("C-f" . my-project-search-from-isearch)))
(use-package isearch
:ensure nil
:defer t
:bind
(:map isearch-mode-map
("C-d" . isearch-forward-symbol-at-point)))
;; Selection window (rg, grep, help etc). ----- ;; Selection window (rg, grep, help etc). -----
@ -436,6 +442,7 @@
(setq org-src-preserve-indentation t) (setq org-src-preserve-indentation t)
(setq org-src-tab-acts-natively t) (setq org-src-tab-acts-natively t)
(setq org-hide-emphasis-markers nil) (setq org-hide-emphasis-markers nil)
(setq org-agenda-files (quote ("~/Nextcloud/DenoteNotes/")))
(setq org-edit-src-content-indentation 0)) (setq org-edit-src-content-indentation 0))
@ -528,11 +535,10 @@
(global-set-key (kbd "C-z") 'move-text-down) (global-set-key (kbd "C-z") 'move-text-down)
(global-set-key (kbd "C-q") 'move-text-up) (global-set-key (kbd "C-q") 'move-text-up)
;; (global-set-key (kbd "C-c t c") 'avy-goto-char) ;; (global-set-key (kbd "C-'") 'avy-goto-char)
(global-set-key (kbd "C-'") 'avy-goto-char) (keymap-global-set "C-;" 'avy-goto-char)
;; (global-set-key (kbd "C-c t w") 'avy-goto-word-0) (keymap-set org-mode-map "C-;" 'avy-goto-char)
(global-set-key (kbd "C-,") 'avy-goto-word-0) (global-set-key (kbd "C-:") 'avy-goto-word-0)
;;; Functions. ----- ;;; Functions. -----
;;RecentFiles ;;RecentFiles
@ -547,23 +553,44 @@
(global-set-key "\C-x\C-r" 'my/recentf-open-files-compl) (global-set-key "\C-x\C-r" 'my/recentf-open-files-compl)
;; Half page up/down ;; Half page up/down
(defun my/half-page-up () (defun my/half-page-up ()
(interactive) (interactive)
;; (scroll-down-command ) (let ((target-line (/ (window-height) 2)))
(move-to-window-line-top-bottom 0) (condition-case nil
(recenter)) (scroll-down (/ (window-height) 2))
(global-set-key (kbd "M-p") 'my/half-page-up) (error nil))
(sit-for 0)
(move-to-window-line target-line)))
(defun my/half-page-down () (defun my/half-page-down ()
(interactive) (interactive)
(if (eq (line-number-at-pos) (line-number-at-pos (window-start))) (let ((target-line (/ (window-height) 2)))
;; If the cursor is at the top of the page, move it to the center (condition-case nil
(progn (scroll-up (/ (window-height) 2))
(let ((middle-line (1+ (/ (window-height) 2)))) (error nil))
(move-to-window-line middle-line))) (sit-for 0)
;; (scroll-up scroll-amount) (move-to-window-line target-line)))
(move-to-window-line -1 )
(recenter))) ;; (defun my/half-page-up ()
;; (interactive)
;; ;; (follow-scroll-down)
;; ;; (recenter))
;; (move-to-window-line-top-bottom 0)
;; (recenter))
(global-set-key (kbd "M-p") 'my/half-page-up)
;; (defun my/half-page-down ()
;; (interactive)
;; (if (eq (line-number-at-pos) (line-number-at-pos (window-start)))
;; ;; If the cursor is at the top of the page, move it to the center
;; (progn
;; (let ((middle-line (1+ (/ (window-height) 2))))
;; (move-to-window-line middle-line)))
;; ;; (scroll-up scroll-amount)
;; (move-to-window-line -1 )
;; (recenter)))
(global-set-key (kbd "M-n") 'my/half-page-down) (global-set-key (kbd "M-n") 'my/half-page-down)
;; Split window and follow cursor. ----- ;; Split window and follow cursor. -----
@ -650,6 +677,21 @@
(set-mark-command 1)) (set-mark-command 1))
(global-set-key (kbd "M-`") 'jump-to-mark) (global-set-key (kbd "M-`") 'jump-to-mark)
;; Show/hide `~*/+` symbols in org-mode ------
(defun my/org-toggle-emphasis ()
"Toggle hiding/showing of org emphasize markers."
(interactive)
(if org-hide-emphasis-markers
(set-variable 'org-hide-emphasis-markers nil)
(set-variable 'org-hide-emphasis-markers t))
(save-excursion
(goto-char (point-min))
(org-ctrl-c-ctrl-c)))
;; (org-reload))
(define-key org-mode-map (kbd "C-c e") 'my/org-toggle-emphasis)
;; (defun exchange-point-and-mark-no-activate () ;; (defun exchange-point-and-mark-no-activate ()
;; "Identical to \\[exchange-point-and-mark] but will not activate the region." ;; "Identical to \\[exchange-point-and-mark] but will not activate the region."
;; (interactive) ;; (interactive)