- Notifications
You must be signed in to change notification settings - Fork74
💫 Extensible UI for Neovim notifications and LSP progress messages.
License
j-hui/fidget.nvim
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Extensible UI for Neovim notifications and LSP progress messages.
Demo setup
Note that this demo may not always reflect the exact behavior of the latest release.
This screen recording was taken as I opened a Rust file I'm working on,triggeringrust-analyzer to send me some LSP progress messages.
As those messages are ongoing, I trigger some notifications with the following:
localfidget=require("fidget")vim.keymap.set("n","A",function()fidget.notify("This is from fidget.notify().")end)vim.keymap.set("n","B",function()fidget.notify("This is also from fidget.notify().",vim.log.levels.WARN)end)vim.keymap.set("n","C",function()fidget.notify("fidget.notify() supports annotations...",nil, {annote="MY NOTE",key="foobar"})end)vim.keymap.set("n","D",function()fidget.notify(nil,vim.log.levels.ERROR, {annote="bottom text",key="foobar"})fidget.notify("... and overwriting notifications.",vim.log.levels.WARN, {annote="YOUR AD HERE"})end)
(I use normal mode keymaps to avoid going into ex mode, which would pause Fidgetrendering and make the demo look glitchy...)
Visible elements:
- Terminal + font:Kitty +Comic Shanns Mono
- Editor:Neovim v0.9.4
- Theme:catppuccin/nvim (mocha, dark)
- Status line:nvim-lualine/lualine.nvim
- Color columns:
:set colorcolumn=81,121,+1,+2(sorry) - Scrollbar:petertriho/nvim-scrollbar
Fidget is an unintrusive window in the corner of your editor that managesits own lifetime. Its goals are:
- to provide a UI for Neovim's
$/progresshandler - to provide a configurable
vim.notify()backend - to support basic ASCII animations (Fidget spinners!) to indicate signs of life
- to be easy to configure, sane to maintain, and fun to hack on
There's only so much information one can stash into the status line. Besides,who doesn't love a little bit of terminal eye candy, as a treat?
Fidget requires Neovim v0.11.3. It may work on older versions, but full functionality is not guaranteed.
If you would like to see progress notifications, you must have configured Neovimwith an LSP server that uses the$/progress handler.For an up-to-date list of LSP servers this plugin is known to work with, seethis Wiki page.
Install this plugin using your favorite plugin manager.
See thedocumentation forsetup() options.
{"j-hui/fidget.nvim",opts= {-- options },}Plug'j-hui/fidget.nvim'" Make sure the plugin is installed using :PlugInstall. Then, somewhere after plug#end():lua <<EOFrequire("fidget").setup {--options}EOF
:Rocks install fidget.nvim
Fidget is actively developed on themain branch, and may occasionally undergobreaking changes.
If you would like to ensure configuration/API stability, you can pin your tag toone of therelease tags.
For instance, usingLazy:
{"j-hui/fidget.nvim",version="*",-- alternatively, pin this to a specific version, e.g., "1.6.1"opts= {-- options },}Fidget can be configured by passing a table of options to thesetup().Available options are shown below:
{-- Options related to LSP progress subsystemprogress= {poll_rate=0,-- How and when to poll for progress messagessuppress_on_insert=false,-- Suppress new messages while in insert modeignore_done_already=false,-- Ignore new tasks that are already completeignore_empty_message=false,-- Ignore new tasks that don't contain a messageclear_on_detach=-- Clear notification group when LSP server detachesfunction(client_id)localclient=vim.lsp.get_client_by_id(client_id)returnclientandclient.nameornilend,notification_group=-- How to get a progress message's notification group keyfunction(msg)returnmsg.lsp_client.nameend,ignore= {},-- List of LSP servers to ignore-- Options related to how LSP progress messages are displayed as notificationsdisplay= {render_limit=16,-- How many LSP messages to show at oncedone_ttl=3,-- How long a message should persist after completiondone_icon="✔",-- Icon shown when all LSP progress tasks are completedone_style="Constant",-- Highlight group for completed LSP tasksprogress_ttl=math.huge,-- How long a message should persist when in progressprogress_icon=-- Icon shown when LSP progress tasks are in progress {"dots"},progress_style=-- Highlight group for in-progress LSP tasks"WarningMsg",group_style="Title",-- Highlight group for group name (LSP server name)icon_style="Question",-- Highlight group for group iconspriority=30,-- Ordering priority for LSP notification groupskip_history=true,-- Whether progress notifications should be omitted from historyformat_message=-- How to format a progress messagerequire("fidget.progress.display").default_format_message,format_annote=-- How to format a progress annotationfunction(msg)returnmsg.titleend,format_group_name=-- How to format a progress notification group's namefunction(group)returntostring(group)end,overrides= {-- Override options from the default notification configrust_analyzer= {name="rust-analyzer"}, }, },-- Options related to Neovim's built-in LSP clientlsp= {progress_ringbuf_size=0,-- Configure the nvim's LSP progress ring buffer sizelog_handler=false,-- Log `$/progress` handler invocations (for debugging) }, },-- Options related to notification subsystemnotification= {poll_rate=10,-- How frequently to update and render notificationsfilter=vim.log.levels.INFO,-- Minimum notifications levelhistory_size=128,-- Number of removed messages to retain in historyoverride_vim_notify=false,-- Automatically override vim.notify() with Fidgetconfigs=-- How to configure notification groups when instantiated {default=require("fidget.notification").default_config },redirect=-- Conditionally redirect notifications to another backendfunction(msg,level,opts)ifoptsandopts.on_openthenreturnrequire("fidget.integration.nvim-notify").delegate(msg,level,opts)endend,-- Options related to how notifications are rendered as textview= {stack_upwards=true,-- Display notification items from bottom to topalign="message",-- Indent messages longer than a single linereflow=false,-- Reflow (wrap) messages wider than notification windowicon_separator="",-- Separator between group name and icongroup_separator="---",-- Separator between notification groupsgroup_separator_hl=-- Highlight group used for group separator"Comment",line_margin=1,-- Spaces to pad both sides of each non-empty linerender_message=-- How to render notification messagesfunction(msg,cnt)returncnt==1andmsgorstring.format("(%dx) %s",cnt,msg)end, },-- Options related to the notification window and bufferwindow= {normal_hl="Comment",-- Base highlight group in the notification windowwinblend=100,-- Background color opacity in the notification windowborder="none",-- Border around the notification windowzindex=45,-- Stacking priority of the notification windowmax_width=0,-- Maximum width of the notification windowmax_height=0,-- Maximum height of the notification windowx_padding=1,-- Padding from right edge of window boundaryy_padding=0,-- Padding from bottom edge of window boundaryalign="bottom",-- How to align the notification windowrelative="editor",-- What the notification window position is relative totabstop=8,-- Width of each tab character in the notification windowavoid= {}-- Filetypes the notification window should avoid-- e.g., { "aerial", "NvimTree", "neotest-summary" } }, },-- Options related to integrating with other pluginsintegration= { ["nvim-tree"]= {enable=true,-- Integrate with nvim-tree/nvim-tree.lua (if installed)-- DEPRECATED; use notification.window.avoid = { "NvimTree" } }, ["xcodebuild-nvim"]= {enable=true,-- Integrate with wojciech-kulik/xcodebuild.nvim (if installed)-- DEPRECATED; use notification.window.avoid = { "TestExplorer" } }, },-- Options related to logginglogger= {level=vim.log.levels.WARN,-- Minimum logging levelmax_size=10000,-- Maximum log file size, in KBfloat_precision=0.01,-- Limit the number of decimals displayed for floatspath=-- Where Fidget writes its logs tostring.format("%s/fidget.nvim.log",vim.fn.stdpath("cache")), },}For more details, seefidget-option.txt.
Fidget has a Lua API, withdocumentation generated fromsource code. You are encouraged to hack around with that.
Fidget exposes some of its Lua API functions through:Fidget sub-commands(e.g.,:Fidget clear), which support shell-like arguments and completion.These sub-commands are documented below.
Clear active notifications
Arguments
Positional arguments:
{group_key}:(any)group to clear
Clear notifications history
Arguments
Flags:
--before {seconds}:(number)filter history for items updated at least this long ago--group_key {group_key}:(any)clear history by group key--include_active {true|false}:(boolean)whether to clear items that have not been removed (default: true)--include_removed {true|false}:(boolean)whether to clear items that have have been removed (default: true)--since {seconds}:(number)filter history for items updated at most this long ago
Positional arguments:
{group_key}:(any)clear history by group key
Show notifications history
Arguments
Flags:
--before {seconds}:(number)filter history for items updated at least this long ago--group_key {group_key}:(any)filter history by group key--include_active {true|false}:(boolean)whether to clear items that have not been removed (default:true)--include_removed {true|false}:(boolean)whether to clear items that have have been removed (default:true)--since {seconds}:(number)filter history for items updated at most this long ago
Positional arguments:
{group_key}:(any)filter history by group key
Suppress LSP progress notifications
Arguments
Positional arguments:
{suppress}:(boolean)whether to suppress (omitting this argument toggles suppression)
Suppress notification window
Arguments
Positional arguments:
{suppress}:(boolean)whether to suppress (omitting this argument toggles suppression)
Fidget includes aTelescope picker extension, which will showyour Fidget notification history in Telescope and allow you to filter it.To enable this extension, make sure the Telescope plugin is installed, andadd the following to your configuration:
require("telescope").load_extension("fidget")
You can open the Fidget picker using the command:Telescope fidget, orvia the Lua API:
require("telescope").extensions.fidget.fidget()
Rather than defining its own highlights, Fidget's default configuration usesbuilt-in highlight groups that are typically overridden by custom Vim colorschemes. With any luck, these will look reasonable when rendered, but the visualoutcome will really depend on what your color scheme decided to do with thosehighlight groups.
You can override these highlight groups (e.g.,icon_style) using the:h fidget-options shown above.
rcarriga/nvim-notify is first andforemost avim.notify() backend, and it also supportsLSP progress notifications(with the integration seems to have been packaged up inmrded/nvim-lsp-notify).
vigoux/notifier.nvim isavim.notify() backend that comes with first-class LSP notification support.
neoclide/coc.nvim provides a nice LSPprogress UI in the status line, which first inspired my desire to have thisfeature for nvim-lsp.
arkav/lualine-lsp-progress wasthe original inspiration for Fidget, and funnels LSP progress messages intonvim-lualine/lualine.nvim.I once borrowed some of its code (though much of that code has since beenrewritten).
nvim-lua/lsp-status.nvim alsosupports showing progress text, though it requires some configuration tointegrate that into their status line.
Most of the Fidget spinner patterns were adapted from the npm packagesindresorhus/cli-spinners.
About
💫 Extensible UI for Neovim notifications and LSP progress messages.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
