Giter VIP home page Giter VIP logo

codeshot.nvim's Introduction

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 sss_code 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:

-- Lua
use {
  "SergioRibera/codeshot.nvim",
  config = function()
    require('codeshot').setup({})
  end
}
" 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)

codeshot.nvim's People

Contributors

brayan-724 avatar sergioribera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

codeshot.nvim's Issues

Guifont undefined breaks plugin `option.lua:22`

Awesome plugin ๐Ÿš€

Plugin still breaks at option.lua:22 when vim.opt.guifont is not set.

Failed to run `config` for codeshot.nvim
...al/share/nvim/lazy/codeshot.nvim/lua/codeshot/option.lua:22: attempt to call method 'replace' (a nil value)
# stacktrace:
  - /codeshot.nvim/lua/codeshot/option.lua:22
  - /codeshot.nvim/lua/codeshot/init.lua:1
  - lua/plugins/codeshot.lua:2 _in_ **setup**
  - lua/plugins/plugins.lua:199 _in_ **config**
Command `SSFocused` not found after loading `codeshot.nvim`

Installed with lazy.nvim, commit: #4931944

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.