nvim: add comments to undocumented functions
This commit is contained in:
parent
b776aa4260
commit
62dacd2c04
3 changed files with 19 additions and 1 deletions
|
@ -41,7 +41,7 @@ M.toggle = function()
|
|||
end
|
||||
end
|
||||
|
||||
---Crate a lualine component that shows an icon when autoformatting is enabled.
|
||||
---Create a lualine component that shows an icon when autoformatting is enabled.
|
||||
---@return table component
|
||||
M.lualine = function()
|
||||
local icon = require("fschauen.util.icons").ui.Format
|
||||
|
|
|
@ -3,6 +3,10 @@ local M = {}
|
|||
local util = require("fschauen.util")
|
||||
local exists = util.exists
|
||||
|
||||
---Find lua module source.
|
||||
---@param modname string Module name.
|
||||
---@return table results List of source files in the runtime path that implement
|
||||
--- `modname`.
|
||||
local find_module_sources = function(modname)
|
||||
modname = modname:gsub("^%.+", ""):gsub("/", ".")
|
||||
local base = "lua/" .. modname:gsub("%.", "/")
|
||||
|
@ -18,6 +22,10 @@ local find_module_sources = function(modname)
|
|||
return results
|
||||
end
|
||||
|
||||
---Execute lua script in lines.
|
||||
---@param first integer|nil First line to execute. If nil, execute current line.
|
||||
---@param last integer|nil Last line to execute. If nil, execute only the first
|
||||
--- line.
|
||||
M.execute_lines = function(first, last)
|
||||
first = first or vim.fn.line(".")
|
||||
last = last or first
|
||||
|
@ -25,6 +33,7 @@ M.execute_lines = function(first, last)
|
|||
loadstring(code)()
|
||||
end
|
||||
|
||||
---Execute current selection as a lua chunk.
|
||||
M.execute_selection = function()
|
||||
local selection = { vim.fn.line("v"), vim.fn.line(".") }
|
||||
table.sort(selection)
|
||||
|
@ -39,6 +48,9 @@ M.execute_file = function(path)
|
|||
end
|
||||
end
|
||||
|
||||
---Edit a lua module.
|
||||
---@param modname string|nil Module name. If nil, edit path name under cursor
|
||||
--- (meant to be mapped to `gf`).
|
||||
M.go_to_module = function(modname)
|
||||
modname = modname or vim.fn.expand("<cfile>")
|
||||
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
local M = {}
|
||||
|
||||
---Toggle 'number' and disable 'relativenumber'.
|
||||
M.toggle_number = function()
|
||||
vim.wo.number = not vim.wo.number
|
||||
vim.wo.relativenumber = false
|
||||
end
|
||||
|
||||
---Toggle 'relativenumber' and enable 'number' if disabled.
|
||||
M.toggle_relativenumber = function()
|
||||
vim.wo.relativenumber = not vim.wo.relativenumber
|
||||
vim.wo.number = vim.wo.relativenumber or vim.wo.number
|
||||
end
|
||||
|
||||
---Toggle 'list'.
|
||||
M.toggle_list = function() vim.wo.list = not vim.wo.list end
|
||||
|
||||
---Toggle 'wrap'.
|
||||
M.toggle_wrap = function() vim.wo.wrap = not vim.wo.wrap end
|
||||
|
||||
---Toggle 'spell'.
|
||||
M.toggle_spell = function() vim.wo.spell = not vim.wo.spell end
|
||||
|
||||
---Set buffer options for git commits.
|
||||
M.set_gitcommit_buffer_options = function()
|
||||
vim.bo.textwidth = 72
|
||||
vim.opt.formatoptions:append("t") -- wrap text on 'textwidth'
|
||||
|
|
Loading…
Add table
Reference in a new issue