GitHub - segeljakt/vim-silicon: Vim plugin for generating images of source code...
source link: https://github.com/segeljakt/vim-silicon
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
vim-silicon
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 https://github.com/Aloxaf/silicon, which is similar to https://carbon.now.sh, but does not require an internet connection.
Installation
First, you need to install cargo and silicon:
# Install cargo curl https://sh.rustup.rs -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'
Commands
The available commands are Silicon
, and SiliconHighlight
:
" 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 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. :'<,'>SiliconHighlight /path/to/output.png
If no /path/to/output.png
is specified, then the generated image is copied to clipboard. However, this feature is only supported on Linux at the moment.
Options
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, \ }
To get the list of available themes, you can run this in the terminal:
silicon --list-themes
For more details about options, see https://github.com/Aloxaf/silicon.
Credits
Credits goes to:
- https://github.com/Aloxaf for Silicon
- Bethesda for the awesome Doom wallpaper
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK