- Update package description and fix mainProgram typo - Rewrite documentation to describe project switching, not process viewing - Add PROJECT_FOLDERS configuration and usage examples - Update all references across docs (README, guides, module overviews)
318 lines
5.0 KiB
Markdown
318 lines
5.0 KiB
Markdown
# editors Home Manager Module
|
|
|
|
Editor configurations for Home Manager.
|
|
|
|
## Overview
|
|
|
|
This module provides pre-configured settings for various code editors, making it easy to set up your development environment.
|
|
|
|
## Quick Start
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
imports = [m3ta-nixpkgs.homeManagerModules.default];
|
|
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
neovim.enable = true;
|
|
zed.enable = true;
|
|
};
|
|
}
|
|
```
|
|
|
|
## Module Options
|
|
|
|
### `m3ta.coding.editors.enable`
|
|
|
|
Enable the editors module.
|
|
|
|
- Type: `boolean`
|
|
- Default: `false`
|
|
|
|
### `m3ta.coding.editors.neovim.enable`
|
|
|
|
Enable Neovim configuration.
|
|
|
|
- Type: `boolean`
|
|
- Default: `false`
|
|
|
|
### `m3ta.coding.editors.neovim.package`
|
|
|
|
Custom Neovim package.
|
|
|
|
- Type: `package`
|
|
- Default: `pkgs.neovim`
|
|
|
|
### `m3ta.coding.editors.zed.enable`
|
|
|
|
Enable Zed editor configuration.
|
|
|
|
- Type: `boolean`
|
|
- Default: `false`
|
|
|
|
### `m3ta.coding.editors.zed.package`
|
|
|
|
Custom Zed package.
|
|
|
|
- Type: `package`
|
|
- Default: `pkgs.zed`
|
|
|
|
## Supported Editors
|
|
|
|
### Neovim
|
|
|
|
Neovim is a highly extensible Vim-based text editor.
|
|
|
|
```nix
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
neovim = {
|
|
enable = true;
|
|
package = pkgs.neovim;
|
|
};
|
|
}
|
|
```
|
|
|
|
**Features**:
|
|
- Vim-style editing
|
|
- Plugin system
|
|
- Lua scripting
|
|
- Fast performance
|
|
- Built-in LSP support
|
|
|
|
**Configuration**: The module provides sensible defaults. You can customize by adding your own configuration.
|
|
|
|
### Zed
|
|
|
|
Zed is a high-performance, multiplayer code editor.
|
|
|
|
```nix
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
zed = {
|
|
enable = true;
|
|
package = pkgs.zed;
|
|
};
|
|
}
|
|
```
|
|
|
|
**Features**:
|
|
- Fast startup
|
|
- Built-in collaboration
|
|
- AI assistance (optional)
|
|
- Modern UI
|
|
- Low memory usage
|
|
|
|
**Configuration**: Zed uses JSON configuration files that can be customized.
|
|
|
|
## Usage Examples
|
|
|
|
### Minimal Neovim Setup
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
neovim.enable = true;
|
|
};
|
|
}
|
|
```
|
|
|
|
### Minimal Zed Setup
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
zed.enable = true;
|
|
};
|
|
}
|
|
```
|
|
|
|
### Multiple Editors
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
neovim.enable = true;
|
|
zed.enable = true;
|
|
};
|
|
}
|
|
```
|
|
|
|
### Custom Package
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
m3ta.coding.editors = {
|
|
enable = true;
|
|
neovim = {
|
|
enable = true;
|
|
package = pkgs.neovim-unwrapped; # Use unwrapped version
|
|
};
|
|
};
|
|
}
|
|
```
|
|
|
|
## Configuration Files
|
|
|
|
### Neovim
|
|
|
|
The module sets up Neovim configuration in:
|
|
|
|
```
|
|
~/.config/nvim/
|
|
```
|
|
|
|
You can extend it with:
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
xdg.configFile."nvim/init.lua".text = ''
|
|
-- Your custom Neovim configuration
|
|
'';
|
|
}
|
|
```
|
|
|
|
### Zed
|
|
|
|
Zed configuration is in:
|
|
|
|
```
|
|
~/.config/zed/settings.json
|
|
```
|
|
|
|
You can customize it with:
|
|
|
|
```nix
|
|
{config, ...}: {
|
|
xdg.configFile."zed/settings.json".text = builtins.toJSON {
|
|
# Your custom Zed settings
|
|
};
|
|
}
|
|
```
|
|
|
|
## Migration Guide
|
|
|
|
### From Manual Configuration
|
|
|
|
If you have existing editor configurations, you can:
|
|
|
|
1. Backup your current config
|
|
2. Enable the module
|
|
3. Test it out
|
|
4. Gradually migrate custom settings
|
|
|
|
**Backup**:
|
|
|
|
```bash
|
|
# Backup Neovim
|
|
cp -r ~/.config/nvim ~/.config/nvim.backup
|
|
|
|
# Backup Zed
|
|
cp -r ~/.config/zed ~/.config/zed.backup
|
|
```
|
|
|
|
### From Other Editors
|
|
|
|
**Vim to Neovim**:
|
|
- Most Vim configurations work with Neovim
|
|
- Enable module and test
|
|
- Migrate plugins to modern Lua versions
|
|
|
|
**VSCode to Zed**:
|
|
- Zed has built-in keybinding presets
|
|
- Enable module and check keybindings
|
|
- Adjust as needed
|
|
|
|
## Keybindings
|
|
|
|
### Neovim
|
|
|
|
Default keybindings (Vim-style):
|
|
|
|
| Mode | Key | Action |
|
|
|-------|------|---------|
|
|
| Normal | `i` | Enter insert mode |
|
|
| Normal | `ESC` | Exit insert mode |
|
|
| Normal | `:w` | Save |
|
|
| Normal | `:q` | Quit |
|
|
| Normal | `u` | Undo |
|
|
| Normal | `Ctrl+r` | Redo |
|
|
|
|
### Zed
|
|
|
|
Default keybindings:
|
|
|
|
| Mode | Key | Action |
|
|
|-------|------|---------|
|
|
| General | `Ctrl+S` | Save |
|
|
| General | `Ctrl+P` | Command palette |
|
|
| General | `Ctrl+Shift+P` | File palette |
|
|
| Navigation | `Ctrl+B` | Toggle sidebar |
|
|
| Navigation | `Ctrl+Shift+B` | Toggle activity bar |
|
|
|
|
## Plugins and Extensions
|
|
|
|
### Neovim
|
|
|
|
The module provides a base. You can add plugins using:
|
|
|
|
```nix
|
|
{pkgs, ...}: {
|
|
programs.neovim.plugins = with pkgs.vimPlugins; [
|
|
nvim-lspconfig
|
|
nvim-treesitter
|
|
telescope-nvim
|
|
];
|
|
}
|
|
```
|
|
|
|
### Zed
|
|
|
|
Zed extensions are managed through the editor:
|
|
|
|
1. Open Zed
|
|
2. Go to Extensions (Ctrl+Shift+X)
|
|
3. Browse and install extensions
|
|
|
|
## Troubleshooting
|
|
|
|
### Editor Not Found
|
|
|
|
Ensure the editor package is installed:
|
|
|
|
```bash
|
|
# Check Neovim
|
|
which nvim
|
|
|
|
# Check Zed
|
|
which zed
|
|
```
|
|
|
|
### Configuration Not Applied
|
|
|
|
Check if the module is enabled:
|
|
|
|
```bash
|
|
# Check Home Manager state
|
|
home-manager show
|
|
|
|
# View current config
|
|
nix eval .#homeConfigurations.username.config.m3ta.coding.editors --apply builtins.attrNames
|
|
```
|
|
|
|
### Conflicts with Existing Config
|
|
|
|
If you have existing configuration:
|
|
|
|
1. Backup current config
|
|
2. Test module with fresh config
|
|
3. Gradually add custom settings
|
|
|
|
## Related
|
|
|
|
- [Using Modules Guide](../../guides/using-modules.md) - How to use modules
|
|
- [Adding Packages](../../guides/adding-packages.md) - How to add new packages
|