mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-13 19:57:19 +00:00
sort paragraphs in emacs.nix, nixfmt, add indent preserve to separedit
This commit is contained in:
parent
f051150ac5
commit
bc6254b8c3
1 changed files with 423 additions and 424 deletions
847
emacs.nix
847
emacs.nix
|
@ -30,7 +30,7 @@ in {
|
||||||
(setq native-comp-async-report-warnings-errors nil)
|
(setq native-comp-async-report-warnings-errors nil)
|
||||||
(setq warning-minimum-level 'error)
|
(setq warning-minimum-level 'error)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
prelude = ''
|
prelude = ''
|
||||||
; -*-emacs-lisp-*-
|
; -*-emacs-lisp-*-
|
||||||
;; Disable startup message.
|
;; Disable startup message.
|
||||||
|
@ -110,43 +110,51 @@ in {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
usePackage = {
|
usePackage = {
|
||||||
dracula-theme = {
|
calibredb = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
extraPackages = [ pkgs.sqlite ];
|
||||||
config = ''
|
config = ''
|
||||||
(load-theme 'dracula t)
|
; -*-emacs-lisp-*-
|
||||||
|
(setq calibredb-root-dir "~/Documents/calibre-library")
|
||||||
|
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
||||||
|
(setq calibredb-library-alist '(("~/Documents/calibre-library")))
|
||||||
|
(setq sql-sqlite-program "${pkgs.sqlite}/bin/sqlite3")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
yasnippet = {
|
cdlatex = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
after = [ "latex" ];
|
||||||
(setq yas-snippet-dirs '("~/Documents/org/snippets"))
|
init = ''
|
||||||
(yas-global-mode 1)
|
(add-hook 'LaTeX-mode-hook #'turn-on-cdlatex)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
yasnippet-snippets = {
|
citeproc.enable = true;
|
||||||
|
|
||||||
|
company = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
defines = [ "comapny-text-icons-margin" ];
|
||||||
(yas-reload-all)
|
init = ''
|
||||||
|
;; Align company-mode tooltips to the right hand side
|
||||||
|
(setq company-tooltip-align-annotations t)
|
||||||
|
;; Display number of completions before and after current suggestions
|
||||||
|
;; in company-mode
|
||||||
|
(setq company-tooltip-offset-display 'lines)
|
||||||
|
;; Display text icon of type in company popup
|
||||||
|
(setq company-format-margin-function #'company-text-icons-margin)
|
||||||
'';
|
'';
|
||||||
|
hook =
|
||||||
|
[ "(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
ivy = {
|
company-math = {
|
||||||
enable = true;
|
enable = true;
|
||||||
command = [ "ivy-mode" ];
|
after = [ "company" ];
|
||||||
extraConfig = ''
|
init = ''
|
||||||
:custom
|
; -*-emacs-lisp-*-
|
||||||
(ivy-use-virtual-buffers t)
|
(add-to-list 'company-backends 'company-math-symbols-unicode)
|
||||||
(enable-recursive-minibuffers t)
|
|
||||||
'';
|
'';
|
||||||
bind = { "C-c C-r" = "ivy-resume"; };
|
|
||||||
hook = [ "(after-init . ivy-mode)" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
swiper = {
|
|
||||||
enable = true;
|
|
||||||
bind = { "C-s" = "swiper"; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
counsel = {
|
counsel = {
|
||||||
|
@ -171,31 +179,21 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
company = {
|
edit-indirect.enable = true;
|
||||||
|
|
||||||
|
editorconfig = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defines = [ "comapny-text-icons-margin" ];
|
config = ''
|
||||||
init = ''
|
(editorconfig-mode 1)
|
||||||
;; Align company-mode tooltips to the right hand side
|
|
||||||
(setq company-tooltip-align-annotations t)
|
|
||||||
;; Display number of completions before and after current suggestions
|
|
||||||
;; in company-mode
|
|
||||||
(setq company-tooltip-offset-display 'lines)
|
|
||||||
;; Display text icon of type in company popup
|
|
||||||
(setq company-format-margin-function #'company-text-icons-margin)
|
|
||||||
'';
|
'';
|
||||||
hook =
|
|
||||||
[ "(sh-mode . company-mode)" "(emacs-lisp-mode . company-mode)" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rust-mode = {
|
flycheck = {
|
||||||
enable = true;
|
enable = true;
|
||||||
bindLocal.rust-mode-map = {
|
hook = [ "(after-init . global-flycheck-mode)" ];
|
||||||
"C-c C-y" = "lsp-format-buffer";
|
config = ''
|
||||||
"C-c C-c" = "rust-run-clippy";
|
(setq flycheck-disabled-checkers '(emacs-lisp-checkdoc))
|
||||||
"C-c C-r" = "rust-run";
|
'';
|
||||||
"C-c C-t" = "rust-test";
|
|
||||||
"C-c C-o" = "rust-compile";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
format-all = {
|
format-all = {
|
||||||
|
@ -208,21 +206,88 @@ in {
|
||||||
extraPackages = [ pkgs.black pkgs.shellcheck pkgs.clang-tools ];
|
extraPackages = [ pkgs.black pkgs.shellcheck pkgs.clang-tools ];
|
||||||
};
|
};
|
||||||
|
|
||||||
tree-sitter = {
|
gnuplot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
init = ''
|
init = ''
|
||||||
(setq tree-sitter-major-mode-language-alist '((arduino-mode . c)))
|
(require 'gnuplot)
|
||||||
|
(autoload 'gnuplot-mode "gnuplot" "Gnuplot major mode" t)
|
||||||
|
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot-mode" t)
|
||||||
|
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
|
||||||
|
(require 'gnuplot-context)
|
||||||
'';
|
'';
|
||||||
hook = [
|
extraPackages = [ pkgs.gnuplot ];
|
||||||
"(rust-mode . tree-sitter-hl-mode)"
|
|
||||||
"(python-mode . tree-sitter-hl-mode)"
|
|
||||||
"(c-mode . tree-sitter-hl-mode)"
|
|
||||||
"(shell-mode . tree-sitter-hl-mode)"
|
|
||||||
"(javascript-mode . tree-sitter-hl-mode)"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tree-sitter-langs.enable = true;
|
graphviz-dot-mode = {
|
||||||
|
enable = true;
|
||||||
|
bindLocal.graphviz-dot-mode-map = {
|
||||||
|
"C-c C-y" = "graphviz-dot-indent-graph";
|
||||||
|
};
|
||||||
|
extraPackages = [ pkgs.graphviz ];
|
||||||
|
};
|
||||||
|
|
||||||
|
htmlize.enable = true;
|
||||||
|
|
||||||
|
ivy = {
|
||||||
|
enable = true;
|
||||||
|
command = [ "ivy-mode" ];
|
||||||
|
extraConfig = ''
|
||||||
|
:custom
|
||||||
|
(ivy-use-virtual-buffers t)
|
||||||
|
(enable-recursive-minibuffers t)
|
||||||
|
'';
|
||||||
|
bind = { "C-c C-r" = "ivy-resume"; };
|
||||||
|
hook = [ "(after-init . ivy-mode)" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ivy-bibtex = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
|
||||||
|
;; ignores the order of regexp tokens when searching for matching candidates.
|
||||||
|
(setq ivy-re-builders-alist
|
||||||
|
'((ivy-bibtex . ivy--regex-ignore-order)
|
||||||
|
(t . ivy--regex-plus)))
|
||||||
|
(setq ivy-bibtex-bibliography '("~/Documents/org/zotero.bib"))
|
||||||
|
(setq reftex-default-bibliography '("~/Documents/org/zotero.bib"))
|
||||||
|
(setq bibtex-completion-pdf-field "file")
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
latex = {
|
||||||
|
enable = true;
|
||||||
|
package = epkgs: epkgs.auctex;
|
||||||
|
hook = [''
|
||||||
|
(LaTeX-mode
|
||||||
|
. (lambda ()
|
||||||
|
(turn-on-reftex)))
|
||||||
|
''];
|
||||||
|
init = ''
|
||||||
|
(setq TeX-PDF-mode t
|
||||||
|
TeX-auto-save t
|
||||||
|
TeX-parse-self t)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp-ivy = {
|
||||||
|
enable = true;
|
||||||
|
command = [ "lsp-ivy-workspace-symbol" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp-java = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq lsp-java-format-settings-url
|
||||||
|
"https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml")
|
||||||
|
(setq lsp-java-format-settings-profile
|
||||||
|
"GoogleStyle")
|
||||||
|
(setq lsp-java-jdt-download-url
|
||||||
|
"https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz")
|
||||||
|
'';
|
||||||
|
hook = [ "(java-mode . lsp)" ];
|
||||||
|
};
|
||||||
|
|
||||||
lsp-mode = {
|
lsp-mode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -266,383 +331,14 @@ in {
|
||||||
extraPackages = [ pkgs.nodePackages.bash-language-server ];
|
extraPackages = [ pkgs.nodePackages.bash-language-server ];
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp-ui = {
|
|
||||||
enable = true;
|
|
||||||
command = [ "lsp-ui-mode" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp-ivy = {
|
|
||||||
enable = true;
|
|
||||||
command = [ "lsp-ivy-workspace-symbol" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp-treemacs = {
|
lsp-treemacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
command = [ "lsp-treemacs-errors-lisp" ];
|
command = [ "lsp-treemacs-errors-lisp" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp-java = {
|
lsp-ui = {
|
||||||
enable = true;
|
enable = true;
|
||||||
init = ''
|
command = [ "lsp-ui-mode" ];
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq lsp-java-format-settings-url
|
|
||||||
"https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml")
|
|
||||||
(setq lsp-java-format-settings-profile
|
|
||||||
"GoogleStyle")
|
|
||||||
(setq lsp-java-jdt-download-url
|
|
||||||
"https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz")
|
|
||||||
'';
|
|
||||||
hook = [ "(java-mode . lsp)" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
flycheck = {
|
|
||||||
enable = true;
|
|
||||||
hook = [ "(after-init . global-flycheck-mode)" ];
|
|
||||||
config = ''
|
|
||||||
(setq flycheck-disabled-checkers '(emacs-lisp-checkdoc))
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
arduino-mode = {
|
|
||||||
enable = true;
|
|
||||||
config = ''
|
|
||||||
(require 'flycheck-arduino)
|
|
||||||
(add-hook 'arduino-mode-hook #'flycheck-arduino-setup)
|
|
||||||
'';
|
|
||||||
init = ''
|
|
||||||
(setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino")
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-mode = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = ''
|
|
||||||
:mode "\\.nix\\'"
|
|
||||||
'';
|
|
||||||
config = ''
|
|
||||||
(setq nix-nixfmt-bin "${pkgs.nixfmt}/bin/nixfmt")
|
|
||||||
(setq nix-executable "/nix/var/nix/profiles/default/bin/nix")
|
|
||||||
'';
|
|
||||||
bindLocal.nix-mode-map = { "C-c C-y" = "nix-format-buffer"; };
|
|
||||||
extraPackages = [ pkgs.nixfmt ];
|
|
||||||
};
|
|
||||||
|
|
||||||
edit-indirect.enable = true;
|
|
||||||
|
|
||||||
org = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
:preface
|
|
||||||
(defun my/indent-org-block-automatically ()
|
|
||||||
"Indent the current org code block."
|
|
||||||
(interactive)
|
|
||||||
(when (org-in-src-block-p)
|
|
||||||
(org-edit-special)
|
|
||||||
(indent-region (point-min) (point-max))
|
|
||||||
(org-edit-src-exit)))
|
|
||||||
(defun my/org-force-open-current-window ()
|
|
||||||
"Open a link using 'org-open-at-point' in current window."
|
|
||||||
(interactive)
|
|
||||||
(let ((org-link-frame-setup
|
|
||||||
(quote
|
|
||||||
((vm . vm-visit-folder)
|
|
||||||
(vm-imap . vm-visit-imap-folder)
|
|
||||||
(gnus. gnus)
|
|
||||||
(file . find-file)
|
|
||||||
(wl . wl)))
|
|
||||||
))
|
|
||||||
(org-open-at-point)))
|
|
||||||
(defun my/follow-org-link (arg)
|
|
||||||
"Follow a link in orgmode If ARG is given.
|
|
||||||
Opens in new window otherwise opens in current window."
|
|
||||||
(interactive "P")
|
|
||||||
(if arg
|
|
||||||
(org-open-at-point)
|
|
||||||
(my/org-force-open-current-window)))
|
|
||||||
'';
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(defvar my/org-dir "~/Documents/org/")
|
|
||||||
(require 'oc)
|
|
||||||
(require 'oc-basic)
|
|
||||||
(require 'oc-csl)
|
|
||||||
(require 'oc-natbib)
|
|
||||||
(require 'ox-latex)
|
|
||||||
(setq org-src-window-setup 'current-window)
|
|
||||||
(setq org-confirm-babel-evaluate nil)
|
|
||||||
(setq org-src-fontify-natively t)
|
|
||||||
(setq org-src-tab-acts-natively t)
|
|
||||||
(setq org-src-preserve-indentation t)
|
|
||||||
(setq org-export-with-tags nil)
|
|
||||||
(setq org-publish-project-alist
|
|
||||||
'(("root"
|
|
||||||
:base-directory (expand-file-name my/org-dir)
|
|
||||||
:publishing-function org-html-publish-to-html
|
|
||||||
:publishing-directory (expand-file-name "~/public_html")
|
|
||||||
:section-numbers nil
|
|
||||||
:with-author nil
|
|
||||||
:with-creator t
|
|
||||||
:with-toc t
|
|
||||||
:time-stamp-file nil)))
|
|
||||||
;; Configure HTML export
|
|
||||||
(setq org-html-validation-link nil)
|
|
||||||
(setq org-html-head-include-scripts nil)
|
|
||||||
(setq org-html-head-include-default-style nil)
|
|
||||||
(setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
|
|
||||||
(setq org-html-section)
|
|
||||||
(setq bibtex-completion-notes-path (expand-file-name "notes.org" my/org-dir))
|
|
||||||
(setq org-cite-global-bibliography '("~/Documents/org/zotero.bib"))
|
|
||||||
(setq org-cite-export-processors '((t basic)))
|
|
||||||
(setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow)
|
|
||||||
(setq org-cite-csl-styles-dir "~/Zotero/styles")
|
|
||||||
(setq bibtex-completion-pdf-open-function
|
|
||||||
(lambda (fpath)
|
|
||||||
(call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath)))
|
|
||||||
(defun org-export-latex-no-toc (depth)
|
|
||||||
(when depth
|
|
||||||
(format "%% Org-mode is exporting headings to %s levels.\n"
|
|
||||||
depth)))
|
|
||||||
(setq org-export-latex-format-toc-function 'org-export-latex-no-toc)
|
|
||||||
(setq org-latex-pdf-process
|
|
||||||
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
|
|
||||||
(add-to-list 'exec-path "/Users/willem/.nix-profile/bin")
|
|
||||||
(add-to-list 'org-latex-classes
|
|
||||||
'("apa6"
|
|
||||||
"\\documentclass{apa6}"
|
|
||||||
("\\section{%s}" . "\\section*{%s}")
|
|
||||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
||||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
||||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
||||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
|
||||||
(add-to-list 'org-latex-classes
|
|
||||||
'("mla"
|
|
||||||
"\\documentclass{mla}"
|
|
||||||
("\\section{%s}" . "\\section*{%s}")
|
|
||||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
||||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
||||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
||||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
|
||||||
(setq org-agenda-files '("~/Documents/org" "~/Documents/org/ubc"))
|
|
||||||
'';
|
|
||||||
hook = [
|
|
||||||
"(org-babel-after-execute . org-redisplay-inline-images)"
|
|
||||||
"(org-mode . visual-line-mode)"
|
|
||||||
];
|
|
||||||
bind = {
|
|
||||||
"C-c n c" = "org-id-get-create";
|
|
||||||
"C-c n a" = "org-agenda";
|
|
||||||
};
|
|
||||||
bindLocal.org-mode-map = {
|
|
||||||
"C-c C-o" = "my/follow-org-link";
|
|
||||||
"C-c C-y" = "my/indent-org-block-automatically";
|
|
||||||
"<mouse-2>" = "my/follow-org-link";
|
|
||||||
};
|
|
||||||
extraPackages = [ pkgs.texlive.combined.scheme-full ];
|
|
||||||
};
|
|
||||||
|
|
||||||
htmlize.enable = true;
|
|
||||||
|
|
||||||
gnuplot = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
(require 'gnuplot)
|
|
||||||
(autoload 'gnuplot-mode "gnuplot" "Gnuplot major mode" t)
|
|
||||||
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot-mode" t)
|
|
||||||
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
|
|
||||||
(require 'gnuplot-context)
|
|
||||||
'';
|
|
||||||
extraPackages = [ pkgs.gnuplot ];
|
|
||||||
};
|
|
||||||
|
|
||||||
org-contrib.enable = true;
|
|
||||||
|
|
||||||
plantuml-mode = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
(setq plantuml-executable-path "${pkgs.plantuml}/bin/plantuml")
|
|
||||||
(setq plantuml-default-exec-mode 'executable)
|
|
||||||
'';
|
|
||||||
extraPackages = [ pkgs.plantuml ];
|
|
||||||
};
|
|
||||||
|
|
||||||
graphviz-dot-mode = {
|
|
||||||
enable = true;
|
|
||||||
bindLocal.graphviz-dot-mode-map = {
|
|
||||||
"C-c C-y" = "graphviz-dot-indent-graph";
|
|
||||||
};
|
|
||||||
extraPackages = [ pkgs.graphviz ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-dot = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-shell = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-calc = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-emacs-lisp = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-gnuplot = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-matlab = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "org" ];
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q")
|
|
||||||
(setq org-babel-matlab-shell-command "~/Applications/MATLAB_R2022b.app/bin/matlab -nosplash")
|
|
||||||
'';
|
|
||||||
extraPackages = [ pkgs.octave pkgs.texinfo4 ];
|
|
||||||
};
|
|
||||||
|
|
||||||
ob-python = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = [
|
|
||||||
(pkgs.python310.withPackages (p: with p; [ matplotlib latexify-py ]))
|
|
||||||
];
|
|
||||||
after = [ "org" ];
|
|
||||||
config = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq org-babel-python-command "${pkgs.python310}/bin/python3.10")
|
|
||||||
(setq-default python-indent-guess-indent-offset-verbose nil)
|
|
||||||
(defun my/org-babel-execute:python-session (body params)
|
|
||||||
(let ((session-name (cdr (assq :session params))))
|
|
||||||
(when (not (eq session-name "none"))
|
|
||||||
(org-babel-python-initiate-session session-name))))
|
|
||||||
(advice-add #'org-babel-execute:python :before #'my/org-babel-execute:python-session)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
latex = {
|
|
||||||
enable = true;
|
|
||||||
package = epkgs: epkgs.auctex;
|
|
||||||
hook = [''
|
|
||||||
(LaTeX-mode
|
|
||||||
. (lambda ()
|
|
||||||
(turn-on-reftex)))
|
|
||||||
''];
|
|
||||||
init = ''
|
|
||||||
(setq TeX-PDF-mode t
|
|
||||||
TeX-auto-save t
|
|
||||||
TeX-parse-self t)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
company-math = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "company" ];
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(add-to-list 'company-backends 'company-math-symbols-unicode)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
cdlatex = {
|
|
||||||
enable = true;
|
|
||||||
after = [ "latex" ];
|
|
||||||
init = ''
|
|
||||||
(add-hook 'LaTeX-mode-hook #'turn-on-cdlatex)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
org-download = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
(require 'org-download)
|
|
||||||
(setq-default org-download-image-dir "~/Documents/org/images")
|
|
||||||
'';
|
|
||||||
hook = [ "(dired-mode-hook . org-download-enable)" ];
|
|
||||||
extraPackages = [ pkgs.pngpaste ];
|
|
||||||
};
|
|
||||||
|
|
||||||
#
|
|
||||||
# Start bibtex cite/ref section
|
|
||||||
#
|
|
||||||
|
|
||||||
ivy-bibtex = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
|
|
||||||
;; ignores the order of regexp tokens when searching for matching candidates.
|
|
||||||
(setq ivy-re-builders-alist
|
|
||||||
'((ivy-bibtex . ivy--regex-ignore-order)
|
|
||||||
(t . ivy--regex-plus)))
|
|
||||||
(setq ivy-bibtex-bibliography '("~/Documents/org/zotero.bib"))
|
|
||||||
(setq reftex-default-bibliography '("~/Documents/org/zotero.bib"))
|
|
||||||
(setq bibtex-completion-pdf-field "file")
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
org-ref = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq org-ref-insert-cite-function
|
|
||||||
(lambda ()
|
|
||||||
(org-cite-insert nil)))
|
|
||||||
(setq org-ref-default-bibliography "~/Documents/org/zotero.bib")
|
|
||||||
(setq bibtex-completion-bibliography '("~/Documents/org/zotero.bib"))
|
|
||||||
(require 'org-ref)
|
|
||||||
(require 'org-ref-ivy)
|
|
||||||
'';
|
|
||||||
bindLocal.org-mode-map = { "C-c ]" = "org-ref-insert-link"; };
|
|
||||||
};
|
|
||||||
|
|
||||||
citeproc.enable = true;
|
|
||||||
|
|
||||||
pdf-tools = {
|
|
||||||
enable = true;
|
|
||||||
init = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq-default pdf-view-display-size 'fit-width)
|
|
||||||
(setq pdf-annot-activate-created-annotations t)
|
|
||||||
'';
|
|
||||||
extraPackages = [ pkgs.poppler pkgs.automake ];
|
|
||||||
};
|
|
||||||
|
|
||||||
#
|
|
||||||
# End bibtex cite/ref section
|
|
||||||
#
|
|
||||||
|
|
||||||
calibredb = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = [ pkgs.sqlite ];
|
|
||||||
config = ''
|
|
||||||
; -*-emacs-lisp-*-
|
|
||||||
(setq calibredb-root-dir "~/Documents/calibre-library")
|
|
||||||
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
|
||||||
(setq calibredb-library-alist '(("~/Documents/calibre-library")))
|
|
||||||
(setq sql-sqlite-program "${pkgs.sqlite}/bin/sqlite3")
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
separedit = {
|
|
||||||
enable = true;
|
|
||||||
bind = { "C-c '" = "separedit"; };
|
|
||||||
hook = [ "(separedit-buffer-creation . normal-mode)" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
editorconfig = {
|
|
||||||
enable = true;
|
|
||||||
config = ''
|
|
||||||
(editorconfig-mode 1)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meow = {
|
meow = {
|
||||||
|
@ -733,6 +429,309 @@ in {
|
||||||
(meow-setup)
|
(meow-setup)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix-mode = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
:mode "\\.nix\\'"
|
||||||
|
'';
|
||||||
|
config = ''
|
||||||
|
(setq nix-nixfmt-bin "${pkgs.nixfmt}/bin/nixfmt")
|
||||||
|
(setq nix-executable "/nix/var/nix/profiles/default/bin/nix")
|
||||||
|
'';
|
||||||
|
bindLocal.nix-mode-map = { "C-c C-y" = "nix-format-buffer"; };
|
||||||
|
extraPackages = [ pkgs.nixfmt ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-calc = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-dot = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-emacs-lisp = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-gnuplot = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-matlab = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq org-babel-octave-shell-command "${pkgs.octave}/bin/octave -q")
|
||||||
|
(setq org-babel-matlab-shell-command "~/Applications/MATLAB_R2022b.app/bin/matlab -nosplash")
|
||||||
|
'';
|
||||||
|
extraPackages = [ pkgs.octave pkgs.texinfo4 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-python = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = [
|
||||||
|
(pkgs.python310.withPackages (p: with p; [ matplotlib latexify-py ]))
|
||||||
|
];
|
||||||
|
after = [ "org" ];
|
||||||
|
config = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq org-babel-python-command "${pkgs.python310}/bin/python3.10")
|
||||||
|
(setq-default python-indent-guess-indent-offset-verbose nil)
|
||||||
|
(defun my/org-babel-execute:python-session (body params)
|
||||||
|
(let ((session-name (cdr (assq :session params))))
|
||||||
|
(when (not (eq session-name "none"))
|
||||||
|
(org-babel-python-initiate-session session-name))))
|
||||||
|
(advice-add #'org-babel-execute:python :before #'my/org-babel-execute:python-session)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ob-shell = {
|
||||||
|
enable = true;
|
||||||
|
after = [ "org" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
org = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
:preface
|
||||||
|
(defun my/indent-org-block-automatically ()
|
||||||
|
"Indent the current org code block."
|
||||||
|
(interactive)
|
||||||
|
(when (org-in-src-block-p)
|
||||||
|
(org-edit-special)
|
||||||
|
(indent-region (point-min) (point-max))
|
||||||
|
(org-edit-src-exit)))
|
||||||
|
(defun my/org-force-open-current-window ()
|
||||||
|
"Open a link using 'org-open-at-point' in current window."
|
||||||
|
(interactive)
|
||||||
|
(let ((org-link-frame-setup
|
||||||
|
(quote
|
||||||
|
((vm . vm-visit-folder)
|
||||||
|
(vm-imap . vm-visit-imap-folder)
|
||||||
|
(gnus. gnus)
|
||||||
|
(file . find-file)
|
||||||
|
(wl . wl)))
|
||||||
|
))
|
||||||
|
(org-open-at-point)))
|
||||||
|
(defun my/follow-org-link (arg)
|
||||||
|
"Follow a link in orgmode If ARG is given.
|
||||||
|
Opens in new window otherwise opens in current window."
|
||||||
|
(interactive "P")
|
||||||
|
(if arg
|
||||||
|
(org-open-at-point)
|
||||||
|
(my/org-force-open-current-window)))
|
||||||
|
'';
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(defvar my/org-dir "~/Documents/org/")
|
||||||
|
(require 'oc)
|
||||||
|
(require 'oc-basic)
|
||||||
|
(require 'oc-csl)
|
||||||
|
(require 'oc-natbib)
|
||||||
|
(require 'ox-latex)
|
||||||
|
(setq org-src-window-setup 'current-window)
|
||||||
|
(setq org-confirm-babel-evaluate nil)
|
||||||
|
(setq org-src-fontify-natively t)
|
||||||
|
(setq org-src-tab-acts-natively t)
|
||||||
|
(setq org-src-preserve-indentation t)
|
||||||
|
(setq org-export-with-tags nil)
|
||||||
|
(setq org-publish-project-alist
|
||||||
|
'(("root"
|
||||||
|
:base-directory (expand-file-name my/org-dir)
|
||||||
|
:publishing-function org-html-publish-to-html
|
||||||
|
:publishing-directory (expand-file-name "~/public_html")
|
||||||
|
:section-numbers nil
|
||||||
|
:with-author nil
|
||||||
|
:with-creator t
|
||||||
|
:with-toc t
|
||||||
|
:time-stamp-file nil)))
|
||||||
|
;; Configure HTML export
|
||||||
|
(setq org-html-validation-link nil)
|
||||||
|
(setq org-html-head-include-scripts nil)
|
||||||
|
(setq org-html-head-include-default-style nil)
|
||||||
|
(setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
|
||||||
|
(setq org-html-section)
|
||||||
|
(setq bibtex-completion-notes-path (expand-file-name "notes.org" my/org-dir))
|
||||||
|
(setq org-cite-global-bibliography '("~/Documents/org/zotero.bib"))
|
||||||
|
(setq org-cite-export-processors '((t basic)))
|
||||||
|
(setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow)
|
||||||
|
(setq org-cite-csl-styles-dir "~/Zotero/styles")
|
||||||
|
(setq bibtex-completion-pdf-open-function
|
||||||
|
(lambda (fpath)
|
||||||
|
(call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath)))
|
||||||
|
(defun org-export-latex-no-toc (depth)
|
||||||
|
(when depth
|
||||||
|
(format "%% Org-mode is exporting headings to %s levels.\n"
|
||||||
|
depth)))
|
||||||
|
(setq org-export-latex-format-toc-function 'org-export-latex-no-toc)
|
||||||
|
(setq org-latex-pdf-process
|
||||||
|
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
|
||||||
|
(add-to-list 'exec-path "/Users/willem/.nix-profile/bin")
|
||||||
|
(add-to-list 'org-latex-classes
|
||||||
|
'("apa6"
|
||||||
|
"\\documentclass{apa6}"
|
||||||
|
("\\section{%s}" . "\\section*{%s}")
|
||||||
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||||
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||||
|
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||||
|
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
||||||
|
(add-to-list 'org-latex-classes
|
||||||
|
'("mla"
|
||||||
|
"\\documentclass{mla}"
|
||||||
|
("\\section{%s}" . "\\section*{%s}")
|
||||||
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||||
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||||
|
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||||
|
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
||||||
|
(setq org-agenda-files '("~/Documents/org" "~/Documents/org/ubc"))
|
||||||
|
'';
|
||||||
|
hook = [
|
||||||
|
"(org-babel-after-execute . org-redisplay-inline-images)"
|
||||||
|
"(org-mode . visual-line-mode)"
|
||||||
|
];
|
||||||
|
bind = {
|
||||||
|
"C-c n c" = "org-id-get-create";
|
||||||
|
"C-c n a" = "org-agenda";
|
||||||
|
};
|
||||||
|
bindLocal.org-mode-map = {
|
||||||
|
"C-c C-o" = "my/follow-org-link";
|
||||||
|
"C-c C-y" = "my/indent-org-block-automatically";
|
||||||
|
"<mouse-2>" = "my/follow-org-link";
|
||||||
|
};
|
||||||
|
extraPackages = [ pkgs.texlive.combined.scheme-full ];
|
||||||
|
};
|
||||||
|
|
||||||
|
org-contrib.enable = true;
|
||||||
|
|
||||||
|
org-download = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
(require 'org-download)
|
||||||
|
(setq-default org-download-image-dir "~/Documents/org/images")
|
||||||
|
'';
|
||||||
|
hook = [ "(dired-mode-hook . org-download-enable)" ];
|
||||||
|
extraPackages = [ pkgs.pngpaste ];
|
||||||
|
};
|
||||||
|
|
||||||
|
org-ref = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq org-ref-insert-cite-function
|
||||||
|
(lambda ()
|
||||||
|
(org-cite-insert nil)))
|
||||||
|
(setq org-ref-default-bibliography "~/Documents/org/zotero.bib")
|
||||||
|
(setq bibtex-completion-bibliography '("~/Documents/org/zotero.bib"))
|
||||||
|
(require 'org-ref)
|
||||||
|
(require 'org-ref-ivy)
|
||||||
|
'';
|
||||||
|
bindLocal.org-mode-map = { "C-c ]" = "org-ref-insert-link"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
pdf-tools = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq-default pdf-view-display-size 'fit-width)
|
||||||
|
(setq pdf-annot-activate-created-annotations t)
|
||||||
|
'';
|
||||||
|
extraPackages = [ pkgs.poppler pkgs.automake ];
|
||||||
|
};
|
||||||
|
|
||||||
|
#
|
||||||
|
plantuml-mode = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
(setq plantuml-executable-path "${pkgs.plantuml}/bin/plantuml")
|
||||||
|
(setq plantuml-default-exec-mode 'executable)
|
||||||
|
'';
|
||||||
|
extraPackages = [ pkgs.plantuml ];
|
||||||
|
};
|
||||||
|
#
|
||||||
|
|
||||||
|
rust-mode = {
|
||||||
|
enable = true;
|
||||||
|
bindLocal.rust-mode-map = {
|
||||||
|
"C-c C-y" = "lsp-format-buffer";
|
||||||
|
"C-c C-c" = "rust-run-clippy";
|
||||||
|
"C-c C-r" = "rust-run";
|
||||||
|
"C-c C-t" = "rust-test";
|
||||||
|
"C-c C-o" = "rust-compile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
separedit = {
|
||||||
|
enable = true;
|
||||||
|
bind = { "C-c '" = "separedit"; };
|
||||||
|
hook = [ "(separedit-buffer-creation . normal-mode)" ];
|
||||||
|
init = ''
|
||||||
|
; -*-emacs-lisp-*-
|
||||||
|
(setq separedit-preserve-string-indentation t)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
swiper = {
|
||||||
|
enable = true;
|
||||||
|
bind = { "C-s" = "swiper"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
tree-sitter = {
|
||||||
|
enable = true;
|
||||||
|
init = ''
|
||||||
|
(setq tree-sitter-major-mode-language-alist '((arduino-mode . c)))
|
||||||
|
'';
|
||||||
|
hook = [
|
||||||
|
"(rust-mode . tree-sitter-hl-mode)"
|
||||||
|
"(python-mode . tree-sitter-hl-mode)"
|
||||||
|
"(c-mode . tree-sitter-hl-mode)"
|
||||||
|
"(shell-mode . tree-sitter-hl-mode)"
|
||||||
|
"(javascript-mode . tree-sitter-hl-mode)"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
tree-sitter-langs.enable = true;
|
||||||
|
|
||||||
|
yasnippet = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
(setq yas-snippet-dirs '("~/Documents/org/snippets"))
|
||||||
|
(yas-global-mode 1)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
yasnippet-snippets = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
(yas-reload-all)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
arduino-mode = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
(require 'flycheck-arduino)
|
||||||
|
(add-hook 'arduino-mode-hook #'flycheck-arduino-setup)
|
||||||
|
'';
|
||||||
|
init = ''
|
||||||
|
(setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino")
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
dracula-theme = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
(load-theme 'dracula t)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue