Skip to content

Latest commit

 

History

History
1207 lines (1169 loc) · 40.3 KB

config.org

File metadata and controls

1207 lines (1169 loc) · 40.3 KB

User details

(setq user-full-name "Mrinal Purohit"
      user-mail-address "[email protected]")

Mac specific

Beginning of line and end of line

(global-set-key [home] 'move-beginning-of-line)
(global-set-key [end] 'move-end-of-line)
(global-set-key (kbd "C-c b") 'beginning-of-buffer)
(global-set-key (kbd "C-c e") 'end-of-buffer)

Command and alt keys

(setq mac-option-key-is-meta t)
(setq mac-command-key-is-meta t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'super)
(defun prelude-swap-meta-and-super ()
  "Swap the mapping of Meta and Super.
Very useful for people using their Mac with a
Windows external keyboard from time to time."
  (interactive)
  (if (eq mac-command-modifier 'super)
      (progn
        (setq mac-command-modifier 'meta)
        (setq mac-option-modifier 'super)
        (message "Command is now bound to META and Option is bound to SUPER."))
    (progn
      (setq mac-command-modifier 'super)
      (setq mac-option-modifier 'meta)
      (setq mac-option-key-is-meta t)
      (message "Command is now bound to SUPER and Option is bound to META."))))

(global-set-key (kbd "C-c w") 'prelude-swap-meta-and-super)

Start server

(require 'server)
(unless (server-running-p)
  (server-start))

Package initializations

Load secrets

(load "~/.emacs.d/secrets")

Enable custom themes

(setq custom-safe-themes t)

Snippets

Disable bell

(setq visible-bell t)
(setq ring-bell-function 'ignore)

Smarter move beginning of line

(defun smarter-move-beginning-of-line (arg)
  "Move point back to indentation of beginning of line.

Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.

If ARG is not nil or 1, move forward ARG - 1 lines first.  If
point reaches the beginning or end of the buffer, stop there."
  (interactive "^p")
  (setq arg (or arg 1))

  ;; Move lines first
  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

;; remap C-a to `smarter-move-beginning-of-line'
(global-set-key (kbd "C-a") 'smarter-move-beginning-of-line)

Editing defaults

Column number

(column-number-mode t)

Highlight currrent line

(global-hl-line-mode t)

Word Wrap

(global-visual-line-mode t)

No double space sentences

(setq-default sentence-end-double-space nil)

Dialogue boxes

(setq use-dialog-box nil)

Show tilde `~` for empty lines in left fringe

(define-fringe-bitmap 'tilde [0 0 0 113 219 142 0 0] nil nil 'center)
(set-fringe-bitmap-face 'tilde 'font-lock-comment-face)
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
(setq-default indicate-empty-lines t)

Display date/time in modeline

(setq display-time-day-and-date t)
(setq display-time-format "%H:%M %a %e %B %Y")
(setq display-time-default-load-average nil)
(display-time)

Change prompts

Make yes or no be y or n

(fset 'yes-or-no-p 'y-or-n-p)

Clipboard management

(setq save-interprogram-paste-before-kill t)

Encoding

(set-language-environment "UTF-8")
(set-default-coding-systems 'utf-8)

Hide menu, tool, scroll bar

(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

Cursor

Cursor type to bar and disable cursor blink

(setq-default cursor-type 'bar)
(blink-cursor-mode -1)

Replace selected text

(delete-selection-mode t)

Don’t ask whether to open symlinked files, just open them

(setq vc-follow-symlinks t)

Easier mark popping

Pressing C-u C-SPC to pop mark every time is cumbersome, this setting helps to just do C-u C-SPC and C-SPC repeatedly

(setq set-mark-command-repeat-pop t)

Load newest byte code

(setq load-prefer-newer t)

Warn only when opening files larger than 100MB

(setq large-file-warning-threshold 100000000)

Set column to 80

(setq-default fill-column 80)

Disable tab indentation

(setq-default indent-tabs-mode nil
              tab-width 4)

Font

(add-to-list 'default-frame-alist
             '(font . "-*-Iosevka-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1"))
;; old code
;; (set-face-attribute 'default nil
;;                     :family "Source Code Pro"
;;                     :foundry "ADBO"
;;                     :height 105
;;                     :weight 'normal
;;                     :width 'normal)

;; (set-default-font "Source Code Pro" nil t)
;; (set-face-attribute 'default nil :height 105)

Smooth scrolling, from Chillar Anand

;; nice scrolling
(setq scroll-margin 0
      scroll-conservatively 100000
      scroll-preserve-screen-position t)

Startup messages

(setq inhibit-startup-message t
      initial-scratch-message ""
      initial-major-mode 'text-mode
      inhibit-startup-echo-area-message t)

Split window Vertically

(setq split-height-threshold nil)
(setq split-width-threshold 160)

Disable list all buffer key-binding

(global-unset-key (kbd "C-x C-b"))

Delete Trailing whitespace on save

(add-hook 'before-save-hook 'whitespace-cleanup)

Faster scroll movement

(setq auto-window-vscroll nil)

Disable native async comp warnings

(setq native-comp-async-report-warnings-errors nil)

Files

Auto Revert Mode

Revert buffers automatically when files are changed externally

(global-auto-revert-mode t)

Revert buffers based on VC info

(setq auto-revert-check-vc-info t)

Desktop mode

Change desktop-save values, picked from Chillar Anand

(use-package desktop
  :config
  (setq desktop-dirname             (concat user-emacs-directory "desktop/")
        desktop-base-file-name      "emacs.desktop"
        desktop-base-lock-name      "lock"
        desktop-path                (list desktop-dirname)
        desktop-save                t
        desktop-files-not-to-save   "^$"  ;reload tramp paths
        desktop-load-locked-desktop t)
  (desktop-save-mode t))

Don’t make backup files

(setq make-backup-files nil)

Save Place

(save-place-mode t)

Projects

Projectile GitHub

(use-package projectile
  :straight t
  :defer 5
  :init
  (setq projectile-keymap-prefix (kbd "C-c p"))
  (projectile-mode))

Packages

Hydra GitHub

(use-package hydra
  :straight t)

Ace-window GitHub

(use-package ace-window
  :straight t
  :bind
  ("M-o" . ace-window)
  :config
  (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
(use-package ag
  :straight t)

All the icons GitHub

(use-package all-the-icons
  :straight t)

Anzu GitHub

For current match and total match information in the mode-line

(use-package anzu
  :straight t
  :diminish (anzu-mode)
  :defer 5
  :config
  (global-set-key [remap query-replace] 'anzu-query-replace)
  (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
  :init
  (global-anzu-mode t))

Avy GitHub

(use-package avy
  :straight t
  :bind
  ("C-:" . avy-goto-char)
  ("M-g g" . avy-goto-line)
  ("M-g M-g". avy-goto-line)
  :config
  (setq avy-background t
        avy-keys (number-sequence ?a ?z)
        avy-keys-alist
      `((avy-goto-char . ,(number-sequence ?a ?f))
        (avy-goto-word-1 . (?f ?g ?h ?j)))
        avy-highlight-first t)
  (avy-setup-default))

Buffer show binding just to kill buffers easily

(use-package bs
  :straight t
  :bind
  ("M-g M-b" . bs-show))

Buffer Uniquify GitHub

(use-package uniquify
  :defer 2
  :config
  (setq uniquify-buffer-name-style 'forward
        uniquify-separator "/"
        uniquify-after-kill-buffer-p t
        uniquify-ignore-buffers-re "^\\*"))

Copilot

(use-package copilot
  :straight (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
  :hook
  (prog-mode . copilot-mode)
  :bind (:map copilot-completion-map
              ("<tab>" . 'copilot-accept-completion)
              ("TAB" . 'copilot-accept-completion))
              ;; ("C-TAB" . 'copilot-accept-completion-by-word)
              ;; ("C-<tab>" . 'copilot-accept-completion-by-word)
  :config
  ;; (define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
  ;; (define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
  (add-to-list 'copilot-indentation-alist '(prog-mode . 2))
  (add-to-list 'copilot-indentation-alist '(org-mode . 2))
  (add-to-list 'copilot-indentation-alist '(text-mode . 2))
  (add-to-list 'copilot-indentation-alist '(closure-mode . 2))
  (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode . 2))
  :ensure t)

Diminish GitHub

(use-package diminish
  :straight t
  :diminish (auto-revert-mode visual-line-mode))

Editorconfig GitHub

(use-package editorconfig
  :straight t
  :config
  (editorconfig-mode 1))

Expand Region GitHub

(use-package expand-region
  :straight t
  :defer t
  :bind
  ("C-=" . er/expand-region))

Flycheck GitHub

(use-package flycheck
  :straight t
  :functions hydra-flycheck
  :defer t
  :config
  (define-key flycheck-mode-map flycheck-keymap-prefix nil)
  (setq flycheck-idle-change-delay 3.0)
  (define-key flycheck-mode-map flycheck-keymap-prefix flycheck-command-map)
  :init
  (global-flycheck-mode))

    ;; (defhydra hydra-flycheck (:hint nil))
  (defhydra hydra-flycheck
    (:pre (progn (setq hydra-hint-display-type t) (flycheck-list-errors))
     :post (progn (setq hydra-hint-display-type nil) (quit-windows-on "*Flycheck errors*"))
     :hint nil)
    "Errors"
    ("f"  flycheck-error-list-set-filter                            "Filter")
    ("j"  flycheck-next-error                                       "Next")
    ("k"  flycheck-previous-error                                   "Previous")
    ("gg" flycheck-first-error                                      "First")
    ("G"  (progn (goto-char (point-max)) (flycheck-previous-error)) "Last")
    ("q"  nil))

(bind-key "C-c f" 'hydra-flycheck/body)

Flyspell GitHub

Use flyspell for markdown files

(use-package flyspell
  :straight t
  :defer t
  :mode ("'\\.md\\'" . flyspell-mode))

Free keys GitHub

(use-package free-keys
  :straight t)

Git

Git Messenger GitHub (currently unused)

(use-package git-messenger
  :bind
  ("C-c v p" . git-messenger:popup-message)
  :config
  (setq git-messenger:show-detail t
        git-messenger:use-magit-popup t))

Git Timemachine GitHub (currently unused)

(use-package git-timemachine
  :bind
  ("C-c C-x t" . git-timemachine))

Magit GitHub

(use-package magit
  :straight t
  :defer 5
  :bind
  (("C-x g" . magit-status)
   ("C-c g b" . magit-blame)
   )
  :config
  (setq magit-commit-arguments nil ;;(quote ("--gpg-sign=E27C4BC509095144"))
        magit-diff-use-overlays nil
        magit-diff-refine-hunk t
        ;; magit-blame-styles '((side-view
        ;;                     (margin-format    . (" %s%f" " %C %a" " %H"))
        ;;                     (margin-width     . 42)
        ;;                     (margin-face      . magit-blame-margin)
        ;;                     (margin-body-face . (magit-blame-dimmed))))
        )
  )

Google-this GitHub (currently unused)

(use-package google-this
  :diminish (google-this-mode)
  :bind
  ("C-c /" . google-this-mode-submap)
  :config
  (google-this-mode 1))

Helm GitHub

(use-package helm
  :straight t
  :defer 5
  :diminish (helm-mode)
  :bind
  ("M-g M-m" . helm-global-mark-ring)
  ("M-x" . helm-M-x)
  ("C-x b" . helm-mini)
  ("M-y" . helm-show-kill-ring)
  ("C-x C-f" . helm-find-files)
  :config
  (setq helm-M-x-fuzzy-match                  t
        helm-buffers-fuzzy-matching           t
        helm-recentf-fuzzy-match              t)
  ;;       helm-bookmark-show-location           t
  ;;       helm-buffers-fuzzy-matching           t
  ;;       helm-completion-in-region-fuzzy-match t
  ;;       helm-file-cache-fuzzy-match           t
  ;;       helm-imenu-fuzzy-match                t
  ;;       helm-mode-fuzzy-match                 t
  ;;       helm-locate-fuzzy-match               t
  ;;       helm-quick-update                     t
  ;;       helm-recentf-fuzzy-match              t
  ;;       helm-semantic-fuzzy-match             t)
  (helm-mode 1))

Helm Flx GitHub (currently unused)

(use-package helm-flx
  :init
  (helm-flx-mode +1))

Helm Fuzzier GitHub (currently unused)

;; (use-package helm-fuzzier
;;   :init
;;   (helm-fuzzier-mode 1))

Helm Projectile GitHub

(use-package helm-projectile
  :straight t
  :defer 5
  :config
  (helm-projectile-on))

Helm Ag GitHub

(use-package helm-ag
  :straight t
  :config
  (setq helm-ag-fuzzy-match t
        helm-ag-base-command "ag --nocolor --nogroup --ignore-case --hidden"))

Hungry Delete GitHub

(use-package hungry-delete
  :straight t
  :diminish (hungry-delete-mode)
  :config
  (global-hungry-delete-mode))

Ido (currently unused)

Flx-ido

(use-package flx-ido
  :init (flx-ido-mode t)
  :config
  (setq ido-enable-flex-matching t
        ido-use-faces nil))

Ido mode

(use-package ido
  :init
  (ido-mode t)
  (setq ido-everywhere t))

Ido-vertical mode

(use-package ido-vertical-mode
  :init
  (ido-vertical-mode t)
  (setq ido-vertical-define-keys 'C-n-C-p))

jsonrpc

(use-package jsonrpc
  :straight t)

Keychain GitHub

(use-package keychain-environment
  :straight t
  :defer t
  :init
  (keychain-refresh-environment))

Key Frequency GitHub

(use-package keyfreq
  :straight t
  :config
  (keyfreq-mode t)
  (keyfreq-autosave-mode t))

Multiple Cursors GitHub

(use-package multiple-cursors
    :straight t
    :functions hydra-mc
    :commands (mc/add-cursor-on-click
               mc/edit-beginning-of-lines
               mc/edit-lines
               mc/insert-numbers
               mc/qmark-all-dwim
               mc/mark-all-in-region-regexp
               mc/mark-all-like-this
               mc/mark-next-like-this
               mc/mark-previous-like-this
               mc/mark-sgml-tag-pair
               mc/reverse-regions
               mc/skip-to-next-like-this
               mc/skip-to-previous-like-this
               mc/sort-regions
               mc/unmark-next-like-this
               mc/unmark-previous-like-this))

(defhydra hydra-mc (:hint nil)
      "
          ^Up^            ^Down^        ^All^                ^Lines^               ^Edit^                 ^Other^
    ----------------------------------------------------------------------------------------------------
    [_p_]   Next    [_n_]   Next    [_a_] All like this  [_l_] Edit lines      [_i_] Insert numbers   [_t_] Tag pair
    [_P_]   Skip    [_N_]   Skip    [_r_] All by regexp  [_L_] Edit line beg.  [_s_] Sort regions      ^ ^
    [_M-p_] Unmark  [_M-n_] Unmark  [_d_] All DWIM        ^ ^                  [_R_] Reverse regions  [_q_] Quit
    "
      ("p" mc/mark-previous-like-this)
      ("P" mc/skip-to-previous-like-this)
      ("M-p" mc/unmark-previous-like-this)

      ("n" mc/mark-next-like-this)
      ("N" mc/skip-to-next-like-this)
      ("M-n" mc/unmark-next-like-this)

      ("a" mc/mark-all-like-this :exit t)
      ("r" mc/mark-all-in-region-regexp :exit t)
      ("d" mc/mark-all-dwim :exit t)

      ("l" mc/edit-lines :exit t)
      ("L" mc/edit-beginnings-of-lines :exit t)

      ("i" mc/insert-numbers)
      ("s" mc/sort-regions)
      ("R" mc/reverse-regions)

      ("t" mc/mark-sgml-tag-pair)
      ("q" nil)

      ("<mouse-1>" mc/add-cursor-on-click)
      ("<down-mouse-1>" ignore)
      ("<drag-mouse-1>" ignore))

(bind-key "C-c m" 'hydra-mc/body)

Paradox GitHub (currently unused)

(use-package paradox
  :defer t
  :config
  (setq paradox-execute-asynchronously t))

PDF Tools GitHub

For better/faster PDF rendering

(use-package pdf-tools
  :straight t
  :init
  (pdf-tools-install))

Good scroll

(use-package good-scroll
  :config
  (good-scroll-mode 1))

Smartparens GitHub

(use-package smartparens
  :straight t
  :diminish (smartparens-mode)
  :defer 5
  :bind
  ("C-c s" . sp-unwrap-sexp)
  :init
  (use-package smartparens-config
    :ensure nil)
  (smartparens-global-mode)
  (show-smartparens-global-mode))

Undo tree Elpa

For undo visualizations

(use-package undo-tree
  :straight t
  :diminish undo-tree-mode
  :bind
  ("C-z" . undo)
  ("C-S-z" . undo-tree-redo)
  :config
  (setq undo-tree-auto-save-history t
        undo-tree-history-directory-alist `(("." . ,(concat user-emacs-directory "undo-tree-history/")))
        undo-tree-visualizer-diff t
        undo-tree-visualizer-timestamps t)
  :init
  (global-undo-tree-mode))

Regex (Base) GitHub Mirror

(use-package re-builder
  :straight t
  :init
  (setq reb-re-syntax 'string))

Smartscan GitHub

(use-package smartscan
  :straight t
  :config
  (smartscan-mode t))

Which key GitHub

Displays available keybindings in a popup

(use-package which-key
    :straight t
    :defer t
    :diminish (which-key-mode)
    :init
    (which-key-setup-side-window-bottom)
    (which-key-mode))

Winum Mode GitHub (currently unused)

(use-package winum
  :config
  (winum-set-keymap-prefix (kbd "C-c"))
  :bind
  ("M-1" . winum-select-window-1)
  ("M-2" . winum-select-window-2)
  ("M-3" . winum-select-window-3)
  ("M-4" . winum-select-window-4)
  :init
  (winum-mode))

Zop-to-char GitHub

(use-package zop-to-char
  :straight t
  :config
  (global-set-key [remap zap-to-char] 'zop-to-char))

Programming

Auto-complete GitHub

(use-package auto-complete
  :straight t
  :defer t
  :init
  (global-auto-complete-mode t)
  (ac-config-default))

Clean Mode

(use-package clean-mode
  :load-path "clean-mode/"
  :init
  (add-to-list 'auto-mode-alist '("\\.cl\\'" . clean-mode)))

Direnv GitHub

(use-package direnv
  :straight t
  :functions hydra-de
  :config
  (direnv-mode))
(defhydra hydra-de (:hint nil)
      "
          ^Allow^          ^Update^                     ^Other^
    ----------------------------------------------------------------------------------------------------
    [_a_]   Allow    [_u_]   Update Environment   [_q_]   Quit
    "
      ("a" direnv-allow :exit t)
      ("u" direnv-update-environment :exit t)
      ("q" nil))

(bind-key "C-c d" 'hydra-de/body)

Dhall GitHub

(use-package dhall-mode
  :straight t
  :ensure t
  :config
  (setq
    ;; uncomment the next line to disable automatic format
    dhall-format-at-save nil

    ;; comment the next line to use unicode syntax
    dhall-format-arguments (\` ("--ascii"))

    ;; header-line is obsoleted by lsp-mode
    dhall-use-header-line nil))

Groovy GitHub

(use-package groovy-mode
  :defer t
  :config
  (setq groovy-indent-offset 2))

Haskell

Haskell mode GitHub

(use-package haskell-mode
  :straight t
  :bind
  ([f8] . haskell-navigate-imports))

Dante GitHub (currently unused)

(use-package dante
  :after haskell-mode
  :commands 'dante-mode
  :init
  (add-hook 'haskell-mode-hook 'flycheck-mode)
  (add-hook 'haskell-mode-hook 'dante-mode)
  (add-hook 'dante-mode-hook
   '(lambda () (flycheck-add-next-checker 'haskell-dante
                '(warning . haskell-hlint)))))

Hindent GitHub (currently unused)

(use-package hindent
  :config
  (add-hook 'haskell-mode-hook 'hindent-mode))

Hasky-extensions GitHub

(use-package hasky-extensions
  :bind
  ("C-c y" . hasky-extensions)
  ("C-c h x" . hasky-extensions-browse-docs))

LSP

LSP mode GitHub

(use-package lsp-mode
  :straight t
  :hook ((dhall-mode haskell-mode nix-mode) . lsp)
  :functions hydra-lsp
  :init
  (add-hook 'haskell-mode-hook 'direnv-update-environment)
  :commands lsp
  :config
  (setq lsp-prefer-flymake nil
        lsp-modeline-diagnostics-enable t))

(defhydra hydra-lsp (:hint nil)
      "
          ^Start^              ^Action^                    ^Other^
    ----------------------------------------------------------------------------------------------------
    [_s_]   Start LSP    [_a_]   Apply code action   [_q_]   Quit
    [_r_]   Restart LSP  [_f_]   Format code
    "
      ("s" lsp :exit t)
      ("r" lsp-workspace-restart :exit t)
      ("a" lsp-execute-code-action :exit t)
      ("f" lsp-format-buffer :exit t)
      ("q" nil))

(bind-key "C-c c" 'hydra-lsp/body)

LSP Haskell GitHub

(use-package lsp-haskell
  :straight t
  :after (haskell-mode lsp-mode)
  :defer t
  :custom
  (lsp-haskell-process-path-hie "haskell-language-server-wrapper")
  :hook
  (haskell-mode . lsp-haskell-set-hlint-on)
  (haskell-mode . lsp-haskell-set-completion-snippets-on)
  :config
  (setq lsp-haskell-formatting-provider "fourmolu"))

LSP UI GitHub

(use-package lsp-ui
  :straight t
  :commands lsp-ui-mode
  :hook (prog-mode . lsp-ui-mode)
  :config
  (setq lsp-ui-flycheck-enable t
        lsp-ui-doc-position 'bottom))
;; (use-package company-lsp :commands company-lsp)
;; (use-package helm-lsp :commands helm-lsp-workspace-symbol)
;; (use-package lsp-treemacs :commands lsp-treemacs-errors-list)

JavaScript

js2-mode GitHub

(use-package js2-mode
  :straight t
  :defer 5
  :mode ("\\.js\\'" . js2-mode)
  :hook
  (js-mode . js2-minor-mode)
  :init
  (setq js2-include-node-externs t)
  (setq js2-basic-offset 2)
  (setq js-indent-level 2)
  (setq js2-strict-missing-semi-warning nil)
  (setq js-switch-indent-offset 2))

js2-refactor GitHub

(use-package js2-refactor
  :straight t
  :diminish (js2-refactor-mode)
  :defer t
  :config
  (js2r-add-keybindings-with-prefix "C-c C-m")
  (add-hook 'js2-mode-hook 'js2-refactor-mode))

xref-js2 GitHub

(use-package xref-js2
  :straight t
  :defer 5
  :init
  (add-hook 'js2-mode-hook (lambda ()
                             (add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t))))

Nix

lsp-nix

(use-package lsp-nix
  :after (lsp-mode)
  :demand t
  :custom
  (lsp-nix-nil-formatter ["nixfmt"]))

Nix-mode GitHub

(use-package nix-mode
  :straight t
  :mode ("\\.nix\\'" . nix-mode)
  :hook (nix-mode . lsp-deferred))

PureScript

PureScript mode

(use-package purescript-mode
  :commands purescript-mode
  :mode (("\\.purs$" . purescript-mode))
  :config
  (add-hook 'purescript-mode-hook #'turn-on-purescript-decl-scan)
  (add-hook 'purescript-mode-hook #'turn-on-purescript-indentation))

Psc-ide

(use-package psc-ide
  :diminish (purescript-indentation-mode psc-ide-mode company-mode)
  :config
  (setq psc-ide-rebuild-on-save t
        psc-ide-use-npm-bin t
        psc-ide-editor-mode t)
  :bind
  ("C-c C-v" . psc-ide-flycheck-insert-suggestion)
  :init
  (add-hook 'purescript-mode-hook
            (lambda ()
              (psc-ide-mode)
              (company-mode)
              (turn-on-purescript-indentation))))

Python (currently unused)

(use-package elpy
  :defer t
  :config
  (setq python-indent-offset 4)
  (elpy-enable))

(use-package jedi
  :defer t
  :init
  (add-hook 'python-mode-hook 'jedi:setup)
  (setq jedi:complete-on-dot t
        jedi:use-shortcuts t))

(use-package py-autopep8
  :defer t
  :init
  (add-hook 'python-mode-hook 'py-autopep8-enable-on-save))

Snippets GitHub

(use-package yasnippet
  :straight t
  :defer t
  :diminish (yas-minor-mode)
  :config
  (setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt))
  (setq yas-indent-line 'fixed)
  (yas-global-mode 1))

Web mode GitHub

(use-package web-mode
  :defer t
  :mode
  ("\\.html?\\'" . web-mode)
  ("\\.css?\\'" . web-mode)
  :config
  (setq web-mode-markup-indent-offset 2
        web-mode-code-indent-offset 2
        web-mode-css-indent-offset 2
        web-mode-script-padding 0
        web-mode-enable-auto-expanding t
        web-mode-enable-css-colorization t
        web-mode-enable-auto-pairing nil
        web-mode-enable-auto-closing t
        web-mode-enable-auto-quoting t))

YAML GitHub

(use-package yaml-mode
  :straight t
  :defer t)

Documentation

Markdown GitHub

(use-package markdown-mode
  :straight t
  :defer t
  :commands (markdown-mode gfm-mode)
  :mode ("\\.md\\'" . gfm-mode)
  :init
  (setq markdown-command "multimarkdown"))

Org Mode

Org (Base) GitHub

(use-package org
  :straight (:type built-in)
  :bind
  ("C-c l" . org-store-link)
  ("C-c a" . org-agenda)
  :config
  (setq org-log-done t
        org-support-shift-select t
        org-catch-invisible-edits 'show-and-error
        ;; stop emacs asking for confirmation
        org-confirm-babel-evaluate nil
        org-src-fontify-natively t
        org-src-tab-acts-natively t
        org-fontify-whole-heading-line t
        org-fontify-done-headline t
        org-fontify-quote-and-verse-blocks t
        org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)")
                            (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
                            (sequence "|" "CANCELED(c)"))))
;; (setq org-todo-keywords
;;       '((sequence "TODO(t)" "IN-PROGRESS(i)" "CANCELLED(c)" DONE(d)"))))

Org bullets GitHub

(use-package org-bullets
  :straight t
  :after org
  :init
  ;; (setq org-bullets-bullet-list '("●"))
  (org-bullets-mode t)
  (add-hook 'org-mode-hook 'org-bullets-mode))

Visuals

Highlight modes

Git Gutter GitHub

For the fringe on the left with live changes

(use-package git-gutter
  :straight t
  :diminish (git-gutter-mode)
  :defer t
  :hook (prog-mode . git-gutter-mode)
  :config
  (global-git-gutter-mode t)
  (setq git-gutter:update-interval 0.02)
  ;; (set-face-foreground 'git-gutter:modified-sign "#a36fff")
  ;; (set-face-foreground 'git-gutter:added-sign "#198844")
  ;; (set-face-foreground 'git-gutter:deleted-sign "#cc342b")
  (add-to-list 'git-gutter:update-hooks 'focus-in-hook)
  (add-hook 'git-gutter:update-hooks 'magit-after-revert-hook)
  (add-hook 'git-gutter:update-hooks 'magit-not-reverted-hook))

Rainbow mode for Programming modes GitHub

(use-package rainbow-mode
  :straight t
  :diminish rainbow-mode
  :init
  (add-hook 'prog-mode-hook 'rainbow-mode))

Themes

Doom theme and custom theme modifications (currently unused)

(use-package doom-themes
  :init
  (load-theme 'doom-one t)
  (setq doom-enable-bold t    ; if nil, bolding are universally disabled
        doom-enable-italic t  ; if nil, italics are universally disabled

        ;; doom-one specific settings
        doom-one-brighter-modeline t
        doom-one-brighter-comments t)
  ;; brighter minibuffer when active
  (add-hook 'minibuffer-setup-hook 'doom-brighten-minibuffer))

(custom-theme-set-faces
 'doom-one
 '(font-lock-builtin-face ((t (:foreground "c678dd" :bold bold))))
 '(font-lock-comment-face ((t (:foreground "#5699AF" :italic italic))))
 '(font-lock-constant-face      ((t (:foreground "#a9a1e1" :bold bold :italic italic))))
 '(font-lock-function-name-face ((t (:foreground "#c678dd" :bold bold))))
 '(font-lock-keyword-face       ((t (:foreground "#51afef" :italic italic)))))

Gruvbox theme GitHub

(use-package gruvbox-theme
  :straight t
  :config
  (load-theme 'gruvbox-dark-hard t))

Mode-line

Smart-mode-line GitHub

(use-package smart-mode-line
  :straight t
  :init
  (setq sml/theme 'respectful
        sml/mode-width 'full
        sml/name-width 10)
  (sml/setup))

Zerodark modeline theme GitHub

(use-package zerodark-theme
  :straight t
  :init
  (zerodark-setup-modeline-format))

Powerline modeline with wave format (currently unused)

(use-package powerline
  :load-path "custom/powerline"
  :config
  (setq powerline-default-separator 'wave
        powerline-display-buffer-size nil)
  (powerline-default-theme))

Ligatures

(defun my-correct-symbol-bounds (pretty-alist)
    "Prepend a TAB character to each symbol in this alist,
this way compose-region called by prettify-symbols-mode
will use the correct width of the symbols
instead of the width measured by char-width."
    (mapcar (lambda (el)
              (setcdr el (string ?\t (cdr el)))
              el)
            pretty-alist))

  (defun my-ligature-list (ligatures codepoint-start)
    "Create an alist of strings to replace with
codepoints starting from codepoint-start."
    (let ((codepoints (-iterate '1+ codepoint-start (length ligatures))))
      (-zip-pair ligatures codepoints)))

;; list can be found at https://github.com/i-tu/Hasklig
(setq my-hasklig-ligatures
      (let* ((ligs '("&&" "***" "*>" "\\\\" "||" "|>" "::"
                     "==" "===" "==>" "=>" "=<<" "!!" ">>"
                     ">>=" ">>>" ">>-" ">-" "->" "-<" "-<<"
                     "<*" "<*>" "<|" "<|>" "<$>" "<>" "<-"
                     "<<" "<<<" "<+>" ".." "..." "++" "+++"
                     "/=" ":::" ">=>" "->>" "<=>" "<=<" "<->")))
          (my-correct-symbol-bounds (my-ligature-list ligs #Xe100))))

 ;; nice glyphs for programs with hasklig
  (defun my-set-ligatures ()
    "Add hasklig ligatures for use with prettify-symbols-mode."
    (setq prettify-symbols-alist
          (append my-hasklig-ligatures prettify-symbols-alist))
    (prettify-symbols-mode))

(defun my-add-to-multiple-hooks (function hooks)
  (mapc (lambda (hook)
          (add-hook hook function))
        hooks))

(my-add-to-multiple-hooks
 'my-set-ligatures
 '(
   ;; purescript-mode-hook
   haskell-mode-hook
   ))

Rainbow delimiters GitHub

(use-package rainbow-delimiters
  :straight t
  :defer t
  :init
  (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))