0

I have friendly-snippets(https://github.com/rafamadriz/friendly-snippets), which works.

The (python) snippets that it uses are installed at

$HOME/.local/share/nvim/site/pack/packer/start/friendly-snippets/snippets/python

And they work, but I would like to add some of my own snippets to this.

If I edit some of the files in:

> tree python/
python/
├── base.json
├── comprehension.json
├── debug.json
├── python.json
└── unittest.json

Then they work, but ideally I would like to have my custom snippets stored in a different location than where the default snippets are.

So my question is - how can I add custom snippets in $HOME/dotfiles/neovim/nvim (or whatever), for a particular language (in this case python), to be used with the friendly-snippets plugin.

If there's any information missing please let me know and I'll add it

1 Answer 1

0
  1. Open the package.json file in your friendly snippets directory. In your case, it's $HOME/.local/share/nvim/site/pack/packer/start/friendly-snippets
  2. Search for your required language.
  3. Edit or Create new the path to your required snippets file. for example, you may find
{
    "language": "python",
    "path": "./snippets/python/base.json"
},

Change the path here. Done.

2
  • 1
    @Friedrich is it alright now? Commented Aug 14, 2023 at 7:28
  • It's perfect ;-)
    – Friedrich
    Commented Aug 14, 2023 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.