;;; navigation.el --- Navigation behavior config -*- lexical-binding: t -*- ;; This file is not part of GNU Emacs ;; 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 this program. If not, see . ;;; Commentary: ;; commentary ;;; Code: ;; Smooth scrolling (setq bidi-paragraph-direction 'left-to-right bidi-inhibit-bpa t bidi-display-reordering nil) (use-package ultra-scroll :straight (:host github :repo "jdtsmith/ultra-scroll") :init (setq scroll-conservatively 3 ; or whatever value you prefer, since v0.4 scroll-margin 0) ; important: scroll-margin>0 not yet supported :config (ultra-scroll-mode 1)) ;; Disable mouse input (defcustom theurgy-mouse-disabled t "Disable mouse input." :type 'boolean :group 'theurgy) (when theurgy-mouse-disabled (dolist (k '([mouse-1] [down-mouse-1] [drag-mouse-1] [double-mouse-1] [triple-mouse-1] [mouse-2] [down-mouse-2] [drag-mouse-2] [double-mouse-2] [triple-mouse-2] [mouse-3] [down-mouse-3] [drag-mouse-3] [double-mouse-3] [triple-mouse-3] [mouse-4] [down-mouse-4] [drag-mouse-4] [double-mouse-4] [triple-mouse-4] [mouse-5] [down-mouse-5] [drag-mouse-5] [double-mouse-5] [triple-mouse-5])) (global-unset-key k))) ;; Keyboard Scrolling (global-set-key (kbd "C-") '(lambda () (interactive) (scroll-up-line))) (global-set-key (kbd "C-") '(lambda () (interactive) (scroll-down-line))) (global-set-key (kbd "C-S-") '(lambda () (interactive) (scroll-up-line 10))) (global-set-key (kbd "C-S-") '(lambda () (interactive) (scroll-down-line 10))) (global-set-key (kbd "M-") #'scroll-other-window-down) (global-set-key (kbd "M-") #'scroll-other-window) ;; Windmove bindings (global-set-key (kbd "C-c ") 'windmove-left) (global-set-key (kbd "C-c ") 'windmove-right) (global-set-key (kbd "C-c ") 'windmove-up) (global-set-key (kbd "C-c ") 'windmove-down) ;; Fullscreen and maximize button (global-set-key (kbd "C-x ") 'toggle-frame-maximized) (global-set-key (kbd "C-x ") 'toggle-frame-fullscreen) ;; Line jumps (defun jump-to-line-absolute () (interactive) (let ((p display-line-numbers)) (setq display-line-numbers t) (call-interactively 'goto-line) (setq display-line-numbers p))) (defun relative-line-jump-helper (relative-line) (interactive "nGoto line: ") (goto-line (+ (line-number-at-pos) relative-line) '() t)) (defun jump-to-line-relative () (interactive) (let ((p display-line-numbers)) (setq display-line-numbers 'relative) (call-interactively 'relative-line-jump-helper) (setq display-line-numbers p))) (global-set-key (kbd "M-g g") 'jump-to-line-absolute) (global-set-key (kbd "M-g r") 'jump-to-line-relative) ;; Eglot and flymake bindings (global-set-key (kbd "M-g ") 'flymake-goto-prev-error) (global-set-key (kbd "M-g ") 'flymake-goto-next-error) (global-set-key (kbd "C-x M-f") 'eglot-code-actions) (provide 'navigation) ;;; navigation.el ends here