emacs: clean doom config

greenclip now is supported nicely inside `exwm`
This commit is contained in:
Hoang Nguyen 2021-03-01 22:48:10 +03:00
parent 72ca87a115
commit 9e16310d4e
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
5 changed files with 65 additions and 39 deletions

View File

@ -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))

View File

@ -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"))

View File

@ -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

View File

@ -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

View File

@ -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