1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-22 00:11:27 +00:00

update emacs config

This commit is contained in:
horhik 2024-03-17 14:33:30 +03:00
parent 07a78788f6
commit 4e4712a9da
2 changed files with 266 additions and 155 deletions

View file

@ -22,13 +22,14 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq max-lisp-eval-depth 10000) (setq max-lisp-eval-depth 10000)
(print "Adding melpa") (print "Adding melpa")
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(print "Initializing...") (print "Initializing...")
(package-initialize)
(unless package-archive-contents (unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
@ -38,15 +39,18 @@
#+end_src #+end_src
** Straight.el ** Straight.el
#+begin_src emacs-lis #+begin_src emacs-lisp
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (expand-file-name
(bootstrap-version 5)) "straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file) (unless (file-exists-p bootstrap-file)
(with-current-buffer (with-current-buffer
(url-retrieve-synchronously (url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies) 'silent 'inhibit-cookies)
(goto-char (point-max)) (goto-char (point-max))
(eval-print-last-sexp))) (eval-print-last-sexp)))
@ -72,7 +76,7 @@
(use-package which-key) (use-package which-key)
(use-package gruvbox-theme (straight-use-package 'gruvbox-theme
) )
@ -581,6 +585,36 @@
:weight 'normal :weight 'normal
:width 'normal) :width 'normal)
#+end_src #+end_src
** For LaTeX
#+begin_src emacs-lisp
(setq org-startup-with-latex-preview t)
(setq org-preview-latex-default-process 'dvisvgm)
(setq org-preview-latex-process-alist
'((dvipng :programs
("lualatex" "dvipng")
:description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
(1.0 . 1.0)
:latex-compiler
("lualatex -output-format dvi -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvipng -fg %F -bg %B -D %D -T tight -o %O %f"))
(dvisvgm :programs
("latex" "dvisvgm")
:description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :use-xcolor t :image-input-type "xdv" :image-output-type "svg" :image-size-adjust
(1.7 . 1.5)
:latex-compiler
("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvisvgm %f -n -b min -c %S -o %O"))
(imagemagick :programs
("latex" "convert")
:description "pdf > png" :message "you need to install the programs: latex and imagemagick." :use-xcolor t :image-input-type "pdf" :image-output-type "png" :image-size-adjust
(1.0 . 1.0)
:latex-compiler
("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
:image-converter
("convert -density %D -trim -antialias %f -quality 100 %O"))))
#+end_src
* PDF Tools * PDF Tools
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -635,17 +669,18 @@
** Modeline ** Modeline
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq-default tab-width 4)
(use-package doom-modeline (straight-use-package 'doom-modeline)
:ensure t
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 15))) (doom-modeline-mode)
#+end_src #+end_src
** Org-ref ** Org-ref
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-ref (straight-use-package 'org-ref
:ensure t :ensure t
) )
#+end_src #+end_src
@ -672,9 +707,9 @@
(ivy-mode 1) (ivy-mode 1)
) )
(use-package amx (straight-use-package 'amx
:ensure t )
:init (amx-mode 1)) (amx-mode 1)
#+end_src #+end_src
** Ivy Frame and Counsel ** Ivy Frame and Counsel
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -784,7 +819,10 @@
* Org Roam * Org Roam
** Basic ** Basic
#+begin_src #+begin_src emacs-lisp
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(use-package org-roam (use-package org-roam
;(org-roam-directory (file-truename default-folder)) ;(org-roam-directory (file-truename default-folder))
:bind (("C-c n l" . org-roam-buffer-toggle) :bind (("C-c n l" . org-roam-buffer-toggle)
@ -802,6 +840,14 @@
) )
:config :config
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(setq org-roam-mode-sections
(list #'org-roam-backlinks-section
#'org-roam-reflinks-section
#'org-roam-unlinked-references-section
))
;; If you're using a vertical completion framework, you might want a more informative completion interface ;; If you're using a vertical completion framework, you might want a more informative completion interface
(setq org-roam-completion-everywhere t) (setq org-roam-completion-everywhere t)
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
@ -809,9 +855,6 @@
(require 'org-roam-protocol) (require 'org-roam-protocol)
(require 'org-roam-export) (require 'org-roam-export)
;(setq org-roam-db-location "~/Notes/org-roam.db")
(org-roam-directory "~/Notes")
(org-roam-dailies-directory "~/Notes/journals/")
(org-roam-capture-templates (org-roam-capture-templates
'(("d" "default" plain '(("d" "default" plain
@ -819,6 +862,18 @@
(file+head "pages/${slug}.org" "#+title: ${title}\n") (file+head "pages/${slug}.org" "#+title: ${title}\n")
:unnarrowed t))) :unnarrowed t)))
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 0.33)
(window-parameters . (
(no-delete-other-windows . t)))))
(org-roam-db-autosync-mode t)
) )
#+end_src #+end_src
@ -874,22 +929,19 @@
** Icons ** Icons
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package all-the-icons (straight-use-package 'all-the-icons
:ensure t
) )
(use-package treemacs-all-the-icons (straight-use-package 'treemacs-all-the-icons
:ensure t
) )
(use-package treemacs-nerd-icons (straight-use-package 'treemacs-nerd-icons)
:config ;(treemacs-load-theme "nerd-icons")
(treemacs-load-theme "nerd-icons"))
#+end_src #+end_src
** tree ** tree
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package treemacs (straight-use-package 'treemacs
:config :config
(treemacs-load-all-the-icons-with-workaround-font "Hermit") ;(treemacs-load-all-the-icons-with-workaround-font "Hermit")
(general-define-key (general-define-key
:keymaps 'treemacs-mode-map :keymaps 'treemacs-mode-map
@ -991,6 +1043,7 @@
:config :config
(add-hook 'org-mode-hook 'org-fragtog-mode) (add-hook 'org-mode-hook 'org-fragtog-mode)
) )
#+end_src #+end_src
** Exporting to latex ** Exporting to latex
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1055,25 +1108,6 @@
#+end_src #+end_src
* Org-roam * Org-roam
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(setq org-roam-mode-sections
(list #'org-roam-backlinks-section
#'org-roam-reflinks-section
#'org-roam-unlinked-references-section
))
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 0.33)
(window-parameters . (
(no-delete-other-windows . t)))))
#+end_src #+end_src
* Programming * Programming
@ -1153,7 +1187,7 @@
#+end_src #+end_src
** TypeScript ** TypeScript
#+begin_src emacs-lisp #+begin_src emacs-lis
(require 'lsp-mode) (require 'lsp-mode)
(add-hook 'typescript-mode-hook 'lsp-deferred) (add-hook 'typescript-mode-hook 'lsp-deferred)
(add-hook 'javascript-mode-hook 'lsp-deferred) (add-hook 'javascript-mode-hook 'lsp-deferred)

