~~/.doom.d -> ~/.config/doom

This commit is contained in:
dx
2020-07-15 15:56:08 +01:00
parent 33edf2cf6d
commit 6bdf6db3b4
42 changed files with 16 additions and 14 deletions

View File

@@ -0,0 +1,158 @@
#+TITLE: private/bindings Literate configuration
#+PROPERTY: header-args(elisp) :tangle config.el
* Introduction
This is the main document for this module (=private/bindings=).
To compile, simply execute the source code block below
#+BEGIN_SRC elisp :tangle no
(org-babel-tangle-file "README.org" "config.el")
#+END_SRC
* Initial
#+BEGIN_SRC elisp
;;; private/bindings/config.el -*- lexical-binding: t; -*-
#+END_SRC
* Leader
Bindings for the leader map
** Single binds
These are immediate bindings to the leader map that instantly launch functions when pressed.
This binding space is reserved for stuff I use quite often.
#+BEGIN_SRC elisp
(map!
:leader
"SPC" #'execute-extended-command
"!" #'async-shell-command
"T" #'eshell
"-" #'dired-jump
"_" #'dired-jump-other-window
";" #'eval-expression
"h" #'help-command
"w" #'ace-window)
#+END_SRC
** Files
#+BEGIN_SRC elisp
(map!
:leader
:prefix "f"
"r" #'counsel-recentf
"f" #'find-file
"p" #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles"))
"s" #'save-buffer
"d" #'dired)
#+END_SRC
** Buffers
#+BEGIN_SRC elisp
(map!
:leader
:prefix "b"
"n" #'next-buffer
"p" #'previous-buffer
"d" #'kill-current-buffer
"b" #'switch-to-buffer
"i" #'ibuffer)
#+END_SRC
** Search
#+BEGIN_SRC elisp
(map!
:leader
:prefix "s"
"i" #'imenu
"o" #'+lookup/online
(:after counsel
"s" #'swiper
"r" #'counsel-rg)
(:after counsel-etags
"t" #'counsel-etags-find-tag))
#+END_SRC
** Projectile
#+BEGIN_SRC elisp
(map!
:leader
:after projectile
:desc "Switch to p-buffer" ">" #'projectile-switch-to-buffer
:desc "Projects" "p" #'projectile-switch-project
(:prefix ("p" . "project")
:desc "Regen tags" "g" #'projectile-regenerate-tags
:desc "Open project files" "f" #'projectile-find-file))
#+END_SRC
** Code
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("c" . "code") ; Code
:desc "Compile" "c" #'compile
:desc "Compile via make" "m" #'+make/run
:desc "Undo tree" "u" #'undo-tree-visualize
(:after lsp
:desc "Format code lsp" "f" #'+default/lsp-format-region-or-buffer
:desc "Execute action" "a" #'lsp-execute-code-action))
#+END_SRC
** Magit and VC
#+BEGIN_SRC elisp
(map!
:leader
:prefix "g"
"g" #'magit-status
"c" #'magit-clone
"f" #'magit-fetch
"p" #'magit-pull)
#+END_SRC
** Notes
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("n" . "notes")
:desc "Open notes in dired" "-" #'(lambda () (interactive) (dired org-directory))
:desc "Open quicknotes" "q" #'(lambda () (interactive) (find-file (format "%s/qnotes.org" org-directory))))
#+END_SRC
** Frames
#+BEGIN_SRC elisp
(map!
:leader
:prefix "F"
"d" #'delete-frame)
#+END_SRC
* Company
#+BEGIN_SRC elisp
(map!
:after company
:map company-active-map
"C-j" #'company-select-next
"C-k" #'company-select-previous
"C-SPC" #'company-complete)
#+END_SRC
* Multi cursors
Setup bindings for multi cursors.
As it's a motion based system, use the "gz" namespace.
#+BEGIN_SRC elisp
(map!
:prefix "g"
(:prefix "z"
"m" #'evil-mc-resume-cursors
"p" #'evil-mc-pause-cursors
"d" #'evil-mc-make-all-cursors
"j" #'evil-mc-make-cursor-move-next-line
"k" #'evil-mc-make-cursor-move-prev-line
"z" #'evil-mc-make-cursor-at-pos))
#+END_SRC
* Quit
Quit Emacs or restart it
#+BEGIN_SRC elisp
(map!
:prefix "q"
"q" #'save-buffers-kill-terminal
"r" #'doom/restart)
#+END_SRC
* Remaps
#+BEGIN_SRC elisp
(define-key!
[remap org-goto] #'counsel-org-goto)
#+END_SRC
* Misc
Misc bindings that don't fit to any other category.
#+BEGIN_SRC elisp
(map!
"C-x C-z" #'text-scale-adjust
"TAB" #'evil-jump-item
"M-c" #'count-words-region
"M-s" #'occur)
#+END_SRC

View File

@@ -0,0 +1,21 @@
;;; private/completion/config.el -*- lexical-binding: t; -*-
(map!
:map icomplete-minibuffer-map
;; unbind anything I want to use for useful stuff
"C-j" nil
"C-k" nil
"C-b" nil
"TAB" nil
"C-j" #'icomplete-forward-completions
"C-k" #'icomplete-backward-completions
"C-n" #'icomplete-forward-completions
"C-p" #'icomplete-backward-completions
"TAB" #'icomplete-force-complete
"C-b" #'completions)
(setq icomplete-separator "\t|\t")
(setq icomplete-in-buffer t)
(add-hook 'doom-first-input-hook #'icomplete-mode)

View File

@@ -0,0 +1,19 @@
#+TITLE: private/gentemplate
#+DATE: March 17, 2020
* Description
This module allows users to clone templates from my Github to specific machines.
These templates allow for quick and easy setup for languages or frameworks where
this sort of thing isn't very nice to do (for example C++).
This module is used through the main function =+gentemplate/generate-template=.
It will ask what template you want to use then where to put it, finally doing
the necessary work to get you that template. You may mutate the variables
=+gentemplate/template-list= and =+gentemplate/profile-url= to customise your
templates.
* Prerequisites
- git
* Requirements
- ivy
- magit
- cl

View File

@@ -0,0 +1,36 @@
;;; private/gentemplate/config.el -*- lexical-binding: t; -*-
(require 'cl-lib)
(defvar +gentemplate/profile-url
"https://github.com/oreodave/"
"Profile to download templates from on github.")
(defvar +gentemplate/template-list
(list "CTemplate" "CPPTemplate" "PythonTemplate" "NodeTemplate" "ArduinoTemplate" "JavaTemplate")
"List of templates to use, relative to the profile-url")
(defun +gentemplate/offline ()
(eq (cl-list-length (network-interface-list)) 1))
(defun +gentemplate/copy-template (template-name dest)
"Copy a template project via it's `template-name' to a folder called `dest'"
(copy-directory (expand-file-name (concat "~/Code/Templates/" template-name)) dest))
(after! (ivy magit-clone)
(defun +gentemplate/download-template (template-name dest)
"Download a given template via its `template-name' to the `dest' folder"
(magit-clone-regular (concat +gentemplate/profile-url template-name) dest nil))
(defun +gentemplate/generate-template ()
(interactive)
(ivy-read
"Enter template: "
+gentemplate/template-list
:action
(lambda (template-name)
(let ((dir (read-directory-name "Enter directory to download to: "))
(offline (+gentemplate/offline)))
(if offline
(+gentemplate/copy-template template-name dir)
(+gentemplate/download-template template-name dir)))))))

View File

@@ -0,0 +1,7 @@
#+TITLE: private/narrow
#+DATE: May 10, 2020
* Description
Minimal configuration for narrowing to function.
* Prerequisites
* Requirements

View File

@@ -0,0 +1,14 @@
;;; private/narrow/config.el -*- lexical-binding: t; -*-
(defvar +narrow/narrow-state 't "To narrow or not to narrow. Flips between t and nil")
(defun +narrow/toggle-narrow-state ()
"Toggle the state of +narrow/narrow-state between 't and 'nil"
(if (= +narrow/narrow-state 't)
(setq +narrow/narrow-state nil)
(setq +narrow/narrow-state 't)))
(defun +narrow/toggle-narrow ()
(interactive)
(cond ((+narrow/narrow-state) (narrow-to-defun) (+narrow/toggle-narrow-state))
(t (widen))))

View File

@@ -0,0 +1,16 @@
#+TITLE: private/ocaml
#+DATE: March 29, 2020
* Description
My own ocaml module. Has LSP support, which is well defined.
Pretty minimalist and allows for quick coding. Uses the terminal a lot so I'd
suggest using vterm as well for quick access to the terminal.
* Prerequisites
- ocaml compiler
- opam
- ocamllsp (from opam) (if LSP)
* Requirements
- lsp
- tuareg
- utop

View File

@@ -0,0 +1,20 @@
;;; private/ocaml/config.el -*- lexical-binding: t; -*-
(use-package! utop
:config
(map!
:localleader
:map tuareg-mode-map
:desc "Repl" "c" #'utop
(:prefix ("e" . "eval")
:desc "Buffer" "b" #'utop-eval-buffer
:desc "Region" "r" #'utop-eval-region)))
(when (featurep! +lsp)
(after! lsp
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "ocamllsp")
:major-modes '(tuareg-mode)
:server-id 'ocaml-lsp))
(add-hook 'tuareg-mode-hook #'lsp!)))

View File

@@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; private/ocaml/packages.el
(package! tuareg)
(package! utop)

View File

@@ -0,0 +1,13 @@
#+TITLE: private/oreoline
#+DATE: March 29, 2020
* Description
My very own modeline. Minimalist, isn't particularly fancy but does the job.
Uses telephone line with some configuration. Has support for a light version as well.
Has LSP support as well as evil support (can present evil modes and LSP mode).
* Prerequisites
None
* Requirements
- telephone line
- evil-anzu

View File

@@ -0,0 +1,74 @@
;;; ui/telephone/config.el -*- lexical-binding: t; -*-
(use-package! telephone-line
:hook (after-init . telephone-line-mode)
:init
;; Faces
(defface +oreoline-accent-dark '((t (:foreground "black" :background "Cadet Blue" ))) "")
(defface +oreoline-evil-dark '((t (:foreground "white" :background "dark green" ))) "")
(defface +oreoline-evil-inactive '((t (:foreground "cornsilk" :background "gray26" ))) "")
(defface +oreoline-accent-light '((t (:foreground "black" :background "Light Slate Grey"))) "")
(defface +oreoline-evil-light '((t (:foreground "black" :background "Sky Blue" ))) "")
;; Set telephone line faces
(setq telephone-line-faces
'((evil . (+oreoline-evil-dark . +oreoline-evil-inactive))
(modal . telephone-line-modal-face)
(ryo . telephone-line-ryo-modal-face)
(accent . (+oreoline-accent-dark . telephone-line-accent-inactive))
(nil mode-line . mode-line-inactive)))
(when (featurep! +light)
(setq telephone-line-faces
'((evil . (+oreoline-evil-light . +oreoline-evil-inactive))
(modal . telephone-line-modal-face)
(ryo . telephone-line-ryo-modal-face)
(accent . (+oreoline-accent-light . telephone-line-accent-inactive))
(nil mode-line . mode-line-inactive))))
;; Seperators
(setq telephone-line-primary-left-separator 'telephone-line-abs-left
telephone-line-secondary-left-separator 'telephone-line-identity-hollow-left
telephone-line-primary-right-separator 'telephone-line-abs-right
telephone-line-secondary-right-separator 'telephone-line-identity-hollow-right)
;; LSP segment
(telephone-line-defsegment +oreoline-lsp-segment ()
(if (bound-and-true-p lsp-mode)
(propertize "")
(propertize "")))
;; Visual line check
(telephone-line-defsegment +oreoline-visual-segment ()
(if mark-active
(let ((lines (count-lines (region-beginning) (region-end)))
(chars (- (region-end) (region-beginning))))
(if (< lines 2)
(propertize (format "%sC" chars))
(propertize (format "%sL %sC" lines chars))))
(propertize "~")))
(setq
;; LHS
telephone-line-lhs
'((evil . (telephone-line-evil-tag-segment
telephone-line-buffer-modified-segment))
(accent . (telephone-line-filesize-segment
telephone-line-buffer-name-segment
telephone-line-erc-modified-channels-segment
telephone-line-process-segment))
(nil . ()))
;; RHS
telephone-line-rhs
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-vc-segment
+oreoline-lsp-segment
telephone-line-major-mode-segment
telephone-line-flycheck-segment))
(modal . (+oreoline-visual-segment))
(evil . (telephone-line-airline-position-segment))))
:config
(size-indication-mode +1))
(use-package! evil-anzu
:after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight)

View File

@@ -0,0 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; ui/telephone/packages.el
(package! telephone-line)
(package! evil-anzu)

View File

@@ -0,0 +1,13 @@
#+TITLE: private/rss
#+DATE: May 2, 2020
* Description
This module allows the manipulation and usage of the /newsticker/ system. This is a nice RSS reader inbuilt to Emacs.
Use =+rss/set-feed-urls= to set the urls for use in newsticker. Bind
=+rss/open-newsticker= =+rss/close-newsticker= to appropriate bindings.
* Prerequisites
None
* Requirements
- cl-lib
- newsticker

View File

@@ -0,0 +1,51 @@
;;; private/rss/config.el -*- lexical-binding: t; -*-
(require 'seq)
(require 'cl-lib)
(defvar +rss/feed-urls '(("Arch Linux" "https://www.archlinux.org/feeds/news/" Linux)
("LEMMiNO" "https://www.youtube.com/feeds/videos.xml?channel_id=UCRcgy6GzDeccI7dkbbBna3Q" YouTube)
("Gamer from Mars" "https://www.youtube.com/feeds/videos.xml?channel_id=UCJ6z_yj_dDNrhn-c8ZyKV4g" YouTube)
("Pop Culture Detective" "https://www.youtube.com/feeds/videos.xml?channel_id=UCHiwtz2tCEfS17N9A-WoSSw" YouTube)
("Dark Sominium" "https://www.youtube.com/feeds/videos.xml?channel_id=UC_e39rWdkQqo5-LbiLiU10g" YouTube Stories)
("Dark Sominium Music" "https://www.youtube.com/feeds/videos.xml?channel_id=UCkLiZ_zLynyNd5fd62hg1Kw" YouTube Music)
("Nexpo" "https://www.youtube.com/feeds/videos.xml?channel_id=UCpFFItkfZz1qz5PpHpqzYBw" YouTube)
("Techquickie" "https://www.youtube.com/feeds/videos.xml?channel_id=UC0vBXGSyV14uvJ4hECDOl0Q" YouTube)
("3B1B" "https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw" YouTube)))
(when (featurep! +elfeed)
(after! elfeed
(setq elfeed-feeds (cl-map 'list (lambda (item) (append (list (nth 1 item)) (cdr (cdr item)))) +rss/feed-urls))))
(when (featurep! +newsticker)
(defun +rss/set-feed-urls (LIST)
"Set the newsticker-url-list to LIST. LIST should have format =(TAG URL START_TIME INTERVAL)="
(setq newsticker-url-list LIST))
(defun +rss/get-newsticker-buffers ()
"Using seq, filter the buffer list for newsticker buffers"
(seq-remove (lambda (buffer)
(not (and (cl-search "*Newsticker" (buffer-name buffer))
(= (cl-search "*Newsticker" (buffer-name buffer))))))
(buffer-list)))
(defun +rss/close-newsticker()
"Routine to close the newsticker system"
(interactive)
(newsticker-stop)
(dolist (buf (+rss/get-newsticker-buffers))
(kill-buffer buf))
(+workspace/delete "RSS"))
(use-package! newsticker
:config
(+rss/set-feed-urls ; Format is =(TAG URL START_TIME INTERVAL)=
(cl-map 'list (lambda (item) (list (nth 0 item) (nth 1 item) nil 3600)) +rss/feed-urls))
(defun +rss/open-newsticker ()
"Routine to start and open the newsticker"
(interactive)
(newsticker-start)
(+workspace/new "RSS")
(newsticker-treeview))))

View File

@@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; private/rss/packages.el
(package! elfeed)

View File

@@ -0,0 +1,10 @@
#+TITLE: private/startup
#+DATE: July 15, 2020
* Description
Basically setup the default Emacs mode-line and the scratch buffer for ease of use.
This replaces the =modeline= and =doom-dashboard= modules as it leverages the default Emacs utilities.
* Prerequisites
Emacs of some kind, preferably 27 just for the sake of preserving versioning.
* Requirements
None

View File

@@ -0,0 +1,14 @@
;;; private/startup/config.el -*- lexical-binding: t; -*-
(defun +startup/create-scratch-message ()
"Generate a string for the scratch buffer"
(format "Welcome to Emacs! (。◕‿◕。)
Load time was %s
Time of startup: %s"
(emacs-init-time)
(current-time-string (current-time))))
(add-hook 'doom-first-input-hook
#'(lambda ()
(setq-default mode-line-format (list "%l:%c %P \t %+%b(" '(:eval (format "%s" major-mode)) ") \t %I \t" vc-mode mode-line-end-spaces))
(setq-default initial-scratch-message (+startup/create-scratch-message))))