- Emacs Lisp 100%
| modules | make local backups when editing files remotely over tramp | |
| .gitignore | better desktop-save-mode | |
| early-init.el | some ported changes from emacs-solo | |
| emacs-logo.png |
update scratch message and failing png file opening
|
|
| init.el | completion only on TAB + completion-preview-mode always on | |
| LICENSE | update README, add LICENSE | |
| README.org | correct link to keybind modules in readme #2 | |
| screenshot1.png | make screenshots smaller | |
| screenshot2.png | make screenshots smaller | |
| screenshot3.png | add terminal screenshot | |
| screenshot_mobile.png | smaller mobile screenshot | |
- dotemacs
dotemacs
This project is an effort to replace Doom Emacs with my own configuration while keeping the keybinding and most of the functionality as similar as possible. The configurations still lack many of functionalities that my Doom config offers. But I constantly improve them as this project is my current setup. I still use Doom from time to time and browse its code to check how things are done for inspiration.
Screenshots
- Dark mode
/haditim/dotemacs/media/branch/master/screenshot1.png
- Light mode
/haditim/dotemacs/media/branch/master/screenshot2.png
- In terminal (foot terminal)
/haditim/dotemacs/media/branch/master/screenshot3.png
- Android (dark mode) on Samsung Galaxy S22 Ultra (using Termux:X11)
/haditim/dotemacs/media/branch/master/screenshot_mobile.png
Motivation
Speed
Doom Emacs meets most of my expectations of an IDE for software development and note taking. However, having to use it in a virtualized environment for a long time recently, I experienced slowdowns and high resource consumption over time. Doom does an amazing job loading only necessary features and lazily, optimizing startup speed and the overall feel. Nevertheless, the big number of packages that come bundled with it eventually make it slower with time. Many of the functionality these packages offer are now built into Emacs but cannot be easily replaced. This convinced me to start building my Emacs configs bottom-up rather than trying to make Doom faster by taking the bloat away.
Simplicity
Doom is complex, so many advice and macros are included that I for
one could not wrap my head around many of them for modifications. More
magic means less control. I decided to build my config as simple as
possible, no advice, no macros, no complexity (also because I don't know how to
use advice and macros).
Minimalism
Here I try to minimize the number of packages loaded into Emacs and
constantly check the loaded ones to avoid slowdowns caused by them. As
an example, I use built-in projects and tab-bar-mode instead of
projectile and pers/perspective which handle most of what I expect
from them alright.
Installation/Usage (on GNU/Linux)
This repo is tested on Debian, Alpine and Arch GNU/linux distros but should work on other distros, too.
Install emacs
From your distro package manager
I recently moved to lucid toolkit version of emacs since the PGTK can be very slow to navigate, especially on HiDPI monitors.
sudo apt install emacs-lucid # Debian-based distros
sudo pacman -Sy emacs-lucid # Arch-based distros
Building emacs from source (optional)
Version 28+ is supported although 29+ is recommended. Most distros' package managers have version 30 as the default now. Nevertheless, you can compile from source with other branches of the repo:
./configure --prefix=~/.local --without-compress-install --with-native-compilation=no \
--with-tree-sitter --with-x-toolkit=lucid --with-imagemagick \
--with-small-ja-dic --with-cairo-xcb
NOTE 1: Cairo gives me errors on Sway/Debian combination, so I drop it
(--without-cairo flag which does not always work) or go directly for Emacs
version 30 branch. For imagemagick and json you'd need to install
libmagickwand-dev and libjansson-dev, respectively.
NOTE 2: Lucid x-toolkit seems to be the fastest (albeit by a slight margin),
even on Wayland. Thus, I moved from pgtk to Lucid. You need to install
libxaw-dev to be installed or change --with-x-toolkit=lucid to --with-pgtk
--without-x.
Install/download requirements
vterm
If you plan to use vterm, you need to install build-essential (or build-base)
and make cmake gcc libtool.
Nerd-icons
After packages are installed and emacs is loaded, run M-x
nerd-icons-install-fonts and restart emacs for icons to show up.
pdf-tools (optional)
If you view PDF files in Emacs, you need to also run M-x pdf-tools-install after
loading.
Download font (optional)
Aporetic font is used in my configs. You can download and install it, or
change the module my-looks.el to use another font. The config will fall back to
default if desired fonts are not found.
git clone --depth 1 https://github.com/protesilaos/aporetic ~/.local/share/fonts/
(org) screenshots
To be able to paste screenshots using org-download, you need grim tool to be installed.
Clone this repo
You can clone this to ~/.config/emacs (or ~/.emacs.d):
mv ~/.config/emacs ~/.config/emacs.bak
git clone https://codeberg.org/haditim/dotemacs.git ~/.config/emacs
Installation/Usage (on Android)
Refer to my post for installation on Android here. You need to take other steps mentioned above if you want fonts/pdf tools, etc..
Getting started
Make sure treesitter grammar for the language you're developing in is installed
by running treesit-install-language-grammar.
Python
I use this configuration mainly for Python development with the following amenities:
- A custom virtual env selector which is a strong alternative to
pyvenv,poetryandcondadependencies which works well over tramp with conda/poetry/python-venv environments. This can be called withmy/python-venv-mode(also local leader binding, m e). The minor mode also shows env info in mode line. - LSP support with
eglot. Just install the LSP server in your environment and run eglot after setting the env (, e). - Quick REPL interactions with
my/restart-python-repl(also bound to, m r). If you doSPC ubefore calling the function, you can call the REPL with a custom interpreter (e.g.ipython). If you later want to restart REPL with the custom interpreter you chose before, you can callmy/restart-python-repl-last-interpreter(, m R). - Debugging using dape which is an amazing package dominating my Python
interactions. Just call dape (
SPC d d) and pick from available configs. I also havestreamlitconfig as well asdebupy-remoteanddebugpy-file-remote-forwarded-portwhich help with streamlit and tramp-managed projects. - Docstring management with
python-docstringandnumpydoc.
Micropython
As I like to be able to talk to ESP32 (and other micropython-managed
micro controllers), I added some REPL interactions as I have for normal Python to
the config. If you call my/start-micropython, you can select the device and send
buffer or region to that device, even if it is connected to a remote machine.
Other languages
I also have basic support for the following:
- C
- Typescript/Javascript (mostly via treesitter)
- Flutter/Dart (no treesitter available yet). Remember to run
flutter config --disable-analyticsto prevent it from dialing home!
LaTeX
CDLaTeX is enabled for org-mode and LaTeX buffers. Use C-c { to get completions
for TeX elements.
Keyboard shortcuts
I use general and which-key to manage keybindings. All the keybindings are in
my-evil-keybinds.el. There are two type of keybinds in my config; vanilla and
vim (default). If you prefer vanilla keybinds, set (setq my/vanilla-editing t)
in my-variables.el (create the file where the init.el is if it does not
exist). But beware, the vanilla keybinds are not as polished as the vim (evil)
version since I mostly use the latter. Changing to vanilla keybinds make
my-vanilla-keybinds.el the default keybindings.
Start by typing <space> (in evil version) or M-<space> in vanilla version and
which-key will guide you for the rest of keybinds. Local leader is bound to ,
and C-, for the evil and vanilla states, accordingly.
Switch themes
By typing SPC t a you get a random theme based on whether my/dark-mode is on
(which it is by default). To toggle dark mode, type SPC t d.