123 lines
3.6 KiB
Org Mode
123 lines
3.6 KiB
Org Mode
#+title: Buffer Config
|
|
#+author: Evie Litherland-Smith
|
|
#+email: evie@xenia.me.uk
|
|
#+language: en
|
|
#+filetags: :emacs:config:
|
|
#+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent
|
|
* Common buffer shortcuts
|
|
** Scratch buffer
|
|
#+begin_src emacs-lisp
|
|
;; Scratch buffer shortcut
|
|
(keymap-global-set "C-c w x" #'scratch-buffer)
|
|
#+end_src
|
|
** emacs init file
|
|
#+begin_src emacs-lisp
|
|
;; 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 e" #'my/open-init-file)
|
|
#+end_src
|
|
** NixOS config flake
|
|
#+begin_src emacs-lisp
|
|
;; 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)
|
|
#+end_src
|
|
** Templates file
|
|
#+begin_src emacs-lisp
|
|
;; Tempel template file shortcut
|
|
(defun my/open-template-file ()
|
|
"Open `tempel' template file."
|
|
(interactive)
|
|
(require 'tempel)
|
|
(find-file tempel-path))
|
|
(keymap-global-set "C-c w t" #'my/open-template-file)
|
|
#+end_src
|
|
** Org directory
|
|
#+begin_src emacs-lisp
|
|
;; Org directory shortcut
|
|
(defun my/open-org-directory ()
|
|
"Open base org-mode directory in dired."
|
|
(interactive)
|
|
(require 'org)
|
|
(find-file org-directory))
|
|
(keymap-global-set "C-c w o" #'my/open-org-directory)
|
|
#+end_src
|
|
** Default bibliography file
|
|
#+begin_src emacs-lisp
|
|
(defun my/open-global-bibliography ()
|
|
"Open `org-cite-global-bibliography'."
|
|
(interactive)
|
|
(require 'org)
|
|
(find-file (car org-cite-global-bibliography)))
|
|
(keymap-global-set "C-c w b" #'my/open-global-bibliography)
|
|
#+end_src
|
|
** RSS feeds file
|
|
#+begin_src emacs-lisp
|
|
;; Elfeed feeds file shortcut
|
|
(defun my/open-feeds-file ()
|
|
"Open org file containing elfeed sources."
|
|
(interactive)
|
|
(require 'org)
|
|
(require 'elfeed)
|
|
(require 'elfeed-org)
|
|
(find-file (expand-file-name "feeds.org" org-directory)))
|
|
(keymap-global-set "C-c w f" #'my/open-feeds-file)
|
|
#+end_src
|
|
** Documents and Downloads
|
|
#+begin_src emacs-lisp
|
|
(defun my/open-documents-directory ()
|
|
"Open Documents directory."
|
|
(interactive)
|
|
(find-file "~/Documents/"))
|
|
(defun my/open-downloads-directory ()
|
|
"Open Downloads directory."
|
|
(interactive)
|
|
(find-file "~/Downloads/"))
|
|
(keymap-global-set "C-c w d" #'my/open-documents-directory)
|
|
(keymap-global-set "C-c w C-d" #'my/open-downloads-directory)
|
|
#+end_src
|
|
** Projects directory
|
|
#+begin_src emacs-lisp
|
|
(defun my/open-projects-directory ()
|
|
"Open Projects directory.
|
|
Try `magit-clone-default-directory' if available, fall back to
|
|
~/Projects otherwise."
|
|
(interactive)
|
|
(require 'magit)
|
|
(find-file (if magit-clone-default-directory
|
|
magit-clone-default-directory
|
|
"~/Projects/")))
|
|
(keymap-global-set "C-c w p" #'my/open-projects-directory)
|
|
#+end_src
|
|
* Common project shortcuts
|
|
** NixOS
|
|
#+begin_src emacs-lisp
|
|
(defun my/open-nixos-project ()
|
|
"Open NixOS config project."
|
|
(interactive)
|
|
(require 'project)
|
|
(let ((nixos "/etc/nixos/"))
|
|
(if (file-directory-p nixos)
|
|
(project-switch-project nixos)
|
|
(warn (concat nixos " not found")))))
|
|
(keymap-global-set "C-c p n" #'my/open-nixos-project)
|
|
#+end_src
|
|
** emacs
|
|
#+begin_src emacs-lisp
|
|
(defun my/open-emacs-project ()
|
|
"Open Emacs config project."
|
|
(interactive)
|
|
(require 'project)
|
|
(project-switch-project user-emacs-directory))
|
|
(keymap-global-set "C-c p e" #'my/open-emacs-project)
|
|
#+end_src
|