Git Product home page Git Product logo

codesnap.nvim's Introduction

image

Neovim made with lua release action status release action status

CodeSnap.nvim

๐Ÿ“ธ Snapshot plugin with rich features that can make pretty code snapshots for Neovim

Warning

v1.0.0 will bring some break changes

  • The CodeSnapPreviewOn command is not supported, if you prefer live-preview, you can pin CodeSnap.nvim version to v0.0.11 to continue using this command.
  • The opacity and preview_title config has been removed from v1.0.0
  • The editor_font_family was renamed to code_font_family

โœจFeatures

  • ๐Ÿคฉ Beautiful code snap template
  • ๐Ÿ˜Ž Custom watermark and window style
  • ๐Ÿ’ป Beautiful Mac-style title bar
  • ๐Ÿค– Generate snapshots using only a single command
  • ๐Ÿž Breadcrumbs for display file path
  • ๐ŸŒŠ More beautiful background theme
  • ๐Ÿ”ข [WIP] Column number

Prerequirements

  • Neovim 9.0+

Install

Recommend using Lazy.nvim for installation, but you can still use another plugin manager you prefer.

Lazy.nvim

{ "mistricky/codesnap.nvim", build = "make", version = "^1" },

Build manually

Since v0.0.1 was released, the CodeSnap.nvim will cross-compile for the following three targets, then the CodeSnap.nvim will automatically determine which package to use based on your system, you no longer need to have Rust environment if everything goes smoothly.

  • x86_64-unknown-linux-gnu
  • x86_64-apple-darwin
  • aarch64-apple-darwin

If CodeSnap.nvim on your system still not works fine, there are a lot of reasons depending on your system arch or OS version, well you can try to build CodeSnap manually using the following config:

{ "mistricky/codesnap.nvim", build = "make build_generator", version = "^1" },

Usage

CodeSnap.nvim provides the following two ways to take snapshots of currently selected code

Copy into the clipboard

To take a beautiful snapshot use CodeSnap.nvim, you can just use CodeSnap command to generate a snapshot of the current selected code, then the CodeSnap.nvim will write the snapshot into the clipboard, and you can paste it anywhere you want.

Clipboard.mov

Save the snapshot

Of course, you can use CodeSnapSave command to save the snapshot to path where you defined it in config.save_path

require("codesnap").setup({
  -- ...
  save_path = ...
})
Save.mov

Breadcrumbs

Breadcrumbs are something to display the current snapshot file path, you can open it through config has_breadcrumbs:

require("codesnap").setup({
  -- ...
  has_breadcrumbs = true
})

The breadcrumbs look like: image

Custom path separator

The CodeSnap.nvim uses / as the separator of the file path by default, of course, you can specify any symbol you prefer as the custom separator:

require("codesnap").setup({
  -- ...
  has_breadcrumbs = true
  breadcrumbs_separator = "๐Ÿ‘‰"
})

image

Custom background

The CodeSnap.nvim comes with many beautiful backgrounds preset, you can set any background you like by setting bg_theme to its name, just like:

require("codesnap").setup({
  -- The "default" background is one you see at the beginning of the README
  bg_theme = "default"
})
bamboo sea
peach grape
dusk summer

Solid color background

If you prefer solid color background, you can set bg_color to your preferred color. For example:

require("codesnap").setup({
  -- ...
  bg_color = "#535c68"
})

CodeSnap

Watermark

Watermark is something that makes screenshots more personalized, but if you don't like watermark just set it as an empty string to hide it.

require("codesnap").setup({
  -- ...
  watermark = ""
})

Commands

CodeSnap # Take a snapshot of the currently selected code and copy the snapshot into the clipboard

CodeSnapSave # Save the snapshot of the currently selected code and save it on the disk

Configuration

Define your custom config using setup function

require("codesnap").setup({...})

There is a default config:

{
    mac_window_bar = true,
    title = "CodeSnap.nvim",
    code_font_family = "CaskaydiaCove Nerd Font",
    watermark_font_family = "Pacifico",
    watermark = "CodeSnap.nvim",
    bg_theme = "default"
}

License

MIT.

codesnap.nvim's People

Contributors

mistricky avatar marqmitk avatar elliottminns avatar mrwinston avatar

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.