diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 39927ae..d0c2e37 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -1,14 +1,14 @@ local function augroup(name) - return vim.api.nvim_create_augroup("wf_" .. name, { clear = true }) + return vim.api.nvim_create_augroup("wf_" .. name, { clear = true }) end vim.api.nvim_create_autocmd({ "FileType" }, { - group = augroup("spellcheck"), - pattern = { "gitcommit", "markdown", "md", "mdx" }, - callback = function() - vim.opt_local.spell = true - vim.opt_local.wrap = true - end, + group = augroup("spellcheck"), + pattern = { "gitcommit", "markdown", "md", "mdx" }, + callback = function() + vim.opt_local.spell = true + vim.opt_local.wrap = true + end, }) -- vim.api.nvim_create_autocmd({ "FileType" }, { diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index 7a28339..a8a64e2 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,96 +1,96 @@ return { - { - "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-nvim-lsp" }, - config = function() - local cmp = require("cmp") + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-nvim-lsp" }, + config = function() + local cmp = require("cmp") - cmp.setup({ - -- Highlights the first result always - completion = { - completeopt = "menu,menuone,noinsert", - }, + cmp.setup({ + -- Highlights the first result always + completion = { + completeopt = "menu,menuone,noinsert", + }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i" }), - [""] = cmp.mapping.confirm({ - behaviour = cmp.ConfirmBehavior.Insert, - select = true, - }), - }), + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i" }), + [""] = cmp.mapping.confirm({ + behaviour = cmp.ConfirmBehavior.Insert, + select = true, + }), + }), - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, { - { name = "buffer" }, - }), - }) - end, - }, - { - "L3MON4D3/LuaSnip", - dependencies = { "rafamadriz/friendly-snippets" }, - }, - { - "echasnovski/mini.pairs", - version = false, - opts = {}, - }, - { - "echasnovski/mini.surround", - version = false, - opts = { - mappings = { - add = "gsa", -- Add surrounding in Normal and Visual modes - delete = "gsd", -- Delete surrounding - find = "gsf", -- Find surrounding (to the right) - find_left = "gsF", -- Find surrounding (to the left) - highlight = "gsh", -- Highlight surrounding - replace = "gsr", -- Replace surrounding - update_n_lines = "gsn", -- Update `n_lines` - }, - }, - }, - { - "JoosepAlviste/nvim-ts-context-commentstring", - opts = { - enable_autocmd = false, - }, - }, - { - "echasnovski/mini.comment", - version = false, - opts = { - options = { - custom_commentstring = function() - return require("ts_context_commentstring.internal").calculate_commentstring() - or vim.bo.commentstring - end, - }, - }, - }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets" }, + }, + { + "echasnovski/mini.pairs", + version = false, + opts = {}, + }, + { + "echasnovski/mini.surround", + version = false, + opts = { + mappings = { + add = "gsa", -- Add surrounding in Normal and Visual modes + delete = "gsd", -- Delete surrounding + find = "gsf", -- Find surrounding (to the right) + find_left = "gsF", -- Find surrounding (to the left) + highlight = "gsh", -- Highlight surrounding + replace = "gsr", -- Replace surrounding + update_n_lines = "gsn", -- Update `n_lines` + }, + }, + }, + { + "JoosepAlviste/nvim-ts-context-commentstring", + opts = { + enable_autocmd = false, + }, + }, + { + "echasnovski/mini.comment", + version = false, + opts = { + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() + or vim.bo.commentstring + end, + }, + }, + }, } diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 790f129..cde1558 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,9 +1,9 @@ return { - "folke/tokyonight.nvim", - lazy = true, - opts = { - style = "storm", - transparent = true, - dim_inactive = true, - }, + "folke/tokyonight.nvim", + lazy = true, + opts = { + style = "storm", + transparent = true, + dim_inactive = true, + }, } diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua index 5820e06..d3ca74e 100644 --- a/lua/plugins/formatting.lua +++ b/lua/plugins/formatting.lua @@ -1,20 +1,20 @@ return { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - css = { "prettierd" }, - scss = { "prettierd" }, - html = { "djlint" }, - lua = { "stylelua" }, - javascript = { "prettierd" }, - javascriptreact = { "prettierd" }, - json = { "prettierd" }, - jsonc = { "prettierd" }, - typescript = { "prettierd" }, - typescriptreact = { "prettierd" }, - }, - format_on_save = { - lsp_fallback = true, - }, - }, + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + css = { "prettierd" }, + scss = { "prettierd" }, + html = { "djlint" }, + lua = { "stylelua" }, + javascript = { "prettierd" }, + javascriptreact = { "prettierd" }, + json = { "prettierd" }, + jsonc = { "prettierd" }, + typescript = { "prettierd" }, + typescriptreact = { "prettierd" }, + }, + format_on_save = { + lsp_fallback = true, + }, + }, } diff --git a/lua/plugins/linting.lua b/lua/plugins/linting.lua index 97cbede..995389c 100644 --- a/lua/plugins/linting.lua +++ b/lua/plugins/linting.lua @@ -1,26 +1,26 @@ return { - "mfussenegger/nvim-lint", - opts = { - events = { "BufWritePost", "BufReadPost", "InsertLeave" }, - linters_by_ft = { - html = { "djlint" }, - javascript = { "eslint_d" }, - typescript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - typescriptreact = { "eslint_d" }, - }, - }, - config = function(_, opts) - local lint = require("lint") - lint.linters_by_ft = opts.linters_by_ft + "mfussenegger/nvim-lint", + opts = { + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + html = { "djlint" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + }, + }, + config = function(_, opts) + local lint = require("lint") + lint.linters_by_ft = opts.linters_by_ft - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - vim.api.nvim_create_autocmd(opts.events, { - group = lint_augroup, - callback = function() - lint.try_lint() - end, - }) - end, + vim.api.nvim_create_autocmd(opts.events, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index bad9c77..c680cb4 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -55,6 +55,7 @@ return { vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show signature" }) vim.keymap.set("n", "f", vim.lsp.buf.format, { desc = "Format buffer" }) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "View code actions" }) + vim.keymap.set("n", "cr", vim.lsp.buf.rename, { desc = "Rename" }) end, }, }