Near the beginning of my Internet career, I experimented with Emacs. I soon switched to Vim and stayed with it. I recently started getting curious about Emacs again while going through some Lisp tutorials. I can’t leave Vim behind completely, so I’m trying “Evil“.
The installation instructions are not very clear, and it was a bit frustrating to get the package manager working so that it could find Evil. Here’s what did work:
Activate the Package Manager
I’m using Emacs 24. I put this in my .emacs file, which is located at ~/.emacs:
'("marmalade" . "http://marmalade-repo.org/packages/"))
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(setq package-archive-enable-alist '(("melpa" deft magit)))
Note: the letter C refers to the ctrl key and M refers to the alt key. So C-x means ctrl-x and M-x means alt-x.
I restarted Emacs and and typed
M-x puts you on a command line and the rest is the command. Press enter at the end.
The result will be a list of available packages something like this:
I found Evil and the other packages I wanted to install and pressed the
i key to mark them. Then I pressed
x to install them.
To see a list of installed packages, type
C-h v package-activated-list. The output of that command for me is:
package-activated-list's value is
(evil-leader evil-matchit evil-nerd-commenter evil-tabs elscreen evil figlet goto-chg org undo-tree)
I then put this into the .emacs file below the stuff mentioned above:
;; Remap org-mode meta keys for convenience
(mapcar (lambda (state)
(evil-declare-key state org-mode-map
(kbd "M-l") 'org-metaright
(kbd "M-h") 'org-metaleft
(kbd "M-k") 'org-metaup
(kbd "M-j") 'org-metadown
(kbd "M-L") 'org-shiftmetaright
(kbd "M-H") 'org-shiftmetaleft
(kbd "M-K") 'org-shiftmetaup
(kbd "M-J") 'org-shiftmetadown))
Here is a screenshot:
There may be better ways to do it, but now it works, and I can use Vim commands as soon as the program starts. I’ll create a part 2 if this works out!