From ccdbef24532ec6255c98d33ee6fd7d54f7a59e06 Mon Sep 17 00:00:00 2001 From: vanten-s Date: Mon, 5 Aug 2024 18:11:21 +0200 Subject: [PATCH] Simple Emacs Config --- dotfiles/emacs/init.el | 59 +++++++++++++++++++++++++++++++++++++++++ dotfiles/emacs/init.el~ | 57 +++++++++++++++++++++++++++++++++++++++ dotfiles/zshrc | 2 ++ home-modules/emacs.nix | 16 +++++++++-- 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 dotfiles/emacs/init.el create mode 100644 dotfiles/emacs/init.el~ diff --git a/dotfiles/emacs/init.el b/dotfiles/emacs/init.el new file mode 100644 index 0000000..80b1580 --- /dev/null +++ b/dotfiles/emacs/init.el @@ -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) + diff --git a/dotfiles/emacs/init.el~ b/dotfiles/emacs/init.el~ new file mode 100644 index 0000000..0a3a33c --- /dev/null +++ b/dotfiles/emacs/init.el~ @@ -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) + diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 7c5f3d1..3f7d4c2 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -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 + diff --git a/home-modules/emacs.nix b/home-modules/emacs.nix index 962fe56..cd63fd3 100644 --- a/home-modules/emacs.nix +++ b/home-modules/emacs.nix @@ -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 + ]; }