ohnoimdead

ohnoimdead

Heya, apologies in advance if there’s a better place to ask this, happy to move it if so.

I’m just playing around with AstroNvim (GitHub - AstroNvim/AstroNvim: AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins · GitHub) and trying to get all of elixir, heex, and TailwindCSS working similarly to VSCode with the usual plugins. I’m 90% sure this is my lack of understanding of how to configure neovim to use the right language server and/or treesitter for .ex and .heex, but I’m a bit stuck at the moment. Curious if anyone else has gotten this all working? And to head off the simple questions: I have tailwindcss and elixirls with lsp and elixir and heex with ts. All the elixirls stuff works great in .ex, and all of tailwindcss works in .html, but it doesn’t all want to work together in .ex inside ~H sigils or in .heex.

I’ll keep poking at it until I find the right knobs and switches, but if someone is like: oh yeah, just do [obvious thing that I’m missing], then that would be super helpful.

Cheers!

Showing Posts 1 to 10

Sebb

Sebb

I tried this with LunarVim this weekend and gave up very frustrated. You have to be very intelligent for this or make configuring a editor your hobby. Both not for me. I’d love to use a real vim for Elixir, but now I’ve settled with vscode-neovim which seem fine.

dimitarvp

dimitarvp

That’s one of my very few criticisms towards VIM and Emacs – sub-modes / sub-file highlighting.

At one point I just figured “frak it” and started working without those, still in VIM and Emacs. If it gets too frustrating I’ll just hop into VSCode temporarily; it’s 50x easier to customize anyway.

100% agreed and that doesn’t apply only for sub-mode highlighting. It applies to a lot of stuff in both editors. I have been vocal here occasionally that I gave up on Emacs. I won’t be giving up on NeoVim / LunarVim anytime soon – they are, to me, much better than Emacs – but the culture of “keep hacking it and make it your own” (a culture I started to despise with time) is still there. It’s still much easier to “hack on” than Emacs though (again, IMO) so I’ll stick around. I already have a good idea how to customize NeoVim / LunarVim and I like it much better.

But yeah, they still need more work in some areas. Maybe that will come with time, in the meantime I chose to simply not care. :003:

Sebb

Sebb

With VSCode Neovim - Visual Studio Marketplace (not the default vscode-vim) you get a decent vim-experience inside vscode. You have access to plugins and :ex-mode.

This is my init.vim and I will be happy with that as soon I’ve got visual-multi running.
Note, that you have to execute :PlugInstall to install plugins in nvim (does not seem to work in vscode).

For Elixir I have the “normal” vscode-plugins installed which coexist with no problems. See Formatting Phoenix HEEx Templates in VS Code

let mapleader = " "

if !filereadable($HOME . "/.config/nvim/autoload/plug.vim")
  echo "~≥ Installing vim-plug \n"
  silent !curl -fLo $HOME/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  let shouldInstallBundles = 1
endif

call plug#begin()
Plug 'asvetliakov/vim-easymotion'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
call plug#end()

map <Leader>f <Plug>(easymotion-bd-f)
map <Leader>L <Plug>(easymotion-bd-jk)
map <Leader>w <Plug>(easymotion-bd-w)
ohnoimdead

ohnoimdead OP

Well poop, after spending a couple of hours on it I think I have to give up for now, sadly. My only guess is that the configuration for elixirls in the (very excellent) vscode ElixirLS plugin is doing something to make everything work well together. :person_shrugging:

Damn you neovim! Why do you make it so hard to love you??

ohnoimdead

ohnoimdead OP

Yeah, same here (everything works great in VSCode with the usual plugins). Although I just use the regular ol’ Vim plugin… I might check out the Neovim one at some point. Anyway, this was more a curiosity. I think AstroNvim is very cool and probably works great for some of the languages that maybe have a bit more coverage on the integration with the IDE front. It’s fine though, VSCode serves my needs beautifully and I really have no complaints.

Sebb

Sebb

the default plugin is great. Everything just works.
But I need ex-mode, eg for applying a macro to all selected lines like :'<,'>norm @a

I wonder where the vim-thusiasts are … as there is a way to do it for sure (just not for mere mortals)

groig

groig

I use neovim configured from scratch and it wasn’t difficult to get it all working. Here are the relevant parts of my config:

Treesitter options:

{
        ensure_installed = "all",
        highlight = {
            enable = true,
        },
}

Lsp configs for tailwind and elixir-ls

    lspconfig.elixirls.setup(vim.tbl_extend("force", lsp_options, {
      cmd = { "elixir-ls" },
      settings = { elixirLS = { dialyzerEnabled = false } },
    }))

    lspconfig.tailwindcss.setup(vim.tbl_extend("force", lsp_options, {
      filetypes = { "html", "elixir", "eelixir", "heex" },
      init_options = {
        userLanguages = {
          elixir = "html-eex",
          eelixir = "html-eex",
          heex = "html-eex",
        },
      },
      settings = {
        tailwindCSS = {
          experimental = {
            classRegex = {
              'class[:]\\s*"([^"]*)"',
            },
          },
        },
      },
    }))

Some screenshots showing the highlight and the elixir-ls and tailwind completions both inside ~H sigils and heex files:

Here is a very trimmed down version of kickstart.nvim with working treesitter highlight, completion and snippets similar to how it works on my config

17
Post #7
Sebb

Sebb

this comment is like all the vim-related documentation. Good for people already expert on the matter.

dimitarvp

dimitarvp

Ohhh, I’ll try this and report back (if I find a HEEX file to try it on :smiley:).

Sebb

Sebb

would be nice if you enable others less blessed to also do it if its working for you.

@ohnoimdead you did mark it as solution. Do you have a config now that does all you want? Can you share it?

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews