Skip to content
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

[Feature request]: Allow the dismissal of 'mini' view #417

Closed
1 task done
lmburns opened this issue Mar 29, 2023 · 1 comment · Fixed by #432 or #639
Closed
1 task done

[Feature request]: Allow the dismissal of 'mini' view #417

lmburns opened this issue Mar 29, 2023 · 1 comment · Fixed by #432 or #639
Labels
enhancement New feature or request

Comments

@lmburns
Copy link

lmburns commented Mar 29, 2023

Did you check the docs?

  • I have read all the noice.nvim docs

Is your feature request related to a problem? Please describe.

I'd like to be able to dismiss the mini view notification windows.

Describe the solution you'd like

Would it be possible to get something like nvim-notify's dismiss function?

Describe alternatives you've considered

Setting a lower timeout on the window. However, this isn't favorable all of them time. Sometimes I would like to have windows open longer than others, and when they are in the way and I want them to be closed, I'd like to close them.

I have a function like the following, that allows me to focus floating windows and I can close them if I'd like, but that involves having to press the keybinding for the function, followed by :q, when I can just have a single builtin keybinding to close the window.

Function
---Focus the floating window
M.focus_floating_win = function()
    if D.is_floating_window(fn.win_getid()) then
        cmd.wincmd("p")
        return
    end
    for _, winnr in ipairs(fn.range(1, fn.winnr("$"))) do
        local winid = fn.win_getid(winnr)
        local conf = api.nvim_win_get_config(winid)
        if conf.focusable and conf.relative ~= "" then
            fn.win_gotoid(winid)
            return
        end
    end
end

Additional context

I see that there is MiniView:hide, but the function is empty.
I tried calling require('noice.view.backend.mini'):hide() and it doesn't do anything.

@lmburns lmburns added the enhancement New feature or request label Mar 29, 2023
@bennypowers
Copy link

I tried this, with :NoiceDisable and :NoiceEnable. I suppose it works, but it clears the nvim window for a few frames and that's annoying

command('ClearNotifications', function()
  local has_notify, notify = pcall(require, 'notify')
  if has_notify then
    notify.dismiss { silent = true }
  elseif pcall(require, 'notifier') then
    vim.cmd[[:NotifierClear]]
  elseif pcall(require, 'noice') then
    -- vim.cmd[[:NoiceDisable]]
    -- vim.cmd[[:NoiceEnable]]
  end
  vim.cmd[[nohlsearch|diffupdate|normal! <C-L><CR>]]
end, {
  bang = true,
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants