mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
216 lines
6.2 KiB
Org Mode
216 lines
6.2 KiB
Org Mode
#+TITLE: Ryan's Emacs config
|
|
#+AUTHOR: Ryan Kes
|
|
#+DESCRIPTION: There are many Emacs configs, this one is mine
|
|
|
|
* About
|
|
My personal Emacs config.
|
|
** init.el
|
|
To load this config add the following to ~init.el~
|
|
#+begin_example
|
|
(org-babel-load-file
|
|
(expand-file-name
|
|
"config.org"
|
|
user-emacs-directory))
|
|
#+end_example
|
|
|
|
* Package Management
|
|
** Archives
|
|
#+begin_src emacs-lisp
|
|
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
|
("org" . "https://orgmode.org/elpa/")
|
|
("elpa" . "https://elpa.gnu.org/packages/")))
|
|
|
|
(package-initialize)
|
|
(unless package-archive-contents
|
|
(package-refresh-contents))
|
|
#+end_src
|
|
|
|
** Use-Package
|
|
The ~use-package~ macro allows you to isolate package configuration in your ~.emacs~ file in a way that is both performance-oriented and, well, tidy.
|
|
|
|
#+begin_src emacs-lisp
|
|
(unless (package-installed-p 'use-package)
|
|
(package-install 'use-package))
|
|
|
|
(require 'use-package)
|
|
;; "ensure" packages by default
|
|
(setq use-package-always-ensure t)
|
|
#+end_src
|
|
|
|
** Ensure
|
|
The ~:ensure~ keyword causes the package(s) to be installed automatically if not already present on your system
|
|
|
|
#+begin_src emacs-lisp
|
|
(require 'use-package-ensure)
|
|
(setq use-package-always-ensure t)
|
|
#+end_src
|
|
|
|
* General Configuration
|
|
** User Interface
|
|
Start with minimal interface
|
|
#+begin_src emacs-lisp
|
|
(setq inhibit-startup-message t) ;; Disable startup message
|
|
|
|
(scroll-bar-mode -1) ; Disable visible scrollbar
|
|
(tool-bar-mode -1) ; Disable the toolbar
|
|
(tooltip-mode -1) ; Disable tooltips
|
|
(menu-bar-mode -1) ; Disable the menu bar
|
|
|
|
;; Set up the visible bell
|
|
(setq visible-bell t)
|
|
#+end_src
|
|
|
|
Enable line numbers and customize their format.
|
|
#+begin_src emacs-lisp
|
|
(column-number-mode)
|
|
(global-display-line-numbers-mode t)
|
|
(setq display-line-numbers-type `relative)
|
|
#+end_src
|
|
|
|
** Theme
|
|
#+begin_src emacs-lisp
|
|
(use-package doom-themes)
|
|
(load-theme 'doom-molokai t)
|
|
#+end_src
|
|
|
|
** Font
|
|
#+begin_src emacs-lisp
|
|
(set-face-attribute 'default nil :font "JetBrainsMono Nerd Font")
|
|
#+end_src
|
|
|
|
** Icons
|
|
#+begin_src emacs-lisp
|
|
(use-package all-the-icons)
|
|
#+end_src
|
|
|
|
** Mode Line
|
|
*** Doom Modeline
|
|
#+begin_src emacs-lisp
|
|
(use-package doom-modeline
|
|
:init (doom-modeline-mode 1)
|
|
:custom (doom-modeline-height 15))
|
|
#+end_src
|
|
|
|
* Keyboard Bindings
|
|
** Escape Cancels All
|
|
#+begin_src emacs-lisp
|
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
|
#+end_src
|
|
|
|
** Evil Mode
|
|
|
|
*** General
|
|
#+begin_src emacs-lisp
|
|
(use-package evil
|
|
:init ;; tweak evil's configuration before loading it
|
|
(setq evil-want-keybinding nil)
|
|
(setq evil-want-C-u-scroll t)
|
|
(evil-mode))
|
|
#+end_src
|
|
|
|
*** Evil Collection
|
|
Evil Collection is also installed since it adds 'evil' bindings to parts of Emacs that the standard Evil package does not cover, such as: calendar, help-mode and ibuffer.
|
|
#+begin_src emacs-lisp
|
|
(use-package evil-collection
|
|
:after evil
|
|
:config
|
|
(evil-collection-init))
|
|
#+end_src
|
|
|
|
** General Keybindings
|
|
[[https://github.com/noctuid/general.el][general.el]] provides a more convenient way to bind keys in emacs for both evil and non-evil users. ~general-define-key~ allows defining multiple keys at once, implicitly wrapping key strings with (kbd ...), having named prefix key sequences (like the leader key in vim), and more.
|
|
#+begin_src emacs-lisp
|
|
(use-package general
|
|
:config
|
|
(general-evil-setup t)
|
|
|
|
(general-create-definer dw/leader-key-def
|
|
:keymaps '(normal insert visual emacs)
|
|
:prefix "SPC"
|
|
:global-prefix "C-SPC"))
|
|
#+end_src
|
|
|
|
** Keybinding Panel (which-key)
|
|
[[https://github.com/justbur/emacs-which-key][which-key]] shows an overview of what keybindings are available based on the prefix keys you entered.
|
|
#+begin_src emacs-lisp
|
|
(use-package which-key
|
|
:init (which-key-mode)
|
|
:config(setq which-key-idle-delay 0.3))
|
|
#+end_src
|
|
|
|
* Ivy
|
|
** General
|
|
#+begin_src emacs-lisp
|
|
(use-package ivy
|
|
:diminish
|
|
:bind (("C-s" . swiper)
|
|
:map ivy-minibuffer-map
|
|
("TAB" . ivy-alt-done)
|
|
("C-l" . ivy-alt-done)
|
|
("C-j" . ivy-next-line)
|
|
("C-k" . ivy-previous-line)
|
|
:map ivy-switch-buffer-map
|
|
("C-k" . ivy-previous-line)
|
|
("C-l" . ivy-done)
|
|
("C-d" . ivy-switch-buffer-kill)
|
|
:map ivy-reverse-i-search-map
|
|
("C-k" . ivy-previous-line)
|
|
("C-d" . ivy-reverse-i-search-kill))
|
|
:init
|
|
(ivy-mode 1)) ;; Load keybindings
|
|
#+end_src
|
|
|
|
** Ivy-rich
|
|
[[https://github.com/Yevgnen/ivy-rich][ivy-rich]] comes with rich transformers for commands from ~ivy~ and ~counsel~.
|
|
#+begin_src emacs-lisp
|
|
(use-package ivy-rich
|
|
:after counsel
|
|
:init
|
|
(ivy-rich-mode 1))
|
|
#+end_src
|
|
|
|
** Counsel
|
|
~ivy-mode~ ensures that any Emacs command using ~completing-read-function~ uses ivy for completion.
|
|
|
|
Counsel takes this further, providing versions of common Emacs commands that are customised to make the best use of Ivy. For example, ~counsel-find-file~ has some additional keybindings. Pressing ~DEL~ will move you to the parent directory.
|
|
#+begin_src emacs-lisp
|
|
(use-package counsel
|
|
:demand t
|
|
:bind (("M-x" . counsel-M-x)
|
|
("C-x b" . counsel-ibuffer)
|
|
("C-x C-f" . counsel-find-file)
|
|
;; ("C-M-j" . counsel-switch-buffer)
|
|
("C-M-l" . counsel-imenu)
|
|
:map minibuffer-local-map
|
|
("C-r" . 'counsel-minibuffer-history))
|
|
:custom
|
|
(counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
|
|
:config
|
|
(setq ivy-initial-inputs-alist nil)) ;; Don't start searches with ^
|
|
#+end_src
|
|
|
|
* Development
|
|
** Languages
|
|
*** Emacs Lisp
|
|
**** Helpful
|
|
[[https://github.com/Wilfred/helpful][Helpful]] is an alternative to the built-in Emacs help that provides much more contextual information.
|
|
#+begin_src emacs-lisp
|
|
(use-package helpful
|
|
:custom
|
|
(counsel-describe-function-function #'helpful-callable)
|
|
(counsel-describe-variable-function #'helpful-variable)
|
|
:bind
|
|
([remap describe-function] . helpful-function)
|
|
([remap describe-symbol] . helpful-symbol)
|
|
([remap describe-variable] . helpful-variable)
|
|
([remap describe-command] . helpful-command)
|
|
([remap describe-key] . helpful-key))
|
|
#+end_src
|
|
** Productivity
|
|
*** Rainbow Delimiters
|
|
#+begin_src emacs-lisp
|
|
(use-package rainbow-delimiters
|
|
:hook (prog-mode . rainbow-delimiters-mode))
|
|
#+end_src
|
|
***
|