diff --git a/Xresources b/Xresources index ec4bf53..b9afe19 100644 --- a/Xresources +++ b/Xresources @@ -1,13 +1,14 @@ !! URxvt Appearance urxvt*termName: rxvt-256color -urxvt*font: xft:Terminus:style=Regular:size=12 +urxvt*font: xft:Terminus:style=Regular:size=16 Xft.autohint: true Xft.antialias: true Xft.hinting: true -Xft.hintstyle: hintslight +Xft.hintstyle: hintfull Xft.rgba: rgb Xft.lcdfilter: lcddefault +rofi.color-enabled: true urxvt*letterSpace: 0 urxvt*lineSpace: 0 urxvt*geometry: 120x30 diff --git a/emacs b/emacs index a01f843..e29654a 100644 --- a/emacs +++ b/emacs @@ -4,6 +4,9 @@ (add-to-list 'package-archives '("elpa" . "https://tromey.com/elpa/") t) (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(add-to-list 'package-archives + '("xaldew" . "https://gustafwaldemarson.com/elpa/")) +(add-to-list 'package-unsigned-archives "xaldew") (package-initialize) ;; emacs preferences @@ -18,12 +21,13 @@ (setq visible-bell t) (setq vc-handled-backends nil) +(setf epa-pinentry-mode 'loopback) + ;; only show line numbers in programming mode (defun display-numbers-hook () (display-line-numbers-mode t)) (add-hook 'prog-mode-hook 'display-numbers-hook) - (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time (setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling (setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse @@ -35,9 +39,6 @@ (setq interprogram-cut-function nil) (setq backup-directory-alist '(("" . "~/.emacs.d/backup"))) -(eval-when-compile - (require 'use-package)) - (setq package-check-signature nil) (defun ensure-package-installed (&rest packages) "Assure every package is installed, ask for installation if it’s not. @@ -58,7 +59,35 @@ Return a list of installed packages or nil for every skipped package." (or (file-exists-p package-user-dir) (package-refresh-contents)) -(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'eglot 'telephone-line 'dashboard 'multiple-cursors 'flycheck 'which-key 'restart-emacs 'doom-themes 'rainbow-mode 'rainbow-delimiters 'all-the-icons 'elpy 'rustic 'simpleclip 'messages-are-flowing 'hl-todo 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam 'smex 'smartparens 'origami 'dumb-jump 'kaolin-themes 'company-quickhelp 'treemacs 'treemacs-projectile 'treemacs-magit 'treemacs-icons-dired) +(ensure-package-installed 'use-package 'ivy 'magit 'centaur-tabs 'eglot 'dashboard 'multiple-cursors 'flycheck 'which-key 'doom-themes 'rainbow-mode 'rainbow-delimiters 'all-the-icons 'elpy 'rustic 'simpleclip 'messages-are-flowing 'hl-todo 'powerline 'format-all 'auctex 'counsel 'swiper 'projectile 'org-roam 'smex 'smartparens 'origami 'dumb-jump 'kaolin-themes 'company-quickhelp 'treemacs 'treemacs-projectile 'treemacs-magit 'treemacs-icons-dired 'org-mime 'hydra 'verb 'telephone-line 'bm 'undo-fu 'ranger) + +;; need it after installation - makes it possible to bootstrap +(eval-when-compile + (require 'use-package)) + +(use-package ranger + :config + (setq ranger-preview-file nil) + (ranger-override-dired-mode t)) + +(use-package undo-fu + :config + (global-unset-key (kbd "C-z")) + (global-set-key (kbd "C-z") 'undo-fu-only-undo) + (global-set-key (kbd "C-S-z") 'undo-fu-only-redo)) + +(use-package telephone-line + :init + (setq telephone-line-primary-left-separator 'telephone-line-cubed-left + telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left + telephone-line-primary-right-separator 'telephone-line-cubed-right + telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right) + (setq telephone-line-height 24) + :config + (telephone-line-mode 1)) + +(use-package magit + :ensure t) (use-package treemacs :ensure t @@ -101,8 +130,8 @@ Return a list of installed packages or nil for every skipped package." treemacs-litter-directories '("/node_modules" "/.venv" "/.cask") treemacs-show-cursor nil treemacs-show-hidden-files t - treemacs-silent-filewatch nil - treemacs-silent-refresh nil + treemacs-silent-filewatch t + treemacs-silent-refresh t treemacs-sorting 'alphabetic-asc treemacs-select-when-already-in-treemacs 'move-back treemacs-space-between-root-nodes t @@ -124,15 +153,7 @@ Return a list of installed packages or nil for every skipped package." (treemacs-follow-mode t) (treemacs-filewatch-mode t) (treemacs-fringe-indicator-mode 'always) - - (pcase (cons (not (null (executable-find "git"))) - (not (null treemacs-python-executable))) - (`(t . t) - (treemacs-git-mode 'deferred)) - (`(t . _) - (treemacs-git-mode 'simple))) - - (treemacs-hide-gitignored-files-mode nil)) + (treemacs-git-mode 'deferred)) :bind (:map global-map ("M-0" . treemacs-select-window) @@ -142,7 +163,7 @@ Return a list of installed packages or nil for every skipped package." ("C-x t C-t" . treemacs-find-file) ("C-x t M-t" . treemacs-find-tag))) -(use-package treemacs-projectile +(use-package treemacs-projectile :after (treemacs projectile) :ensure t) @@ -154,18 +175,81 @@ Return a list of installed packages or nil for every skipped package." :after (treemacs magit) :ensure t) -(require 'dumb-jump) +(use-package bm + :ensure t + :demand t + + :init + ;; restore on load (even before you require bm) + (setq bm-restore-repository-on-load t) + + + :config + ;; Allow cross-buffer 'next' + (setq bm-cycle-all-buffers t) + + ;; where to store persistant files + (setq bm-repository-file "~/.emacs.d/bm-repository") + + ;; save bookmarks + (setq-default bm-buffer-persistence t) + + ;; Loading the repository from file when on start up. + (add-hook 'after-init-hook 'bm-repository-load) + + ;; Saving bookmarks + (add-hook 'kill-buffer-hook #'bm-buffer-save) + + ;; Saving the repository to file when on exit. + ;; kill-buffer-hook is not called when Emacs is killed, so we + ;; must save all bookmarks first. + (add-hook 'kill-emacs-hook #'(lambda nil + (bm-buffer-save-all) + (bm-repository-save))) + + ;; The `after-save-hook' is not necessary to use to achieve persistence, + ;; but it makes the bookmark data in repository more in sync with the file + ;; state. + (add-hook 'after-save-hook #'bm-buffer-save) + + ;; Restoring bookmarks + (add-hook 'find-file-hooks #'bm-buffer-restore) + (add-hook 'after-revert-hook #'bm-buffer-restore) + + ;; The `after-revert-hook' is not necessary to use to achieve persistence, + ;; but it makes the bookmark data in repository more in sync with the file + ;; state. This hook might cause trouble when using packages + ;; that automatically reverts the buffer (like vc after a check-in). + ;; This can easily be avoided if the package provides a hook that is + ;; called before the buffer is reverted (like `vc-before-checkin-hook'). + ;; Then new bookmarks can be saved before the buffer is reverted. + ;; Make sure bookmarks is saved before check-in (and revert-buffer) + (add-hook 'vc-before-checkin-hook #'bm-buffer-save) + + + :bind (("" . bm-next) + ("S-" . bm-previous) + ("C-" . bm-toggle)) + ) + +(global-set-key (kbd " ") 'bm-next-mouse) +(global-set-key (kbd " ") 'bm-previous-mouse) +(global-set-key (kbd " ") 'bm-toggle-mouse) + +(use-package dumb-jump) (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) (setq xref-show-definitions-function #'xref-show-definitions-completing-read) -(require 'origami) +(use-package origami) (bind-keys :map origami-mode-map ("C-c C-" . origami-toggle-node)) (add-hook 'prog-mode-hook #'origami-mode) -(require 'smartparens-config) -(add-hook 'prog-mode-hook #'smartparens-mode) +(use-package smartparens-config + :config + (add-hook 'prog-mode-hook #'smartparens-mode)) + (bind-keys :map smartparens-mode-map ("C-M-a" . sp-beginning-of-sexp) @@ -227,22 +311,25 @@ Return a list of installed packages or nil for every skipped package." (setq centaur-tabs-enable-key-bindings t centaur-tabs-set-icons t centaur-tabs-set-modified-marker t - centaur-tabs-style "chamfer" + centaur-tabs-style "chamfer" centaur-tabs-gray-out-icons 'buffer)) + +;;(centaur-tabs-group-by-projectile-project) breaks w/ buffers unrelated to projects (centaur-tabs-headline-match) (centaur-tabs-mode 1) +(use-package flycheck) + (add-hook 'after-init-hook #'global-flycheck-mode) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) (add-hook 'css-mode-hook #'rainbow-mode) -(require 'telephone-line) -(telephone-line-mode 1) (when (fboundp 'windmove-default-keybindings) (windmove-default-keybindings)) -(require 'which-key) -(which-key-mode) +(use-package which-key + :config + (which-key-mode)) (use-package dashboard :init @@ -254,7 +341,7 @@ Return a list of installed packages or nil for every skipped package." :ensure t :config (dashboard-setup-startup-hook)) -(require 'multiple-cursors) +(use-package multiple-cursors) (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) (global-set-key (kbd "C->") 'mc/mark-next-like-this) (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) @@ -316,6 +403,10 @@ Return a list of installed packages or nil for every skipped package." (setq projectile-completion-system 'ivy) ;; org settings +(use-package org + :mode ("\\.org\\'" . org-mode) + :config (define-key org-mode-map (kbd "C-c C-r") verb-command-map)) + (setq org-replace-disputed-keys t) (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) diff --git a/emacs_home.el b/emacs_home.el index f27f121..cd1b202 100644 --- a/emacs_home.el +++ b/emacs_home.el @@ -3,11 +3,115 @@ "~/Documents/home-org-mode/untitled_project.org" "~/Documents/home-org-mode/personal.org")) -(set-frame-font "Iosevka:size=16") +(set-frame-font "Iosevka:size=16" nil t) (ensure-package-installed 'rustic) -(use-package rustic) -(setq rustic-lsp-client 'eglot) +(use-package rustic + :config + (setq rustic-lsp-client 'eglot) + (setq rustic-cargo-clippy-trigger-fix 'on-compile)) + +(push 'rustic-clippy flycheck-checkers) +;;(add-hook 'eglot--managed-mode-hook (lambda () (flymake-mode -1))) + +(eval-after-load 'gnus-group + '(progn + (defhydra hydra-gnus-group (:color blue) + " +[_A_] Remote groups (A A) [_g_] Refresh +[_L_] Local groups [_\\^_] List servers +[_c_] Mark all read [_m_] Compose new mail +[_G_] Search mails (G G) [_#_] Mark mail +" + ("A" gnus-group-list-active) + ("L" gnus-group-list-all-groups) + ("c" gnus-topic-catchup-articles) + ("G" dianyou-group-make-nnir-group) + ("g" gnus-group-get-new-news) + ("^" gnus-group-enter-server-mode) + ("m" gnus-group-new-mail) + ("#" gnus-topic-mark-topic) + ("q" nil)) + ;; y is not used by default + (define-key gnus-group-mode-map "y" 'hydra-gnus-group/body))) + +;; gnus-summary-mode +(eval-after-load 'gnus-sum + '(progn + (defhydra hydra-gnus-summary (:color blue) + " +[_s_] Show thread [_F_] Forward (C-c C-f) +[_h_] Hide thread [_e_] Resend (S D e) +[_n_] Refresh (/ N) [_r_] Reply +[_!_] Mail -> disk [_R_] Reply with original +[_d_] Disk -> mail [_w_] Reply all (S w) +[_c_] Read all [_W_] Reply all with original (S W) +[_#_] Mark [_G_] Search mails +" + ("s" gnus-summary-show-thread) + ("h" gnus-summary-hide-thread) + ("n" gnus-summary-insert-new-articles) + ("F" gnus-summary-mail-forward) + ("!" gnus-summary-tick-article-forward) + ("d" gnus-summary-put-mark-as-read-next) + ("c" gnus-summary-catchup-and-exit) + ("e" gnus-summary-resend-message-edit) + ("R" gnus-summary-reply-with-original) + ("r" gnus-summary-reply) + ("W" gnus-summary-wide-reply-with-original) + ("w" gnus-summary-wide-reply) + ("#" gnus-topic-mark-topic) + ("G" dianyou-group-make-nnir-group) + ("q" nil)) + ;; y is not used by default + (define-key gnus-summary-mode-map "y" 'hydra-gnus-summary/body))) + +;; gnus-article-mode +(eval-after-load 'gnus-art + '(progn + (defhydra hydra-gnus-article (:color blue) + " +[_o_] Save attachment [_F_] Forward +[_v_] Play video/audio [_r_] Reply +[_d_] CLI to download stream [_R_] Reply with original +[_b_] Open external browser [_w_] Reply all (S w) +[_f_] Click link/button [_W_] Reply all with original (S W) +[_g_] Focus link/button +" + ("F" gnus-summary-mail-forward) + ("r" gnus-article-reply) + ("R" gnus-article-reply-with-original) + ("w" gnus-article-wide-reply) + ("W" gnus-article-wide-reply-with-original) + ("o" gnus-mime-save-part) + ("v" w3mext-open-with-mplayer) + ("d" w3mext-download-rss-stream) + ("b" w3mext-open-link-or-image-or-url) + ("f" w3m-lnum-follow) + ("g" w3m-lnum-goto) + ("q" nil)) + ;; y is not used by default + (define-key gnus-article-mode-map "y" 'hydra-gnus-article/body))) + +;; message-mode +(eval-after-load 'message + '(progn + (defhydra hydra-message (:color blue) + " +[_c_] Complete mail address +[_a_] Attach file +[_s_] Send mail (C-c C-c) +" + ("c" counsel-bbdb-complete-mail) + ("a" mml-attach-file) + ("s" message-send-and-exit) + ("i" dianyou-insert-email-address-from-received-mails) + ("q" nil)))) + +(defun message-mode-hook-hydra-setup () + (local-set-key (kbd "C-c C-y") 'hydra-message/body)) + +(add-hook 'message-mode-hook 'message-mode-hook-hydra-setup) (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")) diff --git a/gnus.el b/gnus.el new file mode 100644 index 0000000..66345db --- /dev/null +++ b/gnus.el @@ -0,0 +1,132 @@ +(setq user-full-name "Rostyslav Hnatyshyn" + user-mail-address "rostyslav.hnatyshyn@gmail.com") + +(setq message-send-mail-function 'smtpmail-send-it + smtpmail-default-smtp-server "smtp.gmail.com" + smtpmail-smtp-service 587 + smtpmail-local-domain "homepc") + +(require 'nnir) + +(setq gnus-save-newsrc-file nil) +(setq gnus-use-dribble-file nil) + +;; Please note mail folders in `gnus-select-method' have NO prefix like "nnimap+hotmail:" or "nnimap+gmail:" +;; Read feeds/atom through gwene +(setq gnus-select-method '(nntp "news.gwene.org")) + +;; ask encryption password once +(setq epa-file-cache-passphrase-for-symmetric-encryption t) + +;; @see http://gnus.org/manual/gnus_397.html +(add-to-list 'gnus-secondary-select-methods + '(nnimap "gmail-rosty" + (nnimap-address "imap.gmail.com") + (nnimap-server-port 993) + (nnimap-stream ssl) + (nnir-search-engine imap) + ; @see http://www.gnu.org/software/emacs/manual/html_node/gnus/Expiring-Mail.html + ;; press 'E' to expire email + (nnmail-expiry-target "nnimap+gmail-rosty:[Gmail]/Trash") + (nnmail-expiry-wait 90))) + +(add-to-list 'gnus-secondary-select-methods + '(nnimap "gmail-throwaway" + (nnimap-address "imap.gmail.com") + (nnimap-server-port 993) + (nnimap-stream ssl) + (nnir-search-engine imap) + (nnmail-expiry-target "nnimap+gmail-throwaway:[Gmail]/Trash") + (nnmail-expiry-wait 90))) + +(add-to-list 'gnus-secondary-select-methods + '(nnimap "gmail-asu" + (nnimap-address "imap.gmail.com") + (nnimap-server-port 993) + (nnimap-stream ssl) + (nnir-search-engine imap) + (nnmail-expiry-target "nnimap+gmail-asu:[Gmail]/Trash") + (nnmail-expiry-wait 90))) + + +(setq gnus-thread-sort-functions + '(gnus-thread-sort-by-most-recent-date + (not gnus-thread-sort-by-number))) + +;; {{ press "o" to view all groups +(defun my-gnus-group-list-subscribed-groups () + "List all subscribed groups with or without un-read messages" + (interactive) + (gnus-group-list-all-groups 5)) + +(define-key gnus-group-mode-map + ;; list all the subscribed groups even they contain zero un-read messages + (kbd "o") 'my-gnus-group-list-subscribed-groups) +;; }} + +;; Fetch only part of the article if we can. +;; I saw this in someone's .gnus +(setq gnus-read-active-file 'some) + +;; open attachment +(eval-after-load 'mailcap + '(progn + (cond + ;; on macOS, maybe change mailcap-mime-data? + ((eq system-type 'darwin)) + ;; on Windows, maybe change mailcap-mime-data? + ((eq system-type 'windows-nt)) + (t + ;; Linux, read ~/.mailcap + (mailcap-parse-mailcaps))))) + +;; Tree view for groups. +(add-hook 'gnus-group-mode-hook 'gnus-topic-mode) + +;; Threads! I hate reading un-threaded email -- especially mailing +;; lists. This helps a ton! +(setq gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject) + +;; Also, I prefer to see only the top level message. If a message has +;; several replies or is part of a thread, only show the first message. +;; `gnus-thread-ignore-subject' will ignore the subject and +;; look at 'In-Reply-To:' and 'References:' headers. +(setq gnus-thread-hide-subtree t) +(setq gnus-thread-ignore-subject t) + +;; http://www.gnu.org/software/emacs/manual/html_node/gnus/_005b9_002e2_005d.html +(setq gnus-use-correct-string-widths nil) + +(eval-after-load 'gnus-topic + '(progn + (setq gnus-message-archive-group '((format-time-string "sent.%Y"))) + (setq gnus-topic-topology '(("Gnus" visible) + (("gmail-rosty" visible nil nil)) + (("gmail-asu" visible nil nil)) + (("gmail-throwaway" visible nil nil)))) + (setq gnus-topic-alist '(("gmail-rosty" + "nnimap+gmail-rosty:INBOX" + "nnimap+gmail-rosty:[Gmail]/Sent Mail" + "nnimap+gmail-rosty:[Gmail]/Drafts" + "nnimap+gmail-rosty:[Gmail]/Important") + ("gmail-throwaway" + "nnimap+gmail-throwaway:INBOX" + "nnimap+gmail-throwaway:[Gmail]/Sent Mail" + "nnimap+gmail-throwaway:[Gmail]/Drafts" + "nnimap+gmail-throwaway:[Gmail]/Important") + ("gmail-asu" + "nnimap+gmail-asu:INBOX" + "nnimap+gmail-asu:[Gmail]/Sent Mail" + "nnimap+gmail-asu:[Gmail]/Drafts" + "nnimap+gmail-asu:[Gmail]/Important") + ("Gnus"))))) +(setq gnus-posting-styles + '(("gmail-rosty" + (address "Rostyslav Hnatyshyn ") + ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587 rostyslav.hnatyshyn@gmail.com")) + ("gmail-asu" + (address "Rostyslav Hnatyshyn") + ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587 rhnatysh@asu.edu")) + ("gmail-throwaway" + (address "Frosty Snowman ") + ("X-Message-SMTP-Method" "smtp smtp.gmail.com 587 throwawayfrosty@gmail.com"))))