refactor: restructure core modules into config directory for better organization
This commit is contained in:
29 files changed
+1751
-1924
No files matched your search
+72
-54
@@ -1,62 +1,80 @@
|
||||
return {
|
||||
'echasnovski/mini.nvim',
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
require('mini.ai').setup() -- Extend and create a/i textobjects
|
||||
require('mini.pairs').setup() -- Autopairs
|
||||
require('mini.icons').setup() -- Icons
|
||||
require('mini.bracketed').setup() -- Go forward/backward with square brackets
|
||||
require('mini.tabline').setup() -- Tabline
|
||||
require('mini.files').setup() -- Files
|
||||
require("mini.ai").setup() -- Extend and create a/i textobjects
|
||||
require("mini.pairs").setup() -- Autopairs
|
||||
require("mini.icons").setup() -- Icons
|
||||
require("mini.bracketed").setup() -- Go forward/backward with square brackets
|
||||
require("mini.tabline").setup() -- Tabline
|
||||
|
||||
require('mini.misc').setup({
|
||||
-- File explorer
|
||||
require("mini.files").setup({
|
||||
mappings = {
|
||||
close = "q",
|
||||
go_in = "L",
|
||||
go_in_plus = "l",
|
||||
go_out = "h",
|
||||
go_out_plus = "H",
|
||||
mark_goto = "'",
|
||||
mark_set = "m",
|
||||
reset = "<BS>",
|
||||
reveal_cwd = "@",
|
||||
show_help = "g?",
|
||||
synchronize = "<CR>",
|
||||
trim_left = "<",
|
||||
trim_right = ">",
|
||||
},
|
||||
})
|
||||
|
||||
require("mini.misc").setup({
|
||||
-- restore cursor position on file reopen
|
||||
require('mini.misc').setup_restore_cursor(),
|
||||
require("mini.misc").setup_restore_cursor(),
|
||||
-- automated change of current directory
|
||||
require('mini.misc').setup_auto_root(),
|
||||
require("mini.misc").setup_auto_root(),
|
||||
})
|
||||
|
||||
-- splitjoin
|
||||
require('mini.splitjoin').setup({
|
||||
require("mini.splitjoin").setup({
|
||||
mappings = {
|
||||
toggle = '<leader>tj',
|
||||
split = '',
|
||||
join = '',
|
||||
toggle = "<leader>tj",
|
||||
split = "",
|
||||
join = "",
|
||||
},
|
||||
})
|
||||
|
||||
-- surround action
|
||||
require('mini.surround').setup({
|
||||
require("mini.surround").setup({
|
||||
mappings = {
|
||||
add = 'msa',
|
||||
delete = 'msd',
|
||||
find = 'msf',
|
||||
find_left = 'msF',
|
||||
highlight = 'msh',
|
||||
replace = 'msr',
|
||||
update_n_lines = 'msn',
|
||||
add = "msa",
|
||||
delete = "msd",
|
||||
find = "msf",
|
||||
find_left = "msF",
|
||||
highlight = "msh",
|
||||
replace = "msr",
|
||||
update_n_lines = "msn",
|
||||
|
||||
suffix_last = 'l',
|
||||
suffix_next = 'n',
|
||||
suffix_last = "l",
|
||||
suffix_next = "n",
|
||||
},
|
||||
})
|
||||
|
||||
-- indents
|
||||
require('mini.indentscope').setup({
|
||||
draw = { animation = require('mini.indentscope').gen_animation.linear({ ease = 'out', duration = 15 }) },
|
||||
options = { border = 'top', try_as_border = true, indent_at_cursor = false },
|
||||
require("mini.indentscope").setup({
|
||||
draw = { 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 = '*',
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
if vim.bo[args.buf].buftype ~= '' then
|
||||
if vim.bo[args.buf].buftype ~= "" then
|
||||
vim.b[args.buf].miniindentscope_disable = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- statusline
|
||||
require('mini.statusline').setup({
|
||||
require("mini.statusline").setup({
|
||||
use_icons = true,
|
||||
content = {
|
||||
active = function()
|
||||
@@ -70,51 +88,51 @@ return {
|
||||
local function section_filetype(args)
|
||||
if
|
||||
MiniStatusline.is_truncated(args.trunc_width)
|
||||
or vim.bo.filetype == ''
|
||||
or vim.bo.buftype ~= ''
|
||||
or vim.bo.filetype == ""
|
||||
or vim.bo.buftype ~= ""
|
||||
then
|
||||
return ''
|
||||
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)
|
||||
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 ''
|
||||
return ""
|
||||
end
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
if not clients or #clients == 0 then
|
||||
return ''
|
||||
return ""
|
||||
end
|
||||
local names = vim.tbl_map(function(c)
|
||||
return c.name
|
||||
end, clients)
|
||||
return string.format(' %s', table.concat(names, ', '))
|
||||
return string.format(" %s", table.concat(names, ", "))
|
||||
end
|
||||
|
||||
local function section_searchcount(args)
|
||||
if vim.v.hlsearch == 0 then
|
||||
return ''
|
||||
return ""
|
||||
end
|
||||
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
|
||||
if not ok or s.current == nil or s.total == 0 then
|
||||
return ''
|
||||
return ""
|
||||
end
|
||||
local icon = MiniStatusline.is_truncated(args.trunc_width) and '' or ' '
|
||||
local icon = MiniStatusline.is_truncated(args.trunc_width) and "" or " "
|
||||
if s.incomplete == 1 then
|
||||
return icon .. '?/?│'
|
||||
return icon .. "?/?│"
|
||||
end
|
||||
local fmt = '>%d'
|
||||
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)
|
||||
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'
|
||||
return MiniStatusline.is_truncated(args.trunc_width) and "%-2l│%-2v"
|
||||
or " %-2l│ %-2v"
|
||||
end
|
||||
|
||||
local filetype = section_filetype({ trunc_width = 70 })
|
||||
@@ -124,18 +142,18 @@ return {
|
||||
|
||||
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 = "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') } },
|
||||
{ hl = "MiniStatuslineInactive", strings = { vim.fn.expand("%:t") } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user