━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO GET A COOL AND FUNCTIONAL EMACS SETUP
anya
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Table of Contents
─────────────────
Why Emacs?
Getting started
.. Changing the font
.. Getting access to more packages/plugins
Epic Packages
.. use-package
.. Magit
.. Evil-Mode
.. Doom-modeline
.. Themes
.. Dashboard
Other niche tweaks
.. Stop Emacs from making backup files and autosaving stuff
.. Line numbers
Screenshots
Why Emacs?
══════════
Because emacs is very extensible, it can be used for literally
anything including but not limited to talking in an irc,playing
music,using it as your window manager!! and much more. It is also
free software(free as in freedom and free as in price) so there is no
spooky telemetry in the program, unlike vscode and you can even modify
the source code to make your own emacs fork. Emacs is old and time
tested, developers having been using it for decades so you won’t get
any silly bugs in the program.
Getting started
═══════════════
After you installed Emacs create a file called `init.el' in
`~/.emacs.d/', Lets start off by making emacs look nicer by adding
these lines to the file
┌────
│ ;; makes emacs loadtime faster by reducing the garbage collector
│ (setq gc-cons-threshold (* 50 1000 1000))
│
│ ;;; --- UI --- ;;;
│
│ ;; hides tool bar, menu bar and scroll bar
│ (tool-bar-mode -1)
│ (menu-bar-mode -1)
│ (scroll-bar-mode -1)
│
│ ;; turns yes or no questions to y or n
│ (defalias 'yes-or-no-p 'y-or-n-p)
│
└────
This hides the menu bar, tool bar and scroll bar they might be useful
to some people ,but they look ugly so we’ll just remove them. It also
reduces the garbage collection which makes startup time faster (note:
this not change emacs daemon performance)
Changing the font
─────────────────
┌────
│ ;; Change the font
│ (add-to-list 'default-frame-alist
│ '(font . "insert font name here"))
└────
I recommend you use a Jetbrains font because it looks cool C;
Getting access to more packages/plugins
───────────────────────────────────────
┌────
│ ;; sets melpa as another package archive
│ (require 'package)
│ (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
└────
This make it so you will get access to more Emacs packages. Make sure
to `M-x package-refresh-contents' after restarting your Emacs (`M-x'
means `Alt' + `x')
Epic Packages
═════════════
Emacs packages are written in elisp a prorgamming that is used to
configure emacs, these packages can make emacs even more *awesomeeee*
use-package
───────────
use-package is a package that makes it so packages load more
efficiently to install it run: `M-x package-install RET use-package
RET' and here is the code to enable it
Magit
─────
Magit is the best fucking git frontend ever it is miles better than
command line git, here’s how to install this amazing package `M-x
package-install RET magit RET'
┌────
│ (use-package magit
│ :ensure t
│ :config
│ (setq magit-push-always-verify nil)
│ :bind
│ ("C-c g" . magit-status)) ;; Magit keybinding
└────
To open Magit press `C-c g', Here are some simple magit keybindings to
get you started in magit.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Binding What the binding does
───────────────────────────────────────────────────────────────────────────────────────────────────────────
s Stage a file and/or a change
S Stage *all* files and changes
u Unstage a file and/or a change
U Unstage *all* files and changes
c c Create a new Commit(once you finished writing your commit press `C-c C-c' to actually commit it)
P u Push to upstream branch
P p Push to current push remote
l l To view the log
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Magit documentation can be found here:
[https://magit.vc/manual/magit/]
A helpful video made by Distrotube:
[https://invidious.snopyta.org/watch?v=X_iX5US1_xE]
[https://magit.vc/manual/magit/]
[https://invidious.snopyta.org/watch?v=X_iX5US1_xE]
Evil-Mode
─────────
So you are a vim-lover and you can’t live without the vim keybindings,
then this package is for you!. Evil-mode emulates vim inside Emacs
allowing you to smoothly migrate from vim to emacs.
┌────
│ (use-package evil) ;; vim emulation
│ (evil-mode 1)
└────
Doom-modeline
─────────────
Let’s face it the default Emacs modeline/statusbar is *ugly* af. Doom
modeline is a modern replacement to the default Emacs modeline.
┌────
│ (use-package doom-modeline
│ :ensure t
│ :init (doom-modeline-mode 1))
└────
Make sure to run `M-x all-the-icons-install-fonts RET' to install the
fonts required for the modeline to look really cool.
Themes
──────
There are a *lot* of themes for Emacs, but the theme package I use is
the `doom-themes' package. Why? because it is a *mega* pack of themes
containing over 50 /unique/ themes.
Github page:
┌────
│ (use-package doom-themes
│ :ensure t
│ :config
│ (load-theme 'pick-your-theme-from-the-github-page t)
│ ;; (load-theme 'doom-molokai t)
│ ;; uncomment line above to use my favorite theme
│ (doom-themes-org-config)
│ (doom-themes-visual-bell-config))
└────
Dashboard
─────────
The default looks pretty bad as well so lets change it to something
that will look much better
┌────
│ (use-package dashboard
│ :ensure t
│ :config
│ (dashboard-setup-startup-hook)
│ (setq dashboard-startup-banner "/path/to/your/avatar/image")
│ (setq dashboard-banner-logo-title "Insert cool message here")
│ (setq dashboard-set-heading-icons t)
│ (setq dashboard-set-file-icons t))
│
│ ;; Makes the dashboard buffer the default for when you use the emacs daemon
│ (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
└────
Now you can have your own custom avatar and quote in your dashboard C:
Other niche tweaks
══════════════════
Stop Emacs from making backup files and autosaving stuff
────────────────────────────────────────────────────────
┌────
│ ;; tells emacs to not make backups and not to autosave stuff
│ (setq make-backup-files nil)
│ (setq auto-save-default nil)
└────
Line numbers
────────────
┌────
│ ;; line numbers in all buffer
│ (global-display-line-numbers-mode)
└────
Sometimes you don’t want line numbers, like when you are using a
terminal in emacs. Here is the code to disable line-numbers in some
Emacs modes
┌────
│ ;; disable line numbers for some modes
│ (dolist (mode '(org-mode-hook ;; org document
│ term-mode-hook ;; terminal
│ vterm-mode-hook ;; another terminal
│ shell-mode-hook ;; shell
│ eshell-mode-hook ;; another shell
│ treemacs-mode-hook ;; filetree
│ completion-list-mode-hook ;; auto completion buffer
│ org-agenda-mode-hook ;; agenda viewer
│ tetris-mode-hook)) ;; tetris
│ (add-hook mode (lambda () (display-line-numbers-mode 0))))
│
└────
Screenshots
═══════════
After following this guide your emacs may look something similar to
this: