Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/niuiic/code-shot.nvim
- Owner: niuiic
- License: mit
- Created: 2023-08-18T08:14:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-11T04:33:18.000Z (6 months ago)
- Last Synced: 2024-07-31T20:49:59.895Z (3 months ago)
- Topics: heovim, plugin, shot-code
- Language: Lua
- Homepage:
- Size: 8.79 KB
- Stars: 60
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - niuiic/code-shot.nvim - Take a picture of the code. (Media / Cursorline)
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,
})
```