Giter Site home page Giter Site logo

freeze.nvim's Introduction

freeze.nvim

Neovim plugin to consume some text, pass it into Charm's freeze CLI to generate a screenshot, and then put it into your clipboard.

⚡️ Requirements

Warning

Run :checkhealth freeze after installation to ensure requirements are satisfied.

📦 Installation

use {
  "ndom91/freeze.nvim",
  requires = { "nvim-lua/plenary.nvim" },
  config = function()
    require('freeze').setup({
      fontSize = 12,
    })
  end
}
{
  "ndom91/freeze.nvim",
  lazy = false,
  keys = {
    {
      "<leader>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).

vim.keymap.set("n", "<leader>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.

{
  -- 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.

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:

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:

nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/path_to_file.lua {minimal_init = 'tests/minimal.vim'}"

📝 License

MIT

freeze.nvim's People

Contributors

ndom91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.