This commit is contained in:
Paul Gauthier 2025-01-22 15:32:25 -08:00
parent fceead7cbe
commit 05a77c7406

View file

@ -4,6 +4,7 @@ nav_order: 901
description: Use aider to edit configuration files, documentation, and other text-based formats. description: Use aider to edit configuration files, documentation, and other text-based formats.
--- ---
# Editing config & text files # Editing config & text files
Aider isn't just for code, it can be very helpful when editing Aider isn't just for code, it can be very helpful when editing
@ -15,27 +16,31 @@ or pretty much any configuration or documentation file.
Here are some practical examples of modifying common config/text files: Here are some practical examples of modifying common config/text files:
## Shell Configuration ## Shell Configuration
```bash
<div class="chat-transcript" markdown="1">
$ aider .bashrc $ aider .bashrc
Added .bashrc to the chat. Added .bashrc to the chat.
────────────────────────────────────────────────────────────────
.bashrc
> Add an alias 'll' that lists all files, with all details in human readable format. And update PATH to include uv installed tools.
+ alias ll='ls -alh'
+ export PATH="$HOME/.local/bin:$PATH" #### Add an alias 'll' that lists all files, with all details in human readable format. And update PATH to include uv installed tools.
``` ```
+ alias ll='ls -alh'
+ export PATH="$PATH:$HOME/.local/bin:$PATH"
```
</div>
## SSH Configurations ## SSH Configurations
```bash
<div class="chat-transcript" markdown="1">
$ aider ~/.ssh/config $ aider ~/.ssh/config
Added config to the chat. Added config to the chat.
────────────────────────────────────────────────────────────────
config
> Create a Host entry 'my-server' using bastion.example.com as JumpHost
#### Create a Host entry 'my-server' using bastion.example.com as JumpHost
```
+ Host my-server + Host my-server
+ HostName 192.168.1.100 + HostName 192.168.1.100
+ User deploy + User deploy
@ -43,23 +48,26 @@ config
+ IdentityFile ~/.ssh/deploy_key + IdentityFile ~/.ssh/deploy_key
+ ProxyJump bastion.example.com + ProxyJump bastion.example.com
``` ```
</div>
## Docker Setup ## Docker Setup
```bash
<div class="chat-transcript" markdown="1">
$ aider Dockerfile docker-compose.yml $ aider Dockerfile docker-compose.yml
Added Dockerfile and docker-compose.yml to the chat. Added Dockerfile and docker-compose.yml to the chat.
────────────────────────────────────────────────────────────────
Dockerfile
> Set non-root user and enable healthchecks
#### Set non-root user and enable healthchecks
```
+ USER appuser + USER appuser
+ HEALTHCHECK --interval=30s --timeout=3s \ + HEALTHCHECK --interval=30s --timeout=3s \
+ CMD curl -f http://localhost:8000/health || exit 1 + CMD curl -f http://localhost:8000/health || exit 1
```
docker-compose.yml #### Expose port 5432 and add volume for postgres data
> Expose port 5432 and add volume for postgres data
```
services: services:
postgres: postgres:
image: postgres:15 image: postgres:15
@ -68,87 +76,80 @@ docker-compose.yml
+ volumes: + volumes:
+ - pgdata:/var/lib/postgresql/data + - pgdata:/var/lib/postgresql/data
``` ```
</div>
## Git Configuration ## Git Configuration
```bash
<div class="chat-transcript" markdown="1">
$ aider .gitconfig $ aider .gitconfig
Added .gitconfig to the chat. Added .gitconfig to the chat.
────────────────────────────────────────────────────────────────
.gitconfig
> Set default push behavior to current branch and enable color UI
#### Set default push behavior to current branch and enable color UI
```
+ [push] + [push]
+ default = current + default = current
+ [color] + [color]
+ ui = auto + ui = auto
``` ```
</div>
## System Configuration ## System Configuration
```bash <div class="chat-transcript" markdown="1">
$ aider /etc/hosts # May need sudo $ aider /etc/hosts # May need sudo
Added hosts to the chat. Added hosts to the chat.
────────────────────────────────────────────────────────────────
hosts
> Block tracking domains by pointing them to 127.0.0.1
#### Block tracking domains by pointing them to 127.0.0.1
```
+ 127.0.0.1 ads.example.com + 127.0.0.1 ads.example.com
+ 127.0.0.1 track.analytics.co + 127.0.0.1 track.analytics.co
``` ```
</div>
## Editor Configs ## Editor Configs
```bash <div class="chat-transcript" markdown="1">
$ aider .vimrc $ aider .vimrc
Added .vimrc to the chat. Added .vimrc to the chat.
────────────────────────────────────────────────────────────────
.vimrc
> Enable line numbers and set 4-space tabs for Python
#### Enable line numbers and set 4-space tabs for Python
```
+ set number + set number
+ autocmd FileType python set tabstop=4 shiftwidth=4 expandtab + autocmd FileType python set tabstop=4 shiftwidth=4 expandtab
``` ```
</div>
## Application Configuration ## VSCode Configuration
```bash <div class="chat-transcript" markdown="1">
$ aider settings.json $ aider settings.json
Added settings.json to the chat. Added settings.json to the chat.
────────────────────────────────────────────────────────────────
settings.json (VSCode)
> Enable auto-format on save and set default formatter
#### Enable auto-format on save and set default formatter
```
+ "editor.formatOnSave": true, + "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode"
``` ```
</div>
## 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 ## Markdown Documentation
```bash <div class="chat-transcript" markdown="1">
$ aider README.md $ aider README.md
Added README.md to the chat. Added README.md to the chat.
────────────────────────────────────────────────────────────────
README.md
> Add installation section with brew and pip options
#### Add installation section with brew and pip options
```
+ ## Installation + ## Installation
+ ```bash + ```
+ # Homebrew + # Homebrew
+ brew install cool-app-10k + brew install cool-app-10k
+ +
@ -156,16 +157,16 @@ README.md
+ pipx install cool-app-10k + pipx install cool-app-10k
+ ``` + ```
``` ```
</div>
## XML Configuration ## XML Configuration
```bash <div class="chat-transcript" markdown="1">
$ aider pom.xml $ aider pom.xml
Added pom.xml to the chat. Added pom.xml to the chat.
──────────────────────────────────────────────────────────────── #### Add JUnit 5 dependency with test scope
pom.xml
> Add JUnit 5 dependency with test scope
```
+ <dependency> + <dependency>
+ <groupId>org.junit.jupiter</groupId> + <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId> + <artifactId>junit-jupiter-api</artifactId>
@ -173,5 +174,6 @@ pom.xml
+ <scope>test</scope> + <scope>test</scope>
+ </dependency> + </dependency>
``` ```
</div>