require("lz.n").load({ -- { -- "nvim-treesitter-context", -- event = "BufReadPost", -- after = function() -- require("treesitter-context").setup({ -- enable = true, -- max_lines = 3, -- How many lines the window should span -- }) -- end, -- }, { "nvim-lint", event = { "BufReadPre", "BufNewFile" }, after = function() local lint = require("lint") lint.linters_by_ft = { markdown = { "markdownlint-cli2" }, } -- Create autocommand which carries out the actual linting -- on the specified events. local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { group = lint_augroup, callback = function() -- Only run the linter in buffers that you can modify in order to -- avoid superfluous noise, notably within the handy LSP pop-ups that -- describe the hovered symbol using Markdown. if vim.bo.modifiable then lint.try_lint() end end, }) end, }, { "nvim-autopairs", event = "InsertEnter", after = function() require("nvim-autopairs").setup({ check_ts = true, }) end, }, { "nvim-treesitter", dep_of = "render-markdown.nvim", -- cmd = { "" }, event = "DeferredUIEnter", -- ft = "", -- keys = "", -- colorscheme = "", load = function(name) vim.cmd.packadd(name) vim.cmd.packadd("nvim-treesitter-textobjects") end, after = function() -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` require("nvim-treesitter.configs").setup({ highlight = { enable = true }, indent = { enable = true }, incremental_selection = { enable = true, keymaps = { init_selection = "", node_incremental = "", scope_incremental = "", node_decremental = "", }, }, textobjects = { select = { enable = true, lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { -- You can use the capture groups defined in textobjects.scm ["aa"] = "@parameter.outer", ["ia"] = "@parameter.inner", ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", }, }, move = { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { ["]m"] = "@function.outer", ["]]"] = "@class.outer", }, goto_next_end = { ["]M"] = "@function.outer", ["]["] = "@class.outer", }, goto_previous_start = { ["[m"] = "@function.outer", ["[["] = "@class.outer", }, goto_previous_end = { ["[M"] = "@function.outer", ["[]"] = "@class.outer", }, }, swap = { enable = true, swap_next = { ["a"] = "@parameter.inner", }, swap_previous = { ["A"] = "@parameter.inner", }, }, }, }) end, }, { "conform.nvim", event = "BufWritePre", cmd = "ConformInfo", keys = { { "f", function() require("conform").format({ async = true, lsp_format = "fallback" }) end, mode = "", desc = "[F]ormat buffer", }, }, after = function() require("conform").setup({ notify_on_error = true, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else return { timeout_ms = 500, lsp_format = "fallback", } end end, formatters_by_ft = { lua = { "stylua" }, -- Conform can also run multiple formatters sequentially python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, }, }) end, }, { "friendly-snippets", }, { "luasnip", before = function() require("lz.n").trigger_load("friendly-snippets") end, after = function() require("luasnip.loaders.from_vscode").lazy_load() end, }, { "blink.cmp", before = function() -- Trigger lazydev so it's ready for blink source require("lz.n").trigger_load({ "lazydev.nvim", "luasnip" }) end, event = "VimEnter", after = function() require("blink.cmp").setup({ keymap = { preset = "default", -- [Up/Down] [""] = { "select_next", "fallback" }, [""] = { "select_prev", "fallback" }, -- Overrides Signature Help -- [Insert Suggestion] [""] = { "select_and_accept", "fallback" }, -- [Remap Signature Help] -- Since we took , let's move signature help to (optional) [""] = { "show_signature", "hide_signature", "fallback" }, }, appearance = { nerd_font_variant = "mono", }, completion = { -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = true, auto_show_delay_ms = 500, }, menu = { draw = { columns = { { "kind_icon" }, { "label", gap = 1 } }, components = { label = { text = function(ctx) return require("colorful-menu").blink_components_text(ctx) end, highlight = function(ctx) return require("colorful-menu").blink_components_highlight(ctx) end, }, }, }, }, }, cmdline = { completion = { menu = { auto_show = true, }, }, keymap = { preset = "inherit" }, }, sources = { default = { "lsp", "path", "snippets", "lazydev", }, providers = { lazydev = { module = "lazydev.integrations.blink", score_offset = 100 }, }, }, snippets = { preset = "luasnip" }, fuzzy = { implementation = "prefer_rust_with_warning" }, -- Shows a signature help window while you type arguments for a function signature = { enabled = true, }, }) end, }, })