when will the condition set for a plugin be fired? #534
-
I am using the following config to load vim-fugitive conditionaly: 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} It only works when I first open nvim, i.e., fugitive will be loaded if the directory is a Git directory, otherwise fugitive will not be loaded. It seems that the |
Beta Was this translation helpful? Give feedback.
Answered by
wbthomason
Aug 6, 2021
Replies: 1 comment 4 replies
-
Ah - yes, |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
jdhao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah - yes,
cond
is only run when the compiled file is sourced (so, when you enter Neovim). The easiest way to do what you want is to load on theDirChanged
event using theevent
key.