Vi Mongo Configuration Guide
Vi Mongo uses a flexible configuration system that allows you to customize various aspects of the application. This guide will walk you through the different configuration files and how to modify them.
Configuration Files
Vi Mongo uses three main configuration files:
- config.yaml - Main configuration file
- keybindings.json - Custom key mappings
- styles/*.yaml - Theme configuration files
All configuration files are stored in the vi-mongo configuration directory:
- On Unix:
~/.config/vi-mongo/
- On macOS:
~/Library/Application Support/vi-mongo/
- On Windows:
%APPDATA%\vi-mongo\
or the directory specified by the XDG_CONFIG_HOME
environment variable.
Main Configuration
The main configuration file config.yaml
contains the following sections:
General Settings
version
: Configuration file versionshowConnectionPage
: Show connection page on startup (true/false)showWelcomePage
: Show welcome page on startup (true/false)currentConnection
: Name of the default MongoDB connection to use
Log Settings
path
: Path to the log filelevel
: Log level (debug, info, warn, error)prettyPrint
: Format logs for better readability
Editor Settings
command
: Custom command to use for editing documentsenv
: Environment variable to use for editor command (defaults toEDITOR
)
Styles Settings
betterSymbols
: Use improved symbols for UI elements (requires proper font support)currentStyle
: Currently active style file
MongoDB Connections
Each connection has the following properties:
name
: Unique name for the connectionurl
: MongoDB connection string (alternative to host/port)host
: MongoDB server hostnameport
: MongoDB server portdatabase
: Default database to connect tousername
: MongoDB usernamepassword
: MongoDB passwordtimeout
: Connection timeout in secondsoptions
(Optional):authorizedDatabases
: Only show databases the user is authorized to access (more here Mongodb List Databases)authorizedCollections
: Only show collections the user is authorized to accesslimit
: Default document limit per page - this will be set as default for all collections for given connection. To overtwrite this set diffrent limit inQueryOptions
modal.
Keybindings Configuration
Vi Mongo supports extensive keyboard customization via the keybindings.json
file. Each key binding consists of key combinations and descriptions.
Keys can be specified in two ways:
keys
: Key combinations using Tcell naming (likeCtrl+C
,Alt+o
)runes
: Simple character keys (likeq
,E
,?
)
Global Keybindings
Main Navigation Keybindings
Database Keybindings
Content Keybindings
Query Bar Keybindings
Connection Form Keybindings
Connection List Keybindings
Document Peeker Keybindings
History Keybindings
Index Management Keybindings
AI Query Keybindings
Customizing Keybindings:
keys
: An array of key combinations (e.g., "Ctrl+H", "Enter")runes
: An array of single characters (e.g., "?", "a")description
: A brief description of the action
Styling Configuration
Vi Mongo supports theme customization via style files stored in the styles/
directory. You can create and edit these files to customize the appearance of the application.
Global Styles
Content Styles
Document Peeker Styles
Database Tree Styles
Other Notes
Environment Variables
Vi Mongo uses the following environment variables:
- EDITOR: Default editor to use for editing documents (can be overridden in config)
- ENV: When set to "vi-dev", development mode is enabled
- OPENAI_API_KEY: API key for OpenAI services (AI features)
- ANTHROPIC_API_KEY: API key for Anthropic services (Claude AI features)
Known Keybinding Issues
When configuring keybindings, be aware of some potential issues:
- Ctrl+H: This key combination is often interpreted as the Backspace2 (Ctrl+backspace) key in terminal environments, For this given case there is special handling in place to make it work as expected. For others like Ctrl+I there is no special handling in place, so those keybindings won't work as expected.
- Terminal Limitations: Some key combinations might not work as expected due to limitations in certain terminal emulators. If a keybinding doesn't seem to work, try an alternative combination.
If you encounter unexpected behavior with your custom keybindings, consider these potential issues and try alternative key combinations.
Applying Changes
After modifying any configuration file, you need to restart Vi Mongo for the changes to take effect. The application will automatically load the updated configuration on startup.
Resetting to Defaults
If you want to reset your configuration to the default settings, you can delete the configuration files from the ~/.config/vi-mongo
directory. The next time you start Vi Mongo, it will recreate the configuration files with default values.
Troubleshooting
If you encounter any issues after modifying the configuration files, try the following steps:
- Verify that the YAML/JSON syntax is correct in the modified files.
- Check the application logs (default location:
/tmp/vi-mongo.log
) for any error messages. - Reset to default configuration by deleting the configuration files and restarting the application.
If problems persist, please open an issue on the Vi Mongo GitHub repository with details about your configuration and the encountered problem.