From 779fdf4fd482ad28708d55f1276de23b28db7393 Mon Sep 17 00:00:00 2001 From: aaron Date: Sun, 26 Jan 2025 18:50:28 +0100 Subject: [PATCH] add plugins --- init.lua | 4 + lua/0x29a/lazy/autopairs.lua | 10 +++ lua/0x29a/lazy/colorscheme.lua | 3 + lua/0x29a/lazy/conform.lua | 20 +++++ lua/0x29a/lazy/indent-blankline.lua | 5 ++ lua/0x29a/lazy/lsp.lua | 116 ++++++++++++++++++++++++++++ lua/0x29a/lazy/lualine.lua | 9 +++ lua/0x29a/lazy/nvimtree.lua | 18 +++++ lua/0x29a/lazy/telescope.lua | 14 ++++ lua/0x29a/lazy/treesitter.lua | 15 ++++ lua/0x29a/lazy/tw.lua | 4 + lua/0x29a/lazy_init.lua | 21 +++++ lua/0x29a/set.lua | 12 +++ 13 files changed, 251 insertions(+) create mode 100644 init.lua create mode 100644 lua/0x29a/lazy/autopairs.lua create mode 100644 lua/0x29a/lazy/colorscheme.lua create mode 100644 lua/0x29a/lazy/conform.lua create mode 100644 lua/0x29a/lazy/indent-blankline.lua create mode 100644 lua/0x29a/lazy/lsp.lua create mode 100644 lua/0x29a/lazy/lualine.lua create mode 100644 lua/0x29a/lazy/nvimtree.lua create mode 100644 lua/0x29a/lazy/telescope.lua create mode 100644 lua/0x29a/lazy/treesitter.lua create mode 100644 lua/0x29a/lazy/tw.lua create mode 100644 lua/0x29a/lazy_init.lua create mode 100644 lua/0x29a/set.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..c13b245 --- /dev/null +++ b/init.lua @@ -0,0 +1,4 @@ +vim.g.mapleader = " " -- Set leader key before running lazy + +require("0x29a.lazy_init") +require("0x29a.set") diff --git a/lua/0x29a/lazy/autopairs.lua b/lua/0x29a/lazy/autopairs.lua new file mode 100644 index 0000000..8428d7c --- /dev/null +++ b/lua/0x29a/lazy/autopairs.lua @@ -0,0 +1,10 @@ +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = function() + require('nvim-autopairs').setup({}) + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end +} diff --git a/lua/0x29a/lazy/colorscheme.lua b/lua/0x29a/lazy/colorscheme.lua new file mode 100644 index 0000000..da8f59c --- /dev/null +++ b/lua/0x29a/lazy/colorscheme.lua @@ -0,0 +1,3 @@ +return { + "shaunsingh/nord.nvim" +} diff --git a/lua/0x29a/lazy/conform.lua b/lua/0x29a/lazy/conform.lua new file mode 100644 index 0000000..84bf1de --- /dev/null +++ b/lua/0x29a/lazy/conform.lua @@ -0,0 +1,20 @@ +return { + 'stevearc/conform.nvim', + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + opts = { + formatters_by_ft = { + markdown = { "prettierd" }, + python = { "isort", "black" }, + terraform = { "terraform_fmt" } + }, + -- Set default options + default_format_ops = { + lsp_format = "fallback", + }, + -- Set up format-on-save + format_on_save = { + timeout_ms = 500 + } + } +} diff --git a/lua/0x29a/lazy/indent-blankline.lua b/lua/0x29a/lazy/indent-blankline.lua new file mode 100644 index 0000000..08fc717 --- /dev/null +++ b/lua/0x29a/lazy/indent-blankline.lua @@ -0,0 +1,5 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {} +} diff --git a/lua/0x29a/lazy/lsp.lua b/lua/0x29a/lazy/lsp.lua new file mode 100644 index 0000000..aaeb4fe --- /dev/null +++ b/lua/0x29a/lazy/lsp.lua @@ -0,0 +1,116 @@ +return { + "neovim/nvim-lspconfig", + dependencies = { + "stevearc/conform.nvim", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + }, + + config = function() + require("conform").setup({ + formatters_by_ft = { + } + }) + local cmp = require('cmp') + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities()) + + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "gopls", + "bashls", + "ansiblels", + "dockerls", + "docker_compose_language_service", + "jsonls", + "pylsp", + }, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, + + zls = function() + local lspconfig = require("lspconfig") + lspconfig.zls.setup({ + root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), + settings = { + zls = { + enable_inlay_hints = true, + enable_snippets = true, + warn_style = true, + }, + }, + }) + vim.g.zig_fmt_parse_errors = 0 + vim.g.zig_fmt_autosave = 0 + + end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup { + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "Lua 5.1" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + } + } + } + } + end, + } + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) + }) + + vim.diagnostic.config({ + -- update_in_insert = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + }) + end +} diff --git a/lua/0x29a/lazy/lualine.lua b/lua/0x29a/lazy/lualine.lua new file mode 100644 index 0000000..c118d72 --- /dev/null +++ b/lua/0x29a/lazy/lualine.lua @@ -0,0 +1,9 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require("lualine").setup({ + theme = "auto", + }) + end +} diff --git a/lua/0x29a/lazy/nvimtree.lua b/lua/0x29a/lazy/nvimtree.lua new file mode 100644 index 0000000..42b2b05 --- /dev/null +++ b/lua/0x29a/lazy/nvimtree.lua @@ -0,0 +1,18 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup( + { + filters = { + dotfiles = false, + git_ignored = false + } + } + ) + end +} diff --git a/lua/0x29a/lazy/telescope.lua b/lua/0x29a/lazy/telescope.lua new file mode 100644 index 0000000..d551afe --- /dev/null +++ b/lua/0x29a/lazy/telescope.lua @@ -0,0 +1,14 @@ +return { + 'nvim-telescope/telescope.nvim', + tag = '0.1.6', -- or, branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('telescope').setup({}) + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.git_files, {}) + vim.keymap.set('n', 'fl', builtin.live_grep, {}) + vim.keymap.set('n', ';', builtin.buffers, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + end +} diff --git a/lua/0x29a/lazy/treesitter.lua b/lua/0x29a/lazy/treesitter.lua new file mode 100644 index 0000000..17969a3 --- /dev/null +++ b/lua/0x29a/lazy/treesitter.lua @@ -0,0 +1,15 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + ensure_installed = { + "c", "lua", "vim", "vimdoc", "elixir", "javascript", "html", "python", "typescript", "terraform" + }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/lua/0x29a/lazy/tw.lua b/lua/0x29a/lazy/tw.lua new file mode 100644 index 0000000..b6143f6 --- /dev/null +++ b/lua/0x29a/lazy/tw.lua @@ -0,0 +1,4 @@ +return { + "cappyzawa/trim.nvim", + opts = {} +} diff --git a/lua/0x29a/lazy_init.lua b/lua/0x29a/lazy_init.lua new file mode 100644 index 0000000..7abc4d9 --- /dev/null +++ b/lua/0x29a/lazy_init.lua @@ -0,0 +1,21 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = "0x29a.lazy", + change_detection = { + notify = false + } +}) diff --git a/lua/0x29a/set.lua b/lua/0x29a/set.lua new file mode 100644 index 0000000..703df01 --- /dev/null +++ b/lua/0x29a/set.lua @@ -0,0 +1,12 @@ +vim.cmd.colorscheme("nord") +vim.opt.nu = true +vim.opt.relativenumber = true +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.wrap = false +vim.opt.hlsearch = true +vim.opt.incsearch = true +vim.opt.termguicolors = true