emacs/config/buffers.org

1.9 KiB

Buffer Config

Common buffer shortcuts

Scratch buffer

  ;; Scratch buffer shortcut
  (keymap-global-set "C-c w x" #'scratch-buffer)

emacs init file

  ;; Config file shortcut
  (defun my/open-init-file ()
    "Open emacs init file"
    (interactive)
    (find-file (locate-user-emacs-file "init.el")))
  (keymap-global-set "C-c w c" #'my/open-init-file)

NixOS config flake

  ;; NixOS flake shortcut
  (defun my/open-nixos-flake ()
    "Open NixOS system config flake"
    (interactive)
    (let ((flake "/etc/nixos/flake.nix"))
      (if (file-exists-p flake)
          (find-file flake)
        (warn (concat flake " not found")))))
  (keymap-global-set "C-c w n" #'my/open-nixos-flake)

Templates file

  ;; Tempel template file shortcut
  (with-eval-after-load 'tempel
    (defun my/open-template-file ()
      "Open `tempel' template file"
      (interactive)
      (find-file tempel-path))
    (keymap-global-set "C-c w t" #'my/open-template-file))

Org directory

  ;; Org directory shortcut
  (with-eval-after-load 'org
    (defun my/open-org-directory ()
      "Open base org-mode directory in dired"
      (interactive)
      (find-file org-directory))
    (keymap-global-set "C-c w o" #'my/open-org-directory))

RSS feeds file

  ;; Elfeed feeds file shortcut
  (with-eval-after-load 'org
    (defun my/open-feeds-file ()
      "Open org file containing elfeed sources"
      (interactive)
      (require 'elfeed)
      (require 'elfeed-org)
      (find-file (expand-file-name "feeds.org" elfeed-base-directory))))
  (keymap-global-set "C-c w f" #'my/open-feeds-file)