Add database tools and improve tmux copy mode

Database Tools:
- Add lazysql: LazyGit-style TUI database management tool
- Add sqlite3: Official SQLite CLI for scripting and automation
- Comprehensive usage documentation for both tools
- Support for MySQL, PostgreSQL, and SQLite databases

Tmux Improvements:
- Fix copy mode to not exit after copying (copy-pipe vs copy-pipe-and-cancel)
- Allows multiple text selections without re-entering copy mode
- Manual exit control with q/Escape/Ctrl+c

System Optimizations:
- Add trusted binary caches for faster Nix builds
- Include nix-community and devenv cachix for improved performance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yan Lin 2025-07-27 17:17:03 +02:00
parent c66c5ed416
commit c3872475b5
3 changed files with 85 additions and 1 deletions

View file

@ -212,6 +212,8 @@ Launch with `gitui` in any git repository for:
- **bat**: Syntax-highlighted cat replacement - **bat**: Syntax-highlighted cat replacement
- **btop**: Modern system monitor - **btop**: Modern system monitor
- **httpie**: Modern HTTP client for API testing - **httpie**: Modern HTTP client for API testing
- **lazysql**: LazyGit-style TUI database management tool
- **sqlite3**: Official SQLite command-line interface
- **lftp**: Scriptable FTP client for automation - **lftp**: Scriptable FTP client for automation
- **termscp**: Comprehensive TUI file transfer client (FTP/SFTP/SCP/S3) - **termscp**: Comprehensive TUI file transfer client (FTP/SFTP/SCP/S3)
- **zoxide**: Smart cd with frecency algorithm - **zoxide**: Smart cd with frecency algorithm
@ -258,6 +260,76 @@ http GET api.example.com/protected Authorization:"Bearer your-token"
http GET api.example.com/api X-API-Key:"your-api-key" http GET api.example.com/api X-API-Key:"your-api-key"
``` ```
#### lazysql Usage Examples
```bash
# Launch TUI database management (LazyGit-style interface)
lazysql
# Connect to different databases
lazysql -h localhost -u username -p password -d database_name # MySQL
lazysql --url postgres://user:pass@localhost/dbname # PostgreSQL
lazysql --url sqlite://./database.db # SQLite
lazysql --url "mysql://user:pass@localhost/db" # MySQL URL format
# With config file (recommended for credentials)
lazysql --config ~/.config/lazysql/config.yml
# Interactive TUI operations:
# - Navigate tables with j/k (vim-style)
# - View table structure and data
# - Execute SQL queries in editor mode
# - Export query results
# - Browse database schema
```
**Key lazysql features:**
- **LazyGit-inspired interface**: Familiar navigation for developers
- **Multi-database support**: MySQL, PostgreSQL, SQLite
- **SQL editor**: Syntax highlighting and query execution
- **Export capabilities**: Save query results to files
- **Connection management**: Save and reuse database connections
#### sqlite3 Usage Examples
```bash
# Connect to SQLite database
sqlite3 ai.db
# One-liner queries (no interactive session)
sqlite3 ai.db "SELECT COUNT(*) FROM users;"
sqlite3 ai.db "SELECT * FROM users WHERE active = 1;"
# Common SQLite dot commands (inside sqlite3 shell)
.tables # List all tables
.schema # Show all table schemas
.schema users # Show specific table schema
.mode csv # Set output format (csv, json, html, etc.)
.headers on # Show column headers
.output results.csv # Redirect output to file
.output stdout # Reset output to terminal
# Import/Export operations
.backup backup.db # Create database backup
.restore backup.db # Restore from backup
.dump # Export entire database as SQL
.dump users # Export specific table as SQL
# Execute SQL script file
.read script.sql # Run SQL commands from file
sqlite3 ai.db < script.sql # Alternative: pipe script to sqlite3
# Database inspection
.dbinfo # Show database information
.indices table_name # Show indexes for table
.exit # Exit sqlite3 shell
```
**Key sqlite3 features:**
- **Universal compatibility**: Works with any SQLite database
- **Scriptable**: Perfect for automation and batch operations
- **Lightweight**: Minimal overhead for quick queries
- **Import/Export**: Built-in CSV, JSON, and SQL dump capabilities
- **Backup tools**: Simple database backup and restore operations
#### termscp Usage Examples #### termscp Usage Examples
```bash ```bash
# Launch TUI file transfer client # Launch TUI file transfer client

View file

@ -21,6 +21,16 @@
]; ];
nix.settings.experimental-features = "nix-command flakes"; nix.settings.experimental-features = "nix-command flakes";
nix.settings.substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://devenv.cachix.org"
];
nix.settings.trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
system.stateVersion = 6; system.stateVersion = 6;
nixpkgs.hostPlatform = "aarch64-darwin"; nixpkgs.hostPlatform = "aarch64-darwin";
@ -48,6 +58,8 @@
lftp lftp
termscp termscp
httpie httpie
lazysql
sqlite
claude-code.packages.aarch64-darwin.claude-code claude-code.packages.aarch64-darwin.claude-code
nerd-fonts.fira-code nerd-fonts.fira-code
nerd-fonts.jetbrains-mono nerd-fonts.jetbrains-mono

View file

@ -70,7 +70,7 @@
# Better copy mode # Better copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" bind-key -T copy-mode-vi y send-keys -X copy-pipe "pbcopy"
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# New window with current path # New window with current path