(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
];
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 {
template = builtins.readFile ./lib/doom-stylix-theme.el.mustache;
extension = ".el";
@ -89,7 +90,7 @@ in {
(setq systemOpacity ${builtins.toString config.userSettings.emacs.opacity})
;;; sysvars.el ends here
'';
'';
wayland.windowManager.hyprland.settings.exec-once = lib.optionals config.wayland.windowManager.hyprland.enable [ "emacs --daemon" ];
};
}

View File

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

View File

@ -15,43 +15,35 @@
;;; Code:
;; Line wrapping management
(defun truncate-lines-off ()
(defun activate-writing-lines ()
"Stop truncating lines in current buffer."
(interactive)
(toggle-truncate-lines 0))
(defun truncate-lines-on ()
(setq-local truncate-lines nil)
(setq visual-line-mode t)
(display-line-numbers-mode 0))
(defun activate-coding-lines ()
"Truncate lines in current buffer."
(interactive)
(toggle-truncate-lines 1))
(defun visual-line-mode-off ()
"Disable `visual-line-mode` in current buffer."
(interactive)
(visual-line-mode 0))
(add-hook 'org-mode-hook 'truncate-lines-on)
(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)
(setq-local truncate-lines t)
(setq visual-line-mode nil)
(display-line-numbers-mode 1))
(add-hook 'org-mode-hook 'activate-writing-lines)
(add-hook 'markdown-mode-hook 'activate-writing-lines)
(add-hook 'prog-mode-hook 'activate-coding-lines)
(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)
(progn
(display-line-numbers-mode)
(truncate-lines-on)
(visual-line-mode-off)
(display-line-numbers-mode 1))
)
(progn
(truncate-lines-off)
(visual-line-mode)
(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)
(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