aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

Integrate AI Coding Assistant with Neovim #74

Open aleeusgr opened 6 months ago

aleeusgr commented 6 months ago

Description:

As a developer on NixOS, I'd like to integrate an AI coding assistant with Neovim to enhance my coding experience. This assistant should provide real-time suggestions, code completion, and debugging assistance to help me write more efficient and accurate code.

Current Behavior:

Currently, I'm using Neovim as my editor on NixOS, but I'm missing the benefits of an AI-powered coding assistant. I've tried installing various plugins and extensions, but none of them provide the level of AI-driven assistance I need.

Desired Behavior:

I'd like to see an AI coding assistant integrated with Neovim on NixOS that provides the following features:

  1. Real-time suggestions: As I type, the assistant should suggest relevant code snippets, functions, and variables to help me complete my code.
  2. Code completion: The assistant should auto-complete code snippets, functions, and variables as I type, reducing the need for manual typing.
  3. Debugging assistance: The assistant should provide real-time debugging information, such as variable values, function calls, and error messages, to help me identify and fix issues.
  4. Code analysis: The assistant should analyze my code and provide suggestions for improvement, such as code refactoring, optimization, and best practices.

Technical Requirements:

To implement this feature, I'd like to see the following technical requirements met:

  1. Integration with Neovim: The AI coding assistant should seamlessly integrate with Neovim, allowing me to access its features and functionality.
  2. NixOS compatibility: The solution should be compatible with NixOS and its package manager, Nix.
  3. Language support: The assistant should support multiple programming languages, including Python, Java, and C++.
  4. Customizability: The assistant should allow for customization of its behavior, such as adjusting the level of suggestions, code completion, and debugging assistance.

Acceptance Criteria:

To confirm that the AI coding assistant is working correctly, the following acceptance criteria should be met:

  1. The assistant provides real-time suggestions and code completion as I type.
  2. The assistant provides accurate debugging information and code analysis.
  3. The assistant is customizable and integrates seamlessly with Neovim.
  4. The solution is compatible with NixOS and its package manager, Nix.

Estimated Time: 2-3 weeks

aleeusgr commented 6 months ago

https://lilianweng.github.io/posts/2023-03-15-prompt-engineering/#instruction-prompting https://platform.openai.com/docs/introduction https://learnprompting.org/

aleeusgr commented 5 months ago
viral post

x 3.5k impressions, Factors: pic, "mindful developer community", 7 AM UTC ![image](https://github.com/aleeusgr/nix-things/assets/36756030/6a49106f-cbf4-49e6-83b0-a8f817adb429) ![image](https://github.com/aleeusgr/nix-things/assets/36756030/bc2f60e2-43cd-4269-9cc2-7f5b7204192a) ![image](https://github.com/aleeusgr/nix-things/assets/36756030/4dc68796-7874-4d3e-b50b-97a025fd989c) ![image](https://github.com/aleeusgr/nix-things/assets/36756030/8083e48f-5003-4ad7-8993-4574c53257ad)

text

A mindful developer community is a group of software developers and technologists who prioritize mental well-being, emotional intelligence, and sustainable practices in their work environment and professional interactions. This community values the importance of self-awareness, empathy, collaboration, and continuous learning to create an inclusive, supportive atmosphere that fosters personal growth and innovation.

aleeusgr commented 5 months ago

text: https://docs.gpt4all.io/gpt4all_python.html

aleeusgr commented 4 weeks ago

Codeium: https://github.com/Exafunction/codeium.nvim/issues/18

aleeusgr commented 4 weeks ago
index e98cf1a..4aa24b1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,11 +3,17 @@

   inputs = {
     nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
-    home-manager.url = "github:nix-community/home-manager";
-    home-manager.inputs.nixpkgs.follows = "nixpkgs";
+    home-manager = {
+      url = "github:nix-community/home-manager";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    codeium = {
+      url = "github:jcdickinson/codeium.nvim";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };

-  outputs = inputs@{ nixpkgs, home-manager, ... }: {
+  outputs = inputs@{ nixpkgs, home-manager, codeium, ... }: {
     nixosConfigurations = {
       vivo = nixpkgs.lib.nixosSystem {
         system = "x86_64-linux";
+++ b/home.nix
@@ -40,6 +40,16 @@ let
       #ihaskell-blaze 
       #ghcup
     ];
+    nvimWithCodeium = neovim.override {
+            configure = {
+              customRC = ''
+                lua require("codeium").setup()
+              '';
+              packages.myPlugins = {
+                start = [vimPlugins.codeium-nvim vimPlugins.plenary-nvim vimPlugins.nvim-cmp];
+              };
+            };
+          };
 in
   {
     dconf = {
@@ -72,6 +82,7 @@ in
       # Neovim is starting to get huge; should move to a separate file.
       neovim = {
         enable = true;
+        package = nvimWithCodeium;
aleeusgr commented 3 weeks ago

https://github.com/ollama/ollama https://mynixos.com/nixpkgs/options/services.ollama https://github.com/huggingface/llm.nvim?tab=readme-ov-file#backend

https://ollama.com/library

aleeusgr commented 3 weeks ago

add llm-ls: https://github.com/roman3pm/manix/blob/9cdee1f93ab2de92bf557945400c5546ac082e06/profiles/home.nix#L53

add llm-nvim: https://github.com/roman3pm/manix/blob/9cdee1f93ab2de92bf557945400c5546ac082e06/profiles/neovim/default.nix#L54-L60

add lua config: https://github.com/roman3pm/manix/blob/9cdee1f93ab2de92bf557945400c5546ac082e06/profiles/neovim/lsp.lua#L196-L205

aleeusgr commented 3 weeks ago

askai.sh improvements.

  1. Add option to read arbitrary text file or input.

  2. Make accessible globally via home manager.

aleeusgr commented 3 weeks ago

Try Continue + VSCode Setup guide: https://docs.continue.dev/walkthroughs/set-up-codestral?ref=blog.continue.dev

Running Continue without Internet: https://docs.continue.dev/walkthroughs/running-continue-without-internet

VS Code plugin: https://marketplace.visualstudio.com/items?itemName=Continue.continue

Codestral keys: https://console.mistral.ai/codestralcontinune

Suggested local models for Chat, Autocomplete, and Embeddings: https://docs.continue.dev/setup/select-model

aleeusgr commented 1 week ago

https://github.com/nomnivore/ollama.nvim/

aleeusgr commented 1 week ago

https://github.com/sigoden/aichat