feat: doom gaming!! 🔥

This commit is contained in:
jabuxas 2025-02-09 19:13:48 -03:00
parent aba9595d37
commit 21cd16f6f4
4 changed files with 68 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -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'

View File

@ -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