Vim Silicon

Vim plugin for generating images of source code using
Alternatives To Vim Silicon
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Vim Plug30,869
6 months ago126mitVim Script
:hibiscus: Minimalist Vim Plugin Manager
4 days ago7mitVim Script
The ultimate Vim configuration (vimrc)
a day ago20July 26, 20221bsd-2-clauseC
n³ The unorthodox terminal file manager
Vim Go15,560
17 days ago12February 16, 202229otherVim Script
Go development plugin for Vim
Vim Pathogen11,902
a year ago27vimVim Script
pathogen.vim: manage your runtimepath
Tmux Resurrect9,931
2 months ago214mitShell
Persists tmux environment across system restarts.
Nvim Lspconfig8,090
a day ago57apache-2.0Lua
Quickstart configs for Nvim LSP
2 days ago116gpl-3.0Python
UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
6 months ago3bsd-2-clauseRuby
YADR - The best vim,git,zsh plugins and the cleanest vimrc you've ever seen
18 days agomitVim Script
A light and configurable statusline/tabline plugin for Vim
Alternatives To Vim Silicon
Select To Compare

Alternative Project Comparisons


This plugin provides a command which, given a visual selection or buffer, will generate a neat looking and highly customizable image of the source code. The image generator is Aloxaf/silicon, which is similar to, but does not require an internet connection.


First, you need to install cargo and silicon:

# Install cargo
curl -sSf | sh

# Install silicon
cargo install silicon

# Add cargo-installed binaries to the path
export PATH="$PATH:$CARGO_HOME/bin"

Then, if using vim-plug, add this to your ~/.vimrc:

Plug 'segeljakt/vim-silicon'


This plugin provides a single command Silicon:

" Generate an image of the current buffer and write it to /path/to/output.png
:Silicon /path/to/output.png

" Generate an image of the current buffer and write it to /path/to/output.png and clipboard.
:Silicon /path/to/output.png --to-clipboard

" Generate an image of the current buffer and write it to /path/to/<filename>.png
:Silicon /path/to/

" Generate an image of the current visual line selection and write it to /path/to/output.png
:'<,'>Silicon /path/to/output.png

" Generate an image of the current buffer, with the current visual line selection highlighted.
:'<,'>Silicon! /path/to/output.png


This is the default configuration:

let g:silicon = {
      \   'theme':              'Dracula',
      \   'font':                  'Hack',
      \   'background':         '#AAAAFF',
      \   'shadow-color':       '#555555',
      \   'line-pad':                   2,
      \   'pad-horiz':                 80,
      \   'pad-vert':                 100,
      \   'shadow-blur-radius':         0,
      \   'shadow-offset-x':            0,
      \   'shadow-offset-y':            0,
      \   'line-number':           v:true,
      \   'round-corner':          v:true,
      \   'window-controls':       v:true,
      \ }

Images are by default saved to the working directory with a unique filename, you can change this filepath by setting:

let g:silicon['output'] = '~/images/silicon-{time:%Y-%m-%d-%H%M%S}.png'

To get the list of available themes, you can run this in the terminal:

silicon --list-themes

Silicon internally uses bat's themes and syntaxes. To get the list of supported languages, you could:

cargo install bat
bat --list-languages

For more details about options, see Aloxaf/silicon.

Advanced Configuration

Instead of assigning values to flags in g:silicon, you can assign functions which expand into values right before generating the images.

For example, to save images into different directories depending on whether you are at work or not:

let s:workhours = {
      \ 'Monday':    [8, 16],
      \ 'Tuesday':   [9, 17],
      \ 'Wednesday': [9, 17],
      \ 'Thursday':  [9, 17],
      \ 'Friday':    [9, 15],
      \ }

function! s:working()
    let day = strftime('%u')
    if has_key(s:workhours, day)
      let hour = strftime('%H')
      let [start_hour, stop_hour] = s:workhours[day]
      if start_hour <= hour && hour <= stop_hour
        return "~/Work-Snippets/"
    return "~/Personal-Snippets/"

let g:silicon['output'] = function('s:working')


Credits goes to:

Popular Plugin Projects
Popular Vim Projects
Popular Libraries Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Vim Plugin