commit 135148b220963baa0b1e2b5f6ed4ca038e23134d
parent cf77a4ac8846e93365951641a5e86d3af09efecd
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Mon, 14 Nov 2022 07:21:27 -0800
Lualatex in org-export-tex, vterm
Diffstat:
3 files changed, 98 insertions(+), 15 deletions(-)
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
@@ -269,6 +269,7 @@ mouse-3: Toggle minor modes"
:ensure t
:mode (("\\.rs\\'" . rustic-mode))
:config
+ (setq lsp-rust-server 'rust-analyzer)
(setq rustic-format-on-save t))
(use-package toml-mode
@@ -365,6 +366,26 @@ mouse-3: Toggle minor modes"
org-edit-src-content-indentation 0)
(require 'org-tempo)
+ ;; Configure org mode to use lualatex for TeX export.
+ ;; lualatex preview
+ (setq org-latex-pdf-process
+ '("lualatex -shell-escape -interaction nonstopmode %f"
+ "lualatex -shell-escape -interaction nonstopmode %f"))
+
+ (setq luamagick '(luamagick :programs ("lualatex" "convert")
+ :description "pdf > png"
+ :message "you need to install lualatex and imagemagick."
+ :use-xcolor t
+ :image-input-type "pdf"
+ :image-output-type "png"
+ :image-size-adjust (1.0 . 1.0)
+ :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f")
+ :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))
+
+ (add-to-list 'org-preview-latex-process-alist luamagick)
+
+ (setq org-preview-latex-default-process 'luamagick)
+
(setq org-src-tab-acts-natively t)
:bind (:map org-mode-map
("M-S-<up>" . 'text-scale-increase)
@@ -445,24 +466,12 @@ mouse-3: Toggle minor modes"
:config
(setq TeX-auto-save t)
(setq TeX-parse-self t)
- (setq Tex-command-default "LatexMk")
- (setq-default TeX-master nil)
- (setq-default TeX-engine 'luatex)
- (setq-default TeX-PDF-mode t)
- (setq-default TeX-show-compilation nil)
- (setq-default TeX-process-asynchronous t)
- ;(setq-default TeX-save-query nil)
(add-hook 'LaTeX-mode-hook #'flyspell-mode)
(add-hook 'LaTeX-mode-hook #'wc-mode)
(add-hook 'LaTeX-mode-hook #'company-auctex-init)
(add-hook 'LaTeX-mode-hook #'company-mode)
(add-hook 'LaTeX-mode-hook #'TeX-source-correlate-mode)
- (add-hook 'LaTeX-mode-hook #'TeX-interactive-mode)
- (add-hook 'after-save-hook #'(lambda ()
- (let* ((master-file (TeX-master-file)))
- (TeX-command "LatexMk" #'TeX-master-file))))
-
- (require 'auctex-latexmk))
+ (add-hook 'LaTeX-mode-hook #'TeX-interactive-mode))
(when (and module-file-suffix (not (eq system-type 'windows-nt)))
(use-package vterm
@@ -520,6 +529,17 @@ mouse-3: Toggle minor modes"
(use-package lsp-mode
:ensure t
+ :custom
+ (lsp-eldoc-render-all t)
+ (lsp-idle-delay 0.6)
+ ;; enable / disable the hints as you prefer:
+ (lsp-rust-analyzer-server-display-inlay-hints t)
+ (lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial")
+ (lsp-rust-analyzer-display-chaining-hints t)
+ (lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil)
+ (lsp-rust-analyzer-display-closure-return-type-hints t)
+ (lsp-rust-analyzer-display-parameter-hints nil)
+ (lsp-rust-analyzer-display-reborrow-hints nil)
:init
;; TODO automatically format on save
@@ -544,7 +564,13 @@ mouse-3: Toggle minor modes"
:config
(which-key-mode))
;; optionally
- (use-package lsp-ui :commands lsp-ui-mode :ensure t)
+ (use-package lsp-ui
+ :ensure t
+ :commands lsp-ui-mode
+ :custom
+ (lsp-ui-peek-always-show t)
+ (lsp-ui-sideline-show-hover t)
+ (lsp-ui-doc-enable nil))
;; optionally if you want to use debugger
(use-package dap-mode
@@ -559,6 +585,7 @@ mouse-3: Toggle minor modes"
:hook ((c-mode c++-mode) . lsp)
:commands lsp)
+
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
(use-package yaml-mode
diff --git a/.config/zsh/emacs-vterm-zsh.sh b/.config/zsh/emacs-vterm-zsh.sh
@@ -0,0 +1,56 @@
+# From https://github.com/akermu/emacs-libvterm/blob/master/etc/emacs-vterm-zsh.sh
+
+# Some of the most useful features in emacs-libvterm require shell-side
+# configurations. The main goal of these additional functions is to enable the
+# shell to send information to `vterm` via properly escaped sequences. A
+# function that helps in this task, `vterm_printf`, is defined below.
+
+function vterm_printf(){
+ if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
+ # Tell tmux to pass the escape sequences through
+ printf "\ePtmux;\e\e]%s\007\e\\" "$1"
+ elif [ "${TERM%%-*}" = "screen" ]; then
+ # GNU screen (screen, screen-256color, screen-256color-bce)
+ printf "\eP\e]%s\007\e\\" "$1"
+ else
+ printf "\e]%s\e\\" "$1"
+ fi
+}
+
+# Completely clear the buffer. With this, everything that is not on screen
+# is erased.
+if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
+ alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear'
+fi
+
+# With vterm_cmd you can execute Emacs commands directly from the shell.
+# For example, vterm_cmd message "HI" will print "HI".
+# To enable new commands, you have to customize Emacs's variable
+# vterm-eval-cmds.
+vterm_cmd() {
+ local vterm_elisp
+ vterm_elisp=""
+ while [ $# -gt 0 ]; do
+ vterm_elisp="$vterm_elisp""$(printf '"%s" ' "$(printf "%s" "$1" | sed -e 's|\\|\\\\|g' -e 's|"|\\"|g')")"
+ shift
+ done
+ vterm_printf "51;E$vterm_elisp"
+}
+
+# This is to change the title of the buffer based on information provided by the
+# shell. See, http://tldp.org/HOWTO/Xterm-Title-4.html, for the meaning of the
+# various symbols.
+autoload -U add-zsh-hook
+add-zsh-hook -Uz chpwd (){ print -Pn "\e]2;%m:%2~\a" }
+
+# Sync directory and host in the shell with Emacs's current directory.
+# You may need to manually specify the hostname instead of $(hostname) in case
+# $(hostname) does not return the correct string to connect to the server.
+#
+# The escape sequence "51;A" has also the role of identifying the end of the
+# prompt
+vterm_prompt_end() {
+ vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
+}
+setopt PROMPT_SUBST
+PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
diff --git a/.gitignore b/.gitignore
@@ -89,7 +89,7 @@ flycheck_*.el
!/.config/dunst/
!/.config/dunst/dunstrc
!/.config/zsh/
-!/.config/zsh/zshrc
+!/.config/zsh/*
!/.config/systemd
!/.config/systemd/user
!/.config/systemd/user/emacs.service