mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 16:41:43 +05:30
feat(neovim): Replace lualine with mini.statusline & move all mini.nvim
plugins to `utility-plugs` - Switched for easier configuration & reduction in number of plugins - `mini.nvim` now does way too many things to be in `code-generic`
This commit is contained in:
@@ -9,74 +9,6 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- mini.nvim: Collection of various small independent plugins/modules
|
||||
{
|
||||
"echasnovski/mini.nvim",
|
||||
version = false,
|
||||
config = function()
|
||||
-- gc
|
||||
require("mini.comment").setup()
|
||||
|
||||
require("mini.pairs").setup()
|
||||
|
||||
-- mini.ai
|
||||
-- va) - [v]isually select [a]round [)]paren
|
||||
-- - a) would implicitly select around another ), based on some predefined logic
|
||||
-- ci' - [c]hange [i]nside [']quote
|
||||
-- via - [a]rguments
|
||||
-- vif - [f]unction calls
|
||||
-- va_ - select around "_"
|
||||
-- va1 - select around two "1"
|
||||
--
|
||||
-- explicit covering region:
|
||||
-- vinq - select [i]nside [n]ext [q]uote
|
||||
-- vilb - select inside last bracket
|
||||
-- cina - change next function argument
|
||||
-- cila - change last function argument
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- mini.surround
|
||||
-- functionality similar to tpope's vim-surround
|
||||
require("mini.surround").setup({
|
||||
mappings = {
|
||||
add = "ys", -- add surrounding in normal and visual modes
|
||||
delete = "ds", -- delete surrounding
|
||||
find = "yf", -- find surrounding (to the right)
|
||||
find_left = "yf", -- find surrounding (to the left)
|
||||
highlight = "yh", -- highlight surrounding
|
||||
replace = "cs", -- replace surrounding
|
||||
update_n_lines = "", -- update `n_lines`
|
||||
},
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- configure mini.indentscope
|
||||
if require("config.util").is_not_vscode() then
|
||||
require("mini.indentscope").setup({
|
||||
delay = 100,
|
||||
symbol = "│",
|
||||
options = { try_as_border = true },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"help",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
},
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
|
||||
@@ -193,118 +193,6 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- Set lualine as statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
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",
|
||||
{
|
||||
"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_c = {
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = config.icons.diagnostics.ERROR,
|
||||
warn = config.icons.diagnostics.WARN,
|
||||
info = config.icons.diagnostics.INFO,
|
||||
hint = config.icons.diagnostics.HINT,
|
||||
},
|
||||
},
|
||||
{
|
||||
function()
|
||||
return " " .. require("dap").status()
|
||||
end,
|
||||
cond = function()
|
||||
return package.loaded["dap"] and require("dap").status() ~= ""
|
||||
end,
|
||||
color = config.fg("Debug"),
|
||||
},
|
||||
},
|
||||
|
||||
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"),
|
||||
},
|
||||
},
|
||||
|
||||
lualine_y = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true,
|
||||
path = 1,
|
||||
},
|
||||
{ "filetype", padding = { left = 1, right = 1 } },
|
||||
},
|
||||
lualine_z = {
|
||||
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||
{ "location", padding = { left = 0, right = 1 } },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Indent guides for Neovim
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
|
||||
@@ -1,4 +1,111 @@
|
||||
return {
|
||||
|
||||
-- mini.nvim: Collection of various small independent plugins/modules
|
||||
{
|
||||
"echasnovski/mini.nvim",
|
||||
version = false,
|
||||
config = function()
|
||||
-- gc
|
||||
require("mini.comment").setup()
|
||||
|
||||
require("mini.pairs").setup()
|
||||
|
||||
-- mini.ai
|
||||
-- va) - [v]isually select [a]round [)]paren
|
||||
-- - a) would implicitly select around another ), based on some predefined logic
|
||||
-- ci' - [c]hange [i]nside [']quote
|
||||
-- via - [a]rguments
|
||||
-- vif - [f]unction calls
|
||||
-- va_ - select around "_"
|
||||
-- va1 - select around two "1"
|
||||
--
|
||||
-- explicit covering region:
|
||||
-- vinq - select [i]nside [n]ext [q]uote
|
||||
-- vilb - select inside last bracket
|
||||
-- cina - change next function argument
|
||||
-- cila - change last function argument
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- mini.surround
|
||||
-- functionality similar to tpope's vim-surround
|
||||
require("mini.surround").setup({
|
||||
mappings = {
|
||||
add = "ys", -- add surrounding in normal and visual modes
|
||||
delete = "ds", -- delete surrounding
|
||||
find = "yf", -- find surrounding (to the right)
|
||||
find_left = "yf", -- find surrounding (to the left)
|
||||
highlight = "yh", -- highlight surrounding
|
||||
replace = "cs", -- replace surrounding
|
||||
update_n_lines = "", -- update `n_lines`
|
||||
},
|
||||
silent = true,
|
||||
})
|
||||
|
||||
local statusline = require("mini.statusline")
|
||||
statusline.setup({
|
||||
use_icons = vim.g.have_nerd_font,
|
||||
content = {
|
||||
active = function()
|
||||
local config = require("config.util")
|
||||
|
||||
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
|
||||
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
||||
local diff = MiniStatusline.section_diff({
|
||||
trunc_width = 75,
|
||||
icon = config.icons.git.modified,
|
||||
})
|
||||
local diagnostics = MiniStatusline.section_diagnostics({
|
||||
trunc_width = 75,
|
||||
signs = config.icons.diagnostics,
|
||||
})
|
||||
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
|
||||
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
||||
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 40 })
|
||||
local search = MiniStatusline.section_searchcount({ trunc_width = 40 })
|
||||
local location = MiniStatusline.section_location({ trunc_width = 75 })
|
||||
|
||||
-- Mode | Branch, diff | Diagnostics | ... | FileType | FileName | Rows/Columns
|
||||
return MiniStatusline.combine_groups({
|
||||
{ hl = mode_hl, strings = { mode } },
|
||||
{ hl = "MiniStatuslineDevinfo", strings = { git, diff } },
|
||||
{ hl = mode, strings = { diagnostics } },
|
||||
"%<", -- Mark general truncate point
|
||||
"%=", -- End left alignment
|
||||
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
||||
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
|
||||
{ hl = mode_hl, strings = { search, location } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- configure mini.indentscope
|
||||
if require("config.util").is_not_vscode() then
|
||||
require("mini.indentscope").setup({
|
||||
delay = 100,
|
||||
symbol = "│",
|
||||
options = { try_as_border = true },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"help",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
},
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Various Quality of Life plugins into one
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
|
||||
Reference in New Issue
Block a user