This repository holds my emacs configuration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
merazi 2fa4c368c9 May 25 3 weeks ago
.gitignore Emacs configuration files 2 months ago
README.org [Symlink to merazi-init.org] Show my config just by opening the repo 1 month ago
init.el 2021-05-07 1 month ago
merazi-init.org May 25 3 weeks ago

README.org

Merazimacs

GUI Tweaks

Disable the startup screen.

  (setq inhibit-startup-screen t)

Add a useful title to the emacs frame.

  (setq-default frame-title-format '("%b"))

Disable some GUI elements.

  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tool-bar-mode -1)

Enable cursor blinking

  (blink-cursor-mode 1)

I like the default emacs theme, but the highlighted text color is too low contrast… Hey! This is the extensible text editor, I can tweak anything 😃

  (set-face-attribute 'region nil :background "#ccc")

I find the fringe to be useful, if you don't want it you can set it to minus one.

  (fringe-mode 6)

I like this font.

  (set-frame-font "Noto Sans Mono-10")

Move the custom file

I don't want it to clutter init.el

  (setq custom-file "~/.config/emacs/custom.el")
  (load-file custom-file)

Custom keyboard shortcuts

Easier window resizing.

  (global-set-key (kbd "<C-up>") 'shrink-window)
  (global-set-key (kbd "<C-down>") 'enlarge-window)
  (global-set-key (kbd "<C-left>") 'shrink-window-horizontally)
  (global-set-key (kbd "<C-right>") 'enlarge-window-horizontally)

Editing behaviour

This will allow me to just say y or n, instead of having to type "yes" or "no" each time.

  (fset 'yes-or-no-p 'y-or-n-p)

This will clean all the whitespace on the document each time I save. It only affects trailing whitespace, it doesn't affect new lines or indentation.

  (add-hook 'before-save-hook 'whitespace-cleanup)

For some reason, if I select some text and start typing, emacs doesn't replace the selected text. This tweak changes that behaviour.

  (delete-selection-mode 1)

I don't want my lines to get truncated. I preffer having to scroll in order to see the long lines instead of having them truncated on the next line.

  (set-default 'truncate-lines t)

I don't find lockfiles that useful, if you wan you can set the variable back to t.

  (setq create-lockfiles nil)

Complete and show pairs like parentheses, braces, brackets, quotes and greater/less than.

  (electric-pair-mode 1)
  (show-paren-mode 1)

Autosaves

Move the autosave files (~).

  (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))

Package configurations

all-the-icons

This will allow me to have nice looking icons on the modeline.

  (use-package all-the-icons :ensure t)

emojify

This allows emojis to be displayed on emacs.

  (use-package emojify :ensure t
    :config
    (global-emojify-mode t))

org-mode

My org mode config, right now it just has python stuff…

  (use-package org :ensure t
    :config

    ;; Add python to the execute list
    (org-babel-do-load-languages
'org-babel-load-languages
'((python . t)))

    ;; Some keyboard shortcuts
    (global-set-key "\C-cl" 'org-store-link)
    (global-set-key "\C-ca" 'org-agenda)
    (global-set-key "\C-cc" 'org-capture)
    (global-set-key "\C-cb" 'org-switchb)

    ;; Set the path for the python executable
    (setq org-babel-python-command "~/.guix-profile/bin/python3")

    ;; Separate the Cover page, TOC and Content on org-mode latex export
    (setq org-latex-toc-command "\\clearpage \\tableofcontents \\clearpage"))

rainbow Mode

Shows css colors, very useful for editing css or similar.

  (use-package rainbow-mode :ensure t
    :config
    (global-set-key (kbd "C-x c") 'rainbow-mode))

ivy

Better completion for emacs.

  (use-package ivy :ensure t
    :config
    (ivy-mode 1))

smex

An ido-like mode for M-x.

  ;;     (use-package smex :ensure t
  ;;       :config
  ;;       (global-set-key (kbd "M-x") 'smex)
  ;;       (global-set-key (kbd "M-X") 'smex-major-mode-commands)
  ;;       ;; the old M-x prompt
  ;;       (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command))

gitignore-mode

I use this so I can have syntax highlighting on gitignore files.

  (use-package gitignore-mode :ensure t)

telega

  (use-package telega :ensure t
    :config
    (setq telega-use-docker t))

magit

Magit is an interface to the version control system Git, implemented as an Emacs package.

  (use-package magit :ensure t)

flycheck

This will do syntax checking for several languages.

  (use-package flycheck :ensure t
    :init
    (global-flycheck-mode t))

swiper

An improved search utility for emacs. I really enjoy using it as it is very satisfactory.

  (use-package swiper :ensure t
    :config
    (global-set-key "\C-s" 'swiper))

web-mode

An improved mode for html, css, javascript and other web languages.

  (use-package web-mode :ensure t
    :config
    (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)))

which-key

This package shows a help buffer for the current key chord.

  (use-package which-key :ensure t
    :config
    (which-key-mode))

org-tree-slides

Give presentations in org-mode!

  (use-package org-tree-slide :ensure t
    :custom
    (org-tree-slide-slide-in-effect t)
    (org-tree-slide-activate-message "Presentation started!")
    (org-tree-slide-deactivate-message "Presentation finished!")
    (org-tree-slide-header t)
    (org-tree-slide-breadcrumbs " > ")
    (org-image-actual-width nil))

User functions

I'll be adding more user functions here.

Reload the configuration file

  (defun reload-config ()
    (interactive)
    (load-file (concat user-emacs-directory "init.el")))

Emacs own beacon

This was suggested by Lusco over on Telegram, thank you!

  (defun pulse-line (_)
    (pulse-momentary-highlight-one-line (point)))
  (setq window-selection-change-functions '(pulse-line))