2026-01-25T22:53:21
This commit is contained in:
104
config.el
104
config.el
@@ -75,7 +75,7 @@
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
|
||||
(setq doom-theme 'catppuccin)
|
||||
;; (setq doom-theme 'catppuccin)
|
||||
;;(setq org-startup-with-inline-images t)
|
||||
;; for inline images in org mode
|
||||
(setq org-display-inline-images t)
|
||||
@@ -344,3 +344,105 @@ Uses `current-date-time-format' for the formatting the date/time."
|
||||
;; (nth (random (length alternatives)) alternatives))))
|
||||
|
||||
(setq vterm-shell "/usr/bin/env zsh")
|
||||
|
||||
;; for installing c and cpp tree sitter languages
|
||||
;; probably only need this once and run
|
||||
;; M-x treesit-install-language-grammar RET c RET
|
||||
;; M-x treesit-install-language-grammar RET cpp RET
|
||||
;; can comment out after
|
||||
;; (after! treesit
|
||||
;; (setq treesit-language-source-alist
|
||||
;; '((c "https://github.com/tree-sitter/tree-sitter-c")
|
||||
;; (cpp "https://github.com/tree-sitter/tree-sitter-cpp"))))
|
||||
|
||||
|
||||
;; for org blocks:
|
||||
(setq company-org-block-edit-style 'auto) ;; 'auto, 'prompt, or 'inline
|
||||
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
'company-org-block)))
|
||||
|
||||
|
||||
|
||||
;; for better csv handling
|
||||
;; disable line wrap
|
||||
(defun disable-linewrap ()
|
||||
"csv line wrap setup"
|
||||
(visual-line-mode -1)
|
||||
(toggle-truncate-lines 1))
|
||||
|
||||
(add-hook 'csv-mode-hook #'disable-linewrap)
|
||||
|
||||
;; auto detect separator
|
||||
(add-hook 'csv-mode-hook #'csv-guess-set-separator)
|
||||
;; turn on field alignment
|
||||
(add-hook 'csv-mode-hook #'csv-align-mode)
|
||||
;; add csv header line
|
||||
(add-hook 'csv-mode-hook #'csv-header-line)
|
||||
|
||||
(defun toggle-csv-mode-hooks ()
|
||||
"Toggle my CSV mode hooks (add/remove)."
|
||||
(interactive)
|
||||
(if (memq #'disable-linewrap csv-mode-hook)
|
||||
(progn
|
||||
(remove-hook 'csv-mode-hook #'disable-linewrap)
|
||||
(visual-line-mode t)
|
||||
(toggle-truncate-lines)
|
||||
(remove-hook 'csv-mode-hook #'csv-guess-set-separator)
|
||||
(csv-guess-set-separator)
|
||||
(remove-hook 'csv-mode-hook #'csv-align-mode)
|
||||
(csv-align-mode)
|
||||
(remove-hook 'csv-mode-hook #'csv-header-line)
|
||||
(csv-header-line)
|
||||
(normal-mode)
|
||||
(message "CSV hooks removed"))
|
||||
(progn
|
||||
(add-hook 'csv-mode-hook #'disable-linewrap)
|
||||
(add-hook 'csv-mode-hook #'csv-guess-set-separator)
|
||||
(add-hook 'csv-mode-hook #'csv-align-mode)
|
||||
(add-hook 'csv-mode-hook #'csv-header-line)
|
||||
(normal-mode)
|
||||
(message "CSV hooks added"))))
|
||||
|
||||
;; (map! :map csv-mode-map "SPC t ;" #'toggle-csv-mode-hooks)
|
||||
(map! :after csv-mode
|
||||
:map csv-mode-map
|
||||
:desc "Toggle CSV hooks"
|
||||
:n "SPC t ;" #'toggle-csv-mode-hooks)
|
||||
;; :leader
|
||||
;; "t;" #'toggle-csv-mode-hooks)
|
||||
|
||||
|
||||
;; make invisible characters more visible
|
||||
(setq! glyphless-char-display-control '((format-control . empty-box) (variation-selectors . thin-space) (no-font . hex-code)))
|
||||
|
||||
|
||||
|
||||
;; A starting point for a conservative, MISRA-friendly layout.
|
||||
;; CC Mode style approximating the example (Allman + 4 spaces + aligned args).
|
||||
(c-add-style
|
||||
"misra-allman"
|
||||
'("bsd"
|
||||
(c-basic-offset . 4)
|
||||
(indent-tabs-mode . nil)
|
||||
|
||||
;; Make { for functions and control statements go on the next line when typing.
|
||||
;; Note: this affects "on-the-fly" formatting; reindent won't move braces by itself.
|
||||
(c-hanging-braces-alist . ((defun-open before)
|
||||
(substatement-open before)))
|
||||
|
||||
;; Keep the brace itself not additionally indented relative to the if/for/while.
|
||||
;; After-the-fact cleanup: turn "} else {" into "}\nelse\n{".
|
||||
(c-cleanup-list . (brace-else-brace)) ; key part for else placement
|
||||
|
||||
(c-offsets-alist . ((statement-block-intro . +)
|
||||
(substatement-open . 0)
|
||||
(case-label . +)
|
||||
(statement-case-intro . +)
|
||||
(arglist-cont-nonempty . c-lineup-arglist)
|
||||
;; Align wrapped function call/decl arguments under the first arg.
|
||||
(arglist-intro . +)
|
||||
(arglist-cont-nonempty . c-lineup-arglist)
|
||||
(arglist-close . 0)))))
|
||||
|
||||
Reference in New Issue
Block a user