Skip to content
Snippets Groups Projects
Unverified Commit 3cc0b221 authored by amtoine's avatar amtoine
Browse files

add type annotations and format

parent 0f3db064
Branches
No related tags found
No related merge requests found
local M = {}
---@param keys string
---@param func string|function
---@param desc string
---@param bufnr integer
function M.nmap(keys, func, desc, bufnr)
vim.keymap.set('n', keys, func, { buffer = bufnr, silent = true, noremap = true, desc = desc })
end
......
local M = {}
-- return true if the `value` is inside the `list`, false otherwise
function M.is_in(value, list)
for _, item in ipairs(list) do
if value == item then
-- return `true` if the `v` is inside the `values`, `false` otherwise
--
---@generic T: any
---@param v T
---@param values T[]
---@return boolean
function M.is_in(v, values)
for _, item in ipairs(values) do
if v == item then
return true
end
end
......
......@@ -9,7 +9,7 @@ return {
config = function()
local aerial = require("aerial")
aerial.setup({
on_attach = function(bufnr)
on_attach = function(bufnr --[[@param bufnr integer]])
vim.keymap.set('n', '<leader>ap', aerial.prev, { buffer = bufnr })
vim.keymap.set('n', '<leader>an', aerial.next, { buffer = bufnr })
end
......
......@@ -14,7 +14,7 @@ return {
topdelete = { text = '‾' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
on_attach = function(bufnr --[[@param bufnr integer]])
local gs = require("gitsigns")
local function map(mode, lhs, rhs, opts)
......
......@@ -26,7 +26,7 @@ M.multigrep = function(opts)
opts.cwd = opts.cwd or vim.uv.cwd()
local finder = finders.new_async_job {
command_generator = function(prompt)
command_generator = function(prompt --[[@param prompt string]])
if not prompt or prompt == "" then
return nil
end
......
......@@ -17,8 +17,8 @@ local non_default_entries = { url_entry, unpack(lsp_entries) }
local popup_menu_group = vim.api.nvim_create_augroup("nvim_popupmenu", { clear = true })
local disable = function(x) vim.cmd("amenu disable " .. x) end
local enable = function(x) vim.cmd("amenu enable " .. x) end
local disable = function(x --[[ @param x string]]) vim.cmd("amenu disable " .. x) end
local enable = function(x --[[ @param x string]]) vim.cmd("amenu enable " .. x) end
vim.api.nvim_create_autocmd("MenuPopup", {
pattern = "*",
......
......@@ -5,6 +5,12 @@ local state = {
}
}
---@class Size
---@field height integer
---@field width integer
---@param pos string
---@param size Size
local open_terminal = function(pos, size)
return function()
vim.cmd.new()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment