202 lines
5.5 KiB
EmacsLisp
202 lines
5.5 KiB
EmacsLisp
(defvar bootstrap-version)
|
|
(let ((bootstrap-file
|
|
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
|
(bootstrap-version 6))
|
|
(unless (file-exists-p bootstrap-file)
|
|
(with-current-buffer
|
|
(url-retrieve-synchronously
|
|
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
|
'silent 'inhibit-cookies)
|
|
(goto-char (point-max))
|
|
(eval-print-last-sexp)))
|
|
(load bootstrap-file nil 'nomessage))
|
|
|
|
(straight-use-package 'use-package)
|
|
(setq straight-use-package-by-default t)
|
|
|
|
(use-package emacs
|
|
:straight (:type built-in)
|
|
:bind (("C-z" . nil)
|
|
("C-z i" . (lambda () (interactive) (find-file user-init-file))))
|
|
:config
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
(put 'dired-find-alternate-file 'disabled nil)
|
|
(set-default-file-modes #o750)
|
|
(windmove-default-keybindings 'super)
|
|
:custom
|
|
(column-number-mode t)
|
|
(dired-dwim-target 'dired-dwim-target-next)
|
|
(inhibit-startup-screen t)
|
|
(global-auto-revert-mode t)
|
|
(global-auto-revert-non-file-buffers t))
|
|
|
|
(use-package better-defaults
|
|
:straight (:host nil :repo "https://git.sr.ht/~technomancy/better-defaults"))
|
|
|
|
(use-package treemacs-icons-dired
|
|
:hook (dired-mode . treemacs-icons-dired-mode))
|
|
|
|
(use-package undo-tree
|
|
:init (global-undo-tree-mode)
|
|
:custom
|
|
(undo-tree-history-directory-alist '(("." . "~/.config/emacs/undo-tree"))))
|
|
|
|
(use-package magit
|
|
:bind (("C-x g" . magit-status)
|
|
("C-x M-g" . magit-list-repositories))
|
|
:custom
|
|
(magit-repository-directories
|
|
'(("~/" . 0)
|
|
("~/Projects/" . 1))))
|
|
|
|
(use-package nyan-mode
|
|
:init
|
|
(nyan-mode 1)
|
|
:custom
|
|
(nyan-animate-nyancat t)
|
|
(nyan-wavy-trail t))
|
|
|
|
(use-package mozc
|
|
:bind (("C-c m" . mozc-mode)))
|
|
|
|
(use-package material-theme
|
|
:config
|
|
(load-theme 'material t))
|
|
|
|
(use-package windmove
|
|
:straight (:type built-in)
|
|
:bind (("s-w" . windmove-up)
|
|
("s-a" . windmove-left)
|
|
("s-s" . windmove-down)
|
|
("s-d" . windmove-right)))
|
|
|
|
(use-package counsel
|
|
:bind (("C-s" . swiper-isearch)
|
|
("M-x" . counsel-M-x)
|
|
("M-y" . counsel-yank-pop)
|
|
("<f1> f" . counsel-describe-function)
|
|
("<f1> v" . counsel-describe-variable)
|
|
("C-x C-f" . counsel-find-file)
|
|
("C-x b" . ivy-switch-buffer)
|
|
("C-x d" . counsel-dired)
|
|
("C-c u" . counsel-unicode-char)
|
|
("C-c v" . ivy-push-view)
|
|
("C-c V" . ivy-pop-view)
|
|
:map ivy-minibuffer-map
|
|
("C-<return>" . ivy-immediate-done))
|
|
:config
|
|
(setq ivy-re-builders-alist
|
|
'((t . ivy--regex-ignore-order)))
|
|
:custom
|
|
(ivy-mode 1)
|
|
(ivy-count-format "(%d/%d) "))
|
|
|
|
(use-package org
|
|
:straight (:type built-in)
|
|
:bind (("C-c l" . org-store-link)
|
|
("C-c c" . org-capture)
|
|
("C-c a" . org-agenda)
|
|
("C-c b" . org-switchb)
|
|
:map org-mode-map
|
|
("M-." . org-open-at-point)
|
|
("M-," . org-mark-ring-goto))
|
|
:custom
|
|
(org-agenda-start-on-weekday 0)
|
|
(org-agenda-weekend-days '(5 6))
|
|
(org-default-notes-file "~/Documents/notes.org")
|
|
(org-agenda-files (list org-default-notes-file))
|
|
(org-capture-templates
|
|
'(
|
|
("i" "Thoughts on Debugging and Research" entry
|
|
(file+headline org-default-notes-file "Inquiries")
|
|
"** %?\n %U\n*** Failures and possible solutions")
|
|
("t" "Task" entry
|
|
(file+headline org-default-notes-file "Tasks")
|
|
"** TODO %?\n %U")
|
|
)))
|
|
(use-package org-contrib)
|
|
(use-package org-contacts
|
|
:after org-contrib)
|
|
|
|
;; EPUB reader
|
|
(use-package nov
|
|
:init
|
|
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
|
|
|
|
(use-package company
|
|
:init (global-company-mode))
|
|
|
|
(use-package apt-mode)
|
|
|
|
(use-package docker
|
|
:bind ("C-c d" . docker))
|
|
|
|
(use-package iedit)
|
|
(use-package wgrep)
|
|
|
|
(use-package lsp-mode
|
|
:init
|
|
(setq lsp-keymap-prefix "C-z l")
|
|
:custom
|
|
(lsp-pylsp-plugins-flake8-enabled nil))
|
|
|
|
(use-package flymake
|
|
:straight (:type built-in)
|
|
:bind (:map flymake-mode-map
|
|
("C-c C-n" . flymake-goto-next-error)
|
|
("C-c C-p" . flymake-goto-prev-error)
|
|
("C-c C-l" . flymake-show-buffer-diagnostics)))
|
|
|
|
(use-package pyvenv)
|
|
|
|
(defun find-venv ()
|
|
"Try to find a .venv/ directory in the current project"
|
|
(require 'f)
|
|
(let ((basedir (f-traverse-upwards
|
|
(lambda (path)
|
|
(let ((venv-path (f-expand ".venv" path)))
|
|
(f-exists? venv-path))))))
|
|
(when basedir (f-expand ".venv" basedir))))
|
|
|
|
(defun load-python-env ()
|
|
"Set up the Python IDE in the current project"
|
|
(interactive)
|
|
(let ((venv-dir (find-venv)))
|
|
(if venv-dir
|
|
(progn
|
|
(pyvenv-activate venv-dir)
|
|
(lsp))
|
|
(pyvenv-deactivate))))
|
|
|
|
(use-package python
|
|
:bind (:map python-mode-map
|
|
("C-c C-p" . nil)
|
|
("C-c C-l" . nil))
|
|
:hook ((python-mode . load-python-env)))
|
|
|
|
; Requires the Python package "black"
|
|
(use-package blacken
|
|
:hook (python-mode . blacken-mode))
|
|
|
|
; Requires the Python package "isort"
|
|
(use-package py-isort
|
|
:hook (before-save . (lambda ()
|
|
(when (bound-and-true-p blacken-mode)
|
|
(py-isort-before-save))))
|
|
:config
|
|
(setq py-isort-options '("--profile" "black")))
|
|
|
|
;; Jupyter notebook integration
|
|
(use-package ein
|
|
:bind (("C-z j" . ein:run)
|
|
:map ein:notebook-mode-map
|
|
("C-c C-x k" . ein:notebook-switch-kernel))
|
|
:config
|
|
(require 'ein-notebook)
|
|
:custom
|
|
(ein:jupyter-default-notebook-directory "~/Projects/notebooks")
|
|
(ein:output-area-inlined-images t))
|
|
|
|
(use-package direnv
|
|
:config
|
|
(direnv-mode))
|