Skip to content

niuiic/code-shot.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

code-shot.nvim

Take a picture of the code.

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

More neovim plugins

Dependencies

Usage

Just call require("code-shot").shot(), work in both n, v and V mode.

  • Shot whole file

  • Shot selection

Config

Default config here.

require("code-shot").setup({
	---@return string output file path
	output = function()
		local core = require("core")
		local buf_name = vim.api.nvim_buf_get_name(0)
		return core.file.name(buf_name) .. ".png"
	end,
	---@return string[]
	-- select_area: {start_line: number, end_line: number} | nil
	options = function(select_area)
		if not select_area then
			return {}
		end
		return {
			"--line-offset",
			select_area.start_line,
		}
	end,
})

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

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