From d9d8aad29a212f75a10459e425562254ecc0d7d7 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 8 Sep 2023 15:23:32 +0300 Subject: stumpwm: update keybindings --- .emacs.d/modules/thanos-eshell.el | 170 -------------------------------------- .emacs.d/modules/thanos-shells.el | 163 ++++++++++++++++++++++++++++++++++++ .stumpwm.d/keybindings.lisp | 3 +- 3 files changed, 164 insertions(+), 172 deletions(-) delete mode 100644 .emacs.d/modules/thanos-eshell.el create mode 100644 .emacs.d/modules/thanos-shells.el diff --git a/.emacs.d/modules/thanos-eshell.el b/.emacs.d/modules/thanos-eshell.el deleted file mode 100644 index 8d5e164..0000000 --- a/.emacs.d/modules/thanos-eshell.el +++ /dev/null @@ -1,170 +0,0 @@ -;;; thanos-eshell.el --- eshell configuration -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo -;; Keywords: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -(setenv "EDITOR" "emacsclient -n") -(setenv "DEBEMAIL" "public@thanosapollo.com") -(setenv "DEBNAME" "Thanos Apollo") -;; configuration with eat -(require 'eshell) -(require 'eat) - -(setf eshell-visual-commands '()) -(eat-eshell-mode 1) - -;;;; sudo completion -(defun pcomplete/sudo () - "Completion rules for the `sudo' command." - (let ((pcomplete-ignore-case t)) - (pcomplete-here (funcall pcomplete-command-completion-function)) - (while (pcomplete-here (pcomplete-entries))))) - -;;;; systemctl completion -(defcustom pcomplete-systemctl-commands - '("disable" "enable" "status" "start" "restart" "stop" "reenable" - "list-units" "list-unit-files") - "p-completion candidates for `systemctl' main commands" - :type '(repeat (string :tag "systemctl command")) - :group 'pcomplete) - -(defvar pcomplete-systemd-units - (split-string - (shell-command-to-string - "(systemctl list-units --all --full --no-legend;systemctl list-unit-files --full --no-legend)|while read -r a b; do echo \" $a\";done;")) - "p-completion candidates for all `systemd' units") - -(defvar pcomplete-systemd-user-units - (split-string - (shell-command-to-string - "(systemctl list-units --user --all --full --no-legend;systemctl list-unit-files --user --full --no-legend)|while read -r a b;do echo \" $a\";done;")) - "p-completion candidates for all `systemd' user units") - -(defun pcomplete/systemctl () - "Completion rules for the `systemctl' command." - (pcomplete-here (append pcomplete-systemctl-commands '("--user"))) - (cond ((pcomplete-test "--user") - (pcomplete-here pcomplete-systemctl-commands) - (pcomplete-here pcomplete-systemd-user-units)) - (t (pcomplete-here pcomplete-systemd-units)))) - -;;;; man completion -(defvar pcomplete-man-user-commands - (split-string - (shell-command-to-string - "apropos -s 1 .|while read -r a b; do echo \" $a\";done;")) - "p-completion candidates for `man' command") - -(defun pcomplete/man () - "Completion rules for the `man' command." - (pcomplete-here pcomplete-man-user-commands)) - -;; hut completion -(defcustom pcomplete-hut-commands - '("builds" "export" "git" "graphql" "lists" "help" "hg" - "init" "meta" "pages" "paste" "todo") - "p-completion candidates for `hut' main commands" - :type '(repeat (string :tag "hut command")) - :group 'pcomplete) - -(defun pcomplete/hut () - "Completion rules for `hut' command" - (pcomplete-here (append pcomplete-hut-commands))) - -(setq thanos/eshell-aliases - '((g . magit) - (gl . magit-log) - (gc . magit-clone) - (d . dired) - (o . find-file) - (oo . find-file-other-window) - (ll . (lambda () (eshell/ls '-lha))) - (eshell/clear . eshell/clear-scrollback))) - -;; Define aliases using `mapc` -(mapc (lambda (alias) - (defalias (car alias) (cdr alias))) - thanos/eshell-aliases) - -;; PATH -(defvar eshell-path-env (getenv "~/.local/bin")) - -(require 'eshell-git-prompt) -;; customize multiline theme -(defun eshell-git-prompt-multiline () - "Eshell Git prompt inspired by spaceship-prompt." - (let (separator hr dir git git-dirty time sign command) - (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) - (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) - (setq dir - (concat - (concat (abbreviate-file-name (eshell/pwd))))) - (setq git - (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) - (concat (eshell-git-prompt--branch-name)))) - (setq git-dirty - (when (eshell-git-prompt--branch-name) - (if (eshell-git-prompt--collect-status) - (with-face " ✎" 'eshell-git-prompt-modified-face) - (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) - (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face)) - (setq sign - (if (= (user-uid) 0) - (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) - (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) - (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) - - - (eshell-git-prompt---str-read-only - (concat hr dir separator git git-dirty separator time sign command)))) - -(eshell-git-prompt-use-theme 'multiline) - -(eshell-syntax-highlighting-global-mode 1) - -(setq eshell-highlight-prompt t) - - -(define-prefix-command 'thanos/eshell-map) -(global-set-key (kbd "C-c e") 'thanos/eshell-map) - -(define-key thanos/eshell-map (kbd "o") 'multi-eshell) -(define-key thanos/eshell-map (kbd "n") 'multi-eshell-switch) - -(defvar thanos/vterm-map (make-sparse-keymap)) -(define-prefix-command 'thanos/vterm-map) -(define-key global-map (kbd "C-c v") 'thanos/vterm-map) -(define-key thanos/vterm-map (kbd "n") 'multi-vterm-next) -(define-key thanos/vterm-map (kbd "p") 'multi-vterm-prev) -(define-key thanos/vterm-map (kbd "d") 'multi-vterm-dedicated-open) -(define-key thanos/vterm-map (kbd "o") 'multi-vterm) - - -(provide 'thanos-eshell) -;;; thanos-eshell.el ends here diff --git a/.emacs.d/modules/thanos-shells.el b/.emacs.d/modules/thanos-shells.el new file mode 100644 index 0000000..36552d4 --- /dev/null +++ b/.emacs.d/modules/thanos-shells.el @@ -0,0 +1,163 @@ +;;; thanos-shell.el --- shells configuration -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Thanos Apollo + +;; Author: Thanos Apollo +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: +;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ +;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ +;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ +;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ +;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ +;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ +;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ +;;; Code: + +(setenv "EDITOR" "emacsclient -n") +(setenv "DEBEMAIL" "public@thanosapollo.com") +(setenv "DEBNAME" "Thanos Apollo") +(setenv "SBCL_HOME" "/usr/local/lib/sbcl") +(setenv "XDG_SESSION_TYPE" "x11") + +;; configuration with eat +(require 'eshell) +(require 'eat) + +(setf eshell-visual-commands '()) +(eat-eshell-mode 1) + +;;;; sudo completion +(defun pcomplete/sudo () + "Completion rules for the `sudo' command." + (let ((pcomplete-ignore-case t)) + (pcomplete-here (funcall pcomplete-command-completion-function)) + (while (pcomplete-here (pcomplete-entries))))) + +;;;; systemctl completion +(defcustom pcomplete-systemctl-commands + '("disable" "enable" "status" "start" "restart" "stop" "reenable" + "list-units" "list-unit-files") + "p-completion candidates for `systemctl' main commands" + :type '(repeat (string :tag "systemctl command")) + :group 'pcomplete) + +(defvar pcomplete-systemd-units + (split-string + (shell-command-to-string + "(systemctl list-units --all --full --no-legend;systemctl list-unit-files --full --no-legend)|while read -r a b; do echo \" $a\";done;")) + "p-completion candidates for all `systemd' units") + +(defvar pcomplete-systemd-user-units + (split-string + (shell-command-to-string + "(systemctl list-units --user --all --full --no-legend;systemctl list-unit-files --user --full --no-legend)|while read -r a b;do echo \" $a\";done;")) + "p-completion candidates for all `systemd' user units") + +(defun pcomplete/systemctl () + "Completion rules for the `systemctl' command." + (pcomplete-here (append pcomplete-systemctl-commands '("--user"))) + (cond ((pcomplete-test "--user") + (pcomplete-here pcomplete-systemctl-commands) + (pcomplete-here pcomplete-systemd-user-units)) + (t (pcomplete-here pcomplete-systemd-units)))) + +;;;; man completion +(defvar pcomplete-man-user-commands + (split-string + (shell-command-to-string + "apropos -s 1 .|while read -r a b; do echo \" $a\";done;")) + "p-completion candidates for `man' command") + +(defun pcomplete/man () + "Completion rules for the `man' command." + (pcomplete-here pcomplete-man-user-commands)) + +;; hut completion +(defcustom pcomplete-hut-commands + '("builds" "export" "git" "graphql" "lists" "help" "hg" + "init" "meta" "pages" "paste" "todo") + "p-completion candidates for `hut' main commands" + :type '(repeat (string :tag "hut command")) + :group 'pcomplete) + +(defun pcomplete/hut () + "Completion rules for `hut' command" + (pcomplete-here (append pcomplete-hut-commands))) + +(setq thanos/eshell-aliases + '((g . magit) + (gl . magit-log) + (gc . magit-clone) + (d . dired) + (o . find-file) + (oo . find-file-other-window) + (ll . (lambda () (eshell/ls '-lha))) + (eshell/clear . eshell/clear-scrollback))) + +;; Define aliases using `mapc` +(mapc (lambda (alias) + (defalias (car alias) (cdr alias))) + thanos/eshell-aliases) + +;; PATH +(defvar eshell-path-env (getenv "~/.local/bin")) + +(require 'eshell-git-prompt) + +;; customize multiline theme +(defun eshell-git-prompt-multiline () + "Eshell Git prompt inspired by spaceship-prompt." + (let (separator hr dir git git-dirty time sign command) + (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face)) + (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face)) + (setq dir + (concat + (concat (abbreviate-file-name (eshell/pwd))))) + (setq git + (concat (with-face "⎇" 'eshell-git-prompt-exit-success-face) + (concat (eshell-git-prompt--branch-name)))) + (setq git-dirty + (when (eshell-git-prompt--branch-name) + (if (eshell-git-prompt--collect-status) + (with-face " ✎" 'eshell-git-prompt-modified-face) + (with-face " ✔" 'eshell-git-prompt-exit-success-face)))) + (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face)) + (setq sign + (if (= (user-uid) 0) + (with-face "\n#" 'eshell-git-prompt-multiline-sign-face) + (with-face "\nλ" 'eshell-git-prompt-multiline-sign-face))) + (setq command (with-face " " 'eshell-git-prompt-multiline-command-face)) + + + (eshell-git-prompt---str-read-only + (concat hr dir separator git git-dirty separator time sign command)))) + +(eshell-git-prompt-use-theme 'multiline) + +(eshell-syntax-highlighting-global-mode 1) + +(setq eshell-highlight-prompt t) + +;; Keybindings +(define-key global-map (kbd "C-c e") 'eshell) +(define-key global-map (kbd "C-c v") 'vterm) + + +(provide 'thanos-shells) +;;; thanos-eshell.el ends here diff --git a/.stumpwm.d/keybindings.lisp b/.stumpwm.d/keybindings.lisp index 1bb7caa..3bf5a2a 100644 --- a/.stumpwm.d/keybindings.lisp +++ b/.stumpwm.d/keybindings.lisp @@ -10,8 +10,7 @@ (define-key *root-map* (kbd "C-r") "exec emacsclient -e '(thanos/app-launcher\)'") (define-key *root-map* (kbd ",") "exec flameshot gui") -(define-key *root-map* (kbd "C-R") "restart-hard") -(define-key *root-map* (kbd "M-r") "restart-soft") +(define-key *root-map* (kbd "M-r") "restart-hard") (define-key *root-map* (kbd "p") "exec emacsclient -e '(thanos/pass-launcher)'") (define-key *root-map* (kbd "F") "float-this") (define-key *root-map* (kbd "U") "unfloat-this") -- cgit v1.2.3