Open AlejandroSuero opened 3 weeks ago
@AlejandroSuero sorry I was a bit busy. Just tried the changes here, for some reason it doesn't work for me.
Here is my how I'm testing it
{
'https://github.com/AlejandroSuero/supermaven-nvim',
branch = 'feature/conditional-running',
config = function()
require('supermaven-nvim').setup {
keymaps = {
accept_suggestion = '<C-g>',
condition = function()
local match = vim.bo.filetype == 'starter'
or vim.fn.expand ':t:r' == 'init'
return match
end,
},
disable_inline_completion = false, -- disables inline completion for use with cmp
disable_keymaps = false, -- disables built in keymaps for more manual control
}
end,
},
You can here for example that although I have a check for the starter
filetype it still ran (check the supermaven message at the bottom), same happens when opening any init.lua
, the condition should prevent it from running but it's still running
https://github.com/supermaven-inc/supermaven-nvim/assets/63876/7a5de70e-4348-45b6-8b74-77e8226dd0c1
@ahmedelgabri condition
should be outside the keymaps
entry, like:
require("supermaven-nvim").setup({
keymaps = {
- - ...
},
condition = function()
return - - your condition
end,
})
Try it out this way and if something fails, I'll check it out tomorrow, today I don't have the pc around.
What a stupid mistake 🤦♂️ I will try again in the evening. Thanks @AlejandroSuero
@ahmedelgabri no worries, I should have put an example with the other options in the PR description so it doesn't lead to confusion.
@AlejandroSuero works great! 👍🏼
With these changes the user can stop
supermaven
conditionally for example, if the user wants files likebash_private.sh
to not be running but want any other.sh
files to havesupermaven
running it can do it with the following configuration.README.md
with changesFor this demo I used:
https://github.com/supermaven-inc/supermaven-nvim/assets/71392160/a1efb698-8e5b-49a2-af39-d2b5887fc492
Closes #57.