From 991a67a19b6587095ffbac4aba76ddbdeea9b7a4 Mon Sep 17 00:00:00 2001 From: Vladislav Slobodenyuk Date: Wed, 6 Aug 2025 19:42:39 +0900 Subject: [PATCH] Some fairly minimal changes --- .config.d/.gitignore | 0 .config.d/05-basic.el | 18 -------- .config.d/05-tatoeba.el | 68 +++++++++++++++++++++++++++++++ .config.d/10-completion.el | 6 +++ .config.d/15-lsp.el | 24 +++++++++++ .config.d/20-window-management.el | 25 ++++++++++++ .gitignore | 2 +- 7 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 .config.d/.gitignore create mode 100644 .config.d/05-tatoeba.el create mode 100644 .config.d/20-window-management.el diff --git a/.config.d/.gitignore b/.config.d/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.config.d/05-basic.el b/.config.d/05-basic.el index 0bbdaae..326fc48 100644 --- a/.config.d/05-basic.el +++ b/.config.d/05-basic.el @@ -85,17 +85,6 @@ emacs) ("https://planet.emacslife.com/atom.xml" emacs) - ("https://ria.ru/export/rss2/archive/index.xml" - ru-news) - ("https://rssexport.rbc.ru/rbcnews/news/30/full.rss" - ru-news) - ("https://lenta.ru/rss" - ru-news) - ("https://rg.ru/xml/index.xml" - ru-news) - ("https://portamur.ru/news/rss.php" - ru-news - local-news) ("https://kagi.com/smallweb/appreciated" small-web) ("https://kagi.com/api/v1/smallweb/feed/?gh" @@ -108,13 +97,6 @@ ;; into kill ring before replacing it. (setq save-interprogram-paste-before-kill t) -;; Windmove family of commands allow easy navigation when there is more than two -;; buffers on screen. -(keymap-global-set "C-S-" 'windmove-left) -(keymap-global-set "C-S-" 'windmove-right) -(keymap-global-set "C-S-" 'windmove-up) -(keymap-global-set "C-S-" 'windmove-down) - ;; Compile command allows to easily run noninteractive commands, among other ;; things, like, you know, compiling stuff. (keymap-global-set "C-c l" 'compile) diff --git a/.config.d/05-tatoeba.el b/.config.d/05-tatoeba.el new file mode 100644 index 0000000..51dcd98 --- /dev/null +++ b/.config.d/05-tatoeba.el @@ -0,0 +1,68 @@ +;;; 05-tatoeba.el --- Tatoeba utilities. -*- no-byte-compile: t; lexical-binding: t; -*- + +;;; Description: +;; This file contains my utilities for the tatoeba website. + +;;; Code: + +(defun tatoeba--request-word-data (word) + "Gets raw senteces from the tatoeba api" + (request-response-data + (request + (format + "https://tatoeba.org/eng/api_v0/search?from=deu&has_audio=&list=&native=&original=&orphans=no&query=%s&sort=relevance&sort_reverse=&tags=&to=eng&trans_filter=limit&trans_has_audio=&trans_link=&trans_orphan=no&trans_to=&trans_unapproved=no&trans_user=&unapproved=no&user=&word_count_max=&word_count_min=2" + word) + :parser 'json-read + :sync t))) + +(defun tatoeba--get-eng-translations (translations) + "Converts the translations list into the (id . translation) form" + (let* ((translation-list (append + (aref translations 0) + (aref translations 1) + '()))) + (mapcar + (lambda (x) + (if (equal (cdr (assoc 'lang x)) + "eng") + (cons + (cdr (assoc 'id x)) + (cdr (assoc 'text x))))) + translation-list))) + +(defun tatoeba--get-sentence-list (word) + "Requests sentences and transforms them into an easy to use form." + (let* ((raw-data (tatoeba--request-word-data + word)) + (results (cdadr raw-data))) + (mapcar + (lambda (x) + (list + (assoc 'id x) + (cons 'user (cdadr (assoc 'user x))) + (assoc 'text x) + (cons 'translations + (tatoeba--get-eng-translations + (cdr (assoc 'translations x)))))) + results))) + +(defun tatoeba-get-capture-template () + "Returns a template for the org-capture" + (let* ((word (read-string "Word: ")) + (sentence-list (tatoeba--get-sentence-list + word))) + (with-output-to-string + (princ + (format "\n** %s\n" word)) + (dolist (sentence sentence-list) + (if (not (eq (cdadr + (assoc 'translations sentence)) + nil)) + (princ + (format + "*** %s\n%s\n\n" + (cdr (assoc 'text sentence)) + (cdadr + (assoc 'translations sentence))))))))) + +;;; 05-tatoeba.el ends here diff --git a/.config.d/10-completion.el b/.config.d/10-completion.el index cc5266f..953cce7 100644 --- a/.config.d/10-completion.el +++ b/.config.d/10-completion.el @@ -41,6 +41,12 @@ (global-corfu-mode t) (corfu-popupinfo-mode t)) +;; This package provides icons to corfu completions. Requires nerd fonts to be +;; installed to work. +(use-package nerd-icons-corfu + :config + (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) + ;; Cape provides Completion At Point Extensions which can be used in ;; combination with Corfu, Company or the default completion UI. The ;; completion backends used by completion-at-point are so called diff --git a/.config.d/15-lsp.el b/.config.d/15-lsp.el index 703e34b..2340669 100644 --- a/.config.d/15-lsp.el +++ b/.config.d/15-lsp.el @@ -115,4 +115,28 @@ (add-hook 'emacs-lisp-mode-hook (lambda () (lispy-mode 1))) +;; This package adds indent bars. Currently only configured for rust and python. +(use-package indent-bars + :ensure t + :defer t + :custom + (indent-bars-no-descend-lists t) ; no extra bars in continued func arg lists + (indent-bars-treesit-support t) + (indent-bars-treesit-ignore-blank-lines-types '("module")) + ;; Add other languages as needed + (indent-bars-treesit-scope '((python function_definition class_definition for_statement + if_statement with_statement while_statement) + (rust trait_item impl_item + macro_definition macro_invocation + struct_item enum_item mod_item + const_item let_declaration + function_item for_expression + if_expression loop_expression + while_expression match_expression + match_arm call_expression + token_tree token_tree_pattern + token_repetition))) + (indent-bars-treesit-wrap '((rust arguments parameters))) + :hook ((python-base-mode yaml-mode rust-mode) . indent-bars-mode)) + ;;; 15-lsp.el end here diff --git a/.config.d/20-window-management.el b/.config.d/20-window-management.el new file mode 100644 index 0000000..6733eba --- /dev/null +++ b/.config.d/20-window-management.el @@ -0,0 +1,25 @@ +;;; 20-window-management.el --- Setup concerning windowing. -*- no-byte-compile: t; lexical-binding: t; -*- + +;; Treemacs is a package that provides a tree view of the current project. +(use-package treemacs + :ensure t + :defer t + :commands (treemacs)) + +;; Windmove family of commands allow easy navigation when there is more than two +;; buffers on screen. The bindings are the Vim movement commands with the +;; Control+Shift modifiers, adjusted for the workman layout and shifted a bit +;; down and to the left. +(keymap-global-set "C-S-k" #'windmove-left) +(keymap-global-set "C-S-l" #'windmove-down) +(keymap-global-set "C-<" #'windmove-up) +(keymap-global-set "C->" #'windmove-right) + +;; Still thinking on this one +;; (setq +;; display-buffer-alist +;; `(("\\*vterm\\*" display-buffer-in-side-window +;; (side . bottom) (slot . 0) (window-height . fit-window-to-buffer) +;; (preserve-size . (nil . t)) '(window-parameters . ((no-delete-other-windows . t)))))) + +;;; 20-window-management.el ends here diff --git a/.gitignore b/.gitignore index e28235b..57212fa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,8 @@ !init.el !.github/ !.LICENSE - !custom.el !pre-early-init.el !post-init.el !.config.d/ +!.config.d/*