0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

nvim-notifyの通知をすぐに消す

Posted at

はじめに

nvim-notifyは通知をかっこよくポップアップにしてくれるプラグインです.
しかし,通知が編集作業の邪魔になるときがあります.
ここでは,nvim-notifyの通知を即時消去する方法を紹介します.

結論

設定方法だけ知りたい人向け.
例えば,<leader>dnで通知を消去したいのなら,以下のように設定します.

lua/plugins/nvim-notify.lua
return {
  'rcarriga/nvim-notify',
  config = function()
    vim.keymap.set('n', '<leader>dn', function()
      require('notify').dismiss { silent = true }
    end, { desc = 'Dismiss notifications' })
  end,
}

前提

当たり前ですがnvim-notifyがインストールされていることが前提です.
lazy.nvimでプラグインごとにファイルを分割して管理している場合は,以下のような設定で使えます.

lua/plugins/nvim-notify.lua
return {
  'rcarriga/nvim-notify'
}

通知の消去

リポジトリdoc/nvim-notify.txtnotify.dismiss()という関数が紹介されています.

Dismiss all notification windows currently displayed

と書かれており,これを使えば表示されている通知を消去できます.

例えば,<leader>dnで通知を消去したいのなら,以下のように設定します(上の結論と同じ).

lua/plugins/nvim-notify.lua
return {
  'rcarriga/nvim-notify',
  config = function()
    vim.keymap.set('n', '<leader>dn', function()
      require('notify').dismiss { silent = true }
    end, { desc = 'Dismiss notifications' })
  end,
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?