Giter VIP home page Giter VIP logo

codesnap.nvim's Introduction

codesnap.nvim's People

Contributors

a-h4nu avatar elliottminns avatar github-actions[bot] avatar marqmitk avatar mistricky avatar mrwinston avatar nadir-ishiguro avatar nexxai avatar ocya1011 avatar okuramasafumi avatar uzaaft 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

codesnap.nvim's Issues

CodeSnapASCII not calculating whitespace correctly

See below snippet from my config

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ nvim/lua/workspaces/persistence.lua                                                    โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ 193 local function load_marks()                                                        โ”‚
โ”‚ 194 	local marks_file = Path:new(M.workspaces_path .. Path.path.sep .. "marks.json")   โ”‚
โ”‚ 195 	local marks_data = nil                                                            โ”‚
โ”‚ 196 	if marks_file:exists() then                                                       โ”‚
โ”‚ 197 		marks_data = vim.fn.json_decode(marks_file:read())                               โ”‚
โ”‚ 198 	end                                                                               โ”‚
โ”‚ 199                                                                                    โ”‚
โ”‚ 200 	if not marks_data then                                                            โ”‚
โ”‚ 201 		return                                                                           โ”‚
โ”‚ 202 	end                                                                               โ”‚
โ”‚ 203                                                                                    โ”‚
โ”‚ 204 	state.get().marks = marks_data                                                    โ”‚
โ”‚ 205 end                                                                                โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Also breaks in go

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Pack/git/git.go                                                                                        โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ 39 func AsyncGitRemoteRefExists(s *config.Session, packageDir string) chan GitRemoteRefExistsResult {  โ”‚
โ”‚ 40 	res := make(chan GitRemoteRefExistsResult)                                                         โ”‚
โ”‚ 41 	go func() {                                                                                        โ”‚
โ”‚ 42 		exists, err := GitRemoteRefExists(s, packageDir)                                                  โ”‚
โ”‚ 43 		res <- GitRemoteRefExistsResult{exists, err}                                                      โ”‚
โ”‚ 44 		close(res)                                                                                        โ”‚
โ”‚ 45 	}()                                                                                                โ”‚
โ”‚ 46                                                                                                     โ”‚
โ”‚ 47 	return res                                                                                         โ”‚
โ”‚ 48 }                                                                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

