diff --git a/init.el b/init.el index dc1039c..b5e2f02 100644 --- a/init.el +++ b/init.el @@ -15,7 +15,7 @@ (require 'init-bindings) -(require 'init-dashboard) +;; (require 'init-dashboard) (require 'init-workspace) (require 'init-dired) diff --git a/lisp/init-completion.el b/lisp/init-completion.el index d88600f..1bf7339 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -220,14 +220,6 @@ ;;Quit completion before saving (add-hook 'before-save-hook #'corfu-quit) (advice-add #'persistent-scratch-save :before #'corfu-quit) - (defun corfu-move-to-minibuffer () - (interactive) - (pcase completion-in-region--data - (`(,beg ,end ,table ,pred ,extras) - (let ((completion-extra-properties extras) - completion-cycle-threshold completion-cycling) - (consult-completion-in-region beg end table pred))))) - (keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer) (add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer)) (use-package nerd-icons-corfu diff --git a/lisp/init-edit.el b/lisp/init-edit.el index 2b7d423..cf2b0cb 100644 --- a/lisp/init-edit.el +++ b/lisp/init-edit.el @@ -9,7 +9,31 @@ (use-package smartparens :hook (elpaca-after-init . smartparens-global-mode) ;; :hook (elpaca-after-init . smartparens-global-strict-mode) - :init (sp-use-paredit-bindings)) + :init (sp-use-paredit-bindings) + :config + ;; Autopair quotes more conservatively; if I'm next to a word/before another + ;; quote, I don't want to open a new pair or it would unbalance them. + (let ((unless-list '(sp-point-before-word-p + sp-point-after-word-p + sp-point-before-same-p))) + (sp-pair "'" nil :unless unless-list) + (sp-pair "\"" nil :unless unless-list)) + (dolist (brace '("(" "{" "[")) + (sp-pair brace nil + :post-handlers '(("||\n[i]" "RET") ("| " "SPC")) + ;; Don't autopair opening braces if before a word character or + ;; other opening brace. The rationale: it interferes with manual + ;; balancing of braces, and is odd form to have s-exps with no + ;; whitespace in between, e.g. ()()(). Insert whitespace if + ;; genuinely want to start a new form in the middle of a word. + :unless '(sp-point-before-word-p sp-point-before-same-p))) + + (sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p)) + + ;; Don't do square-bracket space-expansion where it doesn't make sense to + (sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode) + "[" nil :post-handlers '(:rem ("| " "SPC"))) + ) ;; Hungry deletion (use-package hungry-delete diff --git a/lisp/init-tex.el b/lisp/init-tex.el index 61de53d..782aa1d 100644 --- a/lisp/init-tex.el +++ b/lisp/init-tex.el @@ -1,17 +1,22 @@ ;; -*- lexical-binding: t; -*- - - (use-package latex :ensure (auctex :pre-build (("./autogen.sh") ("./configure" "--without-texmf-dir" "--with-lispdir=.") ("make"))) :mode (("\\.tex\\'" . LaTeX-mode)) - :hook ((LaTeX-mode . prettify-symbols-mode)) + :hook prettify-symbols-mode + :hook visual-line-mode + :hook turn-on-reftex :bind (:map LaTeX-mode-map - ("C-S-e" . latex-math-from-calc)) + ("C-S-e" . latex-math-from-calc)) + :custom + (TeX-parse-self t) + (TeX-PDF-mode t) + (TeX-DVI-via-PDFTeX t) :config ;; Format math as a Latex string with Calc + (add-hook 'LaTeX-mode-hook #'eglot-ensure) (defun latex-math-from-calc () "Evaluate `calc' on the contents of line at point." (interactive) @@ -28,7 +33,14 @@ (insert (calc-eval `(,l calc-language latex calc-prefer-frac t - calc-angle-mode rad)))))))) + calc-angle-mode rad))))))) + (setq TeX-view-program-selection '((output-pdf "PDF Tools"))) + (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer) + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab"))) +) + + (use-package cdlatex :ensure t :hook (LaTeX-mode . turn-on-cdlatex) diff --git a/lisp/init-typst.el b/lisp/init-typst.el index 8db0459..4cc6b4d 100644 --- a/lisp/init-typst.el +++ b/lisp/init-typst.el @@ -16,7 +16,8 @@ `((typst-ts-mode) . ,(eglot-alternatives `(,typst-ts-lsp-download-path "tinymist" - "typst-lsp"))))))) + "typst-lsp")))))) + (setq typst-ts-preview-function 'find-file-other-window)) (use-package typst-preview :ensure (:type git :host github :repo "havarddj/typst-preview.el") diff --git a/lisp/init-ui.el b/lisp/init-ui.el index 0a42d75..02cccdc 100644 --- a/lisp/init-ui.el +++ b/lisp/init-ui.el @@ -21,7 +21,7 @@ :init (setq doom-themes-enable-bold t) (setq doom-themes-enable-italic t) - (load-theme 'modus-operandi-tinted t)) + (load-theme 'doom-moonlight t)) (use-package rainbow-delimiters :hook ((prog-mode . rainbow-delimiters-mode) diff --git a/lisp/init-window.el b/lisp/init-window.el index 4653951..e846de0 100644 --- a/lisp/init-window.el +++ b/lisp/init-window.el @@ -120,6 +120,16 @@ "\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode rustic-cargo-outdated-mode rustic-cargo-run-mode rustic-cargo-test-mode "\\*haskell\\*")) + (add-to-list 'display-buffer-alist + '("\\.pdf\\'" + (display-buffer-reuse-window display-buffer-in-direction) + (direction . right) + (window-width . 0.5))) + (add-to-list 'display-buffer-alist + '("\\*OCaml\\*" + (display-buffer-reuse-window display-buffer-in-direction) + (direction . right) + (window-width . 0.5))) :config (with-no-warnings diff --git a/lisp/init-workspace.el b/lisp/init-workspace.el index 5db7c7b..6862fa3 100644 --- a/lisp/init-workspace.el +++ b/lisp/init-workspace.el @@ -5,7 +5,11 @@ (use-package tabspaces :functions tabspaces-mode + :commands (tabspaces-switch-or-create-workspace + tabspaces-open-or-create-project-and-workspace) :hook (elpaca-after-init . tabspaces-mode) + :bind (:map tabspaces-mode-map + ([remap project-switch-project] . tabspaces-open-or-create-project-and-workspace)) :custom (tab-bar-show nil) @@ -17,6 +21,7 @@ ;; sessions (tabspaces-session t) (tabspaces-session-auto-restore t) - (tabspaces-keymap-prefix "C-c o")) - + (tabspaces-keymap-prefix "C-c o") + (tab-bar-new-tab-choice "default")) + (provide 'init-workspace)