madmaxieee / code-shot.nvim

Neovim plugin to shot code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code-shot.nvim

Take a picture of the code.

Similar features to silicon.nvim, keep simple, keep reliable.

Dependencies

Usage

Just call require("code-shot").shot(), work in both n and v mode. You can also use :CodeShot command.

  • Shot whole file

  • Shot selection

Config

Default config here.

require("code-shot").setup({
	to_clipboard = false,
	---@return string output file path
	output = function()
		local buf_name = vim.api.nvim_buf_get_name(0)
		return string.match(buf_name, "([^/^%.]+)[^/]*$") .. ".png"
	end,
	---@return string[]
	-- select_area: {s_start: {row: number, col: number}, s_end: {row: number, col: number}} | nil
	options = function(select_area)
		if not select_area then
			return {}
		end
		return {
			"--line-offset",
			select_area.s_start.row,
		}
	end,
})

Add any argument supported by silicon in options. For example, select a theme.

require("code-shot").setup({
	options = function()
		return {
			"--theme",
			"DarkNeon",
		}
	end,
})

About

Neovim plugin to shot code

License:MIT License


Languages

Language:Lua 100.0%