diff options
Diffstat (limited to 'config/nvim/lua/plugins.lua')
-rw-r--r-- | config/nvim/lua/plugins.lua | 191 |
1 files changed, 132 insertions, 59 deletions
diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index fa736e3..6e33f5b 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -4,18 +4,68 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd([[packadd packer.nvim]]) end +local treesitter_formaters = { + "c", + "lua", + "kconfig", + "make", + "markdown", + "markdown_inline", + "meson", + "ninja", + "ini", + "gitcommit", + "git_rebase", + "git_config", + "nix", + "python", + "toml", + "vim", + "vimdoc", + "yaml", +} + require("packer").startup(function(use) use("wbthomason/packer.nvim") - -- Visual + -- Visual ------------------------------------------------------------------ use("shaunsingh/nord.nvim") use("MunifTanjim/nui.nvim") - use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) - use("lukas-reineke/indent-blankline.nvim") + use({ + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = treesitter_formaters, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + }) + end, + }) + use({ + "lukas-reineke/indent-blankline.nvim", + config = function() + local highlight = { "CursorColumn", "Whitespace" } + require("ibl").setup({ + indent = { highlight = highlight, char = "" }, + whitespace = { + highlight = highlight, + remove_blankline_trail = false, + }, + scope = { enabled = false }, + }) + end, + }) use("itchyny/lightline.vim") - -- Files navigation - use("nvim-lua/plenary.nvim") - use("nvim-telescope/telescope.nvim") - -- Git + use("josa42/nvim-lightline-lsp") + use({ + "nvim-telescope/telescope.nvim", + config = function() + require("mytelescope") + end, + }) + -- Git --------------------------------------------------------------------- use("tpope/vim-fugitive") use("airblade/vim-gitgutter") use({ @@ -30,71 +80,94 @@ require("packer").startup(function(use) run = function() require("gitlab.server").build(true) end, + config = function() + require("diffview").setup() + require("gitlab").setup() + end, }) - -- Programming + -- Programming ------------------------------------------------------------- use("neovim/nvim-lspconfig") use("p00f/clangd_extensions.nvim") - use("w0rp/ale") - use("maximbaz/lightline-ale") + use({ + "mfussenegger/nvim-lint", + config = function() + local lint = require("lint") + lint.linters_by_ft = { + c = { "cppcheck", "flawfinder", "editorconfig-checker" }, + lua = { "selene", "editorconfig-checker" }, + markdown = { "vale" }, + nix = { "statix", "deadnix", "nix", "editorconfig-checker" }, + python = { "pylint", "mypy", "pydocstyle", "editorconfig-checker" }, + sh = { "shellcheck", "editorconfig-checker" }, + } + lint.linters.deadnix = { + cmd = "deadnix", + stdin = false, + args = { "--output-format", "json" }, + stream = "stdout", + parser = function(output) + local lines = vim.fn.split(output, "\n") + local diagnostics = {} + for _, line in ipairs(lines) do + local ok, decoded = pcall(vim.json.decode, line) + if ok and decoded.file ~= nil then + for _, result in ipairs(decoded.results) do + table.insert(diagnostics, { + lnum = result.line, + end_lnum = result.line, + col = result.column, + end_col = result.endColumn, + severity = vim.diagnostic.severity.HINT, + source = "deadnix", + message = result.message, + }) + end + end + end + return diagnostics + end, + } + vim.api.nvim_create_autocmd({ "BufReadPost", "BufWrite", "InsertLeave" }, { + callback = function() + lint.try_lint() + end, + }) + end, + }) + use({ + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + formatters_by_ft = { + c = { "clang-format", "trim_newlines", "twim_whitespace" }, + json = { "jq", "trim_newlines", "twim_whitespace" }, + lua = { "stylua", "trim_newlines", "twim_whitespace" }, + nix = { "alejandra", "trim_newlines", "twim_whitespace" }, + python = { "isort", "black", "trim_newlines", "twim_whitespace" }, + sh = { "shfmt", "trim_newlines", "twim_whitespace" }, + yaml = { "yq", "trim_newlines", "twim_whitespace" }, + }, + }) + end, + }) use("SirVer/ultisnips") use("honza/vim-snippets") use("craigemery/vim-autotag") use("scrooloose/nerdcommenter") - -- Movement, format and others + -- Movement, format and others --------------------------------------------- use("tpope/vim-surround") use("tpope/vim-repeat") use("dhruvasagar/vim-table-mode") + -- Filetypes --------------------------------------------------------------- + use("tmhedberg/SimpylFold") + use("LnL7/vim-nix") + use("kaarmu/typst.vim") + use("aliou/bats.vim") - -- Indent blanklike character specificaiton - local highlight = { "CursorColumn", "Whitespace" } - require("ibl").setup({ - indent = { highlight = highlight, char = "" }, - whitespace = { - highlight = highlight, - remove_blankline_trail = false, - }, - scope = { enabled = false }, - }) - -- Treesitter - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "c", - "lua", - "kconfig", - "make", - "markdown", - "markdown_inline", - "meson", - "ninja", - "ini", - "gitcommit", - "git_rebase", - "git_config", - "nix", - "python", - "toml", - "vim", - "vimdoc", - "yaml", - }, - highlight = { - enable = true, - -- TODO why we must set this to true? - additional_vim_regex_highlighting = true, - }, - }) - - -- LSP + -- LSP --------------------------------------------------------------------- local lspconfig = require("lspconfig") lspconfig.clangd.setup({}) - lspconfig.rnix.setup({}) + lspconfig.nil_ls.setup({}) lspconfig.pylsp.setup({}) lspconfig.bashls.setup({}) - - -- Telescope - require("mytelescope") - - -- Gitlab - require("diffview").setup() - require("gitlab").setup() end) |