- [[#automatically-create-table-of-contents][Automatically Create Table of Contents]]
- [[#projectile][PROJECTILE]]
- [[#scrolling][SCROLLING]]
- [[#shells][SHELLS]]
- [[#eshell][Eshell]]
- [[#vterm][Vterm]]
- [[#language-support][LANGUAGE SUPPORT]]
- [[#theme][THEME]]
- [[#which-key][WHICH KEY]]
* PUT THIS IN YOUR INIT.EL
#+begin_verse
(org-babel-load-file
(expand-file-name
"config.org"
user-emacs-directory))
#+end_verse
* ABOUT THIS CONFIG
This is my personal Emacs config. I patterned my config to mimic Doom Emacs, which is a distribution of Emacs that uses the "evil" keybindings (Vim keybindings) and includes a number of nice extensions and a bit of configuration out of the box. I am maintaining this config not just for myself, but also for those that want to explore some of what is possible with Emacs. I will add a lot of examples of plugins and settings, some of them I may not even use personally. I do this because many people following me on YouTube and Odysee look at my configs as "documentation".
* PACKAGE MANAGEMENT
** Setup package.el to work with MELPA
#+begin_src emacs-lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-refresh-contents)
(package-initialize)
#+end_src
** Installing use-package
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
(package-install 'use-package))
#+end_src
* ALL THE ICONS
This is an icon set that can be used with dashboard, dired, ibuffer and other Emacs programs.
#+begin_src emacs-lisp
(use-package all-the-icons
:ensure t)
#+end_src
* GENERAL KEYBINDINGS
General.el allows us to set keybindings. As a longtime Doom Emacs user, I have grown accustomed to using SPC as the prefix key. It certainly is easier on the hands than constantly using CTRL for a prefix.
#+begin_src emacs-lisp
(use-package general
:ensure t ;; install general if not installed
:config
(general-evil-setup t))
(nvmap :prefix "SPC"
"SPC" '(counsel-M-x :which-key "M-x")
"." '(find-file :which-key "Find file")
;; Buffers
"b b" '(ibuffer :which-key "Ibuffer")
"b k" '(kill-current-buffer :which-key "Kill current buffer")
Evil is an extensible 'vi' layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. Evil Collection is also installed since it adds 'evil' bindings to parts of Emacs that the standard Evil package does not cover, such as: calenda, help-mode adn ibuffer.
#+begin_src emacs-lisp
(use-package evil
:ensure t ;; install evil if not installed
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(evil-mode))
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
#+end_src
* FINDING FILES
Though 'recentf' is one way to find recent files although I prefer using 'projectile-find-file-in-directory'.
#+begin_src emacs-lisp
(use-package recentf
:ensure t
:config
(recentf-mode))
#+end_src
* DIRED
Dired is the file manager within Emacs. Below, I setup keybindings for image previews (peep-dired). Doom Emacs does not use 'SPC d' for any of its keybindings, so I've chosen the format of 'SPC d' plus 'key'.
=NOTE:= If the setting for 'ivy-posframe-display' is set to 'nil' (false), anything that is set to 'ivy-display-function-fallback' will just default to their normal position in Doom Emacs (usually a bottom split). However, if this is set to 't' (true), then the fallback position will be centered in the window.
Toc-org helps you to have an up-to-date table of contents in org files without exporting (useful useful for README files on GitHub). Use :TOC: to create the table.
#+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
* PROJECTILE
#+begin_src emacs-lisp
(use-package projectile
:ensure t
:config
(projectile-global-mode 1))
#+end_src
* SCROLLING
#+begin_src emacs-lisp
(setq scroll-conservatively 101) ;; value greater than 100 gets rid of half page jumping
(setq mouse-wheel-scroll-amount '(3 ((shift) . 3))) ;; how many lines at a time
Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets the shell to be used in M-x shell, M-x term, M-x ansi-term and M-x vterm. By default, the shell is set to 'fish' but could change it to 'bash' or 'zsh' if you prefer.
#+begin_src emacs-lisp
(use-package vterm
:ensure t)
(setq shell-file-name "/bin/fish"
vterm-max-scrollback 5000)
#+end_src
* LANGUAGE SUPPORT
Adding packages for programming langauges, so we can have nice things like syntax highlighting.
#+begin_src emacs-lisp
(use-package haskell-mode
:ensure t)
#+end_src
* THEME
#+begin_src emacs-lisp
(use-package doom-themes)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled