common/home/spacemacs/user-config.el

120 lines
3.2 KiB
EmacsLisp

;; Spacemacs itself
(exec-path-from-shell-initialize)
(spacemacs/enable-transparency)
; Needed for emacs --daemon to read fonts
; Sometimes doesn't work
(spacemacs|do-after-display-system-init (spacemacs/set-default-font dotspacemacs-default-font))
;; Turn off auto mode
(rassq-delete-all 'jit-lock-debug-mode auto-mode-alist)
;; whitespace mode
(spacemacs/toggle-whitespace-globally-on)
(defun custom/common-program-hook ()
(setq whitespace-style '(face spaces tabs newline trailing space-mark tab-mark newline-mark lines-tail))
(interactive)
(whitespace-mode t)
(setq whitespace-line-column 80)
(display-fill-column-indicator-mode)
(smart-tabs-mode-enable)
)
(defun custom/common-richtext-hook ()
(setq whitespace-style '(face spaces tabs newline trailing space-mark tab-mark newline-mark))
(interactive)
(whitespace-mode t)
(setq whitespace-line-column 'nil)
)
(defun custom/latex-hook ()
(custom/common-program-hook)
(indent-tabs-mode)
)
(add-hook 'text-mode-hook 'custom/common-richtext-hook)
(add-hook 'LaTeX-mode-hook 'custom/latex-hook)
(add-hook 'latex-mode-hook 'custom/latex-hook)
(add-hook 'prog-mode-hook 'custom/common-program-hook)
(setq whitespace-display-mappings
;; all numbers are Unicode codepoint in decimal. ⁖ (insert-char 182 1)
'(
(space-mark 32 [183] [46]) ; 32 SPACE 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
(newline-mark 10 [172 10]) ; 10 LINE FEED, 172 Not Sign「¬」
(tab-mark 9 [10141 9] [92 9]) ; 9 TAB, 10141 Triangle-headed rightwards arrow 「➝」
))
;; Auto save upon defocus
(add-hook 'focus-out-hook
(defun save-current-buffer-if-needed ()
(interactive)
(when (and (buffer-file-name) (buffer-modified-p))
(save-buffer))))
;; Mixed indent mode (in conjunction with smart-tabs-mode)
(setq-default indent-tabs-mode t
indent-line-function 'tab-to-tab-stop
tab-width 2)
(setq css-indent-offset 2)
(smart-tabs-insinuate
'c
'c++
'java
'javascript)
(add-hook 'after-init-hook #'company-statistics-mode)
;; C/C++
(setq
c-default-style "stroustrup"
c-basic-offset 2
lsp-clients-clangd-args
'("-j=4"
"--clang-tidy"
"--header-insertion=never"
"--pch-storage=memory"
))
(highlight-doxygen-global-mode 1)
;; Org mode
(if (boundp 'org-format-latex-options)
(setq org-format-latex-options (plist-put org-format-latex-options
:scale 2.0)))
;; Spellchecking
(setq ispell-dictionary "english")
;; Centaur
(setq
centaur-tabs-set-icons t
centaur-tabs-set-bar 'over
centaur-tabs-set-close-button t
centaur-tabs-style "wave"
centaur-tabs-set-bar 'under
centaur-tabs-set-modified-marker t
centaur-tabs-modified-marker "*"
centaur-tabs-cycle-scope 'tabs)
(setq
pdf-sync-backward-display-action t
pdf-sync-forward-display-action t)
;; Ensures the pdf view mode doesn't get into emacs state.
;; If it does get into emacs state, checked by
;; (describe-variable 'evil-state)
;; Use M-x evil-normal-state or M-x evil-force-evilified-state to revert.
(evil-set-initial-state 'pdf-view-mode 'evilified)
(setq display-time-24hr-format t)
(setq display-time-format "%H:%M")
;; Optimizations
;; font-lock mode is always slow in latex
(setq font-lock-maximum-decoration
'((latex-mode . 2)
(t . t)))