๐Ÿ“ฆ SergioRibera / codeshot.nvim

Take Amazing Screenshots of your code on Neovim

โ˜… 37 stars โ‘‚ 2 forks ๐Ÿ‘ 37 watching โš–๏ธ GNU General Public License v2.0
luaneovimneovim-pluginnixosnvimnvim-pluginscreenshotscreenshot-generatorscreenshot-utility
๐Ÿ“ฅ Clone https://github.com/SergioRibera/codeshot.nvim.git
HTTPS git clone https://github.com/SergioRibera/codeshot.nvim.git
SSH git clone git@github.com:SergioRibera/codeshot.nvim.git
CLI gh repo clone SergioRibera/codeshot.nvim
Sergio Alejandro Ribera Costa Sergio Alejandro Ribera Costa Merge pull request #9 from Brayan-724/fix/vim-theme 7c6347a 5 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ lua
๐Ÿ“ nix
๐Ÿ“ spec
๐Ÿ“„ .busted
๐Ÿ“„ .editorconfig
๐Ÿ“„ .envrc
๐Ÿ“„ .gitignore
๐Ÿ“„ .luacheckrc
๐Ÿ“„ .stylua.toml
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ CONTRIBUTING.md
๐Ÿ“„ default.nix
๐Ÿ“„ flake.lock
๐Ÿ“„ flake.nix
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ shell.nix
๐Ÿ“„ README.md

codeshot.nvim

CodeShot allows you to take screenshots of your code in a very nice format and integrated in neovim

out

[!IMPORTANT]
This repository does not require constant updates but if you have any problems or feature suggestions open an issue and I will be happy to check it out.
> This project is basically a wrapper for the ssscode terminal tool, as soon as the settings of that tool change, this plugin will be updated, in the meantime if you have any problems or suggestions, I will be happy to review your issue.

Features

  • Blazing Fast!! because it internally uses a tool to generate the images,
this binary is blazing fast (Written in Rust)
  • beautiful images of source code, saved to preferred place.
  • Highly Customizable
  • copy to clipboard

Requirements

๐Ÿ“ฆ Installation

Install the plugin with your preferred package manager:

packer

-- Lua
use {
  "SergioRibera/codeshot.nvim",
  config = function()
    require('codeshot').setup({})
  end
}

vim-plug

" Vim Script
Plug 'SergioRibera/codeshot.nvim'

lua require('codeshot').setup({})

โš™๏ธ Configuratioon

[!IMPORTANT]
If you have specific doubts about any configuration,
you can check more details in the sss_code repository.

silicon comes with the following defaults:

codeshot.setup {
  bin_path = 'sss_code', -- This may be required in case you have not added the binary to the $PATH
  -- %c = is a sss_code command generated
  -- Example to copy on wayland: "%c | wl-copy"
  copy = "%c", -- Format of custom command to run and copy output raw
  silent = true, -- Run command as Silent
  window_controls = false, --
  shadow = false, -- Enable Shadow
  shadow_image = false, -- Generate shadow from code theme
  show_line_numbers = true, -- Enable line numbers
  use_current_theme = true, -- Allows you to generate a screenshot taking the current neovim theme you have
  theme = '', -- Theme file to use. May be a path, or an embedded theme
  extra_syntaxes = '', -- Additional folder to search for .sublime-syntax files in
  tab_width = vim.opt.shiftwidth,
  fonts = vim.opt.guifont:replace(':h', '='):replace(':', '='), -- Lists of fonts to use
  background = '#323232', -- Background of image
  radius = 15, -- Rounded radius of code
  author = '', -- Leave your mark, add your name to the picture
  author_color = '#FFFFFF',
  window_title = '', -- The title that the code will have at the top next to the window controls
  window_title_background = '', -- The color for the window controls bar, if you leave it empty it will take the background of the theme
  window_title_color = '#FFFFFF',
  window_controls_width = 120, -- The maximum width for window controls
  window_controls_height = 40, -- The maximum Height for window controls
  titlebar_padding = 10, -- Text separation with window controls
  padding_x = 80, -- The x padding of the code with the image border
  padding_y = 100, -- The y padding of the code with the image border
  shadow_color = '#707070', -- Color for the shadow
  shadow_blur = 50, -- The level of blurring to be applied to the shadow
  save_format = 'png', -- The format in which the image will be saved [default: png]
  output = "CodeShot_${year}-${month}-${date}_${time}.png", -- Auto generate file name based on time (absolute or relative to cwd)
}

Usage

Keymaps

Using commands

-- Take screenshot just of selected lines
vim.keymap.set('v', '<Leader>s',  ":SSSelected" )
-- Take screenshot of file and highlight selected lines
vim.keymap.set('v', '<Leader>s',  ":SSFocused" )
Call Lua Functions
-- Take screenshot of file and highlight selected lines
codeshot.focus_selected_lines()
-- Take screenshot just of selected lines
codeshot.selected_lines()
-- It captures the current file but receives as parameters a value for the lines to capture and the lines to highlight.
-- lines, hi_lines: range of lines in `start..end` format
codeshot.current(lines, hi_lines)
-- It takes a capture of the file we pass it and receives as parameters a value for the lines to capture and the lines to highlight.
-- file: is a path to file
-- lines, hi_lines: range of lines in `start..end` format
codeshot.take(file, lines, hi_lines)