From 4d963b3b9cdbc239bf9975695d14af7319e3026a Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Wed, 16 Oct 2024 19:26:33 +0200 Subject: updates --- emacs | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------- shrc | 10 +++--- xinitrc | 7 +++-- 3 files changed, 95 insertions(+), 32 deletions(-) diff --git a/emacs b/emacs index cd9bb6b..bb2aadb 100644 --- a/emacs +++ b/emacs @@ -1,10 +1,7 @@ ;; -*- lexical-binding: t; -*- -;; Put Emacs auto-save and backup files to /tmp - (add-to-list 'load-path "~/.emacs.d/elisp") (fset 'yes-or-no-p 'y-or-n-p) (setq - ;; Visual inhibit-startup-screen t default-frame-alist '((font . "Iosevka SS13 Extended") (height . 150) @@ -13,11 +10,6 @@ undo-limit 10000000 undo-outer-limit 20000000 - ;; X integration - ring-bell-function 'ignore - default-directory (concat (getenv "HOME") "/") - focus-follows-mouse t - mouse-autoselect-window t ;; Package list package-list '( magit @@ -46,13 +38,13 @@ ("non-gnu" . "https://elpa.nongnu.org/nongnu/") ("melpa-stable" . "https://stable.melpa.org/packages/"))) -(setq-default fill-column 80 - frame-title-format '("%b")) ;; UI (menu-bar-mode -1) (tool-bar-mode -1) -(tab-bar-mode) + +(setq-default fill-column 80 + frame-title-format '("%b")) (package-initialize) @@ -64,21 +56,25 @@ (unless (package-installed-p package) (package-install package))) +(use-package tab-bar + :init +; (defun me/close-tab-and-buffer +; (lambda () +; (interactive) +; (kill-buffer))) + (tab-bar-mode)) + (use-package exwm :init - (setq exwm-workspace-number 4 + (setq exwm-workspace-number 1 exwm-input-global-keys `(([?\s-r] . exwm-reset) ;; s-r: Reset (to line-mode). - ([?\s-w] . exwm-workspace-switch) ;; s-w: Switch workspace. - ([?\s-&] . (lambda (cmd) ;; s-&: Launch application. - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command cmd nil cmd))) ;; s-N: Switch to certain workspace. ,@(mapcar (lambda (i) `(,(kbd (format "s-%d" i)) . (lambda () (interactive) - (exwm-workspace-switch-create ,i)))) + (tab-bar-select-tab ,i)))) (number-sequence 0 9)))) (exwm-input-set-key (kbd "s-f") (lambda () (interactive) @@ -89,9 +85,19 @@ (exwm-input-set-key (kbd "C-") (lambda () (interactive) (shell-command "scrot -s -F '/home/mccd/screenshots/%Y-%m-%d_$wx$h.png'"))) + (exwm-input-set-key (kbd "s-") + (lambda (cmd) ;; s-&: Launch application. + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command cmd nil cmd))) (exwm-enable) (exwm-xim-mode) (push ?\C-\\ exwm-input-prefix-keys) + :config + (setq + ring-bell-function 'ignore + default-directory (concat (getenv "HOME") "/") + focus-follows-mouse t + mouse-autoselect-window t) :hook (;; Make sure titles match X window (exwm-update-title . (lambda () @@ -142,6 +148,7 @@ backup-directory-alist `((".*" . ,emacs-tmp-dir)))) (use-package minibuffer + :defer t :config (setq completion-cycle-threshold 5 completion-ignore-case t)) @@ -152,6 +159,7 @@ x-select-enable-primary t)) (use-package imenu + :defer t :config (setq imenu-auto-rescan t)) @@ -159,17 +167,61 @@ :init (display-battery-mode t)) +(use-package comint + :bind + ((:repeat-map + repeat-hist-line-map + ("n" . comint-next-input) + ("p" . comint-previous-input)))) + (use-package repeat + :demand t :bind (("C-." . repeat) - (:repeat-map repeat-repeat-map - ("." . repeat))) + (:repeat-map + repeat-repeat-map + ("." . repeat)) + (:repeat-map + repeat-normal-movement-map + ("n" . next-line) + ("b" . backward-char) + ("f" . forward-char) + ("e" . move-end-of-line) + ("M-f" . forward-word) + ("M-b" . backward-word) + ("v" . scroll-up-command) + ("M-v" . scroll-down-command) + ("o" . 'avy-goto-char-timer) + ("a" . move-beginning-of-line) + ("p" . previous-line)) + (:repeat-map + repeat-kill-line-map + ("k" . kill-line)) + (:repeat-map + repeat-delete-word-map + ("d" . kill-word)) + (:repeat-map + repeat-delete-char-map + ("d" . delete-char)) + (:repeat-map + repeat-movement-map + ("e" . end-of-defun) + ("f" . forward-sexp) + ("n" . forward-list) + ("p" . backward-list) + ("d" . down-list) + ("o" . avy-goto-char-timer) + ("u" . up-list) + ("b" . backward-sexp) + ("a" . beginning-of-defun))) :config - (setq repeat-on-final-keystroke t) - (setq set-mark-command-repeat-pop t) +(setq repeat-on-final-keystroke t + set-mark-command-repeat-pop t + repeat-exit-key (kbd "")) (repeat-mode 1)) (use-package org-crypt + :ensure nil :init (setenv "GPG_AGENT_INFO" nil) (setq auth-source-debug t @@ -203,8 +255,9 @@ epa-pinentry-mode 'loopback)) (use-package exwm-mff + :demand t :load-path "elisp" - :config + :init (exwm-mff-mode)) (use-package avy @@ -360,6 +413,8 @@ (diary-mode . org-link-minor-mode) (diary-fancy-display-mode . org-link-minor-mode) (diary-fancy-display-mode . variable-pitch-mode) + (diary-mode . (lambda () + (add-hook 'after-save-hook 'sync-org nil t))) (diary-mode . flyspell-mode)) :config (global-set-key (kbd "C-c d") 'calendar) @@ -696,7 +751,9 @@ '(org-tag ((t (:inherit fixed-pitch :foreground "gray40" :weight regular)))) '(org-time-grid ((t (:foreground "gray")))) '(outline-4 ((t (:inherit outline-2)))) - '(tab-bar ((t (:box (:line-width (12 . 12) :style flat-button) :weight light :family "Iosevka Aile")))) + '(tab-bar ((t (:box (:line-width (12 . 24) :style flat-button) :weight semi-light :family "Iosevka Aile")))) + '(tab-bar-tab ((t (:inherit tab-bar :foreground "black" :box (:line-width (20 . 1) :color "white") :weight semi-bold)))) + '(tab-bar-tab-inactive ((t (:inherit tab-bar-tab :background "white" :foreground "#999999" :weight semi-light)))) '(tldr-code-block ((t (:background "cornsilk" :foreground "black")))) '(tldr-command-argument ((t (:background "cornsilk" :foreground "black")))) '(tldr-command-itself ((t (:background "khaki" :foreground "black" :weight bold)))) @@ -734,7 +791,12 @@ '(org-fold-core-style 'overlays) '(package-selected-packages '(exwm-mff eat pinentry exwm emms company orglink web-mode flycheck nix-mode nix-ts-mode avy pdf-tools elfeed-protocol lem yasnippet-snippets elfeed yasnippet smartparens markdown-mode mastodon tldr almost-mono-themes rec-mode magit go-mode expand-region devdocs)) - '(tab-bar-format '(tab-bar-format-align-right tab-bar-format-global)) + '(tab-bar-auto-width t) + '(tab-bar-close-button-show nil) + '(tab-bar-format + '(tab-bar-format-tabs tab-bar-format-align-right tab-bar-format-global)) + '(tab-bar-position nil) + '(tab-bar-tab-hints t) '(window-divider-default-right-width 2) '(yank-from-kill-ring-rotate t)) (put 'secrets-mode 'disabled nil) diff --git a/shrc b/shrc index 845c21e..9b2eb6f 100644 --- a/shrc +++ b/shrc @@ -44,12 +44,10 @@ notes() { . /home/mccd/.nix-profile/etc/profile.d/nix.sh - -set -o vi - -PS1='\W \$ ' +alias a='pwd' eval "$(zoxide init posix --hook prompt)" - -[ "$(tty)" == "/dev/tty1" ] && exec startx +if [ "$(tty)" = "/dev/tty1" ]; then + exec startx +fi diff --git a/xinitrc b/xinitrc index 7e8d8f4..08a2f2a 100755 --- a/xinitrc +++ b/xinitrc @@ -5,6 +5,8 @@ export XMODIFIERS=@im=exwm-xim export GTK_IM_MODULE=xim export QT_IM_MODULE=xim export CLUTTER_IM_MODULE=xim +export VISUAL=emacsclient +export EDITOR="$VISUAL" xrdb -load ~/.Xresources & autocutsel & xsetroot -solid '#FFFFFF' & @@ -15,7 +17,8 @@ gsettings set org.gnome.desktop.interface font-name 'Iosevka Aile' & gsettings set org.gnome.desktop.interface cursor-size 32 & gsettings set org.gnome.desktop.interface cursor-theme Adwaita & setxkbmap -layout us -variant colemak -option "caps:ctrl_modifier" & -xkbcomp $HOME/.config/keymap_locked_modifier.xkb $DISPLAY & +# xkbcomp $HOME/.config/keymap_locked_modifier.xkb $DISPLAY & xsetroot -cursor_name left_ptr & xset r rate 200 60 & -dbus-run-session emacs +emacs --daemon --eval "(require 'exwm)" -f exwm-enable +exec dbus-run-session emacsclient -c -- cgit v1.2.3