Emacs: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Emacs is | Emacs is a text-editor that can be used in a GUI or a console. | ||
{{ TODO | | {{ TODO | | ||
learn how to use emacs, then clean this up }} | |||
= | = Documentation = | ||
<blockquote> | <blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| official docs || https://www.gnu.org/software/emacs/documentation.html | |||
|- | |- | ||
| < | |} | ||
</blockquote><!-- Documentation --> | |||
= Locations = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |- | ||
| <code>~/.emacs.d</code> | | <code>~/.emacs</code> || main emacs config | ||
|- | |||
| <code>~/.emacs.d/</code> || emacs packages installed here | |||
|} | |} | ||
</blockquote><!-- Locations --> | |||
</blockquote><!-- | |||
= Tutorials = | = Tutorials = | ||
Line 39: | Line 31: | ||
|} | |} | ||
</blockquote><!-- tutorials --> | </blockquote><!-- tutorials --> | ||
= Install = | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
sudo pacman -S emacs | |||
</syntaxhighlight> | |||
</blockquote><!-- Install --> | |||
= Terminology = | = Terminology = | ||
Line 59: | Line 58: | ||
</blockquote><!-- Terminology --> | </blockquote><!-- Terminology --> | ||
= Basics = | = Basics = | ||
<blockquote> | <blockquote> | ||
{| | {| | ||
|- | |- | ||
Line 72: | Line 68: | ||
|- | |- | ||
|} | |} | ||
</blockquote><!-- basics --> | </blockquote><!-- basics --> | ||
Line 141: | Line 135: | ||
(let ((uninstalled-pkgs (remove-if 'package-installed-p required-pkgs))) | (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))) | (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) | (when (> (length pkgs-to-install) 0) | ||
(package-refresh-contents) | (package-refresh-contents) |
Revision as of 20:17, 19 September 2021
Emacs is a text-editor that can be used in a GUI or a console.
TODO:
learn how to use emacs, then clean this up
Documentation
official docs https://www.gnu.org/software/emacs/documentation.html
Locations
~/.emacs
main emacs config ~/.emacs.d/
emacs packages installed here
Tutorials
vim to emacs https://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-fourteen-days.html
Install
sudo pacman -S emacs
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