summaryrefslogtreecommitdiff
path: root/emacs.el
blob: f234f42465f3d1035a52ccdb62c7fed861c0b617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
(setq visible-bell t)

;; Interface configurations
(menu-bar-mode 1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(global-display-line-numbers-mode 1)
(column-number-mode 1)
(load-theme 'adwaita t) ;; Use 'wombat' for dark, 'adwaita' for light
(set-face-attribute 'default nil :height 160) ;; Text size

;; Backup and autosave directory setup
(let ((backup-dir "~/.emacs.d/aux/"))
  (unless (file-exists-p backup-dir)
    (make-directory backup-dir t))
  (setq lock-file-name-transforms `((".*" ,backup-dir t)))
  (setq auto-save-file-name-transforms `((".*" ,backup-dir t)))
  (setq backup-directory-alist `((".*" . ,backup-dir))))

(display-battery-mode 1)

;; Tab and indentation
(setq-default tab-width 4)
(setq c-basic-offset 4)

(defun lmid () ;; Move cursor to the middle of the current line
  (interactive)
  (let ((line-length (- (line-end-position) (line-beginning-position))))
    (goto-char (+ (line-beginning-position) (/ line-length 2)))))

(custom-set-variables
 '(elcord-editor-icon "emacs_legacy_icon")
 '(elcord-idle-message "Got distracted again...")
 '(elcord-idle-timer 600)
 '(elcord-quiet t)
 '(elcord-refresh-rate 10)
 '(package-selected-packages '(elcord flycheck corfu company)))

;; Set up package management
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

;; Ensure use-package is installed
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

;; Package configurations
(use-package flycheck
  :ensure t
  :hook ((c-mode . flycheck-mode)
         (c++-mode . flycheck-mode))
  :config
  (setq-default flycheck-gcc-language-standard "c++20"
                flycheck-clang-language-standard "c++20"))

(use-package company
  :ensure t
  :hook ((c-mode . company-mode)
         (c++-mode . company-mode))
  :config
  (setq company-backends '((company-clang company-files company-yasnippet)))
  (setq company-clang-arguments '("-std=c++20")))

;; Enable Discord Rich Presence integration
(use-package elcord
  :ensure t
  :config
  (elcord-mode))