Skip to content

Take code screenshots with freeze straight from Neovim

License

Notifications You must be signed in to change notification settings

TymekDev/freeze.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

freeze.nvim

A plugin wrapping freeze into a :Freeze command.

Requirements

  • Neovim >= 0.10.0
  • MacOS and osascript
  • freeze >= 578e9d0 (for tokyonight themes)
  • JetBrainsMono Nerd Font

Note

These are specific requirements that work for me. I don't plan to work on lowering these requirements.

Setup

Annotations are optional.

---@module "freeze"
---@type LazySpec
{
  "TymekDev/freeze.nvim",
  cmd = "Freeze",
  ---@module "freeze"
  ---@type freeze.Options
  opts = {},
}

Once installed, you can run a health check with:

:Lazy load freeze.nvim | checkhealth freeze

Tip

Use lazydev.nvim to get completions based on the annotations.

Usage

  • :Freeze command works either on a selection or on a range
  • Use :%Freeze to screenshot an entire file
  • Use :Freeze to screenshot the current line
  • Provide an argument to change the theme: :Freeze tokyonight_day
    • Valid values are keys of require("freeze.themes")

Options

Important

The goal is to create screenshots with a MacOS feel. That's why customization options are limited.

{
  config = "full",
  ["font.family"] = "JetBrainsMono Nerd Font",
  output = function()
    return vim.fn.tempname() .. ".png"
  end,
  theme = require("freeze.themes").tokyonight_storm,
}

Motivation

There are a few plugins built around freeze already. However, the alternatives don't copy the PNG image into the clipboard properly. Namely, it cannot be pasted as an image (e.g. into a Slack message).

I already had the core implemented in my dotfiles, so I decided to turn it into a standalone plugin.

About

Take code screenshots with freeze straight from Neovim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages