summaryrefslogtreecommitdiff
path: root/emacs/init.el
blob: a4f7bbe76ace074db12a008a17b45203b41014f7 (plain) (blame)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

;; Optional: Refresh the package list automatically if it's empty
(unless package-archive-contents
  (package-refresh-contents))

(unless (package-installed-p 'multiple-cursors)
  (package-refresh-contents)
  (package-install 'multiple-cursors))

(set-face-attribute 'default nil :family "Iosevka")
(set-face-attribute 'variable-pitch nil :family "Iosevka Aile")
;;(set-face-attribute 'org-modern-symbol nil :family "Iosevka")

(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)

;; (ido-mode 1)

(add-hook 'org-mode-hook #'org-modern-mode)

(require 'multiple-cursors)
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)

(global-set-key (kbd "C-z") 'mc/mark-next-like-this)
(global-set-key (kbd "S-<f2>") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-<f2>") 'mc/mark-all-like-this)

; Source - https://stackoverflow.com/a/5533251
; Posted by user173973, modified by community. See post 'Timeline' for change history
; Retrieved 2026-05-13, License - CC BY-SA 3.0

(global-set-key (kbd "C-ş") 'text-scale-increase)
(global-set-key (kbd "C-.") 'text-scale-decrease)

(global-set-key (kbd "M-s") 'shell-command)

(global-display-line-numbers-mode)
(setq backup-directory-alist `(("." . "~/emacs/autosaves/")))
(setq auto-save-file-name-transforms '((".*" "~/emacs/autosaves/\\1" t)))

(load-theme 'gruber-darker t)
(menu-bar-mode -1)

;; Disable the tool bar (the row of icons at the top)
(tool-bar-mode -1)

;; Disable the scroll bar (the vertical bar on the side)
(scroll-bar-mode -1)

(set-face-attribute 'default nil :height 170)

(setq project-vc-extra-root-markers '("CMakeLists.txt" "Makefile" "package.json" ".root"))

(use-package company
  :ensure t
  :init (global-company-mode)
  :config
  (setq company-idle-delay 0.0      ; How long to wait before popup (0 = instant)
        company-minimum-prefix-length 1)) ; Show list after typing 1 character

;(use-package lsp-mode
;  :ensure t
;  :init
;  :hook ((c-mode . lsp)
;         (c++-mode . lsp))
;  :custom
;  (lsp-enable-on-type-formatting nil)
;  (lsp-enable-indentation nil)
;  (lsp-before-save-formatting nil)
;  (electric-indent-mode -1)
;  :config
;  (setq-default c-basic-offset 8)
;  (setq-default c-default-style "bsd")
;  :commands lsp)

(setq project-vc-extra-root-markers '(".project"))
(setq project-find-functions '(project-try-vc))

(setenv "PATH" (concat "/home/cool/opt/cross/bin:" (getenv "PATH")))
(add-to-list 'exec-path "/home/cool/opt/cross/bin")

(setq-default c-basic-offset 8)

(defun c-style ()
  (c-set-offset 'defun-open 0)
  (c-set-offset 'substatement-open 0)
  
  (setq c-backslash-column 80)
  (setq c-backslash-max-column 80))

(add-hook 'c-mode-common-hook 'c-style)

(setq-default fill-column 80)

(global-display-fill-column-indicator-mode)

(defun my-c-backslash-region-80 ()
  (interactive)
  (c-backslash-region (region-beginning) (region-end) 80 nil))

(add-hook 'c-mode-hook
          (lambda ()
            (local-set-key (kbd "C-c \\") 'my-c-backslash-region-80)))

(custom-set-variables
 ;; custom-set-variables 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.
 '(auth-source-save-behavior nil)
 '(org-agenda-files
   '("~/schedule.org" "/home/cool/daily/2026-06-15/luggage.org"
     "/home/cool/daily/2026-06-15/todo.org"
     "/home/cool/daily/2026-06-16/todo.org"
     "/home/cool/daily/2026-06-17/todo.org"
     "/home/cool/daily/2026-06-18/todo.org"))
 '(package-selected-packages
   '(company gruber-darker-theme magit multiple-cursors org-modern org-roam smex)))
(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.
 )

(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)

(setq org-agenda-files
      (directory-files-recursively "~/monthly/" "\\.org$"))