Simple Emacs Config

This commit is contained in:
vanten-s 2024-08-05 18:11:21 +02:00
parent f4260580a5
commit ccdbef2453
Signed by: vanten-s
GPG key ID: DE3060396884D3F2
4 changed files with 132 additions and 2 deletions

59
dotfiles/emacs/init.el Normal file
View file

@ -0,0 +1,59 @@
;; Add melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
;; Add straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Set theme
(straight-use-package 'catppuccin-theme)
(load-theme 'catppuccin :no-confirm)
;; Evil
(unless (package-installed-p 'evil)
(package-install 'evil))
(require 'evil)
(evil-mode 1)
;; VTerm
(use-package vterm
:ensure t)
(add-hook 'vterm-mode-hook (lambda () (setq evil-default-state 'emacs)))
;; Nix Mode
(unless (package-installed-p 'nix-mode)
(package-install 'nix-mode))
;; Remove bars
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Remove startup message
(setq inhibit-startup-message t)
;; Display line number
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)
;; Keybinds
(keymap-global-set "C-x t" 'vterm)

57
dotfiles/emacs/init.el~ Normal file
View file

@ -0,0 +1,57 @@
;; Add melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
;; Add straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Set theme
(straight-use-package 'catppuccin-theme)
(load-theme 'catppuccin :no-confirm)
;; Evil
(unless (package-installed-p 'evil)
(package-install 'evil))
(require 'evil)
(evil-mode 1)
;; VTerm
(use-package vterm
:ensure t)
;; Nix Mode
(unless (package-installed-p 'nix-mode)
(package-install 'nix-mode))
;; Remove bars
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Remove startup message
(setq inhibit-startup-message t)
;; Display line number
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)
;; Keybinds
(keymap-global-set "C-x t" 'vterm)

View file

@ -33,3 +33,5 @@ PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magent
source ~/.config/zsh/git.zsh
eval "$(direnv hook zsh)"
unsetopt PROMPT_SP

View file

@ -1,5 +1,17 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
programs.emacs.enable = true;
programs.emacs = {
enable = true;
package = pkgs.emacs-gtk;
};
home.file.".config/emacs".source = ../dotfiles/emacs;
home.file.".emacs".text = ''(load "~/.config/emacs/init.el")'';
home.packages = with pkgs; [
gnumake
cmake
libtool
];
}