From eebbb6c4b7bbe282ac4066f11ea605f380fbce43 Mon Sep 17 00:00:00 2001 From: Devin Haska <2636402+wonderfulfrog@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:59:50 -0700 Subject: [PATCH] fix: formatting --- init.lua | 42 ++--- lua/autocmds.lua | 14 +- lua/keybinds.lua | 6 +- lua/options.lua | 14 +- lua/plugins/coding.lua | 187 +++++++++++---------- lua/plugins/colorscheme.lua | 90 +++++------ lua/plugins/editor.lua | 314 ++++++++++++++++++------------------ lua/plugins/formatting.lua | 38 ++--- lua/plugins/linting.lua | 75 ++++----- lua/plugins/lsp.lua | 112 ++++++------- lua/plugins/treesitter.lua | 78 ++++----- lua/plugins/ui.lua | 312 +++++++++++++++++------------------ 12 files changed, 642 insertions(+), 640 deletions(-) diff --git a/init.lua b/init.lua index 242952b..856ff0d 100644 --- a/init.lua +++ b/init.lua @@ -2,31 +2,31 @@ require("options") local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath) -- Fix for yanking to system clipboard on Windows -if vim.fn.has('wsl') == 1 then - vim.g.clipboard = { - name = 'WslClipboard', - copy = { - ['+'] = 'clip.exe', - ['*'] = 'clip.exe', - }, - paste = { - ['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', - ['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', - }, - cache_enabled = 0, - } +if vim.fn.has("wsl") == 1 then + vim.g.clipboard = { + name = "WslClipboard", + copy = { + ["+"] = "clip.exe", + ["*"] = "clip.exe", + }, + paste = { + ["+"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + ["*"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + }, + cache_enabled = 0, + } end require("lazy").setup("plugins") diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 1f6502d..260e358 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -1,12 +1,12 @@ 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, }) diff --git a/lua/keybinds.lua b/lua/keybinds.lua index 5f4a455..c7baf36 100644 --- a/lua/keybinds.lua +++ b/lua/keybinds.lua @@ -13,9 +13,9 @@ vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move lines under cursor d vim.keymap.set("n", "n", "nzzzv", { desc = "Go to next search result and keep cursor centered on screen" }) vim.keymap.set("n", "N", "Nzzzv", { desc = "Go to previous search result and keep cursor centered on screen" }) -vim.keymap.set("x", "p", "\"_dP", { desc = "Paste without replacing clipboard contents" }) +vim.keymap.set("x", "p", '"_dP', { desc = "Paste without replacing clipboard contents" }) -vim.keymap.set("n", "y", "\"*y", { desc = "Yank into system clipboard" }) -vim.keymap.set("v", "y", "\"*y", { desc = "Yank into system clipboard" }) +vim.keymap.set("n", "y", '"*y', { desc = "Yank into system clipboard" }) +vim.keymap.set("v", "y", '"*y', { desc = "Yank into system clipboard" }) vim.keymap.set("i", "jk", "", { desc = "Exit insert mode" }) diff --git a/lua/options.lua b/lua/options.lua index c8870dc..ca0f843 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -31,13 +31,13 @@ vim.opt.hlsearch = false vim.opt.incsearch = true vim.opt.fillchars = { - foldopen = "", - foldclose = "", - -- fold = "⸱", - fold = " ", - foldsep = " ", - diff = "╱", - eob = " ", + foldopen = "", + foldclose = "", + -- fold = "⸱", + fold = " ", + foldsep = " ", + diff = "╱", + eob = " ", } vim.opt.foldlevel = 99 diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index 5ec6181..4fe3313 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -1,100 +1,99 @@ return { - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - }, - config = function() - local cmp = require("cmp") + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + }, + 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({ 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({ 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 = { - mappings = { - ["`"] = { action = "closeopen", pair = "``", neigh_pattern = "[^\\`].", register = { cr = false } }, - }, - }, - }, - { - "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 = { + mappings = { + ["`"] = { action = "closeopen", pair = "``", neigh_pattern = "[^\\`].", register = { cr = false } }, + }, + }, + }, + { + "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 6441cff..e15d03b 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,47 +1,47 @@ return { - { - "folke/tokyonight.nvim", - lazy = true, - opts = { - style = "storm", - transparent = true, - dim_inactive = true, - }, - }, - { - "catppuccin/nvim", - name = "catppuccin", - priority = 1000, - opts = { - default_integrations = true, - dim_inactive = { - enabled = true - }, - flavour = "macchiato", - integrations = { - alpha = true, - cmp = true, - flash = true, - gitsigns = true, - lsp_trouble = true, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, - neotree = true, - noice = true, - telescope = { - enabled = true, - }, - treesitter = true, - treesitter_context = true, - which_key = true, - } - } - } + { + "folke/tokyonight.nvim", + lazy = true, + opts = { + style = "storm", + transparent = true, + dim_inactive = true, + }, + }, + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + opts = { + default_integrations = true, + dim_inactive = { + enabled = true, + }, + flavour = "macchiato", + integrations = { + alpha = true, + cmp = true, + flash = true, + gitsigns = true, + lsp_trouble = true, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + neotree = true, + noice = true, + telescope = { + enabled = true, + }, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + }, + }, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index cb91684..3e8f243 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,132 +1,132 @@ return { - { - "nvim-neo-tree/neo-tree.nvim", - event = "VeryLazy", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - config = function() - vim.keymap.set("n", "ee", ":Neotree toggle", { desc = "Toggle Neotree" }) - vim.keymap.set("n", "er", ":Neotree reveal", { desc = "Reveal file" }) + { + "nvim-neo-tree/neo-tree.nvim", + event = "VeryLazy", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set("n", "ee", ":Neotree toggle", { desc = "Toggle Neotree" }) + vim.keymap.set("n", "er", ":Neotree reveal", { desc = "Reveal file" }) - local nt = require("neo-tree") + local nt = require("neo-tree") - nt.setup({ - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, - filesystem = { - filtered_items = { - show_hidden_count = false, - hide_dotfiles = false, - hide_gitignored = true, - always_show = { - ".env", - ".env.local", - }, - never_show = { - ".git", - "thumbs.db", - ".DS_Store", - }, - }, - }, - window = { - mappings = { - ["m"] = { - "move", - config = { - show_path = "relative", - }, - }, - }, - }, - event_handlers = { - { - event = "neo_tree_popup_input_ready", - handler = function() - -- Switch to normal inside popups by default. - vim.cmd.stopinsert() - end, - }, - }, - }) - end, - }, - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - opts = {}, - }, - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - vim.keymap.set("n", "tt", ":TroubleToggle", { desc = "Toggle Trouble" }) - end, - }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {}, - }, - { - "nvim-pack/nvim-spectre", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { open_cmd = "noswapfile vnew" }, - keys = { - { - "sr", - function() - require("spectre").open() - end, - desc = "Replace in Files (Spectre)", - }, - }, - }, - { - "nvim-telescope/telescope.nvim", - tag = "0.1.5", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local builtin = require("telescope.builtin") + nt.setup({ + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, + filesystem = { + filtered_items = { + show_hidden_count = false, + hide_dotfiles = false, + hide_gitignored = true, + always_show = { + ".env", + ".env.local", + }, + never_show = { + ".git", + "thumbs.db", + ".DS_Store", + }, + }, + }, + window = { + mappings = { + ["m"] = { + "move", + config = { + show_path = "relative", + }, + }, + }, + }, + event_handlers = { + { + event = "neo_tree_popup_input_ready", + handler = function() + -- Switch to normal inside popups by default. + vim.cmd.stopinsert() + end, + }, + }, + }) + end, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {}, + }, + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + vim.keymap.set("n", "tt", ":TroubleToggle", { desc = "Toggle Trouble" }) + end, + }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + }, + { + "nvim-pack/nvim-spectre", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { open_cmd = "noswapfile vnew" }, + keys = { + { + "sr", + function() + require("spectre").open() + end, + desc = "Replace in Files (Spectre)", + }, + }, + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local builtin = require("telescope.builtin") - vim.keymap.set("n", "ff", builtin.git_files, { desc = "Search git_files" }) - vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Grep git_files" }) - vim.keymap.set("n", "fh", builtin.help_tags, { desc = "View help tags" }) - vim.keymap.set("n", "fb", builtin.buffers, { desc = "Search buffers" }) - vim.keymap.set("n", "sk", builtin.keymaps, { desc = "View keymaps" }) - vim.keymap.set("n", "sR", builtin.resume, { desc = "Resume" }) - vim.keymap.set("n", "st", "TodoTelescope", { desc = "Search TODOs" }) - end, - }, - { - "nvim-telescope/telescope-ui-select.nvim", - config = function() - require("telescope").setup({ - defaults = { - initial_mode = "normal", - }, - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown({}), - }, - }, - }) + vim.keymap.set("n", "ff", builtin.git_files, { desc = "Search git_files" }) + vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Grep git_files" }) + vim.keymap.set("n", "fh", builtin.help_tags, { desc = "View help tags" }) + vim.keymap.set("n", "fb", builtin.buffers, { desc = "Search buffers" }) + vim.keymap.set("n", "sk", builtin.keymaps, { desc = "View keymaps" }) + vim.keymap.set("n", "sR", builtin.resume, { desc = "Resume" }) + vim.keymap.set("n", "st", "TodoTelescope", { desc = "Search TODOs" }) + end, + }, + { + "nvim-telescope/telescope-ui-select.nvim", + config = function() + require("telescope").setup({ + defaults = { + initial_mode = "normal", + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) - require("telescope").load_extension("ui-select") - end, - }, - { - "folke/flash.nvim", - event = "VeryLazy", - ---@type Flash.Config - opts = {}, + require("telescope").load_extension("ui-select") + end, + }, + { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = {}, -- stylua: ignore keys = { { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, @@ -135,37 +135,37 @@ return { { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, }, - }, - { - "kdheepak/lazygit.nvim", - event = "VeryLazy", - cmd = { - "LazyGit", - "LazyGitConfig", - "LazyGitCurrentFile", - "LazyGitFilter", - "LazyGitFilterCurrentFile", - }, - -- optional for floating window border decoration - dependencies = { - "nvim-lua/plenary.nvim", - }, - keys = { - { "gg", "LazyGit", desc = "LazyGit" } - } - }, - { - "lewis6991/gitsigns.nvim", - event = "VeryLazy", - opts = { - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - } - } + }, + { + "kdheepak/lazygit.nvim", + event = "VeryLazy", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "gg", "LazyGit", desc = "LazyGit" }, + }, + }, + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + }, + }, } diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua index dd49a97..c5b7efc 100644 --- a/lua/plugins/formatting.lua +++ b/lua/plugins/formatting.lua @@ -1,21 +1,21 @@ return { - "stevearc/conform.nvim", - opts = { - formatters_by_ft = { - css = { "prettierd" }, - scss = { "prettierd" }, - html = { "djlint" }, - lua = { "stylua" }, - markdown = { "prettierd" }, - 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 = { "stylua" }, + markdown = { "prettierd" }, + 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 66ce712..99d4ad2 100644 --- a/lua/plugins/linting.lua +++ b/lua/plugins/linting.lua @@ -1,38 +1,41 @@ -return { { - "mfussenegger/nvim-lint", - opts = { - events = { "BufWritePost", "BufReadPost", "InsertLeave" }, - linters_by_ft = { - html = { "djlint" }, - javascript = { "eslint" }, - typescript = { "eslint" }, - javascriptreact = { "eslint" }, - typescriptreact = { "eslint" }, - }, - }, - config = function(_, opts) - local lint = require("lint") - lint.linters_by_ft = opts.linters_by_ft +return { + { + "mfussenegger/nvim-lint", + opts = { + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + html = { "djlint" }, + javascript = { "eslint" }, + typescript = { "eslint" }, + javascriptreact = { "eslint" }, + typescriptreact = { "eslint" }, + }, + }, + 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, -}, { - "jose-elias-alvarez/null-ls.nvim", - event = { "BufWritePost", "BufReadPost", "InsertLeave" }, - opts = function() - local null_ls = require("null-ls") - local diagnostics = null_ls.builtins.diagnostics - return { - sources = { - diagnostics.vale, - } - } - end -} } + vim.api.nvim_create_autocmd(opts.events, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, + }, + { + "jose-elias-alvarez/null-ls.nvim", + event = { "BufWritePost", "BufReadPost", "InsertLeave" }, + opts = function() + local null_ls = require("null-ls") + local diagnostics = null_ls.builtins.diagnostics + return { + sources = { + diagnostics.vale, + }, + } + end, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index c8a3210..037ace4 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,61 +1,61 @@ return { - { - "williamboman/mason.nvim", - opts = {}, - }, - { - "williamboman/mason-lspconfig.nvim", - opts = { - ensure_installed = { - "lua_ls", - "tsserver", - "html", - } - } - }, - { - "WhoIsSethDaniel/mason-tool-installer.nvim", - opts = { - ensure_installed = { - "djlint", - "eslint", - "eslint_d", - "prettierd", - "stylua", - "vale", - }, - automatic_installation = true, - } - }, - -- lspconfig should be the last step. - { - "neovim/nvim-lspconfig", - event = "VeryLazy", - dependencies = { - "mason.nvim", - "williamboman/mason-lspconfig.nvim", - }, - opts = { - servers = { - tsserver = {}, - lua_ls = {}, - } - }, - config = function(_, opts) - local lspconfig = require("lspconfig") + { + "williamboman/mason.nvim", + opts = {}, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = { + ensure_installed = { + "lua_ls", + "tsserver", + "html", + }, + }, + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + opts = { + ensure_installed = { + "djlint", + "eslint", + "eslint_d", + "prettierd", + "stylua", + "vale", + }, + automatic_installation = true, + }, + }, + -- lspconfig should be the last step. + { + "neovim/nvim-lspconfig", + event = "VeryLazy", + dependencies = { + "mason.nvim", + "williamboman/mason-lspconfig.nvim", + }, + opts = { + servers = { + tsserver = {}, + lua_ls = {}, + }, + }, + config = function(_, opts) + local lspconfig = require("lspconfig") - local servers = opts.servers + local servers = opts.servers - for server, server_opts in pairs(servers) do - lspconfig[server].setup(server_opts) - end + for server, server_opts in pairs(servers) do + lspconfig[server].setup(server_opts) + end - vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) - 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, - }, + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) + 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, + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 85cf8f5..f1fbb6f 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,41 +1,41 @@ return { - { - "nvim-treesitter/nvim-treesitter", - version = false, - build = ":TSUpdate", - opts = { - ensure_installed = { - "lua", - "javascript", - "typescript", - "tsx", - "htmldjango", - "html", - "jsonc", - "json", - "jsdoc", - "markdown", - "markdown_inline", - "vim", - "vimdoc", - }, - highlight = { enable = true }, - indent = { enable = true }, - }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, - }, - { - "nvim-treesitter/nvim-treesitter-context", - opts = { - max_lines = 2, - }, - }, - { - -- TODO: Figure out why this plugin is not working. - "windwp/nvim-autopairs", - event = "VeryLazy", - opts = {}, - }, + { + "nvim-treesitter/nvim-treesitter", + version = false, + build = ":TSUpdate", + opts = { + ensure_installed = { + "lua", + "javascript", + "typescript", + "tsx", + "htmldjango", + "html", + "jsonc", + "json", + "jsdoc", + "markdown", + "markdown_inline", + "vim", + "vimdoc", + }, + highlight = { enable = true }, + indent = { enable = true }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + }, + { + "nvim-treesitter/nvim-treesitter-context", + opts = { + max_lines = 2, + }, + }, + { + -- TODO: Figure out why this plugin is not working. + "windwp/nvim-autopairs", + event = "VeryLazy", + opts = {}, + }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 60ca8c4..77f87c7 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,163 +1,163 @@ return { - { - 'freddiehaddad/feline.nvim', - init = function() - local ctp_feline = require('catppuccin.groups.integrations.feline') + { + "freddiehaddad/feline.nvim", + init = function() + local ctp_feline = require("catppuccin.groups.integrations.feline") - ctp_feline.setup() + ctp_feline.setup() - require("feline").setup({ - components = ctp_feline.get(), - }) - end - }, - { - "famiu/bufdelete.nvim", - keys = { - { "bd", "Bdelete", desc = "Close Buffer" }, - }, - }, - { - "akinsho/bufferline.nvim", - event = "VeryLazy", - keys = { - { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, - { "[b", "BufferLineCyclePrev", desc = "Prev Buffer" }, - { "]b", "BufferLineCycleNext", desc = "Next Buffer" }, - }, - opts = { - highlights = require("catppuccin.groups.integrations.bufferline").get(), - options = { - diagnostics = "nvim_lsp", - offsets = { - { - filetype = "neo-tree", - text = "", - highlight = "Directory", - text_align = "left", - }, - }, - } - } - }, - { - "lukas-reineke/indent-blankline.nvim", - opts = { - indent = { - char = "│", - tab_char = "│", - }, - scope = { enabled = false }, - exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - }, - }, - main = "ibl", - }, - { - "echasnovski/mini.indentscope", - opts = { - symbol = "│", - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - { - "stevearc/dressing.nvim", - event = "VeryLazy", - opts = {} - }, - { - "rcarriga/nvim-notify", - opts = { - timeout = 2000, - stages = "static", - } - }, - { - "MunifTanjim/nui.nvim" - }, - { - "folke/noice.nvim", - event = "VeryLazy", - opts = {}, - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - } - }, - { - "goolord/alpha-nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - local alpha = require("alpha") - local dashboard = require("alpha.themes.dashboard") + require("feline").setup({ + components = ctp_feline.get(), + }) + end, + }, + { + "famiu/bufdelete.nvim", + keys = { + { "bd", "Bdelete", desc = "Close Buffer" }, + }, + }, + { + "akinsho/bufferline.nvim", + event = "VeryLazy", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, + { "[b", "BufferLineCyclePrev", desc = "Prev Buffer" }, + { "]b", "BufferLineCycleNext", desc = "Next Buffer" }, + }, + opts = { + highlights = require("catppuccin.groups.integrations.bufferline").get(), + options = { + diagnostics = "nvim_lsp", + offsets = { + { + filetype = "neo-tree", + text = "", + highlight = "Directory", + text_align = "left", + }, + }, + }, + }, + }, + { + "lukas-reineke/indent-blankline.nvim", + opts = { + indent = { + char = "│", + tab_char = "│", + }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }, + main = "ibl", + }, + { + "echasnovski/mini.indentscope", + opts = { + symbol = "│", + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = {}, + }, + { + "rcarriga/nvim-notify", + opts = { + timeout = 2000, + stages = "static", + }, + }, + { + "MunifTanjim/nui.nvim", + }, + { + "folke/noice.nvim", + event = "VeryLazy", + opts = {}, + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + }, + { + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") - -- https://github.com/MaximilianLloyd/ascii.nvim - dashboard.section.header.val = { - " ", - " ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ", - " ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ", - " ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ", - " ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ", - " ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ", - " ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ", - " ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ", - " ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ", - " ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ", - " ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ", - " ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ", - " ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ", - " ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ", - " ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ", - " ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ", - " ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ", - " ▄█████████▄▄ ", - " ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ", - " ▄▄█████▀▀▀▀ ▀■ ", - " ▄███▀▀▀▀ ", - " ■▀▀ ", - " ", - } + -- https://github.com/MaximilianLloyd/ascii.nvim + dashboard.section.header.val = { + " ", + " ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ", + " ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ", + " ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ", + " ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ", + " ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ", + " ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ", + " ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ", + " ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ", + " ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ", + " ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ", + " ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ", + " ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ", + " ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ", + " ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ", + " ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ", + " ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ", + " ▄█████████▄▄ ", + " ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ", + " ▄▄█████▀▀▀▀ ▀■ ", + " ▄███▀▀▀▀ ", + " ■▀▀ ", + " ", + } - dashboard.section.buttons.val = { - dashboard.button("e", " > New File", "ene"), - dashboard.button("SPC ee", " > File explorer", "Neotree"), - dashboard.button("q", " > Quit", "qa"), - } + dashboard.section.buttons.val = { + dashboard.button("e", " > New File", "ene"), + dashboard.button("SPC ee", " > File explorer", "Neotree"), + dashboard.button("q", " > Quit", "qa"), + } - alpha.setup(dashboard.opts) - end, - } + alpha.setup(dashboard.opts) + end, + }, }