refactor(config): update plugin configurations for consistency

This commit is contained in:
sankalp committed 2025-10-18 12:10:49 +05:45
1 parent ea6661e0cd
commit 594f1574c7
2 files changed
+139 -140

No files matched your search

+73 -74
View File
@@ -2,10 +2,10 @@ return {
-- completion -- completion
{ {
"saghen/blink.cmp", 'saghen/blink.cmp',
version = "*", version = '*',
config = function() config = function()
require("blink.cmp").setup({ require('blink.cmp').setup({
completion = { completion = {
list = { list = {
selection = { selection = {
@@ -14,27 +14,27 @@ return {
}, },
}, },
documentation = { documentation = {
window = { border = "rounded" }, window = { border = 'rounded' },
auto_show = true, auto_show = true,
auto_show_delay_ms = 50, auto_show_delay_ms = 50,
}, },
menu = { menu = {
border = "rounded", border = 'rounded',
draw = { draw = {
components = { components = {
kind_icon = { kind_icon = {
text = function(ctx) text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind)
return kind_icon return kind_icon
end, end,
highlight = function(ctx) highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
return hl return hl
end, end,
}, },
kind = { kind = {
highlight = function(ctx) highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
return hl return hl
end, end,
}, },
@@ -43,22 +43,22 @@ return {
}, },
}, },
signature = { signature = {
window = { border = "rounded" }, window = { border = 'rounded' },
}, },
snippets = { preset = "luasnip" }, snippets = { preset = 'luasnip' },
sources = { sources = {
default = { "lsp", "path", "snippets", "buffer" }, default = { 'lsp', 'path', 'snippets', 'buffer' },
providers = {}, providers = {},
}, },
keymap = { keymap = {
preset = "none", preset = 'none',
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" }, ['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
["<Tab>"] = { "select_next", "snippet_forward", "fallback" }, ['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
["<CR>"] = { "accept", "fallback" }, ['<CR>'] = { 'accept', 'fallback' },
["<C-space>"] = { "hide", "show" }, ['<C-space>'] = { 'hide', 'show' },
["<C-y>"] = { "show", "show_documentation", "hide_documentation" }, ['<C-y>'] = { 'show', 'show_documentation', 'hide_documentation' },
["<C-u>"] = { "scroll_documentation_up", "fallback" }, ['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
["<C-d>"] = { "scroll_documentation_down", "fallback" }, ['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
}, },
}) })
end, end,
@@ -66,80 +66,79 @@ return {
-- snippets -- snippets
{ {
"L3MON4D3/LuaSnip", 'L3MON4D3/LuaSnip',
version = "*", version = '*',
dependencies = { "rafamadriz/friendly-snippets" }, dependencies = { 'rafamadriz/friendly-snippets' },
config = function() config = function()
local luasnip = require("luasnip") local luasnip = require('luasnip')
require("luasnip.loaders.from_vscode").lazy_load() require('luasnip.loaders.from_vscode').lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({ require('luasnip.loaders.from_vscode').lazy_load({
paths = { vim.fn.stdpath("config") .. "/snippets" }, paths = { vim.fn.stdpath('config') .. '/snippets' },
}) })
luasnip.filetype_extend("mdx", { "markdown" }) luasnip.filetype_extend('mdx', { 'markdown' })
end, end,
}, },
-- auto pairs -- auto pairs
{ {
"windwp/nvim-autopairs", 'windwp/nvim-autopairs',
event = "InsertEnter", event = 'InsertEnter',
config = function() config = function()
local npairs = require("nvim-autopairs") local npairs = require('nvim-autopairs')
local Rule = require("nvim-autopairs.rule") local Rule = require('nvim-autopairs.rule')
local conds = require("nvim-autopairs.conds") local conds = require('nvim-autopairs.conds')
npairs.setup() npairs.setup()
-- Autoclosing angle-brackets. -- Autoclosing angle-brackets.
npairs.add_rule(Rule("<", ">", { npairs.add_rule(Rule('<', '>', {
-- Avoid conflicts with nvim-ts-autotag. -- Avoid conflicts with nvim-ts-autotag.
"-html", '-html',
"-javascriptreact", '-javascriptreact',
"-typescriptreact", '-typescriptreact',
}):with_pair(conds.before_regex("%a+:?:?$", 3)):with_move(function(opts) }):with_pair(conds.before_regex('%a+:?:?$', 3)):with_move(function(opts)
return opts.char == ">" return opts.char == '>'
end)) end))
end, end,
}, },
-- auto tag -- auto tag
{ {
"windwp/nvim-ts-autotag", 'windwp/nvim-ts-autotag',
ft = { ft = {
"html", 'html',
"xml", 'xml',
"javascript", 'javascript',
"typescript", 'typescript',
"javascriptreact", 'javascriptreact',
"typescriptreact", 'typescriptreact',
"jsx", 'jsx',
"tsx", 'tsx',
"vue", 'vue',
"svelte", 'svelte',
"markdown", 'markdown',
"htmldjango", 'htmldjango',
}, },
event = "InsertEnter", event = 'InsertEnter',
lazy = true, lazy = true,
config = function() opts = {
require("nvim-ts-autotag").setup({ -- Defaults
enable_close = true, enable_close = true, -- Auto close tags
enable_rename = true, enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = true, enable_close_on_slash = false, -- Auto close on trailing </
}) },
end,
}, },
-- comment -- comment
{ {
"numToStr/Comment.nvim", 'numToStr/Comment.nvim',
dependencies = { dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring", 'JoosepAlviste/nvim-ts-context-commentstring',
}, },
config = function() config = function()
require("Comment").setup({ require('Comment').setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
mappings = { mappings = {
basic = true, basic = true,
extra = true, extra = true,
@@ -147,23 +146,23 @@ return {
}) })
end, end,
keys = { keys = {
{ "gcc", mode = "n", desc = "Toggle comment line" }, { 'gcc', mode = 'n', desc = 'Toggle comment line' },
{ "gc", mode = { "n", "o" }, desc = "Toggle comment linewise" }, { 'gc', mode = { 'n', 'o' }, desc = 'Toggle comment linewise' },
{ "gc", mode = "x", desc = "Toggle comment linewise (visual)" }, { 'gc', mode = 'x', desc = 'Toggle comment linewise (visual)' },
{ "gbc", mode = "n", desc = "Toggle comment block" }, { 'gbc', mode = 'n', desc = 'Toggle comment block' },
{ "gb", mode = { "n", "o" }, desc = "Toggle comment blockwise" }, { 'gb', mode = { 'n', 'o' }, desc = 'Toggle comment blockwise' },
{ "gb", mode = "x", desc = "Toggle comment blockwise (visual)" }, { 'gb', mode = 'x', desc = 'Toggle comment blockwise (visual)' },
}, },
}, },
-- treesitter -- treesitter
{ {
"nvim-treesitter/nvim-treesitter", 'nvim-treesitter/nvim-treesitter',
build = ":TSUpdate", build = ':TSUpdate',
event = { "BufReadPost", "BufNewFile" }, event = { 'BufReadPost', 'BufNewFile' },
config = function() config = function()
require("nvim-treesitter.configs").setup({ require('nvim-treesitter.configs').setup({
ensure_installed = require("config.extensions").ts_parsers, ensure_installed = require('config.extensions').ts_parsers,
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
+66 -66
View File
@@ -1,80 +1,80 @@
return { return {
"echasnovski/mini.nvim", 'echasnovski/mini.nvim',
config = function() config = function()
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
require("mini.tabline").setup() -- Tabline require('mini.tabline').setup() -- Tabline
-- 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({
-- restore cursor position on file reopen -- restore cursor position on file reopen
require("mini.misc").setup_restore_cursor(), require('mini.misc').setup_restore_cursor(),
-- 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()
@@ -88,51 +88,51 @@ return {
local function section_filetype(args) local function section_filetype(args)
if if
MiniStatusline.is_truncated(args.trunc_width) MiniStatusline.is_truncated(args.trunc_width)
or vim.bo.filetype == "" or vim.bo.filetype == ''
or vim.bo.buftype ~= "" or vim.bo.buftype ~= ''
then 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" return MiniStatusline.is_truncated(args.trunc_width) and '%-2l│%-2v'
or "󰉸 %-2l│󱥖 %-2v" or '󰉸 %-2l│󱥖 %-2v'
end end
local filetype = section_filetype({ trunc_width = 70 }) local filetype = section_filetype({ trunc_width = 70 })
@@ -142,18 +142,18 @@ return {
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,
}, },