Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/niuiic/code-shot.nvim

Neovim plugin to shot code
https://github.com/niuiic/code-shot.nvim

heovim plugin shot-code

Last synced: 14 days ago
JSON representation

Neovim plugin to shot code

Awesome Lists containing this project

README

        

# code-shot.nvim

Take a picture of the code.

Similar features to [silicon.nvim](https://github.com/krivahtoo/silicon.nvim), keep simple, keep reliable.

[More neovim plugins](https://github.com/niuiic/awesome-neovim-plugins)

## Dependencies

- [silicon](https://github.com/Aloxaf/silicon)
- [niuiic/core.nvim](https://github.com/niuiic/core.nvim)

## Usage

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

- Shot whole file

- Shot selection

## Config

Default config here.

```lua
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.

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