Files
nixfiles/xdg/emacs/init.el

154 lines
4.7 KiB
EmacsLisp

;; pager emacs config, currently updated April 4, 2023
;; Packages now handled in `.emacs.d/packages.el`
(setq package-enable-at-startup nil)
(load "~/.config/emacs/packages.el")
;; Misc Requires and imports
(add-to-list 'load-path "~/.config/emacs/lisp/")
(load "~/.config/emacs/lisp/functions.el")
(add-to-list 'load-path "~/.config/emacs/modes")
(require 'expand-region)
(require 'ido)
(require 'go-mode-load)
(require 'popup)
(require 'auto-complete)
(require 'auto-highlight-symbol)
;; Custom styles and general bindings
(setq custom-file "~/.config/emacs/custom.el")
(load custom-file)
(load "~/.config/emacs/bindings.el")
(load "~/.config/emacs/modes/mode-hooks.el")
;; Change settings for backup files.
;; Set the directory to store them in to ~/.emacs.d/autosaves.
(if (eq (user-uid) 0)
;; Root Backups do not go in the shared emacs config file.
(setq backup-directory-alist `(("." . "~/.emacs-autosaves")))
;; Else
(setq backup-directory-alist `(("." . "~/.config/emacs/autosaves"))))
;; Backup things by copying them.
(setq backup-by-copying t)
;; Set some other backup related options.
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; Set syntax hilighting to maximum. Does this do anything?
(setq font-lock-maximum-decoration t)
;; Start ido mode
(ido-mode t)
;; Set tetris score file
;; (setq tetris-score-file "~/.emacs.d/tetris-scores")
;; Automatically added when running functions
(put 'upcase-region 'disabled nil)
(put 'scroll-left 'disabled nil)
(setq auto-fill-mode 1)
;; Fix the scratch buffer, make it more useful
(setq initial-major-mode 'text-mode)
(setq initial-scratch-message (concat "-- " (format-time-string "%A %B %d %H:%M:%S") " --\n\n"))
(add-hook 'c++-mode-hook 'my:ac-c-headers-init)
(add-hook 'c-mode-hook 'my:ac-c-headers-init)
;;(add-hook 'org-mode (lambda () (load "~/.emacs.d/org-mode.el") t)
;; Indentation settings
(setq indent-tabs-mode nil)
(global-visual-line-mode t)
;; For Scheme programming
(setq scheme-program-name "tinyscheme")
;; Slime mode setup
(add-hook 'slime-mode-hook (lambda () (interactive)
(local-set-key (kbd "C-o C-e") 'slime-eval-last-expression)))
;; basic programming settings
(add-hook 'prog-mode-hook
(lambda()
(global-display-line-numbers-mode)
;; (copilot-mode)
(hs-minor-mode)))
(add-hook 'hs-minor-mode-hook
(lambda()
(local-set-key (kbd "C-c SPC") 'hs-toggle-hiding)))
;; copilot mode bindings
;; (add-hook 'copilot-mode-hook
;; (lambda()
;; (define-key copilot-mode-map (kbd "C-<tab>") 'copilot-accept-completion)
;; (define-key copilot-mode-map (kbd "M-<right>") 'copilot-next-completion)
;; (define-key copilot-mode-map (kbd "M-<left>") 'copilot-previous-completion)
;; (define-key copilot-mode-map (kbd "M-<down>") 'copilot-accept-completion-by-line)))
(put 'set-goal-column 'disabled nil)
;; Auto-hilight symbol mode
(global-auto-highlight-symbol-mode t)
;; For js-beutify.el
(eval-after-load 'js2-mode
'(define-key js2-mode-map (kbd "C-c b") 'web-beautify-js))
(eval-after-load 'json-mode
'(define-key json-mode-map (kbd "C-c b") 'web-beautify-js))
(eval-after-load 'sgml-mode
'(define-key html-mode-map (kbd "C-c b") 'web-beautify-html))
(eval-after-load 'css-mode
'(define-key css-mode-map (kbd "C-c b") 'web-beautify-css))
;; Delete trailing whitespace on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; For magit setup
(setq magit-last-seen-setup-instructions "1.4.0")
;; Trunkating lines
(setq truncate-partial-width-windows nil)
(set-default 'truncate-lines t)
(put 'narrow-to-region 'disabled nil)
;; Create a buffer-local hook to run elixir-format on save, only when we enable elixir-mode.
(add-hook 'elixir-mode-hook
(lambda ()
(add-hook 'before-save-hook 'elixir-format nil t)))
;; Finally some python stuff
(add-hook 'python-mode-hook
(lambda ()
(python-black-on-save-mode)))
;; (load-theme 'FairyFloss t)
;; (load "~/.emacs.d/fairyfloss-theme.el")
;; Ported from previous styles.el
(setq inhibit-startup-screen t)
(menu-bar-mode 0)
(if (display-graphic-p)
(progn
(load-theme 'dracula t)
(tool-bar-mode 0)
(setq default-frame-alist '((right-fringe . 0)
(left-fringe . 0)
;; scroll-bar-width only applies
;; when not using toolkit scrollbars
(scroll-bar-width . 10))
)
(custom-set-faces
'(scroll-bar ((t (:background "#4d405b" :foreground "#cf87de" :height 1.0 :width condensed))))
'(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 130 :width normal :foundry "unknown" :family "Roboto Mono")))))
))