chrisgrieser / nvim-scissors

Automagical editing and creation of snippets.
MIT License
377 stars 4 forks source link

[Bug]: snippetDir does not expand ~ #5

Closed zolrath closed 9 months ago

zolrath commented 9 months ago

Bug Description

Hello! With a fairly simple setup defining my snippetDir to be relative to my home directory: ~/.config/nvim/snippets/ the snippet directory is not found.

return {
  {
    "L3MON4D3/LuaSnip",
    config = function()
      require("luasnip.loaders.from_vscode").load({ paths = "~/.config/nvim/snippets" })
    end,
  },
  {
    "chrisgrieser/nvim-scissors",
    dependencies = "nvim-telescope/telescope.nvim",
    opts = {
      snippetDir = "~/.config/nvim/snippets",
    },
}

Instead, when I go to use or edit a snippet it auto creates a ~/.config/nvim/snippets directory structure inside the current folder.

Expected behavior

The path is expanded so ~ results in my users home folder, leading the plugin to the same folder used for my custom snippets. LuaSnip successfully expands and uses the correct snippets.

Relevant Screenshot

No response

To Reproduce

  1. Create a snippets folder in a ~/subdirectory/snippets
  2. Set this folder as your snippetsDir
  3. Open a different folder, say ~/code/some-project
  4. See that nvim-scissors doesn't find your snippets and instead creates a ~/subdirectory/snippets folder in the cwd when trying to use it.
  5. Carefully remove the newly created ~ folder with ./~, ensuring you do not accidentally rm ~ and delete your user folder.

neovim version

NVIM v0.9.5

Make sure you have done the following

chrisgrieser commented 9 months ago

Right, forgot about ~. Should be fixed now 👍