In my .zshrc this works

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ dotfiles/home/.zshrc                            โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ 123 [ -f ~/.lcl.zshrc ] && source ~/.lcl.zshrc  โ”‚
โ”‚ 124                                             โ”‚
โ”‚ 125 if [ -d ~/dotfile-shards/ ]; then           โ”‚
โ”‚ 126   for f in ~/dotfile-shards/*; do           โ”‚
โ”‚ 127     source $f                               โ”‚
โ”‚ 128   done                                      โ”‚
โ”‚ 129 fi                                          โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

The only difference between these as far as I can tell is that the .zshrc is indented with tabs instead of spaces.

Loving the image snapshots, but this ASCII snapshot is the killer feature for me, so i'd love to get it working.

My setup function:

require("codesnap").setup({
	breadcrumbs_separator = "/",
	has_breadcrumbs = true,
	has_line_number = true,
	show_workspace = true,
	bg_padding = 0,
	watermark = "",
})

Build failled in debian stable

I try to install in debain satble (bookworm) and seens like i dosenยดt have a specific dependency for compile from source, and i received this log as result

 ./scripts/build_generator.sh --release
            Blocking waiting for file lock on build directory
           Compiling libuv-sys2 v1.48.0
           Compiling wl-clipboard-rs v0.8.1
           Compiling fontdb v0.16.2
           Compiling oxi-api v0.3.0
           Compiling syntect v5.2.0
           Compiling parking_lot v0.12.1
           Compiling cached_proc_macro v0.20.0
           Compiling oxi-macros v0.3.0
           Compiling instant v0.1.12
           Compiling rustc-hash v1.1.0
           Compiling unicode-linebreak v0.1.5
           Compiling cached_proc_macro_types v0.1.1
           Compiling self_cell v1.0.3
           Compiling sys-locale v0.3.1
           Compiling unicode-segmentation v1.11.0
           Compiling arrayvec v0.7.4
           Compiling unicode-bidi v0.3.15
           Compiling rangemap v1.5.1
           Compiling tiny-skia v0.11.4
           Compiling two-face v0.3.0
           Compiling cosmic-text v0.11.2
           Compiling cached v0.49.3
           Compiling arboard v3.3.2
           Compiling regex v1.10.3
        The following warnings were emitted during compilation:

        warning: [email protected]: Compiler version doesn't include clang or GCC: "cc" "--version"

        error: failed to run custom build command for `libuv-sys2 v1.48.0`

        Caused by:
          process didn't exit successfully: `/home/v_raton/.local/share/nvim/lazy/codesnap.nvim/generator/target/release/build/libuv-sys2-2ce6608c37db8cc7/build-script-build` (exit status: 101)
          --- stdout
          cargo:rerun-if-env-changed=LIBUV_NO_PKG_CONFIG
          cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG
          cargo:rerun-if-env-changed=PKG_CONFIG
          cargo:rerun-if-env-changed=LIBUV_STATIC
          cargo:rerun-if-env-changed=LIBUV_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
          cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_PATH
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
          cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
          cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
          OPT_LEVEL = Some("3")
          TARGET = Some("x86_64-unknown-linux-gnu")
          HOST = Some("x86_64-unknown-linux-gnu")
          cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
          CC_x86_64-unknown-linux-gnu = None
          cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
          CC_x86_64_unknown_linux_gnu = None
          cargo:rerun-if-env-changed=HOST_CC
          HOST_CC = None
          cargo:rerun-if-env-changed=CC
          CC = None
          cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
          cargo:warning=Compiler version doesn't include clang or GCC: "cc" "--version"
          cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
          CRATE_CC_NO_DEFAULTS = None
          DEBUG = Some("false")
          CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
          cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
          CFLAGS_x86_64-unknown-linux-gnu = None
          cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
          CFLAGS_x86_64_unknown_linux_gnu = None
          cargo:rerun-if-env-changed=HOST_CFLAGS
          HOST_CFLAGS = None
          cargo:rerun-if-env-changed=CFLAGS
          CFLAGS = None
          cargo:rustc-link-lib=pthread
          cargo:rustc-link-lib=dl
          cargo:rustc-link-lib=rt
          cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
          AR_x86_64-unknown-linux-gnu = None
          cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
          AR_x86_64_unknown_linux_gnu = None
          cargo:rerun-if-env-changed=HOST_AR
          HOST_AR = None
          cargo:rerun-if-env-changed=AR
          AR = None
          cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
          ARFLAGS_x86_64-unknown-linux-gnu = None
          cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
          ARFLAGS_x86_64_unknown_linux_gnu = None
          cargo:rerun-if-env-changed=HOST_ARFLAGS
          HOST_ARFLAGS = None
          cargo:rerun-if-env-changed=ARFLAGS
          ARFLAGS = None
          cargo:rustc-link-lib=static=uv
          cargo:rustc-link-search=native=/home/v_raton/.local/share/nvim/lazy/codesnap.nvim/generator/target/release/build/libuv-sys2-575694828bbe684b/out
          Generating bindings for libuv...

          --- stderr
          thread 'main' panicked at /home/v_raton/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.68.1/lib.rs:611:31:
          Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
          note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
        warning: build failed, waiting for other jobs to finish...
        cp: cannot stat './generator/target/release/libgenerator.so': No such file or directory
        make: *** [makefile:8: build_generator] Error 1

Vector graphics?

CodeSnap is a great tool, thank you for working on it!

By any chance, is it possible to output the snippet in a vector graphics format, say SVG, EPS, or PDF? If not, do you have plans to implement this? This seems like a valuable feature if one wants to include nice code snippets in a presentation and/or document written in LaTeX.

[BUG] Every first screenshot fails with "node code selected"

Just installed the plugin and everything works fine for the most part, but it seems the first attempt always fails when trying to generate screenshots to both the clipboard or the save path.

Steps to reproduce

Open nvim and any file
Select code and attempt to generate screenshot

Result

no code is selected

Expected

Screenshot generated to either clipboard or save path

When I de-select and re-select the exact code, in the exact same way, everything works fine.. it's just that first attempt that doesn't work.

Screen.Recording.2024-05-09.at.9.20.52.AM.mov

Not working with a Windows Subsystem for Linux

I am using a WSL with Ubuntu, I followed all the installation steps correctly, but when I run the CodeSnapPreviewOn command, I get the message of the image, I am not an expert in these matters :(

image

Hi, I am getting: Command `CodeSnap` not found after loading `codesnap.nvim`

  1. It takes too much time to compile, not the reason of coming here...
  2. I have to select the next line for preview, see video
2024-02-23_23-54-04.mp4
  1. I want the watermark to be the $(PWD) any way to do so? Like:
echo $PWD
> /home/daUnknownCoder/.config/NeutronVim

image

  1. I would also like to change the title of the window from React App to <My Custom Title> is that possible?
  2. Custom Installable font instead of most probably Pacifico in watermark?

See i really like the project but if these can be resolved then this project will be a gr8 success

Question about configuring padding for code screenshots

I am using a code screenshot plugin in nvim and Iโ€™m not sure how to configure the padding for the code screenshot content. Sometimes I want to set the padding to be smaller, or even completely remove it. Is there a way to achieve this configuration? Thank you for your help!

save_path is not a path but a specific filename

I was expecting save_path to take a directory as parameter, not a specific filename.

e.g. save_path = /home/me/snapshots/"

and for it to auto-generate filenames for that directory.

Instead it seems to take a specific named file only:

require("codesnap").setup({
	save_path = "/tmp/snap.png"
})

Which seems a lot less useful?

Could we either add a auto_save_dir parameter which does what I expected, or is
it possible to change the behaviour for save_path, after it's been shipped?

The latest version 1.0 & 1.0.1 install failed

Failed to source /Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua

vim/_editor.lua:0: /Users/lee/.config/nvim/init.lua..nvim_exec2() called at /Users/lee/.config/nvim/init.lua:0../Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Err
or while calling lua chunk: vim/loader.lua:0: dlopen(/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.so, 0x0006): tried: '/Users/lee/.local/share/nvim/site/lazy/codesnap.nvim/lua/generator.s
o' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64h)))
stack traceback:
^I[C]: in function 'error'
^Ivim/loader.lua: in function <vim/loader.lua:0>
^I[C]: in function 'require'
^I...share/nvim/site/lazy/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
^I[C]: in function 'require'
^I...l/share/nvim/site/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main chunk
^I[C]: in function 'nvim_exec2'
^Ivim/_editor.lua: in function 'cmd'
^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>
^I[C]: in function 'xpcall'
^I...al/share/nvim/site/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
^I...
^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
^I.../share/nvim/site/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
^I.../.local/share/nvim/site/lazy/lazy.nvim/lua/lazy/init.lua:110: in function 'setup'
^I/Users/lee/.config/nvim/lua/core/pack.lua:135: in function 'load_lazy'
^I/Users/lee/.config/nvim/lua/core/pack.lua:138: in main chunk
^I[C]: in function 'require'
^I/Users/lee/.config/nvim/lua/core/init.lua:160: in function 'load_core'
^I/Users/lee/.config/nvim/lua/core/init.lua:170: in main chunk
^I[C]: in function 'require'
^I/Users/lee/.config/nvim/init.lua:2: in main chunk

stacktrace:

  • vim/_editor.lua:0 in cmd
  • lua/core/pack.lua:135 in load_lazy
  • lua/core/pack.lua:138
  • lua/core/init.lua:160 in load_core
  • lua/core/init.lua:170
  • init.lua:2

The error msg.

Windows guidance

Hi,

Would be good with some guidance of how to do this in a Windows 10 environment.
I tried to compile with both make and cargo / rust from cygwin.

make issue

Unknown platform
cp: cannot stat 'lua/Unknowngenerator.so': No such file or directory
make: *** [makefile:2: build] Error 1

cargo failed in a later state with unresolved symbols refs.

error LNK2019: unresolved external symbol

Bug: Version v1.1.10 and upper fail on Mac

Not sure what exactly happens, but from what I can tell, neovim just quits... here is an example...

Screen.Recording.2024-04-11.at.16.42.03.mov

Same does not happen on v1.1.9

Screen.Recording.2024-04-11.at.16.43.06.mov

Configuration:

return {
	{
		"mistricky/codesnap.nvim",
		build = "make",
		version = "v1.1.x",
		config = function()
			require("codesnap").setup({
				mac_window_bar = true,
				title = "CodeSnap.nvim",
				code_font_family = "CaskaydiaCove Nerd Font",
				watermark_font_family = "Pacifico",
				watermark = "",
				bg_theme = "grape",
				breadcrumbs_separator = "/",
				has_breadcrumbs = true,
			})
		end,
	}
}

Notes:

  • This happens on v1.1.11 too
  • macbook: image

Troubleshooting:

  • Restarted the terminal
  • Restarted the PC

Keybind documentation

Can you add your setup for keymaps?

    {
      "<leader>ss",
      function()
        vim.cmd("CodeSnap")
      end,
      desc = "CodeSnap",
      mode = "v",
    },

Currently this doesnt work, I have to manually visually select, then type the command CodeSnap removing the range selectors < and >

If i use the above it will just say "no code selected"

Breadcrumbs support

Need a breadcrumbs component to display $pwd which come from Neovim instance

Background image toggle

Would it be possible to have an option to toggle the background image? Most of the time it feels like the background image needlessly pads the image making it much larger then it needs to be when sharing a code snippet.

Add `workspace`

share code snippet to others. workspace is good to show this code blong to some project.

Add option to support line numbers

I believe a viable enhancement to this plugin would be addition of the option to show line numbers in the screenshot. It might help when not whole file is screenshotted but rather a section of it. When creating guides online or sharing code snaps with others it helps whomever is reading to orient themselves in the file.

WSL support

Currently using WSL sometimes, would be nice to be able to pass in commands to copy to clipboard, i.e i think to copy to windows clipboard you need something piped like output | clip.exe

Feature Request: Support for SyntaxSet add_from_folder to Add Custom Syntaxes

Hi there,

I would like to suggest adding support for the SyntaxSet method add_from_folder on the generator to enable the addition of custom syntaxes. This would be particularly useful for languages like Luau and others that may not be included by default, since luau supports types so the syntax would be difference from lua.

Implementing this feature would allow users to easily extend the syntax highlighting capabilities by adding custom syntax definitions from a folder, enhancing the flexibility and usability of the tool.

Compilation Error on ARM64: Failed to run custom build command for `libuv-sys2 v1.48.0`

Hello! When compiling on ARM64 (Fedora) on Mac I get the following error:

error: failed to run custom build command for `libuv-sys2 v1.48.0`

Caused by:
  process didn't exit successfully: `/home/teo/.local/share/nvchad/lazy/codesnap.nvim/generator/target/debug/build/libuv-sys2-75b6965b51d1b505/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBUV_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBUV_STATIC
  cargo:rerun-if-env-changed=LIBUV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=SYSROOT
  cargo:rerun-if-env-changed=LIBUV_STATIC
  cargo:rerun-if-env-changed=LIBUV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rustc-link-search=native=/usr/lib64
  cargo:rustc-link-lib=uv
  cargo:rustc-link-lib=pthread
  cargo:rustc-link-lib=dl
  cargo:rustc-link-lib=rt
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBUV_STATIC
  cargo:rerun-if-env-changed=LIBUV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  Resolving libuv with pkg-config
  Generating bindings for libuv...

  --- stderr
  /usr/include/uv.h:58:10: fatal error: 'stddef.h' file not found
  thread 'main' panicked at /home/teo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libuv-sys2-1.48.0/build.rs:372:38:
  called `Result::unwrap()` on an `Err` value: BindgenError
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Checking dnf yields that both libuv and libuv-devel are installed, as well as gcc and other build tools.

If anyone can shed some light on my issue, that would be great!

Thanks!

Generator not found on ARM64

Already tried installing 1.1.5 but no lock
This was the error occuring

...ocal/share/nvim/lazy/codesnap.nvim/lua/codesnap/init.lua:62: module 'generator' not found:
^Ino field package.preload['generator']
cache_loader: module generator not found
cache_loader_lib: module generator not found
^Ino file './generator.lua'
^Ino file '/opt/homebrew/share/luajit-2.1.0-beta3/generator.lua'
^Ino file '/usr/local/share/lua/5.1/generator.lua'
^Ino file '/usr/local/share/lua/5.1/generator/init.lua'
^Ino file '/opt/homebrew/share/lua/5.1/generator.lua'
^Ino file '/opt/homebrew/share/lua/5.1/generator/init.lua'
^Ino file './generator.so'
^Ino file '/usr/local/lib/lua/5.1/generator.so'
^Ino file '/opt/homebrew/lib/lua/5.1/generator.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
return {
  "mistricky/codesnap.nvim",
  version = "1.1.5",
  build = "make",
  keys = {
    { "<leader>cc", "<cmd>CodeSnap<cr>", mode = "x", desc = "Save selected code snapshot into clipboard" },
    { "<leader>cs", "<cmd>CodeSnapSave<cr>", mode = "x", desc = "Save selected code snapshot in ~/Documents" },
  },
  opts = {
    save_path = "~/Documents",
    has_breadcrumbs = true,
    bg_theme = "bamboo",
  },
}

More info on install

Maybe I'm stupid, but while trying to install, I just added specified line to packer plugin list, and I get this error on init:


Error detected while processing /home/pickle/.config/nvim/init.lua:
E5113: Error while calling lua chunk: Vim:E475: Invalid value for argument cmd: '/home/pickle/.config/nvim/site/pack/packer/start/codesna
p.nvim/snap-server/target/release/snap-server' is not executable
stack traceback:
        [C]: in function 'connect'
        .../pack/packer/start/codesnap.nvim/lua/codesnap/client.lua:29: in function 'init'
        .../pack/packer/start/codesnap.nvim/lua/codesnap/client.lua:33: in function 'start'
        ...te/pack/packer/start/codesnap.nvim/lua/codesnap/init.lua:15: in function 'setup'
        /home/pickle/.config/nvim/init.lua:39: in main chunk

I mean I get that server-snap is not installed, but at which point should it? and is there some command that copies rust binary to path or something? kinda confused it has not happened yet

Add support for font weight and type

I have very specific font specifications in Kitty terminal, it would be really cool to be able to use those same settings for the fonts. Right now if you choose a font family that only has Thin weights or Italics to try to force it to use that font, it just returns a default sans font.

Ideally I would like something like:

code_font_family = "EllographCF Nerd Font Thin"
watermark_font_family = "EllographCF Nerd Font Light Italic"

Love this plugin though, fantastic work!

Add: target Linux ARM64

I'm using Fedora Asahi Remix and I'd like to use CodeSnap on Linux ARM64.
There are other problems, maybe I'm doing something wrong:

  • code_font_family = "JetBrainsMono Nerd Font" doesn't work (I have installed it and I use it)
  • mac_window_bar = false doesn't work

This is my config:

local home = os.getenv "HOME"
...
  {
    "mistricky/codesnap.nvim",
    build = "make",
    version = "^1",
    lazy = "true",
    cmd = {
      "CodeSnap",
      "CodeSnapSave",
    },
    config = function()
      require("codesnap").setup {
        title = "CodeSnap.nvim",
        -- code_font_family = "CaskaydiaCove Nerd Font",
        code_font_family = "JetBrainsMono Nerd Font",
        mac_window_bar = false,
        has_breadcrumbs = true,
        bg_theme = "default",
        save_path = home .. "/.snap.png",
        watermark_font_family = "Pacifico",
        watermark = "Matteo Cavestri",
      }
    end,
  },

On x86 I only have that problems.
Here an example:
snap

Thanks all

Easier way to detect language type?

Currently doing this:

    {
      "<leader>ss",
      function()
        vim.cmd("CodeSnap " .. vim.bo.filetype)
      end,
      desc = "CodeSnap",
      mode = "v",
    },
    {
      "<leader>sS",
      function()
        vim.cmd("CodeSnapSave " .. vim.bo.filetype)
      end,
      desc = "CodeSnap save to ~/codesnap",
      mode = "v",
    },

Seems to work.. for lua at least, might work for other languages, I guess it depends how the names are matched vs vim.bo.filetype

Code highlighting in PHP is... weird?

I apologize for the less than descriptive title, but let me explain with screenshots.

Let's say I have this PHP class:
Screenshot 2024-04-08 at 10 04 55โ€ฏPM

If I select this text:
Screenshot 2024-04-08 at 10 05 31โ€ฏPM

the highlighting works perfectly:
faaa5d4c-b43f-4522-a984-0ed4652d1bcb

But if I simply miss including the <?php tag at the top of every PHP file in the selection:
Screenshot 2024-04-08 at 10 06 38โ€ฏPM

Everything stays dark:
71b59030-99bf-471a-bbab-91d0e5422e08

Now, OK, at first glance it seems like it's using the opening tag to figure out the language, and since it isn't sure, it doesn't do anything, but it does highlight very common coding words but only ever in PHP DocBlock comments:
82062d6c-7ba9-492e-938e-570373f2f081

Is there anything I can do about this, or am I just kind of stuck?

No executable codelens found at current line

Whenever i select lines of code to snap with the keybinding set, i get that error in the title.

However, if I select the lines of code to snap using the command instead: <,'>CodeSnap - it works fine.

Config

return {
  "mistricky/codesnap.nvim",
  build = "make",
  keys = {
    { "<leader>cc", "<cmd>CodeSnap<cr>", mode = "x", desc = "Codesnap" },
  },
  opts = {
    has_breadcrumbs = true,
    bg_theme = "bamboo",
  },
}

What am I doing wrong with the keybinding?

Neovim crashes with EXC_BAD_ACCESS (SIGBUS) when copying image to clipboard

Neovim crashes when attempting to copy an image to the clipboard. The crash report indicates an EXC_BAD_ACCESS (SIGBUS) error during the image processing.

Environment:

  • Neovim Version: v0.10.0

  • Operating System: macOS 14.4.1 (23E224)

  • Architecture: ARM-64 (Native)

Crash Report:

Process:               nvim [69962]
Path:                  /opt/homebrew/*/nvim
Identifier:            nvim
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        Exited process [69961]
Responsible:           kitty [474]
User ID:               501

