From 0d2481bd78a46ed171dfcf1063a7b11fb52585cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Mon, 21 Jul 2025 18:54:30 +0200 Subject: [PATCH] vim: enable copilot --- flake.nix | 1 + lib/vim/init.vim | 13 +++++++++++++ packages/vim.nix | 2 ++ 3 files changed, 16 insertions(+) diff --git a/flake.nix b/flake.nix index 3d23908..25f77eb 100644 --- a/flake.nix +++ b/flake.nix @@ -314,6 +314,7 @@ // flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux flake-utils.lib.system.x86_64-darwin flake-utils.lib.system.aarch64-linux] (system: let pkgs = import nixpkgs { inherit system; + config.allowUnfree = true; overlays = [ nur.overlays.default (self: super: { diff --git a/lib/vim/init.vim b/lib/vim/init.vim index 41e69f9..1a6adf5 100644 --- a/lib/vim/init.vim +++ b/lib/vim/init.vim @@ -124,3 +124,16 @@ set complete+=kspell let g:pandoc#syntax#conceal#use = 0 let g:pandoc#modules#disabled = [] let g:pandoc#spell#default_langs = ['en', 'de'] + + +" Enable Copilot for specific filetypes +" See: https://github.com/github/copilot.vim/blob/1a55183ef9347d6f420406a3746474b6b9fb9ef5/doc/copilot.txt#L46 +let g:copilot_filetypes = { + \ 'python': v:true +\} +" Disable Copilot for files larger than 100kb +autocmd BufReadPre * + \ let f=getfsize(expand("")) + \ | if f > 100000 || f == -2 + \ | let b:copilot_enabled = v:false + \ | endif diff --git a/packages/vim.nix b/packages/vim.nix index ec726cc..7d2abe1 100644 --- a/packages/vim.nix +++ b/packages/vim.nix @@ -40,6 +40,8 @@ editorconfig-vim + copilot-vim + fzf-vim fzfWrapper supertab