Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Created June 27, 2022 13:55
Show Gist options
  • Save krisajenkins/6119bc4113aa9242ec60aaa2f9b89dac to your computer and use it in GitHub Desktop.
Save krisajenkins/6119bc4113aa9242ec60aaa2f9b89dac to your computer and use it in GitHub Desktop.
My .emacs file
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with <open> and enter text in its buffer.
(add-to-list 'exec-path (expand-file-name "~/.nix-profile/bin"))
(setenv "PATH" (mapconcat 'identity exec-path ":"))
(setenv "NIX_PATH" "nixpkgs=/Users/kjenkins/.nix-defexpr/channels/nixpkgs")
(require 'server)
(unless (server-running-p)
(server-start))
(require 'package)
(setq package-enable-at-startup nil)
;; (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(setq package-archives
'(("org" . "http://orgmode.org/elpa/")
("melpa" . "https://melpa.org/packages/")
;; ("gnu" . "https://elpa.gnu.org/packages/")
))
(package-initialize)
(setq use-package-always-ensure t)
(eval-when-compile
(require 'use-package))
(use-package molokai-theme)
(require 'bind-key)
(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.
'(ad-redefinition-action 'accept)
'(ansi-color-faces-vector
[default bold shadow italic underline bold bold-italic bold])
'(ansi-color-names-vector
(vector "#708183" "#c60007" "#728a05" "#a57705" "#2075c7" "#c61b6e" "#259185" "#042028"))
'(backup-directory-alist '(("." . "~/.emacs.d/backups")))
'(bookmark-default-file "~/.emacs.d/bookmarks")
'(bookmark-save-flag 1)
'(c-basic-offset 2)
'(compilation-scroll-output t)
'(custom-enabled-themes '(molokai))
'(dired-use-ls-dired nil)
'(evil-undo-system 'undo-tree)
'(fci-rule-color "#0a2832")
'(flycheck-javascript-flow-args nil)
'(global-auto-revert-mode t)
'(helm-completion-style 'emacs)
'(helm-ff-transformer-show-only-basename nil)
'(helm-quick-update t)
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(ispell-dictionary "english")
'(lsp-java-jdt-download-url
"https://download.eclipse.org/jdtls/milestones/1.4.0/jdt-language-server-1.4.0-202109161824.tar.gz")
'(magit-log-arguments '("--graph" "--color" "--decorate" "-n256"))
'(magit-revert-buffers 'usage t)
'(magit-status-margin '(t age-abbreviated magit-log-margin-width nil 18))
'(magit-submodule-arguments nil)
'(org-agenda-files '("~/Dropbox/TODO.org"))
'(package-selected-packages
'(basic-mode helm-lsp helm-company py-yapf lsp-python-ms emojify dap-mode groovy-mode idle-highlight-mode rainbow-delimiters async ox-reveal lsp-java go-mode edit-indirect rjsx-mode python-mode undo-tree helm-git-grep ace-jump-mode key-chord magit helm-descbinds rainbow-mode helm-ls-git direnv magit-popup typescript-mode evil-tabs jdee flycheck-gradle gradle-mode org-jira rustic nixpkgs-fmt which-key dhall-mode attrap htmlize bazel-mode cmake-mode terraform-mode nix-mode company-arduino arduino-mode string-inflection ledger-mode helm-idris idris-mode restclient json-mode js2-mode psc-ide psci purescript-mode swift-mode mmm-mode lsp-haskell company-lsp lsp-ui lsp-mode haskell-mode scss-mode flycheck-flow elixir-mode sass-mode mustache-mode clj-refactor adoc-mode dockerfile-mode yaml-mode markdown-mode shm hindent guide-key flycheck elscreen speed-type git-timemachine csv-mode cider elm-mode evil-surround company nrepl-eval-sexp-fu smartparens molokai-theme google-translate helm evil use-package))
'(safe-local-variable-values
'((eval setq-local compilation-directory
(message "%s/client"
(magit-toplevel)))
(eval setq-local compilation-directory
(magit-toplevel))
(js2-basic-offset . 2)))
'(tab-width 4)
'(use-package-always-ensure t t))
(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.
'(default ((t (:height 120))))
'(font-lock-comment-face ((t (:foreground "gray60" :slant italic))))
'(markup-meta-face ((t (:stipple nil :foreground "gray98" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :foundry "unknown" :family "Monospace"))))
'(markup-title-0-face ((t (:inherit markup-gen-face :height 1.4))))
'(markup-title-1-face ((t (:inherit markup-gen-face :height 1.3))))
'(markup-title-2-face ((t (:inherit markup-gen-face :height 1.2))))
'(markup-title-3-face ((t (:inherit markup-gen-face :weight bold :height 1.1))))
'(org-block ((t (:inherit shadow :foreground "cyan"))))
'(org-verbatim ((t (:inherit shadow :foreground "dark cyan")))))
(defmacro comment (&rest body)
"Comment out one or more s-expressions."
nil)
(use-package s)
(use-package dash)
(if (window-system)
(progn
(tool-bar-mode -1)
(toggle-frame-maximized)))
(add-hook 'eshell-mode-hook
'(lambda ()
(evil-local-mode 0)
(setq eshell-prompt-function
(lambda ()
(concat
"("
(eshell/basename (eshell/pwd))
")"
" $ ")))))
(defun my-magit-mode-hook ()
(magit-load-config-extensions)
(evil-local-mode 0))
(use-package magit
:commands (magit-toplevel magit-load-config-extensions)
:config
(setq magit-last-seen-setup-instructions "1.4.0"
vc-handled-backends (delq 'Git vc-handled-backends))
(add-hook 'magit-mode-hook 'my-magit-mode-hook))
(use-package magit-popup)
(use-package direnv
:demand t
:functions direnv-mode
:config (direnv-mode)
:hook (prog-mode . direnv-update-environment))
(use-package evil
:commands (evil-define-key evil-delay)
:config
(add-hook 'after-init-hook 'evil-mode)
(evil-define-key '(normal insert) global-map
(kbd "M-e") 'recompile)
(evil-define-key 'normal global-map
",k" 'helm-show-kill-ring
",x" 'helm-M-x
",a" 'mark-whole-buffer
",gs" 'magit-status
",gf" 'helm-ls-git-ls
"\M-h" 'helm-resume
",h" 'helm-resume
",gg" 'helm-git-grep
",u" 'undo-tree-visualize
",br" 'bookmark-set
",bl" 'list-bookmarks
",sf" '(lambda ()
(interactive)
(message (buffer-file-name)))
",w" 'ace-jump-char-mode
",j" 'ace-jump-line-mode)
(evil-ex-define-cmd "A[lternative]" 'ff-find-other-file)
(evil-ex-define-cmd "AS[plit]" '(lambda ()
(interactive)
(ff-find-other-file t)))
(evil-ex-define-cmd "list-packages" 'list-packages)
(evil-ex-define-cmd "pack[age-install]" 'package-install)
(evil-ex-define-cmd "sort" 'sort-lines)
(evil-ex-define-cmd "messages" '(lambda ()
(interactive)
(switch-to-buffer "*Messages*")))
(evil-ex-define-cmd "scratch" '(lambda ()
(interactive)
(switch-to-buffer "*scratch*")))
;; Elisp
(evil-define-key 'normal emacs-lisp-mode-map
"[" 'beginning-of-defun
"]" 'end-of-defun
"K" 'describe-thing-in-popup)
(evil-define-key '(normal insert) emacs-lisp-mode-map
(kbd "M-e") 'eval-defun)
(evil-define-key 'normal lisp-interaction-mode-map
(kbd "M-e") 'eval-defun
",et" 'eval-defun)
(evil-define-key '(normal insert) lisp-mode-map
(kbd "M-e") 'eval-defun)
(evil-define-key '(normal insert) html-mode-map
"M-Q" 'sgml-pretty-print
"\C-c\C-e" 'sgml-close-tag))
(use-package key-chord
:commands (key-chord-define)
:config
(add-hook 'after-init-hook '(lambda () (key-chord-mode t)))
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state))
(use-package ace-jump-mode)
(use-package hl-line
:config
(add-hook 'after-init-hook 'global-hl-line-mode))
(use-package helm-ls-git)
(use-package helm-git-grep
:commands (helm-git-grep))
(use-package helm-descbinds
:commands (helm-descbinds-mode))
(defun my-helm-mini ()
"Custom helm source browser."
(interactive)
(require 'helm-ls-git)
(require 'helm-for-files)
(require 'helm-find)
(helm :sources '(helm-source-recentf
helm-source-ls-git
;; helm-source-elscreen
helm-source-findutils
helm-source-buffers-list
helm-source-bookmarks
helm-source-buffer-not-found)
:buffer "*helm mini*"))
(defun helm-do-grep-recursively ()
"Calls `helm-do-grep' with a prefix arg."
(interactive)
(setq current-prefix-arg '(4))
(call-interactively 'helm-do-grep))
(defun rgrep-sensibly ()
"Calls a recursive grep function. If we're in a git project, will use git grep."
(interactive)
(require 'helm-git-grep)
(if (magit-toplevel)
(helm-git-grep)
(helm-do-grep-recursively)))
(use-package helm
:after (evil)
:ensure t
:commands (helm-file-name-sans-extension helm-source-recentf)
:config
(setq helm-idle-delay 0.05
helm-input-idle-delay 0.05
helm-ls-git-show-abs-or-relative 'absolute)
(helm-mode t)
(helm-descbinds-mode t)
(evil-define-key 'normal global-map
",f" 'my-helm-mini
"\M-x" 'helm-M-x
"\C-x\C-f" 'helm-find-files
"q:" 'helm-complex-command-history)
(evil-ex-define-cmd "vim[grep]" 'rgrep-sensibly))
(use-package ansi-color
:commands (ansi-color-apply-on-region))
(defun colorize-compilation-buffer ()
(read-only-mode)
(ansi-color-apply-on-region (point-min) (point-max))
(read-only-mode))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
(use-package recentf
:config
(setq recentf-max-saved-items 500)
(add-to-list 'recentf-exclude "\\.windows\\'")
(add-to-list 'recentf-exclude ".emacs.d/bookmarks")
(add-to-list 'recentf-exclude "COMMIT_EDITMSG")
(add-to-list 'recentf-exclude ".*-autoloads\\.el")
(add-to-list 'recentf-exclude "archive-contents")
(add-to-list 'recentf-exclude "/var/folders")
(add-to-list 'recentf-exclude "org-clock-save\\.el")
(add-hook 'after-init-hook 'recentf-mode))
(use-package google-translate
:ensure t)
(use-package evil-tabs
:config
(add-hook 'after-init-hook 'global-evil-tabs-mode))
(use-package rainbow-mode
:commands (rainbow-mode))
(use-package rainbow-delimiters
:commands (rainbow-delimiters-mode)
:config
(add-hook 'after-init-hook 'rainbow-delimiters-mode))
(use-package idle-highlight-mode
:commands (idle-highlight-mode)
:config
(add-hook 'after-init-hook 'idle-highlight-mode))
(add-hook 'prog-mode-hook
(lambda ()
(flyspell-prog-mode)
(idle-highlight-mode t)
(rainbow-delimiters-mode t)))
(defun my-kill-sexp ()
"Unlike kill-sexp, this considers the sexp under the point, not after it."
(interactive)
(require 'simple)
(cl-destructuring-bind (start end type) (evil-a-paren)
(kill-region start end)))
(use-package smartparens
:commands
(sp-pair sp-local-pair smartparens-strict-mode))
(defun standard-smartparens-bindings ()
(interactive)
(smartparens-strict-mode 1)
(evil-define-key 'normal smartparens-mode-map
"sh" 'sp-forward-barf-sexp
"sk" 'sp-splice-sexp
"sK" 'sp-splice-sexp-killing-backward
"sl" 'sp-forward-slurp-sexp
"sj" 'sp-next-sexp
"s<" 'sp-emit-sexp
"sk" 'sp-previous-sexp
"sJ" 'sp-join-sexp
"sS" 'sp-split-sexp
"sc" 'sp-convolute-sexp
"st" 'sp-transpose-sexp
"s2t" 'sp-transpose-hybrid-sexp
"s;" 'comment-sexp
"sd" 'duplicate-sexp
"sD" 'my-kill-sexp
"sy" 'yank-sexp
(kbd "M-q") 'sp-indent-defun)
(evil-define-key 'normal smartparens-mode-map
"(" 'sp-backward-up-sexp
")" 'sp-up-sexp
(kbd "M-q") 'sp-indent-defun)
(sp-pair "\"" "\"" :bind "M-\"")
(sp-pair "(" ")" :bind "M-(")
(sp-pair "{" "}" :bind "M-{")
(sp-pair "[" "]" :bind "M-["))
(use-package nrepl-eval-sexp-fu
:config
(setq nrepl-eval-sexp-fu-flash-duration 0.25))
(defun standard-lisp-modes ()
(standard-smartparens-bindings)
(sp-local-pair major-mode "'" nil :actions nil)
(sp-local-pair major-mode "`" nil :actions nil)
(local-set-key (kbd "RET") 'newline-and-indent)
(local-set-key (kbd "M-Q") 'reindent-whole-buffer))
(add-hook 'emacs-lisp-mode-hook 'standard-smartparens-bindings)
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(standard-lisp-modes)
(eldoc-mode t)
(add-syntax-entries emacs-lisp-mode-syntax-table "w" ?- ?_ ?/ ?< ?> ?: ?.)
(font-lock-add-keywords 'emacs-lisp-mode
'(("(\\(lambda\\)\\>" (0 (prog1 ()
(compose-region (match-beginning 1)
(match-end 1)
?λ))))))))
(add-hook 'clojure-mode-hook 'standard-smartparens-bindings)
(add-hook 'clojure-mode-hook '(lambda ()
(sp-local-pair 'clojure-mode "(coment " ")")))
(use-package company
:config
(setq company-dabbrev-downcase nil
company-dabbrev-ignore-case t
evil-complete-next-func '(lambda (arg) (company-select-next))
evil-complete-previous-func '(lambda (arg) (company-select-previous)))
(add-hook 'after-init-hook 'global-company-mode))
(use-package evil-surround
:after (evil)
:functions global-evil-surround-mode
:config
(global-evil-surround-mode t))
(use-package ox-reveal
;; :load-path "kaj/org-reveal"
)
(use-package org
:pin org
:after (evil)
:commands (org-clock-persistence-insinuate org-babel-do-load-languages)
:config
(evil-define-key 'normal global-map
"\C-cl" 'org-store-link
"\C-ca" 'org-agenda)
(require 'ob-core)
(setq org-babel-load-languages '((clojure . t)
(emacs-lisp . t)
(js . t)
(dot . t)
(ledger . t)
(haskell . t)
(python . t)
(shell . t)
(sql . t))
org-confirm-babel-evaluate nil)
(auto-fill-mode t)
(org-clock-persistence-insinuate)
(setq org-agenda-files (quote ("~/Dropbox/TODO.org"
))
org-src-preserve-indentation t
org-default-notes-file "~/Dropbox/Capture.org"
org-refile-targets '((nil :maxlevel . 5)
(org-agenda-files :maxlevel . 5))
org-duration-format "%d"
org-duration-units t
org-clock-persist 'history
org-hide-emphasis-markers nil
org-log-done t
org-todo-keywords '((sequence "TODO" "WAITING" "|" "DONE"))
org-src-fontify-natively t
org-reveal-root "reveal.js"
org-global-properties '(("Effort_ALL" . "0.125d 0.25d 0.5d 1d 1.5d 2d 3d 4d 5d 8d 10d")
("STYLE_ALL" . "habit"))
org-latex-packages-alist '(("a4paper, margin=2cm" "geometry")
("utf8" "inputenc")
("" "times")))
(setq org-capture-templates '(("t" "Todo" entry (file+headline "~/Dropbox/TODO.org" "Tasks") "* TODO %?\n%i")
("j" "Journal" entry (file+datetree "~/Dropbox/Diary.org") "* %U\n%?")))
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
(evil-define-key 'normal org-mode-map
"M" 'helm-org-headlines)
(evil-define-key 'normal global-map
",oc" 'org-capture
",ot" 'org-todo-list)
(add-hook 'org-mode-hook
(lambda ()
(interactive)
(require 'ox-reveal)
(require 'org-id)
(flyspell-mode t)
(auto-fill-mode t)
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("n" . "notes")))))
(use-package cl-lib)
(defun sort-paragraph ()
(interactive)
(save-excursion
(cl-destructuring-bind (start . end) (bounds-of-thing-at-point 'paragraph)
(sort-lines nil start end))))
(defun my-elm-mode-hook ()
(require 'elm-mode)
(require 'flycheck)
(evil-define-key '(normal insert) elm-mode-map
(kbd "M-Q") 'elm-mode-format-buffer)
;; (elm-oracle-setup-completion)
(flycheck-mode -1)
(rainbow-mode t)
(set (make-local-variable 'company-backends)
'((company-elm
company-dabbrev
company-etags
company-yasnippet)))
(setq elm-sort-imports-on-save t
elm-format-on-save t
elm-tags-on-save nil
elm-indent-mode nil
elm-compile-arguments '()))
(use-package elm-mode
:config
(add-hook 'elm-mode-hook 'my-elm-mode-hook))
(use-package csv-mode)
(use-package git-timemachine)
(use-package speed-type)
(use-package elscreen)
(use-package flycheck
:commands (flycheck-add-next-checker)
:after (evil)
:config
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(add-hook 'flycheck-mode-hook 'visual-line-mode)
(evil-define-key 'normal flycheck-mode-map
(kbd "M-r") 'flycheck-buffer
(kbd "M-g n") 'flycheck-next-error
(kbd "M-g p") 'flycheck-previous-error
(kbd ",ge") 'flycheck-list-errors))
(use-package guide-key)
(use-package hindent
:functions hindent-reformat-region
:commands (hindent-reformat-buffer))
(use-package shm)
;;; General Setup.
(global-set-key (kbd "M-3")
(lambda ()
(interactive)
(insert "#")))
(defun byte-compile-this-buffer
()
(interactive)
(save-some-buffers)
(byte-compile-file (buffer-file-name)))
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
(defun font-lock-restart ()
(interactive)
(setq font-lock-mode-major-mode nil)
(font-lock-flush))
(defun pprint (form &optional output-stream)
(princ (with-temp-buffer
(cl-prettyprint form)
(buffer-string))
output-stream)
nil)
(defun n-stars (n)
(if (<= n 0)
""
(format "⭐%s" (n-stars (1- n)))))
(defun add-syntax-entries
(table type &rest chars)
"Add to the syntax TABLE entries of TYPE for the given CHARS. A
convenient way to call modify-syntax-entry many times for the same
type."
(assert (syntax-table-p table) t "TABLE must be a syntax-table: %s")
(dolist (char chars nil)
(modify-syntax-entry char type table)))
(defun reindent-whole-buffer ()
"Reindent the whole buffer."
(interactive)
(indent-region (point-min) (point-max)))
(defun capitalize-first-letter (str)
"Upper-case the first letter of the given string.
Can be useful for camel-case languages."
(if (zerop (length str))
str
(concat (upcase (substring str 0 1))
(substring str 1))))
(use-package less-css-mode
:config
(rainbow-mode t))
(use-package markdown-mode
:mode "\\.md$"
:config
(setq markdown-command "pandoc -f gfm -t html5"))
(defun string-in? (s list)
(interactive)
(seq-contains-p list s 'string=))
(eval-when-compile
(ert-deftest string-in?-test ()
(should (string-in? "b" '("a" "b" "c")))
(should (not (string-in? "z" '("a" "b" "c"))))))
(add-hook 'before-save-hook
'(lambda ()
(unless (string-in? major-mode
'("gfm-mode" "markdown-mode"))
(delete-trailing-whitespace))))
(use-package yaml-mode)
(use-package dockerfile-mode)
(use-package adoc-mode
:mode "\\.adoc$")
(use-package clj-refactor)
;; (use-package glsl-mode)
(use-package mustache-mode)
(use-package sass-mode)
(use-package elixir-mode)
(use-package flycheck-flow)
(use-package css-mode
:config
(setq css-indent-offset 2))
(use-package scss-mode)
(use-package haskell-mode
:config
(add-hook 'haskell-mode-hook 'flycheck-mode)
;; (add-hook 'haskell-mode-hook 'direnv-mode)
(evil-define-key 'normal haskell-mode-map
(kbd "M-Q") '(lambda () (interactive) (haskell-format-buffer))
;; (add-hook 'before-save-hook 'haskell-format-buffer)
))
(defun haskell-format-buffer ()
(interactive)
(require 'hindent)
(when (eq major-mode 'haskell-mode)
;; Note - these formatting commands don't play nicely with
;; `save-excursion`, hence the hand-rolled equivalent. :-(
(let ((save-point (point)))
(if (use-region-p)
(hindent-reformat-region (region-beginning) (region-end))
(hindent-reformat-buffer)
)
;; (haskell-mode-stylish-buffer)
(goto-char save-point))))
(comment (use-package intero
:after (evil)
:config
(evil-define-key 'normal intero-mode-map
(kbd "M-e") 'intero-reload
(kbd "M-Q") '(lambda () (interactive) (haskell-format-buffer))
(kbd "C-c C-l") '(lambda () (interactive) (intero-repl-add))
(kbd "[d") 'intero-goto-definition)
(comment (flycheck-add-next-checker 'intero
'(warning . haskell-hlint))
(add-hook 'haskell-mode-hook 'intero-mode)))
(defun intero-send (command)
(interactive)
(with-current-buffer (intero-repl-buffer nil)
(comint-simple-send (get-buffer-process (current-buffer))
command)))
(defun intero-pop-repl ()
(interactive)
(pop-to-buffer (intero-repl-buffer nil)))
(defun intero-repl-add (&optional prompt-options)
"Add the current file to the REPL's target set.
If PROMPT-OPTIONS is non-nil, prompt with an options list."
(interactive "P")
(save-buffer)
(let ((file (intero-localize-path (intero-buffer-file-name))))
(intero-with-repl-buffer prompt-options
(comint-simple-send
(get-buffer-process (current-buffer))
(concat ":add " file))
(setq intero-repl-last-loaded 'file))))
(defun intero-reload ()
(interactive)
(save-some-buffers)
(with-current-buffer (intero-repl-buffer nil)
(intero-repl-clear-buffer)
(intero-send ":reload"))
(intero-repl-switch-back)))
(comment
(defun dante-bazel-nix (d)
(and (or (directory-files d t "BUILD")
(directory-files d t "BUILD.bazel"))
(directory-files d t "default.nix"))))
(comment (use-package dante
:after (haskell-mode direnv)
:commands 'dante-mode
:init
(setq dante-repl-command-line '("cabal" "new-repl"))
(add-hook 'dante-mode-hook
'(lambda () (flycheck-add-next-checker 'haskell-dante
'(warning . haskell-hlint))))
(add-hook 'haskell-mode-hook 'flycheck-mode)
(add-hook 'haskell-mode-hook 'dante-mode)))
(use-package lsp-mode
:config
(evil-define-key '(normal insert) lsp-mode-map
(kbd "M-Q") 'lsp-format-buffer)
(evil-define-key '(normal) lsp-mode-map
(kbd "[d") 'lsp-goto-type-definition)
(setq gc-cons-threshold (* 1024 1024 100))
(setq read-process-output-max (* 1024 1024))
(add-hook 'js2-mode-hook #'lsp)
(add-hook 'typescript-mode-hook #'lsp))
(use-package lsp-ui
:after lsp-mode
(add-hook 'lsp-mode-hook 'lsp-ui-mode))
(comment (use-package company-lsp
:after lsp-mode
:commands company-lsp))
(use-package helm-lsp
:config
(evil-define-key '(normal insert) lsp-mode-map
(kbd "C-c C-k") 'helm-lsp-code-actions))
(use-package lsp-haskell
:after (haskell-mode)
:config
(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)
(setq lsp-haskell-server-path "haskell-language-server"))
(use-package yasnippet
:config
(add-to-list 'load-path
"~/.emacs.d/snippets")
(add-hook 'after-init-hook 'yas-global-mode)
(setq yas-snippet-dirs
'("~/.emacs.d/snippets")))
(use-package mmm-mode
:functions mmm-add-classes mmm-add-mode-ext-class
:config
(setq mmm-global-mode 'maybe)
(mmm-add-classes
'((markdown-elm
:submode elm-mode
:front "^``` ?elm[\n\r]+"
:back "^```$")))
(mmm-add-mode-ext-class 'markdown-mode nil 'markdown-elm))
(use-package swift-mode)
(defun purty-format-region ()
(interactive)
(let ((save-point (point)))
(call-process-region
(point-min)
(point-max)
"purty"
t
t
t
"-")
(goto-char save-point)))
(use-package purescript-mode
:after (evil)
:config
(setq-local fill-prefix "-- | ")
(add-hook 'purescript-mode-hook
'(lambda ()
(psc-ide-mode)
;;(inferior-psci-mode)
(turn-on-purescript-indentation)
(flycheck-mode t)
(evil-define-key '(normal insert) purescript-mode-map
(kbd "C-c C-k") 'psc-ide-flycheck-insert-suggestion
(kbd "M-Q") #'purty-format-region)
(evil-define-key '(normal) purescript-mode-map
(kbd "[d") 'psc-ide-goto-definition)
(font-lock-add-keywords 'purescript-mode
'(("\\<\\(forall\\)\\>" (0 (prog1 ()
(compose-region (match-beginning 1)
(match-end 1)
?∀)))))))))
(use-package psci
:after (purescript-mode))
(use-package psc-ide
:after (evil purescript-mode)
:config
(setq psc-ide-use-npm-bin t)
(evil-define-key '(normal) psc-ide-mode-map
(kbd "[d") 'psc-ide-goto-definition))
(use-package js2-mode
:mode "\\.js$"
:config
(add-hook 'js2-mode-hook #'lsp)
(add-syntax-entries js2-mode-syntax-table "w" ?_)
(setq js2-basic-offset 2))
(use-package json-mode
:mode ("\\.json$" "\\.avro$")
:config
(local-set-key (kbd "M-Q") 'json-pretty-print-buffer))
(use-package restclient)
(use-package idris-mode)
(use-package helm-idris)
(use-package ledger-mode)
(use-package string-inflection)
(put 'narrow-to-region 'disabled nil)
(use-package arduino-mode)
(use-package company-arduino)
(use-package nix-mode
:mode "\\.nix$")
(use-package terraform-mode)
(use-package cmake-mode)
(use-package htmlize)
(use-package attrap)
(use-package dhall-mode
:config
(local-set-key (kbd "M-Q") 'dhall-format-buffer))
(use-package which-key)
(use-package adoc-mode)
(use-package nixpkgs-fmt
:config
(evil-define-key 'normal nix-mode-map
(kbd "M-Q") 'nixpkgs-fmt-buffer))
(use-package rustic
:after (subr direnv)
:config
(add-syntax-entries rust-mode-syntax-table "w" ?_)
;; (setq rustic-analyzer-command '("cargo" "check" "--target-dir" "kaj"))
(evil-define-key 'normal rustic-mode-map
(kdb "C-c C-l") 'lsp-execute-code-action
(kbd "M-Q") 'rustic-cargo-fmt))
(use-package org-jira
:init
(setq jiralib-url "https://jira.iohk.io"))
(use-package groovy-mode)
(use-package gradle-mode)
(use-package flycheck-gradle)
;; (use-package jdee)
(use-package dap-mode)
(use-package lsp-java
:config
;; (setq lsp-java-import-gradle-enabled t)
;; (setq lsp-java-trace-server t)
;; (setq lsp-log-io t)
(add-syntax-entries java-mode-syntax-table "w" ?_)
(add-to-list 'lsp-file-watch-ignored-directories "/kafka-data/")
(add-to-list 'lsp-file-watch-ignored-directories "/bin/")
(add-to-list 'lsp-file-watch-ignored-directories "/build/")
(add-to-list 'lsp-file-watch-ignored-directories "/.gradle/")
(add-hook 'java-mode-hook 'lsp))
(use-package undo-tree
:config
(global-undo-tree-mode))
(use-package typescript-mode
:config
(add-syntax-entries typescript-mode-syntax-table "w" ?_)
(add-hook 'before-save-hook '(lambda ()
(lsp-format-buffer)))
(evil-define-key '(normal insert) typescript-mode-map
(kbd "M-Q") 'lsp-format-buffer))
(use-package python-mode
:config
(add-syntax-entries python-mode-syntax-table "w" ?_))
(use-package py-yapf
:hook (python-mode . (lambda ()
(require 'py-yapf)
(py-yapf-enable-on-save))))
(use-package lsp-python-ms
:hook (python-mode . (lambda ()
(require 'lsp-python-ms)
(lsp)))
)
(use-package rjsx-mode
:mode ("\\.jsx$" "\\.tsx$")
:config
(evil-define-key '(normal insert) rxjs-mode-map
(kbd "M-Q") 'lsp-format-buffer))
(use-package edit-indirect)
(add-syntax-entries c-mode-syntax-table "w" ?_)
(use-package go-mode)
(use-package emojify
:config (global-emojify-mode))
(defun represent (theme font-height)
(interactive "\v\n")
(unless (custom-theme-name-valid-p theme)
(error "Invalid theme name `%s'" theme))
(load-theme theme)
(toggle-frame-maximized)
(custom-set-faces
`(default ((t (:height ,font-height))))))
(defun present ()
(interactive)
(represent 'whiteboard 210))
(defun unpresent ()
(interactive)
(represent 'molokai 120))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment