-
Notifications
You must be signed in to change notification settings - Fork 13
Configuration
bkmr offers flexible configuration through files, environment variables, and command-line options to customize its behavior and appearance.
bkmr loads configuration in order of precedence (highest priority first):
- Command-line arguments - Highest priority, overrides everything
- Environment variables - System-level configuration
-
Custom config file - Specified with
--config -
Default config file -
~/.config/bkmr/config.toml - Built-in defaults - Lowest priority
This means you can set defaults in config.toml and override them with environment variables or command-line flags as needed.
Default configuration file location:
~/.config/bkmr/config.toml
Create a default configuration file:
# Generate and save default config
bkmr --generate-config > ~/.config/bkmr/config.toml
# View without saving
bkmr --generate-config# Main database path
db_url = "/Users/username/.config/bkmr/bkmr.db"
# FZF fuzzy finder options
[fzf_opts]
height = "50%"
reverse = false
show_tags = false
no_url = false
show_action = true # Show action type indicator in FZF results
show_file_info = true # Show file metadata for imported bookmarks
# Shell script execution options
[shell_opts]
interactive = true # Enable interactive editing before execution
# Embedding model for semantic search (fully local, no API keys)
[embeddings]
model = "NomicEmbedTextV15" # 768 dims, good default
# Other options: AllMiniLML6V2 (384), BGESmallENV15 (384), BGEM3 (1024)
# Base paths for portable file imports
[base_paths]
SCRIPTS_HOME = "$HOME/scripts"
DOCS_HOME = "$HOME/documents"
WORK_SCRIPTS = "/work/automation/scripts"
PROJECT_NOTES = "$HOME/projects/documentation"
DOTFILES = "$HOME/.config"Specify a different config file:
# Use custom config for this command
bkmr --config ~/work/bkmr-config.toml search python
# Use custom config with alias
alias work-bkmr='bkmr --config ~/work/bkmr-config.toml'
work-bkmr search project| Variable | Description | Default | Example |
|---|---|---|---|
BKMR_DB_URL |
Path to SQLite database | ~/.config/bkmr/bkmr.db |
~/Dropbox/bkmr.db |
BKMR_SHELL_INTERACTIVE |
Interactive shell editing | true |
false |
FASTEMBED_CACHE_DIR |
Embedding model cache directory | ~/.cache/bkmr/models/ |
~/models/ |
EDITOR |
Text editor for editing | vim |
code -w |
BKMR_FZF_OPTS |
FZF options | See below | --height 80% |
Note: Per-bookmark custom openers (set via --open-with) override system defaults when opening URLs and local files. See Content Types - Custom Openers for details.
Add to your shell profile (~/.bashrc, ~/.zshrc, ~/.bash_profile):
# Database location
export BKMR_DB_URL="$HOME/.local/share/bkmr/bookmarks.db"
# Editor (VS Code with wait flag)
export EDITOR="code -w"
# Embedding model cache (optional, default: ~/.cache/bkmr/models/)
export FASTEMBED_CACHE_DIR="$HOME/.cache/bkmr/models/"
# Shell execution (disable interactive mode)
export BKMR_SHELL_INTERACTIVE="false"
# FZF options
export BKMR_FZF_OPTS="--height 80% --reverse --show-tags"The fuzzy finder interface can be customized via BKMR_FZF_OPTS environment variable or in config.toml.
| Option | Description | Default |
|---|---|---|
height |
FZF window height | 50% |
reverse |
Display results in reverse order | false |
show_tags |
Show tags in results | false |
no_url |
Hide URLs in results | false |
show_action |
Show action type indicator | true |
show_file_info |
Show file metadata for imports | true |
In config.toml:
[fzf_opts]
height = "80%"
reverse = true
show_tags = true
show_file_info = trueAs environment variable:
# Single string with all options
export BKMR_FZF_OPTS="--height 80% --reverse --show-tags"
# Hide file metadata
export BKMR_FZF_OPTS="--no-file-info"
# Tall window with tags
export BKMR_FZF_OPTS="--height 90% --show-tags"These shortcuts work in bkmr search --fzf mode:
| Key | Action |
|---|---|
Enter |
Execute default action (open, copy, run script) |
Ctrl-O |
Copy URL/content to clipboard (shell scripts: copy bkmr open command) |
Ctrl-E |
Edit bookmark (smart editing) |
Ctrl-D |
Delete bookmark |
Ctrl-A |
Clone bookmark |
Ctrl-P |
Show bookmark details |
Esc |
Quit fuzzy finder |
# Classic style (basic display)
bkmr search --fzf
# Enhanced style (full color)
bkmr search --fzf --fzf-style enhancedEnhanced style provides:
- Green titles
- Yellow URLs
- Magenta tags
- Cyan actions
- Grey file info (for imported bookmarks)
Control how shell scripts (_shell_ type) execute.
Behavior: Present an interactive editor before execution
[shell_opts]
interactive = trueFeatures:
- Edit script before running
- Add/modify parameters
- Vim or Emacs bindings (auto-detected)
- Command history saved to
~/.config/bkmr/shell_history.txt
Example:
bkmr open 123
# Opens editor with:
Execute: ./deploy.sh
# You edit to: ./deploy.sh --env staging --dry-run
# Press Enter to executeBehavior: Execute immediately without editing
[shell_opts]
interactive = false# Or via environment variable
export BKMR_SHELL_INTERACTIVE=false
# Now scripts execute directly
bkmr open 123 # Runs immediatelyOverride global setting for specific executions:
# Force direct execution (skip editor)
bkmr open --no-edit 123
# Direct execution with arguments
bkmr open --no-edit 123 -- --env production --verboseInteractive mode automatically detects your preferred bindings:
Detection sources:
-
$ZSH_VI_MODEenvironment variable (zsh vi mode) -
.inputrcfile for readline settings -
set -o vi/set -o emacsin bash - Defaults to emacs bindings
Base paths make file imports portable across machines.
[base_paths]
SCRIPTS_HOME = "$HOME/scripts"
DOCS_HOME = "$HOME/documents"
WORK_SCRIPTS = "/work/automation"
PROJECT_HOME = "$HOME/dev/projects"Base paths support environment variables:
| Variable | Expands To |
|---|---|
$HOME |
User home directory |
$USER |
Current username |
$PWD |
Current working directory |
| Custom | Any environment variable |
Example:
SCRIPTS_HOME = "$HOME/scripts" # → /home/user/scripts
USER_SCRIPTS = "/home/$USER/scripts" # → /home/user/scripts
WORK_DIR = "$PWD/work" # → /current/dir/work# Import with base path
bkmr import-files backup.sh --base-path SCRIPTS_HOME
# Stored as: $SCRIPTS_HOME/backup.sh (portable!)
# Not as: /home/user/scripts/backup.sh (machine-specific)See Content Types — File Import for complete documentation.
Available for all commands:
| Option | Short | Description |
|---|---|---|
--debug |
-d |
Enable debug output (use multiple times: -d -d) |
--config FILE |
-c |
Use custom config file |
--generate-config |
Output default configuration | |
--no-color |
Disable colored output | |
--help |
-h |
Show help |
--version |
-V |
Show version |
Debug levels:
bkmr -d search python # Basic debug info (info level)
bkmr -d -d search python # Verbose debug info (debug level)
bkmr -d -d -d search python # Maximum verbosity (trace level)Colored output:
Colored output is enabled automatically when writing to an interactive terminal and disabled automatically when output is piped or redirected, so there is no separate "reduced color" mode. To force colors off even on a terminal, use either of:
bkmr search --no-color # flag (accepted in any position, e.g. `bkmr --no-color search`)
NO_COLOR=1 bkmr search # NO_COLOR convention (https://no-color.org/)There is currently no config-file setting for color; the flag and the
NO_COLOR environment variable are the only controls.
| Option | Short | Description | Example |
|---|---|---|---|
--tags |
-t |
Must have ALL these tags (AND) | -t python,web |
--Tags |
-T |
Exclude if has ALL these tags | -T old,archived |
--ntags |
-n |
Must have ANY of these tags (OR) | -n python,rust |
--Ntags |
-N |
Exclude if has ANY of these tags | -N deprecated,old |
--limit |
-l |
Limit results | -l 10 |
--descending |
-o |
Sort descending (implies --sort modified if no --sort) |
|
--ascending |
-O |
Sort ascending (implies --sort modified if no --sort) |
|
--sort |
Sort field: id, title, modified (default: id) |
--sort title |
|
--fzf |
Fuzzy finder interface | ||
--json |
JSON output | ||
--np |
No-print (IDs only) |
$HOME/.config/bkmr/bkmr.db
Via environment variable:
export BKMR_DB_URL="$HOME/Dropbox/bkmr.db"Via config file:
db_url = "/Users/username/Dropbox/bkmr.db"# Create at default location
bkmr create-db ~/.config/bkmr/bkmr.db
# Create at custom location
bkmr create-db ~/Dropbox/bkmr.db
# Then set environment variable
export BKMR_DB_URL=~/Dropbox/bkmr.dbWhen upgrading bkmr, migrations run automatically:
- Check if migrations needed
-
Create backup with date suffix (e.g.,
bkmr_backup_20250412.db) - Apply migrations
- Verify success
Backups saved in same directory as database.
Default directory structure:
$HOME/.config/bkmr/
├── config.toml # Configuration file
├── bkmr.db # Main database
├── bkmr_backup_*.db # Automatic backups
└── shell_history.txt # Shell command history
Fallback locations (if HOME unavailable):
- Platform-specific data directory
- Current directory with
.bkmr/subfolder
Add to your shell profile for quick access:
# Quick fuzzy search
alias b='bkmr search --fzf'
# Quick add
alias ba='bkmr add'
# Search snippets only
alias bs='bkmr search --fzf -t _snip_'
# Search shell scripts
alias bsh='bkmr search --fzf -t _shell_'
# Search markdown docs
alias bd='bkmr search --fzf -t _md_'
# Quick open first result
bko() {
local id=$(bkmr search "$@" --np | head -1)
[[ -n "$id" ]] && bkmr open "$id"
}Optimize FZF for tmux:
# Add to ~/.tmux.conf or shell profile
export BKMR_FZF_OPTS="--height 80% --reverse --preview-window=right:60%"Use different databases for different contexts:
# Work database
alias work-bkmr='BKMR_DB_URL=~/work/bkmr.db bkmr'
# Personal database
alias personal-bkmr='BKMR_DB_URL=~/personal/bkmr.db bkmr'
# Project-specific
alias project-bkmr='BKMR_DB_URL=./project-bkmr.db bkmr'Sync database across devices using:
Git (recommended):
# On machine 1
cd ~/.config/bkmr
git init
git add bkmr.db config.toml
git commit -m "Initial bkmr database"
git push origin main
# On machine 2
git clone <repo> ~/.config/bkmr
export BKMR_DB_URL=~/.config/bkmr/bkmr.dbCloud storage:
# Dropbox
export BKMR_DB_URL="$HOME/Dropbox/bkmr/bkmr.db"
# Google Drive
export BKMR_DB_URL="$HOME/Google Drive/bkmr/bkmr.db"
# iCloud (macOS)
export BKMR_DB_URL="$HOME/Library/Mobile Documents/com~apple~CloudDocs/bkmr/bkmr.db"Syncthing:
# Set up Syncthing folder
export BKMR_DB_URL="$HOME/Sync/bkmr/bkmr.db"1. Start with defaults:
bkmr --generate-config > ~/.config/bkmr/config.toml
# Edit only what you need2. Use environment variables for machine-specific settings:
# In ~/.bashrc (different on each machine)
export BKMR_DB_URL="$HOME/sync/bkmr.db" # Different sync location per machine3. Use config file for shared settings:
# Same config file synced across machines
[fzf_opts]
height = "80%"
show_tags = true
[shell_opts]
interactive = true4. Create context-specific aliases:
# Different contexts with different databases
alias work='BKMR_DB_URL=~/work/bkmr.db bkmr'
alias home='BKMR_DB_URL=~/personal/bkmr.db bkmr'5. Backup configuration:
# Backup config along with database
cp ~/.config/bkmr/config.toml ~/.config/bkmr/config.toml.backupConfig file not loaded:
# Check location
ls -la ~/.config/bkmr/config.toml
# Verify syntax
bkmr --generate-config > /tmp/test.toml
# Compare with your configEnvironment variables not working:
# Verify they're set
echo $BKMR_DB_URL
echo $BKMR_FZF_OPTS
# Check if they're exported
export | grep BKMRDatabase not found:
# Check path
ls -la "$BKMR_DB_URL"
# Create if missing
bkmr create-db "$BKMR_DB_URL"- Getting Started — Initial setup
- Basic Usage — Common commands
- Content Types — Base paths, shell scripts, file import
- Troubleshooting — Common configuration issues
bkmr