diff --git a/docs/config.md b/docs/config.md index 5ae7634..0529c95 100644 --- a/docs/config.md +++ b/docs/config.md @@ -169,6 +169,12 @@ Make sure to quote those when using wildcards in the config file. Patterns used on a specific dotfile can be specified relative to the dotfile destination (`dst`). +Similar to a `.gitignore` file, you can prefix ignore patterns with an exclamation point (`!`). +This so-called "negative ignore pattern" will cause any files that match that pattern to __not__ be ignored, +provided they *would have* been ignored by an earlier ignore pattern (dotdrop will warn if that is not the +case). This feature allows you to, for example, ignore all files within a certain directory, except for one +particular one (see example below). + ```yaml config: cmpignore: @@ -216,3 +222,14 @@ config: - "testdir" ... ``` + +To ignore all files within a certain directory relative to `dst`, except one called `custom_plugin.zsh`: +```yaml +dotfiles: + d_zsh: + src: zsh + dst: ~/.config/zsh + impignore: + - "plugins/*" + - "!plugins/custom_plugin.zsh" +``` diff --git a/tests-ng/negative-ignore-no-match.sh b/tests-ng/negative-ignore-no-match.sh index 74e3cd5..7b2023a 100755 --- a/tests-ng/negative-ignore-no-match.sh +++ b/tests-ng/negative-ignore-no-match.sh @@ -104,7 +104,8 @@ rm -rf ${tmpd} echo "[+] install with negative ignore in dotfile" echo '(1) expect dotdrop install to warn when negative ignore pattern does not match an already-ignored file' -patt="[WARN] no files that are currently being ignored match \"*/ignore_me/c\". In order for a negative ignore pattern to work, it must match a file that is being ignored by a previous ignore pattern." +patt="[WARN] no files that are currently being ignored match \"*/ignore_me/c\". In order for a negative ignore +pattern to work, it must match a file that is being ignored by a previous ignore pattern." cd ${ddpath} | ${bin} install -c ${cfg2} --verbose 2>&1 >/dev/null | grep -F "${patt}" || (echo "dotdrop did not warn when negative ignore pattern did not match an already-ignored file" && exit 1)