My Emacs configuration#
This is my current Emacs configuration.
This config is inspired by and can contain code snippets from those configurations:
- "Emacs Starter Kit" by Phil Hagelberg
- "Emacs Prelude" by Bozhidar Batsov
- "ohai-emacs" by Bodil Stokke
- "emacs-for-clojure" by Daniel Higginbotham
I test it mostly on
Windows machine, but it should also work on
Emacs and many its packages work in assumption of the Unix-like host operating system. This makes that some features don't work on Windows OS.
To solve this problem you can install MinGW with at least those packages:
If you install it in
C:\MinGW\msys\1.0\bin directory, then everything should work good. If you change the directory, then please change the path in
Alternatively you can install Cygwin. It comes with all needed packages. If you use
Cygwin then change path in
To have proper working
magit package (a git client) define
HOME system environment variable and set it to your user home path - you can read more here.
You can define
ORG system environment variable that will point to a folder where all your org files exist. Those files will be used to create agenda for
Additionally at startup of
gtd.org file (my todo list) from path defined in
ORG system environment variable will be tried to open.
To be able to generate HTML (or other formats) from markdown you should install Pandoc
In Windows Aspell bin folder (
\Aspell\bin) should be added to
Path environment variable.
There are defined three hooks in
rs/windows-os-hookfor Windows operating system
rs/osx-os-hookfor Mac OSX operating system
rs/linux-os-hookfor Linux operating stem
You can use those hooks, to invoke code specific only for one of those operating systems.
To set the username and password for Erc (an IRC client) package, please create
.erc-auth.el file in
.emacs.d folder and add those two lines there:
(setq erc-nick "your_username") (setq erc-password "your_irc_password")
- Increase / decrease font size:
- Restore default font size:
- Expand region:
- Change window or frame:
- For avy package:
C-c j- go to char
M-g f- go to line
- Multiple cursors configuration
_From: https://github.com/bodil/ohai-emacs/ _
<insert>to place a cursor on the next match for the current selection.
S-<insert>to place one on the previous match.
C-'to use extended mark mode, giving you more control.
C-"to place cursors on all matches.
Select a region and
C-M-'to place cursors on each line of the selection.
<insert>key no longer activates overwrite mode.
- Comment region:
C-M-f- Jump after the next balanced expression. If inside one and there is no forward exp., jump after its closing pair.
C-M-b- Jump before the previous balanced expression. If inside one and there is no previous exp., jump before its opening pair.
C-M-d- Jump after the opening pair of next balanced expression. This effectively descends one level down in the
expression hierarchy. If there is no expression to descend to, jump after current expression's opening pair. This can be used to quickly navigate to the beginning of current balanced expression.
C-M-a- Jump before the closing pair of previous balanced expression. If there is no expr. to descend to, jump before current expression's closing pair.
C-S-d- Jump to the beginning of current sexp, that is after the opening delimiter.
C-S-a- Jump to the end of current sexp, that is before the closing delimiter.
C-M-eJump up one level from the current balanced expression. This means skipping all the enclosed expressions within this and then jumping after the closing pair. For example (if (= a b) | (some call) (some other call)) -> (if ...)|.
C-M-u- Jump up backwards one level from the current balanced expressions. This means skipping all the enclosed expressions within this backwards and then jumping before the opening pair.
C-M-n- Jump to the beginning of following balanced expression. If there is no following expression on the current level, jump one level up backward, effectively doing sp-backward-up-sexp.
C-M-p- Jump to the end of the previous balanced expression. If there is no previous expression on the current level, jupm one level up forward, effectively doing sp-up-sexp.
Fiplr - Find in Project for Emacs
- Find files: M-x fiplr-find-file RET (key binding
- Find directories: M-x fiplr-find-directory RET
- Clear caches: M-x fiplr-clear-cache RET
This configuration uses thesaurus package.
To use it, first you need to go to the http://words.bighugelabs.com/ page and register (no cost) to get an API key. Then create
.apikey.txt file in the
.emacs.d folder and put this API key in it (as plain text). From now on you can look for similar words using
C-x t command.
To reload any configuration file, you can execute:
eval-buffer and then hit
Windows users there is
script.ahk file in the root folder. It's AutoHotkey script, that allows remapping
Caps Lock key to
Emacs is started. To be able to use it, you have to install AutoHotkey. The shortcut to this script can be placed in
Startup folder to auto start on
Windows startup - you can read full instruction here.