Subs command not available until I run a command to change text
agaro1121 opened this issue · 7 comments
For some reason, the "Subs" command won't show up until I run any of the {ga}{...} commands. Is this expected behavior?
my config:
return {
"johmsalas/text-case.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
keys = {
"ga", -- Default invocation prefix
{ "ga.", "<cmd>TextCaseOpenTelescope<CR>", desc = "Teslescope", mode = {"n", "v"} },
},
config = function()
require("textcase").setup({})
require("telescope").load_extension("textcase")
end
}
This seems rather strange. I can't reproduce this in my setup. Also, we have extensive integration test cases with a minimal setup that work without running any of the ga
commands first. Not sure what a next step for an investigation could be :/
Are you using LazyVim? It might have to do with lazy loading.
You can try this:
return {
"johmsalas/text-case.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
keys = {
"ga", -- Default invocation prefix
{ "ga.", "<cmd>TextCaseOpenTelescope<CR>", desc = "Teslescope", mode = {"n", "v"} },
},
config = function()
require("textcase").setup({})
require("telescope").load_extension("textcase")
end,
lazy = false,
}
It also seems to work correctly (for me) if the key map is moved outside of lazy
return {
"johmsalas/text-case.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
config = function()
require("textcase").setup({})
require("telescope").load_extension("textcase")
vim.keymap.set({ "n", "v" }, "ga.", ":TextCaseOpenTelescope<CR>")
end
}
Interesting. In any case, this just seems to disable lazy loading. And disabling lazy loading is necessary for this plugin because even if we add the Subs
command to the cmd
config, the first usage of the Subs
command does not work interactively because it's not loaded yet.
Agreed. Thanks for looking into this.
Looks like using cmd
works. What is failing is the inccommand preview that is a visual indicator of the ongoing change.
From my initial research, text-case requires a small refactor splitting some files to be always loaded while keeping all the other files lazy loaded. Then, we should be able to use Lazyvim's init
method to load only the initialization file
init: functions are always executed during startup
https://github.com/folke/lazy.nvim?tab=readme-ov-file#-plugin-spec