nvim-spider
nvim-spider copied to clipboard
Feature Request: Integration with precognition.nvim
Feature Requested
Some users want to integrate both plugin behaviors, so I made some modifications in https://github.com/tris203/precognition.nvim/pull/103.
Proposal
I propose automatically integrate when nvim-spider detects precognition is being used. Also let the user opt-out of this feature. The user configuration would like this:
{
"tris203/precognition.nvim",
dependencies = {
"chrisgrieser/nvim-spider",
},
},
And to opt-out the feature:
{
"chrisgrieser/nvim-spider",
opts = {
precognitionIntegrationEnabled = false -- in case of opt-out
}
},
{
"tris203/precognition.nvim",
dependencies = {
"chrisgrieser/nvim-spider",
},
},
Current integration configuration
Currently there is a way to integrate from the user config:
{
"tris203/precognition.nvim",
dependencies = {
"chrisgrieser/nvim-spider",
},
config = function()
local vanilla_motions = require("precognition.motions.vanilla_motions")
local spider = require("spider.motion-logic")
local globalOpts = require("spider.config").globalOpts
require("precognition.motions").register_motions({
next_word_boundary = function(str, cursorcol, linelen, big_word)
if big_word then
return vanilla_motions.next_word_boundary(str, cursorcol, linelen, big_word)
end
return spider.getNextPosition(str, cursorcol, "w", globalOpts) or 0
end,
end_of_word = function(str, cursorcol, linelen, big_word)
if big_word then
return vanilla_motions.end_of_word(str, cursorcol, linelen, big_word)
end
return spider.getNextPosition(str, cursorcol, "e", globalOpts) or 0
end,
prev_word_boundary = function(str, cursorcol, linelen, big_word)
if big_word then
return vanilla_motions.prev_word_boundary(str, cursorcol, linelen, big_word)
end
return spider.getNextPosition(str, cursorcol, "b", globalOpts) or 0
end,
})
end,
},
Relevant Screenshot
nvim-spider ON:
nvim-spider OFF:
Checklist
- [x] The feature would be useful to more users than just me.
That's an interesting idea! I've never used precognition myself, but I can totally see how it could be helpful for new users.
If you're up for it, you can make a PR for that. Let me know if you need any help
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment, for example "bump", and it will be kept open.
This issue has been closed due to inactivity, and will not be monitored.