1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-25 01:21:31 +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,16 +39,19 @@
#+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)))
(load bootstrap-file nil 'nomessage)) (load bootstrap-file nil 'nomessage))
@ -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,43 +819,63 @@
* Org Roam * Org Roam
** Basic ** Basic
#+begin_src #+begin_src emacs-lisp
(use-package org-roam (setq org-roam-directory "~/Notes/pages")
;(org-roam-directory (file-truename default-folder)) (setq org-roam-db-location "~/Notes/notes.org")
:bind (("C-c n l" . org-roam-buffer-toggle) (setq org-roam-dailies-directory "~/Notes/journals/")
("C-c n f" . org-roam-node-find) (use-package org-roam
("C-c n g" . org-roam-graph) ;(org-roam-directory (file-truename default-folder))
("C-c n i" . org-roam-node-insert) :bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n c" . org-roam-capture) ("C-c n f" . org-roam-node-find)
;; Dailies ("C-c n g" . org-roam-graph)
("C-c n j" . org-roam-dailies-capture-today) ("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)
;; Tags
("C-c t a" . org-roam-tag-add)
("C-c t r" . org-roam-tag-remove)
) )
:config
;; 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)
;(setq org-roam-db-location "~/Notes/org-roam.db")
(org-roam-directory "~/Notes")
(org-roam-dailies-directory "~/Notes/journals/")
(org-roam-capture-templates
'(("d" "default" plain
"%?" :target
(file+head "pages/${slug}.org" "#+title: ${title}\n")
:unnarrowed t)))
)
#+end_src #+end_src
** Org-roam UI ** Org-roam UI
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -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 )
) (straight-use-package 'treemacs-all-the-icons
(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...")
(package-refresh-contents))
(setq package-enable-at-startup nil) (unless package-archive-contents
(setq use-package-always-ensure t) (package-refresh-contents))
(setq package-enable-at-startup nil)
(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,38 +561,40 @@
"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
) )
(use-package ivy (use-package ivy
:ensure t :ensure t
:bind (("C-s" . swiper) :bind (("C-s" . swiper)
:map ivy-minibuffer-map :map ivy-minibuffer-map
("TAB" . ivy-alt-done) ("TAB" . ivy-alt-done)
("C-l" . ivy-alt-done) ("C-l" . ivy-alt-done)
("C-j" . ivy-next-line) ("C-j" . ivy-next-line)
("C-k" . ivy-previous-line) ("C-k" . ivy-previous-line)
:map ivy-switch-buffer-map :map ivy-switch-buffer-map
("C-k" . ivy-previous-line) ("C-k" . ivy-previous-line)
("C-l" . ivy-done) ("C-l" . ivy-done)
("C-d" . ivy-switch-buffer-kill) ("C-d" . ivy-switch-buffer-kill)
:map ivy-reverse-i-search-map :map ivy-reverse-i-search-map
("C-k" . ivy-previous-line) ("C-k" . ivy-previous-line)
("C-d" . ivy-reverse-i-search-kill)) ("C-d" . ivy-reverse-i-search-kill))
: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 )
(straight-use-package 'treemacs-all-the-icons
) )
(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)