From 6bdf6db3b453cff3a3f46f1b8f33cac6426f98ac Mon Sep 17 00:00:00 2001 From: dx Date: Wed, 15 Jul 2020 15:56:08 +0100 Subject: ~~/.doom.d -> ~/.config/doom --- .../doom/modules/private/bindings/README.org | 158 +++++++++++++++++++++ .../doom/modules/private/completion/config.el | 21 +++ .../doom/modules/private/gentemplate/README.org | 19 +++ .../doom/modules/private/gentemplate/config.el | 36 +++++ .../.config/doom/modules/private/narrow/README.org | 7 + Doom/.config/doom/modules/private/narrow/config.el | 14 ++ Doom/.config/doom/modules/private/ocaml/README.org | 16 +++ Doom/.config/doom/modules/private/ocaml/config.el | 20 +++ .../.config/doom/modules/private/ocaml/packages.el | 6 + .../doom/modules/private/oreoline/README.org | 13 ++ .../doom/modules/private/oreoline/config.el | 74 ++++++++++ .../doom/modules/private/oreoline/packages.el | 5 + Doom/.config/doom/modules/private/rss/README.org | 13 ++ Doom/.config/doom/modules/private/rss/config.el | 51 +++++++ Doom/.config/doom/modules/private/rss/packages.el | 4 + .../doom/modules/private/startup/README.org | 10 ++ .../.config/doom/modules/private/startup/config.el | 14 ++ 17 files changed, 481 insertions(+) create mode 100644 Doom/.config/doom/modules/private/bindings/README.org create mode 100644 Doom/.config/doom/modules/private/completion/config.el create mode 100644 Doom/.config/doom/modules/private/gentemplate/README.org create mode 100644 Doom/.config/doom/modules/private/gentemplate/config.el create mode 100644 Doom/.config/doom/modules/private/narrow/README.org create mode 100644 Doom/.config/doom/modules/private/narrow/config.el create mode 100644 Doom/.config/doom/modules/private/ocaml/README.org create mode 100644 Doom/.config/doom/modules/private/ocaml/config.el create mode 100644 Doom/.config/doom/modules/private/ocaml/packages.el create mode 100644 Doom/.config/doom/modules/private/oreoline/README.org create mode 100644 Doom/.config/doom/modules/private/oreoline/config.el create mode 100644 Doom/.config/doom/modules/private/oreoline/packages.el create mode 100644 Doom/.config/doom/modules/private/rss/README.org create mode 100644 Doom/.config/doom/modules/private/rss/config.el create mode 100644 Doom/.config/doom/modules/private/rss/packages.el create mode 100644 Doom/.config/doom/modules/private/startup/README.org create mode 100644 Doom/.config/doom/modules/private/startup/config.el (limited to 'Doom/.config/doom/modules') diff --git a/Doom/.config/doom/modules/private/bindings/README.org b/Doom/.config/doom/modules/private/bindings/README.org new file mode 100644 index 0000000..90d1b55 --- /dev/null +++ b/Doom/.config/doom/modules/private/bindings/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/completion/config.el b/Doom/.config/doom/modules/private/completion/config.el new file mode 100644 index 0000000..29d1ee1 --- /dev/null +++ b/Doom/.config/doom/modules/private/completion/config.el @@ -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) diff --git a/Doom/.config/doom/modules/private/gentemplate/README.org b/Doom/.config/doom/modules/private/gentemplate/README.org new file mode 100644 index 0000000..c09f20e --- /dev/null +++ b/Doom/.config/doom/modules/private/gentemplate/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/gentemplate/config.el b/Doom/.config/doom/modules/private/gentemplate/config.el new file mode 100644 index 0000000..d843cc2 --- /dev/null +++ b/Doom/.config/doom/modules/private/gentemplate/config.el @@ -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))))))) diff --git a/Doom/.config/doom/modules/private/narrow/README.org b/Doom/.config/doom/modules/private/narrow/README.org new file mode 100644 index 0000000..c767cb8 --- /dev/null +++ b/Doom/.config/doom/modules/private/narrow/README.org @@ -0,0 +1,7 @@ +#+TITLE: private/narrow +#+DATE: May 10, 2020 + +* Description +Minimal configuration for narrowing to function. +* Prerequisites +* Requirements diff --git a/Doom/.config/doom/modules/private/narrow/config.el b/Doom/.config/doom/modules/private/narrow/config.el new file mode 100644 index 0000000..9afd513 --- /dev/null +++ b/Doom/.config/doom/modules/private/narrow/config.el @@ -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)))) diff --git a/Doom/.config/doom/modules/private/ocaml/README.org b/Doom/.config/doom/modules/private/ocaml/README.org new file mode 100644 index 0000000..de29e59 --- /dev/null +++ b/Doom/.config/doom/modules/private/ocaml/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/ocaml/config.el b/Doom/.config/doom/modules/private/ocaml/config.el new file mode 100644 index 0000000..df138ad --- /dev/null +++ b/Doom/.config/doom/modules/private/ocaml/config.el @@ -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!))) diff --git a/Doom/.config/doom/modules/private/ocaml/packages.el b/Doom/.config/doom/modules/private/ocaml/packages.el new file mode 100644 index 0000000..61f1c8d --- /dev/null +++ b/Doom/.config/doom/modules/private/ocaml/packages.el @@ -0,0 +1,6 @@ +;; -*- no-byte-compile: t; -*- +;;; private/ocaml/packages.el + + +(package! tuareg) +(package! utop) diff --git a/Doom/.config/doom/modules/private/oreoline/README.org b/Doom/.config/doom/modules/private/oreoline/README.org new file mode 100644 index 0000000..57b24e9 --- /dev/null +++ b/Doom/.config/doom/modules/private/oreoline/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/oreoline/config.el b/Doom/.config/doom/modules/private/oreoline/config.el new file mode 100644 index 0000000..0bc3a41 --- /dev/null +++ b/Doom/.config/doom/modules/private/oreoline/config.el @@ -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) diff --git a/Doom/.config/doom/modules/private/oreoline/packages.el b/Doom/.config/doom/modules/private/oreoline/packages.el new file mode 100644 index 0000000..9479896 --- /dev/null +++ b/Doom/.config/doom/modules/private/oreoline/packages.el @@ -0,0 +1,5 @@ +;; -*- no-byte-compile: t; -*- +;;; ui/telephone/packages.el + +(package! telephone-line) +(package! evil-anzu) diff --git a/Doom/.config/doom/modules/private/rss/README.org b/Doom/.config/doom/modules/private/rss/README.org new file mode 100644 index 0000000..3a025d4 --- /dev/null +++ b/Doom/.config/doom/modules/private/rss/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/rss/config.el b/Doom/.config/doom/modules/private/rss/config.el new file mode 100644 index 0000000..4d8468a --- /dev/null +++ b/Doom/.config/doom/modules/private/rss/config.el @@ -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)))) diff --git a/Doom/.config/doom/modules/private/rss/packages.el b/Doom/.config/doom/modules/private/rss/packages.el new file mode 100644 index 0000000..59d7afe --- /dev/null +++ b/Doom/.config/doom/modules/private/rss/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; private/rss/packages.el + +(package! elfeed) diff --git a/Doom/.config/doom/modules/private/startup/README.org b/Doom/.config/doom/modules/private/startup/README.org new file mode 100644 index 0000000..68b4376 --- /dev/null +++ b/Doom/.config/doom/modules/private/startup/README.org @@ -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 diff --git a/Doom/.config/doom/modules/private/startup/config.el b/Doom/.config/doom/modules/private/startup/config.el new file mode 100644 index 0000000..48c4f5f --- /dev/null +++ b/Doom/.config/doom/modules/private/startup/config.el @@ -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)))) -- cgit v1.2.3-13-gbd6f