I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Christopher James Hayward 6985a14825 Add go support 4 years ago
config Add comment 4 years ago
docs Update headers 4 years ago
hosts Split host configs from README 4 years ago
modules Add go support 4 years ago
.gitattributes Fix attributes 4 years ago
.gitignore Ignore .el for .org source instead 4 years ago
.gitmodules Move submodule 4 years ago
LICENSE Update README/LICENSE 4 years ago
README.org Add go support 4 years ago
init.el Add capture module 4 years ago

README.org

Dotfiles

/chris/dotfiles/src/commit/6985a14825155da958c273bb449f3312f744119a/docs/images/desktop-alt.png

Immutable GNU Emacs dotfiles. Built for Life, Liberty, and the Open Road.

  • 100% Literate

  • 100% Immutable

  • 100% Reproducible

Init

Here's a complete list of all of the options configurable for each host, and their default values. All variables prefixed with dotfiles/. If you need to make configurations to another variable, consider creating a new option.

(defvar dotfiles/font 
  "Fira Code" 
  "Unified system font family.")

(defvar dotfiles/font-size 
  96 
  "Unified system font size.")

(defvar dotfiles/browser 
  (getenv "BROWSER") 
  "Default system web browser.")

(defvar dotfiles/language 
  (getenv "LANG") 
  "Default system dictionary language.")

(defconst dotfiles/modules-p 
  '(core 
    editor
    ;; email
    desktop
    writing
    website
    capture
    projects
    interface) 
  "All of the available modules.")

(defvar dotfiles/modules 
  dotfiles/modules-p 
  "All of the enabled modules.")

(defvar dotfiles/home 
  user-emacs-directory 
  "Original value of `user-emacs-directory'.")

(defvar dotfiles/cache 
  (expand-file-name "~/.cache/emacs") 
  "Redirection target of `user-emacs-directory'.")

(defvar dotfiles/idle 
  0.0 
  "Delay time before offering suggestions and completions.")

(defvar dotfiles/leader-key 
  "SPC" 
  "All powerful leader key.")

(defvar dotfiles/leader-key-global 
  (concat "C-" dotfiles/leader-key) 
  "Global prefix for the leader key.")

(defvar dotfiles/projects 
  (expand-file-name "~/.local/source/") 
  "Location of source code projects.")

(defvar dotfiles/passwords 
  (expand-file-name "~/.password-store/") 
  "Location of local password store.")

(defvar dotfiles/public-key 
  "37AB1CB72B741E478CA026D43025DCBD46F81C0F" 
  "GPG key to encrypt org files for.")

Hosts

Each host machines configuration is loaded immediately after the options are declared, before any configuration is applied. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started:

Begin the process by loading any host specific overrides. The host configuration tangles, and loads (if it exist) using the systems name.

(let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
  (when (file-exists-p host-file)
    (org-babel-load-file host-file)))

Modules

Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Here are all of the available modules, also listed in the variable dotfiles/modules-p.

By default all of the modules will load, override the variable dotfiles/modules in a host configuration to override this.

(dolist (m dotfiles/modules)
  (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
    (when (file-exists-p mod-file)
      (org-babel-load-file mod-file))))

HTTP

Instead of the popular restclient package, I use ob-http as a lightweight alternative.

