PriceHiller / fix-wl-copy-date-formatting

Beautiful code snippet images right in the most epic editor :chef_kiss:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

silicon.lua

silicon is a lua plugin for neovim to generate beautiful images of code snippet using silicon

recording.mp4

✨ Features

  • beautiful images of source code, saved to preferred place.
  • copy to clipboard

⚡️ Requirements

📦 Installation

Install the plugin with your preferred package manager:

-- Lua
use {
  "narutoxy/silicon.lua",
  requires = { "nvim-lua/plenary.nvim" },
  config = function()
    require('silicon').setup({})
  end
}
" Vim Script
Plug 'nvim-lua/plenary.nvim'
Plug 'narutoxy/silicon.lua'

lua require('silicon').setup({})

⚙️ Configuratioon

silicon comes with the following defaults:

{
	theme = "auto",
	output = "SILICON_${year}-${month}-${date}_${time}.png", -- auto generate file name based on time (absolute or relative to cwd)
	bgColor = vim.g.terminal_color_5,
	bgImage = "", -- path to image, must be png
	roundCorner = true,
	windowControls = true,
	lineNumber = true,
	font = "monospace",
	lineOffset = 1, -- from where to start line number
	linePad = 2, -- padding between lines
	padHoriz = 80, -- Horizontal padding
	padVert = 100, -- vertical padding
	shadowBlurRadius = 10,
	shadowColor = "#555555",
	shadowOffsetX = 8,
	shadowOffsetY = 8,
    gobble = false, -- enable lsautogobble like feature
}

🚀 Usage

  1. Select code snippet in visual mode.
  • Generate images of selected snippet.
lua require("silicon").visualise_api({})
  • Generate images of whole buffer with the selected snippet being highlighted by lighter background.
lua require("silicon").visualise_api({show_buf = true})
  • Copy the image of snippet to clipboard.
lua require("silicon").visualise_api({to_clip = true})

NOTE: The default path of image is the current working directory of the editor, but you can change it by

require("silicon").setup({
        output = "/home/astro/Pictures/SILICON_$year-$month-$date-$time.png"),
})

About

Beautiful code snippet images right in the most epic editor :chef_kiss:


Languages

Language:Lua 94.2%Language:Nix 5.8%