-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If lazy-loaded pounce does not work for the first time #1
Comments
I haven't used packer before. Here's my init.lua attempting to reproduce this: return require('packer').startup(function()
vim.cmd [[
nmap <leader>p <cmd>Pounce<CR>
vmap <leader>p <cmd>Pounce<CR>
omap <leader>P <cmd>Pounce<CR>
]]
use {
"rlane/pounce.nvim",
cmd = {"Pounce"},
opt = true,
config = function()
require "pounce".setup {
accept_keys = "JFKDLSAHGNUVRBYTMICEOXWPQZ",
debug = false
}
vim.cmd [[
nmap <leader>p <cmd>Pounce<CR>
vmap <leader>p <cmd>Pounce<CR>
omap <leader>P <cmd>Pounce<CR>
]]
end
}
end) With this config, hitting It seems like the config can also be shortened: return require('packer').startup(function()
vim.cmd [[
nmap <leader>p <cmd>Pounce<CR>
vmap <leader>p <cmd>Pounce<CR>
omap <leader>P <cmd>Pounce<CR>
]]
use { "rlane/pounce.nvim", cmd = {"Pounce"}, opt = true }
end) |
I know this issue is over a year old but I'll put this here to avoid opening redundant issues. When lazy loading with lazy.nvim, highlight groups are not set at all. Because of #37 highlights are only defined on the require('lazy').setup({
-- other plugins...
{
'rlane/pounce.nvim',
keys = {
{ 's', '<cmd>Pounce<CR>' }
},
config = function()
local str_color = vim.api.nvim_get_hl(0, { name = 'String' }).fg
local num_color = vim.api.nvim_get_hl(0, { name = 'Number' }).fg
local const_color = vim.api.nvim_get_hl(0, { name = 'Constant' }).fg
local spec_color = vim.api.nvim_get_hl(0, { name = 'Special' }).fg
vim.api.nvim_set_hl(0, 'PounceMatch', { bold = true, fg = 'bg', bg = str_color })
vim.api.nvim_set_hl(0, 'PounceUnmatched', { link = 'None' })
vim.api.nvim_set_hl(0, 'PounceGap', { bold = true, fg = 'bg', bg = num_color })
vim.api.nvim_set_hl(0, 'PounceAccept', { bold = true, fg = 'black', bg = const_color })
vim.api.nvim_set_hl(0, 'PounceAcceptBest', { bold = true, fg = 'black', bg = spec_color })
-- not required
-- require('pounce').setup{}
end
},
-- other plugins
}) I am also using this opportunity to get the colors to match my color scheme by pulling from the already defined highlights. This gives me several ideas about user configurable highlights or dynamically changing highlights to fit the color scheme in use (or even moving to 100% lua - everything exists in the lua api for that now). I could totally start working on a PR if any of that is of interest, though I would wait for #36 to get merged first. |
Could you check if #36 fixed this? It's now setting up the highlights both in the ColorScheme autocommand and when the plugin loads. |
Must have missed that when I looked over it last. I will test when I have the chance soon. |
Can confirm lazy loading works as expected now, awesome job. |
If lazy-loaded pounce does not work for the first time. However, after the first try everything works as expected.
Here is my config using packer:
The text was updated successfully, but these errors were encountered: