From a5b8c27879cc18b2089a74f38c2207450ad12cd2 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Mon, 22 Feb 2021 19:37:10 +0300 Subject: [PATCH] feat(emacs): some updates --- .emacs.d/custom.el | 11 ++++ .emacs.d/emacs.org | 58 ++++++++++++++++++--- .emacs.d/init.el | 45 +++++++++++++--- .emacs.d/snippets/latex-mode/lfig | 2 +- .emacs.d/snippets/latex-mode/lfig-with-text | 13 +++++ .emacs.d/snippets/latex-mode/my-subfig | 21 ++++++++ 6 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 .emacs.d/snippets/latex-mode/lfig-with-text create mode 100644 .emacs.d/snippets/latex-mode/my-subfig diff --git a/.emacs.d/custom.el b/.emacs.d/custom.el index 20075f6..e53cc48 100644 --- a/.emacs.d/custom.el +++ b/.emacs.d/custom.el @@ -12,7 +12,18 @@ '("aaa4c36ce00e572784d424554dcc9641c82d1155370770e231e10c649b59a074" "c83c095dd01cde64b631fb0fe5980587deec3834dc55144a6e78ff91ebc80b19" "bf387180109d222aee6bb089db48ed38403a1e330c9ec69fe1f52460a8936b66" "e074be1c799b509f52870ee596a5977b519f6d269455b84ed998666cf6fc802a" default)) '(dired-recursive-copies 'always) '(doom-modeline-env-enable-python nil) + '(jest-test-options '("--color" "--runInBand" "--forceExit")) '(js-indent-level 2) + '(notmuch-saved-searches + '((:name "inbox (main)" :query "tag:inbox AND tag:main" :key "i") + (:name "unread (main)" :query "tag:unread AND tag:main" :key "u") + (:name "sent (main)" :query "tag:sent AND tag:main" :key "t") + (:name "all mail (main)" :query "tag:main" :key "a") + (:name "inbox (progin)" :query "tag:inbox AND tag:progin") + (:name "unread (progin)" :query "tag:unread AND tag:progin") + (:name "sent (progin)" :query "tag:sent AND tag:progin") + (:name "all main (progin)" :query "tag:progin") + (:name "drafts" :query "tag:draft"))) '(notmuch-search-oldest-first nil) '(org-agenda-files '("~/Documents/org-mode/ETU/sem-10.org" "~/Documents/org-mode/ETU/r&d.org" "~/Documents/org-mode/Personal/misc.org" "~/Documents/org-mode/Job/dig-traject.org" "~/Documents/org-mode/Personal/look-forward.org" "~/Documents/org-mode/ETU/sem-9.org")) diff --git a/.emacs.d/emacs.org b/.emacs.d/emacs.org index dad5240..f62bd08 100644 --- a/.emacs.d/emacs.org +++ b/.emacs.d/emacs.org @@ -198,7 +198,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." custom xref eshell - helpful))) + helpful + compile + comint))) (use-package evil-quickscope :straight t @@ -841,8 +843,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ) (vterm-other-window "vterm-subterminal")))) -;; (general-nmap "`" 'my/toggle-vterm-subteminal) -;; (general-nmap "~" 'vterm) +(general-nmap "`" 'my/toggle-vterm-subteminal) +(general-nmap "~" 'vterm) #+end_src ** Eshell @@ -865,6 +867,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (use-package eshell :ensure nil :after evil-collection + :commands (eshell) :config (add-hook 'eshell-first-time-mode-hook 'my/configure-eshell 90) (setq eshell-banner-message "")) @@ -876,8 +879,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (setq eshell-highlight-prompt nil) (setq eshell-prompt-function 'epe-theme-pipeline)) -(general-nmap "`" 'aweshell-dedicated-toggle) -(general-nmap "~" 'eshell) +;; (general-nmap "`" 'aweshell-dedicated-toggle) +;; (general-nmap "~" 'eshell) #+end_src * Org-mode ** Installation @@ -1037,8 +1040,19 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." :straight t :after (org) :config - (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1))) -) + (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))) +#+end_src +** Org Agenda +#+begin_src emacs-lisp +(setq org-agenda-category-icon-alist `( + ("work" ,(list (all-the-icons-faicon "cog")) nil nil :ascent center) + ("lesson" ,(list (all-the-icons-faicon "book")) nil nil :ascent center) + ("education" ,(list (all-the-icons-material "build")) nil nil :ascent center) + ("meeting" ,(list (all-the-icons-material "chat")) nil nil :ascent center) + ("music" ,(list (all-the-icons-faicon "music")) nil nil :ascent center) + ("misc" ,(list (all-the-icons-material "archive")) nil nil :ascent center) + ("event" ,(list (all-the-icons-octicon "clock")) nil nil :ascent center) +)) #+end_src ** Other settings #+begin_src emacs-lisp @@ -1172,6 +1186,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." :straight t :init (setq doom-modeline-env-enable-python nil) + (setq doom-modeline-env-enable-go nil) :config (doom-modeline-mode 1) (setq doom-modeline-minor-modes nil) @@ -1441,6 +1456,15 @@ pip install qtconsole markdown qrcode[pil] PyQt5 PyQtWebEngine (window-height . 0.33))) ) #+end_src +** OFF TabNine +#+begin_src emacs-lisp :tangle no +(use-package company-tabnine + :straight t + :if (not my/lowpower) + :after company + :config + (add-to-list 'company-backends #'company-tabnine)) +#+end_src ** OFF DAP #+begin_src emacs-lisp :tangle no (use-package dap-mode @@ -1554,6 +1578,20 @@ pip install qtconsole markdown qrcode[pil] PyQt5 PyQtWebEngine (add-hook 'js-mode-hook #'smartparens-mode) (my/set-smartparens-indent 'js-mode) #+end_src +*** Jest +#+begin_src emacs-lisp +(use-package jest-test-mode + :straight t + :hook ((typescript-mode . jest-test-mode) + (js-mode . jest-test-mode)) + :config + (my-leader-def + :keymaps 'jest-test-mode-map + :infix "t" + "t" 'jest-test-run-at-point + "r" 'jest-test-run + "a" 'jest-test-run-all-tests)) +#+end_src *** Vue.js #+begin_src emacs-lisp (use-package vue-mode @@ -1659,6 +1697,7 @@ pip install qtconsole markdown qrcode[pil] PyQt5 PyQtWebEngine (add-hook 'LaTeX-mode-hook #'prettify-symbols-mode) (my/set-smartparens-indent 'LaTeX-mode) + (require 'smartparens-latex) (general-nmap :keymaps '(LaTeX-mode-map latex-mode-map) @@ -1804,7 +1843,10 @@ pip install qtconsole markdown qrcode[pil] PyQt5 PyQtWebEngine #+begin_src emacs-lisp (use-package go-mode :straight t - :mode "\\.go\\'") + :mode "\\.go\\'" + :config + (my/set-smartparens-indent 'go-mode) + (add-hook 'go-mode-hook 'smartparens-mode)) #+end_src ** fish #+begin_src emacs-lisp diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 69bb5c4..dad74d3 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -152,7 +152,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." custom xref eshell - helpful))) + helpful + compile + comint))) (use-package evil-quickscope :straight t @@ -668,8 +670,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ) (vterm-other-window "vterm-subterminal")))) -;; (general-nmap "`" 'my/toggle-vterm-subteminal) -;; (general-nmap "~" 'vterm) +(general-nmap "`" 'my/toggle-vterm-subteminal) +(general-nmap "~" 'vterm) (defun my/configure-eshell () (add-hook 'eshell-pre-command-hook 'eshell-save-some-history) @@ -689,6 +691,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (use-package eshell :ensure nil :after evil-collection + :commands (eshell) :config (add-hook 'eshell-first-time-mode-hook 'my/configure-eshell 90) (setq eshell-banner-message "")) @@ -700,8 +703,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (setq eshell-highlight-prompt nil) (setq eshell-prompt-function 'epe-theme-pipeline)) -(general-nmap "`" 'aweshell-dedicated-toggle) -(general-nmap "~" 'eshell) +;; (general-nmap "`" 'aweshell-dedicated-toggle) +;; (general-nmap "~" 'eshell) (straight-override-recipe '(org :repo "emacsmirror/org" :no-build t)) @@ -827,8 +830,17 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." :straight t :after (org) :config - (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1))) -) + (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))) + +(setq org-agenda-category-icon-alist `( + ("work" ,(list (all-the-icons-faicon "cog")) nil nil :ascent center) + ("lesson" ,(list (all-the-icons-faicon "book")) nil nil :ascent center) + ("education" ,(list (all-the-icons-material "build")) nil nil :ascent center) + ("meeting" ,(list (all-the-icons-material "chat")) nil nil :ascent center) + ("music" ,(list (all-the-icons-faicon "music")) nil nil :ascent center) + ("misc" ,(list (all-the-icons-material "archive")) nil nil :ascent center) + ("event" ,(list (all-the-icons-octicon "clock")) nil nil :ascent center) +)) (setq org-startup-indented t) @@ -948,6 +960,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." :straight t :init (setq doom-modeline-env-enable-python nil) + (setq doom-modeline-env-enable-go nil) :config (doom-modeline-mode 1) (setq doom-modeline-minor-modes nil) @@ -1176,6 +1189,18 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'js-mode-hook #'smartparens-mode) (my/set-smartparens-indent 'js-mode) +(use-package jest-test-mode + :straight t + :hook ((typescript-mode . jest-test-mode) + (js-mode . jest-test-mode)) + :config + (my-leader-def + :keymaps 'jest-test-mode-map + :infix "t" + "t" 'jest-test-run-at-point + "r" 'jest-test-run + "a" 'jest-test-run-all-tests)) + (use-package vue-mode :straight t :mode "\\.vue\\'" @@ -1250,6 +1275,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'LaTeX-mode-hook #'prettify-symbols-mode) (my/set-smartparens-indent 'LaTeX-mode) + (require 'smartparens-latex) (general-nmap :keymaps '(LaTeX-mode-map latex-mode-map) @@ -1366,7 +1392,10 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (use-package go-mode :straight t - :mode "\\.go\\'") + :mode "\\.go\\'" + :config + (my/set-smartparens-indent 'go-mode) + (add-hook 'go-mode-hook 'smartparens-mode)) (use-package fish-mode :straight t diff --git a/.emacs.d/snippets/latex-mode/lfig b/.emacs.d/snippets/latex-mode/lfig index 4518311..afbb1a1 100644 --- a/.emacs.d/snippets/latex-mode/lfig +++ b/.emacs.d/snippets/latex-mode/lfig @@ -4,7 +4,7 @@ \begin{figure}[h] \centering \includegraphics[${1:width=\textwidth}]{${2:`(shell-command-to-string "find -name \"*.png\" -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | head -n 1 | awk '{ printf $5 }' -")`}} +")`}} % chktex 8 \caption{$3}% \label{fig:${4:label}} \end{figure} diff --git a/.emacs.d/snippets/latex-mode/lfig-with-text b/.emacs.d/snippets/latex-mode/lfig-with-text new file mode 100644 index 0000000..6635e83 --- /dev/null +++ b/.emacs.d/snippets/latex-mode/lfig-with-text @@ -0,0 +1,13 @@ +# key: llfig +# name: lfig-with-text +# -- +рис.~\ref{fig:$1}. + +\begin{figure}[h] + \centering + \includegraphics[${2:width=\textwidth}]{${3:`(shell-command-to-string "find -name \"*.png\" -type f -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | head -n 1 | awk '{ printf $5 }' +")`}} % chktex 8 + \caption{$4}% + \label{fig:$1} +\end{figure} +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/latex-mode/my-subfig b/.emacs.d/snippets/latex-mode/my-subfig new file mode 100644 index 0000000..c2c7250 --- /dev/null +++ b/.emacs.d/snippets/latex-mode/my-subfig @@ -0,0 +1,21 @@ +# -*- mode: snippet -*- +# name: my-subfig +# key: subfigg +# -- + +\begin{figure}[h] + \centering + \begin{subfigure}[b]{${1:0.45}\textwidth} + \includegraphics[width=\textwidth]{$2} + \caption{$3} + \end{subfigure}% + \hspace{1cm} + \begin{subfigure}[b]{${4:0.45}\textwidth} + \includegraphics[width=\textwidth]{$5} + \caption{$6} + \end{subfigure}% + \caption{$7}% + \label{fig:$8} +\end{figure} +$0 +