mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
docs: add examples for editing non-code files with aider
This commit is contained in:
parent
06fa0c17a4
commit
29a2db6552
1 changed files with 177 additions and 0 deletions
|
@ -0,0 +1,177 @@
|
||||||
|
# Editing Configuration and Text Files
|
||||||
|
|
||||||
|
Aider isn't just for code! Here are practical examples of modifying common config/text files:
|
||||||
|
|
||||||
|
## Shell Configuration
|
||||||
|
```bash
|
||||||
|
$ aider .bashrc
|
||||||
|
|
||||||
|
Added .bashrc to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
.bashrc
|
||||||
|
> Add an alias 'll' that runs 'ls -alh' and update PATH to include ~/.local/bin
|
||||||
|
|
||||||
|
+ alias ll='ls -alh'
|
||||||
|
+ export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
## SSH Configurations
|
||||||
|
```bash
|
||||||
|
$ aider ~/.ssh/config
|
||||||
|
|
||||||
|
Added config to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
config
|
||||||
|
> Create a Host entry 'my-server' using bastion.example.com as JumpHost
|
||||||
|
|
||||||
|
+ Host my-server
|
||||||
|
+ HostName 192.168.1.100
|
||||||
|
+ User deploy
|
||||||
|
+ Port 2222
|
||||||
|
+ IdentityFile ~/.ssh/deploy_key
|
||||||
|
+ ProxyJump bastion.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker Setup
|
||||||
|
```bash
|
||||||
|
$ aider Dockerfile docker-compose.yml
|
||||||
|
|
||||||
|
Added Dockerfile and docker-compose.yml to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
Dockerfile
|
||||||
|
> Set non-root user and enable healthchecks
|
||||||
|
|
||||||
|
+ USER appuser
|
||||||
|
+ HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
|
+ CMD curl -f http://localhost:8000/health || exit 1
|
||||||
|
|
||||||
|
docker-compose.yml
|
||||||
|
> Expose port 5432 and add volume for postgres data
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
+ ports:
|
||||||
|
+ - "5432:5432"
|
||||||
|
+ volumes:
|
||||||
|
+ - pgdata:/var/lib/postgresql/data
|
||||||
|
```
|
||||||
|
|
||||||
|
## Git Configuration
|
||||||
|
```bash
|
||||||
|
$ aider .gitconfig
|
||||||
|
|
||||||
|
Added .gitconfig to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
.gitconfig
|
||||||
|
> Set default push behavior to current branch and enable color UI
|
||||||
|
|
||||||
|
+ [push]
|
||||||
|
+ default = current
|
||||||
|
+ [color]
|
||||||
|
+ ui = auto
|
||||||
|
```
|
||||||
|
|
||||||
|
## System Configuration
|
||||||
|
```bash
|
||||||
|
$ aider /etc/hosts # May need sudo
|
||||||
|
|
||||||
|
Added hosts to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
hosts
|
||||||
|
> Block tracking domains by pointing them to 127.0.0.1
|
||||||
|
|
||||||
|
+ 127.0.0.1 ads.example.com
|
||||||
|
+ 127.0.0.1 track.analytics.co
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cron Jobs
|
||||||
|
```bash
|
||||||
|
$ aider mycron
|
||||||
|
|
||||||
|
Added mycron to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
mycron
|
||||||
|
> Add daily backup at 2am and weekly log rotation
|
||||||
|
|
||||||
|
+ 0 2 * * * /usr/local/bin/backup --incremental
|
||||||
|
+ 0 3 * * 6 /usr/sbin/logrotate /etc/logrotate.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
## Editor Configs
|
||||||
|
```bash
|
||||||
|
$ aider .vimrc
|
||||||
|
|
||||||
|
Added .vimrc to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
.vimrc
|
||||||
|
> Enable line numbers and set 4-space tabs for Python
|
||||||
|
|
||||||
|
+ set number
|
||||||
|
+ autocmd FileType python set tabstop=4 shiftwidth=4 expandtab
|
||||||
|
```
|
||||||
|
|
||||||
|
## Application Configuration
|
||||||
|
```bash
|
||||||
|
$ aider settings.json
|
||||||
|
|
||||||
|
Added settings.json to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
settings.json (VSCode)
|
||||||
|
> Enable auto-format on save and set default formatter
|
||||||
|
|
||||||
|
+ "editor.formatOnSave": true,
|
||||||
|
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Files
|
||||||
|
```bash
|
||||||
|
$ aider .env
|
||||||
|
|
||||||
|
Added .env to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
.env
|
||||||
|
> Configure database connection with SSL
|
||||||
|
|
||||||
|
+ DB_HOST=db.example.com
|
||||||
|
+ DB_PORT=5432
|
||||||
|
+ DB_SSL=true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Markdown Documentation
|
||||||
|
```bash
|
||||||
|
$ aider README.md
|
||||||
|
|
||||||
|
Added README.md to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
README.md
|
||||||
|
> Add installation section with brew and pip options
|
||||||
|
|
||||||
|
+ ## Installation
|
||||||
|
+ ```bash
|
||||||
|
+ # Homebrew
|
||||||
|
+ brew install aider
|
||||||
|
+
|
||||||
|
+ # PyPI
|
||||||
|
+ pipx install aider-chat
|
||||||
|
+ ```
|
||||||
|
```
|
||||||
|
|
||||||
|
## XML Configuration
|
||||||
|
```bash
|
||||||
|
$ aider pom.xml
|
||||||
|
|
||||||
|
Added pom.xml to the chat.
|
||||||
|
────────────────────────────────────────────────────────────────
|
||||||
|
pom.xml
|
||||||
|
> Add JUnit 5 dependency with test scope
|
||||||
|
|
||||||
|
+ <dependency>
|
||||||
|
+ <groupId>org.junit.jupiter</groupId>
|
||||||
|
+ <artifactId>junit-jupiter-api</artifactId>
|
||||||
|
+ <version>5.9.2</version>
|
||||||
|
+ <scope>test</scope>
|
||||||
|
+ </dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**: Aider works with any text-based format. For system files requiring elevated privileges, use `sudo aider` as needed.
|
Loading…
Add table
Add a link
Reference in a new issue