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

feat(nvim): Snacks #82

Merged
merged 11 commits into from
Dec 25, 2024
Merged
10 changes: 2 additions & 8 deletions config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
"bufferline.nvim": { "branch": "main", "commit": "261a72b90d6db4ed8014f7bda976bcdc9dd7ce76" },
"catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
"cinnamon.nvim": { "branch": "master", "commit": "450cb3247765fed7871b41ef4ce5fa492d834215" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" },
Expand All @@ -34,7 +33,6 @@
"heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" },
"hop.nvim": { "branch": "master", "commit": "1a1eceafe54b5081eae4cb91c723abd1d450f34b" },
"inc-rename.nvim": { "branch": "main", "commit": "1871ca49ae6ee3e9ebee37955ba10c7b1425974f" },
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
"killersheep.nvim": { "branch": "master", "commit": "506823c47b854df02e78d5fec9468ab0e542dcf5" },
"lazy.nvim": { "branch": "main", "commit": "7c493713bc2cb392706866eeba53aaef6c8e9fc6" },
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
Expand All @@ -59,7 +57,6 @@
"nvim-colorizer.lua": { "branch": "master", "commit": "4acf88d31b3a7a1a7f31e9c30bf2b23c6313abdb" },
"nvim-fundo": { "branch": "main", "commit": "ac9c9372c4bf677721e24f144ef29d3a05c2b589" },
"nvim-lspconfig": { "branch": "master", "commit": "124be12d782d656b3c75b513a44d9e4728406078" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
"nvim-tree.lua": { "branch": "master", "commit": "db8d7ac1f524fc6f808764b29fa695c51e014aa6" },
"nvim-treesitter": { "branch": "master", "commit": "2a496fa4e89034014dd054f04c061ba7d6023a0c" },
Expand All @@ -75,7 +72,7 @@
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"scope.nvim": { "branch": "main", "commit": "932102696ead2b7ab9ff65017767b57e2722fdde" },
"smart-splits.nvim": { "branch": "master", "commit": "63d16fc6a8fa6864d00de99207943556b10676cb" },
"statuscol.nvim": { "branch": "main", "commit": "8822f76e105549620ef9c0d96e7b95aedf14c490" },
"snacks.nvim": { "branch": "main", "commit": "98df370703b3c47a297988f3e55ce99628639590" },
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
Expand All @@ -84,14 +81,11 @@
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"toggleterm.nvim": { "branch": "main", "commit": "87b2d6a3cab8e2bd9a0255427074285f0365398d" },
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
"vim-matchup": { "branch": "master", "commit": "5fb083de1e06fdd134c6ad8d007d4b5576b25ba7" },
"vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" },
"vim-tpipeline": { "branch": "master", "commit": "5f663e863df6fba9749ec6db0a890310ba4ad0a9" },
"vimtex": { "branch": "master", "commit": "3401dc81a14b7251bd813e2411eaf0d3b65bd2af" },
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }
}
13 changes: 0 additions & 13 deletions config/nvim/lua/core/autocmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,11 @@ vim.api.nvim_create_autocmd("BufWritePre", {
end,
})

vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
vim.filetype.add {
pattern = {
[".*"] = {
function(path, buf)
return vim.bo[buf].filetype ~= "bigfile" and path and vim.fn.getfsize(path) > vim.g.bigfile_size and "bigfile"
or nil
end,
},
},
}

vim.api.nvim_create_autocmd("FileType", {
group = augroup("bigfile"),
pattern = "bigfile",
callback = function(event)
vim.schedule(function()
vim.bo[event.buf].syntax = vim.filetype.match { buf = event.buf } or ""
require("core.utils").on_load("noice.nvim", vim.schedule_wrap(require("noice").disable))
end)
end,
Expand Down
4 changes: 3 additions & 1 deletion config/nvim/lua/core/mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ map("n", "<leader>bb", "<cmd>FzfLua buffers<cr>", "Buffers")
map("n", "<leader>b>", "<cmd>BufferLineMoveNext<cr>", "Move right")
map("n", "<leader>b<", "<cmd>BufferLineMovePrev<cr>", "Move left")
map("n", "<leader>bs", "<cmd>so %|lua vim.notify('Buffer sourced.')<cr>", "Source this buffer")
map("n", "<leader>bz", "<cmd>ZenMode<cr>", "Zen mode")
map("n", "<leader>bz", function()
require("snacks").zen()
end, "Zen mode")
map("n", "<leader>br", "<cmd>%s/.*/mv & &/<cr>", "bulk rename")
map("n", "<leader>bf", "<cmd>FSToggle<cr>", "Flow state reading toggle")
--}}}
Expand Down
1 change: 0 additions & 1 deletion config/nvim/lua/plugins/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function M.config()
cmp = true,
gitsigns = true,
hop = true,
illuminate = true,
leap = true,
lsp_saga = true,
lsp_trouble = true,
Expand Down
41 changes: 0 additions & 41 deletions config/nvim/lua/plugins/illuminate.lua

