Skip to content

Conversation

@ayamir
Copy link
Owner

@ayamir ayamir commented Jan 2, 2025

This patch lazy loads user's customized snippets from lua/user/snips.
The usage is copy lua/snips to lua/user/snips/ first and create your snippets like the existing examples, i.e.:

cd ~/.config/nvim
mkdir -p ./lua/user/snips/
cp -vr ./snips/* ./lua/user/snips/
# remove existing snippets
cd ./lua/user/snips/snippets/
rm -rf *

Add your customized snippets for go.json like this:

touch go.json
nvim go.json
{
  "if err": {
    "prefix": "ie",
    "body": "if err != nil {\n\t$1\n}\n$2",
    "description": "Snippet for if err"
  }
}

Then you can use it:
image

Close #1385 @greggh

@ayamir ayamir requested a review from charliie-dev January 2, 2025 02:54
Copy link
Collaborator

@charliie-dev charliie-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@charliie-dev charliie-dev merged commit 0a93567 into main Jan 2, 2025
4 checks passed
@charliie-dev charliie-dev deleted the feat/custom_snippets branch January 2, 2025 08:33
@greggh
Copy link

greggh commented Jan 2, 2025

I really don't know what to say. That was so fast. Thank you!

Deg2v pushed a commit to Deg2v/nvimdots that referenced this pull request Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snippets in the lua/user folder.

4 participants