diff --git a/config.org b/config.org index 2fdf198..5db4887 100644 --- a/config.org +++ b/config.org @@ -5,9 +5,6 @@ * IMPORTANT PROGRAMS TO LOAD FIRST -** Lexical Binding (MUST BE FIRST) -#+begin_src emacs-lisp -#+end_src ** Evil Mode #+begin_src emacs-lisp :lexical t (use-package evil @@ -27,3 +24,107 @@ (use-package evil-tutor :ensure t) #+end_src +** General Keybindings +#+begin_src emacs-lisp + (use-package general + :ensure t + :config + (general-evil-setup) + ;; set up 'SPC' as the global leader key + (general-create-definer leader-keys + :states '(normal insert visual emacs) + :keymaps 'override + :prefix "SPC" ;; set leader + :global-prefix "M-SPC") ;; access leader in insert mode + (leader-keys + "." '(find-file :wk "Find file") + "TAB TAB" '(comment-line :wk "Comment lines")) + ) + +#+end_src + +* Fonts +Defining the various fonts that Emacs will use. +#+begin_src emacs-lisp +(set-face-attribute 'default nil + :font "JetBrains Mono" + :height 110 + :weight 'medium) +(set-face-attribute 'variable-pitch nil + :font "Ubuntu" + :height 120 + :weight 'medium) +(set-face-attribute 'fixed-pitch nil + :font "JetBrains Mono" + :height 110 + :weight 'medium) +;; Makes commented text and keywords italics. +;; This is working in emacsclient but not emacs. +;; Your font must have an italic face available. +(set-face-attribute 'font-lock-comment-face nil + :slant 'italic) +(set-face-attribute 'font-lock-keyword-face nil + :slant 'italic) + +;; This sets the default font on all graphical frames created after restarting Emacs. +;; Does the same thing as 'set-face-attribute default' above, but emacsclient fonts +;; are not right unless I also add this method of setting the default font. +(add-to-list 'default-frame-alist '(font . "JetBrains Mono-11")) + +;; Uncomment the following line if line spacing needs adjusting. +(setq-default line-spacing 0.12) +#+end_src + +* GRAPHICAL USER INTERFACE TWEAKS +Let's make GNU Emacs look a little better. + +** Disable Menubar, Toolbars and Scrollbars +#+begin_src emacs-lisp +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +#+end_src + +** Display Line Numbers and Truncated Lines +#+begin_src emacs-lisp +(global-display-line-numbers-mode 1) +(global-visual-line-mode t) +#+end_src +* ORG MODE +** Enabling Table of Contents +#+begin_src emacs-lisp + (use-package toc-org + :ensure t + :commands toc-org-enable + :init (add-hook 'org-mode-hook 'toc-org-enable)) +#+end_src + +** Enabling Org Bullets +Org-bullets gives us attractive bullets rather than asterisks. + +#+begin_src emacs-lisp + (add-hook 'org-mode-hook 'org-indent-mode) + (use-package org-bullets :ensure t) + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) +#+end_src + +* WHICH-KEY +#+begin_src emacs-lisp + (use-package which-key + :ensure t + :init + (which-key-mode 1) + :config + (setq which-key-side-window-location 'bottom + which-key-sort-order #'which-key-key-order-alpha + which-key-sort-uppercase-first nil + which-key-add-column-padding 1 + which-key-max-display-columns nil + which-key-min-display-lines 6 + which-key-side-window-slot -10 + which-key-side-window-max-height 0.25 + which-key-idle-delay 0.8 + which-key-max-description-length 25 + which-key-allow-imprecise-window-fit t + which-key-separator " → " )) +#+end_src diff --git a/package.nix b/package.nix index 7aee328..311f12a 100644 --- a/package.nix +++ b/package.nix @@ -3,12 +3,7 @@ x11 ? false, ... }: let - emacs = - if x11 - then pkgs.emacs-unstable - else pkgs.emacs-pgtk; -in - pkgs.emacsWithPackagesFromUsePackage { + emacs = pkgs.emacsWithPackagesFromUsePackage { # Your Emacs config file. Org mode babel files are also # supported. # NB: Config files cannot contain unicode characters, since @@ -30,7 +25,10 @@ in languages = ["emacs-lisp"]; }; # Package is optional, defaults to pkgs.emacs - package = emacs; + package = + if x11 + then pkgs.emacs-unstable + else pkgs.emacs-pgtk; # By default emacsWithPackagesFromUsePackage will only pull in # packages with `:ensure`, `:ensure t` or `:ensure `. @@ -53,8 +51,11 @@ in # Optionally provide extra packages not in the configuration file. # This can also include extra executables to be run by Emacs (linters, # language servers, formatters, etc) - extraEmacsPackages = epkgs: [ - ]; + extraEmacsPackages = epkgs: + with pkgs; [ + #nerd-fonts.jetbrains-mono + #jetbrains-mono + ]; # Optionally override derivations. override = final: prev: { @@ -62,4 +63,27 @@ in # patches = [./weechat-el.patch]; #}); }; - } + }; + fontConfig = pkgs.makeFontsConf { + fontDirectories = with pkgs; [ + jetbrains-mono + ubuntu-classic + nerd-fonts.jetbrains-mono + ]; + }; + mkEmacs = emacs: + pkgs.runCommand emacs.name + { + nativeBuildInputs = [pkgs.makeBinaryWrapper]; + inherit (emacs) meta; + } + '' + mkdir -p $out/bin + for bin in ${emacs}/bin/*; do + makeWrapper "$bin" $out/bin/$(basename "$bin") --inherit-argv0 \ + --set FONTCONFIG_FILE ${fontConfig} + done + ln -s ${emacs}/share $out/share + ''; +in + mkEmacs emacs