summaryrefslogtreecommitdiff
path: root/emacs/inits/20-programming.el
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2023-01-18 08:31:30 +0100
committertslil clingman <tslil@posteo.de>2023-01-18 08:34:01 +0100
commit67f463598e40139adcd70b074a8ee415310b402f (patch)
treeaaa2b36fb835382cd222901078a8e390d00dd743 /emacs/inits/20-programming.el
parent5301833eaced40b8f7a64a04f222aa1d5986c481 (diff)
changes from $work
Diffstat (limited to 'emacs/inits/20-programming.el')
-rw-r--r--emacs/inits/20-programming.el101
1 files changed, 73 insertions, 28 deletions
diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el
index b1b4c38..9bea91e 100644
--- a/emacs/inits/20-programming.el
+++ b/emacs/inits/20-programming.el
@@ -15,31 +15,28 @@
;; (when (< ww (+ 5 fill-column))
;; (enlarge-window-horizontally (- (+ 5 fill-column) ww)))))
-(use-package smart-tabs-mode
- :ensure t
- :config
- (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml)
- (setq whitespace-style '(face trailing tabs spaces lines
- newline empty space-before-tab space-mark tab-mark
- newline-mark)))
-
-(use-package flycheck
- :defer t
- :ensure t)
-
(defun programming-setup ()
(subword-mode 1)
(electric-pair-local-mode)
(set-fill-column 80)
- ;; Emacs25 compat
- (if (fboundp 'display-line-numbers-mode)
- (display-line-numbers-mode)
- (linum-mode))
+ (hs-minor-mode)
+ (display-line-numbers-mode 1)
(setq auto-hscroll-mode t)
(yas-minor-mode-on))
(add-hook 'prog-mode-hook #'programming-setup)
+(defun align-to-equals (begin end)
+ "Align region to equal signs"
+ (interactive "r")
+ (align-regexp begin end "\\(\\s-*\\)=" 1 1 ))
+
+(use-package centered-window
+ :ensure t)
+
+(use-package hideshow
+ :bind (("C-c C-f C-f" . hs-toggle-hiding)))
+
;; -----------------------------------------------------------------------------
;; Specific packages
@@ -189,6 +186,10 @@
:ensure t
:defer t)
+(use-package flycheck-rust
+ :ensure t
+ :defer t)
+
(use-package rust-mode
:ensure t
:defer t
@@ -212,27 +213,41 @@
(lsp)))
:config
(setq rust-indent-offset 4
- rust-indent-method-chain t
- rust-indent-where-clause t
- rust-format-on-save t)
+ rust-indent-method-chain t
+ rust-indent-where-clause t
+ rust-format-on-save t)
(setq lsp-rust-server 'rust-analyzer
- lsp-rust-analyzer-call-info-full nil))
+ lsp-rust-analyzer-call-info-full nil))
;; -----------------------------------------------------------------------------
;; Python
-(use-package yapfify
+
+(use-package python-black
:ensure t
- :defer t)
+ :after python
+ ;; :hook (python-mode . python-black-on-save-mode-enable-dwim)
+ )
+
+(use-package highlight-indent-guides
+ :ensure t
+ :defer t
+ :config
+ (setq highlight-indent-guides-auto-odd-face-perc 1.5 ;; 10
+ highlight-indent-guides-auto-even-face-perc 3 ;; 15
+))
(use-package python
:hook (python-mode . (lambda ()
- (lsp)
- (yapf-mode)))
- :config
- (setq lsp-pylsp-plugins-pycodestyle-enabled nil
- lsp-pylsp-plugins-pydocstyle-enabled nil
- python-shell-interpreter "python3"))
+ (highlight-indent-guides-mode)
+ (visual-line-mode)
+ ;; (yapf-mode)
+ ))
+ :bind (:map python-mode-map
+ ("C-c C-f" . nil))
+ ;; :config
+ ;; (setq python-shell-interpreter "python3")
+ )
;; -----------------------------------------------------------------------------
;; Zig
@@ -355,3 +370,33 @@
(use-package clojure-mode
:ensure t
:defer t)
+
+;; -------------------------------------------------------------------
+;; JSON and related
+
+(use-package json-mode
+ :ensure t
+ :defer t
+ :mode (("\\.json\\.jinja\\'" . json-mode)
+ ("\\.jinja" . json-mode))
+ :hook (json-mode . (lambda ()
+ (programming-setup)
+ (setq standard-indent 2)
+ (setq js-indent-level 2)
+ (setq tab-width 2
+ indent-tabs-mode nil)))
+ :bind (:map json-mode-map
+ ("C-c C-f" . nil)))
+
+(use-package jinja2-mode
+ :ensure t
+ :defer t
+ :mode ("\\.jinja\\'" . jinja2-mode)
+ :hook (jinja2-mode . (lambda ()
+ (setq indent-line-function 'indent-relative)
+ (highlight-indent-guides-mode)
+ (programming-setup)
+ (spell-fu-mode -1)
+ (auto-fill-mode -1)))
+ :bind (:map jinja2-mode-map
+ ("C-c C-f" . nil)))