From 261ae0f781e4c3f38cefb9f2aea08da5a890ad6b Mon Sep 17 00:00:00 2001 From: Mikkel Svartveit Date: Thu, 29 May 2025 13:18:27 +0200 Subject: [PATCH] Run formatter on plugins.lua --- nvim/lua/plugins.lua | 583 ++++++++++++++++++++++--------------------- 1 file changed, 293 insertions(+), 290 deletions(-) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index f1d1319..66dd4f2 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,321 +1,324 @@ -- Install lazy.nvim (plugin manager) 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) -- Install plugins require("lazy").setup({ - -- Color scheme - { - "catppuccin/nvim", - name = "catppuccin", - priority = 1000, - config = function(plugin) - vim.cmd.colorscheme "catppuccin-macchiato" - end - }, + -- Color scheme + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function(plugin) + vim.cmd.colorscheme("catppuccin-macchiato") + end, + }, - -- Treesitter config - { - "nvim-treesitter/nvim-treesitter", - branch = 'master', - lazy = false, - build = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup { - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - } - end, - }, + -- Treesitter config + { + "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + }) + end, + }, - -- LSP config - { - "neovim/nvim-lspconfig", - dependencies = { - -- Mason for easy LSP installation - { "mason-org/mason.nvim", opts = {} }, - { "mason-org/mason-lspconfig.nvim", opts = { - handlers = { - -- Make it play with nvim-cmp - function(server_name) - require("lspconfig")[server_name].setup({ - capabilities = require('cmp_nvim_lsp').default_capabilities() - }) - end, - }, - } }, + -- LSP config + { + "neovim/nvim-lspconfig", + dependencies = { + -- Mason for easy LSP installation + { "mason-org/mason.nvim", opts = {} }, + { + "mason-org/mason-lspconfig.nvim", + opts = { + handlers = { + -- Make it play with nvim-cmp + function(server_name) + require("lspconfig")[server_name].setup({ + capabilities = require("cmp_nvim_lsp").default_capabilities(), + }) + end, + }, + }, + }, - -- Autocompletion (nvim-cmp) - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp - "L3MON4D3/LuaSnip", -- Snippet engine - }, - config = function() - -- Setup nvim-cmp - local cmp = require('cmp') - cmp.setup({ - sources = { - {name = 'nvim_lsp'}, - }, - mapping = cmp.mapping.preset.insert({ - -- Enter key confirms completion item - [''] = cmp.mapping.confirm({select = true}), + -- Autocompletion (nvim-cmp) + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp + "L3MON4D3/LuaSnip", -- Snippet engine + }, + config = function() + -- Setup nvim-cmp + local cmp = require("cmp") + cmp.setup({ + sources = { + { name = "nvim_lsp" }, + }, + mapping = cmp.mapping.preset.insert({ + -- Enter key confirms completion item + [""] = cmp.mapping.confirm({ select = true }), - -- Ctrl + space triggers completion menu - [''] = cmp.mapping.complete(), - }), - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - }) + -- Ctrl + space triggers completion menu + [""] = cmp.mapping.complete(), + }), + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + }) - -- Keymaps - vim.api.nvim_create_autocmd('LspAttach', { - callback = function(event) - local opts = {buffer = event.buf} + -- Keymaps + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(event) + local opts = { buffer = event.buf } - vim.keymap.set("n", "gd", 'lua vim.lsp.buf.definition()', opts) - vim.keymap.set("n", "gh", 'lua vim.diagnostic.open_float()', opts) - end, - }) - end, - }, + vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", opts) + vim.keymap.set("n", "gh", "lua vim.diagnostic.open_float()", opts) + end, + }) + end, + }, - -- Formatting with null-ls - { - "nvimtools/none-ls.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local null_ls = require("null-ls") - local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - null_ls.setup({ - sources = { - null_ls.builtins.formatting.prettierd, - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.stylua, - }, - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ - async = false, - filter = function(client) - return client.name == "null-ls" - end - }) - end, - }) - end - end, - }) - end, - }, + -- Formatting with null-ls + { + "nvimtools/none-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local null_ls = require("null-ls") + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + null_ls.setup({ + sources = { + null_ls.builtins.formatting.prettierd, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.stylua, + }, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + async = false, + filter = function(client) + return client.name == "null-ls" + end, + }) + end, + }) + end + end, + }) + end, + }, - -- Easy commenting/uncommenting - { - "numToStr/Comment.nvim", - config = true, - }, + -- Easy commenting/uncommenting + { + "numToStr/Comment.nvim", + config = true, + }, - -- Easy handling of surroundings - { - "tpope/vim-surround", - dependencies = { - "tpope/vim-repeat", - }, - }, + -- Easy handling of surroundings + { + "tpope/vim-surround", + dependencies = { + "tpope/vim-repeat", + }, + }, - -- Auto-match brackets, quotes etc. - { - 'windwp/nvim-autopairs', - event = "InsertEnter", - opts = {}, - }, + -- Auto-match brackets, quotes etc. + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, + }, - -- Supermaven AI assist - { - "supermaven-inc/supermaven-nvim", - config = function() - vim.api.nvim_create_user_command("CPE", "SupermavenStart", {}) - vim.api.nvim_create_user_command("CPD", "SupermavenStop", {}) + -- Supermaven AI assist + { + "supermaven-inc/supermaven-nvim", + config = function() + vim.api.nvim_create_user_command("CPE", "SupermavenStart", {}) + vim.api.nvim_create_user_command("CPD", "SupermavenStop", {}) - require("supermaven-nvim").setup({}) + require("supermaven-nvim").setup({}) - -- Disable on startup - vim.api.nvim_command("silent! SupermavenStop") - end, - }, + -- Disable on startup + vim.api.nvim_command("silent! SupermavenStop") + end, + }, - -- Auto-restore session when opening Neovim - { - "rmagatti/auto-session", - opts = { - log_level = "error", - }, - }, + -- Auto-restore session when opening Neovim + { + "rmagatti/auto-session", + opts = { + log_level = "error", + }, + }, - -- File explorer sidebar - { - "kyazdani42/nvim-tree.lua", - commit = "e14989c", -- newer versions break auto-session - dependencies = { - "kyazdani42/nvim-web-devicons", - }, - opts = { - actions = { - open_file = { - quit_on_open = true, - }, - }, - update_focused_file = { - enable = true, - }, - view = { - signcolumn = "auto", - adaptive_size = true, - mappings = { - list = { - { key = "+", action = "cd" }, - }, - }, - }, - }, - init = function() - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - vim.keymap.set("n", "n", ":NvimTreeToggle", { noremap = true, silent = true }) - end, - }, + -- File explorer sidebar + { + "kyazdani42/nvim-tree.lua", + commit = "e14989c", -- newer versions break auto-session + dependencies = { + "kyazdani42/nvim-web-devicons", + }, + opts = { + actions = { + open_file = { + quit_on_open = true, + }, + }, + update_focused_file = { + enable = true, + }, + view = { + signcolumn = "auto", + adaptive_size = true, + mappings = { + list = { + { key = "+", action = "cd" }, + }, + }, + }, + }, + init = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.keymap.set("n", "n", ":NvimTreeToggle", { noremap = true, silent = true }) + end, + }, - -- Fuzzy finder for files, buffers, etc. - { - "nvim-telescope/telescope.nvim", - tag = "0.1.4", - dependencies = { - "nvim-lua/plenary.nvim", - {"nvim-telescope/telescope-fzf-native.nvim", build = "make"}, - }, - keys = { - {"p", "Telescope find_files", noremap = true, silent = true}, - {"f", "Telescope live_grep", noremap = true, silent = true}, - {"b", "Telescope buffers", noremap = true, silent = true}, - {"o", "Telescope oldfiles", noremap = true, silent = true}, - {"t", "Telescope lsp_workspace_symbols", noremap = true, silent = true}, - {"c", "Telescope commands", noremap = true, silent = true}, - {":", "Telescope commands", noremap = true, silent = true}, - {"d", "Telescope git_status", noremap = true, silent = true}, - {"", "Telescope resume", noremap = true, silent = true}, - }, - config = function() - require("telescope").setup({ - defaults = { - mappings = { - i = { - [""] = require("telescope.actions").close, -- Disable normal mode - }, - }, - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", - "--fixed-strings", - } - } - }) - require("telescope").load_extension("fzf") - end, - }, + -- Fuzzy finder for files, buffers, etc. + { + "nvim-telescope/telescope.nvim", + tag = "0.1.4", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, + keys = { + { "p", "Telescope find_files", noremap = true, silent = true }, + { "f", "Telescope live_grep", noremap = true, silent = true }, + { "b", "Telescope buffers", noremap = true, silent = true }, + { "o", "Telescope oldfiles", noremap = true, silent = true }, + { "t", "Telescope lsp_workspace_symbols", noremap = true, silent = true }, + { "c", "Telescope commands", noremap = true, silent = true }, + { ":", "Telescope commands", noremap = true, silent = true }, + { "d", "Telescope git_status", noremap = true, silent = true }, + { "", "Telescope resume", noremap = true, silent = true }, + }, + config = function() + require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = require("telescope.actions").close, -- Disable normal mode + }, + }, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--fixed-strings", + }, + }, + }) + require("telescope").load_extension("fzf") + end, + }, - -- Persistent terminal that can be toggled with a keybinding - { - "akinsho/nvim-toggleterm.lua", - tag = "2.4.0", - keys = "", - config = function() - require("toggleterm").setup({ - hide_numbers = true, - direction = 'float', - open_mapping = [[]], - shell = 'fish', - }) - end, - }, + -- Persistent terminal that can be toggled with a keybinding + { + "akinsho/nvim-toggleterm.lua", + tag = "2.4.0", + keys = "", + config = function() + require("toggleterm").setup({ + hide_numbers = true, + direction = "float", + open_mapping = [[]], + shell = "fish", + }) + end, + }, - -- Run code with a keybinding - { - "CRAG666/code_runner.nvim", - cmd = "RunCode", - dependencies = { - "akinsho/nvim-toggleterm.lua" - }, - opts = { - mode = "toggleterm", - filetype = { - python = "python3", - javascript = "node", - typescript = "ts-node --esm", - c = "gcc -o main % && ./main", - go = "go run", - }, - }, - init = function() - vim.keymap.set("n", "", ":RunCode", { noremap = true }) - end, - }, + -- Run code with a keybinding + { + "CRAG666/code_runner.nvim", + cmd = "RunCode", + dependencies = { + "akinsho/nvim-toggleterm.lua", + }, + opts = { + mode = "toggleterm", + filetype = { + python = "python3", + javascript = "node", + typescript = "ts-node --esm", + c = "gcc -o main % && ./main", + go = "go run", + }, + }, + init = function() + vim.keymap.set("n", "", ":RunCode", { noremap = true }) + end, + }, - -- Live Markdown preview in browser - -- { - -- "iamcco/markdown-preview.nvim", - -- build = "cd app && npm install", - -- ft = "markdown", - -- init = function() - -- vim.g.mkdp_auto_close = 0 - -- end, - -- }, + -- Live Markdown preview in browser + -- { + -- "iamcco/markdown-preview.nvim", + -- build = "cd app && npm install", + -- ft = "markdown", + -- init = function() + -- vim.g.mkdp_auto_close = 0 + -- end, + -- }, - -- Git integration - show modified lines next to line numbers - { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - require("scrollbar.handlers.gitsigns").setup() - end, - }, + -- Git integration - show modified lines next to line numbers + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + require("scrollbar.handlers.gitsigns").setup() + end, + }, - -- VSCode-like scrollbar with Git and diagnostic markers - { - "petertriho/nvim-scrollbar", - config = true, - }, + -- VSCode-like scrollbar with Git and diagnostic markers + { + "petertriho/nvim-scrollbar", + config = true, + }, - -- Smooth scrolling - { - "karb94/neoscroll.nvim", - opts = { - easing_function = "sine", - } - }, + -- Smooth scrolling + { + "karb94/neoscroll.nvim", + opts = { + easing_function = "sine", + }, + }, })