|
|
|
|
@@ -10,15 +10,20 @@
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
|
'(c-basic-offset 4)
|
|
|
|
|
'(c-default-style
|
|
|
|
|
'((c++-mode . "tuleu-c++")
|
|
|
|
|
(java-mode . "java")
|
|
|
|
|
(awk-mode . "awk")
|
|
|
|
|
(other . "gnu")))
|
|
|
|
|
'(company-idle-delay 20.0)
|
|
|
|
|
'(compilation-scroll-output 'first-error)
|
|
|
|
|
'(custom-safe-themes
|
|
|
|
|
'("162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "6622bb651e72d8ebd66454bd86db6c3990324243ff4325c1b6df252aba63b13e" "2f8eadc12bf60b581674a41ddc319a40ed373dd4a7c577933acaff15d2bf7cc6" "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc" "016f665c0dd5f76f8404124482a0b13a573d17e92ff4eb36a66b409f4d1da410" "13096a9a6e75c7330c1bc500f30a8f4407bd618431c94aeab55c9855731a95e1" "8b148cf8154d34917dfc794b5d0fe65f21e9155977a36a5985f89c09a9669aa0" "bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e" "680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426" "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" default))
|
|
|
|
|
'("162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213"
|
|
|
|
|
"e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2"
|
|
|
|
|
"6622bb651e72d8ebd66454bd86db6c3990324243ff4325c1b6df252aba63b13e"
|
|
|
|
|
"2f8eadc12bf60b581674a41ddc319a40ed373dd4a7c577933acaff15d2bf7cc6"
|
|
|
|
|
"f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc"
|
|
|
|
|
"016f665c0dd5f76f8404124482a0b13a573d17e92ff4eb36a66b409f4d1da410"
|
|
|
|
|
"13096a9a6e75c7330c1bc500f30a8f4407bd618431c94aeab55c9855731a95e1"
|
|
|
|
|
"8b148cf8154d34917dfc794b5d0fe65f21e9155977a36a5985f89c09a9669aa0"
|
|
|
|
|
"bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e"
|
|
|
|
|
"680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426"
|
|
|
|
|
"631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b"
|
|
|
|
|
default))
|
|
|
|
|
'(display-time-24hr-format t)
|
|
|
|
|
'(display-time-default-load-average nil)
|
|
|
|
|
'(doom-modeline-github t)
|
|
|
|
|
@@ -41,19 +46,19 @@
|
|
|
|
|
'(lisp-simple-loop-indentation 4)
|
|
|
|
|
'(lisp-tag-body-indentation 4)
|
|
|
|
|
'(lisp-tag-indentation 4)
|
|
|
|
|
'(lsp-copilot-enabled t)
|
|
|
|
|
'(lsp-inline-completion-idle-delay 99999999)
|
|
|
|
|
'(org-agenda-files '("~/org/1.TODO.org"))
|
|
|
|
|
'(package-enable-at-startup nil)
|
|
|
|
|
'(package-selected-packages
|
|
|
|
|
'(clang-format+ cmake-format xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
|
|
|
|
'(package-selected-packages nil)
|
|
|
|
|
'(safe-local-variable-values
|
|
|
|
|
'((vc-follow-symlinks . t)
|
|
|
|
|
(TeX-master . t)
|
|
|
|
|
(TeX-parse-self . t)))
|
|
|
|
|
'((vc-follow-symlinks . t) (TeX-master . t) (TeX-parse-self . t)))
|
|
|
|
|
'(system-packages-noconfirm t)
|
|
|
|
|
'(tab-width 4)
|
|
|
|
|
'(warning-suppress-log-types '((comp)))
|
|
|
|
|
'(whitespace-style
|
|
|
|
|
'(face trailing tabs lines-tail newline space-before-tab::tab space-before-tab::space space-before-tab tab-mark)))
|
|
|
|
|
'(face trailing tabs lines-tail newline space-before-tab::tab
|
|
|
|
|
space-before-tab::space space-before-tab tab-mark)))
|
|
|
|
|
|
|
|
|
|
(if (display-graphic-p)
|
|
|
|
|
(if (fboundp 'tool-bar-mode)
|
|
|
|
|
@@ -75,21 +80,30 @@
|
|
|
|
|
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
|
|
|
|
("gnu" . "https://elpa.gnu.org/packages/")))
|
|
|
|
|
(package-initialize)
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(unless (package-installed-p 'use-package)
|
|
|
|
|
(unless package-archive-contents
|
|
|
|
|
(package-refresh-contents))
|
|
|
|
|
(package-install 'use-package)
|
|
|
|
|
)
|
|
|
|
|
(require 'use-package)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(require 'use-package)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(unless (package-installed-p 'quelpa)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el")
|
|
|
|
|
(eval-buffer)
|
|
|
|
|
(quelpa-self-upgrade)))
|
|
|
|
|
(setq quelpa-checkout-melpa-p nil)
|
|
|
|
|
(setq quelpa-use-package-inhibit-loading-quelpa t)
|
|
|
|
|
(quelpa
|
|
|
|
|
'(quelpa-use-package
|
|
|
|
|
:fetcher github
|
|
|
|
|
:repo "quelpa/quelpa-use-package"))
|
|
|
|
|
(require 'quelpa-use-package)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(require 'use-package-ensure)
|
|
|
|
|
(setq use-package-always-ensure t)
|
|
|
|
|
|
|
|
|
|
(use-package system-packages)
|
|
|
|
|
;(use-package use-package-ensure-system-package)
|
|
|
|
|
|
|
|
|
|
(use-package use-package-ensure-system-package)
|
|
|
|
|
|
|
|
|
|
;; required because vterm wants this before loading.
|
|
|
|
|
(use-package emacs
|
|
|
|
|
@@ -98,9 +112,206 @@
|
|
|
|
|
(cmake . cmake)
|
|
|
|
|
("/usr/include/vterm.h" . libvterm-dev)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
;; Add prompt indicator to `completing-read-multiple'.
|
|
|
|
|
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
|
|
|
|
(defun crm-indicator (args)
|
|
|
|
|
(cons (format "[CRM%s] %s"
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
|
|
|
|
crm-separator)
|
|
|
|
|
(car args))
|
|
|
|
|
(cdr args)))
|
|
|
|
|
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
|
|
|
|
|
|
|
|
|
;; Do not allow the cursor in the minibuffer prompt
|
|
|
|
|
(setq minibuffer-prompt-properties
|
|
|
|
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
|
|
|
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
|
|
|
|
|
|
|
|
|
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
|
|
|
|
|
;; Vertico commands are hidden in normal buffers.
|
|
|
|
|
(setq read-extended-command-predicate
|
|
|
|
|
#'command-completion-default-include-p)
|
|
|
|
|
|
|
|
|
|
;; Enable recursive minibuffers
|
|
|
|
|
(setq enable-recursive-minibuffers t)
|
|
|
|
|
|
|
|
|
|
(defconst atu/numprocs
|
|
|
|
|
(string-to-number (shell-command-to-string "nproc"))
|
|
|
|
|
"The number of processor on the system")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Enable vertico
|
|
|
|
|
(use-package vertico
|
|
|
|
|
:init
|
|
|
|
|
(vertico-mode)
|
|
|
|
|
|
|
|
|
|
;; Different scroll margin
|
|
|
|
|
;; (setq vertico-scroll-margin 0)
|
|
|
|
|
|
|
|
|
|
;; Show more candidates
|
|
|
|
|
(setq vertico-count 10)
|
|
|
|
|
|
|
|
|
|
;; Grow and shrink the Vertico minibuffer
|
|
|
|
|
(setq vertico-resize t)
|
|
|
|
|
|
|
|
|
|
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
|
|
|
|
(setq vertico-cycle t)
|
|
|
|
|
:config
|
|
|
|
|
(vertico-reverse-mode)
|
|
|
|
|
(keymap-set vertico-map "TAB" #'minibuffer-complete)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
|
|
|
|
(use-package savehist
|
|
|
|
|
:init
|
|
|
|
|
(savehist-mode))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Optionally use the `orderless' completion style.
|
|
|
|
|
(use-package orderless
|
|
|
|
|
:init
|
|
|
|
|
;; Configure a custom style dispatcher (see the Consult wiki)
|
|
|
|
|
;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)
|
|
|
|
|
;; orderless-component-separator #'orderless-escapable-split-on-space)
|
|
|
|
|
(setq completion-styles '(partial-completion orderless basic)
|
|
|
|
|
;;completion-category-defaults nil
|
|
|
|
|
completion-category-overrides '((file (styles basic partial-completion ))))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Example configuration for Consult
|
|
|
|
|
(use-package consult
|
|
|
|
|
;; Replace bindings. Lazily loaded due by `use-package'.
|
|
|
|
|
:bind (;; C-c bindings in `mode-specific-map'
|
|
|
|
|
("C-c M-x" . consult-mode-command)
|
|
|
|
|
("C-c h" . consult-history)
|
|
|
|
|
("C-c k" . consult-kmacro)
|
|
|
|
|
("C-c M" . consult-man)
|
|
|
|
|
("C-c i" . consult-info)
|
|
|
|
|
([remap Info-search] . consult-info)
|
|
|
|
|
;; C-x bindings in `ctl-x-map'
|
|
|
|
|
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
|
|
|
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
|
|
|
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
|
|
|
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
|
|
|
|
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
|
|
|
|
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
|
|
|
|
;; Custom M-# bindings for fast register access
|
|
|
|
|
("M-#" . consult-register-load)
|
|
|
|
|
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
|
|
|
|
("C-M-#" . consult-register)
|
|
|
|
|
;; Other custom bindings
|
|
|
|
|
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
|
|
|
|
;; M-g bindings in `goto-map'
|
|
|
|
|
("M-g e" . consult-compile-error)
|
|
|
|
|
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
|
|
|
|
("M-g g" . consult-goto-line) ;; orig. goto-line
|
|
|
|
|
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
|
|
|
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
|
|
|
|
("M-g m" . consult-mark)
|
|
|
|
|
("M-g k" . consult-global-mark)
|
|
|
|
|
("M-g i" . consult-imenu)
|
|
|
|
|
("M-g I" . consult-imenu-multi)
|
|
|
|
|
;; M-s bindings in `search-map'
|
|
|
|
|
("M-s d" . consult-find) ;; Alternative: consult-fd
|
|
|
|
|
("M-s D" . consult-locate)
|
|
|
|
|
("M-s g" . consult-grep)
|
|
|
|
|
("M-s G" . consult-git-grep)
|
|
|
|
|
("M-s r" . consult-ripgrep)
|
|
|
|
|
("M-s l" . consult-line)
|
|
|
|
|
("M-s L" . consult-line-multi)
|
|
|
|
|
("M-s k" . consult-keep-lines)
|
|
|
|
|
("M-s u" . consult-focus-lines)
|
|
|
|
|
;; Isearch integration
|
|
|
|
|
("M-s e" . consult-isearch-history)
|
|
|
|
|
:map isearch-mode-map
|
|
|
|
|
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
|
|
|
|
|
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
|
|
|
|
|
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
|
|
|
|
|
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
|
|
|
|
|
;; Minibuffer history
|
|
|
|
|
:map minibuffer-local-map
|
|
|
|
|
("M-s" . consult-history) ;; orig. next-matching-history-element
|
|
|
|
|
("M-r" . consult-history)) ;; orig. previous-matching-history-element
|
|
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
|
|
;; Optionally configure the register formatting. This improves the register
|
|
|
|
|
;; preview for `consult-register', `consult-register-load',
|
|
|
|
|
;; `consult-register-store' and the Emacs built-ins.
|
|
|
|
|
(setq register-preview-delay 0.5
|
|
|
|
|
register-preview-function #'consult-register-format)
|
|
|
|
|
|
|
|
|
|
;; Optionally tweak the register preview window.
|
|
|
|
|
;; This adds thin lines, sorting and hides the mode line of the window.
|
|
|
|
|
(advice-add #'register-preview :override #'consult-register-window)
|
|
|
|
|
|
|
|
|
|
;; Use Consult to select xref locations with preview
|
|
|
|
|
(setq xref-show-xrefs-function #'consult-xref
|
|
|
|
|
xref-show-definitions-function #'consult-xref)
|
|
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
|
|
;; Optionally configure preview. The default value
|
|
|
|
|
;; is 'any, such that any key triggers the preview.
|
|
|
|
|
;; (setq consult-preview-key 'any)
|
|
|
|
|
;; (setq consult-preview-key "M-.")
|
|
|
|
|
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
|
|
|
|
|
;; For some commands and buffer sources it is useful to configure the
|
|
|
|
|
;; :preview-key on a per-command basis using the `consult-customize' macro.
|
|
|
|
|
(consult-customize
|
|
|
|
|
consult-theme :preview-key '(:debounce 0.2 any)
|
|
|
|
|
consult-ripgrep consult-git-grep consult-grep
|
|
|
|
|
consult-bookmark consult-recent-file consult-xref
|
|
|
|
|
consult--source-bookmark consult--source-file-register
|
|
|
|
|
consult--source-recent-file consult--source-project-recent-file
|
|
|
|
|
;; :preview-key "M-."
|
|
|
|
|
:preview-key '(:debounce 0.4 any))
|
|
|
|
|
|
|
|
|
|
;; Optionally configure the narrowing key.
|
|
|
|
|
;; Both < and C-+ work reasonably well.
|
|
|
|
|
(setq consult-narrow-key "<") ;; "C-+"
|
|
|
|
|
|
|
|
|
|
(autoload 'projectile-project-root "projectile")
|
|
|
|
|
(setq consult-project-function (lambda (_) (projectile-project-root)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package marginalia
|
|
|
|
|
:config
|
|
|
|
|
(marginalia-mode))
|
|
|
|
|
|
|
|
|
|
(use-package embark
|
|
|
|
|
:bind
|
|
|
|
|
("C-x m" . embark-act) ;; pick some comfortable binding
|
|
|
|
|
("M-." . embark-dwim) ;; good alternative: M-.
|
|
|
|
|
("C-h B" . embark-bindings) ;; alternative for `describe-bindings'
|
|
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
|
|
;; Optionally replace the key help with a completing-read interface
|
|
|
|
|
(setq prefix-help-command #'embark-prefix-help-command)
|
|
|
|
|
|
|
|
|
|
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
|
|
|
|
;; strategy, if you want to see the documentation from multiple providers.
|
|
|
|
|
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
|
|
|
|
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
|
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
|
|
;; Hide the mode line of the Embark live/completions buffers
|
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
|
|
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
|
|
|
|
nil
|
|
|
|
|
(window-parameters (mode-line-format . none)))))
|
|
|
|
|
|
|
|
|
|
;; Consult users will also want the embark-consult package.
|
|
|
|
|
(use-package embark-consult
|
|
|
|
|
:demand t
|
|
|
|
|
:hook
|
|
|
|
|
(embark-collect-mode . consult-preview-at-point-mode))
|
|
|
|
|
|
|
|
|
|
(use-package doom-modeline
|
|
|
|
|
:init
|
|
|
|
|
@@ -149,12 +360,6 @@
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(custom-set-faces
|
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package xterm-color
|
|
|
|
|
:config
|
|
|
|
|
@@ -167,49 +372,6 @@
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package smart-tabs-mode
|
|
|
|
|
:config
|
|
|
|
|
(setq-default tab-width 4) ; or any other preferred value
|
|
|
|
|
(setq cua-auto-tabify-rectangles nil)
|
|
|
|
|
(smart-tabs-advice c-indent-line c-basic-offset)
|
|
|
|
|
(smart-tabs-advice c-indent-region c-basic-offset)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-add-language-support cmake cmake-mode-hook
|
|
|
|
|
(
|
|
|
|
|
(cmake-indent . cmake-tab-width)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-add-language-support protobuf protobuf-mode-hook
|
|
|
|
|
(
|
|
|
|
|
(c-indent-line . c-basic-offset)
|
|
|
|
|
(c-indent-region . c-basic-offset)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-add-language-support glsl glsl-mode-hook
|
|
|
|
|
(
|
|
|
|
|
(c-indent-line . c-basic-offset)
|
|
|
|
|
(c-indent-region . c-basic-offset)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-add-language-support opencl opencl-mode-hook
|
|
|
|
|
(
|
|
|
|
|
(c-indent-line . c-basic-offset)
|
|
|
|
|
(c-indent-region . c-basic-offset)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-add-language-support elisp emacs-lisp-mode-hook
|
|
|
|
|
(
|
|
|
|
|
(lisp-indent-line . lisp-indent-offset)
|
|
|
|
|
(lisp-indent-region . lisp-indent-offset)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(smart-tabs-insinuate 'c 'c++ 'cmake 'nxml 'protobuf 'glsl 'elisp)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package aggressive-indent
|
|
|
|
|
:hook
|
|
|
|
|
@@ -226,49 +388,140 @@
|
|
|
|
|
(magit-credential-cache-daemon-socket nil)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package yasnippet
|
|
|
|
|
:delight yas-minor-mode
|
|
|
|
|
:bind ( :map yas-minor-mode-map
|
|
|
|
|
("TAB" . nil)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package yasnippet-snippets
|
|
|
|
|
:after yasnippet
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package company
|
|
|
|
|
:after yasnippet
|
|
|
|
|
:delight
|
|
|
|
|
:bind ( ("M-TAB" . company-complete) )
|
|
|
|
|
:init
|
|
|
|
|
(defun atu/company-prog-mode ()
|
|
|
|
|
"Starts yas company and set up backends accordingly"
|
|
|
|
|
(yas-minor-mode)
|
|
|
|
|
(company-mode)
|
|
|
|
|
)
|
|
|
|
|
:config
|
|
|
|
|
(global-company-mode t)
|
|
|
|
|
(setq
|
|
|
|
|
company-minimum-prefix-length 1
|
|
|
|
|
company-idle-delay 0.5)
|
|
|
|
|
(setq company-backends
|
|
|
|
|
'(
|
|
|
|
|
(company-capf :separate company-yasnippet)
|
|
|
|
|
company-files
|
|
|
|
|
company-keywords
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:hook
|
|
|
|
|
(prog-mode . atu/company-prog-mode)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package cmake-mode
|
|
|
|
|
:ensure-system-package (
|
|
|
|
|
(cmake . cmake)
|
|
|
|
|
(pip . python3-pip)
|
|
|
|
|
(cmake-format . "pip install --user cmakelang[YAML]")
|
|
|
|
|
(pipx . pipx)
|
|
|
|
|
(cmake-format . "pipx install cmakelang[YAML]")
|
|
|
|
|
(cmake-language-server . "pipx install cmake-language-server")
|
|
|
|
|
)
|
|
|
|
|
:config
|
|
|
|
|
(setq cmake-tab-width 4)
|
|
|
|
|
|
|
|
|
|
(defun atu/create-or-erase-buffer (buffer-name)
|
|
|
|
|
""
|
|
|
|
|
(let ((existing-buffer (get-buffer buffer-name)))
|
|
|
|
|
(when existing-buffer
|
|
|
|
|
(with-current-buffer existing-buffer
|
|
|
|
|
(erase-buffer)))
|
|
|
|
|
(get-buffer-create buffer-name))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/cmake-format-buffer ()
|
|
|
|
|
"Formats the current buffer using cmake-format"
|
|
|
|
|
(interactive)
|
|
|
|
|
(shell-command-on-region
|
|
|
|
|
;; region to execute on
|
|
|
|
|
(let (
|
|
|
|
|
(error-buffer (atu/create-or-erase-buffer "*cmake-format:stderr*"))
|
|
|
|
|
(cmake-format-config-file-exists
|
|
|
|
|
(file-exists-p (projectile-expand-root ".cmake-format.yaml"))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(setq-local atu/after-save-message nil)
|
|
|
|
|
(if cmake-format-config-file-exists
|
|
|
|
|
(if (eq 0 (call-process-region
|
|
|
|
|
;;region
|
|
|
|
|
(point-min)
|
|
|
|
|
(point-max)
|
|
|
|
|
;; command
|
|
|
|
|
"cmake-format -"
|
|
|
|
|
;; replace
|
|
|
|
|
t
|
|
|
|
|
;; name of the error bufer
|
|
|
|
|
"* cmake-format Error Buffer *"
|
|
|
|
|
;;
|
|
|
|
|
t))
|
|
|
|
|
"cmake-format"
|
|
|
|
|
nil ;do not delete buffer
|
|
|
|
|
;; discard stdout copy stderr to buffer
|
|
|
|
|
error-buffer
|
|
|
|
|
nil ;dont-redisplay buffer
|
|
|
|
|
"-"
|
|
|
|
|
))
|
|
|
|
|
(let ((current-point (point)))
|
|
|
|
|
(call-process-region
|
|
|
|
|
(point-min) (point-max)
|
|
|
|
|
"cmake-format"
|
|
|
|
|
t t t; replace current buffer and redisplay it
|
|
|
|
|
"--log-level=error" "-"
|
|
|
|
|
)
|
|
|
|
|
(goto-char (+ (point-min) current-point))
|
|
|
|
|
nil
|
|
|
|
|
)
|
|
|
|
|
(message
|
|
|
|
|
"cmake-format: could not format %s see buffer %s for details"
|
|
|
|
|
(buffer-name) error-buffer)
|
|
|
|
|
(current-message)
|
|
|
|
|
)
|
|
|
|
|
(message "cmake-format: skipping as no configuration file found")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/cmake-before-save-hook ()
|
|
|
|
|
""
|
|
|
|
|
(setq-local atu/after-save-message (atu/cmake-format-buffer))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/cmake-after-save-hook ()
|
|
|
|
|
""
|
|
|
|
|
(when atu/after-save-message
|
|
|
|
|
(message atu/after-save-message)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:hook
|
|
|
|
|
(cmake-mode . lsp-deferred)
|
|
|
|
|
(cmake-mode . (lambda () (add-hook 'before-save-hook 'atu/cmake-format-buffer nil 'local)))
|
|
|
|
|
(cmake-mode . (lambda ()
|
|
|
|
|
(add-hook 'before-save-hook 'atu/cmake-before-save-hook nil 'local)
|
|
|
|
|
(add-hook 'after-save-hook 'atu/cmake-after-save-hook nil 'local))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package cc-mode
|
|
|
|
|
:ensure nil
|
|
|
|
|
:ensure-system-package
|
|
|
|
|
(clangd . clangd)
|
|
|
|
|
:config
|
|
|
|
|
(setq lsp-clients-clangd-args
|
|
|
|
|
'("--header-insertion-decorators=0" "--query-driver=/**/arm-none-eabi-*" "--log=verbose"))
|
|
|
|
|
:hook
|
|
|
|
|
(c-mode . lsp-deferred)
|
|
|
|
|
(c++-mode . lsp-deferred)
|
|
|
|
|
(c++-mode . (lambda () (setq-local lsp-enable-on-type-formatting nil)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package clang-format+
|
|
|
|
|
@@ -278,20 +531,31 @@
|
|
|
|
|
(c-mode-common . clang-format+-mode)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package yasnippet
|
|
|
|
|
:delight yas-minor-mode
|
|
|
|
|
:config
|
|
|
|
|
(yas-global-mode)
|
|
|
|
|
:after (company)
|
|
|
|
|
:bind ( :map yas-minor-mode-map
|
|
|
|
|
("TAB" . nil)
|
|
|
|
|
)
|
|
|
|
|
(use-package string-inflection
|
|
|
|
|
:bind
|
|
|
|
|
("C-c u" . string-inflection-all-cycle)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package yasnippet-snippets
|
|
|
|
|
:after (yasnippet)
|
|
|
|
|
(use-package polymode
|
|
|
|
|
:config
|
|
|
|
|
(define-hostmode poly-pio-hostmode
|
|
|
|
|
:mode 'asm-mode)
|
|
|
|
|
|
|
|
|
|
(define-auto-innermode poly-pio-c-innermode
|
|
|
|
|
:mode 'c-mode
|
|
|
|
|
:head-matcher "^%c-sdk{$"
|
|
|
|
|
:tail-matcher "^%}$"
|
|
|
|
|
:head-mode 'host
|
|
|
|
|
:tail-mode 'host)
|
|
|
|
|
|
|
|
|
|
(define-polymode poly-pio-mode
|
|
|
|
|
:hostmode 'poly-pio-hostmode
|
|
|
|
|
:innermodes '(poly-pio-c-innermode))
|
|
|
|
|
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.pio$" . poly-pio-mode))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package projectile
|
|
|
|
|
:bind ( :map projectile-mode-map
|
|
|
|
|
( "C-c p" . 'projectile-command-map)
|
|
|
|
|
@@ -306,8 +570,97 @@
|
|
|
|
|
:test "ng test --progress=false"
|
|
|
|
|
:run "ng serve"
|
|
|
|
|
:test-suffix ".spec")
|
|
|
|
|
(defun atu/cmake-cc-inference (dir)
|
|
|
|
|
"Detects if the current root is a CMake C/C++ project"
|
|
|
|
|
(let ((cmakelists-file (projectile-expand-root "CMakeLists.txt" dir)))
|
|
|
|
|
(if (file-exists-p cmakelists-file)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents cmakelists-file)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward "project[[:space:]]*([^)]+\\([[:space:]]C\\(XX\\)?[[:space:]]\\)[^)]+)" nil t)
|
|
|
|
|
)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/cc-related-files (path)
|
|
|
|
|
"Returns related files path for a C/C++ file for a given path"
|
|
|
|
|
(let* (
|
|
|
|
|
(ext (file-name-extension path))
|
|
|
|
|
(basename (file-name-base path))
|
|
|
|
|
(dirpath (file-name-directory path))
|
|
|
|
|
(impl-rx "\\([.-]?[Ii]mp[l]?\\)$")
|
|
|
|
|
)
|
|
|
|
|
(if (member ext '("h" "hh" "hpp"))
|
|
|
|
|
(if (string-match impl-rx basename)
|
|
|
|
|
(list :other (concat dirpath
|
|
|
|
|
(string-replace
|
|
|
|
|
(match-string 1 basename)
|
|
|
|
|
""
|
|
|
|
|
basename)
|
|
|
|
|
"."
|
|
|
|
|
ext))
|
|
|
|
|
(list :other
|
|
|
|
|
(mapcar (lambda (sfx) (concat dirpath basename sfx))
|
|
|
|
|
(list
|
|
|
|
|
(concat "Imp." ext)
|
|
|
|
|
(concat "Impl." ext)
|
|
|
|
|
(concat "imp." ext)
|
|
|
|
|
(concat "impl." ext)
|
|
|
|
|
(concat ".Imp." ext)
|
|
|
|
|
(concat ".Impl." ext)
|
|
|
|
|
(concat ".imp." ext)
|
|
|
|
|
(concat ".impl." ext)
|
|
|
|
|
(concat "-Imp." ext)
|
|
|
|
|
(concat "-Impl." ext)
|
|
|
|
|
(concat "-imp." ext)
|
|
|
|
|
(concat "-impl." ext)
|
|
|
|
|
".cpp"
|
|
|
|
|
".c"
|
|
|
|
|
)))
|
|
|
|
|
)
|
|
|
|
|
(when (member ext '("c" "cc" "cpp"))
|
|
|
|
|
(list :other
|
|
|
|
|
(mapcar (lambda (sfx) (concat dirpath basename sfx))
|
|
|
|
|
'( ".h" ".hh" ".hpp" )))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(projectile-register-project-type 'cmake-cc #'atu/cmake-cc-inference
|
|
|
|
|
:project-file "CMakeLists.txt"
|
|
|
|
|
:configure "cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=On"
|
|
|
|
|
:compile (format "cmake --build build -j %d" atu/numprocs)
|
|
|
|
|
:test (format "cmake --build build -j %d --target check" atu/numprocs)
|
|
|
|
|
:related-files-fn
|
|
|
|
|
(list
|
|
|
|
|
#'atu/cc-related-files
|
|
|
|
|
(projectile-related-files-fn-test-with-suffix "cpp" "Test")
|
|
|
|
|
(projectile-related-files-fn-test-with-suffix "cpp" "UTest")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; (use-package polymode
|
|
|
|
|
;; :config
|
|
|
|
|
;; (define-hostmode poly-pio-hostmode
|
|
|
|
|
;; :mode 'asm-mode)
|
|
|
|
|
|
|
|
|
|
;; (define-innermode poly-pio-c-innermode
|
|
|
|
|
;; :mode 'c-mode
|
|
|
|
|
;; :head-matcher "^% c-sdk {$"
|
|
|
|
|
;; :tail-matcher "^%}$"
|
|
|
|
|
;; :head-mode 'host
|
|
|
|
|
;; :tail-mode 'host)
|
|
|
|
|
|
|
|
|
|
;; (define-polymode poly-pio-mode
|
|
|
|
|
;; :hostmode 'poly-pio-hostmode
|
|
|
|
|
;; :innermodes '(poly-pio-c-innermode))
|
|
|
|
|
|
|
|
|
|
;; (add-to-list 'auto-mode-alist '("\\.pio$" . poly-pio-mode))
|
|
|
|
|
|
|
|
|
|
;; )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package vterm)
|
|
|
|
|
|
|
|
|
|
(use-package flycheck
|
|
|
|
|
@@ -348,23 +701,26 @@
|
|
|
|
|
(setq lsp-keymap-prefix "C-c l")
|
|
|
|
|
:bind-keymap ("C-c l" . lsp-command-map)
|
|
|
|
|
:config
|
|
|
|
|
(yas-minor-mode)
|
|
|
|
|
(if (display-graphic-p)
|
|
|
|
|
(setq lsp-ui-doc-use-webkit t)
|
|
|
|
|
)
|
|
|
|
|
(add-to-list 'lsp-language-id-configuration '("\\.postcss\\'" . "css"))
|
|
|
|
|
(advice-add 'lsp :before
|
|
|
|
|
(lambda (&rest _args)
|
|
|
|
|
(eval '(setf (lsp-session-server-id->folders (lsp-session)) (ht)
|
|
|
|
|
(defun atu/lsp-inline-completion-display-toggle-key ()
|
|
|
|
|
"Add or remove `i` key from the lsp-command-map` depending on `lsp-inline-completion-mode`"
|
|
|
|
|
(if lsp-inline-completion-mode
|
|
|
|
|
(define-key lsp-command-map (kbd "i") #'lsp-inline-completion-display)
|
|
|
|
|
(define-key lsp-command-map (kbd "i") nil)))
|
|
|
|
|
|
|
|
|
|
(with-eval-after-load 'lsp-inline-completion
|
|
|
|
|
(define-key lsp-inline-completion-active-map (kbd "C-j") #'lsp-inline-completion-accept)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
:bind (
|
|
|
|
|
("C-c C-d" . lsp-ui-doc-toggle)
|
|
|
|
|
)
|
|
|
|
|
:hook
|
|
|
|
|
:bind (("C-c C-d" . lsp-ui-doc-toggle))
|
|
|
|
|
|
|
|
|
|
:hook (
|
|
|
|
|
(lsp-mode . lsp-enable-which-key-integration)
|
|
|
|
|
(lsp-inline-completion-mode . lsp-inline-completion-company-integration-mode)
|
|
|
|
|
(lsp-inline-completion-mode . atu/lsp-inline-completion-display-toggle-key)
|
|
|
|
|
)
|
|
|
|
|
:commands
|
|
|
|
|
(lsp lsp-deferred)
|
|
|
|
|
)
|
|
|
|
|
@@ -538,8 +894,52 @@
|
|
|
|
|
(add-hook 'before-save-hook 'py-isort-before-save)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package code-cells
|
|
|
|
|
:mode ("\\.sync.py'" . code-cells-mode)
|
|
|
|
|
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.h\\'" . c-c++-header))
|
|
|
|
|
:config
|
|
|
|
|
(defun atu/jupyter-ascending-sync ()
|
|
|
|
|
"Runs synchronization with jupyter-ascending "
|
|
|
|
|
(interactive)
|
|
|
|
|
(when (string-match-p ".sync.py\\'" (buffer-name))
|
|
|
|
|
(unless (and (boundp 'atu/jupyter-sync-inhibit) atu/jupyter-sync-inhibit)
|
|
|
|
|
(call-process "python"
|
|
|
|
|
nil nil nil
|
|
|
|
|
"-m" "jupyter_ascending.requests.sync" "--filename" (buffer-file-name)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun atu/jupyter-ascending-eval (start end)
|
|
|
|
|
"Runs cell via jupyter-ascending or python-shell-send-region"
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (string-match-p ".sync.py\\'" (buffer-name)))
|
|
|
|
|
(python-shell-send-region start end)
|
|
|
|
|
(setq-local atu/jupyter-sync-inhibit t)
|
|
|
|
|
(save-buffer)
|
|
|
|
|
(setq-local atu/jupyter-sync-inhibit nil)
|
|
|
|
|
(call-process "python"
|
|
|
|
|
nil nil nil
|
|
|
|
|
"-m" "jupyter_ascending.requests.execute"
|
|
|
|
|
"--filename" (buffer-file-name)
|
|
|
|
|
"--linenumber" (number-to-string (line-number-at-pos))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(setq code-cells-eval-region-commands
|
|
|
|
|
(mapcar (lambda (pair)
|
|
|
|
|
(if (eq (car pair) 'python-mode)
|
|
|
|
|
(cons 'python-mode 'atu/jupyter-ascending-eval)
|
|
|
|
|
pair))
|
|
|
|
|
code-cells-eval-region-commands))
|
|
|
|
|
|
|
|
|
|
:hook
|
|
|
|
|
(python-mode . code-cells-mode-maybe)
|
|
|
|
|
(code-cells-mode . (lambda ()
|
|
|
|
|
(add-hook 'after-save-hook 'atu/jupyter-ascending-sync nil 'local)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package markdown-mode)
|
|
|
|
|
|
|
|
|
|
@@ -547,17 +947,19 @@
|
|
|
|
|
:after (projectile)
|
|
|
|
|
:config
|
|
|
|
|
(unbind-key "C-c C-d" go-mode-map)
|
|
|
|
|
(defun go-compile-command ()
|
|
|
|
|
(defun atu/go-compile-command ()
|
|
|
|
|
"returns a string to compile a go project"
|
|
|
|
|
(setq project-makefile (concat (file-name-as-directory (projectile-project-root)) "Makefile"))
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((project-makefile (concat (file-name-as-directory (projectile-project-root)) "Makefile")))
|
|
|
|
|
(if (file-exists-p project-makefile)
|
|
|
|
|
"make"
|
|
|
|
|
"go build && go test && go vet"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
(projectile-update-project-type
|
|
|
|
|
'go
|
|
|
|
|
:compile 'go-compile-command)
|
|
|
|
|
:compile 'atu/go-compile-command)
|
|
|
|
|
:hook
|
|
|
|
|
(go-mode . lsp-deferred)
|
|
|
|
|
(go-mode . (lambda ()
|
|
|
|
|
@@ -567,7 +969,7 @@
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(use-package glsl-mode)
|
|
|
|
|
(use-package opencl-mode)
|
|
|
|
|
(use-package opencl-c-mode)
|
|
|
|
|
|
|
|
|
|
(use-package protobuf-mode
|
|
|
|
|
:mode "\\.proto\\'"
|
|
|
|
|
@@ -619,6 +1021,15 @@
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package spdx
|
|
|
|
|
:quelpa (spdx :fetcher github :repo "condy0919/spdx.el")
|
|
|
|
|
:bind (:map prog-mode-map
|
|
|
|
|
("C-c i l" . spdx-insert-spdx))
|
|
|
|
|
:custom
|
|
|
|
|
(spdx-copyright-holder 'auto)
|
|
|
|
|
(spdx-project-detection 'auto))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; vc-follow-symlinks: t
|
|
|
|
|
|