Skip to content

feat: adding snacks.nvim plugins #1264

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# snacks.statuscolumn

Pretty status column

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/statuscolumn.md>

_Note_: This also disables the Heirline based statuscolumn.
13 changes: 13 additions & 0 deletions lua/astrocommunity/bars-and-lines/snacks-statuscolumn/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { statuscolumn = {} },
specs = {
{
"rebelot/heirline.nvim",
optional = true,
opts = { statuscolumn = false },
},
},
}
5 changes: 5 additions & 0 deletions lua/astrocommunity/cursorline/snacks-words/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# snacks.words

Auto-show LSP references and quickly navigate between them

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/words.md>
21 changes: 21 additions & 0 deletions lua/astrocommunity/cursorline/snacks-words/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---@type LazySpec
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { words = { enabled = true } },
specs = {
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["]r"] = { function() require("snacks").words.jump(vim.v.count1) end, desc = "Next Reference" },
["[r"] = { function() require("snacks").words.jump(-vim.v.count1) end, desc = "Prev Reference" },
},
},
},
},
{ "RRethy/vim-illuminate", enabled = false },
},
}
9 changes: 9 additions & 0 deletions lua/astrocommunity/editing-support/snacks-bigfile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# snacks.bigfile

`bigfile` adds a new filetype `bigfile` to Neovim that triggers when the file is
larger than the configured size. This automatically prevents things like LSP
and Treesitter attaching to the buffer.

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/bigfile.md>

_Note_: This plugin will also disable the build in `large_buf` feature in AstroCore
12 changes: 12 additions & 0 deletions lua/astrocommunity/editing-support/snacks-bigfile/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { bigfile = { enabled = true } },
specs = {
{
"AstroNvim/astrocore",
opts = { features = { large_buf = false } } --[[@as AstroCoreOpts]],
},
},
}
5 changes: 5 additions & 0 deletions lua/astrocommunity/git/snacks-lazygit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# snacks.lazygit

Automatically configures lazygit with a theme generated based on your Neovim colorscheme and integrate edit with the current neovim instance.

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/lazygit.md>
29 changes: 29 additions & 0 deletions lua/astrocommunity/git/snacks-lazygit/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---@type LazySpec
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { lazygit = { configure = true } },
specs = {
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>gg"] = { function() require("snacks").lazygit() end, desc = "Lazygit" },
["<Leader>tl"] = { function() require("snacks").lazygit() end, desc = "Lazygit" },
["<Leader>gf"] = {
function() require("snacks").lazygit.log_file() end,
desc = "Lazygit Current File History",
},
["<Leader>gl"] = { function() require("snacks").lazygit.log() end, desc = "Lazygit Log (cwd)" },
},
},
},
},
{
"AstroNvim/astroui",
opts = { lazygit = false } --[[@as AstroUIOpts]],
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# snacks.terminal

Create and toggle terminal windows.

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/terminal.md>
36 changes: 36 additions & 0 deletions lua/astrocommunity/terminal-integration/snacks-terminal/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---@type LazySpec
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { words = { enabled = true } },
specs = {
{
"AstroNvim/astrocore",
opts = function(_, opts)
local Snacks = require "snacks"
local maps = opts.mappings

if vim.fn.executable "node" == 1 then
maps.n["<Leader>tn"] = { function() Snacks.terminal "node" end, desc = "ToggleTerm node" }
end
local python = vim.fn.executable "python" == 1 and "python" or vim.fn.executable "python3" == 1 and "python3"
if python then
maps.n["<Leader>tp"] = { function() Snacks.terminal "python" end, desc = "ToggleTerm python" }
end
if vim.fn.executable "btm" == 1 then
maps.n["<Leader>tb"] = { function() Snacks.terminal "btm" end, desc = "ToggleTerm bottom" }
end
local gdu = vim.fn.has "mac" == 1 and "gdu-go" or "gdu"
if vim.fn.has "win32" == 1 and vim.fn.executable(gdu) ~= 1 then gdu = "gdu_windows_amd64.exe" end
if vim.fn.executable(gdu) == 1 then
maps.n["<Leader>tu"] = { function() Snacks.terminal { "gdu" } end, desc = "ToggleTerm gdu" }
end
maps.n["<Leader>th"] = { function() Snacks.terminal() end, desc = "Toggle Terminal" }
maps.n["<Leader>tf"] = { function() Snacks.terminal() end, desc = "Toggle Terminal Float" }
maps.n["<Leader>to"] = { function() Snacks.terminal "<Cmd>execute v:count ." end, desc = "Toggle Terminal" }
end,
},
{ "RRethy/vim-illuminate", enabled = false },
},
}
5 changes: 5 additions & 0 deletions lua/astrocommunity/utility/snacks-notifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# snacks.notifier

Utility functions to work with Neovim's `vim.notify`

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/notifier.md>
39 changes: 39 additions & 0 deletions lua/astrocommunity/utility/snacks-notifier/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = function(_, opts)
local get_icon = require("astroui").get_icon
return require("astrocore").extend_tbl(opts, {
notifier = {
timeout = 3000,
icons = {
DEBUG = get_icon "Debugger",
ERROR = get_icon "DiagnosticError",
INFO = get_icon "DiagnosticInfo",
TRACE = get_icon "DiagnosticHint",
WARN = get_icon "DiagnosticWarn",
},
},
styles = {
notification = {
wo = { wrap = true }, -- Wrap notifications
},
},
})
end,
specs = {
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>uD"] = { function() require("snacks.notifier").hide() end, desc = "Dismiss notifications" },
["<Leader>fn"] = { function() require("snacks").picker.notifications() end, desc = "Find notifications" },
},
},
},
},
{ "rcarriga/nvim-notify", enabled = false },
},
}
14 changes: 14 additions & 0 deletions lua/astrocommunity/utility/snacks-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# snacks.nvim

A collection of useful utilities for Neovim

**Repository:** <https://github.com/folke/snacks.nvim>

## Features

- Bigfile support
- Notifier with customizable timeout
- Quickfile support
- Statuscolumn support
- Words support
- Customizable styles for notifications
44 changes: 44 additions & 0 deletions lua/astrocommunity/utility/snacks-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
dependencies = {
{
"AstroNvim/astrocore",
opts = function(_, opts)
local Snacks = require "snacks"
local maps = opts.mappings

opts.autocmds.snacks_toggle = {
event = "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,
}
maps.n["<Leader>bd"] = { function() Snacks.bufdelete() end, desc = "Delete Buffer" }
maps.n["<Leader>gb"] = { function() Snacks.git.blame_line() end, desc = "Git Blame Line" }
maps.n["<Leader>gB"] = { function() Snacks.gitbrowse() end, desc = "Git Browse" }
maps.n["<Leader>cR"] = { function() Snacks.rename() end, desc = "Rename File" }
end,
},
},
}
5 changes: 5 additions & 0 deletions lua/astrocommunity/utility/snacks-quickfile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# snacks.quickfile

When doing `nvim somefile.txt`, it will render the file as quickly as possible, before loading your plugins.

**Repository:** <https://github.com/folke/snacks.nvim/blob/main/docs/quickfile.md>
6 changes: 6 additions & 0 deletions lua/astrocommunity/utility/snacks-quickfile/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
"folke/snacks.nvim",
priority = 10000,
lazy = false,
opts = { quickfile = {} },
}
Loading