some more work on emacs init.el
This commit is contained in:
parent
7dd753506f
commit
a5d571fc75
2 changed files with 625 additions and 21 deletions
|
@ -7,7 +7,15 @@
|
|||
|
||||
* About
|
||||
My attempt at a litterate configuration for Emacs.
|
||||
* Prep
|
||||
to tangle this file, run the following command in Emacs:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(org-babel-tangle)
|
||||
#+END_SRC
|
||||
or keyboard shortcut `C-c C-v t` (org-babel-tangle) in Emacs.
|
||||
This will generate the `~/.emacs.d/init.el` file with the configuration.
|
||||
|
||||
* Prep
|
||||
|
||||
** Copilot Authentication
|
||||
To use GitHub Copilot, you need to authenticate with your GitHub account. This is done by running the following command in Emacs:
|
||||
after installing the copilot package:
|
||||
|
@ -19,6 +27,29 @@ Try to trigger the GitHub OAuth flow from within Emacs:
|
|||
|
||||
* Configuration
|
||||
|
||||
** Setup lexical binding
|
||||
Here we set up lexical binding, which is a feature in Emacs Lisp that allows for more efficient variable scoping and function closures. This is recommended for performance reasons.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; enable lexical binding
|
||||
(setq lexical-binding t)
|
||||
#+END_SRC
|
||||
|
||||
** Set automatic update of packages
|
||||
|
||||
We set up Emacs to automatically update packages on startup. This ensures that we always have the latest versions of the packages we use.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun geokkjer/display-startup-time ()
|
||||
(message "Emacs loaded in %s with %d grabage collections."
|
||||
(format "%.2f seconds"
|
||||
(float-time
|
||||
(time-subtract after-init-time before-init-time)))
|
||||
gcs-done))
|
||||
|
||||
(add-hook 'emacs-startup-hook #'geokkjer/display-startup-time)
|
||||
|
||||
(setq gc-cons-threshold (* 50 1000 1000))
|
||||
#+END_SRC
|
||||
|
||||
** Customize UI
|
||||
Here we set up the UI to our liking. We disable the menu bar, tool bar, and scroll bar, and set the font size to 14pt.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -67,6 +98,30 @@ Set up doom modeline, which is a nice status line for Emacs. We set it up to sho
|
|||
(setq use-package-always-ensure t)
|
||||
#+END_SRC
|
||||
|
||||
** Org Mode
|
||||
Configure Org-mode for literate programming and note-taking.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; ensure org-mode is installed and up to date
|
||||
(use-package org
|
||||
:ensure t
|
||||
:mode ("\\.org\\'" . org-mode)
|
||||
:config
|
||||
;; enable syntax highlighting in code blocks
|
||||
(setq org-src-fontify-natively t)
|
||||
;; preserve indentation in code blocks
|
||||
(setq org-src-preserve-indentation t)
|
||||
;; enable babel for code execution
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(shell . t)
|
||||
(python . t)
|
||||
(nix . t)))
|
||||
;; don't ask for confirmation when evaluating code blocks
|
||||
(setq org-confirm-babel-evaluate nil))
|
||||
#+END_SRC
|
||||
|
||||
* Code Completion and ide features
|
||||
** LSP Mode
|
||||
Here we install lsp-mode and lsp-ui, which are the core components of the LSP (Language Server Protocol) support in Emacs. We also set up keybindings for common LSP commands.
|
||||
|
@ -105,27 +160,7 @@ Here we install from MELPA, enable it in all prog-modes and bind keys for comple
|
|||
** Language support
|
||||
Here we install and configure support for various programming languages. We use the `use-package` macro to ensure that the packages are installed and configured correctly.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
||||
;; install and configure javscript-mode
|
||||
(use-package javscript-mode
|
||||
:ensure t
|
||||
:mode "\\.js\\'")
|
||||
;; lsp support for javascript
|
||||
(use-package lsp-javascript
|
||||
:ensure t
|
||||
:mode "\\.js\\'")
|
||||
|
||||
;; install and configure gleam-mode
|
||||
(use-package gleam-mode
|
||||
:ensure t
|
||||
:mode "\\.gleam\\'")
|
||||
#+END_SRC
|
||||
;; lsp support for gleam
|
||||
(use-package lsp-gleam
|
||||
:ensure t
|
||||
:mode "\\.gleam\\'")
|
||||
#+END_SRC
|
||||
|
||||
** NixOS from Emacs
|
||||
Editing Nix files and doing NixOS admin stuff like nixos-rebuild boot --upgrade
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue