Skip to content

PriceHiller/silicon.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

silicon.nvim

Render beautiful image of your code in neovim using silicon.

Release License Neovim version

silicon.mp4

Installation

Requirements

  • nvim v0.7
  • [Optional] cargo and rust toolchain

Packer

use {'krivahtoo/silicon.nvim', run = './install.sh'}

Build from source (requires cargo)

use {'krivahtoo/silicon.nvim', run = './install.sh build'}

Vim-Plug

Plug 'krivahtoo/silicon.nvim', { 'do': './install.sh' }

Build from source (requires cargo)

Plug 'krivahtoo/silicon.nvim', { 'do': './install.sh build' }

Configuration

Initialize the plugin.

Lua init file:

require('silicon').setup({
  font = 'FantasqueSansMono Nerd Font=16',
  theme = 'Monokai Extended',
})

Vimscript init file:

lua << EOF
require('silicon').setup({
  font = 'FantasqueSansMono Nerd Font=16',
  theme = 'Monokai Extended',
})
EOF

The setup function accepts the following table:

{
  -- The following keys are all optional
  -- with default values
  -- The following key is required if you want to save image to file instead of clipboard
  output = {
    file = "", -- full path of the file to save to.
    clipboard = true,
    path = ".", -- where to save images e.g. /home/user/Pictures
    format = "silicon_[year][month][day]_[hour][minute][second].png",
  },
  font = 'Hack=20',
  theme = 'Dracula',
  background = '#eff',
  shadow = {
    blur_radius = 0.0,
    offset_x = 0,
    offset_y = 0,
    color = '#555'
  },
  pad_horiz = 100,
  pad_vert = 80,
  line_number = false,
  line_pad = 2,
  line_offset = 1,
  tab_width = 4,
  round_corner = true,
  window_controls = true,
  window_title = nil, -- a function returning window title as a string
  watermark = {
    text = nil, -- add this to enable watermark on the bottom-right.
    color = '#222',
    style = 'bold', -- possible values: 'bold' | 'italic' | 'bolditalic' | anything else defaults to 'regular'.
  },
}

Example

image

Usage

Command:

:'<,'>Silicon[!] [file]
# Defaults to clipboard if [file] is not specified.
# With bang file is saved to specified output.file in the
# output.format specified
# Also mapped to 'SS' in Visual mode

About

Neovim plugin for silicon in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 90.8%
  • Shell 9.2%