All my Emacs' configuration
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
my-snippets
packages
startup.d
vendor
.aspell.en.pws
.aspell.es.pws
.authinfo
.ctags
.emacs.docker
.ercpass.el
.ghub.el
.gitignore
.gitmodules
.projectile
.style.yapf
Menlo-Regular.ttf
README.rst
autopep8rc
build-docker-image.sh
dir-locals.el.example
flake8rc
init.el
isort.cfg
mate.el
requirements.elpy.in
startupd.el
tryit.sh

README.rst

Emacs Configuration

Try it with Docker!

This is the easiest way to try all this set of configurations without touching your computer configuration and break anything:

docker run --rm -it -e DISPLAY -v $(pwd):/src -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
  -v $XAUTHORITY:/root/.Xauthority --net=host humitos/emacs-x11-alpine

Full documentation for Docker image: https://github.com/humitos/emacs-x11-alpine

By running this configuration using Docker, you can start an emacs instance without breaking anything in your existing emacs configuration or even without having emacs installed in your computer.

The idea of this Docker image, is that you can easily check some of the shortcuts and modules that I'm using and start using them in your own configuration by _maybe_ copying that chunk of configuration from startup.d/ folder.

Or, you can just use this Docker image as your daily editor :)

If you really like this configuration, you could install it in your computer with the following instructions.


Installation

NOTE: do not installing it if you are not sure what you are doing... :)
  1. Clone this repository on the standard .emacs.d settings directory:

    cd ~
    git clone --depth 1 https://github.com/humitos/emacs-configuration.git .emacs.d
    cd .emacs.d
    git submodule init
    
  2. Update git submodules and compile necessary modules (helm, ctags and silver searcher, among others):

    ./bin/update_git_submodules
    
  3. Put in your ~/.emacs:

    ;; set default user emacs directory
    (setq emacs-user-directory "~/.emacs.d/")
    
    (load (concat emacs-user-directory "init.el"))
    
  4. Run emacs


NOTE: all of this configuration was tested in
  • Xubuntu 16.04 LTS
  • Emacs 26.0.50
  • git 2.14.1
  • Python 2.7.13
  • Firefox 55.0.2

Install Python necessary modules

I'm installing all the necesary package for elpy in each virtualenv that I'm working on, so you should run this command in your venvs

Install necessary packages:

pip install -U -r requirements.elpy.in

For virtualenv creation, I'm using pyenv.

Install required system packages

sudo apt-get install emacs git aspell-es

ctags compilation:

sudo apt-get install clang-format

Configure Firefox to export bookmarks automatically

This is needed for helm-firefox to find your bookmarks and keep them updated.

Open your Firefox and go to about:config in firefox url toolbar. Search for this line:

user_pref("browser.bookmarks.autoExportHTML", false);

Double click on this line to enable its value to true, you should have now:

user_pref("browser.bookmarks.autoExportHTML", true);

Keep this configuration updated

cd ~/.emacs.d
git pull
./bin/update_git_submodules

Main modules included in this configuration

  • avy
  • browse-at-remote
  • ctags-update
  • discover-my-major
  • easy-kill
  • elpy
  • evil-mode
  • expand-region
  • flycheck
  • gist.el
  • git-gutter-fringe.el
  • git-timemachine
  • guess-language
  • helm
  • helm-dash
  • helm-flycheck
  • helm-fuzzier
  • helm-swoop
  • highlight-indentation
  • highlight-symbol
  • imenu-list
  • jedi
  • magit
  • magithub
  • material-theme
  • origami.el
  • projectile
  • py-autopep8
  • py-autoflake
  • py-docformatter
  • py-isort
  • py-yapf
  • rainbow-delimiters
  • restclient-mode
  • smartparens
  • smart-forward.el
  • smart-mode-line
  • sphinx-doc.el
  • twittering-mode
  • undohist
  • visual-regexp-steroids
  • web-mode
  • whitespace-cleanup-mode
  • yasnippet
  • zencoding-mode
  • zzz-to-char

These are the hotkeys that I use most.

avy

C-c SPC:jump to any place in the buffer with just a hotkey plus the beginning of the word and a char

browse-at-remote

C-c g g:show the file / selected region into remote web page (Github, for example)

Once on magit-status or magit-log hitting the shortcut goes to the proper URL

discover-my-major

discover-my-major:show help with all the all the hotkeys for this major mode

