Add type annotations to plugin specs

This commit is contained in:
Marko Korhonen 2023-11-25 14:37:36 +02:00
parent d2112451a7
commit 9e591464ce
No known key found for this signature in database
GPG Key ID: A7F78BCB859CD890
31 changed files with 56 additions and 14 deletions

View File

@ -1,11 +1,13 @@
-- AsciiDoc plugins are grouped together here
return {
-- Vim ♥️ Asciidoctor
--- @type LazyPluginSpec
{
"habamax/vim-asciidoctor",
ft = { "asciidoctor", "asciidoc" },
},
-- AsciiDoc preview
--- @type LazyPluginSpec
{
"tigion/nvim-asciidoc-preview",
ft = { "asciidoctor", "asciidoc" },

View File

@ -1,4 +1,5 @@
-- Automatic brackets
--- @type LazyPluginSpec
return {
"windwp/nvim-autopairs",
config = true

View File

@ -1,8 +1,10 @@
-- Bufferline
--- @type LazyPluginSpec
return {
"akinsho/bufferline.nvim",
version = "*",
dependencies = { "kyazdani42/nvim-web-devicons" },
---@type BufferlineConfig
--- @type BufferlineConfig
opts = {
options = {
diagnostics = "nvim_lsp",

View File

@ -1,4 +1,5 @@
-- Caddyfile syntax support
--- @type LazyPluginSpec
return {
"isobit/vim-caddyfile",
ft = "caddyfile",

View File

@ -1,4 +1,5 @@
-- Autoompletion
--- @type LazyPluginSpec
return {
"hrsh7th/nvim-cmp",
dependencies = {

View File

@ -1,3 +1,5 @@
-- Confirm before quit
--- @type LazyPluginSpec
return {
"yutkat/confirm-quit.nvim",
event = "CmdlineEnter",

View File

@ -1,4 +1,5 @@
-- GitHub Copilot
--- @type LazyPluginSpec
return {
"zbirenbaum/copilot.lua",
opts = {

View File

@ -1,4 +1,5 @@
-- Startup dashboard
--- @type LazyPluginSpec
return {
"glepnir/dashboard-nvim",
event = "VimEnter",

View File

@ -1,3 +1,5 @@
-- Show the current LSP context in winbar
--- @type LazyPluginSpec
return {
"Bekaboo/dropbar.nvim",
}

View File

@ -1,4 +1,5 @@
-- Neovim inside Firefox
--- @type LazyPluginSpec
return {
"glacambre/firenvim",
build = function()

View File

@ -1,2 +1,3 @@
-- Git commands
--- @type LazyPluginSpec
return { "tpope/vim-fugitive" }

View File

@ -1,4 +1,5 @@
-- Edit GPG encrypted files transparently
--- @type LazyPluginSpec
return {
"jamessan/vim-gnupg",
ft = { "gpg" },

View File

@ -1,7 +1,8 @@
-- Indent characters
--- @type LazyPluginSpec
return {
"lukas-reineke/indent-blankline.nvim",
---@type ibl.config
--- @type ibl.config
opts = {
exclude = {
filetypes = {

View File

@ -1,7 +1,8 @@
-- Colorscheme
--- @type LazyPluginSpec
return {
"rebelot/kanagawa.nvim",
---@type KanagawaConfig
--- @type KanagawaConfig
opts = {
compile = true,
dimInactive = true,
@ -46,6 +47,7 @@ return {
}
end,
},
--- @param opts KanagawaConfig
config = function(_, opts)
require("kanagawa").setup(opts)
vim.cmd("colorscheme kanagawa")

View File

@ -1,4 +1,5 @@
-- Statusline
--- @type LazyPluginSpec
return {
"nvim-lualine/lualine.nvim",
dependencies = { "kyazdani42/nvim-web-devicons" },

View File

@ -1,4 +1,5 @@
-- Snippets plugin
--- @type LazyPluginSpec
return {
"L3MON4D3/LuaSnip",
-- Snippets collection

View File

@ -1,4 +1,5 @@
-- Markdown preview
--- @type LazyPluginSpec
return {
"iamcco/markdown-preview.nvim",
build = "cd app && yarn install",

View File

@ -1,5 +1,6 @@
-- Package manager for LSP servers, DAP adapters etc.
-- It also handles starting all of my LSP servers
--- @type LazyPluginSpec
return {
"williamboman/mason.nvim",
dependencies = {
@ -13,7 +14,7 @@ return {
-- Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.
{
"folke/neodev.nvim",
---@type LuaDevOptions
--- @type LuaDevOptions
opts = {
override = function(root_dir, library)
local dotfiles_path = tostring(vim.fn.expand("~/git/dotfiles"))

View File

@ -1,4 +1,5 @@
-- Library of 30+ independent Lua modules improving overall Neovim
--- @type LazyPluginSpec
return {
"echasnovski/mini.nvim",
version = "*",

View File

@ -1,4 +1,5 @@
-- Formatter plugin
--- @type LazyPluginSpec
return {
"sbdchd/neoformat",
keys = {

View File

@ -1,10 +1,11 @@
-- Replace much of neovim's default UI
-- with a modern replacement
--- @type LazyPluginSpec
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" },
---@type NoiceConfig
--- @type NoiceConfig
opts = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**

View File

@ -1,4 +1,5 @@
-- High performance color highlighter
--- @type LazyPluginSpec
return {
"norcalli/nvim-colorizer.lua",
config = true,

View File

@ -1,3 +1,5 @@
-- Debug adapter for NeoVim
--- @type LazyPluginSpec
return {
"mfussenegger/nvim-dap",
config = function()

View File

@ -1,4 +1,5 @@
-- Tree explorer
--- @type LazyPluginSpec
return {
"kyazdani42/nvim-tree.lua",
lazy = false,

View File

@ -1,4 +1,5 @@
-- Make editing passwords safer
--- @type LazyPluginSpec
return {
"https://git.zx2c4.com/password-store",
config = function(plugin)

View File

@ -1,3 +1,5 @@
-- Customize statuscolumn
--- @type LazyPluginSpec
return {
"luukvbaal/statuscol.nvim",
dependencies = {

View File

@ -1,2 +1,3 @@
-- Do stuff as sudo
--- @type LazyPluginSpec
return { "lambdalisue/suda.vim" }

View File

@ -1,3 +1,4 @@
--- @type LazyPluginSpec
return {
"nvim-telescope/telescope.nvim",
dependencies = {

View File

@ -1,14 +1,15 @@
return {
-- Improved syntax highlighting, text objects and more
--- @type LazyPluginSpec
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
init = function(plugin)
init = function()
require("nvim-treesitter.install").update({
with_sync = true,
})
end,
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
--- @type TSConfig
opts = {
highlight = { enable = true },
indent = { enable = true },
@ -70,10 +71,10 @@ return {
},
},
},
---@param opts TSConfig
--- @param opts TSConfig
config = function(_, opts)
if type(opts.ensure_installed) == "table" then
---@type table<string, boolean>
--- @type table<string, boolean>
local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then
@ -91,13 +92,15 @@ return {
config = function()
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
--- @type table<string,fun(...)>
local move = require("nvim-treesitter.textobjects.move")
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
--- @type table<string,string>
local config = configs.get_module("textobjects.move")[name]
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
@ -115,8 +118,9 @@ return {
},
-- Automatically add closing tags for HTML and JSX
--- @type LazyPluginSpec
{
"windwp/nvim-ts-autotag",
opts = {},
config = true,
},
}

View File

@ -1,13 +1,15 @@
-- Better folds
--- @type LazyPluginSpec
return {
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
---@type UfoConfig
--- @type UfoConfig
opts = {
close_fold_kinds = {
"imports",
},
},
--- @param opts UfoConfig
config = function(_, opts)
local ufo = require("ufo")
ufo.setup(opts)

View File

@ -1,6 +1,7 @@
-- Display possible keybinds
-- Here I have also defined some generic keybinds
-- Plugin specific keybinds are set up in plugin configuration file
--- @type LazyPluginSpec
return {
"folke/which-key.nvim",
config = function()