Setup modernisation, re-init and use EXWM

This commit is contained in:
Curt Spark 2024-12-11 22:42:25 +00:00
parent f0367da0d4
commit 5b770758d0
2 changed files with 161 additions and 14 deletions

View File

@ -53,6 +53,16 @@ Add hook to enable display-line-numbers-mode on all programming major modes:
#+BEGIN_SRC emacs-lisp
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+END_SRC
*** Relative Line Numbers
Relative line numbers
#+BEGIN_SRC emacs-lisp
(setq display-line-numbers 'relative)
#+END_SRC
*** Tab Width
Change tab width.
#+BEGIN_SRC emacs-lisp
(setq-default tab-width 8)
#+END_SRC
*** Window Gaps/Dividers
Window Dividers/Gaps for windows, you can also use the mouse to resize the windows within the gaps.
@ -139,6 +149,7 @@ Install and set the theme, ensuring that it is always installed:
doom-themes-enable-italic t)) ; if nil, italics is universally disabled
(load-theme 'doom-gruvbox-light t)
;; (load-theme 'doom-homage-black t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
@ -553,6 +564,18 @@ Install the package, enable it and ensure that it always is installed, and then
:init
(evil-mode 1))
#+END_SRC
*** Cursor Theming
#+BEGIN_SRC emacs-lisp
(setq evil-default-cursor '("black" box)
evil-normal-state-cursor '("black" box)
evil-emacs-state-cursor '("black" box)
evil-motion-state-cursor '("black" box)
evil-insert-state-cursor '("black" bar)
evil-visual-state-cursor '("black" hbar)
evil-replace-state-cursor '("black" hbar))
#+END_SRC
** Projectile
Projectile is a project manager, like a dynamic bookmarking system. It will automatically add repositories as projects which you can access via Dired or Ivy completion.
Install the package, enable it and ensure that it always is installed, and then make sure that projectile-mode is enabled by default:
@ -741,6 +764,96 @@ lua-mode is a major mode for editing Lua sources in Emacs.
(add-to-list 'auto-mode-alist '("\\.iy\\'" . lua-mode))
#+END_SRC
** Snippets
YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates.
#+BEGIN_SRC emacs-lisp
(use-package yasnippet
:ensure t
:init
(yas-global-mode 1))
(use-package yasnippet-snippets
:ensure t)
#+END_SRC
** Emmet Mode
Provides support for Zen Coding by producing HTML from CSS-like selectors
#+BEGIN_SRC emacs-lisp
(use-package emmet-mode
:ensure t
:init
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook 'emmet-mode)
(add-hook 'js-mode-hook 'emmet-mode))
(define-key emmet-mode-keymap (kbd "C-j") 'emmet-expand-yas)
#+END_SRC
** Prettier Mode
The prettier Emacs package reformats your code by running Prettier with minimal overhead, by request or transparently on file save.
#+BEGIN_SRC emacs-lisp
(use-package prettier
:ensure t
:init
(add-hook 'after-init-hook #'global-prettier-mode)
:hook ((jtsx-jsx-mode . prettier-mode)
(jtsx-tsx-mode . prettier-mode)
(jtsx-typescript-mode . prettier-mode)))
#+END_SRC
** TSX Mode
A batteries-included Emacs major mode for TSX/JSX files.
#+BEGIN_SRC emacs-lisp
(use-package jtsx
:ensure t
:mode (("\\.jsx?\\'" . jtsx-jsx-mode)
("\\.tsx\\'" . jtsx-tsx-mode)
("\\.ts\\'" . jtsx-typescript-mode))
:commands jtsx-install-treesit-language
:hook ((jtsx-jsx-mode . hs-minor-mode)
(jtsx-tsx-mode . hs-minor-mode)
(jtsx-typescript-mode . hs-minor-mode))
:custom
;; Optional customizations
;; (js-indent-level 2)
;; (typescript-ts-mode-indent-offset 2)
;; (jtsx-switch-indent-offset 0)
;; (jtsx-indent-statement-block-regarding-standalone-parent nil)
;; (jtsx-jsx-element-move-allow-step-out t)
;; (jtsx-enable-jsx-electric-closing-element t)
;; (jtsx-enable-electric-open-newline-between-jsx-element-tags t)
;; (jtsx-enable-jsx-element-tags-auto-sync nil)
(jtsx-enable-all-syntax-highlighting-features t)
:config
(defun jtsx-bind-keys-to-mode-map (mode-map)
"Bind keys to MODE-MAP."
(define-key mode-map (kbd "C-c C-j") 'jtsx-jump-jsx-element-tag-dwim)
(define-key mode-map (kbd "C-c j o") 'jtsx-jump-jsx-opening-tag)
(define-key mode-map (kbd "C-c j c") 'jtsx-jump-jsx-closing-tag)
(define-key mode-map (kbd "C-c j r") 'jtsx-rename-jsx-element)
(define-key mode-map (kbd "C-c <down>") 'jtsx-move-jsx-element-tag-forward)
(define-key mode-map (kbd "C-c <up>") 'jtsx-move-jsx-element-tag-backward)
(define-key mode-map (kbd "C-c C-<down>") 'jtsx-move-jsx-element-forward)
(define-key mode-map (kbd "C-c C-<up>") 'jtsx-move-jsx-element-backward)
(define-key mode-map (kbd "C-c C-S-<down>") 'jtsx-move-jsx-element-step-in-forward)
(define-key mode-map (kbd "C-c C-S-<up>") 'jtsx-move-jsx-element-step-in-backward)
(define-key mode-map (kbd "C-c j w") 'jtsx-wrap-in-jsx-element)
(define-key mode-map (kbd "C-c j u") 'jtsx-unwrap-jsx)
(define-key mode-map (kbd "C-c j d") 'jtsx-delete-jsx-node))
(defun jtsx-bind-keys-to-jtsx-jsx-mode-map ()
(jtsx-bind-keys-to-mode-map jtsx-jsx-mode-map))
(defun jtsx-bind-keys-to-jtsx-tsx-mode-map ()
(jtsx-bind-keys-to-mode-map jtsx-tsx-mode-map))
(add-hook 'jtsx-jsx-mode-hook 'jtsx-bind-keys-to-jtsx-jsx-mode-map)
(add-hook 'jtsx-tsx-mode-hook 'jtsx-bind-keys-to-jtsx-tsx-mode-map))
#+END_SRC
** LSP Mode
LSP mode will give you IDE capabilities in Emacs, using Microsoft's
Universal Language Server Protocol. The same one that VSCode uses for
@ -784,7 +897,9 @@ on how to install the Programming Language Servers that you want.
;; optionally if you want to use debugger
(use-package dap-mode
:ensure t)
:ensure t
:init
(require 'dap-lldb))
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
;; New luau lsp for roblox implementation
@ -831,18 +946,22 @@ For more information on setup, you should check out `https://github.com/ch11ng/e
Install the package, enable it and ensure that it always is installed, and then configure:
*** EXWM
+BEGIN_SRC emacs-lisp
(use-package exwm
:ensure t
:config
(require 'exwm-config)
(exwm-config-default))
+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package exwm
:ensure t
:config
(exwm-enable))
#+END_SRC
**** Configuration
+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
;; Autostart applications
(start-process-shell-command "udiskie" nil "udiskie")
(start-process-shell-command "dunst" nil "dunst")
(start-process-shell-command "qpwgraph" nil "qpwgraph")
;; Systemtray
(require 'exwm-systemtray)
(exwm-systemtray-enable)
(exwm-systemtray-mode)
;; Mouse input/bindings
(require 'exwm-input)
@ -850,7 +969,7 @@ Install the package, enable it and ensure that it always is installed, and then
;; EXWM Randr, makes sure that the screens automatically update with the proper resolutions
;; You may want to install a program such as arandr to graphically manage the screens and resolutions, you can export it into Xrandr commands
(require 'exwm-randr)
(exwm-randr-enable)
(exwm-randr-mode)
(defun exwm-switch-workspace-left ()
"Switch one workspace to the left"
@ -877,6 +996,18 @@ Install the package, enable it and ensure that it always is installed, and then
(if (= exwm-workspace-current-index 9) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index 0)) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index (+ exwm-workspace-current-index 1))) )
(message (concat "Swapped current workspace with workspace " (number-to-string exwm-workspace-current-index) "!")))
;; Rename EXWM buffers with window title so they are all identifiable/unique
(defun exwm-rename-buffer ()
(interactive)
(exwm-workspace-rename-buffer
(concat exwm-class-name ":"
(if (<= (length exwm-title) 50) exwm-title
(concat (substring exwm-title 0 49) "...")))))
;; Add these hooks in a suitable place (e.g., as done in exwm-config-default)
(add-hook 'exwm-update-class-hook 'exwm-rename-buffer)
(add-hook 'exwm-update-title-hook 'exwm-rename-buffer)
;; Keybindings
(setq exwm-input-global-keys
`(;; Standard EXWM Bindings
@ -973,7 +1104,7 @@ Install the package, enable it and ensure that it always is installed, and then
;; Ido mode seems to be enabled in the default configuration, turn it back off as we are using Ivy completion instead.
(ido-mode -1)
+END_SRC
#+END_SRC
*** Counsel Linux Application
@ -993,3 +1124,16 @@ Install the package, enable it and ensure that it always is installed, and then
(or comment "")))
(setq counsel-linux-app-format-function #'ds/counsel-linux-app-format-function)
#+END_SRC
** Libvterm
A better terminal
#+BEGIN_SRC emacs-lisp
(use-package vterm
:ensure t)
#+END_SRC
** Libvterm
A better terminal
#+BEGIN_SRC emacs-lisp
(use-package sudo-edit
:ensure t)
#+END_SRC

View File

@ -27,8 +27,11 @@
;; If there is more than one, they won't work right.
'(ansi-color-names-vector
["#d2ceda" "#f2241f" "#67b11d" "#b1951d" "#3a81c3" "#a31db1" "#21b8c7" "#655370"])
'(auth-source-save-behavior nil)
'(custom-safe-themes
'("691d671429fa6c6d73098fc6ff05d4a14a323ea0a18787daeb93fde0e48ab18b" "7546a14373f1f2da6896830e7a73674ef274b3da313f8a2c4a79842e8a93953e" "d6603a129c32b716b3d3541fc0b6bfe83d0e07f1954ee64517aa62c9405a3441" "8f5a7a9a3c510ef9cbb88e600c0b4c53cdcdb502cfe3eb50040b7e13c6f4e78e" "ba72dfc6bb260a9d8609136b9166e04ad0292b9760a3e2431cf0cd0679f83c3a" "e1ecb0536abec692b5a5e845067d75273fe36f24d01210bf0aa5842f2a7e029f" "be9645aaa8c11f76a10bcf36aaf83f54f4587ced1b9b679b55639c87404e2499" "8a379e7ac3a57e64de672dd744d4730b3bdb88ae328e8106f95cd81cbd44e0b6" "41098e2f8fa67dc51bbe89cce4fb7109f53a164e3a92356964c72f76d068587e" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "2035a16494e06636134de6d572ec47c30e26c3447eafeb6d3a9e8aee73732396" "86704574d397606ee1433af037c46611fb0a2787e8b6fd1d6c96361575be72d2" "a41b81af6336bd822137d4341f7e16495a49b06c180d6a6417bf9fd1001b6d2b" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))
'("014cb63097fc7dbda3edf53eb09802237961cbb4c9e9abd705f23b86511b0a69" "38c0c668d8ac3841cb9608522ca116067177c92feeabc6f002a27249976d7434" "f4d1b183465f2d29b7a2e9dbe87ccc20598e79738e5d29fc52ec8fb8c576fcfd" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "691d671429fa6c6d73098fc6ff05d4a14a323ea0a18787daeb93fde0e48ab18b" "7546a14373f1f2da6896830e7a73674ef274b3da313f8a2c4a79842e8a93953e" "d6603a129c32b716b3d3541fc0b6bfe83d0e07f1954ee64517aa62c9405a3441" "8f5a7a9a3c510ef9cbb88e600c0b4c53cdcdb502cfe3eb50040b7e13c6f4e78e" "ba72dfc6bb260a9d8609136b9166e04ad0292b9760a3e2431cf0cd0679f83c3a" "e1ecb0536abec692b5a5e845067d75273fe36f24d01210bf0aa5842f2a7e029f" "be9645aaa8c11f76a10bcf36aaf83f54f4587ced1b9b679b55639c87404e2499" "8a379e7ac3a57e64de672dd744d4730b3bdb88ae328e8106f95cd81cbd44e0b6" "41098e2f8fa67dc51bbe89cce4fb7109f53a164e3a92356964c72f76d068587e" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "2035a16494e06636134de6d572ec47c30e26c3447eafeb6d3a9e8aee73732396" "86704574d397606ee1433af037c46611fb0a2787e8b6fd1d6c96361575be72d2" "a41b81af6336bd822137d4341f7e16495a49b06c180d6a6417bf9fd1001b6d2b" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))
'(dap-gdb-lldb-extension-version "0.27.0")
'(dap-lldb-debug-program '("/run/current-system/sw/bin/lldb-dap"))
'(elcord-quiet 1)
'(fci-rule-color "#a28c6f")
'(hl-todo-keyword-faces
@ -83,5 +86,5 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
'(default ((t (:inherit nil :extend nil :stipple nil :background "#fbf1c7" :foreground "#282828" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight regular :height 128 :width normal :foundry "PfEd" :family "DejaVu Sans Mono")))))