From 9e16310d4efa5c103edcd762bae0eefec969336e Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Mon, 1 Mar 2021 22:48:10 +0300 Subject: [PATCH] emacs: clean doom config greenclip now is supported nicely inside `exwm` --- home/.config/doom/config.el | 49 +++++++++++++++++-------------- home/.config/doom/exwm.el | 42 +++++++++++++++++++------- home/.config/doom/init.el | 8 ++--- home/.config/doom/packages.el | 4 +-- home/.config/fish/conf.d/env.fish | 1 + 5 files changed, 65 insertions(+), 39 deletions(-) diff --git a/home/.config/doom/config.el b/home/.config/doom/config.el index 023c53d..f150615 100644 --- a/home/.config/doom/config.el +++ b/home/.config/doom/config.el @@ -83,6 +83,11 @@ projectile-auto-discover nil)) ;; Ivy / Counsel +(after! counsel + (setq counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)) +(map! "C-M-j" 'counsel-switch-buffer) +(map! :map minibuffer-local-map + "C-r" 'counsel-minibuffer-history) (use-package! all-the-icons-ivy-rich :after counsel-projectile :init (all-the-icons-ivy-rich-mode 1) @@ -90,11 +95,6 @@ (setq all-the-icons-ivy-rich-icon-size 1.0)) (use-package! ivy-rich :after all-the-icons-ivy-rich) -(after! counsel - (setq counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)) -(map! "C-M-j" 'counsel-switch-buffer) -(map! :map minibuffer-local-map - "C-r" 'counsel-minibuffer-history) ;; Completion + lsp (after! company @@ -114,46 +114,51 @@ (after! which-key (setq which-key-idle-delay 0.5)) -;; Org mode +;; Org (setq org-directory "~/Documents/Org/" - org-journal-dir "~/Documents/Org/journal/" - org-agenda-files '("~/Documents/Org/agenda.org") - org-noter-notes-search-path '("~/Documents/Org/notes/") - org-default-notes-file (expand-file-name "notes.org" org-directory) + org-default-notes-file "~/Documents/Org/notes.org" + org-agenda-files '("~/Documents/Org/agenda/agenda.org" "~/Documents/Org/agenda/archive.org") + org-confirm-babel-evaluate nil org-ellipsis "▾" org-hide-emphasis-markers t) (defun follie/comfy-org-editing () - (setq visual-fill-column-width 160 + (setq visual-fill-column-width 120 visual-fill-column-center-text t) (visual-fill-column-mode 1) - ;;(org-superstar-mode 1) (display-line-numbers-mode -1)) (add-hook 'org-mode-hook 'follie/comfy-org-editing) +(defun follie/org-toggle-emphasis-markers () + "Toggle emphasis markers in an Org buffer" + (interactive) + (if org-hide-emphasis-markers + (setq org-hide-emphasis-markers nil) + (setq org-hide-emphasis-markers t)) + (org-mode-restart)) +(map! :map org-mode-map + :localleader :desc "org-toggle-emphasis-markers" + "z" #'follie/org-toggle-emphasis-markers) +;; Org-tree-slide (use-package! org-tree-slide :commands org-tree-slide-mode :config - ;;(org-tree-slide-presentation-profile) (advice-remove 'org-tree-slide--display-tree-with-narrow #'+org-present--narrow-to-subtree-a) (setq +org-present-text-scale 2 org-tree-slide-skip-outline-level 0 org-tree-slide-modeline-display nil - org-tree-slide-header t + org-tree-slide-header nil org-tree-slide-slide-in-effect t + org-tree-slide-breadcrumbs " ▶ " org-tree-slide-activate-message "Presentation starto..." org-tree-slide-deactivate-message "Thanks for listening!")) +;; Org-noter +(setq org-noter-notes-search-path '("~/Documents/Org/noter/")) +;; Org-journal +(setq org-journal-dir "~/Documents/Org/journal/") ;; Spell checker (after! flyspell (setq flyspell-lazy-idle-seconds 2)) -;; Asynchronous bytecode compilation -(use-package! async - :defer t - :init - (dired-async-mode 1) - (async-bytecomp-package-mode 1) - :custom (async-bytecomp-allowed-packages '(all))) - ;; Magit (after! magit (setq magit-diff-refine-hunk 'all)) diff --git a/home/.config/doom/exwm.el b/home/.config/doom/exwm.el index e7a065e..ce64409 100644 --- a/home/.config/doom/exwm.el +++ b/home/.config/doom/exwm.el @@ -147,7 +147,8 @@ (exwm-workspace-switch-create ,i)))) (number-sequence 0 9)))) ;; Additional bindings for convenience - (exwm-input-set-key (kbd "s-s") 'eshell) + (exwm-input-set-key (kbd "s-s") '+eshell/toggle) + (exwm-input-set-key (kbd "s-v") '+vterm/here) (exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app) (exwm-input-set-key (kbd "s-t") 'exwm-floating-toggle-floating) (exwm-input-set-key (kbd "s-f") 'exwm-layout-toggle-fullscreen) @@ -205,6 +206,7 @@ ;; EMMS ;; (use-package! emms +;; :after exwm ;; :init ;; (setq emms-seek-seconds 10) ;; :config @@ -302,23 +304,43 @@ ;; Control dunst (defun close-desktop-notifications () + "Close all current notifications" (interactive) (start-process-shell-command "dunstctl" nil "dunstctl close-all")) (defun toggle-desktop-notifications () + "Toggle desktop notification on/off" (interactive) (start-process-shell-command "dunstctl" nil "dunstctl set-paused toggle")) -;; Clipboard managing with greenclip +;; Clipboard management +(defun greenclip--select-item (str) + "Copy selected item to clipboard" + (setq str (replace-regexp-in-string "\u00a0" "\n" str)) + ;; (kill-new str) + (condition-case nil + (cond + ((fboundp 'ns-set-pasteboard) + (ns-set-pasteboard str)) + ((fboundp 'gui-set-selection) + (gui-set-selection 'CLIPBOARD str)) + (t + (error "No clipboard support"))) + (error + (with-temp-buffer + (insert str) + (if (file-executable-p "xsel") + (call-process-region (point-min) (point-max) "xsel" nil nil nil "--clipboard" "--input") + (call-process-region (point-min) (point-max) "xclip" nil nil nil "-selection clipboard" "--input")))))) (defun ivy-greenclip () - "Select an item from clipboard history and re-copy it" + "Select an item from X clipboard history" (interactive) (let* ((history (split-string (shell-command-to-string "greenclip print") "[\r\n]+"))) - (ivy-read "Copy item from entry: " + (ivy-read "Clipboard item: " history - :action (lambda (item) - ;; Kind of work, though fish-shell is not happy - (shell-command (concat "greenclip print '" item "'")))))) -(defun greenclip-clean () - "Clean clipboard history cache" + :action (lambda (str) + (greenclip--select-item str))))) +(defun greenclip-clear-history () + "Clear clipboard history cache" (interactive) - (start-process-shell-command "greenclip" nil "pkill greenclip && greenclip clear && greenclip daemon")) + (start-process-shell-command "greenclip" nil "pkill greenclip && greenclip clear") + (follie/run-in-background "greenclip daemon")) diff --git a/home/.config/doom/init.el b/home/.config/doom/init.el index 23b654a..b10ccf3 100644 --- a/home/.config/doom/init.el +++ b/home/.config/doom/init.el @@ -21,13 +21,13 @@ :completion (company ; the ultimate code completion backend - +childframe) + +childframe) ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... (ivy ; a search engine for love and life - +fuzzy - ;;+prescient - +icons) + +fuzzy + ;;+prescient + +icons) :ui ;;deft ; notational velocity for Emacs diff --git a/home/.config/doom/packages.el b/home/.config/doom/packages.el index c0b19fc..7bdae6f 100644 --- a/home/.config/doom/packages.el +++ b/home/.config/doom/packages.el @@ -63,10 +63,8 @@ ;;(package! ivy-emms) ;;(package! edwina) -;; Additional modes -(package! vimrc-mode) - ;; Improvements +(package! vimrc-mode) (package! magit-delta) (package! all-the-icons-ivy-rich) (package! nerd-fonts diff --git a/home/.config/fish/conf.d/env.fish b/home/.config/fish/conf.d/env.fish index ed128fb..5ed465a 100644 --- a/home/.config/fish/conf.d/env.fish +++ b/home/.config/fish/conf.d/env.fish @@ -9,6 +9,7 @@ set -g fish_cursor_default block set -g fish_cursor_insert line set -g fish_cursor_replace_one underscore set -g fish_cursor_visual block +set -g fish_vi_force_cursor # no greeting set -g fish_greeting