emacs: additional packages

This commit is contained in:
Hoang Nguyen 2021-02-17 08:40:50 +03:00
parent 03fe06eabd
commit 6a243c6853
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
4 changed files with 157 additions and 110 deletions

View File

@ -10,22 +10,22 @@
doom-big-font (font-spec :family "Iosevka Nerd Font" :size 24)
doom-unicode-font (font-spec :family "Symbola" :size 14))
(custom-set-faces!
'(font-lock-comment-face :slant italic))
'(font-lock-comment-face :slant italic))
;; Might speedup all-the-icons
;;(setq inhibit-compacting-font-caches t)
;; Emoji
(after! emojify
(setq emojify-display-style 'unicode))
(setq emojify-display-style 'unicode))
;; Theme
(setq doom-theme 'doom-nord)
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(after! treemacs
(setq doom-themes-treemacs-theme 'doom-colors
doom-themes-treemacs-enable-variable-pitch nil))
(setq doom-themes-treemacs-theme 'doom-colors
doom-themes-treemacs-enable-variable-pitch nil))
;; Pick an image for dashboard
;;(defun random-choice (items)
@ -55,35 +55,35 @@
standard-indent 2
line-spacing 2)
(after! highlight-indent-guides
(setq highlight-indent-guides-method 'character
highlight-indent-guides-responsive t))
(setq highlight-indent-guides-method 'character
highlight-indent-guides-responsive t))
;; Use ranger.el instead of default dired
(after! ranger
(setq ranger-override-dired-mode t
ranger-parent-depth 0
ranger-cleanup-eagerly t
ranger-show-hidden t
ranger-max-preview-size 20
ranger-dont-show-binary t))
(setq ranger-override-dired-mode t
ranger-parent-depth 0
ranger-cleanup-eagerly t
ranger-show-hidden t
ranger-max-preview-size 20
ranger-dont-show-binary t))
;; Projectile
(after! projectile
(setq projectile-project-search-path '("~/Code/")
projectile-auto-discover nil))
(setq projectile-project-search-path '("~/Code/")
projectile-auto-discover nil))
;; Counsel
(after! counsel
(setq counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only))
(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
(setq company-idle-delay 0.5
company-minimum-prefix-length 2)
(setq company-show-numbers nil))
(setq company-idle-delay 0.5
company-minimum-prefix-length 2)
(setq company-show-numbers nil))
(setq lsp-clients-clangd-args '("-j=2"
"--background-index"
"--clang-tidy"
@ -91,11 +91,11 @@
"--pch-storage=memory"
"--header-insertion=iwyu"
"--header-insertion-decorators"))
(after! lsp-clangd (set-lsp-priority! 'clangd 2)) ;; Use clangd instead of default ccls
;;(after! lsp-clangd (set-lsp-priority! 'clangd 2)) ;; Prefer clangd instead of default ccls
;; Quicker which-key
(after! which-key
(setq which-key-idle-delay 0.5))
(setq which-key-idle-delay 0.5))
;; Org mode
(setq org-directory "~/Documents/Org/"
@ -104,53 +104,26 @@
org-journal-dir "~/Documents/Org/Journal/"
org-hide-emphasis-markers t)
;; Spell checker
(after! spell-fu
(setq spell-fu-idle-delay 0.5))
;; Elfeed
(setq rmh-elfeed-org-files (list (expand-file-name "elfeed.org" doom-private-dir)))
;;(add-hook! 'elfeed-search-mode-hook 'elfeed-update)
;; EMMS
;;(emms-all)
;;(emms-default-players)
;;(emms-playing-time 1)
;;(emms-mode-line 1)
;;(setq emms-source-file-default-directory "~/Music/"
;; emms-info-asynchronously 1
;; emms-playlist-buffer-name "*Music*"
;; emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find
;; emms-browser-covers 'emms-browser-cache-thumbnail-async)
;;(setq emms-player-mpd-server-name "localhost"
;; emms-player-mpd-server-port "6600"
;; emms-player-mpd-music-directory "~/Music")
;;(add-to-list 'emms-info-functions 'emms-info-mpd 'emms-info-exiftool)
;;(add-to-list 'emms-player-list 'emms-player-mpd)
;;(map! :leader
;; :desc "Emms playlist"
;; "e a" #'emms-playlist-mode-go
;; :leader
;; :desc "Emms browse by album"
;; "e b" #'emms-browse-by-album
;; :leader
;; :desc "Emms pause track"
;; "e x" #'emms-pause
;; :leader
;; :desc "Emms stop track"
;; "e s" #'emms-stop
;; :leader
;; :desc "Emms previous track"
;; "e p" #'emms-previous
;; :leader
;; :desc "Emms next track"
;; "e n" #'emms-next)
;; Asynchronous bytecode compilation
(use-package! async
:ensure t
:defer t
:init
(dired-async-mode 1)
(async-bytecomp-package-mode 1)
:custom (async-bytecomp-allowed-packages '(all)))
;; Set qutebrowser as the default browser
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "qutebrowser")
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one

View File

@ -1,40 +1,5 @@
;;; exwm.el -*- lexical-binding: t; -*-
(defun exwm-config--fix/ido-buffer-window-other-frame ()
"Fix `ido-buffer-window-other-frame'."
(defalias 'exwm-config-ido-buffer-window-other-frame
(symbol-function #'ido-buffer-window-other-frame))
(defun ido-buffer-window-other-frame (buffer)
"This is a version redefined by EXWM.
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
(with-current-buffer (window-buffer (selected-window))
(if (and (derived-mode-p 'exwm-mode)
exwm--floating-frame)
;; Switch from a floating frame.
(with-current-buffer buffer
(if (and (derived-mode-p 'exwm-mode)
exwm--floating-frame
(eq exwm--frame exwm-workspace--current))
;; Switch to another floating frame.
(frame-root-window exwm--floating-frame)
;; Do not switch if the buffer is not on the current workspace.
(or (get-buffer-window buffer exwm-workspace--current)
(selected-window))))
(with-current-buffer buffer
(when (derived-mode-p 'exwm-mode)
(if (eq exwm--frame exwm-workspace--current)
(when exwm--floating-frame
;; Switch to a floating frame on the current workspace.
(frame-selected-window exwm--floating-frame))
;; Do not switch to exwm-mode buffers on other workspace (which
;; won't work unless `exwm-layout-show-all-buffers' is set)
(unless exwm-layout-show-all-buffers
(selected-window)))))))))
(defun exwm-config-ido ()
"Configure Ido to work with EXWM."
(add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame))
(defun follie/run-in-background (command)
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
@ -71,9 +36,11 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
(defun follie/update-displays ()
(lambda ()
(start-process-shell-command "xrandr" nil "xrandr --output eDP-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal"))
(start-process-shell-command
"xrandr" nil "xrandr --output eDP-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal"))
(follie/set-wallpaper)
(message "Displays updated"))
(message "Updated displays: %s"
(string-trim (shell-command-to-string "xrandr | grep \" connected\" | awk '{print $1}' | sed '$!N;s/\\n/ /'"))))
(use-package! exwm
:config
@ -87,12 +54,17 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
(add-hook 'exwm-update-title-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; Force tiling by default
(setq exwm-manage-force-tiling t)
;; Window rules
(add-hook 'exwm-manage-finish-hook #'follie/configure-window-by-class)
;; Automatically move EXWM buffer to current workspace
;;(setq exwm-layout-show-all-buffers t)
(setq exwm-layout-show-all-buffers t)
;; Display all buffers in every workspace buffer list
(setq exwm-workspace-show-all-buffers t)
@ -119,13 +91,14 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
;; Keys that always pass through to Emacs in line-mode
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j)) ;; Buffer list
?\C-u
?\C-g ;; keyboard-quit
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j)) ;; Buffer list
;; Ctrl+q to enable next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
@ -163,7 +136,101 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
;; Enable EXWM
(exwm-enable)
;; Work around ido frame
(exwm-config-ido))
(require 'exwm-config)
(exwm-config-ido)
(ido-mode nil))
;; Edit everthing in X windows with Emacs
(use-package! exwm-edit
:after exwm
:config
(exwm-input-set-key (kbd "s-e") #'exwm-edit--compose))
;; xbps in Emacs
(use-package! system-packages
:config
(setq system-packages-use-sudo t))
;; EMMS
;;(use-package! emms
;; :init
;; (setq emms-seek-seconds 10)
;; :config
;; (require 'emms-setup)
;; (emms-all)
;; (emms-default-players)
;; ;; Play music with emms directly
;; (setq emms-source-file-default-directory "~/Music/"
;; emms-info-asynchronously 1
;; emms-playlist-buffer-name "*EMMS-Music*"
;; emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find
;; emms-browser-covers 'emms-browser-cache-thumbnail-async)
;; ;; Or use mpd backend
;; ;;(require 'emms-player-mpd)
;; ;;(setq emms-player-mpd-server-name "localhost"
;; ;; emms-player-mpd-server-port "6600"
;; ;; emms-player-mpd-music-directory "~/Music")
;; ;;(add-to-list 'emms-player-list 'emms-player-mpd)
;; (add-to-list 'emms-info-functions
;; ;;'emms-info-mpd
;; 'emms-info-exiftool))
;; Key maps for emms
;;(map! :leader
;; :desc "Emms playlist"
;; "e a" #'emms-playlist-mode-go
;; :leader
;; :desc "Emms browse by album"
;; "e b" #'emms-browse-by-album
;; :leader
;; :desc "Emms pause track"
;; "e x" #'emms-pause
;; :leader
;; :desc "Emms stop track"
;; "e s" #'emms-stop
;; :leader
;; :desc "Emms previous track"
;; "e p" #'emms-previous
;; :leader
;; :desc "Emms next track"
;; "e n" #'emms-next)
;; Truncate emms module on mode line
;;(use-package! emms-mode-line-cycle
;; :after emms
;; :config
;; (emms-playing-time 1)
;; (emms-mode-line 1)
;; (emms-mode-line-cycle 1))
;; Function keys
(use-package! desktop-environment
:after exwm
:config (desktop-environment-mode)
:custom
;; Brightness
(desktop-environment-brightness-get-command "brightnessctl")
(desktop-environment-brightness-get-regexp "\\([0-9]+%\\)")
(desktop-environment-brightness-set-command "brightnessctl set %s")
(desktop-environment-brightness-small-increment "2%+")
(desktop-environment-brightness-small-decrement "2%-")
(desktop-environment-brightness-normal-increment "5%+")
(desktop-environment-brightness-normal-decrement "5%-")
;; Volume
(desktop-environment-volume-get-command "pulsemixer --get-volume")
(desktop-environment-volume-get-regexp "\\([0-9]+ \\)")
(desktop-environment-volume-toggle-command "pulsemixer --toggle-mute")
(desktop-environment-volume-toggle-microphone-command nil)
(desktop-environment-volume-set-command "pulsemixer --change-volume %s")
(desktop-environment-volume-small-increment "+2")
(desktop-environment-volume-small-decrement "-2")
(desktop-environment-volume-normal-increment "+5")
(desktop-environment-volume-normal-decrement "-5")
;; Screenshot
(desktop-environment-screenshot-directory "~/Screenshots")
(desktop-environment-screenshot-command "scrot -m -q 100 '%Y-%m-%d-%T_$wx$h.png'")
(desktop-environment-screenshot-partial-command
"scrot -s -f -l style=solid,width=2,color=\"red\" -q 100 '%Y-%m-%d-%T_$wx$h.png'")
;; Screenlock
(desktop-environment-screenlock-command "~/.local/bin/X11/i3lock.sh"))
;; Control dunst
(defun follie/disable-desktop-notifications ()

View File

@ -56,7 +56,8 @@
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
;;vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
(window-select ; visually switch windows
+numbers)
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
@ -91,8 +92,10 @@
:checkers
syntax ; tasing you for every semicolon you forget
;;spell ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
(spell ; tasing you for misspelling mispelling
+hunspell
+everywhere)
grammar ; tasing grammar mistake every you make
:tools
;;ansible
@ -148,17 +151,18 @@
(javascript +lsp) ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
(latex ; writing papers in Emacs has never been so fun
+latexmk
+cdlatex
+fold)
;;(latex ; writing papers in Emacs has never been so fun
;; +latexmk
;; +cdlatex
;; +fold)
;;lean
;;factor
;;ledger ; an accounting system in Emacs
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
(markdown ; writing docs for people to ignore
+grip)
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org ; organize your plain life in plain text
+pretty

View File

@ -51,8 +51,11 @@
;; Emacs is an OS
(package! exwm)
(package! exwm-edit)
(package! system-packages)
(package! desktop-environment)
;;(package! emms)
;;(package! emms-mode-line-cycle)
;; Syntax
(package! vimrc-mode)