mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
NVIM
- Plugin file names changed - Plugins reorged into files more logically
This commit is contained in:
293
common/.config/nvim/lua/plugins/ui.lua
Normal file
293
common/.config/nvim/lua/plugins/ui.lua
Normal file
@@ -0,0 +1,293 @@
|
||||
return {
|
||||
-- icons
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
|
||||
-- ui components
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
|
||||
-- Better vim.ui
|
||||
{ "stevearc/dressing.nvim" },
|
||||
|
||||
{ "machakann/vim-highlightedyank" },
|
||||
|
||||
-- colorscheme
|
||||
{
|
||||
"projekt0n/github-nvim-theme",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd("colorscheme github_dark_dimmed")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Show buffers like VS Code tabs
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = {
|
||||
{ "echasnovski/mini.bufremove", version = "*" },
|
||||
},
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle buffer-pin" },
|
||||
{ "<leader>xo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete other buffers" },
|
||||
{ "[b", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev buffer" },
|
||||
{ "]b", "<cmd>BufferLineCycleNext<cr>", desc = "Next buffer" },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
close_command = function(n)
|
||||
require("mini.bufremove").delete(n, false)
|
||||
end,
|
||||
right_mouse_command = function(n)
|
||||
require("mini.bufremove").delete(n, false)
|
||||
end,
|
||||
diagnostics = "nvim_lsp",
|
||||
always_show_bufferline = false,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "Neo-tree",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("bufferline").setup(opts)
|
||||
-- Fix bufferline when restoring a session
|
||||
vim.api.nvim_create_autocmd("BufAdd", {
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
pcall(nvim_bufferline)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Better `vim.notify()`
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
keys = {
|
||||
{
|
||||
"<leader>xn",
|
||||
function()
|
||||
require("notify").dismiss({ silent = true, pending = true })
|
||||
end,
|
||||
desc = "Dismiss all Notifications",
|
||||
},
|
||||
{
|
||||
"<leader>xx",
|
||||
function()
|
||||
require("notify").dismiss({ silent = true, pending = true })
|
||||
end,
|
||||
desc = "Dismiss all Notifications",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
render = "wrapped-compact", -- Smaller popups
|
||||
timeout = 2500,
|
||||
max_height = function()
|
||||
return math.floor(vim.o.lines * 0.25)
|
||||
end,
|
||||
max_width = function()
|
||||
return math.floor(vim.o.columns * 0.5)
|
||||
end,
|
||||
on_open = function(win)
|
||||
vim.api.nvim_win_set_config(win, { zindex = 100 })
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- Completely replaces the UI for messages, cmdline and the popupmenu.
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
progress = {
|
||||
throttle = 1000 / 100,
|
||||
},
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
hover = {
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
-- Show popup message when @recording macros
|
||||
view = "notify",
|
||||
filter = { event = "msg_showmode" },
|
||||
},
|
||||
{
|
||||
filter = { event = "notify", find = "No information available" },
|
||||
opts = { skin = true },
|
||||
},
|
||||
{
|
||||
-- Direct some messages to bottom - obove lualine
|
||||
view = "mini",
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
any = {
|
||||
{ find = "%d+L, %d+B" },
|
||||
{ find = "; after #%d+" },
|
||||
{ find = "; before #%d+" },
|
||||
|
||||
-- Display delete, yank, jump notifications at bottom
|
||||
{ find = "yanked" },
|
||||
{ find = "fewer lines" },
|
||||
{ find = "more lines" },
|
||||
{ find = "EasyMotion" },
|
||||
{ find = "Target key" },
|
||||
{ find = "search hit BOTTOM" },
|
||||
{ find = "lines to indent" },
|
||||
{ find = "lines indented" },
|
||||
{ find = "lines changed" },
|
||||
{ find = ">ed" },
|
||||
{ find = "<ed" },
|
||||
{ find = "The only match" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
lsp_doc_border = true,
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Set lualine as statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
init = function()
|
||||
vim.g.lualine_laststatus = vim.o.laststatus
|
||||
if vim.fn.argc(-1) > 0 then
|
||||
-- set an empty statusline till lualine loads
|
||||
vim.o.statusline = " "
|
||||
else
|
||||
-- hide the statusline on the starter page
|
||||
vim.o.laststatus = 0
|
||||
end
|
||||
end,
|
||||
opts = function()
|
||||
local lualine_require = require("lualine_require")
|
||||
lualine_require.require = require
|
||||
vim.o.laststatus = vim.g.lualine_laststatus
|
||||
|
||||
local config = require("config.util")
|
||||
|
||||
return {
|
||||
options = {
|
||||
theme = "auto",
|
||||
icons_enabled = true,
|
||||
globalstatus = true,
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
extensions = { "neo-tree", "lazy" },
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
|
||||
lualine_c = {
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = config.icons.diagnostics.Error,
|
||||
warn = config.icons.diagnostics.Warn,
|
||||
info = config.icons.diagnostics.Info,
|
||||
hint = config.icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{
|
||||
"filename",
|
||||
file_status = true,
|
||||
path = 1,
|
||||
},
|
||||
-- Breadcrumbs from "nvim-navic" plugin
|
||||
{
|
||||
function()
|
||||
return require("nvim-navic").get_location()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
lualine_x = {
|
||||
{
|
||||
function()
|
||||
return require("noice").api.status.command.get()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["noice"] and require("noice").api.status.command.has()
|
||||
end,
|
||||
color = config.fg("Statement"),
|
||||
},
|
||||
{
|
||||
function()
|
||||
return require("noice").api.status.mode.get()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["noice"] and require("noice").api.status.mode.has()
|
||||
end,
|
||||
color = config.fg("Constant"),
|
||||
},
|
||||
{
|
||||
function()
|
||||
return " " .. require("dap").status()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["dap"] and require("dap").status() ~= ""
|
||||
end,
|
||||
color = config.fg("Debug"),
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = config.icons.git.added,
|
||||
modified = config.icons.git.modified,
|
||||
removed = config.icons.git.removed,
|
||||
},
|
||||
source = function()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
lualine_y = {
|
||||
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||
{ "location", padding = { left = 0, right = 1 } },
|
||||
},
|
||||
lualine_z = {
|
||||
function()
|
||||
return " " .. os.date("%R")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user