Date/Time:             2024-05-20 13:49:16.3895 +0800
OS Version:            macOS 14.4.1 (23E224)
Report Version:        12
Anonymous UUID:        F1BF2BD6-1FC7-2E39-2145-56C2098E5FC9

Sleep/Wake UUID:       056FE953-0A56-4A0E-947F-86AFF09C9338

Time Awake Since Boot: 18000 seconds
Time Since Wake:       855 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       UNKNOWN_0x101 at 0x000000000bad4007
Exception Codes:       0x0000000000000101, 0x000000000bad4007

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [69962]

VM Region Info: 0xbad4007 is not in any region.  Bytes before following region: 4182245369
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104f54000-10525c000    [ 3104K] r-x/r-x SM=COW  /opt/homebrew/*/nvim

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   ???                           	         0xbad4007 ???
1   libdispatch.dylib             	       0x19f7123e8 _dispatch_client_callout + 20
2   libdispatch.dylib             	       0x19f713c68 _dispatch_once_callout + 32
3   ImageIO                       	       0x1aa429cdc TIFFWritePlugin::writeAll() + 80
4   ImageIO                       	       0x1aa429c44 IIO_Writer_TIFF::write(void*, void*) + 48
5   ImageIO                       	       0x1aa519df0 IIOImageDestination::finalizeDestination() + 896
6   ImageIO                       	       0x1aa429a4c CGImageDestinationFinalize + 180
7   AppKit                        	       0x1a33fd738 +[NSBitmapImageRep(NSBitmapImageFileTypeExtensions) representationOfImageRepsInArray:usingType:properties:] + 1832
8   AppKit                        	       0x1a33fc498 -[NSImage TIFFRepresentationUsingCompression:factor:] + 216
9   AppKit                        	       0x1a34819bc -[NSPasteboard writeObjects:] + 712
10  generator.so                  	       0x10b74f968 arboard::platform::osx::Set::image::hb5065722d5ed8601 + 800
11  generator.so                  	       0x10b6eaad8 generator::copy::copy_into_clipboard::h763c2f0f6bc4a544 + 284
12  generator.so                  	       0x10b6f75cc oxi_luajit::function::store::_$u7b$$u7b$closure$u7d$$u7b$$u7b$closure$u7d$$u7d$::hfade5170fc7f2ec4 + 292
13  generator.so                  	       0x10b752730 oxi_luajit::function::store::c_fun::h932a2ea8af637371 + 52
14  libluajit-5.1.2.1.1713773202.dylib	       0x105955a7c 0x105950000 + 23164
15  libluajit-5.1.2.1.1713773202.dylib	       0x10596265c lua_pcall + 148
16  nvim                          	       0x105099b0c nlua_do_ucmd + 1412
17  nvim                          	       0x1051b8b54 do_ucmd + 276
18  nvim                          	       0x10502ca30 execute_cmd0 + 140
19  nvim                          	       0x105029670 do_cmdline + 8580
20  nvim                          	       0x1050e6dc0 nv_colon + 420
21  nvim                          	       0x1050e49f8 normal_execute + 4872
22  nvim                          	       0x10517e7cc state_enter + 392
23  nvim                          	       0x1050a47a4 main + 9492
24  dyld                          	       0x19f53a0e0 start + 2360

Steps to Reproduce:

  1. Run CodeSnap to copy an image to the clipboard.
  2. Observe the crash.

No theme option

I didn't like the backgrounds. I just wanted a solid codesnippet, without backgrounds.
I just added this to the theme:

"none" => vec![
                GradientStop::new(0., Color::from_rgba8(0, 0, 0, 0))
            ],

Example:
with_background
no_background

Try to drag the image and you will see the difference.

`CodeSnap` doesn't work whatever i do

Without selecting code, i would like a vim.notify or vim.print instead of WTF type logs
log1 -> happens when i first time try CodeSnap without selection:

Error executing Lua callback: .../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: Vim:Error executing Lua callback: ...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:31: Please select code which you want to take snapshot first
stack traceback:
	[C]: in function 'error'
	...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:31: in function 'get_config'
	...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:49: in function 'copy_into_clipboard'
	.../share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua:4: in function <.../share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua:3>
	[C]: in function 'cmd'
	.../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <.../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>
stack traceback:
	[C]: in function 'cmd'
	.../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <.../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>

log2 -> happens after 1st time of no code selection

Error executing Lua callback: ...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:31: Please select code which you want to take snapshot first
stack traceback:
	[C]: in function 'error'
	...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:31: in function 'get_config'
	...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:49: in function 'copy_into_clipboard'
	.../share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua:4: in function <.../share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua:3>

sometimes with luck [tho i can't paste this anywhere] i get Save snapshot into clipboard successfully
check video:

Kooha-2024-03-17-20-11-04.webm

CodeSnapSave works, but i dont get breadcrumbs in it:
idk

And sometimes, neovim crashes, check video:

Kooha-2024-03-17-20-02-00.webm

@mistricky, my config:

  -- Beautiful CodeSnippet Viewing
  {
    "mistricky/codesnap.nvim",
    build = "make",
    version = "^1",
    lazy = true,
    cmd = { "CodeSnap", "CodeSnapSave" },
    config = function()
      require("codesnap").setup({
        has_breadcrumbs = true,
        bg_theme = "summer",
        save_path = "./idk.png",
      })
    end,
  },

the plugin is not being detected after adding to plugins

......
  -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
  { import = "lazyvim.plugins.extras.lang.json" },

  -- add any tools you want to have installed below
  {
    "williamboman/mason.nvim",
    opts = {
      ensure_installed = {
        "stylua",
        "shellcheck",
        "shfmt",
        "flake8",
      },
    },
  },
  -- https://github.com/mistricky/codesnap.nvim
  {
    "mistricky/codesnap.nvim",
    build = "make",
  },
}

I opened and closed nvim, and still can't run snapshot command nor they are available in autocomplete.

my nvim --version

NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1713773202

I am on fedora sway 40, and I have Rust installed.

Tab indention doesn't look right.

I use tabs for indention and it looks like this.
image

It works fine for spaces.

This is my nvim --version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

require("codesnap.nvim").setup() didn't work

Hello, amazing plugin ๐Ÿ˜, really missing a feature like that for Neovim, however I had issues running the Lua module
this didn't work for me using Lazy as plugin manager,

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

but this did

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

this might be a Lazy only behavior, so feel free to close this issue.

CodeSnapASCII not saving anything in clipboard

Hello. As by description, CodeSnap seems to work wonderfully except for the CodeSnapASCII command. The info popup informs me that all went good, but in the clipboard (even if emptied beforehand) has only my previous content, no ASCII screenshot. I am using NVIM v0.11.0-dev-358+g6a886a251 on EndevourOS

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.