diff options
| author | jdhao <jdhao@hotmail.com> | 2021-07-29 23:11:30 +0800 |
|---|---|---|
| committer | jdhao <jdhao@hotmail.com> | 2021-07-29 23:11:30 +0800 |
| commit | 3f0c6650f2ac5746dafdc866261e6cd8aa3cef52 (patch) | |
| tree | 7c0d479877fc6ce6d1a4f95af5bc35e5ce558829 /lua/plugins.lua | |
| parent | c8777db448b7b501d70f492523723d163e63d8bb (diff) | |
Update load condition for vim-fugitive
See https://stackoverflow.com/a/38088814/6064933 for how to check if we
are inside a Git repository.
Diffstat (limited to 'lua/plugins.lua')
| -rw-r--r-- | lua/plugins.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lua/plugins.lua b/lua/plugins.lua index 1f86932..4f9a58a 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -178,7 +178,15 @@ require('packer').startup( -- use 'airblade/vim-gitgutter' -- Git command inside vim - use {'tpope/vim-fugitive', cmd = {'Git', 'Gwrite'}} + use {'tpope/vim-fugitive', cond = + function() + local res = vim.fn.system('git rev-parse --is-inside-work-tree') + if string.find(res, 'true') then + return true + else + return false + end + end} -- Better git log display use {'rbong/vim-flog', require = 'tpope/vim-fugitive', cmd = {'Flog'}} |