easy-kill

M-w d:save the current defun definition into the kill-ring (clipboard)
M-w w:save word at point into the kill-ring
M-w f:save the name of the current file being edited

elpy

M-down:
M-up:
M-left:
M-right:move the selected region by indentation
M-.:go to definition (class, function, variable, etc)
M-,:go back where we was
C-c C-z:switch to a Python shell
C-c C-d:open Python documentation (class, function, etc)
C-c C-t:run test depending on cursor position

evil-mode

g x:open URL at point
g f:helm-find-files
<number> g g:go to <number> line
C-z:disable evil mode temporary
zz:shift current line in the MIDDLE of the screen
zt:shift current line to the TOP of the screen
zb:shift current line to the BOTTOM of the screen

expand-region

C-=:mark region based on semantics

find-file-in-project

C-c C-f:find a file in the current project. This uses a search-as-you-type interface for all files under the project root.

(this hotkey comes from elpy)

This hotkey is replaced by the helm one if you have it active.
C-u C-c C-f:find a file in the current project but it regenerate the cache first.

flycheck

C-c C-n:go to the next Flycheck error
C-c C-p:go to the previous Flycheck error

(these hotkeys comes from elpy)

elpy already has some hotkeys for this, but I'm using Flycheck instead of Flymake, which is the default for elpy)

gist.el

gist-list:show the list of all our gist
gist-region-or-buffer-private:create a new private gist with the selection

git-timemachine

git-timemachine:browse all versions of the current file

Once with that mode activated:

p:previous version
n:next version
q:quit

helm

M-x:the beginning is here :)
C-x f:all files in repository (ls-git)
M-y:kill ring
C-x r b:files position bookmark listing
C-c h e:etags
C-c h i:all function and variable names in the current buffer
C-c s:occurrences of the symbol at point in buffer

Commands:

helm-firefox-bookmarks:filter among Firefox bookmarks
helm-google-suggest:search in google
helm-wikipedia-suggest:search in wikipedia
helm-swoop:search inside the current buffer and jump to them
helm-multi-swoop:search in multiples buffer and jump to them
helm-dash:search in dash documentation (https://kapeli.com/dash)
helm-flycheck:show all the flycheck errors in a helm buffer
helm-backup:show the history of the current file

Once in the helm session / buffer:

C-SPC:mark the current selection
M-D:kill the selection

magit

C-x g:open the Magit Status buffer

Once on this buffer

s:stage the selected file / chunk / directory
k:discart the selected file / chunk / directory
u:unstage the selected file / chunk / directory
g:refresh buffer
c c:commit current staged changes
c a:amend current staged changes to previous commit
P u:push to the current branch
b b:checkout another branch
b c:checkout a new branch
b n:create new branch
z z:stash current changes
z p:pop stashed changes
f u:fetch from origin
F e:pulll from elsewhere
C-w:copy the commit hash to the clipboard

Commands:

magit-log:show the git log
magit-blame:show the author of each chunk of code

origami.el

C-c f a:toggle (folding) all the regions
C-c f e:toggle the fold selected

projectile

C-c p p:

switch between projects

C-c p b:

switch between opened buffers for current project

C-c p k:

kill all the buffer related to the current project

C-c p f:

find file in current project

C-c C-s:

perform a grep on the current project

C-c p h:

all together

C-c p R:

regenerate TAGS for current project

This is also integrated with helm

restclient-mode

C-c C-v:execute the current request
C-c C-u:copy the CURL command to the clipboard
C-c C-g:browse the queries / variables / etc with helm

smart-forward.el

C-S-<left>:move backward 'smartly'
C-S-<right>:move forward 'smartly'
C-S-<up>:move up 'smartly'
C-S-<down>:move down 'smartly'

sphinx-doc.el

C-c M-d:create the docstring for the current Python method/function in reStructuredText form

twittering-mode

g:fetch new tweets
RET:reply
u:post a new tweet
C-c C-c:send the tweet once we finish writting
C-c C-k:cancel the current tweet
C-u C-c RET:retweet current
r:show replies
j:navigate to next tweet
k:navigate previous tweet

visual-regexp-steroids

C-M-%:search and replace using regex (visual and interactive results)

zzz-to-char

M-z:zap up to one of the characters in the current paragraph

zencoding-mode

C-j:expand the current expression to match the snippet

References