eddy147

eddy147

How to setup doom emacs elixir yasnippets?

I am trying to have a proper setup for Elixir in doom emacs.
I have code completion with LSP, the next thing I would like to have is the help of yasnippets.
But I have no clue how to set it up, nor can I find any documentation online about it, specifically doom-emacs and elixir-yasnippets.
I do not know how to install it: I have enabled snippets in init.el, and installed elixir-yasnippets with M-x package install.
But when I create a new module, or a new function, I do not know how to invoke the snippets, or do I have to create snippets first, and again I can not find any documentation about it.

Thanks for your help.

Marked As Solved

MarkusSagen

MarkusSagen

@eddy147 Generally, you are more likely to find users that can help with Doom Emacs for Elixir in the Doom Discord than Elixir users that also uses Doom Emacs.

To enable snippets in Doom Emacs, you can in your init.el file uncomment the snippets-section.
To add your own yasnippets, there are multiple ways of doing this, but here is one example.
In your config.el, add:

(setq yas-snippet-dirs (append yas-snippet-dirs
                               '("~/.doom.d/snippets"))) ;; replace with your folder for snippets

Sync your configs and you can now create new snippets with M-x yas-new-snippet (keybound to C-c & C-n). Save the snippet with C-c C-c and type: elixir-mode.

Now you will have a new folder with snippets that can be found in the Elixir major mode.
Enabling snippets will give the added benefit of adding all the snippets from Doom-snippets.

For more info I would recommend this page and these two videos:

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement