diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-07 13:21:20 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-05-07 13:21:20 +0200 |
| commit | 6ee72d2a6a08ce30fb78493657b614b792e6a838 (patch) | |
| tree | f164960adf5325fdbfb634d88e9d5fe8f0264b17 /plugin | |
| parent | 34510ebc63ff65d51f6979a86169bfc52de6180c (diff) | |
| download | nvim-config-6ee72d2a6a08ce30fb78493657b614b792e6a838.tar.gz nvim-config-6ee72d2a6a08ce30fb78493657b614b792e6a838.zip | |
fix(nvim): `Dotfiles*` commands check if gitgutter is loaded
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/50-dotfiles.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugin/50-dotfiles.lua b/plugin/50-dotfiles.lua index 122912c..fc48014 100644 --- a/plugin/50-dotfiles.lua +++ b/plugin/50-dotfiles.lua @@ -28,9 +28,22 @@ vim.api.nvim_create_autocmd("BufEnter", { end, }) +local function check_gitgutter() + if vim.g.gitgutter_enabled == 1 then + return true + end + vim.notify("GitGutter is not enabled!", vim.log.levels.WARN) + return false +end + vim.api.nvim_create_user_command("DotfilesOn", function() - vim.g.gitgutter_git_args = "--git-dir=" .. vim.env.DOTFILES_DIR .. " --work-tree=" .. vim.env.HOME + if check_gitgutter() then + vim.g.gitgutter_git_args = "--git-dir=" .. vim.env.DOTFILES_DIR .. " --work-tree=" .. vim.env.HOME + end end, { desc = "Activate dotfiles (set git env)" }) + vim.api.nvim_create_user_command("DotfilesOff", function() - vim.g.gitgutter_git_args = "" + if check_gitgutter() then + vim.g.gitgutter_git_args = "" + end end, { desc = "Deactivate dotfiles (unset git env)" }) |
