mistricky / codesnap.nvim

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

Easier way to detect language type? #74

Closed jacobrreed closed 2 months ago

jacobrreed commented 2 months ago

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

mistricky commented 2 months ago

That's good point, thx for your advice

mistricky commented 2 months ago

Hi @jacobrreed after refactoring, you don't need to pass the filetype explicitly, CodeSnap will auto-detect what syntax the file should be used for highlighting code.

jacobrreed commented 2 months ago

image

Using latest, doesn't seem able to detect filetype for LUA

mistricky commented 2 months ago

Hi there, @jacobrreed looks like the above Lua code snapshot highlight is working properly, can you provide a further description of the issue you're encountering?

jacobrreed commented 2 months ago

Hi there, @jacobrreed looks like the above Lua code snapshot highlight is working properly, can you provide a further description of the issue you're encountering?

Oh uh.. ya I think I'm so used to my color scheme that the colors threw me off