Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ndom91/freeze.nvim
Charm's "freeze" CLI as a neovim plugin
https://github.com/ndom91/freeze.nvim
charm freeze neovim screenshot
Last synced: 9 days ago
JSON representation
Charm's "freeze" CLI as a neovim plugin
- Host: GitHub
- URL: https://github.com/ndom91/freeze.nvim
- Owner: ndom91
- License: mit
- Created: 2024-05-29T15:21:14.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-06-18T12:32:29.000Z (5 months ago)
- Last Synced: 2024-11-02T11:34:37.385Z (16 days ago)
- Topics: charm, freeze, neovim, screenshot
- Language: Lua
- Homepage:
- Size: 158 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# freeze.nvim
Neovim plugin to consume some text, pass it into Charm's [freeze](https://github.com/charmbracelet/freeze) CLI to generate a screenshot, and then put it into your clipboard.
## ⚡️ Requirements
- Neovim >= **0.8.0**
- Linux: [xclip](https://github.com/astrand/xclip) (x11) or [wl-clipboard](https://github.com/bugaevc/wl-clipboard) (wayland)
- MacOS: [pbcopy](https://ss64.com/mac/pbcopy.html)
- Windows: No additional requirements> [!WARNING]
> Run `:checkhealth freeze` after installation to ensure requirements are satisfied.## 📦 Installation
### [Packer](https://github.com/wbthomason/packer.nvim)
```lua
use {
"ndom91/freeze.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require('freeze').setup({
fontSize = 12,
})
end
}
```### [Lazy](https://github.com/folke/lazy.nvim)
```lua
{
"ndom91/freeze.nvim",
lazy = false,
keys = {
{
"f",
function() require("freeze").exec() end,
mode = { "n", "v" },
desc = "[F]reeze",
noremap = true,
},
},
dependencies = {
"nvim-lua/plenary.nvim",
},
}
```## 🏗️ Usage
You can call freeze with a keybinding or with the `Freeze` command. To make sure the `Freeze` command is always available, make sure to disable lazy loading of the plugin (`lazy = false` in the `Lazy.nvim` configuration).
```lua
vim.keymap.set("n", "f", function() freeze.exec() end)
```In `normal` mode, it will pass on the entire current buffer to be screenshotted. However, if you highlight a block of text in `visual` mode, only that will be used for the screenshot.
### Options
All available options are listed below, these are all passed on to [Charm's CLI flags](https://github.com/charmbracelet/freeze#flags).
```lua
{
-- Defaults
debug = false,
theme = "dracula",
windowControls = true,
showLineNumbers = true,-- Rest
backgroundColor = "#1E1E1E",
margin = 2,
padding = 2,
borderRadius = 8,
borderWidth = 1,
borderColor = "#515151",
shadowBlur = 20,
shadowX = 0,
shadowY = 10,
fontFamily = "monospace",
fontSize = 16,
fontLigatures = true
}
```## 👷 Development
With NixOS, you can make use of the devshell in `flake.nix`.
```sh
nix develop
```### Run tests
Running tests requires [plenary.nvim][plenary] to be checked out in the parent directory of _this_ repository.
You can then run:```bash
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"
```Or if you want to run a single test file:
```bash
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/path_to_file.lua {minimal_init = 'tests/minimal.vim'}"
```- nvim-lua-guide: https://github.com/nanotee/nvim-lua-guide
- plenary: https://github.com/nvim-lua/plenary.nvim## 📝 License
MIT