mistricky / codesnap.nvim Goto Github PK
View Code? Open in Web Editor NEW๐ธ Snapshot plugin with rich features that can make pretty code snapshots for Neovim
License: MIT License
๐ธ Snapshot plugin with rich features that can make pretty code snapshots for Neovim
License: MIT License
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 = "",
})
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
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.
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.
Open nvim
and any file
Select code and attempt to generate screenshot
no code is selected
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.
Other fonts on my system work great. Maple Mono is a really great, quickly rising font: https://github.com/subframe7536/maple-font
Nvim 0.10
Neovide 0.13.1 (probably doesn't matter)
Maple-Mono v7beta20
Open nvim and any file
Select code and attempt to generate screenshot
$(PWD)
any way to do so? Like:echo $PWD
> /home/daUnknownCoder/.config/NeutronVim
React App
to <My Custom Title>
is that possible?Pacifico
in watermark?See i really like the project but if these can be resolved then this project will be a gr8 success
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!
Right now padding of the outer container is pretty thick. Is there a way to shrink it down?
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?
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
The error msg.
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
Hello!
Awesome project! I'm wondering if we could remove some build steps, reduce deps and leverage some of the features that exist in most peoples nvim setups.
For example: https://tree-sitter.github.io/tree-sitter/syntax-highlighting have you considered treesitter for handling the syntax highlighting duties?
Less of an issue, more of a feature request.
How much work would it be to use the local highlighting and colorscheme when taking a snapshot?
Once my colleague complained to me that he can't find the code where I took the snapshot, and I noticed we were on different branches. Perhaps we could add a support for branch detection?
Not sure what exactly happens, but from what I can tell, neovim just quits... here is an example...
Same does not happen on v1.1.9
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:
Troubleshooting:
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"
this seems to be somehow related to the arboard
library.
see my issue there.
Need a breadcrumbs component to display $pwd which come from Neovim instance
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.
share code snippet to others. workspace is good to show this code blong to some project.
When I call :CodeSnap
on rust code, neovim crashes.
Here's the repo where this code resides: https://github.com/wireapp/core-crypto
Need a something like select
component to help user to choose code colorscheme on preview page
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.
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
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.
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!
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",
},
}
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
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!
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 workThis 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:
Thanks all
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
I apologize for the less than descriptive title, but let me explain with screenshots.
Let's say I have this PHP class:
the highlighting works perfectly:
But if I simply miss including the <?php
tag at the top of every PHP file in the selection:
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:
Is there anything I can do about this, or am I just kind of stuck?
Would it be worth to support the following file types?
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 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:
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:
CodeSnapSave
works, but i dont get breadcrumbs in it:
And sometimes, neovim crashes, check video:
@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,
},
......
-- 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.
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.
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
Hey, can you add support for luau language? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.