Skip to content

svblsvljb-contrib/silicon.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

silicon.nvim

Render beautiful image of your code in neovim using silicon.

Release License Neovim version

image

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 key is required if you want to save image to file instead of clipboard
  output = string
  -- The following keys are all optional
  -- with default values
  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,
  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'.
  },
}

Usage

Command:

:'<,'>Silicon [file]
# Defaults to clipboard if [file] is not 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 88.2%
  • Shell 11.8%