mistricky / codesnap.nvim

📸 Snapshot plugin with rich features that can make pretty code snapshots for Neovim
MIT License
483 stars 16 forks source link

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

Closed daUnknownCoder closed 3 months ago

daUnknownCoder commented 4 months ago
  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

https://github.com/mistricky/codesnap.nvim/assets/84800625/56da45b8-452f-4475-99d0-90c3c14dcc28

  1. I want the watermark to be the $(PWD) any way to do so? Like:

    echo $PWD
    > /home/daUnknownCoder/.config/NeutronVim

    image

  2. I would also like to change the title of the window from React App to <My Custom Title> is that possible?

  3. 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

marqmitk commented 4 months ago
  1. The reason is that the binaries are laid out to work on different platforms, that's why they are currently a little bloated until we find a better way.
  2. Visual Line Mode support just got added today, will look into a better version of handling the selection of a single line, thanks for the issue report!
  3. / 5 Since the setup function only runs on start, this is currently not possible, i will see if i can think of a way to implement a more customisable watermark (also for the changing of the font)
  4. Currently not, but a good idea! Will see what i can do.
daUnknownCoder commented 4 months ago
  1. i will see if i can think of a way to implement a more customisable watermark

found a workaround:

watermark = (vim.fn.getcwd():gsub(os.getenv("HOME"), "~")),

image

can u remove the unnecessary image because it is not required as it already is in the photo gen...

mistricky commented 4 months ago

Hey @daUnknownCoder! thx for using codesnap.nvim and give me useful feedback. base on your questions:

  1. Just as @marqmitk said, the reason is that the binaries are laid out to work on different platforms, It may not be entirely compilation-free, but I'm resolving it, may it can reduce some of the compilation time in the next release version.
  2. Follow the document, you can pass pwd in config.watermark which allows you to custom watermark
  3. Currently not support, but this is a good idea, I will support in next release version
  4. Custom font family would be great, it will support in the future

can u remove the unnecessary

It implement in https://github.com/mistricky/codesnap.nvim/pull/18, you will see the changes in next release version :)

mistricky commented 4 months ago

Hii @daUnknownCoder, now the codesnap.nvim already implement custom watermark & preview code font_family in the latest version, you can config them via:

require("codesnap").setup({
  -- ...
  editor_font_family = "CaskaydiaCove Nerd Font",
  watermark_font_family = "Pacifico",
})

The preview title can also be customized via:

require("codesnap").setup({
  -- ...
  preview_title = "CodeSnap.nvim",
})

You can check full changelog in v0.0.9

Based on your question, it seems like you want someplace to display the path of the code that previews on the page, maybe breadcrumbs is a better choice. We will implement breadcrumbs in the future :)

daUnknownCoder commented 4 months ago

@mistricky this workaround works so if u can integrate this to something like

watermark = (vim.fn.getcwd():gsub(os.getenv("HOME"), "~")) (with tilde) watermark = vim.fn.getcwd() (without tilde) With aliases liek watermark = PWD And watermark = tPWD Would be awesome, and wow u guys are fast, maybe focus more on decreasing the dependencies and compilation time first coz these things will resolve on the go but the deal breaker is the compilation time that too 2 different languages... Tho this plugin is v nice

mistricky commented 4 months ago

About the compilation time, at the latest version, the code of the preview client was packed on CI before release, this will reduce a lot of compilation time :)

And looks like you just wanna display the $pwd on somewhere if I'm not mistaken, but watermark of this plugin is design to display your own identity symbol or something, it's not suitable to display something like $pwd, but there is a workaround as you say, custom watermark and it's font family would be make the $pwd looks not weird. But still it's a workaround, we have planned to develop breadcrumbs to display pwd, you can looking forward to next release version :)

daUnknownCoder commented 4 months ago

Can i contribute to those breadcrumbs of yours like do you accept pull requests?

daUnknownCoder commented 4 months ago

Also a CodeSnapPreviewOff to disconnect from localhost

daUnknownCoder commented 4 months ago

Hi can you tell me how to chaneg the watermark family? coz i tried watermark_font_family = "JetBrainsMono Nerd Font", which didnt work

mistricky commented 4 months ago

Can i contribute to those breadcrumbs of yours like do you accept pull requests?

Yeah, of course I'm glad to have others to contribute codesnap.nvim, but this feature is already under development

mistricky commented 4 months ago

Hi can you tell me how to chaneg the watermark family? coz i tried watermark_font_family = "JetBrainsMono Nerd Font", which didnt work

looks like your config is correct, please make sure you have installed JetBrainsMono Nerd Font in your computer

daUnknownCoder commented 3 months ago

Hi can you tell me how to chaneg the watermark family? coz i tried watermark_font_family = "JetBrainsMono Nerd Font", which didnt work

looks like your config is correct, please make sure you have installed JetBrainsMono Nerd Font in your computer

ofc i have, its installed it doesnt work for any font idk why, i tried Iosevka, Rubik, Fira Code too

editor_font_family also doesnt work

