From 21cd16f6f40557a9fec7a6945b649ebf3f6f3276 Mon Sep 17 00:00:00 2001 From: jabuxas Date: Sun, 9 Feb 2025 19:13:48 -0300 Subject: [PATCH] feat: doom gaming!! :fire: --- desktop/configs/doom/.config/doom/config.el | 65 +++++++++++++++++++ desktop/configs/doom/.config/doom/init.el | 2 +- desktop/configs/fish/.config/fish/config.fish | 1 + .../configs/sway/.config/sway/settings/binds | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/desktop/configs/doom/.config/doom/config.el b/desktop/configs/doom/.config/doom/config.el index 1c8a275..2017e0c 100644 --- a/desktop/configs/doom/.config/doom/config.el +++ b/desktop/configs/doom/.config/doom/config.el @@ -101,3 +101,68 @@ ;; Bind to comma in Evil insert mode (after! evil (define-key evil-insert-state-map (kbd ",") #'my-insert-comma-or-emmet)) + +;; Ensure vterm is loaded +(use-package! vterm + :commands vterm + :config + (setq vterm-kill-buffer-on-exit t)) ; Auto-kill buffer on exit + +(after! vterm + (setq vterm-shell "fish")); Replace "fish" with the path to your Fish binary if needed) + +;; Function to open lazygit in a split +;; (defun +lazygit-in-project () +;; "Open lazygit in a vterm buffer at the project root." +;; (interactive) +;; (let ((default-directory (doom-project-root))) +;; (message "Opening lazygit in %s" default-directory) +;; ;; Open in a side window (adjust height as needed) +;; (pop-to-buffer +;; (generate-new-buffer "*lazygit*") +;; '((display-buffer-in-side-window) +;; (side . bottom) +;; (window-height . 0.5))) +;; ;; Start vterm and run lazygit +;; (vterm-mode) +;; (vterm-send-string "lazygit") +;; (vterm-send-return))) + +(defun +lazygit-in-project () + "Open lazygit in a floating frame and auto-close on exit." + (interactive) + (let* ((default-directory (doom-project-root)) + ;; Create a new floating frame + (frame (make-frame `((name . "lazygit") + (width . 120) + (height . 30) + (minibuffer . nil) + (left . 0.5) ; Center horizontally + (top . 0.5) ; Center vertically + (transient . t) ; Mark as temporary + (no-accept-focus . t)))) + ;; Create a dedicated buffer + (buffer (generate-new-buffer "*lazygit*"))) + ;; Configure the new frame and buffer + (select-frame frame) + (switch-to-buffer buffer) + (vterm-mode) + ;; Launch lazygit + (vterm-send-string "lazygit") + (vterm-send-return) + ;; Bind 'q' to kill buffer and frame + (define-key vterm-mode-map (kbd "q") + (lambda () + (interactive) + (kill-buffer buffer) + (delete-frame frame))) + ;; Auto-close frame when process dies (e.g., lazygit exits) + (let ((proc (get-buffer-process buffer))) + (when proc + (set-process-sentinel proc + (lambda (proc _event) + (when (memq (process-status proc) '(exit signal)) + (kill-buffer buffer) + (delete-frame frame)))))))) + +(map! :leader :n "g g" #'+lazygit-in-project) diff --git a/desktop/configs/doom/.config/doom/init.el b/desktop/configs/doom/.config/doom/init.el index 0ef8a38..0ed38bf 100644 --- a/desktop/configs/doom/.config/doom/init.el +++ b/desktop/configs/doom/.config/doom/init.el @@ -78,7 +78,7 @@ eshell ; the elisp shell that works everywhere ;;shell ; simple shell REPL for Emacs ;;term ; basic terminal emulator for Emacs - ;;vterm ; the best terminal emulation in Emacs + (vterm +pretty) ; the best terminal emulation in Emacs :checkers syntax ; tasing you for every semicolon you forget diff --git a/desktop/configs/fish/.config/fish/config.fish b/desktop/configs/fish/.config/fish/config.fish index 8ed1d56..9b83193 100644 --- a/desktop/configs/fish/.config/fish/config.fish +++ b/desktop/configs/fish/.config/fish/config.fish @@ -28,6 +28,7 @@ if status is-interactive alias poweroff="systemctl poweroff" alias cat="bat" alias dockdom="docker compose -p "ciga-diario" -f CIGA-DIARIO-DEV-LOCALHOST.yml" + alias emackie="emacsclient --socket-name=/run/user/$(id -u)/emacs/server -nw" alias protontricks='flatpak run com.github.Matoking.protontricks' alias protontricks-launch='flatpak run --command=protontricks-launch com.github.Matoking.protontricks' diff --git a/desktop/configs/sway/.config/sway/settings/binds b/desktop/configs/sway/.config/sway/settings/binds index b6f13e4..b09de43 100644 --- a/desktop/configs/sway/.config/sway/settings/binds +++ b/desktop/configs/sway/.config/sway/settings/binds @@ -21,6 +21,7 @@ bindsym $mod+Shift+apostrophe exec ~/scripts/switch.fish bindsym $mod+b exec ~/.local/share/AppImage/ZenBrowser.AppImage bindsym $mod+Shift+d exec flatpak run de.shorsh.discord-screenaudio bindsym $mod+Return exec $term +bindsym $mod+Control+e exec $term -e emacsclient --socket-name=/run/user/1000/emacs/server -nw bindsym $mod+Shift+c kill bindsym $mod+Shift+Return exec $menu floating_modifier $mod normal