refactor(editor): consolidate mini.nvim plugins and remove unused editor plugins
This commit is contained in:
6 files changed
+198
-180
No files matched your search
+56
-116
@@ -1,64 +1,4 @@
|
||||
return {
|
||||
-- surround actions
|
||||
{
|
||||
'nvim-mini/mini.surround',
|
||||
version = '*',
|
||||
config = function()
|
||||
require('mini.surround').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- indent guides
|
||||
{
|
||||
'nvim-mini/mini.indentscope',
|
||||
event = 'VeryLazy',
|
||||
config = function()
|
||||
require('mini.indentscope').setup({
|
||||
draw = {
|
||||
delay = 50,
|
||||
animation = require('mini.indentscope').gen_animation.linear({
|
||||
ease = 'out',
|
||||
duration = 15,
|
||||
}),
|
||||
},
|
||||
options = {
|
||||
border = 'top',
|
||||
try_as_border = true,
|
||||
indent_at_cursor = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- disable for certain filetypes
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
pattern = '*',
|
||||
callback = function(args)
|
||||
if vim.bo[args.buf].buftype ~= '' then
|
||||
vim.b[args.buf].miniindentscope_disable = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Go forward/backward with square brackets
|
||||
{
|
||||
'echasnovski/mini.bracketed',
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
config = function()
|
||||
require('mini.bracketed').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- textobjects
|
||||
{
|
||||
'nvim-mini/mini.ai',
|
||||
version = '*',
|
||||
config = function()
|
||||
require('mini.ai').setup({
|
||||
silent = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Dimming the highlights of unused functions, variables, parameters, and more.
|
||||
{
|
||||
@@ -85,62 +25,62 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
version = false,
|
||||
dependencies = {
|
||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
},
|
||||
config = function()
|
||||
require('Comment').setup({
|
||||
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
'gcc',
|
||||
mode = 'n',
|
||||
desc = 'Toggle comment line',
|
||||
},
|
||||
{
|
||||
'gc',
|
||||
mode = { 'n', 'o' },
|
||||
desc = 'Toggle comment linewise',
|
||||
},
|
||||
{
|
||||
'gc',
|
||||
mode = 'x',
|
||||
desc = 'Toggle comment linewise (visual)',
|
||||
},
|
||||
{
|
||||
'gbc',
|
||||
mode = 'n',
|
||||
desc = 'Toggle comment block',
|
||||
},
|
||||
{
|
||||
'gb',
|
||||
mode = { 'n', 'o' },
|
||||
desc = 'Toggle comment blockwise',
|
||||
},
|
||||
{
|
||||
'gb',
|
||||
mode = 'x',
|
||||
desc = 'Toggle comment blockwise (visual)',
|
||||
},
|
||||
{ '<leader>/', "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", desc = 'Toggle comment' },
|
||||
{
|
||||
'<leader>/',
|
||||
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||
desc = 'Toggle comment',
|
||||
mode = 'v',
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
-- {
|
||||
-- 'numToStr/Comment.nvim',
|
||||
-- version = false,
|
||||
-- dependencies = {
|
||||
-- 'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require('Comment').setup({
|
||||
-- pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
|
||||
-- mappings = {
|
||||
-- basic = true,
|
||||
-- extra = true,
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- keys = {
|
||||
-- {
|
||||
-- 'gcc',
|
||||
-- mode = 'n',
|
||||
-- desc = 'Toggle comment line',
|
||||
-- },
|
||||
-- {
|
||||
-- 'gc',
|
||||
-- mode = { 'n', 'o' },
|
||||
-- desc = 'Toggle comment linewise',
|
||||
-- },
|
||||
-- {
|
||||
-- 'gc',
|
||||
-- mode = 'x',
|
||||
-- desc = 'Toggle comment linewise (visual)',
|
||||
-- },
|
||||
-- {
|
||||
-- 'gbc',
|
||||
-- mode = 'n',
|
||||
-- desc = 'Toggle comment block',
|
||||
-- },
|
||||
-- {
|
||||
-- 'gb',
|
||||
-- mode = { 'n', 'o' },
|
||||
-- desc = 'Toggle comment blockwise',
|
||||
-- },
|
||||
-- {
|
||||
-- 'gb',
|
||||
-- mode = 'x',
|
||||
-- desc = 'Toggle comment blockwise (visual)',
|
||||
-- },
|
||||
-- { '<leader>/', "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", desc = 'Toggle comment' },
|
||||
-- {
|
||||
-- '<leader>/',
|
||||
-- "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||
-- desc = 'Toggle comment',
|
||||
-- mode = 'v',
|
||||
-- },
|
||||
-- },
|
||||
-- opts = {},
|
||||
-- },
|
||||
|
||||
-- Todo Comments
|
||||
{
|
||||
|
||||
@@ -87,10 +87,10 @@ return {
|
||||
-- auto pairs
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
enabled = false,
|
||||
event = 'InsertEnter',
|
||||
config = function()
|
||||
local npairs = require('nvim-autopairs')
|
||||
local Rule = require('nvim-autopairs.rule')
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
@@ -99,13 +99,6 @@ return {
|
||||
map_cr = true,
|
||||
map_bs = true,
|
||||
})
|
||||
|
||||
npairs.add_rules({
|
||||
Rule(' ', ' '):with_pair(function(opts)
|
||||
local pair = opts.line:sub(opts.col - 1, opts.col)
|
||||
return vim.tbl_contains({ '()', '[]', '{}', '""', "''", '``' }, pair)
|
||||
end),
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
return {
|
||||
'echasnovski/mini.nvim',
|
||||
config = function()
|
||||
require('mini.ai').setup()
|
||||
require('mini.surround').setup()
|
||||
require('mini.pairs').setup()
|
||||
require('mini.icons').setup()
|
||||
require('mini.bracketed').setup()
|
||||
require('mini.tabline').setup()
|
||||
require('mini.indentscope').setup({
|
||||
draw = {
|
||||
delay = 50,
|
||||
animation = require('mini.indentscope').gen_animation.linear({ ease = 'out', duration = 15 }),
|
||||
},
|
||||
options = { border = 'top', try_as_border = true, indent_at_cursor = false },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
pattern = '*',
|
||||
callback = function(args)
|
||||
if vim.bo[args.buf].buftype ~= '' then
|
||||
vim.b[args.buf].miniindentscope_disable = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require('mini.comment').setup({
|
||||
options = {
|
||||
custom_commentstring = function()
|
||||
return require('ts_context_commentstring').calculate_commentstring() or vim.bo.commentstring
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
require('mini.statusline').setup({
|
||||
use_icons = true,
|
||||
content = {
|
||||
active = function()
|
||||
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 = 80 })
|
||||
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 60 })
|
||||
local lsp = MiniStatusline.section_lsp({ trunc_width = 40 })
|
||||
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
||||
|
||||
local function section_filetype(args)
|
||||
if
|
||||
MiniStatusline.is_truncated(args.trunc_width)
|
||||
or vim.bo.filetype == ''
|
||||
or vim.bo.buftype ~= ''
|
||||
then
|
||||
return ''
|
||||
end
|
||||
local ok, icons = pcall(require, 'mini.icons')
|
||||
local icon = ok and select(1, icons.get('filetype', vim.bo.filetype)) or ''
|
||||
return string.format('%s %s│', icon, vim.bo.filetype)
|
||||
end
|
||||
|
||||
local function section_lsp_clients(args)
|
||||
if MiniStatusline.is_truncated(args.trunc_width) then
|
||||
return ''
|
||||
end
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
if not clients or #clients == 0 then
|
||||
return ''
|
||||
end
|
||||
local names = vim.tbl_map(function(c)
|
||||
return c.name
|
||||
end, clients)
|
||||
return string.format(' %s', table.concat(names, ', '))
|
||||
end
|
||||
|
||||
local function section_searchcount(args)
|
||||
if vim.v.hlsearch == 0 then
|
||||
return ''
|
||||
end
|
||||
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
|
||||
if not ok or s.current == nil or s.total == 0 then
|
||||
return ''
|
||||
end
|
||||
local icon = MiniStatusline.is_truncated(args.trunc_width) and '' or ' '
|
||||
if s.incomplete == 1 then
|
||||
return icon .. '?/?│'
|
||||
end
|
||||
local fmt = '>%d'
|
||||
local cur = s.current > s.maxcount and fmt:format(s.maxcount) or s.current
|
||||
local tot = s.total > s.maxcount and fmt:format(s.maxcount) or s.total
|
||||
return ('%s%s/%s│'):format(icon, cur, tot)
|
||||
end
|
||||
|
||||
local function section_location(args)
|
||||
return MiniStatusline.is_truncated(args.trunc_width) and '%-2l│%-2v'
|
||||
or ' %-2l│ %-2v'
|
||||
end
|
||||
|
||||
local filetype = section_filetype({ trunc_width = 70 })
|
||||
local searchcount = section_searchcount({ trunc_width = 80 })
|
||||
local loc = section_location({ trunc_width = 120 })
|
||||
local lsp_clients = section_lsp_clients({ trunc_width = 60 })
|
||||
|
||||
return MiniStatusline.combine_groups({
|
||||
{ hl = mode_hl, strings = { mode:upper() } },
|
||||
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
|
||||
'%<',
|
||||
{ hl = 'MiniStatuslineFilename', strings = { filename } },
|
||||
'%=',
|
||||
{ hl = 'MiniStatuslineDevinfo', strings = { lsp_clients } },
|
||||
{ hl = mode_hl, strings = { filetype, searchcount, loc } },
|
||||
})
|
||||
end,
|
||||
|
||||
inactive = function()
|
||||
return MiniStatusline.combine_groups({
|
||||
{ hl = 'MiniStatuslineInactive', strings = { vim.fn.expand('%:t') } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
return {
|
||||
{
|
||||
'sschleemilch/slimline.nvim',
|
||||
opts = {
|
||||
style = 'bg',
|
||||
bold = true,
|
||||
spaces = {
|
||||
components = '',
|
||||
left = '',
|
||||
right = '',
|
||||
},
|
||||
sep = {
|
||||
hide = {
|
||||
first = true,
|
||||
last = true,
|
||||
},
|
||||
left = '',
|
||||
right = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
opts = {
|
||||
options = {
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
},
|
||||
},
|
||||
vim.api.nvim_set_hl(0, 'BufferLineFill', { bg = 'None' }),
|
||||
},
|
||||
}
|
||||
+19
-15
@@ -1,11 +1,15 @@
|
||||
return {
|
||||
|
||||
{
|
||||
'nvim-mini/mini.icons',
|
||||
lazy = true,
|
||||
opts = {},
|
||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
opts = { enable_autocmd = false },
|
||||
ft = {
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
},
|
||||
keys = { { 'gc', mode = { 'n', 'x' } }, { 'gbc', mode = { 'n', 'x' } } },
|
||||
},
|
||||
|
||||
--harpoon
|
||||
{
|
||||
'ThePrimeagen/harpoon',
|
||||
@@ -92,7 +96,7 @@ return {
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
border = 'curved', -- 'single', 'double', 'shadow', etc.
|
||||
winblend = 0, -- Set to 0 for full transparency
|
||||
winblend = 0, -- Set to 0 for full transparency
|
||||
highlights = {
|
||||
border = 'Normal',
|
||||
background = 'Normal',
|
||||
@@ -123,16 +127,16 @@ return {
|
||||
picker_integration = true,
|
||||
keymaps = {
|
||||
prefix = '<leader>u', -- Main prefix for uv commands
|
||||
commands = true, -- Show uv commands menu (<leader>x)
|
||||
run_file = true, -- Run current file (<leader>xr)
|
||||
commands = true, -- Show uv commands menu (<leader>x)
|
||||
run_file = true, -- Run current file (<leader>xr)
|
||||
run_selection = true, -- Run selected code (<leader>xs)
|
||||
run_function = true, -- Run function (<leader>xf)
|
||||
venv = true, -- Environment management (<leader>xe)
|
||||
init = true, -- Initialize uv project (<leader>xi)
|
||||
add = true, -- Add a package (<leader>xa)
|
||||
remove = true, -- Remove a package (<leader>xd)
|
||||
sync = true, -- Sync packages (<leader>xc)
|
||||
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
|
||||
run_function = true, -- Run function (<leader>xf)
|
||||
venv = true, -- Environment management (<leader>xe)
|
||||
init = true, -- Initialize uv project (<leader>xi)
|
||||
add = true, -- Add a package (<leader>xa)
|
||||
remove = true, -- Remove a package (<leader>xd)
|
||||
sync = true, -- Sync packages (<leader>xc)
|
||||
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user