Spacemacs - General Discussion, Blog Posts, Wiki



Is there a shortcut for embedded Elixir?

<%= %>

Currently you have to type the opening <%= and it will automatically add the closing %> but this is more key presses than in other editors.

Also, html tags - usually you can type something like p then tab and it will give you the opening and closing <p> tags… but this doesn’t work in Spacemacs. Typing p seems to give you the option but pressing enter doesn’t seem to do anything :confused:


The p + tab is done using emmet mode and I got it working with eex, haml and react files. My .spacemacs file is pretty messy but I think I got it working with this customization or this one. Hope it helps.

And these lines are to enable it in react and haml.

  (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
  (setq web-mode-content-types-alist
        '(("jsx" . "\\.js[x]?\\'")))

  ;; Use emmet mode in other modes (React and Haml)
  (add-hook 'react-mode-hook 'emmet-mode)
  (add-hook 'haml-mode-hook 'emmet-mode)


What is necessary for supporting jump-to-definitions (SPC m g g)? I recently install GNU global tags to get this function to work in the Elixir layer. However, Spacemacs keeps asking for the Tags file even after I generated the tag file in the project root. Then I read Alchemist should be all I need. I feel I am holding it wrong.

Anyone have a helpful blog article or forum post on properly configuring Spacemacs/Elixir to jump to definitions and symbol searching?


I wrote about this on the erlang channel on Slack a while ago and was told that Alchemist may have issues not working with the latest Elixir. All you should need in a spacemacs setup is to add the Elixir layer and go and this used to work beautifully, but as I said I’ve had issues lately too.

For the time being I’m using neovim with Alchemist.vim instead and I’m having a good time. Then again, I usually switch back and forth every now and then, so I have no issue switching to neovim for a language or two.


@bill.c @gonz My jump to definition also seems broken, but you can use “dump-jump-go” instead, which is a separate package from Alchemist and works fine with Elixir. I’ve defined the following shortcut:

(defun dotspacemacs/user-config ()
  (spacemacs/set-leader-keys-for-major-mode 'elixir-mode "j d" 'dumb-jump-go)

This will define SPC m j d in Elixir mode.


perfect! thanks!!


Anyone attempting Language Server Protocol integration in their spacemacs yet? :slight_smile:

I don’t see much RLS action on the spacemacs repo yet.


Does anyone know a way to quickly navigate to a function defined in the current module by name?


SPC j i


Ah, perfect! Just what I was looking for. Thanks!


Do you use format-on-save? How are they using it?


You mean

  (add-hook 'elixir-mode-hook
            (lambda () (add-hook 'before-save-hook 'elixir-format nil t)))

in your dotspacemacs/user-config ?


Yes, this work but sometimes no work.

If no work, I use SPC p ! and I execute mix format.