This file was deleted.

26 changes: 0 additions & 26 deletions config/nvim/lua/plugins/indent-blankline.lua

This file was deleted.

28 changes: 0 additions & 28 deletions config/nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,6 @@ return {
},
},

{
"folke/zen-mode.nvim",
cmd = "ZenMode",
opts = {
plugins = {
tmux = {
enabled = true,
},
},
},
dependencies = {
{
"folke/twilight.nvim",
config = true,
},
},
},

{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
Expand Down Expand Up @@ -128,16 +110,6 @@ return {
end,
},

{
"declancm/cinnamon.nvim",
event = "VeryLazy",
opts = {
keymaps = {
basic = true,
},
},
},

{
"kevinhwang91/nvim-fundo",
event = "BufReadPre",
Expand Down
5 changes: 3 additions & 2 deletions config/nvim/lua/plugins/lazydev.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ return {
ft = "lua",
opts = {
library = {
-- TODO: change to vim.uv
{ path = "luvit-meta/library", words = { "vim%.uv" } },
{ path = "luvit-meta/library", words = { "vim%.loop" } },
{ path = "snacks.nvim", words = { "Snacks" } },
},
},
},

-- optional `vim.uv` typings
{
"Bilal2453/luvit-meta",
lazy = true
lazy = true,
},
}
1 change: 0 additions & 1 deletion config/nvim/lua/plugins/noice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ local M = {
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
}

Expand Down
34 changes: 0 additions & 34 deletions config/nvim/lua/plugins/notify.lua

This file was deleted.

14 changes: 8 additions & 6 deletions config/nvim/lua/plugins/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ M.init = function()
end

M.config = function()
-- vim.api.nvim_create_autocmd("User", {
-- pattern = "SessionLoadPost",
-- callback = vim.schedule_wrap(function()
-- pcall(require("nvim-tree.api").tree.toggle, false, true)
-- end),
-- })
vim.api.nvim_create_autocmd("User", {
pattern = "SessionLoadPost",
callback = vim.schedule_wrap(function()
-- HACK: this is a workaround for a race condition from `focus` plugin (resizer.lua)
-- it will set `cmdheight` to 1, when loading a session
vim.o.cmdheight = 0
end),
})

require("session_manager").setup {
autoload_mode = require("session_manager.config").AutoloadMode.Disabled,
Expand Down
71 changes: 71 additions & 0 deletions config/nvim/lua/plugins/snacks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
return {
"folke/snacks.nvim",
priority = 1000,

---@type snacks.config
opts = {
words = {
enabled = true,
debounce = 150,
},
bigfile = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
statuscolumn = { enabled = true },
scroll = {
enabled = true,
animate = {
duration = { step = 12, total = 210 },
},
},
input = { enabled = true },
indent = {
indent = {
enabled = true,
char = "▏",
hl = "IblIndent",
},
scope = {
char = "▏",
hl = "IblScope",
},
},
zen = {
on_open = function()
vim.system { "tmux", "set", "status", "off" }
end,
on_close = function()
vim.system { "tmux", "set", "status", "on" }
end,
},
},

init = function()
local snacks = require("snacks")

vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesActionRename",
callback = function(event)
snacks.rename.on_rename_file(event.data.from, event.data.to)
end,
})

local set_jump_words_keymap = function(buffer)
local opts = buffer and { buffer = buffer } or nil
vim.keymap.set({ "n", "t" }, "]]", function()
snacks.words.jump(vim.v.count1)
end, opts)
vim.keymap.set({ "n", "t" }, "[[", function()
snacks.words.jump(-vim.v.count1)
end, opts)
end

vim.schedule(set_jump_words_keymap)
vim.api.nvim_create_autocmd("FileType", {
callback = function()
local buffer = vim.api.nvim_get_current_buf()
set_jump_words_keymap(buffer)
end,
})
end,
}
11 changes: 11 additions & 0 deletions config/nvim/lua/plugins/splits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ return {
{
"nvim-focus/focus.nvim",
event = "WinNew",
keys = {
{
"<C-L>",
function()
---@diagnostic disable-next-line: param-type-mismatch
pcall(vim.cmd, "nohlsearch | diffupdate | mode")
pcall(require("focus").focus_autoresize)
end,
desc = "Resize splits and refresh",
},
},
opts = {
autoresize = {
minwidth = 4,
Expand Down
Loading
Loading