(progn (define-prefix-command 'jrm-key-map))
(global-set-key (kbd "C-x C-j") jrm-key-map)
(global-set-key (kbd "C-o") 'other-window)
(define-key dired-mode-map (kbd "C-o") 'other-window)
(define-key rg-mode-map (kbd "C-o") 'other-window)
(define-key grep-mode-map (kbd "C-o") 'other-window)
(global-set-key (kbd "C-x C-j p") 'jrm/adjust-font-size)
(global-set-key (kbd "s-u") '(lambda () (interactive) (revert-buffer t (not (buffer-modified-p)) t)))
(global-set-key (kbd "<f9>") 'other-frame)
(global-set-key (kbd "C-c l l") 'display-line-numbers-mode)
(global-set-key (kbd "<f9>") 'other-frame)
(global-set-key (kbd "C-x C-b") 'ibuffer)
For some reason, using a setq or the :config or :custom keyword in use-package does not set the variable correctly for vterm. Resorting to custom-set-variables.
(custom-set-variables
'(vterm-keymap-exceptions (push "<f9>" vterm-keymap-exceptions))
'(vterm-keymap-exceptions (push "C-o" vterm-keymap-exceptions)))
(define-key vterm-mode-map (kbd "C-q") #'vterm-send-next-key)
Adjust the local mark ring pop key sequence, so after pressing `C-u C-SPC`, you can just press `C-SPC` to keep jumping.
(setq set-mark-command-repeat-pop t)
Setup custom minor mode so keybindings can be turned on/off easily. This is helpful as some major modes want to use these keybindings but I would rather have them bound to custom functions by default, but global-set-key
doesn’t take priority when a major mode specifies custom bindings. See: https://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs
(defun jrm/avy-dwim (&optional arg)
"Install avy if missing, otherwise call goto-word or goto-char-timer if argument is provided"
(interactive "P")
(if (require 'avy nil 'no-error)
(if arg
(call-interactively 'avy-goto-char-timer)
(call-interactively 'avy-goto-word-1))
(if (yes-or-no-p "Package Avy is not installed. Would you like Emacs to install it for you?")
(use-package avy :config (if arg (call-interactively 'avy-goto-char-timer)
(call-interactively 'avy-goto-word-1))))))
(defvar jrm-keys-minor-mode-map
(let ((map (make-sparse-keymap)))
;; Navigation
(define-key map (kbd "M-n") 'forward-paragraph)
(define-key map (kbd "M-p") 'backward-paragraph)
(define-key map (kbd "C-c M-j") 'counsel-org-goto-all)
(define-key map (kbd "M-s") 'jrm/avy-dwim)
map)
"Jrm keys minor mode keymap.")
(define-minor-mode jrm-keys-minor-mode
"A minor mode so that my key bindings override annoying major modes."
:init-value t
:lighter " jrm-keys")
(jrm-keys-minor-mode 1)
;; Don't show minor mode in minibuffer
(defun jrm-minibuffer-setup-hook ()
(jrm-keys-minor-mode 0))
(add-hook 'minibuffer-setup-hook 'jrm-minibuffer-setup-hook)