Emacs
Emacs is another very powerful text editor. Contrary to vim, which was built for
text-editing alone (but has been hacked into doing other things), emacs is more of
an operating system. It uses LISP on the backend rather than vimscript. Though not modal
like vim by default, emacs has an evil-mode extension, which enables vim commands and
hotkeys within emacs.
Personally, I'm considering making the change to emacs for two reasons:
- emacs-daemon allows you to share a single emacs session (using multiple files) with several separate client-windows. This make multi-monitor coding much more friendly.
- many of the most popular vim extensions have emacs counterparts
- more native shell, and other programs can run within emacs. (ex: w3m/mutt/irssi)
TODO:
fix this page, it's yikesey
Install
linux
locations ~/.emacs
main emacs config file ~/.emacs.d
emacs packages are installed here sudo pacman -S emacs
Tutorials
vim to emacs https://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-fourteen-days.html
Terminology
Terminology emacs vim description frame window A window to the WM. Contains splits. window A clone of the current buffer. All properties are identical between all views of buffer EXCEPT for the cursor-point. indirect-buffer split A totally independent copy of the current buffer. Text is shared/updated, but everything else is independent.
Basics
emacs basic usage elisp
Minor Modes
emacs x-symbol alter display of characters by revel (like vim conceal)
Base Config
TODO:
get rid of this whole section once I have a real config
Package Manager
Manual Package Download
Provided that you have the package-archives variable (defined below) set up, you can search/download from the package-archives using:<M-x> package-list <C-s> <package-you-are-looking-for>
Automated Package Download
Automating package downloading from .emacs can be done with the following setup:;; Define Package Sources, Initialize Package Manager (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") ("org" . "http://orgmode.org/elpa/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/") ;("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") )) (require 'package) (package-initialize) ;; Define Packages to install (setq required-pkgs '( evil evil-tabs evil-leader evil-search-highlight-persist airline-themes neotree projectile grizzl darktooth-theme gruvbox-theme )) ;; Auto-Install Packages (require 'cl) (setq pkgs-to-install (let ((uninstalled-pkgs (remove-if 'package-installed-p required-pkgs))) (remove-if-not '(lambda (pkg) (y-or-n-p (format "Package %s is missing. Install it? " pkg))) uninstalled-pkgs))) (when (> (length pkgs-to-install) 0) (package-refresh-contents) (dolist (pkg pkgs-to-install) (package-install pkg)))
Keybinding
;; Evil-Mode Keybinding (define-key evil-normal-state-map (kbd "C-h") 'evil-window-left) ;; Binding Multiple commands to a single Key-Sequence (define-key evil-insert-state-map (kbd "M-h") (lambda () (interactive) (backward-char) (evil-normal-state) )) ;; Binding Key-Sequence to another Key-Sequence