CodeCompanion.nvim is a Neovim plugin that integrates AI coding assistants into your workflow. It supports multiple AI models and enables developers to generate, edit, and debug code directly within Vim. The plugin is designed for operations teams who need to streamline their coding processes and improve productivity.
git clone https://github.com/olimorris/codecompanion.nvim.githttps://codecompanion.olimorris.dev
["1. Install CodeCompanion.nvim by adding it to your Neovim configuration file: `lua require('packer').startup(function() use 'yourusername/codecompanion.nvim' end)`","2. Set up your preferred AI model in the plugin settings. For example: `lua require('codecompanion').setup({ model = 'gpt-4' })`","3. Open a code file in Neovim and use the command `:CodeCompanion` to start the AI assistant. You can then type your request or question about the code.","4. For better results, be specific in your requests. Instead of 'fix this', try 'add error handling for invalid inputs in this function'","5. Use the plugin's code editing features to accept, reject, or modify suggestions directly in your editor."]
Automate code refactoring tasks to improve code quality and maintainability.
Utilize inline assistance for real-time code suggestions while writing.
Integrate various LLMs to enhance coding efficiency and reduce errors.
Manage multiple chat buffers for different coding contexts simultaneously.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/olimorris/codecompanion.nvimCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
I'm working on a [PROGRAMMING_LANGUAGE] script to [DESCRIBE_TASK]. Here's what I have so far: [PASTE_CODE]. Can you help me [SPECIFIC_REQUEST]? I want to make sure it's [SPECIFIC_GOAL].
Based on your Python script for processing sales data, here's how I'd improve it:
```python
# Original code
for row in data:
if row['status'] == 'completed':
total += row['amount']
# Improved version with error handling and type hints
from typing import List, Dict
def calculate_total(sales_data: List[Dict[str, str]]) -> float:
"""
Calculate the total amount from completed sales.
Args:
sales_data: List of dictionaries containing sales data
Returns:
Total amount of completed sales
"""
total = 0.0
for row in sales_data:
try:
if row.get('status') == 'completed':
total += float(row.get('amount', 0))
except (ValueError, TypeError) as e:
print(f"Error processing row {row}: {str(e)}")
return total
# Usage example
sales_data = [
{'status': 'completed', 'amount': '100.50'},
{'status': 'pending', 'amount': '75.25'},
{'status': 'completed', 'amount': '200.00'},
{'status': 'completed', 'amount': 'invalid'},
{'status': 'completed'}
]
print(calculate_total(sales_data)) # Output: 300.50 (skips invalid entries)
```
I've added type hints for better code documentation, included error handling for invalid data, and made the function reusable. The docstring explains the function's purpose and parameters. The example at the bottom shows how to use it with sample data.Run large language models locally on your machine
AI for humanity, built with safety first
Advanced foundation models via API and ChatGPT
AI-powered lesson planning and student analytics
Hey, what’s on your mind today?
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan