From ed6ca13394d9ec40edbce26819c60a4e8f7dc1bb Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 20:04:05 +0100 Subject: [PATCH] Doom Emacs stuff --- doomemacs/.doom.d/config.el | 24 +++++++++++++++++++- doomemacs/.doom.d/packages.el | 3 +++ nvim/.config/nvim/plugin/packer_compiled.lua | 16 ++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/doomemacs/.doom.d/config.el b/doomemacs/.doom.d/config.el index 49804f9..144abb3 100644 --- a/doomemacs/.doom.d/config.el +++ b/doomemacs/.doom.d/config.el @@ -6,7 +6,7 @@ ;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; clients, file templates and snippets. It is optional. -(setq user-full-name "E. Almqvist" +(setq user-full-name "Elias Almqvist" user-mail-address "elalmqvist@gmail.com") ;; Doom exposes five (optional) variables for controlling fonts in Doom: @@ -104,3 +104,25 @@ (global-set-key (kbd "M-g") 'format-all-buffer) + +;; accept completion from copilot and fallback to company +(use-package! copilot + :hook (prog-mode . copilot-mode) + :bind (:map copilot-completion-map + ("" . 'copilot-accept-completion) + ("TAB" . 'copilot-accept-completion) + ("C-TAB" . 'copilot-accept-completion-by-word) + ("C-" . 'copilot-accept-completion-by-word))) + +(after! (evil copilot) + ;; Define the custom function that either accepts the completion or does the default behavior + (defun my/copilot-tab-or-default () + (interactive) + (if (and (bound-and-true-p copilot-mode) + ;; Add any other conditions to check for active copilot suggestions if necessary + ) + (copilot-accept-completion) + (evil-insert 1))) ; Default action to insert a tab. Adjust as needed. + + ;; Bind the custom function to in Evil's insert state + (evil-define-key 'insert 'global (kbd "") 'my/copilot-tab-or-default)) diff --git a/doomemacs/.doom.d/packages.el b/doomemacs/.doom.d/packages.el index 839b83c..b4f1808 100644 --- a/doomemacs/.doom.d/packages.el +++ b/doomemacs/.doom.d/packages.el @@ -48,3 +48,6 @@ ;(unpin! pinned-package another-pinned-package) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;(unpin! t) + +(package! copilot + :recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist"))) diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index 5406eaa..d9c7099 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -195,18 +195,18 @@ time([[Defining packer_plugins]], false) time([[Config for gitsigns.nvim]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim") time([[Config for gitsigns.nvim]], false) --- Config for: nvim-autopairs -time([[Config for nvim-autopairs]], true) -try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") -time([[Config for nvim-autopairs]], false) --- Config for: Comment.nvim -time([[Config for Comment.nvim]], true) -try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") -time([[Config for Comment.nvim]], false) -- Config for: todo-comments.nvim time([[Config for todo-comments.nvim]], true) try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim") time([[Config for todo-comments.nvim]], false) +-- Config for: Comment.nvim +time([[Config for Comment.nvim]], true) +try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim") +time([[Config for Comment.nvim]], false) +-- Config for: nvim-autopairs +time([[Config for nvim-autopairs]], true) +try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") +time([[Config for nvim-autopairs]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then