config/nvim/lua/plugins/ui.lua (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
return {
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
indent = {
enabled = true,
animate = {
enabled = false,
},
},
-- Disable expensive features on very large / minified files
bigfile = { enabled = true },
-- Render a file before plugins fully load, for faster opening
quickfile = { enabled = true },
-- LSP reference highlighting under the cursor (CursorHold-based);
-- replaces the hand-rolled CursorMoved autocmd in init.lua
words = { enabled = true },
-- Treesitter scope detection: ii/ai indent text-objects + [i/]i jumps
scope = { enabled = true },
-- Unified gutter (signs+number+fold+git). The statuscolumn option
-- itself is set in init.lua.
statuscolumn = { enabled = true },
},
keys = {
{ "<Leader>it", function()
if Snacks.indent.enabled then
Snacks.indent.disable()
else
Snacks.indent.enable()
end
end, desc = "Toggle indent guides" },
},
},
{
"nvim-lualine/lualine.nvim",
config = function()
local enable_web_dev_icons = vim.g.enable_web_dev_icons ~= 0
local lualine_custom_theme = require("lualine.themes.auto")
lualine_custom_theme.normal.c.bg = "none"
require("lualine").setup({
options = {
icons_enabled = enable_web_dev_icons,
theme = lualine_custom_theme,
component_separators = "|",
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = {
function()
return vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
end,
},
lualine_z = { "progress", "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {},
})
end,
},
{ "nvim-tree/nvim-web-devicons" },
{ "nvim-mini/mini.icons", version = false },
{
"j-hui/fidget.nvim",
main = "fidget",
opts = {},
},
{
"romgrk/barbar.nvim",
version = "^1.0.0",
dependencies = {
"nvim-tree/nvim-web-devicons", -- for file icons
"lewis6991/gitsigns.nvim", -- optional for git status
},
init = function()
vim.g.barbar_auto_setup = false
end,
config = function()
require("barbar").setup({
-- Enable/disable animations
animation = true,
-- Enable/disable auto-hiding the tab bar when there is a single buffer
auto_hide = true,
-- Enable/disable current/total tabpages indicator (top right corner)
tabpages = true,
-- Enables/disable clickable tabs
clickable = true,
-- Configure icons on the bufferline
icons = {
-- Configure the base icons on the bufferline
buffer_index = false,
buffer_number = false,
button = "", -- Empty string disables close button
-- Enables / disables diagnostic symbols
diagnostics = {
[vim.diagnostic.severity.ERROR] = { enabled = true },
[vim.diagnostic.severity.WARN] = { enabled = true },
[vim.diagnostic.severity.INFO] = { enabled = false },
[vim.diagnostic.severity.HINT] = { enabled = false },
},
gitsigns = {
added = { enabled = true, icon = "+" },
changed = { enabled = true, icon = "~" },
deleted = { enabled = true, icon = "-" },
},
filetype = {
-- Sets the icon's highlight group.
-- If false, will use nvim-web-devicons colors
custom_colors = false,
-- Requires `nvim-web-devicons` if `true`
enabled = false,
},
separator = { left = "▎", right = "" },
-- Configure the icons on the bufferline when modified
modified = { button = "" },
-- Configure the icons on the bufferline based on the visibility of a buffer
pinned = { button = "📌" },
-- Configure the icons on the bufferline for various kinds of tabs
preset = "default",
-- Configure the icons on the bufferline for alternate layout
alternate = { filetype = { enabled = false } },
-- Configure the icons on the bufferline when the buffer is currently active
current = { buffer_index = false },
-- Configure the icons on the bufferline for inactive tabs
-- inactive = { button = "×" },
inactive = {},
-- Configure the icons on the bufferline for visible tabs
visible = { modified = { buffer_number = false } },
},
-- If true, new buffers will be inserted at the start/end of the list.
-- Default is to insert after current buffer.
insert_at_end = false,
insert_at_start = false,
-- Sets the maximum padding width with which to surround each tab
maximum_padding = 1,
-- Sets the minimum padding width with which to surround each tab
minimum_padding = 1,
-- Sets the maximum buffer name length
maximum_length = 30,
-- Sets the minimum buffer name length
minimum_length = 0,
-- If set, the letters for each buffer in buffer-pick mode will be
-- assigned based on their name. Otherwise or in case all letters are
-- already assigned, the behavior is to assign letters in order of
-- usability (see order below)
semantic_letters = true,
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
-- where X is the buffer number. But only a static string is accepted here.
no_name_title = nil,
-- Set the filetypes which barbar will offset itself for
sidebar_filetypes = {
NvimTree = { text = "Files", align = "left" },
},
})
-- Buffer navigation with <Leader> + number
for i = 1, 8 do
vim.keymap.set("n", "<Leader>" .. i, ":BufferGoto " .. i .. "<CR>")
end
vim.keymap.set("n", "<Leader>9", ":BufferLast<CR>", { desc = "Go to last buffer" })
vim.keymap.set("n", "<Leader>]", ":BufferNext<CR>")
vim.keymap.set("n", "<Leader>[", ":BufferPrevious<CR>")
-- vim.keymap.set("n", "<A-<>", ":BufferMovePrevious<CR>")
-- vim.keymap.set("n", "<A->>", ":BufferMoveNext<CR>")
-- vim.keymap.set("n", "<A-p>", ":BufferPin<CR>")
vim.keymap.set("n", "<Leader>x", ":BufferClose<CR>", { desc = "Close buffer" })
vim.keymap.set("n", "<Leader>X", ":BufferCloseAllButCurrent<CR>", { desc = "Close other buffers" })
end,
},
{ "fweep/vim-zsh-path-completion" },
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFindFile" },
keys = {
{ "<Leader>/", ":NvimTreeToggle .<CR>", desc = "Toggle file tree" },
{ "<Leader>?", ":NvimTreeFindFile<CR>", desc = "Find current file in tree" },
},
config = function()
vim.g.enable_web_dev_icons = true
local enable_web_dev_icons = vim.g.enable_web_dev_icons ~= 0
require("nvim-tree").setup({
actions = {
open_file = {
window_picker = {
enable = false,
},
},
},
renderer = {
highlight_git = true,
root_folder_label = false, -- Set to false to hide the root folder name, or a function to customize display
icons = {
show = {
file = enable_web_dev_icons,
folder = enable_web_dev_icons,
folder_arrow = enable_web_dev_icons,
git = false,
},
},
-- special_files = {},
},
view = {
-- signcolumn = 'no',
},
})
end,
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
config = function()
require("notify").setup({
background_colour = "#000000",
})
local noice = require("noice")
noice.setup({
messages = {
view = "mini",
view_error = "mini", -- view for errors
view_warn = "mini", -- view for warnings
view_search = false,
},
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
-- bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
routes = {
-- <C-g> buffer path → mini view, kept visible for 10s.
-- Must come first so it wins (and stops) before the generic
-- notify route below; route opts.timeout sets autohide.
{
view = "cmdline_popup",
filter = {
event = "notify",
cond = function(m)
return m.opts ~= nil and m.opts.buffer_path == true
end,
},
opts = { timeout = 10000 },
},
{ view = "mini", filter = { event = "notify", find = "^Register" } },
-- 1) all normal Vim messages → mini
-- { filter = { event = "msg_show" }, view = "mini" },
-- 2) mode/recording messages → mini
-- { filter = { event = "msg_showmode" }, view = "mini" },
-- 3) anything sent via vim.notify() → mini
{ filter = { event = "notify" }, view = "mini" },
-- 4) LSP progress to mini (leave hover/signature in their own views)
-- { filter = { event = "lsp", kind = "progress" }, view = "mini" },
},
})
vim.api.nvim_create_autocmd("RecordingEnter", {
group = vim.api.nvim_create_augroup("NoiceMacroNotification", { clear = true }),
callback = function()
_MACRO_RECORDING_STATUS = true
noice.notify(string.format("Register: %s", vim.fn.reg_recording()), vim.log.levels.INFO, {
title = "Recording macro",
view = "mini",
keep = function()
return _MACRO_RECORDING_STATUS
end,
})
end,
})
vim.api.nvim_create_autocmd("RecordingLeave", {
group = vim.api.nvim_create_augroup("NoiceMacroNotificationDismiss", { clear = true }),
callback = function()
_MACRO_RECORDING_STATUS = false
noice.notify(string.format("Register: %s", vim.fn.reg_recording()), vim.log.levels.INFO, {
title = "Saved macro",
view = "mini",
timeout = 2000,
})
end,
})
-- setup :Noice dismiss
vim.keymap.set("n", "<Leader>nd", ":Noice dismiss<CR>", { desc = "Dismiss notifications" })
-- <C-g>: show full buffer path. Emit a notify (instead of the native
-- msg_show) so noice's msg_show dedup can't drop repeated presses, and
-- tag it so the route below sends it to the mini view with a long timeout.
vim.keymap.set("n", "<C-g>", function()
local path = vim.fn.expand("%:p")
if path == "" then
path = "[No Name]"
end
vim.notify(path, vim.log.levels.INFO, { buffer_path = true })
end, { desc = "Show full buffer path" })
end,
},
-- Inlay hints are toggled natively via <Leader>dh (see init.lua); the
-- MysticalDevil/inlay-hints.nvim plugin is no longer needed on 0.10+.
}
|