daUnknownCoder commented 3 months ago

Good to know you moved from bloatware rust to Good, pure lua

But this is not working, i removed my ~/.local/share/NeutronVim/lazy/codesnap.nvim folder, i reinstalled the plugin but i always get:

Command CodeSnap not found after loading codesnap.nvim

lazy.nvim also says:

Failed to run `config` for codesnap.nvim

...nfig/NeutronVim/lua/NeutronVim/plugins/Utils/useless.lua:103: loop or previous error loading module 'codesnap'

# stacktrace:
  - lua/NeutronVim/plugins/Utils/useless.lua:103 _in_ **config**

I also get a horizontal split with:

   Error  lazy.nvim Failed to source `/home/daUnknownCoder/.local/share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua`

vim/_editor.lua:0: nvim_exec2()../home/daUnknownCoder/.local/share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Error while calling lua chunk: vim/loader.lua:0: /home/daUnknownCoder/.local/share/NeutronVim/lazy/codesnap.nvim/lua/generator.so: invalid ELF header
stack traceback:
    [C]: in function 'error'
    vim/loader.lua: in function <vim/loader.lua:0>
    [C]: in function 'require'
    ...hare/NeutronVim/lazy/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
    [C]: in function 'require'
    .../share/NeutronVim/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main chunk
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>
    [C]: in function 'xpcall'
    ...l/share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:346: in function '_load'
    ...share/NeutronVim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
    .../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:10: in function '_load'
    .../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:34: in function <.../NeutronVim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**

Device things: neovim version:

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

OS: Arch Linux -> 6.7.6-arch1-1 WM: Hyprland -> Hyprland, built from branch main at commit 927da86e3e76a8465c8b45fd7a87a34f25401b37 Terminal: Warp -> v0.2024.03.05.08.02.stable_01-1

mistricky commented 3 months ago

This issue is duplicates https://github.com/mistricky/codesnap.nvim/issues/39

mistricky commented 3 months ago

Hi @daUnknownCoder the readme was updated, now you can build codesnap.nvim manually if you still face these problem. And the breadcrumbs is added, you can display current file path easier by open breadcrumbs

daUnknownCoder commented 3 months ago

hey @mistricky that was cool, yeah but still:

  1. i cannot use codesnap how hard i try... 1 ->
    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>

    when i not select code ⬆️

if i select code, codesnap freezes and after sometime, neovim quits image

running the codesnap takes so long idk why and the copied thing doesnt even paste anywhere it does take a long time, almost hangs my PC my neovim crashesmostly saying some panic

mistricky commented 3 months ago
  1. CodeSnap command is design for take snapshots of selected code, so if you don't select anything codesnap will reject this action.
  2. Because CodeSnap need a few time to generate snapshot, can you provide the crash log?
daUnknownCoder commented 3 months ago
  1. Because CodeSnap need a few time to generate snapshot, can you provide the crash log?

where do i get that

the generated snapshot isnt copied, the saved snapshot doesnt have breadcrumbs

mistricky commented 3 months ago

almost hangs my PC my neovim crashesmostly saying some panic

after the crash happens, probably exec the :message command can find messages contain "panic"

mistricky commented 3 months ago

the generated snapshot isnt copied, the saved snapshot doesnt have breadcrumbs

If you wanna breadcrumbs, you can set has_breadcrumbs to true like README mention that:

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

require("codesnap").setup({
  -- ...
  has_breadcrumbs = true
})
daUnknownCoder commented 3 months ago

almost hangs my PC my neovim crashesmostly saying some panic

after the crash happens, probably exec the :message command can find messages contain "panic"

after the crash i exit neovim so there's no previous session messages

mistricky commented 3 months ago

after the crash i exit neovim so there's no previous session messages

Can u reproduce and get the crash message?

daUnknownCoder commented 3 months ago

ikr

If you wanna breadcrumbs, you can set has_breadcrumbs to true like README mention that:

this is my config

  {
    "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,
  },

so there's no breadcrumbs in save img and i cannot paste the said copied to clipboard anywhere, mind if you reopen this issue? it feels dumb commenting in a closed issue

this is the idk.png idk

daUnknownCoder commented 3 months ago

after the crash i exit neovim so there's no previous session messages

Can u reproduce and get the crash message?

ig i got something: image

mistricky commented 3 months ago

so there's no breadcrumbs in save img and i cannot paste the said copied to clipboard anywhere, mind if you reopen this issue? it feels dumb commenting in a closed issue

what's your codesnap.nvim version? please make sure update codesnap to latest version v1.1.0

mistricky commented 3 months ago

it feels dumb commenting in a closed issue

Would u mind open another issue to describe these issues? this issue contains too much information includes old version issues.

daUnknownCoder commented 3 months ago

so there's no breadcrumbs in save img and i cannot paste the said copied to clipboard anywhere, mind if you reopen this issue? it feels dumb commenting in a closed issue

what's your codesnap.nvim version? please make sure update codesnap to latest version v1.1.0

image