Skip to content

Instantly share code, notes, and snippets.

@martinklepsch
Last active February 28, 2022 04:34
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save martinklepsch/4e5f2c52a5d9797278d1 to your computer and use it in GitHub Desktop.
Save martinklepsch/4e5f2c52a5d9797278d1 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)
@paldepind
Copy link

I thin line 9-10 should be:

(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

@martinklepsch
Copy link
Author

martinklepsch commented Mar 24, 2021

This gist is quite old 😅 But thanks, I updated the URL.

I've switched to NeoVim in the meantime btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment