🍿 A collection of QoL plugins for Neovim
Find a file
github-actions[bot] edbd40aab4
chore(main): release 1.1.0 (#4)
🤖 I have created a release *beep* *boop*
---


## [1.1.0](https://github.com/folke/snacks.nvim/compare/v1.0.0...v1.1.0)
(2024-11-08)


### Features

* **bufdelete:** optional filter and shortcuts to delete `all` and
`other` buffers. Closes
[#11](https://github.com/folke/snacks.nvim/issues/11)
([71a2346](71a234608f))
* **debug:** simple log function to quickly log something to a debug.log
file
([fc2a8e7](fc2a8e7468))
* **docs:** docs for highlight groups
([#13](https://github.com/folke/snacks.nvim/issues/13))
([964cd6a](964cd6aa76))
* **gitbrowse:** choose to open repo, branch or file. Closes
[#10](https://github.com/folke/snacks.nvim/issues/10). Closes
[#17](https://github.com/folke/snacks.nvim/issues/17)
([92da87c](92da87c910))
* **notifier:** added history to notifier. Closes
[#14](https://github.com/folke/snacks.nvim/issues/14)
([65d8c8f](65d8c8f00b))
* **notifier:** added option to show notifs top-down or bottom-up.
Closes [#9](https://github.com/folke/snacks.nvim/issues/9)
([080e0d4](080e0d4039))
* **notifier:** allow overriding hl groups per notification
([8bcb2bc](8bcb2bc805))
* **notifier:** allow setting dynamic options
([36e9f45](36e9f45302))
* **win:** added default hl groups for windows
([8c0f10b](8c0f10b9da))
* **win:** allow setting `ft` just for highlighting without actually
changing the `filetype`
([cad236f](cad236f9bb))
* **win:** disable winblend when colorscheme is transparent. Fixes
[#26](https://github.com/folke/snacks.nvim/issues/26)
([12077bc](12077bcf65))
* **win:** equalize splits
([e982aab](e982aabefd))
* **win:** util methods to handle buffer text
([d3efb92](d3efb92aa5))
* **win:** win:focus()
([476fb56](476fb56bfd))
* **words:** `jump` optionally shows notification with reference count
([#23](https://github.com/folke/snacks.nvim/issues/23))
([6a3f865](6a3f865357))
* **words:** configurable mode to show references. Defaults to n, i, c.
Closes [#18](https://github.com/folke/snacks.nvim/issues/18)
([d079fbf](d079fbfe35))


### Bug Fixes

* **config:** deepcopy config where needed
([6c76f91](6c76f91398))
* **config:** fix reading config during setup. Fixes
[#2](https://github.com/folke/snacks.nvim/issues/2)
([0d91a4e](0d91a4e364))
* **notifier:** re-apply winhl since level might have changed with a
replace
([b8cc93e](b8cc93e273))
* **notifier:** set default conceallevel=2
([662795c](662795c285))
* **notifier:** try to keep layout when replacing notifs
([9bdb24e](9bdb24e735))
* **terminal:** dont overwrite user opts
([0b08d28](0b08d280b6))
* **terminal:** user options
([334895c](334895c5bb))
* **win:** better winfixheight and winfixwidth for splits
([8be14c6](8be14c68a7))
* **win:** disable sidescroloff in minimal style
([107d10b](107d10b52e))
* **win:** dont center float when `relative="cursor"`
([4991e34](4991e347dc))
* **win:** properly resolve user styles as last
([cc5ee19](cc5ee192ca))
* **win:** set border to none for backdrop windows
([#19](https://github.com/folke/snacks.nvim/issues/19))
([f5602e6](f5602e60c3))
* **win:** simpler way to add buffer padding
([f59237f](f59237f1dc))
* **win:** update win/buf opts when needed
([5fd9c42](5fd9c426e8))
* **words:** disable notify_jump by default
([9576081](9576081e87))


### Performance Improvements

* **notifier:** index queue by id
([5df4394](5df4394c60))
* **notifier:** optimize layout code
([8512896](8512896228))
* **notifier:** skip processing queue when free space is smaller than
min height
([08190a5](08190a5458))
* **win:** skip events when setting buf/win options. Trigger FileType on
BufEnter only if needed
([61496a3](61496a3ef0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-08 11:06:40 +01:00
.github ci: added labeler 2024-11-07 14:07:03 +01:00
doc feat(bufdelete): optional filter and shortcuts to delete all and other buffers. Closes #11 2024-11-08 10:58:40 +01:00
docs feat(bufdelete): optional filter and shortcuts to delete all and other buffers. Closes #11 2024-11-08 10:58:40 +01:00
lua/snacks feat(bufdelete): optional filter and shortcuts to delete all and other buffers. Closes #11 2024-11-08 10:58:40 +01:00
plugin feat: ensure Snacks global is available when not using setup 2024-11-04 16:39:24 +01:00
queries/lua feat: config & setup 2024-11-03 12:56:05 +01:00
scripts docs: better docs 2024-11-05 23:16:08 +01:00
tests feat(gitbrowse): choose to open repo, branch or file. Closes #10. Closes #17 2024-11-08 10:39:55 +01:00
.editorconfig ci: integrated with ci scripts 2024-11-03 09:04:33 +01:00
.gitignore ci: integrated with ci scripts 2024-11-03 09:04:33 +01:00
CHANGELOG.md chore(main): release 1.1.0 (#4) 2024-11-08 11:06:40 +01:00
LICENSE ci: integrated with ci scripts 2024-11-03 09:04:33 +01:00
README.md docs(readme, lazygit): fix typos (#16) 2024-11-07 13:50:13 +01:00
selene.toml feat: initial commit 2024-11-02 23:24:33 +01:00
stylua.toml feat: initial commit 2024-11-02 23:24:33 +01:00
vim.toml feat: initial commit 2024-11-02 23:24:33 +01:00

🍿 snacks.nvim

A collection of small QoL plugins for Neovim.

Features

Snack Description Setup
bigfile Deal with big files ‼️
bufdelete Delete buffers without disrupting window layout
debug Pretty inspect & backtraces for debugging
git Useful functions for Git
gitbrowse Open the repo of the active file in the browser (e.g., GitHub)
lazygit Open LazyGit in a float, auto-configure colorscheme and integration with Neovim
notify Utility functions to work with Neovim's vim.notify
notifier Better and prettier vim.notify ‼️
quickfile When doing nvim somefile.txt, it will render the file as quickly as possible, before loading your plugins. ‼️
rename LSP-integrated file renaming with support for plugins like neo-tree.nvim and mini.files.
statuscolumn Pretty statuscolumn ‼️
terminal Create and toggle floating/split terminals
toggle Toggle keymaps integrated with which-key icons / colors
win Easily create and manage floating windows or splits
words Auto-show LSP references and quickly navigate between them ‼️

Requirements

📦 Installation

Install the plugin with your package manager:

lazy.nvim

Important

A couple of plugins require snacks.nvim to be set-up early. Setup creates some autocmds and does not load any plugins. Check the code to see what it does.

Tip

If you don't need these plugins, you can disable them, or skip setup altogether.

{
  "folke/snacks.nvim",
  priority = 1000,
  lazy = false,
  opts = {
    -- your configuration comes here
    -- or leave it empty to use the default settings
    -- refer to the configuration section below
  },
}

For an in-depth setup of snacks.nvim with lazy.nvim, check the example below.

⚙️ Configuration

Please refer to the readme of each plugin for their specific configuration.

Default Options
---@class snacks.Config
---@field bigfile? snacks.bigfile.Config | { enabled: boolean }
---@field gitbrowse? snacks.gitbrowse.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config | { enabled: boolean }
---@field quickfile? { enabled: boolean }
---@field statuscolumn? snacks.statuscolumn.Config  | { enabled: boolean }
---@field terminal? snacks.terminal.Config
---@field toggle? snacks.toggle.Config
---@field styles? table<string, snacks.win.Config>
---@field win? snacks.win.Config
---@field words? snacks.words.Config
{
  styles = {},
  bigfile = { enabled = true },
  notifier = { enabled = true },
  quickfile = { enabled = true },
  statuscolumn = { enabled = true },
  words = { enabled = true },
}

🚀 Usage

See the example below for how to configure snacks.nvim.

{
  "folke/snacks.nvim",
  priority = 1000,
  lazy = false,
  ---@type snacks.Config
  opts = {
    bigfile = { enabled = true },
    notifier = {
      enabled = true,
      timeout = 3000,
    },
    quickfile = { enabled = true },
    statuscolumn = { enabled = true },
    words = { enabled = true },
    styles = {
      notification = {
        wo = { wrap = true } -- Wrap notifications
      }
    }
  },
  keys = {
    { "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
    { "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
    { "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
    { "<leader>gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line" },
    { "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse" },
    { "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit Current File History" },
    { "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log (cwd)" },
    { "<leader>cR", function() Snacks.rename() end, desc = "Rename File" },
    { "<c-/>",      function() Snacks.terminal() end, desc = "Toggle Terminal" },
    { "<c-_>",      function() Snacks.terminal() end, desc = "which_key_ignore" },
    { "]]",         function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference" },
    { "[[",         function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference" },
    {
      "<leader>N",
      desc = "Neovim News",
      function()
        Snacks.win({
          file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
          width = 0.6,
          height = 0.6,
          wo = {
            spell = false,
            wrap = false,
            signcolumn = "yes",
            statuscolumn = " ",
            conceallevel = 3,
          },
        })
      end,
    }
  },
  init = function()
    vim.api.nvim_create_autocmd("User", {
      pattern = "VeryLazy",
      callback = function()
        -- Setup some globals for debugging (lazy-loaded)
        _G.dd = function(...)
          Snacks.debug.inspect(...)
        end
        _G.bt = function()
          Snacks.debug.backtrace()
        end
        vim.print = _G.dd -- Override print to use snacks for `:=` command

        -- Create some toggle mappings
        Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
        Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
        Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
        Snacks.toggle.diagnostics():map("<leader>ud")
        Snacks.toggle.line_number():map("<leader>ul")
        Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
        Snacks.toggle.treesitter():map("<leader>uT")
        Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub")
        Snacks.toggle.inlay_hints():map("<leader>uh")
      end,
    })
  end,
}

🌈 Highlight Groups

Click to see all highlight groups
Highlight Group Default Group Description
SnacksNormal NormalFloat Normal for the float window
SnacksWinBar Title Title of the window
SnacksBackdrop none Backdrop
SnacksNormalNC NormalFloat Normal for non-current windows
SnacksWinBarNC SnacksWinBar Title for non-current windows
SnacksNotifierInfo none Notification window for Info
SnacksNotifierWarn none Notification window for Warn
SnacksNotifierDebug none Notification window for Debug
SnacksNotifierError none Notification window for Error
SnacksNotifierTrace none Notification window for Trace
SnacksNotifierIconInfo none Icon for Info notification
SnacksNotifierIconWarn none Icon for Warn notification
SnacksNotifierIconDebug none Icon for Debug notification
SnacksNotifierIconError none Icon for Error notification
SnacksNotifierIconTrace none Icon for Trace notification
SnacksNotifierTitleInfo none Title for Info notification
SnacksNotifierTitleWarn none Title for Warn notification
SnacksNotifierTitleDebug none Title for Debug notification
SnacksNotifierTitleError none Title for Error notification
SnacksNotifierTitleTrace none Title for Trace notification
SnacksNotifierBorderInfo none Border for Info notification
SnacksNotifierBorderWarn none Border for Warn notification
SnacksNotifierBorderDebug none Border for Debug notification
SnacksNotifierBorderError none Border for Error notification
SnacksNotifierBorderTrace none Border for Trace notification
SnacksNotifierFooterInfo DiagnosticInfo Footer for Info notification
SnacksNotifierFooterWarn DiagnosticWarn Footer for Warn notification
SnacksNotifierFooterDebug DiagnosticHint Footer for Debug notification
SnacksNotifierFooterError DiagnosticError Footer for Error notification
SnacksNotifierFooterTrace DiagnosticHint Footer for Trace notification