ins resolvething
ins resolvething helps clean up directories that are synced with Syncthing. It has two jobs:
- find duplicate files and move the redundant copies to trash
- find Syncthing conflict files and open them next to the original file in a diff editor
It is designed for folders where Syncthing can leave files such as note.sync-conflict-20240101-ABC.md or redundant copies in .stversions.
Quick start
Open the interactive menu:
ins resolvething menuRun both cleanup steps for every configured scan directory:
ins resolvething allPreview what would happen before changing files:
ins resolvething all --dry-runRun against one directory without changing the saved configuration:
ins resolvething all --dir ~/wiki/vimwiki --dry-runScan directories
resolvething reads its configuration from:
~/.config/instant/resolvething.tomlThe default configuration scans ~/wiki/vimwiki and treats md and json files as mergeable conflict files.
Use the menu to add or edit scan directories:
ins resolvething menuOr inspect and edit the config directly:
ins resolvething config show
ins resolvething config editExample config:
scan_dirs = [
{ path = "~/wiki/vimwiki", extensions = ["md", "json"] },
{ path = "~/Documents/notes", extensions = ["txt", "md"] },
]
# Optional. Defaults to $EDITOR, then nvim.
editor_command = "nvim"extensions controls conflict-file handling. Use an empty list to scan all plain text files in that scan directory.
Duplicate cleanup
ins resolvething duplicates
ins resolvething duplicates --dry-run
ins resolvething duplicates --dir ~/wiki/vimwikiThis command uses fclones to group identical files. Redundant files are moved to trash, not permanently deleted.
Some groups can be resolved automatically:
- conflict-file duplicates keep a non-conflict file when one exists, otherwise the newest conflict file
- duplicate files inside
.stversionskeep the newest version snapshot - groups with one regular file and matching
.origor.tmpcopies keep the regular file - groups made only of
.tmpfiles keep one copy
Ambiguous groups open an interactive picker where you choose which file to keep. Use --no-auto to force interactive selection even for groups that are normally safe to resolve automatically.
Use --show-ignored to list duplicate groups that were deliberately skipped, such as normal live-file plus .stversions snapshot pairs.
Syncthing conflict cleanup
ins resolvething conflicts
ins resolvething conflicts --dry-run
ins resolvething conflicts --dir ~/wiki/vimwikiThis command looks for Syncthing conflict filenames, reconstructs the original path, and opens both files in a diff editor. After the editor exits, resolvething compares the two files:
- if the original and conflict file now match, the conflict file is moved to trash
- if they still differ, the conflict is left in place
- missing, binary, or very large files are skipped
By default the diff editor is $EDITOR -d, falling back to nvim -d. Set editor_command in the config if you want a different editor command.
Menu
ins resolvething menu
ins resolvething menu --guiThe menu shows every configured scan directory with current duplicate and conflict counts. From there you can:
- resolve everything for one directory
- resolve only duplicates or only conflicts
- open the directory
- edit the conflict extensions
- change or remove the scan directory
- add another scan directory
--gui opens the menu in a GUI terminal window.
Command reference
ins resolvething duplicates [--dir <path>] [--no-auto] [--show-ignored] [--dry-run]
ins resolvething conflicts [--dir <path>] [--dry-run]
ins resolvething all [--dir <path>] [--no-auto] [--show-ignored] [--dry-run]
ins resolvething menu [--gui]
ins resolvething config show
ins resolvething config editDependencies
Duplicate cleanup requires fclones. The interactive flows use fzf. If a dependency is missing, ins will try to install it through the supported package managers.
Files are moved to trash using trash, gio trash, or a fallback trash directory under the user data directory.