Created
March 1, 2022 12:58
-
-
Save anthonyclarka2/d5e8005b8c5a10ce9ca8b0965f33554e to your computer and use it in GitHub Desktop.
Vanilla Emacs init.el with links to some sources of customization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; init.el --- Emacs Configuration -*- mode: emacs-lisp; -*- | |
;;; Commentary: | |
;; | |
;; Anthony Jarvis-Clark | |
;; REDACTED@REDACTED.com | |
;; | |
;; Save customizations in a different file. Prevents this file being | |
;; modified by Emacs. | |
;;; Code: | |
(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) | |
(when (file-exists-p custom-file) | |
(load custom-file)) | |
;; Before anything else, orgmode: | |
(add-to-list 'load-path "~/.orgsrc/org-mode/lisp") | |
(require 'org-loaddefs) | |
;; First off, we need MELPA and the org-mode repo: | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) | |
;;(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) | |
(package-initialize) | |
;; Bootstrap `use-package` | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
(require 'use-package) | |
;; Taken from https://github.com/mina86/dot-files/blob/master/emacs/init.el#L29 | |
;;(unless package-archive-contents | |
;; (package-refresh-contents)) | |
;; This is similar to ‘package-install-selected-packages’ except it doesn’t ask | |
;; any questions. | |
;;(dolist (pkg package-selected-packages) | |
;; (unless (package-installed-p pkg) | |
;; (condition-case err | |
;; (package-install pkg t) | |
;; (error (message (error-message-string err)))))) | |
;;(exec-path-from-shell-initialize) | |
(add-to-list 'load-path "~/.emacs.d/lisp") | |
;; Taken from https://karl-voit.at/2017/02/11/my-system-is-foobar/ | |
;; Check if system is Darwin/macOS | |
(defun my-system-type-is-darwin () | |
"Return non-nil if system is darwin-based (Mac OS X)." | |
(string-equal system-type "darwin") | |
) | |
;; Check if system is Microsoft Windows | |
(defun my-system-type-is-windows () | |
"Return non-nil if system is Windows-based (at least up to Win7)." | |
(string-equal system-type "windows-nt") | |
) | |
;; Check if system is GNU/Linux | |
(defun my-system-type-is-gnu () | |
"Return non-nil if system is GNU/Linux-based." | |
(string-equal system-type "gnu/linux") | |
) | |
;; make Linux a bit more mac-like | |
(when (my-system-type-is-gnu) | |
(global-set-key (kbd "s-/") 'comment-or-uncomment-region-or-line) | |
(global-set-key (kbd "s-<backspace>") '(lambda () (interactive) (kill-line 0))) | |
(global-set-key [(super s)] 'save-buffer) | |
) | |
(when (my-system-type-is-darwin) | |
;; EXAMPLE: (global-set-key (kbd "C-z") 'shell) | |
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html#Init-Rebinding | |
(global-set-key (kbd "s-/") 'comment-or-uncomment-region-or-line) | |
(global-set-key (kbd "s-<backspace>") '(lambda () (interactive) (kill-line 0))) | |
(progn (use-package exec-path-from-shell | |
:if (eq system-type 'darwin) | |
:demand t | |
:config | |
(exec-path-from-shell-initialize))) | |
) | |
(when (my-system-type-is-windows) | |
(add-to-list 'exec-path "c:/sqlite/") | |
(add-to-list 'exec-path "c:/Python/Python39") | |
(add-to-list 'exec-path "c:/Windows/System32") | |
(add-to-list 'exec-path "c:/MinGW/bin") | |
(add-to-list 'exec-path "C:/MinGW/mingw32/bin") | |
(add-to-list 'exec-path "C:/MinGW/msys/1.0/bin") | |
(add-to-list 'exec-path "C:/tools/Git/usr/bin") | |
(setenv "PATH" (mapconcat #'identity exec-path path-separator)) | |
) | |
;; Optional additional aesthetic changes | |
;; Adapted from `sanity.el' in Elegant Emacs by Nicolas P. Rougier (rougier) | |
;; https://github.com/rougier/elegant-emacs | |
(setq inhibit-startup-screen t) | |
(setq inhibit-startup-echo-area-message t) | |
(setq inhibit-startup-message t) | |
(setq initial-scratch-message nil) | |
;; (setq initial-major-mode 'lisp-interaction-mode) | |
(setq-default indent-tabs-mode nil) | |
(setq pop-up-windows nil) | |
(tool-bar-mode 0) | |
(tooltip-mode 0) | |
(scroll-bar-mode 0) | |
(setq scroll-conservatively most-positive-fixnum) | |
(menu-bar-mode 1) ;menu bar is explicitly turned on for beginners. Change the value to 0. | |
(show-paren-mode 1) | |
;; Optional aditional aesthetic changes | |
;; Adapted from `elegance.el' in Elegant Emacs by Nicolas P. Rougier (rougier) | |
;; https://github.com/rougier/elegant-emacs | |
;; Line cursor and no blink | |
;;(set-default 'cursor-type '(box . 1)) | |
(blink-cursor-mode 0) | |
;; Line spacing, can be 0 for code and 1 or 2 for text | |
(setq-default line-spacing 0) | |
;; Underline line at descent position, not baseline position | |
(setq x-underline-at-descent-line t) | |
;; Easier on the eyes | |
(add-hook 'text-mode-hook 'olivetti-mode) | |
(setq olivetti-body-width 0.75) | |
(global-display-line-numbers-mode) | |
(global-auto-revert-mode) | |
;; What to do with files and their backups | |
(setq create-lockfiles nil) | |
(setq backup-directory-alist `(("." . "~/.emacsbackups"))) | |
(setq auto-save-file-name-transforms '((".*" "~/.emacsbackups/" t))) | |
(setq make-backup-files t ; backup of a file the first time it is saved. | |
backup-by-copying t ; don't clobber symlinks | |
version-control t ; version numbers for backup files | |
delete-old-versions t ; delete excess backup files silently | |
delete-by-moving-to-trash t kept-old-versions | |
6 ; oldest versions to keep when a new numbered backup is made (default: 2) | |
kept-new-versions 9 ; newest versions to keep when a new numbered backup is made (default: 2) | |
auto-save-default t ; auto-save every buffer that visits a file | |
auto-save-timeout 20 ; number of seconds idle time before auto-save (default: 30) | |
auto-save-interval 200 ; number of keystrokes between auto-saves (default: 300) | |
) | |
;; Me | |
(setq user-full-name "Anthony Jarvis-Clark") | |
(setq user-mail-address "REDACTED") | |
;; Tab widths | |
(setq tab-width 2) | |
(setq indent-tabs-mode nil) | |
(setq standard-indent 2) | |
(setq sh-basic-offset 2) | |
(setq sh-indentation 2) | |
;; Window sizes | |
(global-set-key (kbd "C-=") | |
'text-scale-increase) | |
(global-set-key (kbd "C--") | |
'text-scale-decrease) | |
(global-set-key (kbd "<C-wheel-down>") | |
'text-scale-decrease) | |
(global-set-key (kbd "<C-wheel-up>") | |
'text-scale-increase) | |
(defconst frame-default-top 0 "The 'top' position property of a frame.") | |
(defconst frame-default-left 0 "The 'left' position property of a frame.") | |
(defconst frame-default-height 40 "The default frame height.") | |
(defconst frame-default-width 240 "The default frame width.") | |
(add-to-list 'default-frame-alist | |
(cons 'left frame-default-left)) | |
(add-to-list 'default-frame-alist | |
(cons 'top frame-default-top)) | |
(add-to-list 'default-frame-alist | |
(cons 'height frame-default-height)) | |
(add-to-list 'default-frame-alist | |
(cons 'width frame-default-width)) | |
;;(add-hook 'after-init-hook 'global-company-mode) | |
(cua-mode t) | |
(global-hl-line-mode t) | |
;; | |
;; Treemacs | |
;; | |
(use-package treemacs | |
:config | |
(progn | |
(when (my-system-type-is-darwin) | |
(setq treemacs-python-executable "/usr/bin/python3") | |
) | |
(when (my-system-type-is-windows) | |
(setq treemacs-python-executable "c:/Python/Python39/python.exe") | |
)) | |
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0) | |
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory) | |
treemacs-width 35 | |
treemacs-wrap-around t | |
treemacs-no-png-images t | |
treemacs-indentation 1 | |
treemacs-workspace-switch-cleanup nil | |
treemacs-eldoc-display t | |
treemacs-icon-open-png (propertize "⊖ " 'face 'treemacs-directory-face) | |
treemacs-icon-closed-png (propertize "⊕ " 'face 'treemacs-directory-face)) | |
;; The default width and height of the icons is 22 pixels. If you are | |
;; using a Hi-DPI display, uncomment this to double the icon size. | |
;;(treemacs-resize-icons 44) | |
(setq treemacs-follow-mode t) | |
(setq treemacs-filewatch-mode t) | |
(setq treemacs-fringe-indicator-mode t) | |
(define-key treemacs-mode-map [mouse-1] | |
#'treemacs-single-click-expand-action) | |
(pcase (cons (not (null (executable-find "git"))) | |
(not (null treemacs-python-executable))) | |
(`(t . t) | |
(treemacs-git-mode 'deferred)) | |
(`(t . _) | |
(treemacs-git-mode 'simple))) | |
:bind (:map global-map | |
("M-0" . treemacs-select-window) | |
("C-x t 1" . treemacs-delete-other-windows) | |
("C-x t t" . treemacs) | |
("C-x t B" . treemacs-bookmark) | |
("C-x t C-t" . treemacs-find-file) | |
("C-x t M-t" . treemacs-find-tag))) | |
;; Last part of Treemacs setup, set to always show: | |
(add-hook 'emacs-startup-hook 'treemacs) | |
(with-eval-after-load 'treemacs | |
(defun aclark/treemacs-ignore (filename absolute-path) | |
(or (string-match-p (regexp-quote "Org/Journal") | |
absolute-path) | |
(string-match-p (regexp-quote "/Library/") | |
absolute-path) | |
(string-match-p (regexp-quote "/Applications/") | |
absolute-path) | |
(string-match-p (regexp-quote "/Pictures/") | |
absolute-path) | |
(string-match-p (regexp-quote "/Music/") | |
absolute-path) | |
(string-match-p (regexp-quote "/Movies/") | |
absolute-path))) | |
(add-to-list 'treemacs-ignored-file-predicates | |
#'aclark/treemacs-ignore)) | |
(use-package treemacs-magit | |
:after treemacs magit | |
:ensure t) | |
(use-package treemacs-projectile | |
:after treemacs magit | |
:ensure t) | |
;; Save recently used files: | |
(recentf-mode 1) | |
(setq recentf-max-menu-items 25) | |
(setq recentf-max-saved-items 25) | |
(global-set-key "\C-x\ \C-r" 'recentf-open-files) | |
(setq recentf-exclude '("COMMIT_EDITMSG\\'" | |
".*-autoloads\\.el\\'" | |
"[/\\]\\.elpa/" | |
)) | |
;; deft full-text search | |
(use-package deft | |
:after org | |
:bind | |
("C-c n d" . deft) | |
:custom | |
(deft-recursive t) | |
(deft-use-filter-string-for-filename t) | |
(deft-default-extension "org") | |
(deft-directory org-roam-directory)) | |
(use-package org-journal | |
:bind | |
("C-c n j" . org-journal-new-entry) | |
("C-c j" . org-journal-open-current-journal-file) | |
:custom | |
(org-journal-date-prefix "#+TITLE: ") | |
(org-journal-file-format "%Y-%m-%d.org") | |
(org-journal-dir "~/Org/Journal/") | |
(org-journal-date-format "%A, %d %B %Y\n\n") | |
;; https://github.com/bastibe/org-journal | |
(org-journal-carryover-items "TODO=\"TODO\"|TODO=\"NEXT\"|TODO=\"PROG\"") | |
(org-journal-find-file 'find-file)) | |
(setq org-roam-v2-ack t) | |
;; org-roam | |
(use-package org-roam | |
:ensure t | |
;; :hook (after-init . org-roam-mode) | |
:custom | |
(org-roam-directory "~/Org/") | |
(org-roam-capture-templates | |
'(("d" "default" plain "%?" | |
:target (file+head "${slug}.org" | |
"#+title: ${title} | |
#+author: %n | |
#+date: %t | |
Write a quick description here | |
* Links | |
* Notes | |
* Plans | |
* Decisions | |
") | |
:unnarrowed t)) | |
)) | |
(with-eval-after-load 'org-roam-mode | |
(org-roam-db-autosync-enable) | |
(add-to-list 'display-buffer-alist | |
'("\\*org-roam\\*" | |
(display-buffer-in-direction) | |
(direction . right) | |
(window-width . 0.25) | |
(window-height . fit-window-to-buffer))) | |
(global-set-key (kbd "C-c n f") 'org-roam-node-find) | |
(global-set-key (kbd "C-c n i") 'org-roam-node-insert) | |
(global-set-key (kbd "C-c n c") 'org-roam-capture) | |
(global-set-key (kbd "s-r") 'org-roam-buffer-toggle) | |
(global-set-key (kbd "s-i") 'org-roam-complete-link-at-point) | |
) | |
;; Ivy,Counsel, & Swiper | |
;; Enable Ivy mode in general | |
(use-package ivy | |
:ensure t) | |
(ivy-mode 1) | |
(setq ivy-use-virtual-buffers t) | |
(setq enable-recursive-minibuffers t) | |
(setq ivy-count-format "%d/%d ") | |
(setq ivy-use-selectable-prompt t) | |
;; Add Counsel and Swiper search functions | |
(global-set-key (kbd "C-c f r") | |
#'counsel-recentf) | |
(global-set-key (kbd "C-c C-s") | |
#'swiper) | |
;; Replace default "M-x" and "C-x C-f" with Counsel version | |
(global-set-key (kbd "M-x") | |
#'counsel-M-x) | |
(global-set-key (kbd "C-x C-f") | |
#'counsel-find-file) | |
(use-package doom-modeline | |
:hook (after-init . doom-modeline-mode) | |
:custom | |
(doom-modeline-height 25) | |
(doom-modeline-bar-width 1) | |
(doom-modeline-icon t) | |
(doom-modeline-major-mode-icon t) | |
(doom-modeline-major-mode-color-icon t) | |
(doom-modeline-buffer-file-name-style 'truncate-upto-project) | |
(doom-modeline-buffer-state-icon t) | |
(doom-modeline-buffer-modification-icon t) | |
(doom-modeline-minor-modes nil) | |
(doom-modeline-enable-word-count nil) | |
(doom-modeline-buffer-encoding t) | |
(doom-modeline-indent-info nil) | |
(doom-modeline-checker-simple-format t) | |
(doom-modeline-vcs-max-length 12) | |
(doom-modeline-env-version t) | |
(doom-modeline-irc-stylize 'identity) | |
(doom-modeline-github-timer nil) | |
(doom-modeline-gnus-timer nil)) | |
;; jq related items: | |
(autoload 'jq-mode "jq-mode.el" "Major mode for editing jq files" | |
t) | |
(add-to-list 'auto-mode-alist | |
'("\\.jq$" . jq-mode)) | |
(with-eval-after-load "json-mode" | |
(define-key json-mode-map (kbd "C-c C-j") #'jq-interactively)) | |
(defun newer-than-7-days(file) | |
"Return list of files newer than 7 days old in directory FILE." | |
(> 7 | |
(/(float-time(time-subtract | |
(current-time) | |
(nth 5 (file-attributes file)))) | |
86400))) | |
;; All org-mode stuff | |
(with-eval-after-load 'org | |
(setq org-directory "~/Org/") | |
;; Below taken from: https://out-of-cheese-error.netlify.com/spacemacs-config | |
;; Makes some things look nicer | |
(setq org-startup-indented t) | |
(setq org-pretty-entities t) | |
;; show actually italicized text instead of /italicized text/ | |
(setq org-hide-emphasis-markers t) | |
(setq org-fontify-whole-heading-line t) | |
(setq org-fontify-done-headline t) | |
(setq org-fontify-quote-and-verse-blocks t) | |
(setq org-default-notes-file (concat org-directory "/notes.org")) | |
(setq org-archive-location (concat org-directory "/archive/archive.org::")) | |
(setq org-enforce-todo-dependencies t) | |
(setq org-enforce-todo-checkbox-dependencies t) | |
;; currently todo keywords are simple, but this link has some intriguing possibilities: | |
;; https://github.com/tarsius/hl-todo/blob/14adee3390a6bd8e4763a6ef8eab7ab54768611d/hl-todo.el#L106 | |
(setq org-todo-keywords | |
'((sequence "TODO(t/!)" "PROG(g/!)" "|" "DONE(d!)"))) | |
(setq org-todo-keyword-faces '(("TODO" . (:foreground "#E5C07B")) | |
("PROG" . (:foreground "#98C379")) | |
("DONE" . (:foreground "#ABB2BF" :slant italic | |
:weight light)))) | |
(setq org-log-into-drawer t) | |
(setq org-highest-priority ?A) | |
(setq org-lowest-priority ?D) | |
(setq org-default-priority ?B) | |
(org-babel-do-load-languages 'org-babel-load-languages | |
'((emacs-lisp . t) | |
(shell . t) | |
(python . t) | |
(js . t) | |
(ruby . t) | |
(jq . t) | |
(sqlite . t) | |
(svgbob . t))) | |
(add-to-list 'org-babel-tangle-lang-exts '("js" . "js")) | |
(setq org-agenda-files | |
(seq-filter #'newer-than-7-days | |
(directory-files-recursively "~/Org/Journal" "\\.org$"))) | |
(setq org-agenda-span 'week) | |
(setq org-agenda-block-separator "") | |
(setq org-habit-show-habits t) | |
(setq org-habit-today-glyph ?‖) | |
(setq org-habit-completed-glyph ?✓) | |
(setq org-habit-preceding-days 5) | |
(setq org-habit-following-days 2) | |
(setq org-habit-show-habits-only-for-today | |
nil) | |
(setq org-habit-graph-column 60) | |
(setq org-use-sub-superscripts "{}") | |
(setq org-M-RET-may-split-line nil) | |
(setq org-tags-column 0) | |
(setq org-startup-folded t) | |
(setq org-support-shift-select t) | |
;; https://matthewbilyeu.com/blog/2019-09-28/auto-saving-org-archive-file | |
(setq aclark/notes-archive-file (concat org-directory "/archive/archive.org")) | |
;; The `save-some-buffers` function can run silently, and it also accepts a | |
;; function argument to predicate whether a buffer is saved or not. | |
;; This predicate simply says "save the buffer's file if it's the notes archive | |
;; file" | |
(defun aclark/save-notes-archive-file () | |
(interactive) | |
(save-some-buffers 'no-confirm (lambda () | |
(equal buffer-file-name | |
(expand-file-name aclark/notes-archive-file))))) | |
;; Finally, the newly-defined function can advise the archive function. So, | |
;; after a subtree in org is archived, the archive file will be automatically saved. | |
(advice-add 'org-archive-subtree :after #'aclark/save-notes-archive-file) | |
;; https://stackoverflow.com/questions/17478260/completely-hide-the-properties-drawer-in-org-mode | |
(defun org-cycle-hide-drawers (state) | |
"Re-hide all drawers after a visibility state change." | |
(when (and (derived-mode-p 'org-mode) | |
(not (memq state '(overview folded contents)))) | |
(save-excursion | |
(let* ((globalp (memq state '(contents all))) | |
(beg (if globalp | |
(point-min) | |
(point))) | |
(end (if globalp | |
(point-max) | |
(if (eq state 'children) | |
(save-excursion | |
(outline-next-heading) | |
(point)) | |
(org-end-of-subtree t))))) | |
(goto-char beg) | |
(while (re-search-forward org-drawer-regexp end t) | |
(save-excursion | |
(beginning-of-line 1) | |
(when (looking-at org-drawer-regexp) | |
(let* ((start (1- (match-beginning 0))) | |
(limit | |
(save-excursion | |
(outline-next-heading) | |
(point))) | |
(msg (format | |
(concat | |
"org-cycle-hide-drawers: " | |
"`:END:`" | |
" line missing at position %s") | |
(1+ start)))) | |
(if (re-search-forward "^[ \t]*:END:" limit t) | |
(outline-flag-region start (point-at-eol) t) | |
(user-error msg)))))))))) | |
) ;; end of with-eval-after-load 'org | |
(use-package org-bullets | |
:ensure t | |
:init (setq org-bullets-bullet-list '("§" "⦿" "⦾" "◉" "○" "•" "•" "•")):config | |
(add-hook 'org-mode-hook | |
(lambda () | |
(org-bullets-mode 1)))) | |
(use-package markdown-mode | |
:ensure t | |
:commands (markdown-mode gfm-mode):mode | |
(("\\.md\\'" . gfm-mode) | |
("\\.markdown\\'" . markdown-mode)) | |
:init (setq markdown-command "multimarkdown")) | |
(auto-package-update-maybe) | |
(org-edna-mode) | |
(setq confirm-kill-emacs #'y-or-n-p) | |
(use-package forge :after magit) | |
(global-set-key (kbd "C-x g") | |
'magit-status) | |
(use-package smartparens-config) | |
(add-hook 'text-mode-hook #'smartparens-mode) | |
(add-hook 'emacs-lisp-mode-hook #'smartparens-mode) | |
(use-package centaur-tabs | |
:demand | |
:config | |
(centaur-tabs-mode t) | |
(setq centaur-tabs-set-bar 'under | |
centaur-tabs-set-modified-marker t | |
centaur-tabs-set-icons t | |
centaur-tabs-gray-out-icons t | |
centaur-tabs-set-bar 'over | |
centaur-tabs-label-fixed-length 16 | |
) | |
(centaur-tabs-headline-match) | |
(defun centaur-tabs-buffer-groups () | |
"`centaur-tabs-buffer-groups' control buffers' group rules. | |
Group centaur-tabs with mode if buffer is derived from `eshell-mode' `emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'. | |
All buffer name start with * will group to \"Emacs\". | |
Other buffer group by `centaur-tabs-get-group-name' with project name." | |
(list | |
(cond | |
;; ((not (eq (file-remote-p (buffer-file-name)) nil)) | |
;; "Remote") | |
((or (string-equal "*" (substring (buffer-name) 0 1)) | |
(memq major-mode '(magit-process-mode | |
magit-status-mode | |
magit-diff-mode | |
magit-log-mode | |
magit-file-mode | |
magit-blob-mode | |
magit-blame-mode | |
))) | |
"Emacs") | |
((derived-mode-p 'prog-mode) | |
"Editing") | |
((derived-mode-p 'dired-mode) | |
"Dired") | |
((memq major-mode '(helpful-mode | |
help-mode)) | |
"Help") | |
((memq major-mode '(org-mode | |
org-agenda-clockreport-mode | |
org-src-mode | |
org-agenda-mode | |
org-beamer-mode | |
org-indent-mode | |
org-bullets-mode | |
org-cdlatex-mode | |
org-agenda-log-mode | |
org-journal-mode | |
diary-mode)) | |
"OrgMode") | |
(t | |
(centaur-tabs-get-group-name (current-buffer)))))) | |
:bind | |
("C-<prior>" . centaur-tabs-backward) | |
("C-<next>" . centaur-tabs-forward)) | |
(use-package ivy-rich) | |
(ivy-rich-mode 1) | |
(setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line) | |
(use-package which-key | |
:config | |
(which-key-mode)) | |
;; https://emacs-lsp.github.io/lsp-mode/page/installation/ | |
;;(use-package lsp-mode | |
;; :ensure t | |
;; :init | |
;; (setq lsp-keymap-prefix "s-l") | |
;; :commands lsp) | |
;;(use-package lsp-ui | |
;; :ensure t | |
;; :commands lsp-ui-mode) | |
;;(use-package lsp-ivy | |
;; :ensure t | |
;; :commands lsp-ivy-workspace-symbol) | |
;;(use-package lsp-treemacs | |
;; :ensure t | |
;; :commands lsp-treemacs-errors-list) | |
;; (lsp-treemacs-sync-mode 1) | |
;; https://github.com/emacs-lsp/lsp-mode/issues/2381 | |
;;(with-eval-after-load 'lsp-mode | |
;;(lsp-register-client | |
;; (make-lsp-client :new-connection (lsp-stdio-connection '("~/.asdf/shims/terraform-ls" "serve")) | |
;; :major-modes '(terraform-mode) | |
;; :server-id 'terraform-ls))) | |
;;(add-hook 'terraform-mode-hook #'lsp) | |
(use-package editorconfig | |
:ensure t | |
:config | |
(editorconfig-mode 1)) | |
;; from https://stackoverflow.com/a/9697222 | |
(defun comment-or-uncomment-region-or-line () | |
"Comments or uncomments the region or the current line if there's no active region." | |
(interactive) | |
(let (beg end) | |
(if (region-active-p) | |
(setq beg (region-beginning) end (region-end)) | |
(setq beg (line-beginning-position) end (line-end-position))) | |
(comment-or-uncomment-region beg end))) | |
(use-package yasnippet | |
:ensure t | |
:config | |
(use-package yasnippet-snippets :ensure t) | |
(setq | |
yas-verbosity 1 | |
yas-wrap-around-region t) | |
(with-eval-after-load 'yasnippet | |
(setq yas-snippet-dirs '("~/.emacs.d/snippets" | |
yasnippet-snippets-dir))) | |
(yas-reload-all t) | |
(yas-global-mode t) | |
) | |
;; GNUPG setup items | |
(setq epg-gpg-program "/usr/local/bin/gpg") | |
(setq epa-file-encrypt-to '("REDACTED")) | |
;; Multiple Cursors | |
;; https://github.com/magnars/multiple-cursors.el | |
(use-package multiple-cursors) | |
(global-set-key (kbd "C-d") 'mc/mark-next-like-this) | |
(global-set-key (kbd "C-D") 'mc/mark-previous-like-this) | |
(global-set-key (kbd "C-c C-d") 'mc/mark-all-like-this) | |
(use-package org-pomodoro | |
:ensure t | |
:commands (org-pomodoro) | |
:config | |
(setq alert-user-configuration (quote ((((:category . "org-pomodoro")) libnotify nil))))) | |
(global-set-key (kbd "s-p") 'org-pomodoro) | |
;; https://www.emacswiki.org/emacs/EmacsSvg | |
(auto-image-file-mode 1) | |
(use-package org-tree-slide | |
:ensure t) | |
(use-package ox-reveal | |
:ensure t) | |
(use-package htmlize | |
:ensure t) | |
(use-package doom-themes | |
:ensure t | |
:config | |
;; Global settings (defaults) | |
(setq doom-themes-enable-bold nil ; if nil, bold is universally disabled | |
doom-themes-enable-italic t) ; if nil, italics is universally disabled | |
(load-theme 'doom-one t) | |
;; Enable flashing mode-line on errors | |
(doom-themes-visual-bell-config) | |
;; Corrects (and improves) org-mode's native fontification. | |
(doom-themes-org-config)) | |
(use-package undo-tree | |
:ensure t | |
:config | |
;;turn on everywhere | |
(global-undo-tree-mode 1) | |
(global-set-key (kbd "C-_") 'undo) | |
(defalias 'redo 'undo-tree-redo) | |
(global-set-key (kbd "M-_") 'redo) | |
) | |
(use-package rainbow-delimiters | |
:ensure t | |
:config | |
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode) | |
) | |
;; Some useful settings taken from https://github.com/susam/emfy | |
(column-number-mode) | |
;; (setq-default show-trailing-whitespace t) | |
(setq sentence-end-double-space nil) | |
(setq show-paren-delay 0) | |
(use-package gnuplot | |
:ensure t) | |
(use-package gnuplot-mode | |
:ensure t) | |
;; end of file | |
;;; init.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment