Awesome
<a name="readme-top"></a>
<div align="center">Freeze Neovim Plugin
Take a "screenshot" of your code by turning it into an image, thanks to freeze by charm.
Report an issue · Suggest a feature
Remember to always follow the code of conduct
</div>[!warning]
This plugin requires Neovim v0.9.0 or higher
Installation
Using your plugin manager at your disposal, in the example lazy is going to be used.
[!note]
If you don't have freeze installed, and you are have golang installed, it will
go install github.com/charmbracelet/freeze@latest
for you 🫡.In the case that you don't have neither of those, don't you worry 😉, we got you cover. It will install
freeze
usingcURL
to the freeze's releases page.
- Default installation:
return {
"AlejandroSuero/freeze-code.nvim",
config = function()
require("freeze-code").setup()
end,
}
[!note]
You can also install it using Rocks.nvim
:Rocks install freeze-code.nvim
Also as
luarocks install freeze-code.nvim
- Customizable installation:
return {
"AlejandroSuero/freeze-code.nvim",
config = function()
require("freeze-code.nvim").setup({
-- your configuration goes here
})
end,
}
[!note]
See default configuration below.
local opts = {
freeze_path = vim.fn.exepath("freeze"), -- where is freeze installed
copy_cmd = "gclip", -- the default copy commands `gclip` or native to your OS (see below)
copy = false, -- copy after screenshot option
open = false, -- open after screenshot option
dir = vim.env.PWD, -- where is the image going to be saved "." as default
freeze_config = { -- configuration options for `freeze` command
output = "freeze.png",
config = "base",
theme = "default",
},
}
[!note]
The default command will be gclip if it is installed, otherwise ...
The commands to copy, as defaults per OS will be, for example, for Windows:
Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Clipboard]::SetImage(...)
, for Linux:xclip -selection clipboard -t image/png ...
if is anX11
session,wl-copy < ...
if is aWayland
session, and for MacOS:osascript -e 'to set the clipboard to (read (POSIX file "...") as «class PNGf»)'
.
Once you have it installed, you can use :checkhealt freeze-code
to see if there
are any problems with the installation or you need to install additional tools.
Usage
To use this plugin, simply call :Freeze
and it will take a screenshot of the
current buffer and save it in the dir
path you have configured.
If you want to take a screenshot of a specific line, you can use the :Freeze
in
visual mode, and it will take a screenshot of the selected lines.
Keymaps
local fz_api = require("freeze-code.utils.api")
vim.keymap.set("n", "<leader>fz", fz_api.freeze)
vim.keymap.set("v", "<leader>fz", function()
fz_api.freeze(vim.fn.line("'<"), vim.fn.line("'>"))
end)
-- or using `<cmd>Freeze<cr>`
vim.keymap.set("n", "<leader>fl", fz.freeze_line)
-- or using `<cmd>FreezeLine<cr>`
Contributing
Thank you to everyone that is contributing and to those who want to contribute. Any contribution is welcomed!
Quick guide:
- Fork this project.
- Clone your fork (
git clone <fork-URL>
). - Add main repo as remote (
git remote add upstream <main-repo-URL>
). - Create a branch for your changes (
git switch -c feature/your-feature
orgit switch -c fix/your-fix
). - Commit your changes (
git commit -m "feat(...): ..."
). - Push to your fork (
git push origin <branch-name>
). - Open a PR.
For more information, check CONTRIBUTING.md.
<div align="right"> (<a href="#readme-top">Back to top</a>) </div>