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.
532 lines
16 KiB
532 lines
16 KiB
(require 'package)
|
|
;; fixing broken emacsclient config: emacsclient --eval "(load "~/.emacs")"
|
|
|
|
(add-to-list 'package-archives '("elpa" . "https://tromey.com/elpa/") t)
|
|
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
|
(add-to-list 'package-archives
|
|
'("xaldew" . "https://gustafwaldemarson.com/elpa/"))
|
|
(add-to-list 'package-unsigned-archives "xaldew")
|
|
(package-initialize)
|
|
|
|
;; emacs preferences
|
|
(setq-default cursor-type 'bar)
|
|
(global-hl-line-mode 1)
|
|
(toggle-scroll-bar -1)
|
|
(scroll-bar-mode -1)
|
|
(menu-bar-mode -1)
|
|
(tool-bar-mode -1)
|
|
(column-number-mode t)
|
|
(set-fringe-mode 5)
|
|
(setq doc-view-scale-internally nil)
|
|
(setq visible-bell t)
|
|
(setq vc-handled-backends nil)
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
(show-paren-mode t)
|
|
(setq show-paren-style 'expression)
|
|
(save-place-mode t)
|
|
(setq-default indent-tabs-mode nil
|
|
tab-width 4)
|
|
|
|
(set-language-environment "utf-8")
|
|
(prefer-coding-system 'utf-8-unix)
|
|
(set-locale-environment "en_US.UTF-8")
|
|
(set-default-coding-systems 'utf-8-unix)
|
|
(set-selection-coding-system 'utf-8-unix)
|
|
(set-buffer-file-coding-system 'utf-8-unix)
|
|
(set-clipboard-coding-system 'utf-8)
|
|
(set-keyboard-coding-system 'utf-8)
|
|
(set-terminal-coding-system 'utf-8)
|
|
(setq coding-system-for-read 'utf-8)
|
|
(setq coding-system-for-write 'utf-8)
|
|
|
|
(defun remove-scratch-buffer ()
|
|
(if (get-buffer "*scratch*")
|
|
(kill-buffer "*scratch*")))
|
|
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)
|
|
|
|
(setf epa-pinentry-mode 'loopback)
|
|
|
|
;; only show line numbers in programming mode
|
|
(defun display-numbers-hook ()
|
|
(display-line-numbers-mode t))
|
|
(add-hook 'prog-mode-hook 'display-numbers-hook)
|
|
|
|
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
|
|
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
|
|
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
|
(setq scroll-step 1) ;; keyboard scroll one line at a time
|
|
|
|
(setq custom-file (concat user-emacs-directory "custom.el"))
|
|
(load custom-file 'noerror)
|
|
|
|
(setq interprogram-cut-function nil)
|
|
(setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
|
|
|
|
(setq package-check-signature nil)
|
|
(defun ensure-package-installed (&rest packages)
|
|
"Assure every package is installed, ask for installation if it’s not.
|
|
|
|
Return a list of installed packages or nil for every skipped package."
|
|
(mapcar
|
|
(lambda (package)
|
|
;; (package-installed-p 'evil)
|
|
(if (package-installed-p package)
|
|
nil
|
|
(if (y-or-n-p (format "Package %s is missing. Install it? " package))
|
|
(package-install package)
|
|
package)))
|
|
packages))
|
|
|
|
;; make sure to have downloaded archive description.
|
|
;; Or use package-archive-contents as suggested by Nicolas Dudebout
|
|
(or (file-exists-p package-user-dir)
|
|
(package-refresh-contents))
|
|
|
|
(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'lsp-mode 'lsp-ui 'lsp-ivy 'dashboard 'flycheck 'which-key 'doom-themes 'rainbow-mode 'rainbow-delimiters 'all-the-icons 'rustic 'simpleclip 'hl-todo 'powerline 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam 'smex 'smartparens 'origami 'company-quickhelp 'org-mime 'verb 'telephone-line 'undo-fu 'neotree 'restart-emacs 'git-timemachine 'org-super-agenda 'pyvenv)
|
|
|
|
;; need this after installation - makes it possible to bootstrap
|
|
(eval-when-compile
|
|
(require 'use-package))
|
|
|
|
(use-package flycheck
|
|
:hook (prog-mode . flycheck-mode)
|
|
:config (setq flycheck-checker-error-threshold 1000))
|
|
|
|
(use-package company
|
|
:custom
|
|
(company-minimum-prefix-length 1)
|
|
(company-idle-delay 0.0)
|
|
(company-tooltip-align-annotations t)
|
|
:config
|
|
(global-company-mode)
|
|
)
|
|
|
|
(use-package company-quickhelp
|
|
:ensure t
|
|
:init
|
|
(company-quickhelp-mode))
|
|
|
|
(use-package lsp-mode
|
|
:after company
|
|
:commands lsp
|
|
:config
|
|
(flyspell-prog-mode)
|
|
(setq gc-cons-threshold 100000000
|
|
read-process-output-max (* 1024 1024)
|
|
lsp-completion-provider :capf
|
|
lsp-keep-workspace-alive nil
|
|
lsp-enable-xref t
|
|
lsp-enable-indentation t
|
|
lsp-signature-auto-activate t
|
|
lsp-idle-delay 0.2
|
|
create-lockfiles nil
|
|
lsp-enable-on-type-formatting t
|
|
lsp-before-save-edits t
|
|
lsp-enable-imenu nil
|
|
lsp-completion-enable t
|
|
lsp-enable-snippet nil
|
|
lsp-eldoc-render-all t
|
|
lsp-enable-file-watchers nil
|
|
lsp-enable-folding nil
|
|
lsp-modeline-diagnostics-enable nil
|
|
lsp-headerline-breadcrumb-enable nil
|
|
lsp-semantic-tokens-enable nil)
|
|
:hook ((js-mode js-jsx-mode python-mode svelte-mode ) . lsp-deferred)
|
|
)
|
|
|
|
(with-eval-after-load 'js
|
|
(define-key js-mode-map (kbd "M-.") nil))
|
|
|
|
(use-package lsp-pyright
|
|
:ensure t
|
|
:hook (python-mode . (lambda ()
|
|
(require 'lsp-pyright)
|
|
(lsp-deferred))))
|
|
|
|
(use-package yasnippet
|
|
:defer nil
|
|
:hook (lsp-mode . yas-minor-mode)
|
|
:diminish yas-minor-mode
|
|
:custom
|
|
(yas-indent-line nil)
|
|
(yas-inhibit-overlap-modification-protection t)
|
|
:custom-face
|
|
(yas-field-highlight-face ((t (:inherit region)))))
|
|
|
|
(use-package lsp-ui
|
|
:after flycheck
|
|
:diminish
|
|
:commands lsp-ui-mode
|
|
:bind
|
|
(:map lsp-ui-mode-map
|
|
("M-i" . lsp-ui-doc-focus-frame))
|
|
:custom
|
|
(lsp-ui-flycheck-enable t)
|
|
(lsp-ui-doc-header t)
|
|
(lsp-ui-doc-show-with-cursor t)
|
|
(lsp-ui-doc-include-signature t)
|
|
(lsp-ui-sideline-show-code-actions t)
|
|
(lsp-ui-doc-delay 0.2)
|
|
(lsp-ui-peek-enable t)
|
|
(lsp-ui-peek-show-directory nil)
|
|
:hook
|
|
(lsp-mode . lsp-ui-mode)
|
|
)
|
|
|
|
(use-package pyvenv
|
|
:defer t)
|
|
|
|
(use-package neotree
|
|
:config
|
|
(global-set-key [f8] 'neotree-toggle)
|
|
(setq neo-show-hidden-files t
|
|
neo-theme 'icons
|
|
neo-smart-open t))
|
|
|
|
(use-package undo-fu
|
|
:config
|
|
(global-unset-key (kbd "C-z"))
|
|
(global-set-key (kbd "C-z") 'undo-fu-only-undo)
|
|
(global-set-key (kbd "C-S-z") 'undo-fu-only-redo))
|
|
|
|
(use-package telephone-line
|
|
:init
|
|
(setq telephone-line-primary-left-separator 'telephone-line-cubed-left
|
|
telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
|
|
telephone-line-primary-right-separator 'telephone-line-cubed-right
|
|
telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right
|
|
telephone-line-height 24)
|
|
:config
|
|
(telephone-line-mode 1))
|
|
|
|
(use-package magit
|
|
:defer
|
|
:ensure t)
|
|
|
|
;; (use-package bm
|
|
;; :ensure t
|
|
;; :demand t
|
|
;; :init
|
|
;; (setq bm-restore-repository-on-load t)
|
|
;; (setq bm-repository-file "~/.emacs.d/bm-repository")
|
|
|
|
;; ;; save bookmarks
|
|
;; (setq-default bm-buffer-persistence t)
|
|
;; :config
|
|
;; (add-hook 'after-init-hook 'bm-repository-load)
|
|
;; ;; Saving bookmarks
|
|
;; (add-hook 'kill-buffer-hook #'bm-buffer-save)
|
|
;; (add-hook 'kill-emacs-hook #'(lambda nil
|
|
;; (bm-buffer-save-all)
|
|
;; (bm-repository-save)))
|
|
;; (add-hook 'find-file-hook #'bm-buffer-restore)
|
|
;; :bind (("<f2>" . bm-next)
|
|
;; ("S-<f2>" . bm-previous)
|
|
;; ("C-<f2>" . bm-toggle)))
|
|
|
|
;; (global-set-key (kbd "<left-fringe> <mouse-5>") 'bm-next-mouse)
|
|
;; (global-set-key (kbd "<left-fringe> <mouse-4>") 'bm-previous-mouse)
|
|
;; (global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
|
|
|
|
(use-package origami
|
|
:bind
|
|
(:map origami-mode-map
|
|
("C-c C-<tab>" . origami-toggle-node)))
|
|
|
|
(add-hook 'prog-mode-hook #'origami-mode)
|
|
(use-package smartparens-config
|
|
:bind
|
|
(:map smartparens-mode-map
|
|
("C-M-a" . sp-beginning-of-sexp)
|
|
("C-M-e" . sp-end-of-sexp)
|
|
("C-<down>" . sp-down-sexp)
|
|
("C-<up>" . sp-up-sexp)
|
|
("M-<down>" . sp-backward-down-sexp)
|
|
("M-<up>" . sp-backward-up-sexp)
|
|
("C-M-f" . sp-forward-sexp)
|
|
("C-M-b" . sp-backward-sexp)
|
|
("C-M-n" . sp-next-sexp)
|
|
("C-M-p" . sp-previous-sexp)
|
|
("C-S-f" . sp-forward-symbol)
|
|
("C-S-b" . sp-backward-symbol)
|
|
("C-<right>" . sp-forward-slurp-sexp)
|
|
("M-<right>" . sp-forward-barf-sexp)
|
|
("C-<left>" . sp-backward-slurp-sexp)
|
|
("M-<left>" . sp-backward-barf-sexp)
|
|
("C-M-t" . sp-transpose-sexp)
|
|
("C-M-k" . sp-kill-sexp)
|
|
("C-k" . sp-kill-hybrid-sexp)
|
|
("M-k" . sp-backward-kill-sexp)
|
|
("C-M-w" . sp-copy-sexp)
|
|
("C-M-d" . delete-sexp)
|
|
("M-<backspace>" . backward-kill-word)
|
|
("C-<backspace>" . sp-backward-kill-word)
|
|
([remap sp-backward-kill-word] . backward-kill-word)
|
|
("M-[" . sp-backward-unwrap-sexp)
|
|
("M-]" . sp-unwrap-sexp)
|
|
("C-x C-t" . sp-transpose-hybrid-sexp)
|
|
("C-c (" . wrap-with-parens)
|
|
("C-c [" . wrap-with-brackets)
|
|
("C-c {" . wrap-with-braces)
|
|
("C-c '" . wrap-with-single-quotes)
|
|
("C-c \"" . wrap-with-double-quotes)
|
|
("C-c _" . wrap-with-underscores)
|
|
("C-c `" . wrap-with-back-quotes))
|
|
:config
|
|
(add-hook 'prog-mode-hook #'smartparens-mode))
|
|
|
|
|
|
(use-package centaur-tabs
|
|
:init
|
|
(setq centaur-tabs-enable-key-bindings t
|
|
centaur-tabs-set-icons t
|
|
centaur-tabs-set-modified-marker t
|
|
centaur-tabs-style "chamfer"
|
|
centaur-tabs-gray-out-icons 'buffer)
|
|
:config
|
|
(centaur-tabs-group-by-projectile-project)
|
|
(centaur-tabs-headline-match)
|
|
(centaur-tabs-mode 1))
|
|
|
|
(add-hook 'after-init-hook #'global-flycheck-mode)
|
|
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
|
(add-hook 'css-mode-hook #'rainbow-mode)
|
|
|
|
(when (fboundp 'windmove-default-keybindings)
|
|
(windmove-default-keybindings))
|
|
|
|
(use-package which-key
|
|
:config
|
|
(which-key-mode))
|
|
|
|
;; (use-package multiple-cursors)
|
|
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
|
|
;; (global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
|
;; (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
|
;; (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
|
|
|
|
(use-package ivy :ensure t
|
|
:diminish ivy-mode
|
|
:config
|
|
(ivy-mode 1)
|
|
(setq ivy-height 13)
|
|
(setq ivy-wrap t)
|
|
(setq ivy-use-virtual-buffers t)
|
|
(setq ivy-count-format "(%d/%d) "))
|
|
|
|
(use-package lsp-ivy
|
|
:after lsp-mode ivy
|
|
:commands lsp-ivy-workspace-symbol)
|
|
|
|
(use-package counsel
|
|
:ensure t
|
|
:bind*
|
|
(("M-x" . counsel-M-x)
|
|
("C-c d d" . counsel-descbinds)
|
|
("C-x C-f" . counsel-find-file)
|
|
("C-x r f" . counsel-recentf)
|
|
("C-c g g" . counsel-git)
|
|
("C-c g G" . counsel-git-grep)
|
|
("C-x l" . counsel-locate)
|
|
("C-c g s" . counsel-grep-or-swiper)
|
|
("C-M-y" . counsel-yank-pop)
|
|
("C-c C-r" . ivy-resume)
|
|
("C-c i m" . counsel-imenu)
|
|
("C-c i M" . ivy-imenu-anywhere)
|
|
("C-c d s" . describe-symbol)))
|
|
|
|
(use-package swiper
|
|
:bind*
|
|
(("C-s" . swiper)))
|
|
(setq search-default-mode #'char-fold-to-regexp)
|
|
|
|
(use-package projectile
|
|
:ensure t
|
|
:init
|
|
(projectile-mode +1)
|
|
:config
|
|
(setq projectile-sort-order 'recentf
|
|
projectile-require-project-root t
|
|
projectile-completion-system 'ivy
|
|
projectile-switch-project-action 'neotree-projectile-action)
|
|
:bind (:map projectile-mode-map
|
|
("s-p" . projectile-command-map)
|
|
("C-c p" . projectile-command-map)))
|
|
|
|
(defun trigger-org-company-complete ()
|
|
"Begins company-complete in org-mode buffer after pressing #+ chars."
|
|
(interactive)
|
|
(if (string-equal "#" (string (preceding-char)))
|
|
(progn
|
|
(insert "+")
|
|
(company-complete))
|
|
(insert "+")))
|
|
|
|
;; org settings
|
|
(use-package org
|
|
:mode ("\\.org\\'" . org-mode)
|
|
:bind
|
|
(:map org-mode-map
|
|
("C-c C-r" . verb-command-map)
|
|
("+" . 'trigger-org-company-complete))
|
|
(:map global-map
|
|
("C-c a" . org-agenda)
|
|
("C-c l" . org-store-link))
|
|
:config
|
|
(setq org-replace-disputed-keys t
|
|
org-enforce-todo-dependencies t
|
|
org-enforce-todo-checkbox-dependencies t
|
|
org-log-done nil
|
|
org-clock-idle-time 10
|
|
org-startup-with-inline-images t
|
|
org-startup-folded t
|
|
org-pretty-entities t
|
|
org-hide-leading-stars t
|
|
org-hide-emphasis-markers t
|
|
org-fontify-whole-heading-line t
|
|
org-fontify-done-headline t
|
|
org-fontify-quote-and-verse-blocks t
|
|
org-startup-with-latex-preview t
|
|
org-src-tab-acts-natively t
|
|
org-src-fontify-natively t
|
|
org-confirm-elisp-link-function nil
|
|
org-display-custom-times t
|
|
org-time-stamp-custom-formats '("<%a %b %e %Y>" . "<%a %b %e %Y %H:%M>")
|
|
org-tag-alist '(("bug" . ?b) ("feature" . ?f) ("polish" . ?p) ("optimization" . ?o) ("devops" . ?d) ("reading" . ?r) ("writing" . ?w))
|
|
org-agenda-custom-commands
|
|
'(("p" "Projects" todo "TODO"
|
|
((org-agenda-files '("~/Documents/org-mode/projects.org"))
|
|
(org-agenda-sorting-strategy '(priority-down)))
|
|
))
|
|
org-agenda-skip-scheduled-if-done t
|
|
org-agenda-skip-deadline-if-done t
|
|
org-agenda-todo-ignore-deadlines t
|
|
org-agenda-todo-ignore-with-date t
|
|
org-agenda-todo-ignore-scheduled t
|
|
org-agenda-start-on-weekday nil
|
|
org-agenda-skip-additional-timestamps-same-entry nil
|
|
org-agenda-compact-blocks t
|
|
org-agenda-block-separator nil
|
|
org-agenda-start-day "+0d")
|
|
:hook
|
|
(org-agenda-mode . origami-mode)
|
|
)
|
|
|
|
(use-package org-super-agenda
|
|
:after org
|
|
:ensure t
|
|
:config
|
|
(setq org-super-agenda-groups
|
|
'(
|
|
(:auto-category t)
|
|
)
|
|
)
|
|
)
|
|
(use-package dashboard
|
|
:after org
|
|
:init
|
|
(setq dashboard-set-footer nil
|
|
dashboard-org-agenda-categories '("Tasks" "appointments")
|
|
dashboard-center-content t
|
|
dashboard-set-heading-icons t
|
|
dashboard-set-file-icons t
|
|
initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
|
|
:ensure t
|
|
:config (dashboard-setup-startup-hook))
|
|
|
|
(use-package org-projectile
|
|
:after org
|
|
:bind ("C-c n p" . org-projectile-project-todo-completing-read)
|
|
:config
|
|
(progn
|
|
(setq org-projectile-projects-file
|
|
"~/Documents/org-mode/projects.org")
|
|
;;(setq org-agenda-files (append org-agenda-files (org-projectile-todo-files)))
|
|
(push (org-projectile-project-todo-entry) org-capture-templates))
|
|
:ensure t)
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-visual-line-mode)
|
|
(use-package org-alert
|
|
:ensure t
|
|
:config
|
|
(org-alert-enable)
|
|
(setq alert-default-style 'libnotify
|
|
org-alert-notify-cutoff 300
|
|
))
|
|
|
|
(add-hook 'org-mode-hook 'flyspell-mode)
|
|
|
|
(setq org-agenda-files
|
|
(list
|
|
"~/Documents/org-mode/school.org"
|
|
"~/Documents/org-mode/personal.org"
|
|
"~/Documents/org-mode/tweaking.org"
|
|
"~/Documents/org-mode/projects.org"
|
|
)
|
|
)
|
|
|
|
(use-package org-roam
|
|
:ensure t
|
|
:after org
|
|
:init
|
|
(setq org-roam-v2-ack t)
|
|
:bind* (("C-c n l" . org-roam-buffer-toggle)
|
|
("C-c n f" . org-roam-node-find)
|
|
("C-c n c" . org-roam-dailies-capture-today))
|
|
:bind (:map org-mode-map
|
|
("C-c n i" . org-roam-node-insert))
|
|
:custom
|
|
(org-roam-directory "~/Documents/slipbox")
|
|
(org-roam-capture-templates
|
|
'(("d" "default" plain
|
|
"%?"
|
|
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
("e" "encrypted" plain "%?"
|
|
:target (file+head "${slug}.org.gpg"
|
|
"#+title: ${title}\n")
|
|
:unnarrowed t)
|
|
)
|
|
)
|
|
(org-roam-completion-everywhere t)
|
|
(org-roam-completion-system 'default)
|
|
(org-roam-dailies-directory "daily/")
|
|
:config
|
|
(use-package org-roam-dailies)
|
|
(org-roam-setup)
|
|
(org-roam-db-autosync-mode))
|
|
|
|
(use-package rustic
|
|
:config
|
|
(setq rustic-cargo-clippy-trigger-fix 'on-compile))
|
|
|
|
;;(push 'rustic-clippy flycheck-checkers)
|
|
|
|
(use-package all-the-icons)
|
|
|
|
(defun notify-send (title msg)
|
|
(interactive)
|
|
;; only the first line of the message is returned
|
|
;; (subseq msg 0 (search msg "\n"))
|
|
(shell-command (concat "notify-send '" title "' '" msg "'")))
|
|
|
|
(setq TeX-auto-save t)
|
|
(setq TeX-parse-self t)
|
|
(setq-default TeX-master nil)
|
|
|
|
;;(use-package org-notify)
|
|
;;(org-notify-start)
|
|
|
|
;;(org-notify-add 'appt
|
|
;; '(:time "15m" :period "5m" :duration "30s" :action (notify-send org-notify-action-message)))
|
|
|
|
;;(add-hook 'org-mode-hook 'flyspell-mode 1)
|
|
;;(setq appt-disp-window-function (function facade-notify-appt))
|
|
|
|
|
|
|
|
;;(load-library ".emacs_home")
|
|
;;(cond ((file-exists-p "~/.emacs_home.el") (load "~/.emacs_home.el")))
|
|
;;(cond ((file-exists-p "~/.emacs_work.el") (load "~/.emacs_work.el")))
|
|
;;; .emacs ends here
|
|
|