emacs/pkg/prog-mode.el
Maciej Szlosarczyk 9f73e90317
Some checks are pending
/ Test config on ${{matrix.node}} (20) (push) Waiting to run
Add missing requires to use-package macros
2024-07-22 07:43:42 +03:00

83 lines
2.1 KiB
EmacsLisp

;;; pkg/prog-mode -- summary -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;;; Wrap long lines
(toggle-truncate-lines t)
;;; When pasting/writing over a selection, replace it.
(delete-selection-mode t)
;; When possible, show code documentation
(global-eldoc-mode t)
;; Revert tag tables without asking
(require 'etags)
(setq tags-revert-without-query t)
;;; Show trailing whitespace and remove whitespace on save
(use-package whitespace
:commands whitespace-mode
:straight t
:defer t
:hook (((prog-mode text-mode conf-mode) . whitespace-mode)
(before-save . whitespace-cleanup))
:config
(setq whitespace-style #'(face trailing empty)
;;; Insert newline on save
require-final-newline 't))
(setq-default indent-tabs-mode nil)
;; Use colorful, matching parens
(use-package rainbow-delimiters
:commands rainbow-delimiters-mode
:straight t
:defer t
:hook (((prog-mode text-mode) . rainbow-delimiters-mode))
:init
;;; Match parenthasis (left-right)
(electric-pair-mode t)
(show-paren-mode t))
;;; Show hex (#aaa) colors as colors
(use-package rainbow-mode
:commands rainbow-mode
:straight t
:hook ((prog-mode text-mode) . rainbow-mode))
;; Dash integration
(use-package dash-at-point
:commands dash-at-point
:straight t
:defer t
:config
(add-to-list 'dash-at-point-mode-alist
;; Configure lookup for Ruby mode
'(enh-ruby-mode . "ruby,rubygems,rails")))
;; By default, use 2 spaces for indentation
(setq tab-width 2)
(setq tab-stop-list (number-sequence tab-width 200 tab-width))
;; Ensure indentation in steps:
(defun set-indent (step)
"Set indentation to STEP."
(interactive "NNumber of columns for one step: ")
(setq-local tab-width step)
(setq-local tab-stop-list (number-sequence step 200 step)))
(use-package column-enforce-mode
:straight t
:defer t
:config (global-column-enforce-mode t))
;; Vim-like regex replace with preview in buffer.
(use-package visual-regexp :straight t :defer t)
;; Formatter for many files
(use-package apheleia :straight t :defer t)
(provide '+custom-pkg-prog-mode)
;;; prog-mode ends here