emacs: install copilot

auto-flake-update
Yorick van Pelt 2 months ago
parent a82ba1156e
commit 523e51fbbd
Signed by: yorick
GPG Key ID: A36E70F9DC014A15
  1. 18
      emacs/emacs.org
  2. 33
      home-manager/emacs.nix

@ -362,7 +362,10 @@ from https://vickychijwani.me/nuggets-from-my-emacs-part-i/
#+BEGIN_SRC emacs-lisp
(use-package company
:diminish
:hook (after-init . global-company-mode))
:hook (after-init . global-company-mode)
:config
;; use copilot
(delq 'company-preview-if-just-one-frontend company-frontends))
#+END_SRC
** Indentation
#+BEGIN_SRC emacs-lisp
@ -370,7 +373,11 @@ from https://vickychijwani.me/nuggets-from-my-emacs-part-i/
(setq-default tab-width 2) ; or any other preferred value
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
(define-key prog-mode-map (kbd "<tab>") #'company-indent-or-complete-common)
(defun yorick/copilot-tab (arg)
(interactive "P")
(or (copilot-accept-completion)
(company-indent-or-complete-common arg)))
(define-key prog-mode-map (kbd "<tab>") #'yorick/copilot-tab)
#+END_SRC
** smart home key
#+BEGIN_SRC emacs-lisp
@ -475,6 +482,13 @@ from [[https://www.emacswiki.org/emacs/BackupDirectory][emacs wiki]]
#+RESULTS:
** copilot
#+BEGIN_SRC emacs-lisp
(use-package copilot
:commands (copilot-login copilot-mode)
:bind (:map copilot-mode-map ("TAB" . copilot-accept-completion)))
#+END_SRC
** DONE fix clipboard on wayland
#+BEGIN_SRC emacs-lisp
(setq wl-copy-process nil)

@ -5,13 +5,42 @@ in {
programs.emacs = {
enable = true;
package = pkgs.emacsPgtkNativeComp;
extraPackages = _:
(with epkgs.melpaPackages; [
extraConfig = ''
(setq copilot-node-executable "${pkgs.nodejs-slim-16_x}/bin/node")
'';
overrides = final: prev: {
copilot = final.melpaBuild rec {
pname = "copilot";
version = "20220916.1";
commit = "f316299bab75a380ee04e7ca49c79baf0fb296d6";
src = pkgs.fetchFromGitHub {
owner = "zerolfx";
repo = "copilot.el";
rev = commit;
sha256 = "sha256-n4bXnlNfCC00jVeODUlqZNThf7i8rj69zzMMfXBy8tk=";
};
packageRequires = with final; [ dash editorconfig s ];
recipe = pkgs.writeText "recipe" ''
(copilot
:repo "zerolfx/copilot.el"
:fetcher github
:files ("dist" "*.el"))
'';
meta.description = "Emacs plugin for GitHub Copilot";
};
};
extraPackages = p:
(with p; [
all-the-icons
avy
company
counsel
counsel-projectile
copilot
diminish
direnv
dune

Loading…
Cancel
Save