Sync gitignore-style configuration

Use case or problem

I am putting code in my vault - mostly python and Latex. Even though obsidian do not directly support these kinds of files I want to keep them together, so that I can link from markdown to specific python and latex files (and the other way around).

I want to sync the code as well as the .md files, but there is not enough options in the sync settings to be able to sync correctly. One either cannot sync code, or must also sync files which should not be synced.

Proposed solution

Add support for .gitignore files.

When a .gitignore file is found in some folder, any files further down in that folder will be ignored according to the rules in the .gitignore file.

Current workaround (optional)

Currently I simply sync all files, but that unfortunately includes a lot of build-files and other files which should not be synced.

Obsidian sync has an internal mechanism for excluding folders. .
You could make your scripts output in specific directories and exclude them.

Good solution for many such files, thank you!

Python folder: “cache” can be excluded, as well as “venv”

Some cases are not solved by this though:

  • many such folders would require a lot of manual work to add - would be nice to ignore all folders that include some name, for instance exclude cache or venv
  • latex (by default) generates files in the root folder where it is built, I will look into generating the files into a specific folder.