;; Basic appearence and behaviour. (setq inhibit-startup-message t) (setq auto-save-default nil) (setq make-backup-files nil) (cond ((find-font (font-spec :name "Berkeley Mono")) (set-face-attribute 'default nil :font "Berkeley Mono" :height 120))) (global-set-key (kbd "") 'keyboard-escape-quit) (scroll-bar-mode -1) (tool-bar-mode -1) (set-fringe-mode 10) (setq column-number-mode t) (menu-bar-mode -1) ;; For Emacs >=29. (pixel-scroll-precision-mode t) ;; Messes with the Terraform LSP, and I don't really need this myself. (setq create-lockfiles nil) ;; Orgmode tweaks. (setq org-edit-src-content-indentation 0 org-src-tab-acts-natively t org-src-preserve-indentation t) (setq-default tab-width 4) ;; WSL keybinds to work around some weirdness. (global-set-key (kbd "C-c y") 'clipboard-yank) (global-set-key (kbd "C-c x") 'kill-ring-save) ;; straight.el bootstrapping (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) ;; package list we want installed ;; first use-package (straight-use-package 'use-package) (use-package modus-themes :straight t) (use-package vterm :straight t) (use-package el-patch :straight t) (use-package doom-modeline :straight t :init (doom-modeline-mode 1) :custom (doom-mode-line-height 14)) (use-package all-the-icons :straight t) (use-package paredit :straight t :config (add-hook 'emacs-lisp-mode-hook #'paredit-mode) (add-hook 'lisp-interaction-mode-hook #'paredit-mode) (add-hook 'ielm-mode-hook #'paredit-mode) (add-hook 'lisp-mode-hook #'paredit-mode) (add-hook 'eval-expression-minibuffer-setup-hook #'paredit-mode)) (use-package which-key :straight t :config (which-key-mode)) (use-package projectile :straight t :init (projectile-mode +1) :config (setq projectile-project-search-path '("~/Projects")) :bind (:map projectile-mode-map ("s-p" . projectile-command-map) ("C-c p" . projectile-command-map))) (use-package magit :straight t) (use-package hide-mode-line :straight t) (add-hook 'org-mode-hook #'hide-mode-line-mode) (add-hook 'treemacs-mode-hook #'hide-mode-line-mode) (use-package treemacs :straight t :init (with-eval-after-load 'winum (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) :bind (:map global-map ("M-0" . treemacs-select-window) ("C-x t t" . treemacs) ("C-x t C-t" . treemacs-find-file))) (use-package treemacs-projectile :straight t :after (treemacs projectile)) ;; I hate that I need this, but WSL is /special/. (when (and (eq system-type 'gnu/linux) (getenv "WSLENV")) (use-package exec-path-from-shell :straight t) (exec-path-from-shell-initialize)) ;; Direnv integration (use-package direnv :straight t) (direnv-mode) ;; Fancy tabs (use-package centaur-tabs :straight t :config (setq centaur-tabs-style "bar" centaur-tabs-height 32 centaur-tabs-set-icons t centaur-tabs-set-modified-marker t centaur-tabs-show-navigation-buttons t centaur-tabs-set-bar 'under x-underline-at-descent-line t) (centaur-tabs-headline-match) (setq uniquify-separator "/") (setq uniquify-buffer-name-style 'forward) :bind ("C-" . centaur-tabs-backward) ("C-" . centaur-tabs-forward)) (use-package org-modern :straight t) (add-hook 'org-mode-hook #'org-modern-mode) (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) (setq ;; Edit settings ;;org-auto-align-tags nil ;;org-tags-column 0 org-catch-invisible-edits 'show-and-error org-special-ctrl-a/e t org-insert-heading-respect-content t ;; Org styling, hide markup etc. org-hide-emphasis-markers t org-pretty-entities t org-ellipsis " →" ;; Agenda styling org-agenda-tags-column 0 org-agenda-block-separator ?─ org-agenda-time-grid '((daily today require-timed) (800 1000 1200 1400 1600 1800 2000) " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") org-agenda-current-time-string "⭠ now ─────────────────────────────────────────────────") ;; lsp-mode stuff (use-package eglot :straight t :config (add-hook 'go-mode-hook 'eglot-ensure) (add-hook 'terraform-mode-hook 'eglot-ensure) (add-to-list 'eglot-server-programs '(terraform-mode . ("terraform-ls" "serve")))) (use-package company :straight t :config (add-hook 'after-init-hook 'global-company-mode) (setq company-idle-delay 0) (setq company-minimum-prefix-length 1)) (use-package go-mode :straight t) (use-package nix-mode :straight t :mode "\\.nix\\'") (use-package yaml-mode :straight t) (use-package svelte-mode :straight t) (use-package terraform-mode :straight t) (use-package yasnippet :straight t) (yas-global-mode 1) (use-package k8s-mode :straight t :config (setq k8s-search-documentation-browser-function 'browse-url-firefox) :hook (k8s-mode . yas-minor-mode)) (use-package kubernetes :straight t) (use-package rust-mode :straight t) (use-package tree-sitter :straight t) (use-package tree-sitter-indent :straight t) (use-package markdown-mode :straight t) (use-package olivetti :straight t) (use-package copilot :straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) :ensure t) ; complete by copilot first, then company-mode (defun my-tab () (interactive) (or (copilot-accept-completion) (company-indent-or-complete-common nil))) (use-package elfeed :straight t) (use-package chatgpt-shell :straight t) ; modify company-mode behaviors (with-eval-after-load 'company ; disable inline previews (delq 'company-preview-if-just-one-frontend company-frontends) ; enable tab completion (define-key company-mode-map (kbd "C-") 'my-tab) (define-key company-mode-map (kbd "C-TAB") 'my-tab) (define-key company-active-map (kbd "C-") 'my-tab) (define-key company-active-map (kbd "C-TAB") 'my-tab)) (setq treesit-language-source-alist '((bash "https://github.com/tree-sitter/tree-sitter-bash") (cmake "https://github.com/uyha/tree-sitter-cmake") (css "https://github.com/tree-sitter/tree-sitter-css") (elisp "https://github.com/Wilfred/tree-sitter-elisp") (go "https://github.com/tree-sitter/tree-sitter-go") (html "https://github.com/tree-sitter/tree-sitter-html") (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") (json "https://github.com/tree-sitter/tree-sitter-json") (make "https://github.com/alemuller/tree-sitter-make") (markdown "https://github.com/ikatyang/tree-sitter-markdown") (python "https://github.com/tree-sitter/tree-sitter-python") (toml "https://github.com/tree-sitter/tree-sitter-toml") (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") (yaml "https://github.com/ikatyang/tree-sitter-yaml"))) (setq major-mode-remap-alist '((yaml-mode . yaml-ts-mode) (bash-mode . bash-ts-mode) (js2-mode . js-ts-mode) (typescript-mode . typescript-ts-mode) (json-mode . json-ts-mode) (css-mode . css-ts-mode) (python-mode . python-ts-mode))) ;; Adapted from https://github.com/Slackwise/dotfiles/blob/master/emacs/slackwise.el (setq-default functions-file (concat (or (getenv "XDG_CONFIG_HOME") "~/.emacs.d/") "functions.el")) (when (file-exists-p functions-file) (load functions-file)) ;; Keep the customize system from borking up this file. (setq-default custom-file (concat (or (getenv "XDG_CONFIG_HOME") "~/.emacs.d/") "custom.el")) (when (file-exists-p custom-file) (load custom-file))