-
Notifications
You must be signed in to change notification settings - Fork 8
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
on_enter stopped working properly #51
Comments
what neovim version? |
|
Upgrading to v0.10.2 worked for me. |
Same error for me. I'm on
And it errors on startup with the Git example on the Wiki
local Hydra = require("hydra")
local gitsigns = require('gitsigns')
local hint = [[
_J_: next hunk _s_: stage hunk _d_: show deleted _b_: blame line
_K_: prev hunk _u_: undo last stage _p_: preview hunk _B_: blame show full
^ ^ _S_: stage buffer ^ ^ _/_: show base file
^
^ ^ _<Enter>_: Neogit _q_: exit
]]
Hydra({
name = 'Git',
hint = hint,
config = {
buffer = bufnr,
color = 'pink',
invoke_on_body = true,
hint = {
border = 'rounded'
},
on_enter = function()
vim.cmd 'mkview'
vim.cmd 'silent! %foldopen!'
vim.bo.modifiable = false
gitsigns.toggle_signs(true)
gitsigns.toggle_linehl(true)
end,
on_exit = function()
local cursor_pos = vim.api.nvim_win_get_cursor(0)
vim.cmd 'loadview'
vim.api.nvim_win_set_cursor(0, cursor_pos)
vim.cmd 'normal zv'
gitsigns.toggle_signs(false)
gitsigns.toggle_linehl(false)
gitsigns.toggle_deleted(false)
end,
},
mode = {'n','x'},
body = '<leader>g',
heads = {
{ 'J',
function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gitsigns.next_hunk() end)
return '<Ignore>'
end,
{ expr = true, desc = 'next hunk' } },
{ 'K',
function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gitsigns.prev_hunk() end)
return '<Ignore>'
end,
{ expr = true, desc = 'prev hunk' } },
{ 's', ':Gitsigns stage_hunk<CR>', { silent = true, desc = 'stage hunk' } },
{ 'u', gitsigns.undo_stage_hunk, { desc = 'undo last stage' } },
{ 'S', gitsigns.stage_buffer, { desc = 'stage buffer' } },
{ 'p', gitsigns.preview_hunk, { desc = 'preview hunk' } },
{ 'd', gitsigns.toggle_deleted, { nowait = true, desc = 'toggle deleted' } },
{ 'b', gitsigns.blame_line, { desc = 'blame' } },
{ 'B', function() gitsigns.blame_line{ full = true } end, { desc = 'blame show full' } },
{ '/', gitsigns.show, { exit = true, desc = 'show base file' } }, -- show the base of the file
{ '<Enter>', '<Cmd>Neogit<CR>', { exit = true, desc = 'Neogit' } },
{ 'q', nil, { exit = true, nowait = true, desc = 'exit' } },
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a
minimal.lua
i created:And it works properly:
But when trying to pass a function on on_enter (uncommenting that section), it returns this error as soon as i open nvim:
I can't use
on_enter
oron_exit
The text was updated successfully, but these errors were encountered: