diff options
Diffstat (limited to 'tools/emacs/config')
-rw-r--r-- | tools/emacs/config/desktop.el | 2 | ||||
-rw-r--r-- | tools/emacs/config/init.el | 22 | ||||
-rw-r--r-- | tools/emacs/config/look-and-feel.el | 15 | ||||
-rw-r--r-- | tools/emacs/config/modes.el | 3 | ||||
-rw-r--r-- | tools/emacs/config/term-setup.el | 36 |
5 files changed, 13 insertions, 65 deletions
diff --git a/tools/emacs/config/desktop.el b/tools/emacs/config/desktop.el index dcc35383370a..a19b3f6745f4 100644 --- a/tools/emacs/config/desktop.el +++ b/tools/emacs/config/desktop.el @@ -148,7 +148,7 @@ (exwm-input-set-key (kbd "s-p") #'ivy-password-store) ;; Add X11 terminal selector to a key -(exwm-input-set-key (kbd "C-x t") #'counsel-switch-to-terminal) +(exwm-input-set-key (kbd "C-x t") #'ts/switch-to-terminal) ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el index a27a17c6ddc0..7d40813d83f0 100644 --- a/tools/emacs/config/init.el +++ b/tools/emacs/config/init.el @@ -19,11 +19,11 @@ (use-package ace-window :bind (("C-x o" . ace-window)) - :init + :config (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) aw-scope 'frame)) -(use-package auth-source-pass :init (auth-source-pass-enable)) +(use-package auth-source-pass :config (auth-source-pass-enable)) (use-package avy :bind (("M-j" . avy-goto-char) @@ -34,10 +34,11 @@ (use-package company :hook ((prog-mode . company-mode)) - :init (setq company-tooltip-align-annotations t)) + :config (setq company-tooltip-align-annotations t)) (use-package dash) (use-package dash-functional) +(use-package dottime :config (dottime-display-mode t)) (use-package gruber-darker-theme) (use-package ht) (use-package hydra) @@ -46,19 +47,19 @@ (emacs-lisp-mode . paredit-mode))) (use-package multiple-cursors) (use-package pinentry - :init + :config (setq epa-pinentry-mode 'loopback) (pinentry-start)) (use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) (use-package rainbow-mode) (use-package s) -(use-package smartparens :init (smartparens-global-mode)) (use-package string-edit) (use-package telephone-line) ;; configuration happens outside of use-package -(use-package undo-tree :init (global-undo-tree-mode)) +(use-package term-switcher) +(use-package undo-tree :config (global-undo-tree-mode)) (use-package uuidgen) -(use-package which-key :init (which-key-mode t)) +(use-package which-key :config (which-key-mode t)) ;; ;; Applications in emacs @@ -66,7 +67,7 @@ (use-package magit :bind ("C-c g" . magit-status) - :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) + :config (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) (use-package password-store) (use-package pg) @@ -100,7 +101,7 @@ (use-package haskell-mode) (use-package jq-mode - :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) + :config (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) (use-package kotlin-mode :hook ((kotlin-mode . (lambda () @@ -109,7 +110,7 @@ (use-package lsp-mode) (use-package markdown-mode - :init + :config (add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) @@ -151,7 +152,6 @@ settings modes bindings - term-setup eshell-setup)) (telephone-line-setup) (ace-window-display-mode) diff --git a/tools/emacs/config/look-and-feel.el b/tools/emacs/config/look-and-feel.el index 8f42133fb8a0..88cab18ed2e2 100644 --- a/tools/emacs/config/look-and-feel.el +++ b/tools/emacs/config/look-and-feel.el @@ -27,21 +27,6 @@ (font . ,font))) (set-frame-font font t t)) -;; Display modeline time in dottime (see https://dotti.me) -;; -;; This is done in a way that initially seems more complicated than -;; one would like, but this is unfortunately required due to the way -;; `format-time-string' handles timezones. -(defun format-dottime-advice (orig _ &optional _ _) - (let* ((offset-sec (car (current-time-zone))) - (offset-hours (/ offset-sec 60 60)) - (dottime (if (/= offset-hours 0) - (concat "%M-%Dt%H·%M" (format "%0+3d" offset-hours)) - "%m-%dT%H·%M"))) - (apply orig '("%m-%dT%H·%M" nil t)))) - -(advice-add 'format-time-string :around #'format-dottime-advice) - ;; Configure telephone-line (defun telephone-misc-if-last-window () "Renders the mode-line-misc-info string for display in the diff --git a/tools/emacs/config/modes.el b/tools/emacs/config/modes.el index 19ed2a684349..ceef84b9626d 100644 --- a/tools/emacs/config/modes.el +++ b/tools/emacs/config/modes.el @@ -19,8 +19,7 @@ (show-paren-mode 1) ;; Always auto-close parantheses and other pairs -;; (replaced by smartparens) -;; (electric-pair-mode) +(electric-pair-mode) ;; Keep track of recent files (recentf-mode) diff --git a/tools/emacs/config/term-setup.el b/tools/emacs/config/term-setup.el deleted file mode 100644 index cd4f9c25ef73..000000000000 --- a/tools/emacs/config/term-setup.el +++ /dev/null @@ -1,36 +0,0 @@ -;; Utilities for X11 terminal buffers. - -(defvar x11-terminal-program "gnome-terminal" - "Which X11 terminal application to use.") - -(defvar x11-terminal-buffer-prefix "Term" - "String prefix for X11 terminal buffer names.") - -(defun open-or-create-terminal-buffer (buffer-name) - "Switch to the buffer with BUFFER-NAME or create a new buffer - running the configured X11 terminal." - (let ((buffer (get-buffer buffer-name))) - (if (not buffer) - (run-external-command x11-terminal-program) - (switch-to-buffer buffer)))) - -(defun is-terminal-buffer (buffer) - "Determine whether BUFFER runs an X11 terminal." - (and (equal 'exwm-mode (buffer-local-value 'major-mode buffer)) - (s-starts-with? x11-terminal-buffer-prefix (buffer-name buffer)))) - -(defun counsel-switch-to-terminal () - "Switch to an X11 terminal buffer, or create a new one." - (interactive) - (let ((terms (-map #'buffer-name - (-filter #'is-terminal-buffer (buffer-list))))) - (if terms - (ivy-read "Switch to terminal buffer: " - (cons "New terminal" terms) - :caller 'counsel-switch-to-terminal - :preselect (s-concat "^" x11-terminal-buffer-prefix) - :require-match t - :action #'open-or-create-terminal-buffer) - (run-external-command x11-terminal-program)))) - -(provide 'term-setup) |