silicon-0.5.mp4
- nvim
v0.10
- [Optional] cargo and rust toolchain
use {'krivahtoo/silicon.nvim', run = './install.sh'}
Build from source (requires cargo)
use {'krivahtoo/silicon.nvim', run = './install.sh build'}
Plug 'krivahtoo/silicon.nvim', { 'do': './install.sh' }
Build from source (requires cargo)
Plug 'krivahtoo/silicon.nvim', { 'do': './install.sh build' }
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:
{
-- Output configuration for the saved image
output = {
-- (string) The full path of the file to save to.
file = "",
-- (boolean) Whether to copy the image to clipboard instead of saving to file.
clipboard = true,
-- (string) Where to save images, defaults to the current directory.
-- e.g. /home/user/Pictures
path = ".",
-- (string) The filename format to use. Can include placeholders for date and time.
-- https://time-rs.github.io/book/api/format-description.html#components
format = "silicon_[year][month][day]_[hour][minute][second].png",
},
-- Font and theme configuration for the screenshot.
font = 'Hack=20', -- (string) The font and font size to use for the screenshot.
-- (string) The color theme to use for syntax highlighting.
-- It can be a theme name or path to a .tmTheme file.
theme = 'Dracula',
-- Background and shadow configuration for the screenshot
background = '#eff', -- (string) The background color for the screenshot.
shadow = {
blur_radius = 0.0, -- (number) The blur radius for the shadow, set to 0.0 for no shadow.
offset_x = 0, -- (number) The horizontal offset for the shadow.
offset_y = 0, -- (number) The vertical offset for the shadow.
color = '#555' -- (string) The color for the shadow.
},
pad_horiz = 100, -- (number) The horizontal padding.
pad_vert = 80, -- (number) The vertical padding.
line_number = false, -- (boolean) Whether to show line numbers in the screenshot.
line_pad = 2, -- (number) The padding between lines.
line_offset = 1, -- (number) The starting line number for the screenshot.
tab_width = 4, -- (number) The tab width for the screenshot.
gobble = false, -- (boolean) Whether to trim extra indentation.
highlight_selection = false, -- (boolean) Whether to capture the whole file and highlight selected lines.
round_corner = true,
window_controls = true, -- (boolean) Whether to show window controls (minimize, maximize, close) in the screenshot.
window_title = nil, -- (function) A function that returns the window title as a string.
-- Watermark configuration for the screenshot
watermark = {
text = nil, -- (string) The text to use as the watermark, set to nil to disable.
color = '#222', -- (string) The color for the watermark text.
-- (string) The style for the watermark text, possible values are:
-- 'bold', 'italic', 'bolditalic', or anything else defaults to 'regular'.
style = 'bold',
},
}
require('silicon').setup {
font = 'FantasqueSansMono Nerd Font=26',
background = '#87f',
theme = 'Monokai Extended',
line_number = true,
pad_vert = 80,
pad_horiz = 50,
output = {
path = "/home/krivah/Pictures/Screenshots"
},
watermark = {
text = ' @krivahtoo',
},
window_title = function()
return vim.fn.fnamemodify(vim.fn.bufname(vim.fn.bufnr()), ':~:.')
end,
}
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