|
|
||
|---|---|---|
| README.org | ||
| bookmarks | ||
| config.org | ||
| init.el | ||
| projectile-bookmarks.eld | ||
README.org
- Bloxie's Emacs Configuration
- Introduction
- Config
Bloxie's Emacs Configuration
By Curt Spark / Bloxiebird.
Introduction
Welcome to my Emacs configuration!
Config
Appearance
Remove Tool Bar
Remove the Tool bar at the top for more room. Set mode to false:
(tool-bar-mode -1)
Remove Menu Bar
Remove the Menu Bar at the top for more room. Set mode to false:
(menu-bar-mode -1)
Remove Scroll Bar
Remove the Scroll Bar at the side for more room. Set mode to false:
(scroll-bar-mode -1)
Display Line Numbers
Display line numbers for all Programming Modes. Add hook to enable display-line-numbers-mode on all programming major modes:
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
Modern Fringes
Modern Fringes is a package that makes the side fringes of Emacs much more cleaner and modern. Install the package, enable it and ensure that it always is installed:
(use-package modern-fringes
:ensure t
:init
(modern-fringes-invert-arrows))
Theming
The theme for Emacs. Install and set the theme, ensuring that it is always installed:
(use-package dracula-theme
:ensure t
:init
(load-theme 'dracula t))
All The Icons
All The Icons is a package to display cool icons within Emacs. Install the package, enable it and ensure that it always is installed:
(use-package all-the-icons
:ensure t)
All The Icons Support for Ivy/Counsel. Which are autocompletion tools in emacs Install the package, enable it and ensure that it always is installed:
(use-package all-the-icons-ivy
:ensure t
:init
(all-the-icons-ivy-setup))
Mode Line
Spaceline
Spaceline is the modeline of Spacemacs. Install the package, enable it and ensure that it always is installed. Then make sure that the default spaceline config is enabled and that the seperators are arrows, for a powerline effect:
(use-package spaceline
:ensure t
:config
(require 'spaceline-config)
(setq powerline-default-separator (quote arrow))
(spaceline-spacemacs-theme))
Display the time on the Mode Line, this is more useful for EXWM:
(setq display-time-default-load-average nil)
(display-time-mode t)
Diminish
With Diminish you can optionally remove some of the names of the minor modes in the Mode Line. Install the package, enable it and ensure that it always is installed:
(use-package diminish
:ensure t)
Emacs Dashboard
A startup dashboard for Emacs, replacing the boring old one. Install the package, enable it and ensure that it always is installed:
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
Emacs Dashboard Configuration
;; Set the title
(setq dashboard-banner-logo-title "Welcome to Bloxie's Emacs!")
;; Set the banner
(setq dashboard-startup-banner 'logo)
;; Value can be
;; 'official which displays the official emacs logo
;; 'logo which displays an alternative emacs logo
;; 1, 2 or 3 which displays one of the text banners
;; "path/to/your/image.png" which displays whatever image you would prefer
;; Content is not centered by default. To center, set
(setq dashboard-center-content t)
;; To disable shortcut "jump" indicators for each section, set
(setq dashboard-show-shortcuts nil)
;;To customize which widgets are displayed, you can use the following snippet
(setq dashboard-items '((recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)
(registers . 5)))
;; To show agenda for the upcoming seven days set the variable show-week-agenda-p to t.
;; (setq show-week-agenda-p t)
;; Note that setting list-size for the agenda list is intentionally ignored; all agenda items for the current day will be displayed.
;; To customize which categories from the agenda items should be visible in the dashboard set the dashboard-org-agenda-categories to the list of categories you need.
;; (setq dashboard-org-agenda-categories '("Tasks" "Appointments"))
;; To add icons to the widget headings and their items:
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
;; To show navigator below the banner:
(setq dashboard-set-navigator t)
;; To customize the buttons of the navigator like this:
;; Format: "(icon title help action face prefix suffix)"
(setq dashboard-navigator-buttons
`(;; line1
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
"Homepage"
"Browse homepage"
(lambda (&rest _) (browse-url "https://gitlab.com/bloxiebird/linux-emacs-configuration")))
("★" "Star" "Show stars" (lambda (&rest _) (show-stars)) warning)
("?" "" "?/h" #'show-help nil "<" ">"))
))
Custom
Resizing Buffers
These are controls to resize the width and height of windows. Set keys:
(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)
Fullscreen Function
Emacs does not begin fullscreen, this function will automatically fullscreen Emacs on startup:
(defun fullscreen (&optional f)
(interactive)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
Call Function on Startup
(fullscreen)
Autosave
Default Emacs will store backup and "temporary" files in the edited files directory, instead this changes it to move it to the UNIX Temporary Directory. Set backup/temporary file directories:
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
Wind Move
Windmove is built into Emacs. It lets you move point from window to window using Shift and the arrow keys. This is easier to type than ‘C-x o’ when there are multiple windows open. Enable Wind Move:
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
Global Revert Mode
Global Revert Mode is a minor mode that automatically refreshes opened buffers when an external tool has changed their data. Enable Global Revert Mode:
(global-auto-revert-mode t)
Rainbow Delimiters
This Minor Mode will mark pairs of brackets with colours. Install the package, enable it and ensure that it always is installed.
(use-package rainbow-delimiters
:ensure t)
Set Minor Mode as Global :
(define-globalized-minor-mode global-rainbow-delimiters-mode rainbow-delimiters-mode
(lambda () (rainbow-delimiters-mode 1)))
(global-rainbow-delimiters-mode 1)
Rainbow Mode
This Minor Mode will highlight RGB/HEX values with their respective colours. Install the package, enable it and ensure that it always is installed.
(use-package rainbow-mode
:ensure t)
Set Minor Mode as Global :
(define-globalized-minor-mode global-rainbow-mode rainbow-mode
(lambda () (rainbow-mode 1)))
(global-rainbow-mode 1)
Org Mode
Simple Org Mode Preview
These are a simple set of functions that will automatically refresh the other buffer, which presumably has the Org Mode PDF open. This workflow expects you to have 2 window panes open, which can be in any orientation. The Org Mode File you are editing, and the PDF Document to view the changes you are making. Define functions and set keybindings:
(defun update-other-buffer ()
(interactive)
(other-window 1)
(revert-buffer nil t)
(other-window -1))
(defun org-compile-beamer-and-update-other-buffer ()
"Has as a premise that it's run from an org-mode buffer and the
other buffer already has the PDF open"
(interactive)
(org-beamer-export-to-pdf)
(update-other-buffer))
(defun org-compile-latex-and-update-other-buffer ()
"Has as a premise that it's run from an org-mode buffer and the
other buffer already has the PDF open"
(interactive)
(org-latex-export-to-pdf)
(update-other-buffer))
(define-key org-mode-map (kbd "C-c rl") 'org-compile-latex-and-update-other-buffer)
(define-key org-mode-map (kbd "C-c rb") 'org-compile-beamer-and-update-other-buffer)
LateX Preview
This package will automatically convert LaTeX Snippets into viewable LaTeX in your Org Mode Documents. LaTeX Snippets can be defined with text between dollar signs. Example : $ax+bx^2$
These LaTeX snippets will also show up when converting to PDF. Install the package, enable it and ensure that it always is installed:
(use-package org-fragtog
:ensure t
:init
(add-hook 'org-mode-hook 'org-fragtog-mode))
Org Bullets
Org Bullets convert the Asterisks of Org Mode headers into unicode Bullet point with multiple styles. Install the package, enable it and ensure that it always is installed, then add a hook to enable the Bullet Points when on Org Major Mode:
(use-package org-bullets
:ensure t
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode))))
Enable Indent Mode
A hook that will autmatically make sure that indenting of headers are enabled by default, this is visually useful and emulates code hierarchy. Add a hook to enable the Indentation when on Org Major Mode:
(add-hook 'org-mode-hook 'org-indent-mode)
Enable Beamer Support
A hook that will automatically make sure that Beamer Org Mode templates and exportion are enabled by default, for slideshow creation with LaTeX. Add a hook to enable the Beamer Mode when on Org Major Mode:
(add-hook 'org-mode-hook 'org-beamer-mode)
Agenda
For Org-Agenda, you can set a location of your Org Agenda file here. Set Agenda Directory:
(setq org-agenda-files (quote("~/.emacs.d/agenda.org")))
This is will integrate the Calendar/Diary into Org-Agenda, so you can get access to dates on public holidays etc. Set diary to true:
(setq org-agenda-include-diary t)
Evil Mode
Evil Mode, a package designed to emulate modal editing and vim keybindings in Emacs. Install the package, enable it and ensure that it always is installed, and then make sure that evil-mode is enabled by default:
(use-package evil
:ensure t
:init
(evil-mode 1))
Projectile
Projectile is a project manager, like a dynamic bookmarking system. It will automatically add repositories as projects which you can access via Dired or Ivy completion. Install the package, enable it and ensure that it always is installed, and then make sure that projectile-mode is enabled by default:
(use-package projectile
:ensure t
:init
(projectile-mode))
Auto Completion
Which Key
Which Key is an insanely useful package that will automatically show you the possible key combinations to finish a binded keychord. Install the package, enable it and ensure that it always is installed, and then make sure that which-key is enabled by default:
(use-package which-key
:ensure t
:init
(which-key-mode))
Ivy
Ivy is an autocompletion framework, it will automatically fuzzy find search words for you. This includes file managing, searching, and more via its extensibility and the Counsel package. Install the package, enable it and ensure that it always is installed, and then make sure that ivy-mode is enabled by default:
(use-package ivy
:ensure t
:init
(ivy-mode 1)
:bind
("C-s" . swiper))
Ivy Configuration Set an option to make Ivy show previously opened/edited buffers in the buffer selection :
(setq ivy-use-virtual-buffers t)
;(setq enable-recursive-minibuffers t)
Counsel
A collection of Ivy-enhanced versions of common Emacs commands. Install the package, enable it and ensure that it always is installed:
(use-package counsel
:ensure t)
Counsel Support in Projectile. Install the package, enable it and ensure that it always is installed, and then set up bindings for the Projectile specific prefix:
(use-package counsel-projectile
:ensure t
:init
(counsel-projectile-mode))
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
Company
Company Base
Company is a text completion framework for Emacs. The name stands for "complete anything". It uses pluggable back-ends and front-ends to retrieve and display completion candidates. Install the package, enable it and ensure that it always is installed, and then make sure that company-mode is enabled by default:
(use-package company
:ensure t
:init
(company-mode))
Configuration
; No delay in showing suggestions.
(setq company-idle-delay 0)
; Show suggestions after entering one character.
(setq company-minimum-prefix-length 1)
; Wrap around when suggestions reach bottom.
(setq company-selection-wrap-around t)
; Use tab key to cycle through suggestions.
; ('tng' means 'tab and go')
(company-tng-configure-default)
Company Quickhelp
Company Quickhelp is an extension to company which introduces documentation popups that appears when idling on a company completion candidate. Install the package, enable it and ensure that it always is installed, and then make sure that company-quickhelp-mode is enabled by default:
(use-package company-quickhelp
:ensure t
:init
(company-quickhelp-mode))
Multiple Cursors
The Multiple Cursors package is pretty self explanatory, you can select and manipulate multiple lines of the same text at the same time, move the cursors in unison. Etc. Install the package, enable it and ensure that it always is installed, and then bind the useful functions to a mnenomic key chord:
(use-package multiple-cursors
:ensure t
:bind
("C-c m" . 'mc/mark-next-like-this)
:bind
("C-c C-m" . 'mc/mark-all-like-this))
Expand Region
Auto selects a region of text/code, if executed multiple times it will wrap further, like layers of a binary onion. Install the package, enable it and ensure that it always is installed, and then bind the useful functions to a mnenomic key chord:
(use-package expand-region
:ensure t
:bind
("C-c e" . 'er/expand-region))
LSP Mode
LSP mode will give you IDE capabilities in Emacs, using Microsoft's Universal Language Server Protocol. The same one that VSCode uses for linting, autocompletion. Etc. Install the package, enable it and ensure that it always is installed, add a hook to make sure it only is activated on Programming Related Major Modes, and set a keychord for the custom prefix. +BEGIN_SRC emacs-lisp
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") (setq lsp-keymap-prefix "s-l")
(use-package lsp-mode :ensure t :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) (prog-mode . lsp) ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) :commands lsp) +END_SRC
Configuration
+BEGIN_SRC emacs-lisp ;; optionally (use-package lsp-ui :commands lsp-ui-mode :ensure t) (use-package company-lsp :commands company-lsp :ensure t) ;; if you are helm user ;;(use-package helm-lsp :commands helm-lsp-workspace-symbol) ;; if you are ivy user (use-package lsp-ivy :commands lsp-ivy-workspace-symbol :ensure t) (use-package lsp-treemacs :commands lsp-treemacs-errors-list :ensure t)
;; optionally if you want to use debugger (use-package dap-mode :ensure t) ;; (use-package dap-LANGUAGE) to load the dap adapter for your language +END_SRC