Remaking litterate configs with copilot
This commit is contained in:
parent
ab93034d6d
commit
7dd753506f
4 changed files with 214 additions and 16 deletions
|
@ -1,9 +0,0 @@
|
|||
#+title: Emacs Configuration
|
||||
#+author: Geir Okkenhaug Jerstad
|
||||
#+email: geir@geokkjer.eu
|
||||
#+options: toc:nil num:nil
|
||||
|
||||
* About
|
||||
My attempt at a litterate configuration for Emacs.
|
||||
|
||||
|
152
Emacs/emacs.org
152
Emacs/emacs.org
|
@ -2,8 +2,160 @@
|
|||
#+author: Geir Okkenhaug Jerstad
|
||||
#+email: geir@geokkjer.eu
|
||||
#+options: toc:nil num:nil
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle ~/.emacs.d/init.el
|
||||
|
||||
|
||||
* About
|
||||
My attempt at a litterate configuration for Emacs.
|
||||
* 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:
|
||||
Try to trigger the GitHub OAuth flow from within Emacs:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :eval yes
|
||||
(call-interactively 'copilot-auth)
|
||||
#+END_SRC
|
||||
|
||||
* Configuration
|
||||
|
||||
** 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
|
||||
;; disable startup screen
|
||||
(setq inhibit-startup-screen t)
|
||||
;; disable menu bar
|
||||
(menu-bar-mode -1)
|
||||
;; disable tool bar
|
||||
(tool-bar-mode -1)
|
||||
;; disable scroll bar
|
||||
(scroll-bar-mode -1)
|
||||
;; set font size
|
||||
(set-face-attribute 'default nil :height 140)
|
||||
#+END_SRC
|
||||
Set up doom modeline, which is a nice status line for Emacs. We set it up to show the current buffer name and the current line number.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; install doom-modeline if not already installed
|
||||
(unless (package-installed-p 'doom-modeline)
|
||||
(package-refresh-contents)
|
||||
(package-install 'doom-modeline))
|
||||
(require 'doom-modeline)
|
||||
;; enable doom-modeline
|
||||
(doom-modeline-mode 1)
|
||||
;; set up doom-modeline to show the current buffer name and line number
|
||||
(setq doom-modeline-buffer-file-name-style 'truncate-with-project)
|
||||
#+END_SRC
|
||||
|
||||
** Set up package management
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; set up package archives
|
||||
(require 'package)
|
||||
(setq package-archives
|
||||
'(("melpa" . "https://melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/")))
|
||||
(package-initialize)
|
||||
#+END_SRC
|
||||
|
||||
** Install use-package
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; install use-package if not already installed
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
(require 'use-package)
|
||||
;; ensure that use-package is always used
|
||||
(setq use-package-always-ensure t)
|
||||
#+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.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; install lsp-mode and lsp-ui if not already installed
|
||||
(unless (package-installed-p 'lsp-mode)
|
||||
(package-refresh-contents)
|
||||
(package-install 'lsp-mode))
|
||||
(unless (package-installed-p 'lsp-ui)
|
||||
(package-refresh-contents)
|
||||
(package-install 'lsp-ui))
|
||||
(require 'lsp-mode)
|
||||
(require 'lsp-ui)
|
||||
;; enable lsp-mode in programming buffers
|
||||
(add-hook 'prog-mode-hook #'lsp)
|
||||
#+END_SRC
|
||||
** GitHub Copilot
|
||||
|
||||
Here we install from MELPA, enable it in all prog-modes and bind keys for completion:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; ensure Copilot is installed
|
||||
(unless (package-installed-p 'copilot)
|
||||
(package-refresh-contents)
|
||||
(package-install 'copilot))
|
||||
|
||||
(require 'copilot)
|
||||
;; turn on in programming buffers
|
||||
(add-hook 'prog-mode-hook #'copilot-mode)
|
||||
|
||||
;; keybindings: M-TAB to trigger, TAB to accept
|
||||
(define-key copilot-mode-map (kbd "M-TAB") #'copilot-complete)
|
||||
(define-key copilot-completion-map (kbd "<tab>") #'copilot-accept-completion)
|
||||
#+END_SRC
|
||||
|
||||
** 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
|
||||
Run the commands with M-x shell-command
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; NixOS commands
|
||||
(defun nixos-upgrade ()
|
||||
"Run 'nixos-rebuild boot --upgrade' in a shell."
|
||||
(interactive)
|
||||
(shell-command "nixos-rebuild boot --upgrade"))
|
||||
|
||||
(defun nixos-switch ()
|
||||
"Run 'nixos-rebuild switch' in a shell."
|
||||
(interactive)
|
||||
(shell-command "nixos-rebuild switch"))
|
||||
#+END_SRC
|
||||
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; install nix-mode
|
||||
(use-package nix-mode
|
||||
:ensure t
|
||||
:mode "\\.nix\\'")
|
||||
;; install nix-repl
|
||||
(use-package nix-repl
|
||||
:ensure t
|
||||
:mode "\\.nix\\'")
|
||||
;; install nixpkgs
|
||||
(use-package nixpkgs
|
||||
:ensure t
|
||||
:mode "\\.nix\\'")
|
||||
#+END_SRC
|
||||
|
|
57
dotfiles/sway/Sway.org
Normal file
57
dotfiles/sway/Sway.org
Normal file
|
@ -0,0 +1,57 @@
|
|||
#+title: Litterate Sway Configuration
|
||||
#+author: Geir Okkenhaug Jerstad
|
||||
#+email: geir@geokkjer.eu
|
||||
#+options: toc:nil num:nil
|
||||
#+PROPERTY: header-args:shell :tangle yes :exports code
|
||||
|
||||
* Prep
|
||||
** Install sway with Nerdfonts
|
||||
#+begin_src nix :tangle ~/.nixconfigs/sway.nix
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
sway
|
||||
waybar
|
||||
gammastep
|
||||
fuzzel
|
||||
];
|
||||
fonts = with pkgs; [
|
||||
inter-nerdfont
|
||||
jetbrains-mono-nerdfont
|
||||
source-code-pro-nerdfont
|
||||
ubuntu-mono-nerdfont
|
||||
];
|
||||
}
|
||||
|
||||
#+end_src
|
||||
* Sway Configuration
|
||||
** Sway config
|
||||
#+begin_src shell :tangle ~/.config/sway/config
|
||||
# This file is managed by Geir Okkenhaug Jerstad <geir@geokkjer.eu>
|
||||
# and is litterate.
|
||||
|
||||
#+End_src
|
||||
|
||||
** Waybar config
|
||||
#+begin_src shell :tangle ~/.config/waybar/config
|
||||
# This file is managed by Geir Okkenhaug Jerstad <geir@geokkjer.eu>
|
||||
# and is litterate.
|
||||
|
||||
#+End_src
|
||||
** Waybar style
|
||||
#+begin_src shell :tangle ~/.config/waybar/style.css
|
||||
# This file is managed by Geir Okkenhaug Jerstad <geir@geokkjer.eu>
|
||||
# and is litterate.
|
||||
|
||||
#+End_src
|
||||
** Fuzzel config
|
||||
#+begin_src shell :tangle ~/.config/fuzzel/config
|
||||
# This file is managed by Geir Okkenhaug Jerstad <geir@geokkjer.eu>
|
||||
# and is litterate.
|
||||
|
||||
#+End_src
|
||||
** Gammastep config
|
||||
#+begin_src shell :tangle ~/.config/gammastep/gammastep.conf
|
||||
# This file is managed by Geir Okkenhaug Jerstad <geir@geokkjer.eu>
|
||||
# and is litterate.
|
||||
|
||||
#+End_src
|
|
@ -20,6 +20,8 @@ The litterate config
|
|||
** Home
|
||||
** Machines
|
||||
* Nixos
|
||||
** Home
|
||||
** Workstation
|
||||
** Application Server
|
||||
#+begin_src nix
|
||||
|
||||
|
@ -45,13 +47,9 @@ The litterate config
|
|||
|
||||
#+end_src
|
||||
|
||||
* sd
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* Terminals
|
||||
** Kitty
|
||||
** Rio
|
||||
# Local Variables:
|
||||
# eval: (add-hook 'after-save-hook #'org-babel-tangle t t)
|
||||
# End:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue