Skip to content

Instantly share code, notes, and snippets.

@anhdiepmmk
Forked from martinklepsch/README.md
Created February 28, 2022 04:34
Show Gist options
  • Save anhdiepmmk/ec915b9d387e130bc443ce42be485939 to your computer and use it in GitHub Desktop.
Save anhdiepmmk/ec915b9d387e130bc443ce42be485939 to your computer and use it in GitHub Desktop.
A very minimal Emacs configuration to get started with Emacs & Evil-mode

A Starting Point for using Emacs & Evil-mode

(I wrote a bit about why Emacs and Vim on my blog and thought it might be nice to give some starting point for people that want to try it.)

If you just want to play around with Emacs & Evil mode do the following:

  1. mkdir ~/.emacs.d/
  2. copy init.el into ~/.emacs.d/
  3. Download Emacs from http://emacsformacosx.com
  4. Open Emacs

This should automatically install evil-mode and evil-leader and give you a basic starting point to play around.

You should still go through the Emacs tutorial M-x RET help-with-tutorial (M is the Alt-key) to learn working with buffers, frames, etc. Once you learned the commands you can slowly add <leader> keybindings to replace Emacs' default ones.

If you want to find out what function a keybinding is bound to you can use M-x RET describe-key followed by the keybinding you're interested in.

(require 'package)
; List the packages you want
(setq package-list '(evil
evil-leader))
; Add Melpa as the default Emacs Package repository
; only contains a very limited number of packages
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
; Activate all the packages (in particular autoloads)
(package-initialize)
; Update your local package index
(unless package-archive-contents
(package-refresh-contents))
; Install all missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
(require 'evil)
(evil-mode t)
(require 'evil-leader)
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"b" 'switch-to-buffer
"w" 'save-buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment