summaryrefslogtreecommitdiff
path: root/.config/emacs/init.el
blob: a74ca9dc737d8f0a56936d70b89f7f90fe74f72c (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
;; Packages
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

;; Basics
(set-face-attribute 'default nil :height 160 :family "DejaVu Sans Mono")
; (add-to-list 'default-frame-alist '(undecorated . t))
(global-unset-key (kbd "C-z"))
(global-unset-key (kbd "C-x C-z"))
(setq use-dialog-box nil)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(blink-cursor-mode -1)
(save-place-mode 1)
(fringe-mode 0)
; (require 'ivy)
; (ivy-mode 1)
(setq custom-safe-themes t)
; (load-file "~/.config/emacs/runxiyu-theme-theme.el")
; (load-theme 'runxiyu-theme)
; (load-theme 'wheatgrass)
(load-theme 'adwaita)

;; Evil
(setq evil-undo-system 'undo-redo
      evil-want-fine-undo t)
(require 'evil)
(evil-mode 1)

;; Embed wayland
(defun sway () (interactive) (call-process "sway"))

;; Pinyin
; (with-no-warnings (require 'pyim)
;                   (require 'pyim-basedict)
;                   (pyim-basedict-enable)
;                   (setq default-input-method "pyim"))

;; Org
(require 'org)
(setq org-agenda-files '("~/orp/" "~/org/" "~/od/ibdp/")
      org-agenda-start-on-weekday 0
      org-default-notes-file "~/org/index.org")

;; Git
(require 'magit)

;; Lisp
(with-no-warnings (require 'paredit))
(with-no-warnings (require 'sly))

;; Tree sitter
(setq treesit-language-source-alist '((c "https://github.com/tree-sitter/tree-sitter-c")
                                      (cpp "https://github.com/tree-sitter/tree-sitter-cpp")
                                      (go "https://github.com/tree-sitter/tree-sitter-go")
                                      (markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown"))
      major-mode-remap-alist '((c-mode . c-ts-mode)
                               (cpp-mode . cpp-ts-mode)))

;; Indentation
(setq c-default-style "linux"
      c-basic-offset 8
      tab-width 8
      indent-tabs-mode t)
(setq custom-tab-width 8)
(defun disable-tabs () (interactive) (setq indent-tabs-mode nil))
(defun enable-tabs  () (interactive)
  (local-set-key (kbd "TAB") 'tab-to-tab-stop)
  (setq indent-tabs-mode t)
  (setq tab-width custom-tab-width))
(add-hook 'prog-mode-hook 'enable-tabs)
(add-hook 'text-mode-hook 'enable-tabs)
(add-hook 'lisp-mode-hook 'disable-tabs)
(add-hook 'emacs-lisp-mode-hook 'disable-tabs)
(setq-default electric-indent-inhibit t)
(setq backward-delete-char-untabify-method 'hungry)


;; IRC
(require 'circe)
(setq lui-fill-column 90)
(setq my-credentials-file "~/.local/share/secrets/irc.el")
(defun my-znc-password (server)
  (with-temp-buffer
    (insert-file-contents-literally my-credentials-file)
    (plist-get (read (buffer-string)) :pass)))
(setq circe-networks '(("libera"
		       :host "irc.runxiyu.org"
		       :port 26697
		       :user "runxiyu/libera"
		       :pass my-znc-password
		       :use-tls t)
		      ("rx"
		       :host "irc.runxiyu.org"
		       :port 26697
		       :user "runxiyu/rx"
		       :pass my-znc-password
		       :use-tls t)))

;; Dired
(setq dired-listing-switches "-l")

;; Server
(server-start)


;; Warnings
; (setq warning-minimum-level :emergency) ; bad practice but meh

(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.
 '(package-selected-packages
   '(go darkroom gameoflife xresources-theme vterm vscode-dark-plus-theme solarized-theme sly pyim-basedict pyim pinyin paredit markdown-mode magit ivy helm exwm evil circe)))
(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.
 )