refactor(plugin): use single quotes in require statements and fix minor style issues
Switch to single quotes for module requires and correct minor formatting inconsistencies across the plugin configuration.
This commit is contained in:
1 file changed
+123
-123
+123
-123
@@ -1,151 +1,151 @@
|
|||||||
add("echasnovski/mini.nvim")
|
add('echasnovski/mini.nvim')
|
||||||
|
|
||||||
require("mini.ai").setup() -- extend and create a/i textobjects
|
require('mini.ai').setup() -- extend and create a/i textobjects
|
||||||
require("mini.pairs").setup() -- autopairs
|
require('mini.pairs').setup() -- autopairs
|
||||||
require("mini.icons").setup() -- icons
|
require('mini.icons').setup() -- icons
|
||||||
require("mini.bracketed").setup() -- go forward/backward with square brackets
|
require('mini.bracketed').setup() -- go forward/backward with square brackets
|
||||||
|
|
||||||
-- File explorer
|
-- File explorer
|
||||||
require("mini.files").setup({
|
require('mini.files').setup({
|
||||||
mappings = {
|
mappings = {
|
||||||
close = "q",
|
close = 'q',
|
||||||
go_in = "L",
|
go_in = 'L',
|
||||||
go_in_plus = "l",
|
go_in_plus = 'l',
|
||||||
go_out = "h",
|
go_out = 'h',
|
||||||
go_out_plus = "H",
|
go_out_plus = 'H',
|
||||||
mark_goto = "'",
|
mark_goto = "'",
|
||||||
mark_set = "m",
|
mark_set = 'm',
|
||||||
reset = "<BS>",
|
reset = '<BS>',
|
||||||
reveal_cwd = "@",
|
reveal_cwd = '@',
|
||||||
show_help = "g?",
|
show_help = 'g?',
|
||||||
synchronize = "<CR>",
|
synchronize = '<CR>',
|
||||||
trim_left = "<",
|
trim_left = '<',
|
||||||
trim_right = ">",
|
trim_right = '>',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("mini.misc").setup({
|
require('mini.misc').setup({
|
||||||
-- automated change of current directory
|
-- automated change of current directory
|
||||||
require("mini.misc").setup_auto_root(),
|
require('mini.misc').setup_auto_root(),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- splitjoin
|
-- splitjoin
|
||||||
require("mini.splitjoin").setup({
|
require('mini.splitjoin').setup({
|
||||||
mappings = {
|
mappings = {
|
||||||
toggle = "<leader>tj",
|
toggle = '<leader>tj',
|
||||||
split = "",
|
split = '',
|
||||||
join = "",
|
join = '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- surround action
|
-- surround action
|
||||||
require("mini.surround").setup({
|
require('mini.surround').setup({
|
||||||
mappings = {
|
mappings = {
|
||||||
add = "msa",
|
add = 'msa',
|
||||||
delete = "msd",
|
delete = 'msd',
|
||||||
find = "msf",
|
find = 'msf',
|
||||||
find_left = "msF",
|
find_left = 'msF',
|
||||||
highlight = "msh",
|
highlight = 'msh',
|
||||||
replace = "msr",
|
replace = 'msr',
|
||||||
update_n_lines = "msn",
|
update_n_lines = 'msn',
|
||||||
|
|
||||||
suffix_last = "l",
|
suffix_last = 'l',
|
||||||
suffix_next = "n",
|
suffix_next = 'n',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- indents
|
-- indents
|
||||||
require("mini.indentscope").setup({
|
require('mini.indentscope').setup({
|
||||||
draw = { animation = require("mini.indentscope").gen_animation.linear({ ease = "out", duration = 15 }) },
|
draw = { animation = require('mini.indentscope').gen_animation.linear({ ease = 'out', duration = 15 }) },
|
||||||
options = { border = "top", try_as_border = true, indent_at_cursor = false },
|
options = { border = 'top', try_as_border = true, indent_at_cursor = false },
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufEnter", {
|
vim.api.nvim_create_autocmd('BufEnter', {
|
||||||
pattern = "*",
|
pattern = '*',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
if vim.bo[args.buf].buftype ~= "" then
|
if vim.bo[args.buf].buftype ~= '' then
|
||||||
vim.b[args.buf].miniindentscope_disable = true
|
vim.b[args.buf].miniindentscope_disable = true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- statusline
|
-- statusline
|
||||||
require("mini.statusline").setup({
|
require('mini.statusline').setup({
|
||||||
use_icons = true,
|
use_icons = true,
|
||||||
content = {
|
content = {
|
||||||
active = function()
|
active = function()
|
||||||
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
|
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
|
||||||
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
||||||
local diff = MiniStatusline.section_diff({ trunc_width = 80 })
|
local diff = MiniStatusline.section_diff({ trunc_width = 80 })
|
||||||
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 60 })
|
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 60 })
|
||||||
local lsp = MiniStatusline.section_lsp({ trunc_width = 40 })
|
local lsp = MiniStatusline.section_lsp({ trunc_width = 40 })
|
||||||
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
||||||
|
|
||||||
local function section_filetype(args)
|
local function section_filetype(args)
|
||||||
if MiniStatusline.is_truncated(args.trunc_width) or vim.bo.filetype == "" or vim.bo.buftype ~= "" then
|
if MiniStatusline.is_truncated(args.trunc_width) or vim.bo.filetype == '' or vim.bo.buftype ~= '' then
|
||||||
return ""
|
return ''
|
||||||
end
|
end
|
||||||
local ok, icons = pcall(require, "mini.icons")
|
local ok, icons = pcall(require, 'mini.icons')
|
||||||
local icon = ok and select(1, icons.get("filetype", vim.bo.filetype)) or ""
|
local icon = ok and select(1, icons.get('filetype', vim.bo.filetype)) or ''
|
||||||
return string.format("%s %s│", icon, vim.bo.filetype)
|
return string.format('%s %s│', icon, vim.bo.filetype)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function section_lsp_clients(args)
|
local function section_lsp_clients(args)
|
||||||
if MiniStatusline.is_truncated(args.trunc_width) then
|
if MiniStatusline.is_truncated(args.trunc_width) then
|
||||||
return ""
|
return ''
|
||||||
end
|
end
|
||||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||||
if not clients or #clients == 0 then
|
if not clients or #clients == 0 then
|
||||||
return ""
|
return ''
|
||||||
end
|
end
|
||||||
local names = vim.tbl_map(function(c)
|
local names = vim.tbl_map(function(c)
|
||||||
return c.name
|
return c.name
|
||||||
end, clients)
|
end, clients)
|
||||||
return string.format(" %s", table.concat(names, ", "))
|
return string.format(' %s', table.concat(names, ', '))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function section_searchcount(args)
|
local function section_searchcount(args)
|
||||||
if vim.v.hlsearch == 0 then
|
if vim.v.hlsearch == 0 then
|
||||||
return ""
|
return ''
|
||||||
end
|
end
|
||||||
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
|
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
|
||||||
if not ok or s.current == nil or s.total == 0 then
|
if not ok or s.current == nil or s.total == 0 then
|
||||||
return ""
|
return ''
|
||||||
end
|
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
|
if s.incomplete == 1 then
|
||||||
return icon .. "?/?│"
|
return icon .. '?/?│'
|
||||||
end
|
end
|
||||||
local fmt = ">%d"
|
local fmt = '>%d'
|
||||||
local cur = s.current > s.maxcount and fmt:format(s.maxcount) or s.current
|
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
|
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
|
end
|
||||||
|
|
||||||
local function section_location(args)
|
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
|
end
|
||||||
|
|
||||||
local filetype = section_filetype({ trunc_width = 70 })
|
local filetype = section_filetype({ trunc_width = 70 })
|
||||||
local searchcount = section_searchcount({ trunc_width = 80 })
|
local searchcount = section_searchcount({ trunc_width = 80 })
|
||||||
local loc = section_location({ trunc_width = 120 })
|
local loc = section_location({ trunc_width = 120 })
|
||||||
local lsp_clients = section_lsp_clients({ trunc_width = 60 })
|
local lsp_clients = section_lsp_clients({ trunc_width = 60 })
|
||||||
|
|
||||||
return MiniStatusline.combine_groups({
|
return MiniStatusline.combine_groups({
|
||||||
{ hl = mode_hl, strings = { mode:upper() } },
|
{ hl = mode_hl, strings = { mode:upper() } },
|
||||||
{ hl = "MiniStatuslineDevinfo", strings = { git, diff, diagnostics, lsp } },
|
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
|
||||||
"%<",
|
'%<',
|
||||||
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
{ hl = 'MiniStatuslineFilename', strings = { filename } },
|
||||||
"%=",
|
'%=',
|
||||||
{ hl = "MiniStatuslineDevinfo", strings = { lsp_clients } },
|
{ hl = 'MiniStatuslineDevinfo', strings = { lsp_clients } },
|
||||||
{ hl = mode_hl, strings = { filetype, searchcount, loc } },
|
{ hl = mode_hl, strings = { filetype, searchcount, loc } },
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
inactive = function()
|
inactive = function()
|
||||||
return MiniStatusline.combine_groups({
|
return MiniStatusline.combine_groups({
|
||||||
{ hl = "MiniStatuslineInactive", strings = { vim.fn.expand("%:t") } },
|
{ hl = 'MiniStatuslineInactive', strings = { vim.fn.expand('%:t') } },
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user