View file

@ -1,17 +1,34 @@
(setq max-lisp-eval-depth 10000) (setq max-lisp-eval-depth 10000)
(print "Adding melpa") (print "Adding melpa")
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(print "Initializing...") ;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize) (package-initialize)
(unless package-archive-contents (print "Initializing...")
(unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(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))
(menu-bar-mode -1) (menu-bar-mode -1)
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
@ -28,7 +45,7 @@
(use-package which-key) (use-package which-key)
(use-package gruvbox-theme (straight-use-package 'gruvbox-theme
) )
@ -485,6 +502,34 @@
:weight 'normal :weight 'normal
:width 'normal) :width 'normal)
(setq org-startup-with-latex-preview t)
(setq org-preview-latex-default-process 'dvisvgm)
(setq org-preview-latex-process-alist
'((dvipng :programs
("lualatex" "dvipng")
:description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
(1.0 . 1.0)
:latex-compiler
("lualatex -output-format dvi -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvipng -fg %F -bg %B -D %D -T tight -o %O %f"))
(dvisvgm :programs
("latex" "dvisvgm")
:description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :use-xcolor t :image-input-type "xdv" :image-output-type "svg" :image-size-adjust
(1.7 . 1.5)
:latex-compiler
("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
:image-converter
("dvisvgm %f -n -b min -c %S -o %O"))
(imagemagick :programs
("latex" "convert")
:description "pdf > png" :message "you need to install the programs: latex and imagemagick." :use-xcolor t :image-input-type "pdf" :image-output-type "png" :image-size-adjust
(1.0 . 1.0)
:latex-compiler
("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
:image-converter
("convert -density %D -trim -antialias %f -quality 100 %O"))))
(use-package pdf-tools (use-package pdf-tools
:ensure t :ensure t
:defer t :defer t
@ -516,12 +561,14 @@
"o l" '(counsel-org-link :which-key "insert tag") "o l" '(counsel-org-link :which-key "insert tag")
) )
(use-package doom-modeline (setq-default tab-width 4)
:ensure t
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 15)))
(use-package org-ref (straight-use-package 'doom-modeline)
(doom-modeline-mode)
(straight-use-package 'org-ref
:ensure t :ensure t
) )
@ -544,10 +591,10 @@
:config :config
(ivy-mode 1) (ivy-mode 1)
) )
(use-package amx (straight-use-package 'amx
:ensure t )
:init (amx-mode 1)) (amx-mode 1)
(use-package ivy-posframe) (use-package ivy-posframe)
(use-package counsel (use-package counsel
@ -640,6 +687,62 @@
'("~/.emacs.d/snippets" ;; personal snippets '("~/.emacs.d/snippets" ;; personal snippets
)) ))
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(use-package org-roam
;(org-roam-directory (file-truename default-folder))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today)
;; Tags
("C-c t a" . org-roam-tag-add)
("C-c t r" . org-roam-tag-remove)
)
:config
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(setq org-roam-mode-sections
(list #'org-roam-backlinks-section
#'org-roam-reflinks-section
#'org-roam-unlinked-references-section
))
;; If you're using a vertical completion framework, you might want a more informative completion interface
(setq org-roam-completion-everywhere t)
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
;; If using org-roam-protocol
(require 'org-roam-protocol)
(require 'org-roam-export)
(org-roam-capture-templates
'(("d" "default" plain
"%?" :target
(file+head "pages/${slug}.org" "#+title: ${title}\n")
:unnarrowed t)))
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 0.33)
(window-parameters . (
(no-delete-other-windows . t)))))
(org-roam-db-autosync-mode t)
)
(use-package org-roam-ui (use-package org-roam-ui
:after org-roam :after org-roam
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have ;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
@ -675,20 +778,17 @@
) )
(use-package all-the-icons (straight-use-package 'all-the-icons
:ensure t
) )
(use-package treemacs-all-the-icons (straight-use-package 'treemacs-all-the-icons
:ensure t
) )
(use-package treemacs-nerd-icons (straight-use-package 'treemacs-nerd-icons)
:config ;(treemacs-load-theme "nerd-icons")
(treemacs-load-theme "nerd-icons"))
(use-package treemacs (straight-use-package 'treemacs
:config :config
(treemacs-load-all-the-icons-with-workaround-font "Hermit") ;(treemacs-load-all-the-icons-with-workaround-font "Hermit")
(general-define-key (general-define-key
:keymaps 'treemacs-mode-map :keymaps 'treemacs-mode-map
@ -816,22 +916,7 @@ buffer's text scale."
\\end{titlepage} \\end{titlepage}
") ")
(setq org-roam-directory "~/Notes/pages")
(setq org-roam-db-location "~/Notes/notes.org")
(setq org-roam-dailies-directory "~/Notes/journals/")
(setq org-roam-mode-sections
(list #'org-roam-backlinks-section
#'org-roam-reflinks-section
#'org-roam-unlinked-references-section
))
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 0.33)
(window-parameters . (
(no-delete-other-windows . t)))))
(use-package lsp-mode (use-package lsp-mode
:ensure t :ensure t
@ -897,14 +982,6 @@ buffer's text scale."
(use-package flycheck :ensure t) (use-package flycheck :ensure t)
(require 'lsp-mode)
(add-hook 'typescript-mode-hook 'lsp-deferred)
(add-hook 'javascript-mode-hook 'lsp-deferred)
(use-package typescript-mode
:ensure t
)
(which-key-mode) (which-key-mode)
(add-hook 'c-mode-hook 'lsp) (add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp)