(Finally) Fixed problems with line wrapping and lsp!

This commit is contained in:
Emmet
2025-07-21 22:10:59 -05:00
parent 0893a4e483
commit 4e4ba6a0a3
3 changed files with 34 additions and 31 deletions

View File

@ -71,6 +71,7 @@ in {
nil nil
]; ];
home.file.".config/emacs/init.el".source = ./init.el; home.file.".config/emacs/init.el".source = ./init.el;
home.file.".config/emacs/lib".source = ./lib;
home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors { home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors {
template = builtins.readFile ./lib/doom-stylix-theme.el.mustache; template = builtins.readFile ./lib/doom-stylix-theme.el.mustache;
extension = ".el"; extension = ".el";
@ -89,7 +90,7 @@ in {
(setq systemOpacity ${builtins.toString config.userSettings.emacs.opacity}) (setq systemOpacity ${builtins.toString config.userSettings.emacs.opacity})
;;; sysvars.el ends here ;;; sysvars.el ends here
''; '';
wayland.windowManager.hyprland.settings.exec-once = lib.optionals config.wayland.windowManager.hyprland.enable [ "emacs --daemon" ]; wayland.windowManager.hyprland.settings.exec-once = lib.optionals config.wayland.windowManager.hyprland.enable [ "emacs --daemon" ];
}; };
} }

View File

@ -28,6 +28,10 @@
;; No startup screen ;; No startup screen
(setq inhibit-startup-message t) (setq inhibit-startup-message t)
;; Truncate lines is annoying
(setq truncate-lines nil)
(setq truncate-partial-width-windows nil)
;; Transparent background ;; Transparent background
(set-frame-parameter nil 'alpha-background systemOpacity) (set-frame-parameter nil 'alpha-background systemOpacity)
(add-to-list 'default-frame-alist `(alpha-background . ,systemOpacity)) (add-to-list 'default-frame-alist `(alpha-background . ,systemOpacity))
@ -141,8 +145,8 @@
;; Packages ;; Packages
(use-package line-wrapping-and-numbers (use-package line-wrapping-and-numbers
:load-path "./lib" :load-path "lib/"
:after (org markdown git-timemachine nix-mode)) :after (org git-timemachine nix-mode))
(use-package ultra-scroll (use-package ultra-scroll
:init :init
@ -336,6 +340,9 @@
(use-package treemacs-evil (use-package treemacs-evil
:after (treemacs)) :after (treemacs))
(use-package nix-mode)
(use-package gdscript-mode)
(use-package lsp-mode (use-package lsp-mode
:config :config
(setq lsp-completion-enable t) (setq lsp-completion-enable t)
@ -350,6 +357,9 @@
(gdscript-mode . lsp-deferred) (gdscript-mode . lsp-deferred)
(gdscript-ts-mode . lsp-deferred)) (gdscript-ts-mode . lsp-deferred))
(use-package lsp-nix
:after (lsp-mode))
(use-package lsp-ui :commands lsp-ui-mode) (use-package lsp-ui :commands lsp-ui-mode)
(use-package lsp-treemacs (use-package lsp-treemacs
:after (evil) :after (evil)
@ -944,13 +954,13 @@ Made for `org-tab-first-hook' in evil-mode."
;; Olivetti ;; Olivetti
(use-package olivetti (use-package olivetti
:commands (org-mode markdown-mode)
:custom :custom
(olivetti-style 'fancy) (olivetti-style 'fancy)
(olivetti-margin-width 100) (olivetti-margin-width 100)
:config :config
(setq-default olivetti-body-width 100) (setq-default olivetti-body-width 100)
(add-hook 'org-mode-hook 'olivetti-mode)) (add-hook 'org-mode-hook 'olivetti-mode)
(add-hook 'markdown-mode-hook 'olivetti-mode))
(evil-collection-define-key 'normal 'dired-mode-map (evil-collection-define-key 'normal 'dired-mode-map
"h" 'dired-up-directory "h" 'dired-up-directory

View File

@ -15,43 +15,35 @@
;;; Code: ;;; Code:
;; Line wrapping management ;; Line wrapping management
(defun truncate-lines-off () (defun activate-writing-lines ()
"Stop truncating lines in current buffer." "Stop truncating lines in current buffer."
(interactive) (interactive)
(toggle-truncate-lines 0)) (setq-local truncate-lines nil)
(defun truncate-lines-on () (setq visual-line-mode t)
(display-line-numbers-mode 0))
(defun activate-coding-lines ()
"Truncate lines in current buffer." "Truncate lines in current buffer."
(interactive) (interactive)
(toggle-truncate-lines 1)) (setq-local truncate-lines t)
(defun visual-line-mode-off () (setq visual-line-mode nil)
"Disable `visual-line-mode` in current buffer." (display-line-numbers-mode 1))
(interactive) (add-hook 'org-mode-hook 'activate-writing-lines)
(visual-line-mode 0)) (add-hook 'markdown-mode-hook 'activate-writing-lines)
(add-hook 'org-mode-hook 'truncate-lines-on) (add-hook 'prog-mode-hook 'activate-coding-lines)
(add-hook 'markdown-mode-hook 'truncate-lines-on)
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'markdown-mode-hook 'visual-line-mode)
(add-hook 'prog-mode-hook 'truncate-lines-off)
(add-hook 'prog-mode-hook 'visual-line-mode-off)
(add-hook 'nix-mode-hook 'truncate-lines-off)
(add-hook 'nix-mode-hook 'visual-line-mode-off)
(defun apply-proper-line-wrapping () (defun apply-proper-line-wrapping ()
"Apply proper line wrapping and visual line mode settings according to whether or not the current mode derives from `prog-mode`." "Apply proper line wrapping and visual line mode
settings according to whether or not the current
mode derives from `prog-mode`."
(if (derived-mode-p 'prog-mode) (if (derived-mode-p 'prog-mode)
(progn (progn
(display-line-numbers-mode)
(truncate-lines-on) (truncate-lines-on)
(visual-line-mode-off) )
(display-line-numbers-mode 1))
(progn (progn
(truncate-lines-off) (truncate-lines-off)
(visual-line-mode)
(display-line-numbers-mode 0)))) (display-line-numbers-mode 0))))
(add-hook 'prog-mode-hook 'apply-proper-line-wrapping)
(add-hook 'org-mode-hook 'apply-proper-line-wrapping)
(if (featurep 'markdown-mode)
(add-hook 'markdown-mode-hook 'apply-proper-line-wrapping))
(if (featurep 'git-timemachine) (if (featurep 'git-timemachine)
(add-hook 'git-timemachine-mode-hook 'apply-proper-line-wrapping)) (add-hook 'git-timemachine-mode-hook 'apply-proper-line-wrapping))
(provide 'line-wrapping-and-numbers)
;;; line-wrapping.el ends here ;;; line-wrapping.el ends here