Files
nvim-config/lua/plugins/editor.lua

160 lines
4.2 KiB
Lua

-- Editor enhancements - Snacks explorer configuration
-- Custom keybindings for file explorer (snacks.nvim built into LazyVim)
return {
{
"nvim-telescope/telescope.nvim",
opts = {
defaults = {
hidden = true,
file_ignore_patterns = {},
},
pickers = {
find_files = {
hidden = true,
no_ignore = true,
no_ignore_parent = true,
},
live_grep = {
additional_args = function()
return { "--hidden", "--no-ignore" }
end,
},
},
},
},
-- Configure snacks.nvim explorer (already included in LazyVim)
{
"folke/snacks.nvim",
opts = {
explorer = {
replace_netrw = true,
},
lazygit = {
enabled = true,
},
picker = {
sources = {
explorer = {
-- Explorer picker configuration
hidden = true,
ignored = true, -- Show files ignored by .gitignore
follow_file = true,
-- Custom keymaps within the explorer
win = {
list = {
keys = {
-- Ctrl+Shift+v - Open in vertical split
["<C-S-v>"] = { "edit_vsplit", mode = { "n", "i" } },
-- Ctrl+Shift+h - Open in horizontal split
["<C-S-h>"] = { "edit_split", mode = { "n", "i" } },
-- Alternative mappings (in case terminal doesn't send Ctrl+Shift properly)
["<C-v>"] = { "edit_vsplit", mode = { "n", "i" } },
["<C-x>"] = { "edit_split", mode = { "n", "i" } },
},
},
},
},
},
},
},
keys = {
-- Ctrl+Shift+e - Toggle explorer
{ "<C-S-e>", function() Snacks.explorer() end, desc = "Toggle Explorer" },
-- Alternative binding if terminal doesn't handle Ctrl+Shift
{ "<leader>fe", function() Snacks.explorer() end, desc = "File Explorer" },
-- Lazygit
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
{ "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log" },
{ "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit File History" },
},
},
-- Which-key for keybinding hints
{
"folke/which-key.nvim",
opts = {
spec = {
{ "<leader>a", group = "AI" },
{ "<leader>d", group = "Debug/Database" },
{ "<leader>g", group = "Git" },
{ "<leader>t", group = "Terminal" },
},
},
},
-- Color preview for CSS, HTML, etc.
{
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
opts = {
filetypes = {
"css",
"scss",
"sass",
"less",
"html",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"vue",
"svelte",
"lua",
"yaml",
"toml",
"conf",
},
user_default_options = {
RGB = true,
RRGGBB = true,
RRGGBBAA = true,
names = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
mode = "background",
tailwind = false,
sass = { enable = true, parsers = { "css" } },
virtualtext = "",
always_update = true, -- Update color values even if buffer is not focused
},
},
},
-- Better terminal integration
{
"akinsho/toggleterm.nvim",
version = "*",
opts = {
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
},
},
}