mistricky / codesnap.nvim

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

Add: target Linux ARM64 #53

Closed matteocavestri closed 2 months ago

matteocavestri commented 2 months ago

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:

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

mistricky commented 2 months ago

Hi there, thx for report this issue. For add arm64 compile target, you can use make build_generator build command to build current target from source:

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

But I will consider add it into cross-compile config in the future if it's necessary.

The problem about "mac_window_bar" does not work has fix by https://github.com/mistricky/codesnap.nvim/pull/54, but I can't reproduce the "code_font_family" not work bug, they works fine on my machine (x86_64 Arch Linux with wayland session).

Hack Nerd Font

{
  code_font_family = "Hack Nerd Font",
  save_path = "~/Pictures/foo.png",
  bg_theme = "bamboo",
}

foo

PingFang

{
  code_font_family = "PingFang",
  save_path = "~/Pictures/foo.png",
  bg_theme = "bamboo",
}

foo

CaskaydiaCove Nerd Font

{
  code_font_family = "CaskaydiaCove Nerd Font",
  save_path = "~/Pictures/foo.png",
  bg_theme = "bamboo",
}

foo

matteocavestri commented 2 months ago

Thanks for your reply

Now I'm doing some testing and there are some problems on codesnap during install using lazy:

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

Using this config I got this error during the install (x86), but after a neovim restart CodeSnap works as intended. Do you have any ideas on this problem?

Failed to source `/home/matteocavestri/.local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua`

vim/_editor.lua:0: nvim_exec2()../home/matteocavestri/.local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua: Vim(source):E5113: Error while calling lua chunk: ...ocal/share/nvim/lazy/codesnap.nvim/lua/codesnap/init.lua:3: module 'generator' not found:
    no field package.preload['generator']
cache_loader: module generator not found
cache_loader_lib: module generator not found
    no file './generator.lua'
    no file '/usr/share/luajit-2.1/generator.lua'
    no file '/usr/local/share/lua/5.1/generator.lua'
    no file '/usr/local/share/lua/5.1/generator/init.lua'
    no file '/usr/share/lua/5.1/generator.lua'
    no file '/usr/share/lua/5.1/generator/init.lua'
    no file './generator.so'
    no file '/usr/local/lib/lua/5.1/generator.so'
    no file '/usr/lib64/lua/5.1/generator.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    ...ocal/share/nvim/lazy/codesnap.nvim/lua/codesnap/init.lua:3: in main chunk
    [C]: in function 'require'
    ....local/share/nvim/lazy/codesnap.nvim/plugin/codesnap.lua:1: in main chunk
    [C]: in function 'nvim_exec2'
    vim/_editor.lua: in function 'cmd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484>
    [C]: in function 'xpcall'
    .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:346: in function '_load'
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
    ...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:29: in function <...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:26>
    [C]: in function 'pcall'
    .../share/nvim/lazy/lazy.nvim/lua/lazy/manage/task/init.lua:70: in function 'start'
    .../share/nvim/lazy/lazy.nvim/lua/lazy/manage/task/init.lua:65: in function <.../share/nvim/lazy/lazy.nvim/lua/lazy/manage/task/init.lua:64>

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

Thanks all

mistricky commented 2 months ago

module generator not found

Hi @matteocavestri Can you show what output of uname -m?

matteocavestri commented 2 months ago

The last issue appears on x86_64

On apple silicon I'll start to use codesnap after cross compile on Linux ARM64

mistricky commented 2 months ago

Hey @matteocavestri, thx for report this bug, I fix it in latest version, you can install the CodeSnap.nvim to v1.1.5 and try again, If still have this bug, please tell me

matteocavestri commented 2 months ago

Thanks for your support @mistricky In the last version (v1.1.5) this bug is resolved and now on x86 everything is perfect.

If you want to add ARM64 into cross-compile I,ll wait for an update. If you want I can contribute to the project to make it cross-compile on Linux ARM64. (I'm not so good in rust, but I'm learning it)

matteocavestri commented 2 months ago

@mistricky I've read #58. You can add to the build_generator docs some deps. In order to compile on ARM I need:

export CC=gcc
sudo dnf install libuv libuv-devel # On RHEL based systems
sudo apt-get install libtool libuv1-dev # On Debian based systems
mistricky commented 2 months ago

Hi @matteocavestri, thx for your reply.

If you want to add ARM64 into cross-compile I,ll wait for an update.

Maybe not now, as https://github.com/mistricky/codesnap.nvim/pull/58 says I don't wanna add too many cross-compilation target for now.

You can add to the build_generator docs some deps.

That's great idea, I'll add it in README later.

matteocavestri commented 2 months ago

Thanks @mistricky I consider this issue closed

mistricky commented 2 months ago

Okay Thank u for this issue report again :)

mistricky commented 2 months ago

Document was updated https://github.com/mistricky/codesnap.nvim?tab=readme-ov-file#compile-on-arm