From 08b120f0b7b07376de40c18792a529a611088f90 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Tue, 1 Aug 2023 21:35:36 -0700 Subject: [PATCH] feat: add `cppconfig.el` Signed-off-by: Lucas Sta Maria --- .config/ambit/config.ambit | 3 ++- .emacs.d/include/cppconfig.el | 27 +++++++++++++++++++++++++++ .emacs.d/init.el | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .emacs.d/include/cppconfig.el diff --git a/.config/ambit/config.ambit b/.config/ambit/config.ambit index 6e0cff5..b0552af 100644 --- a/.config/ambit/config.ambit +++ b/.config/ambit/config.ambit @@ -52,7 +52,8 @@ orgconfig.el, mu4econfig.el, racket.el, - latexconfig.el + latexconfig.el, + cppconfig.el ] ]; .config/picom.conf; diff --git a/.emacs.d/include/cppconfig.el b/.emacs.d/include/cppconfig.el new file mode 100644 index 0000000..89e194f --- /dev/null +++ b/.emacs.d/include/cppconfig.el @@ -0,0 +1,27 @@ +;;; cppconfig.el --- Configuration for C/C++ +;;; Commentary: +;; Custom configuration for C/C++. +;;; Code: + +(defun custom-compile-c++ () + "Run the `just' command -- the command I use to compile my environment." + (interactive) + (save-buffer) + (compile (concat "just build " (buffer-name)))) + +(defun custom-run-c++ () + "Run the produced `bin' binary." + (interactive) + (shell-command "./bin")) + +(defun configure-c++ () + "Configure my custom C++ enviroment." + (local-set-key (kbd "C-c C-c") #'custom-compile-c++) + (local-set-key (kbd "C-c C-r") #'custom-run-c++) + (local-set-key (kbd "C-c C-.") #'company-complete)) + +(add-hook 'c-mode-hook #'configure-c++) +(add-hook 'c++-mode-hook #'configure-c++) + +(provide 'cppconfig) +;;; cppconfig.el ends here diff --git a/.emacs.d/init.el b/.emacs.d/init.el index bf0c212..ee08918 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -59,6 +59,7 @@ (straight-use-package 'scribble-mode) (straight-use-package 'go-mode) (straight-use-package 'auctex) +(straight-use-package 'yaml-mode) ;; ====== Custom ============================= @@ -71,6 +72,7 @@ (load-library "mu4econfig") (load-library "racket") (load-library "latexconfig") +(load-library "cppconfig") ;; ====== Hooks ============================== (add-hook 'after-init-hook 'global-company-mode)