Neovim plugin to automatically adjust git env vars when syncing dotfiles using the "bare git repo" method
1# Baredot 2 3This is a Neovim plugin to automatically adjust `git` env vars when syncing dotfiles using the "bare git repo" method: 4 5[Dotfiles: Best way to store in a bare git repository](https://www.atlassian.com/git/tutorials/dotfiles) 6 7## Details 8 9When launching and when changing directory (eg. `:cd`), the plugin will detect if the current 10directory is in a git repo by searching for a `.git` folder. 11 12- If a `.git` folder is found, the env vars are cleared and `git` will work as normal. 13- If a `.git` folder is not found, and we are in `$HOME`, the env vars will be adjusted to use the 14bare git repo. This will let other git plugins function using that repo. 15 16## Setup 17 18lazy.nvim 19```lua 20{ 21 "ejrichards/baredot.nvim", 22 opts = { 23 git_dir = "~/.cfg" -- Change this path 24 } 25} 26``` 27 28## Configuration 29 30```lua 31{ 32 -- These two options set the GIT_DIR and GIT_WORK_TREE env vars 33 -- They are expanded using "vim.fn.expand" 34 git_dir = "~/.cfg", 35 git_work_tree = "~", 36 -- Filename pattern to find that will disable Baredot 37 disable_pattern = "%.git" 38} 39``` 40 41## Commands 42 43- `:Baredot info` - Print current status 44- `:Baredot toggle` - Manually toggle the env vars on / off 45 46## Functions 47 48- `require("baredot").info()` - Print current status 49- `require("baredot").is_enabled()` - Returns current status as boolean 50- `require("baredot").toggle()` - Manually toggle the env vars on / off 51- `require("baredot").set(boolean)` - Set the env vars on / off