(use-package ob-http
  :after org
  :config (org-babel-do-load-languages
            'org-babel-load-languages
            '((http . t))))

C/C++

/chris/dotfiles/src/commit/6985a14825155da958c273bb449f3312f744119a/docs/images/2021-02-13-example-ccls.gif

Add support for C/C++ languages.

  • Configure the ccls language server

  • Load babel language modules for C/C++

  • Create a new structure templates for C/C++

    • <cc for C

    • <cpp for C++

(use-package ccls
  :hook ((c-mode c++-mode objc-mode cuda-mode) .
         (lambda ()
           (require 'ccls)
           (lsp-deferred)))
  :config (add-to-list 'org-structure-template-alist '("cc" . "src C"))
          (add-to-list 'org-structure-template-alist '("cpp" . "src C++"))
          (org-babel-do-load-languages 'org-babel-load-languages '((C . t))))

Python

Install the pyls language server.

pip3 install --user "python-language-server[all]"

Python-mode is an Emacs built in mode.

  • Load the babel language module for Python

  • Add a python source code block structure template with <py

(use-package python-mode
  :hook (python-mode . lsp-deferred)
  :config (require 'dap-python)
          (add-to-list 'org-src-lang-modes '("python" . python))
          (add-to-list 'org-structure-template-alist '("py" . "src python"))
          (org-babel-do-load-languages 'org-babel-load-languages '((python . t)))
  :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
          (dap-python-executable "python3")    ;; Same as above.
          (dap-python-debugger 'debugpy))

PlantUML

Download and install PlantUML, a text-based markup language for creating UML diagrams.

  • Load the babel language module for PlantUML

  • Create a structure template with <pl

(use-package plantuml-mode
  :after org
  :custom (plantuml-default-exec-mode 'jar)
          (plantuml-jar-path "~/.local/bin/plantuml.jar")
          (org-plantuml-jar-path (expand-file-name "~/.local/bin/plantuml.jar"))
          (org-startup-with-inline-images t)
  :config (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
          (add-to-list 'org-structure-template-alist '("pl" . "src plantuml"))
          (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))))

Toggle inline images with SPC t i.

(dotfiles/leader
  "ti" '(org-toggle-inline-images :which-key "Images"))

Interface

/chris/dotfiles/src/commit/6985a14825155da958c273bb449f3312f744119a/docs/images/what-is-emacs-teaser.png

Bring Emacs out of the eighties

Ivy

Download and configure ivy, a powerful selection menu for Emacs.

(use-package ivy
  :diminish
  :config (ivy-mode 1))

Counsel is a customized set of commands to replace built in completion buffers.

(use-package counsel
  :after ivy
  :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
  :config (counsel-mode 1))

Switch buffers with SPC , (comma).

(dotfiles/leader
  "," '(counsel-switch-buffer :which-key "Buffers"))

Provide more information about each item with ivy-rich.

(use-package ivy-rich
  :after counsel
  :init (ivy-rich-mode 1))

Fonts

Write out to all 3 of Emacs' default font faces.

(set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
(set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
(set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)

Define a transient keybinding for scaling the text.

(defhydra hydra-text-scale (:timeout 4)
  "Scale"
  ("j" text-scale-increase "Increase")
  ("k" text-scale-decrease "Decrease")
  ("f" nil "Finished" :exit t))

Increase the font size in buffers with SPC t f.

  • Increase j

  • Decrease k

  • Finish f

(dotfiles/leader
  "tf" '(hydra-text-scale/body :which-key "Font"))

Lines

Relative line numbers are important when using VI emulation keys. You can prefix most commands with a number, allowing you to jump up / down by a line count.

  5:
  4:
  3:
  2:
  1:
156: << CURRENT LINE >>
  1:
  2:
  3:
  4:
  5:

https://github.com/emacsmirror/linum-relative

  • Integrate with display-line-numbers-mode for performance

(use-package linum-relative
  :commands (linum-relative-global-mode)
  :custom (linum-relative-backend 'display-line-numbers-mode))

Add line numbers to the toggles behind SPC t l.

(dotfiles/leader
  "tl" '(linum-relative-global-mode :which-key "Lines"))

https://github.com/Fanael/rainbow-delimiters

  • Colourize nested parenthesis

(use-package rainbow-delimiters
  :hook (prog-mode . rainbow-delimiters-mode))

Themes

/chris/dotfiles/src/commit/6985a14825155da958c273bb449f3312f744119a/docs/images/what-is-emacs-customizable.gif

Cherry pick a few modules from doom-emacs. High quality and modern colour themes are provided in the doom-themes package.

(use-package doom-themes
  :init (load-theme 'doom-moonlight t))

doom-modeline provides an elegant status bar / modeline.

(use-package doom-modeline
  :custom (doom-modeline-height 16)
  :config (doom-modeline-mode 1))

Load a theme with SPC t t.

(dotfiles/leader
  "tt" '(counsel-load-theme t t :which-key "Theme"))

Pretty

Make programming buffers prettier with pretty-mode, complimentary to the built in prettify-symbols-mode.

(use-package pretty-mode
  :hook (python-mode . turn-on-pretty-mode))

Ligatures

Enable font ligatures via fira-code-mode, perform this action only when Fira Code is the current font.

(when (display-graphic-p)
  (use-package fira-code-mode
    :hook (prog-mode org-mode)))

Toggle global ligature mode with SPC t g.

(dotfiles/leader
  "tg" '(global-fira-code-mode :which-key "Ligatures"))

Dashboard

/chris/dotfiles/src/commit/6985a14825155da958c273bb449f3312f744119a/docs/images/desktop.png

Present a dashboard when first launching Emacs. Customize the buttons of the navigator:

(use-package dashboard
  :custom (dashboard-center-content t)
          (dashboard-set-init-info t)
          (dashboard-set-file-icons t)
          (dashboard-set-heading-icons t)
          (dashboard-set-navigator t)
          (dashboard-startup-banner 'logo)
          (dashboard-projects-backend 'projectile)
          (dashboard-items '((projects . 5) (recents  . 5) (agenda . 10)))
          (dashboard-navigator-buttons `(((,(all-the-icons-fileicon "brain" :height 1.1 :v-adjust 0.0)
                                          "Brain" "Knowledge base"
                                          (lambda (&rest _) (browse-url "http://localhost:8080"))))
                                         ((,(all-the-icons-material "public" :height 1.1 :v-adjust 0.0)
                                          "Homepage" "Personal website"
                                          (lambda (&rest _) (browse-url "https://chrishayward.xyz"))))
                                         ((,(all-the-icons-faicon "university" :height 1.1 :v-adjust 0.0)
                                          "Athabasca" "Univeristy login"
                                          (lambda (&rest _) (browse-url "https://login.athabascau.ca/cas/login"))))
                                         ((,(all-the-icons-faicon "book" :height 1.1 :v-adjust 0.0)
                                          "Bookshelf" "Vitalsource bookshelf"
                                          (lambda (&rest _) (browse-url "https://online.vitalsource.com"))))))
  :config (dashboard-setup-startup-hook))

When running in daemon mode, ensure that the dashboard is the initial buffer.

(setq initial-buffer-choice
      (lambda ()
        (get-buffer "*dashboard*")))