about summary refs log tree commit diff
path: root/configs/shared/.emacs.d/wpc/dotfiles.el
blob: ba15fd4d6b5b288da0e5cfe504a5e82981ea37f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;; dotfiles.el --- Elisp to make dotfile management -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com>

;;; Commentary:
;; Quickly edit commonly used files.

;;; Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'macros)
(require 'f)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; API
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defconst dotfiles/install-kbds? t
  "When t, install the keybindings.")

(defconst dotfiles/whitelist
  '(("compton" . "~/.config/compton.conf")
    ("dotfiles" . "~/Dropbox/dotfiles/")
    ("functions" . "~/functions.zsh")
    ("aliases" . "~/aliases.zsh")
    ("variables" . "~/variables.zsh")
    ("Xresources" . "~/.Xresources.shared")
    ("xsession" . "~/.xsessionrc.shared")
    ("tmux" . "~/.tmux.conf")
    ("zshrc" . "~/.zshrc")
    ("config.fish" . "~/.config/fish/config.fish")
    ("configuration.nix" . "~/Dropbox/programming/nixify/configuration.nix")
    ("init.el" . "~/.emacs.d/init.el")
    ("init.vim" . "~/.config/nvim/init.vim"))
  "Dotfiles that I commonly edit.")

(defun dotfiles/edit ()
  "Select a dotfile from ivy and edit it in an Emacs buffer."
  (interactive)
  (ivy-read
   "Dotfile: "
   dotfiles/whitelist
   :action (>> cdr find-file)))

(defun dotfiles/find-emacs-file (name)
  "Call `find-file' on NAME located in dotfiles's emacs.d directory."
  (find-file
   (f-join "~/Dropbox/dotfiles/configs/shared/.emacs.d" name)))

(when dotfiles/install-kbds?
  (evil-leader/set-key "J" #'dotfiles/edit))

(provide 'dotfiles)
;;; dotfiles.el ends here