From c65cf688fca3075f9d194e1ca8b954f9ddfd983c Mon Sep 17 00:00:00 2001 From: dx Date: Fri, 24 Apr 2020 02:53:57 +0100 Subject: ~doom.d -> Doom/.doom.d Proper naming, GNU/Stow style. --- Doom/.doom.d/README.org | 14 + Doom/.doom.d/config.el | 3 + Doom/.doom.d/init.el | 253 ++++++++++ .../.doom.d/modules/private/gentemplate/README.org | 19 + Doom/.doom.d/modules/private/gentemplate/config.el | 31 ++ Doom/.doom.d/modules/private/ocaml/README.org | 16 + Doom/.doom.d/modules/private/ocaml/config.el | 20 + Doom/.doom.d/modules/private/ocaml/packages.el | 6 + Doom/.doom.d/modules/private/oreoline/README.org | 13 + Doom/.doom.d/modules/private/oreoline/config.el | 62 +++ Doom/.doom.d/modules/private/oreoline/packages.el | 5 + Doom/.doom.d/org/config.org | 548 +++++++++++++++++++++ Doom/.doom.d/org/literate.org | 111 +++++ Doom/.doom.d/org/packages.org | 59 +++ Doom/.doom.d/org/personal.org | 73 +++ Doom/.doom.d/packages.el | 4 + .../.doom.d/snippets/csharp-mode/class ... { ... } | 9 + Doom/.doom.d/snippets/csharp-mode/foreach | 9 + Doom/.doom.d/snippets/csharp-mode/method | 8 + Doom/.doom.d/snippets/csharp-mode/params | 6 + Doom/.doom.d/snippets/csharp-mode/prop | 6 + Doom/.doom.d/snippets/csharp-mode/returns | 5 + Doom/.doom.d/snippets/org-mode/author | 5 + Doom/.doom.d/snippets/org-mode/date | 5 + Doom/.doom.d/snippets/org-mode/description | 5 + Doom/.doom.d/snippets/org-mode/img | 10 + Doom/.doom.d/snippets/org-mode/include | 5 + Doom/.doom.d/snippets/org-mode/review | 14 + Doom/.doom.d/snippets/org-mode/title | 5 + Doom/.doom.d/snippets/web-mode/New component | 19 + 30 files changed, 1348 insertions(+) create mode 100644 Doom/.doom.d/README.org create mode 100644 Doom/.doom.d/config.el create mode 100644 Doom/.doom.d/init.el create mode 100644 Doom/.doom.d/modules/private/gentemplate/README.org create mode 100644 Doom/.doom.d/modules/private/gentemplate/config.el create mode 100644 Doom/.doom.d/modules/private/ocaml/README.org create mode 100644 Doom/.doom.d/modules/private/ocaml/config.el create mode 100644 Doom/.doom.d/modules/private/ocaml/packages.el create mode 100644 Doom/.doom.d/modules/private/oreoline/README.org create mode 100644 Doom/.doom.d/modules/private/oreoline/config.el create mode 100644 Doom/.doom.d/modules/private/oreoline/packages.el create mode 100644 Doom/.doom.d/org/config.org create mode 100644 Doom/.doom.d/org/literate.org create mode 100644 Doom/.doom.d/org/packages.org create mode 100644 Doom/.doom.d/org/personal.org create mode 100644 Doom/.doom.d/packages.el create mode 100644 Doom/.doom.d/snippets/csharp-mode/class ... { ... } create mode 100644 Doom/.doom.d/snippets/csharp-mode/foreach create mode 100644 Doom/.doom.d/snippets/csharp-mode/method create mode 100644 Doom/.doom.d/snippets/csharp-mode/params create mode 100644 Doom/.doom.d/snippets/csharp-mode/prop create mode 100644 Doom/.doom.d/snippets/csharp-mode/returns create mode 100644 Doom/.doom.d/snippets/org-mode/author create mode 100644 Doom/.doom.d/snippets/org-mode/date create mode 100644 Doom/.doom.d/snippets/org-mode/description create mode 100644 Doom/.doom.d/snippets/org-mode/img create mode 100644 Doom/.doom.d/snippets/org-mode/include create mode 100644 Doom/.doom.d/snippets/org-mode/review create mode 100644 Doom/.doom.d/snippets/org-mode/title create mode 100644 Doom/.doom.d/snippets/web-mode/New component (limited to 'Doom') diff --git a/Doom/.doom.d/README.org b/Doom/.doom.d/README.org new file mode 100644 index 0000000..f8f5290 --- /dev/null +++ b/Doom/.doom.d/README.org @@ -0,0 +1,14 @@ +#+TITLE: εmacs configuration +#+DATE: December 30, 2019 +#+STARTUP: inlineimages nofold + +This is my Doom Emacs configuration. Use the links below to access various parts +of my config. + +[[file:modules/config.org][Main config]] + +[[file:modules/literate.org][Literate module]] + +[[file:modules/personal.org][Personal functions module]] + +[[file:modules/writers.org][Writer packages module]] diff --git a/Doom/.doom.d/config.el b/Doom/.doom.d/config.el new file mode 100644 index 0000000..8c4c242 --- /dev/null +++ b/Doom/.doom.d/config.el @@ -0,0 +1,3 @@ +;;; ~/Dotfiles/doom.d/config.el -*- lexical-binding: t; -*- + +(load! "bin/config.el") diff --git a/Doom/.doom.d/init.el b/Doom/.doom.d/init.el new file mode 100644 index 0000000..e5ddbed --- /dev/null +++ b/Doom/.doom.d/init.el @@ -0,0 +1,253 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; Copy this file to ~/.doom.d/init.el or ~/.config/doom/init.el ('doom +;; quickstart' will do this for you). The `doom!' block below controls what +;; modules are enabled and in what order they will be loaded. Remember to run +;; 'doom refresh' after modifying it. +;; +;; More information about these modules (and what flags they support) can be +;; found in modules/README.org. +(doom! :private + (oreoline) + (gentemplate) + (ocaml +lsp) + :input + ;;chinese + ;;japanese + + :completion + company ; the ultimate code completion backend + (ivy + +fuzzy + +icons) ; a search engine for love and life + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs + ;;fill-column ; a `fill-column' indicator + hl-todo ; highlight TODO/FIXME/NOTE tags + indent-guides ; highlighted indent columns + ;;(modeline) ; snazzy, Atom-inspired modeline, plus API + + nav-flash ; blink the current line after jumping + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup ; tame sudden yet inevitable temporary windows + +all ; catch all popups that start with an asterix + +defaults) ; default popup rules + (pretty-code) ; replace bits of code with pretty symbols + ;;tabs ; FIXME an (incomplete) tab bar for Emacs + treemacs ; a project drawer, like neotree but cooler + ;;unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + zen + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + (format) ; automated prettiness + ;;lispy ; vim for lisp, for people who dont like vim + multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + + :emacs + (dired ; making dired pretty [functional] + +ranger ; bringing the goodness of ranger to dired + +icons) ; colorful icons for dired-mode + electric ; smarter, keyword-based electric-indent + vc ; version-control and Emacs, sitting in a tree + (ibuffer +icons) + + :term + ;;eshell ; a consistent, cross-platform shell (WIP) + shell ; a terminal REPL for Emacs + ;;term ; terminals in Emacs + vterm ; another terminals in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + spell ; tasing you for misspelling mispelling + + :tools + ;;ansible + debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + (lookup +docsets) ; helps you navigate your code and documentation + lsp + ;;macos ; MacOS-specific commands + magit ; a git porcelain for Emacs + make ; run make tasks from Emacs + pass ; password manager for nerds + pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + rgb ; creating color strings + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :lang + ;;agda ; types of types of types of types... + ;;assembly ; assembly for fun or debugging + (cc + +lsp) ; C/C++/Obj-C madness + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + (csharp +unity) ; unity, .NET, and mono shenanigans + data ; config/data formats + ;;erlang ; an elegant language for a more civilized age + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;ess ; emacs speaks statistics + (fsharp +lsp) ; ML stands for Microsoft's Language + ;;go ; the hipster dialect + (haskell +dante) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; + (java +lsp) ; the poster child for carpal tunnel syndrome + (javascript + +lsp) ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;ledger ; an accounting system in Emacs + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;;nix ; I hereby declare "nix geht mehr!" + (org ; organize your plain life in plain text + +dragndrop ; file drag & drop support + +ipython ; ipython support for babel + +pandoc ; pandoc integration into org's exporter + +pomodoro + +gnuplot + +present) ; using Emacs for presentations + ;;perl ; write code no one else can comprehend + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + (python +lsp) ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + rest ; Emacs as a REST client + ;;ruby ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + web ; the tubes + ;;vala ; GObjective-C + + :email + ;;(mu4e +gmail) ; WIP + ;;notmuch ; WIP + ;;(wanderlust +gmail) ; WIP + + ;; Applications are complex and opinionated modules that transform Emacs + ;; toward a specific purpose. They may have additional dependencies and + ;; should be loaded late. + :app + calendar + irc ; how neckbeards socialize + (rss) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;; For literate config users. This will tangle+compile a config.org + ;; literate config in your `doom-private-dir' whenever it changes. + ;; literate + + ;; The default module sets reasonable defaults for Emacs. It also + ;; provides a Spacemacs-inspired keybinding scheme and a smartparens + ;; config. Use it as a reference for your own modules. + (default +bindings +smartparens)) +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ansi-color-names-vector + ["#00212B" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"]) + '(c-basic-offset 2) + '(c-default-style + (quote + ((c-mode . "linux") + (c++-mode . "linux") + (csharp-mode . "java")))) + '(c-offsets-alist (quote ((c . 2)))) + '(custom-safe-themes + (quote + ("f2b83b9388b1a57f6286153130ee704243870d40ae9ec931d0a1798a5a916e76" "8c1dd3d6fdfb2bee6b8f05d13d167f200befe1712d0abfdc47bb6d3b706c3434" "b3bcf1b12ef2a7606c7697d71b934ca0bdd495d52f901e73ce008c4c9825a3aa" "93268bf5365f22c685550a3cbb8c687a1211e827edc76ce7be3c4bd764054bad" "f30aded97e67a487d30f38a1ac48eddb49fdb06ac01ebeaff39439997cbdd869" "7ffb0d3d0c797b980ed7330adc04a66516d49a61e4187a7054dda014676421d9" "cabc32838ccceea97404f6fcb7ce791c6e38491fd19baa0fcfb336dcc5f6e23c" "d8e3a2b8c72c3cb52d070a5e1969849197488b92d7211cc86c97e033239fdde2" "1728dfd9560bff76a7dc6c3f61e9f4d3e6ef9d017a83a841c117bd9bebe18613" "423435c7b0e6c0942f16519fa9e17793da940184a50201a4d932eafe4c94c92d" "fe76f3d5094967034192f6a505085db8db6deb0e135749d9a54dc488d6d3ee2f" "0d087b2853473609d9efd2e9fbeac088e89f36718c4a4c89c568dd1b628eae41" "c8f959fb1ea32ddfc0f50db85fea2e7d86b72bb4d106803018be1c3566fd6c72" "7d56fb712ad356e2dacb43af7ec255c761a590e1182fe0537e1ec824b7897357" "a2286409934b11f2f3b7d89b1eaebb965fd63bc1e0be1c159c02e396afb893c8" "66d53738cc824d0bc5b703276975581b8de2b903d6ce366cd62207b5dd6d3d13" "0fe9f7a04e7a00ad99ecacc875c8ccb4153204e29d3e57e9669691e6ed8340ce" "2878517f049b28342d7a360fd3f4b227086c4be8f8409f32e0f234d129cee925" "f951343d4bbe5a90dba0f058de8317ca58a6822faa65d8463b0e751a07ec887c" "428754d8f3ed6449c1078ed5b4335f4949dc2ad54ed9de43c56ea9b803375c23" "f8c30fa07ba7e8fe884f22b428dae6724955fa61ad84a658c3b0164ae391fb52" "a16e816774b437acb78beb9916a60ea236cfcd05784227a7d829623f8468c5a2" "9c27124b3a653d43b3ffa088cd092c34f3f82296cf0d5d4f719c0c0817e1afa6" "e838d6375a73fda607820c65eb3ea1f9336be7bd9a5528c9161e10c4aa663b5b" "427fa665823299f8258d8e27c80a1481edbb8f5463a6fb2665261e9076626710" "4e132458143b6bab453e812f03208075189deca7ad5954a4abb27d5afce10a9a" "06e4b3fdcbadc29ff95a7146dee846cd027cfefca871b2e9142b54ad5de4832f" "8e04ea7bf8a736b0bfacd363f4810ffce774ff9ba24f356172ae2b83307aebb2" "614e5089876ea69b515c50b6d7fa0a37eb7ed50fda224623ec49e1c91a0af6a1" "8047ac280914cbe8dcdc489703c398f0941339cfca77dfc09f3641f1f040267c" "1a6d627434899f6d21e35b85fee62079db55ef04ecd9b70b82e5d475406d9c69" "43c808b039893c885bdeec885b4f7572141bd9392da7f0bd8d8346e02b2ec8da" "2f0cbe053485bccbbbb582acdba7c7c9585ad808ee8ab32f0d727c3d39b42275" "f5568ed375abea716d1bdfae0316d1d179f69972eaccd1f331b3e9863d7e174a" "b0fd04a1b4b614840073a82a53e88fe2abc3d731462d6fde4e541807825af342" "155a5de9192c2f6d53efcc9c554892a0d87d87f99ad8cc14b330f4f4be204445" "cdb3e7a8864cede434b168c9a060bf853eeb5b3f9f758310d2a2e23be41a24ae" "8c847a5675ece40017de93045a28ebd9ede7b843469c5dec78988717f943952a" "ef4edbfc3ec509612f3cf82476beddd2aeb3da7bdc3a35726337a0cc838a4ef4" "e3c87e869f94af65d358aa279945a3daf46f8185f1a5756ca1c90759024593dd" "34c99997eaa73d64b1aaa95caca9f0d64229871c200c5254526d0062f8074693" "cb477d192ee6456dc2eb5ca5a0b7bd16bdb26514be8f8512b937291317c7b166" "fd944f09d4d0c4d4a3c82bd7b3360f17e3ada8adf29f28199d09308ba01cc092" "8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "a28d89cf398c60dade1b0a7e3dce9d4691c236c05a050b7e6ba808bfce2622e1" "80365dd15f97396bdc38490390c23337063c8965c4556b8f50937e63b5e9a65c" "f0dc4ddca147f3c7b1c7397141b888562a48d9888f1595d69572db73be99a024" "6d589ac0e52375d311afaa745205abb6ccb3b21f6ba037104d71111e7e76a3fc" "9954ed41d89d2dcf601c8e7499b6bb2778180bfcaeb7cdfc648078b8e05348c6" "75d3dde259ce79660bac8e9e237b55674b910b470f313cdf4b019230d01a982a" "10461a3c8ca61c52dfbbdedd974319b7f7fd720b091996481c8fb1dded6c6116" "797f9204474ae55a3f65d2fc5fb28caf117bb7e0e3eaac58729a9edb38bf7f14" "256bd513a9875cd855077162cdfee8d75b0ad7e18fe8b8cbc10412561fbef892" default))) + '(doom-themes-treemacs-theme "doom-colors") + '(elcord-use-major-mode-as-main-icon t) + '(evil-ex-search-highlight-all t) + '(evil-ex-search-persistent-highlight nil) + '(fci-rule-color "#5B6268") + '(flymake-proc-allowed-file-name-masks + (quote + (("\"\\\\.ino\\\\\"" flymake-proc-simple-make-init nil nil) + ("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-proc-simple-make-init nil flymake-proc-real-file-name-considering-includes) + ("\\.xml\\'" flymake-proc-xml-init nil nil) + ("\\.html?\\'" flymake-proc-xml-init nil nil) + ("\\.cs\\'" flymake-proc-simple-make-init nil nil) + ("\\.php[345]?\\'" flymake-proc-php-init nil nil) + ("\\.h\\'" flymake-proc-master-make-header-init flymake-proc-master-cleanup nil) + ("\\.java\\'" flymake-proc-simple-make-java-init flymake-proc-simple-java-cleanup nil) + ("[0-9]+\\.tex\\'" flymake-proc-master-tex-init flymake-proc-master-cleanup nil) + ("\\.tex\\'" flymake-proc-simple-tex-init nil nil) + ("\\.idl\\'" flymake-proc-simple-make-init nil nil)))) + '(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#51afef")) + '(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#98be65")) + '(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a")) + '(js-indent-level 2) + '(objed-cursor-color "#ff6c6b") + '(org-agenda-files (quote ("~/Dotfiles/doom.d/config.org"))) + '(pug-tab-width 2) + '(vc-annotate-background "#282c34") + '(vc-annotate-color-map + (list + (cons 20 "#98be65") + (cons 40 "#b4be6c") + (cons 60 "#d0be73") + (cons 80 "#ECBE7B") + (cons 100 "#e6ab6a") + (cons 120 "#e09859") + (cons 140 "#da8548") + (cons 160 "#d38079") + (cons 180 "#cc7cab") + (cons 200 "#c678dd") + (cons 220 "#d974b7") + (cons 240 "#ec7091") + (cons 260 "#ff6c6b") + (cons 280 "#cf6162") + (cons 300 "#9f585a") + (cons 320 "#6f4e52") + (cons 340 "#5B6268") + (cons 360 "#5B6268"))) + '(vc-annotate-very-old-color nil)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/Doom/.doom.d/modules/private/gentemplate/README.org b/Doom/.doom.d/modules/private/gentemplate/README.org new file mode 100644 index 0000000..c09f20e --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/modules/private/gentemplate/config.el b/Doom/.doom.d/modules/private/gentemplate/config.el new file mode 100644 index 0000000..5f00084 --- /dev/null +++ b/Doom/.doom.d/modules/private/gentemplate/config.el @@ -0,0 +1,31 @@ +;;; private/gentemplate/config.el -*- lexical-binding: t; -*- + +(require 'cl) + +(setq +gentemplate/template-list (list "CTemplate" "CPPTemplate" "PythonTemplate" "NodeTemplate" "ArduinoTemplate" "JavaTemplate")) +(setq +gentemplate/profile-url "https://github.com/oreodave/") + +(defun +gentemplate/offline () + (eq (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/.doom.d/modules/private/ocaml/README.org b/Doom/.doom.d/modules/private/ocaml/README.org new file mode 100644 index 0000000..de29e59 --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/modules/private/ocaml/config.el b/Doom/.doom.d/modules/private/ocaml/config.el new file mode 100644 index 0000000..df138ad --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/modules/private/ocaml/packages.el b/Doom/.doom.d/modules/private/ocaml/packages.el new file mode 100644 index 0000000..61f1c8d --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/modules/private/oreoline/README.org b/Doom/.doom.d/modules/private/oreoline/README.org new file mode 100644 index 0000000..57b24e9 --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/modules/private/oreoline/config.el b/Doom/.doom.d/modules/private/oreoline/config.el new file mode 100644 index 0000000..7616ca4 --- /dev/null +++ b/Doom/.doom.d/modules/private/oreoline/config.el @@ -0,0 +1,62 @@ +;;; ui/telephone/config.el -*- lexical-binding: t; -*- + +(use-package! telephone-line + :hook (after-init . telephone-line-mode) + :init + ; Faces + (defface my-accent-dark '((t (:foreground "Black" :background "Cadet Blue"))) "") + (defface my-evil-dark '((t (:foreground "White" :background "Black"))) "") + (defface my-accent-light '((t (:foreground "black" :background "Light Slate Grey"))) "") + (defface my-evil-light '((t (:foreground "black" :background "Sky Blue"))) "") + + ;; Set telephone line faces + (setq telephone-line-faces + '((evil . (my-evil-dark . my-evil-dark)) + (modal . telephone-line-modal-face) + (ryo . telephone-line-ryo-modal-face) + (accent . (my-accent-dark . telephone-line-accent-inactive)) + (nil mode-line . mode-line-inactive))) + (when (featurep! +light) + (setq telephone-line-faces + '((evil . (my-evil-light . my-evil-light)) + (modal . telephone-line-modal-face) + (ryo . telephone-line-ryo-modal-face) + (accent . (my-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 () + (after! lsp-mode + (if (lsp-workspaces) + (propertize "") + (propertize "")))) + + ; LHS + (setq telephone-line-lhs + '((evil . (telephone-line-evil-tag-segment + telephone-line-buffer-modified-segment)) + (accent . (telephone-line-vc-segment + telephone-line-filesize-segment + telephone-line-buffer-name-segment + telephone-line-erc-modified-channels-segment + telephone-line-process-segment)) + (nil . ()))) + + ; RHS + (setq telephone-line-rhs + '((nil . (telephone-line-misc-info-segment)) + (accent . (telephone-line-major-mode-segment + +oreoline-lsp-segment + telephone-line-flycheck-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/.doom.d/modules/private/oreoline/packages.el b/Doom/.doom.d/modules/private/oreoline/packages.el new file mode 100644 index 0000000..9479896 --- /dev/null +++ b/Doom/.doom.d/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/.doom.d/org/config.org b/Doom/.doom.d/org/config.org new file mode 100644 index 0000000..8783575 --- /dev/null +++ b/Doom/.doom.d/org/config.org @@ -0,0 +1,548 @@ +#+TITLE: Oreodave's Emacs configuration +#+AUTHOR: Oreodave +#+DESCRIPTION: My Doom Emacs configuration! + +* Preclude +- This is my [[https://github.com/hlissner/doom-emacs][Doom Emacs]] configuration. +- Use it for most of my code editing and development needs. +- Incredibly versatile tool in my inventory. +* Variables and Bootstrap config +Bootstrap via literate and setting up basic variables. +** Bootstrap +Load the literate.el file to start parsing. +#+BEGIN_SRC elisp +(load (expand-file-name (concat doom-private-dir "bin/literate.el"))) +#+END_SRC +** Doom Variables +#+BEGIN_SRC elisp +(after! core-keybinds + (setq doom-localleader-key ",") + (setq doom-theme 'doom-molokai) + (setq doom-font (font-spec :family "Hack" :size 17))) +#+END_SRC +- Set the doom localleader to "," because it's faster +- Using the font [[https://sourcefoundry.org/hack/][Hack]] +** Other variables +#+BEGIN_SRC elisp +(setq completion-ignore-case t) +(setq truncate-lines t) +(setq display-line-numbers-type nil) +(setq bookmark-default-file (expand-file-name (concat doom-private-dir "bookmarks"))) +(setq-default frame-title-format '("%b - Emacs")) +(cl-pushnew '("Libgen" "http://gen.lib.rus.ec/search.php?req=%s") +lookup-provider-url-alist :key #'car :test 'string=) +#+END_SRC +Some quality of life things and others that I couldn't really put in one category +- Using line-numbers that are relative now instead of nothing. +- Set org directory +- Add libgen to search providers +* Package Config +Config for or based heavily around specific packages that I find very important +** DAP +*** Function +First to setup is a routine for setting up all the dap-panes for debugging. +Easier to do than just running all those functions manually +- Routine sets up the panes that I like to use, instead of M-x'ing it +- *cD* starts up the routine +#+BEGIN_SRC elisp +(after! dap-mode + (defun dx:debug () + (interactive) + (dap-ui-mode) + (dap-ui-locals) + (dap-ui-sessions))) +#+END_SRC +*** Keybind +#+BEGIN_SRC elisp + (map! + :after dap-mode + :leader + :desc "Start debugging setup" "cD" #'dx:debug) +#+END_SRC +** Elfeed +Custom functions to work with elfeed, generating new feeds on demand and adding +a keybind to help with that. +*** Feeds +Feeds for elfeed to download from. +#+BEGIN_SRC elisp +(setq elfeed-feeds + '(("http://feeds.bbci.co.uk/news/rss.xml" news) + ("http://www.technologyreview.com/rss") + ("https://news.ycombinator.com/rss" news compsci))) +#+END_SRC + +*** Keybinds +Keybinds for elfeed locally and for the leader. +#+BEGIN_SRC elisp +(map! + (:map elfeed-search-mode-map + :localleader + :desc "Update feeds" "u" #'elfeed-update) + (:leader + :prefix "o" + :desc "Open RSS" "f" #'=rss)) +#+END_SRC +** Dashboard +My very own dashboard config using doom dashboard, with these features: +- Custom load message +- Custom splash image and dashboard buffer name +- Custom dashboard sections for myself + +*** Benchmark display +Redo the display-benchmark function to display a different message +#+BEGIN_SRC elisp +(defun doom-display-benchmark-h (&optional return-p) + "Display a benchmark, showing number of packages and modules, and how quickly +they were loaded at startup. + +If RETURN-P, return the message as a string instead of displaying it." + (funcall (if return-p #'format #'message) + "εmacs loaded %d packages, %d modules in %.03fs" + (- (length load-path) (length doom--initial-load-path)) + (if doom-modules (hash-table-count doom-modules) 0) + (or doom-init-time + (setq doom-init-time + (float-time (time-subtract (current-time) before-init-time)))))) +#+END_SRC + +*** Image and buffer name +Set the splash-image and dashboard buffer name +Space image comes from [[https://flaticon.com][website]] +#+BEGIN_SRC elisp +(setq fancy-splash-image "~/Pictures/space2.png") ; splash image +(setq +doom-dashboard-name "*dashboard*") +#+END_SRC +*** Dashboard items +Set the dashboard functions (segments in overall buffer), set the sections of +the interactive menu as well. +#+BEGIN_SRC elisp +(setq +doom-dashboard-functions ; limit the dashboard items + '(doom-dashboard-widget-banner + doom-dashboard-widget-loaded + doom-dashboard-widget-shortmenu)) + +(setq +doom-dashboard-menu-sections ; Set a specific amount of items + '(("Open org-agenda" + :icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face) + :when (fboundp 'org-agenda) + :action org-agenda) + ("Check the weather" + :icon (all-the-icons-wicon "rain" :face 'font-lock-keyword-face) + :action dx:weather) + ("Jump to bookmark" + :icon (all-the-icons-octicon "bookmark" :face 'font-lock-keyword-face) + :action bookmark-jump))) +#+END_SRC +** Thesaurus +Powerthesaurus installation, added a keybind in org-mode for looking up words. +#+BEGIN_SRC elisp +(use-package! powerthesaurus + :after-call (org-mode) + :defer-incrementally (org) + :config + (map! + :localleader + :map org-mode-map + :prefix "w" + :desc "Thesaurus" "t" #'powerthesaurus-lookup-word-at-point)) +#+END_SRC +Powerthesaurus for thesaurus on writer files +** Spelling checker +Keybinds to org-mode for flyspell package +#+BEGIN_SRC elisp +(map! + :after (flyspell org) + :localleader + :map org-mode-map + :prefix "w" + :desc "Correct current word" "c" #'flyspell-correct-at-point + :desc "Autocorrect word" "a" #'flyspell-auto-correct-word + :desc "Goto next error" "w" #'flyspell-goto-next-error) +#+END_SRC +** Projectile +Add CMakeLists.txt to projectile-project-roots. +#+BEGIN_SRC elisp +(after! projectile + (cl-pushnew "CMakeLists.txt" projectile-project-root-files :test 'string=) + (setq projectile-tags-command + "ctags -e -R --exclude=dist --exclude=.ccls --exclude=.ccls-cache")) +#+END_SRC +* Language Config +Configuration for various languages which I feel can be useful +** C-style languages +Configuration for C and C++. +*** User c-style +Emacs doesn't have the full range of styles that I want, so lemme just do it myself. +#+BEGIN_SRC elisp +(after! cc-mode + (c-add-style + "user" + '((c-basic-offset . 2) + (c-comment-only-line-offset . 0) + (c-hanging-braces-alist (brace-list-open) + (brace-entry-open) + (substatement-open after) + (block-close . c-snug-do-while) + (arglist-cont-nonempty)) + (c-cleanup-list brace-else-brace) + (c-offsets-alist + (statement-block-intro . +) + (knr-argdecl-intro . 0) + (substatement-open . 0) + (substatement-label . 0) + (access-label . 0) + (label . 0) + (statement-cont . +))))) +#+END_SRC +*** Pretty symbols +Setup pretty symbols specifically for C++. I import the string type via `using +std::string` which isn't supported in standard doom. So I add support for it. +#+BEGIN_SRC elisp +(after! cc-mode + (set-pretty-symbols! + '(c-mode c++-mode) + :return "return" + :or "||" + :and "&&" + :not "!" + :bool "bool" + :str "string" + :str "std::string" + :float "float" + :int "int" + :false "false" + :true "true" + :null "nullptr")) +#+END_SRC +** LSP +Add lsp-ui-doc-mode to lsp-ui-mode: allows you to see documentation in a little +VSCode style web-kit window. +#+BEGIN_SRC elisp +(after! lsp + (add-hook 'lsp-mode-hook #'lsp-ui-doc-mode) + (setq lsp-ui-doc-position 'top)) +#+END_SRC +** CSharp +- I have custom installed the omnisharp roslyn executable, so I'd rather use + that +#+BEGIN_SRC elisp +(after! csharp-mode + (setq omnisharp-server-executable-path "~/Bin/repos/omnisharp-roslyn/run")) +#+END_SRC +*** Unit test over whole projects +- Implemented my own function which piggy backs counsel etags to globally search + tags for test specific context, then goes to it and uses an omnisharp test + command to unit test it. Basically global test search in C# projects. To use + this, just make sure you have tags compiled and that all your tests are + written as some public void *name* _Test (i.e. they are appended with _Test so + that the pattern can be matched) +#+BEGIN_SRC elisp +(after! (csharp-mode counsel-etags) + (defun dx:csharp/get-unit-test-in-project () + "Unit test anywhere using CTags or ETags and C#" + (interactive) + (let* ((tags-file (counsel-etags-locate-tags-file)) + (cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name))) + (ivy-read + "Choose test: " + cands + :action + (lambda (item) + ;; From the counsel-etags file-open-api function + (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item) + (let* + ((file (match-string-no-properties 1 item)) + (linenum (match-string-no-properties 2 item)) + ;; always calculate path relative to TAGS + (default-directory (counsel-etags-tags-file-directory))) + + (counsel-etags-push-marker-stack (point-marker)) + (find-file file) + (counsel-etags-forward-line linenum) + (omnisharp-unit-test-at-point)))) + :caller 'dx:csharp/get-unit-tests-in-project)))) +#+END_SRC +*** Redo omnisharp-emit-results +- Reimplemented omnisharp-emit-results to emit stdout regardless of whether the + test failed or not +#+BEGIN_SRC elisp +(after! (csharp-mode omnisharp) + (defun omnisharp--unit-test-emit-results (passed results) + "Emits unit test results as returned by the server to the unit test result buffer. +PASSED is t if all of the results have passed. RESULTS is a vector of status data for +each of the unit tests ran." + ; we want to clean output buffer for result if things have passed otherwise + ; compilation & test run output is to be cleared and results shown only for brevity + + (omnisharp--unit-test-message "") + + (seq-doseq (result results) + (-let* (((&alist 'MethodName method-name + 'Outcome outcome + 'ErrorMessage error-message + 'ErrorStackTrace error-stack-trace + 'StandardOutput stdout + 'StanderError stderr) result) + (outcome-is-passed (string-equal "passed" outcome))) + + (omnisharp--unit-test-message + (format "[%s] %s " + (propertize + (upcase outcome) + 'font-lock-face (if outcome-is-passed + '(:foreground "green" :weight bold) + '(:foreground "red" :weight bold))) + (omnisharp--truncate-symbol-name method-name 76))) + + (if error-stack-trace + (omnisharp--unit-test-message error-stack-trace)) + + (unless (= (seq-length stdout) 0) + (omnisharp--unit-test-message "Standard output:") + (seq-doseq (stdout-line stdout) + (omnisharp--unit-test-message stdout-line))) + + (unless (= (seq-length stderr) 0) + (omnisharp--unit-test-message "Standard error:") + (seq-doseq (stderr-line stderr) + (omnisharp--unit-test-message stderr-line))) + )) + + (omnisharp--unit-test-message "") + + (if (eq passed :json-false) + (omnisharp--unit-test-message + (propertize "*** UNIT TEST RUN HAS FAILED ***" + 'font-lock-face '(:foreground "red" :weight bold))) + (omnisharp--unit-test-message + (propertize "*** UNIT TEST RUN HAS SUCCEEDED ***" + 'font-lock-face '(:foreground "green" :weight bold))) + ) + nil)) +#+END_SRC +*** Map for C# mode +#+BEGIN_SRC elisp +(after! csharp-mode + (map! ; CSharp Keybinds + :map csharp-mode-map + :localleader + :desc "Format buffer" "=" #'omnisharp-code-format-entire-file + (:prefix "t" + :desc "Select Test in Project" "t" #'dx:csharp/get-unit-test-in-project))) +#+END_SRC +** Python +- I do python development for Python3, so I need to set the flycheck python checker, as well as the interpreter, to be Python3 +- Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that +- I run my python code a LOT and thus need commands for sending bits or whole scripts into the REPL +#+BEGIN_SRC elisp +(after! python + (setq python-version-checked t) + (setq python-python-command "python3") + (setq python-shell-interpreter "python3") + (setq flycheck-python-pycompile-executable "python3") + + (map! ; Python keybinds + :map python-mode-map + :localleader + :desc "Start python minor" "c" #'run-python + :desc "Format buffer" "=" #'py-yapf-buffer + (:prefix "s" + :desc "Send region REPL" "r" #'python-shell-send-region + :desc "Send buffer" "b" #'python-shell-send-buffer + :desc "Send function" "f" #'python-shell-send-defun))) +#+END_SRC +** TypeScript +- Typescript (in my opinion) should be indented by 2 +- Setup the LSP server on the lsp-language-id-config in case it hasn't already +#+BEGIN_SRC elisp +(after! typescript-mode + (setq typescript-indent-level 2) + (setq tide-format-options '(:indentSize 2 :tabSize 2)) + (after! lsp + (cl-pushnew '(typescript-mode . "typescript") lsp-language-id-configuration :key #'car) + (lsp-register-client + (make-lsp-client + :new-connection (lsp-stdio-connection "typescript-language-server --stdio") + :major-modes '(typescript-mode) + :server-id 'typescript)))) +#+END_SRC +** Haskell +#+BEGIN_SRC elisp +(after! (haskell-mode dante) + (setq dante-repl-command-line '("stack" "ghci"))) +#+END_SRC +** FSharp +#+BEGIN_SRC elisp +(after! fsharp + (setq inferior-fsharp-program "dotnet fsi --readline")) +#+END_SRC +** Org +Org configuration to maximise org workflow. +*** Org variables +Setup the agenda-files and the org-directory. +#+BEGIN_SRC elisp +(after! org + (setq org-directory "~/Text" + org-agenda-files '("~/Text/") + org-log-repeat 'note)) +#+END_SRC +*** Org keymap +- I like using org-export often, so bind it to a primary bind. +- Narrowing is important and I use it often, so bind that to a prefix +- Loading latex fragments is nice +#+BEGIN_SRC elisp +(map! ; Org keybinds + :after org + :map org-mode-map + :localleader + :desc "Org dispatch" "e" #'org-export-dispatch + :desc "Org LaTeX" "E" #'org-latex-export-as-latex + :desc "Load fragments" "L" #'org-latex-preview + (:prefix ("N" . "narrow") + :desc "Narrow to subtree" "n" #'org-narrow-to-subtree + :desc "Go out of narrow" "o" #'widen)) +#+END_SRC +* Key-map +General keymap +** Personal +- Prefix "SPC m" (rebound from local-leader) that will hold personal keybinds + for functions that I like using +- Mostly opening directories I use a lot or doing custom stuff that I can't + really put in anything in particular +#+BEGIN_SRC elisp +(map! + :leader + :prefix ("m" . "personal") ; Personal + :desc "Open Reviews" "a" #'(lambda () (interactive) (doom-project-find-file "~/Text/Reviews")) + :desc "Open books" "b" #'(lambda () (interactive) (dired (concat org-directory "/Books"))); I like my books + :desc "Open school dir" "s" #'(lambda () (interactive) (dired (expand-file-name "~/School"))) + :desc "Open notes" "n" #'(lambda () (interactive) (dired org-directory)) + :desc "Open code" "c" #'(lambda () (interactive) (dired (expand-file-name "~/Code"))) + :desc "Open weather" "w" #'dx:weather + :desc "Change theme" "t" #'dx:themes/set-new-theme ; From my own collection + :desc "Generate template" "g" #'+gentemplate/generate-template ; From my own collection + (:after pdf-view + :desc "Goto page on pdf" "p" #'pdf-view-goto-page) + :desc "Reload emacs" "r" #'dx:reload) ; Reload is necessary +#+END_SRC +** Counsel +- Counsel keybind config +- Mostly just convenience stuff that happens to use counsel +#+BEGIN_SRC elisp +(map! + :leader + :after counsel ; Counsel or ivy + :desc "M-x" "" #'counsel-M-x ; Redefine as M-x because of my muscle memory with spacemacs + (:prefix ("s" . "search") + :desc "RipGrep!" "r" #'counsel-rg ; Ripgrep is faster than Ag in most cases and makes me feel cool + :desc "Search Tags" "t" #'counsel-etags-find-tag)); is quicker to do than /b, for something that is done so often +#+END_SRC +** Window +- Keybinds to do with windows +- SPC wc < SPC wd +- Some ace-window config in the window keybind prefix +#+BEGIN_SRC elisp +(map! + :leader + :prefix ("w" . "window") ; Windows + :desc "Close window" "d" #'+workspace/close-window-or-workspace ; is slightly closer together than wc + :desc "Switch window" "W" #'ace-window ; is also used in spacemacs so I'd rather use this + :desc "Swap windows" "S" #'ace-swap-window) ; allows me to switch windows more efficiently than before, better than just motions +#+END_SRC +** Code +*** Narrow handlers +- Toggles narrow to function by checking a variable +#+BEGIN_SRC elisp +(setq dx:narrow/narrow-state 0) +(defun dx:narrow/toggle-narrow-state () + (if (= dx:narrow/narrow-state 1) + (setq dx:narrow/narrow-state 0) + (setq dx:narrow/narrow-state 1))) + +(add-hook 'post-command-hook #'dx:narrow/toggle-narrow-state) + +(defun dx:narrow/toggle-narrow () + (interactive) + (if (= dx:narrow/narrow-state 1) + (narrow-to-defun) + (widen))) +#+END_SRC +*** Keybinds +- Some keybinds for the code prefix which help me with coding or working with + code, particularly LSP +#+BEGIN_SRC elisp +(map! + :leader + :prefix ("c" . "code") ; Code + :desc "Compile via make" "C" #'+make/run + :desc "Undo tree" "u" #'undo-tree-visualize + :desc "Narrow to function" "n" #'dx:narrow/toggle-narrow + (:after format-all + :desc "Format code" "=" #'format-all-buffer) + (:after lsp + :desc "Format code lsp" "f" #'+default/lsp-format-region-or-buffer + :desc "Execute action" "a" #'lsp-execute-code-action) + (:after dap-mode + :desc "Debug hydra" "h" #'dap-hydra)) +#+END_SRC +** Projectile +- Projectile config, for leader and for project prefix +#+BEGIN_SRC elisp +(map! + :leader + :after projectile + :desc "Switch to p-buffer" ">" #'projectile-switch-to-buffer ; Opposing < which counsel's all buffers + (:prefix ("p" . "project") + :desc "Regen tags" "g" #'projectile-regenerate-tags + :desc "Open project files" "f" #'projectile-find-file)) +#+END_SRC +** Fonts +- Fonts keybinds (prefix "z") for messing with fonts temp on a buffer +- Really useful when I need to zoom into something for whatever reason +#+BEGIN_SRC elisp +(map! + :leader + :prefix ("z" . "font") ; Fonts + :desc "Increase font" "+" #'doom/increase-font-size + :desc "Decrease font" "-" #'doom/decrease-font-size + :desc "Adjust font" "z" #'text-scale-adjust) +#+END_SRC +** Frames +- Keybinds for frame manipulation: + - Generate new frames from current buffer + - Generate new frames from a specific buffer + - Delete frames + - Switch frames +#+BEGIN_SRC elisp +(map! + :leader + :prefix ("F" . "frame") ; Frames + :desc "Kill frame" "d" #'delete-frame + :desc "Current buffer frame" "m" #'make-frame + :desc "Choose Buffer frame" "n" #'display-buffer-other-frame + :desc "Switch frames" "o" #'other-frame) +#+END_SRC +** Other +*** Leader +- Miscellaneous leader bindings that don't really fit into any particular item +#+BEGIN_SRC elisp +(map! + :leader + :desc "Shell command" "!" #'async-shell-command ; Better than M-! + (:prefix ("b" . "buffers") ; Buffers + :desc "Close buffer" "d" #'doom/kill-this-buffer-in-all-windows) + (:prefix ("f" . "files") + :desc "Open dotfiles" "p" #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles"))) + (:prefix ("o" . "open") + :after org + :desc "Calendar" "c" #'=calendar) + (:prefix ("n" . "notes") + :desc "Open notes in dired" "-" #'(lambda () (interactive) (dired org-directory)))) +#+END_SRC +*** Non-leader +#+BEGIN_SRC elisp +(map! + :n "gk" #'evil-backward-section-begin + :n "gK" #'evil-backward-section-end + :n "gj" #'evil-forward-section-begin + :n "gJ" #'evil-forward-section-end) +#+END_SRC diff --git a/Doom/.doom.d/org/literate.org b/Doom/.doom.d/org/literate.org new file mode 100644 index 0000000..47a8a64 --- /dev/null +++ b/Doom/.doom.d/org/literate.org @@ -0,0 +1,111 @@ +#+TITLE: Literate configuration + +* Preclude +My setup to produce a literate configuration. Allows me to write org files all +around the /doom-private-dir/ and access them. Also shaved like 0.2s off my +loading time. +* Constants +Initialise some basic constants for where stuff is. +- literate/bin-dir: Where to compile to +- literate/preloaded-files: Relative to ~$DOOM~, which files are already + preloaded/don't need to be compiled +#+BEGIN_SRC elisp +(setq dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/"))) +(setq dx:literate/preloaded-files (list "README.org" "org/packages.org" + "org/config.org" "org/literate.org")) +#+END_SRC +* Remove function +When loading the lisp, we need to load everything excluding "config.el" +(preloaded by doom) and "literate.el" (loaded by "config.el"). We'll make a very +specific remove function that will remove entries from a given list and return +the new list, given the fact that the files variable will be a list of fully +expanded file names. +#+BEGIN_SRC elisp +(defun dx:literate/remove-mult (remove-files files) + "Remove any occurrences of `remove-files' from `files'" + (let ((parsed-remove-files (map 'list + #'(lambda (i) (expand-file-name (concat doom-private-dir i))) + remove-files))) ; Generate a list of all fully expanded files to remove + (remove-if #'(lambda (l) (member l parsed-remove-files)) files))) ; remove any files that are in the remove-files +#+END_SRC +* Destination for parser +Generate the destination for a literate config org file to parse to, in this +case the bin folder in the private directory +This is not fitted onto the parser because the parser could be fitted to +multiple /differing/ outputs easily if it isn't specified a destination. +#+BEGIN_SRC elisp +(defun dx:literate/destination(SRC) + "Parse a src.org file to a bin/src.el file" + (replace-regexp-in-string ".*/\\(\\w+\\).org" + (expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC)) +#+END_SRC +* Parser +First we need to get some sort of parser which can, given a source org file and +a destination, parse and produce an Emacs lisp file. We'll copy this from the +literate module of doom. +#+BEGIN_SRC elisp +(defun dx:literate/tangle (SRC DEST) + "Tangle a source org file into a destination el file using a new emacs instance" + (let ((default-directory doom-private-dir)) + (when (file-newer-than-file-p SRC DEST) + (let ((output (get-buffer-create "*org-tangle*"))) + (unwind-protect + (or (and (zerop (call-process + "emacs" nil output nil + "-q" "--batch" + "-l" "ob-tangle" + "--eval" (format "(org-babel-tangle-file %S %S)" + SRC DEST))) + (with-current-buffer output + (message "%s" (buffer-string)) + t)) + (warn (format "Problem with tanging %S to %S" SRC DEST))) + (kill-buffer output)))))) +#+END_SRC +* Hook on save +Now we need to make a hook function that, when the current buffer is an org file +in the doom directory, will run the literate config procedure from above. Use +this hook function and add it to the after-save-hook once org mode has been +loaded. README.org has been added as an exception because it doesn't contain +literate contents. +#+BEGIN_SRC elisp +(defun dx:literate/compile-hook () + "Any org file within $DOOM/org will be compiled on save" + (when (and (eq major-mode 'org-mode) + (or (file-in-directory-p buffer-file-name doom-private-dir) + (file-in-directory-p buffer-file-name (concat doom-private-dir "org"))) + (not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org"))))) + (dx:literate/tangle buffer-file-name (dx:literate/destination buffer-file-name)))) + +(after! org + (add-hook 'after-save-hook #'dx:literate/compile-hook)) +#+END_SRC +* Procedure for all files +A procedure that parses all the org files in a given directory into Emacs lisp +files, using the parser function made. Assume all org files in the "location" +directory contribute to the config. +The location is not set because this function could be easily programmed to use +multiple /differing/ sources to produce the config. The tangle function is set +because this is the function we'll be using for tangling all org files to ELisp files. +#+BEGIN_SRC elisp +(defun dx:literate/tangle-all (&optional location) + "Tangle all org files in `location' to el files in the `destination'" + (interactive) + (or location (setq location doom-private-dir)) + (message "Starting compilation process") + (let ((files (directory-files-recursively location ".org"))) + (dolist (file files) + (message "Compiling and parsing %s" file) + (dx:literate/tangle file (dx:literate/destination file))))) +#+END_SRC +* Load configuration +Final step of the literate cycle: load the config for the first time. +Remove the config.el and literate.el files from the load list because: +1) config.org is preloaded by doom +2) literate.org is loaded by config.org, thus no need to reload it + +#+BEGIN_SRC elisp +(let ((files (directory-files-recursively "~/.doom.d/org/" ".org"))) ; Load + (dolist (file (dx:literate/remove-mult dx:literate/preloaded-files files)) + (load (dx:literate/destination file)))) +#+END_SRC diff --git a/Doom/.doom.d/org/packages.org b/Doom/.doom.d/org/packages.org new file mode 100644 index 0000000..f8d6b11 --- /dev/null +++ b/Doom/.doom.d/org/packages.org @@ -0,0 +1,59 @@ +#+TITLE: Packages + +* Preclude +A list of extra packages I have added to doom, and justification for why. +Here are some examples of how to do packages in Doom. +#+BEGIN_SRC elisp :tangle no +(package! some-package) ;melpa +(package! another-package :recipe (:host github :repo "username/repo")) +(package! builtin-package :disable t) +#+END_SRC +* Header +Don't byte compile this, not a good idea. +#+BEGIN_SRC elisp +;; -*-no-byte-compile: t-*- +#+END_SRC +* General +** wttrin +Weather analysis, useful for when I don't have my phone near me or I need to +show just *how* much Emacs can do to someone. +#+BEGIN_SRC elisp +(package! wttrin) +#+END_SRC +** powerthesaurus +Thesaurus for Emacs, amazingly useful. I do know that doom has it's own +dictionary and thesaurus module, but I wish to use my own cos I have very +specific needs +#+BEGIN_SRC elisp +(package! powerthesaurus) +#+END_SRC +** base16-themes +Every now and then I like to use base16 themes, particularly when zen coding. +#+BEGIN_SRC elisp +(package! base16-theme) +#+END_SRC +* Coding +** counsel-etags +Should really be an inbuilt feature for Ivy, as it is so damn useful. Better +than the Helm or inbuilt "TAGS" searching options as it provides ways to quickly +filter data from the tag set which makes it incredibly fast. I have personally +used it in some of my personal functions such as the global testing function I +have for C# using both tags and OmniSharp. +#+BEGIN_SRC elisp +(package! counsel-etags) +#+END_SRC +** Arduino +I sometimes dabble in Arduino coding, and absolutely adore Emacs, so who says I +can't make Emacs an Arduino IDE? +*** arduino-mode +Absolutely necessary for Arduino development: syntax highlighting. I soon plan +to make my own Arduino mode on the back of cc-mode, but who knows when that will +happen? +#+BEGIN_SRC elisp +(package! arduino-mode) +#+END_SRC +*** company-arduino +Auto complete is essential to make the ultimate IDE experience™. Thus, company-arduino. +#+BEGIN_SRC elisp +(package! company-arduino) +#+END_SRC diff --git a/Doom/.doom.d/org/personal.org b/Doom/.doom.d/org/personal.org new file mode 100644 index 0000000..37a532a --- /dev/null +++ b/Doom/.doom.d/org/personal.org @@ -0,0 +1,73 @@ +#+TITLE: Personal module + +* Preclude +Personal functionality or variables that aid my workflow or are just cool. +* Variables +Some user variables +#+BEGIN_SRC elisp +(setq user-full-name "Aryadev Chavali" + user-mail-address "aryadevchavali1@gmail.com") +#+END_SRC +* Reload +Reload the doom session by brute force fully loading the "config.el" file in the +doom private directory. +#+BEGIN_SRC elisp +(defun dx:reload () + "Reload instance of doom" + (interactive) + (load-file (concat doom-private-dir "config.el"))) +#+END_SRC +* Change theme +Allow user to set a theme from a limited set of candidates, based on +"dx:theme-list". + +- Themes sanctioned by me: + - doom-solarized-dark: just the right everything. best for day. + - doom-gruvbox: good contrast, better for night. + - doom-city-lights: Eh contrast, quite dark + - doom-outrun-electric: Interesting colour palette + - doom-vibrant: Good contrast, bit lighter + - doom-molokai: hacker style + - doom-solarized-light: Light orange theme that's actually okay on the eyes + - doom-acario-light: Light theme with not bad colours +- Themes not sanctioned: + - Light themes other than solarized-light and acario + - Horrid low contrast ones with no colour. Grayscale particularly. I can't + handle those. + +#+BEGIN_SRC elisp +(setq dx:themes/theme-list '(doom-solarized-dark + doom-gruvbox doom-city-lights + doom-outrun-electric doom-vibrant doom-molokai + doom-solarized-light doom-acario-light + base16-3024 base16-classic-dark base16-material-vivid)) + +(defun dx:themes/set-new-theme () + "Set the theme from my own selection, mutate as you see fit" + (interactive) + (ivy-read "Select theme: " + dx:themes/theme-list + :caller 'oreodave/set-new-theme + :action (lambda (x) ; Shamelessly copied from counsel in case of change + (condition-case nil + (progn + (mapc #'disable-theme custom-enabled-themes) + (load-theme (intern x) t) + (when (fboundp 'powerline-reset) + (powerline-reset))) + (error "Problem loading theme %s" x))))) +#+END_SRC +* Password store +Function to get a password given a key. +#+BEGIN_SRC elisp +(defun dx:password-store/get-password (KEY) + (shell-command-to-string (concat "pass " KEY))) +#+END_SRC +* Weather +Function to quickly check weather, which is what I wanted wttrin for. +#+BEGIN_SRC elisp +(defun dx:weather () + "Check the weather at the 'location' stored in password store" + (interactive) + (wttrin (dx:password-store/get-password "location"))) +#+END_SRC diff --git a/Doom/.doom.d/packages.el b/Doom/.doom.d/packages.el new file mode 100644 index 0000000..96fa3e6 --- /dev/null +++ b/Doom/.doom.d/packages.el @@ -0,0 +1,4 @@ +;; -*- no-byte-compile: t; -*- +;;; ~/.doom.d/packages.el + +(load! "bin/packages.el") diff --git a/Doom/.doom.d/snippets/csharp-mode/class ... { ... } b/Doom/.doom.d/snippets/csharp-mode/class ... { ... } new file mode 100644 index 0000000..5e96938 --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/class ... { ... } @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: class ... { ... } +# key: class +# -- + +${1:public} class ${2:Name} +{ + $0 +} diff --git a/Doom/.doom.d/snippets/csharp-mode/foreach b/Doom/.doom.d/snippets/csharp-mode/foreach new file mode 100644 index 0000000..220fcd9 --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/foreach @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Foreach loop +# key: foreach +# condition: t +# -- +foreach (${1:var} ${2:i} in ${3:collection}) +{ + $0 +} diff --git a/Doom/.doom.d/snippets/csharp-mode/method b/Doom/.doom.d/snippets/csharp-mode/method new file mode 100644 index 0000000..a2aaf6b --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/method @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: public void Method { ... } +# key: method +# -- +${1:public} ${2:void} ${3:Method}(${4:int x}) +{ + ${0:return x;} +} diff --git a/Doom/.doom.d/snippets/csharp-mode/params b/Doom/.doom.d/snippets/csharp-mode/params new file mode 100644 index 0000000..b781710 --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/params @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: /// ... +# key: comment +# -- + +/// $0 \ No newline at end of file diff --git a/Doom/.doom.d/snippets/csharp-mode/prop b/Doom/.doom.d/snippets/csharp-mode/prop new file mode 100644 index 0000000..eb2969e --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/prop @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: property ... ... { ... } +# key: prop +# condition: t +# -- +public ${1:int} ${2:property} { get; set; }$0 \ No newline at end of file diff --git a/Doom/.doom.d/snippets/csharp-mode/returns b/Doom/.doom.d/snippets/csharp-mode/returns new file mode 100644 index 0000000..dee5e8d --- /dev/null +++ b/Doom/.doom.d/snippets/csharp-mode/returns @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: /// ... +# key: comment +# -- +/// $0 \ No newline at end of file diff --git a/Doom/.doom.d/snippets/org-mode/author b/Doom/.doom.d/snippets/org-mode/author new file mode 100644 index 0000000..3da977e --- /dev/null +++ b/Doom/.doom.d/snippets/org-mode/author @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: author +# key: +$0 \ No newline at end of file diff --git a/Doom/.doom.d/snippets/org-mode/include b/Doom/.doom.d/snippets/org-mode/include new file mode 100644 index 0000000..4938877 --- /dev/null +++ b/Doom/.doom.d/snippets/org-mode/include @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: include +# key: + $0 + + ) + } +} + +export default $1 \ No newline at end of file -- cgit v1.2.3-13-gbd6f