<commit_before>;;; seanmacs-keybinds.el --- Core keybindings -*- lexical-binding: t; -*-

;;; Commentary:
;; Keybind configuration.

;;; Code:

(defvar core-leader-map (make-sparse-keymap)
  "Base keymap for all leader key commands.")

(defvar core-leader-key "SPC"
  "Leader key.")

(defun core/init-leader ()
  "Initialize the leader map."
  (progn
    (define-key evil-normal-state-map (kbd core-leader-key) core-leader-map)
    (define-key evil-visual-state-map (kbd core-leader-key) core-leader-map)))

(defun core/set-leader-keys (key def &rest bindings)
  "Set global keybinds on the leader map."
  (while key
    (define-key core-leader-map (kbd key) def)
    (setq key (pop bindings) def (pop bindings))))

(defalias 'core/leader 'core/set-leader-keys)

;; Applications
(core/leader
 "a e" 'mu4e
 "a d" 'docker
 "a g s" 'gcloud-instance-shell
 "a g e" 'gcloud-instance-eshell
 "a k" 'kube)

;; Dired/file management
(core/leader
 "d d" 'dired
 "d p" 'seanmacs/window-dired-project-left
 "d f" 'find-file)

;; Org
(core/leader
 "x x" 'org-capture
 "x l" 'org-agenda-list
 "x s" 'org-search-view)

;; Magit
(core/leader
 "g g" 'magit-status
 "g f" 'magit-file-dispatch)

;; Shell
(core/leader
 "s s" 'eshell
 "s n" 'eshell-new
 "s p" 'projectile-run-eshell)

;; Window management
(core/leader
 "w w" 'seanmacs/split-window-right
 "w h" 'seanmacs/split-window-below
 "w H" 'shrink-window-horizontally
 "w L" 'enlarge-window-horizontally
 "w K" 'shrink-window
 "w J" 'enlarge-window
 "w =" 'balance-windows
 "w u" 'winner-undo
 "w p" 'seanmacs/use-some-window
 "." 'repeat)

;; Buffer management
(core/leader
 "b r" 'seanmacs/rename-buffer-special
 "b v" 'revert-buffer
 "b k" 'kill-this-buffer
 "b i" 'seanmacs/indent-buffer)

;; Other
(core/leader
 "o b" 'ibuffer
 "o s" 'imenu)

;; Projectile
(core/leader
   "p" 'projectile-command-map)

;; Flycheck
(core/leader
   "f" 'flycheck-command-map)

;; Xref
(core/leader
   "r a" 'xref-find-apropos
   "r r" 'xref-find-references)

(defun seanmacs/evil-window-next-skip-dired-sidebar ()
  "Move the cursor to next window in cyclic order, skipping dired sidebar buffers."
  (interactive)<commit_msg>Add keybind for showing major mode keybinds<commit_after>;;; seanmacs-keybinds.el --- Core keybindings -*- lexical-binding: t; -*-

;;; Commentary:
;; Keybind configuration.

;;; Code:

(defvar core-leader-map (make-sparse-keymap)
  "Base keymap for all leader key commands.")

(defvar core-leader-key "SPC"
  "Leader key.")

(defun core/init-leader ()
  "Initialize the leader map."
  (progn
    (define-key evil-normal-state-map (kbd core-leader-key) core-leader-map)
    (define-key evil-visual-state-map (kbd core-leader-key) core-leader-map)))

(defun core/set-leader-keys (key def &rest bindings)
  "Set global keybinds on the leader map."
  (while key
    (define-key core-leader-map (kbd key) def)
    (setq key (pop bindings) def (pop bindings))))

(defalias 'core/leader 'core/set-leader-keys)

;; Applications
(core/leader
 "a e" 'mu4e
 "a d" 'docker
 "a g s" 'gcloud-instance-shell
 "a g e" 'gcloud-instance-eshell
 "a k" 'kube)

;; Dired/file management
(core/leader
 "d d" 'dired
 "d p" 'seanmacs/window-dired-project-left
 "d f" 'find-file)

;; Org
(core/leader
 "x x" 'org-capture
 "x l" 'org-agenda-list
 "x s" 'org-search-view)

;; Magit
(core/leader
 "g g" 'magit-status
 "g f" 'magit-file-dispatch)

;; Shell
(core/leader
 "s s" 'eshell
 "s n" 'eshell-new
 "s p" 'projectile-run-eshell)

;; Window management
(core/leader
 "w w" 'seanmacs/split-window-right
 "w h" 'seanmacs/split-window-below
 "w H" 'shrink-window-horizontally
 "w L" 'enlarge-window-horizontally
 "w K" 'shrink-window
 "w J" 'enlarge-window
 "w =" 'balance-windows
 "w u" 'winner-undo
 "w p" 'seanmacs/use-some-window
 "." 'repeat)

;; Buffer management
(core/leader
 "b r" 'seanmacs/rename-buffer-special
 "b v" 'revert-buffer
 "b k" 'kill-this-buffer
 "b i" 'seanmacs/indent-buffer)

;; Other
(core/leader
 "o b" 'ibuffer
 "o s" 'imenu)

;; Projectile
(core/leader
   "p" 'projectile-command-map)

;; Flycheck
(core/leader
   "f" 'flycheck-command-map)

;; Xref
(core/leader
   "r a" 'xref-find-apropos
   "r r" 'xref-find-references)

;; Help
(core/leader
 "h w" 'which-key-show-major-mode)

(defun seanmacs/evil-window-next-skip-dired-sidebar ()
  "Move the cursor to next window in cyclic order, skipping dired sidebar buffers."
  (interactive)
{'fraction_non_alphanumeric': 0.16404647983595352, 'fraction_numerical': 0.000455684666210982, 'mean_word_length': 3.7204301075268815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4530352', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1747, 'n_words': 446}