Set fill-column for doom configuration to 80

This commit is contained in:
Wojciech Kozlowski 2022-04-10 21:21:41 +02:00
parent 8a588cbd4c
commit 61b4dd0437
5 changed files with 65 additions and 50 deletions

1
.dir-locals.el Normal file
View File

@ -0,0 +1 @@
((nil . ((fill-column . 80))))

View File

@ -35,12 +35,11 @@
(setq doom-theme 'doom-one) (setq doom-theme 'doom-one)
(add-hook 'doom-load-theme-hook (add-hook 'doom-load-theme-hook
(lambda () (lambda ()
(progn
(set-face-attribute 'font-lock-constant-face nil :weight 'bold) (set-face-attribute 'font-lock-constant-face nil :weight 'bold)
(set-face-attribute 'font-lock-function-name-face nil :weight 'bold) (set-face-attribute 'font-lock-function-name-face nil :weight 'bold)
(set-face-attribute 'font-lock-keyword-face nil :weight 'bold) (set-face-attribute 'font-lock-keyword-face nil :weight 'bold)
(set-face-attribute 'font-lock-type-face nil :weight 'bold) (set-face-attribute 'font-lock-type-face nil :weight 'bold)
(set-face-attribute 'show-paren-match nil :background nil)))) (set-face-attribute 'show-paren-match nil :background nil)))
(after! whitespace (set-face-attribute 'whitespace-line nil :background nil)) (after! whitespace (set-face-attribute 'whitespace-line nil :background nil))
;; This determines the style of line numbers in effect. If set to `nil', line ;; This determines the style of line numbers in effect. If set to `nil', line
@ -95,7 +94,8 @@
(delete org-agenda-section +doom-dashboard-menu-sections)) (delete org-agenda-section +doom-dashboard-menu-sections))
;; Remove the silly doom newline advice. ;; Remove the silly doom newline advice.
(advice-remove 'newline-and-indent #'+default--newline-indent-and-continue-comments-a) (advice-remove 'newline-and-indent
#'+default--newline-indent-and-continue-comments-a)
;; I actually like it when Emacs recenters the screen while scrolling. This may ;; I actually like it when Emacs recenters the screen while scrolling. This may
;; be an issue in large files. When that becomes an issue add an exception here. ;; be an issue in large files. When that becomes an issue add an exception here.
@ -113,23 +113,25 @@
;; ----------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------
;; Always open magit in other window. ;; Always open magit in other window.
(after! magit (setq magit-display-buffer-function #'magit-display-buffer-traditional)) (after! magit
(setq magit-display-buffer-function #'magit-display-buffer-traditional))
;; Don't use the LSP formatter. ;; Don't use the LSP formatter.
(after! lsp (setq +format-with-lsp nil)) (after! lsp (setq +format-with-lsp nil))
;; Python virtualenv configuration. ;; Python virtualenv configuration.
(after! lsp-pyright (setq lsp-pyright-venv-path (concat (getenv "HOME") "/.virtualenvs"))) (after! lsp-pyright
(setq lsp-pyright-venv-path (concat (getenv "HOME") "/.virtualenvs")))
;; Rainbow delimiters in all prog-mode buffers. ;; Rainbow delimiters in all prog-mode buffers.
(add-hook! prog-mode #'rainbow-delimiters-mode-enable) (add-hook! prog-mode #'rainbow-delimiters-mode-enable)
;; Make TRAMP easier to use for sudo on remote hosts. ;; Make TRAMP easier to use for sudo on remote hosts.
(after! tramp (after! tramp
;; This line proxies all sudo connections via an ssh connection to the provided hostname. ;; Proxy all sudo connections via an ssh connection to the provided hostname.
(add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
;; This rule is an exception to the above so that local sudo does not proxy via ssh. This has to ;; This rule is an exception to the above so that local sudo does not proxy
;; be added last so that it is the first element of the list. ;; via ssh. This has to be added last so that it is the first element.
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))) (add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil)))
;; Extra VTerm configuration. ;; Extra VTerm configuration.
@ -200,9 +202,12 @@
;; Always indent. Why would I ever want to insert a tab? ;; Always indent. Why would I ever want to insert a tab?
tab-always-indent t tab-always-indent t
;; Default indentation size - applies even when indent-tabs-mode is nil. ;; Default indentation size - applies even when indent-tabs-mode is nil.
tab-width 8 tab-width 8)
;; Highlight lines that are too long in whitespace mode.
whitespace-line-column fill-column) ;; Highlight lines that are too long in whitespace mode. We set this with a hook
;; after local variables as fill-column is often set through dir-locals.
(add-hook 'hack-local-variables-hook
(lambda () (setq-local whitespace-line-column fill-column)))
;; CamelCase as separate words. ;; CamelCase as separate words.
(global-subword-mode +1) (global-subword-mode +1)
@ -210,9 +215,9 @@
;; Doom emacs recommends `visual-line-mode' as it claims wrapping is expensive. ;; Doom emacs recommends `visual-line-mode' as it claims wrapping is expensive.
(global-visual-line-mode +1) (global-visual-line-mode +1)
;; But "C-e" behaves differently in `visual-line-mode' than when they are ;; But "C-e" behaves differently in `visual-line-mode' than when wrapping. It
;; wrapped. It goes to the end of the visual line, not the logical line. This ;; goes to the end of the visual line, not the logical line. This can be fixed
;; can be fixed by defining the following aliases. ;; by defining the following aliases.
(defalias #'end-of-visual-line #'end-of-line) (defalias #'end-of-visual-line #'end-of-line)
(defalias #'beginning-of-visual-line #'beginning-of-line) (defalias #'beginning-of-visual-line #'beginning-of-line)
@ -245,7 +250,8 @@
"M-o" #'other-window "M-o" #'other-window
"C-x o" #'other-popup "C-x o" #'other-popup
;; Kill current buffer without prompting. ;; Kill current buffer without prompting.
:desc "kill-buffer" "C-x k" (lambda () :desc "kill-buffer"
"C-x k" (lambda ()
(interactive) (interactive)
(let (kill-buffer-query-functions) (kill-buffer))) (let (kill-buffer-query-functions) (kill-buffer)))
;; Scroll up/down, but keep point in place. ;; Scroll up/down, but keep point in place.

View File

@ -18,9 +18,11 @@ This module provides a terminal emulator powered by libvterm.
The following commands are available to open it: The following commands are available to open it:
+ ~+vterm/other-window~ (=C-c o t=): Opens vterm in other window + ~+vterm/other-window~ (=C-c o t=): Opens vterm in other window
+ ~+vterm/project/other-window~ (=C-c o p=): Opens vterm in the current project in other window + ~+vterm/project/other-window~ (=C-c o p=): Opens vterm in the current project
in other window
+ ~+vterm/here~ (=C-c o T=): Opens vterm in the current window + ~+vterm/here~ (=C-c o T=): Opens vterm in the current window
+ ~+vterm/project/here~ (=C-c o P=): Opens vterm in the current project in the current window + ~+vterm/project/here~ (=C-c o P=): Opens vterm in the current project in the
current window
These commands will first try to find an existing suitable vterm buffer and open These commands will first try to find an existing suitable vterm buffer and open
it. If one does not exist, they will create a new one. If the current buffer is it. If one does not exist, they will create a new one. If the current buffer is

View File

@ -35,7 +35,8 @@ If current buffer is not in vterm-mode:
Returns the vterm buffer" Returns the vterm buffer"
(unless (fboundp 'module-load) (unless (fboundp 'module-load)
(user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm")) (user-error
"Your build of Emacs lacks dynamic modules support and cannot load vterm"))
(let ((vterm-buffer-name (+vterm--buffer-name))) (let ((vterm-buffer-name (+vterm--buffer-name)))
(if (string= major-mode "vterm-mode") (if (string= major-mode "vterm-mode")
(funcall spawn-fn vterm-buffer-name) (funcall spawn-fn vterm-buffer-name)
@ -45,17 +46,20 @@ Returns the vterm buffer"
(funcall spawn-fn vterm-buffer-name)))))) (funcall spawn-fn vterm-buffer-name))))))
(defun +vterm--spawn-or-switch-with-project (spawn-fn switch-fn) (defun +vterm--spawn-or-switch-with-project (spawn-fn switch-fn)
"Open using `spawn-fn' or switch to active vterm using `switch-fn' in a project. "Open with `spawn-fn' or switch to active vterm with `switch-fn' in a project.
Returns the vterm buffer" Returns the vterm buffer"
(let ((project-root (doom-project-root))) (let ((project-root (doom-project-root)))
(unless project-root (unless project-root
(user-error "vterm/project/* cannot find a project, because you are not in a project")) (user-error
"vterm/project cannot find a project, because you are not in a project"))
(let ((default-directory project-root)) (let ((default-directory project-root))
(+vterm--spawn-or-switch spawn-fn switch-fn)))) (+vterm--spawn-or-switch spawn-fn switch-fn))))
(defun +vterm--other-window (other-window-fn current-window-fn) (defun +vterm--other-window (other-window-fn current-window-fn)
"Open or switch using `other-window-fn' unless current buffer is doom-dashboard. "Open or switch with `other-window-fn'.
Unless current buffer is doom-dashboard.
Returns the vterm buffer." Returns the vterm buffer."
(if (equal major-mode #'+doom-dashboard-mode) (if (equal major-mode #'+doom-dashboard-mode)
@ -73,7 +77,8 @@ buffer is the doom-dashboard, vterm opens in the current window.
Returns the vterm buffer." Returns the vterm buffer."
(interactive) (interactive)
(+vterm--other-window (lambda () (+vterm--other-window
(lambda ()
(+vterm--spawn-or-switch #'vterm-other-window (+vterm--spawn-or-switch #'vterm-other-window
#'switch-to-buffer-other-window)) #'switch-to-buffer-other-window))
(lambda () (lambda ()
@ -91,7 +96,8 @@ buffer is the doom-dashboard, vterm opens in the current window.
Returns the vterm buffer." Returns the vterm buffer."
(interactive) (interactive)
(+vterm--other-window (lambda () (+vterm--other-window
(lambda ()
(+vterm--spawn-or-switch-with-project #'vterm-other-window (+vterm--spawn-or-switch-with-project #'vterm-other-window
#'switch-to-buffer-other-window)) #'switch-to-buffer-other-window))
(lambda () (lambda ()