Watch
1
0
Fork
You've already forked Zoe-Dotfiles
0
mirror of synced 2026-11-03 19:17:17 +00:00
Zoe-Dotfiles/emacs/.emacs.d/init.el

173 lines
5.7 KiB
EmacsLisp

;; -*- lexical-binding: nil; -*-
;; Keybind reminder for self:
;; C-x C-f : enter a file / find one
;; C-x C-f RET "/ssh:USER@IP:" logs into sh via emacs
;; C-x C-f RET '"ssh:USER@IP|sudo::/path/to/file" edit as superuser via ssh
;; C-x C-w : save file with name
;; C-x C-s : save file
;; C-x k : kills a buffer with its name
;; C-x RIGHT | LEFT : switches between buffers left and right
;; C-x b : switch to buffer with its name
;; C-x 2 | 3 : split window horizontally or vertical
;; C-x 1 : Kill djacent window
;; C-x 0 : kills current active window
;; C-x C-q : toggle read-only mode
;; C-M-f : Goes to next closing bracket
;; C-M-b : Goes to next opening bracket
;; M-x cd : change dir duh
;; M-y : to paste into vterm or generally(?)
;; M-x package-list-packages RET Ux : updates packages
;; M-x eglot-inlay-hints-mode : cool info for code
;; M-ESC : Escapes corfu prompt
;; C-g : Escapes emacs command line
;; Setup Melpa
(require 'package)
(add-to-list 'package-archives '("melpa-snapshots" . "https://snapshots.melpa.org/packages/") t)
;; All packages
;; Super duper evil emacs
(use-package evil
:ensure t
:init
(defvar evil-mode-buffers '())
;; ^ Only fix for "Error in post-command-hook (evil-normal-post-command): (void-variable evil-mode-buffers)" i could find
;;(setq evil-want-keybinding nil)
(evil-mode 1)
:config
(evil-set-undo-system 'undo-redo))
;; Theme
(use-package base16-theme
:ensure t
:init
(setq base16-theme-256-color-source 'colors)
(setq base16-highlight-mode-line 'off)
:config
(load-theme 'base16-purpledream t))
(use-package markdown-mode :ensure t)
;; Completion menu
(use-package corfu
:ensure t
:config
(keymap-set corfu-map "M-ESC" #'corfu-quit)
(setq corfu-auto t)
(setq corfu-auto-delay 0)
(setq corfu-auto-prefix 0)
(keymap-set corfu-map "RET" `( menu-item "" nil :filter
,(lambda (&optional _)
(and (derived-mode-p 'eshell-mode 'comint-mode)
#'corfu-send))))
:init
(global-corfu-mode))
;; Vterm
(use-package vterm
:ensure t
:config
(add-hook 'vterm-mode-hook (lambda () (setq evil-default-state 'emacs))))
;; QML
;; Sooo i "patched" qml mode by adding the same thing i have in my 1st line, idk how it works but now my indent should be right
(use-package qml-mode :load-path "~/.emacs.d/qml-mode")
;; LSP / Eglot
;;(setq eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider :documentFormattingProvider :documentRangeFormattingProvider))
;; (add-hook 'nix-mode-hook #'eglot-ensure) ;;(for nix)
(add-hook 'eglot-managed-mode-hook (lambda () (eglot-inlay-hints-mode -1)))
(add-hook 'c-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)
(add-hook 'qml-mode-hook 'eglot-ensure)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '(c-mode . ("clangd")))
(add-to-list 'eglot-server-programs '(c++-mode . ("clangd")))
(add-to-list 'eglot-server-programs '(qml-mode . ("~/Projects/Code/Random/qmlls"))))
;; Set some basic stuff up
(setq scroll-step 1)
(setq scroll-conservatively 10000)
(setq set-fringe-mode -1)
(xterm-mouse-mode t)
(mouse-wheel-mode t)
(setq-default truncate-lines t)
(setq truncate-partial-width-windows nil)
(setq initial-scratch-message "")
(setq frame-resize-pixelwise t)
(setq auto-save-default nil)
(setq make-backup-files nil)
(setq inhibit-startup-message t)
(setq visible-bell t)
(setq ring-bell-function 'ignore)
(setq use-short-answers t)
(setq browse-url-generic-program "xdg-open")
(setq-default indent-tabs-mode 'only)
(setq-default tab-width 2)
;;(defvaralias 'c-basic-offset 'tab-width)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;;(global-visual-line-mode t)
(add-to-list 'default-frame-alist '(font . "NotoSansM Nerd Font 12"))
;; Display line numbers in every buffer
(global-display-line-numbers-mode 1)
;; Keybinds
(keymap-global-set "C-c C-v" 'vterm)
(keymap-global-set "C-c v" 'vterm)
(keymap-global-set "C-x v" 'clipboard-yank)
(keymap-global-set "C-x c" 'clipboard-kill-ring-save)
;; ssh stuff (guix is annoying at times)
(setq tramp-remote-path
'(tramp-default-remote-path "/bin" "/usr/bin"
"/sbin" "/usr/sbin" "/usr/local/bin"
"/usr/local/sbin" "/local/bin"
"/local/freeware/bin" "/local/gnu/bin"
"/usr/freeware/bin" "/usr/pkg/bin"
"/usr/contrib/bin" "/opt/bin" "/opt/sbin"
"/opt/local/bin" "/opt/homebrew/bin"
"/opt/homebrew/sbin"
"/run/current-system/profile/bin"))
(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.
'(base16-theme-highlight-mode-line 'box)
'(package-selected-packages '(evil)))
(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.
'(default ((t (:box nil :background "#1e0a28" :foreground "#ffffff"))))
'(ansi-color-fast-blick ((t (:box nil))))
'(ansi-color-slow-blick ((t (:box nil))))
'(corfu-border ((t (:background nil))))
'(cursor ((t (:inherit t :background "#506050" :foreground "#000000"))))
'(font-lock-comment-delimiter-face ((t (:foreground "#656565"))))
'(font-lock-comment-face ((t (:foreground "#656565"))))
'(fringe ((t nil)))
'(help-key-binding ((t (:box nil))))
'(line-number ((t (:foreground "#504050" :background "#1e0a28"))))
'(read-multiple-choice ((t (:box nil))))
'(tab-bar-tab-highlight ((t (:box nil))))
'(tabulated-list-fake-header ((t (:overline nil :underline nil))))
'(tool-bar ((t (:box nil))))
'(widget-field ((t (:box nil)))))